akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<queue>
#include<stack>
#include<map>
#include<string>
#include<algorithm>
#include<utility>
#include<math.h>

using namespace std;
typedef pair<int, int> P;
typedef long long int ll;

const int INF = 1<<30;

int main(){
  int n;cin>>n;
  vector<int> a(n), b(n);
  for(auto &e: a)cin>>e;
  for(auto &e: b)cin>>e;
  ll na=0, nb=0;
  for(int i=0;i<n;i++){
    ll d = b[i]-a[i];
    if(d<0)nb+=-d;
    else if(d>0){
      if(d&1){
        nb++;na+=(d+1)/2;
      }else{
        na+=(d+1)/2;
      }
    }
  }
  // cout<<na<<" "<<nb<<endl;
  cout<<(na>=nb?"Yes":"No")<<endl;
}


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

int main()
{
    int i,j,k,cnt_1 = 0,cnt_2 = 0,len,ans;
    char c[113];
    cin>>c;
    len = strlen(c);
    if(len%2!=0)
    {
        j = (len/2) + 1;
        k = len - j;
        for(i=0; i<len; i++)
        {
            if(i%2==0)
            {
                if(c[i]=='R' || c[i]=='U' || c[i]=='D')
                {
                    cnt_1++;
                }
            }
            else if(i%2!=0)
            {
                if(c[i]=='L' || c[i]=='U' || c[i]=='D')
                {
                    cnt_2++;
                }
            }
        }
        if(cnt_1==j && cnt_2==k)
        {
            cout<<"Yes"<<endl;
        }
        else
        {
            cout<<"No"<<endl;
        }
    }
    else if(len%2==0)
    {
        j = len/2;
        for(i=0; i<len; i++)
        {
            if(i%2==0)
            {
                if(c[i]=='R' || c[i]=='U' || c[i]=='D')
                {
                    cnt_1++;
                }
            }
            else if(i%2!=0)
            {
                if(c[i]=='L' || c[i]=='U' || c[i]=='D')
                {
                    cnt_2++;
                }
            }
        }
        if(cnt_1==j && cnt_2==j)
        {
            cout<<"Yes"<<endl;
        }
        else
        {
            cout<<"No"<<endl;
        }
    }

    return 0;
}


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

using namespace std;

int main()
{
    int x1, x2, y1, y2;
    cin >> x1 >> x2 >> y1 >> y2;
    int x = x1 + x2;
    int y = y1 + y2;
    if (x > y)
        cout << "Left";
    else if (x < y)
        cout << "Right";
    else 
        cout << "Balanced";
    return 0;
}

Measured memory_bytes: 3632
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int n1 = n%10;
		if(n1==2 || n1==4 || n1==5 || n1==7 || n1==9 ){
			System.out.println("hon");
		}else if(n1==0 || n1==1 || n1==6 || n1==8) {
			System.out.println("pon");
		}else {
			System.out.println("bon");
		}
		sc.close();
	}
}


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

#define SIGN_LENGTH 9
#define CIPHER_NUM 32
#define NUL 0x00

typedef struct cipher
{
	char charcter_change_sign[SIGN_LENGTH];
	char sign_change_charcter[SIGN_LENGTH];
	char charcter;
}CIPHER;

#define TEXT_MAX 100

int main(void)
{
	short i = 0;
	short j = 0;

	short text_length = 0;
	char input_text[TEXT_MAX];
	CIPHER code[CIPHER_NUM] = {
		{"100101","00000",'A'},
		{"10011010","00001",'B'},
		{"0101","00010",'C'},
		{"0001","00011",'D'},
		{"110","00100",'E'},
		{"01001","00101",'F'},
		{"10011011","00110",'G'},
		{"010000","00111",'H'},
		{"0111","01000",'I'},
		{"10011000","01001",'J'},
		{"0110","01010",'K'},
		{"00100","01011",'L'},
		{"10011001","01100",'M'},
		{"10011110","01101",'N'},
		{"00101","01110",'O'},
		{"111","01111",'P'},
		{"10011111","10000",'Q'},
		{"1000","10001",'R'},
		{"00110","10010",'S'},
		{"00111","10011",'T'},
		{"10011100","10100",'U'},
		{"10011101","10101",'V'},
		{"000010","10110",'W'},
		{"10010010","10111",'X'},
		{"10010011","11000",'Y'},
		{"10010000","11001",'Z'},
		{"101","11010",' '},
		{"010001","11011",'.'},
		{"000011","11100",','},
		{"10010001","11101",'-'},
		{"000000","11110",'\''},
		{"000001","11111",'?'}
	};
	
	char barcode[801];
	char code_fivecut[160][5];
	
	for(i = 0; i < TEXT_MAX; i++)
	{
		input_text[i] = NUL;
	}

	for(i = 0; i < 801; i++)
	{
		barcode[i] = NUL;
	}
	
	for(i = 0; i < 160;i++)
	{
		for(j = 0; j < 5; j++)
		{
			code_fivecut[i][j] = '0';
		}
	}
	
	while(gets(input_text) != NULL)
	{
		for(i = 0; i < TEXT_MAX; i++)
		{
			text_length++;
			if(input_text[i] == NUL)
			{
				break;
			}
		}
		
		for(i = 0; i < text_length; i++)
		{
			for(j = 0; j < CIPHER_NUM; j++)
			{
				if(input_text[i] == code[j].charcter)
				{
					strcat(barcode, code[j].charcter_change_sign);
				}
			}
		}
		
		int barcode_length = 0;
		
		for(i = 0; i < 801; i++)
		{
			barcode_length++;
			if( barcode[barcode_length] == '\0')
			{
				break;
			}
		}
		int c = 0;
		
		for(i = 0; i < barcode_length; i++)
		{
			for(j = 0; j < 5; j++)
			{
				if(c < barcode_length)
				{
					code_fivecut[i][j] =  barcode[c];
					c++;
				}
			}
		}
		int count=0;
		for(i = 0;i < 800 ; i+= 5)
		{
			if(barcode_length <= i)
			{
				count = i / 5;
				break;
			}
		}
		
		int k = 0;
		int cc = 0;
		for(i = 0; i < count; i++)
		{
			for(j = 0; j < CIPHER_NUM; j++)
			{
				for(k = 0; k < 5; k++)
				{
					if(code_fivecut[i][k] == code[j].sign_change_charcter[k])
					{
						cc++;
					}
				}
				if(cc == 5)
				{
					printf("%c",code[j].charcter);
				}
				cc = 0;
			}
		}
		printf("\n");
		count = 0;
		barcode_length = 0;
		text_length = 0;
		for(i = 0; i < TEXT_MAX; i++)
		{
			input_text[i] = NUL;
		}
		for(i = 0; i < 801; i++)
		{
			barcode[i] = NUL;
		}
		
		for(i = 0; i < 160;i++)
		{
			for(j = 0; j < 5; j++)
			{
				code_fivecut[i][j] = '0';
			}
		}
	}
	return 0;
}

