akhauriyash/Code-Regression huggingface dataset:
#[allow(unused_macros)]
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)*}
    };
}

#[allow(unused_macros)]
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)*}
    };

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

#[allow(unused_macros)]
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, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

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

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

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

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

fn main() {
    input! {
        _n: usize,
        s: chars,
    }
    let ans = s
        .windows(2)
        .filter(|xy| xy[0] != xy[1])
        .collect::<Vec<_>>()
        .len()
        + 1;
    println!("{}", ans);
}


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

int main(){
  string s;cin>>s;
  int l=-1,r,n=s.size();

  REP(i,n){
    if(l==-1 && s.at(i)=='A') l=i;
    if(s.at(i)=='Z') r=i;
  }

  cout<<r-l+1;
}

Measured memory_bytes: 644
/*Function Template*/
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> pint;
const int MAX = 510000;
const int MOD = 1000000007;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define Rep(i, n) for(ll i = 1; i < (n); i++)
#define ALL(a)  (a).begin(),(a).end()
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll fac[MAX], finv[MAX], inv[MAX];


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;
}
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }

}
ll Len(ll n) {
  ll s=0;
  while(n!=0) s++, n/=10;
  return s;
}


ll Sint(ll n) {
  ll m=0,s=0,a=n;
  while(a!=0) s++, a/=10;
  for(ll i=s-1;i>=0;i--) m+=n/((ll)pow(10,i))-(n/((ll)pow(10,i+1)))*10;
  return m;
}


ll Svec(vector<ll> v){
  ll n=0;
  for(ll i=0;i<v.size();i++) n+=v[i];
  return n;
}


ll GCD(ll a,ll b) {
  return b ? GCD(b,a%b) : a;
}


ll LCM(ll a,ll b){
  return a/GCD(a,b)*b;
}


ll Factorial(ll n){
  ll m=1;
  while(n>=1) m*=n,n--;
  return m;
}

void runlength(string s,vector<pair<char,ll>> &p){
  ll x=1;
  if(s.size()==1){
    p.push_back(pair<char,ll>(s[0],1));
  }
  for(ll i=0;i<s.size()-1;i++){
    if(s[i]==s[i+1]){
      x++;
      if(i==s.size()-2){
        p.push_back(pair<char,ll>(s[i],x));
      }
    }else{
      p.push_back(pair<char,ll>(s[i],x));
      x=1;
      if(i==s.size()-2){
        p.push_back(pair<char,ll>(s[s.size()-1],x));
      }
    }
  }
}




ll COM(ll n,ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

const int MAX_N=100010;
vector<bool> sieve_of_eratosthenes(){
  vector<bool> isPrime(MAX_N+1,true);
  for(int i=2;i<=MAX_N;i++){
    if(isPrime[i]){
      for(int j=2*i;j<=MAX_N;j+=i){
        isPrime[j]=false;
      }
    }
  }
  return isPrime;
}

vector<pint> prime_factorize(ll n){
  vector<pint> ans;
  for(ll p=2;p<=sqrt(n);p++){
    if(n%p!=0) continue;
    ll cnt=0;
    while(n%p==0){
      n/=p;
      cnt++;
    }
    ans.push_back(make_pair(p,cnt));
  }
  if(n!=1) ans.push_back(make_pair(n,1));
  return ans;
}

/*↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓*/
int main() {
  IOS;
  while(1){
    ll n,m,x;
    cin>>n>>m>>x;
    if(n==0 && m==0 && x==0) break;
    m--;
    vector<ll> v(n);
    ll ans=0;
    rep(i,n) cin>>v[i];
    ans=Svec(v)*(100-x);
    if(v[m]==0) cout<<0<<endl;
    else cout<<ans/v[m]<<endl;
  }
}


Measured memory_bytes: 3152
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		long N = scan.nextLong();
		scan.close();
		if(N == 0) {
			System.out.println(0);
			System.exit(0);
		}
		// 長さ2n + 1で表すことができる数値の最小値と最大値
		List<Long> list1 = new ArrayList<Long>();
		List<Long> list2 = new ArrayList<Long>();

		for(int i = 1; i <= 33; i += 2) {
			int k = (int)Math.ceil((double) i / 2.0);
			long max = (long)(Math.pow(4, k) - 1) / 3;
			long t1 = (long)(Math.pow(2, i - 1));
			long t2 = 2 * ((long)(Math.pow(4, k - 1)) - 1) / 3;
			long min = t1 - t2;
			list1.add(min);
			list2.add(max);
		}
		list1.set(0, 0L);

		long t = N;
		int[] bi = new int[33];
//		if(t == 0) {
//			for(int i = 0; i < l; i++) {
//				System.out.print(bi[i]);
//			}
//			System.out.println();
//		}

		// 長さ2l で表すことができる数値の最小値と最大値
		List<Long> list3 = new ArrayList<Long>();
		List<Long> list4 = new ArrayList<Long>();
		for(int i = 2; i <= 33; i += 2) {
			int k = i / 2;
			long min = -2 * (long)(Math.pow(4, k) - 1) / 3;
			long t1 = -(long)(Math.pow(2, i - 1));
			long t2 = -((long)(Math.pow(4, k)) - 1) / 3;
			long max = t1 - t2;
			list3.add(min);
			list4.add(max);
		}

//		for(int i = 0; i < list1.size(); i++) {
//			System.out.println(list1.get(i) + " " + list2.get(i));
//		}
//		for(int i = 0; i < list3.size(); i++) {
//			System.out.println(list3.get(i) + " " + list4.get(i));
//		}
		while(t != 0) {
			if(t < 0) {
				for(int i = 0; i < list3.size(); i++) {
					if(list3.get(i) <= t && t <= list4.get(i)) {
						bi[(2 * (i + 1))] = 1;
						t = t + (long)(Math.pow(2, 2 * i + 1));
						break;
					}
				}
			}else if(t > 0) {
				for(int i = 0; i < list1.size(); i++) {
					if(list1.get(i) <= t && t <= list2.get(i)) {
						bi[(2 * i + 1)] = 1;
						t = t - (long)(Math.pow(2, 2 * i));
						break;
					}
				}
			}

		}
		int index = 0;
		for(int i = 0; i < 33; i++) {
			if(bi[i] == 1) {
				index = i;
			}
		}
		for(int i = index; i > 0; i --) {
			System.out.print(bi[i]);
		}
		System.out.println();

	}
}

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

