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

int mod = 1e9+7;

signed main(){
  
    int n,k;
    cin >> n >> k;

    if(n>=10)cout << k << endl;
    else{
        cout << k+100*(10-n) << endl;
    }
  //cout << fixed << setprecision(8) << ans << endl;
  return 0;
}
    


Measured memory_bytes: 256
#ifndef _TEMPLATE_ROOT
#define _TEMPLATE_ROOT
#include "bits/stdc++.h"
using namespace std;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define repl(i, a, b) for(ll i = a; i < (b); ++i)
#define repd(i, a, b) for(int i = b; i >= (a); --i)
#define repdl(i, a, b) for(ll i = b; i >= (a); --i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
template<typename H> bool chmin(H& v1, const H v2) { if (v1 > v2) { v1 = v2; return true; } return false; }
template<typename H> bool chmax(H& v1, const H v2) { if (v1 < v2) { v1 = v2; return true; } return false; }
#endif
#ifndef _TEMPLATE_IO
#define _TEMPLATE_IO

template<typename H> void read(H& head) { cin >> head; }
template<typename H, typename ...T> void read(H& head, T& ...tail) { cin >> head; read(tail...); }
template<typename H> void write(H head) { cout << head << '\n'; }
template<typename H, typename ...T> void write(H head, T ...tail) { cout << head << " "; write(tail...); }
template<typename ...T> void die(T ...tok) { write(tok...); exit(0); }
#endif
#ifndef _TEMPLATE_OPT
#define _TEMPLATE_OPT
#pragma GCC optimize("O3")
#pragma GCC target("avx2")
#endif
using namespace std;

namespace std {
  template<typename T, typename K> struct hash<pair<T, K>> {
    size_t operator()(pair<T, K> const& p) const noexcept {
      size_t h1 = std::hash<T>{}(p.first);
      size_t h2 = std::hash<K>{}(p.second);
      return h1 ^ (h2 << 1);
    }
  };
}

int main() {
	cin.tie(0)->sync_with_stdio(0);
	cin.exceptions(cin.failbit);

  int h, w, n; read(h, w, n);
  map<pair<int, int>, int> mp;
  set<pair<int, int>> cons;

  rep(i, 0, n) {
    int x, y; read(x, y);
    mp[{x, y}] = 1;
    rep(a, -2, 1) rep(b, -2, 1)
      if (1 <= x + a && x + a <= h - 2 && 1 <= y + b && y + b <= w - 2)
        cons.insert({x + a, y + b});
  }

  vector<ll> ans(10);
  for (auto p : cons) {
    int x, y; tie(x, y) = p;
    int cnt = 0;
    rep(i, 0, 3) rep(j, 0, 3)
      cnt += mp[{x + i, y + j}];
    ans[cnt]++;
  }

  ans[0] = 1ll * (h - 2) * (w - 2);
  rep(i, 1, 10) ans[0] -= ans[i];

  rep(i, 0, 10) write(ans[i]);
}



Measured memory_bytes: 202064
#include<bits/stdc++.h>
using namespace std;
/*1 2 0 4 5*/
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
     int sum=0;
    for(int i=0;i<5;i++)
    {
      int n; cin>>n;
      sum+=n;
    }
  cout<<15-sum<<endl;
}

Measured memory_bytes: 3648
#include <stdio.h>
 
int main(void)
{
  int a,b,c;
  scanf("%d",&a);
  if(a==1)
  {
    printf("Hello World");
  }
  else if(a==2)
  {
    scanf("%d",&b);
    scanf("%d",&c);
    b=b+c;
    printf("%d",b);
  }
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define mst(a,b) memset(a,b,sizeof(a))
#define lowbit(x) ((x)&(-x))
#define X first
#define Y second
using namespace std;
using namespace __gnu_cxx;
using namespace __gnu_pbds;
typedef long long LL;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int inf = 0x3f3f3f3f;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const int maxn = 200000+10;
const int maxm = 200000+10;
const int mod = 1e9+7;
const double eps = 1e-9;
int get(int n){
    int res=1;
    for (int i=1;i<=n;i++){
        res=1ll*res*i%mod;
    }
    return res;
}
int main() {
#ifdef local
    freopen("in.txt", "r", stdin);
//    freopen("out.txt", "w", stdout);
#endif
    ios::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    int n,m; cin>>n>>m;
    if (n<m) swap(n,m);
    if (n-m>=2){
        cout<<0<<"\n";
        return 0;
    }
    int ans;
    if (n==m){
        ans=2ll*get(n)%mod*get(n)%mod;
    } else {
        ans=1ll*get(n)%mod*get(m)%mod;
    }
    cout<<ans<<"\n";
    return 0;
}


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

int main()
{
    int x,h;
    while(cin >> x >>h)
    {
        if(x==0&&h==0)break;
        double dx = (double)x,dh = (double)h;
        printf("%.6f\n",dx*dx + (sqrt(dx*dx/4+dh*dh)*dx)*2);

    }

    return 0;

}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#include <numeric>
using namespace std;
#define ll long long
#define mod107 1000000007
#define rep(i, n) for (int i = 0; i < n; ++i)
#define Graph vector<vector<int>>
#define grepq priority_queue<double, std::vector<double>, std::greater<double>>
#define all(v) v.begin(), v.end()
#define PI acos(-1)
#define inf 1000000321

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


int main(){
    ll N,X,T;
    cin >> N>>X>>T;
    if(N%X == 0){
        cout << N/X*T << endl;
    }
    else{
        cout << N/X*T +T << endl;
    }
}

Measured memory_bytes: 3632
#include <iostream>
#include <cmath>
#include <vector>
#include <cstdlib>
#include <algorithm>

#include <stdio.h>
#include <stdlib.h>

using namespace std;

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

  string s;

  cin >> s;
  int left = 0, right = s.length()-1;

  int xplus = 0;

  while(left <= right){
    //cout << "s[left] : " << s[left] << endl;
    //cout << "s[right] : " << s[right] << endl;
    if(s[left] == s[right]){
      left++;
      right--;
      continue;
    }

    if(s[left] == 'x'){
      left++;
      xplus++;
      continue;
    }

    if(s[right] == 'x'){
      right--;
      xplus++;
      continue;
    }

    cout << "-1" << endl;
    return 0;
  }
  cout << xplus << endl;
  return 0;
}


Measured memory_bytes: 512
#include <stdio.h>
int main (){
int S,h,m,s,sum,sum2,sum3;
scanf ("%d",&S);

sum=S/3600;
sum2=(S%3600)/60;
sum3=(S%3600)%60;

printf ("%d:%d:%d\n",sum,sum2,sum3);

return 0;
}

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

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;


