akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Linq;

namespace J
{
    class Program
    {
        static void Main(string[] args)
        {
            long[] x = Console.ReadLine().Split().Select(long.Parse).ToArray();
            if (Math.Min(x[0], x[1]) == 1)
            {
                long a = Math.Max(x[2], x[3]);
                Console.WriteLine(a == 1 || a == Math.Max(x[0], x[1]) ? "Yes" : "No");
            }
            else
            {
                if (x[0] % 2 == 1 && x[1] % 2 == 1)
                {
                    Console.WriteLine(x[2] % 2 == x[3] % 2 ? "Yes" : "No");
                }
                else Console.WriteLine("Yes");
            }
        }
    }
}


Measured memory_bytes: 18432
#include <bits/stdc++.h>
#define SIZE 300005
#define MOD 1000000007LL
#define EPS 1e-10
#define INF 1<<29
#define LLINF 1LL<<60
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define DOWN(i,b,a) for(int i=b;i>=a;i--)
#define SET(a,c) memset(a,c,sizeof a)
#define BIT(i,j) ((i)>>(j))&1
#define ALL(o) (o).begin(), (o).end()
#define ERASE(o) (o).erase(unique((o).begin(),(o).end()), (o).end())
#define SQ(x) ((x)*(x))
using namespace std;
typedef long long ll;
typedef pair<ll,ll> Pll;
typedef pair<int, int> Pii;
typedef pair<double, double> Pdd;
typedef complex<double> dcomplex;
template<typename T> inline void priv(vector<T>a){REP(i,a.size()){cerr<<a[i]<<((i==a.size()-1)?"\n":" ");}}
ll gcd(ll a,ll b){int c=max(a,b);int d=min(a,b);return c==0||d==0?c:gcd(c%d,d);}
ll lcm(ll a,ll b){return a==0||b==0?0:a*b/gcd(a,b);}
ll modpow(ll a, ll n){ll b=1;while (n>0){if(n&1)b=b*a%MOD;a=a*a%MOD;n>>=1;}return b;}

ll N;
ll fact[100010];
ll ifact[100010];

ll modcomb(ll n, ll k){
    if(k < 0 || k > n) return 0;
    ll ans = fact[n];
    ans = ans * ifact[k] % MOD;
    ans = ans * ifact[n-k] % MOD;
    return ans;
}

int main() {
    scanf("%llu", &N);
    vector<ll> cnt(N+1, -1);
    ll a, d1, d2;
    REP(i, N) {
        scanf("%llu", &a);
        if(cnt[a] != -1) {
            d1 = min(cnt[a], ll(i));
            d2 = max(cnt[a], ll(i));
            break;
        }
        cnt[a] = i;
    }
    fact[0] = 1;
    ifact[0] = 1;
    FOR(i, 1, N+2) {
        fact[i] = fact[i-1] * i % MOD;
        ifact[i] = modpow(fact[i], MOD-2);
    }
    ll ans;
    printf("%lld\n", N);
    FOR(k, 2, N) {
        ans = modcomb(N+1, k);
        // ans = modcomb(N-1, k) % MOD;
        // ans = (ans + 2 * modcomb(N-1, k-1)) % MOD;        
        ans = (ans - modcomb(N-(d2-d1), k-1) + MOD) % MOD;
        // ans = (ans + modcomb(N-1, k-2)) % MOD;
        printf("%llu\n", ans);
    }
    printf("1\n");
 	return 0;
}


Measured memory_bytes: 3584
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector> 
using namespace std;
const int INF = 10000007;
int ans[402][402];
int n, ma, mb;
int a[42],b[42],c[42];
int main()
{
    for(int i=0;i<=400;i++)for(int j=0;j<=400;j++)ans[i][j] = INF;
    ans[0][0] = 0;
    cin >> n >> ma >> mb;
    for(int i=1;i<=n;i++)
    {
        cin >> a[i] >> b[i] >> c[i];
    }
    for(int i=1;i<=n;i++)
    {
        for(int j=400;j>=a[i];j--)
        {
            for(int k=400;k>=b[i];k--)
            {
                ans[j][k] = min(ans[j][k], ans[j-a[i]][k-b[i]] + c[i]);
            }
        }
    }
    int res = INF;
    int A = ma, B = mb;
    while(A<=400&&B<=400)
    {
        res = min(res, ans[A][B]);
        A += ma; B += mb;
    }
    if(res == INF) cout << -1 << endl;
    else cout << res << endl;
}

Measured memory_bytes: 896
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 c = sc.nextInt();

      int ba = b-a;
      int cb = c-b;
        if(ba == cb){
          System.out.println("YES");
        }else{
          System.out.println("NO");
        }
    }
}

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

using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
	REP(i, v.size()) { if (i)os << " "; os << v[i]; }return os;
}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
	REP(i, v.size()) { if (i)os << endl; os << v[i]; }return os;
}

int main() {
	ll a, b;

	cin >> a >> b;

	if (a % 3 == 0 || b % 3 == 0 || (a + b) % 3 == 0) {
		cout << "Possible" << endl;
	}
	else {
		cout << "Impossible" << endl;
	}
}

Measured memory_bytes: 256
S = str(input())
max = 0
for i in range(len(S)):
    k = 0
    if not(S[i] in {'A','T','G','C'}):
        continue
    k = 1
    for j in range(i+1,len(S)):
       if S[j] in {'A','T','G','C'}:
           k+=1
       else:
           break

    if k > max:
        max = k

print(max)

Measured memory_bytes: 3188
using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using static System.Math;
using Debug = System.Diagnostics.Debug;

