akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

class Main{
	public static void main(String[] args){
		Scanner sin = new Scanner(System.in);
		
		//int a, b, c;
		//a = sin.nextInt();
		//b = sin.nextInt();
		//c = sin.nextInt();
		
		//if(a < b && b < c){
		//	System.out.println("Yes");
		
		//}else{
		//	System.out.println("No");
		//}
		
		int a, b, c, 一, ニ, 三;
		a = sin.nextInt();
		b = sin.nextInt();
		c = sin.nextInt();
		//output"A B C"
		
		if(a < b){
			if(b < c){
				一 = a;
				ニ = b;
				三 = c;
			}else if(a < c){
				一 = a;
				ニ = c;
				三 = b;
			}else{
				一 = c;
				ニ = a;
				三 = b;
			}
		}else{ //b < a
			if(c < b){
				一 = c;
				ニ = b;
				三 = a;
			}else if(c < a){ // b<c
				一 = b;
				ニ = c;
				三 = a;
			}else{ // b<a,b<c,a<c=b<a<c 
				一 = b;
				ニ = a;
				三 = c;
			}
		}
		
		System.out.println(一 +" "+ ニ +" "+ 三);
		
	}
}



Measured memory_bytes: 26320
#include <stdio.h>

int main(){
  char c;
  int i;

  c=getchar();
  while(c!='\n'){
    if((int)c>=97&&c<=122)
      printf("%c",(int)c-32);
    else if((int)c>=65&&c<=90)
      printf("%c",c+32);
    else
      putchar(c);
    c=getchar();
  }
  puts("");
  return 0;
}

Measured memory_bytes: 524
#include<bits/stdc++.h>
#define pi 3.1415926535897932384626
using namespace std;
      
struct P{
  int x,y;
  bool operator < (const P &a )const{
    //if(y!=a.y)
    return y<a.y;
  };
};

int a,b,c,d,i,k,n,m,e,dx[10]={1,0,-1,0,1,1,-1,-1},dy[10]={0,1,0,-1,1,-1,1,-1};
int o[191][111];
int l[110][199];
int j[111];

long long x,y,z,mod=1000000007;
//string r,r1;
char r[1];

P u[10];
queue<P> q;
//stack<int> s;
map<int,int> p;
vector<int> v;

bool as(P a,P b)
{
  return a.x>b.x;
}

int main()
{
  scanf("%d %d",&a,&b);
  for(int t=1;t<=a;t++)
    for(int w=1;w<=b;w++)
    {
      scanf("%d",&l[t][w]);
      for(int i=0;i*t<=l[t][w];i++)
      for(int j=0;i*t+j*w<=l[t][w];j++)
      o[i][j]=max(o[i][j],l[t][w]-i*t-j*w);
    }
  for(int t=1;t<=a;t++)
  for(int w=1;w<=b;w++)
  {
    int p=mod;
    for(int i=0;i*t<=l[t][w];i++)
    for(int j=0;i*t+j*w<=l[t][w];j++)
    p=min(p,i*t+j*w+o[i][j]);
    if(p!=l[t][w])
    {
      puts("Impossible");
      return 0;
    }
  }
  puts("Possible");
  printf("%d %d\n",100+100+2,100+100+(100+1)*(100+1));
  for(int t=1;t<=100;t++)
    printf("%d %d X\n",t,t+1);
  for(int t=100+2;t<200+2;t++)
    printf("%d %d Y\n",t,t+1);
  for(int i=1,t=0;i<=100+1;t++,i++)
  for(int j=200+2,w=0;j>=100+2;j--,w++)
    printf("%d %d %d\n",i,j,o[t][w]);
  printf("1 %d",200+2);
}


Measured memory_bytes: 384
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<algorithm>
#include<queue>
#include<map>
#include<set>
#include<vector>
#include<functional>
#include <random>
#include<iostream>
#include<iomanip>
using namespace std;

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

	int N = S.length();
	for (int i = 0; i < N; i++) {
		if (S[i] != S[N - 1 - i]) {
			cout << "No\n";
			return 0;
		}
	}

	for (int i = 0; i < (N-1)/2; i++) {
		if (S[i] != S[(N - 1) / 2-1 - i]) {
			cout << "No\n";
			return 0;
		}
	}

	
	cout << "Yes\n";
	return 0;
}

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

int gcd(int a, int b)
{
    int c;

    if (a < b) {
        a+=b; b=a-b; a-=b;
    }

    while (b != 0) {
        c = a % b;
        a = b;
        b = c;
    }

    return a;
}

int main(void){
    vector<int> n(3);
    for(int i = 0; i < 3; i++) cin >> n[i];
    sort(n.begin(), n.end(), greater<int>());
    cout << (10*n[0] + n[1]) + n[2];
}

Measured memory_bytes: 256
n = int(input())
t = [int(x) for x in input().split()]
m = int(input())
ans = 0
for i in range(m):
    p, x = map(int, input().split())
    for j in range(n):
        ans += t[j] if j != p-1 else x
    print(ans)
    ans = 0
        

