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

int main() {
  int A,B,m,ans=200005,price;
  cin>>A>>B>>m;
  vector<int>a(A),b(B);
  for(int i=0; i<A; i++) cin>>a[i];
  for(int i=0; i<B; i++) cin>>b[i];
  for(int i=0; i<m; i++){
    int x,y,c; cin>>x>>y>>c;
    price = a[x-1]+b[y-1]-c;
    ans = min(ans,price);
  }
  sort(a.begin(),a.end());
  sort(b.begin(),b.end());
  ans = min(ans,a[0]+b[0]);
  cout<<ans;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF=1e9,MOD=1e9+7,ohara=1e6+10;
const ll LINF=1e18;
using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl
#define doublecout(a) cout<<fixed<<setprecision(15)<<a<<endl;
#define Cerr(x) cerr<<(x)<<endl
#define fi first
#define se second
#define P pair<ll,ll> 
#define m_p make_pair
#define V vector<ll> 
#define U_MAP unordered_map<ll,ll>

ll n,cnt,ans,a,b,c,d,tmp,tmpp,m,h,w,x,y,sum,pos,k;
ld doua;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl;
struct edge{int to,cost;};

//-------------------------↓↓↓↓↓↓------------------------

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

    cin>>n>>h>>w;
    rep(i,n){
        cin>>a>>b;
        if(h<=a&&w<=b)ans++;
    }
    Cout(ans);
    return 0;
}


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

using namespace std;

int main()
{
  uint64_t N, K;
  cin >> N >> K;
  
  vector<int64_t> x(N);
  for (uint64_t n = 0; n < N; ++n) {
    cin >> x[n];
  }
  
  vector<int64_t> s(N - K + 1, 0);
  for (uint64_t i = 0; i <= N - K; ++i) {
    s[i] = (x[i + K - 1] - x[i]) + std::abs(x[i]);
  }
  
  vector<int64_t> y(x);
  reverse(y.begin(), y.end());
  
  vector<int64_t> t(N - K + 1, 0);
  for (uint64_t i = 0; i <= N - K; ++i) {
    t[i] = (y[i] - y[i + K - 1]) + std::abs(y[i]);
  }
  
  int64_t min = INT64_MAX;
  for (uint64_t i = 0; i <= N - K; ++i) {
    min = std::min(s[i], min);
  }
  for (uint64_t i = 0; i <= N - K; ++i) {
    min = std::min(t[i], min);
  }
  
  cout << min << endl;
  
  return 0;
}

Measured memory_bytes: 2560
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<string>
#include<vector>
#include<stack>
#include<bitset>
#include<cstdlib>
#include<cmath>
#include<set>
#include<list>
#include<deque>
#include<map>
#include<queue>
using namespace std;
typedef long long ll;

int main(){
    int t;
    while(cin>>t){
        if(t>=30){
            cout<<"Yes"<<endl;
        }else{
            cout<<"No"<<endl;
        }
    }
    return 0;
}

Measured memory_bytes: 3620
from collections import deque
from heapq import heapify,heappop,heappush,heappushpop
from copy import copy,deepcopy
from itertools import product,permutations,combinations,combinations_with_replacement
from collections import defaultdict,Counter
from bisect import bisect_left,bisect_right
from math import gcd,ceil,floor,factorial
# from fractions import gcd
from functools import reduce
from pprint import pprint
from statistics import mean,median,mode
import sys
sys.setrecursionlimit(10 ** 6)

INF = float("inf")

def mycol(data,col):
    return [ row[col] for row in data ]

def mysort(data,col,reverse=False):
    data.sort(key=lambda x:x[col],reverse=reverse)
    return data

def mymax(data):
    M = -1*float("inf")
    for i in range(len(data)):
        m = max(data[i])
        M = max(M,m)
    return M

def mymin(data):
    m = float("inf")
    for i in range(len(data)):
        M = min(data[i])
        m = min(m,M)
    return m

def mycount(ls,x):
    # lsはソート済みであること
    l = bisect_left(ls,x)
    r = bisect_right(ls,x)
    return (r-l)

def mydictsort(dict,reverse=False):
    return sorted( dict.items(), reverse=reverse )

def myoutput(ls,space=True):
    if space:
        if len(ls)==0:
            print(" ")
        elif type(ls[0])==str:
            print(" ".join(ls))
        elif type(ls[0])==int:
            print(" ".join(map(str,ls)))
        else:
            print("Output Error")
    else:
        if len(ls)==0:
            print("")
        elif type(ls[0])==str:
            print("".join(ls))
        elif type(ls[0])==int:
            print("".join(map(str,ls)))
        else:
            print("Output Error")

def I():
    return int(input())

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

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

def CI(n):
    return [ int(input()) for _ in range(n) ]

def LI(n):
    return [ list(map(int,input().split())) for _ in range(n) ]

def S():
    return input()

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

def RS():
    return list(input())

def CS(n):
    return [ input() for _ in range(n) ]

def LS(n):
    return [ list(input()) for _ in range(n) ]

ddict = defaultdict(lambda: 0)
# ddict = defaultdict(lambda: 1)
# ddict = defaultdict(lambda: int())
# ddict = defaultdict(lambda: list())
# ddict = defaultdict(lambda: float())

n = I()
a = RI()

for i in range(n):
    ddict[ a[i] ] += 1

d = mydictsort(ddict,reverse=True)
# print(d)

h = 0
w = 0
for i in range(len(ddict)):
    if d[i][1]>=4:
        if h==0:
            h = d[i][0]
            print(h*h)
            exit()
    if d[i][1]>=2:
        if h==0:
            h = d[i][0]
        elif w==0:
            w = d[i][0]

if h!=0 and w!=0:
    print(w*h)
else:
    print(0)

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

int main(){
  int x;
  cin>>x;
  int s=1;
  for(int i=1;i<10;i++){
    if(x%i==0 && x/i<10){
      s=0;
      break;
    }
  }
  if(s==0){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }

  
}


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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a, b;
  int ans = 0;
  cin >> a >> b;
  if(a < b)
    swap(a, b);
  ans += a;
  a--;
  if(a < b)
    swap(a, b);
  ans += a;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
