akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
using namespace std;

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

  int N, Y;
  cin >> N >> Y;
  int sum;
  int flag = 0;
  int I = -1;
  int J = -1;
  int K = -1;

  REP(i, N + 1) {
    REP(j, N - i + 1) {
      int k = N - i - j;
      sum = 10000 * i + 5000 * j + 1000 * k;
      if(sum == Y) {
        I = i;
        J = j;
        K = k;
        flag = 1;
      }
      if(flag)
        break;
    }
    if(flag)
      break;
  }
  cout << I << ' ' << J << ' ' << K << endl;
  return 0;
}

Measured memory_bytes: 256
//----------BHAVIK DIWANI(PICT_COMP)---------------
#include<bits/stdc++.h>
#define test ll t; cin>>t; while(t--)
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define mod 1000000007
#define ll long long
#define int long long
#define ull unsigned long long
#define MAX 1000005
#define pb push_back
#define mkp make_pair
#define vi vector<int>
#define pii pair<int,int>
#define endl '\n'
#define vs vector<string>
#define mii map<int,int>
#define msi map<string,int>
#define vpii vector< pair<int, int > >
#define vpsi vector< pair< string ,int > >
#define forci(p,q) for(int i=p;i<q;i++)
ll gcd(ll a,ll b){ if(b==0) return a;    return gcd(b,a%b);}
ll lcm(ll a,ll b) { return (a/gcd(a,b)*b);}
ull power(ull a, ull b) {a %= mod;  ull res = 1;  while (b > 0) { if (b & 1) res = res * a % mod;  a = a * a % mod;  b >>= 1; }  return res%mod; }
ll modmul(ll x, ll y){return (x*y)%mod;}
ll modadd(ll x, ll y){return (x+y)%mod;}
ll modsub(ll x, ll y){return (x-y+mod)%mod;}
ll fact[1000007]={0};
void facto() {fact[0]=1;fact[1]=1;for(int i=2;i<1000007;i++)fact[i]=(fact[i-1]*i)%mod;}
ll ncr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[r],mod-2)))%mod; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
ll npr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
inline long long toint(const std::string &s) {std::stringstream ss; ss << s; long long x; ss >> x; return x;}
inline std::string tostring(long long number) {std::stringstream ss; ss << number; return ss.str();}
inline std::string tobin(long long x) {return std::bitset<63>(x).to_string();}
/*bool prime[MAX];
ull sieve(){memset(prime,true,sizeof(prime));for(ull p=2;p*p<MAX;p++){if(prime[p]==true){for(ull i=2*p;i<MAX;i+=p){prime[i]=false;}}}prime[0]=0;prime[1]=0;
}*/
/*int inv[1000001]={0};
void findinverse(){inv[1] = 1;for(int i = 2; i <=1e6 ; ++i)	inv[i] = (mod - (mod/i) * inv[mod%i] % mod) % mod;}
*/
using namespace std;
vi fac;
int n,k;
int a[505]={0};
void factors(int n){
	for(int i=1;i<=sqrt(n);i++){
		if(n%i==0){
			if(n/i!=i)
				fac.pb(n/i);
			fac.pb(i);
		}
	}
	sort(fac.begin(),fac.end());
}
int check(int x){
	vi temp;
	forci(0,n){
		temp.pb(a[i]%x);
	}
	sort(temp.begin(),temp.end());
	int l=0,r=n-1;
	int rem=0,req=0;
	while(l<=r){
		if(rem<=0){
			rem+=temp[l];
			req+=temp[l];
			l++;
		}
		else{
			rem-=(x-temp[r]);
			req+=(x-temp[r]);
			r--;
		}
	}
	if(rem!=0 || req>2*k)	return 0;
	else					return 1;
}
int solve()
{
	cin>>n>>k;
	int sum=0;
	for(int i=0;i<n;i++){
		cin>>a[i];
		sum+=a[i];
	}
	factors(sum);
	int ans=0;
	for(int i=0;i<fac.size();i++){
		int x=fac[i];
		if(check(x)){
			ans=x;
		}
	}
	cout<<ans<<endl;
	return 0;
}
signed main()
{
	fastio;
//	test
		solve();
}







Measured memory_bytes: 3696
#include <bits/stdc++.h>
#define DUMP(x)  cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define IFOR(i, m, n) for(int i = n - 1; i >= m; i-- )
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define FOREACH(x,a) for(auto& (x) : (a) )
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
const ll INF = 1e18;
/* テンプレートここまで */
map<ll, ll> prime_decomposition(ll n){
  map<ll, ll> mp;
  for(ll p = 2; p*p <=n; p++){
    if(n%p!=0) continue;
    ll cnt = 0;
    while(n%p == 0){cnt++; n /= p;}
    mp[p] = cnt;
  }
  if(n!=1) mp[n] = 1;
  return mp;
}

ll bpow(ll a , ll b){
  if (b == 0) return 1;
  ll ret;
  if (b%2 == 0){
    ll  t = bpow(a, b/2);
    ret = t*t;
  }else{
    ll t = bpow(a, (b-1)/2);
    ret = a*t*t;
  }
  return ret;
}