Measured memory_bytes: 3060
macro_rules ! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; input_inner ! { iter , $ ( $ r ) * } } ; ( iter = $ iter : ident , $ ( $ r : tt ) * ) => { let s = { use std :: io :: Read ; let mut s = String :: new ( ) ; std :: io :: stdin ( ) . read_to_string ( & mut s ) . unwrap ( ) ; s } ; let mut $ iter = s . split_whitespace ( ) ; input_inner ! { $ iter , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { let s = { use std :: io :: Read ; let mut s = String :: new ( ) ; std :: io :: stdin ( ) . read_to_string ( & mut s ) . unwrap ( ) ; s } ; let mut iter = s . split_whitespace ( ) ; input_inner ! { iter , $ ( $ r ) * } } ; }
macro_rules ! input_inner { ( $ iter : expr ) => { } ; ( $ iter : expr , ) => { } ; ( $ iter : expr , mut $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let mut $ var = read_value ! ( $ iter , $ t ) ; input_inner ! { $ iter $ ( $ r ) * } } ; ( $ iter : expr , mut $ var : ident $ ( $ r : tt ) * ) => { input_inner ! { $ iter , mut $ var : usize $ ( $ r ) * } } ; ( $ iter : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ iter , $ t ) ; input_inner ! { $ iter $ ( $ r ) * } } ; ( $ iter : expr , $ var : ident $ ( $ r : tt ) * ) => { input_inner ! { $ iter , $ var : usize $ ( $ r ) * } } ; }
macro_rules ! read_value { ( $ iter : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ iter , $ t ) ) ,* ) } ; ( $ iter : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ iter , $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ iter : expr , { chars : $ base : expr } ) => { read_value ! ( $ iter , String ) . chars ( ) . map ( | c | ( c as u8 - $ base as u8 ) as usize ) . collect ::< Vec < usize >> ( ) } ; ( $ iter : expr , { char : $ base : expr } ) => { read_value ! ( $ iter , { chars : $ base } ) [ 0 ] } ; ( $ iter : expr , chars ) => { read_value ! ( $ iter , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ iter : expr , char ) => { read_value ! ( $ iter , chars ) [ 0 ] } ; ( $ iter : expr , usize1 ) => { read_value ! ( $ iter , usize ) - 1 } ; ( $ iter : expr , $ t : ty ) => { $ iter . next ( ) . unwrap ( ) . parse ::<$ t > ( ) . unwrap ( ) } ; }
fn abs(x: usize, y: usize) -> usize {
    if x > y {
        x - y
    } else {
        y - x
    }
}
fn main() {
    input! { n, x: usize1, y: usize1 };
    let mut ans = vec![0; n];
    for i in 0..n - 1 {
        for j in i + 1..n {
            let mut d = j - i;
            d = std::cmp::min(
                d,
                std::cmp::min(abs(i, x) + abs(j, y) + 1, abs(i, y) + abs(j, x) + 1),
            );
            ans[d] += 1;
        }
    }
    for i in 1..n {
        println!("{}", ans[i]);
    }
}


Measured memory_bytes: 4352
#define _CRT_SECURE_NO_WARNINGS
#include <vector>
#include <cstdio>
#include <algorithm>
#include <set>
using namespace std;
#define int64 long long
#define mp make_pair
#define pb push_back
#define fs first
#define sc second
#define sz(a) ((int) (a).size())

const int N = (int) 3e5 + 10;
int n, k, c, v;
vector<int64> who[N];
multiset<int64> triplets, singles;
vector< pair< int64, pair< int, int > > > a;

int main() {
	// freopen("input.txt", "r", stdin);
	scanf("%d%d", &n, &k);
	for (int i = 0; i < n; ++i) {
		scanf("%d%d", &c, &v), --c;
		who[c].pb(v);
	}
	for (int i = 0; i < k; ++i) {
		sort(who[i].rbegin(), who[i].rend());
		who[i][0] = who[i][1] = (who[i][0] + who[i][1]);
		for (int j = 2; j < sz(who[i]); ++j) {
			who[i][j] *= 2;
		}
	}
	for (int i = 0; i < k; ++i) {
		a.pb(mp(who[i][0], mp(i, 2)));
		for (int j = 2; j < sz(who[i]); ++j) {
			a.pb(mp(who[i][j], mp(i, 1)));
		}
		if (sz(who[i]) >= 3) {
			triplets.insert(who[i][0] + who[i][1] + who[i][2]);
		}
	}
	sort(a.rbegin(), a.rend());
	printf("-1\n");
	int64 value = 0;
	int64 last_single = -1;
	int64 last_pair = -1;
	for (int s = 2, i = 0, cur = 0; s <= n; ++s) {
		while ((i < sz(a)) && (cur + a[i].sc.sc <= s)) {
			int num = a[i].sc.fs;
			if (a[i].sc.sc == 1) {
				last_single = a[i].fs;
				cur++, value += a[i].fs;
				singles.erase(singles.find(last_single));
			} else {
				last_pair = a[i].fs * 2;
				cur += 2, value += a[i].fs * 2;
				if (sz(who[num]) >= 3) {
					triplets.erase(triplets.find(who[num][0] + who[num][1] + who[num][2]));
				}
				for (int j = 2; j < sz(who[num]); ++j) {
					singles.insert(who[num][j]);
				}
			}
			++i;
		}
		if (cur == s) {
			printf("%lld\n", value / 2);
			continue;
		}
		int64 nxt = -2;
		if (last_single != -1) {
			nxt = max(nxt, value - last_single + a[i].fs * a[i].sc.sc);
		}
		if ((last_pair != -1) && !triplets.empty()) {
			nxt = max(nxt, value - last_pair + *triplets.rbegin());
		}
		if (!singles.empty()) {
			nxt = max(nxt, value + *singles.rbegin());
		}
		printf("%lld\n", nxt / 2);
	}
	return 0;
}


Measured memory_bytes: 25716
import copy
import itertools
import sys

n, m, x = map(int, input().split())

us = [0 for _ in range(m)]

l = []
for i in range(n):
    row = [int(i) for i in input().split()]
    l.append(copy.deepcopy(row))

# 最初の一つをx以上にする組み合わせ
first = []
c = 0
for i in range(1, n+1):
    c = itertools.combinations(range(n), i)
    for v in c:
        total = 0
        for e in v:
            total += l[e][1]
        if total >= x:
            first.append(v)

for i in range(2, m+1):
    cc = copy.deepcopy(first)
    first = []
    for v in cc:
        total = 0
        for e in v:
            total += l[e][i]
        if total >= x:
            first.append(v)

if len(first) == 0:
    print(-1)
    sys.exit()

ans = (100000*n)+1
for i in first:
    t = 0
    for j in i:
        t += l[j][0]
    if ans > t:
        ans = t

print(ans)

Measured memory_bytes: 71292
import math

A, B, K = map(int, input().split())
yakusu_list = []
for i in range(1, A*B+1):
    if A % i == 0 and B % i == 0:
        yakusu_list.append(i)
yakusu_list = sorted(yakusu_list, reverse = True)
print(yakusu_list[K-1])