static class P
{
    static void Main()
    {
        var nk = Console.ReadLine().Split().Select(long.Parse).ToArray();
        var n = (int)nk[0];
        var k = nk[1];
        var a = Console.ReadLine().Split().Select(int.Parse).ToArray();
        //偶奇で循環しそう←ごどく
        //まあどこかで循環しそうで
        //順関節割り出してシミュレーション?
        //多分グループに分けられて、
        //範囲が消えるから後ろがつながるみたいなそういうこと?
        //消えるところまで移動→その次 で配列の先頭が求められる
        int[] hop = new int[a.Length + 1];
        int[] next = new int[a.Length + 1];
        {
            hop[n] = n;
            List<int>[] shouldCameHere = Enumerable.Repeat(0, a.Length + 1).Select(_ => new List<int>()).ToArray();
            shouldCameHere[0].Add(a.Length);
            int[] beforeInd = Enumerable.Repeat(-1, 200001).ToArray();
            for (int i = 0; i < a.Length; i++)
            {
                if (beforeInd[a[i]] != -1)
                {
                    hop[beforeInd[a[i]]] = i;

                    shouldCameHere[i + 1] = shouldCameHere[beforeInd[a[i]]];
                    shouldCameHere[beforeInd[a[i]]] = new List<int>();
                }
                shouldCameHere[i + 1].Add(i);
                beforeInd[a[i]] = i;
            }
            for (int i = 0; i < a.Length; i++)
            {
                if (beforeInd[a[i]] != -1)
                {
                    hop[beforeInd[a[i]]] = i;
                }
                beforeInd[a[i]] = -1;
            }
            for (int i = 0; i < shouldCameHere.Length; i++)
            {
                for (int j = 0; j < shouldCameHere[i].Count; j++)
                {
                    next[shouldCameHere[i][j]] = i;
                }
            }
        }
        var cycle = GetCycleCount(n, hop, next);
        Console.WriteLine(string.Join(" ", Solve(n, (int)(k % cycle), hop, next, a)));

    }

    static IEnumerable<int> Solve(int n, int k, int[] hop, int[] next, int[] a)
    {
        int ptr = n;
        for (int iterate = 0; iterate < k; iterate++)
        {
            ptr = next[hop[ptr]];
        }
        var stack = new Stack<int>();
        Simulation(a.Skip(ptr).ToArray(), stack);
        return stack.Reverse();
    }

    static int GetCycleCount(int n, int[] hop, int[] next)
    {
        int ptr = n;
        int count = 0;
        do
        {
            ptr = next[hop[ptr]];
            count++;
        } while (ptr != n);
        return count;
    }

    static void Simulation(int[] a, Stack<int> state)
    {
        HashSet<int> has = new HashSet<int>(state);
        int ptr = 0;
        for (int i = 0; i < a.Length; i++)
        {
            if (has.Contains(a[i]))
            {
                while (has.Contains(a[i]))
                {
                    has.Remove(state.Pop());
                }
                continue;
            }
            state.Push(a[i]);
            has.Add(a[i]);
        }
    }
}


Measured memory_bytes: 59508
/* When Talent doesn't work, Hard work beats Talent*/

#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")

#include"bits/stdc++.h"

using namespace std;

#define Fast_D cout<<fixed<<setprecision(13);
#define FastIO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

#define nl "\n"
#define int long long
#define double long double
#define all(v) v.begin(),v.end()
#define scanstr(s) cin>>ws; getline(cin,s);

const double PI = 3.141592653589793;

void solve()
{
	int W,H,N;
	cin >> W >> H >> N ;
	int x1=0,x2=W,y1=0,y2=H;
	while(N--)
	{
		int x,y,a;
		cin >> x >> y >> a;
		if(a==1)
		{
			x1 = max(x1,x);
		}
		if(a==2)
		{
			x2 = min(x2,x);
		}
		if(a==3)
		{
			y1 = max(y1,y);
		}
		if(a==4)
		{
			y2 = min(y2,y);
		}
	}
	int wi = max(0LL,x2-x1);
	int hi = max(0LL,y2-y1);
	cout << wi * hi ;
}

int32_t main()
{
	FastIO;
	Fast_D;
	solve();
	return 0;
}


Measured memory_bytes: 3676
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<bitset>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define ARDEB(i,X) cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define ARDEB(i,X) {}
#define END {}
#endif
typedef long long int ll;
typedef pair<int,int> P;
struct edge{int to,cost;};
#define REP(i,n) for(int i=0;i<(n);i++)
#define Endl endl
const int INF=100000000;

int main(){
	string s,t;
	cin>>s>>t;
	reverse(t.begin(),t.end());
	cout<<((s==t)?"YES":"NO")<<endl;
	return 0;
}

Measured memory_bytes: 764
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Diagnostics;

class Myon
{
    public Myon() { }
    public static int Main()
    {
        new Myon().calc();
        return 0;
    }

    Scanner cin;
    Func cin2;
    void calc()
    {
        cin = new Scanner();
        cin2 = new Func();
        int N=cin.nextInt();
        long mod = 1000000007;
        long ans = 1;
        for(int i=1;i<=N;i++)
        {
          ans*=i;
          ans%=mod;
        }
        Console.WriteLine(ans);
    }
}



class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}

class Answer
{
    public void Int2DArrayAns(int[,]x,char c)
    {
        for(int i=0;i<x.GetLength(0);i++)
        {
            for(int j=0;j<x.GetLength(1)-1;j++)
            {
                Console.Write(x[i,j]);
                Console.Write(c);
            }
            Console.WriteLine(x[i,x.GetLength(1)-1]);
        }
    }
    public void Char2DArrayAns(char[,]x,char c)
    {
        for(int i=0;i<x.GetLength(0);i++)
        {
            for(int j=0;j<x.GetLength(1)-1;j++)
            {
                Console.Write(x[i,j]);
                Console.Write(c);
            }
            Console.WriteLine(x[i,x.GetLength(1)-1]);
        }
    }
}

class Func
{
    public long GCDLong(long a, long b)
    {
        while(a!=0)
        {
          long t=a;
          a=b%a;
          b= t;
        }
      
        return b;        
    }
}

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

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

    int len = s.length();
    char left = s[0];
    vector<char> s_kai;

    for(int i = 1; i < len; i++){
        if(i == len - 1){
            if(s[i] == left){
                s_kai.push_back(left);
            }else{
                s_kai.push_back(left);
                s_kai.push_back(s[i]);
            }
        }else if(s[i] != left){
            s_kai.push_back(left);
            left = s[i];
        }
    }

    len = s_kai.size();
    if(len == 0){
        cout << 0 << endl;
    }else{
        cout << len - 1 << endl;
    }

}

Measured memory_bytes: 1148
function main()
  
  N = parse(Int, readline())
  S = map(x -> x == "E" ? 1 : 0, split(chomp(readline()), ""))
  
  sum_S = sum(S)
  check = 0
  ans = 10^10
  
  for i in N:-1:1
    
    sum_S -= S[i]
    if i + 1 <= N
      check += S[i+1]
    end
    ans = min(ans, (i-1-sum_S) + check)

  end
  
  println(ans)
 
