akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
int main(){
  int n;
  char a[n+1];
  
  scanf("%d",&n);
  if(n%2!=0){
    printf("No");
    return 0;
  }
  scanf("%s",a);
  for(int i=0;i<n/2;i++){
    if(a[i]!=a[n/2+i]){
      printf("No");
      return 0;
    }
  }
  printf("Yes");
}


Measured memory_bytes: 1740
#include <cmath>
#include <cstdio>
#include <vector>
#include <list>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <stack>
#include <fstream>
#include <queue>
#include <iomanip>
#include <iterator>
#include <map>
#include <unordered_map>
#include <set>
#include <assert.h>
#include <numeric>
#define fast ios_base::sync_with_stdio(false)
#define mxn (ll)(5e5+5)
#define mod (ll)(1e9+7)
#define mod1 (ll)(998244353)
#define ll long long int
#define ld long double
#define vi vector<ll>
#define vvi vector<vi >
#define pi pair<ll,ll>
#define vvpi vector<vector<pi > >
#define vpi vector<pi >
#define vppi vector<pair<ll,pi > >
#define vs vector<string>
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define pb push_back
#define eb emplace_back
#define mkp make_pair
#define fs first
#define se second
#define crz(v,n) v.clear(),v.resize(n+1,0)
#define print(v) for(ll it=0;it<v.size();it++) cout<<v[it]<<" ";cout<<endl
#define printp(v) for(ll it=0;it<v.size();it++) cout<<v[it].first<<" "<<v[it].second<<endl
using namespace std;
int bit[mxn];
void add(int x,int v){
	for(;x<mxn;x+=x&(-x)) bit[x]+=v;
}int query(int x){
	int s=0;for(;x;x-=x&(-x)) s+=bit[x];
	return s;
}
int main(){fast;
	int n,q,i;cin>>n>>q;vector<int>c(n),ans(q),mp(mxn,0);for(i=0;i<n;i++) cin>>c[i];
	vector<vector<pair<int,int> > >v(mxn);
	for(i=0;i<q;i++){
		int x,y;cin>>x>>y;
		v[y].pb(mkp(x,i));
	}for(i=0;i<n;i++){
		if(mp[c[i]]) add(mp[c[i]],-1);
		add(i+1,1);mp[c[i]]=i+1;
		for(auto j:v[i+1]){
			ans[j.se]=query(i+1)-query(j.fs-1);
		}
	}for(i=0;i<q;i++) cout<<ans[i]<<endl;
}


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

int main() {
	// cin.tie(0);
	// ios::sync_with_stdio(false);

	string s;
	cin >> s;

	if (s[1] == 'B') {
		cout << "ARC";
	} else {
		cout << "ABC";
	}

	return 0;
}

Measured memory_bytes: 3592
N,M = map(int,input().split())
L_list = []
R_list = []

for i in range(M):
  L,R = map(int,input().split())
  L_list.append(L)
  R_list.append(R)
  
if min(R_list) >= max(L_list):
  print(min(R_list)  - max(L_list)+1)
else:
  print(0)

Measured memory_bytes: 10996
#include <iostream>

using namespace std;

