akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<cstring>
#include<iostream>
#include<cmath>
#include<cstdlib>
#include<queue>
using namespace std;
int jx[] = {-1,0,1,-2,2,-2,2,-2,2,-1,0,1},jy[] = {-2,-2,-2,-1,-1,0,0,1,1,2,2,2};
int field[16][16] = {{}};
struct data{
	int x,y,cnt;
};
bool check(int x,int y,int cnt){
	for(int i = 0; i < 9; i++){
		for(int j = 0; j < 9; j++){
			if(field[i][j] == cnt)return true;
		}
	}
	return false;
}
int main(){
	int n;
	int sx,sy;
	while(cin >> sx >> sy){
		if(sx == 0 && sy == 0) break;
		cin >> n;
		int x[16] = {},y[16] = {};
		memset(field,0,sizeof(field));
		for(int i = 1; i <= n; i++){
			cin >> x[i] >> y[i];
			field[y[i]][x[i]] = i;
		}
		bool flg = false;
		queue<data> Q;
		data s = {sx,sy,0};
		Q.push(s);
		while(!Q.empty()){
			data d = Q.front();Q.pop();
			if(d.cnt == n && check(d.x,d.y,d.cnt)){
				flg = true;
				break;
			}
			for(int i = 0; i < 12; i++){
				int nx = d.x + jx[i], ny = d.y + jy[i],nc = d.cnt+1;
				if(nx < 0 || ny < 0 || nx >= 10 || ny >= 10) continue;
				if(abs(x[nc]-nx) <= 1 && abs(y[nc]-ny) <= 1){
					data n = {nx,ny,nc};
					Q.push(n);
				}
			}
		}
		cout << (flg?"OK":"NA") << endl;
	}
	return 0;
}

Measured memory_bytes: 1212
#include<stdio.h>
#include<iostream>
#include<stdlib.h>
#include<math.h>
#include<stdbool.h>
#include<vector>
#include<algorithm>
#include<string>
typedef long long ll;
using namespace std;

ll ten(ll a) {
	ll b = 1;
	while (a >= 10) {
		b++;
		a = (a - a % 10) / 10;
	}
	return b;
}

int main(void) {
	ll n, mi = 10000, ans = 0;
	cin >> n;
	for (ll i = 1;i <= sqrt(n);i++) {
		if (n%i == 0) {
			ll a = i;
			ll b = n / i;
			ans = max(ten(a), ten(b));
			mi = min(mi, ans);
		}
	}
	cout << mi << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
Scanner scan=new Scanner(System.in);
int a=scan.nextInt();
int b=scan.nextInt();
if(a==b) {System.out.println("Draw");}
else if(a==1) {System.out.println("Alice");}
else if(b==1){System.out.println("Bob");}
else if(a>b){System.out.println("Alice");}
else {System.out.println("Bob");}
}
}


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

int main() {
    ll k, n;
    cin >> k >> n;
    vector<ll> a(n), d(n);
    rep(i, n) cin >> a[i];
    for(int i = 1; i < n; i++) {
        d[i - 1] = a[i] - a[i - 1];
        // cout << d[i] << endl;
    }
    d[n - 1] = k - a[n - 1] + a[0];
    // rep(i, n) cout << d[i];
    cout << k - *max_element(d.begin(), d.end()) << endl;
    return 0;
}

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

class Program {
    static void Main(string[] args) {
        //入力
        string s = Console.ReadLine();
        int K = int.Parse(s.Split(' ')[0]);
        int X = int.Parse(s.Split(' ')[1]);

        //検証
        int start = 0;
        int goal = 0;

        if (X - K + 1 < -1000000) {
            start = -1000000;
        } else {
            start = X - K + 1;
        }

        if (X + K - 1 > 1000000) {
            goal = 1000000;
        } else {
            goal = X + K - 1;
        }

        var ans = new List<int>();


        for (int i = start; i <= goal; i++) {
            ans.Add(i);
        }

        //出力
        Console.WriteLine(string.Join(" ", ans));
    }
}

Measured memory_bytes: 13268
#include <iostream>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <math.h>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <climits>
#include <bitset>
#include <list>
#include <map>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

