akhauriyash/Code-Regression huggingface dataset:
import java.util.*;

class Main{

     public static void main(String []args){
        Scanner sc = new Scanner(System.in);
        
        int a = sc.nextInt();
        int b = sc.nextInt();
        
        int yoko = 2 * b;
        
        if(a <= yoko) System.out.println(0);
        else System.out.println(a - yoko);
     }
}

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


int main()
{
  int n;
  cin >> n;
  vector<int> L(n);
  rep(i, n)
    cin >> L[i];
  sort(L.begin(), L.end());
  ll ans = 0;
  rep(i, n - 2)
    for (int j = i + 1; j < n - 1; j++)
    {
      int l = j;
      int r = n;
      while (l + 1 < r)
      {
        int mid = (l + r) / 2;
        if (L[mid] < L[i] + L[j])
          l = mid;
        else
          r = mid;
      }
      ans += l - j;
    }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 384
import java.util.*

fun money(x: Int): Int {
    return when(x) {
        3 -> 100000
        2 -> 200000
        1 -> 300000
        else -> 0
    }
}

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val x = sc.nextInt()
    val y = sc.nextInt()
    println(money(x) + money(y) + if (x == 1 && y == 1) 400000 else 0)
}

Measured memory_bytes: 31256
s = input()
n = len(s)
a = 0
b = 0
for i in range(0,n,2):
    if s[i:i+1] == "0":
        a += 1

for i in range(1,n,2):
    if s[i:i+1] == "1":
        b += 1

print(min(a + b,n - a - b))

Measured memory_bytes: 3188
n,k,q=map(int,input().split())
a=list((k-q) for i in range(n))
for i in range(q):
    s=int(input())
    a[s-1]+=1
for i in range(n):
    if(a[i]>0):
        print("Yes")
    else:
        print("No")

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

int main() {
  long long x, y;
  cin >> x >> y;

  int ans = 1;
  while (true) {
    x = 2 * x;
    if (x > y) break;
    ans++;
  }

  cout << ans << endl;

  return 0;

}


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

static class AffineCipher
{
    static void Main()
    {
        var alpha = new[] { 1, 3, 5, 7, 9, 11, 15, 17, 19, 21, 23, 25, };
        var beta = Enumerable.Range( 0, 26 ).ToArray();

        var indata = Console.In.ReadToEnd()
            .Split( 
                new[] { '\r', '\n' },
                StringSplitOptions.RemoveEmptyEntries )
            .Skip( 1 );
        var q =
            from cipher in indata
            let sentence =
                from a in alpha
                from b in beta
                let trial = 
                    new string( Array.ConvertAll( 
                        cipher.ToArray(),
                        x => x == ' ' ? x : Encrypt( a, b, x ) ) )
                where trial.Split( ' ' )
                    .Where( x => x.Length == 4 )
                    .Any( x => x == "that" || x == "this" )
                select trial
            select sentence.First();
        foreach ( var s in q )
            Console.WriteLine( s );
    }

    static char Encrypt(int a, int b, char g)
    {
        return (char)( 'a' + ( a * ( g - 'a' ) + b ) % 26 );
    }
}

Measured memory_bytes: 6036
#include <iostream>

using namespace std;

int table[22][22],count;


void DFS(int,int);

int main(){
  int W,H,firstW,firstH;
  char a;


  while(cin >> W && cin >> H && W && H){
      count = 0;
  for(int i= 0;i < H+2;i++){
    for(int j = 0;j < W+2;j++){
      if(i == 0 || i == H+1)table[j][i] = 0;
      else table[0][i] = table[W+1][i] = 0;
    }
  }

  
    for(int i=1;i<H+1;i++){
      for(int j=1;j<W+1;j++){
          cin >> a;
          if(a == '.') table[j][i] = 1;
          if(a == '#') table[j][i] = 0;
          if(a == '@') table[j][i] = 1,firstW = j,firstH = i;
        }
      
    }


    DFS(firstW,firstH);
    cout << count << endl;
  }
  return 0;
}

void DFS(int W,int H) {
  count++;
  table[W][H] = 0;
  if(table[W-1][H] == 1) DFS(W-1,H);
  if(table[W][H-1] == 1) DFS(W,H-1);
  if(table[W+1][H] == 1) DFS(W+1,H);
  if(table[W][H+1] == 1) DFS(W,H+1);
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
	
	int n, l; cin >> n >> l;
	vector<string> c(n);
	for (int i = 0; i < n; i++) {
		cin >> c[i];
	}
	sort(c.begin(), c.end());
	string ans = "";
	for (int i = 0; i < n; i++) {
		ans += c[i];
	}
	cout << ans << endl;
	return 0;
}

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

#define ll long long
#define endl "\n"
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

const int MAX = 1e5 + 5;
int a[MAX];
int freq[MAX];

int main()
{
	IOS
	int t = 1;
	//cin >> t;
	while(t--)
	{
		int n;
		cin >> n;
		ll sum = 0;
		for(int i = 1; i <= n; i++)
		{
			cin >> a[i];
			freq[a[i]]++;
			sum += a[i];
		}
		int q;
		cin >> q;

		ll woo[q + 1];
		for(int i = 1; i <= q; i++)
			woo[i] = 0;

		ll ans = sum;
		for(int i = 1; i <= q; i++)
		{
			int b, c;
			cin >> b >> c;
			ll ct = freq[b];
			ans -= (ct * b);
			freq[b] = 0;
			ans += (ct * c);
			freq[c] += ct;
			woo[i] = ans;
		}
		for(int i = 1; i <= q; i++)
			cout << woo[i] << endl;
	}
	return 0;
}


Measured memory_bytes: 5184
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pl;
typedef vector<pl> vp;
#define fore(i,a,b) for(ll i=(ll)(a);i<=(ll)(b);++i)
#define rep(i,n) fore(i,0,(n)-1)
#define rfore(i,a,b) for(ll i=(ll)(b);i>=(ll)(a);--i)
#define rrep(i,n) rfore(i,0,(n)-1)
#define all(x) (x).begin(),(x).end()
const ll INF=1001001001;
const ll LINF=1001001001001001001;
const ll D4[]={0,1,0,-1,0};
const ll D8[]={0,1,1,0,-1,-1,1,-1,0};
template<class T>
bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>
bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}
const string YES = "Yes";
const string NO = "No";