end

main()

Measured memory_bytes: 153476
a = gets.chomp.to_i
c = []
while s = gets
  c.push(s.chomp)
end
#p c[0][0]
m = c.count{|i| i[0] =="M"}
a = c.count{|i| i[0] =="A"}
r = c.count{|i| i[0] =="R"}
cc = c.count{|i| i[0] =="C"}
h = c.count{|i| i[0] =="H"}
puts m*a*r     +m*a*cc     +m*a*h     +m*r*cc     +m*r*h     +m*cc*h     +a*r*cc     +a*r*h     +a*cc*h     +r*cc*h

Measured memory_bytes: 9852
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        switch (n%10){
            case 3:
                System.out.println("bon");
                break;
            case 0:
            case 1:
            case 6:
            case 8:
                System.out.println("pon");
                break;
            default:
                System.out.println("hon");
        }
    }
}

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

typedef long long ll;

int main(){

	int a[3];

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

	sort(a, a + 3);

	int s = 0;
	for(int i = 1; i < 3; i++){
		s += a[i] - a[i-1];
	}
	
	cout << s;

	return 0;
}

Measured memory_bytes: 256
a,b,c,k=map(int,input().split())
ct=k
result = 0
if a>0:
  if ct>a:
    result=1*a
  elif a>=ct:
    result=1*ct
  ct=k-a
if ct>0 and b>0:
  ct=ct-b
if ct>0 and c>0:
  result=result+(-1*ct)
print(result)

Measured memory_bytes: 9008
n, x = map(int, input().split(" "))
count = 0
min_d = 1000

for i in range(n):
  d = int(input())
  x -= d
  count += 1
  if min_d > d:
    min_d = d

while x > 0:
  x -= min_d
  if x < 0:
    break
  count += 1

print(count)

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

int main() {
  int64_t n;
  std::cin >> n;
  std::vector<int64_t> a(n + 2);
  a[0] = a[n + 1] = 0;
  for (int64_t i = 1; i <= n; i++) {
    std::cin >> a[i];
  }
  int64_t sum = 0;
  for (int64_t i = 1; i <= n + 1; i++) {
    sum += std::abs(a[i] - a[i - 1]);
  }

  for (int64_t i = 1; i <= n; i++) {
    const auto diff = std::abs(a[i - 1] - a[i + 1]) - (
      std::abs(a[i - 1] - a[i]) + std::abs(a[i + 1] - a[i]));
    std::cout << sum + diff << std::endl;
  }
  return 0;
}


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

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

def main():
    #n = int(stdin.readline().rstrip())
    h1,m1,h2,m2,k = map(int, stdin.readline().rstrip().split())
    #l = list(map(int, stdin.readline().rstrip().split()))
    #numbers = [[int(c) for c in l.strip().split()] for l in sys.stdin]
    #word = [stdin.readline().rstrip() for _ in range(n)]
    #number = [[int(c) for c in stdin.readline().rstrip()] for _ in range(n)]
    #zeros = [[0] * w for i in range(h)]
    wake = (h2-h1)*60 + m2-m1
    ans = wake - k
    print(ans)

main()


Measured memory_bytes: 9184
#include<iostream>
#include<algorithm>
#include<cmath>
#include<map>
#include<functional>
using namespace std;
#define maxn long long(5*1e8)

int main(){
	long long n=0;
	scanf("%d",&n);	
	map<long long,long long,greater<long long>> num;
	for(long long i=1;i<=n;++i){
		long long temp=0;
		scanf("%d",&temp);
		num[temp]++;
	}
	long long j=pow(2.0,31),ans=0;
	for(auto iter=num.begin();iter!=num.end();++iter){
		while(iter->first<j/2) j/=2;
		if(num[iter->first]>0&&num[j-iter->first]>0){
				if(j==iter->first*2){
					ans+=num[iter->first]/2;
					num[iter->first]=num[iter->first]%2;
				}
				else{
				ans+=min(num[iter->first],num[j-iter->first]);
				num[j-iter->first]-=min(num[iter->first],num[j-iter->first]);
				}
			}
	}
	cout<<ans<<endl;
}
//5 1 2 2 2 3


Measured memory_bytes: 28188
#include<bits/stdc++.h>
using namespace std;
int main(){
    char S[4];
    for(int i = 0; i < 4; i++){
        cin >> S[i];
    }
    bool ans = true;
    for(int i = 0; i < 3; i++){
        if(S[i] == S[i + 1]){
            ans = false;
        }
    }
    if(ans){
        cout << "Good" << endl;
    }
    else{
        cout << "Bad" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0;i < (n);i++)
using namespace std;
  
int main () {
  char b;
  cin >> b;
  if(b == 'A')
    cout << 'T';
  else if(b == 'T')
    cout << 'A';
  else if(b == 'C')
    cout << 'G';
  else if(b == 'G')
    cout << 'C';
}


Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))
# 山1に降った量の半分をxと置くと、山2はA1-x、山3はA2-(A1-x)となり、翻って山1はA3-(A2-(A1-x))
# x = A3-A2+A1+x
# x = (A1+A3-A2) // 2
x = (sum(A[::2]) - sum(A[1::2])) // 2
ans = [x*2]
for i in range(N-1):
    a = A[i] - x
    ans.append(a*2)
    x = a
print(*ans)

Measured memory_bytes: 69860
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); ++i)
using namespace std;
using ll=long long;
int main(){
    string s;
    cin>>s;
    int a=s[0]-'0';
    int b=s[1]-'0';
    int c=s[2]-'0';
    int d=s[3]-'0';
    if(a+b+c+d==7){
        cout<<a<<"+"<<b<<"+"<<c<<"+"<<d<<"=7"<<endl;
              return 0;
    }
    if(a+b+c-d==7){
        cout<<a<<"+"<<b<<"+"<<c<<"-"<<d<<"=7"<<endl;
              return 0;
    }
    if(a+b-c+d==7){
        cout<<a<<"+"<<b<<"-"<<c<<"+"<<d<<"=7"<<endl;
              return 0;
    }
    if(a+b-c-d==7){
        cout<<a<<"+"<<b<<"-"<<c<<"-"<<d<<"=7"<<endl;
              return 0;
    }
    if(a-b-c-d==7){
        cout<<a<<"-"<<b<<"-"<<c<<"-"<<d<<"=7"<<endl;
              return 0;
    }
    if(a-b-c+d==7){
        cout<<a<<"-"<<b<<"-"<<c<<"+"<<d<<"=7"<<endl;
              return 0;
    }
    if(a-b+c-d==7){
        cout<<a<<"-"<<b<<"+"<<c<<"-"<<d<<"=7"<<endl;
              return 0;
    }
    if(a-b+c+d==7){
        cout<<a<<"-"<<b<<"+"<<c<<"+"<<d<<"=7"<<endl;
              return 0;
    }
}

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

