akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
typedef long long ll;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
#define ios ios_base::sync_with_stdio(0) ; cin.tie(0) ; cout.tie(0)
#define so sizeof
#define pb push_back
#define vl vector<ll>
#define el endl;cout.flush()
#define be begin()
#define fi first
#define se second
#define br break
#define sz size()
#define en end()
#define ro return 0
#define br break
#define con continue;
#define um unordered_map<ll,ll>
#define ms(x) memset(x , 0 , so x)
#define all(x) (x).be , (x).en
#define rall(x) (x).rbegin() , (x).rend()
#define acc(x) accumulate((x).be , (x).en , 0)
#define forn(i,a,b) for(ll i=a;i<=b;++i)
#define forr(i,a,b) for(ll i=a;i<b;++i)
#define rng_58 mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define vll vector<pair<ll,ll> >
#define pll pair<ll,ll>
#define plll pair<ll,pair<ll,ll>>
#define plvl pair<pair<ll,ll> ,ll>
#define mp make_pair
int main()
{
    ios;
    ll l , b , h ;
    cin >> l >> b >> h ;
    if(l % 2 == 0 or b % 2 == 0 or h % 2 == 0 ) {
        cout <<  0 << el ;
        ro ;
    }
    else{
        ll mid1 = l/2 , mid2 = b/2 , mid3 = h / 2;
        /// paint along length
        cout << min(l*b , min(b*h , l*h));
        cout << el ;
         ro ;
    }
}



















Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
 public static void main(String[] args){
  Scanner sc = new Scanner(System.in);
  int n = sc.nextInt();
  int num[] = new int[n];
  for(int i = 0 ; i < n ; i++)
   num[i] = sc.nextInt();
  for(int i = n - 1 ; i > 0 ; i--)
   System.out.print(num[i] + " ");
  System.out.println(num[0]);
 }
}


Measured memory_bytes: 26304
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long ll;
int main(){
  string s,t;
  ll s_ele[26]={},t_ele[26]={},sum,ind,tmp,val;
  vector<ll> point[26];
  cin >> s >> t;
  for(int i=0;i<s.size();i++){
    s_ele[s[i]-'a']++;
    point[s[i]-'a'].push_back(i);
    point[s[i]-'a'].push_back(i+s.size());
  }
  for(int i=0;i<t.size();i++){
    t_ele[t[i]-'a']++;
  }
  for(int i=0;i<26;i++){
    if(t_ele[i]>0&&s_ele[i]==0){
      cout << "-1\n";
      return 0;
    }
    sort(point[i].begin(),point[i].end());
  }
  sum = point[t[0]-'a'][0]+1;
  ind = point[t[0]-'a'][0];
  for(int i=1;i<t.size();i++){
    tmp = t[i]-'a';
    auto it = upper_bound(point[tmp].begin(),point[tmp].end(),ind);
    val = *it;
    sum += val-ind;
    ind = val;
    ind %= s.size();
  }
  cout << sum <<endl;
}


Measured memory_bytes: 2800
// AOJ q0040
// YAMADA Terushige
// 2013.5.6

#include<iostream>
#include<sstream>
#include<string>
#include<cctype>
 
using namespace std;
const int N = 26;

char decode(const char c,const int a,const int b){
  if(islower(c)){
    //    int t = ((c - 'a') + N - b)%N;
    int t = c - 'a' - b;
    while(t%a != 0){
      t += N;
    }
    return 'a' + ((t/a) % N) ;
  }
  return c;
}

int gcm(int a,int b){
  if (b==0) return a;
  else return gcm(b,a%b);
}
 
int main(){
  string s,wd;
  int n;
  cin >> n;
  getline(cin,s);
  int a,b;

  for(int i=0;i<n;i++){
    getline(cin,s);
    string ans = s;
    istringstream istr;
    istr.str(s);
    while(istr >> wd){
      if(wd.size()==4){
	string dd = wd;
	for(a=1;a<N;a++){
	  if(gcm(a,N) != 1) continue;
	  for(b=0;b<N;b++){
	    for(int j=0;j<4;j++)
	      dd[j] = decode(wd[j],a,b);
	    if(dd == "this" || dd == "that")
	      goto solved;
	  }
	}
      }
    }
  solved:
    //    istr.clear();
    for(int k=0;k<s.size();k++)
      ans[k]=decode(s[k],a,b);
    cout << ans << endl;
  }
}


Measured memory_bytes: 1224
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    ll n;
    cin>>n;
    int i;
    ll A[n+1];
    for(i=0;i<=n;i++)
    cin>>A[i];
    ll B[n+1];
    ll ans=0;
    B[n]=A[n];
    for(i=n-1;i>=0;i--)
    B[i]=B[i+1]+A[i];
    B[0]=1;
    for(i=1;i<=n;i++)
    {
        B[i]=min(B[i],2*(B[i-1]-A[i-1]));
    }
    for(i=0;i<=n;i++)
    {
        if(B[i]<A[i])
        {
            ans=-1;
            break;
        }
        ans+=B[i];
    }
    cout<<ans<<"\n";
    return 0;
}

Measured memory_bytes: 5160
package main

import (
	"bufio"
	"fmt"
	"os"
)

func main(){
	r := bufio.NewReader(os.Stdin)
	w := bufio.NewWriter(os.Stdout)
	defer w.Flush()

	var N, M int
	fmt.Fscan(r, &N, &M)
	x := make([]int, M)
	y := make([]int, M)
	for i:=0; i < M; i++{
		fmt.Fscan(r, &x[i], &y[i])
		x[i]--;y[i]--;
	}
	maybe := make([]bool, N)
	cnt := make([]int, N)
	for i:=0; i < N; i++{
		maybe[i] = false
		cnt[i] = 1
	}
	maybe[0] = true
	for i:=0; i<M; i++{
		cnt[x[i]]--
		cnt[y[i]]++
		maybe[y[i]] = maybe[y[i]] || maybe[x[i]]
		if(cnt[x[i]]==0){
			maybe[x[i]] = false
		}
	}
	ans := 0
	for i:= 0; i < N; i++{
		if(maybe[i]){
			ans++
		}
	}
	fmt.Println(ans)




}

Measured memory_bytes: 5452
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
using namespace std;
const long long mod=998244353;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const long double EPS=1e-10;
const long double PI=acos(-1.0);
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
long double ABS(long double a){return max(a,-a);}
long long inv[1100000];
long long fact[1100000];
long long finv[1100000];
long long C(int a,int b){
	if(a<b||b<0)return 0;
	return fact[a]*finv[b]%mod*finv[a-b]%mod;
}
int main(){
	long long n,a,b,k;
	scanf("%lld%lld%lld%lld",&n,&a,&b,&k);
	fact[0]=finv[0]=1;
	inv[1]=1;
	for(int i=2;i<1100000;i++){
		inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
	}
	for(int i=1;i<1100000;i++){
		fact[i]=fact[i-1]*i%mod;
		finv[i]=finv[i-1]*inv[i]%mod;
	}
	long long ret=0;
	for(int i=0;i<=n;i++){
		long long tot=a*i;
		long long rem=k-tot;
		if(rem<0)continue;
		if(rem%b)continue;
		long long p=rem/b;
		if(p>n)continue;
		ret=(ret+C(n,i)*C(n,p))%mod;
	}
	printf("%lld\n",ret);
}