#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))

int dx4[4] = {1,0,-1,0}, dy4[4] = {0,1,0,-1};


int main()
{
    ll n;
    cin>>n;
    vector<ll> a(n),b(n);
    vector<pll> p(n);
    for (int i = 0; i < n; i++)
    {
        cin>>a[i]>>b[i];
        p[i]=make_pair(a[i],b[i]);
    }
    sort(all(a));
    sort(all(b));
    ll ans;
    if(n%2==1)//odd
    {
        ll l=a[n/2];
        ll r=b[n/2];
        ans=r-l+1;
    }
    else
    {
        ll l=a[n/2]+a[n/2-1];
        ll r=b[n/2]+b[n/2-1];
        ans=r-l+1;
    }
    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 9548
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a) for(int i = 0; i < (a); i++)
#define ALL(a) (a).begin(),(a).end()
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const long long LINF = 1e18;
const long long MOD = 1e9 + 7;

signed main(){
    int n;
    string s;
    cin >> n;
    cin >> s;
    REP(i,s.size()){
        if(s[i] + n > 'Z'){
            s[i] = 'A' - 1 + s[i] + n - 'Z';
        }else{
            s[i] += n;
        }
    }
    cout << s << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-15
#define mp(a1,a2) make_pair(a1,a2)
typedef long long ll;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=1e+18+1;
int INF=1e+9+1;
vll bubunwa;
int onewa[46][500501]={};
int main(){
	ll N,K;
	ll a[1001];
	ll asum[1001]={};
	scan(N);scan(K);
	rep(i,N){
		scan(a[i]);
		asum[i+1]=asum[i]+a[i];
	}
	rep(i,N){
		for(int j=i+1;j<N+1;j++){
			bubunwa.push_back(asum[j]-asum[i]);
		}
	}
	sort(bubunwa.begin(),bubunwa.end());
	int bnum=bubunwa.size();
	rep(k,46){
		rep(i,bnum){
			onewa[k][i+1]=onewa[k][i]+(bubunwa[i]&(1<<k));
		}
	}
	bool kouho[500500];
	fill(kouho,kouho+bnum,true);
	for(int k=45;k>=0;k--){
		int onenum=0;
		bool nowone[500500]={};
		rep(i,bnum){
			if(kouho[i]){
				onenum+=((bubunwa[i]>>k)&1);
				nowone[i]=((bubunwa[i]>>k)&1);
			}
		}
		if(onenum>=K){
			rep(i,bnum) kouho[i]&=nowone[i];
		}
		//printf("k:%d onenum:%d\n",k,onenum);
	}
	int count=0;
	ll ans;
	rep(i,bnum){
		if(kouho[i]){
			if(count==0){
				ans=bubunwa[i];
			}
			else{
				ans&=bubunwa[i];
			}
			count++;
			if(count==K){
				prin(ans);
				return 0;
			}
		}
	}
	prin(ans);
	return 0;
}


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

int n, m, c;
int a[21], b[21];
int count = 0;

int main() {
    cin >> n >> m >> c;
    for (int i = 0; i < m; i++) cin >> b[i];

    for (int i = 0; i < n; i++) {
        int ans = 0;
        for (int j = 0; j < m; j++) {
            cin >> a[j];
            ans += a[j] * b[j];
        }
        ans += c;
        if (ans > 0) count++;
    }
    cout << count << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <bitset>
#include <set>
#include <sstream>
#include <string>
#include <cstring>
#include <stack>
#include <cmath>
#include <queue>
#include <cctype>
#include <map>
#include <cstdlib>
#include <vector>
#define ll long long
#define INF 0x3f3f3f3f
using namespace std;

ll read(){
    ll x=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0' && ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}

int n;
struct info{
    int id,num;
}a[100005];
bool cmp(info x,info y){
    return x.num<y.num;
};


int main() {
//    freopen("input1.txt","r",stdin);
    n = read();
    for (int i=1;i<=n;i++){
        a[i].num=read();
        a[i].id=i;
    }
    sort(a+1,a+1+n,cmp);
    for (int i=1;i<=n;i++)
        printf("%d ",a[i].id);

}

Measured memory_bytes: 1664
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		while(true){
			int n=in.nextInt();
			if(n==0)break;
			int kai=n/4;
			int sum=0;
			for(int i=0;i<kai;i++){
				sum+=in.nextInt();
			}
			System.out.println(sum);
		}
	}
}

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

int main() {
    int k;
    cin >> k;
    vector<int> a = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    cout << a[k - 1] << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i ,n) for(int i = 0 ; i < (n) ; i ++ )
#define all(x) (x).begin(),(x).end()
using namespace std;
using ll = long long;
using vin=vector<int>;
const int inf=1e9+7;
const ll INF=1e18;


int main() {
  int h,w;
  cin>>h>>w;
  vector<vector<char>> a(h,vector<char> (w));
  rep(i,h){
    rep(j,w){
      cin>>a[i][j] ;
    }
  }
  ///////////
  
  bool ok;
  rep(i,h){
     ok=true;
    rep (j,w){
       if(a[i][j]=='#'){
         ok=false; 
       }
    }
    if(ok){
      a.erase(a.begin()+i);
      h--;
      i--;
      //cout<<1<<endl;
    }
  }
  

  
  
  
  
  rep(i,w){
     ok=true;
    rep (j,h){
       if(a[j][i]=='#'){
         ok=false; 
       }
    }
    if(ok){
      rep(k,h){///上かあらk行目
        a[k].erase(a[k].begin()+i);
        
       // cout<<1<<endl;
      }
      i--;
      w--;
    }
  }
  
  rep(i,h){
     rep(j,w){
       cout<<a[i][j]; 
       
     }
    
    cout<<endl;
  }
  
  
}





Measured memory_bytes: 256
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;

constexpr long long int MOD = 1000000007;
//constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
//constexpr long long int MOD = 998244353;
constexpr double EPS = 1e-8;

//int N, M, K, H, W, L, R;
long long int N, M, K, H, W, L, R;

long long int power(long long int x, long long int n, long long int M) {
	long long int ret = 1;
	long long int by = x;
	while (n) {
		if (n & 1) {
			ret *= by;
			ret %= M;
		}
		by *= by;
		by %= M;
		n >>= 1;
	}
	return ret;
}

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

	cin >> N;
	vector<long long int>v(N);
	for (auto &i : v)cin >> i;
	if (N == 1) {
		cout << v[0] * 2 % MOD << endl;
		return 0;
	}
	sort(v.begin(), v.end());
	reverse(v.begin(), v.end());
	long long int ans = 0;
	for (int i = 0; i < N; i++) {
		long long int add = v[i] * (power(2, N - 1, MOD) + power(2, N - 2, MOD)*i%MOD) % MOD;
		ans += add;
		ans %= MOD;
	}
	cout << ans * power(2, N, MOD) % MOD << endl;
}


Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <algorithm>
#include <set>
#include <string>
#include <queue>

