akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#include <bits/stdc++.h>
using namespace std;
 
//priority_queue<long long, vector<long long>, greater<long long>> pq;

const double TL = 1.5 * CLOCKS_PER_SEC;
mt19937 rng((unsigned int) chrono::steady_clock::now().time_since_epoch().count());
#define clr(x, y) memset(x, y, sizeof(x))
#define forn(i, n) for (int i = 0; i < n; i++)
#define LL long long
const double pi = acos(-1.0);


LL n, a, b, c, d;
map<LL, LL> mp;

LL dis(LL x, LL y) {
  LL dif = abs(x - y);
  if (dif > 1e16 / d) return 1e16;
  return dif * d;
}

LL dfs(LL x) {
  if (x == 0) {
    return 0;
  }
  if (x == 1) {
    return d;
  }
  if (mp.find(x) != mp.end()) {
    return mp[x];
  }
  //cout << x << endl;


  LL ans = 1e16;
  LL y = x % 2;
  LL z = (x - y) / 2;
  ans = min(ans, dfs(z) + min(d * y + a, dis(z, x)));
  if (y != 0) {
    z += 1;
    ans = min(ans, dfs(z) + min(d * (2 - y) + a, dis(z, x)));
  }


  y = x % 3;
  z = (x - y) / 3;
  ans = min(ans, dfs(z) + min(d * y + b, dis(z, x)));
  if (y != 0) {
    z += 1;
    ans = min(ans, dfs(z) + min(d * (3 - y) + b, dis(z, x)));
  }

  y = x % 5;
  z = (x - y) / 5;
  ans = min(ans, dfs(z) + min(d * y + c, dis(z, x)));
  if (y != 0) {
    z += 1;
    ans = min(ans, dfs(z) + min(d * (5 - y) + c, dis(z, x)));
  }

  mp[x] = ans;
  return ans;
}

int main() {
#ifdef LOCAL
  auto start_clock = clock();
  freopen("in", "r", stdin);
#endif
  int T;
  scanf("%d", &T);
  while (T--) { 
    mp.clear();
    cin >> n >> a >> b >> c >> d;
    cout << dfs(n) << endl;
  }

#ifdef LOCAL
 auto end_clock = clock();
 cout << "Time:" << (end_clock - start_clock) / CLOCKS_PER_SEC << endl;
#endif
  return 0;
}


Measured memory_bytes: 4492
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <bits/stdc++.h>
using namespace std;

int main(){
    int n;
    int p[20];
    int cnt = 0;
    cin >> n;
    for(int i=0;i<n;i++){
        cin >> p[i];
    }
    for(int i=1;i<n-1;i++){
        if(p[i-1]<=p[i] && p[i] <= p[i+1]){
            cnt++;
        }else if(p[i+1] <= p[i] && p[i] <= p[i-1]){
            cnt++;
        }
    }
    cout << cnt << endl;

}


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

int n, a, b, num1, num2;

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

int main() {
	scanf("%d %d %d", &n, &a, &b);
	for (int i = 1, x; i <= n; ++i) {
		scanf("%d", &x);
		if (x <= a) ++num1;
		if (x > a && x <= b) ++num2;
	}
	printf("%d\n", min(num1, min(num2, n - num1 - num2)));
	return 0;
}

Measured memory_bytes: 3756
#include <bits/stdc++.h>
using namespace std;
int main(){
  string A, B, C;
  cin >> A >> B >> C;
  if(A[A.size()-1] == B[0] && B[B.size()-1] == C[0]){
    cout << "YES" << endl;
  }
  else cout << "NO" << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define mx 100005
using namespace std;
typedef long long ll;
ll n,capacity;
ll weight[mx];
ll cost[mx];

ll knapshack(ll n,ll W )
{
    ll dp[n+1][W+1];
    for(int i=0;i<=n;i++)
    {
        for(int w=0;w<=W;w++)
        {
            if(i==0 || w==0)
                dp[i][w]=0;
            else if(weight[i-1]<=w)
            {
                dp[i][w]=max(cost[i-1]+dp[i-1][w-weight[i-1]],dp[i-1][w]);
            }
            else
                dp[i][w]=dp[i-1][w];
        }
    }
    return dp[n][W];

}
int main()
{
    cin>>n>>capacity;
    for(int i=0; i<n; i++)
    {
        cin>>weight[i]>>cost[i];
    }
    cout<<knapshack(n,capacity)<<endl;
}


Measured memory_bytes: 79104
w = int(input().replace("\n", ""))
n = []
for i in range(int(input().replace("\n", ""))):
    n.append([int(v) for v in input().replace("\n", "").split(",")])

m = [0] * (w + 1)
for i in range(1, w + 1):
    step = i
    for j in range(0, len(n)):
        if n[j][0] == step:
            step = n[j][1]
        elif n[j][1] == step:
            step = n[j][0]
    m[step] = i
del m[:1]
print("\n".join(map(str, m)))

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

using namespace std;
inline int read(){int x=0,f=1;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}return x*f;}
const int maxn = 1e5 + 50;
const int mod = 1e9 + 7;
int a[maxn];

