akhauriyash/Code-Regression huggingface dataset:
//file_name:ABC100_B.cpp
#include <bits/stdc++.h>
#define fi first
#define se second
#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 rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts()
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("YES");}else{puts("NO");}
const int MX = 200005;

    // 整数スキャン（複数）
    /*
    int x;
    scanf("%d",&x);
    int y;
    scanf("%d",&y);
    int z;
    scanf("%d",&y);

    // n個の整数のスキャン
    /*
    ll a[n] = {};
    rep(i,n){
        scanf("%lld",&a[i]);
    }
    */

    // 文字列スキャン
    /*
    string s;
    cin >> s;
    */


int main() {
    int d;
    scanf("%d",&d);
    int n;
    scanf("%d",&n);



    int ans = 0;

    ans = n;
    if(d==1){
        ans *= 100;
    }
    if(d==2){
        ans *= 10000;
    }

    if(n==100){
        ans = ans * 101 / 100;
    }

    cout << ans << endl;

    return 0;
}



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

using namespace std;

string s;

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

    int n;

    cin >> n;

    cin >> s;

    int rez = 0;

    for(int i = 0; i < n - 2; i++)
    {
        if(s[i] == 'A' && s[i + 1] == 'B' && s[i + 2] == 'C')
            rez++;
    }

    cout << rez;




    return 0;
}


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

