akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;

#define rep(i,n) for(ll i = 0; i < n; i++)
#define per(i,n) for(ll i = n-1; i >= 0; i--)
#define REP(i,n) for(ll i = 1; i < n; i++)
#define PER(i,n) for(ll i = n; i >= 1; i--)
#define sz(x) int(x.size())
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define YesorNo(a) printf(a ? "Yes\n" : "No\n")
#define endl '\n'
#define fi first
#define se second
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vii = vector<vi>;
using vl = vector<ll>;
using vll = vector<vl>;
using vs = vector<string>;
using vb = vector<bool>;
using vc = vector<char>;
using vcc = vector<vc>;
using vP = vector<P>;
using vPP = vector<vP>;
using vPl = vector<Pl>;
const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
const int inf = (1<<30)-1;
const ll infll = (1LL<<62)-1;
ll ceil(const ll &a, const ll &b){return ((a)+(b)-1)/b;}
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; }



int main(){
  int l, r, d;
  cin >> l >> r >> d;
  int ans = 0;
  for(int i = l; i <= r; i++) {
    if(i%d == 0) ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3620
<?php
$que=[];
$head=0;
$tail=0;
list($N,$Q)=explode(' ',trim(fgets(STDIN)));
for($i=0;$i<$N;$i++) $que[$tail++]=(explode(' ',trim(fgets(STDIN))));
$o='';
$TIME=0;
while($head!=$tail){
  $task=$que[$head++];
  if($task[1]<=$Q){
    $o.=$task[0].' '.($TIME+$task[1]).PHP_EOL;
    $TIME+=$task[1];
  }
  else{
    $task[1]-=$Q;
    $que[$tail++]=$task;
    $TIME+=$Q;
  }
}
print $o;

Measured memory_bytes: 122868
#include <bits/stdc++.h>
using namespace std;
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
template<class T> inline T sqr(T x) {return x*x;}
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long ll;
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(v, n) sort(v, v+n)
#define VSORT(v) sort(v.begin(), v.end())
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define INF 999999999
const double EPS = 1e-10;
const double PI  = acos(-1.0);
#define CLR(a) memset((a), 0 ,sizeof(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int main(){
    ll n;
    cin >> n;
    ll res=0;
    for(ll i=n-1;i >= 1;i--)res+=i;
    cout << res << endl;
    return 0;
}

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

#define rep(i,n) for(ll i=0;i<(n);++i)
using ll = long long;
using pll = pair<ll,ll>;
constexpr ll INF = (1LL<<60);
constexpr ll MOD = (1e9+7);
//constexpr ll MOD = (998244353);
template<class T> bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T> bool chmin(T &a,const T &b){if(a>b){a=b;return 1;}return 0;}
#if loc||debg||local||debug
void dump(){cerr<<endl;}
template<class T,class... Ts> void dump(T&& h, Ts&&... t){cerr<<h<<", ";dump(forward<Ts>(t)...);}
#else
template<class T,class... Ts> void dump(T&& h, Ts&&... t){}
#endif
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T> ostream &operator<<(ostream& os,vector<T>const& v){for(auto const& vi:v)os<<vi<<" ";return os;}
template<class T>vector<T> vec(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto vec(size_t a, Ts... ts){return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...));}
template<class T>vector<T> _vec(size_t a,T v){return vector<T>(a,v);}
template<class T, class... Ts>auto _vec(size_t a, Ts... ts){return vector<decltype(_vec<T>(ts...))>(a, _vec<T>(ts...));}

template<typename T>T gcd(T a,T b){while(1){swap(a,b);if(a==0)return b;if(b==0)return a;a%=b;}}
template<class T>inline T lcm(T a,T b){return a/gcd(a,b)*b;}

int main(){

  ll n,m;
  cin>>n>>m;
  vector<ll> a(n);
  cin>>a;

  vector<ll> b = a;
  rep(i,n)b[i]/=2;
  ll tb = 1;
  rep(i,n)tb=lcm(tb,b[i]);
  ll ta = 1;
  rep(i,n)ta=lcm(ta,a[i]);
  dump(ta,tb);
  bool ok=true;
  rep(i,n)if((tb/b[i])%2==0)ok=false;
  if(ok)cout<<(m/tb-m/ta)<<endl;
  else cout<<0<<endl;

}


Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <string>
#include <math.h>
#include <vector>
#include <map>
#include <set>
#include <queue>
using namespace std;
const int INF=0x3f3f3f;
struct node{
    int x,y;
    node(){}
    node(int a,int b):x(a),y(b){}
};
char mp[100][100];
int minn=INF,h,w;
int visit[100][100];
int step[100][100];
int dir[4][2]={{0,-1},{-1,0},{0,1},{1,0}};
queue<node>q;
int bfs(){
    while(!q.empty()){
        int tx=q.front().x;
        int ty=q.front().y;
        q.pop();
        for(int i=0;i<4;i++){
            int xx=tx+dir[i][0];
            int yy=ty+dir[i][1];
            if(xx<0||xx>=h||yy<0||yy>=w) continue;
            if(xx==h-1&&yy==w-1) return step[tx][ty]+1;
            if(visit[xx][yy]==0&&mp[xx][yy]=='.'){
                visit[xx][yy]=1;
                q.push(node(xx,yy));
                step[xx][yy]=step[tx][ty]+1;
            }
        }
    }
    return -1;

}
int main(){
    int sum=0;
    scanf("%d%d",&h,&w);
    for(int i=0;i<h;i++){
        getchar();
        for(int j=0;j<w;j++){
            scanf("%c",&mp[i][j]);
            if(mp[i][j]=='#') sum++;
        }
    }
    visit[0][0]=1;
    q.push(node(0,0));
    minn=bfs();
    if(minn==-1){
        printf("-1\n");
    }
    else printf("%d\n",h*w-minn-sum-1);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define rep(i, n) for(ll i = 0;i < n;i++)
template<class T, class U> void cmax(T& a, U b) { if (a<b) a = b; }
template<class T, class U> void cmin(T& a, U b) { if (a>b) a = b; }

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

  ll k, a, b;
  cin >> k >> a >> b;

  if (b-a <= 2) {
    cout << k+1 << endl;
    return 0;
  }

  cout << a + (k-(a-1))/2*(b-a) + (k-(a-1))%2 << endl;;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdint>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <utility>
#include <vector>

using namespace std;
using ll = long long;

#define EPS (1e-7)

int main() {
  ll N;
  cin >> N;
  vector<ll> A(N);
  for_each(begin(A), end(A), [](auto& x) { cin >> x; });
  ll count = 0;
  for (ll i = 0; i < N; i++) {
    if ((i % 2 == 0) && (A[i] % 2 == 1)) {
      count++;
    }
  }

  cout << count << endl;
  return 0;
}




Measured memory_bytes: 3592
//by azidoazideazide(c2n14)
//
#include<iostream>
#include<cmath>
#include<cstdio>
#include<algorithm>
using namespace std;
using ll=long long;

double a[102];

int main(){
//	ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	int n; double sum=1, base=0;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i];
		a[i]=1/a[i];
		base+=a[i];
	}
	base=1/base;
	printf("%.5f\n", base);
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
//0843-

int main(void) {
	int i;
	int N;
	int *a;
	long long int result;
	char buf[128], *ch;
	char *great_buf;

	fgets(buf, sizeof(buf), stdin);
	ch = strtok(buf, " ");
	N = atoi(ch);

	a = (int *)calloc(N, sizeof(int));
	great_buf = (char *)calloc(N * 8, sizeof(char));

	fgets(great_buf, N * 8, stdin);
	ch = strtok(great_buf, " ");
	a[0] = atoi(ch);
	for(i = 1; i < N; i += 1) {
		ch = strtok(NULL, " ");
		a[i] = atoi(ch);
	}
	free(great_buf);
	result = 0;
	for(i = 0; i < N; i += 1) {
		result += (a[i] - 1);
	}
	free(a);
	printf("%lld\n", result);

	return 0;
}


Measured memory_bytes: 2132
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  char c;
  cin >> c;
  
  if(c == 'a'|| c == 'i'|| c == 'u'|| c == 'e'|| c == 'o'){
    cout << "vowel"<< endl;
  }
  else{
    cout << "consonant" << endl;
  }
 
}