int main() {
	int n, k, s;
	while ( cin >> n >> k >> s, n || k || s ) {
		int dp[11][21][200] = {0}; // dp[???????????£??????][???????????????][????¨?] = ??´????????°
		dp[0][0][0] = true;
		for (int i = 0; i < k; ++i) {
			for (int last = 0; last <= n; ++last) {
				for (int use = last+1; use <= n; ++use) {
					for (int sum = 0; sum <= 155; ++sum) {
						dp[i+1][use][sum+use] += dp[i][last][sum];
					}
				}
			}
		}
		int ans = 0;
		for (int last = 0; last <= n; ++last) {
			ans += dp[k][last][s];
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 1344
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
class LCA(object):
    def __init__(self,E,root=0):
        self.__n=len(E)
        self.__E=E
        self.__logn=(self.__n-1).bit_length()
        self.__depth=[-1]*self.__n
        self.__dist=[-1]*self.__n
        self.__depth[root]=0
        self.__dist[root]=0
        self.__parents=[[-1]*self.__n for _ in range(self.__logn)]
        self.__dfs(root)
        self.__doubling()

    def __dfs(self,v):
        for u,c,d in self.__E[v]:
            if(self.__depth[u]!=-1): continue
            self.__parents[0][u]=v
            self.__depth[u]=self.__depth[v]+1
            self.__dist[u]=self.__dist[v]+d
            self.__dfs(u)

    def __doubling(self):
        for i in range(1,self.__logn):
            for v in range(self.__n):
                if(self.__parents[i-1][v]==-1): continue
                self.__parents[i][v]=self.__parents[i-1][self.__parents[i-1][v]]

    @property
    def depth(self):
        return self.__depth

    @property
    def dist(self):
        return self.__dist

    def get(self,u,v):
        dd=self.__depth[v]-self.__depth[u]
        if(dd<0): # vの方が深いようにする
            u,v=v,u
            dd*=-1
        for i in range(self.__logn):
            if(dd&(1<<i)): v=self.__parents[i][v]
        if(v==u): return v
        for i in range(self.__logn-1,-1,-1):
            pu,pv=self.__parents[i][u],self.__parents[i][v]
            if(pu!=pv): u,v=pu,pv
        return self.__parents[0][u]

def resolve():
    n,q=map(int,input().split())
    E=[[] for _ in range(n)]
    for _ in range(n-1):
        a,b,c,d=map(int,input().split())
        a-=1; b-=1
        E[a].append((b,c,d))
        E[b].append((a,c,d))
    G=LCA(E)

    # Queryを先読みする
    Qs=[[] for _ in range(n)] #Q[v]: idx, color, mag, coef
    for i in range(q):
        x,y,u,v=map(int,input().split())
        u-=1; v-=1
        c=G.get(u,v)
        Qs[u].append((i,x,y,1))
        Qs[v].append((i,x,y,1))
        Qs[c].append((i,x,y,-2))

    # dfsでクエリに答えていく
    ans=[0]*q
    S=[[0,0] for _ in range(n)] # S[col]: total num, total len
    def dfs(v,p):
        # クエリに答える
        # 現在のlengthから、色のtotal lenを引き、青の個数*倍率(mug)を足したものが変更後の長さ
        for idx,col,mag,coef in Qs[v]:
            x=G.dist[v]
            x-=S[col][1]
            x+=mag*S[col][0]
            ans[idx]+=x*coef
        # 遷移
        for nv,col,d in E[v]:
            if(nv==p): continue
            S[col][0]+=1
            S[col][1]+=d
            dfs(nv,v)
            S[col][0]-=1
            S[col][1]-=d
    dfs(0,-1)
    print(*ans,sep="\n")
resolve()

Measured memory_bytes: 205116
#include <bits/stdc++.h>
using namespace std;
template <class T> inline void read(T &x) {
	x = 0; int c = getchar(), f = 1;
	for (; !isdigit(c); c = getchar()) if (c == 45) f = -1;
	for (; isdigit(c); c = getchar()) (x *= 10) += f*(c-'0');
}
int n, m;
char s[100][100];
int main() {
	read(n), read(m), n--, m--;
	for (int i = 0; i < 100; i++)
		for (int j = 0; j < 100; j++)
			s[i][j] = i < 50 ? '#' : '.';
	for (int i = 0; n; i += 2, n -= min(n, 50))
		for (int j = 0; j < 2*min(n, 50); j += 2) s[i][j] = '.';
	for (int i = 99; m; i -= 2, m -= min(m, 50))
		for (int j = 0; j < 2*min(m, 50); j += 2) s[i][j] = '#';
	puts("100 100");
	for (int i = 0; i < 100; i++, puts(""))
		for (int j = 0; j < 100; j++) putchar(s[i][j]);
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    // System.out.println(S);
    if(s.equals("ABC")){
    System.out.println("ARC");  
    }else{
    System.out.println("ABC");  
    }

  }
}





Measured memory_bytes: 35748
import java.io.BufferedReader; 
import java.io.IOException; 
import java.io.InputStreamReader; 
import java.util.Scanner; 
import java.util.StringTokenizer; 

public class Main 
{ 
	static class FastScanner 
	{ 
		BufferedReader br; 
		StringTokenizer st; 
		
		public FastScanner() 
		{ 
			br = new BufferedReader(new
					InputStreamReader(System.in)); 
		} 
		
		String next() 
		{ 
			while (st == null || !st.hasMoreElements()) 
			{ 
				try
				{ 
					st = new StringTokenizer(br.readLine()); 
				} 
				catch (IOException  e) 
				{ 
					e.printStackTrace(); 
				} 
			} 
			return st.nextToken(); 
		} 
		
		int nextInt() 
		{ 
			return Integer.parseInt(next()); 
		} 
		
		long nextLong() 
		{ 
			return Long.parseLong(next()); 
		} 
		
		double nextDouble() 
		{ 
			return Double.parseDouble(next()); 
		} 
		
		String nextLine() 
		{ 
			String str = ""; 
			try
			{ 
				str = br.readLine(); 
			} 
			catch (IOException e) 
			{ 
				e.printStackTrace(); 
			} 
			return str; 
		} 
	} 

	public static void main(String[] args) {
		FastScanner sc=new FastScanner();
		int D=sc.nextInt();
		int T=sc.nextInt();
		int S=sc.nextInt();
		if(D<1 || T<1 || S<1)
		{
			System.out.print("No");
		}
		if(D>10000 || T>10000 || S>10000)
			System.out.print("No");
		if((S*T)>=D)
			System.out.print("Yes");
		else
			System.out.print("No");
	}

}


Measured memory_bytes: 32904
#include<queue>
#include<stack>
#include<math.h>
#include<cmath>
#include<bitset>
#include<stdio.h>
#include<string>
#include<map>
#include<algorithm>
#include<vector>
#include<iostream>
#include<utility>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int main(){
  queue<ll> que;
  long long k,sum=0,sum1=0;
  ll i,n,a[200010],z,z1;
  vector<ll> x(200010);
  vector<ll> y(200010);
  cin >> n >> k;
  for(i=0;i<n;i++){
    scanf("%lld ",&a[i]);
    a[i]--;
  }
  x[0]=1;
  que.push(0);
  while(!que.empty()){
    z=que.front();
    que.pop();
    if(x[a[z]]==0){
      x[a[z]]=x[z]+1;
      que.push(a[z]);
      z1=a[z];
    }
  }
  for(i=0;i<n;i++){
    if(x[i]!=0){
      sum++;
    }
  }
  sum--;
  if(k<=sum){
    for(i=0;i<n;i++){
      if(x[i]==k+1){
        printf("%lld\n",i+1);
        return 0;
      }
    }
  }
  y[z1]=1;
  que.push(z1);
  while(!que.empty()){
    z=que.front();
    que.pop();
    if(y[a[z]]==0){
      y[a[z]]=y[z]+1;
      que.push(a[z]);
      z1=a[z];
    }
  }
  for(i=0;i<n;i++){
    if(y[i]!=0){
      sum1++;
    }
  }
  k-=sum;
  k=k%sum1+1;
  for(i=0;i<n;i++){
    if(y[i]==k){
      printf("%lld\n",i+1);
      return 0;
    }
  }
  return 0;
}

Measured memory_bytes: 8080
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
#define rep(i,n) for (int i = 0; i < (ll)(n); ++i)
ll INF = 1LL << 60;
ll mod = 1e9 + 7;

int main() {
	int n; cin >> n;
	for(int i=1;i<=n;i++) {
		double ss=i*1.08;
		int a=floor(ss);
		if(a==n) {
			cout << i << endl;
			return 0;
		} 
	}
	cout << ":(" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define mod 1000000007
#define maxn 200005
#define vi vector<int>
#define vl vector<ll>
#define mii map<int,int>
#define mli map<ll,int>
#define forit(it,v) for(auto it=v.begin();it!=v.end();++it)
#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
using namespace std;
void solve()
{
    int n;
    cin>>n;
    if (n>=30)
    {
        cout<<"Yes";
    }
    else
    {
        cout<<"No";
    }
}
int main()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    fastIO;
    // sieve();
    int t=1;
    // int t;
    // cin>>t;
    while(t--)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 3592
parseInt(x) = parse(Int, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)
function main()
    n=parseInt(readline())
    v=sort(parseMap(split(readline())))
    ans=v[1]
    for i in v
        ans=(ans+i)/2
    end
    println(ans)
end
main()

Measured memory_bytes: 166380
import java.util.*;
class Main{
	
    public static void main(String args[]){
    	Scanner sc=new Scanner(System.in);
    	String a=sc.next();
    	String b=sc.next();
    	String c=sc.next();
    	System.out.println(a.substring(0,1)+b.substring(1,2)+c.substring(2,3));
    }
}
  

Measured memory_bytes: 23124
#include <stdio.h>

int main(void)
{
    int L, R, x;
    0 <= L < 2000000000;
    0 < R <= 2000000000;

    scanf("%d %d", &L, &R);
    if ((R - L) >= 2019)
    {
        printf("0\n");
        return 0;
    }
    int y = 2018;
    for (int i = L; i < R; i++)
    {
        for (int j = i + 1; j <= R; j++)
        {
            x = (i % 2019) * (j % 2019) % 2019;
            if (x < y)
            {
                y = x;
            }
        }
    }
    printf("%d", y);
    return 0;
}

Measured memory_bytes: 128
fun main(args : Array<String>){

    val n = readLine()!!.toInt()
    var tmp = n
    var cou = 0
    while(tmp > 0){
        cou += tmp % 10
        tmp /= 10
    }

    if(n % cou == 0) {
        println("Yes")
    }
    else{
        println("No")
    }

}


Measured memory_bytes: 31692
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int X = sc.nextInt();

        int a=X/500;
		int b=(X-500*a)/5;
		
      System.out.println(1000*a+5*b);
	}
}



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