Measured memory_bytes: 2940
#include<iostream>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
using namespace std;
int read(){
	int f=1,x=0; char c=getchar();
	while (c>'9' || c<'0') {if (c=='-') f=-1; c=getchar();}
	while (c>='0'&&c<='9') {x=x*10+c-'0'; c=getchar();}
	return f*x;
}
int a,MIN=100,b;
int main(){
	int n;
	cin>>n;
	int m=n/2+1;
//	cout<<m<<endl;
	for(int i=1;i<=m;i++){
		a=i;
		b=n-i;
		int sum=0;
		while(a!=0){
			sum+=a%10;
			a/=10;
		}
		while(b!=0){
			sum+=b%10;
			b/=10;
		}
//		cout<<sum<<endl;
		if(sum<MIN)MIN=sum;
	}
	cout<<MIN<<endl;
	return 0;
}

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

int main() {
  int a, b;
  cin >> a >> b;
  if ((a + b) % 2) {
    cout << (a + b) / 2 + 1 << endl;
  } else {
    cout << (a + b) / 2 << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <functional>
#include <set>
#include <queue>
#include <cctype>
#include <climits>
#include <stack>
#include <map>
#include <cstring>
#include <cassert>
 
using namespace std;

bool check(int x){
	if(x==0) return true;
	return !(x&(x-1));
}

int main(){

	string s;
	cin>>s;

	int n=s.size();
	vector<int> dp(1<<26,1<<28);

	dp[0]=0;
	int state=0;
	for(int i=0;i<n;i++){
		state ^= (1<<(s[i]-'a'));
		for(int j=0;j<26;j++){
			dp[state] = min(dp[state],dp[state^(1<<j)]+1);
		}
	}

	cout<<max(1,dp[state])<<endl;

	return 0;
}


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

using namespace std;

typedef long long int ll;
const int INF = 1<<30;
const long long LINF = 1LL<<60;
const long long MOD = (long long)1e9 + 7;

int main(){
    int n, ans = 0;
    cin >> n;
    set<string> st;
    for(int i = 0; i < n; i++){
        string s;
        cin >> s;
        st.insert(s);
    }
    ans = st.size();
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 19120
#include <stdio.h>
int main(void)
{
  int a,b; 
  scanf("%d %d",&a,&b); 
  if(a<b){
  printf("a < b\n"); 
} 
if(a>b)
{ 
printf("a > b\n"); 
} 
if(a==b)
{ 
printf("a == b\n"); 
} 
return 0; 
} 


Measured memory_bytes: 2056
#include <iostream>
using namespace std;
#define int long long
signed main() {
  
  int n; cin>>n;
  int heights[n];
  int memo[n], tmp;
  
  for(int i = 0; i < n; i++)  memo[i] = 0;
  for(int i = 0; i < n; i++) {
    cin>>heights[i];
    tmp = heights[i];
    if(i - tmp > 0)
      memo[i - tmp]++;
  }
  
  int spies = 0;
  for(int i = 0; i < n; i++)
    spies += (i + heights[i] < n ? memo[i + heights[i]] : 0);
  cout<<spies<<"\n";
  return 0;
}

Measured memory_bytes: 6756
#include <bits/stdc++.h>
using namespace std;
const int INF = 1000000007;
 
int main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);

  int64_t A, B;
  cin >> A >> B;
  if(A * B == 1){
    cout << 1 << endl;
    return 0;
  }
  if(A == 1 || B == 1){
    cout << A * B - 2 << endl;
    return 0;
  }
  if(A == 2 || B == 2){
    cout << 0 << endl;
    return 0;
  }
  else{
    cout << A * B - (2*(A+B)-4) << endl;
  }
}

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

using namespace std;

int main(){
    int N;
    cin >> N;
    vector<int> a(N);
    map<int, int> Count;
    int MAX_A = 0;
    
    for(int i = 0; i < N; ++i){
        cin >> a[i];
        Count[a[i]]++;
        MAX_A = max(MAX_A, a[i]);
    }
    
    int ans = 0;
    
    for(auto el:Count){
        int num = el.first;
        int tmp = Count[num - 1] + Count[num] + Count[num + 1];
        ans = max(ans, tmp);
        if(el.first == MAX_A) break;
    }
    cout << ans << endl;
    
}


Measured memory_bytes: 5376
#include<bits/stdc++.h>
using namespace std;
#include<vector>
#include<queue>
#define ll long long
#define inf INT_MAX
ll int d[100000];
main()
{
memset(d,0,sizeof(d));
ll int n,k;
cin>>n>>k;
int h[n];
for(int i=0;i<n;i++)
{
	cin>>h[i];
}
d[0]=0;
for(int i=1;i<k;i++)
{
 d[i]=abs(h[i]-h[0]);
}
for(int i=k;i<n;i++)
{
	ll int maxi=inf;
	for(int j=1;j<=k;j++)
	{
		maxi=min(maxi,d[i-j]+abs(h[i]-h[i-j]));
	}
	d[i]=maxi;
}
cout<<d[n-1]<<endl;

}


Measured memory_bytes: 1408
import sys
def input(): return sys.stdin.readline().strip()


def main():
    K = int(input())
    N = 50
    print(N)
    x, y = K // N, K % N
    if y == 0:
        ans = [N + x - 1] * N
        print(" ".join(map(str, ans)))
        return
    ans = [N + x] * N
    for _ in range(N - y):
        max_num, max_idx = ans[0], 0
        for i, a in enumerate(ans):
            if max_num < a:
                max_num, max_idx = a, i
        for i in range(N):
            if i == max_idx:
                ans[i] -= N
            else:
                ans[i] += 1
    print(" ".join(map(str, ans)))


if __name__ == "__main__":
    main()


Measured memory_bytes: 64140
#include<iostream>
#include<string>
#include<cstring>
#include<vector>
#include<stack>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<sstream>
#include<cmath>
#include<iterator>
#include<bitset>
using namespace std;
#define _for(i,a,b) for(int i=(a);i<(b);++i)
#define _rep(i,a,b) for(int i=(a);i<=(b);++i)
typedef long long ll;
int readint() { int x; cin >> x; return x; }
const int INF = 1 << 30;
const int maxn = 100005;
int a[maxn];

int main() {
	int n;
	while (cin >> n) {

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

		int x, y = a[n - 1], mm = 1e9;
		if (y & 1) {
			for (int i = 0; i < n - 1; ++i) {
				int tmp = min(abs(a[i] - y / 2), abs(a[i] - (y / 2 + 1)));
				if (tmp< mm) {
					mm = tmp;
					x = a[i];
				}
			}
		}
		else {
			for (int i = 0; i < n - 1; ++i) {
				int tmp = abs(a[i] - y / 2);
				if (tmp < mm) {
					mm = tmp;
					x = a[i];
				}
			}
		}
		cout << y << " " << x << endl;
	}
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
    using namespace std;
     
    struct UF {
        int *id, cnt, *sz;
        
      // Create an empty union find data structure with N isolated sets.
        UF(int N)   {
            cnt = N;
        id = new int[N];
        sz = new int[N];
              for(int i=0; i<N; i++)  {
                  id[i] = i;
            sz[i] = 1;
        }
        }
        ~UF() {
        delete [] id;
        delete [] sz;
        }
        
      // Return the id of component corresponding to object p.
        int find(int p) {
            int root = p;
            while (root != id[root])
                root = id[root];
            while (p != root) {
                int newp = id[p];
                id[p] = root;
                p = newp;
            }
            return root;
        }
      // Replace sets containing x and y with their union.
        void merge(int x, int y)  {
            int i = find(x);
            int j = find(y);
            if (i == j) return;
        
        // make smaller root point to larger one
            if(sz[i] < sz[j]) { 
              id[i] = j; 
              sz[j] += sz[i]; 
            } else  { 
              id[j] = i; 
              sz[i] += sz[j]; 
            }
            cnt--;
        }
      // Return the number of disjoint sets.
        int count() {
            return cnt;
        }
    };
     
    int main() {
      ios::sync_with_stdio(false);
      cin.tie(0);
      int n, m;
      cin >> n >> m;
      UF *dsu = new UF(n);
      vector<int> from(m), to(m);
      for (int i = 0; i < m; i++) {
        cin >> from[i] >> to[i];
        from[i]--; to[i]--;
      }
      long long ans = 1LL * n * (n - 1) / 2;
      vector<long long> res;
      res.push_back(ans);
      for (int i = m - 2; i >= 0; i--) {
        if (dsu->find(from[i + 1]) != dsu->find(to[i + 1])) {
          long long A = dsu->sz[dsu->find(from[i + 1])];
          long long B = dsu->sz[dsu->find(to[i + 1])];
          int cur_sz = (int) res.size();
          res.push_back(res[cur_sz - 1] - A * (n - A) - B * (n - B) + A * B + (A + B) * (n - A - B));
          dsu->merge(from[i + 1], to[i + 1]);
        } else {
          res.push_back(res[(int) res.size() - 1]);
        }
      }
      for (int i = m - 1; i >= 0; i--) {
        cout << res[i] << '\n';
      }
      return 0;
    }

Measured memory_bytes: 3828
N, Q = gets.split.map(&:to_i)
merge_arrs = (N-1).times.map{gets.split.map(&:to_i)}
add_base_points = Q.times.map{gets.split.map(&:to_i)}

base_points = Array.new(N + 1, 0)
add_base_points.each do |pos, point|
  base_points[pos] += point
end

parents = Array.new(N + 1, nil)
parents[0] = 0
parents[1] = 0
merge_arrs.each do |parent, child|
  parents[child] = parent
end

points = Array.new(N + 1, 0)
(1..N).each do |i|
  points[i] = points[parents[i]] + base_points[i]
end

points.shift
puts points.join(' ')

Measured memory_bytes: 39804
#include <bits/stdc++.h>
#define ll long long int
#define ld long double
#define f first
#define s second
#define pb push_back
#define eb emplace_back
#define mk make_pair
#define MOD 1000000007
#define fo(i,a,b) for(i=a;i<b;i++)
#define foe(i,a,b) for(i=a;i<=b;i++)
#define all(x) x.begin(), x.end()
#define vi vector<int>
#define pii pair <int,int>
#define vpii vector< pair<int,int> >
#define boost ios::sync_with_stdio(false); cin.tie(0)
using namespace std;
int main()
{
	boost;
	int n, k, i, j, r, s, p, z;
	string ss;
	cin >> n >> k;
	cin >> r >> s >> p;
	cin >> ss;
	map <char, int> mp;
	mp['r'] = p, mp['p'] = s, mp['s'] = r;
	int len = ss.length();
	int ans = 0;
	fo(z, 0, k){
		string aux = "";
		for(j = z; j < len; j += k)
		aux += ss[j];
		
		int l = aux.length();
		for(i = 0; i < l; i = j){
			j = i;
			int cnt = 0;
			char c = aux[i];
			while(j + 1 < l && aux[j] == aux[j + 1]){
				cnt++;
				j++;
			}
			if(j < l){
				cnt++;
				j++;
			}
			ans += (((cnt + 1) / 2) * mp[c]);
		}
	}
	cout << ans;
}

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

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

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

int main(){
  int N, D;
  cin >> N >> D;
  vector<int> X(N);
  vector<int> Y(N);
  for (int i=0 ; i<N ; i++)
    cin >> X.at(i) >> Y.at(i);
  
  long long Max = pow(D, 2);
  int ans = 0;
  for (int i=0 ; i<N ; i++){
    long long x2 = pow(X.at(i), 2);
    long long y2 = pow(Y.at(i), 2);
    long long d = x2+y2;
    if (d <= Max)
      ans++;
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 4776
#include <bits/stdc++.h>
using namespace std;
#define LL long long
#define VI vector<int>
#define VVI vector<vector<int>>
#define UM unordered_map
#define MP map
#define ST set
#define US unordered_set
#define V vector
#define S string
#define D deque
#define L list
#define Q queue
#define PQ priority_queue
#define DB double
#define LDB long double
#define FOR(i, n) for (int(i) = 0; (i) < (n); ++(i))
#define FFOR(i, n) for (int(i) = 0; (i) <= (n); ++(i))
#define RFOR(i, n) for (int(i) = (n)-1; (i) >= 0; --(i))
#define all(v) (v).begin(), (v).end()

const int dr[] = {0, 1, 0, -1};
const int dc[] = {1, 0, -1, 0};

int nxt()
{
    int n;
    cin >> n;
    return n;
}

LL llnxt()
{
    LL l;
    cin >> l;
    return l;
}

LDB ldbnxt()
{
    LDB n;
    cin >> n;
    return n;
}

DB dbnxt()
{
    DB n;
    cin >> n;
    return n;
}

void bfs(VVI &graph, int start)
{
    int n = graph.size();
    Q<int> q;
    V<bool> visited(n);
    q.push(start);
    visited[start] = true;
    while (not q.empty())
    {
        auto curr = q.front();
        q.pop();
        for (auto i : graph[curr])
        {
            if (not visited[i])
            {
                q.push(i);
                visited[i] = true;
            }
        }
    }
}

int main()
{
    LL n;
    cin >> n;
    VI v;
    while (n > 0)
    {
        --n;
        int t = n % 26;
        v.push_back(t);
        n /= 26;
    }
    for (int i = v.size() - 1; i >= 0; --i)
    {
        cout << char(v[i] + 'a');
    }
}

Measured memory_bytes: 3636
/* Code by : Suraj (@suraj1611) */

#include<bits/stdc++.h>
#include <string>

using namespace std;

#define ll long long int
#define rep(i,n) for(int i=0; i<n; i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define mx INT_MAX
#define mn INT_MIN
#define md 1000000007
#define pb push_back
#define mp make_pair
#define maxsize 1100005
#define lb cout<<endl;
#define endl "\n"
#define F first
#define S second
#define label cout<<"hello!"<<endl
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);

ll power(ll x, ll  y) 
{ 
	ll m=md;
   	ll ans=1;
    while (y > 0) 
    {
        if (y & 1)
            ans = (ans * x) % m;
        x = (x * x) % m;
        y >>= 1;
    }
    return ans;
} 

int main()
{
	IOS
	


	ll n;
	cin>>n;
	ll a[n],b[n],s=0;
	rep(i,n)
	cin>>a[i];
	rep(i,n)
	cin>>b[i];
	rep(i,n)
	{
		if(a[i]-b[i]>0)
			s+=a[i]-b[i];
	}
	cout<<s<<endl;

	

    return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3

from sys import stdin
from fractions import gcd	# math.gcd is introduced in python 3.5
from functools import reduce

def lcm(x, y):
    """The least common multiple of x and y."""
    return x * (y // gcd(x, y))

def flatten(ls):
    """Flatten a list of lists."""
    return [x for l in ls for x in l]


def multiples(t, N):
    """Set of multiples (<= N) of some x in t."""
    return set(i for x in t for i in range(x, N + 1, x))

def value(a, t):
    """The value of the jewels that are labeled a multiple of some x in t."""
    return sum(a[i - 1] for i in multiples(t, len(a)))

def remove(a, t):
    """Break all jewels that are labeled a multiple of some x in t."""
    for i in multiples(t, len(a)):
        a[i - 1] = 0


def tuples(m, N):
    """
    [[m'-tuples over {1,2,3,...,N}] for 0 <= m' <= m].
    The lcm of the m-tuple is less than or equal to N.
    Each m-tuple does not contain a multiple of some j in the tuple.
    """
    if m == 0: return [[()]]
    ts = tuples(m - 1, N)
    if ts[-1] == []: return ts

    ls = []
    for t in ts[-1]:
        lc = reduce(lcm, t) if len(t) > 0 else 1
        mi = min(t)         if len(t) > 0 else N + 1
        for i in range(mi - 1, 0, -1):
            if lcm(lc, i) > N: continue
            if any(j % i == 0 for j in t): continue
            ls.append((i,) + t)  # smaller label first
    ts.append(ls)
    return ts

def solve(a):
    N = len(a)
    tl = flatten(tuples(N, N))
    # break jewels with larger labels first.
    tl.sort(key=lambda t: [-x for x in t])
    for t in tl:
        if value(a, t) < 0: remove(a, t)
    return sum(a)

N = int(stdin.readline())
a = [int(w) for w in stdin.readline().split()]
if len(a) != N: raise
print(solve(a))


Measured memory_bytes: 5176
#include <bits/stdc++.h>
using namespace std;
 
//long long
using ll = long long;
 
// pair<int, int>
using PII = pair<int, int>;
 
//最大値、mod
const int MOD = 1000000007;
const int INF = 1000000000;
const long long LINF = 1e18;
const int MAX = 510000;
 
//出力系
#define print(x) cout << x << endl
#define prints(x) cout << fixed << setprecision(10) << x << endl
#define printc(x) cout << setw(2) << setfill('0') << x << endl;
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
 
// begin() end()
#define all(x) (x).begin(),(x).end()
 
//for
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
 
//最大公約数 
unsigned gcd(unsigned a, unsigned b) {
  if(a < b) return gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}
 
// 最小公倍数
unsigned lcm(unsigned a, unsigned b){
    return a / gcd(a, b) * b; 
}
 
// a = max(a, b), a = min(a, b)
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; }
 
// 累乗(MODをとる)
ll pow_mod(ll num, ll pow, ll mod) {
    ll prod = 1;
    num %= mod;
    while (pow > 0) {
        if (pow & 1) prod = prod * num % mod;
        num = num * num % mod;
        pow >>= 1;
    }
    return prod;
}
 
 
 
// 二項係数(MODとる、1 ≦ k ≦ n ≦ 10^7 程度)
// COMinit()
// COM(x, y)
// とコンビで使う
 
// テーブルを作る前処理
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
 
int dx[4] = {0, 0, 1, -1}, dy[4] = {1, -1, 0, 0};

struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};



int main(){
 int N;
 cin >> N;
 vector<ll> ans;
 while(N != 0){
    int tmp = N % 2;
    if(tmp < 0) tmp += 2;

    N = (N - tmp) / (-2);
    ans.push_back(tmp);
 }
 reverse(all(ans));
  if(ans.empty()){
    print(0);
    return 0;
  }
 REP(i, ans.size()){
    cout << ans.at(i);
 }
  cout << endl;
  return 0;
}

Measured memory_bytes: 256
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*);
    }
}

