akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
#define ll long long
#define cpp boost::multiprecision::cpp_int
#define dequeue deque
#define rep(i, n) for(int i = 0; i < n; i++)
#define rrep(i, n) for(int i = 1; i <= n; i++)
#define drep(i, n) for(int i = n-1; i >= 0; i--)
#define srep(i, s, t) for (int i = s; i < t; i++)
#define vi vector<int>
#define P pair<ll, ll>
int mod = 1'000'000'000 + 7;
const double PI = 3.1415926535897932384626433832795;
struct edge {
	int to;
	ll cost;
};
void reverse(string* s) {
	reverse((*s).begin(), (*s).end());
}
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;
}
void COME_LET_THE_GAMES_BEGIN() {
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << setprecision(20);
}
int main() {
	COME_LET_THE_GAMES_BEGIN();
	int N, H;
	cin >> N >> H;
	vector<int> a(N), b(N);
	rep(i, N) {
		cin >> a[i] >> b[i];
		a[i] = -a[i];
		b[i] = -b[i];
	}
	sort(a.begin(), a.end());
	sort(b.begin(), b.end());
	int ans = 0;
	rep(i, N) {
		if (b[i]<a[0]) {
			H += b[i];
			ans++;
			if (H <= 0) {
				cout << ans << endl;
				return 0;
			}
		}
		else {
			break;
		}
	}
	ans += H / -a[0];
	if (H % a[0] != 0) {
		ans++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define pii pair<ll, ll> 
#define pb push_back
#define debug(x) cerr<< #x << " is " <<x<<endl;
#define debug2(x) cerr<<#x<< " is\n"; for (auto &i:x) {cout<<i<<' '; } cout<<endl;
#define f first
#define s second
using namespace std;

const ll mod = 1e9+7;

ll dp[105][100005];

int main(){
    ios::sync_with_stdio(false); cin.tie(0);
    int n, k; cin>>n>>k;
    vector<ll> a(n+1);
    for (int i=1; i<=n; i++) cin>>a[i];

   	for (int i=1; i<=n; i++){
   		for (int j=0; j<=k; j++){
   			if (i==1) dp[i][j]=a[i]>=j?1:0;
   			else if (j==0) dp[i][j]=1;
   			else {
   				dp[i][j]=dp[i][j-1]+dp[i-1][j];
   				if (j-1-a[i]>=0) dp[i][j]-=dp[i-1][j-1-a[i]];
   			}
   			dp[i][j]=(dp[i][j]%mod+mod)%mod;
   		}
   	}
   	cout<<dp[n][k]%mod<<'\n';
}

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

using namespace std;

const int t[10][10] = {
			{3,2,6,1,5,4}, //W
			{4,2,1,6,5,3}, //E
			{2,6,3,4,1,5}, //N
			{5,1,3,4,6,2}, //S
		};
int main()
{
	int d[10], a[10], k[200];
	string s;
	k['W'] = 0, k['E'] = 1, k['N'] = 2, k['S'] = 3;
	for(int i = 0; i < 6; i++)
	{
		cin >> d[i];
	}
	cin >> s;
	for(int i = 0; i < s.size(); i++)
	{
		for(int j = 0; j < 6; j++)
		{
			a[j] = d[t[k[s[i]]][j]-1];
		}
		for(int j = 0; j < 6; j++)
		{
			d[j] = a[j];
		}
	}
	cout << d[0] << endl;
	return 0;
}


Measured memory_bytes: 3204
from functools import lru_cache


@lru_cache(maxsize=None)
def fib(n):
    """ http://docs.python.jp/3/library/functools.html """
    if n < 2:
        return n
    return fib(n-1) + fib(n-2)


class Fibonacci(object):
    memo = [1, 1]

    def get_nth(self, n):
        if n < len(Fibonacci.memo):
            return Fibonacci.memo[n]
        # print('fib({0}) not found'.format(n))
        for i in range(len(Fibonacci.memo), n+1):
            result = Fibonacci.memo[i-1] + Fibonacci.memo[i-2]
            Fibonacci.memo.append(result)
            # print('fib({0})={1} append'.format(i, result))
        return Fibonacci.memo[n]


if __name__ == '__main__':
    # ??????????????\???
    num = int(input())

    # ?????£??????????????°????¨????
    f = Fibonacci()
    result = f.get_nth(num)
    #result = fib(num+1)

    # ???????????????
    print('{0}'.format(result))

Measured memory_bytes: 8256
N = int(input())


def DFS(N, S):
    if len(S) == N:
        print(S)
    else:
        next_chrs = []
        if S:
            next_max_chr = ord(max(S)) + 1
        else:
            next_max_chr = ord("a")
        for i in range(0, next_max_chr - ord("a") + 1):
            DFS(N, "".join([S, chr(ord("a") + i)]))


DFS(N, "")

Measured memory_bytes: 58840
#include <cstdio>

int main()
{
  int n;
  scanf("%d", &n);
  int e = 1;
  for (int i = 0; i < n; ++i)
  {
    int a;
    scanf("%d", &a);
    e &= a ^ 1;
  }
  puts(e != 0 ? "second" : "first");
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int m, f, b, a;
    cin >> m >> f >> b;
    if (m>=b){
        a=0;
        cout << a << endl;
    }
    else if(m<b&&m+f<b)
            cout << "NA" << endl;
    else{
        a=b-m;
        cout << a << endl;
    }
}



Measured memory_bytes: 3096
#include <bits/stdc++.h>
using namespace std;
int main() {
	char b;
	cin >> b;
	if (b=='A') {
		cout << "T"<<endl;
	}
	else if (b == 'T') {
		cout << "A"<<endl;
	}
	else if (b == 'C') {
		cout << "G"<<endl;
	}
	else if (b =='G') {
		cout << "C"<<endl;
	}
 
}

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

int main() {
    int N, W;
    cin >> N >> W;
    vector<int> weights(N);
    vector<int> values(N);

    for (int i = 0; i < N; i++) {
        cin >> weights[i] >> values[i];
    }

    vector<vector<long long int> > dp(N + 1, vector<long long int>(W + 1));

    for (int i = 0; i <= N; i++) {
        for (int j = 0; j <= W; j++) {
            if (i == 0 || j == 0)
                dp[i][j] = 0;
            else if (weights[i - 1] > j)
                dp[i][j] = dp[i - 1][j];
            else {
                dp[i][j] = max(dp[i - 1][j], values[i - 1] + dp[i - 1][j - weights[i - 1]]);
            }
        }
    }

   
    cout << dp[N][W] << endl;
}

Measured memory_bytes: 80256
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
typedef unsigned int uint;
using namespace std;

int main() {
    int a, b, q, idx;
    cin >> a >> b >> q;

    ll s[a], t[b], x;
    for (int i = 0; i < a; i++) cin >> s[i];
    for (int i = 0; i < b; i++) cin >> t[i];

    for (int i = 0; i < q; i++) {
        cin >> x;

        vector <ll> shrine, temple;

        idx = lower_bound(s, s+a, x) - s;
        if (idx < a) shrine.push_back(s[idx]);
        if (idx > 0) shrine.push_back(s[idx - 1]);

        idx = lower_bound(t, t+b, x) - t;
        if (idx < b) temple.push_back(t[idx]);
        if (idx > 0) temple.push_back(t[idx - 1]);

        ll mn = 1LL << 60;
        for (ll v : shrine) {
            for (ll u : temple) {
                mn = min({mn, abs(x - u) + abs(u - v), abs(x-v) + abs(u - v)});
            }
        }

        cout << mn << "\n";
    }

    return 0;
}

Measured memory_bytes: 2944
/**
 * @copyright (c) 2020 Daisuke Hashimoto
 */

#include <bits/stdc++.h>
using namespace std;
using Pair = pair<int64_t, int64_t>;
constexpr int64_t kInf = INT64_MAX / 2L;

// std::cout << std::setprecision(20) << 1.1 << endl;

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

  int64_t N;
  cin >> N;
  // const int64_t L = static_cast<int64_t>(T.length());
  vector<int64_t> A(N);
  vector<int64_t> B(N);
  for (int64_t i = 0; i < N; ++i) {
    cin >> A[i];
  }
  queue<int64_t> B_is_smaller;
  queue<int64_t> A_is_smaller;
  int64_t total_count = 0;
  int64_t increment_b = 0;
  int64_t increment_a = 0;
  for (int64_t i = 0; i < N; ++i) {
    cin >> B[i];
    total_count += (B[i] - A[i]);
    if (A[i] > B[i]) {
      increment_b += (A[i] - B[i]);
    } else if (A[i] < B[i]) {
      increment_a += (B[i] - A[i] + 1) / 2;
      increment_b += ((B[i] - A[i]) % 2);
    }
  }

  if (increment_a > total_count) {
    cout << "No" << endl;
  } else if (increment_b > total_count) {
    cout << "No" << endl;
  } else {
    cout << "Yes" << endl;
  }
  return 0;
}


Measured memory_bytes: 3796
n, m = [int(i) for i in input().split()]
ss = []
for _ in range(m):
    s = [int(i)-1 for i in input().split()][1:]
    ss.append(s)
p = [int(i) for i in input().split()]

ans =0
for i in range(2 ** n):
    ok = True
    for j,k in zip(ss,p):
        l = 0
        for m in j:
            if (2 ** m) & i != 0:
                l += 1
        if l % 2 != k:
            ok = False


    if ok:
        ans += 1
print(ans)
        

Measured memory_bytes: 41200
#include<bits/stdc++.h>
using namespace std;
#define int long long
int arr[3005];
int n;
int dp[3005][3005][2];

int func(int i,int j,int c)
{
	if(dp[i][j][c]!=-1)
		return dp[i][j][c];
	if(i>j)
	{
		return 0;
	}
	if(c==0)
	{
		dp[i][j][c]=max(arr[i]+func(i+1,j,1),arr[j]+func(i,j-1,1));
	}
	else
	{
		dp[i][j][c]=min(-arr[i]+func(i+1,j,0),-arr[j]+func(i,j-1,0));
	}
return dp[i][j][c];
}

signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin>>n;
	for(int i=0;i<=n;i++)
	{
		for(int j=0;j<=n;j++)
		{
			dp[i][j][0]=dp[i][j][1]=-1;
		}
	}
	for(int i=0;i<n;i++)
	{
		cin>>arr[i];
	}
	cout<<func(0,n-1,0);
return 0;
}