/*                        _
                       _oo0oo_
                      o8888888o
                      88" . "88
                      (| -_- |)
                      0\  =  /0
                   ____/`---'\____
                  /  \\|     |//  \
                 / \\||| /:\ |||// \
                / _||||| -:- |||||- \
               |   | \\\ \-/ /// |   |
               | \_|  ''\---/''  |_/ |
               \  .-\__  '-'  ___/-. /
            ____'. .'  /--.--\  `. .'_____
          /"" '<  `.___\_<|>_/___.' >' "" \
         | | :  `- \`.;`\ _ /`;.`/ - ` : | |
         \  \ `_.   \_ __\ /__ _/   .-` / _/
          `-.____`.___ \_____/___.-`___.-'

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 JENISH MONPARA S.    IIT PATNA    I_LOVE_ADITI_GOEL
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define LIM 100005


#define fio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define mpq priority_queue<int,vector<int>,greater<int>>
#define deb(a) cerr << #a << ": " << a << endl
#define ftt cin>>t;for(int tt=1;tt<=t;++tt)
#define forr(i,n) for((i)=1;(i)<=(n);(i)++)
#define Rev(v) reverse(v.begin(),v.end())
#define Sort(v) sort(v.begin(),v.end())
#define mem(a,b) memset(a,b,sizeof(a))
#define umii unordered_map<int,int>
#define all(a) a.begin() , a.end()
#define vvi vector<vector<int>>
#define pq priority_queue<int>
#define sqr(a) (((a) * (a)))
#define double long double
#define dbg cout<<"\nhi\n"
#define pii pair<int,int>
#define mii map<int,int>
#define vb vector<bool>
#define eb emplace_back
#define vi vector<int>
#define nl cout<<"\n"
#define pb push_back
#define int long long
#define sp <<" "<<
#define se second
#define fi first
 
int fpow(int x,int y,int m) {
     int temp;
     if( y == 0 || x == 1)
          return 1;
     temp = fpow(x, y/2,m);
     if (y % 2 == 0)
          return ((temp)*(temp)) % m;
     else
          return (((x) % m)*((temp*temp) % m)) % m;
}
int gcd(int a,int b)
{
    if(b == 0)return a;
    return gcd(b,a % b);
}
void sieve(int n)
{
     bool prime[5*LIM];
     memset(prime, true, sizeof(prime));
      int rootn = (int)sqrt(n);
     for (int p = 2; p <= rootn; p++)
          if (prime[p] == true)
               for (int i = p*p; i <= n; i += p)
                    prime[i] = false;
     prime[1] = 0;

}

int cnt, sum, mid, mx = -1e17, mn = 1e17, a[2*LIM];
int n, m, d, t, i, j, k, l, r, x, y, z;
bool f, f1, f2;
string s;

//*************************************************************************************************************************


int32_t main()
{     fio;
      char c;
      cin>>c;
      if(c<='Z'&&c>='A')
      {
            cout<<'A';
      }
      else
            cout<<'a';
     
}


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

using namespace std;

#define sqr(x) ((x) * (x))
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()

typedef long long ll;

const int MOD = 1000000007;
const int INF = 1000000007;
const ll INFLL = 1000000000000000007LL;

void solve() {
  int N;
  cin >> N;
  vector<pair<int, int>> es;
  vector<vector<int>> G(N);
  for (int i = 0; i < N - 1; i++) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    es.emplace_back(a, b);
    G[a].emplace_back(b);
    G[b].emplace_back(a);
  }
  int K = 0;
  map<pair<int, int>, int> ans;
  vector<int> used(N, 0);
  vector<int> cs(N, 0);
  queue<int> que;
  que.emplace(0);
  used[0] = 1;
  while (!que.empty()) {
    int v = que.front();
    que.pop();
    int cur = 1;
    for (int u : G[v]) {
      if (used[u]) continue;
      if (cs[v] == cur) cur++;
      cs[u] = ans[make_pair(u, v)] = ans[make_pair(v, u)] = cur++;
      K = max(cs[u], K);
      used[u] = 1;
      que.emplace(u);
    }
  }
  cout << K << endl;
  for (auto e : es) cout << ans[e] << endl;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  // cout << fixed << setprecision(12);

  solve();

  return 0;
}


Measured memory_bytes: 20088
import java.util.Scanner;

public class Main {
	public static void main(String [] args) {
		Scanner stdIn = new Scanner(System.in);
		int n = stdIn.nextInt();
		
		for(int i = 1; i <= n; i++) {
			 if (i % 3 == 0 || Integer.toString(i).contains("3")) {
		            System.out.print(" " + i);
		        } 
		}
		System.out.println();
	}
}


Measured memory_bytes: 29324
fun main(args: Array<String>) {
  val N = readInt()
  val AN = readInts()

  var cnt = 0L
  val map = hashMapOf<Int, Int>()
  for (i in AN.indices) {
    val a = AN[i]
    cnt += map.get(i - a) ?: 0
//    println(cnt)
    val v = map.get(a + i)
    map[a + i] = (v ?: 0) + 1
//    println(map)
  }
  println(cnt)
}

fun readString() = readLine()!!
fun readStrings() = readString().split(" ")
fun readInt() = readString().toInt()
fun readLong() = readString().toLong()
fun readInts() = readStrings().map { it.toInt() }
fun readLongs() = readStrings().map { it.toLong() }


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

string n;
int m = 0, w = 0, t = 0;

int main()
{
	cin >> n;
	
	int j = n.size();

	for (int i = j - 1; i >= 0; i--) {

		int k = n[i] - '0' + w;

		if (k < 6) {
			m += k - t;

			if (k == 5 && t == 0) {
				w = 1;
				t = 1;
			}
			else {
				w = 0;
				t = 0;
			}
		}
		else {
			m += 10 - k;
			w = 1;
			t = 0;
		}
	}

	if (n[j - 1] == '5' && t == 1)
		w = 0;

	cout << m + w << endl;

	return 0;
}

Measured memory_bytes: 1412
#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/STACK:256000000")
#define _USE_MATH_DEFINES
#include<iostream>
#include<vector>
#include<string>
#include<stack>
#include<algorithm>
#include<cmath>
#include<set>
#include<queue>
#include<sstream>
#include<utility>
#include<map>
#include<ctime>
#include<cstdio>
#include<cassert>
#include<functional>
#include<unordered_map>
#include<deque>
#include<cmath>





using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef pair<char, char> pcc;
typedef pair<double, double> pdd;

#define show(x) cerr << x
#define debug(x) show(#x << ": " << (x) << endl)

const long double PI = 3.14159265358979323846;
const long double eps = 1e-5;
const ll INF = numeric_limits<int>::max();
const ll LINF = numeric_limits<ll>::max();
//const ll mod = 1000 * 1000 * 1000 + 7;




void solve() {
    vector<int> c(101, 0);
    int res = 0;
    for (int i = 0; i < 3; ++i) {
        int x;
        cin >> x;
        if (c[x] == 0)
            ++res;
        ++c[x];
    }
    cout << res << endl;

}


//#define LOCAL

int main() {
    ios_base::sync_with_stdio(0);cin.tie(nullptr);cout.tie(nullptr);
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    solve();



#ifdef LOCAL
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif	
    return 0;
}


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

const int MAX = 210000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];
void COMinit(){
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for(int i = 2; i < MAX; i++){
        fac[i] = fac[i-1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
        finv[i] = finv[i-1] * inv[i] % MOD;
    }
}
long long COM(int n, int k){
    if(n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n-k] % MOD) % MOD;
}

int main() {
    COMinit();
    int n; cin >> n;
    vector<int> a(n+1);
    map<int,int> alr;
    int left = -1, right = -1;
    for (int i = 0; i < n+1; ++i) {
        cin >> a[i];
        if (alr.count(a[i])) left = alr[a[i]], right = i;
        else alr[a[i]] = i;
    }

    for (int k = 1; k <= n+1; ++k) {
        long long res = 0;
        res = (res + COM(n+1, k)) % MOD;
        res = (res - COM(left + n-right, k-1) + MOD) % MOD;

        cout << res << endl;
    }
}



Measured memory_bytes: 11264
#include<iostream>
using namespace std;
int main()
{
	int a,b,z,ans;
	while(cin >> a >> b){
		ans = a+b;
		z = 0;
		while(1){
			z++;
			if(ans / 10 == 0){
				break;
			}
			ans = ans / 10;
		}
		cout << z << endl;
	}
	return 0;
}

Measured memory_bytes: 0
INF = 999999999999999999L
EPS = 1e-12

def read():
    return raw_input().strip()

def read_ints():
    return map(int,read().split())

def get_digits(N):
    digs = []
    while N > 0:
        digs.append(N%10)
        N /= 10 
    digs.reverse()
    return digs
        
N = int(read())
digits = get_digits(N)
a1 = sum(digits)
digits = [digits[0]-1] + [9]*(len(digits)-1)
#print digits
a2 = sum(digits)
print max(a1,a2)

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

using namespace std;

typedef long long ll;

const int INF = 1000000000;

int main()
{
  vector<int> v(3);
  scanf("%d %d %d", &v[0], &v[1], &v[2]);
  sort(v.begin(), v.end());
  int K; scanf("%d", &K);
  for (int i = 0; i < K; ++i) {
    v[2] *= 2;
  }
  int ans = v[0] + v[1] + v[2];
  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <iterator>
#define loop(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define debug(x)  cout << #x << " = " << (x) << endl;

using namespace std;
using LL = long long;
using ULL = unsigned long long;

int main() {
    int n; cin >> n;
    map<int, int> m;
    rep(i, n) { int a; cin >> a; ++m[a]; }

    int mini = m.begin()->first;
    int maxi = m.rbegin()->first;

    int ans = 0;
    for (int i = mini - 1; i <= maxi + 1; i++) {
        ans = max(ans, m[i] + m[i - 1] + m[i + 1]);
    }
    cout << ans << endl;
}


Measured memory_bytes: 4992
#include<bits/stdc++.h>
using namespace std;
#define T top()
#define E end()
#define PS push
#define Q queue
#define PP pop()
#define L0 (LL)0
#define V vector
#define ST stack
#define FI first
#define MAX 4e18
#define MIN -MAX
#define DQ deque
#define RE rend()
#define SZ size()
#define C clear()
#define B begin()
#define F front()
#define SE second
#define DL double
#define G getline
#define IN insert
#define endl "\n"
#define EM empty()
#define EE emplace
#define RB rbegin()
#define MD 1000000007
#define PSB push_back
#define PI acos(-1.00)
#define PPB pop_back()
#define PSF push_front
#define ub upper_bound
#define lb lower_bound
#define PPF pop_front()
#define EB emplace_back
#define LL long long int
#define PQ priority_queue
#define N cout<<"NO"<<endl
#define Y cout<<"YES"<<endl
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define file freopen("input.txt","r",stdin);freopen("output.txt","w",stdout)
#define UOSMOY v.C;w.C;ww.C;uu.C;uo.C;vo.C;vu.C;ab.C;bc.C;cc.C;uuu.C;a.C;b.C;c.C;u.C
V<LL>v;
V<LL>w,ab,bc;
set<LL>uo;
map<LL,LL>ww,cc,u;
V<pair<LL,LL> >uu;
map<LL,V<LL> >uuu;
map<pair<LL,LL>,LL> vo;
map<pair<LL,LL>,LL> vu;
LL dxx[]= {-1,0,1,0};
LL dyy[]= {0,1,0,-1};
LL dx[]= {2,1,-1,-2,-2,-1,1,2};
LL dy[]= {1,2,2,1,-1,-2,-2,-1};
int main()
{
//  BRR;
//  file;
    FAST;
    char ch;
    string a,b,c;
    DL x,y,d,e,f,g,h;
    LL n,m,i,j,k,p,q,o,l,s,tt=1,t,z,aa,r=0;
//    cin>>tt;
    while(tt--)
    {
        UOSMOY;
       cin>>a>>b;
       l=b.SZ;
       o=a.SZ;
       k=MAX;
       for(i=0;i<=o-l;i++)
       {
           z=0;
           for(j=i,p=0;j<i+l;j++,p++)
           {
              if(a[j]!=b[p])
              {
                  z++;
              }
           }
           k=min(z,k);
       }
       cout<<k<<endl;
    }
    return 0;
    //IN
    //AL
}


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

using namespace std;
int main(int argc, char **argv)
{   string s;
    cin>>s;
    for(int i = 0 ; i < s.size();i++){
      if((s[i] == 'L' && (i+1) % 2 != 0 )|| (s[i] == 'R' && (i+1) % 2 == 0)){
            cout<<"No";
            return 0;
        }
        
    }
    cout<<"Yes";
	return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <string>
#include <set>
#include <vector>
#include <map>
#include <list>
#include <stack>
using namespace std;
typedef long long ll;

int main(void) {
    int n;
    cin >> n;
    int a[2][n], tmp=0;
    int i, j;
    for(i=0; i<2; i++) {
        for(j=0; j<n; j++)
            cin >> a[i][j];
    }
    int ans=a[0][0];
    for(i=0; i<n; i++)
        ans += a[1][i];
    tmp=ans;
    for(i=0; i<n-1; i++) {
        tmp = tmp - a[1][i] + a[0][i+1];
        ans = max(ans, tmp);
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
import sys
from collections import defaultdict, deque, Counter
#import bisect
#import heapq
#import math
#from itertools import accumulate
#from itertools import permutations as perm
#from itertools import combinations as comb
#from itertools import combinations_with_replacement as combr
#from fractions import gcd
#import numpy as np

stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)
MIN = -10 ** 9
MOD = 10 ** 9 + 7
INF = float("inf")
IINF = 10 ** 18

def main():
    n = int(stdin.readline().rstrip())
    #A, B, C = map(int, stdin.readline().rstrip().split())
    a = list(map(int, stdin.readline().rstrip().split()))
    #numbers = [[int(c) for c in l.strip().split()] for l in sys.stdin]
    #word = [stdin.readline().rstrip() for _ in range(n)]
    #number = [[int(c) for c in stdin.readline().rstrip()] for _ in range(n)]
    #zeros = [[0] * w for i in range(h)]
    c = Counter(a)
    for i in range(n):
        print(c[i+1])

main()


Measured memory_bytes: 33840
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>

#define rep(i,j) REP((i), 0, (j))
#define REP(i,j,k) for(int i=(j);(i)<(k);++i)
#define between(a,x,b) ((a)<=(x)&&(x)<=(b))
using namespace std;

int main(){
  char othello[64];
  scanf("%s", othello);
  if(othello[0] == othello[strlen(othello)-1]) printf("%c\n", othello[0]);
  else puts("o");
  return 0;
}

Measured memory_bytes: 1136
import sys
import itertools
# import numpy as np
import time
import math
import heapq
 
sys.setrecursionlimit(10 ** 7)
 
from collections import defaultdict
 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# map(int, input().split())
# list(map(int, input().split()))

N = int(input())

print(N + N ** 2 + N ** 3)

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

namespace Contest
{
	class Program
	{
		static void Main(string[] args)
		{
			int[] Wab = Console.ReadLine().Split().Select(int.Parse).ToArray();
			int W = Wab[0], left = Math.Min(Wab[1], Wab[2]), right = Math.Max(Wab[1], Wab[2]);
			Console.WriteLine(Math.Max(right - (left + W), 0));
#if DEBUG
			Console.ReadKey();
#endif
		}
	}
}


Measured memory_bytes: 13268
#include <cstdio>
#include <algorithm>
#include <ctype.h>
const int bufSize = 1e6;
inline char nc()
{
    #ifdef DEBUG
    return getchar();
    #endif
    static char buf[bufSize], *p1 = buf, *p2 = buf;
    return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, bufSize, stdin), p1 == p2) ? EOF : *p1++;
}
inline void read(char *s)
{
    static char c;
    for (; !isalpha(c); c = nc());
    for (; isalpha(c); c = nc()) *s++ = c;
    *s = '\0';
}
template<typename T>
inline T read(T &r)
{
    static char c;
    static int flag;
    flag = 1, r = 0;
    for (c = nc(); !isdigit(c); c = nc()) if (c == '-') flag = -1;
    for (; isdigit(c); c = nc()) r = r * 10 + c - 48;
    return r *= flag;
}
int a,b,c,k;
int main()
{
    read(a),read(b),read(c),read(k);
    while(k && b <= a) --k,b<<=1;
    while(k && c <= b) --k,c<<=1;
    if(a < b && b < c) puts("Yes");
    else puts("No");
    return 0;
}

Measured memory_bytes: 1532
#include<stdio.h>
main(){
  int w,n;
  int num[50];
  int i;
  int a,b,temp;

  scanf("%d%d",&w,&n);

  for(i=1;i<=w;i++) num[i]=i;

  for(i=0;i<n;i++){
    scanf("%d,%d",&a,&b);

    temp=num[a];
    num[a]=num[b];
    num[b]=temp;

  }

  for(i=1;i<=w;i++){
    printf("%d\n",num[i]);
  }

  return 0;

}

Measured memory_bytes: 596
from itertools import combinations_with_replacement
from collections import defaultdict

n = int(input())

calc = lambda x,y,z: x**2+y**2+z**2+x*y+y*z+z*x

def pattern(x,y,z):
   if x == y and y == z:
      return 1
   elif x == y or y == z or z == x:
      return 3
   elif x != y and y != z and z != x:
      return 6
   else:
      raise RuntimeError

d = defaultdict(int)
n_ = int(pow(n, 0.5))
nums = [i for i in range(1, n_+1)]
for x,y,z in combinations_with_replacement(nums, 3):
   d[calc(x,y,z)] += pattern(x,y,z)
for i in range(1, n+1):
   print(d[i])

Measured memory_bytes: 12032
import java.util.ArrayList;
import java.util.Scanner;
 
public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int x = scanner.nextInt();
		int length = scanner.nextInt();
		ArrayList<Integer> unwanted = new ArrayList<Integer>();
		for(int i = 0; i < length; i++) {
			unwanted.add(scanner.nextInt());
		}
		int maximum = -100;
		int difference = 0;
		while(maximum == -100) {
			if(!unwanted.contains(x - difference))
				maximum = x - difference;
			else if(!unwanted.contains(x + difference))
				maximum = x + difference;
			difference++;
		}
		System.out.print(maximum);
		
	}
}

Measured memory_bytes: 27232
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include <cmath>
//#include <bits/stdc++.h>
using namespace std;

int main(){
    long int X,y,z,ans;
    cin>>X;
    z=X%500;
    y=z%5;
    ans=2*X-z-y;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(I,A,B) for(ll I = (A); I < (B); ++I)
const ll INF=1e15+7;
const ll N = 1002;
string s;
ll a[3];

int main(){
	cin>>s;
	a[0]=a[1]=a[2]=0;
	a[s[0]-'a']++;
	a[s[1]-'a']++;
	a[s[2]-'a']++;
	if(a[0]==1&&a[1]==1&&a[2]==1){
		cout<<"Yes"<<endl;
	}else{
		cout<<"No"<<endl;
	}
	return 0;
}


Measured memory_bytes: 256
MOD = 10 ** 9 + 7
N, K = map(int, input().split())
ans = 1
for i in range(K, N + 1):
    d = N - i
    hi = (N * N + N - d * d - d) // 2
    lo = (i * i - i) // 2
    ans += hi - lo + 1
print(ans % MOD)


Measured memory_bytes: 63776
S = str(input())
T = str(input())

X=[]
Y=[]

a = [c  for c in "abcdefghijklmnopqrstuvwxyz"]

for i in a:
    X.append(len(S) - len(S.replace(i, "")))
    Y.append(len(T) - len(T.replace(i, "")))
    
X.sort()
Y.sort()

ret = "Yes"
for i in range(26):
    if X[i] != Y[i]:
        ret = "No"
    
print (ret)

Measured memory_bytes: 3632
#include <bits/stdc++.h>
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 ALL(v) v.begin(), v.end()
#define downque(que) priority_queue<ll> que;
#define upque(que) priority_queue<ll, vector<int>, greater<int>> que;
typedef long long ll;
typedef vector<vector<int>> Matrix;
const int MOD = 1e9 + 7;
const int MAX = 1e7;


int main(){
  int N;
  cin>>N;
  Matrix G(N);
  vector<pair<int,int>> vp;
  for(int i=1;i<N;i++){
    int a,b;
    cin>>a>>b;
    a--;b--;
    G[a].emplace_back(b);
    G[b].emplace_back(a);
    vp.emplace_back(a,b);//両端の情報を保存
  }

  int K=0;
  map<pair<int,int>,int> I;//辺（順番ではなく両端の数値によって定められてる）の色
  vector<int> cs(N,0); // color of edge between its parent

  vector<int> used(N,0);
  queue<int> que;
  used[0]=1;
  que.emplace(0);

  while(!que.empty()){
    int v=que.front();
    que.pop();

    //最大値更新も一緒にやってる
    if(K<(int)G[v].size()) K=G[v].size();
    
    //頂点ごとに処理
    int cur=1;
    for(int u:G[v]){//頂点vとつながってる頂点uについて
      if(used[u]) continue; //すでに見た頂点ならどうでもいい
      if(cur==cs[v]) cur++; //curが親の色と一致するなら色かえる
      cs[u]=I[make_pair(u,v)]=I[make_pair(v,u)]=cur++;
      //uとvの間の辺の色を決定

      used[u]=1;
      que.emplace(u);//この頂点から下の頂点も調べる。後で
    }
  }

  cout<<K<<endl;
  for(auto p:vp) cout<<I[p]<<endl;
  return 0;
}


Measured memory_bytes: 20084
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 1; i <= n; ++i)
using namespace std;
typedef long long ll;
const int maxn = 1000200;
int n, co[maxn], ce[maxn], mx[maxn], mx2[maxn], ans = 0x3f3f3f3f;
int main(){
    scanf("%d", &n);
    rep(i, n){
        int x; scanf("%d", &x);
        if(i & 1) co[x]++;
        else ce[x]++;
    }
    for(int i = 100000; i ; --i) mx[i] = max(mx[i+1], ce[i]);
    for(int i = 100000; i ; --i) mx2[i] = max(mx2[i+1], co[i]);
    
    // rmq_init();
    for(int i = 1; i <= 100000; ++i) {
        int cnt = n / 2 - co[i];
        cnt += n / 2 - mx[i + 1];
        ans = min(ans, cnt);
    }
    
    for(int i = 1; i <= 100000; ++i) {
        int cnt = n / 2 - ce[i];
        cnt += n / 2 - mx2[i + 1];
        ans = min(ans, cnt);
    }
    printf("%d\n", ans);
    return 0;
}


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

#define times(n, i) uptil(0, n, i)
#define upto(f, t, i) for(auto _##i = (t), i = decltype(_##i)(f) poi  i <= _##i poi  i++)
#define uptil(f, t, i) for(auto _##i = (t), i = decltype(_##i)(f) poi  i < _##i poi  i++)
#define downto(f, t, i) for(auto i = (f), _##i = decltype(i)(t) poi  i >= _##i poi  i--)
#define downtil(f, t, i) for(auto i = (f), _##i = decltype(i)(t) poi  i > _##i poi  i--)

#define unless(c) if(!(c))
#define until(c) while(!(c))
#define loop while(true)

#define poi ;
#define poipoi << "\n"

#define fuwafuwa(n, c) dokidoki((n) + (c) - 1, c)
#define dokidoki(n, c) ((n) / (c) * (c))

template<class T> bool read(T& t){
    return cin >> t poi
}
template<class T, class...U> bool read(T& t, U&... u){
    unless(cin >> t) return false poi
    return read(u...) poi
}

template<class T> T toppo(stack<T>& stick){
    T choco = stick.top() poi
    stick.pop() poi
    return choco poi
}

int main(){
    int n poi
    stack<int> pyon poi

    while(read(n)){
        if(n) pyon.push(n) poi
        else cout << toppo(pyon) poipoi poi
    }

    return 0 poi
}

Measured memory_bytes: 1200
#include<bits/stdc++.h>
using namespace std;
int main()
{
   int a, b, p1, p2, c=0, i;
   cin>> a>> b;
   for( i=1; i<=1000; i++)
   {
       p1= i* 0.08;
       p2=i* 0.1;
       if(p1==a && p2==b)
       {
            c=1;
           break;

       }
   }
   if(c==1)
     cout<< i<< endl;

   else if(c==0)
    cout<<"-1" << endl;
    return 0;
}



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

#define mod 1000000007

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

using namespace std;
typedef long long ll;
const long long INF = 1LL << 60;
 
int main(void){
	
	int M, N;
	
	cin >> N >> M;
	
	char A[N][N], B[M][M];
	
	rep(i, N)
		rep(j, N)
			cin >> A[i][j];
			
	rep(i, M)
		rep(j, M)
			cin >> B[i][j];
	
	bool exist = false;
	
	rep(i, N){
		rep(j, N){
			if(i + M - 1 >= N || j + M - 1 >= N)
				continue;
			bool match = true;
			rep(k, M)
				rep(l, M)
					if(A[i + k][j + l] != B[k][l])
						match = false;
			if(match)
				exist = true;
		}
	}
	
	if(exist)
		cout << "Yes";
	else
		cout << "No";
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream> // C++の入出力
#include <stdio.h> // C の入出力
#include <algorithm> // sort などのアルゴリズム
#include <string.h> // C の文字列用
#include <ctype.h> // C の文字種用
#include <string> // C++の文字列
using namespace std;
int main(void){
    int a,b,k,kizi;
    cin>>k;//トッピングの数
    cin>>a;//生地の値段
    cin>>b;//トッピングの値段
    cin>>kizi;
    int dl = a;
    int tpp[k];
    double cal=0;
    for(int i=0;i<k;i++){
        cin>>tpp[i];
    }
    cal=kizi/dl;
    sort(tpp,tpp+k,greater<int>());//greater<int>()逆順にソート　カロリーの多い順にして一番コスパいいの調べる
    for(int t=0;t<=k;t++){
        double work=kizi;
        for(int x=0;x<t;x++){
            work+=tpp[x];
            dl=a+b*(x+1);
            if(work/dl>cal){
                cal=work/dl;
            }
        }
    }
    int result = cal;
    cout << result << "\n";
    return 0;
}

Measured memory_bytes: 1180
#include<iostream>
using namespace std;
int main( )
{
    char a[105][105];
    int l[105];
    int r[105];
    int n,m;
    cin>>n>>m;

    for(int i = 0;i < n;i++)
        for(int j = 0;j < m;j++){
                cin>>a[i][j];
        }

    for(int i = 0;i < n;i++){
        int t = 0;
        for(int j = 0;j < m;j++){
            if(a[i][j] == '.')
                t++;
        }
        if(t == m) l[i] = 1;
    }

    for(int i = 0;i < m;i++){
        int t = 0;
        for(int j = 0;j < n;j++){
            if(a[j][i] == '.')
                t++;
        }
        if(t == n) r[i] = 1;
    }

    for (int i = 0; i < n; i++){
		int flag = 0;
		for (int j = 0; j < m; j++){
			if(l[i] || r[j]) continue;
			flag = 1;
			cout<<a[i][j];
		}
		if(flag) cout<<endl;
	}




   return 0;
}


Measured memory_bytes: 256
n, m = map(int, input().split())
switches = [list(map(int, input().split())) for _ in range(m)]
p = list(map(int, input().split()))
ans = 0
for i in range(2**n):
    all_on_flag = 1
    for j in range(m):
        switch = switches[j]
        cnt = 0
        for s in switch[1:]:
            if ((i >> (s-1)) & 1):
                cnt += 1
        if cnt % 2 != p[j]:
            all_on_flag = 0
            break
    if all_on_flag:
        ans += 1
print(ans)


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

#define MP make_pair
#define PB push_back
#define ALL(x)      (x).begin(),(x).end()
#define REP(i,n)    for(int i=0;i<(n);i++)
#define REP1(i,n)   for(int i=1;i<(n);i++)
#define REP2(i,d,n) for(int i=(d);i<(n);i++)
#define RREP(i,n)   for(int i=(n);i>=0;i--)
#define CLR(a)      memset((a),0,sizeof(a))
#define MCLR(a)     memset((a),-1,sizeof(a))
#define RANGE(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))

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

const int INF = 0x3f3f3f3f;
const LL INFL = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-9;

const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};


void solve(long long H, long long W, std::vector<std::string> S){
    REP(i, H) {
        REP(j, W) {
            if(S[i][j] == '.') {
                int cnt = 0;
                REP2(x, -1, 2) {
                    REP2(y, -1, 2) {
                        if(x == 0 && y == 0) continue;
                        int mx = j + x;
                        int my = i + y;
                        if(RANGE(mx, my, W, H)) {
                            cnt += S[my][mx] == '#';
                        }
                    }
                }

                S[i][j] = cnt + '0';
            }
        }
    }

    REP(i, H) {
        cout << S[i] << endl;
    }
}

int main(){
    long long H;
    scanf("%lld",&H);
    long long W;
    scanf("%lld",&W);
    std::vector<std::string> S(H);
    for(int i = 0 ; i < H ; i++){
        std::cin >> S[i];
    }
    solve(H, W, std::move(S));
    return 0;
}


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

int cmp_s(const void * left, const void * right)
{
	char *left_char = (char *)left;
  char *right_char = (char *)right;
  return strcmp(left_char, right_char);
}

int main(void){

  int n;
  scanf("%d", &n);
  char s[n][11];
  for (int i = 0; i < n; i++) {
    scanf("%s", s[i]);
  }
  int m;
  scanf("%d", &m);
  char t[m][11];
  for (int i = 0; i < m; i++) {
    scanf("%s", t[i]);
  }

  qsort(s, n, sizeof(s[0]), cmp_s);
  int max = 0;
  int count = 0;
  for (int i = 0; i < n-1; i++) {
    count++;
    if (strcmp(s[i],s[i+1]) != 0) {
      for (int j = 0; j < m; j++) {
        if (strcmp(s[i],t[j]) == 0) {
          count--;
        }
      }
      if (count > max) {
        max = count;
      }
      count = 0;
    }
  }
  count++;
  for (int j = 0; j < m; j++) {
    if (strcmp(s[n-1],t[j]) == 0) {
      count--;
    }
  }
  if (count > max) {
    max = count;
  }
  printf("%d\n", max);

  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <unordered_map>
using namespace std;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

template<class T> vector<T> make_vec(size_t a) { return vector<T>(a); }
template<class T, class... Ts> auto make_vec(size_t a, Ts... ts) {
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
template<class T, class V>
typename enable_if<is_class<T>::value == 0>::type fill(T &t, const V &v) {
    t = v;
}
template<class T, class V>
typename enable_if<is_class<T>::value != 0>::type fill(T &t, const V &v){
    for (auto &e : t) fill(e, v);
}

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }

#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }

long long R, G, B, N;


int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    while (cin >> R >> G >> B >> N) {
        long long res = 0;
        for (long long r = 0; r <= N; ++r) {
            for (long long g = 0; g <= N; ++g) {
                if (r * R + g * G > N) continue;
                long long rem = N - r*R - g*G;
                if (rem % B != 0) continue;
                ++res;
            }
        }
        cout << res << endl;
    }
}




















Measured memory_bytes: 256
#include <bits/stdc++.h>
  
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n) for(int i=1;i<=(n);i++)
#define lol long long
#define SUM(n) ((n)+1)*(n)/2 //1〜nまでの総和を求める式
#define mp make_pair
#define fi first
#define se second
#define pu push_back
#define SYOU(x) fixed<<setprecision(x+1) //小数点桁数を指定する
#define abs(x,y) max(x,y)-min(x,y)
#define all(v) v.begin(),v.end()
#define UPDigit(a,b) (a+b-1)/b //小数点切り上げ
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const int MOD=int(1e9)+7; 
using namespace std;
using pii = pair<lol, lol>;
typedef vector<int> vit;
 
/*
struct SegmentTree{
   
  vector<lol> SumV(1000005,0);
  vector<lol> MaxV(1000005,0);
  vector<lol> MinV(1000005,0);
  int N;
   
  void update(int i,int x){
    i += N - 1;
    minv[i] = x;
    maxv[i] = x;
    sumv[i] = x;
    while(i > 0){
      i = (i - 1)/2;
      maxv[i] = max(maxv[i*2+1],maxv[i*2+2]);
      minv[i] = min(minv[i*2+1],minv[i*2+2]);
      sumv[i] = sumv[i*2+1]+sumv[i*2+2];
    }
  }
   
  void add(int i,int x){
    i += N - 1;
    sumv[i] += x;
    maxv[i] += x;
    minv[i] += x;
    while(i > 0){
      i = (i - 1)/2;
      sumv[i] = sumv[i*2+1]+sumv[i*2+2];
      minv[i] = min(minv[i*2+1],minv[i*2+2]);
      maxv[i] = max(maxv[i*2+1],maxv[i*2+2]);
    }
  }
   
  int getmax(int a,int b,int k,int l,int r){
    if(r <= a || b <= l) return -INF;
    if(a <= l && r <= b) return maxv[k];
    else{
      int c1 = getmax(a,b,2*k+1,l,(l+r)/2);
      int c2 = getmax(a,b,2*k+2,(l+r)/2,r);
      return max(c1,c2);
    }
  }
   
  int getmin(int a,int b,int k,int l,int r){
    if(r <= a || b <= l) return INF;
    if(a <= l && r <= b) return minv[k];
    else{
      int c1 = getmin(a,b,2*k+1,l,(l+r)/2);
      int c2 = getmin(a,b,2*k+2,(l+r)/2,r);
      return min(c1,c2);
    }
  }
   
  int getsum(int a,int b,int k,int l,int r){
    if(r <= a || b <= l) return 0;
    if(a <= l && r <= b) return sumv[k];
    else{
      int c1 = getsum(a,b,2*k+1,l,(l+r)/2);
      int c2 = getsum(a,b,2*k+2,(l+r)/2,r);
      return c1+c2;
    }
  }
}
*/
 