int main() {
  ll n,p; cin >> n >> p;
  map<ll,ll> mp = prime_decomposition(p);
  ll ans = 1;
  FOREACH(x,mp){
    ans *= bpow(x.first, x.second/n);
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<algorithm>

using namespace std;

int main() {
    ios :: sync_with_stdio(false);
    char s[51], t[51];
    int ns, nt;
    int p = -1, i, j, ok;
    memset(s, 0, sizeof(s));
    memset(t, 0, sizeof(t));
    cin>>s>>t;
    ns = strlen(s);
    nt = strlen(t);
    for(i=0; i<ns-nt+1; ++i) {
        ok = 1;
        for(j=0; j<nt; ++j) {
            if((*(s+i+j)!='?')&&(*(s+i+j)!=*(t+j))) {
                ok = 0;
                break;
            }
        }
        if(ok) {
            p = i;
        }
    }
    if(p==-1) {
        cout<<"UNRESTORABLE";
    }
    else {
        for(i=0; i<nt; ++i) {
            *(s+p+i) = *(t+i);
        }
        for(i=0; i<ns; ++i) {
            if(*(s+i)=='?') {
                *(s+i) = 'a';
            }
        }
        cout<<s;
    }
    return 0;
}

Measured memory_bytes: 256
n=int(input())
x,y=[],[]
for i in range(n):
    x1,y1=map(int,input().split())
    x.append(x1)
    y.append(y1)
s=0
for i in range(n):
    for j in range(n):
        if i!=j:
            s+=((x[i]-x[j])**2+(y[i]-y[j])**2)**(1/2)
print(s/n)

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

using namespace std;

int main() {
    int n, m;
    cin >> n >> m;
    vector<int> x(m), x_n(m-1);
    for (int i=0; i<m; i++) cin >> x[i];
    sort(x.begin(), x.end());
    for (int i=0; i<m-1; i++) x_n[i] = x[i+1] - x[i];
    sort(x_n.begin(), x_n.end());
    long long ans = 0;
    for (int i=0; i<m-n; i++) ans += x_n[i];
    cout << ans << endl;
}


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

using namespace std;

int find(vector<int> &C, int x){ return (C[x] == x) ? x : find(C, C[x]);}
bool same(vector<int> &C, int x, int y){ return find(C, x) == find(C, y);}
void merge(vector<int> &C, int x, int y){ C[find(C,x)] = find(C, y);}

int main(){
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  #ifdef Larra
  freopen("in","r",stdin);
  freopen("out","w",stdout);
  #endif
  int n, q;
  cin>>n>>q;
  vector<int> C(n);
  for(int i = 0; i < n; i++) C[i] = i;
  for(int i = 0; i < q; i++){
    int com, x, y;
    cin>>com>>x>>y;
    if(com)
      cout<<same(C, x,y)<<"\n";
    else
      merge(C, x,y);
  }
}

Measured memory_bytes: 3252
import java.util.*;

public class Main {
    static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        int n = sc.nextInt();
        long[] h = new long[n];
        int k = sc.nextInt();
        for(int i = 0; i < n; ++i) h[i] = sc.nextLong();
        Arrays.sort(h);
        n -= k;
        long ans = 0;
        for(int i = 0; i < n; ++i) ans += h[i];
        System.out.println(ans);
    }
}

Measured memory_bytes: 90456
from collections import Counter
from itertools import combinations
n = int(input().rstrip())

c = Counter()

for i in range(1,n+1):
    i = str(i)
    a = int(i[0])
    b = int(i[-1])
    c[a, b] += 1

ans = 0
for a, b in combinations(range(1,10), 2):
    ans += 2 * c[a,b] * c[b,a]

for i in range(1,10):
    ans += c[i,i] ** 2

print(ans)

Measured memory_bytes: 73952
prime = [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97]
num = [0 for i in range(len(prime))]
n = int(input())
vec = [i for i in range(1,n+1)]
for i in vec:
  while i>1:
    for j in range(len(prime)):
      if i%prime[j]==0:
        num[j]+=1
        i//=prime[j]
ans=0
for i in range(len(num)):
  for j in range(i+1,len(num)):
    for k in range(len(num)):
      if i==k or j==k:
        continue
      if num[i]>=4 and num[j]>=4 and num[k]>=2:
        #print(prime[i],prime[j],prime[k])
        ans+=1
for i in range(len(num)):
  for j in range(len(num)):
    if i==j:
      continue
    if num[i]>=24 and num[j]>=2:
      ans+=1
    if num[i]>=14 and num[j]>=4:
      ans+=1    
for i in range(len(num)):
  if num[i]>=74:
    ans+=1
print(ans)

Measured memory_bytes: 3064
#include<iostream>
#include<string.h>
#include<queue>
#include<algorithm>
using namespace std;

typedef pair<int,int> P;

int h,w,n;
char m[1000][1000];
int visited[1000][1000];

int main(){
	cin>>h>>w>>n;

	int pos;
	for(int y=0;y<h;y++){
		for(int x=0;x<w;x++){
			cin>>m[x][y];
			if(m[x][y]=='S') pos=x+y*1000;
		}
	}

	memset(visited,0,sizeof(visited));
	int ans=0;
	for(int now=1;now<=n;now++){
		queue<P> q;
		q.push(make_pair(pos,0));
		while(1){
			pos=q.front().first;
			int x=pos%1000;
			int y=pos/1000;
			int cost=q.front().second;
			q.pop();
			if(visited[x][y]==now || m[x][y]=='X') continue;
			if(m[x][y]==('0'+now)){
				ans+=cost;
				break;
			}
			visited[x][y]=now;
			if(0<x) q.push(make_pair(pos-1,cost+1));
			if(x+1<w) q.push(make_pair(pos+1,cost+1));
			if(0<y) q.push(make_pair(pos-1000,cost+1));
			if(y+1<h) q.push(make_pair(pos+1000,cost+1));
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 8000
export class Main {
  static main(input): string {
    const tmp: string[] = input.split("\n");
    const n: number = Number(tmp[0]);
    const a: number[] = tmp[1].split(" ").map(Number);
    let min: number = Infinity;
    let result: number = 0;
    let even: boolean = true;
    let hasZero: boolean = false;
    for (let i = 0; i < n; ++i) {
      if (a[i] < 0) {
        even = !even;
      } else if (a[i] == 0) {
        hasZero = true;
      }
      const b: number = Math.abs(a[i]);
      if (b < min) {
        min = b;
      }
      result += b;
    }
    return `${result - (hasZero || even ? 0 : (min * 2))}`;
  }
}
console.log(Main.main(require("fs").readFileSync("/dev/stdin", "utf8")));

Measured memory_bytes: 28000
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner in = new Scanner(System.in);
        int N = in.nextInt();
        int M = in.nextInt();
        
        boolean[][] S = new boolean[N][M];
        for (int i = 0; i < M; i++) {
            int k = in.nextInt();
            for (int j = 0; j < k; j++) {
                int s = in.nextInt() - 1;
                S[s][i] = true;
            } 
        } 
       
        int[] P = new int[M];
        for (int i = 0; i < M; i++) {
            P[i] = in.nextInt();
        }
       
        int X = 1 << N;
        int res = 0;
        for (int x = 0; x < X; x++) {
            int[] A = new int[M];
            for (int n = 0; n < N; n++) {
                if ((x >> n & 1) == 1) {
                    for (int m = 0; m < M; m++) {
                        if (S[n][m]) {
                            A[m] += 1;
                        }
                    }
                }
            }
            
            boolean b = true;
            for (int m = 0; m < M; m++) {
                b &= ((A[m] % 2) == P[m]);
            }
            
            if (b) {
                res += 1;
            }
        }
        
        System.out.println(res);
    }
}


Measured memory_bytes: 22868
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)

func nextLine() (arr string) {
	sc.Scan()
	arr = sc.Text()
	return
}

func stringToInt(arr []string) (arr2 []int) {
	for _, val := range arr {
		val2, _ := strconv.Atoi(val)
		arr2 = append(arr2, val2)
	}
	return
}

func printLine(arr []int) {
	for i := 0; i < len(arr); i++ {
		fmt.Print(arr[i])
		if i != (len(arr) - 1) {
			fmt.Print(" ")
		}
	}
	fmt.Print("\n")
}

func bubbleSort(arr []int) (arr2 []int, count int) {
	flag := 1
	for {
		if flag == 0 {
			break
		}
		flag = 0
		for i := len(arr) - 1; i > 0; i-- {
			if arr[i] < arr[i-1] {
				tmp := arr[i]
				arr[i] = arr[i-1]
				arr[i-1] = tmp
				flag = 1
				count++
			}
		}
	}
	arr2 = arr
	return
}

func main() {
    var n int
    fmt.Scan(&n)
    
	line := nextLine()
	arrString := strings.Split(line, " ")
	arr := stringToInt(arrString)

	arr, count := bubbleSort(arr)

	printLine(arr)
	fmt.Println(count)
}



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

int main () {
  string A;
  cin >> A;
  int N = A.size();
  A += "00";
  vector<bool> alph(26,false);
  vector<int> ansl(N+2,1);
  int amount = 26;
  int s;
  for (int i=N-1; i>=0; i--) {
    s = A[i] - 'a';
    ansl[i] = ansl[i+1];
    if (!(alph[s])) {
      amount--;
      alph[s] = true;
      if (amount == 0) {
        ansl[i]++;
        amount = 26;
        for (int i=0; i<26; i++) {
          alph[i] = false;
        }
      }
    }
  }
  for (int i=0; i<26; i++) {
    alph[i] = false;
  }
  int now = ansl[0];
  cerr << now << endl;
  char c;
  ansl[N] = 0;
  ansl[N+1] = 0;
  for (int i=0; i<N; i++) {
    if (now == ansl[i+1]) {
      s = A[i] - 'a';
      alph[s] = true;
    }
    else {
      now--;
      for (int j=0; j<26; j++) {
        if (alph[j] == false) {
          c = 'a' + j;
          cout << c;
          break;
        }
      }
      for (int j=0; j<26; j++) {
        alph[j] = false;
      }
      if (now == 0) {
        break;
      }
      for (;;) {
        if (A[i] == c) {
          break;
        }
        else {
          i++;
        }
      }
    }
  }
  for (int i=0; i<N+1; i++) {
    cerr << ansl[i];
  }
  cerr << endl;
  for (int i=0; i<N+1; i++) {
    cerr << A[i];
  }
  cerr << endl;
  cout << endl;
}

Measured memory_bytes: 1412
#include <bits/stdc++.h>
using namespace std;
int main() {
int A,B,C;
cin >> A >> B >> C;
if(A!=B && A!=C){
    cout << A; return 0;
}
if(B!=A && B!=C){
    cout << B; return 0;
}
cout << C;
return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<unordered_map>
using namespace std;
typedef long long ll;
const int N=1e5+5;
int main(){
int x,n;

unordered_map<int,int>a;
cin>>x>>n;
if(n==0){
    cout<<x<<endl;
  return 0;
}
for(int i=1;i<=n;i++){
    int y;
    cin>>y;
    a[y]++;
    }
for(int i=x,j=x;;i--,j++){
    if(!a[i]){
        cout<<i<<endl;
        break;
    }
    else if(!a[j]){
        cout<<j<<endl;
        break;
    }

}
return 0;}


Measured memory_bytes: 3632
import sys
sys.setrecursionlimit(10 ** 6)
# input = sys.stdin.readline    ####
int1 = lambda x: int(x) - 1
def II(): return int(input())

def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())

def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

def printlist(lst, k='\n'): print(k.join(list(map(str, lst))))
INF = float('inf')

def solve():
    n = II()
    H = LI()

    dp = [INF] * n
    dp[0] = 0
    def f(a, b):
        return abs(a - b)
    for i in range(1, n):
        dp[i] = min(dp[i-1] + f(H[i], H[i-1]), dp[i-2] + f(H[i], H[i-2]) if i >= 2 else INF)
    print(dp[i])


if __name__ == '__main__':
    solve()


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

struct Node
{
	int LeftChild;
	int RightChild;
	int Parent;
	int Sibling;
	int Depth;
	int Height;
	int Degree;
	
	Node()
	{
	    LeftChild = -1;
	    RightChild = -1;
	    Parent = -1;
	    Sibling = -1;
	    Depth = -1;
	    Height = -1;
	    Degree = 0;
	}
};

Node tree[100007];

int Run(int N)
{
	int t, max_height = -1;
	
	t = tree[N].LeftChild;
	if(t != -1)
	{
		tree[t].Depth = tree[N].Depth + 1;
		tree[t].Height = Run(t) + 1;
	}
	else
	{
		tree[t].Height = -1;
	}
	
	if(max_height < tree[t].Height)
	{
		max_height = tree[t].Height;
	}
	
	t = tree[N].RightChild;
	if(t != -1)
	{
		tree[t].Depth = tree[N].Depth + 1;
		tree[t].Height = Run(t) + 1;
	}
	else
	{
		tree[t].Height = -1;
	}
	
	if(max_height < tree[t].Height)
	{
		max_height = tree[t].Height;
	}
	
	return max_height;
}

int main()
{
	int N, ID;
	cin >> N;
	
	for(int i = 0; i < N; ++i)
	{
		tree[i] = Node();
	}
	
	for(int i = 0; i < N; ++i)
	{
		cin >> ID;
		cin >> tree[ID].LeftChild >> tree[ID].RightChild;	
		
		if(tree[ID].LeftChild != -1 && tree[ID].RightChild != -1)
		{
			tree[ID].Degree = 2;
			tree[tree[ID].LeftChild].Parent = ID;
			tree[tree[ID].LeftChild].Sibling = tree[ID].RightChild;
			tree[tree[ID].RightChild].Parent = ID;
			tree[tree[ID].RightChild].Sibling = tree[ID].LeftChild;
		}
		else if(tree[ID].LeftChild != -1)
		{ 
			tree[ID].Degree = 1;
			tree[tree[ID].LeftChild].Parent = ID;
		}
		else if(tree[ID].RightChild != -1)
		{ 
		    tree[ID].Degree = 1;
			tree[tree[ID].RightChild].Parent = ID;
		}
	}
	
	int root;
	for(int i = 0; i < N; ++i)
	{
		if(tree[i].Parent == -1)
		{
			root = i;
		}
	}
	
	tree[root].Depth = 0;
	tree[root].Height = Run(root) + 1;
	
	for(int i = 0; i < N; ++i)
	{
		cout << "node " << i << ": parent = " << tree[i].Parent << ", sibling = " << tree[i].Sibling << ", degree = " << tree[i].Degree << ", depth = " << tree[i].Depth << ", height = " << tree[i].Height << ", ";
		
		if(tree[i].Parent == -1)
		{
			cout << "root";
		}
		else if(tree[i].LeftChild == -1 && tree[i].RightChild == -1)
		{
			cout << "leaf";
		}
		else
		{
			cout << "internal node";
		}
		
		cout << endl;
	}

    return 0;
}



Measured memory_bytes: 5860
#include<iostream>

void printData(int data[], int lineCnt ) {
	for( int i = 0; i < lineCnt; i++ ) {
		if ( i > 0 ) {
			std::cout << " ";
		}
		std::cout << data[i];
	}
	std::cout << std::endl;
}

int main(void) {
    int lineCnt;
    std::cin >> lineCnt;

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

    for( int i = 0; i < lineCnt; i++ ) {
        int val = data[i];
        int j = i -1;
        while ( j >= 0 && val < data[j] ) {
            data[j+1] = data[j];
            j--;
        }
        data[j+1] = val;
        printData(data,lineCnt);
    }

    return 0;
}



Measured memory_bytes: 3108
n,p = map(int,input().split())
if n > 39:
  print(1)
  exit()
if n == 1:
  print(p)
  exit()
ans = 1
num = 1
while num ** n <= p:
  if p % (num**n) == 0:
    ans = num
  num += 1
print(ans)

Measured memory_bytes: 3064
n = int(input())
a = input().split(" ")
count = 0

for i in range(100):
    for j in range(len(a)):
        if(int(a[j]) % 2 != 0):
            break
        else:
            a[j] = int(a[j]) / 2
            count += 1
    else:
        continue
    break

print(count // len(a))


Measured memory_bytes: 3060
# coding: utf-8
N = gets.to_i
a = gets.split.map {|e| e.to_i}
# 砕くレンガの個数
ans = 0
# 今探している数
sn = 1
cnt = 0

a.each do |n|
  if n == sn
    ans += cnt
    cnt = 0
    sn += 1
  else
    cnt += 1
  end
end

if cnt == a.size
  puts -1
else
  puts ans + cnt
end



Measured memory_bytes: 15364
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <bitset>
#include <set>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define all(i,n) (i),(i+n)

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

typedef pair<int, int> P;
typedef pair<string, int> SP;
typedef long long ll;

const int INF = 1e9;
const ll LLINF = 1e18;
const int MAX_V = 1e6+1;
const ll mod = 1000000007;

// --------------------------------------
int c[3][3];
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  REP(i, 3) REP(j, 3) cin >> c[i][j];

  bool f = false;
  REP(b1, 101) REP(b2, 101) REP(b3, 101) {
    int a1;
    if(c[0][0] >= b1) a1 = c[0][0] - b1;
    else continue;

    if(b2 + a1 != c[0][1] || b3 + a1 != c[0][2]) continue;

    int a2;

    if(c[1][0] >= b1) a2 = c[1][0] - b1;
    else continue;

    if(b2 + a2 != c[1][1] || b3 + a2 != c[1][2]) continue;


    int a3;
    if(c[2][0] >= b1) a3 = c[2][0] - b1;
    else continue;

    if(b2 + a3 != c[2][1] || b3 + a3 != c[2][2]) continue;

    f = true;
  }

  cout << (f ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
s = input()
t = s.split(">")
t2 = s.split("<")
a = []
b = []
for i in t:
    if i != '':
        a.append(i)

for i in t2:
    if i != '':
        b.append(i)
n = len(a)
n2 = len(b)
if len(b) == 1 and len(a) == 1:
    if s[0] == '>':
        y = len(b[0])
        x = len(a[0])
        sums = 0
        sums += (x * (x + 1)) / 2
        sums += (y * (y + 1)) / 2
        print(int(sums))
        exit()

tmp = min(n, n2)
sums = 0
if s[0] == '>' and s[len(s)-1] == '<':
    x = len(a[n-1])
    sums += (x * (x + 1)) / 2
    x = len(b[0])
    sums += (x * (x + 1)) / 2
    for i in range(tmp-1):
        x = len(a[i])
        y = len(b[i+1])
        if x > y:
            sums += (x * (x + 1)) / 2
            sums += (y * (y - 1)) / 2
        else:
            sums += (x * (x - 1)) / 2
            sums += (y * (y + 1)) / 2
    print(int(sums))
    exit()

if n2 > n:
    for i in range(tmp):
        x = len(a[i])
        y = len(b[i+1])
        if x > y:
            sums += (x * (x + 1)) / 2
            sums += (y * (y - 1)) / 2
        else:
            sums += (x * (x - 1)) / 2
            sums += (y * (y + 1)) / 2
elif n > n2:
    for i in range(tmp):
        x = len(a[i])
        y = len(b[i])
        if x > y:
            sums += (x * (x + 1)) / 2
            sums += (y * (y - 1)) / 2
        else:
            sums += (x * (x - 1)) / 2
            sums += (y * (y + 1)) / 2
elif n == n2:
    for i in range(tmp):
        x = len(a[i])
        y = len(b[i])
        if x > y:
            sums += (x * (x + 1)) / 2
            sums += (y * (y - 1)) / 2
        else:
            sums += (x * (x - 1)) / 2
            sums += (y * (y + 1)) / 2
if n > n2:
    x = len(a[n-1])
    sums += (x * (x + 1)) / 2
elif n2 > n:
    x = len(b[0])
    sums += (x * (x + 1)) / 2

print(int(sums))


Measured memory_bytes: 17172
# coding: utf-8
import sys
#from operator import itemgetter
sysread = sys.stdin.buffer.readline
read = sys.stdin.buffer.read
#from heapq import heappop, heappush
#from collections import defaultdict
sys.setrecursionlimit(10**7)
#import math
#from itertools import product, accumulate, combinations, product
#import bisect
#import numpy as np
#from copy import deepcopy
from collections import deque
#from decimal import Decimal
#from numba import jit

INF = 1 << 50

def bfs(MAZE, start):
    s = start + (0,)
    queue = deque([s])
    max_count = 0
    seen = set()
    seen.add(start)
    while queue:
        y,x,count = queue.popleft()
        max_count = max(max_count, count)
        for i,j in ((0,1), (0,-1), (1,0), (-1, 0)):
            next_y, next_x = y + i, x + j
            #print(next_y, next_x)
            if not (next_y, next_x) in seen and MAZE[next_y][next_x] == '.':
                queue.append((next_y, next_x, count+1))
                seen.add((next_y, next_x))
    return max_count


def run():
    H, W = map(int, input().split())
    MAZE = ['#' * (W+2)]
    for _ in range(H):
        s = input()
        s = '#' + s + '#'
        MAZE.append(s)
    MAZE.append('#' * (W+2))

    #for m in MAZE:
    #    print(m)

    ways = []
    for i in range(1, H+1):
        for j in range(1, W+1):
            if MAZE[i][j] == '.':
                ways.append((i, j))

    max_count = 0
    for s_i, s_j in ways:
        min_count = bfs(MAZE, (s_i, s_j))
        #print((s_i, s_j), '->', (g_i, g_j))
        #print(min_count)
        max_count = max(max_count, min_count)

    print(max_count)

if __name__ == "__main__":
    run()

Measured memory_bytes: 9472
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
signed main(){
  int N,K; cin>>N>>K;
  int ans=N-K+1;
  cout<<ans<<endl;
  }


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

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cout<<setprecision(32);

	ll n; cin>>n;
	ll ans = n - 1;
	for(ll i = 1; i*i <= n; i++){
		if(n%i == 0)ans = min(ans, i + n/i - 2);
	}
	cout<<ans<<endl;

	return 0;
}

Measured memory_bytes: 256
{-# LANGUAGE BangPatterns #-}

import Control.Monad
import Control.Monad.Trans.State
import Data.Char
import Data.List
import Data.Maybe
import Data.ByteString (ByteString)
import qualified Data.ByteString.Char8 as C8

type Pair = (Int, Int)

main :: IO ()
main = do
  [n,m] <- readInts
  ps <- sortOn fst <$> replicateM n readPair
  print $ solve m ps


solve :: Int -> [Pair] -> Int
solve m = fst . foldl' f e
  where
    e = (0,0)
    f (!s,!n) (a,b)
      | n == m    = (s,n)
      | c > m     = (s+a*(m-n),m)
      | otherwise = (s+a*b,c)
      where
        c = n+b

-- utils
readInts :: IO [Int]
readInts = map (fst . fromJust . C8.readInt) . C8.words <$> C8.getLine

readInt = C8.readInt . C8.dropWhile isSpace

readPair :: IO Pair
readPair = head . unfoldr readT <$> C8.getLine
  where
    readT = runStateT ((,) <$> StateT readInt <*> StateT readInt)

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

int main() {
  bool flag = false;
  string A,B;
  cin >> A >> B;
  for(int i=0;i<A.size();i++){
    int num=0;
    for(int j=0;j<(A.size()-1);j++){
      swap(A[0], A[A.size()-(j+1)]);
    }
    for(int j=0;j<A.size();j++){
      if(A[j]!=B[j]){
        break;
      }else{
        num++;
      }
    }
    if(num==A.size()){
      flag = true;
    }
  }
  if(flag){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll mod2 = 998244353;
const ll INF = 1e18;
const long double EPS = 1e-10;

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

  int n = s.size();
  s += 'A';
  rep(i, n - 1) {
    if (s[i] == s[i + 1]) {
      cout << i + 1 << " " << i + 2 << endl;
      return 0;
    }
    if (s[i] == s[i + 2]) {
      cout << i + 1 << " " << i + 3 << endl;
      return 0;
    }
  }
  cout << "-1 -1" << endl;




  
  return 0;
}

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

namespace GrandGarden0126
{
    class Program
    {
        static void Main(string[] args)
        {
            // 文字列の入力
            //string s = Console.ReadLine();
            // 整数の入力
            int N = int.Parse(Console.ReadLine());// N　花の数
            // スペース区切りの整数の入力
            string[] input = Console.ReadLine().Split();// 花の高さ
            int temp = 0;// 地面
            int ans = 0;
            for(int i = 0; i < N; i++)
            {
                int h = int.Parse(input[i]);
                if (h - temp > 0)// 読み取った値と前の値を比べて大きいとき、差を記録する
                {
                    ans += (h - temp);
                }
                temp = h;
            }
            //出力
            Console.WriteLine(ans);
        }
    }
}


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


int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);//读入优化 
  
  ll n;
  cin >> n;//读入 
  
  vector<ll> v(n+1), w(n+1);//把它当成普通数组就可以啦 
  
  for (int i = 1; i <= n; i++) 
     cin >> v[i] >> w[i];//读入 

  ll MAX_W = 100001LL;//所有询问的L值的最大值 
  vector<vector<ll> > dp(1LL<<10, vector<ll>(MAX_W, 0));//建立dp数组，向量套向量 

  for (ll i = 1; i < 1LL<<10; i++)//预处理出深度在(n/2)向下取整的节点的dp值(一行)，就是经典的01背包 
  {
    if (i > n) break;//如果它不是这棵树的节点，跳出 
    for (ll j = 1; j < MAX_W; j++)
	{
      dp[i][j] = dp[i/2][j];//dp[i/2][j]表示它父亲的dp值；即这个节点不选，直接继承上面的状态 
      if (j - w[i] >= 0) {//如果它是可以通过取该节点与其他一些东西所得到的 
        dp[i][j] = max(dp[i][j], dp[i/2][j-w[i]] + v[i]);
        //用dp[i/2][j-w[i]]+v[i]来更新答案
		//dp[i/2]表示其父节点的dp值。之所以不是dp[i]，是因为这不是无限背包 
      }
    }
  }
  ll query;//询问次数 
  cin >> query;//输入 
 
  for (ll q = 0; q < query; q++)//q次询问 
  {
    ll val, lim;
    cin >> val >> lim;//val:value,询问的节点编号 lim:limit,最大值，即题面中的L 
    if (val < (1LL<<10))//如果它已经被预处理过了，直接打印输出 
	{
      cout << dp[val][lim] << endl;
      continue;//别忘记continue 
    }
    
    ll ans = 0;
    int len = (int)(log2(val)) - 10 + 1;//记录下从len及它自己向上，有多少个节点没有被预处理过 
    for (int i = 0; i < (1<<len); i++)//01枚举上面未被预处理的len个节点的状态，即选或不选(与状压dp有些像) 
    { 
      ll vtemp = 0, wtemp = 0, index = val;
      //vtemp记录下当前被枚举选到的节点的value之和，wtemp同理记录下weight之和，方便转移 
      for (int j = 0; j < len; j++)
	  {
        if ((i>>j) & 1)//对于所有被选择的
		{
          vtemp += v[index];
          wtemp += w[index];
        }//求出vtemp,wtemp 
        index /= 2;//它的父亲 
        if (index < 1LL<<10)//如果index的这个节点已经被预处理过，尝试转移 
		{
          if (lim - wtemp < 0) break;//根本挤不下去，选这些都超过上限limit了，直接跳出 
          ans = max(ans, vtemp + dp[index][lim-wtemp]);
          //全篇最最核心的代码
		  //用vtemp+dp[intex][lim-wtemp]更新答案。即，vtemp表示当前的价值，还要加上之前预处理过的值，就是节点为index，上限为lim-wtemp所能得到的价值和的最大值 
          break;//转移成功，溜掉 
        }
      }
    }
    cout << ans << endl;//打印输出 
  }
  return 0; 
}
//完结撒花 

Measured memory_bytes: 811048
/* 
chirag11032000
Chirag Thakur
*/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

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

template < typename T > using OrderedSet = tree < T, null_type, less < T >, rb_tree_tag, tree_order_statistics_node_update >;
template < typename T > using MinPriorityQueue = priority_queue < T, vector < T >, greater < T > >;

#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template < typename Arg1 >
void __f(const char* name, Arg1&& arg1) {
	cerr << name << " : " << arg1 << std :: endl;
}
template < typename Arg1, typename... Args >
void __f(const char* names, Arg1&& arg1, Args&&... args) {
	const char* comma = strchr(names + 1, ',');
	cerr.write(names, comma - names) << " : " << arg1 << " | ";
	__f(comma + 1, args...);
}
#else
#define trace(...)
#endif

#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

const db PI = acos(-1);
const ll LINF = LLONG_MAX;
const int INF = INT_MAX, MOD = 1e9 + 7, N = 1e5 + 10;

void testCase();

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	testCase();
	cerr << "Time taken: " << int((clock() * 1000.) / CLOCKS_PER_SEC) << "ms\n";
	return 0;
}

void testCase() {
	int n, m;
	cin >> n >> m;
	vector < vector < int > > v(m);
	for (auto &vec: v) {
		int k;
		cin >> k;
		vec.resize(k);
		for (auto &el: vec) {
			cin >> el;
			--el;
		}
	}
	vector < int > s(m);
	for (auto &el: s) {
		cin >> el;
	}
	int conf = 0;
	for (int i = 0; i < (1 << n); ++i) {
		set < int > on;
		for (int j = 0; j < n; ++j) {
			if (i & (1 << j)) {
				on.insert(j);
			}
		}
		int ok = 0;
		for (int j = 0; j < m; ++j) {
			int cnt = 0;
			for (auto &b: v[j]) {
				cnt += on.count(b);
			}
			ok += (cnt % 2) == s[j];
		}
		conf += ok == m;
	}
	cout << conf << "\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF (INT_MAX / 4)
#define REP(i, n) for (ll i = 0, i##_len = (n); i < i##_len; ++i)
#define ALL(a) (a).begin(), (a).end()
/* clang-format off */
#define TIMER_S(start) chrono::system_clock::time_point start = chrono::system_clock::now();
#define TIMER_E(end) chrono::system_clock::time_point end = chrono::system_clock::now();
#define TIME(start, end) cout << static_cast<double>(chrono::duration_cast<chrono::microseconds>(end - start).count()) << "ms" << "\n";
/* clang-format on */

int main() {
  string o, e;
  cin >> o >> e;
  REP(i,(int)(o.size()+e.size())/2){
    cout << o.at(i) << e.at(i) ;
  }
  if ((o.size() + e.size())%2==1)cout << o.at(o.size()-1) << "\n";
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
typedef long long ll;
int main(){
  ll A,B,K,temp;
  cin>>A>>B>>K;
  if(K>0){
    temp=min(K,A);
    A-=temp;
    K-=temp;
  }
   if(K>0){
    temp=min(K,B);
     B-=temp;
     K-=temp;
   }
  cout<<A<<" "<<B;
  return 0;
}


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

int main() {
  int c, a, b;
  cin >> c >> a >> b;
  
  int x = min(a, min(b,c));
  
  int y;
  if (x == a) 
    y = min(b,c);
  else if (x == b)
    y = min(c,a);
  else 
    y = min (a,b);
  
  cout << x*y/2 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
using vecInt = vector<int>;
using vecLong = vector<long long>;
#define rep(i,l,n) for(int i=l;i<n;i++)

const ll mod = ll(1e9) + 7;
const int INF = 1<<29;
const ll lINF = 1l<<40;

int main(){
    int n,k;
    cin >> n >> k;
    vecInt a(n);
    rep(i,0,n) cin >> a[i];
    rep(i,0,n){
        if (i<k) continue;
        else{
            if (a[i]>a[i-k]) cout << "Yes" << endl;
            else cout << "No" << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 4048
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp> 
//#include <ext/pb_ds/tree_policy.hpp>
//#include <functional> // for less
//using namespace __gnu_pbds;
using namespace std;
typedef long long  L;

#define max_(x, y) (((x) > (y)) ? (x) : (y))
#define min_(x, y) (((x) < (y)) ? (x) : (y))
#define ___ ios_base::sync_with_stdio(false);cin.tie(NULL);
#define Mx 2000001
#define inf 1e15
const L MOD = 1e9+7;
const double pi = 2 * acos (0.0);

/*------------------------------Graph Moves----------------------------*/
//const int fx[]={+1,-1,+0,+0};
//const int fy[]={+0,+0,+1,-1};
//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move
//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move
//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
/*---------------------------------------------------------------------*/


//typedef tree<L,null_type,less<L>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

L a1,a2,a3,b1,b2,b3,c,c1,c2,c3,d,d1,d2,d3,d4,d5,e1,e2,e3,f,h,k,l,m,n,m1,m2,n1,n2,o,p,p1,p2,p3,p4,
q,q1,q2,q3,q4,r,s,t,u,v,x,y,z,sum,mx=-inf,mn=inf,flg,flg1,flg2,id1,id2,id3,id4,lim;

L A[Mx],D[Mx],B[Mx];

void solve(){
  sum=0;
  for(L i=1;i<=n;i++){
    B[i]=((D[i]* (D[i]-1))/2);
    sum+=B[i];
  }
  for(L i=0;i<n;i++){
    c=sum;
    if(B[A[i]]){
      c=(sum-B[A[i]]);
      d=(D[A[i]]-1);
      d=(d*(d-1))/2;
      c+=d;
    }
    printf("%lld\n",c);
  }
}
int main()
{
    scanf("%lld",&n);
    for(L i=0;i<n;i++){
      scanf("%lld",&A[i]);
      D[A[i]]++;
    }
    solve();
    return 0;
}
/// empty() lld I64d push_back() top() pop() insert() upper_bound() lower_bound() memset() max() min() scanf continue


Measured memory_bytes: 8480
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
#include <stdio.h>
#include <ctype.h>
#include <random>
#include <string.h>
using namespace std;
#define pie 3.141592653589793238462643383279
#define mod 1000000007
#define int long long
#define P pair<int,int>
#define all(vec) vec.begin(),vec.end()

int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}

int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}

int n, m;
vector<int> vec[100010];
bool bl[100010];
vector<int> ans;

signed main() {
	cin >> n >> m;
	for (int i = 0; i < m; i++) {
		int a, b; cin >> a >> b;
		vec[a].push_back(b);
		vec[b].push_back(a);
	}
	ans.push_back(1);
	int k = 1;
	bl[1] = true;
	while (1) {
		int x = k;
		for (int i = 0; i < (int)vec[k].size(); i++)if (!bl[vec[k][i]]) {
			k = vec[k][i];
			break;
		}
		if (x == k)break;
		ans.push_back(k);
		bl[k] = true;
	}
	reverse(all(ans));
	k = ans[(int)ans.size() - 1];
	while (1) {
		int x = k;
		for (int i = 0; i < (int)vec[k].size(); i++)if (!bl[vec[k][i]]) {
			k = vec[k][i];
			break;
		}
		if (x == k)break;
		ans.push_back(k);
		bl[k] = true;
	}
	cout << (int)ans.size() << endl;
	for (int i = 0; i < (int)ans.size(); i++)cout << ans[i] << " ";
	cout << endl;
}

Measured memory_bytes: 7284
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please

//なんこれ？

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}

const int dm = 1 << 21;
char dn[dm], * di = dn;

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


	int N = getint();
	int X[200000], X2[200000];
	rep(i, N) X2[i] = (X[i] = getint());

	//int L = 0;
	//int R = 1e9 + 1;
	//while (L < R) {
	//	int H = (L + R) / 2;
	//	int k = 0;
	//	rep(i, N) k += X[i] <= H;
	//	if (k < N / 2) L = H + 1;
	//	else R = H;
	//}
	//int L2 = L;
	//int R2 = 1e9 + 1;
	//while (L2 < R2) {
	//	int H = (L2 + R2) / 2;
	//	int k = 0;
	//	rep(i, N) k += X[i] <= H;
	//	if (k < N / 2 + 1) L2 = H + 1;
	//	else R2 = H;
	//}

	nth_element(X, X + N / 2, X + N);
	nth_element(X, X + N / 2 - 1, X + N / 2);
	int L = X[N / 2 - 1];
	int L2 = X[N / 2];
	int K = L;
	int keta1 = 0, keta2 = 0;
	char C1[10], C2[10];
	while (L) {
		*(C1 + keta1) = '0' + L % 10;
		L /= 10;
		keta1++;
	}
	while (L2) {
		*(C2 + keta2) = '0' + L2 % 10;
		L2 /= 10;
		keta2++;
	}

	rep(i, N) {
		if (X2[i] > K) {
			for (int i = keta1 - 1; i >= 0; i--)* di++ = (*(C1 + i));
			*di++ = '\n';
		}
		else {
			for (int i = keta2 - 1; i >= 0; i--)* di++ = (*(C2 + i));
			*di++ = '\n';
		}
	}

	fwrite_unlocked(dn, di - dn, 1, stdout);

	Would you please return 0;
}

Measured memory_bytes: 5888
#include<bits/stdc++.h>
#define REP(i,n) for(int (i)=0 ;(i)<(n);(i)++)
#define REPR(i,n) for(int (i)=(n);(i)>=0;(i)--)
#define FOR(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define ALL(x) x.begin(),x.end()
#define REVERSE(x) reverse(x.begin(),x.end())
#define SORT(x,n) sort(x,x)
#define P pair<int,int>
typedef long long LL;
const int INF=1000000007;
using namespace std;
int gcd(int a,int b){
  if(a%b==0){return b;}
  else{return gcd(b,a%b);}
}

int main(){
  double W,H,x,y;
  cin>>W>>H>>x>>y;
  if(2*x==W&&2*y==H){
    cout<<H*W/2<<" "<<'1';
  }
  else{
     cout<<H*W/2<<" "<<'0';
  }
}


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

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

  rep(i, S.size()) {
    S[i] += N;
    if (S[i] > 'Z') S[i] -= 26;
  }

  cout << S << endl;
}

Measured memory_bytes: 256
import functools

import os
import sys

sys.setrecursionlimit(10000)
INF = float('inf')


def inp():
    return int(input())


def inpf():
    return float(input())


def inps():
    return input()


def inl():
    return list(map(int, input().split()))


def inlf():
    return list(map(float, input().split()))


def inls():
    return input().split()


def inpm(line):
    return [inp() for _ in range(line)]


def inpfm(line):
    return [inpf() for _ in range(line)]


def inpsm(line):
    return [inps() for _ in range(line)]


def inlm(line):
    return [inl() for _ in range(line)]


def inlfm(line):
    return [inlf() for _ in range(line)]


def inlsm(line):
    return [inls() for _ in range(line)]


def Yesif(cond):
    print('Yes' if cond else 'No')


def YESIF(cond):
    print('YES' if cond else 'NO')


def yesif(cond):
    print('yes' if cond else 'no')



print('vowel' if input() in 'aiueo' else 'consonant')


Measured memory_bytes: 3684
#include <stdio.h>
#include <string.h>

int c2i(char c){
    if(c=='A')return 1;
    else if(c=='C')return 2;
    else if(c=='G')return 3;
    else if(c=='T')return 4;
    return 0;
}

int makekey(char str[]){
    long sum=0,p=1,i;
    for(i=0;i<strlen(str);i++){
        sum+=p*c2i(str[i]);
        p*=5;
    }
    return sum;
}

int h1(int key){
    return key%1000000;
}
int h2(int key){
    return 1+(key%(1000000-1));
}

int find(char str[7],char hash[1000000][13]){
    long key,i,h;
    key = makekey(str);
    for(i=0;;i++){
        h=(h1(key)+i*h2(key))%1000000;
        if(strcmp(hash[h],str)==0){return 1;}
        else if(strlen(hash[h])==0){return 0;}
    }
}

void insert(char str[7],char hash[1000000][13]){
    long key,i,h;
    key = makekey(str);
    for(i=0;;i++){
        h=(h1(key)+i*h2(key))%1000000;
        if(strcmp(hash[h],str)==0){return;}
        else if(strlen(hash[h])==0){
            strcpy(hash[h],str);
            return;
        }
    }
}

int main(void){
    int n,i;
    char s[7],moji[13];
    char hash[1000000][13];
    for(i=0;i<1000000;i++){
        hash[i][0]='\0';
    }
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%s %s",s,moji);
        if(s[0]=='i'){
            insert(moji,hash);
        }else{
            if(find(moji,hash)==1){
                printf("yes\n");
            }else{
                printf("no\n");
            }
        }
    }
}




Measured memory_bytes: 14424
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
mod = 10 ** 9 + 7
inf = float('inf')
ninf = -float('inf')
 
#整数input
def ii(): return int(sys.stdin.readline().rstrip()) #int(input())
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) #list(map(int,input().split()))
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]
#文字列input
def ss(): return sys.stdin.readline().rstrip() #input()
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) #list(input().split())
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]

