akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
    int main(){
        string a, b, c;
            char x, y, z;
                cin >> a >> b >> c;
                    x = a.at(0) - 32;
                    y = b.at(0) - 32;
                    z = c.at(0) - 32;
                        cout << x << y << z << endl; 
    return 0;}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> P;
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 1000000000
#define LLINF 1000000000000000ll
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define all(x) (x).begin(),(x).end()
#define sq(x) ((x)*(x))
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define repn(i,a,n) for(int (i)=(a);(i)<(int)(n);(i)++)
#define EQ(a,b) (abs((a)-(b))<eps)
template<class T> void chmin(T& a,const T& b){if(a>b)a=b;}
template<class T> void chmax(T& a,const T& b){if(a<b)a=b;}
int main(){
	int A,B;
	cin >> A >> B;
	if(B%A==0)cout << A+B << endl;
	else cout << B-A << endl;
	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long
int gcd(int a, int b) {
    if(a < b ) return gcd(b, a);
    else if(b == 0)return a;
    else return gcd(b, a % b);
}

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, b;
    cin >> a >> b;
    int G = gcd(a, b);
    set<int> st;
    for(int i = 2; i * i <= G; i++) {
        while(G % i == 0) {
            st.insert(i);
            G /= i;
        }
    }
    st.insert(1);
    st.insert(G);
    cout << st.size() << endl;


    return 0;
}


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

int main(void){
    int n;
    std::cin >> n;
    std::vector<int> a(n);
    for(int i = 0; i < n; i++){
        std::cin >> a[i];
    }
    int x = 0;
    for(int i = 0; i < n; i++){
        int ae = a[i];
        if(i % 2 != 0){
            ae = -ae;
        }
        x += ae;
    }
    std::cout << x << " ";
    for(int i = 0; i < n-1; i++){
        x = -x + 2 * a[i];
        std::cout << x << " ";
    }
    return 0;
}


Measured memory_bytes: 3780
X,Y,A,B,C=list(map(int,input().split()))
p=sorted(list(map(int,input().split())),reverse=True)
q=sorted(list(map(int,input().split())),reverse=True)
r=sorted(list(map(int,input().split())),reverse=True)

i=X-1
j=Y-1
k=0

ans=sum(p[:X])+sum(q[:Y])

while k<len(r):
    if i>-1 and j>-1:
        if p[i]<q[j]:
            cmin=p[i]
            i-=1
        else:
            cmin=q[j]
            j-=1
        
        if r[k]<=cmin:
            break
        ans+=r[k]-cmin
        k+=1
    elif i>-1:
        cmin=p[i]
        i-=1

        if r[k]<=cmin:
            break

        ans+=r[k]-cmin
        k+=1
    elif j>-1:
        cmin=q[j]
        j-=1

        if r[k]<=cmin:
            break

        ans+=r[k]-cmin
        k+=1
    else:
        break

print(ans)


Measured memory_bytes: 106388
N = int(input())
A = [int(x) for x in input().split()]
money = 1000
stock = 0

for i in range(N-1):
    #buy
    if A[i] < A[i+1] and money >= A[i]:
        stock = money//A[i]
        money = money % A[i]
    #sell
    if A[i] > A[i+1] and stock != 0:
        money += stock*A[i]
        stock = 0
        

ans = money + stock*A[N-1]       

print(ans) 

Measured memory_bytes: 9196
import heapq

n = int(input())
dish = []
eaten = [False for _ in range(n)] 
for i in range(n):
	a, b = map(int, input().split())
	dish.append([a+b, a, b])

dish.sort(reverse=True)
ans = 0
for i in range(n):
	if i%2 == 0:
		ans += dish[i][1]
	else:
		ans -= dish[i][2]

print(ans)

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

int main() {

    std::string s, w;

    std::cin >> w;

    int c = 0;

    for ( ;; ) {

        std::cin >> s;

        if ( s == "END_OF_TEXT" ) break;

        for ( int i = 0; i < s.size(); i++ ) {

            if ( s[i] >= 'A' && s[i] <= 'Z' ) s[i] += 'a' - 'A';
        }

        if ( s == w ) c++;
    }

    std::cout << c << std::endl;
}



