akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define N 1010
using namespace std;
template <typename T> void read(T &x){
	x=0;char ch=getchar();int fh=1;
	while (!isdigit(ch)){if (ch=='-')fh=-1;ch=getchar();}
	while (isdigit(ch)){x=x*10+ch-'0';ch=getchar();}
	x=x*fh;
}
int n,d,f[N][N],x,y,g[N][N][3],sum,ansn;
int que(int nu,int l,int r,int p,int q){
	if (p>=d)return que(nu,l,r,d-1,q)+que(nu,0,r,p-d,q);
	if (q>=d)return que(nu,l,r,p,d-1)+que(nu,l,0,p,q-d);
	int sum=g[p][q][nu];
	if (l!=0)sum-=g[l-1][q][nu];
	if (r!=0)sum-=g[p][r-1][nu];
	if (l!=0&&r!=0)sum+=g[l-1][r-1][nu];
	return sum;
}
bool pa(int x,int y,int le){
	int x1=que(2,x,y,x+le,y+le);
	int x2=que(1,0,y,d-1,y+le)+que(1,x,0,x+le,d-1)-que(1,x,y,x+le,y+le);
	if (x1==g[d-1][d-1][2]&&x2==g[d-1][d-1][1])return 1;
	return 0;
}
int main(){
	read(n);read(d);
	for (int i=1;i<=n;i++){read(x);read(y);f[x%d][y%d]++;}
	for (int i=0;i<d;i++)
		for (int j=0;j<d;j++)sum=max(sum,f[i][j]);
	int y=sqrt(sum);while (y*y<sum) y++;
	for (int i=0;i<d;i++)
		for (int j=0;j<d;j++){
			if (f[i][j]<=(y-1)*(y-1))g[i][j][0]=1;
			if ((y-1)*(y-1)<f[i][j]&&f[i][j]<=(y-1)*y)g[i][j][1]=1;
			if (f[i][j]>(y-1)*y)g[i][j][2]=1;
		}
	for (int k=0;k<=2;k++){
		for (int i=0;i<d;i++)
			for (int j=1;j<d;j++)g[i][j][k]+=g[i][j-1][k];
		for (int i=1;i<d;i++)
			for (int j=0;j<d;j++)g[i][j][k]+=g[i-1][j][k];
	}
	ansn=d;
	for (int i=0;i<d;i++){
		for (int j=0;j<d;j++){
			int l=0,r=d-1,mid;
			while (l<r){
				mid=(l+r)/2;
				if (pa(i,j,mid))r=mid;else l=mid+1;
			}
			ansn=min(ansn,l);
		}
	}
	cout<<ansn+d*(y-1)<<endl;
	return 0;
}

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

int main() {
  long long a, b, n; cin >>  n >> a >> b;
  if((a - b) % 2 == 0) {
    cout << abs(a - b) / 2 << endl;
    return 0;
  }
  cout << min(min(a, b) + abs(a - b) / 2, n - max(a, b) + abs(a - b) / 2 + 1) << endl;
  return 0;
}


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

using namespace std;

int main(){

  int A,B,C;
  //string S,T,U;
  
  //cin>>S>>T;
  cin>>A;
  //cin>>U;

  if(A%2==1){
    cout<<A/2+1<<endl;
  }
  else{
    cout<<A/2<<endl;
  }
}


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

using namespace std;

int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    for (auto &&i : a)
    {
        cin >> i;
    }
    int ans = 1e9 + 7;
    for (int i = 1; i <= 100; i++)
    {
        int score = 0;
        for (auto &&j : a)
        {
            score += (j - i) * (j - i);
        }
        ans = min(score, ans);
    }
    cout << ans << "\n";
}

Measured memory_bytes: 384
import java.util.Scanner;
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] num = new int[3];
        for (int i = 0; i < 3; i++) {
            int x = n % 10;
            n /= 10;
            if (x == 9) {
                num[i] = 1;
                continue;
            }
            if (x == 1) {
                num[i] = 9;
                continue;
            }
        }
        System.out.println(num[2] * 100 + num[1] * 10 + num[0]);
    }
}


Measured memory_bytes: 22868
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <string>
#include <map>
#include <queue>
#include <vector>
#include <cstdlib>
#define mp make_pair
#define pb push_back
#define mem(i,a) memset(i,a,sizeof(i))
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
const ll INF=10000000000;
const int DMAX=600000+5;
const int MOD=6000000;
template<class T> inline void read(T &x){
    x=0; 
    T f=1;
    char ch=getchar();
    while(ch<'0' || ch>'9'){
        if(ch=='-'){
            f=-1;
        }
        ch=getchar();
    }
    while(ch<='9' && ch>='0'){
        x=x*10+(ch-'0');
        ch=getchar();
    }
    x*=f;
}
int d;
int main(){
	cin>>d;
	if(d==25){
		cout<<"Christmas"<<endl;
	}
	if(d==24){
		cout<<"Christmas Eve"<<endl;
	}
	if(d==23){
		cout<<"Christmas Eve Eve"<<endl;
	}
	if(d==22){
		cout<<"Christmas Eve Eve Eve"<<endl;
	}
	return 0;
}

Measured memory_bytes: 3568
/*
  NAME : RISHABH SINGH
  INSTITUTION : DELHI TECHNOLOGICAL UNIVERSITY
*/
#include "bits/stdc++.h"
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define int long long
#define pii pair<int, int>
#define bi __builtin_inf()
#define ll long long
#define mp make_pair
#define ss second
#define pb push_back
#define ff first
#define speed_cubing ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define um unordered_map
#define us unordered_set
#define bp __builtin_popcount
#define ld long double
#define rep(n) for (int i = 0; i < n; i++)
#define pll pair<ll, ll>
#define mx = 1e18;
#define lb(v, val) (lower_bound(v.begin(), v.end(), val) - v.begin())
#define ub(v, val) (upper_bound(v.begin(), v.end(), val) - v.begin())
#define PI 3.1415926535
typedef tree<pii, null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> pbds;
ll powmod(ll base,ll exp,ll MOD){ll res=1;while(exp>0){if(exp%2==1) res=(res*base)%MOD;base=(base*base)%MOD;exp/=2;}return (res%MOD);}
#define sz(v) (int)v.size()
#define endl '\n'
const int mod = 998244353;
ll mul_inv(ll a,ll b = mod) {ll t1=a,t2=b,t3,v1=1,v2=0,v3;while(t2!=1){ll x=t1/t2;t3=t1-x*t2;v3=v1-x*v2;t1=t2,t2=t3;v1=v2,v2=v3;}return(v2+b)%b;}
const int N = 1e7+5;
int sieve[N];