Measured memory_bytes: 256
fn read<T: std::str::FromStr>() -> T {
    let mut n = String::new();
    std::io::stdin().read_line(&mut n).ok();
    n.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().split_whitespace()
        .map(|e| e.parse().ok().unwrap()).collect()
}

fn gcd(x: u32, y: u32) -> u32 {
    if x <= y {
        let tmp = x;
        let x = y;
        let y = tmp;
    }
    if y == 0 {
        x
    } else {
        gcd(y, x % y)
    }
}

fn main() {
    let v = read_vec::<u32>();
    let x = v[0];
    let y = v[1];
    println!("{}", gcd(x, y));
}


Measured memory_bytes: 5028
def main():
    n, m = list(map(int, input().split()))
    wa = 0
    kaisuu = 1900 * (2 ** m)
    nokori = ((n - m) * 100) * (2 ** m)
    ikai = (1900 * m) + (100 * (n-m))
    print(ikai*(2**m))

if __name__ == '__main__':
    main()


Measured memory_bytes: 9168
#include <stdio.h>

int main(void){
  int a, b, c, temp, n;
  int a_lng, b_lng;
  scanf("%d", &n);
  if(n>1000){
    printf("error\n");
    return 0;
  }
  while(n>0){
    scanf("%d %d %d", &a, &b, &c);
    if((a<1&&a>1000) || (b<1&&b>1000) || (c<1&&c>1000)){
      printf("error\n");
      return 0;
    }
    if(a>b){
      temp=a;
      a=b;
      b=temp;
    }
    if(b>c){
      temp=b;
      b=c;
      c=temp;
    }
    if((a*a+b*b)==c*c) printf("YES\n");
    else printf("NO\n");
    n--;
  }
}

Measured memory_bytes: 580
// Created by Kshitij Anand NSIT
#include <bits/stdc++.h>
//#include <ext/numeric>
//using namespace __gnu_cxx;


using namespace std;


#define int long long
#define pb push_back
#define P pair<int,int>
#define F first
#define S second
#define vi vector<int>
#define vc vector<char>
#define vb vector<bool>
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define mp(a, b) make_pair(a, b)
#define min3(a, b, c) min(min(a, b), c)
#define min4(a, b, c, d) min(min(a, b), min(c, d))
#define max3(a, b, c) max(max(a, b), c)
#define max4(a, b, c, d) max(max(a, b), max(c, d))
#define fill(arr,val) memset(arr,val,sizeof(arr))
#define inf 1e18
#define ps(x,y) fixed<<setprecision(y)<<x
#define db(x)  cout<<#x<<" : "<<x<<endl


const int N = 1000000007;

void solve(){

    int n,a,b,c, ans=0, count=0, sum=0;
    string s;
    cin>>s;

    for(int i=0; i<sz(s); i++) {

        if(s[i] == 'R')count++;

        else{

            ans = max(count , ans);
            count = 0;
        }
    }  
        ans = max(count , ans);

    cout<<ans<<endl;
}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    
    
  //  int t; cin>>t; while(t--)
    {     
      solve();
    }

  return 0;
}


Measured memory_bytes: 3648
n, d = map(int, input().split())
x = []
for i in range(n):
  xi = list(map(int, input().split()))
  x.append(xi)
#print(x)  
ans = 0  
for i in range(n):
  for j in range(i+1,n):
    dij = sum([(x[i][_] - x[j][_])**2 for _ in range(d)])**(1/2)
    if dij % 1 == 0:
      ans +=1
      
print(ans)      

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

#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef complex<double> point;
#define xx real()
#define yy imag()

#define REP(i, a, b) for(int i = (a); i < (int)(b); i++)
#define REPN(i, a, b) for(int i = (a); i <= (int)(b); i++)
#define FA(it, x) for(__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define SZ(x) (int)(x).size()
#define BE(x) (x).begin(), (x).end()
#define SORT(x) sort(BE(x))
#define _1 first
#define _2 second

#define x1 gray_cat_x1
#define y1 gray_cat_y1

template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

#define file "I1"

const double EPS = 1e-9;
const double PI = acos(-1.);
const int INF = 1e9;
const ll MOD = 1e9 + 7;

const int MAXN = 305;

int mn1[MAXN], mn2[MAXN], mx1[MAXN], mx2[MAXN];

int dp[MAXN][MAXN][MAXN];

