akhauriyash/Code-Regression huggingface dataset:
// 03.68 s	283904 KB
import java.util.Scanner;

class Main {
  private final static String INSERT = "insert";
  private static Tree ROOT = null;
  private static Tree END = null;

  public static void main(String... args) {
    Scanner sc = new Scanner(System.in);
    int times = sc.nextInt();

    for (int i = 0; i < times; i++) {
      if (sc.next().equals(INSERT)) {
        insert(sc.nextInt());
      } else {
        createBuilderInorder(ROOT);
        System.out.println();
        createBuilderByRoot(ROOT);
        System.out.println();
      }
    }
  }

  public static void insert(int key) {
    Tree y = null;
    Tree x = ROOT;
    Tree z = new Tree();
    z.key = key;

    while (x != null) {
      y = x;
      if (z.key < x.key) {
        x = x.left;
      } else {
        x = x.right;
      }
    }

    z.parent = y;

    if (y == null) {
      ROOT = z;
    } else if (z.key < y.key) {
      y.left = z;
    } else {
      y.right = z;
    }
  }

  public static void createBuilderInorder(Tree tree) {
    if (tree != null) {
      createBuilderInorder(tree.left);
      System.out.print(" ");
      System.out.print(tree.key);
      createBuilderInorder(tree.right);
    }
  }

  public static void createBuilderByRoot(Tree tree) {
    if (tree != null) {
      System.out.print(" ");
      System.out.print(tree.key);
      createBuilderByRoot(tree.left);
      createBuilderByRoot(tree.right);
    }
  }
}

class Tree {
  public int key;
  public Tree left;
  public Tree right;
  public Tree parent;

  public Tree() { }
}



Measured memory_bytes: 221436
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
ll GetDigit(ll num){ return log10(num)+1; } //numの桁数を求める

int main()
{
    vector<int> a(3);
    cin >> a[0] >> a[1] >> a[2];
    sort(a.begin(), a.end());
    rep(i,2){
        cout << a[i] << " ";
    }
    cout << a[2];
    cout << endl;
    return 0;   
}


Measured memory_bytes: 3152
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())

l = [a, b, c, d, e]
n = sorted(l)[4]-sorted(l)[0]

if n <= k:
  print('Yay!')
else:
  print(':(')

Measured memory_bytes: 3060
N = int(input())
A = []
B = []
for _ in range(N):
  a, b = map(int, input().split())
  A.append(a)
  B.append(b)
  
if A == B:
  print(0)
else:
  M = sum(A)
  c = 10**10
  for a, b in zip(A, B):
    if a > b:
      c = min(c, b)
  print(M - c)


Measured memory_bytes: 53720
#include "bits/stdc++.h"

using namespace std;

//------------------------------- Libraries --------------------------------//

//------------------------------- Type Names -------------------------------//

using i64 = int_fast64_t;

using seika = string;
//akari : 1D, yukari : 2D, maki : 3D vector
template <class kizuna>
using akari = vector<kizuna>;
template <class yuzuki>
using yukari = akari<akari<yuzuki>>;
template <class tsurumaki>
using maki = akari<yukari<tsurumaki>>;
//akane : ascending order, aoi : decending order
template <class kotonoha>
using akane = priority_queue<kotonoha, akari<kotonoha>, greater<kotonoha>>;
template <class kotonoha>
using aoi = priority_queue<kotonoha>;

//------------------------------- Dubug Functions ---------------------------//
inline void print()
{
    cout << endl;
}
template <typename First, typename... Rest>
void print(const First &first, const Rest &... rest)
{
    cout << first << ' ';
    print(rest...);
}
//------------------------------- Solver ------------------------------------//

void solve()
{
    int n, m;
    cin >> n >> m;
    yukari<int> g(n);
    while (m--)
    {
        int u, v;
        cin >> u >> v;
        g[u].push_back(v);
    }
    auto dfs = [&](auto &&dfs, akari<int> &vst, int v, int p, int s) -> bool {
        vst[v] = 1;
        for (int nv : g[v])
        {
            if (nv != p)
            {
                if (vst[nv])
                {
                    if (nv == s)
                    {
                        cout << 1 << endl;
                        exit(0);
                    }
                }
                else
                {
                    dfs(dfs, vst, nv, v, s);
                }
            }
        }
    };
    for (int s = 0; s < n; s++)
    {
        akari<int> vst(n);
        dfs(dfs, vst, s, -1, s);
    }
    cout << 0 << endl;
}

int main()
{
    solve();
    return 0;
}



Measured memory_bytes: 3152
#include <iostream> 
#include <vector>
#include <utility>
#include <queue>
#include <string>

using namespace std;

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

  vector<vector<int>> board(H, vector<int>(W));

  int n_white = 0;
  for (int i = 0; i < H; i++) {
    string str; cin >> str; 
    for (int j = 0; j < W; j++) {
      if (str.at(j) == '#') {
        board[i][j] = -1; // -1 is blocked
      } else { // '.'
        board[i][j] = -2; // -2 is open 
        n_white++;
      }
    }
  }

  queue<pair<int, int>> q; 
  q.push(make_pair(0, 0));
  board[0][0] = 0; // n >= 0 to signify travelling distance from (0, 0) 

  int ans = -1;
  while (!q.empty()) {
    auto p = q.front(); q.pop(); 
    int r = p.first; 
    int c = p.second; 
    int step = board[r][c] + 1;

    if (r == H - 1 && c == W - 1) {
      ans = n_white - step;
      break; 
    }

    if (r > 0 && board[r - 1][c] == -2) {
      board[r - 1][c] = step;
      q.push(make_pair(r - 1, c));
    }
    if (r < H - 1 && board[r + 1][c] == -2) {
      board[r + 1][c] = step;
      q.push(make_pair(r + 1, c));
    }
    if (c > 0 && board[r][c - 1] == -2) {
      board[r][c - 1] = step;
      q.push(make_pair(r, c - 1));
    }
    if (c < W - 1 && board[r][c + 1] == -2) {
      board[r][c + 1] = step; 
      q.push(make_pair(r, c + 1));
    }
  }

  cout << ans << endl;
}

Measured memory_bytes: 256
import math
import copy
import sys
import fractions
import numpy as np
from functools import reduce
import statistics
import heapq

input = sys.stdin.readline
sys.setrecursionlimit(10**6)

# ===FUNCTION===

def getInputInt():
    inputNum = int(input())
    return inputNum


def getInputListInt():
    outputData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData


def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList


def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList


# ===CODE===

def getInputStr():
    inputStr = str(input())
    return inputStr

data = getInputStr()

a = str(data)
listStr = []
listStr = list(a)

del listStr[len(listStr)-1]

ans = np.zeros(len(listStr), dtype=int)

counter = 0
for i in range(len(listStr)):
    if listStr[i] == "R":
        counter+=1
    else:
        ans[i-1] += counter//2 + counter%2
        ans[i] += counter//2
        counter = 0

for i in range(len(listStr)-1, -1, -1):
    if listStr[i] == "L":
        counter+=1
    else:
        ans[i+1] += counter//2 + counter%2
        ans[i] += counter//2
        counter = 0

print(*ans)

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

using namespace std;

#define N 600000

int n,m,f[N][30],go[N][30];
char s[N];

int main(){
	scanf("%s",s+1); n=strlen(s+1);
	for (int i=n;i;--i){
		f[i][s[i]-'a']=i+1;
		for (int j=s[i]-'a'+1;j<26;++j)
			f[i][j]=f[f[i][j-1]][j-1];
		go[i][0]=f[f[i][25]][25];
		for (int j=1;j<=20;++j)
			go[i][j]=go[go[i][j-1]][j-1];
		for (int j=0;j<s[i]-'a';++j)
			f[i][j]=f[go[i][0]][j];
	}
	scanf("%d",&m);
	while (m--){
		int x,y; scanf("%d%d",&x,&y);
		for (int i=20;~i;--i)
			if (go[x][i]&&go[x][i]<=y) x=go[x][i];
		puts(go[x][0]==y+1?"Yes":"No");
	}
	
	return 0;
}
			

Measured memory_bytes: 121344
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define pi pair<int,int>
#define ff first
#define ss second
#define boost ios::sync_with_stdio(false);cin.tie(nullptr)
#include "string"
#define int long long

const int M = 1e9 + 7;

int mod(int n){
	n %= M;
	return (n + M) % M;
}

int power(int a,int b){
	int ans = 1;
	while(b>0){
		if(b&1)
			ans = mod(ans * a);
		a = mod(a * a);
		b /= 2;
	}
	return ans;
}

pi get(pi a){
	if(a.ff == 0 && a.ss == 0)
		return {0,0};
	int g = __gcd(a.ff,a.ss);
	a.ff /= g;
	a.ss /= g;
	
	if(a.ss<0) {
		a.ff *= -1;
		a.ss *= -1;
	}

	if(a.ff == 0)
		a.ss = 1;
	if(a.ss == 0)
		a.ff = 1;
	return a;
}

pi rev(pi a) {
	a.ff *= -1;
	if(a.ff < 0){
		a.ff *= -1;
		a.ss *= -1;
	}
	if(a.ff == 0)
		a.ss = 1;
	if(a.ss == 0)
		a.ff = 1;
	return {a.ss,a.ff};
}

int32_t main(){
   boost;
   int n;
   cin>>n;
   pi a[n];
   map<pi,int>mp;
   for(int i=0;i<n;i++){
   	cin>>a[i].ff>>a[i].ss;
   	a[i] = get(a[i]);
   	mp[a[i]]++;
   }

   int ans = 1;
   for( auto & p:mp){
   	if(mp[p.ff] == -1)
   		continue;
   	if(p.ff == make_pair(0ll,0ll))
   		continue;
   	pi p1 = rev(p.ff);
   	if(mp.count(p1)){
   		int tt = mod( power(2,p.ss) + power(2,mp[p1]) - 1);
   		ans = mod(ans * tt);
   		mp[p1] = -1;
   	}
   	else
   		ans = mod(ans*power(2,p.ss));
   }
   ans = mod(ans  + mp[{0,0}] - 1);
   cout<<ans<<endl;
}

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

int main(){
  int N;
  cin >> N;
  
  int S = 0;
  int M = N;
  while (M > 0) {
    S += M % 10;
    M /= 10;
  }

  if ( N % S == 0) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}

Measured memory_bytes: 256
//url:
//problem name:

#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); ++i)
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Pl = pair<long long,long long>;
using veci = vector<int>;
using vecl = vector<long>;
using vecveci = vector<vector<int>>;
using vecvecl = vector<vector<long long>>;

int main() {
    int A,B; cin >> A >> B;
    int ans;
    if(A >= 13) ans = B;
    else if(A >= 6) ans = B/2;
    else ans = 0;
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define inp(X) cin >> X
#define out(X) cout << X << endl
#define out16(X) cout << setprecision(16) << X << endl
#define rep(i,n) for(int i=0;i<n;i++ )
#define rep2(i,f,n) for(int i=f;i<n;i++ )
#define MAX(A) *max_element(A.begin(),A.end())
#define MIN(A) *min_element(A.begin(),A.end())
#define SORT(A) sort(A.begin(),A.end())
#define REV(A) reverse(A.begin(),A.end())
typedef long long int ll;
using vi = std::vector<int>;
using vvi = std::vector<std::vector<int>>;
using vd = std::vector<double>;
using vvd = std::vector<std::vector<double>>;
using vll = std::vector<ll>;
using vvll = std::vector<std::vector<ll>>;
using namespace std;
#define MOD 1000000007
#define INF 1000000001
#define LL_INF 1001001001001001001

int main(void) {
	string s; cin >> s ;
	vector<string> t(3);
	t[0] = "Sunny";
	t[1] = "Cloudy";
	t[2] = "Rainy";
	if(s==t[0]) cout << t[1] << endl;
	if(s==t[1]) cout << t[2] << endl;
	if(s==t[2]) cout << t[0] << endl;
}




Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <math.h>
#include <cassert>
#define rep(i,n) for(int i = 0; i < n; ++i )
using namespace std;
using ll = long long;
using P = pair<int,int>;

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

  set<int> v;
  v.emplace(1);
  int d = 1;
  while(d<=n) v.emplace(d*=9);
  d = 1;
  while(d<=n) v.emplace(d*=6);
  
  vector<int> dp(n+1,1e9);
  dp[0] = 0;
  for(int x:v){
    for(int i = 0; i+x<=n; ++i){
      dp[i+x] = min(dp[i+x],dp[i]+1);
    }
  }
  cout << dp[n] << endl;
}


Measured memory_bytes: 640
N = int(input())
S = input()

nr = 0
ng = 0
nb = 0

for i in S:
    if i == 'R':
        nr += 1
    elif i == 'G':
        ng += 1
    elif i == 'B':
        nb += 1
    else:
        raise RuntimeError