int main(){
  int a,b;
  cin >> a >> b;
  if(0 < a && 0 < b)cout << "Positive" << endl;
  else if(a < 0 && b < 0){
    int num = b - a + 1;
    if(num % 2)cout << "Negative" << endl;
    else cout << "Positive" << endl;
  }
  else{
    cout << "Zero" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
import java.util.*;
import java.awt.geom.*;

public class Main{
	
	//0033 cording start
	//0047 cording end
	//0118 sample matched
	//0119 WA * 2
	
	
	private void doit(){
		Scanner sc = new Scanner(System.in);
		while(true){
			int p = sc.nextInt();
			int n = sc.nextInt();
			if((p|n) == 0) break;
			double sqrtP = Math.sqrt(p);
			
			double nearMax = Integer.MAX_VALUE;
			int maxA = -1, maxB = -1;
			double nearMin = 0.0;
			int minA = -1, minB = -1;
			for(int i = 1; i <= n; i++){
				
				double temp = i * sqrtP;
				double temp2 = Math.ceil(temp);
				double temp1 = Math.floor(temp);
				double temp1i = temp1 / i;  // small
				double temp2i = temp2 / i;  //big
				//System.out.println("sqrtP = " + sqrtP + " temp = " + temp);
				//System.out.println("temp1 = " + temp1 + " temp2= " + temp2);
				//System.out.println("temp1i = " + temp1i + " temp2i = " + temp2i);
				//System.out.println("1 = " + (sqrtP - temp1i) + " " + (temp2i - sqrtP) );
				
				if((int)temp1 <= n  && temp1i > nearMin){
					nearMin = temp1i;
					minA = (int) temp1;
					minB = i;
				}
				
				if((int) temp2 <= n && temp2i < nearMax){
					nearMax = temp2i;
					maxA = (int) temp2;
					maxB = i;
				}
			}
			System.out.println(maxA + "/" + maxB + " " + minA +"/"+minB);
		}
	}
	
	public static void main(String[] args) {
		new Main().doit();
	}
}

Measured memory_bytes: 12000
#include <bits/stdc++.h>
using namespace std;
int n,m,k;
int main() {
	scanf("%d %d %d",&n,&m,&k);
	bool ans=0;
	for (int a=0;a<=m;a++)
		for (int b=0;b<=n;b++) {
			if (a*n+b*m-2*a*b==k) {
				ans=1;
				break;
			}
		}
	if (ans)
		printf("Yes\n");
	else printf("No\n");
	return 0;
}

Measured memory_bytes: 256
/*
 * template.cpp
 *
 *  Created on: 2016/10/30
 *      Author: jin
 */
#define MYDEBUG
#include <iostream>
#include <vector>
#include <cstring>
#include <string>
#include <algorithm>
#include <math.h>


#ifdef MYDEBUG
#define debug(x) cout<<#x<<": "<<x<<endl
#else
#define debug(x)
#endif
#define ll long long
#define ull unsigned long long
#define eps 1e-14
#define all(x) x.begin(), x.end()
using namespace std;

template<typename T>
ostream& operator<<(ostream& out, const vector<T>& v) {
  out << "[";
  size_t last = v.size() - 1;
  for (size_t i = 0; i < v.size(); ++i) {
    out << v[i];
    if (i != last)
      out << ",";
  }
  out << "]";
  return out;
}

class Main {
public:
  void sample() {
    cout << "-------------this is sample program.----------------" << endl;
  }
  
  void ABC047_A(){
	  int a,b,c;
	  cin >> a >> b >> c;
	  if(a==(b+c)) printf("Yes");
	  else if(b==(c+a)) printf("Yes");
	  else if(c==(a+b)) printf("Yes");
	  else printf("No");
  }
  
  void ABC047_B(){
	  int W,H,N;
	  cin >> W >> H >> N;
	  vector<vector<int> > rect();
	  
	  for(int i=0; i<N; ++i){
		  
	  }
  }
  
  void ABC044_A(){
	  int n,k,x,y;
	  cin >> n >> k >> x >> y;
	  int ans;
	  if(n<=k){
		ans = n*x;
	  }else{
		ans = k*x + (n-k)*y;
	  }
	  cout << ans << endl;
  }
  
  void ABC044_B(){
	  string str;
	  cin >> str;
	  vector<int> v(26);
	  std::fill(v.begin(),v.end(),0);
	  for(int i=0; i<str.length(); ++i){
		  v[str[i]-97]++;
	  }
	  for(int i=0; i<v.size(); ++i){
		  if(v[i]%2!=0){
			  cout << "No" << endl;
			  return;
		  }
	  }
	  cout << "Yes" << endl;
  }
  
  void ABC055A(){//割引レストラン
	  int N;
	  cin >> N;
	  cout << N*800 - (N/15)*200 << endl;
  }
  
  void ABC055B(){//総積パワー
	  ull p = 1;
	  int mod = 1000000007;
	  int N;
	  cin >> N;
	  for(int i=1; i<=N; i++){
		  p = p * i % mod;
	  }
	  cout << p << endl;
  }
  void ABC055C(){//吸い殻の吸い殻
	  int N,M;
	  cin >> N >> M;
	  int scc = min(N,M/2);
	  N -= scc;
	  M -= scc * 2;
	  scc += M / 4;
	  cout << scc << endl;
  }
  void ABC055D(){
	  
  }
  void ABC013B(){//錠
	  int a,b;
	  cin >> a >> b;
	  if(b<a) swap(a,b);
	  int x = abs(b-a);
	  int y = abs(b-a-10);
	  cout << min(x,y) << endl;
  }
  void ABC020B(){
	  string a,b;
	  cin >> a >> b;
	  cout << atoi((a+b).c_str())*2 << endl;
  }
  void ABC033A(){
	  int N;
	  cin>>N;
	  cout << (N%1111==0 ? "SAME" : "DIFFERENT") << endl;
  }
  void ABC016B(){
	  int a,b,c;
	  cin >> a >> b >> c;
	  int cp = a+b;
	  int cm = a-b;
	  if(cp==cm&&cp==c) cout << "?" << endl;
	  else if(cp==c) cout <<"+"<<endl;
	  else if(cm==c) cout <<"-"<<endl;
	  else cout <<"!"<<endl;
  }
  void ABC029B(){
	  int ret=0;
	  for(int i=0; i<12; ++i){
		  string s;
		  cin >> s;
		  if(s.find("r")!=string::npos) ret++;
	  }
	  cout << ret << endl;
  }
  void ABC023A(){
	  int x;
	  cin >> x;
	  cout << x/10 + x%10 << endl;
  }
  //t   H D
  //a H H D
  //a D D H
  void ABC056A(){
	  string a,t;
	  cin >> a >> t;
	  string at = a+t;
	  if(at=="HH"||at=="DD") cout << "H" << endl;
	  else cout << "D" << endl;
  }
};

int main() {
	Main m;
	m.ABC056A();
}


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

typedef struct {
    int x;
    int y;
    int r;
} WALL;

//内積
#define dotProduct(x1, y1, x2, y2) (( x1 * x2 ) + ( y1 * y2 ))
//　二点の成す線分の移動量を求める
#define distance(x1, y1, x2, y2) (sqrt(pow(x1 - x2, 2) + pow(y1 - y2, 2)))

#define inCircle(x1, y1, c) (pow(c.x - x1, 2) + pow(c.y - y1, 2) < c.r * c.r ? 1 : 0)

int judge(WALL w, int tx, int ty, int sx, int sy) {
    //V : 線分始点から終点へのベクトル
    //C : 線分始点から円中心へのベクトル
    int Vx = tx - sx;
    int Vy = ty - sy;
    int Cx = w.x - sx;
    int Cy = w.y - sy;
    int n1, n2, n3;

    int in_t = inCircle(tx, ty, w);
    int in_s = inCircle(sx, sy, w);

    if (in_t && in_s)
	return 0;

    if (in_t || in_s)
	return 1;

    //二つのベクトルの内積を求める
    n1 = dotProduct(Vx, Vy, Cx, Cy);
    n2 = dotProduct(Vx, Vy, Vx, Vy);
    n3 = dotProduct(Cx, Cy, Cx, Cy);

    if (n1 < 0) {
	//Cの長さが円の半径より小さい場合 : 交差している
	//	if (n3 < w.r * w.r)
	//	    return 1;
	//	else
	    return 0;
    }
    if (n1 > n2) {
	//      	if (pow(w.x - tx, 2) + pow(w.y - ty, 2) < w.r *w.r)
	//	    return 1;
	//	else
	    return 0;
    }
    return (n3 - (n1 * n1 / n2) <= pow(w.r, 2)) ? 1 : 0;
}




int main(void) {
    int n;

    while (scanf("%d", &n), n) {
	int i, m;
        WALL w[100];
        for (i = 0; i < n; i++) {
	    scanf("%d%d%d", &w[i].x, &w[i].y, &w[i].r);
	}
	scanf("%d", &m);
        for(i=0; i < m; i++){
            int j, safe = 0;
            int tx, ty, sx, sy;
            scanf("%d%d%d%d", &tx, &ty, &sx, &sy);
 
            for(j = 0 ; j < n; j++)
                if (judge(w[j], tx, ty, sx, sy) == 1) {
                    safe = 1;
                    break;
                }
 
            if (safe)
                printf("Safe\n");
            else
                printf("Danger\n");
        }
    }
 
    return 0;
}

Measured memory_bytes: 584
S = input()
N = len(S) + 1

ans = 0

cnt0 = 0
if S[0] == ">":
    cnt0 += 1
    j = 1
    while j <= len(S)-1 and S[j] == ">":
        cnt0 += 1
        j += 1
ans += cnt0*(cnt0+1)//2


for i in range(1, N-1):
    if S[i-1] == "<" and S[i] == ">":
        j = i-1
        k = i+1
        cnt1 = 0
        cnt2 = 0
        if S[i-1] == "<" and i >= 0:
            while j >= 0 and S[j] == S[i-1] :
                cnt1 += 1 
                j -= 1
        if S[i] == ">":
            while k <= N-1 and S[i] == S[k-1]:
                cnt2 += 1
                k += 1 
        ans += max(cnt1, cnt2)*(max(cnt1, cnt2)+1)//2
        ans += (min(cnt1, cnt2)-1)*(min(cnt1, cnt2))//2


cntn = 0
if S[-1] == "<":
    cntn += 1
    j = -2
    while j >= -len(S) and S[j] == "<":
        cntn += 1
        j -= 1
ans += cntn*(cntn+1)//2


print(ans)

Measured memory_bytes: 4236
#include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
static const int MAX = 1000;
int best[MAX+1];

bool compare(const pair<int, int> &a, const pair<int, int> &b) {
    if (a.second == b.second) return a.first < b.first;
    return a.second > b.second;
}

int main() {
    int n, m, t, left;
    scanf("%d %d", &n, &m);
    pair<int, int> sum[n+1];
    for (int i = 0; i <=n; i++) sum[i] = make_pair(i, 0);
    fill(best, best+MAX+1, -1);
    left = MAX;
    for (int i = 1; i <= n; i++) {
        scanf("%d", &t);
        if (t < left) {
            fill(best+t, best+left, i);
            left = t;
        }
    }
    for (int i = 0; i < m; i++) {
        scanf("%d", &t);
        if (best[t] > 0) {
            sum[best[t]].second++;
        }
    }
    sort(sum, sum+n+1, compare);
    printf("%d\n", sum[0].first);

    return 0;
}



Measured memory_bytes: 3220
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
const int N = 6e5+20;

vector <int> v;
int n, este, actual;
int arr [N];

void f(int actual)
{
    if(actual == 0) arr[0] = 0;
    else
    {
        if(actual-1 >= 0)
        {
            int peso1 = arr[actual-1] + abs(v[actual] - v[actual-1]);
            //cout<<peso1<<endl;
            if(peso1 < arr[actual])
                arr[actual] = peso1;
        } 
        if(actual-2 >= 0)
        {
            int peso2 = arr[actual-2] + abs(v[actual] - v[actual-2]);
            if(peso2 < arr[actual])
                arr[actual] = peso2;
        } 
    }
}
int main()
{
    cin>>n;
    for(int i = 0; i < n; i++){cin>>este;v.push_back(este);}
    memset(arr, 1000000, sizeof arr);
    for(int i = 0; i < n; i++)f(i);
    cout<<arr[n-1]<<endl;
    //for(int i = 0; i < n; i++)cout<<arr[i]<<" - ";
}

Measured memory_bytes: 5728
#include<cstdio>
#include<iostream>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<map>
#include<algorithm>

using namespace std;

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

    int a, b;
    a = (s[0] - '0') * 10 + (s[1] - '0');
    b = (s[2] - '0') * 10 + (s[3] - '0');

    bool isYYMM = true;
    bool isMMYY = true;

    if (a < 0) {
        isYYMM = false;
    }
    if (b < 1) {
        isYYMM = false;
    }
    if (b > 12) {
        isYYMM = false;
    }

    if (a < 1) {
        isMMYY = false;
    }
    if (a > 12) {
        isMMYY = false;
    }
    if (b < 0) {
        isMMYY = false;
    }

    if (isYYMM && isMMYY) {
        cout << "AMBIGUOUS";
    } else if (isYYMM) {
        cout << "YYMM";
    } else if (isMMYY) {
        cout << "MMYY";
    } else {
        cout << "NA";
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define rfor(i, a, b) for(int i = a; i < (int)b; i++)
#define all(ary) (ary).begin(), (ary).end()
#define debug(x) cerr << #x << ": " << x << '\n'
const long long INF = 1LL << 60;
const int MOD = 1000000007;
using namespace std;
using vec = vector<int>;
using ll = long long;
template <class T = int> T in(){ T x; cin >> x; return (x);}
template <class T> inline bool chmin(T &a, T b) { if ( a > b ) { a = b; return 1; } return 0; }
template <class T> inline bool chmax(T &a, T b) { if ( a < b ) { a = b; return 1; } return 0; }
const int dy[4] = {-1, 0, 0, 1};
const int dx[4] = {0, -1, 1, 0};

int N, W;
ll w[110], v[110];
ll dp[110][100100];

int main(int argc, char *argv[]){
    cin >> N >> W;
    rep(i, N) cin >> w[i] >> v[i];
    rep(i, N){
        rep(sum_w, W + 1){
            if(sum_w - w[i] >= 0)
                chmax(dp[i + 1][sum_w], dp[i][sum_w - w[i]] + v[i]);
            
            chmax(dp[i + 1][sum_w], dp[i][sum_w]);
        }
    }
    cout << dp[N][W] << endl;
    return 0;
}

Measured memory_bytes: 79360
#include<iostream>
#include<string>
#include<algorithm>
#include <stdio.h>
#include<iostream>
#include<cmath>
#include<bitset>
using namespace std;


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

int a[110][110];
int k[30];
for(int i=0; i<n ; i++){
  cin >>k[i];
  for(int j=0;j<k[i];j++){
    cin >>a[i][j];
  }
}
int count[31]={0};
for(int i=0;i<n;i++){
  for(int j=0; j<k[i];j++){
    count[a[i][j]]++;
  }
}
int ans=0;
for(int i=0; i<=m;i++){
  if(count[i]==n) ans++;
}

cout<<ans<<endl;
}


Measured memory_bytes: 256
// Sakhiya07 - Yagnik Sakhiya
 
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long int
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define bp __builtin_popcountll
#define MOD 1000000007
const int N = 2000005;

ll d, x, y;
void extendedEuclid(ll A, ll B) {
    if(B == 0) {
        d = A;
        x = 1;
        y = 0;
    }
    else {
        extendedEuclid(B, A%B);
        ll temp = x;
        x = y;
        y = temp - (A/B)*y;
    }
}
ll modInverse(ll A)
{
    extendedEuclid(A,MOD);
    return (x%MOD+MOD)%MOD;   
}
ll fact[N],inv[N];
ll solve(ll x,ll y)
{
    ll ans = 0;
    for(ll i=0;i<=y;i++)
    {
        ll temp = fact[i+x+1];
        temp = (temp*inv[i+1])%MOD;
        temp=(temp*inv[x])%MOD;
        ans = (ans + temp)%MOD;
    }
    return ans;
    return ans;
}
int main()
{
    fact[0] = inv[0] = 1;
    for(ll i=1;i<N;i++)
    {
        fact[i] = (i*fact[i-1])%MOD;
        inv[i] = modInverse(fact[i]);
    }
    ll x1,y1,x2,y2;
    cin >> x1 >> y1 >> x2 >> y2;
    ll ans = solve(x2,y2);
    ans = (ans - solve(x2,y1-1) + MOD)%MOD;
    ans = (ans - solve(x1-1,y2) + MOD)%MOD;
    ans = (ans + solve(x1-1,y1-1) + MOD)%MOD;
    cout<<ans;
}

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

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

int n,k,r,s,p;

char check(char c){
  if(c=='r')	return 'p';
  if(c=='s')	return 'r';
  if(c=='p')	return 's';
}

int score(char c){
  if(c=='r')	return r;
  if(c=='s')	return s;
  if(c=='p')	return p;
}

int main() {
  cin >> n >> k >> r >> s >> p;
  vector<char> kyoutai(n);
  rep(i,n)	cin >> kyoutai[i];
  
  int ans=0;
  
  vector<char>	jibun(n,'x');
  for(int i=0;i<k;i++){
    jibun[i]=check(kyoutai[i]);
    ans+=score(jibun[i]);
  }
   
  for(int i=k;i<n;i++){
    if(check(kyoutai[i])==jibun[i-k])	continue;
    jibun[i]=check(kyoutai[i]);
    ans+=score(jibun[i]);
  }
  cout << ans;
}


Measured memory_bytes: 3784
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
# define mod 1000000007
# define INF (1 << 29)
# define MAX_N 1000010
/* ACはうれCすぎてうれD */

int main(void){ 
    int n;
    cin >> n;
    vector<string> S;
    for(int i=0; i<n; i++){
        string tmp_s;
        cin >> tmp_s;
        S.push_back(tmp_s);
    }

    int ans = 0;
    int top_B = 0, last_A = 0, both = 0, total = 0;
    int hiku = 0;
    for(int i=0; i<n; i++){
        if(S[i][0] == 'B' && S[i][S[i].length() - 1] != 'A'){
            top_B += 1;
            total += 1;
        }
        else if(S[i][S[i].length() - 1] == 'A' && S[i][0] != 'B'){
            last_A += 1;
            total += 1;
        }
        else if(S[i][0] == 'B' && S[i][S[i].length() - 1] == 'A'){
            both += 1;
        }
        for(int j=0; j<S[i].length()-1; j++){
            if(S[i][j] == 'A' && S[i][j+1] == 'B'){
                ans += 1;
            }
        }
    }
    if(total > 0){
        ans += (both + min(top_B, last_A));
    }
    else{
        if(both > 0) ans += (both - 1);
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int N;
int main(void)
{
    ll N;
    cin >> N;
    vector<ll> T(N), A(N);
    ll t = 1, a = 1;
    for (int i = 0; i < N; i++)
        cin >> T[i] >> A[i];
    for (int i = 0; i < N; i++) {
        ll mul = max((t + T[i] - 1) / T[i], (a + A[i] - 1) / A[i]);
        t = mul * T[i];
        a = mul * A[i];
    }
    cout << t + a << endl;
    return 0;
}

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

int M, N, K;
char S[550][550];
int h, w;
vector<int> y, x;
vector<char> c;
char s[550][550];
int dd[5] = { 0, 1, 0, -1, 0 };

int compress(vector<int> &a) {
  vector<int> v;

  REP(i, 0, a.size()) v.push_back(a[i]);
  sort(v.begin(), v.end());
  v.erase(unique(v.begin(), v.end()), v.end());
  REP(i, 0, a.size()) a[i] = find(v.begin(), v.end(), a[i]) - v.begin();

  return (int) v.size();
}

bool isin(int y, int x) {
  return 0 <= y && y < h && 0 <= x && x < w;
}

int main(void) {
  cin >> M >> N;
  K = 0;
  REP(i, 0, M) REP(j, 0, N) {
    cin >> s[i][j];
    // if(S[i][j] != '.') {
    //   y.push_back(i);
    //   x.push_back(j);
    //   c.push_back(S[i][j]);
    //   K++;
    // }
  }

  // h = compress(y);
  // w = compress(x);
  //
  // REP(i, 0, h) REP(j, 0, w) s[i][j] = '.';
  // REP(i, 0, K) s[y[i]][x[i]] = c[i];
  //
  // cout << h << ", " << w << endl;

  h = M;
  w = N;

  // REP(i, 0, h) {
  //   REP(j, 0, w) cout << s[i][j];
  //   cout << endl;
  // }

  int ans = 0;
  bool visited[256];
  REP(i, 0, 256) visited[i] = false;
  bool f = true;
  while(f) {
    f = false;
    REP(i, 0, h) REP(j, 0, w) {
      if(s[i][j] == '.' || visited[s[i][j]]) {
        int cnt[256];
        REP(k, 0, 256) cnt[k] = 0;
        REP(k, 0, 4) {
          int ny = i + dd[k], nx = j + dd[k + 1];
          while(isin(ny, nx)) {
            if(s[ny][nx] != '.' && !visited[s[ny][nx]]) {
              cnt[s[ny][nx]]++;
              if(cnt[s[ny][nx]] == 2) {
                visited[s[ny][nx]] = true;
                ans += 2;
                f = true;
              }
              break;
            }
            ny += dd[k];
            nx += dd[k + 1];
          }
        }
      }
    }
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3364
In = input().split(" ")
T = int(In[0])
A = int(In[1])
K = int(In[2])
 
if K <= T:
  print("{0} {1}".format(T-K,A))
elif K <= T+A:
  print("0 {0}".format(A-(K-T)))
else:
  print("0 0")

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

int main() {
	int X, N;
	cin >> X >> N;
	bool OK[102];
	for (int i = 0; i < 102; i++) OK[i] = true;
	for (int i = 0; i < N; i++) {
		int p;
		cin >> p;
		OK[p] = false;
	}
	int now = 0;
	while (1) {
		if (OK[X - now]) {
			cout << X - now << endl;
			return 0;
		}
		if (OK[X + now]) {
			cout << X + now << endl;
			return 0;
		}
		now++;
	}
}

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

int main() {
  int N, M, X=0, s, t;
  cin >> N;
  vector<string> blue(N);
  for (int i=0; i<N; i++){
    cin >> blue.at(i);
  }
  cin >> M;
  vector<string> red(M);
  for (int i=0; i<M; i++){
    cin >> red.at(i);
  }
  
  for (int i=0; i<N; i++){
    s=0;
    t=0;
    for (int j=0; j<N; j++){
      if (blue.at(i)==blue.at(j)){s++;}
    }
    for (int k=0; k<M; k++){
      if (blue.at(i)==red.at(k)){t--;}
    }
    if (X<s+t) {X=s+t;}
  }
  cout << X << endl;
}


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

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

using namespace std;

int main(void) {
	vector<pair<int, int> > in;
	while(1) {
		int H, W;
		cin >> H >> W;
		if(H == 0 && W == 0) break;
		in.push_back(make_pair(H, W));
	}
	REP(i, in.size()) {
		REP(j, in[i].first) {
			REP(k, in[i].second) {
				cout << "#";
			}
			cout << endl;
		}
		cout << endl;
	}

	return 0;
}


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

int main() {
	ios::sync_with_stdio(false);
  cin.tie(0);
  long long n;
  cin>>n;
  long long l1=__gcd(n, 360LL);
  long long l2=360*n/l1;
  cout<<l2/n<<endl;
	return 0;
}


Measured memory_bytes: 3660
#include <iostream>
#include <string>
#include <algorithm>
#include <bitset>

using namespace std;

int main() {
	int n;
	cin >> n;
	int k;
	long long b;

	bitset<64>* mask = new bitset<64>[n];
	bitset<64> B;
	
	for (int i = 0; i < n; i++) {
		cin >> k;
			for (int j = 0; j < k; j++) {
				cin >> b;
				mask[i].set(b);
			}
	}

	int q;
	cin >> q;
	int query, x;

	for (int i = 0; i < q; i++) {
		cin >> query >> x;
		if (query == 0) { //test
			cout << B.test(x) << endl;
		}
		else if (query == 1) { //set
			B |= mask[x];
		}
		else if (query == 2) { //clear
			B &= ~mask[x];
		}
		else if (query == 3) { //flip
			B ^= mask[x];
		}
		else if (query == 4) { //all
			cout << ((B & mask[x]) == mask[x]) << endl;
		}
		else if (query == 5) { //any
			cout << (B & mask[x]).any() << endl;
		}
		else if (query == 6) { // none
			cout << (B & mask[x]).none() << endl;
		}
		else if (query == 7) { // count
			cout << (B & mask[x]).count() << endl;
		}
		else if (query == 8) { //val
			cout << (B & mask[x]).to_ullong() << endl;
		}
	}
}


Measured memory_bytes: 3108
package main

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

type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

func abs(x int) int {
	if x > 0 {
		return x
	}
	return -x
}

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

func main() {
	sc := NewScanner()
	a, s := sc.nextInt(), sc.nextStr()
	if a >= 3200 {
		fmt.Println(s)
	} else {
		fmt.Println("red")
	}
}


Measured memory_bytes: 640
;; F - Sum Difference

(defun main ()
  (let ((N (read))
        (X (read))
        (D (read)))
    (print (solve N X D))
    (fresh-line)))

;; 整数列の総和 total = NX + N(N - 1)D/2
;; 高橋君が取った数の個数 m
;; 高橋君が取った数の和 S
;;   Sの最小値: m X + m(m - 1)D/2      (mが1増えると X + m D 増加)
;;   Sの最大値: m X + m(2N - m - 1)D/2 (mが1増えると X + (N - m - 1)D 増加)
;;   Sの刻み: D
;; S - T == S - (total - S) == 2S - total (SとS - Tは一対一)

(defun solve (N X D)
  (cond
    ; X == D == 0ならS == 0.  X != 0, D == 0ならS == m X.
    ((zerop D) (if (zerop X) 1 (1+ N)))
    ((minusp D) (solve-body N (+ X (* (1- N) D)) (- D))) ; Dを正に
    (t (solve-body N X D))))

(defun solve-body (N X D)
  (let ((m-cycle (if (zerop X) 1 (/ (lcm X D) (abs X)))))
    ; m: 高橋君が取った数の個数. m = m-base + i m-cycle
    ; m-cycle: m X mod D == 0 となる最小の正整数 m
    ; m-base == m mod m-cycle. m-baseが異なるSは重ならない.
    (loop for m-base from 0 to (min (1- m-cycle) N) sum
      ; Sの個数
      (reduce #'+
        (mapcar #'(lambda (range) (1+ (/ (- (cdr range) (car range)) D)))
          ; Sが取り得る重複のない区間のリスト
          (clean-range-list
            (S-ranges N X D m-base m-cycle)))))))

(defun S-ranges (N X D m-base m-cycle)
  "各m = m-base + i m-cycleに対してSが取り得る区間のリストを返す"
  (loop for m from m-base to N by m-cycle
        for low  = (+ (* m X) (ash (* m (1- m) D) -1))
        for high = (+ (* m X) (ash (* m (- (+ N N) m 1) D) -1))
        collect (cons low high)))

(defun clean-range-list (ranges)
  "重複のない区間のリストを返す"
  (setf ranges (sort ranges #'< :key #'car)) ; 始点の昇順
  (labels
    ((cleaner (head ranges result)
       (cond ((null ranges) (cons head result))
             ((<= (cdar ranges) (cdr head)) ; 包含
              (cleaner head (cdr ranges) result))
             ((<= (caar ranges) (cdr head)) ; 重なり
              (cleaner (cons (car head) (cdar ranges)) (cdr ranges) result))
             (t
              (cleaner (car ranges) (cdr ranges) (cons head result))))))
    (cleaner (car ranges) (cdr ranges) nil)))

(main)


Measured memory_bytes: 26980
N = int(input())
A_LIST = list(map(int, input().split()))
A_SET = set(A_LIST)
if len(A_SET) == 1:
    if sum(A_SET) == 0:
        print('Yes')
    else:
        print('No')
elif len(A_SET) == 2:
    a1, a2 = sorted(A_SET)
    if a1 == 0 and A_LIST.count(a1) * 3 == N:
        print('Yes')
    else:
        print('No')
elif len(A_SET) == 3:
    a1, a2, a3 = A_SET
    if a1 ^ a2 == a3 and A_LIST.count(a1) ==  A_LIST.count(a2) and A_LIST.count(a2) == A_LIST.count(a3):
        print('Yes')
    else:
        print('No')
else:
    print('No')


Measured memory_bytes: 92584
import functools

import os

INF = float('inf')


def inp():
    return int(input())


def inpf():
    return float(input())


def inps():
    return input()


def inl():
    return list(map(int, input().split()))


def inlf():
    return list(map(float, input().split()))


def inls():
    return input().split()


def debug(fn):
    if not os.getenv('LOCAL'):
        return fn

    @functools.wraps(fn)
    def wrapper(*args, **kwargs):
        print('DEBUG: {}({}) -> '.format(
            fn.__name__,
            ', '.join(
                list(map(str, args)) +
                ['{}={}'.format(k, str(v)) for k, v in kwargs.items()]
            )
        ), end='')
        ret = fn(*args, **kwargs)
        print(ret)
        return ret

    return wrapper


n = inp()
if n % 2== 0:
    print(n)
else:
    print(n*2)

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

int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D ;

  if ( (A + B) > (C + D) ) {
    cout << "Left" << endl;
  }
  
  else if ((A + B) == (C + D)) {
    cout << "Balanced" << endl;
  }
  
  else {
    cout << "Right" << endl;
  }

}
  


Measured memory_bytes: 3576
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); ++i)
using namespace std;
typedef long long ll;
const int INF = 1001001001;

int main() {
    ll N, K, R, S, P, ans=0;
    string T;

    cin >> N >> K >> R >> S >> P >> T;

    vector<char> a(N);

    rep(i,N){
        if(i>=K) {
            if(T[i]=='r') {
                if(a[i-K]=='p') {
                    a[i] = 'a';
                } else {
                    ans += P;
                    a[i] = 'p';
                }
            } else if(T[i]=='s') {
                if(a[i-K]=='r') {
                    a[i] = 'a';
                } else {
                    ans += R;
                    a[i] = 'r';
                }
            } else {
                if(a[i-K]=='s') {
                    a[i] = 'a';
                } else {
                    ans += S;
                    a[i] = 's';
                }
            }
        } else {
            if(T[i]=='r') {
                ans += P;
                a[i] = 'p';
            } else if(T[i]=='s') {
                ans += R;
                a[i] = 'r';
            } else {
                ans += S;
                a[i] = 's';
            }
        }
    }

    cout << ans << endl;

    return 0;
    
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string s;
  cin>>s;
  int count1=0;
  int count2=0;
  for(int i=0;i<s.length();i++)
  {
		if(i%2==0)
        {
			s[i]=='1'?(count1++):(count2++);

        }
    	else
        {
			(s[i]=='0')?(count1++):(count2++);
        }

  }
  cout<<(s.length()-max(count1,count2));
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define ll long long int
#define ld double
#define f first
#define s second
#define pb push_back
#define mk make_pair
#define MOD 1000000007
#define fo(i,a,b) for(i=a;i<b;i++)
#define foe(i,a,b) for(i=a;i<=b;i++)
#define boost ios::sync_with_stdio(false); cin.tie(0)
using namespace std;
map <vector <int>, int> mp;
int main()
{
	boost;
	int n, i;
	cin >> n;
	vector <vector <int> > p;
	string s;
	fo(i, 0, n){
		cin >> s;
		vector <int> v(26, 0);
		for(int j = 0; j < s.length(); j++){
			v[s[j] - 'a']++;
		}
		mp[v]++;
		p.pb(v);
	}
	ll ans = 0;
	fo(i, 0, n){
		ll x = mp[p[i]];
		ans += (x * (x - 1)) / 2;
		mp[p[i]] = 0;
	}
	cout << ans;
}


Measured memory_bytes: 32688
#include "bits/stdc++.h"
using namespace std;
#define ff first
#define ss second
#define pb push_back
typedef long long ll;
#define db(x) cerr<<__LINE__<<": "<<#x<<" = "<<(x)<<'\n'
const int inf = 1e9+7;
const int N = 1e6+9;
int A[N];

void solve() {
    int a, b, n;
    cin>>n;
    ll x=0;
    for(int i=0;i<n;++i) {
        cin>>A[i];
        x^=A[i];
    }
    for(int i=0;i<n;++i) {
        ll res=x^A[i];
        cout<<res<<" ";
    }
}
int main() {
    ios_base::sync_with_stdio(0);
    int T=1 ,cas=0;
    while(T--) {
        solve();
    }
    return 0;
}

// ll, reset, 1, bottom

Measured memory_bytes: 4376
import java.util.Scanner;
import java.util.stream.Stream;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int[] line = Stream.of(sc.nextLine().split(" ", 0)).mapToInt(Integer::parseInt).toArray();
		int con=0;
		boolean isdivflg = true;
		if(line[0] == line[1] && line[1] == line[2] && line[2] == line[0] && line[0] % 2 == 0) {
			con = -1;
		}else{
			while (true) {
				int[] line_div = new int[3];
				for (int i = 0; i < 3; i++) {
					if (line[i] % 2 == 1) {
						isdivflg = false;
					}
					line_div[i] = line[i] / 2;
				}
				if (isdivflg) {
					line[0] = line[0] - line_div[0] + line_div[2];
					line[1] = line[1] - line_div[1] + line_div[0];
					line[2] = line[2] - line_div[2] + line_div[1];
					con++;
				}else {
					break;
				}

			}
		}
		System.out.println(con);
	}
}


Measured memory_bytes: 36112
def update(pos, val):
  while(pos <= N):
    fen[pos] = fen[pos] + val
    pos = pos + (pos & -pos)

def query(pos):
  cont = 0
  while(pos > 0):
    cont = cont + fen[pos]
    pos = pos - (pos & - pos)
  return cont

N, M = map(int,input().split())
fen = [0] * (N + 2)
for i in range (M):
  A, B = map(int,input().split())
  update(A,1)
  update(B + 1,-1)
  #for j in range(1,N + 1):
    #print("ci sono x tessere per il punto " + str(j) + " " + str(query(i)))
  #print("---------")
#print()

ans = 0
for i in range(1,N + 1):
  if query(i) == M:
    ans = ans + 1
print(ans)

Measured memory_bytes: 4236
#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <climits>
#include <iomanip>
#include <algorithm>
#include <queue>
#include <map>
#include <tuple>
#include <iostream>
#include <deque>
#include <array>
#include <set>
#include <functional>
#include <memory>
#include <stack>
#include <numeric>
int main() {
	int n; std::cin >> n;
	std::vector<int> numbers(n); for (auto& p : numbers) std::cin >> p;
	bool can_make = true;
	for (auto i = 1; i < n && can_make; ++i) if (numbers[i] < numbers[i - 1]) can_make = false;
	for (auto i = 0; i < n && !can_make; ++ i) {
		for (auto j = 0; j < i && !can_make; ++j) {
			can_make = true;
			const auto temp = numbers[i];
			numbers[i] = numbers[j];
			numbers[j] = temp;
			for (auto p = 1; p < n && can_make; ++p) {
				if (numbers[p] < numbers[p - 1]) {
					can_make = false;
				}
			}
			numbers[j] = numbers[i];
			numbers[i] = temp;
		}
	}
	if (can_make) std::cout << "YES\n";
	else std::cout << "NO\n";
}

Measured memory_bytes: 256
'''
条件に合うものを絞り込む
data = [1, 2, 3]
s = [x for x in data if x % 3 == 0]
'''
'''
文字配列を数値に
l_si = ['-10', '0', '100']

l_si_i = [int(s) for s in l_si]
'''
'''
a = [2, 4, 6, 8]
b = [3, 6, 9]

print(list(set(a) | set(b)))  # 和集合
print(list(set(a) & set(b)))  # 積集合
'''
'''
N = int(stdin.readline().rstrip())
A = [int(x) for x in stdin.readline().rstrip().split()]
count = 0
while len([x for x in A if x % 2 == 0]) == N:
    A = list(map(lambda y: y / 2, A))
    count += 1
print(count)
'''
'''
.append(要素)
.extend(要素)
.insert(場所,要素)
del 配列名[場所]
-1で末尾で末尾から一つ前
'''
'''
間に空白追加
' '.join(lis)
'''
'''
copy.copy(配列名)
'''
'''
sort()
sorted(reverse=true)
'''
'''
2分探索
bisect.bisect_left(リスト, 要素)
'''
'''
リスト同士の演算
list(map(lambda x, y: x+y, el2, el3))
'''
'''
配列の初期化
配列名=[a]*n+[b]*m
'''
'''
重複
list(set())
２次元配列
list(map(list, set(map(tuple, addition))))
'''
'''
順列
for el in itertools.permutations(配列のパターン):
'''
'''
Decimal()
'''
# 入力 =stdin.readline().rstrip()
# 分割 = stdin.readline().rstrip().split()




from sys import stdin
from itertools import accumulate, dropwhile, takewhile, groupby
import bisect
import copy
import math
import itertools
from functools import reduce
from operator import mul
def gcd(*numbers):
    return reduce(math.gcd, numbers)


def gcd_list(numbers):
    return reduce(math.gcd, numbers)


def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)


def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)


def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)


def get_unique_list(seq):
    seen = []
    return [x for x in seq if x not in seen and not seen.append(x)]


N = int(stdin.readline().rstrip())
count = 0
add = 0
bs = []
for k in range(1, N+1):
    a = k
    bf = str(a)[len(str(a)) - 1]
    if bf == '0':
        continue
    bb = str(a)[0]
    if str(a)[0] == str(a)[len(str(a)) - 1]:
        if int(bf) > N:
            continue
        bs.append((a, int(bf)))
    if int(bf + bb) > N:
        continue
    bs.append((a, int(bf + bb)))
    if len(str(N)) >= 3:
        if bf == str(N)[0]:
            for m in range(1, len(str(N)) - 2):
                add += 10 ** m
            if int(bb) <= int(str(N)[len(str(N)) - 1]):
                add += int(str(N)[1: len(str(N)) - 1]) + 1
            if int(bb) > int(str(N)[len(str(N)) - 1]):
                add += int(str(N)[1: len(str(N)) - 1])
        if bf < str(N)[0]:
            tmp = 0
            for m in range(1, len(str(N)) - 1):
                tmp += 10 ** m
            add += tmp
        if bf > str(N)[0]:
            for m in range(1, len(str(N)) - 2):
                add += 10 ** m
print(len(bs)+add)


Measured memory_bytes: 67928
#L

N=int(input())
a=list(map(int,input().split()))

S=[0]*(N+1)
for i in range(N):
    S[i+1]=S[i]+a[i]

dp=[[0]*(N+1) for _ in range(N+1)]#[l,r)の範囲が残っているときに取れる最大値

for i in range(1,N+1):#r-lの値
    for j in range(N):#lの値
        r=j+i
        if r>N:
            break
        l=j
        x=a[l]+(S[r]-S[l+1]) - dp[l+1][r]
        y=a[r-1]+(S[r-1]-S[l]) - dp[l][r-1]
        dp[l][r]=max(x,y)

print(2*dp[0][N] - S[-1] )

Measured memory_bytes: 112348
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a=sc.nextInt();
		int b=sc.nextInt();
		int c=sc.nextInt();
		int count=0;

		int x=(a&1)<<2 | (b&1)<<1 | (c&1);
		switch(x){
		case 0b001 :
		case 0b110 :
			a++; b++; count++; break;
		case 0b100 : 
		case 0b011 :
			b++; c++; count++; break;
		case 0b010 :
		case 0b101 :
			c++; a++; count++; break;
		}
		
		int cc= Math.max(a, Math.max(b, c));
		int aa= Math.min(a, Math.min(b, c));
		int bb= a+b+c-aa-cc;
		
		count+=(cc-bb)/2+(cc-aa)/2;
		System.out.println(count);
	}
}


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