void solve(){
	int n, m, l, r, x;
	scanf("%d%d", &n, &m);
	REPN(i, 1, n) {
		mx1[i] = i - 1;
		mx2[i] = max(0, i - 2);
		mn1[i] = mn2[i] = 0;
	}
	REP(i, 0, m) {
		scanf("%d%d%d", &l, &r, &x);
		if (x == 1) {
			mx1[r] = min(mx1[r], l - 1);
			mx2[r] = min(mx2[r], max(0, l - 2));
		} else if (x == 2) {
			mn1[r] = max(mn1[r], l);
			mx2[r] = min(mx2[r], l - 1);
		} else if (x == 3) {
			mn1[r] = max(mn1[r], l + 1);
			mn2[r] = max(mn2[r], l);
		}
	}
	REPN(i, 1, n) {
		//printf("%d %d %d %d\n", mn1[i], mx1[i], mn2[i], mx2[i]);
		if (mn1[i] > mx1[i] || mn2[i] > mx2[i]) {
			printf("0\n");
			return;
		}
	}
	
	dp[1][0][0] = 1;
	REP(i, 1, n) {
		REP(j, 0, i) {
			REP(k, 0, max(1, j)) {
				if (!dp[i][j][k]) {
					continue;
				}
				if (mn1[i + 1] <= j && j <= mx1[i + 1] && mn2[i + 1] <= k && k <= mx2[i + 1]) {
					dp[i + 1][j][k] = (dp[i + 1][j][k] + dp[i][j][k]) % MOD;
				}
				if (mn1[i + 1] <= i && i <= mx1[i + 1] && mn2[i + 1] <= k && k <= mx2[i + 1]) {
					dp[i + 1][i][k] = (dp[i + 1][i][k] + dp[i][j][k]) % MOD;
				}
				if (mn1[i + 1] <= i && i <= mx1[i + 1] && mn2[i + 1] <= j && j <= mx2[i + 1]) {
					dp[i + 1][i][j] = (dp[i + 1][i][j] + dp[i][j][k]) % MOD;
				}
			}
		}
	}
	
	/*REPN(i, 1, n) {
		REP(j, 0, i) {
			REP(k, 0, max(1, j)) {
				printf("%d %d %d %d\n", i, j, k, dp[i][j][k]);
			}
		}
	}*/
	
	ll ans = 0ll;
	REP(j, 0, n) {
		REP(k, 0, max(1, j)) {
			/*if (j == 0) {
				ans = (ans + 3ll * dp[n][j][k]) % MOD;
			} else {
				ans = (ans + 6ll * dp[n][j][k]) % MOD;
			}*/
			
			ans = (ans + 3ll * dp[n][j][k]) % MOD;
		}
	}
	
	printf("%lld\n", ans);
}   

int main(){

    //freopen(file".in", "r", stdin); freopen(file".out", "w", stdout);
    int t = 1;
    //cin >> t;
    while(t--){
        solve();    
    }
}


Measured memory_bytes: 108800
#include<bits/stdc++.h>
using namespace std;
const int MAX=1e+5;
vector<int> g[MAX];
map<int,map<int,int>> d;
int check[MAX]={0};bool color[MAX];
void dfs(int v){
	int u;
	for(int i=0;i<g[v].size();i++){
		u=g[v][i];
		if(check[u]==0){
			check[u]++;
			if(d[v][u]==0){
				color[u]=color[v];
			}else{
				color[u]=!color[v];
			}dfs(u);
		}
	}return;
}
int main(){
	int N;cin>>N;
    int u,v,w;
	for(int i=0;i<N-1;i++){
		cin>>u>>v>>w;
		u--;v--;w=w%2;
		g[u].push_back(v);
		g[v].push_back(u);
		d[u][v]=w;
		d[v][u]=w;
	}check[0]++;color[0]=true;
	dfs(0);
	for(int j=0;j<N;j++){
		cout<<color[j]<<endl;
	}
}

Measured memory_bytes: 27392
#include <bits/stdc++.h>
using namespace std;
int main(void){
   
  int N,c=0;
  cin >> N;
  int A[N],B[N],C[N-1];
  
  for(int i=0;i<N;i++) cin >> A[i];
  for(int i=0;i<N;i++) cin >> B[i];
  for(int i=0;i<N-1;i++) cin >> C[i];

  for(int i=0;i<N;i++){
      c +=  B[A[i]-1];
      if(i != 0 && A[i] - A[i-1] == 1) c+= C[A[i-1]-1];
  }
  cout << c << endl;
}

Measured memory_bytes: 3572
#include <iostream>
using namespace std;
int calc(int x) {
	int ret = 0;
	while(x % 100 == 0) {
		x /= 100;
		++ret;
	}
	return ret;
}
int main() {
	int D, N;
	cin >> D >> N;
	int cnt = 0, val = 0;
	while(cnt < N) {
		++val;
		if(calc(val) == D) ++cnt;
	}
	cout << val << '\n';
	return 0;
}//代码是答案，我只是想测试数据有没有问题 

Measured memory_bytes: 256
#include <iostream>
#include <map>

using namespace std;