int32_t main(){
   
   speed_cubing

   for(int i=1;i<N;i++)
      for(int j=i;j<N;j+=i)
         sieve[j]++;


   for(int i=2;i<N;i++)
      sieve[i] = sieve[i]*i+sieve[i-1];


   int n;
   cin>>n;

   cout<<sieve[n];
  
    
   return 0;
}

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

class Program
{
    static void Main(string[] args)
    {
        List<int[]> list = new List<int[]>();
        for (int i = 0; i <= 2; i++)
        {
            int[] arr = Console.ReadLine().Split(' ').Select(a => int.Parse(a)).ToArray();
            list.Add(arr);
        }
        int n = int.Parse(Console.ReadLine());
        for (int i = 1; i <= n; i++)
        {
            int num = int.Parse(Console.ReadLine());
            CheckNum(list, num);
        }
        Bingo(list);

    }

    static void CheckNum(List<int[]> list, int num){
        foreach (int[] arr in list)
        {
            for(int i = 0; i<=2; i++)
            {
                if (arr[i] == num)
                {
                    arr[i] = 0;
                    return;
                }
            }
        }
    }

    static void Bingo(List<int[]> list)
    {
        foreach(int[] arr in list)
        {
            if (arr.Sum() == 0)
            {
                Console.WriteLine("Yes");
                return;
            }
        }
        for(int i = 0; i < 3; i++)
        {
            int sum = 0;
            for(int j = 0; j < 3; j++)
            {
                sum += list[j][i];
            }
            if (sum == 0)
            {
                Console.WriteLine("Yes");
                return;
            }
        }
        if(list[0][0] + list[1][1] + list[2][2] == 0 || list[0][2] + list[1][1] + list[2][0] == 0)
        {
            Console.WriteLine("Yes");
            return;
        }
        Console.WriteLine("No");
    }


}





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

int main() {
  int num;
  float ans;
  cin >> num;

  for(int i = 0; i < num; i++)
  {
  	float real_num;
    float recip;
    cin >> real_num;
    recip = 1 / real_num;
    ans += recip;
  }
  	ans = 1 / ans;
	cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair< ll, ll > Pi;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define rep3(i,i0,n) for(int i=i0;i<(n);i++)
#define pb push_back
#define mod 1000000007
const ll INF = 1LL << 60;
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; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}
#define all(x) x.begin(), x.end()
#define mp make_pair
bool compare(Pi a, Pi b) {
    if(a.first != b.first){
        return a.first < b.first;
        
    }else{
        return a.second < b.second;
    }
}


bool In_map(ll y,ll x,ll h,ll w){
    if(y<0 || x<0 || y>=h || x>=w){
        return 0;
    }else{
        return 1;
    }
}
const vector<ll> dx{1,0,-1,0};
const vector<ll> dy{0,1,0,-1};


int main() {
    ll A,B;
    string S;
    cin >>A>>B>>S;
    if(S[A]!='-'){
        cout<<"No"<<endl;
        return 0;
    }
    ll cnt=0;
    rep(i,A+B+1){
        if(S[i]=='-'){
            cnt++;
        }
    }

    if(cnt!=1){
        cout<<"No"<<endl;
    }else{
        cout<<"Yes"<<endl;
    }



    return 0;
    

}

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

using namespace std;

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

    long long res = x / 11 * 2;

    if (x % 11 > 0) {
        res++;
    }
    if (x % 11 > 6) {
        res++;
    }
    cout << res << '\n';
}

Measured memory_bytes: 384
#include <cstdio>
#include <iostream>
#include <string>

