akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
#include<numeric>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define ll long long
ll gcd(ll a,ll b){
  if(b==0) return a;
  return gcd(b,a%b);
}
ll lcm(int a,int b){
  int res=a/gcd(a,b)*b;
  return res;
}
signed main(){
  int n,m;cin>>n>>m;
  vector<int> a(n);
  vector<int> b(n);
  rep(i,n)cin>>a[i];
  rep(i,n)b[i]=a[i]/2;
  int p=0;
  int ans,res;
  vector<int> c(b);
  bool tag=false;
  rep(i,n){
    int buf=0;
    while(c[i]%2==0){
      c[i]/=2;
      buf++;
    }
    if(i==0){
      p=buf;
    }
    else if(buf!=p){
      tag=true;
      break;
    }
  }
  //cout<<"OK"<<endl;
  int buf=1;
  if(tag){
    res=0;
    goto FINE;
  }
  rep(i,n){
    buf=lcm(buf,b[i]);
  }
  res=m/buf;
  if(res%2==0){
    res/=2;
  }
  else{
    res=res/2+1;
  }
  if(p==n){
    res=m/buf;
    res/=2;
  }
  FINE:
  cout<<res<<endl;
  //cout<<buf<<endl;
  return 0;
}

Measured memory_bytes: 2560
// Author: Vamsi Krishna Reddy Satti
// With love for Competitive Programming!
 
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
using namespace std;

string to_string(const string& s) { return '"' + s + '"'; }
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cout << " " << to_string(H);
    debug_out(T...);
}
#ifdef LOCAL
    #define debug(...) cout << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
    #define debug(...) 3
#endif
 
#define cin_exception cin.exceptions(cin.failbit);
#define cout_precision cout.setf(ios::fixed); cout.precision(15);
#define fast_io ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
using ll = int64_t; using ld = long double;
 
// -----------------------------------------------------------------------------

const int MOD = 1e9 + 7;

int modexp(ll b, int e, int mod) {
    ll a = 1;
    while (e > 0) {
        if (e & 1) a = ll(1) * a * b % mod;
        b = ll(1) * b * b % mod;
        e >>= 1;
    }
    return a;
}

int nCr(int n, int r) {
    if (n < r) return 0;
    int rn = 1, rd = 1;
    for (int i = 0; i < r; ++i) {
        rn = ll(1) * rn * (n - i) % MOD;
        rd = ll(1) * rd * (i + 1) % MOD;
    }
    return ll(1) * rn * modexp(rd, MOD - 2, MOD) % MOD;
}

void solve() {
    int n, a, b; cin >> n >> a >> b;
    int ans = modexp(2, n, MOD) - 1 - nCr(n, a) - nCr(n, b);
    ans = (ans % MOD + MOD) % MOD;
    cout << ans << '\n';
}


int main() {
    fast_io; cin_exception;
    int t = 1; // cin >> t;
    for (int i = 0; i < t; ++i) {
        solve();
    }
}

Measured memory_bytes: 256
parseInt(x) = parse(Int,x)

function main()
    n = parseInt(readline())
    v = map(parseInt, split(readline()))
    c = map(parseInt, split(readline()))
    ans = 0
    for i = 1:n
        ans += max(0, v[i] - c[i])
    end
    println(ans)
end

main()

Measured memory_bytes: 168708
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder.Contest.F
{
	class Program
	{
		public static void Main(string[] args)
		{
			var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
			Console.SetOut(sw);

			Scanner cin = new Scanner();
			string s = cin.next();
			if (s == "ARC") Console.WriteLine("ABC");
			else Console.WriteLine("ARC");


			Console.Out.Flush();
		}
	}

	class Scanner
	{
		string[] s;
		int i;

		char[] cs = new char[] { ' ' };

		public Scanner()
		{
			s = new string[0];
			i = 0;
		}

		public string next()
		{
			if (i < s.Length) return s[i++];
			string st = Console.ReadLine();
			while (st == "") st = Console.ReadLine();
			s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
			if (s.Length == 0) return next();
			i = 0;
			return s[i++];
		}

		public int nextInt()
		{
			return int.Parse(next());
		}

		public int[] ArrayInt(int N, int add = 0)
		{
			int[] Array = new int[N];
			for (int i = 0; i < N; i++)
			{
				Array[i] = nextInt() + add;
			}
			return Array;
		}

		public long nextLong()
		{
			return long.Parse(next());
		}

		public long[] ArrayLong(int N, long add = 0)
		{
			long[] Array = new long[N];
			for (int i = 0; i < N; i++)
			{
				Array[i] = nextLong() + add;
			}
			return Array;
		}

		public double nextDouble()
		{
			return double.Parse(next());
		}

		public double[] ArrayDouble(int N, double add = 0)
		{
			double[] Array = new double[N];
			for (int i = 0; i < N; i++)
			{
				Array[i] = nextDouble() + add;
			}
			return Array;
		}
	}
}

Measured memory_bytes: 25788
n = int(input())
X = list(map(int, input().split()))
D = []
for i, x in enumerate(X):
    D.append([x, i])
D.sort()
l = len(X)