int main(void) {
    int N;
    cin >> N;
    map<int64_t,int> mp;
    for(int i=0; i<N; i++) {
        int A;
        cin >> A;
        mp[A]++;
    }

    int64_t ans = 0;
    for(auto itr=mp.rbegin(); itr!=mp.rend(); itr++) {
        if(itr->second >= 2) {
            itr->second -= 2;
            for(auto itr2=itr; itr2!=mp.rend(); itr2++) {
                if(itr2->second >= 2) {
                    ans = max(ans, itr->first*itr2->first);
                    cout << ans << endl;
                    return 0;
                }
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 6528
#include<iostream>
#include<algorithm>
#include<set>
#include<math.h>
#include<vector>
#include<sstream>
#include<queue>
#include<functional>
#include<bitset>
#include<cstdio>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include <string.h>

using ll = long long;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i, x) for(int i=1;i<=(int)(x);i++)
#define rrep(i, x) for(int i=((int)(x)-1);i>=0;i--)
#define rreps(i, x) for(int i=(int)(x);i>0;i--)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define vll vector<ll>
#define vi vector<int>
#define vpll vector<pair<ll,ll>>
#define vpi vector<pair<int,int>>
#define mod 1000000007
#define put2darr(arr, row, col) rep(i, row) { rep(j, col) { printf("%18d", arr[i][j]); } cout << endl; }

using namespace std;

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 (a > b) {
        a = b;
        return 1;
    }
    return 0;
}

/* 1..10
 * rep:   0 1 2 3 4 5 6 7 8 9
 * reps:  1 2 3 4 5 6 7 8 9 10
 * rrep:  9 8 7 6 5 4 3 2 1 0
 * rreps: 10 9 8 7 6 5 4 3 2 1
 */
int l[10];
#include <fstream>
#include <iostream>
#include <string>
int main() {
    string a,b;
    cin >> a >> b;
    int i = stoi(a+b);
    rep(j, 2000){
        if(i == j*j) {
            cout << "Yes";
            return 0;
        }

    }
    cout << "No";


}



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

int main()
{
  int n;
  scanf("%d", &n);
  vector<double> p(n);
  for(double &i : p)
  {
    scanf("%lf", &i);
  }
  vector<double> dp(n + 1);
  dp[0] = 1;
  for(int coins = 0; coins < n; coins++)
  {
    for(int i = coins + 1; i >= 0; i--)
    {
      dp[i] = (i == 0 ? 0 : dp[i - 1] * p[coins]) + dp[i] * (1 - p[coins]);
    } 
  }
  double sol = 0;
  for(int i = n / 2 + 1; i <= n; i++)
  {
    sol += dp[i];
  }
  printf("%.10lf", sol);
  
  return 0;
}


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

using ll = long long;
using ld = long double;
using vi = vector<int>;
using vll = vector<ll>;
using P = pair<int, int>;

constexpr int INF = 1e9;
constexpr ll INFLL = 1e18;
constexpr int MOD = 1e9 + 7;
const ld PI = acosl(-1);

#define rep(i,n) for(int i=0; i<(n); ++i)
#define all(n) n.begin(),n.end()

int main(){
	ios::sync_with_stdio(false); cin.tie(nullptr);
	//cout << fixed << setprecision(6);
	ll n; cin >> n;
	vll a(1, 0);
	rep(i, n) {
		ll t; cin >> t;
		t += a.back();
		a.push_back(t);
	}

	ll ans = INFLL;
	for(int i = 1; i < a.size()-1; i++){
		ll x = a[i];
		ll y = a.back() - x;
		ans = min(ans, abs(x-y));
	}

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

Measured memory_bytes: 2420
#include <bits/stdc++.h>
using namespace std;
#define MAX 2000000

int H, A[MAX+1];

void maxHeapify(int i) {
  int l, r, largest;

  l = 2 * i;
  r = 2 * i + 1;

  if (l <= H && A[l] > A[i]) largest = l;
  else largest = i;
  if (r <= H && A[r] > A[largest]) largest = r;

  if (largest != i) {
    swap(A[i], A[largest]);
    maxHeapify(largest);
  }
}

int main() {
  cin >> H;

  for (int i = 1; i <= H; i++) cin >> A[i];

  for (int i = H / 2; i >= 1; i--) maxHeapify(i);

  for (int i = 1; i <= H; i++) cout << " " << A[i];

  cout << endl;

  return 0;
}


Measured memory_bytes: 5044
// https://atcoder.jp/contests/abcXXX/tasks/abcXXX_x

#include <iostream>
#include <vector>
#include <tuple>
#include <algorithm>
#include <string>
#include <cmath>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>

using namespace std;
using ll = long long;
using ull = unsigned long long;
using pll = pair<ll, ll>;

static const ll INF = 1001001001;
static const ll LLINF = 1001001001001001001;

#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define RANGE(i, m, n) for(ll i = (m); i <= (n); ++i)

void debug_out() {}
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << to_string(H);
    debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 1
#endif

int run(istream& in, ostream& out) {
    ll a, b;
    in >> a >> b;
    ll ans = 0;
    auto aa = to_string(a);
    auto bb = to_string(b);
    string aaa, bbb;
    REP(i, b) {
        aaa += aa;
    }
    REP(i, a) {
        bbb += bb;
    }

    ans = aaa < bbb ? stoll(aaa) : stoll(bbb);
    out << ans << endl;
    return 0;
}

int main() {
    return run(cin, cout);
}


Measured memory_bytes: 256
ans = []
A = [int(i) for i  in input().split()] + [int(i) for i  in input().split()] + [int(i) for i  in input().split()]
A = {v:i for i, v in enumerate(A)}
N = int(input())
for i in range(N):
    b = int(input())
    if b in A.keys():
        ans.append(A[b])
        
if ((0 in ans) and (1 in ans) and (2 in ans)) or\
((3 in ans) and (4 in ans) and (5 in ans)) or\
((6 in ans) and (7 in ans) and (8 in ans)) or\
((0 in ans) and (3 in ans) and (6 in ans)) or\
((1 in ans) and (4 in ans) and (7 in ans)) or\
((2 in ans) and (5 in ans) and (8 in ans)) or\
((0 in ans) and (4 in ans) and (8 in ans)) or\
((2 in ans) and (4 in ans) and (6 in ans)):
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3064
// D - Powerful Discount Tickets
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rp(i,n) for(int i=0;i<(n);i++)

int main(){
	int N,M;cin>>N>>M;

	vector<int> A(N);
	vector<pair<int,int>> B;
	rp(i,N){
		cin>>A[i];
		for(int a = A[i]; a>0; a>>=1)
			B.push_back(make_pair(a - (a>>1), i));
	}

	sort(B.rbegin(), B.rend());

	vector<int> counting(N);
	rp(i, min(M, (int)B.size())) counting[B[i].second]++;

	ll ans = 0;
	rp(i,N) ans += (ll)A[i]/(1<<counting[i]);
	cout<< ans <<endl;
}

Measured memory_bytes: 35428
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <tuple>
#include <bitset>
#include <random>
#define REP(i,n) for(int i=0;i<n;i++)
#define INF 1000000007
using namespace std;
using pii=pair<int,int>;
using LL=int64_t;





int main(){
    LL n,k;
    cin>>n>>k;
    
    vector<LL> count(n+2,0);//ちょうどi個選ぶときの和の種類
    REP(i,n+2){
        count.at(i)=i*(n-i+1)+1;
        //cout<<i<<' '<<n-i+1<<' '<<i*(n-i+1)+1<<' '<<count.at(i)<<endl;
        
        count.at(i)%=INF;
    }

    LL ans=0;
    for(int i=k;i<=n+1;i++){
        ans+=count.at(i);
        ans%=INF;
        //cout<<count.at(i)<<endl;
    }
    
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 4328
#include<iostream>
#include<queue>
#include<cstring>
#include<vector>
using namespace std;
typedef long long ll;
int main()
{
    int n;
    cin>>n;
    ll brojac=0;
    int r=0;
    for(int i=0;i<n;i++)
    {
        int a;
        cin>>a;
        if(r==1)
        {
            a--;
            if(a>=0)
                brojac++;
        }
        if(a==0)
            continue;
        brojac+=a/2;
        r=a%2;
    }
    cout<<brojac<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
 
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=(n)-1;i>=0;i--)
#define VSORT(v) sort(v.begin(), v.end())
#define DVSORT(v) sort(v.begin(), v.end(),greater<int>())
#define SORT(v, n) sort(v, v+n)
#define DSORT(v,n) sort(v, v+n,greater<int>())
#define vi vector<int>
#define pb push_back
#define P pair<int,int>
#define Pll pair<ll,ll>

template <class T> void chmin(T&a,const T&b) { a = min(a,b); }
template <class T> void chmax(T&a,const T&b) { a = max(a,b); }
 
void print(){cout<<endl;}
template <class Head, class... Tail>
void print(Head&& h,Tail&&... t){ 
	if(sizeof...(t)==0)
		cout<<h;
	else
		cout<<h<<' ';
	print(move(t)...);
}
 
const double EPS =1e-9;
const long INF =2147483647;//32bit 2*1e+9
const long MOD =1e+9+7;
#define PI 3.14159265258979

int dy[]={0, 0, 1, -1, 1, 1, -1, -1};
int dx[]={1, -1, 0, 0, 1, -1, -1, 1};

int main(void){
	int A,B,C,X,cn=0;
	cin>>A>>B>>C>>X;
	REP(i,A+1)
		REP(j,B+1)
			REP(r,C+1)
				if(i*500+j*100+r*50==X) cn++;
	
	print(cn);
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cstring>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
int main(){
    int d,g;
    cin >> d >> g;
    g/=100;
    vector<int>p(d),c(d);
    rep(i,d){
        cin >> p[i] >> c[i];
        c[i] /= 100;
    }
    int ans = 1e9;
    rep(i,1<<d){
        int score = 0;
        int cnt = 0;
        rep(j,d){
            if(i>>j & 1){
                score += (j+1)*p[j] + c[j];
                cnt += p[j];
            }
        }
        if(score >= g){
            ans = min(ans, cnt);
            continue;
        }
        for(int j = d-1; j >= 0; j--){
            if(i>>j & 1)continue;
            rep(k,p[j]-1){
                score += j+1;
                cnt++;
                if(score>=g){
                    ans = min(ans,cnt);
                    break;
                }
            }
            if(score>=g)break;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define REP(i, n) for(int i = 1; i < (int)(n); ++i)
using namespace std;

int main() {
    long long N, K;
    cin >> N >> K;
    long long ans = K;
    REP(i, N) ans *= K - 1;
    cout << ans << endl;
    return 0;
}


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

int main(void){
  char word[210],temp[210];
  int i,j,snum,num,leng;

  while(1){
    scanf("%s",word);
    leng=strlen(word);
    if(word[0]=='-')  break;
    scanf("%d",&snum);
    for(i=0;i<snum;i++){
      scanf("%d",&num);
      for(j=0;j<num;j++)  temp[j]=word[j];
      for(j=num;word[j]!='\0';j++){
        word[j-num]=word[j];
      }
      for(j=0;j<num;j++){
        word[leng-num+j]=temp[j];
      }
    }
    printf("%s\n",word);
  }

  return 0;
}

Measured memory_bytes: 580
#include <bits/stdc++.h>
#pragma warning (disable:4996)
using namespace std;
#define ll long long 
#define ull unsigned long long

char s[10], t[10];

int main()
{
	cin >> s >> t;
	int cnt = 0;
	for (int i = 0; i < 3; i++)
	{
		if (s[i] == t[i])
			cnt++;
	}
	cout << cnt;

	return 0;
}

Measured memory_bytes: 256
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.nextLine());
		Queue<Double> q = new PriorityQueue<>();
		for (int i = 0; i < N; i++) {
			q.add(sc.nextDouble());
		}
		while (q.size() > 1) {
			q.add((q.poll() + q.poll()) / 2);
		}

		System.out.println(q.poll());
	}
}

Measured memory_bytes: 23380
#include <bits/stdc++.h>
#define rep(i,n); for(int i = 0;i < (n);i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
long double pi = acos(-1);
const int INF = 1001001001;


// 最小公倍数を求める
int euqlid (int a, int b){
  int temp;
  temp = a % b;
  if(temp == 0)return b;
  return euqlid(b,temp);
}
ll conbination(ll a,ll b){
  ll u = 1;
  ll d = 1;
  while(b != 0){
    u *= a;
    d *= b;
    a--;
    b--;
  }
  return u / d;
}
int strtoint(char s){
  return (int(s-'0'));
}
int fact(int n){
  if(n == 1)return 1;
  return n * fact(n-1);
  }


int main(){
  int a, b, c, d;
  cin >> a >> b >> c >> d;

  string ans;
  if(a+b > c+d)ans = "Left";
  else if(a+b == c+d)ans = "Balanced";
  else ans = "Right";
  cout << ans << endl;
}


Measured memory_bytes: 256
class BinaryTree {
  constructor() {
    this.root = null;
    BinaryTree.Node = BinaryTree.Node || BinaryTree._Node;
  }

  static get _Node() {
    return class Node {
      constructor(key, parent = null, left = null, right = null) {
        this.key = key;
        this.parent = parent;
        this.left = left;
        this.right = right;
      }

      getChildrenNumber() {return Number(this.left !== null) + Number(this.right !== null);}

      isLeftChild() {return this.parent ? this.parent.left === this : null;}

      getLeftOrRight() {return this.isLeftChild() ? 'left' : 'right';}

      getSuccessor() {
        let n;
        if (this.right !== null) {
          n = this.right;
          while (n.left !== null) n = n.left;
        } else {
          n = this.parent;
          while (!n.isLeftChild && n.parent != null) n = n.parent;
        }
        return n;
      }
    }
  }

  insert(key) {
    if (this.root === null) {
      this.root = new BinaryTree.Node(key);
      return;
    }
    let x = this.root, y;
    let newNode = new BinaryTree.Node(key);
    while (x !== null) {
      y = x;
      x = x[key < x.key ? 'left' : 'right'];
    }
    newNode.parent = y;
    y[key < y.key ? 'left' : 'right'] = newNode;
  }

  find(key, n = this.root) {
    if (n === null || n.key === key) return n;
    return this.find(key, n[key < n.key ? 'left' : 'right']);
  }

  delete(key) {
    const n = this.find(key);
    const leftOrRight = n.getLeftOrRight();
    switch (n.getChildrenNumber()) {
    case 0:
      n.parent[leftOrRight] = null;
      break;
    case 1:
      n.parent[leftOrRight] = n.left || n.right;
      n.parent[leftOrRight].parent = n.parent;
      break;
    default:
      const skey = n.getSuccessor().key;
      this.delete(skey);
      n.key = skey;
    }
  }

  printByIneorder() {
    let str = '';
    const innerFunc = (n) => {
      if (n === null) return;
      innerFunc(n.left);
      str += ` ${n.key}`;
      innerFunc(n.right);
    }
    innerFunc(this.root);
    console.log(str);
  }

  printByPreorder() {
    let str = '';
    const innerFunc = (n) => {
      if (n === null) return;
      str += ` ${n.key}`;
      innerFunc(n.left);
      innerFunc(n.right);
    }
    innerFunc(this.root);
    console.log(str);
  }

  print() {
    this.printByIneorder();
    this.printByPreorder();
  }
}

(function main(){
  const lines = require('fs').readFileSync('/dev/stdin', 'utf8').trim().split('\n');
  const n = Number(lines.shift());

  const tree = new BinaryTree();
  lines.forEach(function(cmd) {
    switch (cmd.charAt(0)) {
    case 'i': tree.insert(Number(cmd.split(' ')[1])); break;
    case 'f': console.log(tree.find(Number(cmd.split(' ')[1])) ? 'yes' : 'no'); break;
    case 'd': tree.delete(Number(cmd.split(' ')[1])); break;
    default: tree.print();
    }
  });
})();



Measured memory_bytes: 204092
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Map.Entry;
import java.util.StringTokenizer;
import java.util.TreeMap;

public class Main {

	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		
		//int[] array = new int[1000001];
		
		while (true) {
			final int N = sc.nextInt();

			if (N == 0) {
				break;
			}
			System.gc();
			TreeMap<Integer, Integer> map = new TreeMap<Integer, Integer>();
            
			
            for(int i = 0; i < N; i++){
                final int A = sc.nextInt();
                 
                int value = 0;
                if(map.containsKey(A)){
                    value = map.get(A);
                }
                value++;
                 
                map.put(A, value);
            }
             
            boolean flag = false;
            for(Entry<Integer, Integer> entry : map.entrySet()){
                //System.out.println(entry.getValue());
                 
                if(entry.getValue() > N / 2){                   
                    System.out.println(entry.getKey());
                    flag = true;
                    break;
                }
            }
             
            if(!flag){
                System.out.println("NO COLOR");
            }
		}

	}
	
	public static class Scanner {
		
		private BufferedReader br;
		private StringTokenizer tok;
		
		public Scanner(InputStream is) throws IOException{
			br = new BufferedReader(new InputStreamReader(is));
			getLine();
		}
		
		private void getLine() throws IOException{
			while(tok == null || !tok.hasMoreTokens()){
				tok = new StringTokenizer(br.readLine());
			}
		}
		
		private boolean hasNext(){
			return tok.hasMoreTokens();
		}
		
		public String next() throws IOException{
			if(hasNext()){
				return tok.nextToken();
			}else{
				getLine();
				return tok.nextToken();
			}
		}
		
		public int nextInt() throws IOException{
			if(hasNext()){
				return Integer.parseInt(tok.nextToken());
			}else{
				getLine();
				return Integer.parseInt(tok.nextToken());
			}
		}
		
		public long nextLong() throws IOException{
			if(hasNext()){
				return Long.parseLong(tok.nextToken());
			}else{
				getLine();
				return Long.parseLong(tok.nextToken());
			}
		}
		
		public double nextDouble() throws IOException{
			if(hasNext()){
				return Double.parseDouble(tok.nextToken());
			}else{
				getLine();
				return Double.parseDouble(tok.nextToken());
			}
		}
	}
}

Measured memory_bytes: 154052
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE TupleSections #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE BangPatterns#-}
{-# OPTIONS_GHC -O2 #-}

import GHC.TypeLits

import Data.Int
import Data.Proxy
import qualified Data.Map.Lazy as Map
import Data.List
import Data.Bits
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
import qualified Data.Vector as V
import qualified Data.Vector.Mutable as VM
import qualified Data.Vector.Unboxed as VU
import qualified Data.Vector.Unboxed.Mutable as VUM
import qualified Data.Array.IArray as Array
import Data.Array.MArray
import Data.Array.ST
--import Data.Monoid
--import Data.Semigroup

import Control.Applicative
import Control.Monad
import Control.Monad.ST
import Control.Monad.Primitive
import Control.Monad.State

import Debug.Trace




getInts :: IO [Int]
getInts = map (fst . fromJust . BS.readInt) . BS.words <$> BS.getLine

main :: IO ()
main = do
  n <- readLn :: IO Int
  w <- getInts
  
  print $ minimum [(\(a,b) -> abs (sum a - sum b)) $ splitAt i w | i <- [0..n]]


Measured memory_bytes: 1020
#line 2 "../../library/template.hpp"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pl = pair<ll, ll>;
using vl = vector<ll>;
#define rep(i, n) for(ll i = 0; i < (ll)n; i++)
#define rep3(i, l, r) for(ll i = l; i < (ll)r; i++)
#define per(i, n) for(ll i = (ll)n-1; i >= 0; i--)
#define per3(i, l, r) for(ll i = (ll)r-1; i >= (ll)l; i--)
#define all(v) begin(v), end(v)
template<class T, class U> inline void cmax(T& a, U b) { if (a < b) a = b; }
template<class T, class U> inline void cmin(T& a, U b) { if (a > b) a = b; }
constexpr char el = '\n';
template<class T, class U> ostream &operator<<(ostream &os, const pair<T, U>& p) { os << p.first << " " << p.second; return os; }
template<class T, class U> istream &operator>>(istream &is, pair<T, U> &p) { is >> p.first >> p.second; return is; }
template<class T> ostream &operator<<(ostream &os, const vector< T > &v) { rep(i, v.size()) os << v[i] << (i + 1 != v.size() ? " " : ""); return os; }
template<class T> istream &operator>>(istream &is, vector< T > &v) { for(T &in : v) is >> in; return is; }
struct IoSetup {
  IoSetup() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); cerr << fixed << setprecision(15); }
} io_setup;
#line 2 "d.cpp"

vl gen_primes(ll n) {
  vector<bool> is_prime(n+1, true);
  is_prime[0] = is_prime[1] = false;
  rep(i, n+1) {
    if (is_prime[i]) {
      for (ll j = 2*i; j <= n+1; j += i) {
        is_prime[j] = false;
      }
    }
  }
  vl res;
  rep(i, n+1) {
    if (is_prime[i])
      res.push_back(i);
  }
  return res;
}

int main() {
  auto vec = gen_primes(55'555);
  ll n;
  cin >> n;
  for (auto&& i : vec) {
    if (n and i%5 == 3) {
      n--;
      cout << i << " ";
    }
  }
  cout << el;
}


Measured memory_bytes: 384
n=int(input())
x=list(map(int,input().split()))

cnt=0
hist=[]
hist.append(0)

for i in range(n-1):
	if x[i+1]-x[i]<=0:
		cnt+=1
		hist.append(cnt)
	else:
		cnt=0
        
print(max(hist))

Measured memory_bytes: 14224
import java.util.*;

public class Main {
    public static void main(String args[]) {
        Scanner scan = new Scanner(System.in);
        int N = scan.nextInt();
        int[] A = new int[N];
        for (int i = 0; i < N; i++) {
            A[i] = scan.nextInt();
        }
        scan.close();

        System.out.println(combineSlimes(A));
    }

    private static long combineSlimes(int[] A) {
        int len = A.length;
        long[][] cost = new long[len][len];
        long[][] sum = new long[len][len];

        for (int j = 0; j < len; j++)
            for (int i = j; i >= 0; i--) {
                cost[i][j] = i == j ? 0 : Long.MAX_VALUE;
                sum[i][j] = j > 0 ? sum[i][j - 1] + A[j] : A[j];
                for (int start = j, left = j - 1; start > i; start--, left--) {
                    cost[i][j] = Math.min(cost[i][j], cost[i][left] + cost[start][j] + sum[i][j]);
                }
            }
        return cost[0][len - 1];
    }

}

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

int main() {
  int N,Q;
  string S;
  cin>>N>>Q>>S;
  string T="a"+S+"a";
  vector<pair<char,char>> p(Q);
  for(int i=0;i<Q;i++){
    char a,b;
    cin>>a>>b;
    p[i]=make_pair(a,b);
  }
  reverse(p.begin(),p.end());
  int l=1,r=N;
  for(int i=0;i<Q;i++){
    char a,b;
    tie(a,b)=p[i];
    if(b=='L'){
      if(T[l]==a){
        l++;
      }
      if(T[r+1]==a){
        r++;
      }
    }
    else{
      if(T[r]==a){
        r--;
      }
      if(T[l-1]==a){
        l--;
      }
    }
  }
  cout<<r-l+1<<endl;
}



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

using namespace std;
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for (int i = 0; i < (n); i++)
#define chmin(x, y) (x) = min((x), (y))
#define chmax(x, y) (x) = max((x), (y))
#define endl "\n"
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){os << "["; for (const auto &v : vec) {os << v << ","; } os << "]"; return os; }
template <typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &p) {os << "(" << p.first << ", " << p.second << ")"; return os;}

void solve() {
    int N;
    cin >> N;
    vector<int> H(N);
    for (int i = 0; i < N; i++) {
        cin >> H[i];
    }
    vector<ll> dp(N, 1LL << 60);
    dp[0] = 0;
    for(int i = 0; i < N; i++) {
        if (i + 1 < N) dp[i + 1] = min(dp[i + 1], dp[i] + abs(H[i + 1] - H[i])); 
        if (i + 2 < N) dp[i + 2] = min(dp[i + 2], dp[i] + abs(H[i + 2] - H[i])); 
    }
    cout << dp[N - 1] << endl;
}

int main() {
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    solve();
    return 0;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(long long i=0;i<x;i++)
#define repn(i,x) for(long long i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
vector<pair<string,P> >vec;

void solve(long long a, string s){
	if (a >= 3200) {
		cout << s << endl;
	} else {
		cout << "red" << endl;
	}
}

int main(){	
	string s;
	long long a;
	scanf("%lld",&a);
	cin >> s;
	solve(a, s);
	return 0;
}



Measured memory_bytes: 256
#include<stdio.h>

int main(){
	
	int a[7],c[2][7],z,Z,x;
	
	for(int i=0;i<6;i++){
		
		scanf("%d",&a[i]);
	}
	for(int i=0;i<6;i++){
		
		scanf("%d",&c[1][i]);
		c[0][i]=i;
	}
	///?????????????±???????????????????
	
	for(int i=0;i<6;i++){
		
		///??????c[1][i]?????????///
		
		for(int t=0;i!=c[0][0];t++){
			if(t==4) break;
			z=c[0][0];
			Z=c[1][0];
			c[0][0]=c[0][4];
			c[1][0]=c[1][4];
			c[0][4]=c[0][5];
			c[1][4]=c[1][5];
			c[0][5]=c[0][1];
			c[1][5]=c[1][1];
			c[0][1]=z;
			c[1][1]=Z;
		}
		if(i!=c[0][0]){
			for(int t=0;i!=c[0][0];t++){
				if(t==4) break;
				z=c[0][0];
				Z=c[1][0];
				c[0][0]=c[0][2];
				c[1][0]=c[1][2];
				c[0][2]=c[0][5];
				c[1][2]=c[1][5];
				c[0][5]=c[0][3];
				c[1][5]=c[1][3];
				c[0][3]=z;
				c[1][3]=Z;
			}
		}
		///a[]??¨????????????????????´??¢?????????///
		
		for(int t=0;t<4;t++){
			x=0;
			for(int t=0;t<6;t++){
				if(a[t]!=c[1][t]){
					x++;
				}
			}
			//printf("%d\n",x);
			if(x==0) break;
			
			Z=c[1][1];
			c[1][1]=c[1][3];
			c[1][3]=c[1][4];
			c[1][4]=c[1][2];
			c[1][2]=Z;
		}
		if(x==0) break;
	}
	if(x==0){
		printf("Yes\n");
	}
	else printf("No\n");
	
	return 0;
}

Measured memory_bytes: 2604
from functools import reduce

MOD = 10**9 + 7
primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443,
          449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997]
N = int(input())
arr = []

for p in primes:
    if p <= N:
        pow_p = p
        s = 0
        while pow_p <= N:
            s += N // pow_p
            pow_p *= p
        arr.append(s + 1)

if N == 1:
    print(1)
else:
    print(reduce(lambda a, b: (a * b) % MOD, arr))


Measured memory_bytes: 3828
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());

            int[] fb = new int[45];
            fb[0] = fb[1] = 1;

            for (int i = 2; i <= n; i++) fb[i] = fb[i - 1] + fb[i - 2];

            Console.WriteLine(fb[n]);
        }
    }
}

