akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

vector<vector<char>> grid;
int h,w;

bool allDots(int i){
    for(int k=0; k<grid[i].size(); k++)
        if(grid[i][k] != '.')
            return false;
    return true;
}
bool allDots2(int i){
    for(int k=0; k<grid.size(); k++)
        if(grid[k][i] != '.')
            return false;
    return true;
}

void printGrid(){
    for(int i=0; i<grid.size(); i++){
        for(int j=0; j<grid[i].size(); j++){
            cout<<grid[i][j];
        }
        cout<<endl;
    }
}

int main()
{
    cin>>h>>w;

    for(int i=0; i<h; i++){
        grid.push_back(vector<char>());
        for(int j=0; j<w; j++){
            char c;
            cin>>c; grid[i].push_back(c);
        }
    }
    bool stop = false;
    while(!stop){
        //cout<<allDots(0)<<endl;
        //cout<<"here!\n";
        stop = true;
        //rows
        for(int i=0; i<grid.size(); i++){
            //cout<<"row: "<<i<<" dots: "<<allDots(i)<<endl;
            if(allDots(i)){
                stop = false;
                vector<vector<char>> newG;
                for(int k=0; k<grid.size(); k++){
                    if(k == i) continue;
                    newG.push_back(vector<char>());
                    for(int l=0; l<grid[k].size(); l++){
                        newG[newG.size()-1].push_back(grid[k][l]);
                    }
                }
                grid = newG;
                /*cout<<"row: "<<i<<endl; //printGrid();
                for(int n=0; n<newG.size(); n++){
                    for(int j=0; j<newG[n].size(); j++){
                        cout<<newG[n][j];
                    }
                    cout<<endl;
                }*/
            }
        }

        //cols
        for(int i=0; i<grid[0].size(); i++){
                //cout<<"col: "<<i<<" dots: "<<allDots2(i)<<endl;
            if(allDots2(i)){
                stop = false;
                vector<vector<char>> newG;
                for(int k=0; k<grid.size(); k++){
                    newG.push_back(vector<char>());
                    for(int l=0; l<grid[0].size(); l++){
                        if(l == i) continue;
                        newG[newG.size()-1].push_back(grid[k][l]);
                    }
                }
                grid = newG;
                /*cout<<"col: "<<i<<endl; //printGrid();
                for(int n=0; n<newG.size(); n++){
                    for(int j=0; j<newG[n].size(); j++){
                        cout<<newG[n][j];
                    }
                    cout<<endl;
                }*/
            }
        }
    }

    printGrid();

    return 0;
}


Measured memory_bytes: 256
A,B,K=map(int,input().split())
if B-A+1<2*K:
  for i in range(A,B+1):
    print(i)
  exit()
l=list()
for i in range(A,A+K):
  l.append(i)
for i in range(B-K+1,B+1):
  l.append(i)

for i in range(len(l)):
  print(l[i])

Measured memory_bytes: 3060
S = input()
flg = True
if 'C' in S[2:len(S) - 1]:
    i = S.index('C')
else:
    i = -1

if S[0] == 'A' and i != -1:
    others = S[1:i] + S[i + 1:]
    for o in others:
        if not (ord('a') <= ord(o) <= ord('z')):
            flg = False
            break
else:
    flg = False

print('AC' if flg else 'WA')

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

int main(){

     double N;
     cin >> N;
     double ans;
     for(int i = 0; i < N; i++){ 
           double x;
           string y;
       cin >> x >> y;
           double rate = 380000.0;

           if(y == "JPY"){
                ans += x;
           }else if(y == "BTC"){
                ans += x * rate;
           }
     }

     cout << ans << endl;

}
          

Measured memory_bytes: 256
def bit_all(a,n):
    ans = 0
    for i in range(2**n):
        mini_ans = 0
        now = 0
        for j in range(n):
            if i>>j & 1:
                mini_ans += int(a[now:j+1])
                now = j+1
        mini_ans += int(a[now:])
        ans += mini_ans
    print(ans)
                
                
a = input()
bit_all(a,len(a)-1)


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

using namespace std;

#define YES cout << "YES" << endl;
#define NO  cout << "NO"  << endl;
#define Yes cout << "Yes" << endl;
#define No  cout << "No"  << endl;
 
#define INF INT_MAX
#define MOD 1000000007
#define PI  acos(-1)

using ll  = long long;
using ull = unsigned long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

int main(int argc, char *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    int N;
    cin >> N;
    
    vector<int> A(N);
    for (int i = 0; i < N; i++) {
        cin >> A[i];
    }

    map<int, int> m;
    for (int i = 0; i < N; i++) {
        m[A[i]]++;
    }

    ll edge1 = 0;
    ll edge2 = 0;
    ll sq = 0;
    for (map<int, int>::iterator it = m.begin(), end = m.end(); it != end; it++) {
        if (it->second > 1) {
            if (it->second >= 4) {
                sq = (ll)it->first * (ll)it->first;
            }
            if (edge1 == 0) {
                edge1 = it->first;
            } else {
                edge2 = edge1;
                edge1 = it->first;
            }
        }
    }

    cout << max(edge1*edge2, sq) << endl;
    return 0;
}

Measured memory_bytes: 5376
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
  int a,b,c,d;
  cin>>a>>b>>c>>d;
  int e=c/b;
  int f=a/d;
  int g=c%b;
  int h=a%d;
  if(e>f+1){cout<<"No"<<endl;}
  else if(e==f+1){if(h!=0 && g==0){cout<<"Yes"<<endl;}else{cout<<"No"<<endl;}}
  else if(e==f){if(g==0){cout<<"Yes"<<endl;}else if(h==0){cout<<"No"<<endl;}else{cout<<"Yes"<<endl;}}
  else if(e<f){cout<<"Yes"<<endl;}
}



Measured memory_bytes: 3636
n, m = gets.to_s.split.map{|t|t.to_i}
a    = gets.to_s.split.map{|t|t.to_i}.sort

bcs = Array.new(m){ gets.to_s.split.map{|t|t.to_i} }.sort_by{|bc| -bc[1] }

i = 0
bcs.each do |bc|
  
  b = bc[0]
  c = bc[1]
  
  while b > 0 && i < n
    
    if a[i] < c
      # p [b,c,a[i]]
      a[i] = c
      b -= 1
    end
    
    i += 1
  end
end

# p a
puts a.reduce(0){|s,t|s+t}

