akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
public class Main {
	public static void main(String args[]){
		Scanner sc= new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int res = a-2*b;
		if(res<0)res = 0;
		System.out.println(res);
	}
}


Measured memory_bytes: 23124
from math import gcd
n = int(input())
ans = 0
for i in range(1, n+1):
    for j in range(1, n+1):
        t = gcd(i, j)
        if t == 1:
            ans += n
        else:
            for k in range(1, n+1):
                ans += gcd(t, k)
print(ans)

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


vector<int> topologicalSort(int v,const vector<int> edge[]){
	vector<int> zeros;
	vector<int> in(v),res;
	for(int i=0;i<v;i++){
		for(int j=0;j<(int)edge[i].size();j++)in[edge[i][j]]++;
	}
	for(int i=0;i<v;i++)if(in[i]==0)zeros.push_back(i);
	while(!zeros.empty()){
		int u=zeros.back();
		zeros.pop_back();
		res.push_back(u);
		for(int i=0;i<(int)edge[u].size();i++){
			if(--in[edge[u][i]]==0)zeros.push_back(edge[u][i]);
		}
	}
	return res;
}


int main(){
	vector<int> edge[20];
	int n,m;
	cin>>n>>m;
	for(int i=0;i<m;i++){
		int x,y;
		cin>>x>>y;
		x--;y--;
		edge[x].push_back(y);
	}
	vector<int> order(topologicalSort(n,edge));
	for(int i=0;i<n;i++)cout<<order[i]+1<<endl;
	return 0;
}

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