Measured memory_bytes: 141312
#include<bits/stdc++.h>
using namespace std;
int ans[2005];
int main(){
	int n,x,y;scanf("%d%d%d",&n,&x,&y);
	for(int i=1;i<=n;i++){
		for(int j=i+1;j<=n;j++){
			ans[min(j-i,abs(x-i)+abs(j-y)+1)]++;
		}
	}
	for(int i=1;i<n;i++)printf("%d\n",ans[i]);
	return 0;
}

Measured memory_bytes: 256
import sys
def b(bs, cs):
    d = set()
    bl, cl = len(bs), len(cs)
    bi, ci = 0, 0
    ncs = []
    while True:
      if bs[bi] > cs[ci]:
        bs.append(cs[ci])
        bi += 1
      else:
        ncs.append(cs[ci])
      ci += 1
      if bi == bl or ci == cl:
        break
    if len(bs) != 2 * bl:
      print("No")
      sys.exit()
    return bs, ncs + cs[ci:]

n=int(input())
xs = sorted(list(map(int,input().split())))[::-1]
bs, cs = xs[:1], xs[1:]
for _ in range(n):
    bs, cs = b(sorted(bs)[::-1], cs)

print("Yes")


Measured memory_bytes: 134528
from collections import deque

def resolve():
    N = int(input())
    tree = [[] for i in range(N)]

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

    d = deque([[0, -1]])
    dist = [0] * N
    while d:
      node, par = d.pop()
      children = tree[node]
      for child in children:
        if child == par:
          continue
        dist[child] = (dist[node] + 1) % 2
        d.appendleft([child, node])

    count0 = dist.count(0)
    count1 = N - count0
    s = [set(), set(), set()]
    for i in range(1, N+1):
      s[i%3].add(i)
    if count0 > N//3:
      if count1 > N//3:
        for i in range(N):
          if dist[i]:
            if s[2]:
              dist[i] = s[2].pop()
            else:
              dist[i] = s[0].pop()
          else:
            if s[1]:
              dist[i] = s[1].pop()
            else:
              dist[i] = s[0].pop()
      else:
        for i in range(N):
          if dist[i]:
            dist[i] = s[0].pop()
          else:
            if s[2]:
              dist[i] = s[2].pop()
            elif s[1]:
              dist[i] = s[1].pop()
            else:
              dist[i] = s[0].pop()
    else:
      for i in range(N):
        if dist[i]:
          if s[2]:
            dist[i] = s[2].pop()
          elif s[1]:
            dist[i] = s[1].pop()
          else:
            dist[i] = s[0].pop()
        else:
          dist[i] = s[0].pop()

    print(*dist)
    