using namespace std;

#define rep(i, N) for(int (i) = 0; (i) < (N); (i) ++)
typedef long long ll;

ll solve1(ll y, ll x){
    ll ans = (1e18);
    for(int i = 1; i < y; i ++){
        ll tmp;
        ll tmp1 = i  *  x;
        // 大きい方.
        ll tmp2 = ((y - i + 1) / 2) * x;
        ll tmp3 = ((y - i) / 2) * x;
        if(tmp2 > tmp1){
            tmp = tmp2 - min(tmp1, tmp3);
        }else{
            tmp = tmp1 - tmp3;
        }
        ans = min(tmp, ans);
    }
    return ans;
}

ll solve2(ll y, ll x){
    ll ans = (1e18);
    for(int i = 1; i < y; i ++){
        ll tmp;
        ll tmp1 = 1L * i * x;
        // 大きい方.
        ll tmp2 = (y - i) *  ((x + 1) / 2 );
        ll tmp3 = (y - i) *  (x / 2);
        if(tmp2 > tmp1){
            tmp = tmp2 - min(tmp1, tmp3);
        }else{
            tmp = tmp1 - tmp3;
        }
        ans = min(tmp, ans);
    }
    return ans;
}




int main(){
    int H, W;
    cin >> H >> W;
    ll ans = solve1(H, W);
    ans = min(ans, solve2(H, W));
    ans = min(solve1(W, H), ans);
    ans = min(ans, solve2(W, H));
    cout << ans << endl;
    return 0;
}


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


class Program
{
	//Main
	static void Main(string[] args)
	{
		//読み込む
		int N = int.Parse(Console.ReadLine());

		long inf = 100000000000;

		//Z,Wそれぞれの最大値と最小値
		/*
		但し、
		Z = x + y, W = x - y;
		*/
		long maxZ = -inf;
		long minZ = inf;
		long maxW = -inf;
		long minW = inf;

		for(int i=0; i<N; i++){
			long[] xy = Console.ReadLine().Split(' ').Select(j => long.Parse(j)).ToArray();
			long z = xy[0] + xy[1];
			if(maxZ < z){
				maxZ = z;
			}
			if(minZ > z){
				minZ = z;
			}
			long w = xy[0] - xy[1];
			if(maxW < w){
				maxW = w;
			}
			if(minW > w){
				minW = w;
			}
		}

		long ans = Math.Max(maxZ - minZ, maxW - minW);

		Console.WriteLine(ans);
	}
}


Measured memory_bytes: 22948
from heapq import heappush, heappop
from collections import deque,defaultdict,Counter
import itertools
from itertools import permutations
import sys
import bisect
import string
sys.setrecursionlimit(10**6)
def SI():
    return input().split()
def MI():
    return map(int,input().split())
def I():
    return int(input())
def LI():
    return [int(i) for i in input().split()]
YN=['Yes','No']
mo=10**9+7
alp=string.ascii_lowercase
d_al=dict([(i,j) for j,i in enumerate(alp)])

s=[d_al[i] for i in input()]
t=[d_al[i] for i in input()]
Ss=set(s)
St=set(t)
ns=len(s)
nt=len(t)
ss=s*2

g=[{} for _ in range(ns)]
pos=[-1]*26
for i in range(ns*2)[::-1]:
    for j in Ss:
        if i<ns:
            g[i][j]=pos[j]-i
    pos[ss[i]]=i

if len(St-Ss)!=0:
    ans=-1
else:
    cur=0
    cur+=g[-1][t[0]]-1
    for i in range(1,nt):
        cur+=g[cur%ns][t[i]]
    ans=cur+1
print(ans)

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

