akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define ll long long
#define inf 0x3f3f3f3f
#define mod 1000000007
#define PI acos(-1)
#define fi first
#define se second
#define lowbit(x) (x&(-x))
#define mp make_pair
#define pb push_back
#define ins insert
#define si size()
#define E exp(1.0)
#define fixed cout.setf(ios::fixed)
#define fixeds(x) setprecision(x)
#pragma GCC optimize(2)
using namespace std;
inline ll read(){ll s=0,w=1;char ch=getchar();
while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=getchar();}
while(ch>='0'&&ch<='9') s=s*10+ch-'0',ch=getchar();
return s*w;}void put1(){ puts("YES") ;}void put2(){ puts("NO") ;}
void put3(){ puts("-1"); }ll qpf(ll a, ll b, ll p){ll ret = 0;while(b)
{if(b & 1) ret = (ret + a) % p;a = (a + a) % p;b >>= 1;}return ret % p ;}
ll qp(ll a, ll n, ll p){ll ret = 1;while(n){if(n & 1) ret = qpf(ret, a, p);
a = qpf(a, a, p);n >>= 1;}return ret % p ;}//��=acos(L/2R);
//void debug1(){ cout<<"I CAN AC"<<endl;}//void debug2(){printf("T A T\n");}

const int manx=2e5+5;

ll dp[manx];
map<ll,ll>cnt;
int main(){
    ll n=read(),p=read();
    string s; cin>>s;
    ll ans=0;
    if(p==2||p==5){
        for(int i=n-1;i>=0;i--)
            if((s[i]-'0')%p==0)
                ans+=(i+1);
    }
    else{
        cnt[0]=1;
        ll base=1,res=0;
        for(int i=n-1;i>=0;i--){
            res+=base*(s[i]-'0');
            res%=p;
            ans+=cnt[res];
            cnt[res]++;
            base*=10,base%=p;
        }
    }
    printf("%lld",ans);
    return 0;
}


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

int main(){	
	long long H;
	long long W;
	long long Q;
	long long D;
	scanf("%lld",&H);
	scanf("%lld",&W);
	vector< vector<long long> > A(H-1+1,vector<long long>(W-1+1));
	scanf("%lld",&D);
	for(int i = 0 ; i <= H-1 ; i++){
		for(int j = 0 ; j <= W-1 ; j++){
			scanf("%lld",&A[i][j]);
		}
	}
	scanf("%lld",&Q);
	vector<long long> R(Q-1+1);
	vector<long long> L(Q-1+1);
	for(int i = 0 ; i <= Q-1 ; i++){
		scanf("%lld",&L[i]);
		scanf("%lld",&R[i]);
	}
	vector< vector< pair<ll, pair<ll, ll> > > > g(D);

	for(int i = 0 ; i <= H-1 ; i++){
		for(int j = 0 ; j <= W-1 ; j++){
			pair<ll, pair<ll, ll> > p;
			p.first = A[i][j];
			p.second.first = i;
			p.second.second = j;
			g[A[i][j]%D].push_back(p);
		}
	}

	for(int i = 0 ; i <= D-1 ; i++){
		sort(g[i].begin(), g[i].end());
	}

	vector< vector< ll > > h(D);
	for(int i = 0 ; i <= D-1 ; i++){
		for(int j = 0; j < g[i].end()-g[i].begin(); j++) {
			if (j == 0) {
				h[i].push_back(0);
			} else {
				h[i].push_back(h[i][j-1]+abs(g[i][j].second.first-g[i][j-1].second.first)+abs(g[i][j].second.second-g[i][j-1].second.second));
			}
		}
	}

	// for(int i = 0 ; i <= D-1 ; i++){
	// 	for(int j = 0; j < g[i].end()-g[i].begin(); j++) {
	// 		cout << i << " " << j << " " << h[i][j] << endl;
	// 	}
	// }
	
	for(int i = 0 ; i <= Q-1 ; i++){
		cout << h[R[i]%D][(R[i]-1)/D] - h[L[i]%D][(L[i]-1)/D] << endl;
	}

	return 0;
}



Measured memory_bytes: 12544
#include <stdio.h>

int main(void){
    int n, m, a[51], b[51], count[51]={0};
    scanf("%d%d", &n, &m);
    for(int i=0; i<m; i++) scanf("%d%d", &a[i], &b[i]);
    for(int i=0; i<m; i++) count[a[i]]++, count[b[i]]++;
    for(int i=1; i<=n; i++) printf("%d\n", count[i]);
    return 0;
}

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

using namespace std;

typedef long long ll;

int main(){
    ll res=0;
    int n;
    cin>>n;
    vector <int> a(n+1), b(n);
    for(int i=0;i<n+1;i++){
        cin>>a[i];
    }
    for(int i=0;i<n;i++){
        cin>>b[i];
    }
    reverse(a.begin(), a.end());
    reverse(b.begin(), b.end());
    for(int i=0;i<n;i++){
        ll ab=min(a[i], b[i]);
        res+=ab;
        b[i]-=ab;
        a[i]-=ab;
        ll ab2=min(a[i+1], b[i]);
        res+=ab2;
        b[i]-=ab2;
        a[i+1]-=ab2;
    }
    cout<<res<<endl;
    return 0;
}

Measured memory_bytes: 1024
import java.util.Scanner;
public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int sum = 0;

		if(A>=B) {
			sum+=A;
			A--;
		}else {
			sum+=B;
			B--;
		}
		if(A>=B) {
			sum+=A;
			A--;
		}else {
			sum+=B;
			B--;
		}
		System.out.println(sum);
	}
}


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


int main(){
  string s;
  cin >> s;
  if(s=="RRR"){
    cout << 3 << endl;
  }else if((s[0]=='R'&&s[1]=='R')||(s[2]=='R'&&s[1]=='R')){
    cout << 2 << endl;
  }else if(s[0]=='R'||s[1]=='R'||s[2]=='R'){
    cout << 1 << endl;
  }else{
    cout << 0 << endl;
  }
}



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

int isOdd(int a){
	if ( a % 2 == 0){
		return 0;
	} else {
		return 1;
	}
}

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

int count = 0;
int a[N];
for (int i = 0; i < N; i++){
	cin >> a[i];
	if ( isOdd(i+1) && isOdd(a[i]) ){
		count++;
	}
}

cout << count << endl;
return 0;
}


Measured memory_bytes: 3628
"""
"""