#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？

sx,sy,tx,ty = mii()

route=[]

route.extend(["U"]*(ty-sy))
route.extend(["R"]*(tx-sx))
route.extend(["D"]*(ty-sy))
route.extend(["L"]*(tx-sx))

route.extend(["L"])
route.extend(["U"]*(ty-sy+1))
route.extend(["R"]*(tx-sx+1))
route.extend(["D"])
route.extend(["R"])
route.extend(["D"]*(ty-sy+1))
route.extend(["L"]*(tx-sx+1))
route.extend(["U"])
print("".join(route))

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

int main()
{
	int A, B, C, D, area1,area2;
	cin >> A >> B >> C >> D;   
	area1 = A * B;
	area2 = C * D;
	if (area1 >= area2)
		cout << area1;
	else
		cout << area2;
	


}

Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
  int list[4] = {0};
  int A, B, i;
  scanf("%d", &A);
  scanf("%d", &B);
  
  list[A-1] = 1;
  list[B-1] = 1;
  
  for(i=0;i<3;i++){
    if(list[i] == 0) {
      printf("%d", i + 1);
    }
  }
  
  return 0;
}

Measured memory_bytes: 128
#include<stdio.h>

int sum(int n);

int main(){
  int sp=sum(5);

  printf("%d\n",sp/5);

  return 0;
}