int main(){
    int a,b;
    cin >> a >> b;
    string ans;
    if (a%3 == 0 || b%3 == 0 ||(a+b)%3 == 0){
        ans = "Possible";
    }else{
        ans = "Impossible";
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using static MyIO;


public class A
{
	public static void Main() => (new Solver()).Solve();
}


public class Solver
{
	public void Solve()
	{
		int N = GetInt();
		Console.WriteLine((N - 1) / 2);
	}
}


public static class MyIO
{
	private static string[] args = null;
	private static int num = -1;
	private static int used = -1;

	private static string getArg()
	{
		if(used == num)
		{
			args = Console.ReadLine().Split(' ');
			num = args.Length;
			used = 0;
		}
		return args[used++];
	}

	public static int GetInt() => int.Parse(getArg());
	public static long GetLong() => long.Parse(getArg());
	public static double GetDouble() => double.Parse(getArg());
	public static string GetString() => getArg();
	public static char GetChar() => getArg()[0];
	public static int[] GetInts(int N) => Enumerable.Range(0, N).Select(_ => GetInt()).ToArray();
	public static long[] GetLongs(int N) => Enumerable.Range(0, N).Select(_ => GetLong()).ToArray();
	public static double[] GetDoubles(int N) => Enumerable.Range(0, N).Select(_ => GetDouble()).ToArray();
	public static string[] GetStrings(int N) => Enumerable.Range(0, N).Select(_ => GetString()).ToArray();
}


Measured memory_bytes: 13140
n, m = map(int, input().split())

divs = []
for i in range(1, int(m ** (1 / 2)) + 1):
  if m % i == 0:
    divs.append(i)
    divs.append(m // i)

divs.sort(reverse=True)
x = m // n

for i in divs:
  if i <= x:
    print(i)
    break

Measured memory_bytes: 3188
#include <iostream>
#include <string>

struct TIntNode
{
	int Value;
	TIntNode* Parent;
	TIntNode* LargeBranch;
	TIntNode* SmallBranch;
	TIntNode(int AValue);
};

TIntNode::TIntNode(int AValue)
{
	Value       = AValue;
	LargeBranch = NULL;
	SmallBranch = NULL;
}

class TIntSet
{
	TIntNode* Root;
	bool Search(int AValue, TIntNode** Node)const;
public:
	bool Search(int AValue)const;
	void Add(int AValue);
	
	TIntSet();
	~TIntSet();
};

void Destroy(TIntNode* Node)
{
	if(Node == NULL) return;
	Destroy(Node->LargeBranch);
	Destroy(Node->SmallBranch);
	delete Node;
}

TIntSet::TIntSet()
{
	Root = NULL;
}

TIntSet::~TIntSet()
{
	Destroy(Root);
}

bool TIntSet::Search(int AValue)const
{
	TIntNode* Node = Root;
	return Search(AValue, &Node);
}

bool TIntSet::Search(int AValue, TIntNode** Node)const
{
	if(*Node == NULL) return false;
	if((*Node)->Value == AValue) return true;;
	if((*Node)->Value > AValue){
		if((*Node)->SmallBranch == NULL) return false;
		*Node = (*Node)->SmallBranch;
		return Search(AValue, Node);
	}else{
		if((*Node)->LargeBranch == NULL) return false;
		*Node = (*Node)->LargeBranch;
		return Search(AValue, Node);
	}
}

void TIntSet::Add(int AValue)
{
	TIntNode* Parent = Root;
	if(Search(AValue, &Parent)) return;
	if(Parent == NULL)
	{
		TIntNode* NewNode = new TIntNode(AValue);
		Root = NewNode;
		return;
	}
	if(Parent->Value > AValue){
		TIntNode* NewNode = new TIntNode(AValue);
		Parent->SmallBranch = NewNode;
	}else{
		TIntNode* NewNode = new TIntNode(AValue);
		Parent->LargeBranch = NewNode;
	}
}

int CharToInt(char c)
{
    switch(c)
    {
    case 'A' : return 0;
    case 'G' : return 1;
    case 'C' : return 2;
    case 'T' : return 3;
    }
    return 0;
}
 
int ToInt(std::string String)
{
    int Result = 0;
    int Order = 1;
    for(unsigned int i=0;i<String.size();i++)
    {
        Result += CharToInt(String[i]) * Order;
        Order *= 4;
    }
    return Result + Order;
}
 
std::string GetResultString(bool Result)
{
    return Result ? "yes" : "no";
}
 
int main()
{
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    TIntSet Dictionary;
    int Count = 0;
    std::cin >> Count;
     
    for(int i=0;i<Count;i++)
    {
        std::string Command;
        std::cin >> Command;
        std::string Input;
        std::cin >> Input;
        if(Command == "insert")
        {
            Dictionary.Add(ToInt(Input));
        }
        else if(Command == "find")
        {
            std::cout << GetResultString(Dictionary.Search(ToInt(Input))) << std::endl;
        }
    }
    return 0;
}

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

#define ll long long

void swap (int *x, int *y) {
  int temp;

  temp = *x;
  *x = *y;
  *y = temp;

  return;
}


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

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

  return a;
}

int upll(const void*a, const void*b){
  return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;
}

int downll(const void*a, const void*b){
  return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;
}

void sortup(ll*a,int n){
  qsort(a,n,sizeof(ll),upll);
}

void sortdown(ll*a,int n){
  qsort(a,n,sizeof(ll),downll);
}

long int modpow(long int a,long int n,long int mod){
  long int ans=1;
  while(n>0){
    if(n & 1){
      ans=ans*a%mod;
    }
    a=a*a%mod;
    n/=2;
  }
  return ans;
}

long int modinv(long int a,long int mod){
  return modpow(a,mod-2,mod);
}

int max(int a,int b){
  if(a<b){
    return b;
  }
  else{
    return a;
  }
}

int min(int a,int b){
  if(a<b){
    return a;
  }
  else{
    return b;
  }
}

void chmax(int *a,int b){
  if(*a < b){
    *a = b;
  }

  return;
}

void chmin(int *a,int b){
  if(*a > b){
    *a =b;
  }

  return;
}


/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/

int main(void){
  int l,r;
  scanf("%d%d",&l,&r);

  if(r-l>2020){
    printf("0\n");
    return 0;
  }

  int ans=3000;
  for(int i=l;i<r;i++){
    for(int j=i+1;j<=r;j++){
      int now=(i%2019)*(j%2019);
      now%=2019;
      chmin(&ans,now);
    }
  }

  printf("%d\n",ans);

  return 0;
}

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

const int N=3e3;
struct Dot {
    int x,y;
    bool operator < (const Dot &b) { return x<b.x && y<b.y; }
} r[N],b[N];

const int M=1e4;
int h[N],to[M],nexp[M],W[M],p=2;
inline void ins(int a,int b,int w) { nexp[p]=h[a], h[a]=p, to[p]=b, W[p]=w, p++;}
#define sins(x,y,z) ins(x,y,z), ins(y,x,0)
#define R(x) (x+150)
const int s=N-1,t=N-2;

int fl[N];
bool bfs() {
    memset(fl,0,sizeof(fl));
    queue<int> qu;
    qu.push(s);
    fl[s]=1;
    while(!qu.empty()) {
        int na=qu.front();
        qu.pop();
        for(int u=h[na];u;u=nexp[u])
            if(W[u] && !fl[to[u]]) fl[to[u]]=fl[na]+1, qu.push(to[u]);
    }
    return fl[t];
}

int dfs(int x,int op) {
    int flow=0;
    if(x==t) return op;
    for(int u=h[x];u;u=nexp[u])
        if(W[u] && fl[to[u]]==fl[x]+1) {
            int d=dfs(to[u], min(op-flow,W[u]));
            flow+=d, W[u]-=d, W[u^1]+=d;
            if(flow==op) break;
        }
    if(!flow) fl[x]=0;
    return flow;
}

int main() {
    ios::sync_with_stdio(false);
    int n;
    cin>>n;
    for(int i=0;i<n;i++) cin>>r[i].x>>r[i].y;
    for(int i=0;i<n;i++) cin>>b[i].x>>b[i].y;
    int ans=0;
    for(int i=0;i<n;i++)
    for(int j=0;j<n;j++)
        if(r[i]<b[j]) sins(i,R(j),1);
    for(int i=0;i<n;i++) sins(s,i,1), sins(R(i),t,1);
    while(bfs()) ans+=dfs(s,0x3f3f3f3f);
    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<string>
#include<typeinfo>
#include<vector>
#include<algorithm>
#include<map>
#include<iomanip>
typedef long long int ll;
using namespace std;
int main()
{
	int a,b,c;
	cin >> a >> b >> c;
	
  	cout << a+b+c-max({a,b,c}) << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll ht[2000005];
ll val[2000005];
ll dp[2000005]={};
ll query(ll pos,ll start,ll end,ll l,ll r)
{
	if(l<=start&&r>=end)
		return dp[pos];
	if(l>end||r<start)
		return 0;
	ll mid=(start+end)/2;
	return(max(query(2*pos,start,mid,l,r),query(2*pos+1,mid+1,end,l,r)));
}
void update(ll pos,ll start,ll end,ll ind,ll value)
{
	if(start==end)
	{
		dp[pos]=value;
		return;
	}
	ll mid=(start+end)/2;
	if(ind<=mid)
		update(2*pos,start,mid,ind,value);
	else
		update(2*pos+1,mid+1,end,ind,value);
	dp[pos]=max(dp[2*pos],dp[2*pos+1]);
}
int main()
{
	ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
	ll ans=0,sum,i,n;
	cin>>n;
	for(i=1;i<=n;i++)
		cin>>ht[i];
	for(i=1;i<=n;i++)
		cin>>val[i];
	for(i=1;i<=n;i++)
	{
		sum=query(1,1,n,1,ht[i])+val[i];
		//cout<<sum<<endl;
		update(1,1,n,ht[i],sum);
		ans=max(ans,sum);
	}
	cout<<ans<<endl;
}


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

using ll=long long;
using namespace std;

#define rep_i(i, n) for (int i = 0; i < (n); ++i)
#define rep_ll(i, n) for (long long i = 0; i < (n); ++i)
#define r_rep_i(i, start, end) for (int i = (start); i < (end); ++i)
#define r_rep_ll(i, start, end) for (long long i = (start); i < (end); ++i)
#define debug_vi(v) copy((v).begin(), (v).end(), ostream_iterator<int>(cout, " "));
#define debug_vll(v) copy((v).begin(), (v).end(), ostream_iterator<long long>(cout, " "));
#define debug_vd(v) copy((v).begin(), (v).end(), ostream_iterator<double>(cout, " "));
#define sort_v(v) sort((v).begin(), (v).end()); //昇順
#define d_sort_vi(v) sort((v).begin(), (v).end(), greater<int>()); //降
#define d_sort_vll(v) sort((v).begin(), (v).end(), greater<long long>()); //降
#define d_sort_vd(v) sort((v).begin(), (v).end(), greater<double>()); //昇順
#define say(t) cout << (t) << endl;
#define sum_vi(v) accumulate((v).begin(), (v).end(), 0);
#define sum_vll(v)accumulate((v).begin(), (v).end(), 0LL);

ll gcd(ll a, ll b) { return b?gcd(b, a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a, b)*b;}

const int IINF=(1<<30);
const ll LLINF = 1LL<<60;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    int n;cin >> n;
    int b, f, r, v;
    // vector<vector<vector<int>>> hoge(4, vector<int>(3, vector<int>(10)));
    vector<vector<int>> hoge(3, vector<int>(10, 0));
    vector<vector<vector<int>>> fuga(4, hoge);

    for (int i = 0; i < n; i++){
        cin >> b >> f >> r >> v;
        fuga[b - 1][f - 1][r - 1] += v;
    }
    for (int i = 0; i < fuga.size(); i++){
        for (int e = 0; e < fuga[i].size(); e++){
            for (int a = 0; a < fuga[i][e].size(); a++){
                // if (a == fuga[i][e].size() - 1){
                //     cout << fuga[i][e][a];
                // }
                cout << " " << fuga[i][e][a];
            }
            cout << endl;
        }
        if(i == fuga.size() - 1)continue;
        cout << "####################" << endl;
    }
}


Measured memory_bytes: 3168
import java.util.Scanner;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        while(true){
            int a = sc.nextInt();
            if(a==0) {break;}
            int []scores=new int[a];
            for(int i=0;i<scores.length;i++){
                scores[i] = sc.nextInt();
            } 
        double average=0,variance=0,deviation=0;
        int sum=0;
        for(int j=0;j<scores.length;j++){
            sum=scores[j]+sum;
        }
        average=(double)sum/scores.length;

        for(int k=0;k<scores.length;k++){
            deviation=deviation+(scores[k]-average)*(scores[k]-average);
        }  
            variance=deviation/scores.length;
    
        System.out.println(Math.sqrt(variance));

        }
sc.close();
    }
    
}


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

#define REP(i,s,n) for(int (i)=s; (i)<(int)(n);(i)++)
#define RIT(it,c) for(__typeof(c.begin()) it = c.begin();it!=c.end();it++)
#define ALL(x) x.begin(), x.end()
#define SZ(x) (int)(x).size()
#define MSET(m,v) memset(m,v,sizeof(m))


using namespace std;


typedef long long LL;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef pair<int,ii> iii;
typedef vector<LL> vL;
typedef vector<bool> vb;
typedef pair<int,vi> iv;
typedef pair<LL,LL> pLL; 
typedef long double LD;




int main(){
	int N;
	cin>>N;
	vector<vi> A(N,vi(N));
	vector<vb> mk(N,vb(N,false));
	for(int i=0;i<N;++i) for(int j=0;j<N;++j){
		cin>>A[i][j];
	}
	bool ok = true;
	for(int k=0;k<N;++k) for(int i=0;i<N;++i) for(int j=0;j<N;++j){
		if(i==k || j==k) continue;
		if(A[i][k] + A[k][j] < A[i][j]){
			cout<<-1;
			return 0;
		}
		if(A[i][k] + A[k][j] == A[i][j]) mk[i][j] = mk[j][i] = true;
	}
	LL ans = 0;
	for(int i=0;i<N;++i) for(int j=0;j<N;++j){
		if(!mk[i][j]) ans += A[i][j];
	}
	cout<<ans/2;
	return 0;
}


Measured memory_bytes: 640
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<stdlib.h>
int main()
{
	int a;
	scanf("%d", &a);
	if (a < 30)
	{
		printf("No");
	}
	else
	{
		printf("Yes");
	}
	return 0;
}

Measured memory_bytes: 1728
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int a = sc.nextInt() -1;
    int b = sc.nextInt()-1;
    int c = sc.nextInt()-1;
    int d = sc.nextInt()-1;
    String s = sc.next();
    int istack,istack2;
    String sstack = s;
    int last;
    boolean mpos = true;
    boolean spos = true;
    
    for(int i = a;i < c;i++){
      if(s.charAt(i) == '#' && s.charAt(i+1) == '#') mpos = false;
    }
    for(int i = b;i < d;i++){
      if(s.charAt(i) == '#' && s.charAt(i+1) == '#') mpos = false;
    }
    if(c > d){
      spos = false;
      for(int i = b-1;i < d && i+2 < n;i++){
        if(s.charAt(i) == '.' && s.charAt(i+1) == '.' && s.charAt(i+2) == '.') spos = true;
      }
    }
    
    
  	if(mpos && spos) System.out.println("Yes");
    else System.out.println("No");
    
    
  }
}