int main(){
    string S,T; cin>>S>>T;
    ll count=0,N=S.size();
    for (int i = 0; i < N; i++){
        if(S[i]!=T[i]){
            count++;
        }
    }
    cout<<count<<endl;
}

Measured memory_bytes: 3912
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;

int main() {
    string s; cin >> s;
    for (int i = 0; i < 2; i++) {
        if (s[i] != s[i + 1]) {
            puts("Yes");
            return 0;
        }
    }
    puts("No");
    return 0;
}

Measured memory_bytes: 256
import numpy as np

n = int(raw_input())
v = map(int,raw_input().split())

seta= [0 for i in range(1,10**5 +1)]
setb= [0 for i in range(1,10**5 +1)]


for i in range(n/2):
    seta[v[2*i]-1]+=1
    setb[v[2*i+1]-1]+=1
seta = np.array(seta)
setb = np.array(setb)

argseta=seta.argsort()[::-1]
argsetb=setb.argsort()[::-1]


if argseta[0]!=argsetb[0]:
    print n - max(seta) - max(setb)
else:
    if setb[argseta[0]]-seta[argseta[1]]<setb[argsetb[0]]-setb[argsetb[1]]:
        print n - max(setb) - seta[argseta[1]]
    else:
        print n - max(seta) - setb[argsetb[1]]