using namespace std;
int a[10000];
int main()
{
	string s;
	cin>>s;
	for (int i = 0;i<s.length();i++)a[s[i]]++;

	for (int i = 'A';i<='Z';i++)if (a[i]!=2 && a[i]!=0){
		cout<<"No"<<endl;
		return 0;
	}
	cout<<"Yes"<<endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
#define reps(i,s,n) for(int (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define reptr(i,n) for(int (i)=(n);(i)>=0;--(i))
#define All(x) (x).begin(),(x).end()
#define BTC 380000
const ll MOD=1e9+7;
using namespace std;

int main() {
  int N;
  cin >> N;
  double sum=0;
  rep(i,N){
    double x;
    string u;
    cin >> x >> u;
    if(u=="BTC"){
      sum+=x*BTC;
    }else{
      sum+=x;
    }
  }
  printf("%.5f\n",sum);
}


Measured memory_bytes: 256
N, K = map(int, input().split())
A = list(map(int, input().split()))
MOD = 10 ** 9 + 7

positives = [a for a in A if a > 0]
negatives = [a for a in A if a < 0]
positive_cnt = len(positives)
negative_cnt = len(negatives)
zero_cnt = A.count(0)


if min(2 * (negative_cnt // 2), 2 * (K // 2)) + positive_cnt >= K:
    # 答えが正になる場合
    positives = sorted(positives, reverse=True)
    negatives = sorted(negatives)

    if K % 2 == 1:
        ans = positives[0]
        positives = positives[1:]
        positive_cnt = len(positives)
    else:
        ans = 1

    positives_twin = [positives[2 * i] * positives[2 * i + 1] for i in range(positive_cnt // 2)] + [0]
    negatives_twin = [negatives[2 * i] * negatives[2 * i + 1] for i in range(negative_cnt // 2)] + [0]
    positives_twin.sort()
    negatives_twin.sort()

    for i in range(K // 2):
        if positives_twin[-1] <= negatives_twin[-1]:
            ans *= negatives_twin[-1]
            ans %= MOD
            negatives_twin.pop()
        else:
            ans *= positives_twin[-1]
            ans %= MOD
            positives_twin.pop()

    print(ans % MOD)

elif zero_cnt > 0:
    # 答えが０になる場合
    print(0)
else:
    # 答えが負になる場合
    ans = 1
    A_abs = sorted([abs(a) for a in A])
    for a in A_abs[:K]:
        ans *= a
        ans %= MOD
    ans = -ans % MOD
    print(ans)


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

int main() {
  int N;
  long long x,a[100005];
  std::cin>>N>>x;
  for(int i = 0;i<N;++i)
    std::cin>>a[i];
  
  long long ans = 0;
  for(int i = 1;i<N;++i){
    ans+=std::max<long long>(0,a[i - 1]+a[i]-x);
    a[i] = std::min(x-a[i-1],a[i]);
    if(a[i]<0)
      a[i] = 0;
  }
  std::cout<<ans<<'\n';
  return 0;
}

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

using namespace std;

//using Matrix = vector< vector<int> >;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9 + 10;
//const ll INF = 1e18 + 10LL;
int dx[5] = {0, 0, 1, -1, 0}, dy[5] = {1, -1, 0, 0, 0};
const double EPS = 1e-10;
bool cmp(P a, P b) { return a.second < b.second; } //End sort (Interval scheduling problem)
ll MOD = 1e9 + 7;

int n;
P task[200010];

int main(void){
	cin>>n;
	for (int i = 0; i < n; i++) cin>>task[i].first>>task[i].second;

	sort(task, task + n, cmp);
	
	int t = 0, i = 0;
	bool can = true;
	while (can && i < n) {
		if (t + task[i].first <= task[i].second) {
			t += task[i++].first;
		} else {
			can = false;
		}
	}

	if (can) cout<< "Yes" <<endl;
	else cout<< "No" <<endl;
	
	return 0;
}

Measured memory_bytes: 1792
A_list = [list(map(int, input().split())) for _ in range(3)]

N = int(input())
B_list = []

for i in range(N):
    B_temp = int(input())
    B_list.append(B_temp)

ans_list = [[0 for _ in range(3)] for i in range(3)]

for i in range(N):
    for j in range(3):
        for k in range(3):
            if B_list[i] == A_list[j][k]:
                ans_list[j][k] = 1

for i in range(3):
    ans_r_flag = 0
    ans_c_flag = 0
    for j in range(3):
        ans_r_flag += ans_list[i][j]
        ans_c_flag += ans_list[j][i]
        if ans_r_flag == 3 or ans_c_flag == 3:
            print("Yes")
            exit()
            
if ans_list[0][0] == 1 and ans_list[1][1] == 1 and ans_list[2][2] == 1:
    print("Yes")
    exit()
if ans_list[0][2] == 1 and ans_list[1][1] == 1 and ans_list[2][0] == 1:
    print("Yes")
    exit()

print("No")


Measured memory_bytes: 9260
import java.util.*;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long[] A = new long[n];
        for(int i=0;i<n;i++){
            A[i]=sc.nextLong();
        }
        int cnt=0;
        for(long w:A){
            if(w%2==1) cnt++;
        }
        String ans = cnt%2==0?"YES":"NO";
        System.out.println(ans);
    }
}


Measured memory_bytes: 50472
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
using namespace std;
#define ll long long
#define rep(i,l,r) for(ll i=(l);i<(r);i++)
int main(void){
    string s;
    cin>>s;
    cout<<(700+((s[0]=='o')+(s[1]=='o')+(s[2]=='o'))*100)<<endl;
    return 0;
}

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

struct team {
	int seikai, ID, penarutii,gotou[10];
};
bool operator < (team a, team b) {
	if (a.seikai != b.seikai)return a.seikai > b.seikai;
	else if (a.penarutii!= b.penarutii)return a.penarutii< b.penarutii ;
	else return a.ID < b.ID;
}
int main() {
	int a, b, c;
	while (cin >> a >> b >> c, a || b || c) {
		team d[50]{};
		for (int k = 0; k < a; k++)d[k].ID = k;
		for (int e = 0; e < c; e++) {
			int f, g, h; string i;
			cin >> f >> g >> h >> i;
			if (i == "WRONG")d[f - 1].gotou[g-1]++;
			else {
				d[f - 1].seikai++;
				d[f - 1].penarutii += h + d[f - 1].gotou[g - 1] * 1200;
			}
		}
		sort(d, d + a);
		for (int i = 0; i < a; i++) {
			cout << d[i].ID + 1 << " " << d[i].seikai << " " << d[i].penarutii << endl;
		}
	}
}

Measured memory_bytes: 3144
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;

int main() {
    string s, t;
    int i;
    cin >> s >> t;
    for(i = 0; i < s.size(); i++){
        if(s.at(i) != t.at(i)){
            break;
        }
    }
    if(i == s.size()){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define REP(i,x,n) for(int i=x;i<(int)n;i++)
#define rep(i,n) REP(i,0,n)
#define sp(p) cout<<setprecision(16)<<fixed<<p<<endl;
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define SORT(a) sort(all(a))
#define RSORT(a) sort(rall(a))
#define UNIQ(a) unique(all(a))
#define UNIQNUM(a) UNIQ(a)-a.begin()
#define UNIQIT(a) a.erase(UNIQ(a), a.end());
#define VOUT(v,i) cout<<#v<<": ";for(int i=0;i<(int)v.size();i++){cout<<v[i]<<" ";}cout<<"\n";
#define vout(v) VOUT(v,z);
#define vmin(v) *min_element(all(v))
#define vmax(v) *max_element(all(v))
#define vsum(v) accumulate(all(v), 0LL);
#define MOUT(m,r,c) rep(i,r){rep(j,c){cout<<m[i][j]<<" ";}cout<<endl;}
#define mout(m) MOUT(m,m.size(),m[0].size())
#define debg(a) cout<<#a<<": "<<a<<endl;
#define show(a) for(cont &y:a){for(cont &x:y){cout<<x<<" ";}cout<<endl;}
#define digit(a) to_string(a).length();
template<class T>inline int out(const T &t){ print(t); putchar('\n'); return 0; }
template<class T>inline T gcd(T a,T b){if(b==0)return a; return(gcd(b,a%b));}
template<class T>inline T lcm(T a,T b){return a/gcd(a,b)*b;}
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef vector<ll> V;
// const long long MOD=1000000007;
const long long INF = 1e18;
#define EPS (1e-7)
#define PI (acos(-1))
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) { a = b; return true; }
    return false;
}
template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) { a = b; return true; }
    return false;
}


void solve(long long A, long long B, long long K){
    ll tak = max(A-K,0LL);
    ll aok = max(B-max(K-A,0LL),0LL);
    cout << tak << " " << aok << "\n";
}

int main(){
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    long long K;
    scanf("%lld",&K);
    solve(A, B, K);
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<map>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
using namespace std;
int main(){
  string tmp[]={"",".,!? ","abc","def","ghi","jkl","mno","pqrs","tuv","wxyz"};
  string str;
  int i,l,cnt1,cnt2,n;
  cin >>n;
  for(int v=0;v<n;v++){
    cin >> str;
    l=str.size();
    cnt1=cnt2=0;
    for(int i=0;i<l;i++){
      if(str[i]=='0'){
	if(cnt2!=0){
	  cout << tmp[cnt1][(cnt2%tmp[cnt1].size()==0)?tmp[cnt1].size()-1:cnt2%tmp[cnt1].size()-1];
	}
	cnt1=cnt2=0;
      } else {
	if(cnt1==0){
	  cnt1=str[i]-'0';
	  cnt2++;
	}else{
	  cnt2++;
	}
      }
    }
    puts("");
  }
}

Measured memory_bytes: 1196
S = list(input().rstrip())

if S[0] == 'A':
	S[0] = 'a'
	cnt = 0
	flag = True
	for i, s in enumerate(S[2:-1]):
		if s == 'C':
			cnt += 1
			if flag:
				S[2+i] = 'c'
				flag = False
	if cnt == 1 and ''.join(S).islower():
		print('AC')
		exit(0)

print('WA')

Measured memory_bytes: 3060
import java.io.InputStream;
import java.io.PrintStream;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
import java.util.concurrent.atomic.AtomicInteger;

public class Main {

  public static void main(String[] args) {
    resolve(System.in, System.out);
  }

  static void resolve(InputStream is, PrintStream pw) {
    Scanner sc = new Scanner(is);
    int n = Integer.parseInt(sc.next());
    Map<Integer, AtomicInteger> countMap = new HashMap<>();
    for (int x = 1; x <= 10000; x++) {
      int x2 = x * x;
      if (x2 > n) {
        break;
      }
      for (int y = 1; y <= 10000; y++) {
        int y2 = y * y;
        int xy = x * y;
        if ((long) x2 + y2 + xy > n) {
          break;
        }
        for (int z = 1; z <= 10000; z++) {
          long c = x2 + y2 + z * z + xy + y * z + z * x;
          if (c > n) {
            break;
          }
          int castC = (int) c;
          countMap.computeIfAbsent(castC, k -> new AtomicInteger(0))
            .incrementAndGet();
        }
      }
    }
    for (int i = 1; i <= n; i++) {
      pw.println(countMap.getOrDefault(i, new AtomicInteger(0)).get());
    }
  }
}


Measured memory_bytes: 44012
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define pi 3.14159265359
#define all(i) i.begin(),i.end()
using namespace std;
const long long INF=1e9+7;
const string alp="abcdefghijklmnopqrstuvwxyz"; //26
const string ALP="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> T;
//const ll MOD=998244353LL;
//const ll MOD=1777777777LL;


int main() {
  ll N;
  cin>>N;
  vl A(N),B(N),C(N);
  rep(i,N) cin>>A[i];
  rep(i,N) cin>>B[i];
  rep(i,N) cin>>C[i];
  
  sort(all(A));
  sort(all(C));
  ll ans=0;
  rep(i,N){
    int b=B[i];
    auto d=lower_bound(A.begin(),A.end(),b);
    auto e=upper_bound(C.begin(),C.end(),b);
    ans+=(d-A.begin())*(C.end()-e);
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 5640
N = int(input())
arare = input().rstrip().split()
count = {"P": 0, "W": 0, "G": 0, "Y": 0}
for i in range(N):
  cur = arare[i]
  if cur == "P":
    count["P"] += 1
  elif cur == "W":
    count["W"] += 1
  elif cur == "G":
    count["G"] += 1
  else:
    count["Y"] += 1
print("Four" if count["Y"] >= 1 else "Three")

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <random>
#include <chrono>
#include <queue>
#include <math.h>
 
using namespace std;

int main(){
  string s;
  cin >>s;
  
  int h;
  
  h=s.size();
  
  int ans1=0;
  int ans2=0;
  
  //最初が0
  
  for (int i=0;i<h;i++){
    if(i%2==0){
      if (s.at(i)=='1') ans1++;
    }
    else{
      if (s.at(i)=='0') ans1++;
    }
  }
  for (int i=0;i<h;i++){
    if(i%2==0){
      if (s.at(i)=='0') ans2++;
    }
    else{
      if (s.at(i)=='1') ans2++;
    }
  }
  int ans=min(ans1,ans2);
  cout << ans<< endl;
  
}

Measured memory_bytes: 512
let () =
  let num = Array.make 100001 0 in
  let sum = ref 0 in
  let n = Scanf.scanf "%d\n" @@ fun n -> n in
  for i = 0 to n - 1 do
    Scanf.scanf "%d " @@ fun d ->
    num.(d) <- num.(d) + 1; sum := !sum + d
  done;
  Scanf.scanf "%d\n" @@ fun q ->
  for i = 0 to q - 1 do
    Scanf.scanf "%d %d\n" @@ fun b c ->
    sum := !sum + (c - b) * num.(b); num.(c) <- num.(c) + num.(b); num.(b) <- 0;
    Printf.printf "%d\n" !sum
  done;

Measured memory_bytes: 6764
// ABC121_A
#include <iostream>
using namespace std;
using ll = long long;

int main() {
    // input(sunippets: inpv, inpn, inps)
    ll H, W, h, w;
    cin >> H >> W >> h >> w;
    
    // calculation
    cout << (H-h)*(W-w) << endl;
    
    return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
from sys import stdin

W = stdin.readline().rstrip()

sum = 0
while True:
  T = stdin.readline().rstrip()
  if T == 'END_OF_TEXT':
    break
  T = T.split()
  sum += len([s for s in T if s.lower() == W])
print(sum)


Measured memory_bytes: 5576
//C
#include <bits/stdc++.h>
#define reg register

using namespace std;

typedef long long ll;
const int maxn = 100005;

inline ll read() {
    reg ll s = 0, t = 0; reg char ch = getchar();
    while (!isdigit(ch)) t |= ch == '-', ch = getchar();
    while (isdigit(ch)) s = (s << 1) + (s << 3) + (ch ^ 48), ch = getchar();
    return t ? -s : s;
}

int main() {
    reg ll n = read();
    for (reg int i = sqrt(n); i >= 1; i--) {
        if (n % i) continue;
        reg ll num = (i - 1) + (n / i - 1);
        cout << num << endl; exit(0);
    }
    return 0;
}


Measured memory_bytes: 256
// Best practice
 
#include<bits/stdc++.h>
 
#define int         long long
#define pb          push_back
#define pf          emplace_front
#define all(a)      (a).begin(),(a).end()
#define rall(a)     (a).rbegin(),(a).rend()
#define pii 		pair<int,int>
#define psi 		pair<string,int>
#define vi 			vector<int>
#define vpii  		vector<pii>
#define vvi 		vector<vi>
#define sz(x)	    (int)(x).size()
#define x           first
#define y           second
#define endl        '\n'
#define tezz        ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define MOD         1000000007
#define hell        998244353
#define prec(n) 	fixed<<setprecision(n)
#define ini(a, i) 	memset(a, i, sizeof(a))
#define output(x)   cout << (x ? "YES" : "NO")<<endl;
using namespace std;
 
#define debug(vec) cout<<(#vec)<<" : [ "; for (auto& i: vec) cout<<i<<" "; cout<< "]" << endl
#define debugp(vec) cout<<(#vec)<<" : [ "; for (auto& i: vec) cout<<"("<<i.x<<","<<i.y<<")"<<" "; cout<< "]" << endl
#define trace(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args);cout << endl; }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cout << "[" << *it << ": " << a << "]\t";
    err(++it, args...);
}
 
// const int dx[4] = { -1, 1, 0, 0};
// const int dy[4] = {0, 0, -1, 1};
// int dX[] = { -1, -1, -1, 0, 0, 1, 1, 1 };
// int dY[] = { -1, 0, 1, -1, 1, -1, 0, 1 };
 
 
// Code from Here -------------------------------------------------------------------------------

bool check(int a, int b, int c){
	return (a+b>c && a+c>b && b+c>a);
}

signed main() {
	tezz
 
	// #ifndef ONLINE_JUDGE
	// 	freopen("input.txt", "r", stdin);
	// 	freopen("output.txt", "w", stdout);
	// #endif

	int n;
	cin >> n;
	int a[n];
	for(int i=0; i<n; i++){
		cin >> a[i];
	}
	sort(a, a+n);
	int c=0;
	for(int i=0; i<n; i++){
		for(int j=i+1; j<n; j++){
			if(a[i]==a[j])continue;
			for(int k=j+1; k<n; k++){
				if(a[j]==a[k] || a[k]==a[i])continue;
				if(check(a[i], a[j], a[k]))c++;
			}
		}
	}
	cout << c << endl;
 
	return 0;
}  

Measured memory_bytes: 3700
#include <iostream>
using namespace std;
 
int main(){
    int n, m, l;
    int a[100][100] = {};
    int b[100][100] = {};
    long int c[100][100] = {};
    cin >> n >> m >> l;
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            cin >> a[i][j];
        }
    }

    for(int i=0;i<m;i++){
        for(int j=0;j<l;j++){
            cin >> b[i][j];
        }
    }

    for(int i=0;i<n;i++){
        for(int j=0;j<l;j++){
            for(int k=0;k<m;k++){
                c[i][j] += a[i][k] * b[k][j];
            }
            cout << c[i][j];
            if(j<l-1) cout << " "; 
        }
        cout << endl;
    }
}


Measured memory_bytes: 3252
#include<stdio.h>
#define N 101
int main(){
  int total,i,j,a,b,A[N][N],c;
  scanf("%d",&total);
  for(i=0;i<total;++i){
    for(j=0;j<total;++j){
      A[i][j]=0;
    }
  }
  for(i=0;i<total;++i){
    scanf("%d%d",&a,&b);
    for(j=0;j<b;++j){
      scanf("%d",&c);
      A[a-1][c-1]=1;
    }
  }
  for(i=0;i<total;++i){
    for(j=0;j<total-1;j++){
      printf("%d ",A[i][j]);
          }
    printf("%d\n",A[i][j]);
      }
  return 0;
}



Measured memory_bytes: 2084
from collections import defaultdict
from collections import deque
from collections import Counter
import itertools
import math

def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()

n,w = readInts()
arr = [readInts() for i in range(n)]

dp = [[0]*10001 for i in range(n+1)]

for i in range(n):
	for j in range(10001):
		if j-arr[i][1]>=0:
			dp[i+1][j] = max(dp[i][j-arr[i][1]]+arr[i][0],dp[i][j])
		else:
			dp[i+1][j] = dp[i][j]

print(dp[n][w])


Measured memory_bytes: 42512
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();

      if(a%3==0||b%3==0||(a+b)%3==0){
            System.out.println("Possible");
      }else{
        System.out.println("Impossible");
      }






  }
}


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

typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;

int MOD=1e9+7;
ll INF=1e18;

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

int main(){
    int n; cin>>n;
    string s; cin>>s;
    int ans=0;
    for(int i=1; i<n; i++){
        vector<bool> cnt1(30, false), cnt2(30, false);
        for(int j=0; j<i; j++){
            cnt1[s[j]-'a']=true;
        }
        for(int j=i; j<n; j++){
            cnt2[s[j]-'a']=true;
        }

        int sum=0;
        for(int j=0; j<=25; j++){
            if(cnt1[j] && cnt2[j]){
                sum++;
            }
        }
        ans=max(ans, sum);
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
using pint = pair<int, int>;
using vi = vector<int>;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()

template<typename T> T gcd(T a, T b) { return b ? gcd(b, a%b) : a; }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template<class T> void corner(bool flg, T hoge) { if (flg) { cout << hoge << endl; exit(0); } }

const int MOD = 1000000007;

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

    int res = 0;
    if (A-B > C) {
        res = 0;
    }
    else {
        res = C - (A-B);
    }

    cout << res << endl;
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>

unsigned char dp[80][80][6401];

int main()
{
  int h, w;
  scanf("%d%d", &h, &w);
  int f[80][80];
  for (int i = 0; i < h; ++i)
  {
    for (int j = 0; j < w; ++j)
    {
      scanf("%d", f[i] + j);
    }
  }
  for (int i = 0; i < h; ++i)
  {
    for (int j = 0; j < w; ++j)
    {
      int a;
      scanf("%d", &a);
      f[i][j] -= a;
    }
  }
  dp[0][0][std::abs(f[0][0])] = 1;
  for (int i = 0; i < h; ++i)
  {
    for (int j = 0; j < w; ++j)
    {
      if (i == 0 && j == 0) continue;
      for (int k = 0; k <= 6400; ++k)
      {
        if (std::abs(k + f[i][j]) <= 6400)
        {
          if (i - 1 >= 0) dp[i][j][k] |= dp[i - 1][j][std::abs(k + f[i][j])];
          if (j - 1 >= 0) dp[i][j][k] |= dp[i][j - 1][std::abs(k + f[i][j])];
        }
        if (std::abs(k - f[i][j]) <= 6400)
        {
          if (i - 1 >= 0) dp[i][j][k] |= dp[i - 1][j][std::abs(k - f[i][j])];
          if (j - 1 >= 0) dp[i][j][k] |= dp[i][j - 1][std::abs(k - f[i][j])];
        }
      }
    }
  }
  for (int i = 0; i <= 6400; ++i)
  {
    if (dp[h - 1][w - 1][i] != 0)
    {
      printf("%d\n", i);
      return 0;
    }
  }
}

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

using namespace std;

#define MOD 1000000007
#define ll long long int
#define ld long double
#define pb push_back
#define mkp make_pair

int main()
{
	char str[] = "CODEFESTIVAL2016";
	char str2[30];
	cin >> str2;
	int x = 0;
	for (int i = 0; str2[i]; ++i) 
		if (str[i] != str2[i]) x++;
	cout << x << endl;

	return 0;
}

Measured memory_bytes: 384
import bisect
n=int(input())
L=[int(x) for x in input().split()]
L.sort()
ans=0

for i in range(n):
  for j in range(i+1,n):
    k=bisect.bisect_left(L, L[i]+L[j])-j-1
    ans+=k
    
    
print(ans)

Measured memory_bytes: 3188
/**
 *    author  : 𝒌𝒚𝒐𝒎𝒖𝒌𝒚𝒐𝒎𝒖𝒑𝒖𝒓𝒊𝒏
 *    created : 2020-01-23 18:38:24
**/

#include <iostream>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <complex>
#include <numeric>
#include <bitset>
#include <cassert>
#include <cctype>
#include <iomanip>
#include <random>
#include <utility>
#include <chrono>

using namespace std;

using int64 = long long;

template<class T> std::ostream& operator<<(std::ostream& os, const std::vector<T>& vec) { os << '{'; size_t n = vec.size(); for (size_t i = 0; i < n; ++i) { os << vec[i]; if (i != n - 1) os << ','; } os << '}'; return os; }
template<class T, class U> std::ostream& operator<<(std::ostream& os, const std::pair<T, U>& p) { return os << '{' << p.first << " " << p.second << '}'; }
template<class T> std::istream& operator>>(std::istream& is, std::vector<T>& vec) { size_t n = vec.size(); for (size_t i = 0; i < n; ++i) is >> vec[i]; return is; }

#ifdef LOCAL
#define debug(_) cerr << #_ << ": " << (_) << '\n'
#else
#define debug(_) 1728
#endif

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);

  int n; cin >> n;
  vector<int> h(n); cin >> h;

  if (n == 1) {
    cout << "Yes" << endl;
    return 0;
  }

  --h[0];

  for (int i = 1; i < n; ++i) {
    if (h[i] - 1 >= h[i - 1]) {
      --h[i];
    }
    if (h[i] < h[i - 1]) {
      cout << "No" << endl;
      return 0;
    }
  }

  cout << "Yes" << endl;

  return 0;
}

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

int main(){
  int n;
  cin >> n;
  vector<int> d(n);
  for (int i=0;i<n;i++){
    cin >> d.at(i);
  }
  sort(d.begin(), d.end());
  int prev = 0;
  int total = 0;
  for (int i:d){
    if (i > prev){
      total++;
      prev = i;
    }
  }
  cout << total << endl;
  return 0;
}



Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <valarray>
#include <vector>

#define EPS 1e-9
#define INF 1070000000LL
#define MOD 1000000007LL
#define fir first
#define foreach(it,X) for(auto it=(X).begin();it!=(X).end();it++)
#define ite iterator
#define mp make_pair
#define mt make_tuple
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define pb push_back
#define sec second
#define sz(x) ((int)(x).size())

using namespace std;

struct timer{
	time_t start;
	timer(){start=clock();}
	~timer(){cerr<<1.*(clock()-start)/CLOCKS_PER_SEC<<" secs"<<endl;}
};

typedef istringstream iss;
typedef long long ll;
typedef pair<ll,ll> pi;
typedef stringstream sst;
typedef vector<ll> vi;

string s,t;
int n,m,dp[4010][4010];

int main2(){
	cin.tie(0);
	ios_base::sync_with_stdio(0);
	
	if(!(cin>>s>>t))return 1;
	n=sz(s),m=sz(t);
	memset(dp,0,sizeof(dp));
	int ans=0;
	rep2(i,1,n+1)rep2(j,1,m+1){
		if(s[i-1]==t[j-1]){
			dp[i][j]=dp[i-1][j-1]+1;
			ans=max(ans,dp[i][j]);
		}else{
			dp[i][j]=0;
		}
	}
	cout<<ans<<endl;
	return 0;
}

int main(){
	while(!main2());
}

Measured memory_bytes: 64028
#include <stdio.h>

int main(void)
{
	int he, tai, hen, tyou = 0, hisi = 0;
	
	while (scanf("%d%*c%d%*c%d", &he, &hen, &tai) != EOF){
	
		if (hen == he) hisi++;
		else if (he * he + hen * hen == tai * tai) tyou++;
	}
	printf("%d\n%d\n", tyou, hisi);
	return (0);
}

Measured memory_bytes: 596
#include<iostream>
using namespace std;
int main()
{
    int a=0,b=0,c=0,t=0,n=10;
    while(n--)
    {
              cin>>t;
              if(t>c)
              {
                     if(t>b)
                     {
                            if(t>a)
                            {
                                   c=b;
                                   b=a;
                                   a=t;
                                   
                            }
                            else
                            {
                                c=b;
                                b=t;
                                }
                     }
				  else
				 {
					 c=t;
				  }
			  }
      }
              cout<<a<<endl<<b<<endl<<c<<endl;              
			  cin>>n;
   return 0;
    }

Measured memory_bytes: 0
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <map>

int main(){
    std::string s; std::cin >> s;
    int K; std::cin >> K;
    for (int i = 0; i < K; ++i) {
        if (s[i] != '1') {
            std::cout << s[i] - '0' << std::endl;
            return 0;
        }
    }
    std::cout << 1 << std::endl;
    return 0;
}

Measured memory_bytes: 3560
#![allow(unused_mut, unused_macros, unused_variables, unused_assignments, non_snake_case, unused_imports)]

use std::cmp::*;
use std::collections::*;

// [Rustで競技プログラミングの入力をスッキリ記述するマクロ - Qiita]
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8 から拝借
macro_rules! input {
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};
    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };
    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };
    // ABC128-C-Switches用に拡張
    ($next:expr, [ $t:tt ]) => {{
        let len = read_value!($next, $t);
        (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    }};
    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };
    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };
    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        N : usize,
        K : usize,
        S : chars
    }
    let count = {
        let mut count = if S[0] == '1' {vec!(1usize)} else {vec!(0usize, 1usize)};
        for n in 1..N {
            if S[n - 1] == S[n] {
                let c = count.pop().unwrap();
                count.push(c + 1);
            } else {
                count.push(1);
            }
        }
        if *S.last().unwrap() == '0' {count.push(0);}
        count
    };
    //println!("{:?}", count);

    let (mut l, mut r) = (0usize, K * 2);
    if count.len() <= r {
        // 全部合算
        println!("{}", count.iter().fold(0, |sum, x| sum + x));
        return;
    }

    let mut counts = vec!(count[l..r + 1].iter().fold(0, |sum, x| sum + x));
    loop {
        r += 2;
        if r < count.len() {
            //println!("{}, {}", l, r);
            //println!("{:?}", counts);
            let mut temp_count = *counts.last().unwrap();
            temp_count -= count[l] + count[l + 1];
            l += 2;
            temp_count += count[r - 1] + count[r];
            counts.push(temp_count);
        } else {break;}
    }
    //println!("{:?}", counts);
    println!("{}", counts.iter().max_by(|a, b| a.partial_cmp(b).unwrap()).unwrap());
}