int main(int argc , char * argv[]){
	int n = read(),ans=1;
	for(int i = 1 ; i <= n ;++ i) a[i] = read();
	sort( a + 1 , a + n + 1 );
	for(int i = 1 ; i <= n ; ){
		int j = i;
		while( j <= n && a[j] == a[i] ) ++ j;
		set < int > pos;
		if( (n + 1 + a[i]) % 2 == 0 ){
			int p = (n + 1 + a[i]) / 2;
			if( p >= 1 && p <= n && p - 1 >= n - p )
				pos.insert( p );
		}
		if( (n + 1 - a[i]) % 2 == 0 ){
			int p = (n + 1 - a[i]) / 2;
			if( p >= 1 && p <= n && p - 1 < n - p )
				pos.insert( p );
		}

		if( j - i != pos.size() ){
			ans = 0 ;
			break ;
		}else{
			if(pos.size() > 1)
				ans = 1LL * ans * 2 % mod;
		}
		i = j;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define countof(array) (sizeof(array) / sizeof(array[0]))
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,n,s) for(int i = s; i < (n); ++i)
#define rsrep(i,n,s) for(int i = (n)-1; i >= s; --i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aall(a) (a), (a)+countof(a)//for array sorting
#define raall(a) (a), (a)+countof(a), greater<>()
#define show(x) cout<<#x<<" = "<<x<<endl;
#define vfind(v, a) find(all(v), a) != v.end()
#define yn(f) { if (f) puts("YES"); else puts("NO"); }
#define yns(f) { if (f) puts("Yes"); else puts("No"); }
#define show_ary(...) { cout<<#__VA_ARGS__<<" = "; for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define show_pair(...) cout<<#__VA_ARGS__<<" = "<<endl; for (const auto& x : (__VA_ARGS__)) { cout<<"  "<<x.fi<<" : "<<x.se<<endl; }
#define out_ary(...) { for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define argmax(v) distance((v).begin(), max_element(all(v)))
#define argmin(v) distance((v).begin(), min_element(all(v)))
#define vmax(v) *max_element(all(v))
#define vmin(v) *min_element(all(v))
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<P> vpair;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<string> vstr;
typedef vector<bool> vbool;
typedef vector<vint> vvint;
typedef vector<vll> vvll;
typedef vector<vstr> vvstr;
typedef vector<vbool> vvbool;
const ll LINF = 2000000000000000000ll;
const int INF = 1000000100;
const ll MOD = 1e9+7;

int main() {
    int n;
    cin >> n;
    vint a(n), b(n), c(n);
    rep(i, n) cin >> a[i];
    rep(i, n) cin >> b[i];
    rep(i, n) cin >> c[i];
    sort(all(a));
    sort(all(b));
    sort(all(c));

    ll ans = 0;
    rep(i, n) {
        ll n_a = lower_bound(all(a), b[i]) - a.begin();
        ll n_c = c.end() - upper_bound(all(c), b[i]);
        if (n_a > 0 && n_c > 0) ans += n_a * n_c;
    }

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

Measured memory_bytes: 1408
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

#A
def A():
    def f(n):
        return ((1<<n)-(1-2*(n&1)))//3
    def k(x,n):
        return f(n)*s+(1-2*(n&1))*x
    a = LI()
    if a[0]%2 or a[1]%2 or a[2]%2:
        print(0)
        return
    if a[0] == a[1] == a[2]:
        print(-1)
        return
    s = sum(a)
    ans = 10**5
    for i in range(3):
        l = 0
        r = 10**5+1
        while r-l > 1:
            m = (l+r)>>1
            ka = k(a[i],m)
            if ka&((1<<m)-1) == 0:
                l = m
            else:
                r = m
        ans = min(ans, l)
    print(ans)
    return
#B
def B():
    n,m = LI()
    f = [0]*n
    for i in range(m):
        a,b = LI()
        f[a-1] ^= 1
        f[b-1] ^= 1
    if all([not f[i]%2 for i in range(n)]):
        print("YES")
    else:
        print("NO")
    return

#C
def C():
    d = [(1,0),(-1,0),(0,1),(0,-1)]
    h,w,k = LI()
    a = SR(h)
    for y in range(h):
        for x in range(w):
            if a[y][x] == "S":
                sy,sx = y,x
                break
    bfs = [[-1]*w for i in range(h)]
    bfs[sy][sx] = 0
    q = deque([(sy,sx)])
    while q:
        y,x = q.popleft()
        for dy,dx in d:
            ny,nx = y+dy,x+dx
            if 0 <= ny < h and 0 <= nx < w:
                if a[ny][nx] == "#":
                    continue
                if bfs[ny][nx] < 0:
                    bfs[ny][nx] = bfs[y][x]+1
                    if bfs[ny][nx] < k:
                        q.append((ny,nx))

    ans = float("inf")
    for y in range(h):
        for x in range(w):
            if bfs[y][x] >= 0:
                ans = min(ans, y, h-1-y, x, w-1-x)
    print(math.ceil(ans/k)+1)
    return

#D
def D():

    return

#E
def E():

    return

#F
def F():

    return

#Solve
if __name__ == "__main__":
    C()


Measured memory_bytes: 81628
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys
import collections

def is_four_card(cards):
  return cards.most_common(1)[0][-1] == 4
def is_full_house(cards):
  return cards.most_common(1)[0][-1] == 3 and cards.most_common(2)[-1][-1] == 2
def is_straight(cards):
  if cards[0] == 1 and cards[1:] == [10,11,12,13]: return True
  return cards == range(cards[0],cards[0]+5)
def is_three_card(cards):
  return cards.most_common(1)[0][-1] == 3
def is_two_pair(cards):
  return cards.most_common(2)[0][-1] == 2 and cards.most_common(2)[1][-1] == 2
def is_one_pair(cards):
  return cards.most_common(1)[0][-1] == 2
for s in sys.stdin:
  d = map(int,s.split(","))
  d.sort()
  dc = collections.Counter(d)
  if is_four_card(dc): print "four card" ; continue
  if is_full_house(dc): print "full house" ; continue
  if is_straight(d): print "straight" ; continue
  if is_three_card(dc): print "three card" ; continue
  if is_two_pair(dc): print "two pair" ; continue
  if is_one_pair(dc): print "one pair" ; continue
  print "null"

Measured memory_bytes: 4628
#include <bits/stdc++.h>
#include <cassert>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
struct Edge
{
  int to;
  int weight;
  Edge(int t, int w) : to(t), weight(w) {}
};
using Graph = vector<vector<Edge>>;
// using Graph = vector<vector<int>>;

const long long INF = 1LL << 60;
const int INT_INF = 1000000000;

int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
// int dx[8] = {-1, -1, -1, 0, 0, 1, 1, 1}, dy[8] = {-1, 0, 1, 1, -1, 1, 0, -1};

ll calcScore(const int contest, const int day, vector<ll> last, vector<ll> &c, vector<vector<ll>> &s)
{
  ll score = 0;
  last[contest] = day + 1;
  score += s[day][contest];
  for (int j = 0; j < 26; j++)
  {
    score -= c[j] * ((day + 1) - last[j]);
  }
  return score;
}

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int D;
  cin >> D;
  vector<ll> c(26);
  for (auto &it : c)
    cin >> it;
  vector<vector<ll>> s(D, vector<ll>(26));
  for (int i = 0; i < D; i++)
  {
    for (int j = 0; j < 26; j++)
    {
      cin >> s[i][j];
    }
  }

  vector<ll> last(26, 0);
  vector<ll> t(D);

  ll score = 0;
  for (int i = 0; i < D; i++)
  {
    ll now = 0;
    ll best_contest = 0;
    for (int co = 0; co < 26; co++)
    {
      ll tmp = calcScore(co, i, last, c, s);
      if (tmp > now)
      {
        now = max(now, tmp);
        best_contest = co;
      }
    }
    last[best_contest] = i + 1;
    score += now;
    cerr << score << endl;
    cout << best_contest + 1 << endl;
  }
  return 0;
}


Measured memory_bytes: 3760
# -*- coding: utf-8 -*-
import random
import sys

sys.setrecursionlimit(100000)
input = sys.stdin.readline

INF = 10**11

def read_int():
    return int(input())


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


def warshall_floyd(g):
    N = len(g)
    for k in range(N):
        for i in range(N):
            for j in range(N):
                g[i][j] = min(g[i][j], g[i][k] + g[k][j])
    return g


def slv(N, M, L, ABC, Q, ST):
    g = [[INF]*(N) for _ in range(N)]

    for a, b, c in ABC:
        if c > L:
            continue
        g[a-1][b-1] = c
        g[b-1][a-1] = c

    d = warshall_floyd(g)

    gg = [[INF]*(N) for _ in range(N)]
    for u in range(N):
        for v in range(N):
            if d[u][v] <= L:
                gg[u][v] = 1

    d = warshall_floyd(gg)

    for s, t in ST:
        c = d[s-1][t-1]
        if c != INF:
            print(c-1)
        else:
            print(-1)


def main():
    N, M, L = read_int_n()
    ABC = [read_int_n() for _ in range(M)]
    Q = read_int()
    ST = [read_int_n() for _ in range(Q)]

    (slv(N, M, L, ABC, Q, ST))


if __name__ == '__main__':
    main()


Measured memory_bytes: 72284
#include <stdio.h>
 
int main(void)
{
	int a, b, x=0, y=0, z=0;
	scanf("%d %d", &a, &b);
	
	x = a+b;
	y = a-b;
	z = a*b;
	
	if(x>y && x>z)
		printf("%d\n", x);
	else if(y>x && y>z)
		printf("%d\n", y);
	else if(z>x && z>y)
		printf("%d\n", z);
	else
		printf("%d\n", x);		
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+10,INF=0x3f3f3f3f;
int f[N][15];
int p[N][15];
int temp[N];
int main()
{
    ios_base::sync_with_stdio(0);
    int n;
	cin>>n;
    for(int i=0;i<n;i++)
	{
        for(int j=0;j<10;j++)
		{
            cin>>f[i][j];
        }
    }
    for(int i=0;i<n;i++)
	{
        for(int j=0;j<=10;j++)
		{
            cin>>p[i][j];
        }
    }
    long long res=-INF;
    for(int i=1;i<(1<<10);i++)
	{
        memset(temp,0,sizeof temp);
        for(int j=0;j<n;j++)
		{
            for(int k=0;k<10;k++)
			{
                if(f[j][k] && ((1<<k)&i))
				{
                    temp[j]++;
                }
            }
        }
        long long t=0;
        for(int j=0;j<n;j++)
		{
            t+=p[j][temp[j]];
        }
        res=max(res,t);
    }
    cout<<res<<endl;
    return 0;
}

Measured memory_bytes: 2688
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+100;
typedef long long ll;
int n,u[N],v[N],sz[N],cnt,RT;
int head[N],to[N],nxt[N],tot;
ll wd[N];

struct P{ll v;int id;}t[N];
inline bool cmp(const P&A,const P&B)
{return B.v<A.v;}

map<ll,int>d;

inline void lk(int u,int v)
{to[++tot]=v;nxt[tot]=head[u];head[u]=tot;}

void dfs(int x,int dep)
{
	wd[RT]+=dep;
	for(int i=head[x];i;i=nxt[i]) dfs(to[i],dep+1);
}

void dfss(int x){
  for(int i=head[x];i;i=nxt[i]) 
   {wd[to[i]]=wd[x]+n-(sz[to[i]]<<1);dfss(to[i]);}
}

int main(){
	int i,j;ll dr;
	scanf("%d",&n);
	for(i=1;i<=n;++i){
		scanf("%lld",&t[i].v);
		d[t[i].v]=i;t[i].id=i;
		sz[i]=1;
	}
	sort(t+1,t+n+1,cmp);
	for(i=1;i<n;++i){
		dr=t[i].v-n+(sz[t[i].id]<<1);
		if(dr<0 || (sz[t[i].id]<<1)==n || (!d[dr])) {puts("-1");return 0;}
		j=d[dr];u[++cnt]=j;v[cnt]=t[i].id;
		sz[j]+=sz[t[i].id];
	}
	for(i=1;i<n;++i) lk(u[i],v[i]);
	RT=t[n].id;
	dfs(RT,0);dfss(RT);
	for(i=1;i<=n;++i){
		if(wd[t[i].id]!=t[i].v) {puts("-1");return 0;}
	}
	for(i=1;i<n;++i) printf("%d %d\n",u[i],v[i]);
	return 0;
}

Measured memory_bytes: 13952
// #pragma GCC optimize("O3")

#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <iomanip>
#include <set>
#include <map>
#include <string>
#include <cstring>
#include <cmath>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cassert>
#include <queue>
#include <deque>
#include <random>
#include <cmath>

#define sz(a) (int)((a).size())
#define all(a) (a).begin(), (a).end()
#define pb push_back

using namespace std; using ll = long long; using pii = pair<int, int>; using vi = vector<int>; using ld = long double;


int32_t main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int n;
    cin >> n;
    vector<pair<int, int>> edges;
    if (n & 1) {
        for (int i = 1; i <= n; i++) {
            for (int j = i + 1; j <= n; j++) {
                if (j == n || i + j != n) {
                    edges.emplace_back(i, j);
                }
            }
        }
    } else {
        for (int i = 1; i <= n; i++) {
            for (int j = i + 1; j <= n; j++) {
                if (i + j != n + 1) {
                    edges.emplace_back(i, j);
                }
            }
        }
    }
    cout << edges.size() << '\n';
    for (auto p : edges) {
        cout << p.first << ' ' << p.second << '\n';
    }
}

Measured memory_bytes: 384
#pragma comment(linker, "/STACK:512000000")
#define _CRT_SECURE_NO_WARNINGS
//#include "testlib.h"
#include <bits/stdc++.h>
using namespace std;

#define all(a) a.begin(), a.end()
typedef long long li;
typedef long double ld;
void solve(bool);
void precalc();
clock_t start;
int main() {
#ifdef AIM
  freopen("/home/alexandero/ClionProjects/ACM/input.txt", "r", stdin);
  //freopen("/home/alexandero/ClionProjects/ACM/output.txt", "w", stdout);
  //freopen("out.txt", "w", stdout);
#else
  //freopen("input.txt", "r", stdin);
  //freopen("output.txt", "w", stdout);
#endif
  start = clock();
  int t = 1;
  cout.sync_with_stdio(0);
  cin.tie(0);
  precalc();
  cout.precision(10);
  cout << fixed;
  //cin >> t;
  int testNum = 1;
  while (t--) {
    //cout << "Case #" << testNum++ << ": ";
    //cerr << testNum << endl;
    solve(true);
    //cerr << testNum - 1 << endl;
  }
  cout.flush();
#ifdef AIM1
  while (true) {
      solve(false);
  }
#endif

#ifdef AIM
  cerr << "\n\n time: " << (clock() - start) / 1.0 / CLOCKS_PER_SEC << "\n\n";
#endif

  return 0;
}

//BE CAREFUL: IS INT REALLY INT?

template<typename T>
T binpow(T q, T w, T mod) {
  if (!w)
    return 1 % mod;
  if (w & 1)
    return q * 1LL * binpow(q, w - 1, mod) % mod;
  return binpow(q * 1LL * q % mod, w / 2, mod);
}

template<typename T>
T gcd(T q, T w) {
  while (w) {
    q %= w;
    swap(q, w);
  }
  return q;
}
template<typename T>
T lcm(T q, T w) {
  return q / gcd(q, w) * w;
}

void precalc() {

}

template<typename T>
void relax_min(T& cur, T val) {
  cur = min(cur, val);
}

template<typename T>
void relax_max(T& cur, T val) {
  cur = max(cur, val);
}

//#define int li
//const int mod = 1000000007;


void solve(bool read) {
  string s;
  cin >> s;
  int res = 1000;
  for (char c = 'a'; c <= 'z'; ++c) {
    int mx = 0;
    for (int i = 0; i < s.length(); ++i) {
      int best = -1;
      for (int j = i; j < s.length(); ++j) {
        if (s[j] == c) {
          best = j;
          break;
        }
      }
      if (best == -1) {
        break;
      }
      relax_max(mx, best - i);
      relax_min(res, max(mx, (int)s.length() - i - 1));
    }
  }

  cout << res << endl;

}

Measured memory_bytes: 256
import collections

MOD = 998244353
n = int(input())
d = list(map(int, input().split()))
if d[0] != 0:
    print(0)
    exit()

d.sort()

c = collections.Counter(d)
if c[0] != 1:
    print('0')
else:
    ans = 1
    k = list(c.keys())
    v = list(c.values())
    for i in range(1, len(v)):
        if k[i]-1 != k[i-1]:
            ans *= 0
        ans *= (v[i-1]**v[i]) % MOD
    print(ans % MOD)


Measured memory_bytes: 19936
#include <stdio.h>
 
int main(){
	int i, N, sum = 0, min = 101;
	int s[101];


	scanf("%d", &N);

	for(i = 1; i <= N; i++) {
		scanf("%d", &s[i]);
	}

	for(i = 1; i <= N; i++) {
		sum += s[i];
		if(s[i] % 10 != 0 && min > s[i]) {
			min = s[i];
		}
	}

	if(sum % 10 != 0) {
		printf("%d", sum);
	}

	else {
		if(min == 101) {
			printf("0");
		}
		else {
			printf("%d", sum - min);
		}
	}
 
}

Measured memory_bytes: 128
#include <algorithm>
#include <iostream>
#include <vector>
#include <string> 
#include <set>
typedef long long ll;
using namespace std;

int arr[1007];
int main() {
    int n, k; cin >> n >> k;
    for (int i = 0; i <= n; ++i) {
        int a = n - i;
        int temp = i * 2 + a * 4;
        if (temp == k) {
            cout << "Yes";
            return 0;
        }
    }
    cout << "No" << endl;


    return 0;
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
int main(){
	int N;cin>>N;
	vector<int> B;
	if(N==0){
		B.push_back(0);
	}while(N!=0){
		if(N%2==0){
			B.push_back(0);
		}else{
			B.push_back(1);
            N--;
		}N=N/(-2);
	}for(int i=B.size()-1;i>=0;i--){
		cout<<B[i];
	}cout<<endl;
}

Measured memory_bytes: 256
import java.util.HashSet;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        HashSet<String> set = new HashSet<>();
        String preString = null;
        int n = sc.nextInt();
        for(int i = 0; i < n; i++) {
            String s = sc.next();
            if(!set.contains(s) && (preString == null || preString.charAt(preString.length()-1) == s.charAt(0))) {
                set.add(s);
                preString = s;
            }
            else {
                System.out.println("No");
                return;
            }
        }
        System.out.println("Yes");
    }
}