Measured memory_bytes: 9128
#include <iostream>
#include <cstdio>
#include <cstring>
const int N=3005;
int n,val[N];

inline int nxi(){
	int x=0;
	char c;
	while((c=getchar())>'9'||c<'0');
	while(x=x*10-48+c,(c=getchar())>='0'&&c<='9');
	return x;
}

namespace G{
	int cnt,fir[N];
	struct edge{
		int to,nx;
	}eg[N<<1];

	inline void add(const int a,const int b){
		eg[++cnt]=(edge){b,fir[a]};
		fir[a]=cnt;
	}

	bool dfs(const int x,const int fa){
		for(int i=fir[x]; i; i=eg[i].nx){
			const int y=eg[i].to;
			if(y!=fa&&val[y]<val[x]&&!dfs(y,x)) return 1;
		}
		return 0;
	}
}

int main(){
	n=nxi();
	for(int i=1; i<=n; ++i){
		val[i]=nxi();
	}
	for(int i=1; i<n; ++i){
		const int a=nxi(),b=nxi();
		G::add(a,b);
		G::add(b,a);
	}
	for(int i=1; i<=n; ++i){
		if(G::dfs(i,0)) printf("%d ",i);
	}
	puts("");
	return 0;
}

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

bc = [list(map(int, input().split())) for i in range(q)]