//最大公約数
lol gcd(lol x, lol y){
  if(x < y) swap(x, y);
  lol r = x % y;
  while(r != 0){
    x = y;
    y = r;
    r = x % y;
  }
  return y;
}
//最小公倍数
lol lcm(lol x, lol y){
  lol a = x * y;
  return (a / gcd(x, y));
}

signed main(void){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  lol n, a, b;
  cin >> n >> a >> b;
  lol x[n + 5];
  rep(i, n){
    cin >> x[i];
  }
  lol ans = 0;
  rep(i, n - 1){
    ans += min(b, (x[i + 1] - x[i]) * a);
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 4392
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
old = a.copy()
for i in range(n):
    if b[i] <= a[i]:
        a[i] -= b[i]
    else:
        a[i+1] = max(0, a[i+1] + a[i] - b[i])
        a[i] = 0

ans = 0
for i in range(n+1):
    ans += old[i] - a[i]
print(ans)

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

using namespace std;
using ll = long long;

#define rep(i, a) for (int i = 0; (i) < (int) (a); (i)++)
#define reps(i, a, b) for (int i = (int) (a); (i) < (int) (b); (i)++)
#define rrep(i, a) for (int i = (int) a-1; (i) >= 0; (i)--)
#define rreps(i, a, b) for (int i = (int) (a)-1; (i) >= (int) (b); (i)--)
#define MP(a, b) make_pair((a), (b))
#define PB(a) push_back((a))
#define all(v) (v).begin(), (v).end()
#define PERM(v) next_permutation(all(v))
#define UNIQUE(v) sort(all(v));(v).erase(unique(all(v)), v.end())
#define CIN(type, x) type x;cin >> x
#define TRUE__  "YES"
#define FALSE__ "NO"
#define PRINT(f) if((f)){cout << (TRUE__) << endl;}else{cout << FALSE__ << endl;}
#define RS resize
#define CINV(v, N) do {\
	v.RS(N);\
	rep(i, N) cin >> v[i];\
} while (0);
#define RCINV(v, N) do {\
	v.RS(N);\
	rrep(i, N) cin >> v[i];\
} while (0);