int main(){
    int n;
    cin >> n;
    ll a[n];
    for(int i=0; i<n; i++) cin >> a[i];
    sort(a, a+n);
    ll ans=0;
    for(int i=0; i+1<n; i+=2){
        ans+=abs(a[i]+a[i+1]);
    }
    if(n%2==1) ans+=a[n-1];
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
L,R = [int(x) for x in input().split()]
 
min_ans = 10**18

if R-L>=2019:
  min_ans=0
else:
  for i in range(L,R):
      for j in range(i+1,R+1):
          ans = (i*j)%2019

          if ans < min_ans:
              min_ans = ans
          if min_ans == 0:
              break
print(min_ans)


Measured memory_bytes: 2940
sx, sy, tx, ty = map(int, input().split())
ans = 'R'*(tx-sx)+'U'*(ty-sy)+'L'*(tx-sx)+'D'*(ty-sy)
ans += 'D'+'R'*(tx-sx+1)+'U'*(ty-sy+1)+'LU'+'L'*(tx-sx+1)+'D'*(ty-sy+1)+'R'
print(ans)

Measured memory_bytes: 9180
import copy

N, M = list(map(int, input().split()))
route = [[0 for i in range(N)] for l in range(N)]
count = 0
for i in range(M):
    a, b = list(map(int, input().split()))
    route[a-1][b-1] = 1
    route[b-1][a-1] = 1

queue = [[[0],i] for  i in range(N) if route[0][i]]

while len(queue):
    r = queue.pop(0)
    n = r[1]
    r[0].append(n)
    if len(r[0]) == N:
        count += 1
    else:
        for i in range(1, N):
            if route[n][i] and i not in r[0]:
                x = copy.deepcopy(r[0])
                queue.append([x, i])

print(count)


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

int main()
{
  int H, W;

  while (true) {
    cin >> H >> W;

    if (H == 0 && W == 0) {
      break;
    }
    for (int i = 0; i < H; i ++) {
      for (int j = 0; j < W; j ++) {
        // 偶数行のとき
        if (i % 2 == 0) {
          if (j % 2 == 0) {
            cout << "#";
          } else {
            cout << ".";
          }
        } else if(i % 2 == 1) {
          if (j % 2 == 0) {
            cout << ".";
          } else {
            cout << "#";
          }
        }
      }
      cout << endl;
    }
    cout << endl;
  }
  return 0;
}


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

int main() {
  int N;
  cin >> N;
  
  int ac = 0;
  int wa = 0;
  int tle = 0;
  int re = 0;
  string S;
  
  for (int i = 0; i < N; i++) {
    cin >> S;
    
    if (S == "AC") {
      ac++;
    }
    else if (S == "WA") {
      wa++;
    }
    else if (S == "TLE") {
      tle++;
    }
    else {
      re++;
    }
  }
  
  cout << "AC x " << ac << endl;
  cout << "WA x " << wa << endl;
  cout << "TLE x " << tle << endl;
  cout << "RE x " << re << endl;
}


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

using LLI = long long int;

int N;
LLI as[334514];

int main() {
  scanf("%d", &N);
  for (int i=0; i<N*3; i++) scanf("%lld", &as[i]);
  sort(as, as+N*3);
  int idx = 3*N-2;
  LLI ans = 0;
  for (int i=0; i<N; i++) {
    ans += as[idx];
    idx -= 2;
  }
  printf("%lld\n", ans);
}


Measured memory_bytes: 2560
from bisect import bisect_right

N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

Sa = [0]*(N+1)
for i in range(1, N+1):
    Sa[i] = Sa[i-1] + A[i-1]

Sb = [0]*(M+1)
for i in range(1, M+1):
    Sb[i] = Sb[i-1] + B[i-1]

ans = 0
for i in range(N+1):
    r = K - Sa[i]
    if r < 0:
        break
    j = bisect_right(Sb, r) - 1
    ans = max(ans, i + j)

print(ans)

Measured memory_bytes: 47384
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main(){
	int n;
	double h,w,x;
	string s;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>s;
		h=10*(s[0]-'0')+s[1]-'0';
		w=10*(s[3]-'0')+s[4]-'0';
		h*=30,h+=0.5*w,w*=6;
		if(h>w)x=h-w;
		else x=w-h;
		if(x>180)x=360-x;
		if(x>=90)cout<<"safe"<<endl;
		if(x<30)cout<<"alert"<<endl;
		if(x>=30&&x<90)cout<<"warning"<<endl;
	}
	return 0;
}

Measured memory_bytes: 3180
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
KO = 0

for i in range(N):
  if  A[i] + A[i+1] > B[i]:
    KO += B[i]
    if A[i] < B[i]:
      A[i+1] -= (B[i] - A[i])
  else:
    KO += A[i] + A[i+1]
    A[i+1] = 0
  
print(KO)

      


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

int main(){
    int N;
    cin >> N;
    ll a[3 * N];

    for(int i = 0; i < 3 * N; ++i) cin >> a[i];
    sort(a, a + 3 * N, greater<int>());

    ll res = 0;
    for(int i = 1; i < 2 * N; i += 2) res += a[i];

    cout << res << endl;
}

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

int main(){
  string s; cin>>s;
  int lm=0;
  
  for(int i=0;i<s.length();i++){
    if(s[i]=='A' || s[i]=='C' || s[i]=='T' || s[i]=='G'){
      if(s.length()==1){cout<<1<<endl; return 0;}
      else{
        for(int j=i;j<s.length();j++){
          if(s[j]!='A' && s[j]!='C' && s[j]!='T' && s[j]!='G'){
            lm = max(lm,j-i);
            break;
          }
          else if(j==s.length()-1) lm=max(lm,j-i+1);
        }
      }
    }
  }
  
  cout<<lm<<endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  vector<int> v(3);
  for(int i=0;i<3;i++){
    cin >> v.at(i);
  }
  sort(v.begin(),v.end());
  cout << v.at(2)*10+v.at(1)+v.at(0);
}
  

Measured memory_bytes: 3632
def main():
    N = int(input())
    v = sorted(list(map(int, input().split())))
    while len(v) > 1:
        x = v.pop(0)
        y = v.pop(0)
        v.append((x+y)/2)
        v = sorted(v)
    print(v[0])


if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <cassert>

using namespace std;
typedef long long LL;
template <typename F, typename S> std::ostream& operator<<(ostream& os, const pair<F,S>& p) {
    os << "(" << p.first << "," << p.second << ")"; return os; }
template <typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
    os << "["; for(const T& a: v){ os << a << ", "; } os << "]"; return os; }
template <typename K, typename V> ostream& operator<<(ostream& os, const map<K,V>& m) {
    os << "{"; for(const auto& p: m){ os << p.first <<":"<< p.second << ", "; } os << "]"; return os; }


LL getNeedShift(LL v1, LL v2){
    LL cnt = 0;
    if(v1 <= v2){
        while(v1 * 4 <= v2){
            v1 <<= 2;
            cnt--;
        }
    }else{
        while(v2 < v1){
            v2 <<= 2;
            cnt++;
        }
    }
    return cnt;
}

vector<vector<LL>> calcOpCnt(vector<LL>& a){
    const LL LIM = 16;
    LL n = a.size();
    vector<vector<LL>> res(n, vector<LL>(LIM));
    for(LL j = 0; j < LIM; ++j){
        res[n-1][j] = j;
    }

    for(LL i = n-2; i >= 0; --i){
        LL s = getNeedShift(a[i], a[i+1]);
        for(LL j = 0; j < LIM; ++j){
            if(j + s >= LIM){
                res[i][j] = res[i+1][LIM-1] + (j + s - (LIM-1)) * (n-1 - i) + j;
            }else{
                res[i][j] = res[i+1][max<LL>(0, j + s)] + j;
            }
        }
    }
    return res;
}