Measured memory_bytes: 21844
#include <cstdio>
#include <algorithm>
#include <cmath>
#define Rint register int
#define LL long long
#define F(x,y,z) for(Rint x=y;x<=z;++x)
using namespace std;
inline LL R(){
    char c='!';LL x=0,z=1;
    for( ; c>'9'||c<'0';c=getchar()) if(c=='-')z=-1;
    for(;c>='0'&&c<='9';c=getchar()) x=x*10+c-'0';
    return x*z;
}
int n,m;

int main()
{
	scanf("%d%d",&n,&m);
	printf("%d\n",n-1+(m>=n));
	return 0;
}



Measured memory_bytes: 128
K=int(input())
a,b=map(int,input().split())
c=a//K
d=b//K
if b-a>=K:
  print('OK')
elif d-c>=1:
  print('OK')
else:
  if a%K==0 or b%K==0:
    print('OK')
  else:
    print('NG')

Measured memory_bytes: 9180
#include<iostream>
#include<vector>
#include<cmath>
#include<algorithm>
#include<iomanip>
#include<cassert>
#include<sstream>
#include<complex>
#include<cstdio>
#include<climits>
#include<cstdlib>
#include<deque>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<ctime>
#include<cctype>
#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define inf (2147483647)
#define EPS 1e-10
#define equals(a,b) (fabs((a)-(b)) < EPS) 
#define MAX_N 500010