void solve(long long H, long long W, long long h, long long w){
    if(H%h==0&&W%w==0){
        cout<<NO<<endl;
        return;
    }

    cout<<YES<<endl;
    ll v=(ll)1e9/(h*w);
    vvl ans(H,vl(W));
    rep(i,H){
        rep(j,W){
            if(j>0)cout<<" ";
            if((i+1)%h|(j+1)%w)cout<<v;
            else cout<<-(v*(h*w-1)+1);
        }
        cout<<endl;
    }

}

int main(){
    long long H;
    scanf("%lld",&H);
    long long W;
    scanf("%lld",&W);
    long long h;
    scanf("%lld",&h);
    long long w;
    scanf("%lld",&w);
    solve(H, W, h, w);
}


Measured memory_bytes: 4736
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<int(n);++i)
#define all(a) a.begin(),a.end()
  
// T := [T][T]... | num 
  
int solve(string const &s, int &i){
    vector<int> v;
    if(isdigit(s[i])){
        int num = 0;
        while(isdigit(s[i])){
            num = num*10 + s[i]-'0';
            i++;
        }
        return num+1;
    }
    while(s[i] == '['){
        i++; // [
        v.push_back(solve(s,i));
        i++; // ]
    }
  
    sort(all(v));
    int n = v.size(), sum = 0;
    rep(k,(n+1)/2){
        sum += v[k];
    }
    return sum;
}
  
int main(void){
    int T;
    cin>>T;
    rep(_,T){
        string s;
        cin>>s;
        int index = 0;
        cout<<(solve(s,index)+1)/2<<endl;
    }
    return 0;
}


Measured memory_bytes: 3116
//------------------------------------------
// C++ templete 
//------------------------------------------
#include <bits/stdc++.h>
using namespace std;

#define endl "\n"

//typedef
//------------------------------------------
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VP;

//REPEAT
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//container util
//------------------------------------------
#define pb push_back
#define paired make_pair
#define ALL(a) (a).begin(),(a).end()
#define PRINT(V) for (auto v : (V)) cout << v << " "
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())

//constant
//------------------------------------------
const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

//math
//------------------------------------------
int QP(int a,int b){int ans=1;do{if(b&1)ans=1ll*ans*a%MOD;a=1ll*a*a%MOD;}while(b>>=1);return ans;}
int QP(int a,int b,int MOD){int ans=1;do{if(b&1)ans=1ll*ans*a%MOD;a=1ll*a*a%MOD;}while(b>>=1);return ans;}
int GCD(int a,int b){return b?GCD(b,a%b):a;}

//debug
//------------------------------------------
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//grobal variable
//------------------------------------------
int N,M;
VI Vec;

int main() 
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
  
    string S; cin >> S;
    
    for (int i=2; i<S.size(); i+=2)
    {
        if (S.substr(0,(S.size()-i)/2) == S.substr((S.size()-i)/2, (S.size()-i)/2)) 
        {
            cout << (S.size() - i) << endl;
            break;
        }
    }

    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <set>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <fstream>
#include <bitset>
#include <queue>
#include <stack>
#include <deque>
#include <time.h>

using std::cin;
using std::cout;
using std::cerr;
using std::endl;

using std::map;
using std::set;
using std::bitset;
using std::vector;
using std::string;
using std::multimap;
using std::multiset;
using std::deque;
using std::queue;
using std::stack;
using std::pair;
using std::iterator;

using std::sort;
using std::stable_sort;
using std::reverse;
using std::max_element;
using std::min_element;
using std::unique;
using std::ios_base;
using std::swap;
using std::min;
using std::max;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef string S;

namespace MySpace{
    struct Small_Segment_Tree{
        vector<int> a;
        int l, r;

        private:
        int __summ(int L, int R, int l, int r, int v)
        {
            if (L <= l && r <= R)
                return a[v];
            if (R <= l || r <= L)
                return 0;
            int m = (l + r) / 2;
            return __summ(L, R, l, m, 2 * v + 1) + __summ(L, R, m, r, 2 * v + 2);
        }

        void __set(int P, int l, int r, int v, int V)
        {
            if (l + 1 == r)
            {
                a[v] = V;
                return;
            }
            int m = (l + r) / 2;
            if (P < m)
            {
                __set(P, l, m, 2 * v + 1, V);
                a[v] = a[2 * v + 1] + a[2 * v + 2];
            }
            else
            {
                __set(P, m, r, 2 * v + 2, V);
                a[v] = a[2 * v + 1] + a[2 * v + 2];
            }
        }

        public:
        int Summ(int L, int R)
        {
            if (R < L)
                return 0;
            return __summ(L, R + 1, l, r, 0);
        }

        void Set(int P, int V)
        {
            __set(P, l, r, 0, V);
        }

        Small_Segment_Tree(int _n)
        {
            a.resize(4 * _n);
            l = 0, r = _n;
        }
    };
};

using std::__gcd;
using std::abs;
using namespace MySpace;

#define F(i, n) for (int (i) = 0; (i) != (n); (i)++)
#define fi first
#define se second
#define re return
#define all(x) (x).begin(), (x).end()
const ll MOD = 1e9 + 7;


ll n, k;
pll ab[255000];

bool comp2(pll aa, pll bb)
{
    return aa.second < bb.second;
}

signed main()
{
    srand(time(NULL));
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> ab[i].first >> ab[i].second;
    }
    sort(ab, ab + n, comp2);
    ll t = 0;
    for (int i = 0; i < n; i++)
    {
        t += ab[i].first;
        if (t > ab[i].second)
        {
            cout << "No";
            return 0;
        }
    }
    cout << "Yes";
}


Measured memory_bytes: 3456
#include<iostream>
#include<vector>
using namespace std;
int main()
{
    int n;
    cin>>n;
    vector<long long int> arr(n+1);
    for(int i=1;i<=n;i++)
    {
        cin>>arr[i];
    }
    vector<long long int> dp(n+1);
    dp[0]=0;
    dp[1]=0;
    dp[2]=abs(arr[1]-arr[2]);
    for(int i=3;i<=n;i++)
    {
        dp[i]=min(dp[i-1]+abs(arr[i]-arr[i-1]),dp[i-2]+abs(arr[i]-arr[i-2]));
        // cout<<dp[i]<<" ";
    }
    cout<<dp[n];
}

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

long long A[12][12];