def int_as_array(num): return list(map(int, [y for y in str(num)]))


def array_as_int(arr): return int(''.join(map(str, arr)))


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


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


def array_to_string(arr, sep=' '): return sep.join(map(str, arr))


def matrix_to_string(arr, sep=' '): return '[\n' + '\n'.join(
    [sep.join(map(str, row)) for row in arr]) + '\n]'


def solve(string):
    if string[2] == string[3] and string[4] == string[5]:
        print('Yes')
    else:
        print('No')


string = input()
solve(string)


Measured memory_bytes: 3064
using System;

namespace _0578
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            string name = Console.ReadLine();
            int ret = 0;
            for (int i = 0; i < n; i++)
            {
                string s = Console.ReadLine();
                bool flag = false;
                for (int j = 0; j < s.Length; j++)
                {
                    for (int k = 1; j + k * (name.Length-1) < s.Length; k++)
                    {
                        string a = "";
                        for (int l = 0; l < name.Length; l++)
                        {
                            a += s[j + k * l];
                        }
                        if (a == name) flag = true;
                    }
                }
                if (flag) ret++;
            }
            Console.WriteLine(ret);
        }
    }
}

Measured memory_bytes: 9296
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Practice
{
    class Program
    {
        static void Main(string[] args)
        {
            SolveA();
            //SolveB();
            //SolveC();
            //SolveD();
        }
        private const long MOD = 1000000007;

        static void SolveA()
        {
            var o = ReadAndParseIntArr();
            int x = o[0];
            int a = o[1];
            int b = o[2];
            string ans = Math.Abs(x - a) < Math.Abs(x - b) ? "A" : "B";
            Console.WriteLine(ans);
        }

        #region よく使う便利関数
        private static bool isPrime(long x)
        {
            if (x == 2) { return true; }
            if (x < 2 || x % 2 == 0) { return false; }
            long i = 3;
            while (i * i <= x)
            {
                if (x % i == 0) { return false; }
                i = i + 2;
            }
            return true;
        }
        private static long lcm(long x, long y)
        {
            return x / gcd(x, y) * y;
        }
        private static long gcd(long x, long y)
        {
            return y > 0 ? gcd(y, x % y) : x;
        }
        private static long pow(long x, long n)
        {
            if (n == 0) { return 1; }
            long res = pow(x * x % MOD, n / 2);
            if (n % 2 == 1)
            {
                res = res * x % MOD;
            }
            return res;
        }
        private static int ReadAndParseInt()
        {
            return int.Parse(Console.ReadLine());
        }
        private static int[] ReadAndParseIntArr()
        {
            return Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
        }
        private static long ReadAndParseLong()
        {
            return long.Parse(Console.ReadLine());
        }
        private static long[] ReadAndParseLongArr()
        {
            return Array.ConvertAll(Console.ReadLine().Split(' '), long.Parse);
        }
        #endregion
    }
}

Measured memory_bytes: 11220
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define lper(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};
long long fac(ll a){
    long long ans=1;
    while(a>1){
        ans*=a;
        a--;
    }
    return ans;
}
int main(){
    ll n;
    cin >> n;
    ll ans=1;
    rep(i,n){
        ll b;cin >> b;
        ans = ans/__gcd(ans,b);
        ans *= b;
    }
    cout << ans << endl;
}


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

//

#define RESIDUE(u,v) (capacity[u][v] - flow[u][v])
#define RCOST(u,v) (cost[u][v] + h[u] - h[v])
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define LL long long

LL k;
vector<LL> v;

LL digit(LL a){
  LL ret=0;
  while(1){
    if(a==0)break;
    ret++;
    a/=10;
  }
  return ret;
}

LL sum_digit(LL a){
  LL ret=0;
  while(1){
    if(a==0)break;
    ret+=a%10;
    a/=10;
  }
  return ret;
}

double value(LL a){
  return (double)a/(double)sum_digit(a);
}

int main(){
  cin >> k;
  if(k<=9){
    REP(i,k)
      cout<<i+1<<endl;
    return 0;
  }
  REP(i,9)
    v.push_back(i+1);
  LL plus_digit = 1;
  LL cand = 10;
  while(1){
    //cerr<<cand<<endl;
    double conf = cand/(9*digit(cand));
    if(v.size() >= k && (value(v[k-1])) <= conf)break;
    while(v.size()){
      if(value(v.back()) <= value(cand))break;
      v.pop_back();
    }
    v.push_back(cand);
    if(value(cand) > plus_digit){
      //cerr<<"dbg"<<endl;
      cand += plus_digit*(9-(cand/plus_digit)%10);
      plus_digit*=10;
      continue;
    }
    cand+=plus_digit;
  }
  
  REP(i,k){
    cout<<v[i]<<endl;
  }
  return 0;
}


Measured memory_bytes: 256
import bisect
import copy
import heapq
import math
import sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
sys.setrecursionlimit(500000)
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

n=int(input())

if n==3:
    print("2 5 63")
elif n==4:
    print("2 5 20 63")
elif n==5:
    print("2 5 20 30 63")