using namespace std;

template<class T>
class RMQ{
private:
  int n;
  T dat[2*MAX_N-1];
public:
  void init(int n_){
    n = 1;
    while(n<n_)n*=2;
    for(int i=0;i<2*n-1;i++)dat[i] = inf;//
  }
 
// k????????????(0-indexed)???a????????卒
  void update(int k,T a){
    k += n-1;
    dat[k] = a;
    while(k > 0){
      k = (k-1)/2;
      dat[k] = min(dat[k*2+1],dat[k*2+2]);
    }
  }
 
  T query(int a,int b,int k,int l,int r){
    if(r<=a || b<=l)return inf;
    else if(a<=l && r<=b)return dat[k];
     
      T vl = query(a,b,k*2+1,l,(l+r)/2);
      T vr = query(a,b,k*2+2,(l+r)/2,r);
      return min(vl,vr);
  }

//n???????????則?????????????????????????\?????????贈???????????即 
  T _query(int a,int b){
    return query(a,b,0,0,n);
  }
};


int main()
{
  int n,q,com,x,y;
  //scanf("%d%d",&n,&q);
  cin >> n >> q;
  RMQ<int> rmq;
  rmq.init(n+1);
  rep(i,q)
    {
      //scanf("%d%d%d",&com,&x,&y);
      cin >> com >> x >> y;
      if(com == 0)rmq.update(x,y);
      else        cout << rmq._query(x,y+1) << endl;
    }

  return 0;
}

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