#[allow(unused_imports)]
use std::cmp::{min, max};
#[allow(unused_imports)]
use std::io::{stdout, stdin, BufWriter, Write};

pub fn gcd(a: u64, b: u64) -> u64 {
    if b == 0 {
        a
    } else {
        gcd(b, a % b)
    }
}

fn main() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (write!(out,$($format)*).unwrap());
    }
    input!{
      k: u64,
    }
    let mut ans = 0;
    for i in 1..k+1 {
        for j in 1..k+1 {
            for k in 1..k+1 {
                ans += gcd(gcd(i, j), k);
            }
        }
    }
    puts!("{}\n", ans);
}


Measured memory_bytes: 2164
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define rrep(i, n) for (int i = (int)n-1; i >= 0; --i)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
const int mod = 1e9+7;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;

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; }

__attribute__ ((constructor))
void fastio() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(10);
}

// void print_que(priority_queue<pair<int,int>> que){
//     for(auto u : que){
//         cout << u.second << " " << u.first << endl;
//     }
// }

int main(){
    int k, t;
    cin >> k >> t;
    map<int,int> mii;
    rep(i,t){
        int a;
        cin >> a;
        mii[i] = a;
    }
    // for(auto u : mii){
    //     cout << u.first << u.second << endl;
    // }
    // cout <<"map output finish" << endl;
    priority_queue<pair<int, int>> que;
    for(auto u : mii){
        que.push({u.second, u.first});
    }
    int ans = 0;
    int pre = -1;
    while(!que.empty()){
        // for(auto u : que){
        //     cout << u.second << " " << u.first << endl;
        // }
        // cout << "-------------" << endl;
        int top_first = que.top().first;
        int top_second = que.top().second;
        que.pop();
        if(top_second == pre){
            if(!que.empty()){
                int second_first = que.top().first;
                int second_second = que.top().second;
                que.pop();
                pre = second_second;
                que.push({top_first, top_second});
                second_first--;
                if(second_first){
                    que.push({second_first, second_second});
                }
                
            }else{
                ans += top_first;
                break;
            }
        }else{
            top_first--;
            pre = top_second;
            if(top_first) que.push({top_first, top_second});
            
        }
    }
    cout << ans << endl;
    return 0;
}


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

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = std::int64_t;
using P = std::tuple<int,int>;