Measured memory_bytes: 3180
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
unsigned long long int countDivisibles(unsigned long long int A, unsigned long long int B, unsigned long long int M) 
{ 
    // Add 1 explicitly as A is divisible by M 
    if (A % M == 0) 
        return (B / M) - (A / M) + 1; 
  
    // A is not divisible by M 
    return (B / M) - (A / M); 
}
int main() {
    unsigned long long int a,b,c,d;
    cin>>a>>b>>c>>d;
    unsigned long long int l=__gcd(c,d);
    l=(__int128)(c*d)/l;
    //cout<<l<<endl;
    unsigned long long int A=countDivisibles(a,b,c);
    unsigned long long int B=countDivisibles(a,b,d);
    unsigned long long int C=countDivisibles(a,b,l);
    A=A+B-C;
    unsigned long long int ans=(b-a+1)-A;
    cout<<ans<<endl;
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,jd=0;
void solve(){
  for(int i=1;i<10;i++){
    for(int j=1;j<10;j++){
      if(n==i*j){
        jd=1;
      }
    }
  }

  if(jd==1){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }


}



int main(){
  cin>>n;

  solve();
  return 0;
}


Measured memory_bytes: 256
import sys
readline = sys.stdin.readline

def main():
    N = int(readline())
    K = int(readline())
    X = list(map(int, readline().rstrip().split()))
    ans = 0
    for x in X:
        ans += min(x*2, abs(x-K)*2)
    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
// ABC-C.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower

using namespace std;
#define rep(i,n) for(int i=0;i<(int)n;i++)
int main(){
	int n; cin >> n;
	vector<int> B(n - 1);
	rep(i,n-1){
		cin >> B[i];
	}

	vector<int> A(n);

	rep(i,n-1){
		if (i == 0) {
			A[i] = B[i];
			A[i + 1] = B[i];
		}
		else {
			if (A[i] > B[i]) {
				A[i] = B[i];
				A[i + 1] = B[i];
				
			}
			else {
				A[i + 1] = B[i];
			}
		}
	}

	int sum = 0;
	rep(i, n) {
		sum += A[i];
	}

	cout << sum << endl;
}


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

int selectionSort(int arr[], int N) {
    int sw=0, t;
    bool flag=1;
    for (int i=0; i<N-1; i++) {
        flag=0;
        int minj=i;
        for (int j=i; j<N; j++) {
            if (arr[minj] >  arr[j]) minj=j;
        }
        t=arr[i]; arr[i]=arr[minj]; arr[minj]=t;
        if (i !=minj) {
            sw++;
            flag=1;
        }
    }
return sw;
}

        
            

int main() {
    int arr[100], sw, N;
    cin >> N;
    for (int i=0; i<N; i++) cin >> arr[i];
    
    sw=selectionSort(arr, N);
    
    for (int i=0; i<N; i++) {
        if (i>0) cout << " ";
        cout << arr[i];
    }
    cout << "\n";
    cout << sw << endl;
    
    return 0;
}


Measured memory_bytes: 3092
using System;

namespace test
{
    class Program
    {
        static void Main(string[] args){
            string sec = Console.ReadLine();
            int b = int.Parse(sec);
            int a = b / 60;
            int s = b % 60;
            int m = a % 60;
            int h = a / 60;
            Console.WriteLine("{0}:{1}:{2}",h,m,s);
		}
    }
}

Measured memory_bytes: 9112
a,b,k = map(int,input().split())

ab = [a,b]

for i in range(k):
  
  give = i%2
  if give==0:
    take=1
  else:
    take=0
  
  if ab[give]%2==1:
    ab[give] -= 1
  ab[take] += (ab[give]/2)
  ab[give] /= 2

print(int(ab[0]),int(ab[1]))
  

Measured memory_bytes: 3060
H,W,K = (int(i) for i in input().split())

# .は白
# #は黒
# K個になれば良い

master_list = []

for i in range(H):
  master_list.append(list(str(input())))

count = 0
for i in range(2**H):
  for j in range(2**W):
    K_count = 0
    bin_i = format(i,"b").zfill(H)
    bin_j = format(j,"b").zfill(W)
    for x in range(H):
      if bin_i[x] == "1":
        for y in range(W):
          if bin_j[y] =="1" and master_list[x][y] == "#":
            K_count += 1
    if K_count == K:
      count+=1

print(count)


Measured memory_bytes: 9204
using System;
using System.Collections.Generic;
using System.Linq;

public class Solution
{
    public static void Main()
    {
        var vals = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
        var N = vals[0];
        var A = vals[1];
        var B = vals[2];

        Console.WriteLine(Math.Min(A * N, B));
    }
}

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

int main(){
  ll n; cin >> n;
 vector<ll> a(200000,0);
 vector<ll> ent(n);
 rep(i,n){
   cin >> ent[i];   ll m=ent[i];
   m--;
   a[m]++;
 }
  ll sum=0;
 rep(i,200000){
   ll l=a[i]; sum+=(l*(l-1))/2;
 }
 rep(i,n){
   if(a[ent[i]-1]==0)cout << sum << endl;
   else{
     ll b=a[ent[i]-1]-1;
     cout << sum-b << endl;
   }
 }
}

Measured memory_bytes: 5760
import itertools
n, k = map(int, input().split())
p = []

vy = set()
vx = set()
for i in range(n):
    x, y = map(int, input().split())
    p.append((y,x))
    vy.add(y)
    vx.add(x)
vy = sorted(list(vy))
vx = sorted(list(vx))

min_area = float('inf')


for y in itertools.combinations(vy, r=2):
    for x in itertools.combinations(vx, r=2):
        cnt = 0
        for i in range(n):
            if y[0] <= p[i][0] <= y[1] and x[0] <= p[i][1] <= x[1]:
                cnt += 1
        if cnt >= k:
            min_area = min(min_area, (y[1]-y[0]) * (x[1]-x[0]))
print(min_area)

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

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; }

using ll = long long;
using P = pair<ll,ll>;
using graph = vector<vector<int>>;

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const ll INF = 1LL<<60;
const ll mod = 1000000007LL;

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

int main(){
    ll N,A,B;
    cin>>N>>A>>B;
    vector<ll> v(N);
    rep(i,N) cin>>v[i];
    ll l = 0LL, r = 1000000005LL;
    while(r-l>1){
        ll mid = (r+l)/2LL;
        ll cnt = 0LL;
        bool ok = true;
        rep(i,N){
            ll t = 0;
            if(v[i]-mid*B<=0) t= 0;
            else t = (v[i]-mid*B-1)/(A-B) + 1;
            if(t>mid) ok = false;
            cnt += t;
        }
        if(cnt > mid) ok = false;
        if(ok) r = mid;
        else l = mid;
    }
    cout<<r<<endl;
}

Measured memory_bytes: 4008
import bisect
import cmath
import heapq
import itertools
import math
import operator
import os
import random
import re
import string
import sys
from collections import Counter, defaultdict, deque
from copy import deepcopy
from decimal import Decimal
from functools import lru_cache, reduce
from math import gcd
from operator import add, itemgetter, mul, xor

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353





S = sys.stdin.buffer.readline().decode().rstrip()
T = sys.stdin.buffer.readline().decode().rstrip()
ok = T[:-1] == S
if ok:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 27224
#include <algorithm>
#include <bits/stdc++.h>
#include <cstdint>
#include <iostream>
#include <iterator>
#include <vector>

// lib/util.hpp
#ifndef UTIL_HPP
#define UTIL_HPP


typedef ::std::int_fast64_t i64;
typedef ::std::uint_fast64_t u64;
typedef ::std::int_fast32_t i32;
typedef ::std::uint_fast32_t u32;