# c > a[i]: 変更; a[i] = c; b -= 1; i+=1;
# c < a[i]: 変更しない。i+=1を繰り返して、c>a[i]

Measured memory_bytes: 20760
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

S, T = readline().split()
A, B = map(int, readline().split())
U = read().rstrip()

if S == U:
    A -= 1
else:
    B -= 1

print(A,B)

Measured memory_bytes: 3060
import java.util.Scanner;

public class Main{
  public static void main(String[] args){
    Scanner scanner = new Scanner(System.in);
    
    int n = Integer.parseInt(scanner.next());
    int[] a = new int[n];
    for(int i = 0; i < n; i++){
      a[i] = Integer.parseInt(scanner.next());
    }
    
    int[] x = new int[n];
    int sum = 0;
    for(int i : a){
      sum += i;
    }
    
    x[0] = sum;
    for(int i = 1; i < n; i += 2){
      x[0] -= 2 * a[i];
    }
    
    for(int i = 1; i < n; i++){
      x[i] = 2 * a[i - 1] - x[i - 1];
    }
    
    StringBuilder answer = new StringBuilder();
    for(int i = 0; i < n - 1; i++){
      answer.append(x[i]);
      answer.append(" ");
    }
    answer.append(x[n - 1]);
    
    System.out.println(answer.toString());
  }
}


Measured memory_bytes: 47744
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// using namespace __gnu_pbds;
// gp_hash_table<int, int> mapka;

using namespace std;
#define PB push_back
#define MP make_pair
#define LL long long
#define int LL
#define FOR(i,a,b) for(int i = (a); i <= (b); i++)
#define RE(i,n) FOR(i,1,n)
#define REP(i,n) FOR(i,0,(int)(n)-1)
#define R(i,n) REP(i,n)
#define VI vector<int>
#define PII pair<int,int>
#define LD long double
#define FI first
#define SE second
#define st FI
#define nd SE
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())

template<class C> void mini(C &a4, C b4) { a4 = min(a4, b4); }
template<class C> void maxi(C &a4, C b4) { a4 = max(a4, b4); }

template<class TH> void _dbg(const char *sdbg, TH h){ cerr<<sdbg<<'='<<h<<endl; }
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
  while(*sdbg!=',')cerr<<*sdbg++;
  cerr<<'='<<h<<','; _dbg(sdbg+1, a...);
}

template<class T> ostream &operator<<(ostream& os, vector<T> V) {
  os << "["; for (auto vv : V) os << vv << ","; return os << "]";
}
template<class L, class R> ostream &operator<<(ostream &os, pair<L,R> P) {
  return os << "(" << P.st << "," << P.nd << ")";
}

#ifdef LOCAL
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...) (__VA_ARGS__)
#define cerr if(0)cout
#endif

const int P = 1e9 + 7;
void add(int &a,int b){
  a += b;
  if(a >= P)
    a -= P;
}
int mul(int a,int b){
  return a * b % P;
}
int pot(int a,int w){
  int r = 1;
  while(w){
    if(w&1){
      r = r * a % P;
    }
    a = a * a % P;
    w/=2;
  }
  return r;
}
int k,n;
string z;
const int MAX = 2001000;
int sil[MAX];
int odw[MAX];
int p25[MAX];
int p26[MAX];
int dwu(int a,int b){
  return sil[a] * odw[b] % P * odw[a-b] % P;
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout << fixed << setprecision(11);
  cerr << fixed << setprecision(6);
  sil[0] = 1;
  p25[0] = 1;
  p26[0] = 1;
  R(i,MAX - 1){
    sil[i + 1] = mul(sil[i], i+1);
    p25[i + 1] = mul(p25[i], 25);
    p26[i + 1] = mul(p26[i], 26);
  }
  odw[MAX-1] = pot(sil[MAX-1], P-2);
  for(int i = MAX-1;i;i--){
    odw[i-1] = mul(odw[i], i);
  }
  cin >> k >> z;
  n = SZ(z);
  int res = 0;
  R(i,k+1){
    add(res, mul(dwu(n + i - 1, i), mul(p25[i],p26[k-i])));
  }
  cout << res << "\n";
}


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

int main() {
  int n; cin >> n;
  vll h(n); rep(i, n) cin >> h[i];
  int dp[100010];
  dp[0] = 0;
  dp[1] = abs(h[0] - h[1]);
  for (int i = 2; i < n; i++)
    dp[i] = min(dp[i-1] + abs(h[i-1] - h[i]), dp[i-2] + abs(h[i-2] - h[i]));
  cout << dp[n-1] << endl;
  return 0;
}