Measured memory_bytes: 26112
#include<bits/stdc++.h>
using namespace std;

#define fi first
#define se second
#define long long long
typedef pair<int,int> ii;

long gcd(long a, long b) {return (b == 0)? a : gcd(b, a%b); }

int main()
{
	// freopen("input.in", "r", stdin);

	long a, b;
	scanf("%lld %lld", &a, &b);
	printf("%lld\n", a*b/gcd(a,b));

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define RREP(i,n) for(int i=n;i>=0;i--)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
typedef long long ll;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//const ll INF = 1LL << 60;
//const int INF = 1001001001;

int main(void){
    int k,x;
    cin >> k >> x;
    for(int i=x-(k-1);i<=x+(k-1);i++)
        printf("%d ",i);

    return 0;
}

Measured memory_bytes: 3732
#include <bits/stdc++.h>

using namespace std;

int main()
{
    int sum = 0;
    int N;
    cin >> N;
    //int a[10000];
    for(int i = 0; i < N; i++){
      //  cin >> a[i];
        int a ;
        cin >> a;
        int n = 0;
        while(a%2 == 0){
            a/=2;
            n++;
        }
        sum+=n;
    }
    cout << sum << endl;


    return 0;
}

Measured memory_bytes: 256
p = int(input())
a = list(map(int, input().split()))

list_size = p-1

f_list = [1] * list_size
f_r_list = [1] * list_size

for i in range(list_size - 1):
	f_list[i + 1] = int((f_list[i] * (i + 2)) % p)

f_r_list[-1] = pow(f_list[-1], p - 2, p)

for i in range(2, list_size + 1):
	f_r_list[-i] = int((f_r_list[-i + 1] * (list_size + 2 - i)) % p)

def comb(n, r):
	if n < r:
		return 0
	elif n == 0 or r == 0 or n == r:
		return 1
	else:
		return (((f_list[n - 1] * f_r_list[n - r - 1]) % p) * f_r_list[r - 1]) % p 

pows = [[1] for x in range(p)]
for i in range(p):
	for _ in range(p-1):
		pows[i].append((pows[i][-1] * i) % p)

ans = [0 for _ in range(p)]
for i, x in enumerate(a):
	if x == 0:
		continue
	ans[0] += 1
	ans[0] %= p
	for j in range(p):
		ans[j] -= pows[(p-i)%p][p-1-j] * comb(p-1, j)
		ans[j] %= p

print(*ans)

Measured memory_bytes: 117980
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define N 100000
ll p[100000],arr[100000];
ll j=0;

void cal(ll n){
  ll a=2;
  while(sqrt(n)>=a){
    if(n%a==0){
      arr[j]=a;
      p[j]++;
      n/=a;
      // cout<<n<<endl;
    }else{
      if(arr[j]!=0){/*cout<<p[j]<<" "<<arr[j]<<endl;*/ j++;}
      a++;
    }
  }
  if(n==arr[j]) p[j]++;
  else{
  arr[j+1]=n;
  p[j+1]++;
  }
}
int main(){
  ll n,z;
  ll ans=1;
  cin>>n>>z;
  cal(z);
  for(int i=0;i<100000;i++){
    if(p[i]/n != 0) ans*=pow(arr[i],p[i]/n);
  }
  cout<<ans<<endl;
  return 0;
}
  


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define Rep(i,j,n) for(int i=j; i<n; i++)
#define rep(i,n) for(int i=0; i<n; i++)
#define PI 3.14159265359
#define INF 1000100100//000000000
#define MOD 1000000007
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define P pair<int, int>
#define PP pair<P,P>
#define T tuple<int,int,int> 
using namespace std;

int main(){
    int n; cin >> n;
    vector<int> li(n);
    rep(i,n) cin >> li[i];
    int one[n][20];
    vector<vector<int> > wo(20);
    rep(i,n){
        int now=li[i];
        rep(j,20){
            if(now%2==1){
                one[i][j]=1;
                wo[j].push_back(i);
            }
            else one[i][j]=0;
            now/=2; 
        }
    }

    ll ans=0;
    int right=n-1;
    for(int i=n-2; i>=0; i--){
        int tmp=n;
        rep(j,20){
            if(!one[i][j]) continue;
            int l=-1;
            int r=wo[j].size();
            while(l+1<r){
                int c=(l+r)/2;
                if(wo[j][c]>i) r=c;
                else l=c;
            }
            if(r!=wo[j].size()) tmp=min(tmp,wo[j][r]);
        }
        tmp--;
        if(tmp<right) right=tmp;
        ans+=right-i;
    }

    cout << ans+n << endl;
    return 0;
}


Measured memory_bytes: 27684
#include<functional>
#include<algorithm>
#include<iostream>
#include<utility>
#include<string>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#include<deque>
#include<map>
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,x,n) for(int i=x;i<n;i++)
#define all(v) (v).begin(),(v).end()
#define pf push_front
#define pb push_back
#define int long long
using namespace std;
const int INF=1000000007;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};



signed main(){
  int n,a;
  cin>>n>>a;
  cout<<n*n-a<<endl;


  return 0;
}


Measured memory_bytes: 256
'use strict'
const main = arg => {
	const input = arg.trim().split("\n").slice(1, arg.trim().split("\n").length);
	for(let i = 0 ; i < input.length ; i++) {
		console.log(input[i])
		console.log(input[i])
	}
}   
main(require('fs').readFileSync('/dev/stdin', 'utf8'))

Measured memory_bytes: 9264
#include<bits/stdc++.h>
using namespace std ;
#define ll long long
#define pb push_back
#define f first
#define s second

int  main() {
    ll a , b ;
    cin >> a >> b ;
    if (b%2==0 and a*2<=b and a*4>=b) cout << "Yes\n" ;
    else  cout << "No\n" ;


}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;