using namespace std;

#define FOR(i, j, k, in) for (int i=j ; i<k ; i+=in)
#define RFOR(i, j, k, in) for (int i=j ; i>=k ; i-=in)
#define REP(i, j) FOR(i, 0, j, 1)
#define FOREACH(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define MP make_pair
#define PB push_back
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
const double pi=acos(-1.0);
typedef pair<int, int> PII;
typedef long int int32;
typedef unsigned long int uint32;
typedef long long int int64;
typedef unsigned long long int  uint64;

#define int long long
#define trace(x) cerr << #x << ": " << x << " " << endl;


inline int add(int a, int b){a += b; if(a >= MOD)a -= MOD; return a;}
inline int sub(int a, int b){a -= b; if(a < 0)a += MOD; return a;}
inline int mul(int a, int b){return (int)((int) a * b %MOD);}


#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

signed main()
{
    IOS
    int c = 1^2^3;
    int a, b;
    cin >> a >> b;
    cout << ((c^a)^b);
    
}

Measured memory_bytes: 256
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")
 
#include <iostream>
#include <stdlib.h>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <assert.h>
#include <memory.h>
#include <time.h>
#include <bitset>
#include<iomanip>
 
#define uint unsigned int
#define ll long long
#define ull unsigned long long
#define ld long double
#define rep(i, l, r) for (int i = (l); i < (r); i++)
#define repb(i, r, l) for (int i = (r); i > (l); i--)
#define sz(a) (int)a.size()
#define fi first
#define se second
#define pii pair<int,int>
#define pli pair<ll,int>
#define pll pair<ll,ll>
#define mp(a, b) make_pair(a, b)
#define mt(a,b,c) make_tuple(a,b,c)
#define rank qwertyuio
#define next dfghjk
#define plus fsghsf
#define minus ytryr
#define pb push_back
using namespace std;
 
inline bool setmin(int &x, int y) { return (y < x) ? x = y, 1 : 0; }
inline bool setmax(int &x, int y) { return (y > x) ? x = y, 1 : 0; }
inline bool setmin(ll &x, ll y) { return (y < x) ? x = y, 1 : 0; }
inline bool setmax(ll &x, ll y) { return (y > x) ? x = y, 1 : 0; }
 
const int N = 100000;
const int inf = (int)1e9 + 1;
const ll big = (ll)1e18 + 1;
const int P = 239;
const int P1 = 31;
const int P2 = 57;
const int mod = (int)1e9 + 7;
const int mod1 = (int)1e9 + 9;
const int mod2 = 998244353;
const int mod3 = (int)1e6+3;
const ld eps = 1e-12;
const double pi = atan2(0, -1);
const int ABC = 26;

int main()
{
    //freopen("a.in", "r", stdin);
    //freopen("a.out", "w", stdout);<<" "
    int n;
    cin>>n;
    string a,b;
    cin>>a>>b;
    string w;
    int i;
    for(i=0;i<n;i++){
        w.pb(a[i]);
        w.pb(b[i]);
    }
    cout<<w;
    return 0;
             
    
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
  val len = Integer.parseInt(readLine() ?: "0")
  val str = readLine() ?: ""
  val pos = Integer.parseInt(readLine() ?: "0")
  var ans = ""
  for(i in 0..len - 1) {
    if(str[i] == str[pos-1]) {
      ans += str[i]
    } else {
      ans += "*"
    }
  }
  println(ans)
}


Measured memory_bytes: 33748
using System;

class Program
{
    static void Main(string[] args)
    {
        string w = Console.ReadLine();

        bool beautifil = true;
        while (w != "")
        {
            string temp = "";
            char c = w[0];
            int count = 1;
            for (int i = 1; i < w.Length; i++)
            {
                if (c == w[i]) count++;
                else temp += w[i];
            }
            if(count % 2 == 1)
            {
                beautifil = false;
                break;
            }            
            w = temp;
        }

        if (beautifil) Console.WriteLine("Yes");
        else Console.WriteLine("No");
    }
}

Measured memory_bytes: 2776
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef  long long int ll;
typedef long double db;
#define pb push_back
#define mp make_pair
#define ub(v,val) upper_bound(v.begin(),v.end(),val)
#define np(str) next_permutation(str.begin(),str.end())
#define lb(v,val) lower_bound(v.begin(),v.end(),val)
#define sortv(vec) sort(vec.begin(),vec.end())
#define rev(p) reverse(p.begin(),p.end());
#define v vector
#define PI 3.1415926535
#define len length()
#define repc(i,s,e) for(ll i=s;i<e;i++)
#define fi first
#define se second
#define mset(a,val) memset(a,val,sizeof(a));
#define mt make_tuple
#define repr(i,n) for( i=n-1;i>=0;i--)
#define rep(i,n) for( i=0;i<n;i++)
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
const ll M = 1e9 + 7;
ll inf = 1e16;

ll n, m;
//GCD
ll gcd (ll a, ll b) {
	if (b == 0)
		return a;
	else
		return gcd (b, a % b);
}