#define MOD 1000000007

void init();
void solve();

signed main()
{
	init();
	solve();
}

int x[2];
int k;

void init()
{
	cin >> x[0] >> x[1];
	cin >> k;
}

void sw(int a)
{
	if (x[a] % 2) x[a]--;
	x[a] /= 2;
	x[1-a] += x[a];
}

void solve()
{
	int pos = 0;
	while (k--) {
		sw(pos);
		pos = 1-pos;
	}
	cout << x[0] << " " << x[1] << endl;
}





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

int main(){
  int n,d1,d2,val=0,doup=0;
  cin>>n;

  while(n--){
    cin>>d1>>d2;
    if(d1==d2) val++;
    else val=0;

    if(val==3) doup=1;
  }

  if(doup==1)cout<<"Yes\n";
  else cout<<"No\n";

  return 0;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF=1e9,MOD=1e9+7,ohara=1e6+10;
const ll LINF=1e18;
using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl
#define doublecout(a) cout<<fixed<<setprecision(15)<<a<<endl;
#define Cerr(x) cerr<<(x)<<endl
#define fi first
#define se second
#define P pair<ll,ll> 
#define m_p make_pair
#define V vector<ll> 

ll n,cnt,ans=LINF,a[ohara],b,c,d,tmp,tmpp,m,h,w,x,y,sum,pos,k;
ld doua;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl;
struct edge{int to,cost;};
ll slime[5000][5000];
//slime[i][j]:=スライムiをj回以内の魔法回数でとるときの最小

//-------------------------↓↓↓↓↓↓------------------------

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

    cin>>n>>x;
    rep(i,n){
        cin>>a[i];
        a[i+n]=a[i];
    }
    rrep(i,n,2*n){
        slime[i-n][0]=a[i];
        cnt=0;
        rrrep(j,i-1,0){
            cnt++;
            //slime[i-n][cnt]=a[j]+x*cnt;
            slime[i-n][cnt]=a[j];
        }
    }
    rep(i,n){
        rrep(j,1,n+5){
            slime[i][j]=min(slime[i][j],slime[i][j-1]);
        }
    }

    rep(i,n){
        cnt=0;
        rep(j,n){
            //if(i==2)cout<<j<<" "<<i<<" "<<slime[j][i]<<"\n";
            cnt+=slime[j][i];
        }
        ans=min(ans,cnt+i*x);
    }
    Cout(ans);
    return 0;
}