int main(){
    LL n;
    cin >> n;
    vector<LL> a(n);
    for(LL i = 0; i < n; ++i){
        cin >> a[i];
    }
    vector<LL> b(a.begin(), a.end());
    reverse(b.begin(), b.end());

    vector<vector<LL>> right = calcOpCnt(a);
    vector<vector<LL>> left = calcOpCnt(b);
    reverse(left.begin(), left.end());
    LL ans = right[0][0]*2;
    for(LL i = 1; i < n; ++i){
        LL cand = right[i][0]*2 + left[i-1][0]*2 + i;
        //cerr << i << " : " << right2[i] << " " << left2[i] << " " << cand << endl;
        ans = min(ans, cand);
    }
    //cerr << right2 << endl;
    //cerr << left2 << endl;
    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 68992
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby, combinations_with_replacement
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
import numpy as np
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
A = [round(float(input())*(10**9)) for _ in range(N)]
fac = [[0, 0] for _ in range(N)]

for i, x in enumerate(A):
    while x%2 == 0:
        x //= 2
        fac[i][0] += 1
    while x%5 == 0:
        x //= 5
        fac[i][1] += 1

acc = [[0]*51 for _ in range(51)]

for l in fac:
    n2, n5 = l
    acc[n2+1][n5+1] += 1

acc = np.array(acc, dtype=np.int64)
acc = acc.cumsum(0).cumsum(1).tolist()

ans = 0

for l in fac:
    n2, n5 = l
    n2l = max(0, 18-n2)
    n5l = max(0, 18-n5)
    ans += acc[50][50] - acc[n2l][50] - acc[50][n5l] + acc[n2l][n5l]
    if n2 >= 9 and n5 >= 9:
        ans -= 1

print(ans//2)


Measured memory_bytes: 52652
import java.util.*;

class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()){
			int n= sc.nextInt();
			int o= sc.nextInt();
			int wa = n+o;
			System.out.println(sum(wa));
			}
		sc.close();



	}
	static int sum(int n){
		int i=1;
		int t=10;
		while(n>=t){
			t=t*10;
			i++;
			}
		return i;
	}
}

Measured memory_bytes: 12000
n = int(input())
gu = [1]
ki = [0]
for i in range(0, 20):
  gu.append(gu[-1] + (-2)**(2 + 2*i))
  ki.append(ki[-1] + (-2)**(1 + 2*i))
ans = []
for i in range(20):
  if gu[-2-i] < n <= gu[-1-i]:
    ans.append('1')
    n-= (gu[-1-i]-gu[-2-i])
  else:
    ans.append('0')
  if ki[-1-i] <= n < ki[-2-i]:
    ans.append('1')
    n -= (ki[-1-i]-ki[-2-i])
  else:
    ans.append('0')
ans.append(str(n))
print(str(int(''.join(ans))))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
vector <string> str;
vector <int> score;
int D,x,ans;
void saiki(int ima,int sum,int d){
  if(ima==str.size()) ans=max(sum,ans);
  if(ima==str.size()) return ;
  saiki(ima+1,sum,d);
  if(d+str[ima].size()>D) return;
  saiki(ima+1,sum+score[ima],d+str[ima].size());
}


int main(){
  cin>>D;
  string s;
  cin>>x;
  for(int i=0,a;i<x;i++)cin>>s>>a,str.push_back(s),score.push_back(a);
  cin>>x;
  for(int i=0,a;i<x;i++)cin>>s>>a,str.push_back(s),score.push_back(a);

  for(int i=0;i<str.size();i++){
    int f=0;
    for(int j=0;j<str[i].size();j++)if(str[i][j]!='D') f=1;
    if(f) str.erase(str.begin()+i),score.erase(score.begin()+i),i--;
  }
  saiki(0,0,0);
  cout <<ans<<endl;
  return 0;
}

Measured memory_bytes: 1236
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <cstdio>
using namespace std;
#define rep(i,n) for (int i=0 ; i<(n);i++)

int main() {
	string a, b, c;
	cin >> a >> b >> c;

	cout << "A" << (char)(b[0]) << "C" <<endl;

}

Measured memory_bytes: 764
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int main() {
  int N;
  scanf("%d",&N);
  if (N%2) {
    printf("%f\n",(float)(N/2+1)/N);
  }
  else
  printf("%f",0.5);
  return 0;
}



Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef pair<ll, ll> pll;
#define all(c) begin(c), end(c)
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define rep(i, n) for (ll i = 0; i < ll(n); i++)

const ll mod = 1000000007;
struct mint {
    ll x;  // typedef long long ll;
    mint(ll x = 0) : x((x % mod + mod) % mod) {}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) {
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint a) const {
        mint res(*this);
        return res += a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res -= a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res *= a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }

    mint inv() const {
        return pow(mod - 2);
    }
    mint& operator/=(const mint a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint a) const {
        mint res(*this);
        return res /= a;
    }
};

struct combination {
    vector<mint> fact, ifact;
    // init struct with "n" of "nCk" (maximum number in other words)
    combination(int n) : fact(n + 1), ifact(n + 1) {
        assert(n < mod);
        fact[0] = 1;
        for (int i = 1; i <= n; ++i) fact[i] = fact[i - 1] * i;
        ifact[n] = fact[n].inv();
        for (int i = n; i >= 1; --i) ifact[i - 1] = ifact[i] * i;
    }
    // c(n,k) returns mint that contains nCk (mod p (= 1e9+7)) in x
    // i.e.) mint num = c(n,k), then num.x == nCk (mod p (= 1e9+7))
    mint operator()(int n, int k) {
        if (k < 0 || k > n) return 0;
        return fact[n] * ifact[k] * ifact[n - k];
    }