ans = nr * ng * nb

for j in range(N):
    for i in range(j):
        k = 2 * j - i
        if k < N:
            if S[i] == S[j]: continue
            if S[i] == S[k]: continue
            if S[j] == S[k]: continue
            ans -= 1

print(ans)


Measured memory_bytes: 73572
s =list(input())
syurui = []
for i in s:
    if i not in syurui:
        syurui.append(i)
ans = sorted(syurui)
if len(ans)==26:
    print('None')
else:
    num = [97+i for i in range(26)]
    for i in num:
        if chr(i) not in ans:
            answer = i
            break
    print(chr(i))

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

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


int main() {
    double T,X; cin >> T >> X;
    cout << fixed << setprecision(10) << T/X << endl;
    return 0;
}

Measured memory_bytes: 3752
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define pb push_back
const int mx=100;

vector<int>a[mx];
bool vis[mx];
int low[mx],par[mx],ok[mx];
int ans=0,t=0;
void dfs(int u)
{
   vis[u]=true;
   ok[u]=low[u]=t++;

   for(auto v:a[u])
   {
       if(!vis[v])
       {
           par[v]=u;
           dfs(v);
           low[u]=min(low[u],low[v]);

           if(low[v]>ok[u])
            ans++;
       }
       else if(v!=par[u])
            low[u]=min(low[u],ok[v]);
   }
}

int main()
{
    int n,m;
    cin>>n>>m;

    while(m--)
    {
        int u,v;
        cin>>u>>v;
        a[u].pb(v);
        a[v].pb(u);
    }

    for(int i=1; i<=n; i++)
    {
        if(!vis[i])
            dfs(i);
    }

    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 256
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <cmath>
#include <queue>
#include <set>
#include <stack>

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = n - 1; i >= 0; i--)
#define repone(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define each(i, mp) for(auto i:mp)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll half_inf = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);

ll h, w;
ll c[10][10];
ll a[200][200];
ll d[10];
vector<bool> visited(10);

void dfs(ll now) {
    rep(i, 10) {
        if (!visited[i]) {
            if (d[now] + c[i][now] < d[i]) {
                d[i] = d[now] + c[i][now];
                visited[i] = true;
                dfs(i);
                visited[i] = false;
            }
        }
    }
}


void solve() {
    fill(d, d + 10, inf);
    fill(visited.begin(), visited.end(), false);
    visited[1] = true, d[1] = 0;
    dfs(1);
    ll ans = 0;
    rep(i, h)
        rep(j, w) if (a[i][j] != -1) {
                ans += d[a[i][j]];
            }
    cout << ans << endl;
}

int main() {
    cin >> h >> w;
    rep(i, 10)rep(j, 10) cin >> c[i][j];
    rep(i, h)rep(j, w) cin >> a[i][j];
    solve();
    return 0;
}

Measured memory_bytes: 512
#include <stdio.h>
#include <math.h>
 
int main(void) {

	int h1, m1, h2, m2, k;
	
	scanf("%d %d %d %d %d", &h1, &m1, &h2, &m2, &k);
	
	h1 = h1 * 60;
	h2 = h2 * 60;
	
	
	printf("%d", (h2 + m2) - (h1 + m1) - k);
	
	
	
	
	return 0;
}

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

int N, A[200009];

bool solve(int M) {
	vector<pair<int, int>>vec;

	vec.push_back(make_pair(1, 0));
	for (int i = 0; i < N; i++) {
		if (vec[vec.size() - 1].first < A[i]) {
			vec.push_back(make_pair(A[i], 1));
		}
		else {
			while (vec.size() >= 1 && vec[vec.size() - 1].first > A[i]) vec.pop_back();
			if (vec[vec.size() - 1].first == A[i]) vec[vec.size() - 1].second++;
			else vec.push_back(make_pair(A[i], 2));
		}

		// 単調増加になった
		while (vec.size() >= 2 && vec[vec.size() - 1].second == M + 1) {
			int Z = vec.size();
			if (vec[Z - 2].first + 1 == vec[Z - 1].first) {
				vec[Z - 2].second++; vec.pop_back();
			}
			else {
				int RANK = vec[Z - 1].first - 1; vec.pop_back();
				vec.push_back(make_pair(RANK, 1));
			}
		}

		if (i == 0) vec[0].second = 1;
	}
	if (vec[0].second > M) return false;
	return true;
}

int main() {
	cin >> N;
	for (int i = 0; i < N; i++) { cin >> A[i]; }
	bool flag = true;
	for (int i = 0; i < N - 1; i++) {
		if (A[i] >= A[i + 1]) flag = false;
	}
	if (flag == true) {
		cout << "1" << endl;
		return 0;
	}

	int L = 2, R = (1 << 30), M, maxn = (1 << 30);
	for (int i = 0; i < 40; i++) {
		M = (L + R) / 2;
		bool t = solve(M);
		if (t == true) { maxn = min(maxn, M); R = M; }
		else { L = M; }
	}
	cout << maxn << endl;
	return 0;
}

Measured memory_bytes: 2060
import sys
import numpy as np
def input(): return sys.stdin.readline().rstrip()
def ii(): return int(input())
def mi(): return map(int, input().split())
def li(): return list(mi())


def main():
    n = ii()
    x = []  
    ans = 0     
    for i in range(n):
        a, b = mi()
        x.append(a+b)
        ans -= b
    x.sort(reverse=True)
    ans += sum(x[::2])    
    print(ans)






if __name__ == '__main__':
    main()

Measured memory_bytes: 31092
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <regex>
#include <numeric>
using namespace std;

/*--- Macro ---*/
#define rep(i, n) for(int i=0; i<(int)n; i++)
#define rep1(i, n) for(int i=1; i<(int)n; i++)
#define mp make_pair
#define pb push_back
#define all(a) a.begin(), a.end()

/*---  Type ---*/
typedef long long ll;

/*--- Constants ---*/
template <typename T> const T INF = numeric_limits<T>::max() / 10;
const int MOD = (int)1e9 + 7;

// Floating
const double EPS = 1e-11;
#define EQ0(x) (abs(x) < EPS)
#define EQ(x, y) (abs(a-b) < EPS)

// Util
int max(int a, int b, int c) {return max(a, max(b, c));}
int min(int a, int b, int c) {return min(a, min(b, c));}
ll max(ll x, ll y) {return x > y ? x : y;}
ll min(ll x, ll y) {return x < y ? x : y;}
ll max(ll a, ll b, ll c) {return max(a, max(b, c));}
ll min(ll a, ll b, ll c) {return min(a, min(b, c));}