cnt = [0] * 100005 

for i in range(n):
    cnt[a[i]] += 1
    
tot = 0
for j in range(len(cnt)):
    tot += j * cnt[j]

# print(tot)

for k in range(q):
    b = bc[k][0]
    c = bc[k][1]
    tot -= b*cnt[b]
    tot -= c*cnt[c]
    cnt[c] += cnt[b]
    cnt[b] = 0
    tot += b*cnt[b]
    tot += c*cnt[c]
    print(tot)


Measured memory_bytes: 32048
import Control.Applicative
import Control.Monad
import Data.List

solve :: Int -> Int -> Int -> Int
solve a b c
    | any odd [a, b, c] = 0
    | all (== a) [b, c] = -1
    | otherwise         = go 0 a b c
  where
    go k a b c
        | any odd [a, b, c] = k
        | otherwise         = k' `seq` go k' (b2 + c2) (a2 + c2) (a2 + b2)
      where
        k' = k + 1
        a2 = a `div` 2
        b2 = b `div` 2
        c2 = c `div` 2

main :: IO ()
main = do
    [a, b, c] <- fmap read . words <$> getLine :: IO [Int]
    print $ solve a b c

Measured memory_bytes: 508
# -*- coding:utf-8 -*-

# input
N = int(input())
X = list(map(int, input().split()))