int main() {
	// your code goes here
	IOS;

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	ll i, j, t, k, x, y, z, N;
	cin >> n;
	N = 1e6 + 1;
	ll spf[N];
	spf[1] = 1;
	for (i = 2; i < N; i++)
		spf[i] = i;
	for (i = 4; i < N; i += 2)
		spf[i] = 2;
	for (i = 3; i * i < N; i++)
	{
		if (spf[i] == i)
		{
			for (j = i * i; j < N; j += i)
				if (spf[j] == j)
					spf[j] = i;
		}
	}
	ll a[n];
	ll gc = 0;
	rep(i, n) {
		cin >> a[i];
		gc = gcd(gc, a[i]);
	}
	//cout << gc;
	if (gc != 1) {
		cout << "not coprime";
	}
	else {
		ll cnt[N];
		mset(cnt, 0);
		rep(i, n) {
			x = a[i];
			while (x != 1) {
				cnt[spf[x]]++;
				y = spf[x];
				while (y == spf[x]) {
					x /= spf[x];
				}
			}
		}
		ll flg = 0;
		rep(i, N) {
			if (cnt[i] > 1) {
				flg = 1;
				break;
			}
		}
		if (flg)
			cout << "setwise coprime";
		else
			cout << "pairwise coprime";


	}


	return 0;
}

Measured memory_bytes: 26940
#include <bits/stdc++.h>
#include <iostream>
#include <limits>
#include <numeric>
#include <type_traits>
#include <bitset>
#include <atcoder/all>

using namespace std;
using namespace atcoder;

#define rep(i,n,m) for(ll (i)=(n);(i)<(m);(i)++)
#define rrep(i,n,m) for(ll (i)=(n);(i)>(m);(i)--)
using ll = long long;

int main(){
    
    int N,Q;
    scanf ("%d %d", &N , &Q);
    dsu UF(N);

    rep(i,0,Q){
        int t,u,v;
        scanf ("%d %d %d" , &t , &u , &v);
        if (t == 0) UF.merge(u,v);
        else printf ("%d\n" , UF.same(u,v));
    }
}

Measured memory_bytes: 3896
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<queue>
#include<map>
using namespace std;                       
typedef long long ll;

 string a[200005];
  int main()
  {   int n,t=1,t1=0;
      cin>>n;
      for(int i=1;i<=n;i++)
        cin>>a[i];
        sort(a+1,a+n+1);
         int sum=1;
		for(int i=1;i<n;i++)
		{  if(a[i]!=a[i+1])
		         sum++;
		 } 
        
	    cout<<sum<<endl;
	}

Measured memory_bytes: 9740
n = int(input().strip())
s = []
for _ in range(n):
  s.append(input().strip())

a, z = ord('a'), ord('z')
for i in range(a, z+1):
  i = chr(i)
  mi = min(_s.count(i) for _s in s)
  print(i * mi, end='')
  for j in range(len(s)):
    s[j].replace(i, '')

print()

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define ALL(a) (a.begin(), a.end())
using ull = unsigned long long;
template<typename T> void Out(T x) { cout << x << endl; }

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  ull r, b, N;
  cin >> N >> r >> b;
  Out(N/(r+b)*r + min(N % (r + b), r));
  return 0;
}


Measured memory_bytes: 256
// #define DEBUGGING
#include <bits/stdc++.h>
#define endl '\n'
#define ALL(V) (V).begin(), (V).end()
#define ALLR(V) (V).rbegin(), (V).rend()
template <typename T> using V = std::vector<T>;
template <typename T> using VV = V<V<T>>;
using ll = std::int64_t;
using ull = std::uint64_t;
using PLL = std::pair<ll, ll>;
using TLL = std::tuple<ll, ll, ll>;
template <typename T> const T& var_min(const T &t) { return t; }
template <typename T> const T& var_max(const T &t) { return t; }
template <typename T, typename... Tail> const T& var_min(const T &t, const Tail&... tail) { return std::min(t, var_min(tail...)); }
template <typename T, typename... Tail> const T& var_max(const T &t, const Tail&... tail) { return std::max(t, var_max(tail...)); }
template <typename T, typename... Tail> void chmin(T &t, const Tail&... tail) { t = var_min(t, tail...); }
template <typename T, typename... Tail> void chmax(T &t, const Tail&... tail) { t = var_max(t, tail...); }
template <typename T> const T& clamp(const T &t, const T &low, const T &high) { return std::max(low, std::min(high, t)); }
template <typename T> void chclamp(T &t, const T &low, const T &high) { return t = clamp(t, low, high); }
namespace init__ { struct InitIO { InitIO() { std::cin.tie(nullptr); std::ios_base::sync_with_stdio(false); std::cout << std::fixed << std::setprecision(30); } } init_io; }
#define mv_rec make_v(init, tail...)
template <typename T> T make_v(T init) { return init; }
template <typename T, typename... Tail> auto make_v(T init, size_t s, Tail... tail) { return V<decltype(mv_rec)>(s, mv_rec); }
#undef mv_rec
#ifdef DEBUGGING
#include "../../debug/debug.cpp"
#else
#define DEBUG(...) 0
#define DEBUG_SEPARATOR_LINE 0
#endif
using namespace std;

int main() {
    int sum = 0;
    for(int i = 0; i < 3; i++) {
        int a;
        cin >> a;
        sum += a;
    }

    cout << (22 <= sum ? "bust" : "win") << endl;
    return 0;
}


Measured memory_bytes: 256
as1,ae,bs,be = map(int,input().split())
da = {as1:'AS',ae:'AE'}
db = {bs:'BS',be:'BE'}
order = [as1,ae,bs,be]
order.sort()
Alice = False
Bob = False
start = -1
end = -1
for t in order:
  if t in da and da[t] == 'AS':
    Alice = True
  if t in db and db[t] == 'BS':
    Bob = True
  if t in da and da[t] == 'AE':
    Alice = False
  if t in db and db[t] == 'BE':
    Bob = False
  if Alice and Bob:
    start = t
  if start != -1 and (not(Alice) or not(Bob)):
    end = t
    break
#print(str(start) + " " + str(end))
print(str(end-start))

Measured memory_bytes: 3064
#include<stdio.h>
int main(void)
{
	int N, K,i,c,count=1;
	scanf("%d", &N);
	scanf("%d", &K);
	while (N >= K) {
		c = N / K;
		i = N % K;
		N = c;
		count++;
	}
	printf("%d", count);
	return 0;
}

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

long long mpow(long long x, int n) {
	long long r=1;
	while (n>0) {
		if (n&1) r=r*x%1000000007;
		x = x*x%1000000007;
		n >>= 1;
	}
	return r;
}