// -------------------------------------------------------------------------------------

ll gcd(ll a, ll b) {
  ll greater = max(a, b), less = min(a, b);
  ll remainder = greater % less;

  if(remainder == 0) {
    return less;
  } else {
    return gcd(less, remainder);
  }
}

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

  int ans = 0;
  rep(i, n) {
    int a;
    cin >> a;
    ans += (a - 1);
  }
  
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#define REP(i,n) for(int (i) = (0);(i) < (n);++i)
using namespace std;
int dp[1010][1010];
int main(){
	string a,b;cin>>a>>b;
	REP(i,a.size()+1)dp[i][0]=i;
	REP(i,b.size()+1)dp[0][i]=i;	
	for(int i=1;i<=a.size();i++){
		for(int j=1;j<=b.size();j++){
			int q=1;if(a[i-1]==b[j-1])q = 0;
			dp[i][j]=min(min(dp[i-1][j-1]+q,dp[i][j-1]+1),dp[i-1][j]+1);
		}
	}	
	cout<<dp[a.size()][b.size()]<<endl;
	return 0;
}

Measured memory_bytes: 7120
import Foundation

let nk = readLine()!.split(separator:" ").map{Int($0)!}
var sets: Set<Int> = []
for _ in 1...nk[1]{
  let _ = readLine()!
  let A = readLine()!.split(separator:" ").map{Int($0)!}
  for i in A{
  sets.insert(i)
  }
}
print(nk[0] - sets.count)


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

int main() {
    string s, t;
    cin >> s >> t;

    int sl = s.length(), tl = t.length();

    if(sl<tl) {
        cout << "UNRESTORABLE" << endl;
        return 0;
    }

    for(int i=sl-tl; i>=0; i--) {
        for(int j=tl-1; j>=0; j--) {
            if(s[i+j]!=t[j] && s[i+j]!='?') break;
            if(j==0) {
                for(int k=0; k<tl; k++) s[i+k] = t[k];
                for(int k=0; k<sl; k++) if(s[k]=='?') s[k]='a';
                cout << s << endl;
                return 0;
            }
        }
    }
    cout << "UNRESTORABLE" << endl;
    return 0;
}


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

int main() {
	int n,k; 
  cin >> n >> k;
	vector<ll> num(k);
  for(int i=1; i<=n;i++)
    num[i%k]++;
  ll res = 0;
  rep(a,k){
    int b = (k-a) % k;
    int c = (k-a) % k;
    if((b+c)%k!=0) continue;
    res += num[a] * num[b] * num[c];
  }
  cout << res << endl;
	return 0;
}


Measured memory_bytes: 4816
# coding: utf-8
# Your code here!

N, A, B = map(int, input().split())
sum_li = 0
total = 0

for i in range(1, N + 1):
    sum_li = sum(map(int, list(str(i))))
    if sum_li >= A and sum_li <= B:
        total += i
print(total)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define pb          push_back
#define vi          vector<int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define endl        "\n"
#define fast        ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define int         long long int
#define mod         1000000007
#define test        int t;cin>>t;while(t--)
#define REP(i,a,b)  for(int i=a,i<=b;i++)
#define MAXN        200001

struct plans{

    int x,y,z;
};

int32_t main()
{
    int n;cin>>n;
    vector<plans> vp;

    int x,y,z;
    for(int i=0;i<n;i++){
        cin>>x>>y>>z;
        vp.pb({x,y,z});
    }

    int dp[n+1][3];
    memset(dp,0,sizeof(dp));

    dp[0][0]=vp[0].x;
    dp[0][1]=vp[0].y;
    dp[0][2]=vp[0].z;

    for(int i=1;i<n;i++){
        
        dp[i][0]=vp[i].x + max(dp[i-1][2],dp[i-1][1]);
        dp[i][1]=vp[i].y + max(dp[i-1][0],dp[i-1][2]);
        dp[i][2]=vp[i].z + max(dp[i-1][1],dp[i-1][0]);
    }

    cout<<max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]))<<endl;


    return 0;
}

Measured memory_bytes: 7972
import java.util.Scanner;

public class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    int x = scan.nextInt();
    
    if(x == 0){
      System.out.println(1);
    }else if(x == 1){
      System.out.println(0);
    }
  }
}

Measured memory_bytes: 35836
class Dinic:
  def __init__(self,n,g):
    self.n=n;self.e=[[]for _ in range(n)]
    for i in range(n):
      for j,c in g[i]:a=[j,c,None];a[2]=b=[i,0,a];self.e[i].append(a);self.e[j].append(b)
  def bfs(self,s,t):
    self.d=d=[None]*self.n;d[s]=0;k=[s];e=self.e
    for i in k:
      for j,c,_ in e[i]:
        if c and d[j]==None:d[j]=d[i]+1;k.append(j)
    return d[t]!=None
  def dfs(self,v,t,f):
    if v==t:return f
    d=self.d
    for e in self.m[v]:
      w,c,r=e
      if c and d[v]<d[w]:
        b=self.dfs(w,t,min(f,c))
        if b:e[1]-=b;r[1]+=b;return b
    return 0
  def flow(self,s,t):
    l=0;x=10**20
    while self.bfs(s,t):
      self.m=list(map(iter,self.e));f=x
      while f:f=self.dfs(s,t,x);l+=f
    return l
v,e=map(int,input().split())
edge=[[]for _ in range(v)]
for _ in range(e):
  uu,vv,c=map(int,input().split())
  edge[uu].append((vv,c))
dinic=Dinic(v,edge)
print(dinic.flow(0,v-1))