resolve()

Measured memory_bytes: 60240
import java.util.*;

public class Main {

    public static void main(String args[]) {


        Scanner scan = new Scanner(System.in);
        String s = scan.next();

        char a = s.charAt(0);
        char b = s.charAt(1);
        char c = s.charAt(2);

        if (a == 'R') {
            if (b== 'R') {

                if (c == 'R') {
                    System.out.println(3);
                } else {
                    System.out.println(2);
                }
            }  else {
                System.out.println(1);
            }
        } else {
            if (b== 'R') {
                if (c== 'R') {
                    System.out.println(2);
                } else {
                    System.out.println(1);
                }
            } else {
                if (c=='R') {
                    System.out.println(1);
                } else {
                    System.out.println(0);
                }
            }
        }

    }
}

Measured memory_bytes: 35624
#include<stdio.h>
int main(void)
{
  int a, b;
  int c;

  scanf("%d%d",&a,&b);

  c = a*b;

  if(c%2 == 0){
	printf("Even\n");
  }else{
	printf("Odd\n");
  }

  return 0;

}


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

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

    int x, y, z, tmp;
    cin >> x >> y >> z;

    if(x > y){
        tmp = x;
        x = y;
        y = tmp;
    }
    if (y > z){
        tmp = y;
        y = z;
        z = tmp;
    }
    if(x > y){
        tmp = x;
        x = y;
        y = tmp;
    }

    cout << x << " " << y << " " << z << endl;

    return 0;
}

Measured memory_bytes: 3148
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <stack>
#include <functional>

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
    #define eprintf(...) 42
#endif

#define rep_(i, a_, b_, a, b, ...) for (int i = (a), i##_len = (b); i < i##_len; ++i)
#define rep(i, ...) rep_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define reprev_(i, a_, b_, a, b, ...) for (int i = (b-1), i##_min = (a); i >= i##_min; --i)
#define reprev(i, ...) reprev_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define all(x) (x).begin(), (x).end()
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 (b < a) { a = b; return 1; } return 0; }
template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int,int> P;
typedef long double ld;

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, b; cin >> a >> b;
    rep (i, 10000) {
        int aa = (i * 8) / 100, bb = (i * 10) / 100;
        if (aa == a && bb == b) {
            cout << i << "\n";
            return 0;
        }
    }
    cout << -1 << "\n";
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>

using namespace std;

long long a, n, smallest, biggest, sum;
char op;

int main(){
	
	cin >> n;

	smallest = 0;
	biggest = 0;
	sum = 0;

	for (int i = 0; i + 1 <= n;i++){

		cin >> a;

		if (i == 0 || a < smallest){
			smallest = a;
		}
		if (i == 0 || a > biggest){
			biggest = a;
		}

		sum += a;

	}

		cout << smallest << " " << biggest << " " << sum << endl;

	return 0;
}






Measured memory_bytes: 3116
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<LL,LL> P;
const LL mod=1000000007;
const LL LINF=1LL<<60;
const int INF=1<<30;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};


int main(){
    vector<int> a(3);
    for (int i = 0; i < 3; i++) {
        cin >> a[i];
    }
    sort(ALL(a));
    cout << a[2]*10+a[1]+a[0] << endl;
    return 0;
}


Measured memory_bytes: 256
n = int(input())
h = list(map(int,input().split()))
max = 0
count = 0
h.reverse()
for i in range(1,n):
    if h[i] >= h[i-1]:
        count +=1
    elif max < count:
        max = count
        count = 0
    else:
        count = 0
if max < count:
    max = count
print(max)

Measured memory_bytes: 14224
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>
#include <map>

using namespace std;
typedef long long ll;
ll A;
double B;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setprecision(10) << fixed;
    cin >> A >> B;
    ll b = (B+0.001)*100;
    cout << (A*b)/100 << endl;
}

Measured memory_bytes: 3740
#include<iostream>
#include<string>
using namespace std;
int main(){
  string s;
  cin >> s;
  
  int ss[2];
  ss[0] = stoi(s.substr(0,2));
  ss[1] = stoi(s.substr(2,2));
 
  bool NotMonth[2]; 
  //2文字の文字列がMM/YYのどちらか判別する
  for(int i=0; i<2; i++){
    if(ss[i]==0 || ss[i]>12){
      NotMonth[i] = true;
    }
    else{
      NotMonth[i] = false;
    }
  }
  
  string answer;
  if(NotMonth[0]){
    if(NotMonth[1]) answer = "NA";
    else answer = "YYMM";
  }
  else{
    if(NotMonth[1]) answer = "MMYY";
    else answer = "AMBIGUOUS";
  }
  
  cout << answer << endl;
  return 0;
}

Measured memory_bytes: 256
def gcd(numbers):
    _min = numbers[0]
    tmp = sorted([_n % _min for _n in numbers])
    return _min if tmp[-1] == 0 else gcd(sorted([_t if _t > 0 else _min for _t in tmp]))


def solve(string):
    ins = string.split("\n")
    n, x = map(int, ins[0].split(" "))
    xs = list(map(int, ins[1].split(" ")))
    xs.append(x)
    xs = sorted(xs)
    diff = [_n - _p for _p, _n in zip(xs, xs[1:])]
    return str(gcd(diff))


if __name__ == '__main__':
    tmp = [input(), input()]
    print(solve('\n'.join(tmp)))


Measured memory_bytes: 19672
n, x = input().split()
n = int(n)
x = int(x)
ans = 0
a1, a2 = x, n - x
l = min(a1, a2)
h = max(a1, a2)
while True:
    d = h // l
    ans += 3 * l * d
    temp = h - l * d
    if temp == 0:
        break
    h = l
    l = temp
print(ans)

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

#define int long long int
#define double long double
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define endl "\n"

const int N = 1e5 + 5;
int a[N];