bool isNotPrime[1000100];
int minFactor[1000100];
int N, A[1000100];
bool used[1000100];

bool p(){
    for(int i=0;i<N;++i){
        int a = A[i];

        while(a > 1){
            int f = minFactor[a];

            if(used[f]){return false;}
            used[f] = true;

            while(a % f == 0){
                a /= f;
            }
        }
    }

    return true;
}

bool q(){
    int g = 0;

    for(int i=0;i<N;++i){
        g = std::gcd(g, A[i]);
    }

    return g == 1;
}

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

    for(int i=2;i<=1000000;i+=2){
        minFactor[i] = 2;
    }

    for(int i=3;i<=1000000;i+=2){
        if(isNotPrime[i]){continue;}

        minFactor[i] = i;

        for(int j=2*i;j<=1000000;j+=i){
            isNotPrime[j] = true;
            minFactor[j] = i;
        }
    }

    std::cin >> N;

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

    if(p()){
        std::cout << "pairwise coprime" << std::endl;
    }else if(q()){
        std::cout << "setwise coprime" << std::endl;
    }else{
        std::cout << "not coprime" << std::endl;
    }
}


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

void scan(std::vector<int>& x){
    for(auto i = 0; i < x.size(); i++){
        std::cin >> x.at(i);
    }
}