int main() {
  int a,b,ab,a_n,b_n;
  cin >> a >> b >> ab >> a_n >> b_n;
  int sum;
  for (int i=0; a_n-i>=0 || b_n-i>=0 ; i++) {
    if (i==0) {
      sum = a_n*a+b_n*b;
    }
    else {
      sum = min(sum, max(a_n-i,0)*a+max(b_n-i,0)*b + i*ab*2);
    }
  }
  cout << sum << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,(n)-1,0)
#define all(v) v.begin(), v.end()
#define endk '\n'
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
const ld eps = 1e-10;
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b){if(a>b) a=b;}
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b){if(a<b) a=b;}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s; cin >> s;
  ll k; cin >> k; k--;
  rep(i, s.size()) {
    if(s[i] == '1') {
      if(i == k) {
        cout << s[i] << endk;
        break;
      }
    } else {
      cout << s[i] << endk;
      break;
    }
  }
  return 0;
}


Measured memory_bytes: 3620
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

//char S[200010][10];

int compare_string(const void *a, const void *b) {
  return strcmp(*(char **)a, *(char **)b);
}
int main(){
	int N;
	char cmp[10];
	char **S;
	int flag=1;
	scanf("%d\n",&N);
	
	
	
	int i,j,cnt=0;
	
	S = (char**)malloc(sizeof(char*)*N);
	for(i=0;i<N;i++){
		S[i]=(char*)malloc(sizeof(char)*10);
		scanf("%s",cmp);
		strcpy(S[i],cmp);
	}

	qsort((void *)S, N, sizeof(S[0]), compare_string);
	
	for(i=0; i<N-1; i++) {
        //printf("%d, %s,%s\n",i, S[i],S[i+1]);
		if(strcmp(S[i],S[i+1])!=0){
			cnt++;
		}
    }

	cnt++;
	printf("%d\n",cnt);

	free(S);
	return 0;
}

Measured memory_bytes: 10752
#define rep(i, n) for (int i = 0; i < (n); i++)
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int MOD = 1000000007;
// MAX int 2,147,483,647 -> 10桁
// MAX ll 9,223,372,036,854,775,807 -> 19桁
// MAX O(n) 10^8 -> 8回
// double pi = M_PI or acos(-1)
// printf("%.10f\n", ans);

int g[15][15];

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


Measured memory_bytes: 3612
"use strict";
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
    result["default"] = mod;
    return result;
};
exports.__esModule = true;
var fs = __importStar(require("fs"));
var read = fs.readFileSync('/dev/stdin', 'utf-8');
var insertionSort = function (A) {
    for (var i = 1; i < A.length; i++) {
        var v = A[i];
        var j = i - 1;
        while (j >= 0 && A[j] > v) {
            A[j + 1] = A[j];
            j--;
        }
        A[j + 1] = v;
        console.log(A.join(' '));
    }
};
var inputArray = read.split('\n');
var A = inputArray[1].split(' ').map(function (s) { return parseInt(s); });
console.log(A.join(' '));
insertionSort(A);
//# sourceMappingURL=01a.js.map


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

using namespace std;

#define intt long long
#define FAST ios_base::sync_with_stdio(0); cin.tie(0);

int n, m, k;

int main() {

	FAST;

	cin >> n >> m >> k;
	vector <int> x(k + 1), y(k + 1);
	vector <int> cntx(n + 1), cnty(m + 1);
	for (int i = 1; i <= k; i ++) {
		cin >> x[i] >> y[i];
		cntx[x[i]] ++;
		cnty[y[i]] ++;
	}
	int maxx = -1, maxy = -1;
	for (int i = 1; i <= n; i ++) maxx = max(maxx, cntx[i]);
	for (int i = 1; i <= m; i ++) maxy = max(maxy, cnty[i]);
	int maxcntx = 0;
	for (int i = 1; i <= n; i ++) {
		if (cntx[i] == maxx) maxcntx ++;
	}
	int maxcnty = 0;
	for (int i = 1; i <= m; i ++) {
		if (cnty[i] == maxy) maxcnty ++;
	}
	int allcnt = 0;
	for (int i = 1; i <= k; i ++) {
		if (cntx[x[i]] + cnty[y[i]] == maxx + maxy) allcnt ++;
	}
	int ans = maxx + maxy;
	if (1LL * allcnt == 1LL * maxcntx * maxcnty) ans --;
	cout << ans << '\n';
	return 0;
}

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

int main()
{

    string str;
    cin >> str;

    size_t size = str.length();
    int size_int = (int)size;

    int *nums = new int[size_int];
    int sums = 0;

    for (int i = 0; i < size_int; ++i)
    {
        nums[i] = (int)(str[i] - '0'); //str[i]　はchar型なのでchar→intへ変換
        sums += nums[i];               //確認のため表示
    }
    if (sums % 9 == 0)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
}

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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif
class UnionFind {
    vector<int> par;
    vector<int> rank;
    vector<int> size;
    vector<vector<int>> group;
public:
    UnionFind(int n = 1) {
        par.resize(n + 1);
        rank.resize(n + 1);
        size.resize(n + 1);
        group.resize(n + 1);
        for (int i = 0; i <= n; ++i) {
            par[i] = i;
            rank[i] = 0;
            size[i] = 1;
            group[i].push_back(i);
        }
    }