int main() {
	int N; cin >> N;
	int T[110];
	for(int i=0; i<N; ++i) cin >> T[i];
	int M; cin >> M;
	int P[110], X[110], S;
	for(int i=0; i<M; ++i){
	    cin >> P[i] >> X[i];
	    S=0;
	    for(int j=0; j<N; ++j){
	        if(j+1==P[i]) S += X[i];
	        else S += T[j];
	    }
	    cout << S << endl;
	}
	return 0;
}


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

#define rep(i, n) for(int i = 0; i < n; i++)

typedef long long ll;
using namespace std;
int mod = 1000000007;

int main(void){
    int a=0, b=0, c=0;
    string S_a, S_b, S_c;
    cin >> S_a >> S_b >> S_c;
    int turn = 0;
    while(true){
        switch(turn){
            case 0:
                if(a == S_a.length()){
                    cout << "A" << endl;
                    return 0;
                }
                if(S_a[a] == 'b') turn = 1;
                else if(S_a[a] == 'c') turn = 2;
                a++;
                break;
            case 1:
                if(b == S_b.length()){
                    cout << "B" << endl;
                    return 0;
                }
                if(S_b[b] == 'a') turn = 0;
                else if(S_b[b] == 'c') turn = 2;
                b++;
                break;
            case 2:
                if(c == S_c.length()){
                    cout << "C" << endl;
                    return 0;
                }
                if(S_c[c] == 'a') turn = 0;
                else if(S_c[c] == 'b') turn = 1;
                c++;
                break;
            default:
                break;
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a) for(int i=0;i<a;i++)
#define pd(a,n) for(int i=0;i<n;i++)cout<<a[i]<<((i==n-1)?"\n":" ");cout<<endl;
#define pdd(a,n,m)for(int i=0;i<n;i++){for(int j=0;j<m;j++)cout<<a[i][j]<<" ";cout<<endl;}
#define mp make_pair
#define pb push_back
#define ll long long
//#define __int64 lng long
#define P pair<int,int>
#define PP pair<P,int>

vector<int>G[111];
int dist[111];
int n;

int main(){
  cin>>n;
  rep(i,n)dist[i]=-1;

  rep(i,n){
    int a,k;
    cin>>a>>k;
    a--;
    rep(i,k){
      int x;
      cin>>x;
      x--;
      G[a].pb(x);
    }
    sort(G[a].begin(),G[a].end());
  }
  queue<P>bfs;
  bfs.push(mp(0,0));

  while(!bfs.empty()){
    int now=bfs.front().first;
    int cost=bfs.front().second;
    bfs.pop();
    if(dist[now]!=-1)
      continue;
    dist[now]=cost;
    for(int i=0;i<G[now].size();i++){
      int next=G[now][i];
      bfs.push(mp(next,cost+1));
    }
  }
  rep(i,n)cout<<i+1<<" "<<dist[i]<<endl;
  return 0;
}



Measured memory_bytes: 3168
from fractions import gcd
N = int(raw_input())
t = a = 1
for _ in xrange(N):
    T, A = map(int, raw_input().split())
    q = max((t + T - 1) / T, (a + A - 1) / A)
    t, a = T * q, A * q
print t + a

Measured memory_bytes: 4264
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cstdlib>
#include<ctime>
#include<utility>
#include<list>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
const ll p=924844033;
const ll g=5;
ll fp(ll a,ll b)
{
	ll s=1;
	while(b)
	{
		if(b&1)
			s=s*a%p;
		a=a*a%p;
		b>>=1;
	}
	return s;
}
namespace ntt
{
	ll w1[1000010];
	ll w2[1000010];
	int rev[1000010];
	int n;
	void init()
	{
#ifdef DEBUG
		n=16;
#else
		n=524288;
#endif
		int i;
		for(i=1;i<=n;i<<=1)
		{
			w1[i]=fp(g,(p-1)/i);
			w2[i]=fp(w1[i],p-2);
		}
		rev[0]=0;
		for(i=1;i<n;i++)
			rev[i]=(rev[i>>1]>>1)|(i&1?n>>1:0);
	}
	void ntt(ll *a,int t)
	{
		int i,j,k;
		ll u,v,w,wn;
		for(i=0;i<n;i++)
			if(rev[i]<i)
				swap(a[i],a[rev[i]]);
		for(i=2;i<=n;i<<=1)
		{
			wn=(t==1?w1[i]:w2[i]);
			for(j=0;j<n;j+=i)
			{
				w=1;
				for(k=j;k<j+i/2;k++)
				{
					u=a[k];
					v=a[k+i/2]*w%p;
					a[k]=(u+v)%p;
					a[k+i/2]=(u-v)%p;
					w=w*wn%p;
				}
			}
		}
		if(t==-1)
		{
			ll inv=fp(n,p-2);
			for(i=0;i<n;i++)
				a[i]=a[i]*inv%p;
		}
	}
};
ll b[1000010];
ll c[1000010];
ll a[1000010];
ll inv[1000010];
ll fac[1000010];
ll ifac[1000010];
int s[1000010];
int n;
list<int> l[200010];
ll num[1000010];
void dfs(int x,int fa)
{
	s[x]=1;
	for(auto v:l[x])
		if(v!=fa)
		{
			dfs(v,x);
			s[x]+=s[v];
			num[s[v]]--;
			num[n-s[v]]--;
		}
}
int main()
{
#ifdef DEBUG
	freopen("b.in","r",stdin);
	freopen("b.out","w",stdout);
#endif
	scanf("%d",&n);
	int i,x,y;
	for(i=1;i<=n-1;i++)
	{
		scanf("%d%d",&x,&y);
		l[x].push_back(y);
		l[y].push_back(x);
	}
	inv[0]=inv[1]=fac[0]=fac[1]=ifac[0]=ifac[1]=1;
	for(i=2;i<=n;i++)
	{
		inv[i]=-(p/i)*inv[p%i]%p;
		fac[i]=fac[i-1]*i%p;
		ifac[i]=ifac[i-1]*inv[i]%p;
	}
	dfs(1,0);
	num[n]=n;
	for(i=0;i<=n;i++)
		b[i]=num[n-i]*fac[n-i]%p;
	for(i=0;i<=n;i++)
		c[i]=ifac[i];
	ntt::init();
	ntt::ntt(b,1);
	ntt::ntt(c,1);
	for(i=0;i<ntt::n;i++)
		a[i]=b[i]*c[i]%p;
	ntt::ntt(a,-1);
	for(i=1;i<=n;i++)
	{
		ll ans=a[n-i]*ifac[i]%p;
		ans=(ans+p)%p;
		printf("%lld\n",ans);
	}
	return 0;
}

Measured memory_bytes: 78080
#include "bits/stdc++.h"
#include "math.h"
#include "string.h"
#include "algorithm"
 
using namespace std;
typedef int64_t ll;
typedef vector<int64_t> vll;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vin;
typedef pair<double,ll> P;
typedef vector<P> vp;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SIZE(a) int((a).size())
vll dp(20010,INT_MAX);//体力をi減らした時の最小魔力
int main(){
  int h,n;
  cin>>h>>n;
  vll a(n),b(n);
  REP(i,n){
    cin>>a[i]>>b[i];
  }
  dp[0]=0;
  REP(i,h){
    
    REP(j,n){
      dp[i+a[j]]=min(dp[i+a[j]],dp[i]+b[j]);
    }
  }
  sort(a.begin(),a.end());
  reverse(a.begin(),a.end());
  ll ans=INT_MAX;
  FOR(i,h,h+a[0]){
    ans=min(ans,dp[i]);
  }
  cout<<ans<<endl;
}



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

int main()
{
	int M, K;
	scanf("%d%d", &M, &K);
	if ((1 << M) <= K)
		puts("-1");
	else if (M == 0)
		puts("0 0");
	else if (M == 1)
	{
		if (K == 0)
			puts("0 0 1 1");
		else
			puts("-1");
	}
	else if (K == 0)
	{
		for (int i{}; i < (1 << M); i++)
			printf("%d %d%c", i, i, i + 1 == (1 << M)?'\n':' ');
	}
	else
	{
		for (int i{}; i < (1 << M); i++)
			if (i != K)
				printf("%d ", i);
		printf("%d", K);
		for (int i{(1 << M) - 1}; i >= 0; i--)
			if (i != K)
				printf(" %d", i);
		printf(" %d\n", K);
	}

	return 0;
}

Measured memory_bytes: 1792
#include<algorithm>
#include<bitset>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<functional>
#include<list>
#include<map>
#include<iomanip>
#include<iostream>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<vector>
#include<algorithm>
#include<memory.h>
using namespace std;
int main(){
	int r,g,b,h;
	cin>>r>>g>>b;
	h=r*100+g*10+b;
	if(h%4==0)cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <limits>
#include <cmath>
#include <cassert>

using namespace std;
using ll = long long;

const int INF = 1<<30;
const int MOD = (int)1e9 + 7;
const int MAX_N = (int)1e5 + 5;
#define debug(x) cout << #x << ": " << x << endl

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    while(cin >> n, n)
    {
        vector<int> v(n);
        for(int i = 0; i < n; i++) cin >> v[i];
        int avg = 0;
        for(int i = 0; i < n; i++) avg += v[i];
        avg /= n;
        int ans = 0;
        for(int i = 0; i < n; i++)
        {
            if(v[i] <= avg) ans++;
        }
        cout << ans << endl;
    }
    return 0;
}




Measured memory_bytes: 3192
#include <bits/stdc++.h>
#include <algorithm>
#include <string>
#include <math.h>
using ll = long long;
using namespace std;
ll ans;
#define rep(i,n) for(int i=0;i<n;i++)
string S;
int ctoi(char c){
	return c-'0';
}
int main(){
  int P;cin>>P;
  int Q;cin>>Q;
  int R;cin>>R;
  
  	if(P>=Q&&P>=R){
      cout<<Q+R<<endl;
    }else if(Q>=P&&Q>=R){
      cout<<P+R<<endl;
    }else if(R>=P&&R>=Q){
    	cout<<P+Q<<endl;
    }
    return 0;  
      }


Measured memory_bytes: 256
//include
//------------------------------------------
#include <bits/stdc++.h>
using namespace std;
//conversion
//------------------------------------------
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();}
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef long long ll;
//container util
//------------------------------------------
#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(c) sort((c).begin(),(c).end())
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const long long INF = 1000000007;
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
// chmax chmin
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main(void){
    int N,L; cin >> N >> L;
    vector<string> s(N); REP(i,N) cin >> s[i];
    SORT(s);
    REP(i,N) cout << s[i];
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
	int i[3];
	int s,j,x;
	
	scanf("%d %d %d",&i[0],&i[1],&i[2]);
	
	for( s=0 ; s<3 ; s++ ){
		for ( j = 0 ; j <2-s ; j++ ){
			if(i[j]>i[j+1]){
				x=i[j+1];
				i[j+1]=i[j];
				i[j]=x;
			}
		}
	}
	printf("%d %d %d\n",i[0],i[1],i[2]);
	
	return(0);
}

Measured memory_bytes: 596
package main

import (
	"fmt"
)

func main(){
	var a, b int
	fmt.Scan(&a, &b)

	ans := a+b
	if ans < (a-b){
		ans = a-b
	}
	if ans < (a*b){
		ans = a*b
	}

	fmt.Print(ans)
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define pb push_back
#define fi first
#define se second
const int N = 3e5+6;
const int mod = 1e9+107;
const ll inf = 1e16;
ll a[N];
ll spt[N][100];
void solve(){
    ll n,k;
    cin>>n>>k;
    for(int i=1;i<=n;i++)cin>>a[i];
    for(int i=1;i<=n;i++)spt[i][0] = a[i];
    for(int j=1;j<100;j++){
        for(int i=1;i<=n;i++){
            spt[i][j] = spt[spt[i][j-1]][j-1];
        }
    }
    ll node = 1;
    for(ll i=62;i>=0;i--){
        if((1ll<<i)<=k){
            node = spt[node][i];
            k-=(1ll<<i);
        }
    }
    cout<<node<<endl;
}
int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int t=1;
//    cin>>t;
    while(t--)solve();
    return 0;
}


Measured memory_bytes: 161468
/*
"Won't stop until I'm phenomenal."
- Phenomenal, Eminem
 */
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define ff first
#define Shazam ios_base::sync_with_stdio(false);   cin.tie(NULL); cout.tie(NULL);
#define ss second
#define all(c) c.begin(),c.end()
#define endl "\n"
#define test() int t; cin>>t; while(t--)
#define fl(i,a,b) for(int i = a ; i <b ;i++)
#define get(a) fl(i,0,a.size())  cin>>a[i];
#define pra(a) fl(i,0,a.size()) cout<<a[i]<<" ";	cout<<endl;
#define pr(a,n) fl(i,0,n) cout<<a[i]<<" ";	cout<<endl;
const ll INF = 2e18;
const int inf = 2e9;
const int mod1 = 1e9 + 7;



int main(){
    Shazam;
    int n,m; cin>>n>>m;
    // multiset<ll,greater<ll>> s;
    // for(int i = 0 ; i < n; i++){
    //     ll k; cin>>k; s.insert(k);
    // }
    // for(int i = 0 ; i < m; i++){
    //     ll operate = *s.begin();
    //     s.erase(s.begin());
    //     s.insert(operate>>=1);
    // }
    // ll ans = 0;
    // for(auto p : s)
    //     ans+= p;
    ll ans = 0;
    priority_queue<ll> q;
    for(int i = 0 ; i < n ;i++){
        ll k; cin>>k;
        q.push(k);
    }
    for(int i = 0; i < m; i++){
        ll operate = q.top();
        q.pop();
        q.push(operate>>=1);
    }
    while(!q.empty()){
        ans+=q.top();
        q.pop();
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 4156
import java.io.*;

class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader reader =
            new BufferedReader(new InputStreamReader(System.in));

        String[] line = reader.readLine().split(" ");
        int a = Integer.parseInt(line[0]);
        int b = Integer.parseInt(line[1]);
        
        int area = a * b;
        int areaLength = ( a + b ) * 2;

        System.out.println(area + " " + areaLength);
    }
}

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

using namespace std;
typedef long long ll;

vector<int> a;
vector<int> b;
vector<int> c;
int N;
map<int,map<int,int>> dp;

int iter(int j, int k){
    //j is current day, k is picked activity (cannot be picked again);

    int ans = 0;

    if (j == N-1){
        if (k == 1) return a[j];
        if (k == 2) return b[j];
        if (k == 3) return c[j];
    }

    if (dp[j][k]) return dp[j][k];
    
    if (k == 0){
        //Can pick from all of them
        ans = max(ans, iter(j+1, 1));
        ans = max(ans, iter(j+1, 2));
        ans = max(ans, iter(j+1, 3));
    } else if (k == 1){
        //Can't pick first activity
        ans = max(ans, iter(j+1, 2));
        ans = max(ans, iter(j+1, 3));
    } else if (k == 2){
        //Can't pick second activity
        ans = max(ans, iter(j+1, 1));
        ans = max(ans, iter(j+1, 3));
    } else if (k == 3) {
        //Can't pick third activity
        ans = max(ans, iter(j+1, 1));
        ans = max(ans, iter(j+1, 2));
    }
    
    if (k == 1) return dp[j][k] = ans+=a[j];
    if (k == 2) return dp[j][k] = ans+=b[j];
    if (k == 3) return dp[j][k] = ans+=c[j];
    
    return ans;
}

int main(){
    int T = 1;
    //cin >> T;
    while (T--){
        cin >> N;
        for (int i = 0; i<N; i++){
            int t1,t2,t3;
            cin >> t1 >> t2 >> t3;
            a.push_back(t1); b.push_back(t2); c.push_back(t3);
        }

        cout << iter(-1,0) << endl;
    }
}

Measured memory_bytes: 32620
#include <bits/stdc++.h>
using namespace std;
int main () {
  int A, B;
  cin >> A >> B;
  bool S = false;
  for(int i = 0; i <= A; i++) {
    if(i * 2 + (A - i) * 4 == B) {
      S = true;
    }
  }
  if(S) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

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

main(){
	
	int i, j,counter[26]={0};
	char text[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'},c[1200]="";
	
	for(i=0;i<1200;i++){
		scanf("%c",&c[i]);
		
		if(c[i]=='\0')break;
		
		else if(c[i]=='\n')continue;
		
		else if(isupper(c[i])!=0){
			c[i]=tolower(c[i]);
		}
		j=c[i]-'a';
		counter[j]+=1;
	}
	
	for (i=0;i<26;i++){
		printf("%c : %d\n",text[i],counter[i]);
	}
		
	return 0;
}

Measured memory_bytes: 548
N,K = map(int,input().split())
number_of = [0]*N
for i in range(K):
  d = int(input())
  who_has = [int(x) for x in input().split()]
  for j in range(d):
    number_of[who_has[j]-1]+=1
print(number_of.count(0))
  

Measured memory_bytes: 67628
import sys

def main():
	input = sys.stdin.readline

	N, K, Q = list(map(int,input().strip().split()))
	count = [0]*N
	for i in range(Q):
		Ai = int(input().strip())
		count[Ai-1] += 1

	requirement = Q-K+1
	for i in range(N):
		if count[i]>=requirement:
			print('Yes')
		else:
			print('No')

if __name__ == "__main__":
    main()


Measured memory_bytes: 46940
#include<iostream>

using namespace std;

int main(){
    string s, t, u;
    int a, b;

    cin >> s >> t;
    cin >> a >> b;
    cin >> u;

    if(s == u){
        a--;
    }else if(t == u){
        b--;
    }

    cout << a << " " <<  b << endl;

    return 0;
}


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

int main() {
  int h_1;
  int m_1;
  int h_2;
  int m_2;
  int K;
  int time;
  cin >> h_1 >> m_1 >> h_2 >> m_2 >> K;
  if (h_1 == h_2){
    time = m_2 - m_1 - K;
    if (time > 0){
      cout << time << endl;
    }else{
      cout << 0 << endl;
    }
  }else{
    time = (h_2 - (h_1 + 1)) * 60 + (60 - m_1) + m_2 - K;
    if(time > 0){
      cout << time << endl;
    }else{
      cout << 0 << endl;
    }
  }
}

Measured memory_bytes: 3632
#include "bits/stdc++.h"
#pragma GCC optimize ("-O3")
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
//#include <boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision;
using namespace std;
 
#define all(c) (c).begin(),(c).end()
#define endl "\n"
#define ff first
#define ss second
#define allr(c) (c).rbegin(),(c).rend()
#define ifr(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define pof pop_front
#define pob pop_back
#define pb emplace_back
#define pf emplace_front
#define fstm(m,n,r) m.reserve(n);m.max_load_factor(r)
#define mp make_pair
#define mt make_tuple
#define inf LLONG_MAX
#define os tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
//order_of_key (k) : Number of items strictly smaller than k .
//find_by_order(k) : K-th element in a set (counting from zero).
const double PI = acos(-1);
typedef complex<double> cd;
typedef long long ll;
ll gcd(){return 0ll;} template<typename T,typename... Args> T gcd(T a,Args... args) { return __gcd(a,(__typeof(a))gcd(args...)); }
typedef map<ll,ll> mll;
typedef map<string,ll> msll;
typedef unordered_map<ll,ll> umap;
typedef vector<ll> vll;
typedef pair<ll,ll> pll;
typedef long double ld;
#define mod 1000000007 
#define N 100001
 
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
 
    int n;
    cin>>n;
    ll a[n];
    ifr(i,0,n) cin>>a[i];
    ll dp[n][n];
    ifr(i,0,n) ifr(j,0,n) dp[i][j]=0;
    ifr(i,0,n)
        dp[i][i]=a[i];

    for(int i=n-2;i>=0;i--) {
        for(int j=i+1;j<n;j++) {
            dp[i][j] = max(a[i]-dp[i+1][j], a[j]-dp[i][j-1]);
        }
    }
    cout<<dp[0][n-1]<<endl;
    return 0;
}

Measured memory_bytes: 73980
#include<iostream>
#include<vector>
#include<cmath>
#include<queue>
#include<utility>
#include<algorithm>

using namespace std;
#define INF 10000000

int main(){
  int d,g;cin >> d >> g;
  g=int(g/100);
  vector< pair<int,int> > pc(d);
  int P=0;int C=0;
  for(int i=0;i<d;i++){
    int p,c;cin >> p >> c;c=int(c/100);
    pc[i]=make_pair(p,c);
    C+=(c+p*(i+1));P+=p;
  }
  vector<int> dp(C+1,INF);
  for(int i=0;i<d;i++){
    vector<int> dp_sub(C+1,INF);
    for(int j=0;j<C+1;j++){
      if(j==0){
        for(int k=1;k<pc[i].first+1;k++){
          if(k!=pc[i].first){dp_sub[k*(i+1)]=k;}
          else{dp_sub[k*(i+1)+pc[i].second]=k;}
        }
      }else if(dp[j]!=INF){
        for(int k=1;k<pc[i].first+1;k++){
          if(k!=pc[i].first){
            dp_sub[j+k*(i+1)]=min(dp[j]+k,dp_sub[j+k*(i+1)]);
          }else{
            dp_sub[j+k*(i+1)+pc[i].second]=min(dp[j]+k,dp_sub[j+k*(i+1)+pc[i].second]);
          }
        }
      }
    }
    for(int j=0;j<C+1;j++){
      if(dp_sub[j]!=0){
        dp[j]=min(dp[j],dp_sub[j]);
      }
    }
  }
  int m=P;
  for(int i=g;i<C+1;i++){
    if(dp[i]!=0){m=min(m,dp[i]);}
  }
  cout << m << endl;
}


Measured memory_bytes: 1120
import numpy as np

n, m = map(int, input().strip().split())
array = [int(input()) for _ in range(m)]
is_broken = np.zeros(n + 1, dtype=np.bool)
for a in array:
    is_broken[a] = 1

a0 = 0
a1 = 1

if n == 1:
    if is_broken[n]:
        print(0)
    else:
        print(1)

else:
    for i in range(1, n + 1):
        if is_broken[i]:
            a2 = 0
        else:
            a2 = (a1 + a0) % 1000000007

        a0 = a1
        a1 = a2

    print(a1)


Measured memory_bytes: 16212
PROGRAM failingAsleep
      IMPLICIT NONE
      integer :: n
      integer :: t(50)
      character(100) :: s(50),x
      integer :: i
      logical :: flag = .false.
      integer(16) :: ans = 0
      
      read*,n
      do i = 1,n
        read*,s(i),t(i)
      end do
      read*,x
      
      
      do i = 1,n
        
        if( flag )then
          ans = ans + t(i)
        end if
        
        if(trim(s(i))==x)then
          flag = .true.
        end if
        
      end do
      
      print*,ans
      
      END PROGRAM

Measured memory_bytes: 640
def diameter(N, E):#diamete of a tree
    from collections import deque
    V = [-1]*N
    V[0] = 0
    q = deque([0])
    # s = 0
    while q:
        v = q.popleft()
        for w in E[v]:
            if V[w] == -1:
                # s = w
                V[w] = V[v] + 1
                q.append(w)
    s = V.index( max(V))
    p = deque([s])
    W = [-1]*N
    W[s] = 0
    while p:
        v = p.popleft()
        for w in E[v]:
            if W[w] == -1:
                W[w] = W[v] + 1
                p.append(w)
    return max(W)

N = int( input())
E = [ [] for _ in range(N)]
for _ in range(N-1):
    a, b = map( int, input().split())
    a, b = a-1, b-1
    E[a].append(b)
    E[b].append(a)
ans = "First"
if diameter(N, E)%3 == 1:
    ans = "Second"
print( ans)


Measured memory_bytes: 94668
#include <bits/stdc++.h>
// iostream is too mainstream
#include <cstdio>
// bitch please
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <cmath>
#include <iomanip>
#include <time.h>
#define dibs reserve
#define OVER9000 1234567890
#define ALL_THE(CAKE,LIE) for(auto LIE =CAKE.begin(); LIE != CAKE.end(); LIE++)
#define tisic 47
#define soclose 1e-8
#define chocolate win
// so much chocolate
#define patkan 9
#define ff first
#define ss second
#define abs(x) (((x) < 0)?-(x):(x))
#define uint unsigned int
#define dbl long double
#define pi 3.14159265358979323846
using namespace std;
// mylittledoge

using cat = long long;

#ifdef DONLINE_JUDGE
	// palindromic tree is better than splay tree!
	#define lld I64d
#endif

int main() {
	cin.sync_with_stdio(0);
	cin.tie(0);
	cout << fixed << setprecision(10);
	int N;
	cin >> N;
	vector<cat> A(N+2, 0), D(N+1);
	for(int i = 0; i < N; i++) {
		cin >> A[i+1];
		D[i] = A[i+1]-A[i];
	}
	D[N] = -A[N];
	int ans = 0;
	cat dp_sums[3] = {};
	for(int i = 0; i <= N; i++) {
		if(D[i] == 0) continue;
		dp_sums[2] = A[i+1];
		if(D[i] > 0)
			dp_sums[1] = min(A[i+1], max(dp_sums[1], dp_sums[0] + D[i]));
		else {
			dp_sums[1] = min(A[i+1], max(dp_sums[0], dp_sums[1] + D[i]));
			if(dp_sums[0] >= -D[i]) dp_sums[0] += D[i];
			else {
				dp_sums[0] = dp_sums[1];
				dp_sums[1] = A[i+1];
				ans++;
			}
		}
	}
	cout << ans << "\n";
	return 0;
}

// look at my code
// my code is amazing


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

using namespace std;

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

    string n;
    int r = 0, nine = 9;
    cin >> n;

    for (char i : n) {
        r += static_cast<int>(i) - 48;
    }

    if (r == 0) {
        cout << "Yes";
        return 0;
    }

    while (true) {
        nine += 9;
        if (nine == r) {
            cout << "Yes";
            return 0;
        }
        else if (nine > r) {
            cout << "No";
            return 0;
        }
    }
}


Measured memory_bytes: 3768
#include<stdio.h>
main(){
  int t,n,s,f,i,sum,se;
  while(1){
    sum=0;
    scanf("%d",&t);
    if(t==0)break;
    scanf("%d",&n);
    for(i=0;i<n;i++){
      scanf("%d %d",&s,&f);
      sum+=(f-s);
    }
    if(sum>=t){
      printf("OK\n");
    }else{
      printf("%d\n",t-sum);
    }
  }
  return 0;
}

Measured memory_bytes: 612
#include<bits/stdc++.h>
using namespace std;
typedef  long long ll;
using vll=vector<ll>;
using vi=vector<int>;

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;}