left = D[l//2-1][0]
right = D[l//2][0]

ans = [0] * n
for i in range(n):
    idx = D[i][1]
    if i <= l//2-1:
        ans[idx] = right
    else:
        ans[idx] = left

for a in ans:
    print(a)

Measured memory_bytes: 42272
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float("INF")

#A
def A():
    n = II()
    if n < 1000:
        print("ABC")
    else:
        print("ABD")
    return

#B
def B():
    return

#C
def C():
    n = II()
    dp = [inf for i in range(n + 1)]
    ans = [1]
    x = 6
    while x <= n:
        ans.append(x)
        x = x * 6
    x = 9
    while x <= n:
        ans.append(x)
        x = x * 9
    ans.sort()
    for i in ans:
        dp[i] = 1
    for i in range(1, n + 1):
        if not i in ans:
            a = bisect.bisect_left(ans, i)
            for k in range(a):
                #print(i,ans[k], a)
                dp[i] = min(dp[i - ans[k]] + 1, dp[i])
    print(dp[n])

    return

#D
def D():
    n, c = LI()
    D = LIR(c)
    C = LIR_(n)
    CL = list(itertools.permutations(range(c), 3))
    ans = inf
    amari0 = [0 for i in range(30)]
    amari1 = amari0[::1]
    amari2 = amari0[::1]
    for y in range(n):
        for x in range(n):
            amari = (x + y) % 3
            if amari == 0:
                amari0[C[y][x]] += 1
            if amari == 1:
                amari1[C[y][x]] += 1
            if amari == 2:
                amari2[C[y][x]] += 1
    for c0, c1, c2 in CL:
        ansb = 0
        for i in range(c):
            ansb += D[i][c0] * amari0[i]
            ansb += D[i][c1] * amari1[i]
            ansb += D[i][c2] * amari2[i]
        ans = min(ans, ansb)

            
    print(ans)

    return

#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == '__main__':
    A()


Measured memory_bytes: 39920
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int H = sc.nextInt();
		int W = sc.nextInt();
		char s[][] =new char[H][W];
		for (int i=0;i<H;i++) {
			String str = sc.next();
			for(int j=0;j<W;j++) {
				s[i][j] = str.charAt(j);
			}
		}
		for (int i=0;i<H;i++) {
			for(int j=0;j<W;j++) {
				if (s[i][j]=='.') {
					int count =0;
					for (int m=-1;m<=1;m++) {
						for (int k=-1;k<=1;k++) {
							if(j+k<0) {
								continue;
							}
							if (j+k>=W) {
								continue;
							}
							if (i+m<0) {
								continue;
							}
							if (i+m>=H) {
								continue;
							}
							if (s[i+m][j+k]=='#') {
								count ++;
							}
						}
					}
					s[i][j] = (char) ('0' + count);
				}
			}
		}
		for (int i=0;i<H;i++) {
			for(int j=0;j<W;j++) {
				System.out.print(s[i][j]);
			}
			System.out.println();
		}
	}

}


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

n,q = map(int, input().split())
link = [[] for _ in range(n)]
for i in range(n-1):
    tmp = list(map(int,input().split()))
    link[tmp[0]-1].append(tmp[1]-1)
    link[tmp[1]-1].append(tmp[0]-1)

from collections import defaultdict
d = defaultdict(int)
for i in range(q):
    tmp = list(map(int,input().split()))
    d[tmp[0]-1]+=tmp[1]

from collections import deque
ans =[0]*n
finish  = {0}
Q = deque()
Q.append([0,0])
while Q:
    node= Q.popleft()
    finish.add(node[0])

    val = node[1] + d[node[0]]
    ans[node[0]]+=val

    for nxt in link[node[0]]:
        if nxt in finish:
            pass
        else:
            Q.append([nxt,val])

print(*ans)

Measured memory_bytes: 128112
import fractions
 
n = int(input())
a = [int(value) for value in input().split(" ")]
 
from_right_gcd = []
from_left_gcd = []
 
# 左から
for index in range(a.__len__()):
    if index == 0:
        from_left_gcd.append(a[index])
        continue
    from_left_gcd.append(fractions.gcd(from_left_gcd[index - 1], a[index]))
 
# 右から
for index in range(a.__len__() - 1, -1, -1):
    if index == a.__len__() - 1:
        from_right_gcd.append(a[index])
        continue
    from_right_gcd.append(fractions.gcd(from_right_gcd[a.__len__() - index - 1 - 1], a[index]))
 
maybe_answer_list = []
 
for index in range(a.__len__()):
    if index == 0:
        maybe_answer_list.append(from_right_gcd[a.__len__() - 1 - 1])
        continue
    if index == a.__len__() - 1:
        maybe_answer_list.append(from_left_gcd[index - 1])
        continue
    maybe_answer_list.append(fractions.gcd(from_left_gcd[index - 1], from_right_gcd[a.__len__() - index - 1 - 1]))
 
print(max(maybe_answer_list))

Measured memory_bytes: 16124
import java.util.*;
import java.util.Scanner;
public class Main {
    public static void main(String[] defargs) {
        Scanner scanner = new Scanner(System.in);
        while(true) {
		int n = scanner.nextInt();
		int x = scanner.nextInt();
			if(n == 0 && x == 0){
			    break;
			} 
		int answer = 0;
		for(int i = 1; i <= n; i++) {
			for(int j = i + 1; j <= n; j++) {
				for(int k = j + 1; k <= n; k++) {
					if(i + j + k == x){
					    answer++;
					} 
				}
			}
		}
		System.out.println(answer);
		}
	}
}


Measured memory_bytes: 26768
import java.util.Scanner;

public class Main {

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

        int plus = a + b;
        int multiple = a * b;
        int minus = a - b;

        int ans = Math.max(minus, Math.max(plus, multiple));
        System.out.println(ans);
    }
}



Measured memory_bytes: 21844
'use strict';

function Main(input) {
  let A = Number(input.split(" ")[0])
  let B = Number(input.split(" ")[1])

  let ans = 0

  if (A >= B) {
    ans += A
    A--
  } else {
    ans += B
    B--
  }

  if (A >= B) {
    ans += A
    A--
  } else {
    ans += B
    B--
  }

  console.log(ans)
};

Main(require("fs").readFileSync("/dev/stdin", "utf8").trim());


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