Measured memory_bytes: 6396
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#include <cmath>
#define N 200005
#define pii pair<int, int>
using namespace std;
const long double pi = acos(-1);

int x, y, xx, yy, n, posx, posy, f[N];
pii p[N];

int main() {
    cin >> x >> y >> xx >> yy;
    cin >> n, posx = posy = 1;

    if (x > xx) posx = -1;
    if (y > yy) posy = -1;

    x *= posx, xx *= posx;
    y *= posy, yy *= posy;

    for (int i = 1, a, b; i <= n; ++i) {
        scanf("%d%d", &a, &b);
        a *= posx, b *= posy;
        if (a < x || a > xx || b < y || b > yy)
            --n, --i;
        else p[i] = make_pair(a, b);
    }

    sort(p + 1, p + n + 1);

    memset(f, 0x3f, sizeof f);
    for (int i = 1; i <= n; ++i)
        f[lower_bound(f + 1, f + n + 1, p[i].second) - f] = p[i].second;

    int lis = n; while (lis >= 1 && f[lis] == 0x3f3f3f3f) --lis;

    long double ans = ((xx - x) + (yy - y)) * 100.0;
    ans += (pi * 5.0 - 20) * lis;

    if (lis == min(xx - x, yy - y) + 1) ans += pi * 5.0;

    printf("%.46Lf\n", ans);

    return 0;
}