else:
    anslst=[]
    for i in range(n):
        if i%4==0:
            anslst.append(i//4*6+2)
        elif i%4==1:
            anslst.append(i//4*6+3)
        elif i%4==2:
            anslst.append(i//4*6+4)
        elif i%4==3:
            anslst.append(i//4*6+6)
    if sum(anslst)%6==0:
        pass
    elif sum(anslst)%6==3:
        anslst.remove(9)
        if anslst[-1]%6==0:
            anslst.append(anslst[-1]+6)
        else:
            anslst.append(anslst[-1]+2)
    elif sum(anslst)%6==2:
        anslst.remove(8)
        anslst.append(i//4*6+6)
    elif sum(anslst)%6==5:
        anslst.remove(9)
        anslst.append(i//4*6+4)
    print(*anslst)

Measured memory_bytes: 70688
#include "bits/stdc++.h"
#define ed cout<<"\n";
#define SPEED ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

using namespace std;

int main() {
	SPEED;
	long long int n, a, b, c, d, e;
	cin >> n >> a >> b >> c >> d>>e;
	cout << max({ (n - 1) / a,(n - 1) / b ,(n - 1) / c ,(n - 1) / d,(n - 1) / e }) + 5;
		ed;
	return 0;
}

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

int main(){
    double x1, y1, x2, y2;
    std::cin >> x1 >> y1 >> x2 >> y2;
    
    std::cout << std::fixed << std::setprecision(4) << std::sqrt(std::pow(x2 - x1, 2) + std::pow(y2 - y1, 2)) << std::endl;

    return 0;
}


Measured memory_bytes: 3240
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;cin>>n;
  if(n==0)cout<<1<<endl;
  else if(n==1)cout<<2<<endl;
  else if(n==2)cout<<1<<endl;
  else
    cout<<0<<endl;
  return 0;

}


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

int main() {
	string S;
	cin >> S;
	int ans = 0, now=0;
	for (int i = 0; i < 3; i++) {
		if (S[i] == 'R') now++;
		else now = 0;
		ans = max(ans, now);
	}
	cout << ans << endl;
}


Measured memory_bytes: 3572
const main = (input) => {
    const args = input.split('\n');
    const N = args[0],
          nums = args.slice(1, args.length - 1);

    console.log(nums.filter((n, i) => nums.indexOf(n) === i).length);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 7500
#include<iostream>
#include<algorithm>
#include<cstring>
#include <string>
#include <set>
#include <queue>
#include <cmath>
#include <iomanip>
#include <vector>
#include <cstdio>
#define MAXN 100010

using namespace std;

int rank1[MAXN];
int par[MAXN];

void init(int n) {
    for (int i = 1; i <= n; ++i) {
        rank1[i] = 0;
        par[i] = i;
    }
}

int find(int x) {
    if (par[x] == x)
        return x;
    else
        return find(par[x]);
}

void unite(int x, int y) {
    x = find(x);
    y = find(y);
    if (x == y)
        return;
    if (rank1[x] < rank1[y]) {
        par[x] = y;
    } else {
        par[y] = x;
        if (rank1[y] == rank1[x])
            rank1[x]++;
    }
}

int main() {
    int n, q;
    while (~scanf("%d%d", &n, &q)) {
        if (n == 0 && q == 0)
            break;
        init(n);
        for (int i = 2; i <= n; ++i) {
            scanf("%d", &par[i]);
        }
        long long sum = 0;
        char s[MAXN];
        int a;
        for (int i = 1; i <= q; ++i) {
            scanf("%s %d", s, &a);
            if (s[0] == 'M') {
                par[a] = a;
            }
            else {
                sum += find(a);
            }
        }
        printf("%lld\n", sum);
    }
    return 0;
}

Measured memory_bytes: 3932
h,w = map(int,input().split())
canbas = []
for _ in range(h):
    canbas.append(input())
x = 0
for i in range(h):
    for j in range(w):
        if canbas[i][j] == '.':
            continue
        else:
            if i ==0:
                a = '.'
            else:
                a = canbas[i-1][j]
            if j ==0:
                b = '.'
            else:
                b = canbas[i][j-1]
            if i == h-1:
                c = '.'
            else:
                c = canbas[i+1][j]
            if j == w-1:
                d = '.'
            else:
                d = canbas[i][j+1]
            if a==b==c==d=='.':
                x = 1
                break
    if x == 1:
        break

if x == 1:
    print('No')
else:
    print('Yes')


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

#define REP(i ,n) for(int i=0 ;i < n; i++)
#define REPB(i ,n) for(int i=n; i >= 0; i--)
#define FOR(i ,m ,n) for(int i=m; i < n; i++)
#define FORB(i, m, n) for(int i=m; i>= n; i--)
#define ll long long
#define pb push_back
#define popb pop_back
#define debug(i) cout<< #i<< "= "<< i << endl
using namespace std;

int main(){
    int r,g,b,n;
    ll ans = 0;
    cin >> r >> g >> b >> n;

    int k1 = n / r + 1;
        //debug(k1);
    REP(i,k1){
        int k2 = (n - i * r) /g + 1;
        REP(j,k2){
            int k3 = (n - i * r - j * g) / b;
            int G = (n - i * r - j * g) % b;
            if(k3 >= 0 && G == 0){
                ans++;
                //debug(i);
                //debug(j);
                //debug(k3);
            } 
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
a = int(input())
if a >= 400 and a <= 599:
    print("8")
elif a >= 600 and a <= 799:
    print("7")
elif a >= 800 and a <= 999:
    print("6")
elif a >= 1000 and a <= 1199:
    print("5")
elif a >= 1200 and a <= 1399:
    print("4")
elif a >= 1400 and a <= 1599:
    print("3")
elif a >= 1600 and a <= 1799:
    print("2")
elif a >= 1800 and a <= 1999:
    print("1")

Measured memory_bytes: 9176
#include<bits/stdc++.h>
using namespace std;
int main(void){
    int n, m; cin>>n>>m;
    int a[m+1]={0};
    for(int i=0;i<n;i++){
        int k; cin>>k;
        for(int i=1;i<=k;i++){
            int t;
            cin>>t;
            a[t]++;
        }
    }

    int c=0;
    for(int i=1;i<m+1;i++){
            c+=(a[i]==n);
    }
    cout<<c;

}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
	string a;
	int num = 0;
	cin >> a;
	long long ans = 0;
	for(auto it:a){
		num += (it == 'B');
		ans += num * (it == 'W');
	}
	cout << ans;
	return 0;
}

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

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

const ll MOD = ll(1e9 + 7);
const ll LLINF = LLONG_MAX;
const int IINF = INT_MAX;
const int MAX_N = int(1e5) + 5;
const double EPS = 1e-8;
const int di[] = {0, 1, 0, -1}, dj[] = {1, 0, -1, 0};
string dir[] = {"R", "D", "L", "U"};
#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 (ll i = m; i < n; i++)
#define ALL(v) (v).begin(), (v).end()

struct UF{
    int p[MAX_N], r[MAX_N];
    void init(int N){
        REP(i,N){
            p[i] = i;
            r[i] = 0;
        }
    }
    int find(int x){
        if(p[x] == x)return x;
        else return p[x] = find(p[x]);
    }
    void unite(int x, int y){
        x = find(x);
        y = find(y);
        if(x==y)return;
        if(r[x]<r[y])swap(x,y);
        if(r[x]==r[y])r[x]++;
        p[y] = x;
    }
    bool same(int x, int y){
        return find(x) == find(y);
    }
};

P x[MAX_N], y[MAX_N];

int main() {
    int n;
    
    cin >> n;
    REP(i,n){
        cin >> x[i].first >> y[i].first;
        x[i].second = i;
        y[i].second = i;
    }
    sort(x,x+n);
    sort(y,y+n);
    vector<P3> ls;
    REP(i,n){
        ls.push_back({abs(x[i+1].first-x[i].first),{x[i].second,x[i+1].second}});
        ls.push_back({abs(y[i+1].first-y[i].first),{y[i].second,y[i+1].second}});
    }
    sort(ALL(ls));
    int ans = 0;
    UF g;
    g.init(n);
    for(auto i : ls){
        P e = i.second;
        if(!g.same(e.first,e.second)){
            g.unite(e.first,e.second);
            ans += i.first;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 10096
#include<bits/stdc++.h>
using namespace std;
bool p[100000];
int main()
{
	int n,k,ans,i;
	memset(p,0,sizeof(p));
	scanf("%d %d",&n,&k);
	ans = n;
	for(i=0;i<k;i++)
	{
		int l;
		scanf("%d",&l);
		for(int j=0;j<l;j++)
		{
			int a;
			scanf("%d",&a);
			if(!p[a])
			{
				p[a] =!p[a];
				ans--;
			}
		}
	}
	printf("%d",ans);
}

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

int main() {
	int  a[5];
	char x[5];
	for (int i = 0; i < 4; i++) {
		cin >> x[i];
		a[i] = x[i] - '0';
	}
	char f[4];
	for (int i = 0; i < 8; i++) {
		int z = i;
		int sum = a[0];
		for (int j = 0; j < 3; j++) {
			if (z % 2 == 0) {
				sum += a[j + 1];
				f[j] = '+';
			}
			else {
				sum -= a[j + 1];
				f[j] = '-';
			}
			z /= 2;
		}
		if (sum == 7) {
			cout << a[0] << f[0] << a[1] << f[1] << a[2] << f[2] << a[3] << "=7";
			return 0;
		}
	}
}

Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <cmath>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define INF_INT (INT_MAX / 2)
#define INF_LONG (LONG_MAX / 2)
//#define DEBUG true
#define DEBUG false
using namespace std;

const int MAX = 100001;
const int MOD = 1000000007;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<int, ll> pil;

int ceil(int x, int y) { return (x % y == 0) ? x / y : x / y + 1; }

int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }

int lcm(int x, int y) { return x / gcd(x, y) * y; }

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

  string s;
  cin >> s;

  char ans = (s[0] - 'a' + 1) % 26 + 'a';
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<cstdlib>
#include<string>
#include<algorithm>
#include<climits>
#include<cctype>
#include<map>
#include<queue>
#include<iomanip>

using namespace std;

int main(){

	int a,b;
	cin >> a >> b;
	int m[999];

    for(int i = 0;i < 999;i++){
    	int v = 0;
    	for(int j = 1;j <= i+1;j++){
    		v += j;
    	}
    	m[i] = v;
    }

    for(int i = 0;i < 999-1;i++){
    	int left = m[i];
    	int right = m[i+1];

    	if(b-a == right - left){
    	   cout << right - b << endl;
    	   return 0;
    	}
    }


   return 0;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#include <iostream>
#include <numeric>
#define rep(i,n) for (int i = 0;i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define chmax(x,y) x = max(x,y)
int INF = 1e9;
ll  LINF = 1e18;

int main(){
	int n;cin >> n;
	vector<P> table(n);
	rep(i,n){
		int a,b;cin >> a >>b;
		table[i] = make_pair(a,b);
	}
	bool flag = false;
	rep(i,n-2){
		if(table[i].first==table[i].second){
			if(table[i+1].first==table[i+1].second){
				if(table[i+2].first == table[i+2].second) flag = true;
			}
		}
	}
	if(flag) cout << "Yes" << endl;
	else cout << "No" << endl;
	
}


Measured memory_bytes: 3632
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <sstream>
#include <fstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
static const double EPS = 1e-5;

#define FOR(i,k,n) for (int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
int n,s,a[20];
int dfs(int i, int sum){
  if(i==n) return abs(s-sum*2);
  if((sum+a[i])*2>s) return dfs(i+1,sum);
  return min( dfs(i+1,sum+a[i]), dfs(i+1,sum));
}
int main(void){
  while(cin>>n){
    if(n==0) break;
    REP(i,n) cin>>a[i];
    s = accumulate(a,a+n,0);
    cout<<dfs(0,0)<<endl;
  }
  return 0;
}

Measured memory_bytes: 864
/*
created at 29.6.2015 by charis 
last edited at 2.9.2015 by charis
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_3_A
*/

#include<cstdlib>
#include<cstdio>
using namespace std;

class stack{
public:
	int top;
	int S[1000];

	void initialize(){
		top = 0;
	}
	int isEmpty(){
		return top == 0;
	}
	int isFull(){
		return top>=1000; //S[100]
	}
	void push(int x){
		if(isFull()) printf("Error\n");
		else {
			top++;
			S[top]=x;		
		}	
	}
	int pop(){
		if(isEmpty()) printf("Error\n");
		top--;		
		return S[top+1];
	}
};

int main(){
	stack s;
	char C[100];
	s.initialize();
	while( scanf("%s", &C) != EOF ){
		if ( C[0] == 'E') break ;
		if ( C[0] == '+' ){
			int a = s.pop();
			int b = s.pop();	
			s.push(a+b); 
		}	
		else if ( C[0] == '-' ) {
			int a = s.pop();
			int b = s.pop();	
			s.push(b-a); 			
		}
		else if ( C[0] == '*' ) {
			int a = s.pop();
			int b = s.pop();	
			s.push(a*b); 			
		}
		else {
			int x = atoi(C);
			s.push(x);
		}
	} 
    printf( "%d\n", s.pop() );
	
	return 0; 
} 

Measured memory_bytes: 980
#include<stdio.h>
int main()
{
	int a,b;
	scanf("%d %d",&a,&b);
	if(a==1&&b==1)
	{
		printf("Draw");
	}
	else if (a==1&&b!=1)
	{
		printf("Alice");
	}
	else if (b==1&&a!=1)
	{
		printf("Bob");
	}
	else if (b>a)
	{
		printf("Bob");
	}
	else if(a>b)
	{
		printf("Alice");
	}
	else
	{
		printf("Draw");
	}
return 0;
}


Measured memory_bytes: 128
n,m= map(int,input().split())
a = list(map(int,input().split()))
s=sum(a)
ans=[]
a=sorted(a,reverse=True)
for i in range(m):
  if a[i]*4*m >= s:
    ans.append(a[i])

if len(ans) == m:
  print("Yes")
else:
  print("No")

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

int main() {
	// your code goes here
	int n;
	cin>>n;
	map<string,int>m;
	for(int i=1;i<=n;i++)
	{
	    string s=to_string(i);
	    char f=s[0];
	    char sec=s.back();
	    s.clear();
	    s+=f;
	    s+=sec;
	    m[s]++;
	}
	long long ans=0;
	for(pair<string,int>p:m)
	{
	    string s=p.first;
	    int x=p.second;
	    if(s[0]==s[1])
	    {
	       ans+=(long long) x*x;
	    }
	    else
	    {
	        swap(s[0],s[1]);
	        ans+=(long long)p.second*m[s];
	    }
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
#print#!/usr/bin/env python3
#%% for atcoder uniittest use
import sys
input= lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(10**9)
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
def lispin(t=int):return list(pin(t))
#%%code
def resolve():
    N=int(input())
    t=3**N
    s=1
    f=0
    for a in pin():
        if  a%2:
            f=1
            s*=1
        else:
            s*=2

    print(t-s)
#%%submit!
resolve()

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

double rate(int water, int sugar) {
    if (water == 0 && sugar == 0) return -0.1;
    else return 100*sugar/(double)(water + sugar);
}

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int A, B, C, D, E, F;
    cin >> A >> B >> C >> D >> E >> F;
    int answater = 0, anssugar = 0;
    for(int O = 0; O <= 30; O++) {
        int water = 0;
        int sugar = 0;
        for(int i = 0; i <= O; i++) {
            water = 100 * A * i + 100 * B * (O - i);
            if (water > F) continue;
            for(int j = 0; j <= 3000; j++) {
                for(int k = 0; k <= 3000; k++) {
                    sugar = j * C + k * D;
                    if (F - (water + sugar) < 0) continue;
                    if (water / 100 * E < sugar) continue;
                    //cout << water << " " << sugar << " " << (water / 100 * E) << endl;
                    //cout << water << " " << sugar << endl;
                    double rate1 = rate(water, sugar);
                    double rate2 = rate(answater, anssugar);
                    if (rate1 > rate2){
                        anssugar = sugar;
                        answater = water;
                    }
                }
            }
        }
    }
    cout << answater + anssugar << " " << anssugar << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n;
    scanf("%d",&n);
    int a[n];
    for (int i = 0; i < n; i++){
        scanf("%d",&a[i]);
        if (a[i]%2 == n%2){
            printf("0");
            return 0;
        }
    }
    sort(a,a+n);
    int c[n];
    if (n % 2 == 0){
        for (int i = 0; i < n; i++){
            c[i] = 2*(i/2)+(n%2==0);
        }
    }
    else{
        c[0] = 0;
        for (int i = 1; i < n; i++){
            c[i] = 2*((i+1)/2)+(n%2==0);
        }
    }
    for (int i = 0; i < n; i++){
        if (c[i] != a[i]){
            printf("0");
            return 0;
        }
    }
    int ans = 1;
    for (int i = 0; i < n/2; i++){
        ans <<= 1;
        ans %= 1000000007;
    }
    printf("%d",ans);
}


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

int main(){
   int k,s,A;
   cin>>k>>s;
   for(int x = 0;x<=k;x++){
      for(int y =0;y<=k;y++){

            if(s-x-y<=k &&s-x-y>=0){
               A++;
}}}
   cout<<A<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#define MOD 1000000007
#define INF 1 << 30

using namespace std;
typedef long long ll;

int main(void) {
	int num, i, ma = 1, mi = 1, x;
	cin >> num;
	cout << 2 * num - 1 << "\n";
	vector<int> d(num + 1);
	for (i = 1; i <= num; i++) {
		cin >> d[i];
		if (d[ma] < d[i])
			ma = i;
		if (d[mi] > d[i])
			mi = i;
	}
	if (abs(d[ma]) >= abs(d[mi]))
		x = ma;
	else
		x = mi;
	for (i = 1; i <= num; i++)
		printf("%d %d\n", x, i);
	if (d[x] > 0) {
		for(i = 1; i< num; i++)
			printf("%d %d\n", i, i + 1);
	}
	else {
		for (i = num; i > 1; i--)
			printf("%d %d\n", i, i - 1);
	}
	return 0;
}

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

long long fpb(long long a, long long b){
    if(b == 0) return a;
    return fpb(b, a%b);
}

long long findkpk(long long a, long long b){
    return a*b/fpb(a,b);
}

int main(){
    bool correct = true;
    int N, M;
    string  S, T;

    cin >> N >> M >> S >> T;

    long long kpk = findkpk(N, M);
    long long sub1 = kpk/N, sub2 = kpk/M;
    long long subkpk = findkpk(sub1, sub2);

    for(long long i=0; i<kpk ; i+=subkpk){
        if(S[i/sub1] != T[i/sub2]){
            correct = false;
            break;
        }
    }

    if(correct){
        cout << kpk << endl;
    } else{
        cout << -1 << endl;
    }
}

Measured memory_bytes: 3696
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		double P = 1;
		
		for(int i=1; i<=N; i++){
			 P = (P*i)%(Math.pow(10,9)+7);
		}
		
		System.out.println((int)P);

	}

}

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

long long int n,a[100005],b[100005],c[100005],d[100005][4];

long long int dp(long long int i,int f){

	if(i>n){
		return 0;
	}
	if(d[i][f]!=-1){
		return d[i][f];
	}
	
	if(f==1){
		return d[i][f] =  max(b[i]+dp(i+1,2),c[i]+dp(i+1,3));
	}
	else if(f==2){
		return d[i][f] = max(a[i]+dp(i+1,1),c[i]+ dp(i+1,3));
	}
	else{
		return d[i][f] = max(b[i] + dp(i+1,2), a[i]+ dp(i+1,1));
	}
} 

int main(){
	cin>>n;
	for(long long int i=1;i<=n;i++){
		cin>>a[i]>>b[i]>>c[i];
	}
	for(long long int i=0;i<100005;i++){
		for(int j=0;j<4;j++){
		d[i][j]=-1;
		} 
	}
	
	cout<<max(dp(1,1),max(dp(1,2),dp(1,3)))<<endl;
	
	return 0;
}

Measured memory_bytes: 10368
#include <bits/stdc++.h>
#define ll long long
using namespace std;
ll MOD = 1e9+7;
ll H, N, M, L, K, W, X, Y, Z;
ll ans = 0;
int main() {
	cin >> H >> W >> K;
	vector<vector<ll>>dp(H + 1, vector<ll>(W + 1, 0));
	dp[0][1] = 1;
	for (int i = 1; i <= H; i++) {
		for (int bit = 0; bit < (1 << (W - 1)); bit++) {
			bool flag = 0;
			for (int j = 0; j < W - 2; j++) {
				if ((bit&(1 << j)) && (bit&(1 << (j + 1)))) {
					flag = 1; break;
				}
			}
			if (flag)continue;
			vector<ll>tmp(W + 1);
			for (int j = 1; j <= W; j++)tmp[j] = dp[i - 1][j];
			for (int j = 0; j < W - 1; j++) {
				if (bit&(1 << j)) {
					swap(tmp[j + 1], tmp[j + 2]);
				}
			}
			for (int j = 1; j <= W; j++) {
				dp[i][j] += tmp[j];
				dp[i][j] %= MOD;
			}
		}
	}
	cout << dp[H][K] << endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
	int n[]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
	int k;
	scanf("%d",&k);
	printf("%d",n[k-1]);
	// your code goes here
	return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mk make_pair
#define pb push_back
#define pf push_front
typedef pair<int, int> pii;
const int mod = 1000000007;
const int INF = 1000000009;
const long long INFL = 1000000000000000018ll;
 
int N, M, A[10], C[10] = {0, 2, 5, 5, 4, 5, 6, 3, 7, 6};
char S[10];
string dp[10010];
 
signed main()
{
    cin >> N >> M;
    for(int i = 0; i < M; i++){
        cin >> A[i];
    }
    sort(A, A + M, greater<int>() );
    for(int i = 0; i < 10; i++){
        S[i] = '0' + i;
        //printf("%d %c\n", i, S[i]);
    }
    for(int i = 0; i < M; i++){
        int num = A[i];
        int cost = C[num];
        char add = S[num];
        //printf("%d %d %d %c\n", i, num, cost, add);
        for(int j = 0; j <= N; j++){
            if(j - cost >= 0){
                string s = dp[j - cost];
                string t = dp[j];
                if(j - cost != 0 && !s.size())continue;
                s += add;
                //printf("%d,%d ", i, j);
                //cout << s << endl;
                if(s.size() > t.size()){
                    dp[j] = s;
                }
                else if(s > t && s.size() == t.size()){
                    dp[j] = s;
                }
            }
        }
    }
    cout << dp[N] << endl;
    return 0;
}


Measured memory_bytes: 43264
#define DEBUG 0

/**
 * File    : E.cpp
 * Author  : Kazune Takahashi
 * Created : 2019-5-26 21:31:42
 * Powered by Visual Studio Code
 */

#include <iostream>
#include <iomanip>   // << fixed << setprecision(xxx)
#include <algorithm> // do { } while ( next_permutation(A, A+xxx) ) ;
#include <vector>
#include <string> // to_string(nnn) // substr(m, n) // stoi(nnn)
#include <complex>
#include <tuple>
#include <queue>
#include <stack>
#include <map> // if (M.find(key) != M.end()) { }
#include <set>
#include <functional>
#include <random> // auto rd = bind(uniform_int_distribution<int>(0, 9), mt19937(10101010));
#include <chrono> // std::chrono::system_clock::time_point start_time, end_time;
// start = std::chrono::system_clock::now();
// double elapsed = std::chrono::duration_cast<std::chrono::milliseconds>(end_time-start_time).count();
#include <cctype>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
using namespace std;

typedef long long ll;

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

// const int C = 1e6+10;
// const ll M = 1000000007;

int N, Q;
ll S[200010], T[200010], X[200010];
ll D[200010];
int ans[200010];
typedef tuple<ll, ll, ll> K;
vector<K> KK;
typedef tuple<ll, int, int> info;
priority_queue<info, vector<info>, greater<info>> P;

int main()
{
  cin >> N >> Q;
  for (auto i = 0; i < N; i++)
  {
    cin >> S[i] >> T[i] >> X[i];
    KK.push_back(K(X[i], S[i], T[i]));
  }
  sort(KK.begin(), KK.end());
  for (auto i = 0; i < Q; i++)
  {
    cin >> D[i];
  }
  for (auto i = 0; i < N; i++)
  {
    ll x = get<0>(KK[i]);
    ll s = get<1>(KK[i]);
    ll t = get<2>(KK[i]);
    P.push(info(s - x, x, 0));
    P.push(info(t - x, x, 1));
  }
  int ind = 0;
  multiset<int> S;
  fill(ans, ans + Q, -1);
  while (!P.empty())
  {
    info x = P.top();
    P.pop();
    ll next_t = get<0>(x);
    int point = get<1>(x);
    bool start = (get<2>(x) == 0);
#if DEBUG == 1
    cerr << "next_t = " << next_t << endl;
#endif
    while (next_t > D[ind])
    {
      int a = -1;
      if (S.empty())
      {
        a = -1;
      }
      else
      {
        a = *S.begin();
      }
      ans[ind] = a;
#if DEBUG == 1
      cerr << "D[" << ind << "] = " << D[ind] << ", ans[" << ind << "] = " << ans[ind] << endl;
#endif
      ind++;
      if (ind == Q)
      {
        goto EXIT;
      }
    }
    if (start)
    {
      S.insert(point);
#if DEBUG == 1
      cerr << "insert: " << point << endl;
#endif
    }
    else
    {
      S.erase(S.find(point));
#if DEBUG == 1
      cerr << "erase: " << point << endl;
#endif
    }
  }
EXIT:
  for (auto i = 0; i < Q; i++)
  {
    if (ans[i] == -1)
    {
      cout << -1 << endl;
    }
    else
    {
      cout << ans[i] << endl;
    }
  }
}

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

using namespace std;
using ll=long long;

int main(){
    ll n,a,b;
    cin>>n>>a>>b;
    ll c=a+b;
    ll blue=n/c*a;
    n%=c;
    blue+=min(n,a);
    cout<<blue<<endl;
    return 0;
}


Measured memory_bytes: 256
#!/usr/bin/python3

from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


def main():
    N = int(input())
    t = sum(int(s) for s in str(N))
    if N % t == 0:
        print(Yes)
    else:
        print(No)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3956
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
#define INF 100000000
int main(){
    ll A,B;
    cin>>A>>B;
    if(A>B)     cout<<(A+A-1);
    if(A<B)     cout<<(B+B-1);
    if(A==B)    cout<<(A+B);
}

Measured memory_bytes: 256
#include <algorithm>
#include <cstdlib>
#include <cstdio>
using namespace std;
const int maxn=1e5+10;
int n,k,a[maxn];

int main(){
    while (~scanf("%d%d",&n,&k)){
        int pos;
        for (int i=1;i<=n;i++){
            scanf("%d",&a[i]);
            if (a[i]==1) pos=i;
        }
        printf("%d\n",(n-1+k-2)/(k-1));
    }
    return 0;
}


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

#define int long long

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

	int x;
	for (int i = 1; i <= 5; ++i) {
		cin >> x;
		if (x == 0) {
			cout << i;
			break;
		}
	}
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

#define repd(i, a, b) for (ll i = (a); i < (b); i++)
#define rep(i, n) repd(i, 0, n)

using namespace std;

namespace mp = boost::multiprecision;

using ll = long long;
using Bint = mp::cpp_int;
ll mod = 1000000007;

int main() {
input:
    ll n, m;
    cin >> n >> m;
    ll g[n][n];
    rep(i, n) {
        rep(j, n) { g[i][j] = mod; }
    }
    rep(i, n) { g[i][i] = 0; }

    rep(i, m) {
        ll a, b, c;
        cin >> a >> b >> c;
        g[a - 1][b - 1] = c;
        g[b - 1][a - 1] = c;
    }

    ll d[n][n];
    rep(i, n) {
        rep(j, n) { d[i][j] = g[i][j]; }
    }

    rep(k, n) {
        rep(i, n) {
            rep(j, n) { d[i][j] = min(d[i][j], d[i][k] + d[k][j]); }
        }
    }

    bool used[n][n] = {};
    memset(used, 0, sizeof used);
    rep(k, n) {
        rep(i, n) {
            rep(j, n) {
                if (d[i][j] + g[j][k] == d[i][k]) {
                    used[j][k] = true;
                }
            }
        }
    }

    ll ans = 0;
    rep(i, n) {
        rep(j, n) {
            if (g[i][j] == mod) {
                used[i][j] = true;
            }
            if (!used[i][j]) {
                ans++;
            }
        }
    }
    cout << ans / 2 << endl;
    return 0;
}


Measured memory_bytes: 384
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <string>
#include <set>
#include <vector>

using namespace std;

int A,B,C,D;

int main(){
    cin >> A >> B >> C >> D;
    int ans = 0;
    if (A <= C && C <= B && B <= D) ans = B-C;
    else if(A <= C && D <= B) ans = D-C;
    else if (C <= A && B <= D) ans = B-A;
    else if (C <= A && A <= D && D <= B) ans = D-A;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
from collections import *
N,W = map(int,input().split())
dp = defaultdict(int)
dp[0] = 0

for n in range(N):
  w,v = map(int,input().split())
  for k,b in dp.copy().items():
    if k+w<=W:
      dp[k+w] = max(dp[k+w],b+v)

print(max(dp.values()))

Measured memory_bytes: 9728
#include <iostream>
using namespace std;
int main()
{ int a,b,c ;
    cin>>a>>b>>c;
   if(a<b&b<c&a<c)
   cout <<a<<" "<<b<<" "<<c<<endl;
   else if (a>b&b>c&a>c)
    cout<<c<<" "<<b<<" "<<a<<endl;
   else if(a==b&b==c&a==c)
    cout <<a<<" "<<b<<" "<<c<<endl;
    else if (a==b&a>c)
    cout<<c<<" "<<b<<" "<<a<<endl;
     else if (a==b&a<c)
    cout <<a<<" "<<b<<" "<<c<<endl;
     else if (c==b&c>a)
    cout<<a<<" "<<b<<" "<<c<<endl;
     else if (c==b&c<a)
    cout <<c<<" "<<b<<" "<<a<<endl;
     else if (a==c&b>c)
    cout<<a<<" "<<c<<" "<<b<<endl;
     else if (a==c&b<c)
    cout<<b<<" "<<c<<" "<<a<<endl;

       else if (a>b&b<c&a>c)
    cout<<b<<" "<<c<<" "<<a<<endl;
       else if (a>b&a<c&b<c)
    cout<<b<<" "<<a<<" "<<c<<endl;
       else if (a<b&b>c&a>c)
    cout<<c<<" "<<b<<" "<<a<<endl;
       else if (a<b&b>c&a<c)
    cout<<a<<" "<<c<<" "<<b<<endl;
return 0;
}



Measured memory_bytes: 3072
using System;

namespace B
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] In = Console.ReadLine().Split(' ');
            int a = int.Parse(In[0]);
            int b = int.Parse(In[1]);
            int sum = 1;
            int cnt = 0;
            while (sum < b)
            {
                sum += (a - 1);
                cnt++;
            }
            if (b == 1) Console.WriteLine(0);
            else Console.WriteLine(cnt);
        }
    }
}



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

int main() 
{
    int n;
    cin >> n;
    long long int a[200005];
    for(int i = 0; i < n; i++) {
    	cin >> a[i];
    }

    long long sum = 0;

    for(int i = 1; i < n; i++) {
    	if(a[i] <= a[i-1]) {
    		sum = sum + a[i-1] - a[i];
    		a[i] = a[i-1];
    	}
    }

    cout << sum;

	return 0;
}


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

long long from_1(long long n) {
	long long result=0;
	// cout << "n=" << n << "\n";
	n = n + 1;
	for (long long i = 1; i <= n; i = i * 2) {
		if (i == 1) {
			result = (n / 2) % 2;
			// cout << i << ":" << result << "\n";
		} else {
			result = result + i * (max(n % (i * 2) - i, (long long)0) % 2);
			// cout << i << ":" << (max(n % (i * 2) - i, (long long)0) % 2) <<
			// "\n";
		}
	}
	// cout << "result" << result << "\n";
	return result;
}

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

	long long A, B;
	scanf("%lld %lld", &A, &B);

	cout << (from_1(B) ^ from_1(A - 1));

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main()
{
    char T[200000];
    int n,i,K,PD_point;

    scanf("%s", T);
    n = 0;
    i = 0;
    PD_point = 0;
    while (T[n] != '\0') {  /* str[n] が終端文字（ヌル文字 '\0'）でない間繰り返す */
        if(T[n] == '?') { 
            T[n] = 'D';
        }

        n++;
    }
    printf( T );
    // for(i = 0 ;i<200000; i++){
    //         printf("%c",T[i]);
    //         //printf("B\n");
    // }

    return 0;
}

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

bool adj_mat[8][8];
int perms[8] = {0, 1, 2, 3, 4, 5, 6, 7};
using namespace std;

int main(){
   int N;
   int M;
   cin >> N >> M;
   for(int i = 0; i < M; i++){
       int a;
       int b;
       cin >> a >> b;
       adj_mat[a - 1][b - 1] = true;
       adj_mat[b - 1][a - 1] = true;
   }

    int ans = 0;
   do {
       bool good = true;
       if(perms[0] != 0){
           continue;
       }
       for(int i = 0; i < N - 1; i++){
           if(!adj_mat[perms[i]][perms[i + 1]]){
               good = false;
               break;
           }
       }
       if(good){
           ans ++;
       }
   } while(next_permutation(perms, perms + N));

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


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <climits>
#include <random>
#include <iomanip>

using namespace std;
using P = pair<long, long>;

typedef long long int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

#define fillInt(xs, x)        \
  for (int i = 0; i < (x); i++) \
    scanf("%d", &xs[i]);
#define fillLong(xs, x)       \
  for (int i = 0; i < (x); i++) \
    scanf("%ld", &xs[i]);
#define fillString(xs, x)       \
  for (int i = 0; i < (x); i++) \
    cin >> xs[i];
#define sortv(xs) sort(xs.begin(), xs.end())
#define sortvinv(xs) sort(xs.begin(), xs.end(), std::greater<long>())
#define lbv(xs, x) lower_bound(xs.begin(), xs.end(), x) - xs.begin()
#define ubv(xs, x) upper_bound(xs.begin(), xs.end(), x) - xs.begin()
#define bs(xs, x) binary_search(xs.begin(), xs.end(), x)

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

const int mod = 1000000007;

struct edge {
    int to;
    bool isSame;
};

const int MAX_V = 100005;
vector<edge> G[MAX_V];
int know[MAX_V];
int magic;

void dfs(int x, int color) {
  if(know[x]) return;
  know[x] = color;
  rep(i, G[x].size()) {
    dfs(G[x][i].to, G[x][i].isSame ? color : -color);
  }
}

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

  int n, m;
  cin >> n >> m;

  rep(i, m) {
    int x, y, z;
    cin >> x >> y >> z;
    x--;
    y--;
    if(z%2) {
      G[x].push_back({y, false});
      G[y].push_back({x, false});
    } else {
      G[x].push_back({y, true});
      G[y].push_back({x, true});
    }
  }

  rep(i, n) {
    if(!know[i])magic++;
    dfs(i, 1);
  }

  cout << magic << endl;
}


Measured memory_bytes: 10752
# coding: utf-8
# Your code here!
# 幅優先探索（行きがけ）
import collections
import sys
import copy
import re
import math
import itertools


def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())


def main():
    N = I()

    NStr = str(N)

    keta = 0
    for n in NStr:
        keta += int(n)

    if keta % 9 == 0:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()


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

int main() {
  int N, K;
  cin >> N >> K;
  int a = 1;
  for (int i = 0; i < N; i++){
    if (a <= K){
      a = 2 * a;
    }
    else {
      a = a + K;
    }
  }
  cout << a << endl;
}



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

if A[-1] > 2:
    print(-1)
    exit()

"""
愚直解
初めの人数を2から増やしていって確認。範囲が分からないので、間に合わないのは分かるが計算量は分からん。

問題的にも最後から最初に戻るのがよさそう。
問題的に、Aiの処理を受けたすぐの人数をCiとする。また、ラウンドiの後にとりうる最大の人数をHIi,最小をLOiとする
考えるうえでややこしいのだが、

HIi-1                 HIi
 Ci-1   ->  {Ai} ->    Ci
LOi-1                 LOi

の形になっていて、
「LOi-1~HIi-1 の範囲の値が、  Aiの処理を受けたときに、HIiやLOiの範囲に収まらなければならない」
であるので、HIi-1,LOi-1 が Ai,HIi,LOiに依存している。
（HIi,LOiがAiで決まるのではないのに気を付けたい）

最後の状態（HIi = LOi = Ci = 2）が決まっているので、後ろから先頭に戻る形で、HIi-1, LOi-1を決めていく。

LOi-1を　Aiに通した後の値が LOi であるのは自明で、「LOi-1はAiの定数倍かつ、LOi以上」であるから
LOi-1 = (Loi // Ai) * Ai
といえる

HIi-1 を Ai に通した後に、HIi以下に収まらなければならないので、
HIi-1 = (HIi // Ai) * Ai + (Ai - 1)
となる。ここちょっと発想しにくい感じある。
(HIi // Ai + 1) * Ai が、Aiを通すと、HIiを上回るので、これより小さい物の中で最も大きいものを選びたいから。


"""


HI = 2
LO = 2
for i in range(N):
    
    if LO // A[N-i-1] > 0:
        if LO % A[N-i-1] > 0:
            nxt_LO = (LO // A[N-i-1] + 1) * A[N-i-1]
        else:
            nxt_LO = LO
    else:
        nxt_LO = A[N-i-1]

    
    
    nxt_HI = (HI // A[N-i-1]) * A[N-i-1] + (A[N-i-1] - 1)

    if HI > nxt_HI or LO > nxt_LO  or nxt_HI < nxt_LO:
        print(-1)
        exit()

    LO = nxt_LO
    HI = nxt_HI

print(LO, HI)

Measured memory_bytes: 14228
object Main extends App{
val in= io.StdIn.readLine.split(' ').map(_.toInt).toSeq
val A=in(0)  
val B=in(1)  
val K=in(2)  

def func1(a:Int, b:Int, k:Int):(Int,Int)={
//println(a, b, k)
if(k==0) (a, b) else func2(a/2, b+ a/2, k-1)
}
def func2(a:Int, b:Int, k:Int):(Int,Int)={
//println(a, b, k)
if(k==0) (a, b) else func1(a + b/2, b/2, k-1)
}
val ret=func1(A, B, K)
println(ret._1 +" "+ ret._2)
}


Measured memory_bytes: 27200