int main() {
    long long N;
    cin >> N;
    long long Numbers[] = {1, 2, 3, 4, 5, 6, 7, 8, 9};
    long long numbers[] = {1, 2, 3, 4, 5, 6, 7, 8, 9};
    bool find = false;
    for (long long i = 0; i <= 9; ++i) {
        for (long long j = 0; j <= 9; ++j) {
            if ((Numbers[i] * numbers[j]) == N) {
                find = true;
            }
        }
    }
    if (find == true) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(int argc,char **argv)
{

  int a,b,c;

  cin >> a >> b >> c;

  for(int i=1;i<100000;i++)
  {
    if((b*i + c ) % a == 0)
    {
      cout << "YES" << endl;
      return 0;
    }
  }
  cout << "NO" << endl;


}


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

int main() {
  int k, x;
  cin >> k >> x;
  int start = max(-1000000, x - k + 1);
  int end = min(1000000, x + k - 1);
  for (int i = start; i <= end; i++) cout << i << endl;
}

Measured memory_bytes: 256
import sys
def input():
    return sys.stdin.readline()[:-1]
sys.setrecursionlimit(200000)
N=int(input())
s=[[]for i in range(N)]
c=[None]*N
for i in range(N-1):
    u,v,w=map(int,input().split())
    s[v-1].append((u,w%2))
    s[u-1].append((v,w%2))
def mu(n,l,co):
    for i in l:
        if c[i[0]-1]==None:
            if co==i[1]%2:
                c[i[0]-1]=0
                mu(i,s[i[0]-1],0)
            else:
                c[i[0]-1]=1
                mu(i,s[i[0]-1],1)
mu(1,s[0],0)
print(*c,sep="\n")

Measured memory_bytes: 152240
#include<iostream>
#include<vector>
#include<algorithm>
#include<numeric>
using namespace std;
int main()
{
    int n;
    cin >> n;
  
    int max, max_index, second, tmp;
    max = max_index = second = 0;
    for (int i = 0; i < n; i++) {
      cin >> tmp;
      if (tmp > max) { second = max; max = tmp; max_index = i; }
      else if (tmp > second) { second = tmp; }
    }
    for (int i = 0; i < n; i++) {
      if (i == max_index) cout << second << endl;
      else cout << max << endl;
    }
    return 0;
}

Measured memory_bytes: 1664
#include<iostream>
#include<string>
#include<vector>
#include<list>
#include<cmath>
#include<algorithm>
#include<cstdio>
#include<set>
#include<map>
#include<queue>
#include<cstring>
#include<sstream>
using namespace std;

typedef long long ll;
ll app[26];
int main() {
  int N; cin >> N;
  ll ans = 1;
  string s; cin >> s;
  for ( int i = 0; i < N; i++ ) {
    app[s[i]-'a']++;
  }

  for ( int i = 0; i < 26; i++ ) {
    if ( app[i] ) {
      ans *= app[i]+1;
      ans %= 1000000007;
    }
  }

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


Measured memory_bytes: 512
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <vector>
#include <queue>
#include <cassert>
using namespace std;

typedef long long i64;
typedef pair<i64, int> pii;

const int MAX_N = 100005, MOD = 1000000007;
const i64 inf = 0x3f3f3f3f3f3f3f3f;

class Edge {
public:
  int nxt, to, w;
} e[MAX_N << 2];
int head[MAX_N], cnt;
void addedge(int u, int v, int w) {
  e[++cnt] = (Edge){head[u], v, w}, head[u] = cnt;
  e[++cnt] = (Edge){head[v], u, w}, head[v] = cnt;
}

int N, M, S, T;
i64 dis1[MAX_N], dis2[MAX_N];

priority_queue<pii, vector<pii>, greater<pii> > q;

void dijkstra(int s, i64 *dis) {
  static bool vis[MAX_N];
  memset(vis, 0, sizeof vis);
  for (int i = 1; i <= N; ++i) dis[i] = inf;
  dis[s] = 0;
  q.push(make_pair(0, s));

  while (!q.empty()) {
    int u = q.top().second;
    q.pop();
    if (vis[u]) continue;
    vis[u] = 1;
    for (int i = head[u]; i; i = e[i].nxt)
      if (dis[e[i].to] > dis[u] + e[i].w) {
	dis[e[i].to] = dis[u] + e[i].w;
	q.push(make_pair(dis[e[i].to], e[i].to));
      }
  }
}

i64 way1[MAX_N], way2[MAX_N];

vector<int> G[MAX_N];
bool vis[MAX_N];
int st[MAX_N], top;

void dfs(int u) {
  vis[u] = 1;
  for (int i = 0; i < G[u].size(); ++i)
    if (!vis[G[u][i]])
      dfs(G[u][i]);
  st[++top] = u;
}

void get(int s, i64 *dis, i64 *way) {
  memset(vis, 0, sizeof vis), top = 0;
  for (int i = 1; i <= N; ++i) G[i].clear();
  for (int u = 1; u <= N; ++u)
    for (int i = head[u]; i; i = e[i].nxt)
      if (dis[e[i].to] == dis[u] + e[i].w) 
	G[e[i].to].push_back(u);
  for (int i = 1; i <= N; ++i)
    if (!vis[i])
      dfs(i);
  way[s] = 1;
  for (int i = 1; i <= N; ++i) {
    int u = st[i];
    for (int j = 0; j < G[u].size(); ++j)
      way[u] = (way[u] + way[G[u][j]]) % MOD;
  }
}

int main() {
  scanf("%d%d", &N, &M);
  scanf("%d%d", &S, &T);
  for (int i = 1; i <= M; ++i) {
    int u, v, w;
    scanf("%d%d%d", &u, &v, &w);
    addedge(u, v, w);
  }
  
  dijkstra(S, dis1);
  dijkstra(T, dis2);

  get(S, dis1, way1);
  get(T, dis2, way2);

  assert(way1[T] == way2[S]);
  i64 result = way1[T] * way2[S] % MOD;
  for (int u = 1; u <= N; ++u) {
    if (dis1[u] == dis2[u] && dis1[u] + dis2[u]  == dis1[T]) 
      result = (result - way1[u] * way2[u] % MOD * way1[u] % MOD * way2[u] % MOD) % MOD;
  }
  for (int u = 1; u <= N; ++u)
    for (int i = head[u]; i; i = e[i].nxt) {
      int v = e[i].to;
      if (dis1[u] + e[i].w + dis2[v] != dis1[T]) continue;
      if (dis1[u] * 2 < dis1[T] && dis2[v] * 2 < dis1[T]) {
	result = (result - way1[u] * way2[v] % MOD * way1[u] % MOD * way2[v] % MOD) % MOD;
      }
    }
  printf("%lld\n", (result + MOD) % MOD);
  return 0;
}


Measured memory_bytes: 17792
import sys
sys.setrecursionlimit(200000)
n = int(input())
graph = {i: [] for i in range(1, n + 1)}
for _ in range(n - 1):
    u, v, ww = map(int, input().split())
    graph[u].append([v,ww])
    graph[v].append([u,ww])
color = [-1] * n

def dfs(x):
    for sub in graph[x]:
        next = sub[0]
        lon = sub[1]
        if color[next - 1] != -1:
            continue
        if lon % 2 == 0:
            color[next - 1] = color[x - 1]
        else:
            if color[x - 1] == 1:
                color[next - 1] = 0
            else:
                color[next - 1] = 1
        dfs(next)

color[0] = 0
dfs(1)
for i in color:
    print(i)

Measured memory_bytes: 93580
#include<iostream>
using namespace std;
int main(){
        int i,a[3];
        for(i=0;i<3;i++){
                cin >> a[i];
        }
        for(i=0;i<3;++i){
                for(int j=1;j<3-i;++j){
                        if(a[j]<a[j-1]){
                                int tmp= a[j];
                                a[j] = a[j-1];
                                a[j-1]= tmp;
                        }
                }
        }
                cout << a[0] << " " << a[1]
                     << " " << a[2] << endl;
}


Measured memory_bytes: 3100
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int a,b,x,i,j,gou=0,ans,ans1;
    cin>>a>>b>>x;
    for(i=0;;i++){
        if(a<b&&x<=1000){
            gou=a;
            x=0;
            break;
        }
        else if(a<b){
            ans=x/1000;
            gou=a*ans;
            x=0;
            break;
        }
        if(a>=(b*2)){
        
            break;
        }
        
        if(x<=500&&i==0){
            gou=gou+b;
            x=-1;
            break;
        }
        
        if(x<500){
            break;
        }
        x=x-1000;
        gou=gou+a;
    }
    for(j=0;;j++){
    if(x<=0){
    break;    
    }
    x=x-500;
    gou=gou+b;
    }
    cout<<gou<<endl;
    
}



Measured memory_bytes: 3116
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define pi acos(-1.0)
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
 
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) c.begin(), c.end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int main(){
    ll a, b;
    cin >> a >> b;
    if (a == b){
        cout << 1 << endl;
        return 0;
    }
    int n;
    FORR(i,60,0){
        int x = (a >> i) & 1;
        int y = (b >> i) & 1;
        if (x == y){
            a -= x * (1LL << i);
            b -= x * (1LL << i);
        }else{
            n = i;
            break;
        }
    }

    ll t = (1LL << n);
    int m = -1;
    FORR(i,n-1,0){
        if ((b >> i) & 1){
            m = i;
            break;
        }
    }

    ll ma = t + (1LL << (m+1)) - 1;
    ll mi = t | a;

    ll ans = 0;
    if (ma < mi){
        ans = ma - a + 1 + 2*t - mi;
    }else{
        ans = 2*t - a;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <string>
#include <iostream>
using namespace std;
struct Node{
  int key;
  Node *right,*left,*parent;
};
Node *root,*NIL;
void insert(int k){
  Node *y = NIL;
  Node *x = root;
  Node *z;
  z=(Node *)malloc(sizeof(Node));
  z->key=k;
  z->left=NIL;
  z->right=NIL;
  while(x!=NIL){
    y=x;
    if(z->key < x->key){
      x=x->left;
    }else{
      x=x->right;
    }
  }
  z->parent=y;
  if(y==NIL){
    root = z;
  }else{
    if(z->key < y->key){
      y->left=z;
    }else{
      y->right=z;
    }
  }
}

void inorder(Node *u){
  if(u==NIL) return ;
  inorder(u->left);
  printf(" %d",u->key);
  inorder(u->right);
}
void preorder(Node *u){
  if(u==NIL) return ;
  printf(" %d",u->key);
  preorder(u->left);
  preorder(u->right);
}

int main(){
  int n,i,x;
  string com;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    cin >>com;
    if(com =="insert"){
      scanf("%d",&x);
      insert(x);
    }else if(com == "print"){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
  }
  return 0;
}


Measured memory_bytes: 26724
n, m, l= map(int,input().split())
A = [list(map(int,input().split())) for _ in range(n)]
B = [list(map(int,input().split())) for _ in range(m)]
for i in range(n):
  t = [str(sum([A[i][k]*B[k][j] for k in range(m)])) for j in range(l)]
  print(" ".join(t))


Measured memory_bytes: 6300
#include <iostream>
using namespace std;
int main(){
    int x,y;
    while (1) {
        cin>>x>>y;
        if(x==0&&y==0)break;
        if(x>y){
            cout<<y<<" "<<x<<endl;
        }else{
            cout<<x<<" "<<y<<endl;
        }
    }
    return 0;
}

Measured memory_bytes: 2996
#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  for (int i = 0;i < s.length();i++) {
    if (s.at(i) == '9') {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
}

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

int main() {
  cin.tie(0); ios::sync_with_stdio(false);
  long long a, b; cin >> a >> b;
  if (a <= 0 && b >= 0) {
    cout << "Zero" << "\n";
    return 0;
  }
  if (a > 0) {
    cout << "Positive" << "\n";
    return 0;
  }
  if ((b - a + 1) % 2 == 1) cout << "Negative" << "\n";
  else cout << "Positive" << "\n";
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define int int64_t
#define double long double
#define rep(i, N) for(int i=0; i<N; i++)
#define repr(i, N) for(int i=N-1; i>=0; --i)
#define all(v) v.begin(),v.end() 
using namespace std;
//using pr = pair<int, int>;
using tup  = tuple<int, int, int>;
using vec  = vector<int>;
using vvec = vector<vec>;

//プロトタイプ宣言

//グローバル変数
//const int INF = ;
//const int MAX_N = ;
//const int MAX_M = ;
//vvec dp(MAX_N, vec(MAX_M));

//関数：
/* メイン・プログラム */
signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);

	int h, w, n; cin >> h; cin >> w; cin >> n;
	int mx, mn;
	mx = max(h, w); mn = min(h, w);

	int ct = 0;
	int amn = 0;
	for(int i=1; i<=mn; i++) {
		amn += mx;
		ct++;
		if(amn >= n) break;
	}
	
	cout << ct << endl;
	return 0;
}

/*	(n * m) % dvs = ((n%dvs) * (m%dvs)) % dvs
*/

//std::string str;
//str = std::to_string(int i);
//bitset<3> s(N);
//int ans = (char)grid - '0';
//int id = lower_bound(all(arr), x) - arr.begin();
//cout << fixed << setprecision(10) << tld << endl;
//vector<int> sub(itr,itr+d); //イテレーターで部分数列(i=0...d)を指定

/*	struct data {
	char *name;
	int age;
	int height;
	double weight;
};*/

/*	string ans(lgd, '0');
	string &refer = ans;
	for(int i=0; i<lgd; i++) refer[i] = (char)vd[i] + '0';*/

/*	map<int,int> mp;
for(auto p : mp) {
	ct += p.second*(p.second-1); }

map<int,int>::iterator itr;
for(itr = mp.begin(); itr != mp.end(); itr++) {
	ans += itr->second * (itr->second-1);
}*/


Measured memory_bytes: 256
import sys
input_lines1 = sys.stdin.readlines()
for line in input_lines1:
    strBuf = line.replace('\n', '').split(' ')

    if int(strBuf[0]) <= 6 :
        print 1
    elif (int(strBuf[0])) <= 11:
        print 2
    elif (int(strBuf[0])) % 11 == 0:
        print (int(strBuf[0])) / 11 * 2

    elif (int(strBuf[0])) % 11 > 0:
        if (int(strBuf[0])) % 11 > 6 :
            print (int(strBuf[0])) / 11 * 2 + 2
        else :
            print (int(strBuf[0])) / 11 * 2 + 1


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

typedef long long   signed int LL;
typedef long long unsigned int LU;

#define incID(i, l, r) for(int i = (l)    ; i <  (r); i++)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define  inc(i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define  dec(i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)

#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))

#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define UB upper_bound
#define LB lower_bound
#define PQ priority_queue

#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
#define  FOR(it, v) for(auto it =  v.begin(); it !=  v.end(); ++it)
#define RFOR(it, v) for(auto it = v.rbegin(); it != v.rend(); ++it)

template<typename T> bool   setmin(T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool   setmax(T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

// ---- ----

int w, h, n, x[100], y[100], a[100];
int f[100][100];

int main() {
	cin >> w >> h >> n;
	inc(i, n) { cin >> x[i] >> y[i] >> a[i]; }
	
	inc(i, n) {
		inc(xx, w) {
		inc(yy, h) {
			if(a[i] == 1 && xx <  x[i]) { f[xx][yy] = 1; }
			if(a[i] == 2 && xx >= x[i]) { f[xx][yy] = 1; }
			if(a[i] == 3 && yy <  y[i]) { f[xx][yy] = 1; }
			if(a[i] == 4 && yy >= y[i]) { f[xx][yy] = 1; }
		}
		}
	}
	
	int ans = 0;
	inc(xx, w) {
	inc(yy, h) {
		if(f[xx][yy] == 0) { ans++; }
	}
	}
	
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a, b, x; cin >> x >> a >>b;
  if(b-a >x) cout << "dangerous" << endl;
  else if(b-a >0) cout << "safe" << endl;
  else cout << "delicious" << endl;
  return 0;
}
  


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

int main(void){
	int n;
	int x[101];
	for(int i=0; i<101; i++)
		x[i] = 0;

	while(cin>>n){
		x[n]++;
	}

	vector<int> res;
	int max = 0;

	for(int i=1; i<101; i++){
		if(x[i] > max){
			max = x[i];
			res.clear();
			res.push_back(i);
		}else if(x[i] == max){
			res.push_back(i);
		}
	}

	for(int i=0; i<res.size(); i++){
		cout << res[i] << endl;
	}

	return 0;
}

Measured memory_bytes: 0
#include"bits/stdc++.h"
using namespace std;
typedef long long int ll;
#define crap ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

ll solve(ll arr[],ll n){
    if( n == 2 ){
        return abs(arr[1]-arr[0]);
    }
    ll dp[n];
	memset(dp,0,sizeof(dp));
    dp[1] = abs(arr[1]-arr[0]);
    for( ll i=2; i<n; i++ ){
        ll op1 = abs(arr[i]-arr[i-1]) + dp[i-1];
        ll op2 = abs(arr[i]-arr[i-2]) + dp[i-2];
        dp[i] = min(op1,op2);
    }
    return dp[n-1];
}

int main() {
	crap;
	ll n;
	cin >> n;
	ll arr[n];
	for( int i=0; i<n; i++ ){
	    cin >> arr[i];
	}
	cout << solve(arr,n);
	
	return 0;
}

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

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

 
typedef pair<int,int> P;
typedef long long ll;
 
const int INF = 1001001001;
const int MOD = 1000000007;
const double PI=acos(-1);

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

    string ans = "Yes";

    while (A>=B) {
        if (K==0) {
            break;
        }
        B*=2;
        K--;
    }
    while(B>=C) {
        if (K==0) {
            break;
        }
        C*=2;
        K--;
    }
    if (A<B && B<C) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}

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

using namespace std;

using ll = long long;
using vi = vector<int>;

const ll linf = 1LL << 62;
const int inf = 999999;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
const ll atcoder = int(1e9 + 7);

#define Endl endl
#define pr(x) cout << x << endl
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)
#define all(x) x.begin(),x.end()
#define atcoder(int)1e9+7
#define rep(i,n) for(int i = 0;i<n;i++)
#define pb(x) push_back(x)
#define mp(a,b) make_pair(a,b)


ll gcd(ll a, ll b) {//最大公約数
	if (a%b == 0)return b;
	else gcd(b, a%b);
}

ll lcm(ll a, ll b) {//最小公倍数
	return (a / gcd(a, b))*b;
}

ll dp[1010][1010];

int  main() {
		
	ll a, b;
	ll ans = 0;

	cin >> a >> b;

	if (a < 0 && b < 0) {
		if(abs(abs(a) - abs(b)) %2 == 0)cout << "Negative" << Endl;
		else  pr("Positive");
	}
	else if (a == 0 && b == 0 || a*b < 0)
		cout << "Zero" << Endl;
	else if (a > 0 && b > 0)
		cout << "Positive" << endl;
	else {
		if (a > b) {
			if (b % 2 == 1)pr("Negative");
			else pr("Positive");
		}
		else {
			if (b % 2 == 1)pr("Negative");
			else pr("Positive");
		}
	}

	return 0;

}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<cstring>
#include<sstream>
using namespace std;
 
#define P(p) cout<<(p)<<endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define vsort(v) sort(v.begin(), v.end());
#define rvsort(v) sort(v.begin(), v.end(),greater<int>());
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return
#define lb(v,n) lower_bound(v.begin(),v.end(),n)
#define ub(v,n) upper_bound(v.begin(),v.end(),n)
#define mae(v) max_element(v.begin(),v.end())
#define mie(v) min_element(v.begin(),v.end())
#define INF 0x7FFFFFFF
#define mod 1000000007
typedef long long ll;
////////////////////////////////////////////////////////////

int main(){
	int n;
	cin >> n;
	ll a[n];
	rep(i,0,n) cin >> a[i];
	
	ll s = 0 , s2 = 0;
	ll cnt = 0 , cnt2 = 0;
	rep(i,0,n){
		s += a[i];
		s2 += a[i];
		
		if( i%2 && s >= 0 ){
			cnt += abs(s - (-1));
			s = -1;
		}
		
		if( !(i%2) && s <= 0 ){
			cnt += abs(s - 1 );
			s = 1;
		}

		if( i%2 && s2 <= 0 ){
			cnt2 += abs(s2 - 1);
			s2 = 1;
		}

		if( !(i%2) && s2 >= 0 ){
			cnt2 += abs(s2 - (-1) );
			s2 = -1;
		}

		//cout << "s:" << s << " cnt:" << cnt << " s2:" << s2 << " cnt2:" << cnt2 << endl;

	}

	cout << min( cnt , cnt2 ) << endl;
	ret 0;
}

Measured memory_bytes: 1024
let n=read_int()open Array
let a=init n(fun _->Scanf.scanf"%d "(fun e->e))and b=make n 0and c=make 10001 0;;iter(fun e->c.(e)<-c.(e)+1)a;iteri(fun i _->if i<>0then c.(i)<-c.(i)+c.(i-1))c;for i=n-1downto 0do c.(a.(i))<-c.(a.(i))-1;b.(c.(a.(i)))<-a.(i);done;print_int b.(0);for i=1to n-1do print_string" ";print_int b.(i);done;print_newline()

Measured memory_bytes: 36196
def aa
	a = gets.chomp.to_i
	b = gets.chomp.to_i
	c = gets.chomp.to_i
	d = gets.chomp.to_i
	e = gets.chomp.to_i
	k = gets.chomp.to_i

    if
    (a-b).abs <= k and
    (a-c).abs <= k and
    (a-d).abs <= k and
    (a-e).abs <= k and
    (b-c).abs <= k and
    (b-d).abs <= k and
    (b-e).abs <= k and
    (c-d).abs <= k and
    (c-e).abs <= k and
    (d-e).abs <= k
        puts 'Yay!'
    else
        puts ':('
    end
end

aa


Measured memory_bytes: 1788
#include <stdio.h>
#include <math.h>

int main(int argc, const char * argv[]) {
    int n,i;
    double x1,y1,x2,y2,x3,y3,px,py,a,b,c,d,e,f,r;
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3);
        a=2*(x2-x1);
        b=2*(y2-y1);
        c=((x2*x2)-(x1*x1))+((y2*y2)-(y1*y1));
        d=2*(x3-x1);
        e=2*(y3-y1);
        f=((x3*x3)-(x1*x1))+((y3*y3)-(y1*y1));
        px=(c*e-b*f)/(a*e-b*d);
        py=(c*d-a*f)/(b*d-a*e);
        r=sqrt((px-x1)*(px-x1)+(py-y1)*(py-y1));
        px=round(px*1000)/1000+0;
        py=round(py*1000)/1000+0;
        r=round(r*1000)/1000+0;
        printf("%.3f %.3f %.3f\n",px,py,r);
    }
    return 0;
}