Measured memory_bytes: 40808
#include<iostream>
#include <cstring>
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string.h>
#include <stdlib.h>
#include <iomanip>

using namespace std;
int main()
{
    int k;
    double x;
    cin >> k;
    x = 2 * 3.141592653589 * k;
    cout <<setprecision(10) <<x << endl;;
    return 0;
}

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

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define FOR(i, s, e) for (ll(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (ll(i) = (s); (i) > (e); (i)--)
#define debug(x) cout << #x << ": " << x << endl
#define mp make_pair
#define pb push_back
const ll MOD = 1000000007;
const int INF = 1e9;
const ll LINF = 1e16;
const double PI = acos(-1.0);
int dx[8] = {0, 0, 1, -1, 1, 1, -1, -1};
int dy[8] = {1, -1, 0, 0, 1, -1, 1, -1};

/* -----  2017/06/10  Problem: ARC 071 C / Link: http://arc071.contest.atcoder.jp/tasks/arc071_c  ----- */
/* ------問題------



-----問題ここまで----- */
/* -----解説等-----



----解説ここまで---- */



ll N;
ll sums[100010];
ll sumt[100010];
ll ans = 0LL;

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

	string S, T;
	cin >> S >> T;
	sums[0] = 0;
	FOR(i, 0, S.size()) {
		if (S[i] == 'A')sums[i + 1] = 1;
		else if (S[i] == 'B')sums[i + 1] = 2;
	}
	sumt[0] = 0;
	FOR(i, 0, T.size()) {
		if (T[i] == 'A')sumt[i + 1] = 1;
		else if (T[i] == 'B')sumt[i + 1] = 2;
	}
	FOR(i, 0, S.size()) {
		sums[i + 1] += sums[i];
	}
	FOR(i, 0, T.size()) {
		sumt[i + 1] += sumt[i];
	}
	ll Q;  cin >> Q;
	FOR(i, 0, Q) {
		int s1, s2, t1, t2;
		cin >> s1 >> s2 >> t1 >> t2;
		if ((sums[s2] - sums[s1 - 1]) % 3 == (sumt[t2] - sumt[t1 - 1]) % 3)
			cout << "YES" << endl;
		else  cout << "NO" << endl;

	}

	return 0;
}


Measured memory_bytes: 2512
/*Lucky_Glass*/
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;

const int N=1e6,MOD=2;

int n;
char str[N+5];
int num[N+5];
int fac[N+3];

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;
}
int ABS(int x){return x<0? -x:x;}
int Count2(int x){
	int ret=0;
	while(!(x&1)) x>>=1,ret++;
	return ret;
}
int fC(int a,int b){return fac[b]-fac[a]-fac[b-a];}
int main(){
	scanf("%d%s",&n,str+1);
	fac[0]=0;
	for(int i=1;i<=n;i++) fac[i]=fac[i-1]+Count2(i);
	bool ok=false;
	int ans=0,fans=0;
	for(int i=1;i<n;i++){
		num[i]=ABS((int)str[i]-str[i+1]);
		if(num[i]==1){
			ok=true;
			ans^=fC(n-1-i,n-2)==0;
		}
		if(num[i]==2)
			fans^=fC(n-1-i,n-2)==0;
	}
	if(ok){
		printf("%d\n",ans);
		return 0;
	}
	printf("%d\n",fans*2);
	return 0;
}