//pow(llpow,modpow)
template<class T> ll llpow(ll x,T n){ll ans=1;if(x==0)ans=0;while(n){if(n&1)ans*=x;x*=x;n>>=1;}return ans;}
long long modpow(long long a, long long n, long long mod) {long long res = 1;while (n > 0) {if (n & 1) res = res * a % mod;a = a * a % mod;n >>= 1;}return res;}
//最大公約数
template<class T> inline T gcd(T x,T y){if(y==0)return x; else {return gcd(y,x%y);}}
//最小公倍数
template<class T> inline T lcm(T x,T y){return x/gcd(x,y)*y;}
//逆元
long long modinv(long long a, long long m) {long long b = m, u = 1, v = 0;while (b) {long long t = a / b;a -= t * b; swap(a, b);u -= t * v; swap(u, v);}u %= m;if (u < 0) u += m;return u;}

#define rep(i,n) for(ll i=0;i<(ll)n;i++)
#define rep2(i, begin_i, end_i) for (ll i = (ll)begin_i; i < (ll)end_i; i++)

long long INF = 1LL<<60;
int main( ){
    int n,m;
    cin>>n>>m;
    cout<<n*(n-1)/2+m*(m-1)/2<<endl;
    return 0;
}




Measured memory_bytes: 256
#include<iostream>
#include<queue>
#include<utility>
#include<iomanip>