int32_t main()
{
	IOS;
	int n;
	cin >> n;
	int zero = 0;
	for (int i = 1; i <= n; i++)
	{
		cin >> a[i];
		if (a[i] == 0)
			zero = 1;
	}
	// int val = 1e18 * 1e18;
	// if (1e18 > 9223372036854775807)
	// 	cout << val << endl;
	if (zero)
	{
		cout << "0" << endl;
	}
	else
	{
		sort(a + 1, a + n + 1);
		int ans = 1;
		double cur = 1;
		for (int i = 1; i <= n; i++)
		{
			cur *= a[i];
			if (cur > 1e18 + 5)
			{
				cout << "-1" << endl;
				return 0;
			}
			ans *= a[i];
		}
		// if (ans > 1000000000000000000)
		// {
		// 	cout << "-1" << endl;
		// 	return 0;
		// }
		cout << ans << endl;
	}

	return 0;
}

Measured memory_bytes: 4332
#include <bits/stdc++.h>
typedef long long ll;
#define pb push_back
#define mii map <int, int>
#define mll map <ll, ll>
#define pii pair <int, int>
#define pll pair <ll, ll>
#define vi vector <int>
#define vd vector <double>
#define vll vector <ll>
#define fi first
#define se second
#define si set <int>
#define sll set <ll>
#define spii set <pii>
#define vpii vector <pair <int,int> >
#define vpll vector <pair <long long,long long> >
#define vvi vector <vector <int> >
#define vvpii vector <vector <pii > >
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(),(x).rend()


using namespace std;
const ll INFLL = 1e18;
const int MAXN = 1e6+100;
const ll INF = 1e9;
const ll mod1=1e9+7;
const ll mod2=2e9+11;

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin>>n;
    int cur=1;
    int cnt=0;
    for (int i=0;i<n;i++)
    {
        int x;
        cin>>x;
        if (x==cur)
            cur++,cnt++;
    }
    if (cnt==0)
        cout<<-1;
    else
    cout<<n-cnt;
}

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

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    long long A,B,K;
    cin>>A>>B>>K;
    if(K<=A) 
    {
        cout<<A-K<<" "<<B<<endl;
    }
    else if(K<=A+B) 
    {
        cout<<0<<" "<<A+B-K<<endl;
    }
    else 
    {
        cout<<0<<" "<<0<<endl;
    }
    return 0;
}

Measured memory_bytes: 3612
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <stack>
#include <algorithm>
#include <string>
#include <map>
#include <iterator>
#include <set>

using namespace std;


int main() {

    string S;
    cin >> S;

    if (S == "ABC") {
        cout << "ARC" << endl;
    } else {
        cout << "ABC" << endl;
    }


    return 0;

}

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

using namespace std;
typedef long long ll;

int main() {
  ll a, b, n;
  cin >> a >> b >> n;
  ll x = n;
  if (n >= b) x = b - 1;
  ll ans = (a * x / b) - a * (x / b);
  cout << ans << '\n';
  return 0;
}



Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
using ll = int_fast64_t;
using ull = uint_fast64_t;
using ld = long double;
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rep1(i, n) for (ll i = 1; i < n; ++i)
ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }
template <typename T> void vecout(const T &v) {
  for (auto it = v.begin(); it != v.end();
       ++it, cout << (it != v.end() ? " " : "\n")) {
    cout << *it;
  }
}

void solve() {
  // main coding
  int n; cin>>n;
  vector<vector<int>> dp(n,vector<int>(3));
  cin>>dp[0][0]>>dp[0][1]>>dp[0][2];
  int a,b,c;
  rep1(i,n) {
    cin>>a>>b>>c;
    dp[i][0]=max(dp[i-1][1],dp[i-1][2])+a;
    dp[i][1]=max(dp[i-1][0],dp[i-1][2])+b;
    dp[i][2]=max(dp[i-1][0],dp[i-1][1])+c;
  }
  cout<<max({dp[n-1][0],dp[n-1][1],dp[n-1][2]})<<endl;
}

int main() {
  cout << fixed << setprecision(10);
  solve();
  return 0;
}


Measured memory_bytes: 5760
#include"bits/stdc++.h"
using namespace std;
using ll = int64_t;

ll MODpow(ll n, ll m, ll mod) {
    ll result = 1;
    while (m) {
        if (m % 2 == 1) {
            result *= n;
            result %= mod;
        }

        m /= 2;
        n *= n;
        n %= mod;
    }

    return result;
}

class Combination {
public:
    Combination(ll max_num, ll mod) {
        fact_.resize(max_num + 1, 1);
        inv_fact_.resize(max_num + 1, 1);
        mod_ = mod;
        for (ll i = 2; i <= max_num; i++) {
            fact_[i] = i * fact_[i - 1] % mod_;
            inv_fact_[i] = MODpow(fact_[i], mod_ - 2, mod_);
            assert(fact_[i] * inv_fact_[i] % mod_ == 1);
        }
    }
    ll operator()(ll n, ll m) const {
        if (m < 0 || m > n) return 0;
        return fact_[n] * inv_fact_[n - m] % mod_ * inv_fact_[m] % mod_;
    }
private:
    vector<ll> fact_, inv_fact_;
    ll mod_;
};

int main() {
    ll p;
    cin >> p;
    vector<ll> a(p);
    for (ll i = 0; i < p; i++) {
        cin >> a[i];
    }

    Combination comb(p - 1, p);

    vector<ll> b(p);
    for (ll j = 0; j < p; j++) {
        if (a[j] == 0) {
            continue;
        }
        //1 - (x - j)^(p - 1)を展開
        //この第二項についてx^iの項の係数を考えると - p-1_C_i (-j)^(p-1-i)
        ll pow = 1;
        for (ll i = p - 1; i >= 0; i--) {
            ll c = comb(p - 1, i) * pow % p;
            (pow *= j) %= p;
            if ((p - 1 - i) % 2 == 0) {
                c = p - c;
            }
            if (i == 0) {
                c += 1;
            }
            (b[i] += c) %= p;
        }
    }

    for (ll i = 0; i < p; i++) {
        cout << b[i] << " \n"[i == p - 1];
    }
}

Measured memory_bytes: 384
local read = io.read
local N, K = read("n", "n")

local number_of_types = {}
local have_types_s = {}
for i = 1, N do
	local readed = read("n")
	if have_types_s[readed] then
		local index = have_types_s[readed]
		number_of_types[index] = number_of_types[index] + 1
	else
		local new_index = #number_of_types + 1
		have_types_s[readed] = new_index
		number_of_types[new_index] = 1
	end