int main() {
	int n, k;
	cin >> n >> k;
	
	long long sumg = 0;
	long long cntg[100010];
	for (int i=k; 0<i; i--) {
		long long cntb = k/i;
		cntg[i] = mpow(cntb, n);
		for (int j=2; j*i<=k; j++) {
			cntg[i] += (1000000007-cntg[j*i]);
			cntg[i] %= 1000000007;
			if (cntg[i]<0) cout << 1;
		}
		sumg += cntg[i]*i;
		sumg %= 1000000007;
	}

	cout << sumg << endl;	

}


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

#define pb push_back
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n,s) for(int i=(s);i<(n);i++)
#define rrep(i,n) for(int i=(n-1);i>=0;i--)
#define rreps(i,n,s) for(int i=s;i>=n;i--)
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
using ll = long long;

ll calc_gcd(ll x,ll y){
    if(y==0) return x;
    return calc_gcd(y,x%y);
}

ll calc_lcm(ll x,ll y){
    return (x/calc_gcd(y,x%y))*y;
}

using ll = long long;
using namespace std;
constexpr long long MAX = 5100000;
constexpr long long INF = 1LL << 60;
constexpr int MOD = 1000000007;
template<typename T>
struct RMQ{
    // const T INF=numeric_limits<T>::max();
    const T INF=0;
    int n;
    vector<T> dat;
    RMQ(int n_):n(),dat(n_*4,INF){
        int x=1;
        while(n_>x){
            x*=2;
        }
        n=x;
    }

    void update(int i,T x){
        i += n - 1;
        dat[i] = x;
        while(i>0){
            i=(i-1)/2;
            dat[i]=calc_gcd(dat[i*2+1],dat[i*2+2]);
        }
    }

    T query(int a,int b){
        return query_sub(a,b,0,0,n);
    }
    T query_sub(int a,int b,int k,int l,int r){
        if(r<=a||b<=l){
            return INF;
        }
        else if(a<=l&&r<=b){
            return dat[k];
        }
        else{
            T vl = query_sub(a,b,k*2+1,l,(l+r)/2);
            T vr = query_sub(a,b,k*2+2,(l+r)/2,r);
            return calc_gcd(vl,vr);
        }
    }
};
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
int n;
cin>>n;
RMQ<ll> rmq(n);
vector<int> a(n);
rep(i,n){
    cin>>a[i];
    rmq.update(i,a[i]);
}
ll max_val=1;
rep(i,n){
    ll vl = rmq.query(0,i);
    ll vr = rmq.query(i+1,n);
    max_val = max(max_val,calc_gcd(vl,vr));
}
cout<<max_val<<endl;
return 0;
}

Measured memory_bytes: 3840
import java.util.Scanner;
public class Main{
  public static void main(String[]args){

    Scanner scan = new Scanner(System.in);

    double ans = 0;
    int c = scan.nextInt();
    for(int i=0;i<c;i++){
      double t = (double) scan.nextInt();
      ans += 1.0/t;
    }
    
    System.out.println(1.0/ans);
  }
}

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

using namespace std;
#define repr(i,a,b) for (int i=a; i<b; i++)
#define rep(i,n) for (int i=0; i<n; i++)


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

    cout << (48-M) << endl;

}

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

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

#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

int main()
{
    ll X, Y;
    cin >> X >> Y;
    if (abs(X - Y) >= 2)
        cout << "Alice" << endl;
    else
        cout << "Brown" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#define popcount __builtin_popcount
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF=1e9;
int n;
vector<int> g[2010];
string s;
int cnt[2010];
bool used[2010];
int ds[2010];
int l[2010];
void dfs(int x){
    used[x]=1;
    for(auto y:g[x]){
        if(used[y]) continue;
        dfs(y);
        cnt[x]+=cnt[y];
        ds[x]+=(cnt[y]+ds[y]);
        l[x]=max(l[x], l[y]+2*cnt[y]+ds[y]);
    }
    l[x]-=ds[x];
    if(l[x]<0) l[x]=ds[x]%2;
    if(s[x]=='1') cnt[x]++;
}
int main()
{
    cin>>n; cin>>s;
    for(int i=0; i<n-1; i++){
        int a, b; cin>>a>>b; a--; b--;
        g[a].push_back(b); g[b].push_back(a);
    }
    int ans=INF;
    for(int r=0; r<n; r++){
        fill(used, used+n, 0);
        fill(l, l+n, 0);
        fill(cnt, cnt+n, 0);
        fill(ds, ds+n, 0);
        dfs(r);
      //cout<<l[r]<<endl;
        if(l[r]==0) ans=min(ans, ds[r]);
    }
    if(ans==INF) cout<<-1<<endl;
    else cout<<ans/2<<endl;
    return 0;
}

Measured memory_bytes: 512
using System;

namespace ConsoleApplication10
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split(' ');

            int a = int.Parse(s[0]);
            int b = int.Parse(s[1]);

            if (a < b)
            {
                Console.WriteLine("a < b");
            }
            else if (a > b)
            {
                Console.WriteLine("a > b");
            }
            else if (a == b)
            {
                Console.WriteLine("a == b");
            }

        }
    }
}

Measured memory_bytes: 8976
import sys

input_methods=['clipboard','file','key']
using_method=0
input_method=input_methods[using_method]

tin=lambda : map(int, input().split())
lin=lambda : list(tin())
mod=1000000007

#+++++

def main():
	n = int(input())
	#b , c = tin()
	#s = input()
	al=lin()
	vm=10**6+1
	rr = [0]*(vm)
	for v in al:
		rr[v]+=1
	
	for v in list(set(al)):
		for i in range(2*v, vm, v):
			rr[i]=0
	ret = rr.count(1)
	print(ret)
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)
		
def input_clipboard():
	import clipboard
	input_text=clipboard.get()
	input_l=input_text.splitlines()
	for l in input_l:
		yield l

if __name__ == "__main__":
	if sys.platform =='ios':
		if input_method==input_methods[0]:
			ic=input_clipboard()
			input = lambda : ic.__next__()
		elif input_method==input_methods[1]:
			sys.stdin=open('inputFile.txt')
		else:
			pass
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

Measured memory_bytes: 122084
use proconio::*;
use proconio::marker::*;