int sum(int n){
  int i;
  int a;
  int tmp=0;

  for(i=0;i<n;i++){
    scanf("%d",&a);
    if(a<40){
      tmp=40+tmp;
    }
    else{
      tmp=a+tmp;
    }
  }

  return tmp;
}

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

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

#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 main()
{
    int x,ans=1;
    cin>>x;
    
    for(int i = 2; i*i <= x; i++)
    {
        int tmp = 1;
        for(int j = 2; j < x; j++)
        {
            tmp*=i;
            if(tmp>x)break;
            ans=max(ans,tmp);
        }
        
    }
    cout <<ans<<endl;

    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast,inline,unroll-loops,fast-math")
#pragma GCC optimize("O3")
#include<bits/stdc++.h>
#define mod 1000000007
#define mod1 998244353
#define INF LLONG_MAX
#define NINF LLONG_MIN
#define inf 1e18
#define all(v) v.begin(),v.end()
#define T ll test;cin>>test; while(test--)
#define rep(i,a,n) for(ll i=a;i<(long long)n;++i)
#define rep1(i,a,n) for(ll i=a;i<=(long long)n;++i)
#define rep2(i,n,a) for(ll i=n;i>(long long)a;--i)
#define rep3(i,n,a) for(ll i=n;i>=(long long)a;--i)
#define repi(i,a,n) for(int i=a;i<=(int)n;++i)
#define repl(i,a,n) for(int i=a;i<(int)n;++i)
#define PI 3.141592653589793238510
#define en '\n'
#define MAX 100005
#define less_time ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define debug cout<<"HERE"<<en;
#define setbits(x)  __builtin_popcountll(x)
#define zrobits(x)  __builtin_ctzll(x)
#define ps(x,y) fixed<<setprecision(y)<<x
#define mk(arr,n,type) type *arr=new type[n];
#define F first
#define S second
#define LB lower_bound
#define UB upper_bound
#define vc vector
#define vi vc<int>
#define mii unordered_map<int,int>
#define pql priority_queue<int>
#define pqs priority_queue<int,vi,greater<int>>
#define vll vector<long long>
#define pll pair<long long,long long>
#define pl pair<int,int>
#define eb emplace_back
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef long double ld;
using namespace std;
using namespace std::chrono;
int main(){
    less_time;
    ll n,W;
    cin>>n>>W;
    ll wt[105]={0};
    ll v[105]={0};
    repi(i,1,n)
    cin>>wt[i]>>v[i];
    ll dp[n+5][W+5];
    memset(dp,0,sizeof dp);
    repi(i,1,n)
    {
      repi(w,1,W)
      {
        if(wt[i]<=w)
         dp[i][w]=max(v[i]+dp[i-1][w-wt[i]],dp[i-1][w]);
        else
         dp[i][w]=dp[i-1][w];
      }
    }
    cout<<dp[n][W];
return 0;
}


Measured memory_bytes: 82304