#define rep(i, n) for(int i = 0; i < (n); i++)
#define all(a) (a).begin(),(a).end()
#define SORT(a) sort(all(a))
#define rSORT(a, i) sort(all(a),(i))

using ll = long long;
constexpr ll INF = 10000000000;
constexpr ll MOD = 1000000007;
constexpr int MAX = 2000200;
constexpr double EPS = 1E-11;

using namespace std;

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

	if (a==b&&b==c) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}




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

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

using namespace std;

int main() {
	int M,T,P,R;
	while(true){
		cin >> M >> T >> P >> R;
		if(M==0) return 0;
		vector<int> m(R),t(R),p(R),j(R);
		REP(i,R){
			cin >> m[i] >> t[i] >> p[i] >> j[i];
			t[i]--;
			p[i]--;
		}
		vector<vector<int>> pena(T,vector<int>(P));
		vector<vector<int>> score(T,vector<int>(2)); //seikai,jikan

		REP(i,R){
			if(j[i] == 0){
				score[t[i]][0]++;
				score[t[i]][1]+=pena[t[i]][p[i]] + m[i];
			}
			pena[t[i]][p[i]]+=20;
		}

		vector<tuple<int,int,int>> tupleScore(T);
		REP(i,T){
			tupleScore[i] = make_tuple(-score[i][0],score[i][1],-1-i);
		}
		sort(ALL(tupleScore));

		int top;
		tie(ignore,ignore,top) = tupleScore[0];
		cout << -top;
		REP(i,T-1){
			int ans1,tim1,ans2,tim2;
			tie(ans1,tim1,ignore)=tupleScore[i];
			tie(ans2,tim2,top)=tupleScore[i+1];
			if(ans1==ans2 && tim1==tim2){
				cout << "=" << -top;
			}
			else{
				cout << "," << -top;
			}
		}

		cout << endl;	
	}
	return 0;
}

Measured memory_bytes: 3128
//#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast,no-stack-protector") 
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>


#define ll long long
#define int ll
#define ull unsigned long long
#define ld long double
#define rep(i, l, r) for (int i = l; i < r; i++)
#define repb(i, r, l) for (int i = r; i > l; i--)
#define sz(a) (int)a.size()
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define pb push_back
#define mp(a, b) make_pair(a, b)
#define ret(a) {cout << a; exit(0);}

using namespace std;

mt19937 mrand(random_device{}()); 
const ll mod=1000000007;
int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b,ll mod) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}

typedef pair < int , int > pii ;
typedef pair < long long  , long long > pll ;

const int N = 3e5 + 1;

int n, m, k;
int a[N], f[N];

main(){
	ios::sync_with_stdio(0); cin.tie(0);cout.tie(0);
	cin >> n >> m;
	int ans = 0;
	for(int i = 1; i <= n; i++){
		int x;
		cin >> x;
		ans += x >= m;
	}
	cout << ans ;

}


Measured memory_bytes: 256
import java.util.Scanner;
 
public class Main {
 
    public static void main(String[] args) {
        new Main().compute();
    }
 
    void compute() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] t = new int[N + 1];
        int[] v = new int[N + 1];
        for (int i = 0; i < N; i++) {
            t[i] = sc.nextInt();
        }
        for (int i = 0; i < N; i++) {
            v[i] = sc.nextInt();
        }
        for (int i = N - 1; i >= 0; i--) {
            v[i] = Math.min(v[i], v[i + 1] + t[i]);
        }
        double x = 0;
        double vc = 0;
        for (int i = 0; i < N; i++) {
            double vn = v[i + 1];
            if (v[i] < vn) {
                vn = v[i];
            }
            if (vc + t[i] < vn) {
                double vmax = vc + t[i];
                x += vmax * t[i];
                x -= (vmax - vc) * (vmax - vc) / 2;
                vc = vc + t[i];
            } else {
                double vmax = Math.min(v[i], (vc + vn + t[i]) / 2);
                x += vmax * t[i];
                x -= ((vmax - vc) * (vmax - vc) + (vmax - vn) * (vmax - vn)) / 2;
                vc = vn;
            }
        }
        System.out.println(x);
    }
}

Measured memory_bytes: 23764
use std::io;
use std::str::FromStr;
use std::string::String;

fn main() {
    let stdin = io::stdin();
    let mut buf = String::new();
    stdin.read_line(&mut buf).ok();
		
		let mut cnt : isize = 0;
		for c in buf.chars(){
			if c == '+' {
				cnt += 1;
			}
			else if c == '-'{
				cnt -= 1;
			}
		}

		println!("{}",cnt);
}

Measured memory_bytes: 4352
# coding: utf-8

import sys
import math
import collections
import itertools
def input(): return sys.stdin.readline().strip()
def gcd(x, y): return y if x % y == 0 else gcd(y, x % y)
def lcm(x, y): return (x * y) // gcd(x, y)
MOD = 10 **9 + 7

# N = int(input())
# S = input()
K, X = map(int, input().split())
# 横
# L = [int(x) for x in input().split()]
# 縦
# A = [int(input()) for _ in range(N)]
# 多次元
# L = [[int(x) for x in input().split()] for _ in range(N)]

for i in range(X - K + 1, X + K) :
        print(i, end=" ")

print()

Measured memory_bytes: 38384
import sys
from collections import *
import heapq
import math
import bisect
from itertools import permutations,accumulate,combinations,product
from fractions import gcd
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
mod=pow(10,9)+7

n=int(input())
a=list(map(int,input().split()))
rui=ruiseki(a)
rui.sort()
ans=0
tmp=rui[0]
cnt=1
# print(rui)
for i in range(n):
    if tmp==rui[i+1]:
        cnt+=1
    else:
        tmp=rui[i+1]
        ans+=cnt*(cnt-1)//2
        cnt=1
    # print(i,ans,cnt)