int main() {
  int N;
  cin >> N;
  vector<int> f(81);
  for (int i=0; i<81; i++) {
    f[i]=0;
  }
  for (int j=1; j<10; j++) {
    for (int k=1; k<10; k++) {
      f[j*k-1]=f[j*k-1]+1;
    }
  }
  if (f[N-1]>=1) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 3600
N = int(input())
s1 = input()
s2 = input()

if(s1[0] == s2[0]):
	ans = 3
else:
	ans = 6

for i in range(1, N):
	if s1[i] == s1[i-1] and s2[i] == s2[i-1]: continue
	if s1[i-1] == s2[i-1] : 
		ans *= 2
	else :
		if s1[i] != s2[i] : ans *= 3

print(ans%(10**9+7))
		

Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <vector>
#include <deque>
#include <queue>
#include <list>
#include <stack>
#include <string>
#include <functional>
#include <numeric>
#define _USE_MATH_DEFINES
#include <math.h>
#include <iomanip>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
using namespace std;
#define INT_MAX 2147483647
#define INT_MIN (-2147483647 - 1)
#define INF (int)1e8
#define _INF (int)-1e8
#define INFLL (long long)1e14
#define _INFLL (long long)-1e14
#define Loop(i, n) for(int i = 0; i < (int)n; i++)
#define Loop1(i, n) for(int i = 1; i <= (int)n; i++)
#define Loopr(i, n) for(int i = (int)n - 1; i >= 0; i--)
#define Loopr1(i, n) for(int i = (int)n; i >= 1; i--)
#define bitmanip(m,val) static_cast<bitset<(int)m>>(val)
typedef long long int ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef pair<int, int> P;


class Networkflow {
private:
	struct edgedata {
		int to, capacity, weight;
		edgedata* dual_p;
		bool operator<(const edgedata & another) const {
			return (capacity > another.capacity);
		}
	};
	struct node {
		int id;
		bool done;
		list<edgedata> edges;
	};
	vector<node> nodes;
	int n;
	int source, sink;
	edgedata* dummy;
public:
	int result;
	Networkflow(int size, int s, int t) {
		n = size;
		source = s;
		sink = t;
		nodes.resize(n);
		dummy = new edgedata;
		init();
	}
	void init() {
		Loop(i, n) {
			nodes[i] = { i, false,{} };
		}
	}
	void addedge(int s, int t, int c, int w) {
		nodes[s].edges.push_back({ t, c, w, dummy });
		nodes[t].edges.push_back({ s, 0, w, &(nodes[s].edges.back()) });
		nodes[s].edges.back().dual_p = &(nodes[t].edges.back());
	}
	void maxflow() {
		Loop(i, n) {
			nodes[i].edges.sort();
		}
		result = 0;
		vector<pair<int, edgedata*>> stk;
		int a; // the node which is focused on
		int df; // how much flow in one operation
		while (1) {
			a = source;
			Loop(i, n) nodes[i].done = false;
			nodes[source].done = true;
			while (a != sink) {
				int b = -1;
				edgedata* p;
				for (auto itr = nodes[a].edges.begin(); itr != nodes[a].edges.end(); ++itr) {
					if ((*itr).capacity > 0) {
						b = (*itr).to;
						if (nodes[b].done) b = -1;
						else {
							p = &(*itr);
							stk.push_back(make_pair(a, p));
							nodes[b].done = true;
							a = b;
							break;
						}
					}
				}
				if (b == -1) {
					if (stk.empty()) break;
					a = stk.back().first;
					stk.pop_back();
				}
			}
			if (stk.empty()) break;
			df = INT_MAX;
			Loop(i, stk.size()) {
				df = min(df, (*(stk[i].second)).capacity);
			}
			while (stk.size()) {
				(*(stk.back().second)).capacity -= df;
				(*((*(stk.back().second)).dual_p)).capacity += df;
				stk.pop_back();
			}
			result += df;
		}
		return;
	}
};

int main() {
	int v, e;
	cin >> v >> e;
	Networkflow networkflow(v, 0, v - 1);
	Loop(i, e) {
		int s, t, c; cin >> s >> t >> c;
		networkflow.addedge(s, t, c, 1);
	}
	networkflow.maxflow();
	cout << networkflow.result << endl;
	return 0;
}

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

int main(){
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  if (A + B > C + D){
    cout << "Left" << endl;
  } else if (A + B < C + D){
    cout << "Right" << endl;
  } else {
    cout << "Balanced" << endl;
  }
  return 0;
}


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

typedef long long lli;

lli p, q, a, n, ans;

void rec(lli k, lli prev, lli s, lli t) {
  if(s*q == t*p) ++ans;
  if(s*q > t*p) return;
  if(k == n) return;
  for(lli i = prev; i*t <= a; ++i) {
    rec(k+1, i, s*i+t, t*i);
  }
}

int main() {
  while(cin >> p >> q >> a >> n && (p|q|a|n)) {
    ans = 0;
    rec(0, 0, 0, 1);
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 1156
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define override_rep(i, l, r, mes, ...) mes
#define rep1(i, n) for (int i = 0; i < n; i++)
#define rep2(i, l, r) for (int i = l; i < r; i++)
#define rep(...) override_rep(__VA_ARGS__, rep2, rep1)(__VA_ARGS__)
using P = pair<int, int>;
template<typename T, typename U>
istream& operator>>(istream& in, pair<T, U>& p) {
    in >> p.first >> p.second;
    return in;
}
int gcd(int a,int b){
    if(a%b==0)return b;
    return gcd(b,a%b);
}
signed main(signed argc, char* argv[]) {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    const int MOD = 1e9+7;
    int n;
    cin>>n;
    vector<int> b(n),ans(n);
    rep(i,n){
        cin>>b[i];
    }
    rep(i,n){
        for(int j=b.size();j>0;j--){
            if(b[j-1]==j){
                ans[n-1-i]=j;
                b.erase(b.begin()+j-1);
                goto joi;
            }
        }
        cout<<-1<<endl;
        return 0;
        joi:;
    }
    rep(i,n)cout<<ans[i]<<endl;
}


Measured memory_bytes: 256
import itertools

n = int(input())
x = []
y = []
h = []
for i in range(n):
    xx, yy, hh = map(int, input().split())
    x.append(xx)
    y.append(yy)
    h.append(hh)
if n == 1:
    print(x[0], y[0], h[0])
else:
    c = [-1, -1]
    top = -1
    for cx, cy in itertools.product(range(0, 101), range(0, 101)):
        flag = False
        tmp_h = 0
        for j in range(n):
            if h[j] != 0:
                tmp_h_tmp = h[j] + abs(cx-x[j]) + abs(cy-y[j])
                if tmp_h == 0:
                    tmp_h = tmp_h_tmp
                else:
                    if tmp_h != tmp_h_tmp:
                        flag = True
                        break
        if flag:
            continue
        assert tmp_h > 0
        for j in range(n):
            if h[j] == 0:
                if not max(tmp_h - abs(cx-x[j]) - abs(cy-y[j]), 0) == 0:
                    flag = True
                    break
        if flag:
            continue
        c = [cx, cy]
        top = tmp_h
        break
    print(c[0], c[1], top)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<b;++i)
#define debug(x) cerr<<#x<<": "<<x<<endl
#define sz(x) (int)(x).size()
using vi = vector<int>;
using ll = long long;
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    string s;
    ll k;
    cin >> s >> k;
    ll total = 0;
    char last = '*';
    ll sum1=0;
    rep(it,0,2) {
        ll sum = 0;
        string t = s;
        int n = sz(t);
        rep(i,0,n) {
            if(i>0) last = t[i-1];
            if(t[i]==last) {
                t[i] = '*';
                ++sum;
            }
            last = t[i];
        }
        if(it==0) {
            if(last!=s[0]) {
                total = k*sum;
                break;
            }
            else sum1 = sum;
        }
        if(it==1) {
            if(last!=s[0]) {
                total = sum*(k/2)+sum1*(k-k/2);
            }
            else total = sum1+(k-1)*sum;
        }
    }
    cout<<total<<endl;
}


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


int main(){
    int A,B;
    cin >> A >> B;
    int wa = A + B;
    int sa = A - B;
    int seki = A * B;

    int max = wa;
    
    if(max < sa){
        max = sa;
    }
    if(max < seki){
        max = seki;
    }

    cout << max;

    return 0;
}

Measured memory_bytes: 384
#include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;
//1  2 1 3 2 4 2 5 8 7 a
//10 8 0 5 0 4 0 3 5 0 ans
//1  2 0 3 0 4 0 5 8 0 s

//1  1  2  2  2  3  4  5  7  8 so
//10 10 18 18 18 23 27 30 34 35wa
int main(void) {
	long long int i,j, N,b,max=0,gen=0;
	vector<long long int>a;//元の数列
	vector<long long int>s;//初めて記録更新したとこ
	vector<long long int>so;//ソート済み
	vector<long long int>wa;
	scanf("%lld", &N);
	for (i = 0; i <N; i++) {
		scanf("%lld", &b);
		a.push_back(b);
		so.push_back(b);
		if (max < b) { s.push_back(b); max = b; }else{ s.push_back(0); }
	}
	sort(so.begin(), so.end());
	wa.push_back(N*so[0]);
	for (i = 1; i < N; i++) {
		wa.push_back((so[i] - so[i - 1])*(N - i)+wa[i-1]);
	}
	max = 0; j = 0;
	for (i = 0; i < N; i++) {
		if (s[i] == 0) { printf("0\n"); continue; }
		while (-1) {
			if (s[i] <= so[j]) { break; }
			j++;
		}
		printf("%lld\n", wa[j] - max);
		max = wa[j];
	}

	return 0;
}

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

int main(){
	int n;
	cin >> n;
	int s=0,m=0;
	for(int i=0; i<n; i++){
		int l;
		cin >> l;
		s += l;
		m = max(m,l);
	}

	cout << ((s-2*m > 0)?"Yes":"No") << endl;

	return 0;
}

Measured memory_bytes: 3592
N = int(input())
*A, = map(int, input().split())
*B, = map(int, input().split())

C = []
D = []
for i in range(N):
    if A[i] < B[i]:
        C.append(B[i]-A[i])
    elif A[i] > B[i]:
        D.append(A[i]-B[i])

C.sort()
D.sort(reverse=1)

rest = 0
j = 0
ans = 0
for c in C:
    while j < len(D) and rest < c:
        rest += D[j]
        ans += 1
        j += 1
    if rest < c:
        ans = -1
        break
    ans += 1
    rest -= c
print(ans)

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

int main()
{
    string S;
    cin >> S;

    vector<int> vec(4);
    for (int i = 0; i < 4; i++)
        vec.at(i) = S.at(i) - '0';
    vector<char> op(3);

    for (int i = 0; i < 8; i++)
    {
        int ans = vec.at(0);
        if (i % 2 == 0)
        {
            ans += vec.at(1);
            op.at(0) = '+';
        }
        else
        {
            ans -= vec.at(1);
            op.at(0) = '-';
        }

        if (i % 4 < 2)
        {
            ans += vec.at(2);
            op.at(1) = '+';
        }
        else
        {
            ans -= vec.at(2);
            op.at(1) = '-';
        }

        if (i % 8 < 4)
        {
            ans += vec.at(3);
            op.at(2) = '+';
        }
        else
        {
            ans -= vec.at(3);
            op.at(2) = '-';
        }

        if (ans == 7)
        {
            cout << vec.at(0) << op.at(0) << vec.at(1) << op.at(1);
            cout << vec.at(2) << op.at(2) << vec.at(3);
            cout << "=7" << endl;
            break;
        }
    }
}

Measured memory_bytes: 256
#include<stdio.h>
main(){
	int i,j,h[10],tmp;
	for(i=0;i<10;i++){
		scanf("%d",&h[i]);
	}
	
	for(i=0;i<=9;i++){
		for(j=9;j>i;j--){
			if(h[j]>h[j-1]){
				tmp=h[j];
				h[j]=h[j-1];
				h[j-1]=tmp;
			}
		}
	}
	for(i=0;i<3;i++){
		printf("%d\n",h[i]);
	}
	return 0;
}

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

using namespace std;

int main()
{
    //freopen("lcs.inp","r",stdin);
    int n,m,i,j;
    string s, t,k="";
    getline(cin,s);
    getline(cin,t);
    n = s.length();
    m = t.length();
    int f[n+1][m+1];
    for (i = 0; i <= n; i++)
    {
        f[i][0] = 0;
    }
    for ( j = 0; j <= m; j++)
    {
        f[0][j] = 0;
    }
    for ( i = 1; i <= n; i++)
    {
        for ( j = 1; j <= m; j++)
        {
            if ( s[i-1] == t[j-1])
            {
                f[i][j] = f[i-1][j-1] + 1;
            }
            else
            {
                f[i][j] = max(f[i-1][j],f[i][j-1]);
            }
        }
    }
    i = n, j = m;
    while (i > 0 && j > 0)
    {
        if (s[i-1] == t[j-1])
        {
            k=char(s[i-1])+k;
            //cout<<"Chon ki tu "<<i<<j<<s[i-1]<<endl;
            i--;
            j--;
        }
        else
        {
            if (f[i-1][j] == f[i][j])
            {
                i--;
            }
            else
            {
                j--;
            }
        }
    }
    cout << k;
    return 0;
}


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

int main(){
    int n;
    int sum=0;
    cin >> n;
    for(int i=1; i<=n; i+=2){
        int count=1;
        for(int j=2; j<=i; j++){
            if( i%j == 0)  count++;
        }
        if(count==8) sum++;
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

#define DAY_OF_YEAR 365
#define cal(x, base) (x / base + (x % base == 0?0:1))

int count_pattern(int);

int main(void) {
    int n;

    while (EOF != scanf("%d", &n)) {
        if (n == 0) {
            break;
        }

        printf("%d\n", cal(cal(count_pattern(n), 10), DAY_OF_YEAR));
    }

    return 0;
}


int count_pattern(int num) {

    if (num <= 1) {
        return 1;
    } else if (num == 2) {
        return 2;
    } else if (num == 3) {
        return 4;
    }

    return count_pattern(num - 1) + count_pattern(num - 2) + count_pattern(num - 3);
}

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

struct SegmentTree {
  struct Node {
    int v;
    Node(int v) : v(v) {}

    Node operator*(const Node &r) const {
      return Node(min(v, r.v));
    }
  };

  Node e = Node((1ll << 31) - 1);
  size_t sz;
  vector<Node> seg;

  SegmentTree(int n) {
    sz = 1;
    while (sz < n) sz <<= 1;
    seg.assign(2 * sz - 1, e);
  }

  void update(int k, const Node &x) {
    k += sz - 1;
    seg[k] = x;
    while (k) {
      k = (k - 1) / 2;
      seg[k] = seg[2 * k + 1] * seg[2 * k + 2];
    }
  }

  Node query(int a, int b, int k, int l, int r) {
    if (r <= a || b <= l) return e;
    if (a <= l && r <= b) return seg[k];
    return query(a, b, 2 * k + 1, l, (l + r) / 2) * query(a, b, 2 * k + 2, (l + r) / 2, r);
  }

  void update(int k, int x) {
    update(k, Node(x));
  }

  int query(int a, int b) {
    return query(a, b, 0, 0, sz).v;
  }
};

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DSL_2_A&lang=jp
int main() {
  int n, q;
  cin >> n >> q;

  SegmentTree seg(n);
  while (q--) {
    int com;
    cin >> com;

    if (com) {
      int l, r;
      cin >> l >> r;
      cout << seg.query(l, r + 1) << endl;
    } else {
      int v, x;
      cin >> v >> x;
      seg.update(v, x);
    }
  }
}

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

int main(void){
    int n;
    cin >> n;

    string s;
    cin >> s;


    int cnt = 0;
    int max = 0;

    for(int i = 0; i < n; i++){
        if(s.at(i) == 'I'){
            cnt++;
        }
        else{
            cnt--;
        }
      
        if(max < cnt) {
          max = cnt;
        }
    }

    printf("%d", max);
    return 0;

}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#include <time.h>
typedef long long llint;
typedef long double ldouble;
// 小大
int compare(const void *a, const void *b){return *(llint *)a - *(llint *)b;}
typedef struct{
    llint aa;
    llint bb;
}frequent;
// 小大
int cmp( const void *p, const void *q ) {
    return ((frequent*)p)->bb - ((frequent*)q)->bb;
}


int main(void){
    llint n,k;
    scanf("%lld%lld",&n,&k);
    // llint [n];
    // for(i=0;i<n;i++){
    //     scanf("%lld",&[i]);
    // }
    if(n==k){
        printf("Yes\n");
    }else{
        printf("No\n");
    }

    // printf("\n");
    return 0;
}


Measured memory_bytes: 128
#include <algorithm>
#include <iostream>
#include <numeric>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;

int main(void) {
  ios::sync_with_stdio(false);
  int N, x;
  cin >> N >> x;
  if (x == 1 || x == 2 * N - 1) {
    cout << "No" << endl;
    return 0;
  }
  cout << "Yes" << endl;
  if (N == 2) {
    cout << "1 2 3" << endl;
    return 0;
  }
  vector<int> answer(2 * N - 1);
  iota(answer.begin(), answer.end(), 1);
  if (x <= N) {
    rotate(answer.rbegin(), answer.rbegin() + (N - x), answer.rend());
  } else {
    rotate(answer.begin(), answer.begin() + (x - N), answer.end());
  }
  rep(i, 2 * N - 1) cout << answer[i] << endl;
  return 0;
}


Measured memory_bytes: 3988
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define MOD 1000000007
#define INF (1<<30)
#define LINF (lint)(1LL<<56)
#define endl "\n"
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcount(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
#define plint pair<lint,lint>
typedef unsigned long long int ull;
typedef long long lint;

int main(void){
  lint M;
  cin >> M;
  lint D[M],C[M];
  lint ans=0;
  lint digitsum=0;
  lint keta=0;
  rep(i,M){
    cin >> D[i] >> C[i];
    digitsum+=D[i]*C[i];
    keta+=C[i];
  }
  cout << keta-1+(digitsum-1)/9 << endl;
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i = a; i < b; ++i)
#define all(c) c.begin(), c.end()
#define gmax(x,y) x=max(x,y)
#define gmin(x,y) x=min(x,y)
#define gadd(x,y) x=add(x,y)
#define gmul(x,y) x=mul(x,y)
using namespace std;

typedef pair<int,int> pii;
typedef long long ll;
typedef vector<int> vi;

int main(){
	cin.tie(0);
	cout.tie(0);
	ios_base::sync_with_stdio(0);
	string s;
	cin >> s;
	int c = s.back() - '0';
	string ans = "hon";
	if(c == 3)ans = "bon";
	else if(c == 0 || c == 1 || c == 6 || c == 8)ans ="pon";
	cout << ans << '\n';
}


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

int FindSumofDigits(int n){
    int sum = 0;
    while (n > 0){
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
int main(){
    int N, A, B;
    cin >> N >> A >> B;
    int total = 0;
    for (int i = 0; i <= N; ++i){
        int sum = FindSumofDigits(i);
        if (sum >= A && B >=sum){
            total += i;
        }
    }
    cout << total << endl;

    
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
int n, d, m[109], c[109][10009], cur[109];
int main() {
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	while (cin >> n >> d, n) {
		int sum = 0;
		for (int i = 0; i < n; i++) {
			cin >> m[i]; cur[i] = m[i]; sum += m[i];
			for (int j = 1; j <= m[i]; j++) cin >> c[i][j], c[i][j] += c[i][j - 1];
		}
		bool flag = true;
		for (int i = 0; i < sum && flag; i++) {
			bool found = false;
			for (int j = 0; j < n; j++) {
				if (cur[j] == 0) continue;
				cur[j]--;
				int l = 1012345678, r = -1;
				for (int k = 0; k < n; k++) {
					l = min(l, c[k][cur[k]]);
					r = max(r, c[k][cur[k]]);
				}
				if (r - l <= d) {
					found = true;
					break;
				}
				cur[j]++;
			}
			if (!found) {
				flag = false;
				break;
			}
		}
		cout << (flag ? "Yes\n" : "No\n");
	}
	return 0;
}


Measured memory_bytes: 3640
#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;
    for (int i = 1; i <= 9; ++i) {
        if (n % i == 0 && n / i <= 9 && n / i != 0) {
            puts("Yes");
            return 0;
        }
    }

    puts("No");
    return 0;
}

Measured memory_bytes: 256
import bisect
import os
from collections import Counter, deque
from fractions import gcd
from functools import lru_cache
from functools import reduce
import functools
import heapq
import itertools
import math
import numpy as np
import re
import sys

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

sys.setrecursionlimit(2147483647)
INF = float("inf")

N, H, W = list(map(int, sys.stdin.readline().split()))
A, B = list(zip(*[map(int, sys.stdin.readline().split()) for _ in range(N)]))

A = np.array(A)
B = np.array(B)

print(((A >= H) & (B >= W)).sum())


Measured memory_bytes: 15668
def s()
  gets()
end
def i()
  gets.to_i
end
def li()
  gets.split.map(&:to_i)
end
def ili()
  n = gets.to_i
  as = gets.split.map(&:to_i)
  [n, as]
end

H, W, D = li()
as = []
H.times{
  as << li()
}
Q= i()
lr = []
Q.times{
  lr << li()
}

list = Array.new(D, 0)
current = []
D.times{
  current << []
}

H.times{|i|
  W.times{|j|
    index = as[i][j]%D
    current[index] << [as[i][j],i,j]
  }
}
D.times{|i|
  current[i].sort_by!{|c| c[0]}
}
res = []
current.each{|c|
  temp = [0]
  (c.length-1).times{|i|
    temp << temp[i] + (c[i+1][1]-c[i][1]).abs + (c[i+1][2]-c[i][2]).abs
  }
  res << temp
}

lr.each{|l|
  if (l[0]%D == 0)
    puts res[l[0]%D][l[1]/D-1] - res[l[0]%D][l[0]/D-1]
  else
    puts res[l[0]%D][l[1]/D] - res[l[0]%D][l[0]/D]
  end
}

Measured memory_bytes: 27128
#include <bits/stdc++.h>
using namespace std;
void Koch(double x1, double y1, double x5, double y5, double n){
  if (n == 0){
    cout << x1 << ' ' << y1 << endl;
  } else {
    double x2 = (x1 * 2 + x5) / 3;
    double y2 = (y1 * 2 + y5) / 3;
    double x3 = x1 + (x5 - x1) / 2 - sqrt(3) / 6 * (y5 - y1);
    double y3 = y1 + (y5 - y1) / 2 + sqrt(3) / 6 * (x5 - x1);
    double x4 = (x1 + x5 * 2) / 3;
    double y4 = (y1 + y5 * 2) / 3;
    Koch(x1, y1, x2, y2, n - 1);
    Koch(x2, y2, x3, y3, n - 1);
    Koch(x3, y3, x4, y4, n - 1);
    Koch(x4, y4, x5, y5, n - 1);
  }
}
int main(){
  cout << fixed << setprecision(20);
  int n;
  cin >> n;
  double x1 = 0;
  double y1 = 0;
  double x2 = 100;
  double y2 = 0;
  Koch(x1, y2, x2, y2, n);
  cout << x2 << ' ' << y2 << endl;
}


Measured memory_bytes: 3240
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
using namespace std;
int main()
{
  int N, K;
  cin >> N >> K;
  vector<int> A(N);
  for(int n = 0; n < N; ++n){
    cin >> A[n];
  }

  // K-1ずつ変更する
  if((N-1)%(K-1)>0){
    cout << (N-1)/(K-1) + 1 << endl;
  }else{
    cout << (N-1)/(K-1) << endl;
  }
  return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define ll long long
#define V vector<long long>
#define VV vector<vector<long long>>
#define VVV vector<vector<vector<long long>>>
#define rep(i,n) for(ll (i)=0;(i)<(n);++(i))
using namespace std;

int main() {
    ll n;
    cin>>n;
    V ans(n,0);
    rep(i,n-1){
        ll a;
        cin>>a;
        ans[a-1]++;
    }
    rep(i,n)cout<<ans[i]<<endl;
}


Measured memory_bytes: 4840
N = int(input())
GA, SA, BA = map(int, input().split())
GB, SB, BB = map(int, input().split())
rate1 = [(a, b - a) for a, b in ((GA, GB), (SA, SB), (BA, BB)) if a < b]
rate2 = [(b, a - b) for a, b in ((GA, GB), (SA, SB), (BA, BB)) if a > b]


def visit(n, rate):
    if len(rate) == 1:
        m, d = rate[0]
        n += (n // m) * d
    elif len(rate) == 2:
        m1, d1 = rate[0]
        m2, d2 = rate[1]
        ans = 0
        for i in range(n // m1 + 1):
            j = (n - i * m1) // m2
            ans = max(ans, d1 * i + d2 * j)
        n += ans
    elif len(rate) == 3:
        m1, d1 = rate[0]
        m2, d2 = rate[1]
        m3, d3 = rate[2]
        ans = 0
        for i in range(n // m1 + 1):
            for j in range((n - i * m1) // m2 + 1):
                k = (n - i * m1 - j * m2) // m3
                ans = max(ans, d1 * i + d2 * j + d3 * k)
        n += ans
    return n


N = visit(N, rate1)
N = visit(N, rate2)
print(N)


Measured memory_bytes: 39536
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
  string s;
  cin>>s;
  ll size=s.size();
  for(ll i=0; i<size; i++){
    s[i]='x';
  }

  cout<<s<<"\n";

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stack>
#include <utility>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
 
int main() {
    stack<int> S1;
    stack<pair<int,int>> S2;
    string S;
    cin >> S;
    int s = 0;
    for (int i = 0; i < S.size(); i++) {
        if (S[i] == '\\') S1.push(i);
        else if (S[i] == '/' && S1.size() > 0) {
            int j = S1.top(); S1.pop();
            s += i - j;
            int a = i - j;
            while (S2.size() > 0 && S2.top().first > j) {
                a += S2.top().second; S2.pop();
            }
            S2.push(make_pair(j, a));
        }
    }
 
    vector<int> ans;
    while (!S2.empty()) {
        ans.push_back(S2.top().second);
        S2.pop();
    }
    reverse(ans.begin(), ans.end());
    cout << s << endl;
    cout << ans.size();
    for (auto i: ans) {
        cout << " " << i;
    }
    cout << endl;
 
    return 0;
}

Measured memory_bytes: 3272
#include<iostream>
using namespace std;
int bubble(int a[],int n)
{
	int count=0;
	bool flag=1;
	for(int i=0;flag;i++)
	{
		flag=0;
		for(int j=n-1;j>=i+1;j--){
			if ( a[j] < a[j - 1] ) { 
			// 交换相邻元素 
			swap(a[j],a[j - 1] ); 
			flag = 1;
             count++;	
		}
	}	
  }
  return count;
}

int main(){
	int a[100],n,count;
	cin>>n;
	for(int i=0;i<n;i++)
	cin>>a[i];
	count=bubble(a,n);
    for(int i=0;i<n;i++)
    {
    	if(i) cout<<" ";
    	cout<<a[i];
	}
	cout<<endl;
	cout<<count<<endl;
	return 0;
}


Measured memory_bytes: 3116
#include<stdio.h>
#define MAX 10000

void depth(int, int);
void print(int);
int height(int);
int sibling(int);

struct node{
    int parent;
    int left;
    int right;
};
struct node data[MAX];
int n,data2[MAX],data3[MAX];

int main(){
    int i,id,left,right,root=0;
    scanf("%d",&n);
    for(i=0;i<n;i++)data[i].parent=-1;
    for(i=0;i<n;i++){
        scanf("%d %d %d",&id,&left,&right);
        data[id].left=left;
        data[id].right=right;
        if(left!=-1)data[left].parent=id;
        if(right!=-1)data[right].parent=id;
    }
    for(i=0;i<n;i++){
        if(data[i].parent==-1) root=i;
    }
    depth(root,0);
    height(root);
    for(i=0;i<n;i++)print(i);
    return 0;
}

int height(int x){
    int h=0,h2=0;
    if(data[x].left!=-1)h=height(data[x].left)+1;
    if(data[x].right!=-1)h2=height(data[x].right)+1;
    if(h>h2)return data3[x]=h;
    else return data3[x]=h2;
}

int sibling(int x){
    if(data[x].parent==-1)return -1;
    if(data[data[x].parent].left!=x && data[data[x].parent].left!=-1){
        return data[data[x].parent].left;
    }
    if(data[data[x].parent].right!=x && data[data[x].parent].right!=-1){
        return data[data[x].parent].right;
    }
    return -1;
}

void depth(int x, int y){
    if(x==-1)return;
    data2[x]=y;
    depth(data[x].left, y+1);
    depth(data[x].right, y+1);
}

void print(int x){
    int d=0;
    printf("node %d: ",x);
    printf("parent = %d, ",data[x].parent);
    printf("sibling = %d, ",sibling(x));
    if(data[x].left!=-1)d++;
    if(data[x].right!=-1)d++;
    printf("degree = %d, ",d);
    printf("depth = %d, ",data2[x]);
    printf("height = %d, ",data3[x]);
    if(data[x].parent==-1){
        printf("root\n");
    }else if(data[x].left==-1 && data[x].right==-1){
        printf("leaf\n");
    }else{
        printf("internal node\n");
    }
}


Measured memory_bytes: 2056
#include <stdio.h>
#include <string.h>

int main(void)
{
    int N;
    char word[100][11];
    int i, j;
    unsigned char flag = 1;
    
    scanf("%d%*c", &N);
    for(i = 0; i < N; i++){
        scanf("%s%*c", word[i]);
        if(i != 0){
            if(word[i][0] != word[i - 1][strlen(word[i - 1]) - 1]){
                flag = 0;
                break;
            }else{
                for(j = 0; j < i; j++){
                    if(!strcmp(word[i], word[j])){
                        flag = 0;
                        break;
                    }
                }
            }
        }
    }
    if(flag == 0){
        printf("No\n");
    }else{
        printf("Yes\n");
    }
    
    return 0;
}


Measured memory_bytes: 128
a,b = map(int, input().split(" "))
if( b < 100):
    print((100**a)*b)
else:
    a_plus = 1
    n = 0
    while b >= 100**(a_plus):
        n = n + int(b / (100**(a_plus)))
        a_plus = a_plus + 1
    print((100 ** a) * (b + n))

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

// Numeric Constants
#define N 1000000007
#define maxs 200005
#define mins 1005
#define eps 1e-14
#define imax 2000000200
#define llmax 1000000002000000000ll
#define pi 3.141592653589793

// Others
#define ll long long
#define pb push_back
#define gc getchar_unlocked
#define iosbase ios_base::sync_with_stdio(false)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define ppi pair<pair<int,int>,int>
#define ppl pair<pll,ll>
#define vi vector<int>
#define sc scanf
#define pr printf
#define lld I64d
#define F first
#define S second
#define siter set<int>::iterator
#define p_pq priority_queue
#define ub upper_bound
#define lb lower_bound

int customlog2(int x){
    int ret=0;
    while(x>1){
        ret++;
        x>>=1;
    }
    return ret;
}

int power(int a,int b){
    int ret=1;
    while(b>0){
        if(b&1){
            ret=(ret*a);
        }
        a=(a*a);
        b>>=1;
    }
    return ret;
}


int powerMOD(int a,int b,int c){
    int ret=1;
    while(b>0){
        if(b&1){
            ret=(ret*a)%c;
        }
        a=(a*a)%c;
        b>>=1;
    }
    return ret;
}
int a[maxs];
int main()
{
    int n,i;
    sc("%d",&n);
    for(i=0;i<2*n;i++){
        sc("%d",&a[i]);
    }
    int ans=0;
    sort(a,a+2*n);
    for(i=2*n-2;i>=0;i-=2){
        ans+=a[i];
    }
    pr("%d\n",ans);
    return 0;
}

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

int *g_a;
int *g_b;
int main(void)
{
    int n;
    cin >> n;
    std::vector<int> a;
    std::vector<int> b;

    for( int i = 0; i < n; i++ )
    {
        int ta, tb;
        cin >> ta >> tb;
        a.push_back(ta);
        b.push_back(tb);
    }
    std::sort(a.begin(), a.end());
    std::sort(b.begin(), b.end());

    int ans;

    if( n % 2 == 1 )
    {
        ans = b.at( n / 2 ) - a.at( n / 2 ) + 1;
    }
    else
    {
        ans = b.at( n / 2 - 1 ) + b.at( n / 2 ) - a.at( n / 2 - 1 ) - a.at( n / 2 ) + 1;
    }
    cout << ans;    
}

Measured memory_bytes: 5092
#pragma warning(disable:4996)
#include <bits/stdc++.h>

using namespace std;

//macro
#define FOR(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define EPS (1e-8)
#define equals(a,b)(fabs((a)-(b))<EPS)

using ll = long long;
using ull = unsigned long long;
using vb = vector<bool>;
using vi = vector<int>;
using vll = vector<ll>;
using vs = vector<string>;
using vvb = vector<vb>;
using vvi = vector<vi>;
using vvll = vector<vll>;
//func
template<typename A, typename T>void assign2d(A&arr, ll H, ll W, T t) { arr.resize(H); REP(i, H) arr[i].assign(W, t); }
template<class T> ostream &operator<<(ostream &os, const vector<T> &v) { int n = v.size(); REP(i, n)os << v[i] << (i == n - 1 ? "" : " "); return os; }
template <class T = int> inline T IN() { T x; cin >> x; return x; }
template<class T> inline void OUT(const T &x) { cout << x << "\n"; }
void YESNO(bool c) { OUT(c ? "YES" : "NO"); };
void YesNo(bool c) { OUT(c ? "Yes" : "No"); };
struct pre_ { pre_() { cin.tie(nullptr); ios::sync_with_stdio(false); /*cout << fixed << setprecision(6);*/ } } pre__;

int main() {
	int A, B, C;
	cin >> A >> B >> C;
	YESNO(B - A == C - B);
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;
public class Main{
    public static void main(String[] args) throws IOException{
        Reader r = new Reader();
        int N = r.i();
        int[] u = new int[N-1],
              v = new int[N-1],
              w = new int[N-1];
        ArrayList<int[]>[] T = new ArrayList[N];
        int[] color = new int[N];
        Arrays.fill(color, -1);
        for(int i = 0; i < N; i++)
            T[i] = new ArrayList<>();
        for(int i = 0; i < N-1; i++){
            int[] a = r.ii();
            u[i] = a[0];
            v[i] = a[1];
            w[i] = a[2];
            T[u[i]-1].add(new int[]{v[i], w[i]});
            T[v[i]-1].add(new int[]{u[i], w[i]});
        }
        ArrayList<Integer> A = new ArrayList<>();
        A.add(1);
        color[0] = 0;
        while(A.size() > 0){
            int s = A.remove(0);
            ArrayList<int[]> set = T[s-1];
            for(int[] t : set){
                if(color[t[0]-1] < 0){
                    if(t[1]%2 == 0)
                        color[t[0]-1] = color[s-1];
                    else
                        color[t[0]-1] = 1- color[s-1];
                    A.add(t[0]);
                }
            }
        }
        for(int c : color)
            print(c);
    }
    static void print(Object o){
        System.out.println(o.toString());
    }
    static class Reader extends BufferedReader{
        Reader(){
            super(new InputStreamReader(System.in));
        }
        String s() throws IOException{
            return readLine();
        }
        String[] ss() throws IOException{
            return s().split(" ");
        }
        int Int(String s){
            return Integer.parseInt(s);
        }
        int i() throws IOException{
            return Int(s());
        }
        int[] ii() throws IOException{
            String[] ss = ss();
            int size = ss.length;
            int[] ii = new int[size];
            for(int j = 0; j < size; j++) ii[j] = Int(ss[j]);
            return ii;
        }
    }
}


Measured memory_bytes: 72320
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <string>
#include <cmath>
using namespace std;
#define MOD 1000000007
#define MAX 510000
#define INF 1<<30
#define LINF (ll)1<<62
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll, ll> P;
typedef vector<pair<ll, ll>> vpl;

int main(){
    ll n,m; cin >> n >> m;
    vvl G(n);
    vl indeg(n,0);
    rep(i,m){
        ll x,y; cin >> x >> y;
        x--; y--;
        G[x].push_back(y);
        indeg[y]++;
    }
    vl d(n,0);
    queue<ll> q;
    rep(i,n) if(indeg[i] == 0) q.push(i);
    while(!q.empty()){
        ll u = q.front(); q.pop();
        for(auto v : G[u]){
            indeg[v]--;
            if(indeg[v] == 0){
                q.push(v);
                d[v] = max(d[v], d[u]+1);
            }
        }
    }
    ll mx = 0;
    rep(i,n) mx = max(mx, d[i]);
    //rep(i,n) cout << d[i] << " ";
    cout << mx << endl;
}

Measured memory_bytes: 7296
// Math = ♥️

#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
using namespace std;

#define ll long long
#define ld long double
typedef pair<ll, ll> ii;
typedef vector<ll> vi;
typedef vector<bool> vb;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<vii> vvii;
#define pq priority_queue
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(), (c).end()
#define sz(c) ((ll)c.size())
// #define ordered_set                            \
//     tree<ll, null_type, less<ll>, rb_tree_tag, \
//          tree_order_statistics_node_update>

int main(void) {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    ll x;
    cin >> x;

    cout << (lcm(x, 360) / x) << "\n";
}


Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
using i64 = int_fast64_t;
#define rep(i, N) for(int (i) = 0; (i) < (N); (i)++)
#define all(v) (v).begin(), (v).end()
#define eb emplace_back

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

Measured memory_bytes: 256
#!/usr/bin/env python3
# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools


def input_int_list_with_length(length=None):
    if length == None:
        length = int(input())
    return list(map(int, input().split()))[:length]


def solve(N, A):
    ans = 0
    L = {}
    for i in range(N):
        l = i+A[i]
        if l in L:
            L[l] += 1
        else:
            L[l] = 1
    for i in range(N):
        r = i-A[i]
        if r in L:
            ans += L[r]

    print(ans)


def main():
    A = input_int_list_with_length()
    solve(len(A), A)


if __name__ == '__main__':
    main()


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

int main(){
	int n,m,k,i;
	cin>>n>>m;
	for(int i=1;i<=m;i++){
		cin>>k;
		n-=k;
	}
	if(n<0) cout<<"-1";
	else cout<<n;
	return 0;
}

Measured memory_bytes: 3596
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <utility>
#include <vector>
#include <tuple>

#define DEBUG(x) cout<<#x<<": "<<x<<endl

using namespace std;

int main(){

	long long N, K;

	cin >> N >> K;

	long long A[N];

	for(long long i = 0; i < N ; i++){
		cin >> A[i];
	}

	sort(A, A+N);

	long long ans = 1000'000'009;

	for(long long i = 0; i < N-K+1; i++){
		ans = min(ans, A[i+K-1] - A[i]);
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 1024
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
    
al = [1]
num2ind = {1:0}
for i in range(K):
    ne = A[al[-1]-1]
    al.append(ne)
    if ne in num2ind:
        tar = num2ind[ne]
        break
    num2ind[ne] = i+1
    
ne = i+1
if K<=len(al):
    print(al[K])
else:
    K-=tar
    K%=(ne-tar)
    print(al[tar+K])


Measured memory_bytes: 113844
#include <bits/stdc++.h>
#define ll long long
#define fi first
#define se second
#define sz(a)  int((a).size())
#define pb  push_back
#define eb  emplace_back
#define FOR(var,from,to) for(int var=(from);var<=(to);++var)
#define rep(var,n)  for(int var=0;var<(n);++var)
#define rep1(var,n)  for(int var=1;var<=(n);++var)
#define repC2(vari,varj,n)  for(int vari=0;vari<(n)-1;++vari)for(int varj=vari+1;varj<(n);++varj)
#define repC3(vari,varj,vark,n)  for(int vari=0;vari<(n)-2;++vari)for(int varj=vari+1;varj<(n)-1;++varj)for(int vark=varj+1;vark<(n);++vark)
#define ALL(c)  (c).begin(),(c).end()
#define RALL(c)  (c).rbegin(),(c).rend()
#define tr(i,c)  for(auto i=(c).begin(); i!=(c).end(); ++i)
#define mset(arr,val)  memset(arr,val,sizeof(arr))
#define mid(x,y) ((x)+((y)-(x))/2)
#define IN(x,a,b) ((a)<=(x)&&(x)<=(b))
using namespace std;
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void Ans(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }


int main() {
    int N;
    int ans=0;
    cin>>N;
    char a;
    while(cin>>a){
        char b;
        if(a+N>'Z'){
            b=a+N-26;
        }else{
            b=a+N;
        }
        cout<<b;
    }
    

    cout<<endl;
    return 0;
}

Measured memory_bytes: 256
import sys
from heapq import heappush, heappop
readline = sys.stdin.readline
from collections import defaultdict
vertices, edges, start = map(int, readline().split())
connect = defaultdict(list)
cost = defaultdict(dict)
answer = ["INF" for n in range(vertices)]
for _ in range(edges):
    s, t, w = map(int, readline().split())
    connect[s].append(t)
    cost[s].update({t:w})
 
 
now = start
weight = 0
p_queue = []
heappush(p_queue, (0, now))
visited = set()
while p_queue:
    weight, now = heappop(p_queue)
    if now in visited:
        continue
    visited |= {now}
    answer[now] = weight
    for c in connect[now]:
        if c not in visited:
            heappush(p_queue, (weight + cost[now][c], c))
for a in answer:
    print(a)


Measured memory_bytes: 113976
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <iomanip>

using namespace std;

int main(){
	int n, k;
	string s = "";
	cin >> n >> k;
	while(n != 0){
		s += n%k;
		n/=k;
	}
	reverse(s.begin(), s.end());
	int len = s.length();
	cout << len << endl;
	return 0;
}

Measured memory_bytes: 384
while nums = gets
	num = nums.to_i
	count = 0
	if num == 0
		break
	end
	while num != 1
	if (num % 2) == 0
			num = num / 2
			count = count + 1
		else 
			num = (num * 3) + 1
			count = count + 1
		end
	end
	puts count
end

Measured memory_bytes: 8528
from bisect import bisect_left
def main():
    N, Q = map(int, input().split())
    W = [tuple(map(int, input().split())) for _ in range(N)]
    W.sort(key=lambda x:x[2])
    
    D = [int(input()) for _ in range(Q)]
    ans = [-1]*Q
    skip = [-1]*Q
    for s, t, x in W:
        l = bisect_left(D, s-x)
        r = bisect_left(D, t-x)
        while l < r:
            if skip[l] == -1:
                ans[l] = x
                skip[l] = r
                l+=1
            else:
                l = skip[l]
    for a in ans:
        print(a)
main()  

Measured memory_bytes: 53984
#include<stdio.h>
int main(void)
{
    char S[4],T[4];
    int i,j=0;
  
    scanf("%s",S);
    scanf("%s",T);
  
    for(i=0;i<3;i++){
      if(S[i]==T[i]) j++;
    }
      
    printf("%d\n",j);
  
    return 0;
}


Measured memory_bytes: 1732
#include<stdio.h>

int main(void)
{
	int a,b;

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

	if(a>b){
		printf("a > b\n");
	}
	else if(a<b){
		printf("a < b\n");
	}
	else{
		printf("a == b\n");
	}
	return 0;
}


Measured memory_bytes: 2052
#include<bits/stdc++.h>
using namespace std;
 
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
#define f0(i,a,b) for(int i=a;i<b;i++)
#define f1(i,a,b) for(int i=a;i<=b;i++)
#define f2(i,a,b) for(int i=a;i>b;i--)
#define f3(i,a,b) for(int i=a;i>=b;i--)
#define all(a) a.begin(),a.end()
#define pb push_back
#define mp make_pair
#define pii pair<int,int>

#define fi first
#define se second
#define mod 1000000007
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define test int t;cin>>t;while(t--)

signed main(){
    fast
int a,b,c;
cin>>a>>b>>c;
int d=(a-1)/b+1;
cout<<d*c<<endl;
    
    }

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

int main(){
 int a=0, b=0, c=0, d=0, k=0;
  cin >> a >> b >> c;
  cin >> k;
  while(a >= b){b *= 2; d++;}
  while(b >= c){c *= 2; d++;}
  
  if (d <= k) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
  
}


Measured memory_bytes: 3636
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<vector>
#include<functional>
#include<algorithm>
using namespace std;
int main() {
	int a[3];
	for (int i = 0; i < 3; i++) cin >> a[i];
	sort(a, a + 3);
	cout << a[0] << " " << a[1] << " " << a[2] << endl;
}

Measured memory_bytes: 3100
#include<iostream>
#include<string>
#include<cctype>
#include<fstream>
#define rep(i,start,n) for(int i=start;i<n;i++)    //http://peroon.hatenablog.com/entry/20091123/1258966199????????§
//???for()????????????????????????????????¨??§?°??????????????????¨????????????rep???repetition?????\??§??????????????§?????????//

using namespace std;

int main(){

  string sentence;                    //????????????????´????????????°?????????

  getline(cin,sentence);              //???????????¨?????°???cin?????¨??????????????????????´?

  rep(i,0,sentence.length()){                //for()??¨?????????????????????????????????????????¶??????????????????????????§???
    if(islower(sentence[i])){                //sentence???????´??????????????????????????????????????°?????????????????????????
      sentence[i] = toupper(sentence[i]);   //?°????????????´???????????????????????§???????????????
    }
    else{                                   //??????????????´????????\???????????????????????§???????????´??????
      sentence[i] = tolower(sentence[i]);   //??§???????????´???????°????????????????
    }
  }

  cout << sentence << endl;                  //??????

  return 0;

}

Measured memory_bytes: 1180
from itertools import permutations


def main():
    """
    とおり方
    2 <= N <= 200
    2 <= R <= min(8, N)
    より、
    最大でも 2 <= R <= 8
    8! = 40320

    道路
    1 <= M <= N * (N-1) / 2
    より、
    最大でも 100 * 199 = 19900

    調べ方
    rに現れない町を経由する可能性がある
    ある町Aからある町Bまでの最短距離を求める
    ABCの町を訪れるならば、
    A→B→C、
    B→C→A
    C→A→B
    の３パターン（組合せ）がある
    もちろん他の町を経由するかもしれない
        A→(D)→B→(E)→C
    """
    N, M, R = map(int, input().split())
    r = map(int, input().split())

    inf = float("inf")
    d = [[inf] * (N + 1) for _ in range(N + 1)]
    for n in range(1, N + 1):
        d[n][n] = 0

    for _ in range(M):
        a, b, c = map(int, input().split())
        d[a][b] = c
        d[b][a] = c

    for k in range(1, N + 1):
        for i in range(1, N + 1):
            for j in range(1, N + 1):
                if d[i][j] > d[i][k] + d[k][j]:
                    d[i][j] = d[i][k] + d[k][j]

    min_cost = inf
    for p in permutations(r):
        cost = 0
        for i in range(len(p) - 1):
            src, dst = p[i:i + 2]
            cost += d[src][dst]
        min_cost = min(min_cost, cost)

    print(min_cost)

if __name__ == '__main__':
    main()


Measured memory_bytes: 4656