#define INF (1 << 29)
#define x pos.first
#define y pos.second

using namespace std;

typedef pair<int, int> Pos;


struct Path
{
    Pos pos;
    int cost;
};



//?????????
const int dx[2] = {-1, 1};

//?????????
const int dy[2] = {-1, 1};

int main()
{
    int w, h;
    while(cin >> w >> h, (w + h))
    {
        int map_ver[32][32];//???
        int map_hor[32][32];//?¨?
        int min_cost[31][31];

        for(int i = 0; i < h; i++)
        {
            for(int j = 0; j < w; j++)
            {
                min_cost[i][j] = INF;
            }
        }

        //*
        for(int i = 0; i < h; i++)
        {
            for(int j = 0; j < w - 1; j++)
            {
                cin >> map_ver[i][j];
            }
            if(i < h - 1)for(int j = 0; j < w; j++)
            {
                cin >> map_hor[i][j];
            }
        }
        //*/

        queue< Path > path;

        path.push(Path{ Pos(0, 0), 1 });
        min_cost[0][0] = 1;

        //*
        while(!path.empty())
        {
            const Path now = path.front();
            path.pop();

            for(int i = 0; i < 2; i++)
            {
                const int nextCost = now.cost + 1;
                
                const int nextX = now.x + dx[i];
                if(0 <= nextX && nextX < w)
                {
                    //?¨?????????? ver
                    int nextX_sub = now.x + i - 1;

                    bool edge = nextX_sub < 0 || nextX_sub >= w;
                    nextX_sub = max(0, min(nextX_sub, w - 1));

                    if(map_ver[now.y][nextX_sub] == 0 && !edge)
                    {
                        if(min_cost[now.y][nextX] > nextCost)
                        {
                            min_cost[now.y][nextX] = nextCost;
                            path.push( Path{ Pos(nextX, now.y), nextCost } );
                        }
                    }
                }


                const int nextY = now.y + dy[i];
                if(0 <= nextY && nextY < h)
                {
                    //??????????????? hor
                    
                    int nextY_sub = now.y + i - 1;

                    bool edge = nextY_sub < 0 || nextY_sub >= h;
                    nextY_sub = max(0, min(nextY_sub, h - 1));

                    if(map_hor[nextY_sub][now.x] == 0 && !edge)
                    {
                        if(min_cost[nextY][now.x] > nextCost)
                        {
                            min_cost[nextY][now.x] = nextCost;
                            path.push( Path{ Pos(now.x, nextY), nextCost } );
                        }
                    }
                }

            }

        }
        /*
        for(int i = 0; i < h; i++)
        {
            for(int j = 0; j < w; j++)
            {
                cout << setw(3) << min(100, min_cost[i][j]) << " ";
            }
            cout << endl;
        }
        //*/
        cout << ((min_cost[h - 1][w - 1] == INF) ? 0 : min_cost[h - 1][w - 1]) << endl;
    }   

}