Measured memory_bytes: 8960
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(unused_macros)]
#![allow(unused_imports)]

use std::str::FromStr;
use std::io::*;
use std::collections::*;
use std::cmp::*;

struct Scanner<I: Iterator<Item = char>> {
    iter: std::iter::Peekable<I>,
}

macro_rules! exit {
    () => {{
        exit!(0)
    }};
    ($code:expr) => {{
        if cfg!(local) {
            writeln!(std::io::stderr(), "===== Terminated =====")
                .expect("failed printing to stderr");
        }
        std::process::exit($code);
    }}
}

impl<I: Iterator<Item = char>> Scanner<I> {
    pub fn new(iter: I) -> Scanner<I> {
        Scanner {
            iter: iter.peekable(),
        }
    }

    pub fn safe_get_token(&mut self) -> Option<String> {
        let token = self.iter
            .by_ref()
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        if token.is_empty() {
            None
        } else {
            Some(token)
        }
    }

    pub fn token(&mut self) -> String {
        self.safe_get_token().unwrap_or_else(|| exit!())
    }

    pub fn get<T: FromStr>(&mut self) -> T {
        self.token().parse::<T>().unwrap_or_else(|_| exit!())
    }

    pub fn vec<T: FromStr>(&mut self, len: usize) -> Vec<T> {
        (0..len).map(|_| self.get()).collect()
    }

    pub fn mat<T: FromStr>(&mut self, row: usize, col: usize) -> Vec<Vec<T>> {
        (0..row).map(|_| self.vec(col)).collect()
    }

    pub fn char(&mut self) -> char {
        self.iter.next().unwrap_or_else(|| exit!())
    }

    pub fn chars(&mut self) -> Vec<char> {
        self.get::<String>().chars().collect()
    }

    pub fn line(&mut self) -> String {
        if self.peek().is_some() {
            self.iter
                .by_ref()
                .take_while(|&c| !(c == '\n' || c == '\r'))
                .collect::<String>()
        } else {
            exit!();
        }
    }

    pub fn peek(&mut self) -> Option<&char> {
        self.iter.peek()
    }
}

trait Joinable {
    fn join(self, sep: &str) -> String;
}

impl<U: ToString, T: Iterator<Item = U>> Joinable for T {
    fn join(self, sep: &str) -> String {
        self.map(|x| x.to_string()).collect::<Vec<_>>().join(sep)
    }
}

fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin.bytes().map(|c| c.unwrap() as char));
    let n: usize = sc.get();
    let a: Vec<i64> = sc.vec(n);
    let mut ans1 = 0;
    for i in 0..n {
        ans1 = max(ans1, a[i]);
    }
    let mut v: Vec<i64> = a.into_iter().filter(|&i| i != ans1).collect();
    v.sort_by_key(|i| (i - ans1/2).abs());
    let ans2 = v[0];
    println!("{} {}", ans1, ans2);
}


Measured memory_bytes: 6396
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll ;
#define fast ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
 const ll inf=1e9+7;

int main()
{
    fast;
    
string s,ans="\0";
cin>>s;

ll cnt=0;
for(ll i=s.size()-1;i>=0;i--)
{
	
	if(s[i]=='B')cnt++;
	else if(cnt&&s[i]!='B')
	{
		cnt--;
		
	}
	else
	ans+=s[i];
}

reverse(ans.begin(),ans.end());
cout<<ans;
    
    
 
   
}

		
	
	
	
	