Measured memory_bytes: 1408
import sys,collections,math;sys.setrecursionlimit(10**7)
def Is(): return [int(x) for x in sys.stdin.readline().split()]
def Ss(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

lis,f = [],[]
for i in range(5):
    lis.append(I())
    if lis[-1] % 10 != 0:
        f.append(lis[-1] % 10)
print(sum(lis+list(map(lambda x: 10-x, sorted(f)[1:]))))


Measured memory_bytes: 3316
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<set>
#include<map>
#include<queue>
#include<cmath>
#define REP(i,a) for (int i = 0;i < (a);++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)
#define ALL(obj) (obj).begin(),(obj).end()
#define SORT(list) sort(ALL((list)));
#define MOD 1000000007
using namespace std;
using ll = long long;
int main(){
    int n;
    cin >> n;

    int answer = 0;
    int max_div=0;
    if(n == 1){
        cout << 1 << endl;
        return 0;
    }
    FOR(i,1,n+1){
        int now = i;
        int count = 0;
        while(now%2==0){
            count++;
            now/=2;
        }
        if(count > max_div){
            answer = i;
            max_div = count;
        }
    }
    cout << answer << endl;
    return 0;
}

Measured memory_bytes: 3636
#include <stdio.h>

int main(void)
{
	int limit = 10000;
	int H[limit], W[limit];
	int i, j;
	for (i = 0; i < limit; i++) {
		scanf("%d %d", &H[i], &W[i]);
		if (H[i] == 0 && W[i] == 0) {
			break;
		}
	}
	for (j = 0; j < i; j++) {
		for (int h = 0; h < H[j]; h++) {
			for (int w = 0; w < W[j]; w++) {
				if (h % 2 == 0) {
					if (w % 2 == 0) {
						printf("#");
					} else {
						printf(".");
					}
				} else {
					if (w % 2 == 0) {
						printf(".");
					} else {
						printf("#");
					}
				}
			}
			printf("\n");
		}
		printf("\n");
	}
}



Measured memory_bytes: 2100
#pragma warning(disable:4996)

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <float.h>

#pragma region 定義
typedef long long  ll;
typedef unsigned long long  ull;


#define _itoa(A,N) sprintf(A, "%d", N);

int i_dsort(const void* a, const void* b);
int i_asort(const void* a, const void* b);

int  _gcd(int a, int b);
int  _swp(int* a, int* b);
int _cknum(char* a, int n);
int _atoi(char* s, int len);

int s_asort(const void* a, const void* b);
int s_dsort(const void* a, const void* b);

//昇順
int s_asort(const void* a, const void* b) {
	return(strcmp((char*)a, (char*)b));
}
int s_dsort(const void* a, const void* b) {
	return(strcmp((char*)b, (char*)a));
}

int i_dsort(const void* a, const void* b) {
	return(*(int*)b - *(int*)a);
}
int i_asort(const void* a, const void* b) {
	return(*(int*)a - *(int*)b);
}


int i_gcd(int a, int b);
int i_gcd(int a, int b) {
	if (!b)return a;
	return i_gcd(b, a % b);
}
int i_lcm(int a, int b);
int i_lcm(int a, int b) {
	return (a * b) / i_gcd(a, b);
}
int ll_gcd(ll a, ll b);
int ll_gcd(ll a, ll b) {
	if (!b)return a;
	return ll_gcd(b, a % b);
}
int ll_lcm(ll a, ll b);
int ll_lcm(ll a, ll b) {
	return (a * b) / ll_gcd(a, b);
}

// puts("Yes\n") puts("No\n")
// scanf("%d.%d") 浮動小数点入力を整数２つで得る


//#define pai  3.1415926535 
//#define  _USE_MATH_DEFINES でM_PIが使える

#define deg_rad(X)  (X*(M_PI/180))


int _swp(int* a, int* b)
{
	int tmp;
	tmp = *b; *b = *a; *a = tmp;
	return 0;
}
#define _abs(x) ((x)>0?(x):-(x))
#define _min(x,y) ((x)<(y)?(x):(y))
#define _max(x,y) ((x)<(y)?(y):(x))

int _cknum(char* a, int n) {
	int i;
	char t = '0';

	for (i = 0; i < n; i++) {
		if (a[i] < '0' || a[i]>'9') return 1;
	}
	return 0;
}


int _atoi(char* s, int len) {
	char tmp[20];
	memcpy(tmp, s, len);
	tmp[len] = 0x00;
	return (atoi(tmp));
}

//素因数分解　pf素数が入る　pc 素数の数
//ll _pfact(ll a);
//static ll pf[100000000];
//static ll pc;
//
//ll _pfact(ll a) {
//	long i, r;
//	if (a % 2 == 0) {
//		pf[pc] = 2; pc++;
//		return(_pfact(a / 2));
//	}
//	r = sqrt(a);
//	for (i = 3; i <= r; i += 2) {
//		if (a % i == 0) {
//			pf[pc] = i; pc++;
//			return(_pfact(a / i));
//		}
//	}
//	if (a != 1) {
//		pf[pc] = a; pc++;
//	}
//	return 0;
//
//}

//同じものの最初の文字をNULLにして降順
int _sort(const void* a, const void* b);
int _sort(const void* a, const void* b) {
	char rc;

	rc = strcmp((char*)b, (char*)a);
	if (rc == 0) {
		*(char*)a = 0x00;
		return(1);
	}
	return(rc);
}

#pragma endregion



//ABC 096 C - Grid Repainting 2
static char s[52][53];
int main(void) {

	int i,j,h, w;
 

	memset(s, 0x20, sizeof(s));
	scanf("%d %d",&h,&w);

	for (i = 1; i <= h; i++) {
		scanf("%s", &s[i][1]);
		s[i][w + 1] = 0x00;
	}

//	for (i = 1; i <= h; i++)
//		printf("%s\n", s[i]);
	

	for (i = 1; i <= h; i++) {
		for (j = 1; j <= w; j++) {
			if (s[i][j] == '.') continue;
//			printf("%d %d %c:%c %c %c %c\n",i,j,s[i][j],
//				s[i - 1][j], s[i + 1][j],
//				s[i][j - 1], s[i][j + 1]);

			if (s[i - 1][j] != '#' &&
				s[i + 1][j] != '#' &&
				s[i][j - 1] != '#' &&
				s[i][j + 1] != '#')
			{
				printf("No\n"); return 0;
			}
		}
	}
	
	printf("Yes\n");
	return 0;
}




Measured memory_bytes: 1656
import sys
import itertools
import bisect

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

in_n = lambda: int(readline())
in_nn = lambda: map(int, readline().split())
in_nl = lambda: list(map(int, readline().split()))
in_na = lambda: map(int, read().split())
in_s = lambda: readline().rstrip().decode('utf-8')


def main():

    N = in_n()
    comb = itertools.product([0, 1], repeat=16)

    p = []
    m = []
    for c in comb:
        pt, mt = 0, 0
        for i in range(len(c)):
            pt += c[i] * (4 ** i)
            mt += c[i] * 2 * (4 ** i)
        p.append(pt)
        m.append(mt)

    p.sort()
    m.sort()

    for i in range(len(p)):
        if p[i] < N:
            continue
        else:
            pred_m = -(N - p[i])
            j = bisect.bisect_left(m, pred_m)
            if m[j] == pred_m:
                pred_p = p[i]
                break

    ans = pred_p | pred_m
    print(bin(ans)[2:])


if __name__ == '__main__':
    main()


Measured memory_bytes: 15520
import java.util.Scanner;

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

    int N = scanner.nextInt();
    int[] A = new int[N];
    for (int i = 0; i < N; i++) A[i] = scanner.nextInt();
    int count = 0;
    int d = 0;
    for (int i = 1; i < N; i++) {
      if (A[i] > A[i - 1] && d >= 0) {
        if (d == 0) d = 1;
        continue;
      }
      if (A[i] < A[i - 1] && d <= 0) {
        if (d == 0) d = -1;
        continue;
      }
      if (A[i] == A[i - 1] && d == 0) continue;
      if (A[i] > A[i - 1]) {
        count++;
        d = 0;
      } else if (A[i] < A[i - 1]) {
        count++;
        d = 0;
      }
    }
    System.out.println(count + 1);
  }
}