Measured memory_bytes: 3044
#include <iostream>
#include <cstdio>
#include <string>
#include <list>
#include <algorithm>
using namespace std;
int main(){
    int q,x;
    string com;
    list<int> v;
    cin>>q;
    for (int i = 0; i < q; ++i) {
        cin>>com;
        if(com[0]=='i'){
            cin>>x;
            v.push_front(x);
        }else if(com[6]=='L') v.pop_back();
        else if(com[6]=='F') v.pop_front();
        else if(com[0]=='d'){
            cin>>x;
            for (list<int>::iterator it=v.begin();it!=v.end();it++) {
                if(*it==x){
                    v.erase(it);
                    break;
                }
            }
        }
    }
    int i=0;
    for (list<int>::iterator it=v.begin();it!=v.end();it++){
        if(i++) printf(" ");
        printf("%d",*it);
    }
    printf("\n");
    return 0;
}



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

using namespace std;
#define BUF (10)
#define ll long long 

int n;
char s[BUF];

int main(void){
	cin >> s;
	n = strlen(s);

	int cnt = 0;
	int ans = 0;
	for(int i=0;i<n;++i){
		if(s[i]=='0') cnt++;
		ans += s[i] - '0';
	}

	if(s[0]=='1' && n-cnt==1){
		cout << 10 << endl;
		return 0;
	}

	cout << ans << endl;

	return 0;
}


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