Measured memory_bytes: 3584
#include <bits/stdc++.h>
#define fi first
#define se second
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define space putchar(' ')
#define enter putchar('\n')
#define MAXN 100005
#define eps 1e-12
//#define ivorysi
using namespace std;
typedef long long int64;
typedef unsigned int u32;
typedef double db;
template<class T>
void read(T &res) {
	res = 0;T f = 1;char c = getchar();
	while(c < '0' || c > '9') {
		if(c == '-') f = -1;
		c = getchar();
	}
	while(c >= '0' && c <= '9') {
		res = res * 10 + c - '0';
		c = getchar();
	}
	res *= f;
}
template<class T>
void out(T x) {
	if(x < 0) {x = -x;putchar('-');}
	if(x >= 10) {
		out(x / 10);
	}
	putchar('0' + x % 10);
}
int64 A[305][305];
int64 B[305][305],ans;
pii p[100005];
int tot,N;
void Solve() {
	read(N);
	for(int i = 1 ; i <= N ; ++i) {
		for(int j = 1 ; j <= N ; ++j) {
			read(A[i][j]);
			if(i != j) B[i][j] = 1e16;
			if(i < j) p[++tot] = mp(i,j);
		}
	}
	sort(p + 1,p + tot + 1,[](pii a,pii b){return A[a.fi][a.se] < A[b.fi][b.se];});
	for(int i = 1 ; i <= tot ; ++i) {
		int u = p[i].fi,v = p[i].se;
		for(int j = 1 ; j <= N ; ++j) {
			B[u][v] = min(B[u][j] + B[j][v],B[u][v]);
		}
		B[v][u] = B[u][v];
		if(B[u][v] < A[u][v]) {puts("-1");return;}
		if(B[u][v] == A[u][v]) continue;
		ans += A[u][v];
		B[u][v] = B[v][u] = A[u][v];
	}
	out(ans);enter;
}
int main() {
#ifdef ivorysi
	freopen("f1.in","r",stdin);
#endif
	Solve();
}


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

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define MOD 1000000007
#define el endl
#define INF 1e8
typedef long long ll;
typedef long double ld;
// 'a' = 97 'z' = 122 => 'a' = 0 'z' = 25
int main() {
    int n;
    cin >> n;
    rep(i, n){
        int a;
        cin >> a;
        if(a % 2 == 0){
            if(a % 3 != 0 && a % 5 != 0){
                cout << "DENIED" << endl;
                return 0;
            }
        }
    }
    cout << "APPROVED" << endl;
}




Measured memory_bytes: 256
n, q = gets.split.map &:to_i

@root = Array.new(n + 1) {|i| i}
def find(x); @root[x] = @root[x] == x ? x : find(@root[x]); end
def union(x,y); (x = find(x)) == (y = find(y)) or @root[x] = y ; end

q.times do
    t, u, v = gets.split.map &:to_i
    if t == 0
        union u, v
    else
        a = find u
        b = find v

        puts a == b ? 1 : 0
    end
end

Measured memory_bytes: 15792
use std::str::FromStr;
use std::fmt::Debug;
use std::cmp;
#[allow(dead_code)]
fn read_as_vec<T>() -> Vec<T>
where T: FromStr, <T as FromStr>::Err : Debug{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().split_whitespace().map(|c| T::from_str(c).unwrap()).collect()

}