int main(){
    int N, ans = 0, tmp;
    std::cin >> N;
    std::vector<int> V(N), C(N);
    scan(V);
    scan(C);
    for(auto i = 0; i < N; i++){
        tmp = V.at(i) - C.at(i);
        if(tmp > 0){
            ans += tmp;
        }
    }

    std::cout << ans << std::endl;

    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

public struct Query
{
    public int Start;
    public int End;

    public Query(int start, int end)
    {
        Start = start;
        End = end;
    }
}

public class Solution
{
    public static long[][] WarshallFloyd(long[][] dist)
    {
        const int origin = 1;
        var n = dist.Length;
        var min = Enumerable.Range(0, n).Select(_ => new long[n]).ToArray();

        for (int i = origin; i < n; i++)
        {
            for (int j = origin; j < n; j++)
            {
                min[i][j] = dist[i][j];
            }
        }

        for (int k = origin; k < n; k++)
        {
            for (int i = origin; i < n; i++)
            {
                for (int j = origin; j < n; j++)
                {
                    if (min[i][k] == long.MaxValue || min[k][j] == long.MaxValue)
                    {
                        continue;
                    }
                    var newDist = min[i][k] + min[k][j];
                    if (newDist < min[i][j])
                    {
                        min[i][j] = newDist;
                    }
                }
            }
        }

        return min;
    }

    public static void Main()
    {
        var vals = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
        var N = (int)vals[0];
        var M = (int)vals[1];
        var L = vals[2];
        var dist = Enumerable.Range(0, N + 1).Select(_ => Enumerable.Repeat(long.MaxValue, N + 1).ToArray()).ToArray();
        for (int i = 0; i < M; i++)
        {
            vals = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
            dist[vals[0]][vals[1]] = vals[2];
            dist[vals[1]][vals[0]] = vals[2];
        }
        for (int i = 1; i < N + 1; i++)
        {
            dist[i][i] = 0;
        }

        var Q = int.Parse(Console.ReadLine());
        var queries = new Query[Q];
        for (int i = 0; i < Q; i++)
        {
            var vs = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            queries[i] = new Query(vs[0], vs[1]);
        }

        var min = WarshallFloyd(dist);

        var supplyDist = Enumerable.Range(0, N + 1).Select(_ => Enumerable.Repeat(long.MaxValue, N + 1).ToArray()).ToArray();
        for (int i = 1; i < N + 1; i++)
        {
            for (int j = 1; j < N + 1; j++)
            {
                if (min[i][j] <= L)
                {
                    supplyDist[i][j] = 1;
                }
            }
        }
        var supplyMin = WarshallFloyd(supplyDist);
        var result = queries.Select(q => supplyMin[q.Start][q.End] == long.MaxValue ? -1 : supplyMin[q.Start][q.End] - 1).ToArray();
        Console.WriteLine(string.Join(Environment.NewLine, result));
    }
}

Measured memory_bytes: 25780
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define sz(a) a.size()
#define re return
#define all(a) a.begin(),a.end()
#define int long long
using namespace std;
int n,m,q;
int ans;
int a[55],b[55],c[55],d[55];
signed main()
{
	cin>>n>>m>>q;
	for (int i=0;i<q;i++){
		cin>>a[i]>>b[i]>>c[i]>>d[i];
		b[i]--,a[i]--;
	}
	vector<int>v;
	for (int i=0;i<m-1;i++){
		v.pb(0);
	}
	for (int i=0;i<n;i++){
		v.pb(1);
	}
	do {
		int k=1;
		vector<int>vv;
		for (int i=0;i<sz(v);i++){
			if (v[i]==0)  k++;
			else  vv.pb(k);
		}
		int score=0;
		for (int i=0;i<q;i++){
			if (vv[b[i]]-vv[a[i]]==c[i])  score+=d[i];
		}
		ans=max(ans,score);
	}
	while (next_permutation(all(v)));
	cout<<ans;
	re 0;
}

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

inline unsigned count(
  const std::vector< std::vector<unsigned> > &sum,
  unsigned left, unsigned right, unsigned top, unsigned bottom 
)
{
  return sum[bottom][right]
       + sum[top][left]
       - sum[bottom][left]
       - sum[top][right];
}

int main(int argc, char **argv)
{
  unsigned N, K;
  std::cin >> N >> K;
  
  unsigned M = 2 * K;
  
  std::vector< std::vector<unsigned> > table(M);
  for (unsigned m = 0; m < M; ++m) {
    table[m] = std::vector<unsigned>(M, 0);
  }
  
  for (unsigned n = 0; n < N; ++n) {
    unsigned x, y;
    char color;
    std::cin >> x >> y >> color;
    
    ++table[(y + (color == 'W' ? K : 0)) % M][x % M];
  }
  
  /*for (unsigned y = 0; y < M; ++y) {
    for (unsigned x = 0; x < M; ++x) {
      std::cerr << table[y][x] << ' ';
    }
    std::cerr << std::endl;
  }
  std::cerr << std::endl;*/
  
  std::vector< std::vector<unsigned> > sum(M + 1);
  for (unsigned m = 0; m < M + 1; ++m) {
    sum[m] = std::vector<unsigned>(M + 1, 0);
  }
  
  for (unsigned y = 0; y < M; ++y) {
    for (unsigned x = 0; x < M; ++x) {
      sum[y + 1][x + 1] = table[y][x]
                        + sum[y + 1][x] 
                        + sum[y][x + 1] 
                        - sum[y][x];
    }
  }
  
  /*for (unsigned y = 0; y < M + 1; ++y) {
    for (unsigned x = 0; x < M + 1; ++x) {
      std::cerr << sum[y][x] << ' ';
    }
    std::cerr << std::endl;
  }
  std::cerr << std::endl;*/
  
  unsigned max = 0;
  for (unsigned py = 0; py < K; ++py) {
    for (unsigned px = 0; px < K; ++px) {
      unsigned S = 0;
      
      S += count(sum, 0, px, py, py + K);
      S += count(sum, px, px + K, 0, py);
      S += count(sum, px, px + K, py + K, M);
      S += count(sum, px + K, M, py, py + K);
      
      /*
      S += count(sum, 0, px, 0, py);
      S += count(sum, 0, px, py + (K - 1), M - 1);
      S += count(sum, px, px + (K - 1), py, py + (K - 1));
      S += count(sum, px + (K - 1), M - 1, 0, py);
      S += count(sum, px + (K - 1), M - 1, py + (K - 1), M - 1);
      */
      max = std::max(max, std::max(S, N - S));
    }
  }
  std::cout << max << std::endl;
  
  return 0;
}

Measured memory_bytes: 31616
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
using System.Numerics;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            Solve();
            //Out.Flush();
            Read();
        }

        static void Solve()
        {
            var N = Sarray()[0];
            var ai = Sarray();
            var rui = new long[N + 1];
            for (var i = 1; i <= N; ++i)
                rui[i] = rui[i - 1] + ai[i - 1];
            var ans = long.MaxValue;
            for (var i = 1; i < N; ++i) 
                ans = Min(ans, Abs(rui[i] - (rui[N] - rui[i])));
            WriteLine(ans);
        }

        static long Mod = (long)1e9 + 7;
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }
        static public (T1 a, T2 b) Slice<T1, T2>()
        {
            var t = ReadLine().Split();
            return (
            (T1)Convert.ChangeType(t[0], typeof(T1)),
            (T2)Convert.ChangeType(t[1], typeof(T2)));
        }
        static public (T a, T b) Slice2<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)));
        }
        static public (T a, T b, T c) Slice3<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)),
            (T)Convert.ChangeType(t[2], typeof(T)));
        }
    }
}

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