namespace tools {
  template <typename T>
  void read(::std::istream& is, ::std::vector<T>& vector, const typename ::std::vector<T>::size_type size) {
    vector.reserve(size);
    ::std::copy_n(::std::istream_iterator<T>(is), size, ::std::back_inserter(vector));
  }
  template <typename T>
  void read(::std::vector<T>& vector, const typename ::std::vector<T>::size_type size) {
    ::tools::read(::std::cin, vector, size);
  }

  template <typename T, ::std::size_t N>
  void read(::std::istream& is, ::std::array<T, N>& array) {
    ::std::copy_n(std::istream_iterator<T>(is), N, array.begin());
  }
  template <typename T, ::std::size_t N>
  void read(::std::array<T, N>& array) {
    ::tools::read(::std::cin, array);
  }
}

#endif

// main.cpp

int main() {
  i64 X, Y;
  std::cin >> X >> Y;
  std::cout << std::max<i64>(4 - X, 0) * 100000 + std::max<i64>(4 - Y, 0) * 100000 + (X == 1 && Y == 1 ? 400000 : 0) << std::endl;
  return 0;
}

Measured memory_bytes: 256
n = int(raw_input())
ans = 0
for i in range(1 , n + 1):
    ans += i * (n - i + 1)
#print n , ans
for i in xrange(n - 1):
    x , y = [int(i) for i in raw_input().split(' ')]
    if x > y:
        t = x
        x = y
        y = t
    ans -= x * ( n - y + 1 )
print ans

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

int count(string M[], int i, int j,int h, int w){
    int ans=0;
    for(int a=-1;a<2;a++){
        for(int b=-1;b<2;b++){
            int x = i+a;
            int y = j+b;
            if(x >= 0 && x < h && y >= 0 && y < w){
                if(M[i+a][j+b] == '#'){
                    ans++;
                }
            }
        }
    }
    return ans;
}