using namespace std;

int main() {
		int N, K;
		cin >> N >> K;
		vector<int> x(N, 0);
		for (int i = 0; i < N; i++) {
				cin >> x[i];
		}

		int ans = 1e9;
		for (int i = 0; i+K-1 < N; i++) {
				int t = min(abs(x[i]), abs(x[i+K-1]));
				t += x[i+K-1] - x[i];
				ans = min(t, ans);
		}

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


Measured memory_bytes: 640
n=int(input())
l=sorted(list(map(int,input().split())))
ans=0
for i in range(n):
  for j in range(i+1,n):
    for k in range(j+1,n):
      if l[k]<l[j]+l[i] and l[i]!=l[j] and l[j]!=l[k]:
        ans+=1
print(ans)

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

using namespace std;
typedef long long ll;
vector<ll> ar;
const ll MAX = 3010;
vector<vector<ll>> dp(MAX, vector<ll>(MAX, -1));

ll ans = 0;
ll func(ll s, ll e)
{
    if (s > e)
    {
        return 0;
    }
    if (dp[s][e] != -1)
    {
        return dp[s][e];
    }
    else
    {
        dp[s][e] = max(ar[s] - func(s + 1, e), ar[e] - func(s, e - 1));
        return dp[s][e];
    }
}
int main()
{
    ll n;
    cin >> n;
    ar = vector<ll>(n);
    for (int x = 0; x < n; x++)
    {
        cin >> ar[x];
    }
    ll s = 0, e = n - 1;
    ll score = 0;
    func(s, e);
    cout << dp[s][e] << endl;
}

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

const int INF = 1e9;
const int MOD = 1e9 + 7;
int x, n, m;
vector<vector<int>> pd(12, vector<int>(2e6, INF));
int A[12][12];
int custos[12];

int mochila(int v, int custo, int *skills) {
	if (v == n) {
		int i;
		for (i = 0; i < m && skills[i] >= x; i++);
		if (i == m)
			return 0;
		else {
			return INF;
		}
	}

	if (pd[v][custo] != INF) return pd[v][custo];
	
	for (int i = 0; i < m; i++)
		skills[i] += A[v][i];
	pd[v][custo] = min(pd[v][custo], custos[v] + mochila(v + 1, custo + custos[v], skills));
	for (int i = 0; i < m; i++)
		skills[i] -= A[v][i];
	pd[v][custo] = min(pd[v][custo], mochila(v + 1, custo, skills));
	
	
	return pd[v][custo];
}

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

  cin >> n >> m >> x;
  for (int j = 0; j < n; j++) {
    cin >> custos[j];
    for (int i = 0; i < m; i++) {
      cin >> A[j][i];
    }
  }
  
  int skills[12];
  memset(skills, 0, sizeof skills);
  int r = mochila(0, 0, skills);
  if (r >= INF)
	cout << -1;
  else
	cout << r;
  cout << endl;

  return 0;
}