Measured memory_bytes: 2560
#include<stdio.h>

int main(){
  int i, j, n, t, e, x, y, ans;

  scanf("%d %d %d", &n, &t, &e);
  for(i=0, ans=-1; i<n; i++){
    scanf("%d", &x); 
    if(ans != -1) continue;

    for(j=x; j<=t+e; j+=x){
      if(j >= t-e && j <= t+e){
	ans = i+1;
	break;
      }
    }
  }
  printf("%d\n", ans);
  return 0;
}

Measured memory_bytes: 596
using System;
using System.Linq;
public class Hello{
    public static void Main(){
        int n = int.Parse(Console.ReadLine());
        string a = Console.ReadLine();
        string b = Console.ReadLine();
        string c = Console.ReadLine();
        int ans = 0;
        for (int i = 0;i<n;i++){
            char ai = a[i]; char bi=b[i];char ci = c[i];
            if (ai!=bi){
                if (ai==ci | bi==ci){
                    ans += 1;
                }
                else{
                    ans += 2;
                }
            }
            else if (ai!=ci){
                    ans += 1;
                }
        }


        Console.Write(ans);
    }
}


Measured memory_bytes: 11092
#include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include <cassert>
#include <cmath>
#include<cstdint>

#define INF 1e9
#define rep(i,n)for(int i=0;(i)<(int)(n);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define vec(type,n) vector<type>(n)
#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
#define ALL(a)  (a).begin(),(a).end()

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<int,int>;