pub trait MoOperator {
    type Value;
    type Query;
    type Answer;
    fn init(&mut self);
    fn insert(&mut self, v: &Self::Value);
    fn delete(&mut self, v: &Self::Value);
    fn answer(&mut self, q: Self::Query) -> Self::Answer;
    fn solve(
        &mut self,
        array: &[Self::Value],
        mut query: Vec<(usize, usize, Self::Query)>,
        answer: &mut [Self::Answer],
    ) {
        let state = self;
        let size = array.len();
        assert!(query.len() <= answer.len());
        assert!(query.iter().all(|p| p.0 < p.1 && p.1 <= size));
        if query.is_empty() {
            return;
        }
        let batch = (size as f64 / (query.len() as f64).sqrt()).ceil() as usize;
        let mut q = vec![];
        std::mem::swap(&mut q, &mut query);
        let mut query = (0..(size / batch + 1)).map(|_| vec![]).collect::<Vec<_>>();
        for (i, (l, r, op)) in q.into_iter().enumerate() {
            query[l / batch].push((r, l, i, op));
        }
        state.init();
        let mut x = 0;
        let mut y = 0;
        for (i, mut query) in query.into_iter().enumerate() {
            query.sort_unstable_by_key(|p| p.0);
            if i & 1 == 1 {
                query.reverse();
            }
            for (r, l, k, op) in query.into_iter() {
                while l < x {
                    x -= 1;
                    state.insert(&array[x]);
                }
                while y < r {
                    state.insert(&array[y]);
                    y += 1;
                }
                while x < l {
                    state.delete(&array[x]);
                    x += 1;
                }
                while r < y {
                    y -= 1;
                    state.delete(&array[y]);
                }
                answer[k] = state.answer(op);
            }
        }
    }
}

struct State {
    cnt: Vec<u32>,
    ans: usize,
}

impl MoOperator for State {
    type Value = usize;
    type Query = ();
    type Answer = usize;
    fn init(&mut self) {
        for c in self.cnt.iter_mut() {
            *c = 0;
        }
        self.ans = 0;
    }
    fn insert(&mut self, x: &Self::Value) {
        let c = &mut self.cnt[*x];
        if *c == 0 {
            self.ans += 1;
        }
        *c += 1;
    }
    fn delete(&mut self, x: &Self::Value) {
        let c = &mut self.cnt[*x];
        if *c == 1 {
            self.ans -= 1;
        }
        *c -= 1;
    }
    fn answer(&mut self, _q: Self::Query) -> usize {
        self.ans
    }
}

fn run() {
    input! {
        n: usize,
        q: usize,
        c: [Usize1; n],
        ask: [(Usize1, usize); q],
    }
    let ask: Vec<_> = ask.into_iter().map(|(l, r)| (l, r, ())).collect();
    let mut ans = vec![0; q];
    State {
        cnt: vec![0; n],
        ans: 0,
    }.solve(&c, ask, &mut ans);
    for a in ans {
        println!("{}", a);
    }
}


fn main() {
    run();
}


Measured memory_bytes: 41948
#include<iostream>
#include<algorithm>
#include<vector>
#include<numeric>
#include<string>
#include<cmath>
#include<set>
#include<queue>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cctype>
#include<map>
#include<cstring>

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,a,b) for (int (i)=a;(i)<(b);(i)++)
#define all(x) (x).begin(),(x).end()

using namespace std;
using ll = long long int;
const int inf = 1001001000;
const long long int Inf = 1001001001001001000;

void print(vector<vector<int>> a){
	for (int i = 0; i < a.size(); i++)
	{
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<vector<long long int>> a){
	for (int i=0;i<a.size();i++){
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<int> a){
    int n = a.size();
    for (int j=0;j<n;j++) {
        if (j != n-1) cout << a[j] << " ";
        else cout << a[j] << endl;
    }
}

void print(set<int> a){
	for (auto x:a)
		cout << x << " ";
	cout << endl;
}

long long int ok(long long int n){
	string s = to_string(n);
	int sz = s.size();
	vector<vector<vector<vector<ll>>>> dp(sz + 1, vector<vector<vector<ll>>>(2, vector<vector<ll>>(2, vector<ll>(10, 0))));
	dp[0][0][0][0] = 1;
	rep(i, sz)
	{
		int D = s[i] - '0';
		rep(j, 2)
		{
			rep(k,2){
				rep(l,10){
					for (int d = 0; d <= (j ? 9 : D);d++){
						if (abs(l-d)<=1 | k == 0)
							dp[i + 1][j || (d < D)][k || d][d] += dp[i][j][k][l];
					}
				}
			}
			
		}
	}
	long long int ans = 0;
	rep(i, 10) ans += dp[sz][0][1][i] + dp[sz][1][1][i];
	return ans;
}

// int d[20],n;
// int dp[20][10][2][2];

// int calc(long long int m){
// 	for(n=0;m;m/=10)d[n++]=m%10;
// 	reverse(d,d+n);
// 	memset(dp,0,sizeof(dp));
// 	dp[0][0][0][0]=1;
// 	rep(i,n)rep(j,10)rep(k,2)rep(l,2){
// 		rep(nj,10)if(k||nj<=d[i])if(abs(nj-j)<=1||l==0){
// 			int nk=k||nj<d[i], nl=l||nj;
// 			dp[i+1][nj][nk][nl]+=dp[i][j][k][l];
// 		}
// 	}
// 	int res=0;
// 	rep(i,10)rep(j,2)res+=dp[n][i][j][1];
// 	return res;
// }

// class JumpyNum {
// 	public:
// 	int howMany(long long int high,int low=1) 
// 	{
// 		return calc(high)-calc(low-1);
// 	}
// };

int main()
{
	int k;
	cin >> k;
	long long int l = 0, r = 1e12;
	while(l + 1 < r){
		long long int mid = (l + r) / 2;
		if (ok(mid) < k)
			l = mid;
		else
			r = mid;
	}
	cout << r << endl;
 
	return 0;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"sort"
	"strconv"
)

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func asub(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

func abs(a int) int {
	if a >= 0 {
		return a
	}
	return -a
}

func lowerBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] >= x
	})
	return idx
}

func upperBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] > x
	})
	return idx
}

type Edge struct {
	from, to, cost int
}

type Route struct {
	path []int
}