Measured memory_bytes: 27772
//includes
#include<iostream>
#include<vector>
#include<set>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<string>
#include<stack>
#include<map>
#include<queue>
#include<iomanip>
#include<numeric>
#include<assert.h>
#include<cstring>
#include<unordered_map>
#include<bitset>

//macros and consts
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define all(a) (a).begin(),(a).end()
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define FORE(i,a) for(auto &i : a)
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define accm accumulate
#define Fi first
#define Se second
#define INF 1e9
#define llINF (1LL<<60)
#define mINF -1e9
#define mllINF -(1LL<<60)
#define endl "\n"
#define CONT continue
#define BRK break
#define modulo(n, m) (((n)%(m)+(m))%m)

//shorter types
using namespace std;
using ll = long long;
using vi = std::vector<int>;
using vc = std::vector<char>;
using vll = std::vector<long long>;
using vs = std::vector<string>;
using Mi = map<int,int>;
using Mll = map<ll,ll>;
using UMi = unordered_map<int,int>;
using UMll = unordered_map<ll,ll>;
using Pi = pair<int,int>;
using Pll = pair<ll,ll>;
using vPi = vector<Pi>;
using vPll = vector<Pll>;
using vvi = vector<vector<int>>;
using vvll = vector<vector<ll>>;
using vvc = vector<vector<char>>;
using vvs = vector<vector<string>>;
using pqgi = priority_queue<int,vector<int>,greater<int>>;
using pqsi = priority_queue<int,vector<int>,less<int>>;
using pqgll = priority_queue<int,vector<int>,greater<int>>;
using pssll = priority_queue<int,vector<int>,less<int>>;
template<class T>
using vec = vector<T>;
#define int long long