vector<int>bitSearch(int bit,int n){
    vector<int>S;
    rep(i,n)if(bit&(1<<i))S.push_back(i);
    return S;
}



int main(){
   int n;cin>>n;
   VEC(int,a,n);
   int res = INF;
   rep(i,n){
       int cnt = 0;
       while(a[i]%2==0){
           a[i] /= 2;
           cnt++;
       }
       res = min(res,cnt);
   }
   cout<<res;
}



Measured memory_bytes: 256
#include<stdio.h>
int main(void){
  int A[100];
  int i,j,N,key,C;
  C=0;

  scanf("%d",&N);
  for(i=0;i<N;i++){
    scanf("%d",&A[i]);
  }

  for(i=0;i<N;i++){
    for(j=N-1;j>i;j--){
      key=A[j];
      if(A[j]<A[j-1]){
        A[j]=A[j-1];
        A[j-1]=key;
        C++;
      }
    }
  }

  for(i=0;i<N;i++){
      if(i!=0)printf(" ");
      printf("%d",A[i]);
    }
  printf("\n");
  printf("%d\n",C);

  return 0;
}

Measured memory_bytes: 0
#line 1 "GRL_1_B.test.cpp"
#define PROBLEM "http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_1_B"

#include <bits/stdc++.h>  // clang-format off
using Int = long long;
#define REP_(i, a_, b_, a, b, ...) for (Int i = (a), lim##i = (b); i < lim##i; i++)
#define REP(i, ...) REP_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
struct SetupIO { SetupIO() { std::cin.tie(nullptr), std::ios::sync_with_stdio(false), std::cout << std::fixed << std::setprecision(13); } } setup_io;
#ifndef dump
#define dump(...)
#endif  // clang-format on