# solve
X_sorted = sorted(X)
n0 = X_sorted[int(len(X_sorted)/2-1)]
n1 = X_sorted[int(len(X_sorted)/2)]
for i in range(len(X)):
    if (n1 > X[i]):
        print(n1)
    elif (n0 <= X[i]):
        print(n0)


Measured memory_bytes: 25228
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <list>
#include <string>
#include <numeric>
#include <math.h>
#include <set>
#include <map>
#include <fstream>
#include <sstream>
#include <iterator>
#include <complex>
using namespace std;

long long gcd(long long a,long long b){return b?gcd(b,a%b):a;}
long long lcd(long long a,long long b){return a*b / gcd(a,b) / gcd(a,b);}
int main()
{
	int N;
	cin>>N;
	int cnt = 0;
	for(int i=0; i<N; i++)
	{
		int _a;
		cin>>_a;
		if(i%2==1)
		{
			continue;
		}

		if(_a % 2==1)
		{
			cnt++;
		}
	}
	cout<<cnt<<endl;
}

Measured memory_bytes: 3620
-- Computation - Simple Calculator

import Control.Applicative

main :: IO ()
main = do
  xs <- map (calc . words) . lines <$> getContents
  mapM_ putStrLn $ takeWhile (/= "end") xs


calc :: [String] -> String
calc [a, op, b]
  | op == "+" = show $ (read a) + (read b)
  | op == "-" = show $ (read a) - (read b)
  | op == "*" = show $ (read a) * (read b)
  | op == "/" = show $ div (read a) (read b)
  | op == "?" = "end"