int main() {
  long long N, M, X;
  cin >> N >> M >> X;
  vector<long long> C(N);
  for (long long i = 0; i < N; i++) {
    cin >> C[i];
    for (long long j = 0; j < M; j++) {
      cin >> A[i][j];
    }
  }
  long long sum_c = -1;
  for (long long bit = 0; bit < (1<<N); ++bit) {
    long long tmp = 0;
    vector<long long> t_sum(M, 0);
    for (long long i = 0; i < N; i++) {
      if (bit & (1<<i)) {
        tmp += C[i];
        for (long long j = 0; j < M; j++) {
          t_sum[j] += A[i][j];
        }
      }
    }
    bool flag = true;
    for (long long j = 0; j < M; j++) {
      if (t_sum[j] < X) {
        flag = false;
        break;
      }
    }
    if (!flag) continue;
    if (sum_c == -1) {
      sum_c = tmp;
    } else {
      sum_c = sum_c > tmp ? tmp : sum_c;
    }
  }
  cout << sum_c << endl;
  return 0;
}

Measured memory_bytes: 3632
#入力（後でいじる）
def pin(type=int):
    return map(type,input().split())
#どっかで最悪計算量の入力データを用意する関数を作ろう？
"""
O(N^2)
"""
#solution:
#潜 影 蛇 手 ! !
*c,N=pin()
c.sort(reverse=True)
ans=0


I=(N//c[0])+1
J=N//c[1]+1
for i in range(I):
    for j in range(J):
        remain=(N-i*c[0]-j*c[1])
      
        if remain>=0 and remain%c[2]==0:
            
            ans+=1
            
print(ans)

Measured memory_bytes: 40684
#include <bits/stdc++.h>
#define mod 1000000007
using namespace std;

int dp[101][100001];

int findTotalWays(int childs, int candies, vector < int > &maxCandies) {
  memset(dp, -1, sizeof(dp));
  for (int i = 0; i < childs + 1; i++) {
    dp[i][0] = 1;
  }
  for (int j = 1; j < candies + 1; j++) {
    dp[0][j] = 0;
  }

  vector < int > sum(candies + 2, 0);

  for (int i = 1; i < childs + 1; i++ ) {
    sum[0] = 0;
    for (int j = 1; j <= candies + 1; j++) {
      sum[j] = ((sum[j - 1] % mod) + (dp[i - 1][j - 1] % mod)) % mod;
    }
    for (int j = 1; j < candies + 1; j++) {
      if (j - maxCandies[i - 1] < 0) {
        dp[i][j] = (sum[j + 1] - sum[0] + mod) % mod;
      } else {
        dp[i][j] = (sum[j + 1] - sum[j - maxCandies[i - 1]] + mod) % mod;
      }
    }
  }

  return dp[childs][candies];
}

int main() {
  int childs;
  int candies;
  cin>>childs;
  cin>>candies;
  vector < int > maxCandies;
  int maxCandy;
  for (int i = 0; i < childs; i++) {
    cin>>maxCandy;
    maxCandies.push_back(maxCandy);
  }
  cout<<findTotalWays(childs, candies, maxCandies)<<endl;
  return 0;
}


Measured memory_bytes: 43076
/*  CREATED BY
    STREAM_CIPHER
    29-aug-2020
*/
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define double long double
#define debug1(a) cout<<#a<<"="<<(a)<<"\n"
#define debug2(a,b) cout<<#a<<"="<<(a)<<","<<#b<<"="<<(b)<<"\n"
#define debug3(a,b,c) cout<<#a<<"="<<(a)<<","<<#b<<"="<<(b)<<","<<#c<<"="<<(c)<<"\n"
#define fix_precision(n) cout << fixed << setprecision(n)
#define all(a) a.begin(),a.end()
const double pi=acos(-1.0);
int inf=0x3f3f3f3f3f3f3f3f;
const int mod=1e9+7;
const int mx=5*1000000;
int cpd[2000000];
void SieveOfEratosthenes(int n) 
{ 
    memset(cpd,0,sizeof cpd);
    bool prime[n+1]; 
    memset(prime, true, sizeof(prime)); 
  
    for (int p=2; p*p<=n; p++) 
    { 
        if (prime[p] == true) 
        {
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    } 
    for (int p=2; p<=n; p++) 
       if (prime[p]) 
          cpd[p]=p;
    for(int i=2;i<=n;i++)
    {
        if(cpd[i]==i)
        {
            for(int j = 2*i;j<=n;j+=i)
            {
                cpd[j]=i;
            }
        }
    }
} 
vector<int> find(int n)
{
	vector<int>ans;
	unordered_map<int,int>cnt;
	while(n!=1)
	{
		cnt[cpd[n]]++;
		if(cnt[cpd[n]]==1)
			ans.push_back(cpd[n]); 
		n = n / cpd[n]; 
	}
	return ans;
}
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        // freopen("output.txt","w",stdout);
    #endif
        SieveOfEratosthenes(1000100);
        int n;
        cin>>n;
        vector<int>a(n);
        for(auto &i:a)
        	cin>>i;
        map<int,int>div;
        vector<int>ff=find(a[n-1]);
        for(auto i:ff)
        	div[i]=1;
        bool ok1=true;
        for(int i=n-2;i>=0;i--)
        {
        	vector<int>ff2=find(a[i]);
        	for(auto j:ff2)
        	{
        		if(div[j]!=0)
        		{
        			ok1=false;
        			break;
        		}
        	}
        	if(!ok1)
        		break;
        	else
        	{
        		for(auto j:ff2)
	        	{
	        		div[j]=1;
	        	}
        	}
        }
        if(ok1)
        {
        	cout<<"pairwise coprime\n";
        	return 0;
        }
        int gg=a[0];
        for(auto i:a)
        {
        	// cout<<i<<" ";
        	gg=gcd(gg,i);
        	// debug1(gg);
        }
        if(gg==1)
        	cout<<"setwise coprime\n";
        else
        	cout<<"not coprime\n";

}

Measured memory_bytes: 27764
/* {{{ Shinobu kawaii */
/*
  ______   __        _                  __                 
.' ____ \ [  |      (_)                [  |                
| (___ \_| | |--.   __   _ .--.   .--.  | |.--.   __   _   
 _.____`.  | .-. | [  | [ `.-. |/ .'`\ \| '/'`\ \[  | | |  
| \____) | | | | |  | |  | | | || \__. ||  \__/ | | \_/ |, 
 \______.'[___]|__][___][___||__]'.__.'[__;.__.'  '.__.'_/ 

*/
// clang-format off
/* }}} */

#include <bits/stdc++.h>
using namespace std;

// #define int long long
struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast;

/* cpp template {{{ */

/* short */
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) (v).begin(), (v).end()
#define X real()
#define Y imag()

