akhauriyash/Code-Regression huggingface dataset:
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define INF 0x6fffffff
#define INFL 0x6fffffffffffffffLL

int main() {
	ll		a,b,c,h,i,j,k,l,m,n,x,y,H,W,w;
	ll		ans = 0;
	string	s;
	cin >> H >> W >> h >> w;

	ans = (H-h) * (W-w);
	//vector<ll>	aa(n);
	//for(i=0;i<n;i++) cin >> aa[i];
	//vector<ll>	dp(n+1,INFL);
	//vector<vector<ll>>	dp2(x , vector<ll>(y,INFL));

	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3600
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;

int main(){
  int H, W;
  cin >> H >> W;
  char a[H][W];
  for(int i = 0; i < H; i++){
    for(int j = 0; j < W; j++){
      cin >> a[i][j];
    }
  }

  for(int i = 0; i < H; i++){
    for(int j = 0; j < W; j++){
      if(i - 1 >= 0 && j + 1 < W){
        if(a[i][j] == '#' && a[i - 1][j + 1] == '#'){
          cout << "Impossible" << endl;
          return 0;
        }
      }
    }
  }

  cout << "Possible" << endl;
  return 0;
}


Measured memory_bytes: 256
using System;
class Program
{
  static void Main(string[] args)
  {
    // スペース区切りの整数の入力
    string[] input = Console.ReadLine().Split(' ');
    int _N = int.Parse(input[0]);

    int digit = (_N == 0) ? 1 : ((int)Math.Log10(_N) + 1);
    
    int num = 0;
    for (int i=0;i<digit;i++){
      num += (_N % (int)Math.Pow(10,i+1) ) / (int)Math.Pow(10,i);
    }

    if (_N % num==0){
        Console.WriteLine("Yes");
      }else{
        Console.WriteLine("No");
      }
    
  }
}

Measured memory_bytes: 13140
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp> // Common file
//#include <ext/pb_ds/tree_policy.hpp>
//#include <functional> // for less
#define PI acos(-1.0)
#define eps 1e-9
#define ll long long
#define ull unsigned long long
#define nl printf("\n")
#define sf scanf
#define pf printf
#define INF (ll)1e15
#define mod 1000000007

///#define isValid(n,m,nx,ny)nx>=0&&nx<n&&ny>=0&&ny<m
///int kx[]={1, 1, -1, -1, 2, 2, -2, -2}; //knight moves
///int ky[]={2,-2,  2, -2, 1,-1,  1, -1}; //knight moves
///int dx[]={1,-1,0,0,1,-1,1,-1};//eight direction
///int dy[]={0,0,1,-1,1,-1,-1,1};//eight direction
 
///using namespace __gnu_pbds;
using namespace std;
 
///inline double toRad(double deg){return deg*PI/180;}
///inline double toDeg(double rad){return rad*180/PI;}
///typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> new_data_set;
 
const int S=3123;
bool sugar_can[S+5];
bool water_can[S+5];

bool Is_max(int sugar,int water_sugar,int s,int ws)
{
    if(sugar*ws<s*water_sugar)return true;
    return false;
}

int main()
{
    #ifndef ONLINE_JUDGE
    //freopen("input.txt","r",stdin);
    #endif
    int a,b,c,d,e,f;
    while(sf("%d %d %d %d %d %d",&a,&b,&c,&d,&e,&f)==6)
    {
        memset(sugar_can,false,sizeof sugar_can);
        memset(water_can,false,sizeof water_can);
        for(int i=0;i<=f;i++)
        {
            for(int j=0;j<=f;j++)
            {
                if(i*c+j*d<=f)sugar_can[i*c+j*d]=true;
                if(i*100*a+j*100*b<=f)water_can[i*100*a+j*100*b]=true;
            }
        }

        int water_sugar=100*a,sugar=0;
        for(int w=100*a;w<=f;w++)
        {
            if(water_can[w])
            {
                int s=(e*w)/100;
                for(int i=s;i>=0;i--)
                {
                    if(sugar_can[i] && w+i<=f)
                    {
                        if(Is_max(sugar,water_sugar,i,w+i))
                        {
                            water_sugar=w+i;
                            sugar=i;
                        }
                    }
                }
            }
        }
        pf("%d %d\n",water_sugar,sugar);
    }
    return 0;
}
 









 




























Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for (int i=0;i<(n);i++)
#define ALL(a) (a).begin(),(a).end()
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define ll long long
#define ull unsigned long long
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

using namespace std;

int main(){
  string s;
  int isleft,c;
  while(cin>>s){
    if(s[0]=='#')break;
    else if(s[0]-'a'<7 ||( s[0]-'a'>15&&s[0]!='u'&&s[0]!='y'))isleft=1;
    else isleft=0;
    c=0;
    REP(i,s.size()){
      if(s[i]-'a'<7 ||( s[i]-'a'>15&&s[i]!='u'&&s[i]!='y')){
	if(!isleft){
	  c++;
	  isleft++;
	}
      }else{
	if(isleft){
	  c++;
	  isleft--;
	}
      }
    }  
    cout << c << endl;
  }
  
  return 0;
}

Measured memory_bytes: 3036
#include <bits/stdc++.h>
using namespace std;
 
int main()
{
	string s, t;
	cin >> s >> t;
	map<char, char> S, T;
	for (int i = 0; i < s.size(); ++i)
	{
		if (S.count(s[i]) == 0)
		{
			S[s[i]] = t[i];
		}
		if (T.count(t[i]) == 0)
		{
			T[t[i]] = s[i];
		}
		if(S[s[i]] != t[i] || T[t[i]] != s[i])
		{
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 776
import java.util.Scanner;

public class Main {
  	public static void main(String args[]){
		
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int W = sc.nextInt();
		
		long[][] dp = new long[N+1][W+1];
		long ans = 0;
		
		for(int i=0;i<N+1;i++){
			for(int j=0;j<W+1;j++){
				dp[i][j] = -1;
			}
		}
		dp[0][0] = 0;
		
		for(int i=1;i<=N;i++){
			int w = sc.nextInt();
			long v = sc.nextLong();
			
			for(int j=0;j<=W;j++){
				
				if(dp[i-1][j] == -1){
					continue;
				}
				
				for(int k=0;k<=1;k++){
					if(j+w*k <= W){
						dp[i][j+w*k] = chmax(dp[i][j+w*k],dp[i-1][j]+v*k);
						ans = chmax(ans, dp[i][j+w*k]);
					}
				}				
			}
		}
		
		System.out.println(ans);
	}

	public static long chmax(long a, long b){
		
		if(a >= b){
			return a;
		}else{
			return b;
		}
	}
	
}

Measured memory_bytes: 127572
n = int(input())
p = -10 ** 10
rmin= 10 ** 10
while n > 0:
    r = int(input())
    if n == 0:
        rmax = r
    else:
        if r - rmin > p:
            p = r - rmin
        if r < rmin:
            rmin = r
    n -= 1
print(p)

Measured memory_bytes: 7684
#!usr/bin/env python3
from collections import defaultdict, deque, Counter, OrderedDict
import collections, heapq, itertools, bisect
import math, fractions
import sys, copy

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI1(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline().rstrip())
def LS(): return [list(x) for x in sys.stdin.readline().split()]
def S(): return list(sys.stdin.readline().rstrip())
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
dire = [[1, 0], [0, 1], [-1, 0], [0, -1]]
dire8 = [[1, 0], [1, 1], [0, 1], [-1, 1], [-1, 0], [-1, -1], [0, -1], [1, -1]]
MOD = 1000000007

def main():
    N = I()
    A = sorted(LI(), reverse=True)
    q = []
    ans = A[0]
    q.append((-min(A[0], A[1]), A[0], A[1]))
    q.append((-min(A[0], A[1]), A[0], A[1]))


    for i in range(2, N):
        (minus_x, left, right) = heapq.heappop(q)
        ans += -minus_x
        heapq.heappush(q, (-min(left, A[i]), left, A[i]))
        heapq.heappush(q, (-min(right, A[i]), A[i], right))

    print(ans)


if __name__ == '__main__':
    main()

Measured memory_bytes: 143252
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <string.h>
using namespace std;

int main() {
	int a, b, anna[5001], bruno[5001];
	cin >> a >> b;
	for(int i = 0; i < a; ++i)
		scanf("%d", &anna[i]);
	for(int i = 0; i < b; ++i)
		scanf("%d", &bruno[i]);
	
	int ans = 0;
	for(int i = 0; i < b; ++i){
		int n = i, res = 0;
		for(int j = 0; j < a; ++j){
			if(anna[j] == bruno[n]){
				res++;
				n++;
			}
		}
		ans = max(ans, res);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const ll M=1e9+7;


int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll r;cin>>r;
	float pi=22/7.0;
	pi=2.0*pi*r;
	cout<<pi;

	
	return 0;
} 

Measured memory_bytes: 3792
"use strict";
function Main(input) {
  input = input.split("\n");
  const num = input.shift();

  let arr = [];
  for (let i = 0; i < num; i++) {
    if (arr.indexOf(parseInt(input[i])) == -1) {
      arr.push(parseInt(input[i]));
    }
  }
  console.log(arr.length);
}

Main(require("fs").readFileSync("/dev/stdin", "utf-8"));


Measured memory_bytes: 11468
#include <iostream>

using i64 = long long;

const int N = 500000 + 7;
const i64 MOD = 998244353;

int n, m;
i64 fac[N], ifc[N], inv[N];
i64 ans = 0;

i64 pow(i64 a, i64 k) {
	i64 t = 1;
	for (; k; a = a * a % MOD, k >>= 1) if (k & 1) t = t * a % MOD;
	return t;
}
i64 binom(i64 n, i64 m) {
	return n < m || m < 0 ? 0 : fac[n] * ifc[m] % MOD * ifc[n - m] % MOD;
}

int main() {
//	freopen("code.in", "r", stdin);
//	freopen("code.out", "w", stdout);
	
	scanf("%d%d", &n, &m);
	if (n > m) std::swap(n, m);
	inv[1] = 1;
	for (int i = 2; i <= m; ++i)
		inv[i] = -MOD / i * inv[MOD % i] % MOD;
	for (int i = fac[0] = ifc[0] = 1; i <= m; ++i)
		fac[i] = fac[i - 1] * i % MOD, ifc[i] = ifc[i - 1] * inv[i] % MOD;
	for (int i = 0; i <= n; ++i)
		ans += (i & 1 ? -1 : 1) * binom(n, i) * binom(m, i) % MOD * fac[i] % MOD
			* pow(m + 1, n - i) % MOD * pow(n + 1, m - i) % MOD;
	ans = (ans % MOD + MOD) % MOD;
	printf("%lld", ans);
	return 0;
}


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

using namespace std;

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

  vector<int> d;
  vector<long long> mnum(n);
  vector<long long> cnum(n);
  vector<long long> mcnum(n);

  for(int i = 0;i < n;i++){
    if(i!=0){
      mnum[i] = mnum[i-1];
      mcnum[i] = mcnum[i-1];
      cnum[i] = cnum[i-1];
    }
    if(s[i] == 'D')d.push_back(i);
    if(s[i] == 'M')mnum[i] ++;
    if(s[i] == 'C'){
      mcnum[i] += mnum[i];
      cnum[i]++;
    }
  }
  int q;
  cin >> q;
  while(q--){
    int k;
    cin >> k;
    long long ret = 0;
    for(int i = 0;i < d.size();i++){
      ret += mcnum[min(d[i]+k-1,n-1)] - mcnum[d[i]] - (cnum[min(d[i]+k-1,n-1)] - cnum[d[i]])*mnum[d[i]];
    }
    cout << ret << endl;
  }
}


Measured memory_bytes: 30460
n = int(input())
l = [list(map(int, input().split())) for _ in range(2)]

r1 = []
tmp1 = 0
for i in range(n):
    rui1 = l[0][i] + tmp1
    r1.append(rui1)
    tmp1 = rui1

r2 = [0] * n
tmp2 = 0
for i in reversed(range(n)):
    rui2 = l[1][i] + tmp2
    r2[i] = rui2
    tmp2 = rui2

max_cnt = 0
for i in range(n):
    cnt = r1[i] + r2[i]
    max_cnt = max(max_cnt, cnt)
print(max_cnt)

Measured memory_bytes: 9156
N, M = map(int, input().split())
ABs = []
for i in range(M):
  A, B = map(int, input().split())
  A, B = A-1, B-1
  ABs.append((A, B))
UF = list(range(N))
Ns = [1]*N
def par(m):
  s = []
  r = UF[m]
  while r != m:
    s.append(m)
    m = r
    r = UF[m]
  for i in s:
    UF[i] = r
  return r
def unite(m, n):
  i = par(m)
  j = par(n)
  UF[j] = i
  Ns[i] = Ns[j] = Ns[i]+Ns[j]
def size(m):
  return Ns[par(m)]
r = N*(N-1)//2
rs = [r]
for A, B in reversed(ABs):
  if par(A) == par(B):
    rs.append(r)
    continue
  sA = size(A)
  sB = size(B)
  unite(A, B)
  r -= sA*sB
  rs.append(r)
rs.pop()
for r in reversed(rs):
  print(r)


Measured memory_bytes: 28260
#include <cstdio>

using namespace std;

void cut(int a[], int p, int c)
{
    int b[50];

    for (int i = 0; i < c; ++i)
        b[i] = a[p - 1 + i];
    for (int i = 0; i < p - 1; ++i)
        a[p - 1 + c - 1 - i] = a[p - 1 - 1 - i];
    for (int i = 0; i < c; ++i)
        a[i] = b[i];
}

int main()
{
    for (;;) {
        int n, r, a[50];

        scanf("%d %d", &n, &r);
        if (n == 0 && r == 0)
            break;

        for (int i = 0; i < n; ++i)
            a[i] = n - i;

        for (int i = 0; i < r; ++i) {
            int p, c;

            scanf("%d %d", &p, &c);
            cut(a, p, c);
        }

        printf("%d\n", a[0]);
    }

    return 0;
}

Measured memory_bytes: 1028
import java.util.*;
public class Main{
    public static void main(String[] args){
	new Main().run();
    }
    Scanner sc = new Scanner(System.in);

    int a, b, c;
    void run(){
	int n = sc.nextInt();
	while(n-- > 0){
	    a = sc.nextInt();
	    b = sc.nextInt();
	    c = sc.nextInt();
	    a = a*a;
	    b = b*b;
	    c = c*c;
	    if(a==(b+c) || b==(a+c) || c==(a+b))
		System.out.println("YES");
	    else System.out.println("NO");
	}
    }
}

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

const int N = 200005;

int n, m;
int a[N];

int solve() {
  int x;
  scanf("%d", &x);

  if (x >= 30) printf("Yes\n");
  else printf("No\n");
  return 0;
}

int main() {
  int t = 1;
  // scanf("%d", &t);
  while (t--) solve();
  return 0;
}


Measured memory_bytes: 3656
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <string>
#include <utility>
#include <vector>
#include <algorithm>

using namespace std;

int main(int argc, char *argv[]) {
  // read inputs
  int N;
  vector<pair<string, pair<int, int>>> pairs;
  cin >> N;
  // printf("%d\n", N);
  for (int i = 0; i < N; i++) {
    string cs;
    int p;
    cin >> cs >> p;
    pairs.push_back(make_pair(cs, make_pair(-p, i + 1)));  // NOTE : negation
    // cout << cs << " " << p << endl;
  }

  // solve
  sort(pairs.begin(), pairs.end());
  for (const pair<string, pair<int, int>> &pair : pairs) {
    cout << pair.second.second << "\n";
  }
  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    long long w, h, x, y, r;
    cin >> w >> h >> x >> y >> r;
    
    if(x >= r && x <= w - r && y >= r && y <= h - r){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}


Measured memory_bytes: 3096
sx, sy, tx, ty = map(int, input().split(" "))

x1 = tx - sx
y1 = ty - sy

l1 = ["U"] * y1 + ["R"] * x1 + ["D"] * y1 + ["L"] * x1
l2 = ["L"] * 1 + ["U"] * (y1 + 1) + ["R"] * (x1 + 1) + ["D"] * 1 + \
     ["R"] * 1 + ["D"] * (y1 + 1) + ["L"] * (x1 + 1) + ["U"] * 1

print("".join(l1 + l2))


Measured memory_bytes: 3316
#include<stdio.h>

int main(void)
{
    int i, x;
    
    for ( i=1; 1; ++i) {
        scanf("%d", &x);
        
        if ( x == 0)
            break;
        printf("Case %d: %d\n", i, x);
    }
    return 0;
}


Measured memory_bytes: 2056
#include<iostream>
#include <stdlib.h>
#include <string.h>
#include <math.h>

using namespace std;
int main(){
    int n, K, i, count;
    int h[1000000];
    cin >> n >> K;
    for(i = 0; i < n; i++){
        cin >> h[i];
    }

    for(i = 0; i < n; i++){
        if(h[i] >= K){
            count++;
        }
    }

    cout << count << endl;

    return 0;
}

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

int main(){

    // omajinai
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    // omajinai

    int n;
    cin >> n;
    vector<int> a(n+2);
    for(int i = 1;i < n+1;i ++){
        cin >> a.at(i);
    }
    int sum = 0;

    for(int i = 1;i < n+2;i ++){
        sum += abs(a.at(i)-a.at(i-1));
    }

    for(int i = 1;i < n+1;i ++){
        cout << sum - abs(a.at(i)-a.at(i-1)) -abs(a.at(i+1)-a.at(i)) +abs(a.at(i+1)-a.at(i-1)) << endl;
    }
}

Measured memory_bytes: 1664
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define set_bits(a) __builtin_popcount(a)
#define pb push_back
#define pf push_front
#define mod 1000000007
#define M 998244353
#define fi first
#define se second
#define endl '\n'
#define INF 1e18
#define PI 3.14159265358979323846
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);


int main()
{
    ll n,i;
    cin>>n;
    ll arr[n+1];
    unordered_map<ll,ll>mp,m;
    for(i=1;i<=n;i++)
    {
       cin>>arr[i];
       mp[arr[i]+i]++;
       m[i-arr[i]]++;
    }

    ll ans=0;
    for(i=1;i<=n;i++)
    {
        ll p = i+arr[i];
        if(m.find(p)!=m.end())
        {
            ans += m[p];
        }
    }

    cout<<ans<<endl;
}


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

#define SORT(c) sort((c).begin(), (c).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
#define ANS(ans) cout << (ans) << endl;
#define UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
typedef vector<int> VI;
typedef pair<int, int> P;

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

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

    if(n==m){
      ANS("Yes");
    } else {
      ANS("No");
    }
    return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize(2)
#include <bits/stdc++.h>
using namespace std;
#define int long long
int a,b,c;

signed main()
{
    cin>>a>>b>>c;
    if(c-a-b < 0)
    {
        puts("No");
    }
    else
    {
        if(a*b*4 < (c-a-b)*(c-a-b))
        {
            puts("Yes");
        }
        else puts("No");
    }
    return 0;
}

Measured memory_bytes: 256
def cd(a,b,arr)
  a < b ? (c = a) : (c = b)
  (1..c).each do |i|
    arr << i if a % i == 0 && b % i == 0
  end
end

a,b,k = gets.chomp.split.map(&:to_i)
arr = []
cd(a,b,arr)

puts arr[-k]

Measured memory_bytes: 1788
#include <cstdio>
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <cmath>
#include <iomanip>
#include <deque>
#include <queue>
#include <unordered_map>
#include <stack>
#include <bitset>
#include <cstdlib>
#include <sstream>
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)

using namespace std;
ll pow(ll N, ll P){
    if(P==0) return 1;
    if(P%2==0){
        ll t = pow(N, P/2);
        return t*t;
    }
    return N * pow(N, P-1);
}
ll modpow(ll N, ll P,ll k){
    if(P==0) return 1;
    if(P%2==0){
        ll t = modpow(N, P/2,k)%k;
        return t*t%k;
    }
    return N * modpow(N, P-1,k)%k;
}
ll modkai(ll n,ll m,ll k){//n*(n-1)*(n-2)*...(m+1)%k
    if(n == m)return 1;
    return modkai(n-1,m,k)*n%k;
}
ll mod_cnb(ll n,ll m,ll k){//nCm%k,kは十分大きい素数
  int m_=modkai(m,0,k);
  return modkai(n,n-m,k)*modpow(m_,k-2,k)%k;
}
ll gcd(ll n,ll m){
    ll n_ = max(n,m);
    ll m_ = min(n,m);
    if(n_%m_ == 0)return m_;
    return gcd(m_,n_%m_);
}
ll lcm(ll n,ll m){
    return n*m/gcd(n,m);
}

int main(){
    ll n,k;cin>>n>>k;
    string s;cin>>s;
    ll ans=0;
    bool flag=0;
    vector<ll> st,ls;
    if(s[0]=='0')st.push_back(0);
    rep(i,n){
        if(s[i]=='1'&&s[i+1]=='0'){
            st.push_back(i+1);
        }
        if(s[i]=='0'&&s[i+1]=='1'){
            ls.push_back(i);
        }
    }
    if(s[n-1]=='0')ls.push_back(n-1);
    if(st.size()!=ls.size()){
        cout<<"error"<<endl;
        return 0;
    }
////////////////////////////////
    if(st.size()<=k){cout<<n<<endl;return 0;}

    ans=st[k];
    for(int i=0;i+k+1<st.size();i++){
        ans=max(ans,st[i+k+1]-ls[i]-1);
    }
    ans=max(ans,n-1-ls[ls.size()-k-1]);
    cout<<ans<<endl;

}

Measured memory_bytes: 1404
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <string>
#include <cmath>

using namespace std;

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

	long long d2 = 1LL * d * d;

	int ans = 0;
	long long x, y;
	for (int i = 0; i < n; i++) {
		cin >> x >> y;
		if (x*x + y*y <= d2) {
			ans++;
		}
	}

	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3176
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = (a); i < n; i++)
#define print(x) cout << x << endl;
using namespace std;
typedef long long ll;

int main()
{
    int N;
    cin >> N;
    ll H[N];
    rep(i, 0, N) cin >> H[i];

    bool ok = true;
    H[0]--;
    ll max_n = H[0];

    rep(i, 0, N-1) {
        if (max_n > H[i + 1] || H[i] - H[i + 1] > 1) {
            ok = false;
            break;
        }
        H[i]--;
        max_n = max(max_n, H[i]);
    }

    if (ok) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 1024
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC optimize(3)
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC target("sse3","sse2","sse")
#pragma GCC target("avx","sse4","sse4.1","sse4.2","ssse3")
#pragma GCC target("f16c")
#pragma GCC optimize("inline","fast-math","unroll-loops","no-stack-protector")
#pragma GCC diagnostic error "-fwhole-program"
#pragma GCC diagnostic error "-fcse-skip-blocks"
#pragma GCC diagnostic error "-funsafe-loop-optimizations"
#pragma GCC diagnostic error "-std=c++14"
#include "bits/stdc++.h"
//#include "ext/pb_ds/tree_policy.hpp"
//#include "ext/pb_ds/assoc_container.hpp"
#define PB push_back
#define PF push_front
#define LB lower_bound
#define UB upper_bound
#define fr(x) freopen(x,"r",stdin)
#define fw(x) freopen(x,"w",stdout)
#define iout(x) printf("%d\n",x)
#define lout(x) printf("%lld\n",x)
#define REP(x,l,u) for(ll x = l;x<u;x++)
#define RREP(x,l,u) for(ll x = l;x>=u;x--)
#define complete_unique(a) a.erase(unique(a.begin(),a.end()),a.end())
#define mst(x,a) memset(x,a,sizeof(x))
#define all(a) a.begin(),a.end()
#define PII pair<int,int>
#define PLL pair<ll,ll>
#define MP make_pair
#define sqr(x) ((x)*(x))
#define lowbit(x) (x&(-x))
#define lson (ind<<1)
#define rson (ind<<1|1)
#define se second
#define fi first
#define dbg(x) cerr<<#x<<" = "<<(x)<<endl;
#define sz(x) ((int)x.size())
#define EX0 exit(0);

typedef  long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ld;
using namespace std;
typedef vector<ll> VLL;
typedef vector<int> VI;
const int block_size = 320;
typedef complex<ll> point;
const ll mod = 1e9+7;
const ll inf = 1e9+7;
const ld eps = 1e-9;
const db PI = atan(1)*4;
template<typename T>
inline int sign(const T&a) {
    if(a<0)return -1;
    if(a>0)return 1;
    return 0;
}

template<typename T,typename S>inline bool upmin(T&a,const S&b){return a>b?a=b,1:0;}
template<typename T,typename S>inline bool upmax(T&a,const S&b){return a<b?a=b,1:0;}

template<typename T> inline void in(T &x) {
    x = 0;
    T f = 1;
    char ch = getchar();
    while (!isdigit(ch)) {
        if (ch == '-') f = -1;
        ch = getchar();
    }
    while (isdigit(ch))  {
        x = x * 10 + ch - '0';
        ch = getchar();
    }
    x *= f;
}

ll twop(int x) {
    return 1LL<<x;
}

template<typename A,typename B > inline void in(A&x,B&y) {
    in(x);
    in(y);
}
template<typename A,typename B,typename C>inline void in(A&x,B&y,C&z) {
    in(x);
    in(y);
    in(z);
}
template<typename A,typename B,typename C,typename D> inline void in(A&x,B&y,C&z,D&d) {
    in(x);
    in(y);
    in(z);
    in(d);
}

namespace SOLVE {
    void main(){
    }
}


int main() {
//#ifndef ONLINE_JUDGE
//    fr("/Users/zhangqingchuan/Desktop/cp/cp/input.txt");
//    fw("/Users/zhangqingchuan/Desktop/cp/cp/output.txt");
//#endif
    
    
    
    
    int n;
    int cnt = 0;
    cin>>n;
    REP(i,0,n){
        int c;in(c);
        cnt+=c%2;
    }
    cnt%=2;
    if(cnt)cout<<"NO";
    else cout<<"YES";
    
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void){
    int N,m,i,j,minj,count,x;
    scanf("%d",&N);
    m=N-1;
    int a[m];
    scanf("%d",&a[0]);
    for(N=1;N<=m;N++){
        scanf(" %d",&a[N]);
    }
    count=0;
    for(i=0;i<N-1;i++){
        minj=i;
        for(j=i;j<=N-1;j++){
            if(a[j]<a[minj]){
                minj=j;
            }
        }
        j=i;
        x=a[j];
        a[j]=a[minj];
        a[minj]=x;
        if(minj!=i){
            count++;
        }
    }
    printf("%d",a[0]);
    for(N=1;N<=m;N++){
        printf(" %d",a[N]);
    }
    printf("\n%d\n",count);
    return 0;
}


Measured memory_bytes: 2100
import java.util.*;

class Main {

	public static void main(String args[]){
		Scanner in = new Scanner(System.in);
		for(;;){
			int n = in.nextInt(), m = in.nextInt();
			if(n==0 && m==0) break;
			int as[] = new int[n], bs[] = new int[m];
			for(int i=0; i<n; i++) as[i] = in.nextInt();
			for(int i=0; i<m; i++) bs[i] = in.nextInt();
			int totalA=0, totalB=0;
			int a=-1, b=-1, s=1<<29;
			for(int i=0; i<n; i++) totalA += as[i];
			for(int i=0; i<m; i++) totalB += bs[i];
			for(int i=0; i<n; i++){
				for(int j=0; j<m; j++){
					if(as[i] + bs[j] < s && totalA - as[i] + bs[j] == totalB - bs[j] + as[i]){
						s = as[i] + bs[j];
						a = as[i];
						b = bs[j];
					}
				}
			}
			if(a<0) System.out.println(-1);
			else System.out.println(a + " " + b);
		}
	}
	
}

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

int main(){
  int D,N;
  cin >> D >> N;
  if(D==0&&N!=100){
    cout << N << endl;
  }
  else if(D==0&&N==100){cout << N+1 << endl;}
  else if(D==1&&N!=100){
    cout << N*100 << endl;
  }
  else if(D==1&&N==100){cout << N*100+100 << endl;}
  else if(D==2&&N!=100){
    cout << N*10000 << endl;
  }
  else if(D==2&&N==100){cout << N*10000+10000 <<endl;}
  





}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;

int main() {
    
	long long x;
	cin >> x;
	long long f = -1;
	long long s = -1;
	for (long long i=1; i*i <= x; i++) {
		if (x % i == 0) {
			f = i;
			s = x / i;
		}
	}
	cout << f-1 + s-1 << endl;
	
}


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

using namespace std;

const int N = 1120;
const int K = 14;

int prime[N];
bool is_prime[N+1];

int sieve(){
  int p =0;
  for(int i=0;i<=N;i++) is_prime[i] = true;
  is_prime[0] = is_prime[1] = false;
  for(int i=2;i<=N;i++){
    if(is_prime[i]){
      prime[p++] = i;
      for(int j=2*i;j<=N;j+=i) is_prime[j] = false;
    }
  }
  return p;
}
//187

main(){
  int size = sieve();
  int dp[K+1][N+1];
  fill(dp[0], dp[K+1], -1);
  dp[0][0] = 1;
  for(int k=0;k<size;k++){
    for(int i=K-1;i>=0;i--){
      for(int j=N;j>=0;j--){
	if(dp[i][j]!=-1){
	  if(j+prime[k]>N) continue;
	  int &tmp = dp[i+1][j+prime[k]];
	  if(tmp == -1){
	    tmp = dp[i][j];
	  }else{
	    tmp += dp[i][j];
	  }
	}
      }
    }
  }
  int n, k;
  while(cin >> n >> k){
    if(n==0 && k==0) break;
    if(dp[k][n] == -1) cout << 0 << endl;
    else cout << dp[k][n] << endl;
  }
  return 0;
}

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

typedef long long ll;

int main(void)
{
    int h1,s1,h2,s2;
    cin>>h1>>s1>>h2>>s2;

    while(1)
    {
        h2 = h2 - s1;
        if(h2 <= 0)
            break;
        h1 = h1 - s2;
        if(h1 <= 0)
            break;
    }
    if(h2 <= 0)
        cout<<"Yes\n";
    else
        cout<<"No\n";

    return 0;
}


Measured memory_bytes: 3620
#include <stdio.h>

int main() 
{
	int i, k = 0;
	double h,max,min,arr[50] = { 0 };

	while (scanf("%lf", &h) != EOF)
	{
		arr[k] = h;
		++k;
	}

	max = arr[0];
	min = arr[1];

	for (i = 2; i < k; i++)
	{
		if (arr[i] > max)
		{
			max = arr[i];
		}
		if (arr[i] < min)
		{
			min = arr[i];
		}
	}

	printf("%.1f\n",(max-min));
	return 0;
}


Measured memory_bytes: 652
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <vector>
#include <algorithm>
#include <cmath>
#include <chrono>

using namespace std;

int main(int argc, const char * argv[]) {

    ios::sync_with_stdio(false);
    cin.tie(0);

    int n; cin >> n;
    
    int ans = 0;
    for (int i = 1; i <= n; i++) {
        if (to_string(i).size() % 2 == 1) ans++;
    }
    
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 892
#include<bits/stdc++.h>
#define rep(i, n) for(int i=0;i<(n);++i)
#define per(i, n) for(int i=(n)-1;i>=0;--i)
#define repa(i, n) for(int i=1;i<(n);++i)
#define foreach(i, n) for(auto &i:(n))
#define pii pair<int, int>
#define pll pair<long long, long long>
#define all(x) (x).begin(), (x).end()
#define bit(x) (1ll << (x))
using namespace std;
using ll = long long;
//const ll MOD = (ll)1e9+7;
//const ll MOD = 998244353;
const ll MOD = 924844033;
const int INF = (ll)1e9+7;
const ll INFLL = (ll)1e18;
using namespace std;
template<class t>
using vvector = vector<vector<t>>;
template<class t>
using vvvector = vector<vector<vector<t>>>;
template<class t>
using priority_queuer = priority_queue<t, vector<t>, greater<t>>;
template<class t, class u> bool chmax(t &a, u b){if(a<b){a=b;return true;}return false;}
template<class t, class u> bool chmin(t &a, u b){if(a>b){a=b;return true;}return false;}

#ifdef DEBUG
#define OUTPUT(x) (output(x), outendl())
#else
#define OUTPUT(x) (void)0
#endif

ll modpow(ll x, ll b){
	ll res = 1;
	while(b){
		if(b&1)res = res * x % MOD;
		x = x * x % MOD;
		b>>=1;
	}
	return res;
}

ll modinv(ll x){
	return modpow(x, MOD-2);
}

bool was_output = false;
template<class t>
void output(t a){
	if(was_output)cout << " ";
	cout << a;
	was_output = true;
}
void outendl(){
	was_output = false;
	cout << endl;
}

//below here

int main(){
	int n;
	cin >> n;
	vector<complex<double>> town(n);
	foreach(i,town){
		int x,y;
		cin >> x >> y;
		i = complex<double>(x,y);
	}
	vector<int> line;
	rep(i,n){
		line.push_back(i);
	}
	double ans = 0;
	int time = 0;
	do{
		double sum = 0;
		rep(i,n-1){
			sum += abs(town[line[i+1]]-town[line[i]]);
		}
		++time;
		ans += sum;
	}while(next_permutation(all(line)));
	printf("%.10lf\n",ans/time);
	return 0;
}


Measured memory_bytes: 256
package main

import (
    "fmt"
)

func main() {
    var s, t string
    fmt.Scan(&s)
    fmt.Scan(&t)

    cnt := 0
    for i:=0; i<len(s); i++ {
        if s[i] != t[i] {
            cnt += 1
        }
    }
    fmt.Println(cnt)
}



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

typedef long long ll;
typedef unsigned long long llu;

int main(int argc, char *argv[]) {
  ll n;
  cin >> n;

  map<string, ll> m;
  map<string, ll> mcnt;
  for (ll i = 0; i < n; ++i) {
    string s;
    cin >> s;
    sort(s.begin(), s.end());

    if (m.count(s) > 0) {
      mcnt[s]++;
      if (mcnt[s] == 1) {
        m[s] = 1;
      } else {
        m[s] += mcnt[s];
      }
    } else {
      m[s] = 0;
      mcnt[s] = 0;
    }
  }

  ll ans = 0;
  for (auto itr = m.begin(); itr != m.end(); ++itr) {
    if (itr->second > 0) {
      ans += itr->second;
    }
  }

  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 22144
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <fstream>
#include <vector>
#include <queue>
#include <utility>
#include <cstring>
using namespace std;
typedef long long ll;

struct Order {
	string name;
	int c;
};

bool operator<(const Order& l, const Order& r) {
	if (l.name.size() != r.name.size()) return l.name.size() < r.name.size();
	return l.name < r.name;
}

int main() {
	int N;
	scanf("%d", &N);
	char name[9];
	int c;
	vector<Order> ords;
	for (int i = 0; i < N; ++i) {
		scanf("%s %d", name, &c);
		ords.push_back({string(name), c});
	}
	sort(ords.begin(), ords.end());
	int sum = 0;
	for (int i = 0; i < N; ++i) {
		if (i > 0 && ords[i].name != ords[i-1].name) {
			printf("%s %d\n", ords[i-1].name.c_str(), sum);
			sum = 0;
		}
		sum += ords[i].c;
	}
	printf("%s %d\n", ords.back().name.c_str(), sum);
}

Measured memory_bytes: 1692
#include<bits/stdc++.h>
#define EM 100000000
using namespace std;
using LL = long long;
using P = pair<LL, LL>;
LL LINF = 1e18;
int INF = 1e9;
LL mod = 1e9+7;
using vint = vector<int>;
using vLL = vector<LL>;
using vvint = vector<vector<int>>;
using vvLL = vector<vector<LL>>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
	int N;
	cin >> N;
	vint a(N), b(N), c(2*N, 0);
	vector<P>	ab(2*N);
	for(int i = 0;i < N;i++)	cin >> a[i];
	for(int i = 0;i < N;i++)	cin >> b[i];
	for(int i = 0;i < 2*N;i+=2){ab[i] = P(a[i/2], 1);ab[i+1] = P(b[i/2], 0);}
	sort(ab.begin(), ab.end());
	int d = 0;
	LL ans = 1;
	for(int i = 0;i < 2*N;i++){
		if(ab[i].second == 1){if(d < 0) ans *= -d;ans %= mod;d++;}
		else{if(d > 0) ans *= d;ans %= mod;d--;}
	}
	cout << ans << endl;
}

Measured memory_bytes: 4992
#include <iostream>
#include <climits>
#include <set>
#include <string>
#include <algorithm>
#include <vector>
#define MAX 1000000007


using namespace std;
#define ll long long
#define dbg if(1)
#define ISRANGE(val,lo,hi) ((lo<=val)&&(val<hi))



int main(){
    ll ans,r,g,b,n;
    ans=0;
    cin >>r>>g>>b>>n;
    for(int i=0;i*r<=n;i++){
        for(int j=0;j*g+i*r<=n;j++){
            if ((n-(j*g+i*r))%b==0)ans++;
        }
    }

    cout <<ans<<endl;

    return 0;

}

Measured memory_bytes: 256
# -*- coding:utf-8 -*-
if __name__ == "__main__":
    a, b, c, x, y = map(int, input().split())
    ans = float('inf')
    for tmp in range((10**5)+1):
        ans = min(ans, a*max(0, x-tmp)+b*max(0,y-tmp)+c*2*tmp)
    else:
        print(ans)

Measured memory_bytes: 2940
#include <cstdio>
#include <iostream>
using namespace std;
int N;
long long A[100001], sum;
long long gcd(long long a, long long b){
    if(a == 0) return b;
    if(b == 0) return a;
    return gcd(b, a%b);
}
int main(){
    scanf("%d", &N);
    for(int i = 0; i < N; ++i){
        scanf("%lld", &A[i]);
        sum += A[i];
    }
    if(N == 1){
        printf(N%2 ? "Second\n" : "First\n");
        return 0;
    }
    for(int parity = 0; true; parity ++){
        sum = 0;
        for(int i = 0; i < N; ++i) sum += A[i];
        if((sum - N) % 2){
            printf(parity % 2 ? "Second\n" : "First\n");
            return 0;
        }
        
        for(int i = 0; i < N; ++i)
            if(A[i] == 1){
                printf(parity % 2 ? "First\n": "Second\n");
                return 0;
            }
            
        int nodd = 0;
        for(int i = 0; i < N; ++i){
            if(A[i]%2) nodd++;
        }
        if(nodd != 1){
            printf(parity % 2 ? "First\n": "Second\n");
            return 0;
        }
        long long gd = A[0] - (A[0]%2);
        //printf("nodd is %d\n", nodd);
        //for(int i = 0; i < N; ++i) printf("%lld ", A[i]); printf("\n");
        for(int i = 1; i < N; ++i){
            if(A[i] % 2) gd = gcd(A[i] - 1, gd);
            else gd = gcd(A[i], gd);
        }
        for(int i = 0; i < N; ++i) A[i] /= gd;
    }
}
    


Measured memory_bytes: 1024
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int ma = sc.nextInt();
        int mb = sc.nextInt();
        HashMap<Integer, Integer> map = new HashMap<>();
        map.put(0, 0);
        for (int i = 0; i < n; i++) {
            HashMap<Integer, Integer> next = new HashMap<>(map);
            int a = sc.nextInt();
            int b = sc.nextInt();
            int c = sc.nextInt();
            for (Map.Entry<Integer, Integer> entry : map.entrySet()) {
                int key = entry.getKey() + a * 1000 + b;
                int value = entry.getValue() + c;
                if (next.containsKey(key)) {
                    if (next.get(key) > value) {
                        next.put(key, value);
                    }
                } else {
                    next.put(key, value);
                }
            }
            map = next;
        }
        int min = Integer.MAX_VALUE;
        
        for (int key = ma * 1000 + mb; key < 4000400; key += ma * 1000 + mb) {
            if (map.containsKey(key) && map.get(key) < min) {
                min = map.get(key);
            }
        }
        if (min == Integer.MAX_VALUE) {
            System.out.println(-1);
        } else {
            System.out.println(min);
        }
    }
}

Measured memory_bytes: 46116
a = list(map(int,input().split()))
for i in range(2):
  a = a + list(map(int,input().split()))
n = int(input())
b = []
for i in range(n):
  b.append(int(input()))
for i in range(len(a)):
  if a[i] in b:
    a[i] = 0

if a[0] == a[1] == a[2] ==0:
  print('Yes')
elif a[3] == a[4] == a[5] ==0:
  print('Yes')
elif a[6] == a[7] == a[8] == 0:
  print('Yes')
elif a[0] == a[3] == a[6] ==0:
  print('Yes')
elif a[1] == a[4] == a[7] == 0:
  print('Yes')
elif a[2] == a[5] == a[8] ==0:
  print('Yes')
elif a[0] == a[4] == a[8] ==0:
  print('Yes')
elif a[2] == a[4] == a[6] == 0:
  print('Yes')
else:
  print('No')

Measured memory_bytes: 3064
N, M, K = map(int, input().split())

A = list(map(int, input().split()))
B = list(map(int, input().split()))

a, b = [0], [0]
for i in range(N):
    a.append(a[i] + A[i])
for i in range(M):
    b.append(b[i] + B[i])

ans, j = 0, M
for i in range(N+1):
    if a[i] > K:
        break
    while b[j] > K - a[i]:
        j -= 1
    ans = max(ans, i + j)

print(ans)


Measured memory_bytes: 134260
import java.util.Arrays;
import java.util.Scanner;

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

    void solve(Scanner sc) {
        int n = sc.nextInt();
        int k = sc.nextInt();
        int min = Integer.MAX_VALUE;
        for (int i = 0; i < (1 << n); i++) {
            int tmp = 1;
            for (int j = 0; j < n; j++) {
                if (((i >> j) & 1) == 1) {
                    tmp *= 2;
                } else {
                    tmp += k;
                }
            }

            min = Math.min(min, tmp);
        }
        System.out.println(min);
    }
}

Measured memory_bytes: 20948
#include<iostream>

using namespace std;

int board[8][9];//y,xの順番

char data[10];

int isA(int x,int y){

	if(y==7 || x == 7){
		return 0;
	}
	if(board[y][x+1] == 1 && board[y+1][x+1] == 1 && board[y+1][x] == 1){
		return 1;
	}

	return 0;
}

int isB(int x,int y){
	if(y>=5){
		return 0;
	}
	else if(board[y+1][x]==1 && board[y+2][x] == 1 && board[y+3][x]==1){
		return 1;
	}

	return 0;
}

int isC(int x,int y){
	if(x>=5){
		return 0;
	}
	else if(board[y][x+1]==1 && board[y][x+2] == 1 && board[y][x+3]==1){
		return 1;
	}

	return 0;
}

int isD(int x,int y){
	if(y>=6 || x==0){
		return 0;
	}
	else if(board[y+1][x]==1 && board[y+2][x-1] == 1 && board[y+1][x-1]==1){
		return 1;
	}

	return 0;
}

int isE(int x,int y){
	if(x>=6 || y == 7){
		return 0;
	}
	else if(board[y][x+1]==1 && board[y+1][x+1] == 1 && board[y+1][x+2]==1){
		return 1;
	}

	return 0;
}

int isF(int x,int y){
	if(y>=6 || x==7){
		return 0;
	}
	else if(board[y+1][x]==1 && board[y+1][x+1] == 1 && board[y+2][x+1]==1){
		return 1;
	}

	return 0;
}

int isG(int x,int y){
	if(y==0 || x>=6){
		return 0;
	}
	else if(board[y][x+1]==1 && board[y-1][x+1] == 1 && board[y-1][x+2]==1){
		return 1;
	}

	return 0;
}

void dataChange(int i){
	for(int j=0;j<8;j++){
		board[i][j] = data[j] - '0';
	}
}

int main(){

	while(cin>>data){
		dataChange(0);

		for(int i=1;i<8;i++){
			cin>>data;
			dataChange(i);
		}

		for(int y=0;y<8;y++){
			for(int x=0;x<8;x++){
				if(board[y][x] == 1){
					if(isA(x,y) == 1){
						cout<<"A"<<endl;
					}
				}

				if(board[y][x] == 1){
					if(isB(x,y) == 1){
						cout<<"B"<<endl;
					}
				}
				if(board[y][x] == 1){
					if(isC(x,y) == 1){
						cout<<"C"<<endl;
					}
				}
				if(board[y][x] == 1){
					if(isD(x,y) == 1){
						cout<<"D"<<endl;
					}
				}
				if(board[y][x] == 1){
					if(isE(x,y) == 1){
						cout<<"E"<<endl;
					}
				}
				if(board[y][x] == 1){
					if(isF(x,y) == 1){
						cout<<"F"<<endl;
					}
				}
				if(board[y][x] == 1){
					if(isG(x,y) == 1){
						cout<<"G"<<endl;
					}
				}
			}
		}
	}

	return 0;
}

Measured memory_bytes: 1136
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     @hamayanhamayan0
　　　　／　　　＼　 　  |　|
　　　 /　　 /￣￣￣￣/　　|
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿
　 　　　＼/＿＿＿＿/　（u　⊃
---------------------------------------------------------------------------------------------------*/













const int MA = 1000001;
int N, A[201010];
int cnt[1010101];
bool ok[1010101];
//---------------------------------------------------------------------------------------------------
void _main() {
	cin >> N;
	rep(i, 0, N) cin >> A[i];

	rep(i, 0, N) cnt[A[i]]++;
	rep(x, 1, MA) ok[x] = true;
	rep(x, 1, MA) if(0 < cnt[x]) {
		if (1 < cnt[x]) ok[x] = false;
		for (int x2 = x * 2; x2 < MA; x2 += x) ok[x2] = false;
	}

	int ans = 0;
	rep(x, 1, MA) if (ok[x]) ans += cnt[x];
	cout << ans << endl;
}







Measured memory_bytes: 9220
#include <iostream>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>

using namespace std;
int A,B,C;
void dfs(const int n, const int a, const int b, const int c, const int count, int& ans, const vector<int>& l) {
  if (n<0) {
    if (a==0 || b==0 || c==0) return;
    ans = min(ans, abs(A-a) + abs(B-b) + abs(C-c) + count*10);
    return;
  }

  dfs(n-1,a,b,c,count,ans,l);
  dfs(n-1,a+l[n],b,c,(a>0? count+1 : count),ans,l);
  dfs(n-1,a,b+l[n],c,(b>0? count+1 : count),ans,l);
  dfs(n-1,a,b,c+l[n],(c>0? count+1 : count),ans,l);
}

int main() {
  int n;
  cin >> n >> A >> B >> C;
  vector<int> l(n);
  for (int i=0; i<n; i++) cin>>l[i];

  int ans = INT_MAX;
  dfs(n-1,0,0,0,0,ans,l);

  cout << ans << endl;
}

Measured memory_bytes: 256
import sys

ri = lambda: int(sys.stdin.readline())
rl = lambda: list(map(int, sys.stdin.readline().split()))

D = ri()
c = rl()
s = [rl() for _ in range(D)]
t = [ri() for _ in range(D)]

score = 0
li = [0] * 26
c_sum = sum(c)
d = 0
for i in t:
  li = [v+1 for v in li]
  li[i-1] = 0
  tmp = 0
  for cv, liv in zip(c, li):
      tmp += cv*liv
  score += s[d][i-1] - tmp
  print(score)
  d += 1
  

Measured memory_bytes: 68592
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

int main() {
    int a, b;
    cin >> a >> b;
    if (a * b % 2 == 0) {
        cout << "No" << endl;
    } else {
        cout << "Yes" << endl;
    }
}


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

using namespace std;

int Max = 1e9+7;

char mm[1001][1001];
long long int dp[1011][1011];
long long int mod = 1e9+7;

long long int get(int u, int v) {
    if (u < 0 || v < 0) return 0;
    if (u == 0 && v == 0)   return 1;
    if (dp[u][v] != -1) return dp[u][v];
    long long int ans = 0;
    if (u-1 >= 0 && mm[u-1][v] == '.')   ans = (ans + get(u-1, v))%mod;
    if (v-1 >= 0 && mm[u][v-1] == '.')   ans = (ans + get(u, v-1))%mod;
    dp[u][v] = ans;
    return ans;
}

int main(void) {
    int n, m;
    cin>>n>>m;
    for(int i = 0; i < n; ++i) {
        for (int j = 0; j < m; ++j) {
            cin>>mm[i][j];
        }
    }
    memset(dp, -1, sizeof(dp));
    cout<<get(n-1, m-1);
    return 0;
}



Measured memory_bytes: 9344
#include <algorithm>
#include <cassert>
#include <iostream>
#include <queue>
#include <tuple>
#include <utility>
#include <vector>

using namespace std;

void solve(int n, int k, vector<char> &cv) { cv[k-1] = cv[k-1] + 0x20; }

int main(int argc, char const *argv[]) {
  int n, k;
  vector<char> cv;
  char c;

  cin >> n;
  cin >> k;

  for (int i = 0; i < n; i++) {
    cin >> c;
    cv.push_back(c);
  }

  solve(n, k, cv);
  for (int i = 0; i < n; i++) {
    cout << cv[i];
  }

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll an[100010],am[100010];
int main()
{int a,b,c;
cin>>a>>b>>c;
if(b-a==c-b)
{ cout<<"YES"<<endl;
}
else
{cout<<"NO"<<endl;}
 return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define N 200005
using namespace std;
struct node {
	int id,x,y;
}ans[N],q[N],t[N];
struct syf {
	inline bool operator () (node x,node y) {
		if (1ll*x.x*y.y!=1ll*x.y*y.x) return 1ll*x.x*y.y>1ll*x.y*y.x;
		return x.id<y.id;
	}
};
long long Ans;
int f[N],a[N],i,j,k,l,s,n,m,fa[N],r,sum,F[N],tot,st[N];
set<node,syf>GT[N];
set<node,syf>::iterator GTW;
struct Node {
	int last[N],Next[N],to[N],tot;
	inline void add(int x,int y) {
		Next[++tot]=last[x]; last[x]=tot; to[tot]=y;
	}
}A,B;	
inline void dfs(int x,int y) {
	if (a[x]) F[x]=y,y=x,B.add(F[x],x);
	for (int i=A.last[x];i;i=A.Next[i]) dfs(A.to[i],y);
}
inline bool cmp(node x,node y) {
	return 1ll*x.x*y.y>1ll*x.y*y.x;
}
inline bool check(node x,node y) {
	return (1ll*x.x*y.y<=1ll*x.y*y.x);
}
inline void up(int x) {
	while (x>1) {
		int j=x>>1;
		if (1ll*t[x].x*t[j].y>1ll*t[x].y*t[j].x) swap(t[j],t[x]);
		else return ;
		x=j;
	}
}
inline void insert(int x) {
	t[++r].id=x;
	t[r].x=ans[x].x,t[r].y=ans[x].y;
	up(r);
}
inline void down(int x) {
	while (x<=r) {
		int j=x*2;
		if (j>r) return ;
		if (j+1<=r&&1ll*t[j+1].x*t[j].y>1ll*t[j+1].y*t[j].x) j++;
		if (1ll*t[j].x*t[x].y>1ll*t[j].y*t[x].x) swap(t[j],t[x]);
		else return ;
		x=j;
	}
}
inline void del() {
	t[1]=t[r--];
	down(1);
}
inline void work(int x) {
	sum++;
	Ans+=1ll*sum*f[x];
	for (int i=B.last[x];i;i=B.Next[i]) insert(B.to[i]);
}
int main() {
	scanf("%d",&n);
	for (i=2;i<=n;i++) scanf("%d",&fa[i]),A.add(fa[i],i);
	for (i=1;i<=n;i++) scanf("%d",&a[i]);
	for (i=n;i;i--) {
		if (!a[i]) {
			f[i]=1;
			for (j=A.last[i];j;j=A.Next[j]) f[i]+=f[A.to[j]];
		} 
		else f[i]=0;
	}
	dfs(1,0);
	for (i=1;i<=n;i++) if (a[i]) for (j=A.last[i];j;j=A.Next[j]) if (!a[A.to[j]]) f[i]+=f[A.to[j]];
	for (i=n;i;i--) {
		if (!a[i]) continue;
		ans[i].x=f[i];
		ans[i].y=1;
		ans[i].id=i;
		int r=0;
		st[i]=++tot;
		for (j=B.last[i];j;j=B.Next[j]) {
			if (GT[st[B.to[j]]].size()>GT[st[i]].size()) {
				for (GTW=GT[st[i]].begin();GTW!=GT[st[i]].end();GTW++) GT[st[B.to[j]]].insert(*GTW);
				st[i]=st[B.to[j]];
			}
			else {
				for (GTW=GT[st[B.to[j]]].begin();GTW!=GT[st[B.to[j]]].end();GTW++) GT[st[i]].insert(*GTW);
			}
		}
		for (GTW=GT[st[i]].begin();GTW!=GT[st[i]].end();) {
			node xx=(*GTW);
			if (check(ans[i],xx)) {
				ans[i].x+=xx.x,ans[i].y+=xx.y;
				GTW++;
				GT[st[i]].erase(xx);
			}
			else break;
		}
		GT[st[i]].insert(ans[i]);
	}
	r=0;
	for (i=B.last[0];i;i=B.Next[i]) insert(B.to[i]);
	sum=0; 
	while (r) {
		int gt=t[1].id;
		del();
		work(gt);
	}
	printf("%lld\n",Ans);
}


Measured memory_bytes: 43008
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<LL,LL> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a,T b){return b?gcd(b,a%b):a;}
const LL mod=1000000007;
const LL LINF=1LL<<62;
const int INF=1<<30;
int dx[]={1,0,-1,0,1,-1,1,-1};
int dy[]={0,1,0,-1,1,-1,-1,1};


int main(){
    int n,k;cin >> n >> k;
    vector<int> cnt(n,0);
    for (int i = 0; i < k; i++) {
        int d;cin >> d;
        for (int j = 0; j < d; j++) {
            int a;cin >> a;
            cnt[a - 1]++;
        }
    }
    int ans = 0;
    for (int i = 0; i < n; i++) {
        if(not cnt[i]) ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3600