    int find(int x) {
        if (par[x] == x) {
            return x;
        } else {
            int r = find(par[x]);
            return par[x] = r;
        }
    }

    bool is_same(int x, int y) {
        return find(x) == find(y);
    }

    bool unit(int x, int y) {
        x = find(x);
        y = find(y);
        if (x == y) {
            return false;
        } else {
            if (rank[x] < rank[y]) {
                swap(x, y);
            }
            if (rank[x] == rank[y]) {
                ++rank[x];
            }
            par[y] = x;
            size[x] += size[y];
            return true;
        }
    }

    int get_size(int x) {
        return size[find(x)];
    }

    void merge(int x, int y) {
        x = find(x);
        y = find(y);
        if (group[x].size() > group[y].size()) {
            swap(x, y);
        }
        copy(group[y].begin(), group[y].end(), back_inserter(group[x]));
        group[y].clear();
        par[y] = x;
    }
};

void Main() {
    ll N, Q;
    cin >> N >> Q;
    UnionFind unionFind(N);
    rep(i, Q) {
        ll c, x, y;
        cin >> c >> x >> y;
        if (c) {
            cout << unionFind.is_same(x, y) << '\n';
        }else{
            unionFind.unit(x, y);
        }
    }
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}



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

int main(){
  int N;
cin>>N;
int v[N];
int c[N];
for(int i=0;i<N;i++){
  cin>>v[i];
 }
for(int i=0;i<N;i++){
  cin>>c[i];
 }
int count=0;

for(int i=0;i<N;i++){
  if(v[i]-c[i]>0) count += v[i]-c[i];
 }

cout<<count<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int PREP = (cin.tie(nullptr), ios::sync_with_stdio(false), cout << fixed << setprecision(9), 0);
//int SEGV = getenv("D") || (exit(system("D= SEGFAULT_SIGNALS=all catchsegv ./prog.exe") >> 8), 0);
using Int = long long;
int main() {
    double P[6], Q[6];
    for (auto &p : P) cin >> p, p /= 100;
    for (auto &q : Q) cin >> q, q /= 100;
    auto f = [&](double x) {
        double ans = 0;
        for (int i = 0; i < 6; i++) {
            ans += max(P[i] * x, Q[i] * (1 - x));
        }
        return ans;
    };
    double lo = 0, hi = 1.0;
    for (int i = 0; i < 100; i++) {
        double a = (2 * lo + hi) / 3;
        double b = (lo + 2 * hi) / 3;
        if (f(a) >= f(b)) {
            lo = a;
        } else {
            hi = b;
        }
    }
    cout << f(lo) << endl;
    return 0;
}

Measured memory_bytes: 3804
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
int main()
{
    int W, H; cin >> W >> H;
    vector<pair<int, int>> A;
    for (int i = 0; i < W; i++) {
        int p; cin >> p;
        A.emplace_back(p, 0);
    }
    for (int i = 0; i < H; i++) {
        int q; cin >> q;
        A.emplace_back(q, 1);
    }
    sort(begin(A), end(A));
    Int ans = 0;
    for (int i = 0; i < A.size(); i++) {
        Int cost, axis; tie(cost, axis) = A[i];
        if (axis == 0) {
            if (W > 0) ans += cost * (H+1);
            W--;
        } else {
            if (H > 0) ans += cost * (W+1);
            H--;
        }
    }
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 2548
#include <iostream>
#include <unordered_set>
#include <cstdint>
#include <vector>
#include <sstream>
#include <string>
#include <climits>
#include <set>
#include <algorithm>
#include <math.h>
#include <cmath>
#include <iomanip>
#include <numeric>
#include <map>
using namespace std;

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

	if (n % 2)
	{
		cout << "No";
		return 0;
	}

	int j = n / 2;

	for (int i = 0; i < n / 2; i++)
	{
		if (str[i] != str[j++])
		{
			cout << "No";
			return 0;
		}
	}

	cout << "Yes";
}

Measured memory_bytes: 3628
#include <iomanip>
#include <iostream>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;

int main(void) {
  ios::sync_with_stdio(false);
  int64_t x;
  cin >> x;
  int64_t cnt11 = x / 11;
  int64_t cnt6 = (x % 11 + 5) / 6;
  int64_t answer = cnt11 * 2 + cnt6;
  cout << answer << endl;
  return 0;
}


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

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

  set<char> SE;

  for (int i = 0; i < N; i++) {
    char S;
    cin >> S;
    SE.insert(S);
  }

  cout << ((SE.size() == 3) ? "Three" : "Four") << "\n";
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <string>

#define rep(i, a, b) for ( int i = (a); i < (b); i++ )
#define per(i, a, b) for ( int i = (b)-1; i >= (a); i--)
#define pb push_back
#define mp make_pair
#define bg begin()
#define en end()
#define all(v) (v).begin(), (v).end()
#define sz(v) (int)(v).size()


using namespace std;

typedef long long ll;

static const long long MOD = 1000000007;

ll ans;
ll R[4005], G[4005], B[4005];

int main(void) {
    int n;
    string s = "x", t;
    cin >> n >> t;
    s += t;

    for (int i=1; i<=n; i++) {
        if (s[i]=='R') R[i]++;
        else if (s[i]=='G') G[i]++;
        else B[i]++;
    }

    for (int i=1; i<=n; i++) {
        R[i] += R[i-1];
        G[i] += G[i-1];
        B[i] += B[i-1];
    }

    for (int i=1; i<=n-2; i++) {
        for (int j=i+1; j<=n-1; j++) {
            if (s[i]==s[j]) continue;
            int d = j-i;

            if (s[i]=='R') {
                if (s[j]=='G') {
                    ans += B[n] - B[j];
                    if (j+d<=n && s[j+d] == 'B') ans--;
                }
                if (s[j]=='B') {
                    ans += G[n] - G[j];
                    if (j+d<=n&&s[j+d] == 'G') ans--;
                }

            } else if (s[i]=='G'){
                if (s[j]=='R') {
                    ans += B[n] - B[j];
                    if (j+d<=n&&s[j+d] == 'B') ans--;
                }
                if (s[j]=='B') {
                    ans += R[n] - R[j];
                    if (j+d<=n&&s[j+d] == 'R') ans--;
                }

            } else if (s[i]=='B') {
                 if (s[j]=='G') {
                     ans += R[n] - R[j];
                     if (j+d<=n&&s[j+d] == 'R') ans--;
                }
                if (s[j]=='R') {
                    ans += G[n] - G[j];
                    if (j+d<=n&&s[j+d] == 'G') ans--;
                }

            }
        }
    }
    
    cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3736
#include<iostream>
using namespace std;
#include<map>
#include<set>
#include<vector>
#include<algorithm>
#include<cmath>
#define int long long int
#define mod 1000000007
int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int n;
	cin>>n;
	int value[n]={0};
	int j;
	for(j=0;j<n;j++)
	{
		int x,y;
		cin>>x>>y;
		if(x==y)
		  value[j]=1;
	}
	bool result=false;
	for(j=0;j<n-2;j++)
	{
		if(value[j]&&value[j+1]&&value[j+2])
		{
			result=true;
			break;
		}
	}
	if(result)
	  cout<<"Yes"<<endl;
	else
	  cout<<"No"<<endl;
}


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

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int[] s = new int[m];
		int[] c = new int[m];

		for (int i = 0; i < m; i++) {
			s[i] = sc.nextInt();
			c[i] = sc.nextInt();
		}

		int[] ans = new int[n];
		Arrays.fill(ans, -1);
		//s,cの値を代入していく。コンフリクトが発生したらfalse.
		for (int i = 0; i < m; i++) {
			if (ans[s[i] - 1] != -1 && ans[s[i] - 1] != c[i]) {
				System.out.println(-1);
				return;
			}
			ans[s[i] - 1] = c[i];
		}

		boolean flag = true;
		for (int i = 0; i < n; i++) {
			if (flag && ans[i] == 0 && i != n - 1) {
				System.out.println(-1);
				return;
			} else if (flag && ans[i] == -1 && i == n - 1) {
				System.out.print(0);
				flag = false;
			} else if (flag && ans[i] == -1) {
				System.out.print(1);
				flag = false;
			} else if (!flag && ans[i] == -1) {
				System.out.print(0);
			} else {
				System.out.print(ans[i]);
				flag = false;
			}
		}

	}

}