Measured memory_bytes: 51700
# -*- coding: utf-8 -*-
# 
import math
import sys
import itertools
import numpy as np


# いっこ入力
n =int(input())

# 空白区切りの数列をリストに代入
v = [int(i) for i in input().split()]

a = {v[0]:1}
b = {v[1]:1}
for i in range(2,n,2):
#    print(a)
    if v[i] in a:
        a[v[i]] += 1
    else:
        a[v[i]] = 1
    if v[i+1] in b:
        b[v[i+1]] += 1
    else:
        b[v[i+1]] = 1
    
#print(a,b)

max_a = max(a, key = a.get)
a1 = max(a.values())
max_b = max(b, key = b.get)
b1 = max(b.values())

if a1 == n // 2:
    a2=0
else:
    a[max_a]=0
    a2 = max(a.values())

if b1 == n // 2:
    b2=0
else:
    b[max_b]=0
    b2 = max(b.values())

c = a1+b2
d = a2+b1

if max_a == max_b:
    print(n-max(c,d))
else:
    print(n-a1-b1)



Measured memory_bytes: 25304
import math

N = int(input())
xy = [list(map(int, input().split())) for _ in range(N)]

ans = 0
count = 1;
for i in range(1, N):
    count *= i

for j in range(N):
    for i in range(N):
        if j != i:
            ans += math.sqrt((xy[i][0] - xy[j][0])**2 +(xy[i][1] - xy[j][1])**2) * count


print(ans / count / N)


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define vi vector<int>
#define pb push_back
#define pii pair<int,int>
#define fi first
#define se second
#define re cin>>
#define pr cout<<
#define all(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)


const int N=2e6+5;
const int mod=1e9+7;
ll n,k,ar[N];

bool poss(int x){
      int cuts=0;
      for(int i=1;i<=n;i++){
            cuts+=(ar[i]+x-1)/x-1;
      }
      return cuts<=k;
}

int main(){
      
      cin.tie(NULL); cout.tie(NULL); ios_base::sync_with_stdio(false);
      cin>>n>>k;
      ll lo=1,hi=0;
      for(int i=1;i<=n;i++) {
            cin>>ar[i];
            hi=max(hi,ar[i]);
      }

      ll ans=0;
      while(lo<=hi){
            int mid=(lo+hi)>>1;
            if(poss(mid)) ans=mid,hi=mid-1;
            else lo=mid+1;
      }

      cout<<ans;
      return 0;
}

Measured memory_bytes: 5136
$ii = 0;
while(<STDIN>){
    $line[$ii] = $_;
	$ii++;
}

$N = $line[0];
$A = $line[1];
$B = $line[2];
$C = $line[3];

$Ans = 0;
for ($xx = 0; $xx < $N; $xx++) {
	$tmp = 2;
    $a = substr($A, $xx, 1);
    $b = substr($B, $xx, 1);
    $c = substr($C, $xx, 1);
    
   	if ($b eq $c) { $tmp = 1; }
   	if ($c eq $a) { $tmp = 1; }
   	if ($a eq $b) {
    	if ($b eq $c) {
    		$tmp = 0;
        } else {
    		$tmp = 1;
        }
    }
	$Ans += $tmp;
    
}

print "$Ans\n";



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

int get_digit(int num);

int main(){

	while (1){
		int a, b;
		cin >> a >> b;
		if (cin.eof()){
			break;
		}
		cout << get_digit(a + b) << endl;
	}

	return 0;
}

int get_digit(int num){

	if (num / 10 != 0){
		return 1 + get_digit(num / 10);
	}
	return 1;
}

Measured memory_bytes: 1160
L, R = map(int, input().split())
modlist =[]
for i in range(L, R):
    for j in range(L+1,R+1):
        nummod = i * j % 2019
        modlist.append(nummod)
        if nummod == 0:
            break
    if nummod == 0:
        break
print(min(modlist))

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

void Solve(){
	int v[3][3];
	for(int i = 0; i < 3; i++){
		for(int ii = 0; ii < 3; ii++)
			cin>>v[i][ii];
	}
	set<int> s;
	int n;
	cin>>n;
	vector<int> k(n);
	for(int i = 0; i < n; i++){
		cin>>k[i];
		s.insert(k[i]);
	}
	bool good = false;
	for(int i = 0; i < 3; i++){
		bool good = true;
		bool good1 = true;
		for(int j = 0; j < 3; j++){
			if(s.find(v[i][j]) == s.end())
				good = false;
			if(s.find(v[j][i]) == s.end())
				good1 = false;
		}
		if(good || good1){
			cout<<"Yes\n";
			return;
		}
	}
	if(s.find(v[0][0]) != s.end() && s.find(v[1][1]) != s.end() && s.find(v[2][2]) != s.end()){
		cout<<"Yes\n";
		return;
	}
	if(s.find(v[2][0]) != s.end() && s.find(v[1][1]) != s.end() && s.find(v[0][2]) != s.end()){
		cout<<"Yes\n";
		return;
	}
	cout<<"No\n";

	return;
}
 
int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int q = 1;
	//cin>>q;
	while(q--){
		Solve();
	}
}


Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.PrintStream;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Scanner;
import java.util.HashMap;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskAC68D solver = new TaskAC68D();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskAC68D {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            Map<Integer, Integer> counts = new HashMap<>();

            for (int i = 0; i < n; i++) {
                int a = in.nextInt();

                if (counts.get(a) == null) {
                    counts.put(a, 0);
                }
                int count = counts.get(a);
                counts.put(a, count + 1);
            }

            int oddDistinct = 0;
            int evenDistinct = 0;

            for (Map.Entry<Integer, Integer> entries : counts.entrySet()) {
                int c = entries.getValue();

                if (c % 2 == 0) {
                    evenDistinct++;
                } else {
                    oddDistinct++;
                }
            }
            if (evenDistinct % 2 == 0) {
                System.out.println(counts.size());
            } else {
                System.out.println(counts.size() - 1);
            }
        }

    }
}



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

X = 1

if N == K:
    for a in A:
        X = X * a % MOD
        X %= MOD
    print(X)
    sys.exit()

P = []
M = []
for a in A:
    if a >= 0:
        P.append(a)
    else:
        M.append(a)    

if len(P) == 0:
    if K % 2 != 0:
        M.sort(reverse=True)
        for i in range(K):
            X = X * M[i] % MOD
            X %= MOD
        print(X)
        sys.exit()

P.sort()
M.sort(reverse=True)