Measured memory_bytes: 676
# dfs版
def dfs(d, A, B, C, f):
    global ans
    if d == n:
        if not 0 in [A, B, C]:
            ans = min(ans, abs(a - A) + abs(b - B) + abs(c - C) + f - 30)
        return
    dfs(d + 1, A, B, C, f)
    dfs(d + 1, A + l[d], B, C, f + 10)
    dfs(d + 1, A, B + l[d], C, f + 10)
    dfs(d + 1, A, B, C + l[d], f + 10)


n, a, b, c = map(int, input().split())
l = [int(input()) for _ in range(n)]
ans = 10 ** 10
dfs(0, 0, 0, 0, 0)
print(ans)


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

// Macros
#define F  first
#define S  second
#define PB push_back

// Rename Datatypes
using ll  = long long;
using ld  = long double;
using pii = pair<int,int>;

// Common Functions
ll fastpow(ll a, ll ex){ ll res = 1; while(ex){ if(ex & 1) res *= a; a *= a; ex >>= 1; } return res; }
ll fastpow(ll a, ll ex, ll m){ a %= m; ll res = 1; while(ex){ if(ex & 1) res = (a*res) % m; a = (a*a) % m; ex >>= 1; } return res; }
ll modinverse(ll a, ll m){ ll m0 = m, y = 0, x = 1; while (a > 1){ ll q = a / m; a %= m; swap(a,m); x -= q*y; swap(x,y); } if(x < 0) x += m0; return x; }