Measured memory_bytes: 524
import java.util.Scanner;

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

    public static void solve(Scanner sc) {
        char[] a = sc.next().toCharArray();
        if (a[0] == a[1] || a[1] == a[2] || a[2] == a[0]) {
            System.out.println("No");
        } else {
            System.out.println("Yes");
        }
    }
}

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

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

    string s;
    cin >> s;

    int a = s[0] - '0', b = s[1] - '0', c = s[2] - '0', d = s[3] - '0';

    if(a-b-c-d==7) printf("%d-%d-%d-%d=7\n", a, b, c, d);
    else if(a-b-c+d==7) printf("%d-%d-%d+%d=7\n", a, b, c, d);
    else if(a-b+c+d==7) printf("%d-%d+%d+%d=7\n", a, b, c, d);
    else if(a-b+c-d==7) printf("%d-%d+%d-%d=7\n", a, b, c, d);
    else if(a+b-c-d==7) printf("%d+%d-%d-%d=7\n", a, b, c, d);
    else if(a+b-c+d==7) printf("%d+%d-%d+%d=7\n", a, b, c, d);
    else if(a+b+c-d==7) printf("%d+%d+%d-%d=7\n", a, b, c, d);
    else if(a+b+c+d==7) printf("%d+%d+%d+%d=7\n", a, b, c, d);
}


Measured memory_bytes: 3692
from sys import stdin
def main():
    #入力
    readline=stdin.readline
    N,M=map(int,readline().split())
    x=[0]*M
    y=[0]*M
    for i in range(M):
        a,b=map(int,readline().split())
        x[i]=a
        y[i]=b

    li=[[1,0] for _ in range(N+1)]
    li[1][1]=1
    for i in range(M):
        if li[x[i]][0]>=2 and li[x[i]][1]==1:
            li[y[i]][0]+=1
            li[y[i]][1]=1

            li[x[i]][0]-=1

        elif li[x[i]][0]==1 and li[x[i]][1]==1:
            li[y[i]][0]+=1
            li[y[i]][1]=1

            li[x[i]][0]-=1
            li[x[i]][1]=0

        else:
            li[y[i]][0]+=1

            li[x[i]][0]-=1
            
    count=0
    for i in range(1,N+1):
        if li[i][1]==1: count+=1
    print(count)
if __name__=="__main__":
    main()

Measured memory_bytes: 21108
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstring>
#include<iostream>
using namespace std;