//here begins your code
signed main(){
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  vector<bool> isPrime(101000,true);
  isPrime[0] = false;
  isPrime[1] = false;
  for(int i = 2; pow(i,2) <= 101000; i++){
  	if(isPrime[i]) for(int j = 2; i * j <= 101000; j++) isPrime[i * j] = false;
  }

  int X;
  cin >> X;
  for(int i = X; i <= 101000; i++){
  	if(isPrime[i]){
  		cout << i << endl;
  		return 0;
  	}
  }
  //check types
  //do not eb if you resize
  //resize before you access by idx
  return 0;
} 

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	void run(){
		Scanner s = new Scanner(System.in);
		String W = s.next().toLowerCase();
		String T="";
		String txt = "";
		int cnt=0;
		while(true){
			if(W.equals(txt))cnt++;
			txt = s.next();
			if("END_OF_TEXT".equals(txt)){
				break;
			}
			txt = txt.toLowerCase();
		}
		System.out.println(cnt);
	}
	public static void main(String args[]){
		new Main().run();
	}
}

Measured memory_bytes: 26320
#include <bits/stdc++.h>
using namespace std;
using int64 = long long;
#define int int64
#define rep(i, n) for(int i=0; i<n; i++)
#define FOR(i, a, b) for(int i=a; i<b; i++)
#define SORT(x) sort(x.begin(), x.end())
#define GSORT(x) sort(x.begin(), x.end(), greater<int>())
#define mk make_pair
#define fi first
#define se second
#define pb push_back
#define ALL(x) x.begin(), x.end()
#define V(T) vector<T>
typedef pair<int, int> P;
typedef pair<P, P> PP;
typedef vector<int> vi;
typedef vector<vi> vvi;
int max(int a, int b) {if(b>a) return b; else return a;}
int min(int a, int b) {if(b<a) return b; else return a;}
const int INF = 1e18;