int main(void){
    vector<int> a(3);
    for(int i=0; i<3; i++) cin >> a[i];
    sort(a.begin(), a.end());
    cout << (a[1] - a[0]) + (a[2] - a[1]) << endl;
    return 0;
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using ld = long double;

#define ALL(a) (a).begin(),(a).end()
#define CHMIN(a, b) a = min((a),(b))
#define CHMAX(a, b) a = max((a),(b))
const int INF = 1e9;
const int MOD = 1e9 + 7;

signed main() {
    int n, a;
    cin >> n >> a;
    cout << n * n - a << endl;
    return 0;
}

Measured memory_bytes: 256
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    n=INT()
    k=INT()
    ct=1
    for i in range(n):
        ct=min(ct*2,ct+k)
    print(ct)
if __name__ == '__main__':
    do()

Measured memory_bytes: 3064
K = int(input())
cand = [[1, 2, 3, 4, 5, 6, 7, 8, 9]]
for _ in range(9):
    tmp = []
    for v in cand[-1]:
        if v%10 != 0:
            tmp.append(v*10 + (v%10-1))
        tmp.append(v*10 + (v%10))
        if v%10 != 9:
            tmp.append(v*10 + (v%10+1))
    cand.append(tmp)
ans = []
for i in range(len(cand)):
    for v in cand[i]:
        ans.append(v)
ans = sorted(ans)
print(ans[K-1])

Measured memory_bytes: 15144
#include <bits/stdc++.h>
using namespace std;

#define fastIO \
ios_base::sync_with_stdio(false); cin.tie(NULL);
#define endl "\n"
#define ll long long
#define MOD 1000000007
#define pb push_back
#define ff first
#define ss second
#define mp make_pair

int main(){
	int n, t;
	cin >> n >> t;
	vector <int> adj[n+1];
	vector <int> p(n+1, 0);
	for(int i=0;i<n-1;i++){
		int u, v;
		cin >> u >> v;
		adj[u].push_back(v);
		adj[v].push_back(u);
	}
	while(t--){
		int x, y;
		cin >> x >> y;
		p[x] += y;
	}
	
	queue <int> q;
	bool vis[n+1] = {false};
	q.push(1);
	vis[1] = true;
	while(!q.empty()){
		int curr = q.front();
		q.pop();
		for(auto i = adj[curr].begin(); i!=adj[curr].end(); ++i){
			if(!vis[*i]){
				vis[*i] = true;
				p[*i] += p[curr];
				q.push(*i);
			}
		}
	}
	for(int i=1;i<=n;i++)	cout << p[i] << " ";
	cout << endl;
	return 0;
}

Measured memory_bytes: 15732
#include<bits/stdc++.h>
constexpr long long INFL = 1LL << 60;
constexpr int INF = 1 << 30;

using namespace std;

using ll = long long;
using P = tuple<int, int>;
using iarr = valarray<int>;

int main()
{
    int a,b;
    cin >> a >> b;
    if(a == b){
        cout << "Draw" << endl;
        return 0;
    }

    if(a == 1){
        cout << "Alice" << endl;
    }else if(b == 1){
        cout << "Bob" << endl;
    }else if(a > b){
        cout << "Alice" << endl;
    }else{
        cout << "Bob" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define db(x)	{ cerr << #x << " = " << x << endl; }

int32_t main(){
	int s,w; cin>>s>>w;
	if(w>=s) {cout<<"unsafe";}
	else {cout<<"safe";}
return 0;
}
// g++ -std=c++17 -Wshadow -Wall -o "sol" "sol.cpp" -g -fsanitize=address -fsanitize=undefined -D_GLIBCXX_DEBUG

Measured memory_bytes: 3612
#include<bits/stdc++.h>
using namespace std;

int main(){
  int n,m,t;
  int time;
  int a[105];

  cin >> n >> m >> t;
  
  for(int i=0;i < n;i++){
    cin >> a[i];
  }
  int d[105]={};
  for(int i=0;i < n-1;i++){
    d[i] = a[i+1]-a[i];
  }
  time = 0;
  for(int i=0;i < n-1;i++){
    if(d[i]-2*m > 0) time += d[i]-2*m;
  }
  time += max(t-a[n-1]-m,0);
  
  cout << time+a[0]-m << endl;
  return 0;
}


Measured memory_bytes: 3136
import sys
S = input()
if S != S[::-1]:
  print("No")
  sys.exit()
N = len(S)
SS = S[:(N - 1) // 2]
if SS != SS[::-1]:
  print("No")
  sys.exit()
SSS = S[(N + 3) // 2 - 1:]
if SSS != SSS[::-1]:
  print("No")
  sys.exit()
print("Yes")

Measured memory_bytes: 3064
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<string>
#include<cstring>
#include<algorithm>
#include<functional>
#include<vector>

using namespace std;
#define endl '\n'
#define pb push_back
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define MOD (1e9 + 7)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define REP(i,n) for(int i = 0;i < (n);i++)
#define FOR(i,a,b) for(int i = (a);i <= (b);i++)
#define YES(n) cout << ((n) ? "YES" : "NO" ) << endl
#define Yes(n) cout << ((n) > "Yes" : "No" ) << endl


typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;

template <class T = int> T in() { T x; cin >> x; return (x); }
template <class T = int> void out(T x) { cout << (x) << endl; }

int gcd(int a, int b) { return b ? gcd(b, a%b) : a; }

void solve() {

	int n, i;
	cin >> n >> i;

	out(n - i + 1);

	return;
}

int main() {

	cin.tie(0);
	ios::sync_with_stdio(false);

	solve();

	return 0;

}

Measured memory_bytes: 256
from itertools import product
N = int(input())
said = [[-1] * (N+1) for _ in range(N+1)]

for a in range(N):
    K = int(input())
    for _ in range(K):
        x, y = map(int, input().split())
        said[a][x - 1] = y

ans = 0
for cand in product(range(2), repeat=N):
    isOK = True

    for i, c in enumerate(cand):
        if not c:
            continue
        A = said[i]
        for j in range(N):
            if i == j or A[j] == -1:
                continue
            if cand[j] != A[j]:
                isOK = False
                break

    if isOK:
        ans = max(ans, sum(cand))

print(ans)


Measured memory_bytes: 3064
a, b, c = map(int, input().split())
k = int(input())

for i in range(k + 1):
    for j in range(k + 1 - i):
        for l in range(k + 1 - i - j):
            if c * 2 ** l > b * 2 ** j > a * 2 ** i:
                print('Yes')
                exit()

print('No')

Measured memory_bytes: 61848
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int const NMAX = int(1e5);
int const INF = int(2e9);

int main() {
    int dp[NMAX];

    int n, k;
    cin >> n >> k;
    vector<int> h(n);
    for (int i=0; i<n; ++i) cin >> h[i];

    fill(dp, dp+NMAX, INF);
    dp[0] = 0;
    dp[1] = abs(h[1] - h[0]);
    for (int i=2; i<n; ++i) {
        for (int j=max(0,i-k); j<i; ++j) {
            dp[i] = min(dp[i], dp[j]+abs(h[i]-h[j]));
        }
    }

    cout << dp[n-1] << endl;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
long long int gcd(long long int a , long long int b)
{
    if(b==0)
    {

        return a;
    }
    return gcd(b,a%b);


}
long long int maxix(long long int a,long long int b)
{
    if(a>b)
    {

        return a;
    }
    return b;

}
long long int minix(long long int a,long long int b)
{

    if(a<b)
    {

        return a;
    }
    return b;
}



int main()
{

int n;
cin>>n;
int a = n%10;
if(a==2||a==4||a==5||a==7||a==9)
{

    cout<<"hon";
}
else if(a==0||a==1||a==6||a==8)
{

    cout<<"pon";
}
else{
    cout<<"bon";
}

return 0;
}


Measured memory_bytes: 3608
a = int(input())
b = int(input())
c = int(input())
x = int(input())

ans = 0

for i in range(a+1):
  for j in range(b+1):
    for k in range(c+1):
      if 500*i + 100*j + 50*k == x:
        ans += 1
        
print(ans)

Measured memory_bytes: 9064
#include <iostream>
#include <algorithm>

using namespace std;

#define s(a) a.size()
#define push(a,b) a.push_back(b)
 
int main(){
    string RED,GREEN,up;
 
    while(cin >> RED , RED != "-"){
	string ans = "";
	int R = 0,G = 0,U = 0;   
	int t = 0;   
 
	cin >> GREEN >> up;
	while(R < s(RED) || G < s(GREEN) || U < s(up)){
	    if(t%2==0){
		if(GREEN[G] != up[U]){
		    push(ans,GREEN[G]);
		    G++;
		}
		else{
		    G++;U++; t++;
		}
	    }
	    else{
		if(RED[R] != up[U]){
		    push(ans,RED[R]);
		    R++; t++;
		}
		else{
		    R++;U++;
		}
	    }
	}
	cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 3144
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vll = vector<long long>;
using vp = vector<pair<int, int>>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvll = vector<vector<long long>>;
template<class T> inline bool chmax(T &a, T b) { if (a<b) {a=b; return 1;} return 0;}
template<class T> inline bool chmin(T &a, T b) { if (b<a) {a=b; return 1;} return 0;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    string s;
    cin >> s;
    int n = sz(s);
    string ans;
    rep(i, n) {
        if (i % 2 == 0) ans += s[i]; 
    }
    cout << ans << endl;
}

Measured memory_bytes: 592
#include <stdio.h>
#include <stdlib.h>

typedef long long ll;

int N;
int A[200010];

ll f(const ll b){
  ll res = 0;
  for (int i = 0; i < N; ++i) {
    res += abs(A[i] - (b + i + 1));
  }
  // printf("f: %lld\n", res);
  return res;
}

int main(void){
  scanf("%d", &N);
  for (int i = 0; i < N; ++i)
    scanf("%d", &A[i]);

  ll l = -2e9;
  ll r = 2e9;
  for (int i = 0; i < 100; ++i) {
    ll l2 = (l * 2 + r) / 3;
    ll r2 = (l + r * 2) / 3;
    ll fl2 = f(l2);
    ll fr2 = f(r2);
    if (fl2 < fr2)
      r = r2;
    else
      l = l2;
    // printf("l: %d, r: %d\n", l, r);
  }
  // printf("c: %d, ans:%lld\n", (l + r) / 2, f((l + r) / 2));
  printf("%lld\n", f((l + r) / 2));
}


Measured memory_bytes: 896
l, r = map(int, input().split())
def doit(l, r):
#  l = l % 2019
#  r = r % 2019
#  if r <= l:
#    r += 2019
  res = 2018
  for x in range(l, r):
    for y in range(x + 1, r + 1):
      #print(x, y, file=sys.stderr)
      res = min(res, (x * y) % 2019)
      if res == 0:
        return 0
  return res % 2019

print(doit(l, r))


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<ll>;
using vs = vector<string>;
#define  rep(i,n) for(ll i = 0; i < (n); ++i)
#define  red(i,n) for(ll i = (n)-1; i >= 0; --i)
#define  all(a)   begin(a),end(a)
#define  pb(a)    push_back(a)
#define  yn(a)    cout << ( (a)?"Yes\n":"No\n" );
inline ll gcd(ll a,ll b) { return b?gcd(b,a%b):a; }
const ll INF = 1e9+9, LINF = 1e18;


int main()
{
    int n;
    cin>>n;
    cout<<(n<1000?"ABC":"ABD")<<endl;
    return 0;
}


Measured memory_bytes: 256
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

import numpy as np

N = int(readline())
XY = np.array(read().split(),np.int64)

X = XY[::2]; Y = XY[1::2]

dx = X[:,None] - X[None,:]
dy = Y[:,None] - Y[None,:]

dist_mat = (dx * dx + dy * dy) ** .5

answer = dist_mat.sum() / N
print(answer)

Measured memory_bytes: 12404
#include <stdio.h>
int main()
{
  int W,H,i,n;
  while(1)
  {
    scanf("%d %d",&H,&W);
    if(W==0 && H==0)break;
    if(H>=3 && W<=300){
    for(n=1;n<=W;n++)
    {
      printf("#");
    }
    printf("\n");
    for(i=1;i<=H-2;i++)
    {
      printf("#");
      for(n=1;n<=W-2;n++)
      {
        printf(".");
      }
      printf("#\n");
    }
    for(n=1;n<=W;n++)
    {
      printf("#");
    }
    printf("\n\n");
  }}
  return 0;
}

Measured memory_bytes: 588
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>

int compare_int(const void *a, const void *b)
{
    return *(int*)a - *(int*)b;
}

int main(void)
{
	//変数の宣言
	int w,h;
	static int p[100010];
	static int q[100010];
	static int pnum[100010];
	static int qnum[100010];
	int i,j,k;
	long long int ans;
	int flag=0;
	//データの読み込み
	scanf("%d %d",&w,&h);
	
	for(i=0;i<w;i++){
		scanf("%d",&p[i]);
	}
	for(i=0;i<h;i++){
		scanf("%d",&q[i]);
	}
	
//	printf("nは%dです\n", n);
//	printf("データの読み込み終了\n");
	//実際の処理
	
	qsort(p, w, sizeof(int), compare_int);
	qsort(q, h, sizeof(int), compare_int);
	
	i=0;
	j=0;
	while(flag==0){
		if(i<w&&j<h){
			if(p[i]<q[j]){
				pnum[i]=h-j+1;
//				printf("p=%d,pnum=%d\n",p[i],pnum[i]);
				i++;
			}else{
				qnum[j]=w-i+1;
//				printf("q=%d,qnum=%d\n",q[j],qnum[j]);
				j++;
			}
		}else if(i==w&&j!=h){
			qnum[j]=1;
			j++;
		}else if(j==h&&i!=w){
			pnum[i]=1;
			i++;
		}else{
			flag=1;
		}
	}
	ans=0;
	for(i=0;i<w;i++){
		ans=ans+(long long int)p[i]*pnum[i];
	}
	for(i=0;i<h;i++){
		ans=ans+(long long int)q[i]*qnum[i];
	}
	
//	printf("計算部分終了\n");
	
	//出力
	printf("%lld",ans);
	
	
//	printf("結果の出力終了\n");
	
}



Measured memory_bytes: 2164
#include <iostream>
#include <string>

using namespace std;

int main(void){
	int n;
	cin >> n;
	cin.ignore();
	for(int i=0;i<n;i++){
		string S;
		getline(cin,S);
		string::iterator it=S.begin();
		while(S.find("Hoshino") != -1 ){
			S.replace(S.find("Hoshino"),7,"Hoshina");
		}
		cout << S << endl;
	}
	return 0;
}

Measured memory_bytes: 1216
n = int(input())
ab = []
for _ in range(n):
    a,b = [int(x) for x in input().split()]
    ab.append([a,b])

ans = "Yes"
time = 0
AB = sorted(ab, key=lambda x: x[1])

for x in AB:
    time += x[0]
    if time > x[1]:
        ans = "No"
        break
print(ans)

Measured memory_bytes: 39648
#include <bits/stdc++.h>

using namespace std ;

#define sz(v) (int)v.size()
#define ll long long
#define all(v)  v.begin() , v.end()
#define rall(v)  v.rbegin() , v.rend()
#define pf push_front
#define pb push_back
#define fast FastInputOutput() ;
#define Clear( container , value ) memset( container , value , sizeof container )
#define PI acos( -1.0 )
#define forn( t , v , be , n ) for( t v = be ; v < n ; v++ )
#define fore( x , j ) for( auto x : j )
#define se second
#define fr first
//#define c_b fflush(stdin);

const ll Long_max = numeric_limits < ll > :: max() ;
const int Int_max = numeric_limits < int > :: max() ;

void File_input( string pathIn ) {
    freopen( pathIn.c_str(), "r", stdin ) ;
}

void File_output( string pathOut ) {
    freopen( pathOut.c_str(), "w", stdout ) ;
}

int msg() {
    srand( time( 0 ) ) ;
    vector < string > st = {
        "Wish everyone high ratings!",
        "Good luck!",
        "Have fun!",
        "Please, read all the problems!",
        "Go Go fight!"
    } ;
    cerr << st[ rand() % sz( st ) ] ;
    return 0 ;
}

void FastInputOutput() {
    ios_base :: sync_with_stdio( 0 ) ;
    cin.tie( 0 ) ;
    cout.tie( 0 ) ;
}

string str ;

int main() {
  cin >> str ;
  int len = str.find( 'A' ) ;
  reverse( all( str ) ) ;
  int las = str.find( 'Z' ) ;
  las = sz( str ) - las ;
  cout << abs( las - len ) ;
  return 0 ;
}


Measured memory_bytes: 640
def L(P,K,x):
  for i in range(K):
    t = input()
    try:
      P[t]+=1*x
    except:
      P[t]=1*x
  return P

P = {"":0}

N = int(input())
P = L(P,N,1)
M = int(input())
P = L(P,M,-1)
print(max(P.values()))

Measured memory_bytes: 38384
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <cstdio>
#include <string>
#include <cmath>
#include <queue>
#include <tuple>
#include <set>
#include <assert.h>
#include <sstream>
#include <string>
//#include <bits/stdc++.h>
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i,i0,n) for(int (i)=(i0);(i)<(n);(i)++)
#define FORR(i,i0,n) for(int (i)=(n)-1; (i)>=(i0);(i)--)
#define SORT(x) sort(x.begin(),x.end())
#define SORTR(x) sort(x.begin(),x.end(),greater <>())
#define rn return
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
using namespace std;
using ll = long long;
typedef std::pair<int,int> P;
//#include <boost/multiprecision/cpp_int.hpp>
//using bint = boost::multiprecision::cpp_int;



int main(){
    ll n,d,a;
    cin >> n >> d >> a;
    d = d*2ll;
    vector<P> p(n);
    rep(i,n) cin >> p[i].first >> p[i].second;
    SORT(p);
    ll tot = 0;
    ll damage = 0;
    ll ans = 0;
    queue<pair<ll,ll>> q;
    rep(i,n){
        ll x = p[i].first;
        ll h = p[i].second;
        
        while(q.size() && q.front().first < x){
            tot -= q.front().second;
            q.pop();
        }
        h -= tot;
        

        ll count = (max(0ll,h)+a-1)/a;
        ans += count;
        damage = count*a;
        tot+=damage;
        q.push(mp(x+d,damage));

        
    }
    cout << ans;
}


Measured memory_bytes: 5120
#include <bits/stdc++.h>

using namespace std;

#define fi first
#define se second
#define eb emplace_back
#define mt make_tuple
#define all(x) (x).begin(), (x).end()  
#define sz(x) int(x.size()) 
#define MOD 1000000007

typedef long long ll;
typedef pair <int, int> ii;
typedef pair <ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef long double ld;

const ll INF=63;
const int mxn=0;
bool DEBUG=0;

int cnt[10];

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    //freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
    string s;
    cin>>s;
    int n=s.length();
    for(int i=0; i<n; i++){
		cnt[s[i]-'0']++;
	}
	int sum = 0;
	for(int i=1; i<10; i++){
		sum += cnt[i]*i;
	}
	if(sum%9==0)cout<<"Yes"<<"\n";
	else cout<<"No"<<"\n";
}
	
// READ & UNDERSTAND
// ll, int overflow, array bounds, memset(0)
// special cases (n=1?), n+1 (1-index)
// do smth instead of nothing & stay organized
// WRITE STUFF DOWN


Measured memory_bytes: 3712
#include <bits/stdc++.h>
using namespace std;
#define INCANT cin.tie(0), ios::sync_with_stdio(false), cout << fixed << setprecision(20);
#define int long long
#define double long double
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define sz(x) (x).size()
#define all(x) (x).begin(), (x).end()
#define sortv(v) sort(all(v))
#define sortg(v) sort(all(v), greater<int>())
#define countv(v, c) count(all(v), c)
#define gcd __gcd
#define rep(i, m, n) for(int i=(int)(m);i<(int)(n);i++)
#define _rep(i, n) rep(i, 0, n)
#define rev(i, m, n) for(int i=(int)(m-1);i>=(int)(n);i--)
#define _rev(i, n) rev(i, n, 0)
#define each(i, n) for(auto&& i: n)
void in(){}
template<typename F, typename... R>
bool in(F& f, R&... r){
	if(cin >> f){in(r...);return true;}
	else{return false;}
}
#define inv(x) each(i, x) in(i)
#define out(x) cout << (x)
#define space() cout << " "
#define indent() cout << '\n'
void print(){}
template<typename F, typename... R>
void print(F f, R... r){out(f), indent(), print(r...);}
#define printv(x) each(i, x) out(i), space(); indent()
#define debughead(x) cerr << "Line " << __LINE__ << ": " << #x << ": "
#define debugout(x) cerr << (x) << " "
#define debugindent() cerr << '\n'
#define debug(x) debughead(x), debugout(x), debugindent()
#define YN(x) out((x) ? "YES" : "NO"), indent()
#define Yn(x) out((x) ? "Yes" : "No"), indent()
#define yn(x) out((x) ? "yes" : "no"), indent()
const int INF = 1e18;
const int MOD = 1e9 + 7;
const double EPS = 1e-15;
const double PI = acos(-1);
const int dx[] = {0, 0, 1, 0, -1, -1, 1, 1, -1};
const int dy[] = {0, -1, 0, 1, 0, -1, -1, 1, 1};
const string alphabet = "abcdefghijklmnopqrstuvwxyz";
const string ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
template<typename T>
bool chmax(T& a, T b){return (a = max(a, b)) == b;}
template<typename T>
bool chmin(T& a, T b){return (a = min(a, b)) == b;}
int lcm(int a, int b){return a / gcd(a, b) * b;}
int factorial(int a){return a < 2 ? 1 : factorial(a - 1) * a;}
int summation(int a){return a < 1 ? 0 : (a * a + a) / 2;}
int combination(int n, int r){
	int res = 1;
	rep(i, 1, r + 1){
		res *= n--, res /= i;
	}
	return res;
}
bool isPrime(int n){
	rep(i, 2, sqrt(n) + 1){
		if(i > 3){
			i++;
		}
		if(!(n % i)){
			return false;
		}
	}
	return true;
}
vector<int> divisor(int n){
	vector<int> ans;
	rep(i, 1, sqrt(n) + 1){
		if(!(n % i)){
			ans.pb(i);
			if(i * i < n){
				ans.pb(n / i);
			}
		}
	}
	return ans;
}
map<int, int> factorization(int n){
	map<int, int> ans;
	rep(i, 2, sqrt(n) + 1){
		if(i > 3){
			i++;
		}
		while(!(n%i)){
			ans[i]++, n /= i;
		}
	}
	if(n > 1){
		ans[n]++;
	}
	return ans;
}
int n, tmp, res = 0;
string s;
main(){INCANT;
	/*-------------------*/
	int A, B;
	in(A, B);
	res = -1;
	rev(i, 10000, 1) {
		if((A <= i * 0.08 && i * 0.08 < A+1) && (B <= i * 0.10 && i * 0.10 < B+1)) res = i;
	}
	print(res);
	/*-------------------*/
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;                void iosbase(void);
typedef  long long int     ll;      typedef long double                            db;
typedef  vector<int>       vi;      typedef priority_queue<int>                    MAXHEAP;
typedef  pair<ll, ll>    pii;     typedef priority_queue<int, vi, greater<int>>  MINHEAP;
#define  int               ll
#define  ff                first
#define  ss                second
#define  pb                push_back
#define  si(x)             (int)x.size()
#define  minv(m,n)         *min_element(m,n)
#define  maxv(m,n)         *max_element(m,n)
#define  deb(x)            cout<<"> "<<#x<<" : "<<x<<endl;
#define  mem(a,x)          memset(a,x,sizeof(a))
#define  rep(i,n)          for(int i=0;i<n;i++)
#define  prs(x,y)          fixed<<setprecision(y)<<x
#define  show(a)           for(auto x:a){cout<<x<<" ";}cout<<endl;
#define  showmap(a)        for(auto x:a){cout<<x.ff<<" "<<x.ss<<endl;}
#define  showstack(a)      while(!a.empty()){cout<<a.top()<<endl;a.pop();}
const int sz = 1e5 + 5;

int32_t main()
{
    iosbase(); int tt = 1;
    //cin>>tt;
    for (int t = 1; t <= tt; t++)
    {
        int n , d;
        cin >> n >> d;
        pii a[n];
        rep( i, n)
        {
            int x , y;
            cin >> x >> y;
            a[i] = {x , y};
        }
        // showmap(a);
        int ans = 0 ;
        rep( i , n)
        {
            if ( (( a[i].ff * a[i].ff) + (a[i].ss * a[i].ss ) ) <= d * d)
                ans++;
        }
        cout << ans << endl;
    }
    return 0 ;
}
void iosbase(void) {
    ios::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
#ifndef ONLINE_JUDGE
    freopen("in.txt", "r", stdin);
//freopen("in2.txt","r",stdin);
//freopen("out.txt","w",stdout);
#endif
}

Measured memory_bytes: 6776
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<deque>
#include<regex>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;i++)

typedef int long long ll;
using namespace std;
typedef pair<int,int> P;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
const ll MOD=1e9+7;
static const int MAX = 100;
static const int INF = (1<<23);
template<class T> T gcd(T a, T b){return b? gcd(b,a%b) : a;}
template<class T> T lcm(T a,T b){return a / gcd(a,b)*b;}

int main(){
    cout<<setprecision(16);
    double r;
    cin>>r;
    cout<<2*r*M_PI<<endl;






return 0;
}


Measured memory_bytes: 3760
#include <cstdio>
#include <cstring>
#include <string>
#include <iostream>
#include <algorithm>
using namespace std;

typedef long long ll;
const int maxn=1e5+5;

ll a[maxn],n,d[maxn];

int main()
{
	ll sum=0;
	scanf("%lld",&n);
	for(int i=0;i<n;i++)
	{
	    scanf("%lld",a+i);
	    sum+=a[i];
	}
	ll k=(1+n)*n/2;
	if(sum%k!=0)
	{
		printf("NO\n");
		return 0; 
	}
	k=sum/k;
	for(int i=0;i<n-1;i++)
	    d[i]=a[i+1]-a[i];
	d[n-1]=a[0]-a[n-1];
	for(int i=0;i<n;i++)
	{
		if(k==d[i])
		    continue;
		ll t=k-d[i];
		if(t<0||t%n!=0)
		{
			printf("NO\n");
			return 0;
		}
	}
	printf("YES\n");
	return 0;
}


Measured memory_bytes: 1792
package main

import(
	"fmt"
)

func isSecondSmall(a,b,c int)bool{
	if a>b{
		return b>c
	} else {
		return c>b
	}
}

func main(){
	var n int
	fmt.Scanln(&n)
	p:=make([]int,n)
	for i:=0;i<n;i++{
		fmt.Scan(&p[i])
	}
	ans:=0
	for i:=1;i<n-1;i++{
		if isSecondSmall(p[i-1],p[i],p[i+1]){
			ans++
		}
	}
	fmt.Println(ans)
}

Measured memory_bytes: 512
import java.util.*;
public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] xdata = new int[n];
		int m = sc.nextInt();
		int[] ydata = new int[m];
		int x = sc.nextInt();
		int y = sc.nextInt();
		int xmax = x;
		int ymin = y;
		for(int i=0; i<n; i++) {
			xdata[i]=sc.nextInt();
		}
		for(int i=0; i<m; i++) {
			ydata[i]=sc.nextInt();
		}
		for(int i=0; i<n; i++) {
			if(xmax<xdata[i]) {
				xmax = xdata[i];
			}
		}
		for(int i=0; i<m; i++) {
			if(ymin>ydata[i]) {
				ymin = ydata[i];
			}
		}
		if(xmax<ymin) {
			System.out.println("No War");
		}else {
			System.out.println("War");
		}
	}
}

Measured memory_bytes: 21716
#include <iostream>
#include <string>
using namespace std;
string s;
int k;
int main(){
    cin>>s>>k;
    bool a=(s[0]==s[s.size()-1]);
    long long cnt=0,x=0,y=0;
    for(int i=0,j=0;i<s.size();i=j){
        while(s[i]==s[j]&&j<s.size())j++;
        cnt+=(j-i)/2;
        if(i==0)x=j-i;
        if(j>=s.size())y=j-i;
        if(i==0&&j>=s.size()){
            cout<<(long long)s.size()*k/2;
            return 0;
        }
    }
    cnt*=k;
    if(a)cnt-=(x/2+y/2-(x+y)/2)*(k-1);
    cout<<cnt;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <sstream>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <complex>
#include <vector>
#include <cstdio>
#include <cmath>
#include <time.h>
#define all(c) ((c).begin(),(c).end())
#define rall(c) (c).rbegin(),(c).rend()
#define sort(v,n) sort(v,v+n)
#define vsort(v) sort(v.begin(),v.end())
#define vvsort(v) sort(v.begin(),v.end(),greater<int>())
#define ll long long
#define pb(a) push_back(a)
#define fi first
#define se second
#define inf 999999999
using namespace std;
const ll MOD = 1e9 + 7;
const double PI = acos(-1.0);
//---------------------------------------------------------------------------------------------//
int n;
int main() {
	while (cin>>n) {
		if (n == 0)return 0;
		int x[21], y[21];
		for (int i = 0; i < n; i++) {
			cin >> x[i] >> y[i];
		}
		int m; cin >> m;
		char d[31];
		int l[31];
		bool a[21][21];
		for (int i = 0; i < 21; i++) {for (int j = 0; j < 21; j++) {a[i][j] = 0;}}
		a[10][10] = 1;
		for (int i = 0; i < m; i++) {cin >> d[i] >> l[i];}
		int cont = 0;
		int nowx = 10;
		int nowy = 10;
		while (cont < m) {
			if (d[cont] == 'N' || d[cont] == 'S') {
				if (d[cont] == 'N') {
					for (int i = nowy; i <= l[cont] + nowy; i++) {
						a[i][nowx] = 1;
					}
					nowy += l[cont];
				}
				else {
					for (int i = nowy; i >= nowy - l[cont]; i--) {
						a[i][nowx] = 1;
					}
					nowy -= l[cont];
				}
				
			}
			else {
				if (d[cont] == 'E') {
					for (int i = nowx; i <= l[cont] + nowx; i++) { 
						a[nowy][i] = 1; 
					}
					nowx += l[cont];
				}
				else {
					for (int i = nowx; i >= nowx - l[cont]; i--) {
						a[nowy][i] = 1; 
					}
					nowx -= l[cont];
				}
			}
			cont++;
		}
		//for (int i = 0; i < 21; i++) { for (int j = 0; j < 21; j++) { cout << a[i][j] << " "; if (j == 20)cout << endl; } }
		for (int i = 0; i < n; i++) {
			if (a[y[i]][x[i]] != 1) {cout << "No" << endl;break;}
			if (i == n - 1)cout << "Yes" << endl;
		}

	}
}

Measured memory_bytes: 3000
fun main (args:Array<String>){
    val inputNum = readLine()!!.toDouble()
    val numPow2 = Math.pow(inputNum,2.0)
    val numPow3 = Math.pow(inputNum,3.0)
    val outputNum = inputNum + numPow2 + numPow3
    print(outputNum.toInt())
}

Measured memory_bytes: 34648
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		int n;
		Scanner sc = new Scanner(System.in);
		while (true) {

			double hei = 0, sum = 0;
			n = sc.nextInt();

			double[] s = new double[n];
			double[] si = new double[n];

			if (n == 0)
				break;

			for (int i = 0; i < n; i++) {
				s[i] = sc.nextInt();
				hei += s[i];
			}

			hei = hei / n;

			for (int i = 0; i < n; i++) {
				si[i] = Math.pow(s[i] - hei, 2);
				sum += si[i];
			}

			System.out.printf("%.8f\n", Math.sqrt(sum / n));
		}
		sc.close();

	}
}



Measured memory_bytes: 31892
#include<bits/stdc++.h>
using namespace std;

main(){
  int n,p[21],ans=0;

  cin >> n;
  for(int i=0;i<n;i++){
    cin >> p[i];
  }

  for(int i=1;i<n-1;i++){
    if(p[i-1]<p[i] && p[i]<p[i+1]){
      ans++;
    }else if(p[i+1]<p[i] && p[i]<p[i-1]){
      ans++;
    }
  }

  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long int
#define ldouble long double
#define vin vector<int> 
#define rep(i,a,n) for(i=(a);i<(n);i++)
#define INF (int)1000000007

//setprecision()<<

using namespace std;

void fin(int i,int n,vin &a){
    rep(i,0,n){
        cin>>a.at(i);
    } 
} 

signed main() {
    int i;
    string s;
    cin>>s;
    int cnt=0;
    for(int i=0;i<s.size()/2;i++){
        if(s.at(i)!=s.at(s.size()-1-i)){
            cnt++;
        }

    }
    cout<<cnt<<endl;
return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>

int main()
{
   int ans=0;
   int e[9] ;
   int a[2] ;
   int b[2] ;
   for(int i=0;i<3;i++){
	   scanf("%d %d %d",&e[i*3],&e[i*3+1],&e[i*3+2]);
   }
   
	for(int i=0;i<2;i++){
		a[i]=e[i*3+4]-e[i*3+1];
	}
	for(int i=0;i<2;i++){
		if(a[i]!=e[i*3+4]-e[i*3+1])ans=1;
	}
	for(int i=0;i<2;i++){
		if(a[i]!=e[i*3+5]-e[i*3+2])ans=1;
	}

	for(int i=0;i<2;i++){
		b[i]=e[i+1]-e[i];
	}
	for(int i=0;i<2;i++){
		if(b[i]!=e[i+1]-e[i])ans=1;
	}
	for(int i=0;i<2;i++){
		if(b[i]!=e[i+4]-e[i+3])ans=1;
	}
	for(int i=0;i<2;i++){
		if(b[i]!=e[i+7]-e[i+6])ans=1;
	}

   if(ans==1){
	   printf("No\n");
   }else{
	   printf("Yes\n");
   }
}

Measured memory_bytes: 1612
using System;
class Program{
	static void Main(){
		long[] s=Array.ConvertAll(Console.ReadLine().Split(),long.Parse);
		long[] a=Array.ConvertAll(Console.ReadLine().Split(),long.Parse);
		long ans=0;
		for(long i=1;i<s[0];i++){
			if(a[i-1]+a[i]>s[1]){
				ans+=a[i-1]+a[i]>s[1]?a[i-1]+a[i]-s[1]:0;
				a[i]=a[i]-(a[i-1]+a[i]-s[1]);
				if(a[i]<0){
					a[i-1]+=a[i];
					a[i]=0;
				}
			}
		}
		Console.WriteLine("{0}",ans);
	}
}

Measured memory_bytes: 27484
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define countof(array) (sizeof(array) / sizeof(array[0]))
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,n,s) for(int i = s; i < (n); ++i)
#define rsrep(i,n,s) for(int i = (n)-1; i >= s; --i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aall(a) (a), (a)+countof(a)//for array sorting
#define raall(a) (a), (a)+countof(a), greater<>()
#define show(x) cout<<#x<<" = "<<x<<endl;
#define vfind(v, a) find(all(v), a) != v.end()
#define yn(f) { if (f) puts("YES"); else puts("NO"); }
#define yns(f) { if (f) puts("Yes"); else puts("No"); }
#define show_ary(...) { cout<<#__VA_ARGS__<<" = "; for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define show_pair(...) cout<<#__VA_ARGS__<<" = "<<endl; for (const auto& x : (__VA_ARGS__)) { cout<<"  "<<x.fi<<" : "<<x.se<<endl; }
#define out_ary(...) { for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define argmax(v) distance((v).begin(), max_element(all(v)))
#define argmin(v) distance((v).begin(), min_element(all(v)))
#define vmax(v) *max_element(all(v))
#define vmin(v) *min_element(all(v))
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<P> vpair;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<string> vstr;
typedef vector<bool> vbool;
typedef vector<vint> vvint;
typedef vector<vll> vvll;
typedef vector<vstr> vvstr;
typedef vector<vbool> vvbool;
const ll LINF = 2000000000000000000ll;
const int INF = 1000000100;
const ll MOD = 1e9+7;

int main() {
    int n;
    cin >> n;
    vint a(n);
    rep(i, n) cin >> a[i];
    if (n == 1) {
        puts("1");
        return 0;
    }
    int mode = 0;
    if (a[0] > a[1]) mode = 1;
    if (a[0] < a[1]) mode = 2;

    int ans = 1;
    rep(i, n-1) {
        if (a[i] > a[i+1]) {
            if (mode == 1) continue;
            if (mode == 0) mode = 1;
            if (mode == 2) {
                ans++;
                mode = 0;
            }
        } 
        if (a[i] < a[i+1]) {
            if (mode == 2) continue;
            if (mode == 0) mode = 2;
            if (mode == 1) {
                ans++;
                mode = 0;
            }
        }
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 640
#include <array>
#include <iostream>

int main() {
  std::array<int, 5> v;
  int k;
  std::cin >> v[0] >> v[1] >> v[2] >> v[3] >> v[4] >> k;

  bool found = false;
  for (int i = 0; i < 4; ++i) {
    for (int j = i + 1; j < 5; ++j) {
      if (v[j] - v[i] > k) {
        found = true;
        break;
      }
    }
  }
  std::cout << (found ? ":(" : "Yay!") << std::endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  vector<int> a = {0,1,3,1,2,1,2,1,1,2,1,2,1} ;
  int x, y;
  cin >> x >> y;
  
  if ( a.at(x) == a.at(y) ) {
      cout << "Yes" << endl;
  }
  else {
      cout << "No" << endl;
  }
  
}
  
  
  

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <vector>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
#define endl '\n'
#define fast ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
using namespace std;
int a,b,c;
int main()
{
	cin>>a>>b>>c;
	for (int i=1;i<=1000;i++)
	   if (a*i%b==c)
	   {
	   	   cout<<"YES\n";
	   	   return 0;
	   }
	cout<<"NO\n";   
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; (int)(i) < n; i++)

using namespace std;

int main() {
  int ha, ma, hb, mb, k, a, b;
  cin >> ha >> ma >> hb >> mb >> k;
  a = 60*ha + ma;
  b = 60*hb + mb;
  cout << b - k - a << endl;
}

Measured memory_bytes: 3596
#include<iostream>
#include<cmath>
#include<vector>
#include<set>
#include<algorithm>
#include<tuple>
#include<utility>
#include<cctype>
#include<climits>
#include<map>
#include<queue>
#include<functional>

using namespace std;
template<class T> void chmax(T& a, T b) {if(a < b){a=b;}}
template<class T> void chmin(T& a, T b) {if(a > b){a=b;}}

#define REP(i,a,n) for(int i=a;i<n;++i)
#define RUP(a,b) ((a+b-1)/(b))
#define ENT "\n"
#define REV(v) reverse(v.begin(),v.end())
#define SRT(v) sort(v.begin(),v.end())

typedef long long ll;
typedef tuple<int,int,bool> Tb;


int atcoder(){
    //入力
    ll n,maxw;
    cin >> n >> maxw;
    ll w[n],v[n];
    REP(i,0,n) cin >> w[i] >> v[i];
    ll dp[110][110000]={};
    
    //処理
    REP(i,1,n+1){
        REP(j,1,maxw+1){
            chmax(dp[i][j] , dp[i-1][j]);
            if(j>=w[i-1]) chmax(dp[i][j] , dp[i-1][j-w[i-1]]+v[i-1]);
        }
    }
    //出力
    cout << dp[n][maxw] << ENT;
    return 0;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    atcoder();
    return 0;
}


Measured memory_bytes: 94848
#include<iostream>
#include<map>
#include<vector>
#include<algorithm>

using namespace std;

const int MAX = 10001;

string data[MAX];
int W,H,N;

struct Button{
  int lx,rx,ly,ry;
  string name;
};

map<string,vector<Button> > M;


void init(){
  M.clear();
  fill(data,data+MAX,"");
}

void input(){
  cin >> W >> H;
  for(int i = 0; i < N; i++){
    string s;
    int num;
    cin >> s >> num;
    if(i == 0) data[0] = s;

    for(int j = 0; j < num; j++){
      Button B;
      cin >> B.lx >> B.ly >> B.rx >> B.ry >> B.name;
      M[s].push_back(B);	
    }

  }
}

void solve(){
  int num;
  cin >> num;
  int index = 0;


  while(num--){
    string op;
    cin >> op;
    if(op == "click"){
      int x,y;
      cin >> x >> y;
      string now = data[index];

      for(int i = 0; i < M[now].size(); i++){
	if(M[now][i].lx <= x && x <= M[now][i].rx && M[now][i].ly <= y && y <= M[now][i].ry){
	  data[++index] = M[now][i].name;
	  fill(data+index+1,data+MAX,"");
	  break;
	}

      }

    }else if(op == "back" && index > 0) index--;
    else if(op == "forward" && data[index+1] != "") index++;
    else if(op == "show") cout << data[index] << endl;
  }
}

int main(){

  while(cin >> N && N){
    input();
    solve();
  }
  return 0;
}

Measured memory_bytes: 984
#include<bits/stdc++.h>
using namespace std;


vector<int> arr(101);
vector<int> dp(100001,-1);
int n,k; 
int find(int k)
{
    if( k < arr[0]) return 0;
    if(dp[k] != -1) return dp[k];
    
    int res = 0 ; 
    for(int i = 0 ; i < n and arr[i] <= k ; i ++)
       res = res || ( !find(k-arr[i]) );
    
    return dp[k] = res; 
}

void solve()
{
    
  cin >> n >> k ;
  for( int i = 0 ; i < n ; i ++) cin >> arr[i];

  //sort(begin(arr),begin(arr)+n);

  if(find(k)) cout << "First" << endl;  
  else cout << "Second" << endl; 

}

int main()
{   
    
    
	 ios_base::sync_with_stdio(false);
	 cin.tie(NULL);


    solve(); 
    return 0;
}




Measured memory_bytes: 8328