end

table.sort(number_of_types)

local out = 0
for i = 1, #number_of_types - K do
	out = out + number_of_types[i]
end

print(out)


Measured memory_bytes: 15556
#include<cstdio>
#include<string>
#include<iostream>
#include<algorithm>
using namespace std;
int h,w,a,b;
const long long mod=1e9+7;
const int N=2e5+7;
long long  fac[N];

long long quickpow(long long a, long long b,long long mod) {
    if (b < 0) return 0;
    long long ret = 1;
    a %= mod;
    while(b) {
        if (b & 1) ret = (ret * a) % mod;
        b >>= 1;
        a = (a * a) % mod;
    }
    return ret;
}

long long inv(long long a,long long  mod)
{
	return quickpow(a,mod-2,mod);
}

long long Cal(long long n,long long m)
{
	long long a=fac[n];
	long long b=(fac[m]*fac[n-m])%mod;
	return (a*inv(b,mod))%mod;
}

int main()
{
  cin>>h>>w>>a>>b;
  fac[0]=1;
  for(long long i=1;i<N;i++)
  	fac[i]=(fac[i-1]*i)%mod;
  long long res=0;
  for(long long i=b+1;i<=w;i++)
  {
    long long tmp=(Cal(i-1+h-a-1,h-a-1)*Cal(w-i+a-1,a-1))%mod;
    res=(res+tmp)%mod;
  } 
  cout<<res<<endl;
}

Measured memory_bytes: 1792
#include<stdio.h>
#include<string.h>
#define LEN 100005

int min(int a, int b) {return a < b ? a : b;}

typedef struct pp{
char name[100];
int t;
} P;

P Q[LEN+1];
int head, tail, n;

void enqueue(P x){
Q[tail]=x;
if(tail==LEN)tail=1;
else tail++;
}

P dequeue(){
P x =Q[head];
if(head==LEN)head=1;
else head++;
return x;
}

int main(){
int elaps=0,c,i,q;
P u;
scanf("%d %d",&n,&q);
for(i=1;i<=n;i++)scanf("%s %d",Q[i].name,&Q[i].t);

head=1; tail=n+1;

while(head!=tail){
u=dequeue();
c=min(q,u.t);
u.t-=c;
elaps+=c;
if(u.t>0)enqueue(u);
else{
printf("%s %d\n",u.name,elaps);
}
}
return 0;
}

Measured memory_bytes: 10756
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i,N) for(int i = 0; i < (N); i++)
#define erep(i,N) for(int i = N - 1; i >= 0; i--)
const ll INF = 1000000000;
//const ll MOD = 1000000007;
const ld PI = (acos(-1));
using Graph = vector<vector<int>>;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true;} return false;}
typedef pair<int, int> P;
typedef pair<ll,ll> PLL;
double rad(double a) {return a * 180 / PI;}