if K % 2 != 0:
    X = X * P[-1] % MOD
    X %= MOD
    K -= 1
    P.pop()

PP = []
if len(P) % 2 == 0:
    for i in range(0, len(P), 2):
        PP.append(P[i] * P[i + 1])
else:
    PP.append(P[0])
    for i in range(1, len(P), 2):
        PP.append(P[i] * P[i + 1])
if len(M) % 2 == 0:
    for i in range(0, len(M), 2):
        PP.append(M[i] * M[i + 1])
else:
    for i in range(1, len(M), 2):
        PP.append(M[i] * M[i + 1])
PP.sort(reverse=True)

i = 0
while K > 0:
    X = X * PP[i] % MOD
    X %= MOD
    K -= 2
    i += 1

print(X)

Measured memory_bytes: 31632
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//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; }

/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
*/

int dp[101][4][4][4];
const int mod = 1000000007;

int main(void){
    int N; cin >> N;
    dp[0][3][3][3] = 1;

    for(int len=0; len<N; len++){
        for(int i=0; i<4; i++){
            for(int j=0; j<4; j++){
                for(int k=0; k<4; k++){

                    for(int a=0; a<4; a++){
                        if(j == 0 && k == 2 && a == 1) continue;
                        if(j == 0 && k == 1 && a == 2) continue;
                        if(j == 1 && k == 0 && a == 2) continue;
                        if(i == 0 && k == 1 && a == 2) continue;
                        if(i == 0 && j == 1 && a == 2) continue;

                        dp[len+1][j][k][a] += dp[len][i][j][k];
                        dp[len+1][j][k][a] %= mod;
                    }
                }
            }
        }
    }

    int ans = 0;
    for(int i=0; i<4; i++){
        for(int j=0; j<4; j++){
            for(int k=0; k<4; k++){
                ans += dp[N][i][j][k];
                ans %= mod;
            }
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
N=int(input())
S=input()
R=[]
G=[]
B=[]
for i in range(N):
  if S[i]=='R':
    R.append(i)
  elif S[i]=='G':
    G.append(i)
  else:
    B.append(i)

cnt=len(R)*len(G)*len(B)
for i in R:
  for j in G:
    if (i+j)%2==0 and S[(i+j)//2]=='B':
      cnt-=1
for i in R:
  for j in B:
    if (i+j)%2==0 and S[(i+j)//2]=='G':
      cnt-=1
for i in B:
  for j in G:
    if (i+j)%2==0 and S[(i+j)//2]=='R':
      cnt-=1      
print(cnt)

Measured memory_bytes: 9248
#include <stdio.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>

using std::cin;
using std::cout;
using std::endl;
using std::terminate;
using std::vector;
using std::sort;

const long INF = 1L << 61;

void solve() {
    long N, K; cin >> N >> K;
    vector<long> v(N);
    for (int i = 0; i < N; ++i) {
        cin >> v[i];
    }
    sort(v.begin(), v.end());

    long min_v = -INF;
    long max_v = INF;
    while (max_v - min_v > 1) {
        long x = (max_v + min_v) / 2;
        long S = 0;
        long T = 0;
        for (int i = 0; i < N; ++i) {
            if (v[i] > 0) {
                int left_i = -1;
                int right_i = N;
                while (right_i - left_i > 1) {
                    int pivot = (right_i + left_i) / 2;
                    if (v[i] * v[pivot] <= x) {
                        left_i = pivot;
                    } else {
                        right_i = pivot;
                    }
                }
                S += right_i;
            } else if (v[i] < 0) {
                int left_i = -1;
                int right_i = N;
                while (right_i - left_i > 1) {
                    int pivot = (right_i + left_i) / 2;
                    if (v[i] * v[pivot] <= x) {
                        right_i = pivot;
                    } else {
                        left_i = pivot;
                    }
                }
                S += N - right_i;
            } else if (x >= 0) {
                S += N;
            }

            if (v[i] * v[i] <= x) {
                T++;
            }
        }

        long cnt = (S - T) / 2;
        if (cnt >= K) {
            max_v = x;
        } else {
            min_v = x;
        }
    }

    cout << max_v << endl;
}

int main() {

#ifdef DEV
    std::ifstream in("input");
    cin.rdbuf(in.rdbuf());

    int t; cin >> t;
    for (int x = 1; x <= t; ++x) {
        solve();
    }
#else
    solve();
#endif

    return 0;
}


Measured memory_bytes: 4844
#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)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
 
int main(void){
    ll n, a;
    cin >> n >> a;
 
    ll ans = 1e18;
 
    REP(i,40){
        int d = i + 1;
        ll p = pow(n, 1.0/d);
        int x;
        REP(j,d+1){
            ll s = 1;
            REP(k,d-j) s *= p;
            REP(k,j) s *= (p+1);
            if (s >= n){
                x = j;
                break;
            }
        }
        ans = min(ans, a*i + p*d + x);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <stdio.h>
using namespace std;

int main(void)
{
  int i,j,k,m[27]={};
  char ch;

  while ( scanf("%c", &ch) != EOF ){
    ch = tolower(ch);
    i = ch - 'a' + 1;
    m[i] = m[i] + 1;
  }

  for(k = 1; k <= 26; k++){
    j = 0x60 + k;
    cout << (char)j << " : " << m[k] << endl;  
  }
  return 0;
}

Measured memory_bytes: 3144
import java.util.*;
import java.io.*;
public class Main {

	public static void main(String[] args) throws Exception{
		int num = 998244353;

		// TODO Auto-generated method stub
 		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
 		PrintWriter out = new PrintWriter(System.out);
 		int n = Integer.parseInt(bf.readLine());
 		for(int i = 1;i<=n;i++){
//	 		String input1 = bf.readLine().trim();
//	 		String input2 = bf.readLine().trim();
 			int count = 0;
	 		for(int xy = 1;xy*xy <= 2*i;xy++){
	 			for(int yz = 1;yz*yz <= 2*i-xy*xy;yz++){
	 				int xz2 = 2*i-xy*xy-yz*yz;
	 				int xz = (int)(Math.sqrt(xz2));
	 				if (xz2 >= 1 && Math.sqrt(xz2) == (int)(Math.sqrt(xz2)))
	 					if ((xy+yz+xz)%2 == 0 && (xy+yz+xz)/2 > xy && (xy+yz+xz)/2 > xz && (xy+yz+xz)/2 > yz)
	 						count++;
	 				
	 			}
	 		}
	 		out.println(count);
 		}
 		
 		
 		out.println();
	 		
 		out.close();
 		
 		
 		
 	}
}
 	
 
//StringJoiner sj = new StringJoiner(" "); 
//sj.add(strings)
//sj.toString() gives string of those stuff w spaces or whatever that sequence is

 		
 		
 		
 		
	




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

int main()
{
  int N;
  string S;
  cin>>N;
  cin>>S;
  int ans=0;
  for(int i=0;i<N;i++){
    if(i==0)ans+=1;
    else if(S[i]!=S[i-1])ans+=1;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 512
#include<iostream>
using namespace std;
int main(){
int i,n[101]={0},m=0;
while(cin>>i)n[i]++;
for(i=0;i<100;i++)if(n[i]>m)m=n[i];
for(i=0;i<100;i++)if(n[i]==m)cout<<i<<endl;
return 0;
}

Measured memory_bytes: 1160
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);

    int n = sc.nextInt();
    int sum = 0;
    int max = 0;

    for (int i = 0; i < n; i++) {
      int tmp = sc.nextInt();
      sum += tmp;
      max = Math.max(max, tmp);
    }

    if ((sum - max) > max) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }

  }
}

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

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

using namespace std;

class mint{
	static const int MOD=1e9+7;
	int x;
public:
	mint():x(0){}
	mint(long long y){ x=y%MOD; if(x<0) x+=MOD; }

	mint& operator+=(const mint& m){ x+=m.x; if(x>=MOD) x-=MOD; return *this; }
	mint& operator-=(const mint& m){ x-=m.x; if(x<   0) x+=MOD; return *this; }
	mint& operator*=(const mint& m){ x=1LL*x*m.x%MOD; return *this; }
	mint& operator/=(const mint& m){ return *this*=inverse(m); }
	mint operator+(const mint& m)const{ return mint(*this)+=m; }
	mint operator-(const mint& m)const{ return mint(*this)-=m; }
	mint operator*(const mint& m)const{ return mint(*this)*=m; }
	mint operator/(const mint& m)const{ return mint(*this)/=m; }

	friend mint inverse(const mint& m){
		int a=m.x,b=MOD,u=1,v=0;
		while(b>0){ int t=a/b; a-=t*b; swap(a,b); u-=t*v; swap(u,v); }
		return u;
	}

	friend istream& operator>>(istream& is,mint& m){ long long t; is>>t; m=mint(t); return is; }
	friend ostream& operator<<(ostream& os,const mint& m){ return os<<m.x; }
	int to_int()const{ return x; }
};

int main(){
	int n;
	string s; cin>>n>>s;
	s="<"+s;

	// dp[i][j] = 左から i 個目まで決めて, 最後に置いた数より大きい数が j 個残っているような置き方の数
	static mint dp[3001][3001];
	dp[0][n]=1;
	rep(i,n){
		rep(j,n-i+1){
			if(s[i]=='<'){
				dp[i+1][0]+=dp[i][j];
				dp[i+1][j]-=dp[i][j];
			}
			else{
				dp[i+1][j]+=dp[i][j];
				dp[i+1][n-i]-=dp[i][j];
			}
		}
		rep(j,n) dp[i+1][j+1]+=dp[i+1][j];
	}
// O(n^3) DP
/*
	rep(i,n){
		rep(j,n-i+1){
			if(s[i]=='<'){
				rep(k,j) dp[i+1][k]+=dp[i][j];
			}
			else{
				rep(k,n-i-j) dp[i+1][k+j]+=dp[i][j];
			}
		}
	}
*/
	cout<<dp[n][0]<<'\n';

	return 0;
}


Measured memory_bytes: 35456
#include <bits/stdc++.h>
#include <complex>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define fi first
#define se second
#define mp make_pair
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,K,Q,A,B,C,L,R;
string S,T;
const ll MOD = 998244353;
const ll INF = 1LL << 59;
const long double EPS = 1e-9;
typedef pair<ll,ll> P;

typedef vector<P> vp;
typedef vector<vp> matP;

ll fastpow(ll a, ll pw) {
	ll res = 1;
	while (pw) {
		if (pw & 1) res = res * a % MOD;
		a = a * a % MOD;
		pw >>= 1;
	}
	return res;
}

int main(){
    cin>>N;
    vec a(N);
    rep(i,N) cin>>a[i];
    const ll MAX_V = 1e+6;
    vec w(MAX_V + 1, 0);
    reps(i,1,MAX_V + 1){
        (w[i] += fastpow(i, MOD - 2))%=MOD;
        for(int j = i*2; j <= MAX_V; j += i){
            (w[j] += MOD - w[i])%=MOD;
        }
    }
    ll ans = 0;
    vec num_a(MAX_V + 1, 0);
    rep(i,N) ++num_a[a[i]];
    reps(i,1,MAX_V + 1){
        ll sum = 0, a2 = 0;
        for(int j = i; j <= MAX_V; j += i){
            (sum += num_a[j]*j)%=MOD;
            (a2 += num_a[j]*j*j)%=MOD;
        }
        (sum *= sum)%=MOD;
        (sum += MOD - a2)%=MOD;
        (sum *= fastpow(2,MOD - 2))%=MOD;
        (sum *= w[i])%=MOD;
        (ans += sum)%=MOD;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 17408
# -*- coding: utf-8 -*-

W, H, N = map(int, input().split())
aN = [list(map(int, input().split())) for i in range (N)]

# 1マスずつ塗りつぶさないパターン(こっちのが速い)
minXY = [0, 0]
maxXY = [W, H]
for i in range(N):
    
    if aN[i][2] == 1:
        minXY[0] = max(minXY[0], aN[i][0])

    elif aN[i][2] == 2:
        maxXY[0] = min(maxXY[0], aN[i][0])

    elif aN[i][2] == 3:
        minXY[1] = max(minXY[1], aN[i][1])

    elif aN[i][2] == 4:
        maxXY[1] = min(maxXY[1], aN[i][1])

# 縦横それぞれにマイナスの可能性を考慮する
ansW = maxXY[0] - minXY[0]
ansH = maxXY[1] - minXY[1]
if ansW < 0:
    ansW = 0
if ansH < 0:
    ansH = 0

print(ansH * ansW)

Measured memory_bytes: 3064
//Krunal_Mathukiya
#include<bits/stdc++.h>
using namespace std;
#define lli long long int
#define li long int
#define pb push_back
#define mkp make_pair
#define nikalL return
#define umap unordered_map
#define fr(i,s,n) for(int i=s;i<=n;++i)
#define frr(i,s,n) for(int i=s;i>=n;--i)
#define jaldiKarNe ios_base::sync_with_stdio(false);cin.tie(NULL);
#define mod 1000000007
int n;
lli wt[107];
int val[107];
// umap<int,umap<int,lli> >dp,vis;
// lli fn(int i,int value) {
// 	if(vis[i][value]) return dp[i][value];
// 	vis[i][value]=1;
// 	if(i==0) {
// 		if(value) return dp[i][value]=500000000000;
// 		else return dp[i][value]=0;
// 	}
// 	lli nottake=fn(i-1,value);
// 	if(val[i]>value) return dp[i][value]=nottake;
// 	lli take=wt[i]+fn(i-1,value-val[i]);
// 	return dp[i][value]=min(take,nottake);
// }
void TestingChaluKarEyy() {
	lli w;
	// dp.clear();
	// vis.clear();
	cin>>n>>w;
	int tot=0;
	fr(i,1,n) cin>>wt[i]>>val[i],tot+=val[i];
	int ans=0;
	// fr(i,1,tot) {
	lli dp[n+1][tot+1];
	fr(i,0,n) fr(j,0,tot) dp[i][j]=10e11;
	dp[0][0]=0;
	fr(i,1,n) {
		fr(j,0,tot) {
			if(val[i]>j) {
				dp[i][j]=dp[i-1][j];
				continue;
			}
			dp[i][j]=min(dp[i-1][j],wt[i]+dp[i-1][j-val[i]]);
		}
	}
	frr(i,tot,0) {
		if(dp[n][i]<=w) {
			cout<<i;
			nikalL;
		}
	}
}
int main() {
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif
	jaldiKarNe;
	int TestingKaravvuChhe = 1;
	// cin >> TestingKaravvuChhe;
	while (TestingKaravvuChhe--) {
		TestingChaluKarEyy();
	}
}


Measured memory_bytes: 82420
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,m,n) for(int i=m;i<n;i++)
ll mod=1e9+7;

int main(){
  int n,m;
  ll k;
  cin>>n>>m>>k;
  ll a[n],b[m];
  rep(i,0,n) cin>>a[i];
  rep(i,0,m) cin>>b[i];
  ll c[n+1],d[m+1];
  c[0]=0;
  d[0]=0;
  //d[0]=b[0];
  rep(i,0,n) c[i+1]=c[i]+a[i];
  rep(i,0,m) d[i+1]=d[i]+b[i];
  //rep(i,0,m-1) d[i+1]=d[i]+b[i+1];
  int ans=0;
  rep(i,0,n+1){
    if(c[i]>k) break;
    if(ans<i+(upper_bound(d,d+(m+1),k-c[i])-d-1)){
      ans=i+(upper_bound(d,d+(m+1),k-c[i])-d-1);
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 9836
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <queue>
#include <stack>
#include <set>
using namespace std;
#define fi first
#define se second
typedef long long lli;
typedef pair<int, int> pii;
const int maxn = 105;
const int maxw = 1e5 + 5;
const lli INF = 1e16;
int n, W;
int w[maxn], v[maxn];

lli dp[maxw];

void ReadInput()
{
    cin >> n >> W;
    for(int i = 1; i <= n; ++i)
        cin >> w[i] >> v[i];
}

void Solve()
{
    fill(begin(dp), end(dp), -INF);
    dp[0] = 0;
    for(int i = 1; i <= n; ++i)
        for(int j = W - w[i]; j >= 0; --j)
        {
            if(dp[j] == -INF) continue;
            dp[j + w[i]] = max(dp[j + w[i]], dp[j] + v[i]);
        }
    lli ans = -1;
    for(int j = 0; j <= W; ++j)
        ans = max(ans, dp[j]);
    cout << ans << '\n';
}

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


Measured memory_bytes: 1024
#include<bits/stdc++.h> 
//#define <- プログラムの文字列を置換する
//typedef <- 新しい型に名前を付けるためのキーワード

using namespace std;

#define MAX_N 100000

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

const long long MOD = 1e9 + 7;
const long long INF = 1e15;
const int INF_INT = 1e9;

template<class TYPE>
struct edge{
    TYPE to,cost; 
    edge(TYPE t,TYPE c){
        to = t;
        cost = c;
    }
};

int main(){
    char x,y;
    cin >> x >> y;
    if(x > y) cout << ">" << endl;
    else if(x == y) cout << "=" << endl;
    else cout << "<" << endl;
    return 0;
}



Measured memory_bytes: 256
import java.io.*;
import java.util.*;

/**
 * @author Tran Anh Tai
 * @template for CP codes
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        solver.solve(in, out);
        out.close();
    }
    // main solver
    static class Task{
        public void solve(InputReader in, PrintWriter out) {
            int x = in.nextInt();
            int n = in.nextInt();
            int p[] = new int[n];
            boolean[] visited = new boolean[101];
            for (int i = 0; i < n; i++){
                int num = in.nextInt();
                visited[num] = true;
            }
            int more = 101, less = 0;
            for (int i = x; i >= 0; i--){
                if (!visited[i]){
                    less = i;
                    break;
                }
            }
            for (int i = x + 1; i <= 100; i++){
                if (!visited[i]){
                    more = i;
                    break;
                }
            }
            if  (more - x < x - less){
                out.println(more);
            }
            else{
                out.println(less);
            }
        }
    }
    // fast input reader class;
    static class InputReader {
        BufferedReader br;
        StringTokenizer st;

        public InputReader(InputStream stream) {
            br = new BufferedReader(new InputStreamReader(stream));
        }

        public String nextToken() {
            while (st == null || !st.hasMoreTokens()) {
                String line = null;
                try {
                    line = br.readLine();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
                if (line == null) {
                    return null;
                }
                st = new StringTokenizer(line);
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(nextToken());
        }
        public long nextLong(){
            return Long.parseLong(nextToken());
        }
    }
}

Measured memory_bytes: 32664
import java.util.Scanner;

public class Main {

	public static Scanner scanner = new Scanner(System.in);

	public static void main(String[] args) {

		int a = input();
		int b = input();

		if (a < b) {

			System.out.println("a" + " < " + "b");

		} else if (b < a) {

			System.out.println("a" + " > " + "b");

		} else {

			System.out.println("a" + " == " + "b");

		}

		close();

	}

	public static int input() {

		return scanner.nextInt();

	}

	public static void close() {

		if (scanner != null) {

			scanner.close();

		}
	}
}

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

n, a, b = map(int, input().split())
R = [int(input()) for i in range(n)]

l = 0
r = 10 ** 9 + 1


# x 回で全滅できるか否か
def check(x):
    cnt = 0
    for ri in R:
        if ri - x * b > 0:
            cnt += (ri - x * b + a-b - 1) // (a-b)
    return cnt <= x

while True:
    if r - l <= 1:
        break
    mid = (l + r) // 2
    if check(mid):
        r = mid
    else:
        l = mid

if check(l):
    print(l)
else:
    print(r)


Measured memory_bytes: 13076
import math
N = int(input())
X = list(map(int, input().split()))
 
def sutamina(P, X):
    return (X-P)**2
  
sutamina_min = float('inf')
for i in range(100):
    sutamina_souwa = 0
    for k in X:
        sutamina_souwa += sutamina(i, k)
    if sutamina_souwa < sutamina_min:
        sutamina_min = sutamina_souwa

print(sutamina_min)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define in insert
#define PI 3.1415926535897932384626433832795
#define MOD 100000007
#define F first
#define S second
#define aLL(str) (str).begin(), (str).end()
#define IOS                  \
	ios::sync_with_stdio(0); \
	cin.tie(0);              \
	cout.tie(0)
#define ll long long
typedef vector<ll> vl;
typedef map<ll,ll> ml;
typedef vector<string> vs;
typedef vector<vector<int>> vvi;
ll i,j;
int main()
{IOS;
int t;
t=1;
while(t--)
{ll n,c1=0,c2=0,c3=0,c4=0;
cin>>n;
string s,s1="AC",s2="WA",s3="TLE",s4="RE";
for(i=0;i<n;i++)
{
    cin>>s;
    if(s.compare(s1)==0)c1++;
    else if(s.compare(s2)==0)c2++;
    else if(s.compare(s3) ==0)c3++;
    else c4++;
}
cout<<s1 <<" x "<<c1<<endl;
cout<<s2 <<" x "<<c2<<endl;
cout<<s3 <<" x "<<c3<<endl;
cout<<s4 <<" x "<<c4<<endl;
}
return 0;}



Measured memory_bytes: 3656
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <sstream>
#include <iomanip>
#include <map>
#define rep(i,n) for(int i = 0; i < n; i++)
#define rep1(i,n) for(int i = 1; i <= n; i++)
#define co(x) cout << x <<endl
#define cs(x) cout << x <<" "
#define ALL(a) (a).begin(),(a).end()
typedef long long ll;
using namespace std;
int mod = 1e9 + 7;

int main()
{
	int n;
	cin >> n;
	if (n % 2 == 0)co(0.5);
	else co(((double)(n + 1) / 2 / (double)n));
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define stoi stoll
using ll=long long;
using vi=vector<int>;
using pii=pair<int,int>;
#define ALL(c) begin(c),end(c)
#define RALL(c) rbegin(c),rend(c)
#define ITR(i,b,e) for(auto i=(b);i!=(e);++i)
#define FORE(x,c) for(auto &&x:c)
#define REPF(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define REP(i,n) REPF(i,0,n)
#define REPR(i,n) for(int i=(int)(n);i>=0;--i)
#define SZ(c) ((int)c.size())
#define CONTAIN(c,x) (c.find(x)!=end(c))
#define INSEG(l,x,r) ((l)<=(x)&&(x)<(r))
#define dump(...)
#define pb push_back
#define _ 0
const signed INF_=1001001001; const long long INF=1001001001001001001LL;
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) {
    ITR(i,begin(v),end(v))os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> istream& operator>>(istream &is,vector<T> &v) {
    ITR(i,begin(v),end(v)) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
    is>>p.first>>p.second;return is;}
template<class T, class U> bool chmax(T &a,const U &b){return a<b?a=b,1:0;}
template<class T, class U> bool chmin(T &a,const U &b){return a>b?a=b,1:0;}
template <class T> void PSUM(T& c) {partial_sum(begin(c), end(c), begin(c));}
template<class T> using heap=priority_queue<T,vector<T>,greater<T>>;
struct before_main_function {
    before_main_function() {
        cin.tie(0); ios::sync_with_stdio(false);
        cout << setprecision(15) << fixed;
        // #define endl "\n"
    }
} before_main_function;
//------------------8<------------------------------------8<--------------------

signed main() {
    int r, s, p;
    cin >> r >> s >> p;
    vector<int> d(p);
    REP(k, p) {
        int i, j;
        cin >> i >> j;
        i--; j--;
        if (j >= s) j++;
        d[k] = abs(i - r) + abs(j - s);
    }
    sort(RALL(d));
    int ans = 0;
    REP(i, p) {
        chmax(ans, d[i] + i);
    }
    cout << ans << endl;
    return (0^_^0);
}



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

int n, a;
list<int> b;

int main() {
    cin >> n;

    for (int i = 0; i < n; i++) {
        cin >> a;
        if (i % 2 == 0) {
            b.push_back(a);
        }
        else {
            b.push_front(a);
        }
    }

    if (n % 2 != 0) {
        reverse(b.begin(), b.end());
    }

    list<int>::iterator itr;
    for (itr = b.begin(); itr != b.end(); itr++) {
        cout << *itr << " ";
    }

    cout << endl;
}


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

int main() {
  int N = 0, ans = 0, n = 0;
  cin >> N ;
  
  n = N;
  do {
    ans += n%10;
    n /= 10;
  } while (n > 10);
  ans += n;
  
  if (N%ans == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#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++)


int main() {
  int n;
  cin >> n;
  if(n>=2000){
    cout<<1<<endl;
  }
  else{
    bool ch=false;
    rep(j,21){
      if(100*j<=n&&105*j>=n){
        ch=true;
      }
    }    
    cout<<ch<<endl;    
  }
}

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

int main() {
	long long int n[10],i,j,a,b;
	while (cin >> a) {
		for (j=1000000000,b=0;j>0;j/=10,b++) { n[b]=a/j; a-=j*n[b];}
		for (i=0;i<9;i++) for (j=0;j<9-i;j++) n[j]=(n[j]+n[j+1]) % 10;
		cout << n[0] << endl;
	}
	return 0;
}

Measured memory_bytes: 1156