Measured memory_bytes: 104648
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		
		try (Scanner sc = new Scanner(System.in);) {
			
			int n = sc.nextInt();
			
			int taroPoint = 0;
			int hanakoPoint = 0;
			
			for(int i = 0; i < n; i++) {
				String taroCard = sc.next();
				String hanakoCard = sc.next();
				
				int result = taroCard.compareTo(hanakoCard);
				
				if(result < 0) {
					hanakoPoint += 3;
				} else if(result == 0) {
					taroPoint++;
					hanakoPoint++;
				} else {
					taroPoint += 3;
				}
			}
			
			System.out.println(taroPoint + " " + hanakoPoint);
		}
	}
}


Measured memory_bytes: 29160
#include <stdio.h>
#include <string>
#include <iostream>
#include <iomanip>
#include <map>
#include <algorithm>
#include <vector>
using namespace std;

int main(void) {
	string a,b;
	cin >> a >> b;
	string ans;
	if(a==b)ans="EQUAL";
	else if(a.length()>b.length()){
		ans="GREATER";
	}else if(a.length()<b.length()){
		ans="LESS";
	}else {
		ans=a>b?"GREATER":"LESS";
	}
	cout << ans << endl;
	return 0;
}

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


int main() {
  int W, H, x, y;
  scanf ("%d %d %d %d", &W, &H, &x, &y);
  
  printf("%0.1f %d", 1.0 * W * H /2, (2*x == W && 2*y == H) ? 1 :0);
  return 0;
}




Measured memory_bytes: 128
#include "bits/stdc++.h"

#define REP(i,num) for(int i=0;i<(num);++i)
#define LOOP(i) while(i--)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto pitr=c.begin();pitr!=c.end();++pitr){cout<<*pitr;if(next(pitr,1)!=c.end())cout<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);

	int A=in(),B=in();
	
	REP(i,100000){
		int C=floor(i*0.08),D=floor(i*0.1);
		if(C==A && D==B){
			out(i);
			return 0;
		}
	}
	out(-1);
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <functional>
#include <bitset>

using namespace std;
using lint = long long int;
long long int INF = 1001001001001001LL;
int inf = 1000000007;
long long int MOD = 1000000007LL;
double PI = 3.1415926535897932;