signed main() {
    int N, x;
    cin >> N >> x;
    vi res(2*N-1);

    if(x==1 || x==2*N-1) {
        cout << "No" << endl;
        return 0;
    }
    else if(N>2) {
        if(x==2) {
            rep(i, 3) {
                res[(2*N-1)/2-1+i] = x-1+i;
            }
            res[(2*N-1)/2-2] = x+2;
            int a = 5;
            rep(i, (2*N-1)/2-2) res[i] = a++;
            FOR(i, (2*N-1)/2+2, 2*N-1) res[i] = a++;
        } else {
            rep(i, 3) {
                res[(2*N-1)/2-1+i] = x-1+i;
            }
            res[(2*N-1)/2+2] = x-2;
            int a = 1;
            rep(i, (2*N-1)/2-1)  {
                if(a==x-2) a = x+2;
                res[i] = a;
                a++;
            }
            FOR(i, (2*N-1)/2+3, 2*N-1) {
                if(a==x-2) a = x+2;
                res[i] = a++;
            }
        }
    } else {
        rep(i, 3) {
            res[i] = i+1;
        }
    }

    cout << "Yes" << endl;
    rep(i, 2*N-1) {
        cout << res[i] << endl;
    }

    return 0;
}

Measured memory_bytes: 4768
import java.util.*;
 
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int d = sc.nextInt();
		int x = a*b;
		int y = c*d;
		if( x > y ){
			System.out.println(x);
		}else{
			System.out.println(y);
		}
	return;
	}
}

