akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
const int N=200005;
int n,nn,a[N],b[N],l,r;
inline bool check(int k)
{
	for(int i=1;i<=nn;i++)
		if(a[i]<k) b[i]=0;
		else b[i]=1;
	int pos1=1e8,pos0=1e8;	
	for(int i=1;i<nn;i++)
		if(b[i]==b[i+1])
		{
			if(b[i]) 
			{
				pos1=min(pos1,min(abs(n-i),abs(n-(i+1))));
			}
			else 
			    pos0=min(pos0,min(abs(n-i),abs(n-(i+1))));
		}
	if(pos1==1e8&&pos0==1e8)
	   return (n&1)==b[n];
	return pos1<pos0;
}
int main()
{
//	freopen("pyramid.in","r",stdin);
//	freopen("pyramid.out","w",stdout);
	scanf("%d",&n);//n=read();
	nn=2*n-1;
	for(int i=1;i<=nn;i++)
	{
		scanf("%d",&a[i]);//a[i]=read();
	}
	l=-1;r=1e8;
	while(r-l>1)
	{ 
		int mid=(l+r)/2;	
		if(check(mid)) l=mid;
		else r=mid;
	}	
	printf("%d",l);//write(l);
	return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define newl "\n"
using namespace std;
using lli = long long int;
using vvint = vector <vector <int>>;
const int mod = 1e9 + 7;

const int N = 2e5 + 1;

void solve(){
	int n,t;
	cin >> n >> t;
	int minn = 1e9;
	for(int i= 0;i < n;++i){
		int c,tt;
		cin >> c >> tt;
		if(tt <= t) minn = min(c,minn);
	}
	if(minn == 1e9) cout << "TLE" << newl;
	else cout << minn << newl;

	return;
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout << fixed << setprecision(10);
	#ifdef EXECUTE_LOCALLY
		   freopen("in.txt","r",stdin);
	#endif
	int t = 1;
	//cin >> t;
	while(t--) solve();
	#ifdef EXECUTE_LOCALLY
    	cout << setprecision(3) << "program time: " << (double)clock() / CLOCKS_PER_SEC << newl;
	#endif
	return 0;
}


Measured memory_bytes: 3620
#![allow(dead_code)]
#![allow(unused_imports)]
use ascii::{AsciiChar, AsciiStr, AsciiString};
use indexmap::IndexMap;
use itertools::*;
use libm::*;
use num::*;
use ordered_float::OrderedFloat;
use permutohedron::LexicalPermutation;
use proconio::marker::{Bytes, Chars};
use proconio::{fastout, input};
use std::cmp::{max, min, Ordering};
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
use std::mem::swap;

fn main() {
    input!(n: isize, s:[String; n]);
    let mut ans = vec![0,0,0,0];
    for c in s {
        match &c[..] {
            "AC" => ans[0] += 1,
            "WA" => ans[1] += 1,
            "TLE" => ans[2] += 1,
            _ => ans[3] += 1,
        }
    }
    println!("AC x {}", ans[0]);
    println!("WA x {}", ans[1]);
    println!("TLE x {}", ans[2]);
    println!("RE x {}", ans[3]);
}


Measured memory_bytes: 7856
#include <iostream>
#include <fstream>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <unordered_set>
#include <bitset>
#include <limits>
#include <algorithm>

#define MOD_BIG 1000000007
#define MOD_BIG2 998244353
using std::string;
using std::cin;
using std::cout;
using std::cerr;
using std::endl;
using ll = long long;
using pint = std::pair<int, int>;
using pll = std::pair<ll, ll>;
using std::vector;

#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)

//////////////////////////////////////


//////////////////////////////////////

int main() {
    
    int N, M;
    cin >> N >> M;
    if (N == M) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using BitArray = System.Collections.BitArray;
using BigInteger = System.Numerics.BigInteger;
using TextReader = System.IO.TextReader;

namespace AtCoderProject
{
    public class Program
    {
        public object Calc()
        {
            var N = consoleReader.Int;
            var K = consoleReader.Int;
            return (N - 1 + K -2) / (K - 1);
        }


        #region いつもの
        private readonly ConsoleReader consoleReader;
        public Program(ConsoleReader consoleReader) { this.consoleReader = consoleReader; }
        static void Main() => Console.WriteLine(new Program(new ConsoleReader(Console.In)).Calc()); static string AllLines<T>(IEnumerable<T> source) => string.Join("\n", source);
        #endregion
    }

#pragma warning disable
    public class ConsoleReader
    {
        private string[] line = Array.Empty<string>();
        private int linePosition;
        private TextReader textReader;
        public ConsoleReader(TextReader tr) { textReader = tr; }
        public int Int => int.Parse(String);
        public long Long => long.Parse(String);
        public double Double => double.Parse(String);
        public string String
        {
            get
            {
                if (linePosition >= line.Length)
                {
                    linePosition = 0;
                    line = textReader.ReadLine().Split();
                }
                return line[linePosition++];
            }
        }
        public class SplitLine
        {
            private string[] splited;
            public SplitLine(ConsoleReader cr) { splited = cr.textReader.ReadLine().Split(); }
            public int[] Int => String.Select(x => int.Parse(x)).ToArray();
            public long[] Long => String.Select(x => long.Parse(x)).ToArray();
            public double[] Double => String.Select(x => double.Parse(x)).ToArray();
            public string[] String => splited;
        }
        public SplitLine Split => new SplitLine(this);
        public class RepeatReader
        {
            ConsoleReader cr; int count;
            public RepeatReader(ConsoleReader cr, int count) { this.cr = cr; this.count = count; }
            public IEnumerable<T> Select<T>(Func<ConsoleReader, T> func) { for (int i = 0; i < count; i++) yield return func(cr); }
            public IEnumerable<string> String { get { for (int i = 0; i < count; i++) yield return cr.String; } }
            public IEnumerable<int> Int { get { for (int i = 0; i < count; i++) yield return cr.Int; } }
            public IEnumerable<double> Double { get { for (int i = 0; i < count; i++) yield return cr.Double; } }
        }
        public RepeatReader Repeat(int count) => new RepeatReader(this, count);
    }
}

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

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

	int n,l;

	cin >> n >> l;

	int sum = 0;

	for(int i=0;i<n;i++)
	{
		sum += (l+i);
	}

	int diff = 1e9;
	int num = 0;

	for(int i=0;i<n;i++)
	{
		int sum2 = sum - (l+i);
		if(abs(sum-sum2)<diff)
		{
			diff = abs(sum-sum2);
			num = sum2;
		}
	}

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


Measured memory_bytes: 256
n , a , b , c , d = map(int,input().split())
s = input()
if s[a:c+1].count("##") != 0 or s[b:d+1].count("##") != 0:
    print("No")
    exit()
if c > d:
    if s[b-2:d+1].count("...") == 0:
        print("No")
        exit()
print("Yes")

Measured memory_bytes: 3636
//http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_6_B&lang=jp
#include <iostream>
#include <algorithm>
using namespace std;

/*
void swap(int A[],int i,int j){
  int buf = A[j];
  A[j] = A[i];
  A[i] = buf;
}
*/

int partition(int A[], int l, int r){
  const int x = A[r]; //????????¨?????????
  int i = l-1; //??§???????????????????????¨??????????????????-1
  for(int j = l; j < r; j++){
    //j?????????????????£???????????¨??????????????????????????¨????????????
     if (A[j] <= x){
       i += 1;
       //??´??????????????????????????¨???
       swap(A[i],A[j]);
     }
  }
  swap(A[i+1],A[r]);
  return i+1;
}


int main(){
  int n;
  cin >> n;
  int S[n];
  for(int i=0; i<n; i++){
    cin >> S[i];
  }//????????????????????????

  int mark = partition(S,0,n-1);
  for(int i=0; i<mark; i++){
    cout << S[i] << " ";
  }
  cout << "[" << S[mark] << "] ";
  for(int i=mark+1; i<n-1; i++){
    cout << S[i] << " ";
  }
  cout << S[n-1] << endl;
  return 0;
}

Measured memory_bytes: 1552
#include <bits/stdc++.h>
using namespace std;
int main(){
  int a, b;
  cin >> a >> b;
  if(a == b){cout << "Draw" << endl;}
  else if(a == 1){cout << "Alice" << endl;}
  else if(b == 1){cout << "Bob" << endl;}
  else if(a>b){cout << "Alice" << endl;}
  else if(a<b){cout << "Bob" << endl;}
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;

int count (int n, int x) {
    int cnt = 0;
    for (int i = 1; i <= n - 2; i++) {
        for (int j = i + 1; j <= n - 1; j++) {
            for (int k = j + 1; k <= n; k++) {
                if (i + j + k == x) cnt++;
            }
        }
    }
    return cnt;
}

int main() {
    int n, x;
    
    while (1) {
        cin >> n >> x;
        if (n == 0 && x == 0) break;
        cout << count (n, x) << endl;
    }
    return 0;
}


Measured memory_bytes: 3100
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
#include <queue>
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
using namespace std;
typedef long long ll;
const ll inf = 1e+16;
struct Graph
{
  vector<int> dat;
  int n;
  int m;
  vector<vector<pair<int,ll>>> edge;
  vector<ll> d;
  
  Graph(int _n,int _m){
    n = 1;
    m = _m;
    while(n<_n) n*=2;
    dat.resize(2*(2*n-1)+m);
    edge.resize(2*(2*n-1)+m);
  }

  void add(int from,int to,ll cost){
    edge[from].push_back(make_pair(to,cost));
  }

  void init(){
    int index = 2*n-1;
    rep(i,n-1){
      add(2*i+1,i,0);
      add(2*i+2,i,0);
      add(index+i,index+2*i+1,0);
      add(index+i,index+2*i+2,0);
    }
    rep(i,n){
      add(n-1+index+i,n-1+i,0);
    }
  }

  void update(int a,int b,int k,int l,int r,ll c,int to){
    if(r<=a||b<=l) return ;

    if(a<=l&&r<=b){
      add(k,to+2*(2*n-1),c);
      add(to+2*(2*n-1),k+2*n-1,0);      
    }
    else{
      update(a,b,2*k+1,l,(l+r)/2,c,to);
      update(a,b,2*k+2,(l+r)/2,r,c,to);      
    }
  }


  void dijkstra(int s){
    d.assign(2*(2*n-1)+m,inf);
    d[s]=0;
    priority_queue<pair<ll,int>,vector<pair<ll,int>>,greater<pair<ll,int>>> q;
    q.push(make_pair(0,s));
    while(!q.empty()){
      pair<ll,int> p=q.top();q.pop();
      int w = p.second;
      if(d[w]<p.first) continue;
      for(auto& v:edge[w]){
	ll c = v.second;
	int t = v.first;
	if(d[t]>d[w]+c){
	  d[t]=d[w]+c;
	  q.push(make_pair(d[t],t));
	}
      }
    }
  }

  void show(){
    rep(i,2*(2*n-1)+m){
      cout << i << ":" << d[i] << "\n";
    }
    rep(i,2*(2*n-1)+m){
      for(auto& v:edge[i]){
	cout << i << ":" << v.first << ":" << v.second << "\n";
      }
    }

  }
  
};
int main()
{
  int n,m;
  cin >> n >> m;
  vector<int> l(m),r(m);
  vector<ll> c(m);
  rep(i,m){
    cin >> l[i] >> r[i] >> c[i];
    l[i]--;
    r[i]--;
  }

  Graph gp(n,m);
  gp.init();
  rep(i,m){
    gp.update(l[i],r[i]+1,0,0,gp.n,c[i],i);
  }

  gp.dijkstra(gp.n-1);

  if(gp.d[gp.n-1+n-1+2*gp.n-1]==inf) cout << -1 << "\n";
  else cout << gp.d[gp.n-1+n-1+2*gp.n-1] << "\n";


  
  return 0;
}


Measured memory_bytes: 107488
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
int main() {
    // ifstream in("data.txt");
    // cin.rdbuf(in.rdbuf());
    int N;
    cin >> N;
    vector<int> v(N);
    vector<int> v2(N);
    for(int i = 0; i < N; ++i)
        cin >> v.at(i);
    v2 = v;
    sort(v2.begin(), v2.end());
    int cnt = 0;
    for(int i = 0; i < N; i++) {
        if(v.at(i) != v2.at(i)) {
            cnt++;
        }
    }

    if(cnt == 2 || cnt == 0) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
}


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

int main () {
  int H , W ;
  cin >> H >> W ;
  string line[H] ;
  for(int i = 0 ; i < H ; i++ ) cin >> line[i] ;
  for(int i = 0 ; i < H ; i++ ) {
    for(int j = 0 ; j < 2 ; j++ ) {
      cout << line[i] << endl ;
    }
  }
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

namespace Test01
{
    class Program
    {
        const int INF = 1000000009;
        static void Main(string[] args)
        {
            int[] input = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
            int N = input[0];
            int Ma = input[1];
            int Mb = input[2];

            int[] A = new int[N + 1];
            int[] B = new int[N + 1];
            int[] C = new int[N + 1];
            for(int i = 1; i <= N; i++)
            {
                input = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
                A[i] = input[0];
                B[i] = input[1];
                C[i] = input[2];
            }

            int max = 400;
            int[,,] dp = new int[max + 1, max + 1, N + 1];
            for (int a = 0; a <= max; a++) for (int b = 0; b <= max; b++) for (int i = 0; i <= N; i++) dp[a, b, i] = INF;
            for (int i = 0; i <= N; i++) dp[0, 0, i] = 0;
            
            for(int a = 1; a <= max; a++)
            {
                for(int b = 1; b <= max; b++)
                {
                    for(int i = 1; i <= N; i++)
                    {
                        dp[a, b, i] = Math.Min(dp[a, b, i], dp[a, b, i - 1]);
                        if (a >= A[i] && b >= B[i]) dp[a, b, i] = Math.Min(dp[a, b, i], dp[a - A[i], b - B[i], i - 1] + C[i]);
                    }
                }
            }

            int sa = Ma;
            int sb = Mb;
            int ans;
            List<int> ans_list = new List<int>();
            while(sa <= max && sb <= max)
            {
                if (dp[sa, sb, N] < INF) ans_list.Add(dp[sa, sb, N]);
                sa += Ma;
                sb += Mb;
            }

            ans_list = ans_list.OrderBy(x => x).ToList();
            if (ans_list.Count == 0) ans = -1;
            else ans = ans_list.First();

            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 39008
#include <iostream>
#include <atcoder/dsu>

using namespace std;

int main() {
  int N, Q, t, u, v;
  cin >> N >> Q;
  atcoder::dsu d(N);
  while(cin >> t >> u >> v) {
    if (t) cout << d.same(u,v) << endl;
    else d.merge(u,v);
  }
}


Measured memory_bytes: 3980
#include <iostream>
using namespace std;

int main() {
    int n;
    string m = "",str = "";

    cin >> n;
    for(int i=0;i<n;i++) {
        cin >> m;
        if(i!=n-1)
            str = " " + m + str;
        else
            str = m + str;
    }
    cout << str << endl;
}

Measured memory_bytes: 3144
I,O,T,J,L,S,Z=[int(i) for i in input().split()]
ans=O

if I>0 and J>0 and L>0 and (I%2)+(J%2)+(L%2)>=2:
	ans+=3
	I-=1
	J-=1
	L-=1

ans+=int(J/2)*2
ans+=int(L/2)*2
ans+=int(I/2)*2

print(ans)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;

void ABC166D()
{
	ll X;
	cin >> X;
	ll N = 120;
	for (ll i = 0; i < N; ++i)
	{
		ll A = i * i * i * i * i;
		for (ll j = -N; j < i; ++j)
		{
			ll B = j * j * j * j * j;
			if (A - B == X)
			{
				cout << i << ' ' << j << endl;
				return;
			}
		}
	}
}

int main()
{
	ABC166D();
	return 0;
}

Measured memory_bytes: 3632
def resolve():
    import collections

    N = int(input())
    A_list = [int(item) for item in input().split()]
    origin_dict = collections.Counter(A_list)

    twopair_in_N = 0
    for i in origin_dict.values():
        twopair_in_N += i*(i-1)//2

    for j in range(N):
        deff = origin_dict[A_list[j]] -1

        print(twopair_in_N - deff)
    

if __name__ == "__main__":
    resolve()


Measured memory_bytes: 26780
#include <iostream>
#include <string.h>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <cmath>
#include <sstream>
#include <map>
#include <deque>
#include <queue>
#include <set>
using namespace std;
const int INF=1e5+9;
vector <int> v[INF];
int color[INF];
int cnt[3];
int main(){
	queue<int> q;
	int n,u,w;
	cin>>n;
	for(int i=0;i<n-1;i++){
		cin>>u>>w;
		v[u].push_back(w);
		v[w].push_back(u);
	}
	color[1]=1;
	color[n]=2;
	q.push(1);
	q.push(n);
	while(!q.empty()){
		int tmp=q.front();
		q.pop();
		cnt[color[tmp]]++;
		for(int i=0;i<v[tmp].size();i++){
			int tt=v[tmp][i];
			if(color[tt]) continue;
			color[tt]=color[tmp];
			q.push(tt);
		}
	}
	if(cnt[2]>=cnt[1]) cout<<"Snuke"<<endl;
	else cout<<"Fennec"<<endl;
	return 0;
}


Measured memory_bytes: 6272
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <tuple>
#include <cmath>
using namespace std;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
vector<int> G[100000];
bool used[100000];
vector<int> ans;
void dfs(int v){
    used[v]=true;
    ans.push_back(v);
    for(auto to:G[v]){
        if(!used[to]){
            dfs(to);
            return;
        }
    }
    return;
}

int main(){
    int N,M;
    cin>>N>>M;
    for(int i=0;i<M;i++){
        int A,B;
        cin>>A>>B;
        A--;B--;
        G[A].push_back(B);
        G[B].push_back(A);
    }
    dfs(0);
    reverse(ans.begin(), ans.end());
    ans.pop_back();
    dfs(0);
    cout<<ans.size()<<endl;
    for(int i=0;i<ans.size();i++){
        if(i)cout<<' ';
        cout<<ans[i]+1;
    }
    cout<<endl;
    return 0;
}

Measured memory_bytes: 6904
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<map>
#include<iostream>
using namespace std;
typedef long long int lli;
#define rep(i,n) for(lli i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(lli i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b)-1);i>=((int)(a));i--)
typedef pair<int, int> mp;
#define fir first
#define sec second
#define IINF INT_MAX
#define LINF LLONG_MAX
#define eprintf(...) fprintf(stderr,__VA_ARGS__)
#define pque(type) priority_queue<type,vector<type>,greater<type> >
#define memst(a,b) memset(a,b,sizeof(a))
 
int main(void){
	lli N;
	cin >> N;
	
	reg(h, 1, 3500){
		reg(n, 1, 3500){
			lli a = 4*n*h - N*(n+h);
			lli b = N*n*h;
			if(a>0 && b%a == 0 && b/a <= 3500){
				cout << h << " " << n << " " << b/a << endl;
				h = n = 10000;
			}
		}	
	}
	
	return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#define INF 100000000
#include <iostream>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>

using namespace std;

typedef long long ll;
typedef pair <int,int> P;
typedef pair <int,P> PP;

static const double EPS = 1e-8;

const int tx[] = {0,1,0,-1};
const int ty[] = {-1,0,1,0};

int students[100][100];

int main(){
	int n;
	while(~scanf("%d",&n)){
		if(n==0) break;

		map<ll,int> stars;
		for(int i=0;i<n;i++){
			ll num;
			scanf("%lld",&num);
			stars[num]++;
		}

		int maxv=numeric_limits<int>::min();
		ll res = 0;
		for(map<ll,int>::iterator it = stars.begin(); it != stars.end(); it++){
			if(maxv < it->second){
				maxv = it->second;
				res = it->first;
			}
		}

		if(maxv > n/2) printf("%lld\n",res);
		else printf("NO COLOR\n");
	}
}

Measured memory_bytes: 1956
#include<bits/stdc++.h>
using namespace std;
int main() {
	int n,m;
	cin>>n>>m;
	int ans=0;
	int s[n+m+1];
	for(int i=1;i<=n;i++) s[i]=2;
	for(int i=n+1;i<=n+m;i++) s[i]=1;
	for(int i=1;i<n+m;i++) {
		for(int j=i+1;j<=n+m;j++) {
			if((s[i]+s[j])%2==0) ans++;
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1000000007;
#define INF 1LL<<30
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()

vector<vector<int>> G;
int n;
int ans[200010];

void dfs(int v,int p=-1,int c=0){
    ans[v]=c;
    for(auto nv : G[v]){
        if(nv==p) continue;
        dfs(nv,v,1-c);
    }
} 

int main(){
    cin>>n;
    G.resize(3*n);
    int x=n;
    rep(i,n-1){
        int u,v,w;
        cin>>u>>v>>w;
        u--,v--;
        if(w%2==1){
            G[u].push_back(v);
            G[v].push_back(u);
        }
        else{
            G[u].push_back(x);
            G[x].push_back(u);
            G[v].push_back(x);
            G[x].push_back(v);
            x++;
        }
    }

    //cout<<"test"<<endl;

    dfs(0);
    rep(i,n) cout<<ans[i]<<endl;

}

Measured memory_bytes: 19176
N = int(input())
ac = 0
wa = 0
tle = 0
re = 0
for i in range(N):
    tmp = input()
    if tmp == 'AC':
        ac += 1
    elif tmp == 'WA':
        wa += 1
    elif tmp == 'TLE':
        tle += 1
    elif tmp == 'RE':
        re += 1
print("AC x", ac)
print("WA x", wa)
print("TLE x", tle)
print("RE x", re)

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

typedef long long ll;
typedef pair<ll, ll> P;

#define pb push_back
#define rep(i, n) for(int i = 0; i < (n); i++)
#define FOR(i, a, n) for(int i = a; i < (n); i++)
#define mod (ll)(1e9+7)
#define int ll
#define INF 100000000

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

signed main() {
	ll h, r, result;
  cin >> h >> r;
  if(h + r == 0) result = 0;
  else if(h + r < 0) result = -1;
  else if(h + r > 0) result = 1;
  cout << result << endl;
	return 0;
}


Measured memory_bytes: 3128
N, M= map(int,input().split())
submit = [list(map(str,input().split())) for _ in range(M)]


AC_list = [0] * N
penalty_list = [0] * N
ans_penalty_list = [0] * N

for i in range(M):
  if submit[i][1] == "WA":
    penalty_list[int(submit[i][0])-1] += 1
  else:
    if AC_list[int(submit[i][0])-1] == 0:
      AC_list[int(submit[i][0])-1] = 1
      ans_penalty_list[int(submit[i][0])-1] = penalty_list[int(submit[i][0])-1]

print(str(AC_list.count(1)), str(sum(ans_penalty_list)))

Measured memory_bytes: 34452
#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 debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define INF 1000000000
#define mod 1000000007
using ll=long long;
const ll LINF=1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
// ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return true;}return false;}


ll fact_mod(ll n) {
    ll ret=1; 
    for(ll i=2;i<=n;i++) ret=ret*(i%mod)%mod;
    return ret;
} 
ll pow_mod(ll x, ll n){
    if(n==0) return 1;
    ll ret=pow_mod((x*x) % mod, n/2);
    if(n&1) ret=(ret*x)%mod;
    return ret;
}
//O(r)
ll combination_mod(ll n, ll r) {
    if(r>n-r) r=n-r;
    if(r==0) return 1;
    ll a=1;
    for(ll i=0;i<r;i++) a=a*((n-i)%mod)%mod;
    ll b=pow_mod(fact_mod(r), mod-2);
    return (a%mod)*(b%mod)%mod;
}
ll inv_mod(ll n){
    return pow_mod(n,mod-2);
}


signed main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    
    int n;cin>>n;
    vector<pair<ll,ll>> v;
    ll after=0;
    rep(i,n){
        pair<ll,ll> p;
        cin>>p.first>>p.second;

        if(p.first==0 and p.second==0){
            after++;
        }
        else{
            v.push_back(p);
        }
    }
    n-=after;

    // やくぶｎ，(分子，分母)　負なら，分子を負
    auto f=[](ll si,ll bo){
        if(si==0)return make_pair(0ll,1ll);
        if(bo==0)return make_pair(1ll,0ll);
        ll g=gcd(abs(si),abs(bo));
        si/=g;bo/=g;

        if(si>0 and bo>0) return make_pair(si,bo);
        if(si<0 and bo<0) return make_pair(abs(si),abs(bo));
        else return make_pair(-abs(si),abs(bo));
    };

    map<pair<ll,ll>,ll> cnt;
    for(int i=0;i<n;i++){
        cnt[f(v[i].second,v[i].first)]++;  
        auto p=f(v[i].first,v[i].second);
        p.first=-p.first;
    }

    vector<pair<ll,ll>> yabai;
    for(auto pp:cnt){
        auto p=pp.first;
        ll lf=pp.second;

        if(lf==0) continue;

        pair<ll,ll> target;
        if(p.first<0) target=make_pair(p.second,-p.first);
        else target=make_pair(-p.second,p.first);

        if(cnt.count(target)){

            if(cnt[target]) yabai.push_back(make_pair(lf,cnt[target]));
            cnt[target]=0;
        }
    }
    ll s=0;
    ll ans=1;
    for(auto p:yabai){
        ll res=(pow_mod(2,p.first)+pow_mod(2,p.second)-1)%mod;
        ans=ans*res%mod;
        s+=p.first+p.second;
    }
    ans=(ans*pow_mod(2,n-s))%mod;
    ans+=after-1;
    if(ans<0) ans+=mod;
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 18696
//City Savers

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,x,y) for(int i=x;i<y;i++)
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a/__gcd(a, b)*b)
#define range(a) (a).begin(),(a).end() 
#define pb push_back
#define mp make_pair
#define nnn "\n"
#define spa " "
template<class T>inline bool chmin(T& a,T b,bool f){
if(f==1){if(a>b){a=b;return true;}return false;}
else if(f==0){if(a<b){a=b;return true;}return false;}return false;}
typedef pair<int,string> p;
const int inf = 2147483647;//2*10^9
const ll INF = 9223372036854775807;//9*10^18

int main (){
    int n;cin>>n;
    ll ans =0;
    vector<int>a(n+1),b(n);
    rep(i,0,n+1)cin>>a[i];
    rep(i,0,n)cin>>b[i];
    rep(i,0,n){
        if(a[i]>=b[i])ans+=b[i];
        if(a[i]<b[i]){
            ans+=a[i];
            if(a[i+1]-(b[i]-a[i])<0){
                ans+=a[i+1];
            }else{
                ans+=b[i]-a[i];
            }
            a[i+1]-=(b[i]-a[i]);
            if(a[i+1]<0)a[i+1]=0;
        }
    }
    cout << ans << nnn;
    return 0;
}

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

//考え方が大事
// とりあえず、関係ない、小さいほうのやつらN人を、各チームにふりわける。
// 残りの2N人をどうするか、という段階になれば、AGC001-Aと同じ問題になる。
// で、N+1番目に小さいものとどれがペアを組めばいいかというと、N+2番目と組めばいいのであって、
// その流れで、N+3は、N+4と組めばいい。これを最後まで続けていけばいい。

int N;
int a[300010];

int main(){
    cin>>N;

    for (int i = 0; i < 3*N; i++)
    {
        cin>>a[i];
    }
    
    sort(a, a+3*N);
    

    long long ans = 0;
    for (int i = N; i < 3*N-1; i+=2)
    {
        ans += a[i];
    }
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1408
#include<iostream>
using namespace std;

class Dice{
public:
  int f[6]; // face
  Dice(){} // instance
  void roll(int i,int j,int k,int l){
    int t = f[i];
    f[i] = f[j];
    f[j] = f[k];
    f[k] = f[l];
    f[l] = t;
  }
  void roll_y(){ roll(0, 2, 5, 3); } // to W
  void roll_x(){ roll(0, 1, 5, 4); } // to N
  void roll_z(){ roll(1, 2, 4, 3); }
};

bool eq( Dice d1, Dice d2 ){
  int i;
  for( i = 0; i < 6; i++ )
    if( d1.f[i] != d2.f[i] ) return false;
  return true;
}

bool equal( Dice d1, Dice d2 ){
int i, j;
  for( i = 0; i < 6; i++ ){
    for( j = 0; j < 4; j++ ){
      if( eq(d1, d2) ) return true;
      d1.roll_z();
    }
    if( i % 2 == 0 ) d1.roll_y();
    else d1.roll_x();
  }
  return false;
}

int main(){
  Dice d1, d2;
  int i;

  for( i = 0; i < 6; i++ ) cin >> d1.f[i];
  for( i = 0; i < 6; i++ ) cin >> d2.f[i];

  if( equal( d1, d2 ) ) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}

Measured memory_bytes: 1160
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int p = sc.nextInt();
		int[] a = new int[n];
		int even = 0;
		for(int i = 0 ; i < n ; i++) {
			a[i] = sc.nextInt();
			if(a[i] % 2 == 0) even++;
		}
		if(n == even) {
			System.out.println(p == 0 ? 1L<<n : 0);
		} else {
			System.out.println(1L<<(n - 1));
		}
	}
}


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

using ll = long long;
using pii = pair<int, int>;

#define vt          vector
#define sz(x)       (int)(x).size()
#define all(x)      (x).begin(), (x).end()
#define rall(x)     (x).rbegin(), (x).rend()
#define fi          first
#define se          second

signed main() {
    ios::sync_with_stdio(0), cin.tie(0);

    int n;
    cin >> n;
    vt<int> a(n);
    for (int &i : a) cin >> i;

    ll ans = 0;
    int l = 0;
    vt<int> cur(20);
    for (int r = 0; r < n; r++) {
        for (int i = 0; i < 20; i++) {
            cur[i] += a[r] >> i & 1;
            while (cur[i] > 1) {
                for (int j = 0; j < 20; j++) {
                    cur[j] -= a[l] >> j & 1;
                }
                l++;
            }
        }
        ans += r - l + 1;
    }

    cout << ans;
}


Measured memory_bytes: 3992
#include <iostream>
#include <vector>
#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;

vector<int> par(100000);

void UnionFind(int n) {
    rep(i, n) par[i] = i;
    return;
}

int root(int x) {
    if (par[x] == x) return x;
    par[x] = root(par[x]);
    return par[x];
}

void unite(int x, int y) {
    int rx = root(x);
    int ry = root(y);
    if (rx == ry) return;
    par[rx] = ry;
    return;
}

bool same(int x, int y) {
    int rx = root(x);
    int ry = root(y);
    return rx == ry;
}

int main() {
    int N, M;
    cin >> N >> M;
    vector<int> a(M), b(M);
    rep(i, M) {
        cin >> a[i] >> b[i];
        --a[i];
        --b[i];
    }
    
    int cnt = 0;
    rep(i, M) {
        UnionFind(N);
        rep(j, M) {
            if (i == j) continue;
            unite(a[j], b[j]);
        }
        bool judge = true;
        rep(j, N) rep(k, N) {
            if (!same(j, k)) judge = false;
        }
        if (!judge) ++cnt;
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 640
using System;
using System.Collections.Generic;
using System.Linq;

namespace abc173_b
{
  class Program
  {
    static void Main(string[] args)
    {
      var N = CIn.ReadInt();
      var S = CIn.ReadStringArray(N);
      var d = new Dictionary<string, int>();

      d.Add("AC", 0);
      d.Add("WA", 0);
      d.Add("TLE", 0);
      d.Add("RE", 0);

      foreach (var s in S) d[s]++;

      Console.WriteLine("AC x " + d["AC"]);
      Console.WriteLine("WA x " + d["WA"]);
      Console.WriteLine("TLE x " + d["TLE"]);
      Console.WriteLine("RE x " + d["RE"]);
    }
  }

  static class CIn
  {
    private static readonly Queue<string> fieldBuffer = new Queue<string>();

    public static string Read()
    {
      if (fieldBuffer.Count == 0)
      {
        foreach (var field in Console.ReadLine().Split())
        {
          fieldBuffer.Enqueue(field);
        }
      }
      return fieldBuffer.Dequeue();
    }

    public static int ReadInt() => int.Parse(Read());
    public static long ReadLong() => long.Parse(Read());
    public static double ReadDouble() => double.Parse(Read());

    public static string[] ReadStringArray(int n)
    {
      var array = new string[n];
      for (var i = 0; i < n; i++)
      {
        array[i] = Read();
      }
      return array;
    }

    public static int[] ReadIntArray(int n)
    {
      var array = new int[n];
      for (var i = 0; i < n; i++)
      {
        array[i] = ReadInt();
      }
      return array;
    }

    public static long[] ReadLongArray(int n)
    {
      var array = new long[n];
      for (var i = 0; i < n; i++)
      {
        array[i] = ReadLong();
      }
      return array;
    }

    public static double[] ReadDoubleArray(int n)
    {
      var array = new double[n];
      for (var i = 0; i < n; i++)
      {
        array[i] = ReadDouble();
      }
      return array;
    }

    public static char[,] ReadCharMatrix(int h, int w)
    {
      var array = new char[h, w];
      for (var i = 0; i < h; i++)
      {
        var l = Console.ReadLine().ToCharArray();
        for (var j = 0; j < w; j++)
        {
          array[i, j] = l[j];
        }
      }
      return array;
    }
  }
}


Measured memory_bytes: 34780
/* ＵＴＦ－８ */
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <array>
#include <queue>
#include <stack>
#include <algorithm>
#include <tuple>
#include <numeric>
#include <type_traits>
#include <limits>

#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>

#define USE_COLORED 1

#ifdef USE_COLORED
static const char stdout_pre[]  = "\033[1m"; // bold black
static const char stderr_pre[]  = "\033[31;1m"; // bold red
static const char stdxxx_post[] = "\033[m";

// 当然ながら GCC(g++)/libstdc++ 依存
#include <ext/stdio_filebuf.h>
using stdio_filebuf = __gnu_cxx::stdio_filebuf<char>;
class colored_stdio_filebuf : public stdio_filebuf {
private:
	const char* const pre_;
	const char* const post_;

public:
	colored_stdio_filebuf(FILE* fp, const char* pre, const char* post) : stdio_filebuf(fp, std::ios_base::out), pre_(pre), post_(post)
	{
	}

protected:
	std::streamsize xsputn(const char* s, std::streamsize count) override
	{
		stdio_filebuf::xsputn(pre_, strlen(pre_));
		auto ret = stdio_filebuf::xsputn(s, count);
		stdio_filebuf::xsputn(post_, strlen(post_));
		return ret;
	}
};
#endif

int main()
{
#ifdef USE_COLORED
	if (getenv("DEBUG")) {
		std::cout.rdbuf(new colored_stdio_filebuf(stdout, stdout_pre, stdxxx_post));
		std::cerr.rdbuf(new colored_stdio_filebuf(stderr, stderr_pre, stdxxx_post));
	} else
#endif
	{
		int fd = open("/dev/null", O_WRONLY);
		dup2(fd, 2);
		close(fd);
	}
	
	long N;
	std::cin >> N;
	
	long La = 2;
	long Lb = 1;

	for (int i = 1; i < N; ++i) {
		long Lt = La + Lb;
		La = Lb;
		Lb = Lt;
	}
	std::cout << Lb << "\n";
}


Measured memory_bytes: 256
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn digits(n: usize) -> usize {
    let mut n = n;
    let mut count = 0;
    while n > 0 {
        count += 1;
        n /= 10;
    }
    count
}

fn main() {
    input! {
        n: usize,
    }
    let mut count = 0;
    for i in 1..n + 1 {
        if digits(i) % 2 == 1 {
            count += 1;
        }
    }
    println!("{}", count);
}


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

int main() {
        int n, k;
        scanf("%d%d", &n, &k);
        vector<long long> h(n);
        rep(i, n) {
                scanf("%lld", &h[i]);
        }
        vector<long long> dp(n + 1, 1e18);
        dp[0] = 0;
        rep(i, n) if (i) {
                for (int j = 1; j <= k; j ++) if (i - j >= 0) {
                        dp[i] = min(dp[i], dp[i - j] + abs(h[i] - h[i - j]));
                }
        }
        printf("%lld\n", dp[n - 1]);
        return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define rep(i,l,n) for(int i = l; i < n; ++i)

int main() {
    string s;
    cin >> s;

    int c0 = 0,c1 = 0;

    for(int i = 0; i < s.size(); ++i){
        if(i % 2 == 0){
            if(s[i] != '0'){
                c0++;
            }else{
                c1++;
            }
        }else{
            if(s[i] != '1'){
                c0++;
            }else{
                c1++;
            }
        }
    }

    cout << (c0 < c1 ? c0 : c1) << endl;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
 
int main() {
 int n;
 cin>>n;
  
 vector<tuple<string,int,int>>a;
  
  for(int i=1;i<=n;i++)
  {
    string s;
    int p;
    cin>>s>>p;
    p=-p;
    a.push_back(make_tuple(s,p,i));
  }
  
  sort(a.begin(),a.end());
 
for(int i=0;i<n;i++)
    {
        cout<<get<2>(a[i])<<endl;
    }

}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Convert;
using static System.Console;
using static System.Math;
class MainClass
{
	static void Main(string[] args)
	{
		Answer(new ConsoleInput(Console.In, ' '));
	}
	public static void Answer(ConsoleInput cin)
	{
      var N = cin.Read;
      WriteLine($"ABC{N}");
	}
    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); }}
        public int ReadInt { get { return int.Parse(Read); }}
        public long ReadLong { get { return long.Parse(Read); }}
        public double ReadDouble { get { return double.Parse(Read); }}
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret;}
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret;}
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret;}
    }
}

Measured memory_bytes: 13268
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#define vll vector<ll>
#define vvvl vector<vvl>
#define vvl vector<vector<ll>>
#define VV(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define VVV(a, b, c, d) vector<vvl>(a, vvl(b, vll (c, d)));
#define re(c, b) for(ll c=0;c<b;c++)
#define all(obj) (obj).begin(), (obj).end()
typedef long long int ll;
typedef long double ld;
using namespace std;

int main(int argc, char const *argv[]) {
  ll n;std::cin >> n;
  ll INF = 2000000000000000000;
  vll a(n);re(i, n) std::cin >> a[i];
  vvl dp = VV(n/2+1, 3, -INF, ll);

  for(int i=1;i<=n/2;i++){
    for(int j=0;j<3;j++){
      if((i-1)*2+j>=n) continue;
      ll num = a[(i-1)*2 + j];
      if(i==1){
        dp[1][j] = num;
      }else{
        for(int k=0;k<=j;k++) {
          dp[i][j] = max(dp[i][j], dp[i-1][k] + num);
        }
      }
    }
  }
  ll ans = -INF;
  for(int i=0;i<3;i++) ans = max(ans, dp[n/2][i]);
  std::cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 9920
#include<stdio.h>
#include<math.h>
int main()
{
    int n,i,a;
    while(scanf("%d",&n)!=EOF)
    {
        i=1;
        while(i)
        {
            a=pow(2.0,i);
            if(a>n)
                {
                    printf("%d\n",a/2);
                    break;
                }
            if(a==n)
                {
                    printf("%d\n",a);
                    break;
                }
                i++;
        }
    }
    return 0;
}


Measured memory_bytes: 128
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int m = sc.nextInt();

        int[] a = new int[n];

//        for (int i=0; i<n; i++) a[i] = sc.nextInt();

        PriorityQueue<Double> pq = new PriorityQueue<>();

        for (int i=0; i<n; i++){
            pq.add(sc.nextDouble()*(-1));
        }

        for (int i=0; i<m; i++){
            double p = pq.poll()/2;
            pq.add(p);
        }

        long ans =0;
        while (!pq.isEmpty()){
            ans += pq.poll()*(-1);
        }

        System.out.println(ans);

    }
}

Measured memory_bytes: 99428
#include<bits/stdc++.h>
#define ll long long
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;

int main() {
  int n,m,l,o; cin>>n>>m>>l>>o;
  if ((abs(n-m)<=o&&abs(m-l)<=o)||abs(n-l)<=o) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}


Measured memory_bytes: 256
def return_distance(X,p):
    A=list(map(lambda a:(a-p)**2,X))
    return sum(A)

N=int(input())
X=list(map(int,input().split()))
min_p=min(X)
max_p=max(X)

ans=return_distance(X,max_p)
for p in range(min_p,max_p):
    if ans>return_distance(X,p):
        ans=return_distance(X,p)
    else:
        pass

print(ans)


Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <string>
#include <cmath>
#include <map>
#include <vector>
#include <sstream>

#define rep(x,to) for(int x=0;x<to;x++)
#define rep2(x,from,to) for(int x=from;x<to;x++)

using namespace std;
typedef long long ll;



int main() {

	int n, kk;
	ll sum=0;
	
	cin >> n;
	rep(i,n){
		cin >> kk;
		sum += kk;
	}
	
	cout << sum / n << endl;
	return 0;
}

Measured memory_bytes: 1156
#include<iostream> 
using namespace std;

int main()
{
  int math,greedy,geometry,DP,graph,other;
  while(cin>> math>> greedy>> geometry>> DP>> graph>> other){
    if(math + greedy + geometry + DP + graph + other == 0) break;

    int A = math + DP;
    int B = greedy + graph;
    int C = geometry + other;

    int res = 0;

    int max_game = min(min(A,B),C);
    for(int balance_game=0; balance_game<=min(2,max_game); balance_game++){
      int tmpA = A;
      int tmpB = B;
      int tmpC = C;
      tmpA -= balance_game;
      tmpB -= balance_game;
      tmpC -= balance_game;
      int math_game = tmpA/3;
      int algorithm_game = tmpB/3;
      int implement_game = tmpC/3;

      res = max(balance_game + math_game + algorithm_game + implement_game,res);
    }
    cout<< res<< endl;
  }
}

Measured memory_bytes: 1160
n = int(input())
A = list(map(int, input().split()))
cnt = 0
while True:
    f = True
    for i in range(n):
        if A[i]%2 != 0:
            f = False
        A[i] /= 2
    if f == False:
        break
    
    cnt += 1
    
print(cnt)

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

using namespace std;
using llong = long long;
using ldbl = long double;
using lpair = pair<llong, llong>;

#define ALL(x) x.begin(), x.end()

constexpr llong mod = 1e9+7;
constexpr llong inf = mod * mod;

struct node {
  llong idx;
  llong sum = 0;
  vector<llong> children;

  node() = default;
  node(llong idx): 
    idx(idx)
  {}
};

llong N, Q;
vector<node> tree;

void dfs(llong now, llong par) {
  for (auto child: tree[now].children) {
    if (child == par) continue;
    tree[child].sum += tree[now].sum;
    dfs(child, now);
  }
}

int main() {

  cin >> N >> Q;
  tree.resize(N + 1);
  for (int i = 0; i < N - 1; i++) {
    llong a, b;
    cin >> a >> b;
    tree[a].children.push_back(b);
    tree[b].children.push_back(a);
  }
  for (int i = 0; i < Q; i++) {
    llong p, x;
    cin >> p >> x;
    tree[p].sum += x;
  }

  dfs(1, -1);
  for (int i = 1; i <= N; i++) {
    cout << tree[i].sum << " \n"[i == N];
  }

  return 0;
}

Measured memory_bytes: 26660
#include<stdio.h>
#define N 10000
#define Q 500

int search(int A[],int n,int k){
  int i=0;

  A[n]=k;
  while(A[i]!=k)i++;
  return i!=n;
}

main(){
  int n,q;
  int A[N];
  int i,k;
  int c=0;

  scanf("%d",&n);
  for(i=0;i<n;i++)scanf("%d",&A[i]);
  scanf("%d",&q);
  for(i=0;i<q;i++){
    scanf("%d",&k);
    if(search(A,n,k))c++;
  }

  printf("%d\n",c);

  return 0;

}




Measured memory_bytes: 2108
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    string s, t;
    cin >> s >> t;
    int ans = INF<int>;
    for (int i = 0; i+t.size() <= s.size(); ++i) {
        int val = 0;
        for (int j = 0; j < t.size(); ++j) {
            if(s[i+j] != t[j]) val++;
        }
        ans = min(ans, val);
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 3592
import queue

H,W = map(int,input().split())
S = [list(input()) for _ in range(H)]
INF = H*W+1

def movable(S,S_dist,px,py):
    if  0 <= px and px < H and 0 <= py and py < W:
        if S_dist[px][py] == INF and S[px][py] == ".":
            return True
    return False

def bfs(S,sx,sy):
    S_dist = [[INF for _ in range(W)] for _ in range(H)]
    #Sを直接いじれば訪問済みかどうか管理できるがそれだと毎回Sをリセットする必要がある
    #S_distのみ書き込みにすればS_distはローカルだからリセットが不要
    S_dist[sx][sy] = 0
    q = queue.Queue()
    q.put((sx,sy))
    vec = [(0,1),(0,-1),(1,0),(-1,0)]
    ret = 0
    while not q.empty():
        p = q.get()
        ret = S_dist[p[0]][p[1]]
        for vx,vy in vec:
            if movable(S,S_dist,p[0]+vx,p[1]+vy):
                S_dist[p[0]+vx][p[1]+vy] = S_dist[p[0]][p[1]]+1
                q.put((p[0]+vx,p[1]+vy))
    return ret

ans = 0
for i in range(H*W):
    if S[i//W][i%W] == ".":
        ans = max(ans,bfs(S,i//W,i%W))
print(ans)


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

using namespace std;

using ll = long long;
using Vi = vector<int>;
using Vl = vector<ll>;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

constexpr int I_INF = (1 << 30);
constexpr ll L_INF = (1ll << 62);

//==================================

using Graph = vector<vector<int>>;
Graph g;
Vi checked;

void dfs(int u, int d, Vi& dArray) {
    dArray[u] = d;
    for (const auto& to : g[u]) {
        if (checked[to] != 0) continue;
        checked[to] = 1;
        dfs(to, d + 1, dArray);
    }
}

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

    int N, U, V;
    cin >> N >> U >> V;
    --U;
    --V;

    Vi dFromU(N), dFromV(N);
    g.resize(N);
    checked.resize(N);

    for (int i = 0; i < N - 1; ++i) {
        int a, b;
        cin >> a >> b;
        --a;
        --b;
        g[a].push_back(b);
        g[b].push_back(a);
    }

    checked[U] = 1;
    dfs(U, 0, dFromU);

    fill(checked.begin(), checked.end(), 0);
    checked[V] = 1;
    dfs(V, 0, dFromV);

    int ans = 0;
    for (int i = 0; i < N; ++i) {
        if (dFromV[i] <= dFromU[i]) continue;
        ans = max(ans, dFromV[i] - 1);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 10752
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)
#define vv(T) vector<vector<T>>
using namespace std;
using ll = long long;
using vint = vector<int>;
using vvint = vector<vector<int>>;
using vll = vector<long long>;
using vvll = vector<vector<long long>>;
using vbool = vector<bool>;
using vvbool = vector<vector<bool>>;
using qint = queue<int>;
using sint = stack<int>;
using pii = pair<int, int>;


int main(){
    int n;
    cin >> n;
    vvint acts(n, vint(3));
    rep(i, n){
        rep(j, 3){
            cin >> acts[i][j];
        }
    }

    vvint happy(n, vint(3, 0));
    rep(i, 3){
        happy[0][i] = acts[0][i];
    }
    for(int i = 1; i < n; i ++){
        auto x = acts[i];
        int a, b, c;
        a = x[0];
        b = x[1];
        c = x[2];
        happy[i][0] = max(happy[i - 1][1] + a, happy[i - 1][2] + a);
        happy[i][1] = max(happy[i - 1][0] + b, happy[i - 1][2] + b);
        happy[i][2] = max(happy[i - 1][0] + c, happy[i - 1][1] + c);
    }

    cout << *max_element(happy.back().begin(), happy.back().end()) << endl;
    return 0;
}


Measured memory_bytes: 11136