    // nPk - permutation
    mint p(int n, int k) {
        return fact[n] * ifact[n - k];
    }
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n, m;
    cin >> n >> m;
    combination nck(1000500);
    mint ans = 0;
    for (ll k = 0; k <= n; k++) {
        mint val = nck(n, k);
        // mPn
        val *= nck.p(m, n);
        // {m-k}P{n-k}
        val *= nck.p(m - k, n - k);
        if (k & 1) {
            ans -= val;
            continue;
        }
        ans += val;
    }
    cout << ans.x << endl;
}

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

int main()
{
	int64_t n, q;
	cin >> n >> q;
	vector<int64_t> as(n);
	for (auto &&a : as)
	{
		cin >> a;
	}
	vector<int64_t> ts(q), xs(q), ys(q);
	for (int64_t i = 0; i < q; i++)
	{
		cin >> ts[i] >> xs[i] >> ys[i];
	}

	fenwick_tree<int64_t> fw(n);
	for (int64_t i = 0; i < n; i++)
	{
		fw.add(i, as[i]);
	}

	for (int64_t i = 0; i < q; i++)
	{
		if (ts[i] == 1)
		{
			cout << fw.sum(xs[i], ys[i]) << endl;
		}
		else
		{
			fw.add(xs[i], ys[i]);
		}
	}

	return 0;
}

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