Measured memory_bytes: 9808
#include <iostream>
#include <algorithm>
#include <iterator>
#include <iomanip>
#include <cmath>
#include <vector>
#include <numeric>
#include <cstdio>
#include <bitset>
#include <map>


using namespace std;

typedef vector<int> Vector;
typedef vector<Vector> Matrix;

const int MAX = 101;

int main()
{


    int n, m;
    cin >> n >> m;

    Matrix A(MAX, Vector(MAX));
    Vector b(MAX);    

    int i = 0;
    while (i++ < n)
    {
        int j = 0;
        while (j++ < m)
        {
            cin >> A[i][j];
        }
    }

    i = 0;
    while (i++ < m)
    {
        cin >> b[i];
    }

    //method 1
    // i = 0;
    // while (i++ < n)
    // {
    //     int j = 0, ans = 0;
    //     while (j++ < m)
    //     {
    //         ans += A[i][j] * b[j];
    //     }
    //     cout << ans << endl;
    // }

    //method 2
    i = 0;
    while (i++ < n)
    {
        cout << inner_product(A[i].begin(), A[i].end(), b.begin(), 0) << endl;
    }
    
}


Measured memory_bytes: 3204
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int a = in.nextInt();
		int b = in.nextInt();
		int c = 1;
		int p = a;

		while(p < b) {
			p += a-1;
			c++;
		}

		if(b == 1) {
			System.out.println(0);
			return;
		}
		System.out.println(c);
		return;
	}
}


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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> Pi;
typedef vector<ll> Vec;
typedef vector<int> Vi;
typedef vector<string> Vs;
typedef vector<P> VP;
typedef vector<vector<ll>> VV;
typedef vector<vector<int>> VVi;