// ベルマンフォード法
func bellmanFord(N, P, S int, edges []Edge) ([]int, bool) {
	d := make([]int, N+1)
	for i := 0; i <= N; i++ {
		d[i] = math.MaxInt64
	}
	d[S] = 0
	for i := 0; i < N-1; i++ {
		for _, e := range edges {
			if d[e.from] != math.MaxInt64 &&
				d[e.to] > d[e.from]+e.cost {
				d[e.to] = d[e.from] + e.cost
			}
		}
	}

	negative := make([]bool, N+1)
	for i := 0; i < N; i++ {
		for _, e := range edges {
			if d[e.from] != math.MaxInt64 &&
				d[e.to] > d[e.from]+e.cost {
				d[e.to] = d[e.from] + e.cost
				negative[e.to] = true
			}
			negative[e.to] = negative[e.to] || negative[e.from]
		}
	}

	return d, negative[N]
}

func main() {
	sc.Split(bufio.ScanWords)

	N, M, P := getInt(), getInt(), getInt()
	edges := make([]Edge, M)
	for i := 0; i < M; i++ {
		f, t, c := getInt(), getInt(), getInt()
		edges[i] = Edge{f, t, -c + P}
	}

	// out(edges)
	// ここから
	d, negativeLoop := bellmanFord(N, P, 1, edges)

	if negativeLoop {
		out(-1)
	} else {
		out(max(0, -d[N]))
	}
}


Measured memory_bytes: 896
#include<bits/stdc++.h>
using namespace std;
using UL = unsigned int;
using ULL = unsigned long long;
using LL = long long;
#define rep(i,n) for(UL i=0; i<(n); i++)

struct Tree{
 struct Node{ int l=-1,r=-1,p=-1; int v; };
 vector<Node> V;
 int R=-1;
 void insert(int v){
  int* pp=&R;
  int p=R;
  while(p!=-1){
   if(v<V[p].v){ pp=&V[p].l; p=V[p].l; }
   else{ pp=&V[p].r; p=V[p].r; }
  }
  *pp=V.size();
  V.push_back({-1,-1,p,v});
 }

 void printPreorder(int p=-2){
  if(p==-2) p=R;
  if(p==-1) return;
  printf(" %d",V[p].v);
  printPreorder(V[p].l);
  printPreorder(V[p].r);
 }
 void printInorder(int p=-2){
  if(p==-2) p=R;
  if(p==-1) return;
  printInorder(V[p].l);
  printf(" %d",V[p].v);
  printInorder(V[p].r);
 }
};

Tree T;
int Q;

int main() {
 scanf("%d",&Q);
 rep(i,Q){
  string c;
  { char buf[10]; scanf("%s",buf); c=buf; }
  if(c=="insert"){
   int v; scanf("%u",&v);
   T.insert(v);
  }
  else if(c=="print"){
   T.printInorder(); printf("\n");
   T.printPreorder(); printf("\n");
  }
 }
}



Measured memory_bytes: 11172
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
#define rep(i,n) for (int i=0; i<n;++i)
typedef long long ll;
using namespace std;
const ll INF = 1LL << 50;
struct edge {int from, to, cost;};
edge es[5005];
ll d[2502];
int N,M,P;
bool negative[2502]; 

void shortest_path(int s){
  rep(i, N) d[i] = INF;
  d[s] = 0;
  rep(loop, N-1){
    rep(i, M){
      edge e = es[i];
      if (d[e.from] == INF) continue;
      if(d[e.from] != INF && d[e.to] > d[e.from]+e.cost) d[e.to] = d[e.from] + e.cost;
    }
  }
}

void find_negative_loop(){
  rep(i, N){
    rep(j, M){
      edge e =es[j];
      if (d[e.from] == INF) continue;
      if (d[e.to] > d[e.from] + e.cost) {
        d[e.to] = d[e.from] + e.cost;
        // n回目にも更新があるなら負の経路が存在する
        negative[e.from] = true;
      }
      if(negative[e.from]) negative[e.to] = true;
    }
  }
}

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

  cin >> N >> M >> P;
  int a,b,c;
  rep(i, M){
    cin >> a >> b >> c;
    a--, b--;
    edge e = {a, b, -c+P};
    es[i] = e;
  }
  shortest_path(0);
  find_negative_loop();
  int ans = - d[N-1];
  if (negative[N-1]) cout << -1 << endl;
  else cout << max(ans, 0) << endl;
}

Measured memory_bytes: 384
// Problem : A - Next Alphabet
// Contest : AtCoder Beginner Contest 151
// URL : https://atcoder.jp/contests/abc151/tasks/abc151_a
// Memory Limit : 1024.000000 MB 
// Time Limit : 2000.000000 milisec 
// Powered by CP Editor (https://github.com/coder3101/cp-editor)

#include<bits/stdc++.h>
using namespace std;
 
#define int long long
#define IOS ios::sync_with_stdio(false); cin.tie(nullptr);
 
const int N = 3e5+5;
const int MOD = 1e9+7;

int32_t main()
{
    	IOS;
	char ch;
	cin >> ch;
	ch++;
	cout << ch << endl;
    	return 0;
}

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

typedef long long ll;

int main() {
    string S, T, U;
    int A, B;
    cin >> S >> T >> A >> B >> U;
    if (U == S) A--;
    else B--;
    cout << A << " " << B << endl;
}

Measured memory_bytes: 256
n = int(input())
d = dict()
d['M'] = 0
d['A'] = 0
d['R'] = 0
d['C'] = 0
d['H'] = 0
for i in range(n):
    s = input()
    if s[0] in 'MARCH':
        d[s[0]] += 1
s = "MARCH"
ans = 0
for i in range(5):
    for j in range(i+1,5):
        for k in range(j+1,5):
            ans += d[s[i]] * d[s[j]] * d[s[k]]

print(ans)


Measured memory_bytes: 3064
n = int(input())
s = ["" for _ in range(n)]
for i in range(n):
    s[i] = input()
s.sort()
s.append("")
cnt = 0
m = -1
ans = []
for i in range(n):
    if s[i] == s[i + 1]:
        cnt += 1
    else:
        if cnt > m:
            m = cnt
            ans = [s[i]]
        elif cnt == m:
            ans.append(s[i])
        cnt = 0
for word in ans:
    print(word)

Measured memory_bytes: 20688
#include<bits/stdc++.h>
long long a,b,x,s,t;
int main()
{
    scanf("%lld%lld%lld",&a,&b,&x);
    if(a%x==0)
		s=a/x;
    else
		s=a/x+1;
    t=b/x;
    printf("%lld",t-s+1);
    return 0;
}

Measured memory_bytes: 256