int main(){
  long long n,a,b;
  cin >> n >> a >> b;
  
  long long c=a+b;
  long long ans = a*(n/c);
  ans += min(n%c,a);//n%c<aのときn%c、n%c=>aのときaというif文を書いても良いけどminで書くとシンプル
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
int main() {
int n;
cin >> n;
vector<string> s(n);
for (int i = 0; i < n; ++i) cin >> s[i];
auto abs = find(s.begin(), s.end(), "Y");
if (abs != s.end()) cout << "Four";
else cout << "Three";
}

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

int main() {
  std::vector<int> C_i_row(3, 0);
  std::vector<std::vector<int>> C_num_vec(3, C_i_row);
  int answer = 0;
  for (int i = 0; i < C_num_vec.size(); i++) {
    for (int j = 0; j < C_num_vec[i].size(); j++) {
      int a = 0;
      std::cin >> a;
      C_num_vec[i][j] = a;
    }
  }

  //std::cout << C_num_vec[1][0] << std::endl;
  for (int a_1 = 0; a_1 <= 100; a_1++) {
    for (int b_1 = 0; b_1 <= 100; b_1++) {
      if (C_num_vec[0][0] == a_1 + b_1) {
        for (int a_2 = 0; a_2 <= 100; a_2++) {
          if (C_num_vec[1][0] == a_2 + b_1) {
            for (int a_3 = 0; a_3 <= 100; a_3++) {
              if (C_num_vec[2][0] == a_3 + b_1) {
                for (int b_2 = 0; b_2 <= 100; b_2++) {
                  if (C_num_vec[0][1] == a_1 + b_2 &&
                      C_num_vec[1][1] == a_2 + b_2 &&
                      C_num_vec[2][1] == a_3 + b_2) {
                    for (int b_3 = 0; b_3 <= 100; b_3++) {
                      if (C_num_vec[0][2] == a_1 + b_3 &&
                          C_num_vec[1][2] == a_2 + b_3 &&
                          C_num_vec[2][2] == a_3 + b_3)

                      {
                        std::cout << "Yes" << std::endl;
                        return 0;
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
  std::cout << "No" << std::endl;
  return 0;
}


Measured memory_bytes: 256
# A and T , C and G

b = input()

if b == "A":
    print("T")
elif b == "T":
    print("A")
elif b == "C":
    print("G")
elif b == "G":
    print("C")
    
# 大文字で入力ならこれでよいけど、小文字だったらどうするのかなあ

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

#include <vector>
using namespace std;


struct Node {
    int key;
    Node *parent;		// ???
    Node *left;			// ?????????
    Node *right;		// ?????????
};

Node *root, *NIL;

void insert( int k );

bool find( Node *node, int k );

void PreOrder( Node *node );

void InOrder( Node *node );

void freeTree( Node *node );

int main()
{
    int n;

    scanf("%d", &n);
    
    for ( int i = 0; i < n; i++ ) {
	char str[100];
	scanf("%s", str);
	if ( !strcmp( str, "insert" ) ) {
	    int d;
	    scanf("%d", &d);
	    insert( d );
	}
	else if ( !strcmp( str, "find" ) ) {
	    int d;
	    scanf("%d", &d);
	    if ( find( root, d ) ) {
		printf("yes\n");
	    }
	    else {
		printf("no\n");
	    }
	}
	else if ( !strcmp( str, "print" ) ) {
	    InOrder( root );
	    printf("\n");

	    PreOrder( root );
	    printf("\n");
	}
    }

    freeTree( root );

    return 0;
}




void insert( int k )
{
    Node *p_y = NIL;		// ?????¨??????????????????????£?????¨??????????
    Node *p_x = root;
    
    Node *p_z = (Node *)malloc( sizeof( Node ) );
    p_z->parent = NIL;
    p_z->left   = NIL;
    p_z->right  = NIL;
    p_z->key    = k;

    while ( p_x != NULL ) {
	p_y = p_x;
	if ( k < p_x->key ) { // ???
	    p_x = p_x->left;
	}
	else {
	    p_x = p_x->right;
	}
    }

    p_z->parent = p_y;

    if ( p_y == NULL ) {
	root = p_z;
    }
    else if ( p_z->key < p_y->key ) {
	p_y->left = p_z;
    }
    else {
	p_y->right = p_z;
    }
}


bool find( Node *node, int k )
{
    if ( node == NULL ) {
	return false;
    } 
    else {
	if ( k == node->key ) {
	    return true;
	}
	else if ( k < node->key ) {
	    return find( node->left, k );
	}
	else if ( k > node->key ) {
	    return find( node->right, k );
	}
    }
}

void PreOrder( Node *node )
{
    if ( node != NULL ) {
	printf(" %d", node->key);
	PreOrder( node->left );
	PreOrder( node->right );
    }
}


void InOrder( Node *node )
{
    if ( node != NULL ) {
	InOrder( node->left );
	printf(" %d", node->key);
	InOrder( node->right );
    }
}

void freeTree( Node *node )
{
    if ( node != NULL ) {
	freeTree( node->left );
	freeTree( node->right );
	free( node );
    }
}

Measured memory_bytes: 19792
#include<bits/stdc++.h>
#define ll long long int
#define endl '\n'
#define M 1000000007
#define yes cout<<"YES\n"
#define no cout<<"NO\n"
#define f first
#define s second
#define b begin
#define e end
#define pb push_back
#define mp make_pair
#define FOR(i,a,b) for(i=a;i<b;i++)
#define RFOR(i,a,b) for(i=a;i>=b;i--)
#define all(x) x.begin(),x.end()
#define itfr(it,x) for(it=x.begin();it!=x.end();it++)
#define flash ios_base::sync_with_stdio(false); cin.tie(NULL)
using namespace std;

int main()
{
    flash;
    //sieve();
    ll T=1,n,m,k,x,y,z;
    // cin>>T;
    while(T--)
    {
        string a,b,c;
        cin>>a>>b>>c;
        n = a.length();
        m = b.length();
        k = c.length();
        x = 0; y = 0; z = 0;
        char cur = 'a';
        while(x<=n&&y<=m&&z<=k)
        {
            if(cur=='a')
            {
                cur = a[x];
                x++;
            }
            else if(cur=='b')
            {
                cur = b[y];
                y++;
            }
            else
            {
                cur = c[z];
                z++;
            }
        }
        if(x>n)
            cout<<'A';
        else if(y>m)
            cout<<'B';
        else
            cout<<'C';
        cout<<endl;
    }
}


Measured memory_bytes: 3632
#include <cstdio>
#include <vector>
#include <algorithm>
#include <queue>

#define X first
#define Y second
#define PB push_back

using namespace std;

const int N = 1e5 + 500;
const int K = 30;

vector < int > v[N];

int obr[N], doc[N][K], par[N], ja[N], sol, n, deg[N];
queue < int > Q;

void ide(int x){
	for(int y : v[x]){
		if(!obr[y]){
			par[x] = y;
			v[x].erase(find(v[x].begin(), v[x].end(), y));
			break;
		}
	}
	for(int y : v[x]){
		for(int k = 0;k < K;k++)
			doc[x][k] += doc[y][k];
	}
	int mini = K - 1;
	for(;mini >= 0 && doc[x][mini] < 2;mini--);
	ja[x] = mini + 1;
	for(;doc[x][ja[x]];ja[x]++);
	for(int k = 0;k <= ja[x];k++)
		doc[x][k] = 0;
	//printf("x = %d ja = %d par = %d\n", x, ja[x], par[x]);
	doc[x][ja[x]] = 1; obr[x] = 1;
	sol = max(sol, ja[x]);
}

int main(){
	scanf("%d", &n);
	for(int i = 1;i < n;i++){
		int x, y; scanf("%d%d", &x, &y);
		v[x].PB(y); v[y].PB(x);
		deg[x]++, deg[y]++;
	}
	for(int i = 1;i <= n;i++){
		if(deg[i] == 1)
			Q.push(i);
	}
	for(int i = 1;i <= n;i++){
		int gas = Q.front(); Q.pop();
		ide(gas); deg[par[gas]]--;
		if(deg[par[gas]] <= 1)
			Q.push(par[gas]);
	}
	printf("%d\n", sol);
	return 0;
}

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

const int MOD = 1000000007;

template<typename T>
T gcd(T a, T b) { return b ? gcd(b, a%b) : a; }
template<typename T>
T lcm(T a, T b) { return a / gcd(a, b) * b; }

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

    int c = 0;

    for (int i = 1; i <= N; i++) {
        string j = to_string(i);
        if (j.size() % 2 == 1) c++;
    }

    cout << c << endl;
    return 0;
}


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

using namespace std;
using ll = long long;

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

    int n, ans = 0;
    ll d, x, y;
    cin >> n >> d;
    for(int i = 0; i < n; ++i) {
        cin >> x >> y;
        if(x * x + y * y <= d * d) ans++;
    }

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

    return 0;
}

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

int main(){
  int n; cin >> n;
  vector<int> a(n),b(n),c(n);
  for(auto&&e : a)cin >> e;
  for(auto&&e : b)cin >> e;
  for(auto&&e : c)cin >> e;

  sort(a.begin(),a.end());
  sort(c.begin(),c.end());

  long long sum = 0;

  for(auto&&e : b){
    long long sum_a = 0, sum_b = 0;
    sum_a = lower_bound(a.begin(), a.end(), e) - a.begin();
    sum_b = c.end() - upper_bound(c.begin(), c.end(), e);
    sum += sum_a * sum_b;
  }

  cout << sum << endl;
}


Measured memory_bytes: 1408
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

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

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;

template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);    
    
    int N; cin >> N;
    int dp[N+1][64];
    F0R(i, N+1) {
		F0R(j, 64) {
			dp[i][j] = 0;
		}
	}
	// 
	dp[0][0] = 1;
	
	F0R(i, N) {
		F0R(j, 64) {
			F0R(d, 4) {
				int a = j / 16;
				int b = (j / 4) % 4;
				int c = j % 4;
				if (b == 1 && c == 2 && d == 3) continue;
				if (a == 1 && c == 2 && d == 3) continue; //case 1: preexisting
				
				if (a == 1 && b == 2 && d == 3) continue;
				if (a == 1 && c == 2 && d == 3) continue; //case 4: exists but you need to swap first
				
				if (a == 1 && b == 3 && c == 2) continue;
				if (a == 2 && b == 1 && c == 3) continue; //case 2: swap early
				
				if (b == 1 && c == 3 && d == 2) continue;
				if (b == 2 && c == 1 && d == 3) continue; //case 3: swap late
				dp[i+1][b*16+c*4+d] += dp[i][j];
				dp[i+1][b*16+c*4+d] %= MOD;
			}
		}
	}
	
	int ans = 0;
	F0R(j, 64) {
		ans += dp[N][j];
		ans %= MOD;
	}
	cout << ans << endl;
    return 0;
}

// read the question correctly (ll vs int)
// template by bqi343


Measured memory_bytes: 256
# include <iostream>
# include <algorithm>
#include <array>
# include <cassert>
#include <cctype>
#include <climits>
#include <numeric>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <tuple>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
# include <chrono>
# include <random>
# include <limits.h>
# include <unordered_map>
# include <unordered_set>
# include <deque>
# include <cstdio>
# include <cstring>
#include <stdio.h>
#include<time.h>
#include <stdlib.h>
#include <cstdint>
#include <cfenv>

//#include <bits/stdc++.h>
using namespace std;
using LL = int;
using ULL = unsigned long long;
long long MOD = 1000000000 + 7;
constexpr long long INF = numeric_limits<LL>::max();
const double PI = acos(-1);
#define fir first
#define sec second
#define thi third
#define debug(x) cerr<<#x<<": "<<x<<'\n'
typedef pair<LL, LL> Pll;
typedef pair<LL, pair<LL, LL>> Ppll;
typedef pair<LL, pair<LL, bitset<100001>>> Pbll;
typedef pair<LL, pair<LL, vector<LL>>> Pvll;
typedef pair<LL, LL> Vec2;
struct Tll { LL first, second, third; };
struct Fll { LL first, second, third, fourd; };
typedef pair<LL, Tll> Ptll;
#define rep(i,rept) for(LL i=0;i<rept;i++)
#define Mfor(i,mf) for(LL i=mf-1;i>=0;i--)
LL h, w, n, m, k, t, s, q, last, cnt, sum, ans, dp[10000], a[2000000], b[2000000];
string str, ss;
bool f[1100][1100];
char c;
int di[4][2] = { { 0,1 },{ 1,0 },{ 0,-1 },{ -1,0 } };
struct Edge { LL to, cost; };
vector<Edge>vec[200000];
list<LL>li[20000];
vector<LL>v;
map<string, vector<LL>>ma;
multiset<LL>st[3];
void YN(bool f) {
	if (f)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
}
void yn(bool f) {
	if (f)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}
int main() {
	cin >> n;
	rep(i, n) {
		LL x;
		cin >> x;
		st[0].insert(x);
	}
	cin >> m;
	rep(i, m) {
		LL x;
		cin >> x;
		st[1].insert(x);
	}
	set_union(st[0].begin(), st[0].end(), st[1].begin(), st[1].end(), inserter(st[2], st[2].begin()));
	cout << "01"[st[0] == st[2]] << endl;
	return 0;
}


Measured memory_bytes: 45624
#include<bits/stdc++.h>
#define fi first
#define se second
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define rrep(i, n) for (int (i) = 1; (i) <= (n); (i++))
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
#define yn {puts("Yes");}else {puts("No");}
#define printd(x) printf("%.20f\n", x);
template<class T> bool chmin(T& a, const T& b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> bool chmax(T& a, const T& b) {if (a < b) {a = b; return 1;} return 0;}
using namespace std;
using ll = long long;



int main() {
	ll k;
	cin >> k;

	ll now = 7;
	for (int i = 1; i <= 5000000; i++) {
		if (now % k == 0) {
			cout << i << endl;
			return 0;
		}
		else {
			now *= 10;
			now += 7;
			now %= k;
		}
	}

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


Measured memory_bytes: 3620
import sys

K = int(sys.stdin.readline())
S = sys.stdin.readline().rstrip('\n')

# ## COMBINATION (MOD) ###
N_MAX = 10**6  # 問題サイズに合わせて変えておく
MOD = 10**9 + 7

inv = [0] * (N_MAX + 2)
inv[0] = 0  # 逆元テーブル計算用テーブル
inv[1] = 1

for i in range(2, N_MAX + 2):
    inv[i] = -inv[MOD % i] * (MOD // i) % MOD

# K 文字追加
ans = 0

ln = len(S)

p1 = 1
p2 = 1
s2 = pow(26, K, MOD)

for i in range(1, K + 2):

    ans += (p1 * p2 * s2) % MOD
    ans %= MOD

    # print(p1, p2, s2)

    # pre
    p1 = (p1 * (ln + i - 1) * inv[i]) % MOD
    p2 = (p2 * 25) % MOD

    # suf
    s2 = (s2 * inv[26]) % MOD

print(ans)


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

signed main() {
	ll n, k;
	ll l[60];
	cin >> n >> k;
	rep(i, n) cin >> l[i];
	sort(l,l+n, greater<ll>());
	ll ans = 0;
	rep(i, k) ans += l[i];
	cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
void solve(int n){
    int w[n];
    for(int i=0;i<n;i++)scanf("%d",&w[i]);
    vector<vector<int>> dp(n,vector<int>(n));
    for(int i=0;i<n-1;i++)dp[i][i+1]=(abs(w[i]-w[i+1])<=1)*2;
    for(int k=2;k<n;k++){
        for(int i=0;i<n-k;i++){
            int j=i+k;
            if(dp[i+1][j-1]==j-i-1 and abs(w[i]-w[j])<=1)dp[i][j]=j-i+1;
            else{
                for(int l=i;l<j;l++)dp[i][j]=max(dp[i][j],dp[i][l]+dp[l+1][j]);
            }
        }
    }
    printf("%d\n",dp[0][n-1]);
}
int main(){
    while(true){
        int n;scanf("%d",&n);
        if(!n)break;
        solve(n);
    }
    return 0;
}


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

int main(){
  int N; cin >> N;
  multiset<string> S;
  for(int i=0; i<N; i++){
    string tmp; cin >> tmp;
    sort(tmp.begin(),tmp.end());
    S.insert(tmp);
  }
  long long result=0;
  while(!S.empty()){
    long long tmp=S.count(*(S.begin()));
    result+=(tmp*(tmp-1)/2);
    S.erase(*(S.begin()));
  }
  cout << result << endl;
}

Measured memory_bytes: 9600
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ll mod = 1e9 + 7;
//const ll mod = 998244353;
#define REP(i,n) for(int i=0;i<(int)n;++i)
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}
string num2bit(ll num, ll len){
    string bit = "";
    REP(i, len){
    bit += char('0'+(num>>i & 1));
    }
    return bit;
}

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

    ll X, Y, Z;
    cin >> X >> Y >> Z;
    cout << Z << " " << X << " " << Y << endl;
 
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cmath>

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

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

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

template<typename T> void swap(T & x, T & y) { T t = x; x = y; y = t; return; }
template<typename T> T abs(T x) { return (0 <= x ? x : -x); }
template<typename T> T max(T a, T b) { return (b <= a ? a : b); }
template<typename T> T min(T a, T b) { return (a <= b ? a : b); }
template<typename T> bool setmin(T & a, T b) { if(a <= b) { return false; } else { a = b; return true; } }
template<typename T> bool setmax(T & a, T b) { if(b <= a) { return false; } else { a = b; return true; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

// ---- ----

int n, a[100001], ans;

int main() {
	scanf("%d", &n);
	inc1(i, n) { scanf("%d", &a[i]); }
	
	inc1(i, n) {
		if(a[ a[i] ] == i) { ans++; }
	}
	
	printf("%d\n", ans / 2);
	
	return 0;
}


Measured memory_bytes: 512
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <queue>
#include <iterator>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef unsigned long long ULL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int gcd(int a, int b){
   int tmp;
   while(a%b==0){
      tmp=a%b;
      a=b;
      b=tmp;
   }
}

int lcm(int a,int b){
   return a*b/gcd(a,b);
}

bool prime_number(int n){
   if(n < 2){
      return false;
   }
   else if(n == 2){
      return true;
   }
   if(n % 2 == 0){
      return false;
   }
   for(int i=3;i<=n/i;i+=2){
      if(n % i == 0) return false;
      return true;
   }
}

int main(){
   int n;
   double x[2],y[2],r[2];
   cin>>n;
   REP(i,n){
      REP(j,2) cin >> x[j] >> y[j] >> r[j];
      if(sqrt(pow(x[1]-x[0],2)+pow(y[1]-y[0],2))>r[1]+r[0])
         cout << "0" << endl;
      else if(sqrt(pow(x[1]-x[0],2)+pow(y[1]-y[0],2))+r[1]<r[0])
         cout << "2" << endl;
      else if(sqrt(pow(x[1]-x[0],2)+pow(y[1]-y[0],2))+r[0]<r[1])
         cout << "-2" << endl;
      else cout << "1" << endl;
   }
}

Measured memory_bytes: 1236
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <bitset>
#include <utility>
#include <numeric>
#include <queue>
#include <stack>

using ll = long long;
using namespace std;

constexpr int MOD = 1e9 + 7;
constexpr ll MOD_LL = ll(1e9) + 7;

int main(void) {
	int a, b, c;
	cin >> a >> b >> c;
	
	int x = min({a, b, c});
	int y = a + b + c - x - max({a, b, c});
	cout << x * y / 2 << endl;
	
	return 0;
}


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

int main() {
    int n;
    cin >> n;
  	vector<ll> a(n),b(n);
    ll m = 0,key;
    for(int i=0;i<n;i++) {
        cin >> a[i] >> b[i];
        if(a[i] > m) {
            m = a[i];
            key = i;
        }
    }
    cout << a[key] + b[key] << endl;
}

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


Measured memory_bytes: 2104
import sys
sys.setrecursionlimit(10 ** 6)


MOD = 10 ** 9 + 7


def prepare(n):
    global MOD
    modFacts = [0] * (n + 1)
    modFacts[0] = 1
    for i in range(n):
        modFacts[i + 1] = (modFacts[i] * (i + 1)) % MOD

    invs = [1] * (n + 1)
    invs[n] = pow(modFacts[n], MOD - 2, MOD)
    for i in range(n, 1, -1):
        invs[i - 1] = (invs[i] * i) % MOD

    return modFacts, invs


def dfs(n):
    global MOD
    var = 1
    isLeaf = True
    for e in edge[n]:
        if status[e] == 0:
            isLeaf &= False
            status[e] = 1
            var *= dfs(e)
            var %= MOD
    if isLeaf:
        ans = 1
    else:
        ans = nPk(K - 2 + (n == 0), len(edge[n]) - 1 + (n == 0))
        ans *= var
        ans %= MOD
    Leaf[n] = ans
    return ans


def nPk(n, k):
    global MOD
    x1 = modFacts[n]
    x2 = invs[n - k]
    ans = x1 * x2
    return ans % MOD


N, K = map(int, input().split())
edge = [[] for _ in range(N)]
for i in range(N - 1):
    a, b = map(int, input().split())
    edge[a - 1].append(b - 1)
    edge[b - 1].append(a - 1)


for i in range(N):
    if len(edge[i]) + 1 > K:
        print(0)
        exit()

modFacts, invs = prepare(K)


Leaf = [0] * N
status = [0] * N
status[0] = 1
result = dfs(0)

print((result * K) % MOD)


Measured memory_bytes: 88880
#include<bits/stdc++.h>
#define debug(x) cerr << #x << ':' << x << endl
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define ALL(c) (c).begin(), (c).end()
using namespace std;
typedef long long ll;

int main(){
    int n,m,p;
    while(1){
        cin >> n >> m >> p;
        if(n==0 && m==0 && p==0) break;
        vector<int> X(n,0);
        rep(i,n) cin >>X[i];
        int sum = 0;
        rep(i,n) sum+=X[i];
        // cout << "p "<< p << " % " << (100-p)/100.0 << endl;
        int ans;
        if(X[m-1]==0) ans = 0;
        else ans = sum*(100-p) / X[m-1];
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 3072
#include <bits/stdc++.h>
using namespace std::literals::string_literals;
using i64 = long long;
using std::cout;
using std::endl;
using std::cin;

template<typename T>
std::vector<T> make_v(size_t a){return std::vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return std::vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

int main() {
	int n; scanf("%d", &n); std::vector<i64> a(n), b(n);
	for(int i = 0; i < n; i++) scanf("%lld", &a[i]); sort(begin(a), end(a));
	for(int i = 0; i < n; i++) scanf("%lld", &b[i]); sort(begin(b), end(b));
	
	i64 ans = 0;
	for(int i = 40; i >= 0; i--) {
		i64 MOD = (1LL << i);
		std::vector<i64> A, B;
		for(auto v: a) {
			if(v >> i & 1) B.push_back(v % MOD);
			else A.push_back(v % MOD);
		}
		sort(begin(A), end(A)); sort(begin(B), end(B));
		
		i64 count = 0;
		for(auto v: b) {
			if(v >> i & 1) {
				v %= MOD;
				i64 X = upper_bound(begin(A), end(A), MOD - v - 1) - begin(A);
				i64 Y = upper_bound(begin(B), end(B), MOD - v - 1) - begin(B); Y = (i64)B.size() - Y;	
				
				count += X + Y;
				count %= 2;
			} else {
				v %= MOD;
				i64 X = upper_bound(begin(B), end(B), MOD - v - 1) - begin(B);
				i64 Y = upper_bound(begin(A), end(A), MOD - v - 1) - begin(A); Y = (i64)A.size() - Y;
				
				count += X + Y;
				count %= 2;
			}
		}
		if(count % 2LL) ans |= (1LL << i);
	}
	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 7124
S=input()
w=["dream","dreamer","erase","eraser"]
q=[0]
while q:
    i = q.pop()
    s = S[i:]
    if s == "":
        print("YES")
        break
    for c in w:
        if c==s[:len(c)]:q.append(i+len(c))
else:
    print("NO")

Measured memory_bytes: 3668
#include<bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define lper(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};
int main() {
int A;
  int B;
  int C;
  int X;
  cin >>A>>B>>C>>X;
  int count=0;
  rep(i,A+1) {
    	int y=X-500*i;
    	if(y==0) {
    	count++;
          //cout<< count<< 55555<<endl;
     	 break;
    	}
   	 	else if(y<0) {
      	break;
   		 }
      
   		 else if (y>0) {
    			rep(j,B+1) {
      			int z=y-j*100;
      //cout<<z<<" "<<j*100<< endl;
           		if(z==0) {
          		  count++;
                  //cout<<count<< 222<< endl;
          		break;
                }
                  else if(z<0) {
      				break;
    			}
      
    
     				 
     	 		else if(z>0) {
               if   ((z/50<=C) &&(z/50>0)){
        		count++;
                 //cout<<count<<33333<< endl;
     	 				 }
   				       } 
                }
  		}   
  }
  
  cout<< count<< endl;
}
      
  
  

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define FORD(i,a,b) for(int i=a;i>=b;i--)
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) int((a).size())
#define SORT(c) sort((c).begin(),(c).end())
#define PB push_back
#define MP make_pair
#define MEMSET(v, h) memset((v), h, sizeof(v))
#define sqr(x)  ((x) * (x)) 
#define cub(x)  ((x) * (x) * (x))
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
// int gcd(int a,int b){return b?gcd(b,a%b):a;}

ll dist[210][210];

int main() {
  int k,x; cin >> k >> x;
  if(k*500>=x) cout << "Yes" << endl;
  else cout << "No" << endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int f(int x);

int main() {
  int n;
  cin >> n;
  if(n % f(n) == 0) cout << "Yes" << endl;
  else cout << "No" << endl;
}

int f(int x) {
  int sum;
  while(x) {
    sum += x % 10;
    x /= 10;
  }
  return sum;
}

Measured memory_bytes: 256
const txt = require('fs').readFileSync('/dev/stdin', 'utf8')

const input = txt.split('\n').map((i: string) => { return Number(i) })
input.pop()
let count: number = 0
for (let i = 0; i < input.length; i++) {
  if (input[i] % 10 === 0) {
    count += input[i]
    input.splice(i, 1)
    i = i - 1
  }
  else {
    count += input[i]
  }
}
const newtime = input.map((i: number) => { return i % 10 })
const sort = newtime.sort()
sort.splice(0, 1)
for (let i in sort) {
  count += 10 - newtime[i]
}
console.log(count)

Measured memory_bytes: 7372
#include <bits/stdc++.h>
#define ll long long int
#define ld long double
#define mod 1000000007
#define inf 1e18
#define inp(arr,n) for(int i=0;i<n;i++) cin>>arr[i]
#define fr(i,a,b) for(int i=a;i<=b;i++)
using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int T=1;
    while (T--) {
        int n;
        cin>>n;
        ll sum=0;
        int arr[100001];
        memset(arr,0,sizeof(arr));
        fr(i,1,n){
            int a;
            cin>>a;
            arr[a]++;
            ll A=a;
            sum+=A;
        }
        int q;
        cin>>q;
        fr(i,1,q){
            int b,c;
            cin>>b>>c;
            int f=arr[b];
            arr[b]=0;
            arr[c]+=f;
            ll F=f;
            sum=sum+f*(c-b);
            cout<<sum<<"\n";
        }
    }
    return 0;
}

Measured memory_bytes: 4044