template<typename T1,typename T2>inline void chmin(T1 &a,const T2 &b){if(a>b) a=b;}
template<typename T1,typename T2>inline void chmax(T1 &a,const T2 &b){if(a<b) a=b;}

#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()

/* do your best */


// quoted from beet-aizu
template <typename T, typename E, typename F, typename G>
struct SegmentTree{
    // using F = function<T(T, T)>
    // using G = function<T(T, E)>
    int n;
    F f;
    G g;
    T ti;
    vector<T> dat;
    SegmentTree(){};
    SegmentTree(F f,G g,T ti):f(f),g(g),ti(ti){}
    void init(int n_){    
        n=1;
        while(n<n_) n<<=1;
        dat.assign(n<<1,ti);
    }
    void build(const vector<T> &v){
        int n_=v.size();
        init(n_);
        for(int i=0;i<n_;i++) dat[n+i]=v[i];
        for(int i=n-1;i;i--)
            dat[i]=f(dat[(i<<1)|0],dat[(i<<1)|1]);
    }
    void update(int k,const E &x){
        k += n;
        dat[k] = g(dat[k], x);
        while(k>>=1)
            dat[k]=f(dat[(k<<1)|0],dat[(k<<1)|1]);    
    }
    T operator [](int k) const { return dat[k+n]; }
    T query(int a,int b) const {
        T vl=ti,vr=ti;
        for(int l=a+n,r=b+n;l<r;l>>=1,r>>=1) {
            if(l&1) vl=f(vl,dat[l++]);
            if(r&1) vr=f(dat[--r],vr);
        }
        return f(vl,vr);
    }

    /* TODO わからない 聞く 
    template<typename C>
    int find(int a,int b,C &check,int k,int l,int r){
        if(!check(dat[k])||r<=a||b<=l) return -1;
        if(k>=n) return k-n;
        int m=(l+r)>>1;
        int vl=find(a,b,check,(k<<1)|0,l,m);
        if(~vl) return vl;
        return find(a,b,check,(k<<1)|1,m,r);
    }
    template<typename C>
    int find(int a,int b,C &check){
        return find(a,b,check,1,0,n);
    }*/
    
};


int main(){
  using T = lint;  // type T
  using E = lint;  // type E
  auto f = [](T a, T b){ // return type T value
    return a + b;
  };
  auto g = [](T a, E b){ // return type T value
    return b;  // return b;
  };
  T ti = 0;  // identify element
  SegmentTree<T, E, decltype(f), decltype(g)> sg(f, g, ti);  // don't change
  lint n; cin >> n;
  sg.build(vector<lint> (n, 0));   // 初期配列を代入
  vector<lint> p(n);
  for(int i = 0; i < n; i++) cin >> p[i];
  vector<pair<lint, lint>> vp;
  for(int i = 0; i < n; i++) {
    vp.push_back({p[i], i});
  }

  sort(RALL(vp));

  lint ans = 0;
  for(int i = 0; i < n; i++) {
    int id = vp[i].second;
    lint sum = sg.query(0, id);
    if(sum == id) ans++;
    sg.update(id, 1);
  }

  cout << ans << endl;
}


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

using namespace std; 

using ll = long long;

int main() {
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    
    ll mod = 998244353;
    static ll dp[3001][3001];
    
    dp[a][b] = 1;
    
    for (int i = a + 1; i <= c; i++) {
        dp[i][b] = dp[i - 1][b] * b % mod;
    }
    
    for (int j = b + 1; j <= d; j++) {
        dp[a][j] = dp[a][j - 1] * a % mod;
    }
    
    for (int i = a + 1; i <= c; i++) {
        for (int j = b + 1; j <= d; j++) {
            dp[i][j] = (dp[i][j] + dp[i][j - 1] * i % mod) % mod;
            dp[i][j] = (dp[i][j] + dp[i - 1][j] * j % mod) % mod;
            dp[i][j] = (dp[i][j] + (mod - dp[i - 1][j - 1] * (i - 1) % mod * (j - 1) % mod)) % mod;
        }
    }
    
    cout << dp[c][d] << endl;
}

Measured memory_bytes: 73360
#include <bits/stdc++.h>
using namespace std;
#define anuj ios_base::sync_with_stdio(false);cin.tie(NULL)
#define fo(i,n) for(int i=0;i<n;i++)
#define Fo(i,k,n) for(int i=k;i<n;i++)
#define ll long long int
#define si(x)	scanf("%d",&x)
#define sl(x)	scanf("%I64d",&x)
#define ss(s)	scanf("%s",s)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define clr(x) memset(x, 0, sizeof(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
#define endl '\n'
typedef pair<int, int>	pii;
typedef pair<ll, ll>	pll;
typedef vector<int>		vi;
typedef vector<ll>		vl;
typedef vector<pii>		vpii;
typedef vector<pll>		vpll;
typedef vector<vi>		vvi;
typedef vector<vl>		vvl;
const int mod = 1000000007;
const int N = 2e5;
const int LG = 20;
int a[N];

// ll maxi(ll a,ll b){
// 	return a>=b?a:b;
// }

int main(){
	anuj;

	int n,W;
	cin >> n >> W;

	ll dp[n+1][W+1];

	fo(i,n+1) dp[i][0]=0;
	fo(i,W+1) dp[0][i]=0;

	ll val[n],wt[n];

	fo(i,n)
		cin >> wt[i] >> val[i];

	Fo(i,1,n+1)
		Fo(j,1,W+1){
			dp[i][j]=dp[i-1][j];
			if(wt[i-1]<=j)
				dp[i][j]=max(dp[i][j],val[i-1]+dp[i-1][j-wt[i-1]]);
		}


	cout << dp[n][W];	

}


Measured memory_bytes: 79232
use std::str::FromStr;
use std::fmt::Debug;
use std::cmp;
#[allow(dead_code)]
fn read_as_vec<T>() -> Vec<T>
where T: FromStr, <T as FromStr>::Err : Debug{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().split_whitespace().map(|c| T::from_str(c).unwrap()).collect()

}

#[allow(dead_code)]
fn read_as_string() -> String{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

fn main(){
    let s = read_as_string().chars().collect::<Vec<char>>();

    println!("{}", s.into_iter().filter(|x| *x == 'o').count()*100 + 700);
}


Measured memory_bytes: 4352