#[allow(dead_code)]
fn read_as_string() -> String{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

fn main(){
    let line = read_as_string().chars().collect::<Vec<char>>();

    if line.iter().all(|x| *x == 'B') || line.iter().all(|x| *x == 'A'){
        println!("No");
    }else{
        println!("Yes");
    }
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<ll> vl;
typedef vector<pair<ll,ll>> vp;
#define rep(i,n) for(ll i = 0; i < ll(n); i++)
#define all(v) v.begin() , v.end()
#define inputv(v,n) rep(i,n){\
    ll x;\
    cin>>x;\
    v.push_back(x);\
    }
const ll INF=99999999999999;
const ll MOD=1000000007;
 
int main() {
  ll n,m;
  cin >> n >> m;
  vl a;
  inputv(a,m);
  sort(a.begin(), a.end());
  ll ans = a[m-1] - a[0];
  if(n >= m){
    cout << 0;
    return 0;
  }
  vl b(m-1);
  rep(i,m-1){
    b[i] = a[i+1] - a[i];
  }
  sort(b.begin(), b.end());
  rep(i,n-1){
    
    ans -= b[m-2-i];
    
  }
  cout << ans;
  
 return 0;
}

Measured memory_bytes: 1908
x,y,a,b,c=map(int,input().split())
p=sorted(list(map(int,input().split())))[-x:]
q=sorted(list(map(int,input().split())))[-y:]
r=sorted(list(map(int,input().split())))
print(sum(sorted(p+q+r)[-x-y:]))

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

using namespace std;

int main(){
	int m,n;
	while(cin >> n >> m){
		if(!(m|n)) break;
		bool matched[n][n];
		int pic[n][n];
		int pat[m][m];
		int orig[m][m];
		
		for(int i=0;i<n;i++){
			for(int j=0;j<n;j++){
				cin >> pic[i][j];
				matched[i][j] = false;
			}
		}
		
		for(int i=0;i<m;i++){
			for(int j=0;j<m;j++){
				cin >> orig[i][j];
			}
		}
		
		for(int i=0;i<4;i++){//4ツ陛サツ古シ
			//rotateツつオツつスpatツづーツ催ャツづゥ
			if(i == 0){//0
				for(int p=0;p<m;p++){
					for(int q=0;q<m;q++){
						pat[p][q] = orig[p][q];
					}
				}
			}else if(i == 1){ //90
				for(int p=0;p<m;p++){
					for(int q=0;q<m;q++){
						pat[p][q] = orig[m-1-q][p];
					}
				}
			}else if(i == 2){
				for(int p=0;p<m;p++){
					for(int q=0;q<m;q++){
						pat[p][q] = orig[m-1-p][m-1-q];
					}
				}
			}else{
				for(int p=0;p<m;p++){
					for(int q=0;q<m;q++){
						pat[p][q] = orig[q][m-1-p];
					}
				}
			}
			for(int p=0;p<n-m+1;p++){
				for(int q=0;q<n-m+1;q++){
					bool ok = true;
					for(int r=0;r<m;r++){
						for(int s=0;s<m;s++){
							if(pat[r][s] != -1 && pat[r][s] != pic[p+r][q+s]) ok = false;
						}
					}
					if(ok){
						for(int r=0;r<m;r++){
							for(int s=0;s<m;s++){
								if(pat[r][s] != -1){
									matched[p+r][q+s] = true;
								}
							}
						}
					}
				}
			}
		}
		int x=-1,y=-1;
		for(int p=0;p<n;p++){
			for(int q=0;q<n;q++){
				if(matched[p][q]){
					x = p;
					y = q;
					break;
				}
			}
			if(x != -1 && y != -1) break;
		}
		if(x == -1 && y == -1){
			cout << "NA" << endl;
		}else{
			cout << y+1 << " " << x+1 << endl;
		}
	}
}

Measured memory_bytes: 944
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<deque>
#include<regex>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>

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

typedef int long long ll;
using namespace std;
typedef pair<int, int> P;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const ll MOD = 1e9 + 7;
static const int MAX = 100;
static const int INF = (1 << 23);

int main() {
    string s;
    cin>>s;
    string pre;
    //pre = s[0];
    int cnt=1;
    bool f=false;


    if(s.size()==2){
        if(s[0]!=s[1]){
            cout<<2<<endl;
        }else{
            cout<<1<<endl;
        }
        return 0;
    }


    for(int i=1;i<s.size();i++){
        if(f){
            if(i==s.size()-2&&s[i]==s[i+1]){
                cnt++;
                break;
            }
            cnt++;
            f=false;

        }else{

            if(s[i]!=s[i-1]){
                cnt++;
            }else{
                if(i==s.size()-1){
                    break;
                }
                cnt++;
                i++;
                f=true;
            }
        }


    }
    cout<<cnt<<endl;


    return 0;
}


Measured memory_bytes: 768
import bisect
n=int(input())
l=sorted(list(map(int,input().split())))
g=0
for ai in range(n-2):
    for bi in range(ai+1,n-1):
        g+=max(0,bisect.bisect_left(l,l[bi]+l[ai])-1-bi)
print(g)


Measured memory_bytes: 9372
#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 <bitset>
#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<VL> VVL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

struct union_find{
    VI par;

    void init(int n){
        par.resize(n);
        REP(i,n) par[i] = i;
    }

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

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

    void merge(int x, int y){
        x = find(x);
        y = find(y);
        if (x == y) return;
        par[x] = y;
    }
};

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

    VI c(n);
    REP(i,n){
        scanf("%d", &c[i]);
        c[i]--;
    }

    VI a(m), b(m);
    VL w(m);
    REP(i,m){
        scanf("%d %d %lld", &a[i], &b[i], &w[i]);
        a[i]--;
        b[i]--;
    }

    VI emp(n, -1);
    int x = k;
    REP(i,n){
        if (c[i] == -1){
            emp[i] = x++;
        }
    }

    VI ind(m);
    REP(i,m) ind[i] = i;

    sort(ALL(ind), [&](int x, int y){ return w[x] < w[y]; });

    union_find uf;
    uf.init(x);

    ll ans = 0;
    x = 0;

    REP(i,m){
        int p = (c[a[ind[i]]] == -1 ? emp[a[ind[i]]] : c[a[ind[i]]]);
        int q = (c[b[ind[i]]] == -1 ? emp[b[ind[i]]] : c[b[ind[i]]]);
        if (!uf.same(p, q)){
            x++;
            ans += w[ind[i]];
            uf.merge(p, q);

            if (x == k-1){
                cout << ans << endl;
                return 0;
            }
        }
    }
    cout << -1 << endl;

    return 0;
}


Measured memory_bytes: 3712
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1e9;
const int MOD = 1000000007;
const double PI = acos(-1);
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};

void solve() {
  int a, b;
  cin >> a >> b;
  int ans = 0;
  rep(i, 9) {
    int x = 10001 * (i+1);
    rep(j,10) {
      int y = 1010 * j;
      rep(k,10) {
        int p = x + y + (100 * k);
        if (a <= p && p <= b) ans++;
      }
    }
  }
  cout << ans << endl;
}

int main() {
  solve();
  return 0;
}

Measured memory_bytes: 3528
#include <stdio.h>
int main()
{
	int n,i,f=0;
	char a[101];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		getchar();
		scanf("%c",&a[i]);
		if(a[i]=='Y')
		f=1;
	}
	if(f)
	printf("Four\n");
	else
	printf("Three\n");
	return 0;
}

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

/*
unsigned seed1 = std::chrono::system_clock::now().time_since_epoch().count();
mt19937 g1.seed(seed1);

ios_base::sync_with_stdio(false);
cin.tie(NULL);
*/
using namespace std;

const double PI = 2 * acos(0);

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef long double ld;
typedef vector<vector<ll>> matrix;

int n;
map<int, int> dp[2];
vector<pii> freq[2];
int main() {
  scanf("%d", &n);
  for(int i = 0; i < n; i++) {
    int t;
    scanf("%d", &t);
    dp[i%2][t]++;
  }
  for(int i = 0; i < 2; i++) {
    for(auto out: dp[i]) {
      freq[i].push_back(pii(out.second, out.first));
    }
  }
  sort(freq[0].begin(), freq[0].end());
  sort(freq[1].begin(), freq[1].end());
  reverse(freq[0].begin(), freq[0].end());
  reverse(freq[1].begin(), freq[1].end());
  int ret = max(freq[0][0].first, freq[1][0].first);
  if(freq[0][0].second != freq[1][0].second) {
    ret = max(ret, freq[0][0].first + freq[1][0].first);
  }
  if(freq[1].size() >= 2 && freq[0][0].second != freq[1][1].second) {
    ret = max(ret, freq[0][0].first + freq[1][1].first);
  }
  if(freq[0].size() >= 2 && freq[0][1].second != freq[1][0].second) {
    ret = max(ret, freq[0][1].first + freq[1][0].first);
  }
  printf("%d\n", n - ret);
}


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

int main() {
 int N;
  cin >> N;
  vector <int> C(N);
  for(int i = 0;i<N;i++){
    cin >> C.at(i);
  }
  sort(C.begin(),C.end());
  reverse(C.begin(),C.end());
  vector <int> A(N);
  vector <int> B(N);
  int counter = 0;
  for (int i = 0;i<N;i++){
    A.at(i) = C.at(2*i);
    counter++;
    if(counter == N){
      break;
    }
    B.at(i) = C.at(2*i+1);
    counter++;
    if(counter == N){
      break;
    }
  }
  //int SA = sizeof(A);
  //int SB = sizeof(B);
  int AS = 0, BS = 0;
  for (int i = 0; i<N;i++){
    AS+=A.at(i);
  }
  for (int i = 0; i<N;i++){
    BS+=B.at(i);
  }
  cout << AS-BS << endl;
}

Measured memory_bytes: 256