struct UnionFind {
    vector<int> par; // par[i]:iの親の番号 (例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

//dpTable
//int dp[100050];

int main(){
    int Q;
    cin >> Q;
    vector<int> l(Q);
    vector<int> r(Q);
    rep (i,Q) cin >> l.at(i) >> r.at(i);
    vector<int> rui(100050,0);
    for (int i = 1; i < 100000; i += 2) {
        if (i != 1) {
            bool hoge = false,huga = false;
            for (int j = 2; j <= sqrt(i); j++) {
                if (i % j == 0) hoge = true;
            }
            for (int j = 2; j <= sqrt((i + 1) / 2); j++) {
                if (((i + 1) / 2) % j == 0) huga = true;
            }
            if (!(hoge) && !(huga)) rui.at(i)++;
        }
    }
    for (int i = 1; i < 100050; i++) rui.at(i) += rui.at(i - 1);
    for (int i = 0; i < Q; i++) {
        cout << rui.at(r.at(i)) - rui.at(l.at(i) - 1) << endl;
    }
    return 0;
}

Measured memory_bytes: 4592
#include<bits/stdc++.h>
using namespace std;
int main(){
	string s;
	cin>>s;
	if(s=="SUN"){
		cout<<7;
	}
	if(s=="SAT"){
		cout<<1;
	}
	if(s=="FRI"){
		cout<<2;
	}
	if(s=="THU"){
		cout<<3;
	}
	if(s=="WED"){
		cout<<4;
	}
	if(s=="TUE"){
		cout<<5;
	}
	if(s=="MON"){
		cout<<6;
	}
	return 0;
}

Measured memory_bytes: 256
def is_prime(a):
    if a == 1:
        return False
    for i in range(2, a):
        if a % i == 0:
            return False
        if i * i > a:
            break
    return True

n = int(input())
ans = 0
for i in range(n):
    a = int(input())
    if is_prime(a):
        ans += 1
print(ans)


Measured memory_bytes: 5608
import java.util.*;

public class Main{
  public static void main(String[] arts){
    Scanner scan = new Scanner(System.in);
    int p = scan.nextInt();
    int q = scan.nextInt();
    int r = scan.nextInt();
    int con = p + q + r - Math.max(p,Math.max(q,r));
    
    System.out.println(con);
  }
}

Measured memory_bytes: 23508
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
 
#整数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()
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法では？？

n=ii()
arr=limii()

b=list(set(arr))
if len(arr)==len(b):
    print("YES")
else:
    print("NO")

Measured memory_bytes: 122100
/*#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>

#include <boost/rational.hpp>
*/
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
using ll = long long;
using ld = long double;
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define rep3(i, n) for (ll i = 1; i < (ll)(n+1); i++)
#define rep4(i, s, n) for (ll i = (s); i < (ll)(n+1); i++)
#define repr(i,n) for (ll i = (n-1); i>=0;i--)
#define repr3(i,n) for(ll i = (n);i>0;i--)
#define repr4(i,s,n) for(ll i = (n);i>=(s);i--)
#define stlen(s) ll s.size()-1
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define cout(n) cout<<std::fixed<<std::setprecision(n)
using Graph = vector<vector<int>>;
using Graphw = vector<vector<pair<ll,ll>>>;
#define INF1  INT_MAX;
#define INF2  LLONG_MAX;
#define PI  3.14159265358979323846;
#define MOD 1000000007;
/*
namespace mp = boost::multiprecision;
// 任意長整数型
using Bint = mp::cpp_int;
// 仮数部長が32の浮動小数点数型
using Real32 = mp::number<mp::cpp_dec_float<32>>;
// 仮数部長が1024の浮動小数点数型
using Real1024 = mp::number<mp::cpp_dec_float<1024>>;
// 有理数型
using Rat = boost::rational<Bint>;
*/
const int mod = 1000000007;



int main(){

string S;
cin>>S;
int n=S.size()-1;
ll ans=0;
ll have=0;
rep(i,1<<n){
    rep(j,n+1){
        have*=10;
        have+=S[j]-'0';
        if(((i>>j)&1)||(j==n)){
            ans+=have;
            have=0;

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

Measured memory_bytes: 3624
#include <iostream>
#include <map>

int main() {
    int q;
    std::cin >> q;

    std::map<std::string, int> M;
    for (int i = 0; i < q; i++) {
        int op;
        std::string key;
        std::cin >> op;

        if (op == 0) {
            int x;
            std::cin >> key >> x;
            M[key] = x;
        } else if (op == 1) {
            std::cin >> key;
            if (M.count(key) > 0) {
                std::cout << M[key] << std::endl;
            } else {
                std::cout << 0 << std::endl;
            }
        } else if (op == 2) {
            std::cin >> key;
            if (M.count(key) > 0) {
                M.erase(key);
            }
        } else if (op == 3) {
            std::string L, R;
            std::cin >> L >> R;
            auto begin = M.lower_bound(L);
            auto end = M.upper_bound(R);
            for (auto it = begin; it != end; it++) {
                std::cout << it->first << " " << it->second << std::endl;
            }
        }
    }
}



Measured memory_bytes: 27868
# -*- coding: utf-8 -*-
#utf-8を書かないと日本語で怒られる
n = int(raw_input())
#nを数字にする
l = []
l = map(int, raw_input().split())

# sort
l.sort(reverse=True)
#print(l)

# N回のfor文を回して奇数のときはアリスにとらせて偶数ではボブにとらせる
# nは0から回ることに注意（アリスは奇数回目ではない）
alice = 0
bob = 0
for i in range(n):
  if i%2 == 0:
    alice += l[i]
    #print(l[i])
  else:
    bob += l[i]

print(alice-bob)

Measured memory_bytes: 2568
import java.lang.*;
import java.io.*;
import java.util.*;

class Main{
	public static void main(String args[]) throws FileNotFoundException{
		FScanner fs=new FScanner();
		//Scanner sc=new Scanner(System.in);
		
		int n=fs.readInt();
		
		int d=0;
		int c=0;
		
		for(int i=1; i<=n; i++){
			if(i%2==1){
				d=0;
				for(int j=1; j<=i; j++){
					if(i%j==0){
						d+=1;
					}
				}
				if(d==8){
					c+=1;
				}
			}
		}
		
		System.out.println(c);
	}
	
	static void solver(){
		
	}

	static void disp(int[] data){
		for(int i=0; i<data.length; i++){
				System.out.printf("%d ",data[i]);
		}
			System.out.println();
	}
	
	static class FScanner{
		Scanner sc;
		FScanner() throws FileNotFoundException{
			sc=new Scanner(System.in);
		}
		boolean hasNextLine(){
			boolean has=true;
			if(!sc.hasNextLine()){
				has=false;
			}
			return has;
		}
		int readInt(){
			int i=Integer.parseInt(sc.nextLine());
			return i;
		}
		int[] readIntL(){
			String[] buf=sc.nextLine().split(" ");
			int[] num=new int[buf.length];
			for(int i=0; i<buf.length; i++){
				num[i]=Integer.parseInt(buf[i]);
			}
			return num;
		}
		String[] readStringL(){
			String[] s=sc.nextLine().split("");
			return s;
		}
	}
}


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

int main() {
    int n;
    int ans = 0;
    cin >> n;
    vector<int> s (n);
    for(int i=0; i<n; i++){
        cin >> s.at(i);
        ans += s.at(i);
    }
    sort(s.begin(),s.end());
    if(ans % 10 == 0){
        for(int x : s){
            if(x % 10 != 0){
                ans -= x;
                break;
            }
        }
    }
    if(ans % 10 == 0) ans = 0;
    cout << ans << endl;
}

Measured memory_bytes: 256
import java.lang.Character.{isUpperCase, isLowerCase}
import scala.io.StdIn.readLine

object Main extends App {

  val line = readLine()
  println(line.map(toggleCase))

  def toggleCase(c: Char): Char =
    if (isUpperCase(c)) c.toLower
    else if (isLowerCase(c)) c.toUpper
    else c
}



Measured memory_bytes: 43700
#include <iostream>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
int main(){
    int D;
    cin >> D;
    vector<int> c(26);
    rep(i, 26) {
        cin >> c[i];
    }
    vector<vector<int>> s(D, vector<int>(26));
    rep(i, D)rep(j, 26) {
        cin >> s[i][j];
    }
    vector<int> t(D), d(26, 0);
    int max_day, tmp_max;
    int tmp_sum = 0;
    rep(i, D) {
        max_day = 0;
        tmp_max = -10001000;
        rep(j, 26) {
            tmp_sum = 0;
            rep(k, 26) {
                if(k != j){
                    tmp_sum -= c[k]*(i-d[k]);
                }
            }
            tmp_sum += s[i][j];
            if(tmp_sum > tmp_max) {
                max_day = j;
                tmp_max = tmp_sum;
            }
        }
        d[max_day] = i;
        //t[i+1] = t[i]+tmp_max;//t[i]-s[i][max_day];
        t[i] = max_day+1;
    }
    rep(i, D) {
        cout << t[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 3684
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include<set>
#include<map>
using namespace std;


int main() {
    int a;
    cin >> a;
    int odd;
    if(a%2 == 0){
        odd = a/2;
    }
    else{
        odd = a/2 +1;
    }
    cout << double(odd)/double(a);
    cout << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  int p;
  p = 0;
  cin >> N;
  for (int i = 0; i < N; i++){
  int a;
  int b;
  cin >> a >> b;
    p += b - a + 1;
  }
  cout << p;
}

Measured memory_bytes: 3616
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<utility>
#include<cmath>
#include<climits>
#include<queue>
#include<stack>
#include<numeric>
#include<set>
#include<iomanip>
#include<map>
#include<type_traits>
#include<tuple>
using namespace std;

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


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

const int mod = 1000000007;

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;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)


int main(){
  int N, a, count=0,button;
  vector<int> buttons, imp_buttons;
  bool is_possible = true;
  int ans;
  cin >> N;
  
  rep(i, N){
    cin >> a;
    buttons.push_back(a);
  }
  count = 0;
  button = 1;
  int next_button = 0;
  vector<int> prev_buttons;
  
  while(true){
    count++;
    next_button = buttons.at(button-1);
    if(next_button == 2) break;
    if(next_button == button || count > N){
      count = -1;
      break;
    }
    button = next_button;
  }
  cout << count << endl;      
}
    

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

typedef long long ll;
typedef long double ld;

#define MOD 1000000007
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

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

int main(){

    ll A, B;

    cin >> A >> B;

    cout << max({A + B, A + A - 1, B + B - 1}) << endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		int N = Integer.parseInt(scn.next());
		String S = scn.next();
		int max = 0;
		int n = 0;

		for (int i = 0; i < N; i++) {
			if (S.charAt(i) == 'I') {
				n++;
			} else {
				n--;
			}
			if (max < n) {
				max = n;
			}
		}

		System.out.println(max);

	}
}

Measured memory_bytes: 21716
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
template<class T>inline bool chmax(T &a, const T &b){if(a < b){a = b; return 1;}return 0;}
template<class T>inline bool chmin(T &a, const T &b){if(a > b){a = b; return 1;}return 0;}
typedef long long ll;
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N; cin >> N;
  vector<int> P(N, 0);
  for(auto &i : P) cin >> i;
  int ans = 0, m = N + 1;
  REP(i, N){
    if(P[i] < m){
      ans++;
    }
    m = min(m, P[i]);
  }
  cout << ans << endl;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<long long> vll;
#define mod ll(10e8+7)
using namespace std;

ll power(ll a,ll b)
{
    if(!b) return 1;

    ll temp=power(a,b/2)%mod;
    if(b%2==0)
        return (temp*temp)%mod;

    return (((temp*temp)%mod)*a)%mod;
}
ll C(ll n,ll r)
{
    ll ans=1;
    for(ll i=1;i<=r;++i)
    {
        ans=((ans*(n+1-i))%mod)*(power(i,mod-2)%mod);
        ans%=mod;
    }
    return ans;
}
int main()
{
    ll n,a,b;
    cin>>n>>a>>b;

    ll total=power(2,n)%mod;
    ll cai=C(n,a);
    ll cbi=C(n,b);
    cout<<(mod*10+total-cai-cbi-1)%mod<<endl;
    return 0;
}


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

typedef long long ll;

const int MAXN = 100005;

int N, M;
vector <int> E[MAXN];
int clr[MAXN];
int cnt[2];

bool dfs(int x, int c) {
	if (clr[x] != -1)
		return clr[x] == c;
	clr[x] = c;
	cnt[c]++;
	for (auto it : E[x])
		if (!dfs(it, c ^ 1))
			return false;
	return true;
}

int main() {
	memset(clr, -1, sizeof clr);
	scanf("%d%d", &N, &M);
	for (int i = 0; i < M; i++) {
		int a, b;
		scanf("%d%d", &a, &b);
		E[a].push_back(b);
		E[b].push_back(a);
	}
	printf("%lld\n", (dfs(1, 0) ? (ll)cnt[0] * cnt[1] : (ll)N * (N - 1) / 2) - M);
	return 0;
}

Measured memory_bytes: 6400
#include<bits/stdc++.h>
#define rep(i, n) for(int i=0;i<(n);++i)
#define per(i, n) for(int i=(n)-1;i>=0;--i)
#define repa(i, n) for(int i=1;i<(n);++i)
#define foreach(i, n) for(auto &i:(n))
#define pii pair<int, int>
#define pll pair<long long, long long>
#define all(x) (x).begin(), (x).end()
#define bit(x) (1ll << (x))
using namespace std;
using ll = long long;
const ll MOD = (ll)1e9+7;
//const ll MOD = 998244353;
//const ll MOD = 924844033;
const int INF = (ll)1e9+7;
const ll INFLL = (ll)1e18;
const double EPS = 1e-5;
using namespace std;
template<class t>
using vvector = vector<vector<t>>;
template<class t>
using vvvector = vector<vector<vector<t>>>;
template<class t>
using priority_queuer = priority_queue<t, vector<t>, greater<t>>;
template<class t, class u> bool chmax(t &a, u b){if(a<b){a=b;return true;}return false;}
template<class t, class u> bool chmin(t &a, u b){if(a>b){a=b;return true;}return false;}

#ifdef DEBUG
#define OUTPUT(x) (output(x), outendl())
#else
#define OUTPUT(x) (void)0
#endif

ll modpow(ll x, ll b){
	ll res = 1;
	while(b){
		if(b&1)res = res * x % MOD;
		x = x * x % MOD;
		b>>=1;
	}
	return res;
}

ll modinv(ll x){
	return modpow(x, MOD-2);
}

bool was_output = false;
template<class t>
void output(t a){
	if(was_output)cout << " ";
	cout << a;
	was_output = true;
}
void outendl(){
	was_output = false;
	cout << endl;
}

int main(){
	int a,b;
	cin >> a >> b;
	cout << (a ^ b) << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    int N ;
    cin >> N;
    int a = N % 10;
    if(a == 3){
        cout << "bon" << endl;
    }
    else if(a == 0 || a== 1|| a == 6 || a == 8){
        cout << "pon" << endl;
    }
    else cout << "hon" << endl;

}

Measured memory_bytes: 3596
import sys
import math
import collections
import decimal
import itertools
from collections import deque
from functools import reduce
import heapq
import copy
n = int(input())
#h, w, K = map(int, sys.stdin.readline().split())
#s = input()
a = list(map(int, sys.stdin.readline().split()))

a.sort(reverse = True)
p = 0
for i in range(1, n):
    p += a[i//2]

print(p)


Measured memory_bytes: 32652
#include<iostream>

using namespace std;

int max(int x, int y){
	return (x < y) ? y : x;
}

int get_lcs_len(char X[1000], char Y[1000]){
	int x_len=0, y_len=0;

	for(; 'a'<=X[x_len] && X[x_len]<='z'; x_len++);
	for(; 'a'<=Y[y_len] && Y[y_len]<='z'; y_len++);
	for(; 'A'<=X[x_len] && X[x_len]<='Z'; x_len++);
	for(; 'A'<=Y[y_len] && Y[y_len]<='Z'; y_len++);

	int dp[y_len+1][x_len+1]={};
	int result = 0;

	for(int i=1; i<=y_len; i++){
		for(int j=1; j<=x_len; j++){
			if(X[j-1] == Y[i-1]){
				dp[i][j] = dp[i-1][j-1] + 1;
			}else{
				dp[i][j] = max(dp[i-1][j], dp[i][j-1]);
			}
			result = max(result, dp[i][j]);
		}
	}

	return result;
}

int main(){
	int q;
	char X[1000], Y[1000];

	cin >> q;

	int results[q];

	for(int i=0; i<q; i++){
		cin >> X >> Y;
		results[i] = get_lcs_len(X, Y);
	}

	for(int i=0; i<q; i++){
		cout << results[i] << endl;
	}

	return 0;
}


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

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	#ifndef ONLINE_JUDGE    
		freopen("input.txt", "r", stdin);     
		freopen("output.txt", "w", stdout);
	#endif

//----------------------------------------------------//
int n;
cin>>n;
int arr[n];
map<int,int>m;
rep(i,n){
	cin>>arr[i];
	m[arr[i]]++;
}
ll total = 0;
for(auto it:m){
	ll x = it.second;
	total+=x*(x-1)/2;
}
rep(i,n){
	cout<<total - m[arr[i]] + 1<<endl;
}




 






	#ifndef ONLINE_JUDGE
   		cout<<"\nTime Elapsed: " << 1.0*clock() / CLOCKS_PER_SEC << " sec\n";
	#endif

return 0;
}



Measured memory_bytes: 10360
import java.util.Scanner;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    while (true) {
      String str = sc.nextLine();
      if (str.equals("0")) break;
      int sum = 0;
      for (int i = 0; i < str.length(); i++) {
        sum += Character.getNumericValue(str.charAt(i));
      }
      System.out.println(sum);
    }
  }
}


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

int main(){
    int ans[100] = {0};
    for (int i = 1; i < 10;i++)
    {
        for (int j = 1; j < 10;j++)
        {
            ans[i * j] = 1;
        }
    }
    int n;
    cin >> n;
    if(ans[n] == 1)
        cout << "Yes";
    else
        cout << "No";
}

Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <ostream>
#include <queue>
#include <stack>
#include <string>
#include <vector>
#define INF 1000000000
#define rep(i,a,b) for (int i=(a);i<(b);i++)
#define rev(i,a,b) for (int i=(a)-1;i>=b;i--)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef queue<int> qi;
typedef queue< pair<int, int> > qpii;
typedef vector<int> vi;
typedef vector<int, int> vii;
typedef vector<string> vs;
typedef vector< pair<int, int> > vpii;
int dx[4] = { 0, 1, 0, -1 };
int dy[4] = { 1, 0, -1, 0 };

char f[150][150];
int h, w;

void dfs(int y, int x) {
  char z = f[y][x];
  f[y][x] = 'C';
  rep(i,0,4) {
    int my = y+dy[i]; int mx = x+dx[i];
    if(0<=my&&my<h && 0<=mx&&mx<w && f[my][mx] == z) dfs(my, mx);
  }
}

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

  while(1) {
    cin >> h >> w;
    if(h ==0 && w == 0) break;
    rep(i,0,h) {
      rep(j,0,w) {
        cin >> f[i][j];
      }
    }

    int ans = 0;
    rep(i,0,h) {
      rep(j,0,w) {
        if(f[i][j] != 'C') {
          dfs(i, j);
          ans++;
        }
      }
    }

    cout << ans << endl;
  }

	return 0;
}

Measured memory_bytes: 1676
/*
 * if you are interested in the reference code here,
 * see https://github.com/georeth/OJLIBS for more information
 *
 * Solution Author : Georeth Chow <georeth2010@gmail.com>
 */
#include <cstdio>
#include <cmath>
#include <climits>      // INT_MIN LLONG_MIN
#include <cfloat>       // DBL_MIN DBL_MAX
#include <cstring>      // memset
#include <cstdlib>      // malloc
#include <cstdint>      // int64_t
#include <cinttypes>    // PRId64 SCNd64
#include <cassert>      // assert
#include <limits>       // numeric_limits
#include <vector>
#include <deque>
#include <map>
#include <set>
#include <tuple>        // pair, tuple
#include <iostream>     // be careful.
                        // mix with cstdio: slowwww...
                        // mix with cstdio + fastio: bug
#include <sstream>
#include <algorithm>
using namespace std;    // use as solution header. name polution is fine.
#ifdef LOCAL_JUDGE
#  define pr_debug(...) fprintf(stderr, __VA_ARGS__)
#  define pr_line() fprintf(stderr, "%s: %d\n", __FILE__, __LINE__)
#else
#  define pr_debug(...)
#  define pr_line()
#endif
template <typename T>
bool chmax(T &m, const T &v) { if (v > m) return m = v, true; return false; }
template <typename T>
bool chmin(T &m, const T &v) { if (v < m) return m = v, true; return false; }
static const int HMAX32 = INT32_MAX / 2;
static const int HMIN32 = -HMAX32;
static const int64_t HMAX64 = INT64_MAX / 2;
static const int64_t HMIN64 = -HMAX64;
void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); }
#define read_int(id) scanf("%d", &id)
#define read_int64(id) scanf("%" PRId64, &id)
#define new_int(id) int id; read_int(id)
#define new_int64(id) int64_t id; read_int64(id)
#define ALL(x) begin(x), end(x)
/* =====  SOLUTION START  ===== */
int main() {
    int n;
    cin >> n;
    set<int> sticks;
    vector<int> avail = {0, 0};
    for (int i = 0; i < n; ++i) {
        int t;
        scanf("%d", &t);
        if (sticks.count(t)) {
            sticks.erase(t);
            avail.push_back(t);
        } else {
            sticks.insert(t);
        }
    }
    sort(ALL(avail));
    printf("%lld\n", 1LL * avail[avail.size() - 1] * avail[avail.size() - 2]);
    return 0;
}


Measured memory_bytes: 4992