int main(void){
    int h,w;
    cin >> h >> w;
    string M[50];
    for(int i=0;i<h;i++){
        cin >> M[i];
    }
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            if(M[i][j] == '.'){
                M[i][j] = '0'+count(M,i,j,h,w);
            }
        }
    }
    for(int i=0;i<h;i++){
        cout << M[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 256
N = int(input())
D = [input().split() for _ in range(N)]
ans = "No"
for i in range(N - 2):
    if D[i][0] == D[i][1]:
         if D[i + 1][0] == D[i + 1][1]:
            if D[i + 2][0] == D[i + 2][1]:
                ans = "Yes"
                break
print(ans)

Measured memory_bytes: 9128
s = list(input())

flag = True

if s[0] != 'A':
    flag = False

l = s[2:len(s)-1]

count = 0
c = 0
for i,x in enumerate(l):
    if x == 'C':
        count += 1
        c = i

if count != 1:
    flag = False

s.pop(2+c)
s.pop(0)

for x in s:
    if x not in list('abcdefghijklmnopqrstuvwxyz'):
        flag = False

if flag:
    print('AC')
else:
    print('WA')

Measured memory_bytes: 3064
S=gets.chomp.split("")
ans1,ans2=0,0
S.each_with_index do |s,i|
  if i.even? && s=='0' || i.odd? && s=='1'
    ans1+=1
  end
  if i.odd? && s=='0' || i.even? && s=='1'
    ans2+=1
  end
end
puts [ans1,ans2].min

Measured memory_bytes: 9468
#include <iostream>
#include <algorithm>
#include <math.h>
#include <cmath>
#include <stdio.h>
#include <string>
#include <string.h>
#include <cstring>
#include <sstream>
#include <iomanip>
#include <stdlib.h>

using namespace std;

int main (void)
{
	for (int u = 0; u < 100; u++)
	{
		int a[5],b[5];
		int p = 0;

		for (int i = 0; i < 5; i++)
		{
			cin >> a[i] >> b[i];
			if (a[i] == 0 && b[i] == 0)
			{
				p++;
				break;
			}
		}
		if (p != 0)
		{
			break;
		}

		int gg = 0,ggg = 0;
		for (int i = 0; i < 5; i++)
		{
			if (a[i] + b[i] > gg)
			{
				gg = 0;
				gg = a[i] + b[i];
				ggg = 0;
				ggg = i;
			}
		}


		if (ggg == 0)
		{
			cout << 'A';
		}
		else if (ggg == 1)
		{
			cout << 'B';
		}
		else if (ggg == 2)
		{
			cout << 'C';
		}
		else if (ggg == 3)
		{
			cout << 'D';
		}
		else if (ggg == 4)
		{
			cout << 'E';
		}
		cout << " " << gg << endl;
	}
}



Measured memory_bytes: 2988
import random

A,B = map(int,input().split())

count = 0

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

def is_prime3(q,k=50):
    q = abs(q)
    #計算するまでもなく判定できるものははじく
    if q == 2: return True
    if q < 2 or q&1 == 0: return False

    #n-1=2^s*dとし（但しaは整数、dは奇数)、dを求める
    d = (q-1)>>1
    while d&1 == 0:
        d >>= 1
    
    #判定をk回繰り返す
    for i in range(k):
        a = random.randint(1,q-1)
        t = d
        y = pow(a,t,q)
        #[0,s-1]の範囲すべてをチェック
        while t != q-1 and y != 1 and y != q-1: 
            y = pow(y,2,q)
            t <<= 1
        if y != q-1 and t&1 == 0:
            return False
    return True


AL = make_divisors(A)
BL = make_divisors(B)

CS = set(AL) & set(BL)

for p in CS:
    if is_prime3(p):
        count += 1

print(count + 1) # +1 は1を含めるため

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

typedef long long ll;

int main(){
    int n; cin >> n;
    string s; cin >> s;
    int ans=0, x=0;
    for(int i = 0; i < n; i++)
    {
        if(s[i]=='I') x++;
        else if(s[i]=='D') x--;
        ans = max(ans, x);
    }
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 256
N = int(input())
A = list(map(lambda x:int(x)%4, input().split()))
ans_list = []
for i in [0,1,2,3]:
  a = A.count(i)
  ans_list.append(a)
  
ans = ans_list[0] - (ans_list[1] + ans_list[3])
if ans_list[2] == 0 and ans >= -1:
  print("Yes")
elif ans_list[2] != 0 and ans >= 0:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 16944
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>

using namespace std;

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = n;i >= m;i--)
#define REPO(i, n) for(int i = 1;i <= n;i++)
#define ll long long
#define INF 1999999999
#define MINF -1999999999
#define ALL(n) n.begin(),n.end()

int main(){
	int a, b;
	cin >> a >> b;
	if (a + b >= 10) cout << "error" << endl;
	else cout << a + b << endl;
}

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


using namespace std;



int main() {
    long long r, g, b, n;
    scanf("%lld %lld %lld %lld", &r, &g, &b, &n);
    long long ans = 0;
    long long i, j, k;
    for (i=0; i<=n; i++) {
        for (j=0; j<=n; j++) {
            k = n - (i*r+j*g);
            if (k>=0 && k%b==0) {
                ans++;
                //printf("** %d %d %d\n", i, j, k/b);
            }
        }
    }
    printf("%lld\n", ans);
    return 0;
}








Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
 
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
 
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
 
#define rep(i, n)    for(int i = 0; i < (n); ++i)
#define repA(i, a, n)  for(int i = a; i <= (n); ++i)
#define repD(i, a, n)  for(int i = a; i >= (n); --i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
#define fill(a)  memset(a, 0, sizeof (a))
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
typedef long double ld;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

void pre(){


}
 
void solve(){
 
 
}

vector<pii > g[21];
vi c;
void dfs(int u){
    if(u==19) return;
    rep(i,sz(g[u])){
        int v=g[u][i].fst;
        //if(g[u][i].snd==-1) g[u][i].snd=i*c[u];
        c[v]+=c[u];
    }
    dfs(u+1);
}
void dfs2(int u){
    if(u==19) return;
    sort(all(g[u]));
    rep(i,sz(g[u])){
        if(g[u][i].fst==u+1) g[u][i].snd=i*c[u];
        else g[u][i].snd=c[g[u][i].fst]-1;
    }
    dfs2(u+1);
}


vi ans;
void chk(int u, int l){
   if(u==19) { ans.pb(l); return;}

   rep(i,sz(g[u])){
       chk(g[u][i].fst, l+g[u][i].snd);
   }
}

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

    ll l;cin>>l;
    vi v(30,0);
    int mx=-1;
    rep(i,21)if(l&(1<<i)) v[i]=1, mx=i;

    rep(i,mx) g[i].pb({i+1,-1}), g[i].pb({i+1,-1});
    repA(i,mx,18) g[i].pb({i+1,0});
    rep(i,mx)if(v[i]==1) g[0].pb({mx-i,-1});

    c.resize(25,0);
    c[0]=1;
    dfs(0);
    dfs2(0);

    int m=0;
    rep(i,21) m+=sz(g[i]);
    cout<<20<<' '<<m<<endl;
    rep(i,21)trav(it,g[i]) cout<<i+1<<' '<<it.fst+1<<' '<<it.snd<<endl;


    //chk(0, 0);
    //sort(all(ans));
    //debug(ans);

	return 0;
}
 



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

#define INF 2e9

#define REP(i,n) for(int i = 0; i < n;++i)
#define REPA(i,a,n) for(int i = a; i < n; ++i)
#define ALL(a) a.begin, a.end()

using namespace std;

int main(void) {

	int A, B, C;

	cin >> A >> B >> C;

	C = C - max(0, min(A - B, C));

	cout << C << '\n';

	return 0;
}

Measured memory_bytes: 256
import java.io.PrintWriter;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        try (InputReader in = new InputReader(); PrintWriter out = new PrintWriter(System.out)) {
            new Main().solve(in, out);
            out.flush();
        }
    }

    void solve(InputReader in, PrintWriter out) {
        int n = in.nextInt();
        int preMax = 0;
        int ans = 0;
        for (int i = 0; i < n; i++) {
            int h = in.nextInt();
            if (preMax <= h) {
                ans++;
            }

            preMax = Math.max(preMax, h);
        }
        out.println(ans);
    }
}

class InputReader implements AutoCloseable {
    private final Scanner sc = new Scanner(System.in);

    String next() {
        return this.sc.next();
    }

    int nextInt() {
        return Integer.parseInt(this.sc.next());
    }

    long nextLong() {
        return Long.parseLong(this.sc.next());
    }

    double nextDouble() {
        return Double.parseDouble(this.sc.next());
    }

    @Override
    public void close() {
        this.sc.close();
    }
}

Measured memory_bytes: 21844
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
using namespace std;
int main()
{
  string s;cin >> s;
  int p=0;int cntr=1;int cntl=0;
  vector<int> pl,num;
  rep(i,s.size()-1){
    if(s[i]!=s[i+1]){
      if(p%2==0){
	pl.push_back(i);pl.push_back(i+1);
	num.push_back(cntr);
	cntl=1;
      }
      else{
	num.push_back(cntl);
	cntr=1;
      }
      p++;
    }
    else{
      cntr++;cntl++;
    }
  }
  num.push_back(cntl);

  vector<int> res(s.size(),0);
  for(int i=0;i<pl.size();i+=2){
    res[pl[i]] = (num[i]+1)/2 + num[i+1]/2;
    res[pl[i+1]] = num[i]/2 + (num[i+1]+1)/2;
  }
  rep(i,s.size()) cout << res[i] << " ";
  cout  << "\n";

  
  return 0;
}


Measured memory_bytes: 1908
import sys
X, Y, Z, K = map(int,input().split())
A = list(map(int, sys.stdin.readline().split()))
B = list(map(int, sys.stdin.readline().split()))
C = list(map(int, sys.stdin.readline().split()))
AB = []
ans = []
for a in A:
    for b in B:
        AB.append(a + b)