Measured memory_bytes: 5880
#include <bits/stdc++.h>
using namespace std;
int main(){
    double D1=0.0;
    double D2=0.0;
    double D3=0.0;
    double D4=0.0;
    int n,x,y;
    std::vector<int> vector_x;
    std::vector<int> vector_y;
    cin >> n;
    for (int i=0;i<n;i++) {
        cin >> x;
        vector_x.push_back(x);
    }
    for (int j=0;j<n;j++) {
        cin >> y;
        vector_y.push_back(y);
    }
    for (int k=0;k<n;k++) {
        //p=1の時
        D1 = D1 + abs(vector_x[k]-vector_y[k]);
    }
    for (int l=0;l<n;l++) {
        //p=2の時
        int tmp2 = abs(vector_x[l]-vector_y[l]);
        tmp2 = tmp2*tmp2;
        D2 = D2 + tmp2;
    }
    D2 = sqrt(D2);
    for (int m=0;m<n;m++) {
        //p=3の時
        int tmp3 = abs(vector_x[m]-vector_y[m]);
        tmp3 = tmp3*tmp3*tmp3;
        D3 = D3 + tmp3;
    }
    D3 = pow(D3,1.0/3.0);
    for (int o=0;o<n;o++) {
        //p=∞の時
        int tmp4 = abs(vector_x[o]-vector_y[o]);
        if ( D4 < tmp4 ) {
            D4 = tmp4;
        }
    }
    
    
    printf("%f\n",D1);
    printf("%f\n",D2);
    printf("%f\n",D3);
    printf("%f\n",D4);
}



Measured memory_bytes: 3408
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <cassert>
#include <functional>
#include <string>
using namespace std;

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


Measured memory_bytes: 256
#include<stdio.h>
int main(){
int max=0,a[1010][1010],i,j,dp[1020][1020],min=1000000,n;
char k;
while(1){
for(i=0;i<1010;i++){
for(j=0;j<1010;j++){
dp[i][j]=0;
}
}
scanf("%d\n",&n);
if(n==0){
break;
}
for(i=1;i<=n;i++){
for(j=1;j<=n;j++){
scanf("%c",&k);
if(k=='*'){
a[i][j]=1;
}
else{
a[i][j]=0;
}
}
scanf("\n");
}
for(i=1;i<=n;i++){
for(j=1;j<=n;j++){
if(i==1 && j==1){
if(a[i][j]==0){
dp[i][j]=1;    
}    
}
else{
if(a[i][j]==1){
dp[i][j]=0;
}
else{
if(dp[i-1][j-1]<min){
min=dp[i-1][j-1];
}
if(dp[i-1][j]<min){
min=dp[i-1][j];
}
if(dp[i][j-1]<min){
min=dp[i][j-1];
}
dp[i][j]=min+1;
min=1000000;
}
}
}
}
for(i=1;i<=n;i++){
for(j=1;j<=n;j++){
if(dp[i][j]>max){
max=dp[i][j];
}
}
}
printf("%d\n",max);
max=0;
}
return 0;
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

#define INF 1<<30
#define LINF 1ll<<60ll
#define MOD 1000000007
#define pb(a) push_back(a)

#define _overload3(_1,_2,_3,_4,name,...) name
#define _rep(i,n) _repi(i,0,n)
#define _repi(i,a,b) for(int i=a, i##_len=(b); i<i##_len; ++i)
#define _repis(i,a,b,s) for(int i=a, i##_len(b); i<i##_len; i+=s)
#define REP(...) _overload3(__VA_ARGS__,_repis,_repi,_rep,)(__VA_ARGS__)

#define REPR(i, n) for(int i = n;i >= 0;--i)
#define REPARR(i, v) for(int i = 0;i < sz(v);++i)

#define all(vec) (vec.begin()),(vec.end())
#define sz(x) ((int)(x).size())
#define bit(n) (1ll<<(n))

template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}

#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define yes(n) cout<<((n)?"yes":"no")<<endl
#define poss(n) cout<<((n)?"possible":"impossible")<<endl
#define Poss(n) cout<<((n)?"Possible":"Impossible")<<endl
#define POSS(n) cout<<((n)?"POSSIBLE":"IMPOSSIBLE")<<endl