/**
 *    author:  knshnb
 *    created: Tue Apr 28 00:15:10 JST 2020
 **/

#define CALL_FROM_TEST
#line 1 "/Users/knshnb/competitive_programming/competitive_library/src/Graph/BellmanFord.hpp"
// O(EV)、負のサイクルを通った後に到達できる点については-INF, 到達不可能な点についてはINFを返す
template <class T> struct BellmanFord {
    struct Edge {
        int from, to;
        T cost;
    };
    const T INF = std::numeric_limits<T>::max() / 2;
    int n;
    std::vector<Edge> edges;

    BellmanFord(int n_) : n(n_) {}
    void add_edge(int u, int v, T cost) { edges.push_back({u, v, cost}); }
    std::vector<T> run(int s) {
        std::vector<T> dist(n, INF);
        dist[s] = 0;
        for (int i = 0; i < n - 1; i++) {
            for (Edge& e : edges) {
                if (dist[e.from] == INF) continue;
                dist[e.to] = std::min(dist[e.to], dist[e.from] + e.cost);
            }
        }
        for (Edge& e : edges) {
            // sから到達できる負のサイクル検出
            if (dist[e.to] < INF && dist[e.from] + e.cost < dist[e.to]) {
                dist[e.from] = -INF;
                dist[e.to] = -INF;
            }
        }
        for (int i = 0; i < n - 1; i++) {
            for (Edge& e : edges) {
                if (dist[e.from] == -INF) dist[e.to] = -INF;
            }
        }
        return dist;
    }
};
#line 19 "GRL_1_B.test.cpp"
#undef CALL_FROM_TEST