Measured memory_bytes: 3992
h,w=map(int,input().split())

maze=[]
for _ in range(h):
    temp=input()
    ary=[]
    for s in temp:
        ary.append(s)
    maze.append(ary)

"""
#深さ優先じゃよく考えたらダメやん
def DFS(yy,xx):
    global maze,h,w,maze_temp
    kyori=0
    for UDRL in [(0,1),(1,0),(-1,0),(0,-1)]:
        ny=UDRL[0]+yy
        nx=UDRL[1]+xx
        if 0<=ny<h and 0<=nx<w and maze_temp[ny][nx]==".":
            maze_temp[ny][nx]="#"
            kyori=max(kyori,DFS(ny,nx))
    #print(yy,xx,kyori+1)
    return kyori+1
"""

import queue
from collections import deque







import copy
#maze_temp=copy.deepcopy(maze)

result=0

for y in range(h):
    for x in range(w):
        fifo = deque([])
        if maze[y][x]==".":
            maze_temp=[[-1]*w for _ in range(h)]
            fifo.append([y,x])
            maze_temp[y][x]=0
            result_temp=0
            while len(fifo)>0:
                temp=fifo.popleft()
                yy=temp[0]
                xx=temp[1]
                for yyy,xxx in [(0,1),(1,0),(-1,0),(0,-1)]:
                    ny=yyy+yy
                    nx=xxx+xx
                    if 0<=ny<h and 0<=nx<w:
                        if maze[ny][nx]=="." and maze_temp[ny][nx]==-1:
                            maze_temp[ny][nx]=maze_temp[yy][xx]+1
                            result_temp=max(result_temp,maze_temp[ny][nx])
                            fifo.append([ny,nx])
                            #print(maze_temp)
            result=max(result_temp,result)
            #print(y,x)
            #print(maze_temp)
print(result)






Measured memory_bytes: 46440
#include<bits/stdc++.h>
#define PI 3.141592653589
#define ll long long
using namespace std;

template<typename T_char>
T_char ToUpper(T_char cX){return toupper(cX);}

int main(){
  int  x[5];
  for(int i=0; i<5; ++i) cin >>x[i];
  int y;
  for(int i=0; i<5; ++i){
    if(x[i] == 0){
      y = i;
      break;
    }
  }

  cout << y+1 << endl;

  return 0;
}

Measured memory_bytes: 3596