// HELPERS
//  Tedious Grid Movements
vector<pii> moves_grid = { {0,1} , {0,-1} , {1,0} , {-1,0} };
inline bool move_okay(int x, int y, int n, int m) { return 0 <= x and x < n and 0 <= y and y < m; }
//  Remember:
//   * vec.assign() GOOD; vec.resize() BAD
//   * comparator uses <

// Output, Common Containers
template <typename T> ostream& operator << (ostream &os, const vector<T> &v) { for (T i : v) os << i << ' '; return os; }
template <typename T> ostream& operator << (ostream &os, const set<T> &v)    { for (T i : v) os << i << ' '; return os; }
template <typename T, typename S> ostream& operator << (ostream &os, const pair<T,S> &v) { os << "(" << v.F << "=>" << v.S << ") "; return os; }
template <typename T, typename S> ostream& operator << (ostream &os, const map<T,S> &v)  { for (auto i : v) os << i << ' '; return os; }

// Debugging
#ifdef SANYAM1101
	#define trace(args...) do{ cerr << "TRACE ON! (Line: " << __LINE__ << ")\n"; auto _stream = istringstream{string{#args}}; d_f(_stream, args); } while(0)
	void d_f(__attribute__((unused)) istringstream& _stream) {}
	template<typename Head, typename... Tails> void d_f(istringstream& _stream, Head H, Tails... T) { string _name; _stream >> _name; if(_name.back() == ',') _name.pop_back(); cerr << "\t" << _name << " <=> [" << H << "]\n"; d_f(_stream, T...); }