#define NREP() for(ll i = 0; i < n; i++)
#define MREP() for(ll j = 0; j < m; j++)
#define REP(i, x, y) for(ll i = x; i < y; i++)
#define ALL(x) (x).begin(), (x).end()
#define MSG(x) cout << x << endl;
#define MSGF(x, n) MSG(fixed << setprecision(n) << x)
#define END(x) cout << x << endl; exit(0);
#define IPT(v, n) REP(i, 0, n){ cin >> v[i]; }
#define YN(x) x ? cout << "YES" << endl : cout << "NO" << endl;
#define Yn(x) x ? cout << "Yes" << endl : cout << "No" << endl;
#define yn(x) x ? cout << "yes" << endl : cout << "no" << endl;

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<ull> vul;
typedef vector<vector<ull>> vvul;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;

const static ll MOD = 1e9 + 7;
const static ll INF = 1LL << 30;

ll a, b, c, d, k, l, m, n, h, w, q, x, y;
string s, t;

ll ans = 0;
ll sum = 0;
ll cnt = 0;
ll cur = 0;
ll tmp = 0;
ll mini = INF;
ll maxi = 0;

double ave = 0.0;

ll mod_pow(ll base, ll power) {
    if (power == 0) return 1;
    if (power == 1) return base % MOD;
    if (power % 2 == 0) return ((mod_pow(base % MOD, (power / 2)) % MOD) * (mod_pow(base, (power / 2)) % MOD)) % MOD;
    return (base % MOD * (mod_pow(base % MOD, power - 1) % MOD)) % MOD;
}