#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define PER(i, a, b) for(ll i=(a); i>=(b); i--)
#define rep(i, n) REP(i, 0, n)
#define per(i, n) PER(i, n, 0)
const ll INF=1e18+18;
const ll MAX=100005;
const ll MOD=1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
#define ALL(v) v.begin(), v.end()
#define rALL(v) v.rbegin(), v.rend()
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a,b)
#define Each(a,b) for(auto &a :b)
#define REPM(i, mp) for (auto i = mp.begin(); i != mp.end(); ++i)
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbgmap(mp) cerr << #mp << ":"<<endl; for (auto i = mp.begin(); i != mp.end(); ++i) { cerr << i->first <<":"<<i->second << endl;}
#define dbgarr(n,m,arr) rep(i,n){rep(j,m){cerr<<arr[i][j]<<" ";}cerr<<endl;}
#define dbgdp(n,arr) rep(i,n){cerr<<arr[i]<<" ";}cerr<<endl;
#define Uniq(v) v.erase(unique(v.begin(), v.end()), v.end())
#define fi first
#define se second

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }

template<typename T1, typename T2>
ostream &operator<<(ostream &s, const pair<T1, T2> &p) { return s<<"("<<p.first<<", "<<p.second<<")"; }

// vector
template<typename T>
ostream &operator<<(ostream &s, const vector<T> &v) {
    int len=v.size();
    for(int i=0; i<len; ++i) {
        s<<v[i];
        if(i<len-1) s<<"	";
    }
    return s;
}

// 2 dimentional vector
template<typename T>
ostream &operator<<(ostream &s, const vector<vector<T> > &vv) {
    int len=vv.size();
    for(int i=0; i<len; ++i) {
        s<<vv[i]<<endl;
    }
    return s;
}

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

    ll n,m;
    cin>>n>>m;
    if(n>m){
        swap(n,m);
    }
    ll ans=0;
    if(n==1&&m==1){
        ans = 1;
    }else if(n==1){
        ans = m-2;
    }else{
        ans = (n-2)*(m-2);
    }
    cout<<ans<<endl;
    return  0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define rep(ver,n) rep2(ver,0,n)
#define rep2(ver,m,n) for(int ver=m;ver<(n);ver++)
#define loop while(true)
#define dup(x,y) (((x)+(y)-1)/(y))
#define all(v) (v).begin(), (v).end()
#define debug(x) std::cerr<<#x<<": "<<x<<"\n"
#define debug2(x,y) std::cerr<<#x<<": "<<x<<", "<<#y<<": "<<y<<"\n"
#define debug3(x,y,z) std::cerr<<#x<<": "<<x<<", "<<#y<<": "<<y<<", "<<#z<<": "<<z<<"\n"
 
typedef long long ll;
typedef pair<int, int> P;
 
int main(){
  string  str;
  cin >> str;
  if(str == "SUN") cout << 7;
  if(str == "MON") cout << 6;
  if(str == "TUE") cout << 5;
  if(str == "WED") cout << 4;
  if(str == "THU") cout << 3;
  if(str == "FRI") cout << 2;
  if(str == "SAT") cout << 1;
  
  return 0;
}

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

template<class T> inline void chmin(T& a, T b) {
    if (a > b) {
        a = b;
    }
}

template<class T> inline void chmax(T& a, T b) {
    if (a < b) {
        a = b;
    }
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S;
    cin >> S;
    sort(S.begin(),S.end());
    if(S == "abc"){
        cout <<"Yes"<< "\n";
    }else{
        cout <<"No"<< "\n";
    }
}

Measured memory_bytes: 256