AB.sort(reverse=True)
AB = AB[:min(3001, X*Y*Z+1)]
for c in C:
    for ab in AB:
        ans.append(c + ab)
ans.sort(reverse=True)
for i in range(K):
    print(ans[i])


Measured memory_bytes: 141764
#define _USE_MATH_DEFINES

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <unordered_map>

using namespace std;

typedef pair<long long int, long long int> P;
long long int INF = 1e18;

int main(){
	
	queue<string> que;
	
	unordered_map<string, int> m;
	
	string fs = "";
	
	for(int i = 0; i < 9; i++){
		string s;
		cin >> s;
		fs += s;
	}
	
	que.push(fs);
	
	for(int loop = 0; loop < 1000; loop++){
		if(que.empty()){
			break;
		}
		int sz = que.size();
		for(int num = 0; num < sz; num++){
			string str = que.front();
			que.pop();
			if(m.find(str) != m.end()){
				continue;
			}
			m[str] = loop;
			for(int i = 0; i < 9; i++){
				if(str[i] == '0'){
					if(i >= 3){
						swap(str[i], str[i - 3]);
						que.push(str);
						swap(str[i], str[i - 3]);
					}
					if(i < 6){
						swap(str[i], str[i + 3]);
						que.push(str);
						swap(str[i], str[i + 3]);
					}
					if(i % 3 > 0){
						swap(str[i], str[i - 1]);
						que.push(str);
						swap(str[i], str[i - 1]);
					}
					if(i % 3 < 2){
						swap(str[i], str[i + 1]);
						que.push(str);
						swap(str[i], str[i + 1]);
					}
				}
			}
		}
	}
	
	cout << m["123456780"] << endl;
	
	return 0;
}


Measured memory_bytes: 22884
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>

const int INF = 1000000010;

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

	int n, w;
	cin >> n >> w;
	int value_max = n*1000+1;
	int n_max = n + 1;
	int dd[n_max][value_max];

	// initialize
	for (int nn = 0; nn < n_max; nn++) {
	  for (int v = 0; v < value_max; v++) {
	    dd[nn][v] = INF;
	  }
	}

	for (int nn = 0; nn <= n; nn++) {
	  dd[nn][0] = 0;
	}
	for (int nn = 1; nn < n_max; nn++) {
	  int www, nu;
	  cin >> www >> nu;
	  for (int v = 1; v < value_max; v++) {
	    // don't use item nn-1
	    int cur = dd[nn-1][v];

	    // use item nn-1
	    if (nu <= v) {
	      int rem_v = v - nu;
	      int cand = dd[nn-1][rem_v] + www;
	      if (cand <= w && cand < cur) {
		cur = cand;
	      }
	    }

	    dd[nn][v] = cur;
	  }
	}
	bool done = false;
	for (int v = value_max-1; v >= 0; v--) {
	  if (done) {
	    break;
	  }
	  for (int nn = 0; nn < n_max; nn++) {
	    if (dd[nn][v] != INF) {
	      cout << v << '\n';
	      done = true;
	      break;
	    }
	  }
	}

	if (!done) {
	  cout << 0 << '\n';
	}
	return 0;
}


Measured memory_bytes: 39808
h,w=map(int,input().split())

s=['0'*(w+2)]

for i in range(h):
    s.append('0'+input()+'0')

s.append('0'*(w+2))


ans=[]
for i in range(1,h+1):
    tmp=[]
    for j in range(1,w+1):
        if s[i][j]=='#':
            tmp.append('#')
        else:
            tmp.append([s[i-1][j-1],s[i-1][j],s[i-1][j+1],\
            s[i][j-1],s[i][j],s[i][j+1],\
            s[i+1][j-1],s[i+1][j],s[i+1][j+1]].count('#'))
    ans.append(tmp)
for i in range(h):
    print(''.join(map(str,ans[i])))

Measured memory_bytes: 3064
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<queue>
#define mp(x,y) make_pair(x,y)
using namespace std;

typedef pair<int,int> pi;

const int N=805;

int n,m,k,dis[N][N],sx,sy,dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};
bool ma[N][N];
char str[N];
queue<pi> que;

void bfs()
{
	for (int i=1;i<=n;i++)
		for (int j=1;j<=m;j++)
			dis[i][j]=k+1;
	dis[sx][sy]=0;que.push(mp(sx,sy));
	while (!que.empty())
	{
		int x=que.front().first,y=que.front().second;que.pop();
		if (dis[x][y]==k) break;
		for (int i=0;i<4;i++)
		{
			int p=x+dx[i],q=y+dy[i];
			if (p<1||p>n||q<1||q>m||ma[p][q]||dis[p][q]<=k) continue;
			dis[p][q]=dis[x][y]+1;que.push(mp(p,q));
		}
	}
}

int get(int x)
{
	return !x?0:(x-1)/k+1;
}