/* REPmacro */
#define REPS(i, a, n) for (int i = (a); i < (n); ++i)
#define REP(i, n) REPS(i, 0, n)
#define RREP(i, n) REPS(i, 1, n + 1)
#define DEPS(i, a, n) for (int i = (a); i >= n; --i)
#define DEP(i, n) DEPS(i, n, 0)

/* debug */
#define debug(x) cerr << x << " " << "(L:" << __LINE__ << ")" << '\n';

/* alias */
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using pii = pair<int, int>;
using D = double;
using P = complex<D>;
template <typename T> using PQ = priority_queue<T>;
template <typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

/* const */
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;
const D EPS = 1e-9;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

/* func */
inline bool inside(int y, int x, int H, int W) {return y >= 0 && x >= 0 && y < H && x < W;}
inline int in() {int x; cin >> x; return x;}
template <typename T> inline bool chmin(T& a, const T& b) {if (a > b) a = b; return a > b;}
template <typename T> inline bool chmax(T& a, const T& b) {if (a < b) a = b; return a < b;}
template <typename T> inline void print(const T& x) {cout << x << '\n';}
template <typename T, typename S> inline void print(const pair<T, S>& p) {cout << p.first << " " << p.second << '\n';}
template <typename T, typename S> inline void print(const vector<pair<T, S>>& v) {
  REP(i, v.size()) print(v[i]);
}
template <typename T> inline void print(const vector<T>& v, string s = " ") {
  REP(i, v.size()) {
    if (i != 0) cout << s;
    cout << v[i];
  }
  cout << '\n';
}
// clang-format on
/* }}} */

signed main() {
  int w = in(), h = in(), n = in();
  int len[] = {0, w, 0, h};

  REP(_, n) {
    int x = in(), y = in(), a = in();
    if (a == 1) {
      chmax(len[0], x);
    } else if (a == 2) {
      chmin(len[1], x);
    } else if (a == 3) {
      chmax(len[2], y);
    } else {
      chmin(len[3], y);
    }
  }
  //REP(i, 4) debug(len[i]);
  int resw = len[1] - len[0],
      resh = len[3] - len[2];
  if (resw < 0 || resh < 0) {
    print(0);
  } else {
    print(resw * resh);
  }

  return 0;
}


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

using namespace std;

int main()
{
    int n;
    cin >> n;

    string t[4];
    int s[4] = {0, 0, 0, 0};

    t[0] = "AC";
    t[1] = "WA";
    t[2] = "TLE";
    t[3] = "RE";

    for (int i = 0; i < n; ++i) {
        string c;
        cin >> c;
        if (c == "AC") {
            s[0]++;
        } else if (c == "WA") {
            s[1]++;
        } else if (c == "TLE") {
            s[2]++;
        } else {
            s[3]++;
        }
    }

    for (int i = 0; i < 4; ++i) {
        cout << t[i];
        cout << " x ";
        cout << s[i];
        cout << '\n';
    }

    return 0;
}


Measured memory_bytes: 3620
#include <cstdio>
using namespace std;
int n,m;
int ans1,ans2;
int pen[100005];
bool ok[100005];
int main(){
	scanf("%d%d",&n,&m);
	for (int i=1;i<=m;i++){
		int p;
		char ch[2];
		scanf("%d%s",&p,ch);
		if (ok[p]) continue;
		if (ch[0]=='A'){
			ok[p]=true;
			++ans1;
			ans2+=pen[p];
		}
		else{
			++pen[p];
		}
	}
	printf("%d %d",ans1,ans2);
	return 0;
}


Measured memory_bytes: 640
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
int gcd( int m, int n )
{
	int a=max(m,n),b=min(m,n);
	if(m==0) return n;if(n==0) return m;
	if(a%b==0) return b;
	return gcd(b,a-b*(a/b));
}
int cal(vector<int> a){
	int n=a.size(),odd=0,even=0,oddn=-1,g=0;
	if(n==1) return 1;
	rep(i,n){
		if(a[i]%2==0) even++;
		else{
			odd++;
			if(oddn<0) oddn=i;
		}
	}
	assert(odd>0);
	if(even%2==1) return 0;
	if(odd>1 || a[oddn]==1) return 1;
	a[oddn]--;
	rep(i,n) g=gcd(g,a[i]);
	assert(g>0);
	rep(i,n) a[i]/=g;
	return 1-cal(a);
}
int main()
{
	vector<int> a;int n,x;
	cin>>n;
	rep(i,n){
		cin>>x;a.pb(x);
	}
	if(cal(a)==0) cout<<"First"<<endl;
	else cout<<"Second"<<endl;
}


Measured memory_bytes: 10104
function main(input) {
  input = input.trim();
  let result = 0;
  for (let i = 1; i < input.length; i++) {
  	if (input[i] !== input[i-1]) result++;
  }
  console.log(result);
}
main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <list>
#include <numeric>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
using namespace std;

int a, b, c, n, k;
string s,t;



int main()
{
	cin >> a >> s >> t;
	string wa;
	rep(i, a)
		cout << s[i] << t[i];
}


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()


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

    vector<ll> r(n,0),g(n,0),b(n,0);
    rep(i,n){
        if(s[i]=='R') r[i]=1;
        else if(s[i]=='G') g[i]=1;
        else b[i]=1;
    }
    vector<ll> sr(n+1,0),sg(n+1,0),sb(n+1,0);
    rep(i,n){
        sr[i+1]=sr[i]+r[i];
        sg[i+1]=sg[i]+g[i];
        sb[i+1]=sb[i]+b[i];
    }

    ll ans=0;
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            if((s[i]=='R' && s[j]=='G') || (s[i]=='G' && s[j]=='R')){
                ans+=sb[n]-sb[j];
                if(2*j-i>=n) continue;
                if(s[2*j-i]=='B') ans--;                
            }
            else if((s[i]=='R' && s[j]=='B') || (s[i]=='B' && s[j]=='R')){
                ans+=sg[n]-sg[j];
                if(2*j-i>=n) continue;
                if(s[2*j-i]=='G') ans--;                
            }
            else if((s[i]=='G' && s[j]=='B') || (s[i]=='B' && s[j]=='G')){
                ans+=sr[n]-sr[j];
                if(2*j-i>=n) continue;
                if(s[2*j-i]=='R') ans--;                
            }
        }
    }
    
    cout<<ans<<endl;
}