int digitsum(int n)
{
	int sum=0;
	while(n)
	{
		sum+=n%10;
		n=n/10;
	}
	return sum;
}
int main()
{
	int n,a,b;
	int sum;
	scanf("%d %d %d",&n,&a,&b);
	sum=0;
	for(int i=1;i<=n;i++)
	{
		if(digitsum(i)>=a&&digitsum(i)<=b)
		{
			sum+=i;
		}
	}
	printf("%d\n",sum);
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
using namespace std;
int n;
int main()
{
	scanf("%d",&n);
	if(n<10) printf("%d",n);
	else if(n>=10 && n<100) printf("9");
	else if(n>=100 && n<1000) printf("%d",n-90);
	else if(n>=1000 && n<10000) printf("909");
	else if(n>=10000 && n<100000) printf("%d",n-90-9000);
	else printf("90909");
	return 0;
}

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

using namespace std;

#define CIN ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
#define TEST_CASE(t) for(int zz=1 ; zz<=t ; zz++)
#define PRINT_CASE printf("Case %d: ",zz)
#define Debug(x)            cout<<#x " = "<<(x)<<endl

const int maxn = (int)3e5+5;
typedef long long ll;


void solve(){

   int n;
   cin >> n;
   int a[n+1], ans = 0;
   for(int i=1 ; i<=n; i++){
      cin >> a[i];
      ans ^=a[i];
   }

   for(int i=1 ; i<=n ; i++){
      a[i] = ans^a[i];
   }
   cout << a[1];
   for(int i=2 ; i<=n ; i++) cout << " " << a[i];
   cout << endl;
}

int main()
{
    CIN
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    //cout << "Fi Amanillah" << endl;

    int t=1;
    // cin >> t;

    while(t--){
         solve();
    }
    return 0;
}


Measured memory_bytes: 4408
#include <iostream>
#include <iomanip>
#include <stdio.h>
#include <set>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#include <memory.h>
#include <string>
#include <sstream>
#include <cstdlib>
#include <ctime>
#include <cassert>

using namespace std;

typedef long long LL;
typedef pair<int,int> PII;

#define MP make_pair
#define PB push_back
#define FF first
#define SS second

#define FORN(i, n) for (int i = 0; i <  (int)(n); i++)
#define FOR1(i, n) for (int i = 1; i <= (int)(n); i++)
#define FORD(i, n) for (int i = (int)(n) - 1; i >= 0; i--)

#define DEBUG(X) { cout << #X << " = " << (X) << endl; }
#define PR0(A,n) { cout << #A << " = "; FORN(_,n) cout << A[_] << ' '; cout << endl; }

#define MOD 1000000007
#define INF 2000000000

int GLL(LL& x) {
    return scanf("%lld", &x);
}

int GI(int& x) {
    return scanf("%d", &x);
}

LL n, s;

vector<LL> divs;

LL f(LL b, LL n) {
    if (n < b) return n;
    else return (n % b) + f(b, n/b);
}

int main() {
    GLL(n); GLL(s); LL diff = llabs(n - s);

    if (diff == 0) {
        cout << n+1 << "\n";
        return 0;
    }

    for (LL d = 1; d * d <= diff; d++) {
        if (diff % d == 0) {
            divs.PB(d);
            divs.PB(diff / d);
        }
    }

    sort(divs.begin(), divs.end());

    for (auto d : divs) {
        LL b = d + 1;

        if (f(b, n) == s) {
            cout << b << "\n";
            return 0;
        }
    }

    cout << -1 << "\n";
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <queue>
#include <sstream>
#include <stack>
#include <time.h>
#include <vector>
#include <complex>
#include <map>
#include <set>
#include <iomanip>
#include <math.h>
#include <stdlib.h>
#include <list>
#include <utility>
#include <memory>
#include <cstring>
#include <fstream>
#include <numeric>
#include <assert.h>
#include <bits/stdc++.h>
using namespace std;
int N,h[100004],c[100004],K;
int main(){
	cin>>N>>K;
	for (int i=0;i<N;i++) c[i]=1e9;
	for (int i=0;i<N;i++) cin>>h[i];
	c[0]=0;
	for (int i=1;i<N;i++)
		for (int j=i-K;j<=i-1;j++) if (j>=0) c[i]=min(c[i],c[j]+abs(h[i]-h[j]));
	cout<<c[N-1];
}

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

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod= int(1e9)+7;
using P = pair<ll,ll>;
using ld=long double;

int main(){
    ll n;cin >>n;
    string s;cin >>s;
    if(n%2==1){
        puts("No");
    }
    else {
        string a=s.substr(0,n/2);
        string b=s.substr(n/2,n/2);
        if(a==b){
            puts("Yes");
        }
        else puts("No");
//        cout <<a<<" "<<b<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
#define check cout<<"?"<<endl;

ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

ll d;
vector<ll> c(26,0),last(26,-1);
vector<vector<ll>> s;

ll score(vector<ll> &t){
    ll ans=0;
    rep(i,d){
        ans+=s[i][t[i]];
        last[t[i]]=i;
        rep(j,26) ans-=c[j]*(i-last[j]);
        //cout<<ans<<endl;
    }
    return ans;
}

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

    scanf("%lld",&d);
    vector<set<ll>> st(26);
    rep(i,26){
        st[i].insert(-1);
        st[i].insert(d);
    }
    vector<ll> t(d,0);
    rep(i,d){
        t[i]=i%26;
    }
    rep(i,26) scanf("%lld",&c[i]);
    s.assign(d,vector<ll>(26,0));
    rep(i,d)rep(j,26){
        scanf("%lld",&s[i][j]);
    }
    /*
    rep(i,d){
        scanf("%d",&t[i]);
        t[i]--;
        st[t[i]].insert(i);
    }
    */
    ll ans=score(t);
    //printf("%lld\n",ans);
    //cout<<ans<<endl;
    
    ll m=1e7+1e5; //scanf("%d",&m);
    ll p,di=0,q=0,ddi=17,dq=17,pans;
    rep(i,m){
        if(t[di]==q) q=(q+1)%26;
        pans=ans;
         //scanf("%d",&di); scanf("%d",&q);
        //di--; q--;
        p=t[di];
        ans+=s[di][q]-s[di][p];
        ll dd=*st[p].upper_bound(di)-di;
        ll du=di-*(--st[p].lower_bound(di));
        ans-=du*dd*c[p];
        dd=*st[q].upper_bound(di)-di;
        du=di-*(--st[q].upper_bound(di));
        ans+=du*dd*c[q];
        di=(di+ddi)%d;
        q=(q+dq)%26;
        if(pans<ans){
            st[p].erase(di);
            st[q].insert(di);
            t[di]=q;
        }
        else ans=pans;
    }
    rep(i,d) printf("%lld\n",t[i]+1);
    //printf("%lld\n",ans);
}


Measured memory_bytes: 3976
s=list(input())
c0=0
c1=0
for i in range(1,len(s)):
    if s[i]==s[i-1] and s[i]=='1':
        s[i]='0'
        c0+=1
    elif s[i]==s[i-1] and s[i]=='0':
        s[i]='1'
        c0+=1
print(c0)

Measured memory_bytes: 3956
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define maxN 101
#define WHITE 0
#define GRAY 1
#define BLACK 2

int G[maxN][maxN];
int d[maxN];
int f[maxN];
int color[maxN];
int time;
int n;

void init(void)
{
    for (int u = 1; u < maxN; u++)
    {
        d[u] = -1;
        f[u] = -1;
        color[u] = WHITE;
        for (int v = 1; v < maxN; v++)
        {
            G[u][v] = 0;
        }
    }
}

void traverse(int v)
{
    color[v] = GRAY;
    time += 1;
    d[v] = time;
    for (int u = 1; u <= n; u++)
    {
        if (G[v][u] == 0)
        {
            continue;
        }
        if (color[u] == WHITE)
        {
            traverse(u);
        }
    }
    color[v] = BLACK;
    time += 1;
    f[v] = time;
}

void DFS(void)
{
    time = 0;
    for (int u = 1; u <= n; u++)
    {
        if (color[u] == WHITE)
        {
            traverse(u);
        }
    }
}


int main(void)
{
    int i, j;
    int u, k, v;

    init();

    scanf("%d", &n);
    for (i = 1; i <= n; i++)
    {
        scanf("%d %d", &u, &k);
        for (j = 1; j <= k; j++)
        {
            scanf("%d", &v);
            G[u][v] = 1;
        }
    }
    
    DFS();

    for (u = 1; u <= n; u++)
    {
        // for (int i = 1; i <= n; i++)
        // {
        //     printf("%d ", G[u][i]);
        // }
        // printf("\n");
        printf("%d %d %d\n", u, d[u], f[u]);
    }

    return 0;
}


Measured memory_bytes: 2084
#include<stdio.h>
 
int main(void)
{
    int A,B,C;
  	int i=0;
    // 整数の入力
    scanf("%d %d %d\n",&A,&B,&C);
  	if(A==B && B!=C)
      printf("Yes\n");
  	else if(A==C && B!=C)
      printf("Yes\n");
  	else if(B==C && A!=C)
      printf("Yes\n");
  	else
      printf("No\n");
    return 0;
}

Measured memory_bytes: 128
# -*- coding: utf-8 -*-
# スペース区切りの整数の入力
even, odd = map(int, input().split())

even_r = 0
odd_r = 0

for i in range(even):
  for j in range(even - i - 1):
    even_r += 1
  
for i in range(odd):
  for j in range(odd - i - 1):
  	odd_r += 1

total = even_r + odd_r

print(total)

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

using namespace std;
using ll = long long;

int main()
{
    int n, val = 0;
    cin >> n;
    unordered_map<string, int> m;
    for (int i = 0; i < n; i++)
    {
        string s;
        cin >> s;
        m[s]++;
        val = max(val, m[s]);
    }
    vector<string> ans;
    for (auto a : m)
    {
        if (a.second == val)
        {
            ans.push_back(a.first);
        }
    }
    sort(ans.begin(), ans.end());
    for (string a : ans)
    {
        cout << a << '\n';
    }
    return 0;
}


Measured memory_bytes: 26976
#include<iostream>
#include<sstream>
#include<vector>
#include<string>
#include<algorithm>
#include<stdlib.h>
using namespace std;

int main(){
  long long A,B;
  cin>>A>>B;
  if(A%2!=B%2){
    cout<<"IMPOSSIBLE"<<endl;
    return 0;
  }
  int flag=0;
  for(long long i=0; i<max(A,B);i++){
      if(abs(A-i)==abs(B-i)){
        cout<<i<<endl;
        flag++;
        break;
      }
  }
  if(flag==0) cout<<"IMPOSSIBLE"<<endl;
  return 0;
}



Measured memory_bytes: 256
import sys
input = sys.stdin.readline

N = int(input())
a = list(map(int, list(input()[:-1])))
a = list(map(lambda x: x-1, a))
p = [0]*N

for i in range(1, N):
    t = i
    
    while t%2==0:
        t //= 2
        p[i] += 1

for i in range(1, N):
    p[i] += p[i-1]

X = 0

for i in range(N):
    if a[i]==1 and p[N-1-i]+p[i]==p[N-1]:
        X += 1

if X%2==1:
    print(1)
else:
    if 1 in a:
        print(0)
    else:
        b = [ai//2 for ai in a]
        X = 0
        
        for i in range(N):
            if b[i]==1 and p[N-1-i]+p[i]==p[N-1]:
                X += 1
        
        print(2*(X%2))

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

int g[15][15];

int main() {
  int n;
  cin >> n;
  rep(i,n)rep(j,n) g[i][j] = -1;
  rep(i,n) {
    int m;
    cin>>m;
    rep(j,m){
      int a, x;
      cin>>a>>x;
      --a;
      g[i][a] =x;
    }
  }
  int ans = 0;
  rep(i,1<<n) {
    vector<int> d(n);
    rep(j,n) if (i>>j&1) {
      d[j] = 1;
    }
    bool ok = true;
    rep(j,n) {
      if(d[j]) {
        rep(k,n) {
          if (g[j][k] == -1) continue;
          if (g[j][k] != d[k]) ok = false;
        }
      }
    }
    if (ok) ans = max(ans, __builtin_popcount(i));
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define pi pair<int,int>
#define ff firs
#define ss second
#define boost ios::sync_with_stdio(false);cin.tie(nullptr)
#include "string"
#define int long long

int32_t main() { 
	boost;
   int n;
   cin>>n;
   int a[n+1],b[n+1];
   for(int i=1;i<=n;i++)
      cin>>a[i]>>b[i];
   sort(a+1,a+n+1);
   sort(b+1,b+n+1);
   if(n%2==1){
      int id = (n+1)/2;
      cout<<b[id]-a[id]+1<<endl;
   }
   else{
      int id = n/2;
      int ans = (b[id+1]+b[id])-(a[id+1]+a[id]);
      cout<<ans+1<<endl;
   }
}


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

using namespace std;


int main() {
    int x;
    cin >> x;
    int ans;
    if(x < 2000) {
        ans = 1;
    }
    if(x < 1800) {
        ans = 2;
    }
    if(x < 1600) {
        ans = 3;
    }
    if(x < 1400) {
        ans = 4;
    }
    if(x < 1200) {
        ans = 5;
    }
    if(x < 1000) {
        ans = 6;
    }
    if(x < 800) {
        ans = 7;
    }
    if(x < 600) {
        ans = 8;
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 3588
# import sys
# input = sys.stdin.readline

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


n = int(input())
mod = int(1e9+7)
a = pow(10,n,mod)
b = pow(8,n,mod)
c = (pow(9,n,mod)-b)*2
print((a-b-c)%mod)



Measured memory_bytes: 81436
#include<cstdio>
#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;

vector<long long>res, num;
int n, tmp;
long long comb(long long a, long long b){
    long long tb = b;
    while(tb){
	a *= 10;
	tb /= 10;
    }
    return a + b;
}

int main(){
    cin >> n;
    for(int i = 0;i < n;i++){
	cin >> tmp;
	num.push_back(tmp);
    }
    for(int i = n;i < 4;i++){
	num.push_back(999999);
    }
    sort(num.begin(), num.end());
    for(int i = 0;i < 4;i++){
	for(int j = 0;j < 4;j++){
	    if(i == j)continue;
	    res.push_back(comb(num[i], num[j]));
	}
    }
    sort(res.begin(), res.end());
    cout << res[2] << endl;
    return 0;
}

Measured memory_bytes: 1340
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val n = sc.nextInt()
    val k = sc.nextInt()
    val a = (0 until n).map { sc.next().toLong() }
    println(problem2020c(n, k, a))
}

fun problem2020c(n: Int, k: Int, a: List<Long>): String {
    val s = Array<Boolean>(n + 1) { false }
    for (i in 0 until n) {
        if (i < k) {
            continue
        } else {
            s[i] = a[i - k] < a[i]
        }
    }
    val ans = mutableListOf<String>()
    for (i in k until s.size - 1) {
        if (s[i]) ans.add("Yes") else ans.add("No")
    }
    return ans.joinToString("\n")
}

Measured memory_bytes: 67824
h, w = map(int, input().split())
s = [0] * h
for i in range(h):
    s[i] = str(input())
t = [[0]*w]*h

if h == 1 and w == 1:
    if s[0][0] == '#':
        v = '#'
    else:
        v = 0
    t[0][0] = str(v)
    print(''.join(t[0]))
    
elif h ==1 and w !=1:
    for k in range(w):
        if k == 0:
            u = s[0][1]
        elif k == w-1:
            u = s[0][k-1]
        else:
            u = s[0][k-1] +s[0][k+1]
        v = u.count('#')
        if s[0][k] == '#':
            v = '#'
        t[0][k] = str(v)
    print(''.join(t[0]))

elif h !=1 and w == 1:
    for j in range(h):
        if j == 0:
            u = s[1][0]
        elif j == h-1:
            u = s[j-1][0]
        else:
            u = s[j-1][0] + s[j+1][0]
        v = u.count('#')
        if s[j][0] == '#':
            v = '#'
        t[j][0] = str(v)
        print(''.join(t[j]))

else:
    for j in range(h):
        if j == 0:
            for k in range(w):
                if k == 0:
                    u = s[0][1] + s[1][0] + s[1][1]
                elif k == w-1:
                    u = s[0][k-1] +s[1][k-1] + s[1][k]
                else:
                    u = s[0][k-1] +s[0][k+1] + s[1][k-1] + s[1][k] + s[1][k+1]
                v = u.count('#')
                if s[j][k] == '#':
                    v = '#'
                t[j][k] = str(v)
        elif j == h-1:
            for k in range(w):
                if k == 0:
                    u = s[j][1] + s[j-1][0] + s[j-1][1]
                elif k == w-1:
                    u = s[j][k-1] +s[j-1][k-1] + s[j-1][k]
                else:
                    u = s[j][k-1] +s[j][k+1] + s[j-1][k-1] + s[j-1][k] + s[j-1][k+1]
                v = u.count('#')
                if s[j][k] == '#':
                    v = '#'
                t[j][k] = str(v)
        else:
             for k in range(w):
                if k == 0:
                    u = s[j][1] + s[j-1][0] + s[j-1][1] + s[j+1][0] + s[j+1][1]
                elif k == w-1:
                    u = s[j][k-1] +s[j-1][k-1] + s[j-1][k] + s[j+1][k-1] + s[j+1][k]
                else:
                    u = s[j][k-1] +s[j][k+1] + s[j-1][k-1] + s[j-1][k] + s[j-1][k+1] + s[j+1][k-1] + s[j+1][k] + s[j+1][k+1]
                v = u.count('#')
                if s[j][k] == '#':
                    v = '#'
                t[j][k] = str(v)
        print(''.join(t[j]))

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

const int MAX = 100010;

int main() {
    //エラトステネス
    vector<int> is_prime(MAX, 1);
    is_prime[0] = 0;
    is_prime[1] = 0;
    for (int i = 2; i < MAX; i++) {
        if (!is_prime[i]) continue;
        for (int j = i * 2; j < MAX; j += i) is_prime[j] = 0;
    }

    //2017-like Numberかどうか
    vector<int> a(MAX, 0);
    for (int i = 0; i < MAX; i++) {
        if (i % 2 == 0) continue;
        if (is_prime[i] && is_prime[(i + 1) / 2]) a[i] = 1;
    }

    //累積和
    vector<int> s(MAX + 1, 0);
    for (int i = 0; i < MAX; i++) s[i + 1] = s[i] + a[i];

    int q;
    cin >> q;
    for (int i = 0; i < q; i++) {
        int l, r;
        cin >> l >> r;

        cout << s[r + 1] - s[l] << endl;
    }

    return 0;
}

Measured memory_bytes: 1792
/*
	submission # - User: herp_sy
	https://atcoder.jp/contests/
*/

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

// utility of stdin,stdout
#define _CRT_SECURE_NO_WARNINGS
#define OUT cout << 
#define BR << endl
#define RET return 0
#define TLong long long
#define TBMod 1000000007

int main(int argc, char const *argv[])
{
	int n,t;
	int ans = 0;
	cin >> n >> t;

	std::vector<int> v(n);
	for (int i = 0; i < n; ++i)	cin >> v.at(i);
	for (int i = 1; i < n; ++i)
	{
		ans += ((v.at(i - 1) + t <= v.at(i)) ? (t) : (v.at(i) - v.at(i - 1)));
	}
	OUT(ans + t) BR;
	RET;
}


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

string s, t;
long long a, n, c, c1, c2;
int main() {
	int i;
	cin >> s >> a;
	n = s.size();
	t = s;
	sort(t.begin(), t.end());
	if(t[0] == t[n-1]) {
		cout << n * a / 2;
		return 0;
	}
	for(i=1; s[i]; i++) {
		if(s[i] == s[i-1]) {
			c++;
			i++;
		}
	}
	if(s[0] != s[n-1]) cout << c * a;
	else {
		for(i=c1=0; s[i] == s[0]; i++, c1++);
		for(i=n-1, c2=0; s[i] == s[n-1]; i--, c2++);
		cout << c*a - (c1/2 + c2/2 - (c1+c2)/2) * (a-1);
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,c;
	scanf("%d%d%d",&a,&b,&c);
	if((a==b && b!=c) || (b==c && b!=a) || (a==c && a!=b))
	{
		printf("Yes\n");
	}
	else
	{
		printf("No\n");
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define fore(i, b, e) for (int i = (int)(b); i <= (int)(e); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long i64;
typedef unsigned long long u64;
typedef long double ld;
typedef long long ll;
// #define sz(x) int((x).size())

int med(int a, int b, int c) {
    vi d{a,b,c};
    sort(all(d));
    return d[1];
}

int get(vi a) {
    int n = a.size();
    while (n > 1) {
        vi b;
        forn(i, n-1) if (i) {
            b.pb(med(a[i-1], a[i], a[i+1]));
        }
        a = b;
        n -= 2;
    }
    return a[0];
}

int main() {
#ifdef LOCAL
    freopen("b.in", "r", stdin);
#endif

    forn(III, 1) {
        int n, x;
        if (!(cin >> n >> x)) break;

        n = n*2-1;

        if (n == 1) {
            cout << "Yes\n1\n" << endl;
            continue;
        }
        if (x == 1 || x == n) {
            cout << "No" << endl;
            continue;
        }

        vi a(n);
        int p = n/2;
        forn(i, n) {
            a[p] = x;
            ++p;
            if (p == n) p = 0;
            ++x;
            if (x == n+1) x = 1;
        }

        cout << "Yes" << endl;
        for (int x: a) cout << x << " "; cout << endl;
//         assert(x == get(a));
    }

#ifdef LOCAL
    cerr << "Time elapsed: " << clock() / 1000 << " ms" << endl;
#endif
    return 0;
}


Measured memory_bytes: 2432
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;

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

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;



int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string n;
    cin >> n;
    if(n[0] == '9' || n[1] == '9'){
        cout << "Yes" << "\n";
    }else{
        cout << "No" << "\n";
    }


    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define repr(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repr(i,0,n)
#define reprrev(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define reprev(i,n) reprrev(i,0,n)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define mp make_pair
#define mt make_tuple
#define MOD 1000000007
#define PI 3.1415926535
typedef long long ll;
typedef pair<int, int> Pi;
typedef pair<ll, ll> Pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<Pi> vPi;
typedef vector<Pll> vPll;
typedef vector<vector<int>> vvi;
typedef vector<vector<bool>> vvb;
typedef vector<vector<ll>> vvll;
typedef vector<vector<char>> vvc;
typedef vector<vector<string>> vvs;
typedef vector<vector<double>> vvd;
typedef vector<vector<Pi>> vvPi;
typedef priority_queue<int, vector<int>, greater<int>> pqli;
typedef priority_queue<ll, vector<ll>, greater<ll>> pqlll;
typedef priority_queue<Pi, vector<Pi>, greater<Pi>> pqlP;
string YN(bool y) { return (y?"YES":"NO"); }
string yn(bool y) { return (y?"Yes":"No"); }
string ON(bool y) { return (y?"OK":"NG"); }
int main(void)
{
	int a, b;

	cin>>a>>b;

	vvc s(100, vc(100, '#'));

	repr(i, 50, 100){
		rep(j, 100){
			s[i][j]='.';
		}
	}

	int count=0;
	bool flag=false;
	rep(i, 50){
		rep(j, 100){
			if(count>=a-1){
				flag=true; break;
			}
			s[i][j]='.';
			count++;
			j++;
		}
		if(flag) break;
		i++;
	}

	count=0; flag=false;
	repr(i, 51, 100){
		rep(j, 100){
			if(count>=b-1){
				flag=true; break;
			}
			s[i][j]='#';
			count++;
			j++;
		}
		if(flag) break;
		i++;
	}

	cout<<100<<" "<<100<<endl;
	rep(i, 100){
		rep(j, 100) cout<<s[i][j];
		cout<<endl;
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
 
using namespace std;
 
int main() {
 
	int n;
	int ans;

	cin >> n;
	
	int d[n];
	
	for (int i = 0; i < n; i++) {
		cin >> d[i];
	}
	
	ans = 0;
	for (int i = 0; i < n - 1; i++) {
		for (int j = i + 1; j < n; j++) {
			ans = ans + d[i] * d[j];
		}
	}
	cout << ans << endl;

   return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
  
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL); 
  
#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define mp make_pair
#define pu push
#define pp pop_back
#define in insert
#define ld long double
#define debug cout << "Hold right there sparky.....\n";
#define forn(low,high,i) for(i=low;i<high;i++)
#define forrev(high,low,i) for(i = high; i>= low;i--)

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...) 1
#endif
template<class T> ostream& operator<<(ostream &os, vector<T> V) {os << "[ "; for(auto v : V) os << v << " "; return os << "]";}
template<class L, class R> ostream& operator<<(ostream &os, pair<L,R> P) {return os << "(" << P.first << "," << P.second << ")";}
  
typedef long long int ll;
  
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
const ll mod =1e9+7;
const ll maxn =5*100001;
ll power(ll x, ll n) {
  ll res = 1;
  for (; n > 0; n >>= 1) {
    if (n & 1) res = (res * x) % mod;
    x = (x * x) % mod;
  }
  return res;
}

int32_t main()
{
    
   

  
    IOS
	
	ll n,m;
	cin>>n>>m;
	vl g[n];
	double p[n],e[n];
	for(ll i=0;i<m;i++)
	{
		ll u,v;
		cin>>u>>v;
		u--;
		v--;
		g[u].pb(v);
	}
	p[0]=1.0;
  for(ll i=1;i<n;i++)
    p[i]=0.0;
	for(ll i=0;i<n;i++)
	{
		for(auto v:g[i])
			p[v]+=(p[i]/g[i].size());
	}
	e[n-1]=0.0;
	for(ll i=n-2;i>=0;i--)
	{	
      	e[i]=0.0;
		for(auto v:g[i])
		{
			e[i]+=((1+e[v])/g[i].size());
		}
	}
	double ans=e[0];
	cout<<fixed<<setprecision(9);
	for(ll i=n-2;i>=0;i--)
	{
		if(g[i].size()==1)
			continue;
		double maxi=0.0,sum=0.0;
		for(auto v:g[i])
		{
			sum+=e[v];
			maxi=max(maxi,e[v]);
		}
		double temp=e[0]+p[i]*((-sum/g[i].size())+(sum-maxi)/(g[i].size()-1));
		ans=min(ans,temp);
	}
	cout<<ans<<endl;
	
	
}
  
           
         
       


Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
const int LIMIT_HEIGHT = 5000;

int main()
{
  int n;
  bool grid[LIMIT_HEIGHT + 1][5];
  bool killed[LIMIT_HEIGHT + 1];

  while(cin >> n, n) {
    fill_n(*grid, (LIMIT_HEIGHT + 1) * 5, false);


    int d, p, q;
    while(n--) {
      cin >> d >> p >> q;
      --q;
      if(d == 1) { // 横向きのブロック
        for(int i = LIMIT_HEIGHT; i >= 0; i--) {
          bool flag = false;
          for(int j = 0; j < p; j++) {
            if(i == 0 || grid[i - 1][j + q]) {
              flag = true;
              for(int k = 0; k < p; k++) {
                grid[i][k + q] = true;
              }
              break;
            }
          }
          if(flag) break;
        }
        
      } else { // 縦向きのブロック
        for(int i = LIMIT_HEIGHT - p; i >= 0; i--) {
          if(i == 0 || grid[i - 1][q]) {
            for(int j = i; j < i + p; j++) {
              grid[j][q] = true;
            }
            break;
          }
        }
      }

      for(int i = 0; i < LIMIT_HEIGHT; i++) {
        bool flag = true;
        for(int j = 0; j < 5; j++) {
          flag &= grid[i][j];
        }
        killed[i] = flag;
      }
      int counter = 0;
      for(int i = 0; i < LIMIT_HEIGHT; i++) {
        while(i + counter < LIMIT_HEIGHT && killed[i + counter]) counter++;
     
        for(int j = 0; j < 5; j++) {
          if(i + counter >= LIMIT_HEIGHT) grid[i][j] = false;
          else grid[i][j] = grid[i + counter][j];
        }
      }
    }
    int ret = 0;
    for(int i = 0; i < LIMIT_HEIGHT; i++) {
      for(int j = 0; j < 5; j++) {
        ret += grid[i][j];
      }
    }
    cout << ret << endl;
  }
}

Measured memory_bytes: 1184
//abc165_a.cpp
//Sun May 24 22:01:07 2020

#include <iostream>
#include <string>
#include <queue>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#include <set>
#define INTINF 2147483647
#define LLINF 9223372036854775807
#define MOD 1000000007

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

int main(){
	int k,a,b;
	cin >> k >> a >> b;

	for (int i=a;i<=b;i++){
		if (i%k==0){
			cout << "OK" << endl;
			return 0;
		}
	}

	cout << "NG" << endl;
//	printf("%.4f\n",ans);
}

Measured memory_bytes: 3564
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(i=0;i<n;i++)
#define loop(i,a,n) for(i=a;i<n;i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

typedef vector<int> vi;
typedef pair<int,int> pii;

int main(void) {
  int i,j;
  ll a1,a2,a3,m1,m2,m3;
  while(1){
    cin>>a1>>m1>>a2>>m2>>a3>>m3;
    if(a1+a2+a3+m1+m2+m3==0)break;
    ll x,y,z,t1,t2,t3;
    x=y=z=1;
    t1=t2=t3=0;
    do{
      x=(a1*x)%m1;
      t1++;
    }while(x!=1);
    do{
      y=(a2*y)%m2;
      t2++;
    }while(y!=1);
    do{
      z=(a3*z)%m3;
      t3++;
    }while(z!=1);
    ll ans=t1*t2/__gcd(t1,t2);
    ans=ans*t3/__gcd(ans,t3);
    cout<<ans<<endl;
  }
}

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

namespace Contest
{
    class Program
    {
        static int Main(string[] args)
        {
            new Program().Process();

            return 0;
        }

        private CommonInput cin;

        private void Process()
        {
            this.cin = new CommonInput();

            int n, a, b, c, x;
            int tmp;
            int totalFrame;

            n = a = b = c = x = 0;

            Func<int> rnd = new Func<int>(() => (a * x + b) % c);

            while (true)
            {
                n = cin.GetNextToInt();
                a = cin.GetNextToInt();
                b = cin.GetNextToInt();
                c = cin.GetNextToInt();
                x = cin.GetNextToInt();

                totalFrame = 0;

                if (n == 0 && a == 0 && b == 0 && c == 0 && x == 0)
                    break;

                for (int i = 0; i < n; i++)
                {
                    tmp = cin.GetNextToInt();

                    while (totalFrame <= 10001 && x != tmp)
                    {
                        x = rnd();
                        totalFrame++;
                    }
                    x = rnd();
                    totalFrame++;
                }

                totalFrame--;

                if (totalFrame <= 10000)
                    Console.WriteLine(totalFrame);
                else
                    Console.WriteLine(-1);
            }
        }
    }

    public class CommonInput
    {
        public CommonInput()
        {
            this._s = new string[0];
            this._i = 0;
        }

        public string Line { get; set; }
        private string[] _s;
        private int _i;
        private char[] _sep = { ' ' };

        public void GetLine()
        {
            this._i = 0;
            do
            {
                this.Line = Console.ReadLine();
            } while (this.Line == "");

            if (this.Line != null)
                this._s = this.Line.Split(this._sep, StringSplitOptions.RemoveEmptyEntries);
        }

        public string GetNext()
        {
            if (this._i < this._s.Length)
                return this._s[this._i++];

            this.GetLine();

            return this._s[this._i++];
        }

        public int GetNextToInt()
        {
            return int.Parse(this.GetNext());
        }

        public long GetNextToLong()
        {
            return long.Parse(this.GetNext());
        }

        public double GetNextToDouble()
        {
            return double.Parse(this.GetNext());
        }
    }
}

Measured memory_bytes: 9740
// finish date: 2018/02/26

#include <iostream>
#include <cmath>
#include <vector>
#include <bitset>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <climits>

using namespace std;

#define FOR(i, a, b) for(int (i)=a;(i)<(b);(i)++)
#define rep(i, n)  FOR(i,0,n)
#define ll long long
#define vi vector<int>
#define vvi vector<vector<int>>
#define vvvi vector<vector<vector<int>>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vd vector<double>
#define vvd vector<vector<double>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define vs vector<string>
#define vc vector<char>
#define vvc vector<vector<char>>
#define bigmod 1000000007
#define INF 1050000000
#define pii pair<int,int>


struct E {
    int to, distance;

    E(int t, int d) {
        to = t;
        distance = d;
    }
};

vi x;
vector<vector<E>> EL, ER;
vb useL, useR;

bool dfs(vector<vector<E>> &edges, int node, vb &use) {
    if (use[node]) return true;
    use[node] = true;
    if (x[node] == INT_MAX) x[node] = 0;
    bool flag = true;
    for (E e:edges[node]) {
        int newD = x[node] + e.distance;
        if (x[e.to] != INT_MAX && x[e.to] != newD) return false;
        x[e.to] = newD;
        flag &= dfs(EL, e.to, useL);
        flag &= dfs(ER, e.to, useR);
    }
    return flag;
}


int main() {
    int A, B, C;
    cin >> A >> B >> C;
    if (A % 2 == 0 || B % 2 == 0 || C % 2 == 0) {
        cout << 0 << endl;
        return 0;
    }
    int ma = max({A, B, C});
    if(ma == A){
        cout<<(ll)B*C<<endl;
    }else if(ma ==B){
        cout<<(ll)C*A<<endl;
    }else {
        cout<<(ll)A*B<<endl;
    }

    return 0;


}





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

#define debug(x) cout << #x << " = " << x << endl
#define fori(i, ini, lim) for(int i = int(ini); i < int(lim); i++)
#define ford(i, ini, lim) for(int i = int(ini); i >= int(lim); i--)

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;

const int MAX = 4000 + 5;
const int INF = (int) 1e9;
int pref[2][MAX][MAX];
int memo[MAX][MAX];
int el_idx[2][MAX], vals[MAX], colors[MAX];
int n;

int roll(int idx, int w_idx) {
	if(idx == 2 * n + 1) {
		return 0;
	}

	int &ans = memo[idx][w_idx];
	if(~ans) {
		return ans;
	}

	int b_idx = idx - w_idx + 1;
	
	ans = INF;
	if(w_idx <= n) {
		int ball_idx = el_idx[0][w_idx] - (pref[0][w_idx - 1][el_idx[0][w_idx]] + pref[1][b_idx - 1][el_idx[0][w_idx]]);
		int price = ball_idx - 1;
		ans = min(ans, roll(idx + 1, w_idx + 1) + price);
	}

	if(b_idx <= n) {
		int ball_idx = el_idx[1][b_idx] - (pref[0][w_idx - 1][el_idx[1][b_idx]] + pref[1][b_idx - 1][el_idx[1][b_idx]]);
		int price = ball_idx - 1;
		ans = min(ans, roll(idx + 1, w_idx) + price);
	}

	return ans;
}

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

	fori(i, 1, 2 * n + 1) {
		char color;
		int val;
		scanf("%c %d%*c", &color, &val);
		int mask = color == 'B';

		el_idx[mask][val] = i;
		vals[i] = val;
		colors[i] = mask;
	}

	fori(i, 0, 2) {
		fori(j, 1, n + 1) {
			int total = 0;
			fori(k, 1, 2 * n + 1) {
				if(colors[k] == i && vals[k] <= j) {
					total++;
				}
				pref[i][j][k] = total;
			}
		}
	}

	memset(memo, -1, sizeof memo);
	printf("%d\n", roll(1, 1));

	return 0;
}


Measured memory_bytes: 127488
#include <bits/stdc++.h>
#define BIT(n) (1LL << (n))
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPB(i, n) for (int i = 0; i < BIT(n); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORA(i, n) for (auto &&i : n)
#define FORS(i, m, n) for (int i = m; i <= n; i++)
#define DEBUG(x) cerr << #x << ": " << x << "\n"
#define DEBUG2(x, y) cerr << #x << ": " << x << " " << #y << ": " << y << "\n"
#define DEBUG3(x, y, z)                                                        \
  cerr << #x << ": " << x << " " << #y << ": " << y << " " << #z << ": " << z  \
       << "\n"
#define PRINTALL(V)                                                            \
  for (auto v : (V)) {                                                         \
    cout << v << " ";                                                          \
  }                                                                            \
  cout << "\n";
#define ALL(v) v.begin(), v.end()
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
#define epb emplace_back
#define int long long
#define pint pair< int, int >
#define ld long double
using namespace std;
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 (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template < class T > using vec = std::vector< T >;
template < class T > void print(const T &x) { cout << x << "\n"; }
const int MOD = 1000000007, INF = 1061109567;
const double EPS = 1e-10, PI = acos(-1.0);
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
// int xy[110][3];
inline int calc(pint x, pint y) {
  return (y.snd - x.snd) * (y.snd - x.snd) + (y.fst - x.fst) * (y.fst - x.fst);
}
signed main() {
  cin.tie(0), ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  int N;
  cin >> N;
  vec< pint > lis(N);
  REP(i, N) {
    int x, y;
    cin >> x >> y;
    lis[i] = mp(x, y);
  }
  sort(ALL(lis), [](const pint &a, const pint &b) {
    return atan2(a.snd, a.fst) < atan2(b.snd, b.fst);
  });
  int ans = 0;
  REP(i, N) {
    int vx = 0, vy = 0;
    REP(j, N) {
      vx += lis[(i + j) % N].fst;
      vy += lis[(i + j) % N].snd;
      chmax(ans, vx * vx + vy * vy);
    }
  }
  print(sqrt(ans * 1.0));
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string S;
  cin >> S;
  
  if(S.at(0)=='a' || S.at(0)=='i' || S.at(0) =='u' || S.at(0)=='e' || S.at(0) =='o'){
    cout <<"vowel"<< endl;
  } 
  else{
    cout <<"consonant" << endl;
  }
  
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int H,W,N;
pair<int,int>p[111111];
set<pair<int,int>> cnt[11];
map<int,set<int>>mp;
int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin>>H>>W>>N;
    for(int i=0;i<N;i++){
        int x,y;
        cin>>x>>y;
        x--;y--;
        p[i]={x,y};
        mp[x].insert(y);
    }
    for(int i=0;i<N;i++){
        int x=p[i].first, y=p[i].second;
        for(int dx=-1;dx<=1;dx++){
            for(int dy=-1;dy<=1;dy++){
                int c=0;
                for(int j=-1;j<=1;j++){
                    for(int k=-1;k<=1;k++){
                        if(x+dx+j<0||y+dy+k<0||x+dx+j>=H||y+dy+k>=W)goto z;
                        if(mp[x+dx+j].find(y+dy+k)!=mp[x+dx+j].end()){
                            c++;
                        }
                    }
                }
                cnt[c].insert({x+dx,y+dy});
                z:;
            }
        }
    }
    long long cnt0 = 1LL*(H-2)*(W-2);
    for(int i=1;i<10;i++)
        cnt0-=cnt[i].size();
    cout<<cnt0<<endl;
    for(int i=1;i<10;i++)
        cout<<cnt[i].size()<<endl;
    return 0;
}


Measured memory_bytes: 94848
#include<vector>
#include<map>
#include<algorithm>
#include<set>
#include<iostream>
#include<string>
#include<set>
#include<queue>
#include<random>
//#include<unordered_set>

using namespace std;

/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;

tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> st;*/

#pragma GCC optimize("Ofast")
#pragma GCC optimize("fast-math")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,tune=native")

#define pb push_back
#define ld long double
#define int long long

mt19937 rnd(51);

int32_t main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int n, q;
	cin >> n >> q;
	vector<int> c(n);
	vector<pair<int, pair<int, pair<int, int>>>> v(n);
	for (int i = 0; i < n; i++) {
		cin >> v[i].first >> v[i].second.first >> v[i].second.second.first;
		c[i] = v[i].second.second.first;
		v[i].first -= v[i].second.second.first;
		v[i].second.first -= v[i].second.second.first;
		v[i].second.second.second = i;
	}
	sort(v.begin(), v.end());
	set<pair<int, int>> ans;
	set<pair<int, int>> lol;
	int j = 0;
	for (int i = 0; i < q; i++) {
		int d;
		cin >> d;
		while (j < v.size() && v[j].first <= d) {
			ans.insert({c[v[j].second.second.second], v[j].second.second.second});
			lol.insert({ v[j].second.first, v[j].second.second.second });
			j++;
		}
		while (lol.size() > 0 && d >= lol.begin()->first) {
            auto v = *lol.begin();
			ans.erase({c[v.second], v.second});
			lol.erase(lol.begin());
		}
		if (lol.size() == 0) {
			cout << -1 << endl;
		}
		else {
			cout << ans.begin()->first << endl;
		}
	}
	return 0;
}


Measured memory_bytes: 34048
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int K = sc.nextInt();
		int[] x = new int[N];
		int[] xabs = new int[N];
		int ans = 0;

		for(int i=0; i<N; i++) {
			x[i] = sc.nextInt();
			xabs[i] = Math.min(Math.abs(x[i]-0), Math.abs(x[i]-K));
			ans += xabs[i];
		}
		System.out.println(ans * 2);

	}

}


Measured memory_bytes: 23892