int main()
{
	scanf("%d%d%d",&n,&m,&k);
	for (int i=1;i<=n;i++)
	{
		scanf("%s",str+1);
		for (int j=1;j<=m;j++)
			if (str[j]=='S') sx=i,sy=j;
			else if (str[j]=='#') ma[i][j]=1;
	}
	bfs();
	int ans=n*m;
	for (int i=1;i<=n;i++)
		for (int j=1;j<=m;j++)
			if (dis[i][j]<=k) ans=min(ans,min(get(i-1),min(get(j-1),min(get(n-i),get(m-j))))+1);
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 3456
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <limits>


int main() {
    int n;
    scanf("%d", &n);
    int pre = n + 1;
    int cnt = 0;
    for (int i = 0; i < n; ++i) {
        int cur;
        scanf("%d", &cur);
        if (cur == pre) {
            cnt++;
            pre = n + 1;
        } else
            pre = cur;

    }
    printf("%d", cnt);
    return 0;
}

Measured memory_bytes: 128
/*
Author-> Codie_1(Akash)
*/
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define rep(n) for(int i=0;i<n;i++)
#define repi(n) for(int i=0;i<n;i++)
#define repj(n) for(int j=0;j<n;j++)
#define repp(n) for(int i=0;i<=n;i++)
#define repab(a,b) for(int i=a;i<b;i++)
#define w(t) int t; cin>>t; while(t--)
#define endl '\n'
#define ff first
#define ss second
#define pb push_back
#define mk make_pair
#define vi vector<int> v
#define vl vector<long long> v;
typedef long long ll;



int main()
{
	fast
	int n,k;
	cin>>n>>k;
	int arr[n];
	rep(n) cin>>arr[i];
	sort(arr,arr+n);
	int sum=0;
	rep(k) sum+=arr[i];
	cout<<sum;


	return 0;
}

Measured memory_bytes: 3536
/*
 * ProblemaB.cxx
 * 
 * Copyright 2019 Visita <visita@lab20>
 * 
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 * MA 02110-1301, USA.
 * 
 * 
 */


#include <iostream>
#include <algorithm>
#include <cstdio>
#include <map>
using namespace std;
typedef long long intl;
intl in[200000], P2 = 1;
int main(int argc, char **argv)
{
	P2 = (intl(1)<<32);
	int N;
	cin>>N;
	map<intl,int> mapa;
	for(int i = 0;i<N;i++)
	{
		intl a;
		scanf("%lld",&a);
		mapa[a]++;
	}
	auto k = mapa.end();
	k--;
	int R = 0;
	while(k!=mapa.begin())
	{
		intl n = k->first, c = k->second;
		while(n*2<P2)
			P2/=2;
		intl v = P2-n;
		if(n*2 == P2)
		{
			R += c/2;
		}
		else if(mapa.count(v))
		{
			
			int m = min(c,intl(mapa[v]));
			R+=m;
			mapa[v] -= m;
		}
		k->second = 0;
		k--;
	}
	intl n = k->first, c = k->second;
		while(n*2<P2)
			P2/=2;
		intl v = P2-n;
		if(n*2 == P2)
		{
			R += c/2;
		}
		else if(mapa.count(v))
		{
			
			int m = min(c,intl(mapa[v]));
			R+=m;
			mapa[v] -= m;
		}
		k->second = 0;
		k--;
	cout<<R<<endl;
	return 0;
}



Measured memory_bytes: 12800
#include <bits/stdc++.h>
using namespace std;
int main() {
string s;
cin >> s;
unordered_map<string,string>  m;
m["Sunny"] = "Cloudy";
m["Cloudy"] = "Rainy";
m["Rainy"] = "Sunny";
cout << m[s];


}









  

Measured memory_bytes: 256
N,T=map(int,input().split())
A=list(map(int,input().split()))

MAX=[A[-1]]

for i in range(N-2,-1,-1):
    MAX.append(max(MAX[-1],A[i]))

MAX=MAX[::-1]
SABUN=[MAX[i]-A[i] for i in range(N)]

#print(MAX)
#print(SABUN)
MAXSA=max(SABUN)

ANS=0
for i in range(N):
    if SABUN[i]==MAXSA:
        ANS+=1

print(ANS)

Measured memory_bytes: 14252
#include <bits/stdc++.h>
// Hey! 僕の提出を見てくれてありがとう.
// ロボ子さん可愛いぞ！！！！！君もV沼にはまろう↓
// https://www.youtube.com/channel/UCDqI2jOz0weumE8s7paEk6g
using namespace std;
/*
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
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>;
*/
using ll = long long;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}//a,bの最大公約数(gcd)を求める
ll lcm(ll a,ll b){return abs(a*b)/gcd(a,b);}//a,bの最小公倍数(lcm)を求める
vector<ll> enum_div(ll n){vector<ll> ret;for(int i=1 ; i*i<=n ; i++){if(n%i == 0){ret.push_back(i);if(i!=1 && i*i!=n)ret.push_back(n/i);}}ret.push_back(n);return ret;}
//↑nの約数を求める
vector<bool> IsPrime; void sieve(size_t max){if(max+1 > IsPrime.size())IsPrime.resize(max+1,true);IsPrime[0] = false;IsPrime[1] = false;for(size_t i=2; i*i<=max; ++i)if(IsPrime[i])for(size_t j=2; i*j<=max; ++j)IsPrime[i*j] = false;}
//↑エラトステネスの篩で素数を求める
#define roundup(divisor,dividend) (divisor + (dividend - 1)) / dividend //切り上げ割り算
#define all(x) (x).begin(),(x).end() //xの初めから終わりまでのポインタ
#define size_t ll //size_tは自動でllに変換される
#define pb(x) push_back(x)
#define pri_queue priority_queue //優先度付きキュー
#define syo(x) fixed << setprecision(x) //iostreamで小数をx桁表示
//sortを降順にする時は greater<型>()
ll ans=0,maxs = LLONG_MIN,mins = LLONG_MAX,n;
int main(){ //srand((unsigned)time(NULL));
  cin >> n;
  for (int i = 0; i < n; i++) {
    ll x;
    cin >> x;
    ans += x;
    maxs = max(maxs,x);
    mins = min(mins,x);
  }
  cout << mins << " " << maxs << " " << ans << endl;
}