Measured memory_bytes: 35768
// 基本テンプレート
 
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
using namespace std;
 
#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define int long long int
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
typedef pair<int, int> pii;
typedef long long ll;
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1001001001001001LL;
const ll MOD = 1000000007LL;

int N, Q;
 
signed main() {
    cin >> N >> Q;

    int L = 2*N;
    vector<int> A(L), B(L);
    for(int i=0; i<L; i++) cin >> A[i];
    for(int i=0; i<L; i++) cin >> B[i];

    int sum = 0, use = 0;
    set< pair<int, int> > S;
    for(int i=1; i<L-1; i++) {
        sum += max(A[i], B[i]);
        if(A[i] < B[i]) use ^= 1;
        S.insert(make_pair(abs(A[i] - B[i]), i));
    }

    while(Q--) {
        int i, x, y; cin >> i >> x >> y; i--;
        if(i != 0 && i != L-1) {
            sum -= max(A[i], B[i]);
            if(A[i] < B[i]) use ^= 1;
            S.erase(make_pair(abs(A[i] - B[i]), i));

            sum += max(x, y);
            if(x < y) use ^= 1;
            S.insert(make_pair(abs(x - y), i));
        }

        A[i] = x, B[i] = y;
        int ans = sum + A[0] + A[L-1];
        if(use) ans -= S.begin() -> first;
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 17280
#include <iostream>
#include <vector>
#include <boost/dynamic_bitset.hpp>
using namespace std;
using uint = unsigned int;
using ull = unsigned long long;
 
int main() {
	uint H, W;
	cin >> H >> W;
	
	vector<vector<uint>> AB(H, vector<uint>(W));

	for(uint i=0; i<H; i++) {
		for(uint j=0; j<W; j++) {
			cin >> AB[i][j];
		}
	}
	
	for(uint i=0; i<H; i++) {
		for(uint j=0; j<W; j++) {
			int B;
			cin >> B;
			AB[i][j] = abs((int)AB[i][j] - B);
		}
	}
	
	uint nbit = 80 * (H + W) * 2 + 1;
	uint p0 = 80 * (H + W);
	vector<vector<boost::dynamic_bitset<>>> dp(2, vector<boost::dynamic_bitset<>>(W, boost::dynamic_bitset<>(nbit)));
	
	dp[1][0].set(p0);
	
	for(uint i=0; i<H; i++) {
		uint i0 = i % 2;
		uint i1 = (i + 1) % 2;
			
		for(uint j=0; j<W; j++) {
			dp[i0][j] = (dp[i1][j] << AB[i][j]) | (dp[i1][j] >> AB[i][j]);
			//cout << i << " " << j << " " << dp[i0][j] << endl;
		}
		
		for(uint j=1; j<W; j++) {
			dp[i0][j] = dp[i0][j] | (dp[i0][j-1] << AB[i][j]) | (dp[i0][j-1] >> AB[i][j]);
			//cout << i << " " << j << " " << dp[i0][j] << endl;
		}
	}
	
	for(uint i=0; i<nbit/2; i++) {
		if(dp[(H-1)%2][W-1][p0+i]) {
			cout << i;
			break;
		}
	}
	
	return 0;
}


Measured memory_bytes: 1024
import java.io.IOException;
import java.io.InputStream;
import java.util.InputMismatchException;

public class Main {
	public static void main(String[] args) {
		new Main();
	}

	public Main() {
		FasterScanner sc = new FasterScanner(System.in);

		long n = sc.nextInt();
		long sol = n*(n+1)/2;
		long n3 = n/3;
		sol -= 3*n3*(n3+1)/2;
		long n5 = n/5;
		sol -= 5*n5*(n5+1)/2;
		long n15 = n/15;
		sol += 15*n15*(n15+1)/2;
		
		System.out.println(sol);
		
		sc.close();
	}
	
	class FasterScanner {
		private InputStream mIs;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;

		public FasterScanner() {
			this(System.in);
		}

		public FasterScanner(InputStream is) {
			mIs = is;
		}

		public int read() {
			if (numChars == -1)
				throw new InputMismatchException();
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = mIs.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public String nextLine() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isEndOfLine(c));
			return res.toString();
		}

		public String nextString() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public long nextLong() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public int nextInt() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		public boolean isEndOfLine(int c) {
			return c == '\n' || c == '\r' || c == -1;
		}

		public void close() {
			try {
				mIs.close();
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
	}
}


Measured memory_bytes: 32500
/* AtCoder Beginner Contest abc128
 * Problem C
 * Au: SJoshua
 */
#include <cstdio>
#include <vector>
#include <string>
#include <set>
#include <iostream>

using namespace std;

int main(void) {
	int n, m;
	cin >> n >> m;
	vector <set <int>> s(m);
	vector <int> p(m);
	for (int i = 0; i < m; i++) {
		int k;
		cin >> k;
		while (k--) {
			int cn;
			cin >> cn;
			s[i].insert(cn - 1);
		}
	}
	for (int i = 0; i < m; i++) {
		cin >> p[i];
	}
	int ans = 0;
	vector <int> sta(10);
	for (int i = 0; i < (1 << n); i++) {
		for (int j = 0; j <= 9; j++) {
			sta[j] = i & (1 << j);
		}
		bool all = true;
		for (int j = 0; j < m; j++) {
			int l = 0;
			for (auto e: s[j]) {
				if (sta[e]) {
					l++;
				}
			}
			if (l % 2 != p[j]) {
				all = false;
				break;
			}
		}
		if (all) {
			ans++;
		}
	}
	cout << ans << endl;
	return 0;
}


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


int main(){
    string S, T, U;
    int A, B;
    cin >> S >> T >> A >> B >> U;
    if (U == S) cout << A-1 << ' ' << B << endl;
    else cout << A << ' ' << B-1 << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define lnode node*2,start,mid
#define rnode node*2+1,mid+1,end
#define rep(i,a,b) for(ll i=a;i<=(b);i+=1)
#define input freopen("in.txt", "r", stdin)
#define out freopen("out.txt", "w", stdout)
#define To_string(num,str) {stringstream ss;ss<<num;ss>>str;}
#define To_num(str,num) {stringstream ss;ss<<str;ss>>num;}
const double pi=acos(-1.0);
const int maxn=(1e5+10);
const int inf=0x3f3f3f3f;
const ll mod=1e9+7;
using namespace std;
struct node
{
    int cost;
    int val;
}a[maxn];
bool cmp(node a,node b)
{
    return a.val>b.val;
}
set<int> con;
int main()
{   cin.tie(0);
    ios::sync_with_stdio(false);
    int n,m,num=0;
    cin>>n>>m;
    for(int i=1;i<=n;i++)
    {
        int cost,val;
        cin>>cost>>val;
        if(cost<=m)
        {
            num+=1;
            a[num].cost=cost;
            a[num].val=val;
        }
    }
    sort(a+1,a+1+n,cmp);
    for(int i=1;i<=m;i++)
        con.insert(i);
    int sum=0;
    ll ans=0;
    for(int i=1;i<=n;i++)
    {
        int now=a[i].cost;
        set<int>::iterator it;
        it=con.lower_bound(now);
        if(it==con.end()) continue;
        else
        {  con.erase(it);
           ans+=a[i].val;
           sum+=1;
           if(sum==m) break;
        }
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 5760
a1 = list(map(int,input().split()))
a2 = list(map(int,input().split()))
a3 = list(map(int,input().split()))
row = int(input())
detame = [int(input()) for i in range(row)]
bingo = 0
if (a1[0]) in detame and (a1[1]) in detame and (a1[2]) in detame:
    bingo=bingo+1
elif (a2[0]) in detame and (a2[1]) in detame and (a2[2]) in detame:
    bingo=bingo+1
elif (a3[0]) in detame and (a3[1]) in detame and (a3[2]) in detame:
    bingo=bingo+1
elif (a1[0]) in detame and (a2[0]) in detame and (a3[0]) in detame:
    bingo=bingo+1
elif (a1[1]) in detame and (a2[1]) in detame and (a3[1]) in detame:
    bingo=bingo+1
elif (a1[2]) in detame and (a2[2]) in detame and (a3[2]) in detame:
    bingo=bingo+1
elif (a1[0]) in detame and (a2[1]) in detame and (a3[2]) in detame:
    bingo=bingo+1
elif (a1[2]) in detame and (a2[1]) in detame and (a3[0]) in detame:
    bingo=bingo+1
if bingo==0:
    print("No")
else:
    print("Yes")

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

#define forn(i,n) for (int i = 0; i < int(n); i++)
#define si(c) ((int)(c.size()))
#define all(c) (c).begin(), (c).end()

#define pb push_back
#define eb emplace_back
typedef long long ll;
typedef pair<int,int> pii;

const int BILLION = 1e9;

ll area(vector<pair<ll,ll>> p) {
    ll res = 0;
    forn(i,3) {
        int j = (i+1)%3;
        assert(0 <= p[i].first && p[i].first <= BILLION);
        assert(0 <= p[j].first && p[j].first <= BILLION);
        res += p[i].first * p[j].second - p[i].second*p[j].first;
    }
    return res;
}

int main() {
    ll s, ns; cin >> s;

    ns = s; if (ns%BILLION) ns += BILLION - ns%BILLION;

    ll x0 = 0, y0 = 0;
    ll x1 = BILLION, y1 = 1;
    ll x2 = (ns-s), y2 = ns/x1;

    assert(area({{x0,y0},{x1,y1},{x2,y2}}) == s);
    cout << x0 << ' ' << y0 << ' ' << x1 << ' ' << y1 << ' ' << x2 << ' ' << y2 << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N=1e4+10;
const int mod=998244353;
int gi() {
    int x=0,o=1;char ch=getchar();
    while((ch<'0'||ch>'9')&&ch!='-') ch=getchar();
    if(ch=='-') o=-1,ch=getchar();
    while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
    return x*o;
}
int qpow(int a,int b) {
    int ret=1;
    while(b) {
        if(b&1) ret=1ll*ret*a%mod;
        a=1ll*a*a%mod,b>>=1;
    }
    return ret;
}
struct poly {
    vector<int> v;
    int& operator[](int x) {
        return v[x];
    }
    void set(int n) {
        v.resize(n+1);
    }
    int get() {
        return (int)v.size()-1;
    }
};
void NTT(poly &a,int n,int f,vector<int> &r) {
    for(int i=0;i<n;i++)
        if(i<r[i]) swap(a[i],a[r[i]]);
    for(int i=1;i<n;i<<=1) {
        int wn=qpow(3,(mod-1)/(i<<1));
        if(f==-1) wn=qpow(wn,mod-2);
        for(int p=i<<1,j=0;j<n;j+=p) {
            int w=1;
            for(int k=0;k<i;k++,w=1ll*w*wn%mod) {
                int x=a[j+k],y=1ll*w*a[j+k+i]%mod;
                a[j+k]=(x+y)%mod,a[j+k+i]=(x-y+mod)%mod;
            }
        }
    }
    if(f==-1) {
        int inv=qpow(n,mod-2);
        for(int i=0;i<n;i++) a[i]=1ll*a[i]*inv%mod;
    }
}
poly operator*(poly a,poly b) {
    int n=a.get(),m=b.get(),l=0;
    m+=n;for(n=1;n<=m;n<<=1) l++;
    vector<int> r(n);
    for(int i=0;i<n;i++) r[i]=(r[i>>1]>>1)|((i&1)<<(l-1));
    a.set(n-1),b.set(n-1);
    NTT(a,n,1,r),NTT(b,n,1,r);
    for(int i=0;i<n;i++) a[i]=1ll*a[i]*b[i]%mod;
    NTT(a,n,-1,r);
    a.set(m);return a;
}
poly qpow(poly a,int b,int n) {
    poly ret;ret.set(n);ret[0]=1;
    while(b) {
        if(b&1) ret=ret*a,ret.set(n);
        a=a*a,a.set(n),b>>=1;
    }
    return ret;
}
int n,m=0,e=0,fac[N],ifac[N];
char a[N],b[N];
int main() {
    scanf("%s",a+1),scanf("%s",b+1),n=strlen(a+1);
    for(int i=1;i<=n;i++) {
        if(a[i]=='1'&&b[i]=='1') ++m;
        else if(a[i]=='0'&&b[i]=='1') ++e;
    }
    fac[0]=1;for(int i=1;i<=n+1;i++) fac[i]=1ll*fac[i-1]*i%mod;
    ifac[n+1]=qpow(fac[n+1],mod-2);
    for(int i=n;i>=0;i--) ifac[i]=1ll*ifac[i+1]*(i+1)%mod;
    poly Q;Q.set(m);
    for(int i=0;i<=m;i++) Q[i]=ifac[i+1];
    poly P=qpow(Q,e,m);
    int ans=0;
    for(int i=0;i<=m;i++) ans=(ans+P[i])%mod;
    ans=1ll*fac[e]*fac[m]%mod*fac[e+m]%mod*ans%mod;
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 1272
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <numeric>
#include <algorithm>
#include <cmath>
#include <functional>
#include <map>
#include <set>
#include <stack>
#include <deque>

#define INF 1000000000;
#define MOD 1000000007;
#define LIMIT 1000000000000000000;
typedef long long ll;
using namespace std;
typedef pair<int, int> P;

int main()
{
    int x, t; cin >> x >> t;
    int ans = x - t;
    if (ans < 0) ans = 0;
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<algorithm>
#include<iostream>
#include<cstring>
#include<iomanip>
#include<sstream>
#include<cstdio>
#include<string>
#include<vector>
#include<bitset>
#include<queue>
#include<cmath>
#include<stack>
#include<set>
#include<map>
#define rep(i,x,n) for(int i=x;i<=n;i++)
#define per(i,n,x) for(int i=n;i>=x;i--)
#define sz(a) int(a.size())
#define rson mid+1,r,p<<1|1
#define pii pair<int,int>
#define lson l,mid,p<<1
#define ll long long
#define pb push_back
#define mp make_pair
#define se second
#define fi first
using namespace std;
const double eps=1e-8;
const int mod=1e9+7;
const int N=1e5+10;
const int inf=1e9;
int x;
int main(){
	//ios::sync_with_stdio(false);
	//freopen("in","r",stdin);
	cin>>x;
	if(x>=30) puts("Yes");
	else puts("No");
	return 0;
}

Measured memory_bytes: 3580
#include<cstdio>
#include<algorithm>
#include<functional>
using namespace std;

int main(){
  int P, Q, R, res;
  scanf("%d %d %d\n",&P, &Q, &R);
  res=min(P+Q,Q+R);
  res=min(res,R+P);
  printf("%d\n",res);
  return 0;
}

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

int main() {
  int x, y;
  cin >> x >> y;

  int grp[] = {0, 2, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0};
  if (grp[x - 1] == grp[y - 1])
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 3584
#include <cstdio>
using namespace std;
int n, m, i, j, k, a, b;
int str[1050][1050], vis[1050], top[1050];
int main() {
	scanf("%d", &n);
	for (i = 1; i <= n; i++) {
		for (j = 1; j < n; j++) {
			scanf("%d", &str[i][j]);
		}
	}
	for (i = 1; i <= n; i++) {
		top[i] = 1;
	}
	int day = 1;
	while (1) {
		bool con = false;
		for (i = 1; i <= n; i++) {
			if (vis[i] == day||top[i]>=n)
				continue;
			int v = str[i][top[i]];
			if (vis[v] != day && str[v][top[v]] == i) {
				top[v]++; top[i]++;
				vis[v] = day; vis[i] = day;
				con = true;
			}
		}
			if (!con)
				break;
			day++;
	}
	for (i = 1; i <= n; i++) {
		if (top[i] != n)
			break;
	}
	if (i != n + 1)
		printf("-1\n");
	else
		printf("%d\n", day-1);
	return 0;
}

Measured memory_bytes: 4224
#include  <bits/stdc++.h>
#define ll long long
using namespace std;


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

    //Insert code
    
    set<char> s;
    char tmp;
    while (cin>>tmp){
        s.insert(tmp);
    }
    cout<<(s.size()==2?"Yes":"No");
    
    //End code

    cerr << "\nTime elapsed: " << 1000*clock() / CLOCKS_PER_SEC << "ms\n";
    
}

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

#define int long long
typedef long long ll;
const int INF = 2e9;
//const ll INF = 9e18;


signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int H, W;
    cin >> H >> W;
    int ans = INF;
    for (int h=1;h<=H;h++){
        int A = h*W;
        int B1 = (H-h)*(W/2);
        int C1 = (H-h)*(W - W/2);
        int mx1 = max(A,max(B1,C1));
        int mn1 = min(A,min(B1,C1));
        ans = min(ans, mx1-mn1);
        int B2 = ((H-h)/2)*W;
        int C2 = H*W - A - B2;
        int mx2 = max(A,max(B2,C2));
        int mn2 = min(A,min(B2,C2));
        ans = min(ans, mx2-mn2);
    }
    swap(H,W);
    for (int h=1;h<=H;h++){
        int A = h*W;
        int B1 = (H-h)*(W/2);
        int C1 = (H-h)*(W - W/2);
        int mx1 = max(A,max(B1,C1));
        int mn1 = min(A,min(B1,C1));
        ans = min(ans, mx1-mn1);
        int B2 = ((H-h)/2)*W;
        int C2 = H*W - A - B2;
        int mx2 = max(A,max(B2,C2));
        int mn2 = min(A,min(B2,C2));
        ans = min(ans, mx2-mn2);
    }
    cout << ans << "\n";
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

using namespace std;
using boost::multiprecision::cpp_int;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ll,pair<ll, ll>> lpll;
typedef pair<ll, int> pli;
typedef pair<int, int> pii;

#define deg_to_rad(deg) (((deg)/360)*2*PI)

const ll LINF = LLONG_MAX;
// const ll MOD = 1e9+7;
const ll MOD = 998244353;

const ld PI = (acos(-1));
const ld EPS = 0.0000000001;
// cout << fixed << setprecision(10) << middle << endl;

int main() {
    // input, ready
    ld A,B,H,M;
    cin >> A >> B >> H >> M;

    // resolve
    ld total_min = H*60+M;
    ld tan_deg = total_min*0.5;
    ld cho_deg = M*6;
    ld diff_deg = abs(cho_deg-tan_deg);

    // output
    ld ans = pow(A+B*cos(PI-deg_to_rad(diff_deg)),2) + pow(B*sin(deg_to_rad(diff_deg)),2);
    ans = pow(ans,0.5);

    cout << fixed << setprecision(15) << ans << endl;

    return 0;
}


Measured memory_bytes: 4168
// Copyright [2020] <unknown>
    #include <bits/stdc++.h>
    using namespace std;
    // #define ONLINE_JUDGE
    #ifndef ONLINE_JUDGE
    #define dbg(x...) { cerr << "\033[32;1m" << #x << " -> "; err(x); }
    void err() { cerr << "\033[39;0m" << endl; }
    template<typename T, typename... A>
    void err(T a, A... x) { cerr << a << ' '; err(x...); }
    #else
    #define dbg(...)
    #endif
     
    #define sz(x) ((int)x.size())
     
    typedef long long LL;
     
    LL bin(LL a, LL b, LL p) {
    	LL res = 1;
    	for (a%=p; b; b>>=1, a=a*a%p)
    		if (b & 1)
    			res = res * a % p;
    	return res;
    }
     
     
    const double pi = 3.141592653;
    int main(int argc, char const *argv[]) {
        // code
        double r;
        cin >> r;
        cout << r * 2 * pi << endl;
        return 0;
    }

Measured memory_bytes: 3756
def main():
    N, Q = map(int, input().split(" "))
    S = input()
    result = [0] * (N + 1)
    for i in range(1, N + 1):
        if S[i-1:i+1] == "AC":
            result[i] = result[i - 1] + 1
        else:
            result[i] = result[i - 1]
    for _ in range(Q):
        l, r = map(int, input().split(" "))
        print(result[r - 1] - result[l - 1])


if __name__ == '__main__':
    main()

Measured memory_bytes: 6140
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		try {
			int n = sc.nextInt();
			sc.nextLine();
			String s = sc.next();

			int first = s.indexOf('I');
			int end = s.lastIndexOf('I');

			if (first == -1) {
				System.out.println(0);
				return;
			}

			int x = 0 - first + 1;
			int max = x > 0 ? x : 0;
			for (int i = first + 1; i <= end; i++) {
				if (s.charAt(i) == 'I') {
					x++;
				} else {
					x--;
				}
				max = x > max ? x : max;
			}

			System.out.println(max);

		} finally {
			sc.close();
		}
	}
}

Measured memory_bytes: 21972
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <limits.h>
#include <math.h>
#include <assert.h>
typedef int64_t ll;
typedef uint64_t ull;
int acs(const void *a, const void *b){return *(int*)a - *(int*)b;} /* 1,2,3,4.. */
int des(const void *a, const void *b){return *(int*)b - *(int*)a;} /* 8,7,6,5.. */
#define min(a,b) (a < b ? a: b)
#define max(a,b) (a > b ? a: b)

#define MAXN (200001)
#define MOD (1000000007)

int main(void)
{
    ll a,b;
    scanf("%ld %ld",&a,&b);

    if(a>=10||b>=10)
    {
        printf("-1\n");
        return 0;
    }

    
    ll ans=a*b;
    printf("%ld\n", ans);
    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N,T,mi=1001;
  cin>>N>>T;
  for(int i=0;i<N;i++){
    int c,t;
    cin>>c>>t;
    if(t<=T)
      mi=min(mi,c);
  }
  if(mi==1001)
    cout<<"TLE"<<endl;
  else
    cout<<mi<<endl;
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
#define REP(i,f,n) for(int i=f; i<(n); i++)
int main()
{
    int n;
    int count = 0;
    cin >> n ;
    int l[n];
    REP(i,0,n){
      cin >> l[i];
    }
    if(n<3){
      cout << 0 << endl;
      return 0;
    }
    REP(i,0,n-2){
      REP(j,i+1,n-1){
        REP(k,j+1,n){
          if(l[i]<l[j]&&l[j]<l[k]
            || l[i]<l[k]&&l[k]<l[j]
            || l[j]<l[i]&&l[i]<l[k]
            || l[j]<l[k]&&l[k]<l[i]
            || l[k]<l[j]&&l[j]<l[i]
            || l[k]<l[i]&&l[i]<l[j]){
            int a = l[i];
            if(a<l[j])a = l[j];
            if(a<l[k])a = l[k];
            if(a < l[i]+l[j]+l[k] - a){
              count++;
            }
          }
        }
      }
    }
    cout<<count<<endl;

    //--debug : end_stoper
    //string end_stoper; cin >> end_stoper;
    return 0;
}

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

#define mod 1000000007

using namespace std;
typedef long long ll; 
 
int main(void){
	
	int N;
	ll x, count = 0;
	
	cin >> N >> x;
	
	ll a[N+1] = {};
	
	for(int i=1; i<=N; i++)
		cin >> a[i];
	
	for(int i=0; i<N; i++){
		if(a[i] + a[i+1] > x){
			count += a[i+1] + a[i] - x;
			a[i+1] = x - a[i];
		}
	}
	
	cout << count;
	
	return 0;
}

Measured memory_bytes: 1024