Measured memory_bytes: 3708
#include <bits/stdc++.h>
using namespace std;
int main(){
	long long h;
	long long ans=0;
	long long ans1=0;
	cin>>h;
	for(;;){
		h=h/2;
		ans++;
		if(h==0){
			break;
		}
	}
	for(int j=0;j<ans;j++){
		ans1+=pow(2,j);
	}
	cout<<ans1<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int h,w;
  cin >> h >> w;
  
  vector<string> a(h);
  for (int i=0; i<h; i++) cin >> a.at(i);
  
  int res = 0;
  vector<int> xm = {-1, 0, 1, 0},
              ym = { 0,-1, 0, 1};
  queue<pair<int,int>> sharp;
  vector<vector<int>> check_map(h, vector<int>(w, -1));

  for (int i=0; i<h; i++) {
    for (int j=0; j<w; j++) {
       if ( a.at(i).at(j) == '#' ) {
         sharp.push( make_pair(j,i));
         check_map.at(i).at(j) = 0;
       }
    }
  }
  while (!sharp.empty()) {
    pair<int,int> s = sharp.front();
    int sx = s.first, sy = s.second;
    sharp.pop();
    for (int i=0; i<4; i++) {
      int x = sx + xm.at(i), y = sy + ym.at(i);
      if( x < 0 || w <= x || y < 0 || h <= y) continue;
      if ( check_map.at(y).at(x) == -1 ) { 
        sharp.push(make_pair(x,y));
        check_map.at(y).at(x) = check_map.at(sy).at(sx)  +  1;
        res = max(res, check_map.at(y).at(x));
      }
    } 
  }
  
  cout << res << endl;

}

Measured memory_bytes: 13456
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;


int main() {
	int n;
  	cin >> n;
  	vector<int> a(n);
  	for (int i = 0; i < n; i++) cin >> a[i];
  	sort(a.begin(), a.end());
  	unsigned long long ans = 1;
  	int x = n & 1, y = 1 - x;
    for (int i = 0; i < n; i++) {
       	if (a[i] != (i + x) / 2 * 2 + y) {
          	cout << 0 << endl;
          	return 0;
        }
    }
  	for (int i = 1; i < n; i += 2) {
        ans *= 2;
        ans %= 1000000007;
    }
    cout << ans << endl;
}

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

int main() {
  int N, M;
  string input;
  cin >> N;
  map<string, int> counts;
  for (int i=0; i<N; i++) {
    cin >> input;
    counts[input] += 1;
  }

  cin >> M;
  for (int i=0; i<M; i++) {
    cin >> input;
    counts[input] -= 1;
  }

  int maximum = {};
  for (map<string, int>::iterator it = counts.begin(); it!=counts.end(); ++it) {
    int v = it->second;
    if (v > maximum) maximum = v;
  }
  cout << maximum << endl;
}

Measured memory_bytes: 256
c = [list(map(int, input().split())) for i in range(3) ]

ans = False

for i in range(101) :
    a1 = 0
    b1 = c[0][0]
    b2 = c[0][1]
    b3 = c[0][2]
    a2 = c[1][0] - b1
    a3 = c[2][0] - b1
    a = []
    a.append(a1)
    a.append(a2)
    a.append(a3)
    if a2 + b2 != c[1][1] :
        continue
    elif a3 + b2 != c[2][1] :
        continue
    elif a2 + b3 != c[1][2] :
        continue
    elif a3 + b3 != c[2][2] :
        continue
    ans = True
    break

if ans :
    print('Yes')
else :
    print('No')


Measured memory_bytes: 3064
#include <iostream>

using namespace std;

int n;
int R[200000];
int dp1, dp2, rmax;

int main(void)
{
	cin >> n;
	for(int i=0;i<n;i++){
		cin >> R[i];
	}
	
	for(int i=0;i<n-1;i++){
		if (i==0){
			dp1 = R[n-i-1]-R[n-i-2];
			rmax = R[n-i-1];
		}else{
			rmax = max(rmax, R[n-i-1]);
			dp1 = max(dp2, rmax-R[n-i-2]);
		}
		dp2 = dp1;
	}
	
	cout << dp1 << endl;
	return 0;
}

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

void load_bingo(int (*array)[3]){
    for(int i=0; i < 3; ++i){
        cin >> array[i][0] >> array[i][1] >> array[i][2];
    }
    
}