Measured memory_bytes: 3108
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main
{
    public static void main(String[] args)
    {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskD solver = new TaskD();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskD
    {
        static int MOD = 1_000_000_000 + 7;
        int memo[];

        public void solve(int testNumber, Scanner in, PrintWriter out)
        {
            int T = 1;
            while (T-- > 0)
            {
                solveOne(in, out);
            }
        }

        private void solveOne(Scanner in, PrintWriter out)
        {
            int N = in.nextInt();
            memo = new int[N + 10];
            Arrays.fill(memo, -1);
            out.println(dp(N));
        }

        private int dp(int n)
        {
            if (n == 0) return 1;
            if (n < 0) return 0;
            if (memo[n] != -1) return memo[n];

            int ans = 0;
            for (int num = 3; num <= n; num++)
            {
                ans = (ans + dp(n - num)) % MOD;
            }
            memo[n] = ans;
            return ans;
        }

    }
}



Measured memory_bytes: 27320
def fib(n):
    a,b = 0,1
    for i in range(n):
        a, b = b, a+b
    return int(b)

N, M = map(int,input().split())

if M == 0:
    print(fib(N) % (10**9 + 7))
    exit()

A = [int(input()) for _ in range(M)]
L = [0] * (M+1)

ans = 1

L[0] = fib(A[0]-1) % (10**9 + 7)
L[M] = fib(N-(A[M-1]+1)) % (10**9 + 7)

for i in range(1,M):
    if A[i]-A[i-1] == 1:
        print(0)
        exit()
    L[i] = fib((A[i]-1)-(A[i-1]+1)) % (10**9 + 7)

for j in range(M+1):
    ans = (ans * L[j]) % (10**9 + 7)

print(ans)


Measured memory_bytes: 7844
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <math.h>
#include <numeric>
#include <set>
#include <list>
#include <bitset>
using namespace std;

int main()
{
    string S, T;
    cin >> S >> T;
    bool flag = false;
    for (int i = 0; i < S.size(); i++)
    {
        S.insert(S.begin(), S[S.size() - 1]);
        S.pop_back();
        if (S == T)
        {
            flag = true;
            break;
        }
    }
    if (flag)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }

    return 0;
}

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


int main() {
	string s;
	cin >> s;
	int a[10] = {};

	int length = s.length();
	int bit_max = 1 << (length - 1);

	for (int i = 0; i < length; i++) {
		a[i] = s.at(i) - '0';
	}

	long long total = 0;
	long long current = 0;

	for (int i = 0; i < bit_max; i++) {
		int currentBit = i;
		current = a[0];
		

		for (int p = 1; p < length ; p++) {
			if ((currentBit & 1) == 0) { 
				current =  current * 10 + a[p];
			} else {
				total += current;
				current = a[p];
			}
			currentBit = currentBit >> 1;
		}
		total += current;

	}

	cout << total << endl; 


	return 0;
}


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

int main(){
    string s;
    cin>>s;
    string ans="Good";
    rep(i,3){
        if(s[i]==s[i+1])ans="Bad";
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 256
using System;
 
class Program{
  static void Main(){
    
    string[] nk = Console.ReadLine().Split(' ');
    string str = Console.ReadLine();
    char[] cs = str.ToCharArray();
    
    int n=int.Parse(nk[0]);
    int k=int.Parse(nk[1]);
    
    cs[k-1]=Char.ToLower(cs[k-1]);
    
    for(int i=0;i<n;i++){
    Console.Write(cs[i]);
    }
  }
}

Measured memory_bytes: 27428
#![allow(non_snake_case)]
use proconio::input;
// use std::collections::HashMap;

fn main() {
    input! {
        N: i32,
    }

    if N / 100 == 7 || (N / 10) % 10 == 7 || N % 10 == 7 {
        println!("Yes");
    } else {
        println!("No");
    }

}


Measured memory_bytes: 2012
import java.util.*;

class Main
{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int x = Integer.parseInt(sc.next());
		int a = Integer.parseInt(sc.next());
		
		if(x < a) System.out.println(0);
		else System.out.println(10);
	}
}

Measured memory_bytes: 22228
import copy
H, W, K = map(int, input().split())
lst = []
num = 0
for i in range(H):
    arrange = input()
    num += arrange.count('#')
    lst.append(arrange)
# print(num)
count = 0

for i in range(2**H):
    # print("初期化")
    rlst = copy.copy(lst)
    counted = 0
    rstr = str(format(i, '0' + str(H) + 'b'))
    # print("rstr:" + rstr)
    while '1' in rstr:
        index = rstr.find('1')
        counted += rlst[index].count('#')
        rlst[index] = "." * W
        rstr = rstr.replace('1','0',1)
    # print(counted)
    for j in range(2**W):
        ccounted = counted
        clst = copy.copy(rlst)
        cstr = str(format(j, '0' + str(W) + 'b'))
        # print("cstr:" + cstr)
        while '1' in cstr:
            index = cstr.find('1')
            dlst = ""
            for k in range(H):
                dlst += clst[k][index]
                clst[k] = clst[k][:index] + '.' + clst[k][index+1:]
            ccounted += dlst.count("#")
            cstr = cstr.replace('1','0',1)
        # print(clst)
        # print(str(num-ccounted))
        if num - ccounted == K:
            count += 1

print(count)

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

int main()
{
    int n;
    cin >> n;
    vector<int> h(n);
    rep(i,n) cin >> h[i];

    int prev = h[0];
    int ans = 0;
    int tmp = 0;
    rep2(i,1,n)
    {
        if(h[i] > prev)
        {
            ans = max(ans, tmp);
            tmp = 0;
        }
        else        
            ++tmp;

        prev = h[i];      
    }
    ans = max(ans, tmp);

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

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

using ll = long long;
using vi = vector<int>;
using vi2 = vector<vector<int>>;
#define MP(a,b) make_pair((a),(b))
#define MT(...) make_tuple(__VA_ARGS__)

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)

#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl;
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl;
#define gcda(x,y) gcd(abs(x),abs(y))

#define DCOUT(x,n) cout << fixed << setprecision(n) << (x) << endl;

#define sz(x) (int)(x).size()
#define HOGE cout << "hoge" << endl;
using P = pair<ll,ll>;

template<typename T>inline istream& operator>>(istream&i,vector<T>&v)
{REP(j,sz(v))i>>v[j];return i;}

const int INF = 1e9;

int main(){
    ll n;
    cin >> n;
    vector<ll> a(n);
    REP(i,n) cin >> a[i];
    ll x = 0;
    REP(i,n) x ^= a[i];
    REP(i,n){
        ll ans = x ^ a[i];
        cout << ans;
        if(i==n-1) break;
      	cout << " ";
    }
  	cout << endl;
}


Measured memory_bytes: 4820
#include<iostream>
#include<algorithm>
#include<string>
#include<map>
#include<cmath>
#include<iomanip>
#include<math.h>
#define rep(i, n) for(int i=0; i<n; i++)
using namespace std;
typedef long long ll;
#define INF 1000000000000000LL

int main(){
    ll N; cin >> N;
    ll a[N+1];
    ll node = 0;
    rep(i, N+1){
        cin >> a[i];
    }
    ll c[N+2];
    c[0] = 1;
    
    for(int i=0; i<N+1; i++){
        ll m = 2LL*(c[i]-a[i]);
        // cout << a[i] << endl;
        // cout << "c[" << i << "] = " << c[i] << endl;
        if(m < 0){
            cout << -1 << endl;
            return 0;
        }
        c[i+1] = min(INF,m);
    }

    node += a[N];
    ll now = a[N];
    
    // cout << "now "<< now << endl;
    for(int i=N-1; i>-1; i--){
        now += a[i];
        if(now < c[i]){
            node += now;
        }else{
            node += c[i];
        }
        // cout << "now "<< now << endl;
    }
    cout << node << endl;
}

Measured memory_bytes: 5116
void main() {
	auto ip2 = readAs!(int[]), A = ip2[0], B = ip2[1];
	writeln(A*B);
}

// ===================================

import std.stdio;
import std.string;
import std.functional;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.container;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

long rl() {
	return readAs!long;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}

Measured memory_bytes: 2740
n, m=map(int, input().split())
a=[]
b=[]
g=[]
for i in range(n):
  g.append([])
for i in range(m):
  ai, bi=map(int, input().split())
  ai-=1
  bi-=1
  g[ai].append(bi)
  g[bi].append(ai)
  a.append(ai)
  b.append(bi)
used=[]
for i in range(n):
  used.append(False)
dame1=0
dame2=0
def dfs(x):
  used[x]=True
  for y in g[x]:
    if dame1==x and dame2==y:
      continue
    if not used[y]:
      dfs(y)
  return
ans=0
for i in range(m):
  for j in range(n):
    used[j]=False
  dame1=a[i]
  dame2=b[i]
  dfs(a[i])
  if not used[b[i]]:
    ans+=1
print(ans)

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

using namespace std;

const int N = 200010;
const long long INF_LL = (1ll << 60);

int a[N], n;
long long s[N];

int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", a + i);
    s[i] = s[i - 1] + a[i];
  }
  long long res = INF_LL;
  for (int i = 1; i < n; i++) {
    res = min(res, abs(s[n] - s[i] * 2));
//    cout << s[n] << " " << s[i] << endl;
  }
  cout << res << endl;
  return 0;
}


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