Measured memory_bytes: 81152
#include <bits/stdc++.h>
#include <boost/range.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/algorithm_ext.hpp>
#include <boost/range/numeric.hpp>
#include <boost/range/adaptors.hpp>
#include <boost/range/irange.hpp>
using namespace std;
constexpr char nl = '\n';
using ll = long long;
using boost::irange;
using boost::adaptors::reversed;
namespace rng { using namespace boost; using namespace boost::range; }
struct init_ { init_(){ cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(10); } } init_;

template<class C> auto operator>>(istream& in, C& c) -> typename enable_if<!is_void<decltype(c.begin())>::value && !is_same<C, string>::value, istream&>::type {
    for (auto& v : c) { in >> v; } return in; }
template<class C> auto operator<<(ostream& out, const C& c) -> typename enable_if<!is_void<decltype(c.begin())>::value && !is_same<C, string>::value, ostream&>::type {
    int i = 0; for (const auto& v : c) { if (i++) { out << ' '; } out << v; } return out; }
template<size_t N, class T, class R> using when_last = typename enable_if<N == tuple_size<remove_reference_t<T>>::value - 1, R>::type;
template<size_t N, class T, class R> using when_init = typename enable_if<N != tuple_size<remove_reference_t<T>>::value - 1, R>::type;
template<size_t N = 0, class T> auto operator>>(istream& in, T&& t) -> when_last<N, T, istream&> { return in >> get<N>(t); }
template<size_t N = 0, class T> auto operator>>(istream& in, T&& t) -> when_init<N, T, istream&> { return operator>><N + 1>(in >> get<N>(t), forward<T>(t)); }
template<size_t N = 0, class T> auto operator<<(ostream& out, const T& t) -> when_last<N, T, ostream&> { return out << get<N>(t); }
template<size_t N = 0, class T> auto operator<<(ostream& out, const T& t) -> when_init<N, T, ostream&> { return operator<<<N + 1>(out << get<N>(t) << ' ', t); }