print(ans+cnt*(cnt-1)//2)

Measured memory_bytes: 119500
A,B,C = map(int,input().split())
ans = 0
if A == B == C:
  if A%2 != 0 or B%2 != 0 or C%2 != 0:
    pass
  else:
    ans = -1
else:
  while A%2 == 0 and B%2 == 0 and C%2 == 0:
    A,B,C = B//2+C//2,A//2+C//2,A//2+B//2
    ans += 1
print(ans)

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

class Program
{
    static void Main(string[] args)
    {
        new Magatro().Solve();
    }
}

class Magatro
{
    private int N, A, B;
    private int[] H;

    private bool Check(int n)
    {
        long cnt = 0;
        foreach (int i in H)
        {
            long p = i;
            p -= (long)B * n;
            if (p <= 0)
            {
                continue;
            }
            cnt += p / (A - B);
            if (p % (A - B) != 0)
            {
                cnt++;
            }
        }
        return cnt <= n;
    }

    public void Solve()
    {
        var line = Console.ReadLine().Split(' ');
        N = int.Parse(line[0]);
        A = int.Parse(line[1]);
        B = int.Parse(line[2]);
        H = new int[N];
        for (int i = 0; i < N; i++)
        {
            H[i] = int.Parse(Console.ReadLine());
        }

        int max = 2000000000;
        int min = -1;
        while (max - min > 1)
        {
            int mid = (max + min) / 2;
            if (Check(mid))
            {
                max = mid;
            }
            else
            {
                min = mid;
            }
        }
        Console.WriteLine(max);
    }
}




Measured memory_bytes: 17376
n,k = map(int,input().split())
a = list(map(int,input().split()))
f = list(map(int,input().split()))
a.sort()
f.sort(reverse=True)

def isok(m):
  c = 0
  for i,j in zip(a,f):
    if i*j >= m:
      c += i - m//j
    if c > k:
      return False
  return True

ok = 10**12+1
ng = -1
while abs(ok-ng) > 1:
  m = (ok+ng) // 2
  if isok(m):
    ok = m
  else:
    ng = m
print(ok)

Measured memory_bytes: 120652
#include <algorithm>
#include <bitset>
#include <cstdio>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;

constexpr int MOD = 1000000007;

typedef long long LL;
typedef pair<int, int> P;
typedef pair<LL, LL> PLL;

int main() {
    string a = "CODEFESTIVAL2016";
    string s;
    cin >> s;
    int count = 0;
    for (int j = 0; j < s.size(); ++j) {
        if (a[j] != s[j]) {

            ++count;
        }
    }
    cout << count << endl;


    return 0;
}


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

int main() {
    string T;
    cin >> T;
  int n=T.size();
  vector<string> a(n);
  
  for(int i=0; i < n; i++){
  a.at(i)=T[i];  
  }
  
  
  for (int i=0; i < n; i++){
    if(a.at(i)=="?"){
      a.at(i)="D";
     }
     }
  
string Z="";
  
 for (int i =0; i<n;i++){
   Z += a.at(i);
 }
  
  cout << Z << endl;
  
  }
  

Measured memory_bytes: 10116
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll (i) = 0; (i) < (n); (i)++)
#define rep1(i, n) for(ll (i) = 1; (i) <= (n); (i)++)
#define rrep(i, n) for(ll (i) = (n) - 1; (i) >= 0; (i)--)
#define rrep1(i, n) for(ll (i) = (n); (i) >= 1; (i)--)
const ll INF = 1145141919810893;
const ll MOD = 1000000007;
template<class T> void chmax(T &a, const T &b){if(a < b){a = b;}}
template<class T> void chmin(T &a, const T &b){if(a > b){a = b;}}

int main(){

    ll N;
    cin >> N;
    cout << N * N << endl;

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#define MAX 100000
#define SENTINEL 2000000000

struct Card{
  char suit;
  int value;
};

struct Card L[MAX/2+2],R[MAX/2+2];

void merge(struct Card A[],int left,int mid,int right){
  int i,j,k,n1=mid-left,n2=right-mid;

  for(i=0;i<n1;i++)L[i] = A[left + i];
  for(i=0;i<n2;i++)R[i] = A[mid + i];
  L[n1].value = R[n2].value = SENTINEL;
  i = j = 0;
  for(k=left;k<right;k++){
    if(L[i].value <= R[j].value){
      A[k] = L[i++];
    }
    else {
      A[k] = R[j++];
    }
  }
}
void mergeSort(struct Card A[],int left,int right){
  int mid;
  if(left+1 < right){
    mid = (left+right)/2;
    mergeSort(A,left,mid);
    mergeSort(A,mid,right);
    merge(A,left,mid,right);
  }
}
int partition(struct Card A[],int p,int r){
  int i,j;
  struct Card a,x;
  x =A[r];
  i = p-1;
  for(j=p;j<r;j++){
    if(A[j].value <= x.value){
      i++;
      a = A[i];
      A[i] = A[j];
      A[j] = a;
    }
  }
  a = A[i+1];
  A[i+1] = A[r];
  A[r] = a;
  return i+1;
}
void quickSort(struct Card A[],int p,int r){
  int q;
  if(p<r){
    q = partition(A,p,r);
    quickSort(A,p,q-1);
    quickSort(A,q+1,r);
  }
}
main(){
  int n,i,v;
  struct Card A[MAX],B[MAX];
  char S[10];
  int stable = 1;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%s %d",S,&v);
    A[i].suit = B[i].suit = S[0];
    A[i].value = B[i].value = v;
  }
  mergeSort(A,0,n);
  quickSort(B,0,n-1);
  for(i=0;i<n;i++){
    if(A[i].suit != B[i].suit)stable = 0;
  }
  if(stable == 1)printf("Stable\n");
  else printf("Not stable\n");
  for(i=0;i<n;i++){
    printf("%c %d\n",B[i].suit,B[i].value);
  }
}





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



int h,w,k;
char grid[10][10];

int solve(int a,int b){
    int cntb=0;
    for(int i = 0; i < h; i++){
        if(a&(1<<i)){
            continue;
        }
        for(int j = 0; j < w; j++){
            if(b&(1<<j)){
                continue;
            }
            cntb+=(grid[i][j]=='#');
        }
    }

    return cntb;
}



int main()
{
    cin >> h >> w >> k;
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            cin>>grid[i][j];
        }
    }
    int cnt=0;
    for(int i = 0; i < (1<<h); i++){
        for(int j = 0; j < (1<<w); j++){
            if(solve(i,j)==k){
                cnt++;
            }
        }
    }
    cout<<cnt<<"\n";
    return 0;
}

Measured memory_bytes: 3588
#include<iostream>

using namespace std;

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

int N;
long long int T[110];
int main () {
    cin >> N;
    for(int i=0; i<N; i++) cin >> T[i];
    long long int lcm = 1;
    for(int i=0; i<N; i++) {
        long long int a = T[i];
        long long int b = lcm;

        if( b > a ) swap(a,b);
        lcm = a / gcd(a,b) * b;
    }
    cout << lcm << endl;
    return 0;
}


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;
using P = pair<int, int>;