ll mod_fact(ll number) {
    ll ret = 1;
    ll count = 1;
    while (count <= number) {
        ret *= (count % MOD);
        ret %= MOD;
        count++;
    }
    return ret % MOD;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

int main() {
    cin >> a >> b >> c >> x >> y;
    ans = LLONG_MAX;
    REP(set_ab, 0, max(2 * x, 2 * y) + 10) {
        ll cost = set_ab * c;
        ll now_a = set_ab / 2;
        ll now_b = set_ab / 2;

        cost += a * max(x - now_a, 0ll);
        cost += b * max(y - now_b, 0ll);
        ans = min(cost, ans);
    }

    MSG(ans)
}


Measured memory_bytes: 256
from collections import defaultdict
d=defaultdict(int)
for i in range(int(input())):
    d[input()]+=1
ans=[]
d=list(d.items())
d.sort(key=lambda x:-x[1])

m=d[0][1]
for i,j in d:
    if m==j:
        ans+=[i]
    else:
        break

for i in sorted(ans):
    print(i)

Measured memory_bytes: 119612
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>

using namespace std;

int main() {
	int N;
	cin >> N;
	vector<int> d(N);
	for (int i = 0; i < N; i++) cin >> d[i];
	int heal = 0;
	for (int i = 0; i < N - 1; i++) {
		for (int j = i + 1; j < N; j++) {
			heal += d[i] * d[j];
		}
	}
	cout << heal << endl;
	return 0;
}

Measured memory_bytes: 3540
import java.util.Scanner;

public class Main {


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

		int n = sc.nextInt();
		
		double ans = 0;
		for(int i=0;i<n;i++) {
			ans+=(1.0/sc.nextDouble());
		}
		
	
		
		
		System.out.println(1.0/ans);
	}



}

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


void solve() {
    string s, t;
    cin >> s >> t;
    vector<vector<int> > dp(s.size(), vector<int>(t.size()));
    for (int i = 0; i < s.size(); i++) {
        for (int j = 0; j < t.size(); j++) {
            dp[i][j] = (i < 1 || j < 1 ? 0 : dp[i-1][j-1]) + (s[i] == t[j] ? 1 : 0);
            int a = (i < 1 ? 0 : dp[i-1][j]);
            int b = (j < 1 ? 0 : dp[i][j-1]);
            dp[i][j] = max(dp[i][j], max(a, b));
        }
    }

    cout << dp[s.size()-1][t.size()-1] << endl;
}

int main() {
    int n;
    cin >> n;
    while (n--) solve();

    return 0;
}

Measured memory_bytes: 6844
import java.util.Scanner;

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

		int R;
		R = sc.nextInt();

		if (R < 1200) {
			System.out.println("ABC");
		} else if (R < 2800) {
			System.out.println("ARC");
		} else {
			System.out.println("AGC");
		}

		sc.close();
	}
}


Measured memory_bytes: 20948
#!/usr/local/bin/python3

from operator import itemgetter

def solve(n,arr):
	sarr1 = sorted(arr, key=itemgetter(1))
	cur = 0
	# print(sarr1)
	for i in range(n):
		t = sarr1[i]
		cur = cur + t[0]
		# print(cur, t[1])
		if cur > t[1]:
			return 'No'
	return 'Yes'

n = int(input())
arr = []
for i in range(n):
	_a,_b = map(int, input().split())
	arr.append((_a, _b))

ans = solve(n,arr)
print(ans)


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

using namespace std;

typedef long long ll;

const ll MOD = 1000000007;

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

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    int n, k; cin >> n >> k;
    int lim = (n + 1) / 2;
    if(k <= lim){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
}

Measured memory_bytes: 256
import java.util.Scanner;



public class Main {

    public static void main(String[] args) {

        int n;

        Scanner scanner = new Scanner(System.in);

        n = scanner.nextInt();

        System.out.println(0.0 + " " + 0.0);

        koch(0.0, 0.0, 100.0, 0.0, 0, n);

        System.out.println(100.0 + " " + 0.0);

    }



   

    static void koch(double ax, double ay, double bx, double by, int call, int n) {

        double x1 = ax + (bx - ax) / 3.0;

        double y1 = ay + (by - ay) / 3.0;

        double x3 = ax + (bx - ax) / 3.0 * 2;

        double y3 = ay + (by - ay) / 3.0 * 2;

        double x2 = Math.cos(Math.PI / 3) * (bx - ax) / 3 - Math.sin(Math.PI / 3) * (by - ay) / 3 + x1;

        double y2 = Math.sin(Math.PI / 3) * (bx - ax) / 3 + Math.cos(Math.PI / 3) * (by - ay) / 3 + y1;

        if (call < n) {

            koch(ax, ay, x1, y1, call + 1, n);

            System.out.println(x1 + " " + y1);

            koch(x1, y1, x2, y2, call + 1, n);

            System.out.println(x2 + " " + y2);

            koch(x2, y2, x3, y3, call + 1, n);

            System.out.println(x3 + " " + y3);

            koch(x3, y3, bx, by, call + 1, n);

        }

    }

}










Measured memory_bytes: 32560
#include<cstdio>
#include<cmath>
#include<vector>
#include<string>
#include<algorithm>

using namespace std;

int main()
{
	long long n;
	vector<string> arr;
	char input[20];
	string str;
	long long i, prev, sol = 0;

	scanf("%lld", &n);

	for (i = 0; i < n; i++)
	{
		scanf("%s", input);

		str = input;

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

		arr.push_back(str);
	}

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

	prev = 0;

	for (i = 1; i < n; i++)
	{
		if (arr[i] != arr[i - 1])
		{
			sol += (i - prev)*(i - prev - 1) / 2;

			prev = i;
		}
	}

	sol += (i - prev)*(i - prev - 1) / 2;

	printf("%lld\n", sol);

	return 0;
}

Measured memory_bytes: 5748
from itertools import accumulate
n,k,*a=map(int,open(0).read().split())
for _ in range(k):
    b=[0]*n
    for i in range(n):
        b[max(0,i-a[i])]+=1
        if i+a[i]+1<n:b[i+a[i]+1]-=1
    a=list(accumulate(b))
    if a==[n]*n:break
print(" ".join(map(str,a)))

Measured memory_bytes: 187748