#ifdef LOCAL
constexpr auto color_s_ = "\033[2m\033[33m", color_e_ = "\033[0m";
template<class T> void trace_(const T& v) { cerr << v; }
template<class T> void trace_(const vector<vector<T>>& m) { cerr << "\n"; for (const auto& v : m) { trace_(v); cerr << "\n"; } }
template<class T> void trace_(const char* s, const T& v) { cerr << color_s_ << s << "="; trace_(v); cerr << color_e_ << "\n"; cerr.flush(); }
template<class T, class... Ts> void trace_(const char* s, const T& v, const Ts&... vs) { cerr << color_s_; for (; *s != ','; ++s) { cerr << *s; } cerr << "="; trace_(v); cerr << ","; trace_(++s, vs...); }
#define TRACE(...) trace_(#__VA_ARGS__, __VA_ARGS__)
#else
#define TRACE(...)
#endif

int digits(ll x) {
    int d = 0;
    while (x > 0) {
        x /= 10;
        d++;
    }
    return d;
}

int main() {
    ll n;
    cin >> n;
    int ans = 11;
    for (ll a = 1; a * a <= n; ++a) {
        if (n % a == 0) {
            ll b = n / a;
            ans = min(ans, max(digits(a), digits(b)));
        }
    }
    cout << ans << nl;
}


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