signed main() {
    int n, m, s;
    std::cin >> n >> m >> s;
    BellmanFord<Int> bf(n);
    REP(_, m) {
        Int u, v, c;
        std::cin >> u >> v >> c;
        bf.add_edge(u, v, c);
    }
    auto dist = bf.run(s);
    if (std::find(dist.begin(), dist.end(), -bf.INF) != dist.end()) {
        std::cout << "NEGATIVE CYCLE" << std::endl;
    } else {
        for (Int d : dist) {
            if (d == bf.INF) {
                std::cout << "INF" << "\n";
            } else {
                std::cout << d << "\n";
            }
        }
    }
}



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

int N, w[101], v[101], W;
long long dp[101][100003];

long long rec(int pos, int curW) {
	if(pos == N) {
		return 0;
	}
	if(dp[pos][curW]!=-1) {
		return dp[pos][curW];
	}
	long long ans = rec(pos + 1, curW);
	if(w[pos] + curW <= W) {
		ans = max(ans, rec(pos + 1, w[pos] + curW) + v[pos]);
	}
	dp[pos][curW] = ans;
	return ans;
}

int main() {
	scanf("%d %d", &N, &W);
	for(int i=0; i < N; ++i) {
		scanf("%d %d",&w[i], &v[i]);
	}
	memset(dp, -1, sizeof(dp));
	printf("%lld", rec(0, 0));
	return 0;
}

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

int main() {
	int N, tmp1 = 0, tmp2 = 0;
	string S;
	cin >> N >> S;
	stack<char> tmp3;
	for (char& i : S) {
		if (i == '(') tmp3.push('(');
		else {
			if (tmp3.empty()) tmp3.push(')');
			else {
				if (tmp3.top() == '(') tmp3.pop();
				else tmp3.push(')');
			}
		}
	}
	while (!tmp3.empty()) {
		if (tmp3.top() == '(') ++tmp1;
		else ++tmp2;
		tmp3.pop();
	}
	for (int i = 0; i < tmp2; ++i) cout << '(';
	cout << S;
	for (int i = 0; i < tmp1; ++i) cout << ')';
}

Measured memory_bytes: 256
#include <iostream>
#include <stdlib.h>

using namespace std;
int main(){
  int N;
  int count=0;
  std::cin >> N;
  int A[N];
  for(int i=0;i<N;i++){
    std::cin >> A[i];
  }
  bool flag=true;
  while(flag){
    flag=false;
    for(int i=N-1;i>=1;i--){
      if(A[i]<A[i-1]){
        count++;
        flag=true;
        int tmp=A[i];
        A[i]=A[i-1];
        A[i-1]=tmp;
      }
    }
  }
  for(int i=0;i<N-1;i++){
    std::cout << A[i]<<" " ;
  }
  std::cout << A[N-1] << '\n';

  std::cout << count << '\n';


}



Measured memory_bytes: 3088
class DisjointSetElement():
    def __init__(self, x):
        self.parent = x
        self.rank = 0


class DisjointSet():
    def __init__(self, n):
        self.elems = [DisjointSetElement(n) for n in range(n)]

    def _find_set(self, x):
        if x != self.elems[x].parent:
            self.elems[x].parent = self._find_set(self.elems[x].parent)
        return self.elems[x].parent

    def same(self, x, y):
        return self._find_set(x) == self._find_set(y)

    def _link(self, x, y):
        if self.elems[x].rank > self.elems[y].rank:
            self.elems[y].parent = x
        else:
            self.elems[x].parent = y
            if self.elems[x].rank == self.elems[y].rank:
                self.elems[y].rank += 1

    def unite(self, x, y):
        self._link(self._find_set(x), self._find_set(y))

    def is_alone(self, x):
        return x == self.elems[x].parent


def read_inputs():
    nv, ne = [int(x) for x in input().split()]

    E = []
    for _ in range(ne):
        s, t, w = [int(x) for x in input().split()]
        E.append((w, s, t))

    return nv, E


def min_sp_tree(nv, E):
    K = DisjointSet(nv)
    total = 0
    n = 0

    i = iter(E)
    while n < nv - 1:
        w, s, t = next(i)
        if not K.same(s, t):
            K.unite(s, t)
            total += w
            n += 1

    return total


def main():
    nv, E = read_inputs()
    E.sort()
    print(min_sp_tree(nv, E))


if __name__ == '__main__':
    main()



Measured memory_bytes: 24772