#else
	#define trace(args...)
#endif


// CODE STARTS HERE

void solve(){
	int n;
	cin >> n;

	string s;
	cin >> s;

	string ans = "";

	int cou = 0;
	for(auto ch: s){
		ch == '(' ? ++cou : --cou;
		ans += ch;
		if(cou < 0){
			ans = string(-cou, '(') + ans;
			cou = 0;
		}
	}

	if(cou > 0) ans += string(cou, ')');

	cout << ans << "\n";
}

signed main (void){
	// Fast_IO
	ios::sync_with_stdio(false);
	cin.tie(nullptr);

	// Set Fixed Notation (default sucks), High Precision for Floating-Point Output
	cout << fixed << setprecision(20);

	// Multiple TCs
	int tt = 1;
	// cin >> tt;
	while(tt--) solve();
}


Measured memory_bytes: 3584
import java.util.Scanner;

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

		for(int i=0;i<N;i++) {
			d[i]=sc.nextInt();
		}

		for(int i=0;i<N;i++) {
			for(int j=i+1;j<N;j++) {
				ans+=d[i]*d[j];
			}
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 21332
#include <stdio.h>

int n;
int temp1[1000], temp2[1000];

void k_cut(int card[], int k)
{

	int i, j, l, cnt = 0;

	for(i = 0; i < k; i++) {
		temp1[i] = card[i];
	}
	for(j = i; j < 2 * n; j++, cnt++) {
		temp2[cnt] = card[j];
	}

	for(i = 0; i < cnt; i++) {
		card[i] = temp2[i];
	}
	for(j = i, l = 0; j < i + k; j++) {
		card[j] = temp1[l++];
	}

}

void riffle_shuffle(int card[])
{

	int i, j, l;

	for(i = 0; i < n; i++) {
		temp1[i] = card[i];
	}
	for(j = i, l = 0; j < 2 * n; j++, l++) {
		temp2[l] = card[j];
	}

	for(i = 0, j = 0; i < 2 * n; i += 2, j++) {
		card[i] = temp1[j];
		card[i + 1] = temp2[j];
	}

}

int main(void)
{

	int m, k, i;
	int card[1000];

	scanf("%d %d", &n, &m);

	for(i = 0; i < 2 * n; i++) {
		card[i] = i + 1;
	}

	for(i = 0; i < m; i++) {
		scanf("%d", &k);
		if(k > 0) {
			k_cut(card, k);
		}
		else {
			riffle_shuffle(card);
		}
	}

	for(i = 0; i < 2 * n; i++) {
		printf("%d\n", card[i]);
	}

	return 0;

}

Measured memory_bytes: 608
#include<stdio.h>
#include<string.h>
#include<math.h>
int main(void)
{
	int s,d,f[200][200],g,h,j,i,k;
	char a[200][200];
	scanf("%d %d",&s,&d);
	for(i=0;i<s;i++){
		for(j=0;j<d;j++)
		f[i][j]=-1;
	}
	for(i=0;i<s;i++){
		scanf("%s",&a[i]);
	}
	for(i=0;i<s;i++){
		for(j=0;j<d;j++){
			if(a[i][j]=='c')
				f[i][j]=0;
		}
	}
	for(i=0;i<s;i++){
		for(j=0;j<d;j++){
			if(f[i][j]!=-1){
				if(f[i][j+1]==-1){
					if(j+1<d)
						f[i][j+1]=f[i][j]+1;
				}
			}
		}
	}
	for(i=0;i<s;i++){
		for(j=0;j<d;j++){
			printf("%d",f[i][j]);
			if(j<d-1)
			printf(" ");
		}
		printf("\n");
	}
	return 0;
}

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

using namespace std;
using ll = long long;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vpii = vector<pair<int, int>>;


int main()
{
  int n;
  cin >> n;
  vpii data(n);
  ll sum = 0;
  bool A = true;
  for (int i = 0; i < n; i++)
  {
    int a, b;
    cin >> a >> b;
    data[i] = make_pair(b, a);
  }
  sort(data.begin(), data.end());
  for (int i = 0; i < n; i++)
  {
    int b, a;
    tie(b, a) = data[i];
    sum += a;
    if (sum > b)
    {
      A = false;
      break;
    }
  }
  if (A)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

Measured memory_bytes: 4816
#include <bits/stdc++.h>
//#include <vector>
#include <string>
#include <algorithm> // sort
#include <map> // pair
using namespace std;

int main(){
  int N;
  cin >> N;

  //N角形の内角の和は180 * N - 360
  int ans = 180 * N - 360;
  cout << ans << endl;

}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main(void) {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(a.begin(), a.end());
  a.push_back(-1);
  int count = 0;
  int last = a[0];
  int ans = 0;
  for (int i = 0; i < n + 1; i++) {
    if (a[i] == last) {
      count++;
    } else {
      if (count >= last) {
        ans += count - last;
      } else {
        ans += count;
      }
      last = a[i];
      count = 1;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1024
import java.util.Scanner;

/**
 * https://abc043.contest.atcoder.jp/tasks/arc059_b
 */
public class Main {

	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		sc.close();
		
		char[] chars = s.toCharArray();
		int left = -1;
		int right = -1;
		for(int l=1; l<=3; l++){
			for(int i=0; i<chars.length-l; i++){
				int[] tmp = new int[26];
				for(int k=0; k<=l; k++){
					tmp[chars[i+k]-'a']++;
				}
				for(int t: tmp){
					if(t*2>l+1){
						left = i+1;
						right = i+l+1;
						break;
					}
				}
				if(left>=0) break;
			}
			if(left>=0) break;
		}
		
		System.out.println(left+" "+right);
		
	}

}


Measured memory_bytes: 44092
#include <bits/stdc++.h>
#define PII pair<int, int>
#define LL long long
using namespace std;
const int MAXN = 200005;
const LL MOD = 998244353;
const LL INF = (LL)1e9 + 5;

int N, h[MAXN], a[MAXN];
LL dp[MAXN];

void solve(int l, int r) {
	if (r - l == 1) {
		dp[l] += a[l];
		return;
	}
	
	int m = (l + r) >> 1;
	solve(l, m);
	vector<pair<int, LL>> v1, v2;
	for (int i = l; i < m; i++) {
		v1.push_back({h[i], dp[i]});
	}
	for (int i = m; i < r; i++) {
		v2.push_back({h[i], i});
	}
	sort(v1.begin(), v1.end());
	sort(v2.begin(), v2.end());
	
	int p1 = 0;
	LL take = 0;
	for (int p2 = 0; p2 < v2.size(); p2++) {
		while (p1 < v1.size() && v1[p1].first < v2[p2].first) {
			take = max(take, v1[p1].second);
			p1++;
		}
		dp[v2[p2].second] = max(dp[v2[p2].second], take);
	}
	solve(m, r);
}

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
	
	cin >> N;
	for (int i = 0; i < N; i++) cin >> h[i];
	for (int i = 0; i < N; i++) cin >> a[i];
	solve(0, N);
	cout << *max_element(dp, dp + N) << '\n';
	
	return 0;
}

Measured memory_bytes: 11948
#include <cstdio>
#include <cstring>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <string>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
typedef long long ll;


ll gcd(ll a, ll b) {
  return b == 0 ? a : gcd(b, a%b);
}

ll xs[100000+10];

int main(void) {
  int n;
  scanf("%d%lld", &n, &xs[0]);
  REP(i, n) {
    scanf("%lld", &xs[i+1]);
  }
  sort(xs, xs + n+1);
  ll res = xs[1] - xs[0];
  REP(i, n) {
    res = gcd(res, xs[i+1] - xs[i]);
  }
  printf("%lld\n", res);
  return 0;
}



Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int>pii;
#define sf(x) scanf("%d",&x)
#define sfl(x) scanf("%lld",&x)
#define lli long long int
#define ll64 int64_t
#define pb push_back
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define frr(i,a) for(int i=0;i<a;i++)
#define frl(i,a) for(lli i=0;i<a;i++)
int main()
{
    lli n;
    cin>>n;
    string s;
    cin>>s;
    lli c=0;
    for(int i=0;i<n;i++)
    {
        if(s[i]=='W')
        {
            c++;
        }
    }
    lli ans=0;
    for(int i=0;i<n-c;i++)
    {
        if(s[i]=='W')
        {
            ans++;
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 3744
#include <queue>
#include <cstdio>
#include <iostream>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <sstream>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

ll N;

ll ans = 0;

ll mi = INF;

int main()
{
	cin >> N;
	for (ll i = 0; i < 5; i++)
	{
		ll tmp;
		cin >> tmp;
		if (i == 0) mi = tmp;
		else mi = min(mi, tmp);
	}

	ans = N / mi;
	if (N % mi != 0) ans++;

	ans += 4;

	cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
 using namespace std;
 int main()
 {
 	int a[101]={0};
 	int n,x;
 	cin>>n;
 	
 	for(int i=1;i<=n;i++)
 	{
 		cin>>x;
 	    a[x]=1;
 	}
 	int s=0;
 	for(int i=1;i<=100;i++)
 	{
 	    if(a[i]==1)  s++;	
 	}
 	cout<<s<<endl;
 	
 	return 0;
 }

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <cstring>
#include <limits>
using namespace std;
#define ll long long int
#define lli long long int
#define fw(i, s, e) for (ll i = s; i < e; ++i)
#define fe(i, s, e) for (ll i = s; i <= e; ++i)
#define fb(i, e, s) for (ll i = e; i >= s; --i)
#define L(T)  \
    ll T;     \
    cin >> T; \
    while (T--)
#define FASTIO                   \
    ios::sync_with_stdio(false); \
    cin.tie(nullptr);            \
    cout.tie(nullptr);
#define mem(a, i) memset(a, i, sizeof(a))
#define ld long double
#define endl "\n"
#define in(P) \
    ll P;     \
    cin >> P;
ll h[100034];
int main()
{
    FASTIO
    // L(T)
    {
        in(n);

        ll a[n + 90];
        ll s = 0;
        fw(i, 0, n)
        {
            cin >> a[i];
            h[a[i]]++;
            s += a[i];
        }
        in(q);
        fw(i, 0, q)
        {
            in(b);
            in(c);
            ll temp = c * h[b] - b * h[b];
            h[c] = h[c] + h[b];
            h[b] = 0;
            s += temp;
            cout << s << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 5220
package main

import (
  "fmt"
)

func main() {

  var a, b, c int

  fmt.Scan(&a, &b, &c)

  rest := a - b
  fmt.Println(max(c - rest, 0))
}

func max(x, y int) int {
    if x < y {
        return y
    }
    return x
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
typedef double db;
bool comp(int a,int b){
return a>b;
}
mt19937 mrand(random_device{}());
const ll mod=1000000007;
int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
int main()
{
	fast;
	rep(i,1,6)
	{
		ll a;
		cin>>a;
		if(!a){
		
		cout<<i;
		return 0;
	}
	}

}



Measured memory_bytes: 3620
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] line = br.readLine().split(" ");
		int x = Integer.parseInt(line[0]);
		int y = Integer.parseInt(line[1]);
		int r;

		while( (r = x % y) != 0 ) {
			x = y;
			y = r;
		}

		System.out.println(y);
	}
}

Measured memory_bytes: 24508