int main(){
	int team,ttt;
	while(cin>>team,team){
		int win[10]={},lose[10]={};
		char name[10],rank[10];
		for(int i=0;i<team;i++){
			cin>>name[i];
			for(int j=0;j<team-1;j++){
				cin>>ttt;
				if(ttt==0)win[i]++;
				if(ttt==1)lose[i]++;
			}
		}
		for(int i=team-1;i>-1;i--){
			for(int j=0;j<team-i;j++){
				for(int k=0;k<team;k++){
					if(win[k]==i&&lose[k]==j)cout<<name[k]<<endl;
				}
			}
		}
	}
}

Measured memory_bytes: 1152
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<stack>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mt make_tuple
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef tuple<int,int,int> tp;
typedef vector<tp> vt;
typedef vector<vd> vvd;
typedef pair<int,pii> pip;
typedef vector<pip>vip;
const double PI=acos(-1);
const double EPS=1e-7;
const int inf=1e9;
const ll INF=2e18;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int n;
vi sc;
vvi in,tmp;
bool f(){
	vvi s(n,vi(3));
	rep(i,3){
		vp t(n);
		rep(j,n)t[j]=pii(-tmp[i][j],j);
		sort(all(t));
		rep(j,n){
			int q;
			if(j==0)q=sc[0];
			else if(t[j-1].first==t[j].first)q=s[t[j-1].second][i];
			else q=sc[j];
			s[t[j].second][i]=q;
		}
	}
	rep(i,n)s[i][0]+=s[i][1]+s[i][2];
	int co=0;
	rep(i,n)if(s[i][0]>s[0][0])co++;
	if(co<8)return 1;
	return 0;
}
int main(){
	cin>>n;
	sc=vi(n);
	rep(i,n)cin>>sc[i];
	in=vvi(3,vi(n));
	rep(i,n)rep(j,3)cin>>in[j][i];
	int out=inf;
	rep(i,3)loop(j,in[i][0]+1,100){
		tmp=in;
		tmp[i][0]=j;
		if(f())out=min(out,j-in[i][0]);
	}
	if(out==inf)cout<<"Saiko"<<endl;
	else cout<<out<<endl;
}

Measured memory_bytes: 3180