int main() {
	ll H, W;
	cin >> H >> W;

	ll ans = 0;
	if (H == 1 || W == 1) {
		ans = 1;
	}
	else if (H % 2 != W % 2) {
		ans = H * W / 2;
		
	}
	else if (H % 2 == 0) {
		ans = H * W / 2;
	}
	else {
		ans = H * (W / 2) + H / 2 + 1;
	}

	cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define INF (1LL<<50)
#define MOD 1000000007

int H,W;
int dx[] = {-1,0,0,1};
int dy[] = {0,-1,1,0};
int max_num;
vector<vector<int>> seen;
deque<pair<int,int>> dq;

void init_seen(){
    rep(i,H+2)rep(j,W+2) seen[i][j] = -1;
}

void bfs(vector<string> &S,int i, int j,int num){
    //cout << i << "-" << j << "-" << num << endl;
    max_num = max(max_num,num);
    while(!dq.empty()){
        int ni = dq.front().first;
        int nj = dq.front().second;
        dq.pop_front();
        for(int k=0;k<4;k++){

        }
    }
}

int main(){

    cin >> H >> W;
    vector<string> S(H+2);
    seen.resize(H+2,vector<int>(W+2));
    rep(i,H){
        cin >> S[i+1];
        S[i+1] = '#' + S[i+1] + '#';
    }
    rep(i,W+2){
        S[0] = S[0]+'#';
        S[H+1] = S[H+1]+'#';
    }
    int ans = -1;
    for(int i=0;i<H+2;i++){
        for(int j=0;j<W+2;j++){
            if(S[i][j]=='#') continue;
            max_num = -1;
            init_seen();
            dq.push_back(make_pair(i,j));
            seen[i][j]=0;
            while(!dq.empty()){
                int ni = dq.front().first;
                int nj = dq.front().second;
                dq.pop_front();
                for(int k=0;k<4;k++){
                    if(S[ni+dy[k]][nj+dx[k]]!='#'&&seen[ni+dy[k]][nj+dx[k]]==-1){
                        seen[ni+dy[k]][nj+dx[k]]=seen[ni][nj]+1;
                        max_num = max(max_num,seen[ni][nj]+1);
                        dq.push_back(make_pair(ni+dy[k],nj+dx[k]));
                    }
                }
            }
            ans = max(ans,max_num);
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
# coding: utf-8
N, X, Y = map(int, input().split())
ans = [0]*N
for i in range(1,N):
    for j in range(i+1,N+1):
        l = min(j-i, abs(X-i)+1+abs(Y-j))
        ans[l] += 1
for k in range(1,N):
    print(ans[k])

Measured memory_bytes: 3444
import itertools

n=int(input())
P=list(map(int,input().split()))
Q=list(map(int,input().split()))

X=[]

for i in range(n):
    X.append(i+1)
i=0
for v in itertools.permutations(X,n):
    i+=1
    if list(v)==P:
        p=i
    if list(v)==Q:
        q=i
print(abs(p-q))

Measured memory_bytes: 3316
from collections import Counter
n, x, y = map(int, input().split())
c = Counter()
for i in range(1, n):
    for j in range(i+1, n+1):
        dist = min(abs(j-i), abs(x-i)+1+abs(j-y), abs(y-i)+1+abs(j-x))
        c[dist] += 1

for k in range(1, n):
    print(c[k])


Measured memory_bytes: 9516
import sys
import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

# テスト用コード
# Ciの値でsortする、Tを0000で固定した後、最後に2**N倍
N = ir()
C = np.array(lr())
MOD = 10 ** 9 + 7
C.sort()
# N-2がマイナスになる時に注意、一番右は2**(N-1)
two_power = np.array([(1+N-i) * pow(2, (N-2), MOD) % MOD if i < N-1 else pow(2, i, MOD) for i in range(N)])
answer = (C * two_power % MOD).sum() % MOD * pow(2, N, MOD)
print(answer%MOD)


Measured memory_bytes: 34488
function Main(input) {
  input = input.split("\n");
  var A = parseInt(input[0].split(" ")[0]);
  var B = parseInt(input[0].split(" ")[1]);
  var sum=0;
  if(A > B){
    sum=sum+A;
    A=A-1;
  }else{
    sum=sum+B;
    B=B-1;
  }
  if(A > B){
    sum=sum+A;
    A=A-1;
  }else{
    sum=sum+B;
    B=B-1;
  }
  console.log(sum);
}

var input=Main(require("fs").readFileSync("/dev/stdin", "utf8"));
// var input=`3 4`
// Main(input);

Measured memory_bytes: 21064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, begin, end) for (int i = begin; i < (int)(end); i++)
#define all(v) v.begin(), v.end()
const int MOD = 1000000007;

int main()
{
    char a;
    cin >> a;
    a++;
    cout << a << endl;
}

Measured memory_bytes: 256
// be name khoda
#include<bits/stdc++.h>
 
using namespace std;
 
#define F first
#define S second
//#define mp make_pair 
typedef long long ll;
#define int long long
#pragma GCC optimize("Ofast")
 
const int maxn = 1e5+10;
const int mod = 1e9+7;
const ll inf = 1e18+10;
//const int N = 2e6+10;
 
int n, k;
int a[maxn];

int ok(int n)
{
    for(int i = 1; i <= k; i++)
        n = n - n % a[i];
    if(n == 2) return 1;
    if(n > 2) return 2;
    if(n < 2) return 0;
}

signed main()
{
    // ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    
    cin>> k;
    for(int i = 1; i <= k; i++) cin>> a[i];

    int lo = -1, hi = inf;
    while (hi-lo > 1)
    {
        int tm = (hi+lo) >> 1;
        if(ok(tm) >= 1) hi = tm;
        else lo = tm;
    }
    int X = hi;

    lo = -1, hi = inf;
    while (hi-lo > 1)
    {
        int tm = (hi+lo) >> 1;
        if(ok(tm) > 1) hi = tm;
        else lo = tm;
    }
    int Y = lo;

    if(X > Y) cout<< -1;
    else cout<< X <<" "<< Y;
}


Measured memory_bytes: 1024
#include<stdio.h>

int fibonacci(long long);

int main(){
  int n;

  scanf("%d",&n);
  printf("%lld\n",fibonacci(n));

  return 0;
}
  
int fibonacci(long long n){
  int hairetu[60],i;

  hairetu[0]=1;
  hairetu[1]=1;
  for(i=2;i<=n;i++){
    hairetu[i]=hairetu[i-1]+hairetu[i-2];
  }
  return hairetu[n];
}

Measured memory_bytes: 596
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <vector>
#include <cstdio>
using namespace std;

int main()
{
     char a,b,c,d,e,f,g,h,i;
    cin>>a>>b>>c>>d>>e>>f>>g>>h>>i;
    cout<<a<<e<<i;
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>  // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <bitset>     // bitset
#include <cctype>     // isupper, islower, isdigit, toupper, tolower
#include <cstdint>    // int64_t, int*_t
#include <cstdio>     // printf
#include <deque>      // deque
#include <iomanip>    // fixed, setprecision
#include <iostream>   // cout, endl, cin
#include <map>        // map
#include <numeric>    // accumulate
#include <queue>      // queue, priority_queue
#include <set>        // set
#include <stack>      // stack
#include <string>     // string, to_string, stoi
#include <tuple>      // tuple, make_tuple
#include <unordered_map>  // unordered_map
#include <unordered_set>  // unordered_set
#include <utility>        // pair, make_pair
#include <vector>         // vector
using namespace std;
typedef long long ll;
typedef unsigned long long ull;

int main() {
  int N, rc, wc, rec, wec;
  string c;
  cin >> N >> c;

  rc = count(c.begin(), c.end(), 'R');
  wc = count(c.begin(), c.end(), 'W');
  rec = count(c.end() - wc, c.end(), 'R');
  wec = count(c.begin(), c.begin() + rc, 'W');

  cout << max(rec, wec) << endl;
}


Measured memory_bytes: 3460
import sys
input = sys.stdin.readline
from collections import deque
N, u, v = map(int, input().split())
u, v = u-1, v-1
X = [[] for i in range(N)]
for i in range(N-1):
    x, y = map(int, input().split())
    X[x-1].append(y-1)
    X[y-1].append(x-1)

P = [-1] * N
Q = deque([v])
R = []
while Q:
    i = deque.popleft(Q)
    R.append(i)
    for a in X[i]:
        if a != P[i]:
            P[a] = i
            X[a].remove(i)
            deque.append(Q, a)

DE = [0] * N
for i in R[1:]:
    DE[i] = DE[P[i]] + 1

D = [0] * N
for i in R[::-1]:
    D[i] = max([D[j] for j in X[i]] + [DE[i]])

i = u
ma = D[i]
while True:
    i = P[i]
    if DE[i] * 2 <= DE[u]: break
    ma = max(ma, D[i])

print(ma - 1)


Measured memory_bytes: 66428
#include<iostream>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<vector>
#include<string>
#include <ios>     
#include <iomanip> 
using namespace std;
typedef long long llong;
typedef unsigned long long ullong;



llong gcd(llong a, llong b) {
	if (a < b) swap(a, b);
	if (a % b == 0) return b;
	else return gcd(b, a % b);
}

llong lcm(llong a, llong b) {
	llong g = gcd(a, b);
	return a * b / g;
}

//ここまで共通

char C[110][110];

int H, W;

int main() {
	cin >> H >> W;
	for (int i = 1; i <= H; i++) {
		for (int j = 1; j <= W; j++) {
			cin >> C[i][j];
		}
	}

	for (int i = 1; i <= 2 * H; i++) {
		for (int j = 1; j <= W; j++) {
			cout << C[(i + 1) / 2][j];
		}
		cout << endl;
	}
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <unordered_map>
#include <vector>
#include <string.h>
#include <set>

using namespace std;

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

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

int dx[] = { 1, -1, 0, 0 };
int dy[] = { 0, 0, 1, -1 };

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> triple;
typedef double D;

const ll INF = 1e9;
const ll MOD = 1000000007;  // 1e9 + 7

vector< vector<int> > A;
vector<P> q; // Match queue

// Check the remaining matches. If match can be made, push it to queue.
void check(int i) {
  if (A[i].size() == 0) { return; }
  int j = A[i].back();
  if (A[j].back() == i) {
    if (i > j) { swap(i, j); }  // Force i < j
    q.emplace_back(i, j);
  }
}

int main(int argc, char** argv) {
  int N;
  cin >> N;

  A.assign(N, vector<int>(N-1));
  rep(i, N) {
    rep(j, N-1) {
      cin >> A[i][j];
      --A[i][j];
    }
    reverse(all(A[i]));
  }

  // Push first matches.
  rep(i, N) {
    check(i);
  }

  int day = 0;
  while (q.size() > 0) { // Repeat until match que
    sort(all(q));
    q.erase(unique(all(q)), q.end());

    vector<P> prevQ;
    swap(prevQ, q); // Set q to prevQ, set empty vector to q.
    for (auto p : prevQ) {
      A[p.first].pop_back(); // pop match
      A[p.second].pop_back(); // pop match
    }
    for (auto p : prevQ) {
      check(p.first);
      check(p.second);
    }

    ++day;
  }

  // Check the remaining of A
  rep(i, N) {
    if (A[i].size() != 0) {
      cout << -1 << endl;
      return 0;
    }
  }

  cout << day << endl;
}


Measured memory_bytes: 4224
//
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
// #define MOD 1000000007
#define rp(i,n) for(int i=0;i<(n);i++)
#define up(i,s,e,d) for(int i=(s);i<(e);i+=(d))
#define ot(x) cout<<(x)
#define ote(x) cout<<(x)<<endl
#define all(x) (x).begin(),(x).end()

int main(){
	string s; cin>>s;
	vector<string> T{"Sunny", "Cloudy", "Rainy"};
	string ans;
	if(s[0]=='S')ans = T[1];
	else if(s[0]=='C')ans = T[2];
	else ans = T[0];
	ote(ans);
}


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

using namespace std;
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;

int main() {

    ll a; cin >> a;
    string b; cin >> b;

    string c = "";
    for (int i = 0; i < b.length(); ++i) {
        if (0 <= b[i] - '0' && b[i] - '0' <= 9) {
            c += b[i];
        }
    }

    cout << a * stoll(c) / 100 << endl;
}

Measured memory_bytes: 3620
N,K=map(int,input().split())
goods=[tuple(map(int,input().split())) for i in range(N)]
ALL=0
from collections import defaultdict
data=defaultdict(int)
B=0
KS=bin(K)[2:]
for a,b in goods:
    astr=bin(a)[2:]
    if len(astr)>len(KS):
        continue
    else:
        B+=b
        for i in range(-1*len(astr),0):
            if astr[i]==KS[i]=="1":
                data[i]+=b
            elif astr[i]=="1" and KS[i]=="0":
                data[i]+=b
                break
ans=0
for i in range(-1*len(KS),0):
    if KS[i]=="1":
        ans=max(B-data[i],ans)
    else:
        B-=data[i]
ans=max(B,ans)
print(ans)

Measured memory_bytes: 18916
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(s,t) for (int s = 0; s < t; ++s);
using ll = long long;


int main() {
  int a,b;

  cin >> a >> b;

  long long ans = a*b;

  cout << ans << endl;
}

Measured memory_bytes: 3596
def gcd(a, b):
  if a < b:
    a, b = b, a
  while a % b:
    a, b = b, a % b
  return b

k = int(input())
total = 0
for a in range(1, k+1):
  for b in range(a, k+1):
    for c in range(b, k+1):
      if a == b == c:
        total += gcd(gcd(a, b), c)
      elif a == b or b == c:
        total += 3*gcd(gcd(a, b), c)
      else:
        total += 6*gcd(gcd(a, b), c)
print(total)


Measured memory_bytes: 9100