int main(){
    int n;
    cin>>n;
    int e=0,o=0;
    REP(i,n){
        int a;
        cin>>a;
        if(a%2){
            o++;
        }else{
            e++;
        }
    }
    int ans=1;
    REP(i,n){
        ans*=3;
    }
    ans-=1<<e;
    cout<<ans<<endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

int main()
{
	int K;
	std::cin >> K;
	if (K%2==0 || K%5==0) std::cout << -1 << std::endl;
	else {
		int k = 0;
		int r = 0;
		int s = 7 % K;
		do {
			r += s;
			r %= K;
			s *= 10;
			s %= K;
			k++;
		} while (r>0);
		std::cout << k << std::endl;
	}
	return 0;
}


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

#define FOR(i,a,b) for(i=a;i<=b;i++)
#define FOD(i,b,a) for(i=a;i>=b;i--)
#define pa pair<int,int>
#define fi first
#define se second
#define task "x"

typedef long long ll;
const ll M=1e6+1;
const ll N=1e4+1;
using namespace std;

ll i, j, n, ans = 0, x, y, z;
string s;

void input()
{
    cin >> s;
    n = s.size();
    s = '!' + s;

}

void solve()
{
    ll dem = 0;

    FOR(i,1,n/2)
    {
        if(s[i]!=s[n-i+1]) {dem++;}
    }
    cout<<dem;

    }

int main()
{
  	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	if(fopen(task".inp","r"))
        {
 	  freopen(task".inp","r",stdin);
 	  freopen(task".out","w",stdout);
	}
	input();
	solve();

   return 0;
}




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

int main(){
    int j,n;
    string s;
    while(cin >> s){
        j=0;
        n=0;
        for(int i=0;i<s.size()-2;i++){
            if(s.substr(i,3) == "JOI") j++;
            if(s.substr(i,3) == "IOI") n++;
        }
        cout << j << endl << n << endl;
    }
}

Measured memory_bytes: 1208
#include<stdio.h>

int main(){
    int H,W,i,j;
    while(true){
        scanf("%d %d",&H,&W);
        if(H==0 && W==0){
            break;
        }
        else{
            for(i=0;i<H;i++){
                for(j=0;j<W;j++)printf("#");
                printf("\n");
            }
            printf("\n");
        }
    }
}


Measured memory_bytes: 2688
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
#import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#
# my_round_int = lambda x:np.round((x*2 + 1)//2)
# 四捨五入
import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
a,b,c = readInts()
print(min(abs(a//2 * b*c - (a-a//2) * b*c), abs(a*(b//2)*c - (a*(b-b//2)*c)), abs(a*b*(c//2) - a*b*(c-c//2))))


Measured memory_bytes: 10376
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
template<typename T> bool chmax(T &a,T b){if(a<b){a=b;return true;}return false;}
template<typename T> bool chmin(T &a,T b){if(a>b){a=b;return true;}return false;}
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define all(vec) vec.begin(),vec.end()
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef tuple<ll,ll,ll> tlll;
typedef tuple<int,int,int> tiii;
const ll mod=1e9+7;
const int inf=1<<30;

int main(){
  string s,t; cin >> s >> t;
  int n=s.size();
  int ans=0;
  rep(i,n){
    if(s[i]!=t[i]) ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3920
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define rep1(i,n) for(int i=1;i<=(int)n;i++)
#define rep2(i,j,n) for(int j=i;j<n;j++)
#define rep3(i,j,n) for(int j=i;j<=n;j++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define sp(n) cout << fixed << setprecision(n)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
typedef long long ll;
using namespace std;
int n,m,q;
int a[50],b[50],c[50],d[50];
vector<int> x(11);
ll dfs(int i,int t,vector<int>& x){
    ll res=0;
    x[i]=t;
    if(i==n-1){
        ll res=0;
        rep(i,q){
            if(x[b[i]]-x[a[i]]==c[i]) res+=d[i];
        }
        return res;
    }else{
        for(int j=0;j+t<m;j++){
            ll buf=dfs(i+1,t+j,x);
            chmax(res,buf);
        }
    }
    return res;
}

int main(){
    cin>>n>>m>>q;
    rep(i,q){
        cin>>a[i]>>b[i]>>c[i]>>d[i];
        a[i]--;b[i]--;
    }
    ll res=dfs(0,0,x);
    cout<<res<<endl;
}

Measured memory_bytes: 3596
#include<stdio.h>
int a,A[20],M[200];
int equal(int,int);
int main(){
  int i,m;
    scanf("%d",&a);
  for(i=0;i<a;i++){
    scanf("%d",&A[i]);
  }
  scanf("%d",&m);
  for(i=0;i<m;i++){
    scanf("%d",&M[i]);
  }
  for(i=0;i<m;i++){
    if(equal(0,M[i])){
      printf("yes\n");
    }
    else{
      printf("no\n");
    }
  }
  return 0;

}
int equal(int j,int l){
  if(A[j]==l)return 1;
  if(j==a)return 0;
  else{
    if(equal(j+1,l)||equal(j+1,l-A[j]))return 1;
  }
  return 0;
}
  

Measured memory_bytes: 580
#include<iostream>
#include<vector>
#include<algorithm>
#include<stdlib.h>
#include<utility>
#include<functional>
#include<cfenv>
#include<cmath>
#include<string>
#include<queue>
#include<stack>
#include<map>
#include<set>

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define vint vector<int>
#define vvint vector<vint>
#define P pair<ll,ll>
#define INT_MAX 2147483647
#define MOD 998244353
#define PI 3.14159265358979323846
#define all(a) (a).begin(),(a).end()
using namespace std;
typedef long long ll;

#define MAX 1000000000000

int main(void) {
	int k; cin >> k;
	int n = 7;
	if (n % k == 0) {
		cout << 1 << endl;
		return 0;
	}
	vector<int> s(k + 2);
	s[n%k]++;
	int i;
	for (i = 2;; i++) {
		n = (n * 10 + 7) % k;
		if (n == 0) {
			break;
		}
		if (s[n]!=0) {
			cout << -1 << endl;
			return 0;
		}
		s[n]++;
	}
	cout << i << endl;
	return 0;
}


Measured memory_bytes: 7212
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>

using namespace std;
using ll = long long;
using ull = unsigned long long;

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

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


int main(){
    int n, a[1000];
    
    cin >> n;
    REP(i, n){
        cin >> a[i];
    }
    
    for(int i = 0; i < n - 1; i++){
        for(int j = i + 1; j < n; j++){
            if((max(a[i], a[j]) - min(a[i], a[j])) % (n - 1) == 0){
                cout << max(a[i], a[j]) << ' ' << min(a[i], a[j]) << endl;
                return 0;
            }
        }
    }
}



Measured memory_bytes: 3096
#include <iostream>
#include <string>
#include <stdio.h>
#include <algorithm>
#include <vector>

using namespace std;

int main()
{
	string s;
	cin >> s;
	string sub = s.substr(0, 4);
	if (sub == "YAKI") {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
    return 0;
}


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

int main()
{
    int n;
    cin >> n;
    
    int ans;
    bool ex = false;

    for(int i = 1; i <= n; i++){
        if((int)(i * 1.08) == n){
            ans = i;
            ex = true;
            break;
        }
    }
    if (ex)
        cout << ans << endl;
    else
        cout << ":(" << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		long x = scan.nextLong();
		long a = 100;
		int count = 0;
		boolean b = true;
		
		while(b) {
			a += a / 100;
			count++;
			if(a >= x) {
				b = false;
			}
		}
		System.out.println(count);

	}

}


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

int main() {
	
	for(;;){
	int m,f,r;
	cin >> m >> f >> r;
	
	if(m==-1 && f==-1 && r==-1){break;}
	
	if(m==-1 || f==-1 || m+f<30){cout<< "F" <<endl;}
	else if(m+f>=80){cout << "A" <<endl;}
	else if(m+f>=65 && m+f<80){cout << "B" <<endl;}
	else if((m+f>=50 && m+f<65)||r>=50){cout << "C" << endl;}
	else{cout << "D" <<endl;}
	
	}
	

	return 0;
}

Measured memory_bytes: 1152
#include<stdio.h>

	int main(){
	
		int i,j,n,x=100000,y[3]={},z;
		
		scanf("%d",&n);
	
		for(i=0;i<n;i++){
			x=x+x*5/100;
		
		z=x;
		
		for(j=0;j<3;j++){
			y[j]=z%10;
			z=z/10;
		}
	
		if(y[0]==0 && y[1]==0 && y[2]==0){
			x=x;
		}
		else if(y[0]+y[1]*10+y[2]*100 < 1000 && y[0]+y[1]+y[2]!=0){
			x=x/1000;
			x=x*1000+1000;
		}
		}
		
		printf("%d\n",x);
	
	return 0;
}

Measured memory_bytes: 592
#include <iostream>
#include<math.h>
#include<algorithm>
using namespace std;
int main()
{
	int k;//no of stones painted black
	int x;//painted black
	cin >> k;
	cin >> x;
	for (int j = x - (k - 1); j <= x + (k - 1); j++)
	{
		cout << j<<" ";
	}



}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <numeric>

using namespace std;

int main(){
    int n;
    cin>>n;
    vector<int> a(n);
    vector<int> cnt(n);
    for(int i=0;i<n;i++){
        cin>>a[i];
        cnt[a[i]]++;
    }
    long long mod=1000000007;
    for(int i=0;i<n;i++){
        if(n%2!=i%2){
            if(i==0){
                if(cnt[0]!=1){
                    cout<<0<<endl;
                    return 0;
                }
                else continue;
            }
            if(cnt[i]!=2){
                cout<<0<<endl;
                return 0;
            }
        }
        else {
            if(cnt[i]!=0){
                cout<<0<<endl;
                return 0;
            }
        }
    }
    long long ans=1;
    int t=n/2;
    while(t>0){
        ans*=2;
        ans%=mod;
        t--;
    }
    cout<<ans<<endl;

}

   


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

#define         pb         push_back
#define         sf(x)      scanf("%d",&x)
#define         sfl(x)     scanf("%lld",&x)
#define         pf(x)      printf("%d\n",x)
#define         pfl(x)     printf("%lld\n",x)
#define         endl       '\n'
#define         pii        pair<int,int>
#define         mapii      map<int,int>
#define         mapll      map<ll,ll>
#define         mapci      map<char,int>
#define         mapcl      map<char,ll>
#define         mapsi      map<string,int>
#define         mapsl      map<string,ll>
#define         pll        pair<ll,ll>
#define         vi         vector<int>
#define         vl         vector<ll>
#define         vd         vector<double,double>
#define         all(c)     c.begin(),c.end()
#define         F          first
#define         S          second
#define         mp         make_pair
#define        ftc(x)      cerr << #x << ": " << x << " " << endl;
#define         PI         acos(-1)
#define         lcm(a,b)   ((a*b)/__gcd(a,b))
#define        optimize    ios_base::sync_with_stdio(false);cin.tie(NULL);
#define        sqr(a)       ((a)*(a))

int main()
{
ll i,j,k,l,m,n;

cin >> n;


string s;

double mm,ans=0.0;

for(i=0;i<n;i++)
{
    cin >> mm >>s;

    if(s == "BTC")
    {
        ans += (mm*380000.0);
    }
    else ans += mm;
}

cout << std::setprecision(10) << ans << endl;

}


Measured memory_bytes: 3792
n,k=map(int,input().split())
cnt=[0]*(n+1) #i人目の人が所持しているお菓子の数を数える
for _ in range(k): #それぞれのお菓子について、そのお菓子を買った人のお菓子の所持数を1増やす
 tmp=int(input())
 arr=list(map(int,input().split()))
 for val in arr:
   cnt[val]+=1
ans=0
for i in range(1,n+1):
 if cnt[i]==0: #すべてのお菓子を見終えたあと、1つもお菓子を持っていない人の数が答え
   ans+=1
print(ans)

Measured memory_bytes: 9112
#include <iostream>
#include <stdio.h>
#include <string>
using namespace std;

int main(){
    int n, m;
    cin >> n >> m;
    int a[n][m];
    int b[m];
    int e;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            cin >> a[i][j];
        }
    }
    for (int i = 0; i < m; i++) {
        cin >> b[i];
    }
    int answer;
    for (int i = 0; i < n; i++) {
        answer = 0;
        for (int j = 0; j < m; j++) {
            answer += a[i][j] * b[j];
        }
        cout << answer << endl;
    }
    return 0;
}

Measured memory_bytes: 3112
def digitsums(N):
    digsum = 0
    for i in range(len(str(N))):
        digsum = digsum + int(N % 10)
        N = N / 10
    return digsum
N = int(input())
digsum = digitsums(N)
out = 'Yes' if N % digsum == 0  else 'No'
print(out)

Measured memory_bytes: 2940
#include<iostream>
#include<string>
#include<sstream>
#include<algorithm>
#include<cmath>
#include<map>
#include<set>
#include<vector>
#include<stack>
#include<queue>
#include<deque>
using namespace std;

int main() {

    int n;

    while(true) {
        cin >> n;
        if(n == 0)  break;

        string result;
        map<char, char> convert;

        for(int i = 0; i < n; i++) {
            char a, b;
            cin >> a >> b;
            convert[a] = b;
        }

        cin >> n;

        for(int i = 0; i < n; i++) {
            char c;
            cin >> c;
            if (convert.find(c) != convert.end()) {
                cout << convert[c];
            } else {
                cout << c;
            }
        }
        cout << endl;
         
    }
    return 0;

}

Measured memory_bytes: 900
a, b = (int(_) for _ in input().split())


def xor(n):
    m = 0
    if (n % 4 == 0):
        m = n
    elif (n % 4 == 1):
        m = 1
    elif (n % 4 == 2):
        m = n + 1
    return (m)


A = xor(a - 1)
B = xor(b)
print(A ^ B)


Measured memory_bytes: 3060
//----------------------------------------------------------------------
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
//----------------------------------------------------------------------

using namespace std;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;

int main(void) {
    int n, k;
    cin >> n >> k;
    vector<ll> a(n);
    rep(i, n)
        cin >> a[i];

    ll ans = 1e18;
    for(int bit = 0; bit < (1 << n); ++bit) {
        vector<ll> tmpa(a);
        vector<int> seebull = {0};
        for(int i = 1; i < n; ++i) {
            if(bit & ( 1 << i)) {
                seebull.push_back(i);
            }
        }
        if((int)seebull.size() != k) continue;

        ll sum = 0;
        for(int i = 0; i < k; ++i) {
            int tmpbull = seebull[i];
            ll maxheight = 0;
            for(int j = 0; j < tmpbull; ++j) {
                maxheight = max(maxheight, tmpa[j]);
            }
            ll add = 0;
            if(maxheight >= tmpa[tmpbull]) {
                add = maxheight - tmpa[tmpbull] + 1;
                tmpa[tmpbull]  += add;
            }
            sum += add;
        }
        ans = min(sum, ans);
    }
    cout << ans << endl;
    return 0;
}


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

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

	if( n%10 == 9 ){
		cout << "Yes" << endl;
	} else if( n >= 90){
		cout << "Yes" << endl;
	} else{
		cout << "No" << endl;
	}
	return 0;
}

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

using namespace std;
using ll =long long;
typedef pair<int,int> P;
#define SORT(a) sort((a).begin(),(a).end())
#define REV(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define debug(x)  cerr << #x << " = " << (x) << endl;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

void coY() {cout <<"Yes"<<endl;}
void coN(){cout <<"No"<<endl;}
 
//Write From this Line

//const ll mod = 1e9+7;
//const ll mod = 998244353;
int main()
{
	int n;
	cin >> n;
	map<int, int> ans;

	For(x,1,100) For(y,1,100) For(z,1,100) {
		ll tmp = 0;
		tmp += x * x;
		tmp += y * y;
		tmp += z * z;
		tmp += x * y;
		tmp += y * z;
		tmp += z * x;
		ans[tmp]++;
	}
	For(i,1,n+1){
		cout << ans[i] << endl;
	}
}


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

using namespace std;

void one()
{
	cout << 1;
	exit(0);
}

void zero()
{
	cout << 0;
	exit(0);
}

main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	
	int m1, d1;
	cin >> m1 >> d1;
	
	if(d1 == 28 && m1 == 2)
		one();
	
	if(d1 == 30)
	{
		if(m1 == 4 || m1 == 6 || m1 == 9 || m1 == 11)
			one();
		
		zero();
	}
	
	if(d1 == 31)
	{
		if(m1 == 1 || m1 == 3 || m1 == 5 || m1 == 7 || m1 == 8 || m1 == 10 || m1 == 12)
			one();
	}
	
	zero();
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cmath>
#define poi 1000
using namespace std;
inline int re()
{
	char c=getchar();
	int x=0,k=1;
	while(c<'0'||c>'9')
	{if(c=='-') k=-1;c=getchar();}
	while(c>='0'&&c<='9')
	{x=(x<<1)+(x<<3)+c-'0';c=getchar();}
	return x*k;
}
void wr(int x)
{
	if(x<0) putchar('-'),x=-x;
	if(x>9) wr(x/10);
	putchar(x%10+'0');
}
signed main()
{
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	cout<<(a-c)*(b-d);
	return 0;
}
/*

*/

Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
using namespace std;
typedef long long ll;
int main(){
  ll N,M;
  cin >> N >> M;
  ll ans = 0;
  if(2 * N < M)cout << N + (M - 2 * N)/4 << endl;
  else cout << M/2 << endl;
}


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

int main()
{
 char w[10],t[1000];
 int i,s=0;
 scanf("%s",w);

 for(i=0;w[i]!='\0';i++){
                         w[i]=tolower(w[i]);
                         }

 for(;;){
          scanf("%s",t);
          if(strcmp(t,"END_OF_TEXT")==0)break;
          for(i=0;t[i]!='\0';i++){
                                  t[i]=tolower(t[i]);
                                  }
          if(strcmp(w,t)==0)s++;
         }                        
 printf("%d\n",s);
 return 0;
}



Measured memory_bytes: 2044
x1, y1, x2, y2 = map(int, input().split())

dx = x2 - x1
dy = y2 - y1

nx = x2
ny = y2

l = []

for i in range(2):
    dx, dy = -dy, dx

    nx = nx + dx
    ny = ny + dy

    l.append(nx)
    l.append(ny)

print(l[0], l[1], l[2], l[3])


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

int main(){
    double W, H, x, y;
    cin >> W >> H >> x >> y;
    double S = W * H / 2;
    double medW = W / 2;
    double medH = H / 2;
    cout << S << endl;
    if(medW == x && medH == y){
        cout << 1 << endl;
    }else{
        cout << 0 << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
int main(void){char str[2048];int i=0;do{scanf("%c",&str[i]);}while(str[i++]!='\n');str[i-1]=0;i=-1;while(str[++i]!=0){str[i]^=(((0x61<=str[i])&&(str[i]<=0x7a))||((0x41<=str[i])&&(str[i]<=0x5a)))?0x20:0;}printf("%s\n",str);return(0);}


Measured memory_bytes: 2560
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <random>
#include <queue>
#include <sstream>
#include <iomanip>

using namespace std;

using Graph = vector<vector<int> >;

vector<int> seen;

class CT
{
public:
	pair<int, int> py;
	int index;

	bool operator<(CT other) {
		return py < other.py;
	}
};

int main()
{
	int N, M;

	cin >> N >> M;

	vector<CT> Cs(M);

	int p,y;
	CT ct;
	for (int mi = 0; mi < M; mi++) {
		cin >> p >> y ;
		ct.py = make_pair(p, y);
		ct.index = mi;
		Cs[mi] = ct;
	}

	sort(Cs.begin(), Cs.end());

	vector<string> As(M);

	int pi = 1;
	for (int mi = 0; mi < M; mi++) {
		if (mi == 0 || Cs[mi].py.first != Cs[mi - 1].py.first) {
			pi = 1;
		}
		ostringstream os;
		os << setw(6) << setfill('0') << Cs[mi].py.first << setw(6) << setfill('0') << pi << endl;
		As[Cs[mi].index] = string(os.str());
		pi++;
	}

	for (int mi = 0; mi < M; mi++) {
		cout << As[mi];
	}

	//printf("%d %d %lld", xi, yi, H + gap);

	//cout << ans;
	

	return 0;
}



Measured memory_bytes: 8192
# input
N, K = map(int, input().split())
A = [0]
A.extend(list(map(int, input().split())))

# process
l = [0]*(N+1)
now = 1
i = 1
while l[now] == 0:
    l[now] = i
    now = A[now]
    i += 1

ans = 0
if K < l[now]:
    ans = l.index(K+1)
else:
    k = (K-l[now]+1)%(len([x for x in l if x!=0])-l[now]+1)
    ans = l.index(l[now]+k)

# output
print(ans)


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

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

int main() {
	long long n, k;
	cin >> n >> k;
	long long a[n];
	long long m = 0;
	for (int i = 0;i < n;i++) {
		cin >> a[i];
		m = max(m, a[i]);
	}
	if (m < k) {
		cout << "IMPOSSIBLE" << endl;
		return 0;
	}
	long long d = a[0];
	for (int i = 1;i < n;i++) {
		d = GCD(a[i], d);
	}
	if (k%d == 0) {
		cout << "POSSIBLE" << endl;
	}
	else cout << "IMPOSSIBLE" << endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <math.h>
#include <string>
#include <algorithm>
#include <ctype.h>
#include <vector>
using namespace std;

#define ll long long int
#define rep(i, a, n) for (int i = a; i < n; i++)
#define INF 1e9
#define LINF 1e17
#define MOD (int)(1e9 + 7)
#define pi 3.141592653589
#define pii pair<int, int>

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

int main()
{
    vector<int> a(3);
    int k;

    cin >> a[0] >> a[1] >> a[2] >> k;
    sort(a.begin(), a.end());
    rep(i, 0, k)
    {
        a[2] *= 2;
    }
    cout << a[0] + a[1] + a[2] << endl;
}


Measured memory_bytes: 256