int main(){
    int bingo_array[3][3], N, b[10] ;
    bool hit[3][3] = {{false},{false},{false}};
    load_bingo(bingo_array);
    cin >> N;
    for(int i=0; i<N; ++i){
        cin >> b[i];
        for (int j=0; j<3; ++j){
            for(int k=0; k<3;++k){
                if(bingo_array[j][k] == b[i])
                    hit[j][k] = true;
            }
        }
    }
    //bingo check YOKO
    for(int i=0; i<3; ++i){
        if(hit[i][0] == true && hit[i][1] == true && hit[i][2] == true ){
            cout << "Yes" << endl;
            return 0;
        }
    }
    //bingo check tate
    for(int i=0; i<3; ++i){
        if(hit[0][i] == true && hit[1][i] == true && hit[2][i] == true ){
            cout << "Yes" << endl;
            return 0;
        }
    }

    //bingo check migi naname shita
    if(hit[0][0] == true && hit[1][1] == true && hit[2][2] == true){
        cout << "Yes" << endl;
        return 0;
    }

    //bingo check migi naname ue
    if(hit[2][0] == true && hit[1][1] == true && hit[0][2] == true){
        cout << "Yes" << endl;
        return 0;
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <vector>
#include <algorithm>
#include <set>
#include <queue>
#include <map>
#include <climits>
#include <complex>
#include <numeric>
using namespace std;

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define RREP(i,n) for(int i=(int)n-1; i>=0; i--)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define RFOR(i,c) for(__typeof((c).rbegin())i=(c).rbegin();i!=(c).rend();++i)
#define ALL(c) (c).begin(), (c).end()

typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<int, pair<int, int> > pipii;
typedef vector<int> vi;

const int INF = 1e9;
const int MOD = 1e9+7;

int main(void){
	int q;
	cin >> q;
	REP(i, q){
		ll a, b;
		cin >> a >> b;
		if(a > b) swap(a, b);
		ll x = (ll)sqrt(static_cast<long double>(a * b - 1));
		ll res = x * 2;
		if(x && (ll)((a * b - 1) / x) == x) res--;
		if(a <= x) res--;
		cout << res << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
using namespace std;

typedef long long ll;

int main() {
#if __APPLE__
    //freopen("A.in", "r", stdin);
    //freopen("A.out", "w", stdout);
#endif

    int A, B, C;
    cin >> A >> B >> C;

    int ans = 0;
    for (int i = 0; i < 1e7; ++i) {
        if (A % 2 == 1 || B % 2 == 1 || C % 2 == 1) {
            break;
        }
        int tmpA = A;
        int tmpB = B;
        int tmpC = C;
        A = (tmpB + tmpC) / 2;
        B = (tmpA + tmpC) / 2;
        C = (tmpA + tmpB) / 2;
        ++ans;
    }

    if (A % 2 == 0 && B % 2 == 0 && C % 2 == 0) {
        ans = -1;
    }
    printf("%d\n", ans);
}


Measured memory_bytes: 768
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

using namespace std;
namespace mp = boost::multiprecision;
#define ll long long
#define cpp mp::cpp_int
#define dequeue deque
#define rep(i, n) for(int i = 0; i < n; i++)
#define rrep(i, n) for(int i = 1; i <= n; i++)
#define drep(i, n) for(int i = n-1; i >= 0; i--)
#define srep(i, s, t) for (int i = s; i < t; i++)
#define vi vector<int>
#define P pair<ll, ll>
int mod = 1'000'000'000 + 7;
struct edge {
	int to;
	ll cost;
};

void COME_LET_THE_GAMES_BEGIN() {
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << setprecision(20);
}
void reverse(string* s) {
	reverse((*s).begin(), (*s).end());
}
int N, M;
bool a[100010];
ll dp[100010];
int main() {
	COME_LET_THE_GAMES_BEGIN();
	cin >> N >> M;
	rep(i, M) {
		int x;
		cin >> x;
		a[x] = 1;
	}
	dp[N] = 1;
	dp[N - 1] = (a[N - 1]) ? 0 : 1;
	for (int i = N - 2; i >= 0; i--) {
		dp[i] = (a[i]) ? 0 : dp[i + 1] + dp[i + 2];
		dp[i] %= mod;
	}
	cout << dp[0] << endl;
}

Measured memory_bytes: 1152
count = 0
while True:
    money = int(input())
    
    if money == 0:
        break
    
    if count > 0:
        print()
    
    coins = list(map(int,input().split()))
    
    needs = [0]*4
    yen = [10,50,100,500]

    summoney = coins[0]*yen[0] + coins[1]*yen[1] + coins[2]*yen[2] + coins[3]*yen[3]
    sur = summoney-money
    arr = [sur % 50// 10, sur %100// 50, sur % 500//100, sur // 500]    
    count +=1    
    for i in range(4):
        if coins[i] > arr[i]:
            print(yen[i],coins[i]-arr[i])
    



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

int main(){
    int a, b; cin >> a >> b;
    int b_min = b*10, b_max = (b+1)*10;
    for (int i = b_min; i < b_max; i++)
    {
        if ((i * 8) / 100 == a){
            cout << i << endl;
            return 0;
        }
    }
    cout << -1 << endl;
}

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

int n, mx, a, s[2][105];
int main()
{
	int i , j;
//	freopen ("input.txt", "r", stdin);
	cin >> n;
	for (j = 0; j < 2; j++) {
	for (i = 1; i <= n; i++) {
		scanf ("%d", &a);
		s[j][i] = s[j][i - 1] + a;
	}
	}
	for (i = 1; i <= n; i++) {
		mx = max(mx, s[0][i] + s[1][n] - s[1][i - 1]);
	}
	cout << mx;
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        long a = scan.nextInt();
        long b = scan.nextInt();
        long c = scan.nextInt();
        if(a % 2 == 1 || b % 2 == 1 || c % 2 == 1){
            System.out.println(0);
            return;
        }
        if(a == b && b == c){
            System.out.println(-1);
            return;
        }
        int out = 0;
        while(a % 2 == 0 && b % 2 == 0 && c % 2 == 0){
            long aa = b / 2 + c / 2;
            long ba = a / 2 + c / 2;
            long ca = a / 2 + b / 2;
            a = aa; b = ba; c = ca;
            out++;
        }
        System.out.println(out);
        scan.close();
    }
}


Measured memory_bytes: 27068
#include <bits/stdc++.h>
using namespace std;;
#define ll long long
#define rep(i, n) for(int i = 0;i < n;i++)
#define repr(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define INF 1<<30
#define LINF 1LL<<62
#define all(x) (x).begin(), (x).end()
#define mp make_pair
#define pb push_back
const int MOD = 1000000007;
 
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n,k;cin >> n >> k;
  string s; cin >> s;
  s[k-1] = s[k-1] + 'a' - 'A' ;
  cout << s << endl;

}

Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var n, m int
	fmt.Scan(&n, &m)
	a := make([]int, n)
	b := make([]int, n)
	c := make([]int, m)
	d := make([]int, m)
	for i := 0; i < n; i++ {
		fmt.Scan(&a[i], &b[i])
	}
	for i := 0; i < m; i++ {
		fmt.Scan(&c[i], &d[i])
	}

	for i := 0; i < n; i++ {
		lv := 999999999
		li := 0
		for j := 0; j < m; j++ {
			l := abs(a[i]-c[j]) + abs(b[i]-d[j])
			if l < lv {
				li = j
				lv = l
			}
		}
		fmt.Println(li + 1)
	}
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}


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

int main(int argc, const char* argv[])
{
    int N;
    cin >> N;
    
    int h[N];
    for(int i = 0; i < N; i++)
        cin >> h[i];
    
    int dp[N];
    dp[0] = 0;
    dp[1] = abs(h[1] - h[0]);
    for(int i = 2; i < N; i++)
    {
        dp[i] = min(dp[i-1] + abs(h[i] - h[i-1]), dp[i-2] + abs(h[i] - h[i-2]));
    }
    
    cout << dp[N-1] << endl;
    
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <cctype>

using namespace std;

bool check(string s)
{
	if(s[0]!='A') return 0;
	int len=s.size(),tot=0;
	for(int i=2; i<len-1; i++)
		if(s[i]=='C')
			++tot;
	for(int i=0; i<len; i++)
		if(s[i]!='A'&&s[i]!='C')
			if(isupper(s[i]))
				return 0;
	if(tot!=1) return 0;
	return 1;
}

int main()
{
	ios::sync_with_stdio(false);
	string s;
	cin>>s;
	if(check(s)) 
		puts("AC");
	else
		puts("WA");
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
    ll N,K;
    cin>>N>>K;
  	ll a=min(abs(N-N/K*K),abs(N-N/K*K-K));
    cout<<min(a,abs(N-N/K*K+K))<<endl;
}



Measured memory_bytes: 3640
N = int(input())
x = list(map(int, input().split()))

def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a%b)


if N == 1:
    print(x[0])
else:
    num = gcd(x[0], x[1])
    if N == 2:
        print(num)
    else:
        for i in range(2, N):
            num = gcd(num, x[i])
        print(num)

Measured memory_bytes: 62704
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    long long int A, B, K;
    cin >> A >> B >> K;

    if(K<=A){
        cout << A-K << " " << B << endl;
    }
    else if(K<=A+B){
        cout << 0 << " " << B-(K-A) << endl;
    }
    else{
        cout << 0 << " " << 0 << endl;
    }
}

Measured memory_bytes: 256
#include<algorithm>//sort(all(変数),greater<型名>())　で降順に
#include<cmath>//切り上げceil(値)
#include<deque>
#include<iomanip>//setprecision(数字)
#include<iostream>
#include<list>
#include<map>
#include<numeric> //xとyの最大公約数は__gcd(x,y),xとyの最小公倍数は(x*y)/__gcd
#include<queue>//priority_queue(優先度付きキュー)：最大値の探索が早い
#include<set>
#include<stack>
#include<string>
#include<vector>

#include<bits/stdc++.h>
#include<cstdio>
#include<cstdlib>
#include<tuple>
#include<utility>
#define rep0(i,n)  for(ll i=0; i<n; i++)
#define rrep0(i,n) for(ll i=n-1; 0<=i; i--)
#define rep1(i,n)  for(ll i=1; i<=n; i++)
#define rrep1(i,n) for(ll i=n; 1<=i; i--)
#define vll vector<ll>
#define vi vector<int>
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
using ll = long long;
using namespace std;
/*ビットxにi番目のフラグが立っているかどうか
if(x & (1 << i))
↑ a << b == a*pow(b,2)
/*{0, 1, ..., n-1} の部分集合の全探索
for (int bit = 0; bit < (1 << n); ++bit)
*/

int main(){
  ll n,m;  cin >> n >> m;
  vector<pair<ll,ll>> x(n);
  rep0(i,n){
    cin >> x[i].first >> x[i].second;
  }
  sort(all(x));
  ll ans = 0;
  rep0(i,n){
    ll buy = min(m,x[i].second);
    ans += buy*x[i].first;
    m -= buy;
  }
  cout << ans;
}


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

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

    vector<pair<int, int>> sc(M);

    rep(i, M) cin >> sc[i].second >> sc[i].first;
    sort(sc.begin(), sc.end());

    int ans = 0, t = 0;
    rep(i, M) {
        if (t <= sc[i].second) {
            ans++;
            t = sc[i].first;
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1024
package main

import "os"
import "fmt"
import "strconv"
import "bufio"
import "strings"


func max(a ...int64) int64 {
    v := int64(-1)
    for i := 0; i < len(a); i++ {
        if v == -1 || v < a[i] {
            v = a[i]
        }
    }
    return v
}

func solve(n int64, w int64, arr [][]int64) int64 {
    dp := make([]int64, w+1)
    t := make([]int64, w+1)
    for j := int64(1); j < w+1; j++ {
        dp[j] = -1
        t[j] = -1
    }
    for i := int64(0); i < n; i++ {
        for j := int64(1); j < w+1; j++ {
            if j-arr[i][0] >= 1 && dp[j-arr[i][0]] != -1 {
                t[j] = max(t[j], dp[j-arr[i][0]]+arr[i][1])
            }
        }
        t[arr[i][0]] = max(t[arr[i][0]], arr[i][1])

        for j := int64(1); j < w+1; j++ {
            dp[j] = max(dp[j], t[j])
            t[j] = -1
        }
    }
    // fmt.Println(dp)
    return max(dp...)
}

func main() {
    scanner := bufio.NewScanner(os.Stdin)
    var n int64 = 0
    var w int64 = 0
    var arr [][]int64
    i := int64(0)
    j := int64(0)
    for scanner.Scan() {
        if i > 0 && i > n {
            break
        }
        if i == 0 {
            strs := strings.Split(scanner.Text(), " ")
            n, _ = strconv.ParseInt(strs[0], 10, 64)
            w, _ = strconv.ParseInt(strs[1], 10, 64)
        } else {
            if i == 1 {
                arr = make([][]int64, n)
            }
            arr[j] = make([]int64, 2)
            strs := strings.Split(scanner.Text(), " ")
            arr[j][0], _ = strconv.ParseInt(strs[0], 10, 64)
            arr[j][1], _ = strconv.ParseInt(strs[1], 10, 64)
            j++
        }
        i++ 
    }
    fmt.Println(solve(n, w, arr))
}

Measured memory_bytes: 2304
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define INF 10000000000000009
//#define INF 9223372036854775807
typedef long long ll;
#define REP(i,n) for(int i=0;i<(n);++i)
#define OREP(i,n) for(int i=1;i<=(n);++i)
#define ORREP(i,n) for(int i=(n);i>=1;--i)
#define ZREP(i,n) for(int i=1;i<(n);++i)
#define RREP(i,n) for(int i=(n)-1;i>=0;--i)
#define rollcall cout<<"I'm Sucu."<<endl;
#define YES(s) s?cout << "YES" << endl:cout << "NO" << endl
#define Yes(s) s?cout << "Yes" << endl:cout << "No" << endl
#define Taka(s) s?cout << "Takahashi" << endl:cout << "Aoki" << endl
#define out(s,t,u) s?cout << t << endl:cout << u << endl
#define int ll
#define Endl endl


signed main(){
    int A,B,C,K;
    cin >> A >> B >> C >> K;
    if(K%2==0){
        cout << A-B << endl;
    }else{
        cout << B-A << endl;
    }
    
    return 0;
}


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

#define fi first
#define se second
#define sz(a) (int)(a).size()
#define all(a) (a).begin(), (a).end()
#define reset(a, v) memset((a), v, sizeof(a))

using namespace std;

typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ii> vii;

int main() {
	int n, m; scanf("%d %d", &n, &m);
	printf("%d\n", n*(n-1)/2 + m*(m-1)/2);
	return 0;
}

Measured memory_bytes: 256
word= input()
wordlist = [raw_input() for i in range(word)]
counts=0
for i in range(word):
    if i>0:
        if wordlist[i-1][-1]==wordlist[i][0]:
            for words in wordlist:
                if words==wordlist[i]:
                    counts=counts+1
            counts=counts-1
        else:
            counts=counts+1
if counts==0:
    print"Yes"
else:
    print"No"


Measured memory_bytes: 2568
#include <iostream>

using namespace std;
int main(int argc, char *argv[]) {
	int a = 0;
	int b = 0;
	int k = 0;
	cin>>a>>b>>k;
	if((k>(b-a+1)/2))
	{
		for(int i=a;i<=b;i++)
		{
			cout<<i;
			cout<<endl;
		}
	}
	else
	{
		for(int i=a;i<a+k;i++)
		{
			cout<<i;
			cout<<endl;
		}
		for(int i=b-k+1;i<=b;i++)
		{
			cout<<i;
			cout<<endl;
		}
	}
}

Measured memory_bytes: 256
#include <stdio.h>
#define NIL -1

typedef struct{
  int parent;
  int left;
  int right;
}node;

void setDepth(int,int);
void print(int);

node t[100000];
int n;
int d[100000];

int main(){
  int i,j,id,k,c,left,right,parent;
  scanf("%d",&n);

  for(i=0;i<=n-1;i++){
    t[i].parent=t[i].left=t[i].right=NIL;
  }

  for(i=0;i<=n-1;i++){
    scanf("%d%d",&id,&k);
    
    for(j=0;j<=k-1;j++){
      scanf("%d",&c);
      if(t[id].left==NIL)t[id].left=c;
      else t[left].right=c;
      left=c;
      t[c].parent=id;
    }
  }

  for(i=0;i<=n-1;i++){
    if(t[i].parent==NIL)right=i;
  }

  setDepth(right,0);

  for(i=0;i<=n-1;i++){
    print(i);
  }


  return 0;
}


void setDepth(int u,int p){
  d[u]=p;
  if(t[u].right!=NIL)setDepth(t[u].right,p);
  if(t[u].left!=NIL)setDepth(t[u].left,p+1);
}


void print(int u){
  int c,i;
  
  printf("node %d: ",u);
  printf("parent = %d, ",t[u].parent);
  printf("depth = %d, ",d[u]);
  if(t[u].parent==NIL)printf("root, ");
  else if(t[u].left==NIL)printf("leaf, ");
  else printf("internal node, ");
  printf("[");

  for(i=0,c=t[u].left;c!=NIL;i++,c=t[c].right){
    if(i)printf(", ");
    printf("%d",c);
  }
  printf("]\n");
}
			




Measured memory_bytes: 7248
using System;
using System.Collections.Generic;
using static AtCoderer.Exter;
using static System.Math;
using System.Linq;

namespace AtCoderer
{

    public class App
    {
        public static void Solve()
        {
            var r = readarr;
          	Console.WriteLine(r[0] >= r[1]?10:0);
        }
        public static void Main(string[] args)
        {
            Solve();
            Console.ReadKey();
        }
    }
    public static class Exter
    {
        public static int Max(params int[] p) => p.Max();
        public static long Max(params long[] p) => p.Max();
        public static int Min(params int[] p) => p.Min();
        public static long Min(params long[] p) => p.Min();
        public static int Gcd(int a, int b) => a > b ? GcdRecursive(a, b) : GcdRecursive(b, a);
        private static int GcdRecursive(int a, int b) => b == 0 ? a : GcdRecursive(b, a % b);
        public static void EnumArr<t>(this IEnumerable<t> v)
        {
            Console.WriteLine(string.Join(",", v));
        }
        public static string ToString(this IEnumerable<char> v)
        {
            return string.Join(",", v);
        }
        public static int[] readarr
        {
            get
            {
                return Console.ReadLine().Split().Select(s => int.Parse(s)).ToArray();
            }
        }
        public class UnionFind
        {
            private int[] Parent;
            private int GetRoot(int v)
            {
                if (Parent[v] < 0)
                    return v;
                else
                    return Parent[v] = GetRoot(Parent[v]);
            }
            public UnionFind(int size)
            {
                Parent = new int[size];
                for (int i = 0; i < size; i++)
                    Parent[i] = -1;
            }
            public bool AreGrouped(int a, int b)
            {
                return GetRoot(a) == GetRoot(b);
            }
            public void Connect(int a, int b)
            {
                a = GetRoot(a);
                b = GetRoot(b);
                if (a == b) return;
                if (Parent[b] < Parent[a])
                {
                    Parent[b] += Parent[a];
                    Parent[a] = b;
                }
                else
                {
                    Parent[a] += Parent[b];
                    Parent[b] = a;
                }
            }
            public int GetGroupSize(int a)
            {
                return -Parent[GetRoot(a)];
            }
        }
    }
}


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

using namespace std;

#define endl '\n'

typedef long long ll;

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

int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a;a=1ll*a*a;}while(b>>=1);return ans;}
int qp(int a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}

#define _rep3(i,p,n) for(int i=(p),i##_counter=(n); i<i##_counter;++i)
#define _rep2(i,n,_) _rep3(i,0,n)
#define _rep_call(a, b, c, name, ...) name(a, b, c)
#define rep(...) _rep_call(__VA_ARGS__, _rep3, _rep2)

#define dump(x)  cerr << #x << " = " << (x) << '\n'
#define debug(x) cerr << #x << " = " << (x) << " (at line " << __LINE__ << ")" << " " << __FILE__ << '\n'

bool check(const string &s, char c) {
    bool ret = true;
    rep(i, s.size()) {
        if (s[i] == c) {
            ret = 1 - ret;
        }
    }
    return ret;
}

void Main() {
    string w; cin >> w;
    rep(c, 'a', 'z' + 1) {
        if (!check(w, c)) {
            cout << "No" << endl;
            return;
        }
    }
    cout << "Yes" << endl;
}

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

Measured memory_bytes: 256