int main() {

    int n;
    cin >> n;
    vector<int> vec(n);

    rep(i, n){
        cin >> vec.at(i);
    }
    sort(vec.begin(), vec.end());
    reverse(vec.begin(), vec.end());

    int x = 0;
    for(int i = 1; i < n; i++){
        x += vec.at(i);
    }
    if(vec.at(0) < x){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

}


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

#ifdef LOCAL
#define debug(var) cerr << (#var) << " = " << (var) << endl;
#else
#define debug(var)
#endif

void init() {
  ios_base::sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
}

const int N = 1e5+23;

int a[N];

void solve() {
  int n; scanf("%d", &n);
  int neg = 0, zeros = 0;
  long long sum = 0;
  for (int i = 0; i < n; ++i) {
    scanf("%d", a+i);
    if (a[i] < 0) ++neg;
    if (a[i] == 0) ++zeros;
    sum += abs(a[i]);
  }
  int m = 2e9;
  if (zeros) --neg;
  if (neg % 2) {
    for (int i = 0; i < n; ++i) {
      m = min(m, abs(a[i]));
    }
  }
  if (m == 2e9) m = 0;
  printf("%lld", sum-2*m);
}

int main() {
  init();
  int t = 1; //scanf("%d", &t);
  while (t--) {
    solve();
  }
  return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pi;
typedef vector<ll> vi;
typedef vector<pi> vpi;
typedef long double ld;
const int inf = 1e9 + 7;
const int mod = 1e9 + 7;
const int maxn = 1e6 + 3;
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define rep(i, a, b) for(int i = a; i < b; i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define lb lower_bound
#define ub upper_bound
#define fact(n) rep(i, 1, n+1)ft.pb((ft[i-1]*i)%mod);
#define mod_in(a) exp(a, mod-2)
#define ncr(n, r) ((ft[n]*mod_in((ft[r]*ft[(n)-(r)])%mod))%mod)
#define deb(x) cout << #x << " " << x << endl;
#define flash ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl '\n'
ll prime[100002];
ll exp(ll a,ll b);
void sieve(ll n);
ll gcd(ll a ,ll b);
ll countdigit(ll n);

void solve(){
    ll n,k,ans=-1e12;
    cin >> n ;
    if(n==1){
        cout<<"0";
    }
    else {
        cout<<"1";
    }
}
int main()
{
    ll t=1;
    //cin >> t;
    while(t--) {
        solve();
    }
}

//
//
//
//
//
// IMPORTANT FUNCTIONS
ll exp(ll a, ll b) {
	int res=1;
	while(b) {
		if(b&1)
			res=(res*a)%mod;
		a=(a*a)%mod;
		b>>=1;
	}
	return res;
}
ll gcd(ll a,ll b){
    if(a==0)return b;
    return gcd(b%a,a);
}
void sieve(ll n) {
    for(ll i=0;i<=n;i++) {
        prime[i]=1;
    }
    prime[0]=0;prime[1]=0;
    for(ll i=2;i<=n;i++) {
        if(prime[i]==1) {
            for(ll j=2;i*j<=n;j++) {
                prime[i*j]=0;
            }
        }
    }
}
ll countdigit(ll  n)
{
    return floor(log10(n) + 1);
}


Measured memory_bytes: 3616