akhauriyash/Code-Regression huggingface dataset:
import math
from collections import deque
from collections import defaultdict

#自作関数群
def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()
def factorization(n):
	res = []
	if n%2==0:
		res.append(2)
	for i in range(3,math.floor(n//2)+1,2):
		if n%i==0:
			c = 0
			for j in res:
				if i%j==0:
					c=1
			if c==0:
				res.append(i)
	return res
def fact2(n):
	p = factorization(n)
	res = []
	for i in p:
		c=0
		z=n
		while 1:
			if z%i==0:
				c+=1
				z/=i
			else:
				break
		res.append([i,c])
	return res
def fact(n):#階乗
	ans = 1
	m=n
	for _i in range(n-1):
		ans*=m
		m-=1
	return ans
def comb(n,r):#コンビネーション
	if n<r:
		return 0
	l = min(r,n-r)
	m=n
	u=1
	for _i in range(l):
		u*=m
		m-=1
	return u//fact(l)
def combmod(n,r,mod):
	return (fact(n)/fact(n-r)*pow(fact(r),mod-2,mod))%mod
def printQueue(q):
	r=copyQueue(q)
	ans=[0]*r.qsize()
	for i in range(r.qsize()-1,-1,-1):
		ans[i] = r.get()
	print(ans)
class UnionFind():
	def __init__(self, n):
		self.n = n
		self.parents = [-1]*n

	def find(self, x): # root
		if self.parents[x]<0:
			return x
		else:
			self.parents[x] = self.find(self.parents[x])
			return self.parents[x]

	def union(self,x,y):
		x = self.find(x)
		y = self.find(y)

		if x==y:
			return

		if self.parents[x]>self.parents[y]:
			x,y = y,x

		self.parents[x]+=self.parents[y]
		self.parents[y]=x

	def size(self,x):
		return -1*self.parents[self.find(x)]

	def same(self,x,y):
		return self.find(x)==self.find(y)

	def members(self,x): # much time
		root = self.find(x)
		return [i for i in range(self.n) if self.find(i)==root]

	def roots(self):
		return [i for i,x in enumerate(self.parents) if x<0]

	def group_count(self):
		return len(self.roots())

	def all_group_members(self):
		return {r: self.members(r) for r in self.roots()} # 1~n
def bitArr(n):#ビット全探索
	x = 1
	zero = "0"*n
	ans = []
	ans.append([0]*n)
	for i in range(2**n-1):
		ans.append(list(map(lambda x:int(x),list((zero+bin(x)[2:])[-1*n:]))))
		x+=1
	return ans;
def arrsSum(a1,a2):
	for i in range(len(a1)):
		a1[i]+=a2[i]
	return a1
def maxValue(a,b,v):
	v2 = v
	for i in range(v2,-1,-1):
		for j in range(v2//a+1): #j:aの個数
			k = i-a*j
			if k%b==0:
				return i
	return -1
def copyQueue(q):
	nq = queue.Queue()
	n = q.qsize()
	for i in range(n):
		x = q.get()
		q.put(x)
		nq.put(x)
	return nq

a,b,m = readInts()
a_arr = readInts()
b_arr = readInts()
xyc = [[] for i in range(a)]
for i in range(m):
	x,y,c = readInts()
	xyc[x-1].append([y-1,c])

ans = min(a_arr)+min(b_arr)

for i in range(len(xyc)):
	for j in xyc[i]:
		ans = min(ans,a_arr[i]+b_arr[j[0]]-j[1])

print(ans)

Measured memory_bytes: 38372
#pragma GCC optimize ("O2")
#include<bits/stdc++.h>
#include <queue>
#include <cstring>

#define mp make_pair
#define pb push_back
#define p push

#define FOR(a, c) for(int a = 0;a<c;a++)
#define ll long long int

#define getI(a) scanf("%d",&a)
#define getII(a, b) scanf("%d%d",&a,&b)
#define getIII(a, b, c) scanf("%d%d%d",&a,&b,&c)
#define getL(a) scanf("%lld",&a)
#define getLL(a, b) scanf("%lld%lld",&a,&b)
#define getLLL(a, b, c) scanf("%lld%lld%lld",&a,&b,&c)
#define BEND(c) (c).begin(),(c).end()
#define BEND2(c) (c).rbegin(),(c).rend()
#define fi first
#define se second
#define pi 3.1415926535897932384626
#define getS(a) scanf("%s",a)
#define pfi(a) printf("%d",a);
#define pfii(a, b) printf("%d%d",a,b);
#define pfl(a) printf("%lld",a);
#define pfll(a, b) printf("%lld%lld",a,b);
#define pfd(a) printf("%lf",a);
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);

#define sag (sol|1)
#define sol (root<<1)
#define ort (bas+son)/2
#define SIZE  ( int)(1e9 + 7)
#define MAXN (ll) (2*(1e5+5))
#define K 25
#define mylog(n) (int)(log(n))

using namespace std;

typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector <vector<int>> vvi;
typedef vector<long long> vl;
typedef vector <pair<int, int>> vpi;
typedef vector <pair<long long, long long>> vpl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector <vi> graph;






int main (){
    IOS;
    char c;
    cin >>c;

    c++;
    cout << c;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef pair<int,int>P;
int main(){
  vector<int>v;
  int n;
  cin>>n;
  while(n--){
    int x;
    cin>>x;
    v.push_back(x);
  }
  int q;
  cin>>q;
  while(q--){
    int x;
    cin>>x;
    cout<<(lower_bound(v.begin(),v.end(),x)-v.begin())<<' '<<(upper_bound(v.begin(),v.end(),x)-v.begin())<<endl;
  }
}


Measured memory_bytes: 3460
#include <stdio.h>
#define INFI 2001
#define MAX_L 101
#define NIL -1
int Graph[MAX_L][MAX_L];
int mstUsed[MAX_L];
int parent[MAX_L];
int dCost[MAX_L];
int minVal;
int main(){
    int n;
    int e;
    int temp;
    int sum = 0;
    scanf("%d", &n);
    for(int i = 0;i<n;i++)
    {
        for(int j = 0;j<n;j++)
        {
            scanf("%d", &e);
            Graph[i][j] = (e==-1)?INFI:e;
        }
    }
    for(int i = 0;i<n;i++){dCost[i]=INFI;parent[i]=NIL;mstUsed[i]=0;}
    dCost[0]=0;
    while(1)
    {
        minVal = INFI;
        temp = NIL;
        for(int i = 0;i<n;i++)
        {
            if(minVal>dCost[i]&&!mstUsed[i])
            {
                temp = i;
                minVal = dCost[i];
            }
        }
        if(temp == -1)break;
        mstUsed[temp] = 1;
        for(int v = 0;v<n;v++)
        {
            if(!mstUsed[v]&&Graph[temp][v]!=INFI)
            {
                if(dCost[v]>Graph[temp][v])
                {
                    dCost[v] = Graph[temp][v];
                    parent[v] = temp;
                }
            }
        }
    }
    for(int i=0;i<n;i++){sum += dCost[i];}
    printf("%d\n", sum);
    return 0;
}



Measured memory_bytes: 2112
#include <bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
#define eps 1e-9

typedef long long ll;

using namespace std;

const ll inf = 1e18;
const ll mod = 1e9+7;
const int N = 1e5+5;

int main()

{
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

    int n, ans = 1;
    string s;

    cin >> n >> s;

    char tmp = s[0];

    for (int i = 1; i < n; i++) {

        if (s[i] != tmp) {

            ans++;
            tmp = s[i];
        }
    }

    cout << ans;

    return 0;
}


Measured memory_bytes: 512
def Q4(K):
    N = 50
    lst = list(range(N))
    q, r = K // N, K % N
    lst = list(map(lambda x: x + q, lst))
    for i in range(r):
        lst[i] += N
        for j in range(N):
            if i != j:
                lst[j] -= 1
    print(N)
    for i in lst:
        print(i, end=' ')

K=int(input())
Q4(K)

Measured memory_bytes: 3060
// ABC154
// c.cs

using System;

class C
{
    public static void Main()
    {
        int N = int.Parse(Console.ReadLine());
        string[] str = Console.ReadLine().Split(' ');
        bool flg = false;
        int[] num = new int[N];

        for (int i = 0; i < N; i++)
        {
            num[i] = int.Parse(str[i]);
        }

        Array.Sort(num);

        for (int i = 0; i < N-1; i++)
        {
            if (num[i] == num[i + 1])
            {
                flg = true;
                break;
            }
        }

        if (flg)
        {
            Console.WriteLine("NO");
        }
        else
        {
            Console.WriteLine("YES");
        }
    }
}

Measured memory_bytes: 30044
import math
a,b,x = map(int,input().split())
if x>a**2*b/2:
    k = math.degrees(math.atan((2*a**2*b-2*x)/a**3))
else:
    k = math.degrees(math.asin(b/(4*x**2/a**2/b**2+b**2)**0.5))
print(k)

Measured memory_bytes: 38640
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define repit(it, li) for(auto it=li.begin(); it!=li.end(); it++)
using namespace std;
using ll = long long;
using P = pair<ll,ll>;

int main(){
   int n, d, a;
   cin>>n>>d>>a;
   vector<P> mon;
   rep(i, n){
      ll x, h;
      cin>>x>>h;
      mon.push_back(make_pair(x, h));
   }

   sort(mon.begin(), mon.end());
   ll cnt=0;
   ll sdm=0;
   vector<ll> ds(n);
   rep(i, n){
      ll x=mon[i].first, h=mon[i].second;
      ll r=(ll)x+(ll)2*d;
      auto rit=upper_bound(mon.begin(), mon.end(), make_pair(r, LLONG_MAX));
      int ri= rit-mon.begin()-1;
      ll remh= h-sdm;
      if(remh>0){
         ll num= (remh-1)/a+1;
         cnt+=num;
         ll dm=a*num;
         sdm+=dm;
         ds[ri]+= -dm;
      }
      sdm+= ds[i];
   }

   cout<<cnt<<endl;
   return 0;
}


Measured memory_bytes: 7908
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <cstdlib>
#include <utility>
#include <cstdio>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <cmath>
#include <set>
#include <map>

using ll = long long;
using namespace std;

int main() {
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	if (abs(c - a) <= d) {
		cout << "Yes";
	}
	else if ((abs(a - b) <= d) && (abs(b - c) <= d)) {
		cout << "Yes";
	}
	else {
		cout << "No";
	}
}







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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#define Abs(x)((x) < 0 ? (x) * -1 : (x))

#define rep(x, y) for ((x) = 0; (x) < (y); (x)++)
#define repin(x, y) for ((x) = 0; (x) <= (y); (x)++)
#define nep(x, y) for ((x) = (y) - 1; 0 <= (x); (x)--)
#define nepi(x, y, z) for ((x) = (y) - 1; (z) <= (x); (x)--)
#define repi(x, y, z) for ((x) = (z); (x) < (y); (x)++)
#define repiin(x, y, z) for ((x) = (z); (x) <= (y); (x)++)
#define reps(x, y, z) for ((x) = 0; (x) < (y); (x) += (z))
#define repis(x, y, z, s) for ((x) = (z); (x) < (y); (x) += (s))
#define repiins(x, y, z, s) for ((x) = (z); (x) <= (y); (x) += (s))
#define repit(x) for (__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define nepit(x) for (__typeof((x).rbegin()) it = (x).rbegin(); it != (x).rend(); it++)

#define All(x) (x).begin(),(x).end()

#define Mem0(x) memset(x, 0, sizeof(x))
#define Mem1(x) memset(x, -1, sizeof(x))

#define Unique(v) v.resize(unique(All(v)) - v.begin())

#define peq(p0, p1)(p0.first == p1.first && p0.second == p1.second)

#define End '\n'
#define Out(x) cout<<(x)<<End
#define OutP(p, sep, end) cout<<p.first<<sep<<p.second<<end

template<typename T> inline bool Max(T &x, const T &y) { return x < y ? x = y, 1 : 0; }
template<typename T> inline bool Min(T &x, const T &y) { return x > y ? x = y, 1 : 0; }
template<typename T> using V = vector<T>;
template<typename T> using VV = V<V<T> >;

#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define lb std::lower_bound
#define ub std::upper_bound

#define lbi(v, x) lb(All(v), (x))-v.begin()
#define ubi(v, x) ub(All(v), (x))-v.begin()

static const ll MOD = 1e9 + 7;
static const double PI = 3.141592653589793;

#define LOCAL 0

int main()
{
#if LOCAL
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
    freopen("debug.txt", "w", stderr);
#endif

    cin.tie(0);
    ios::sync_with_stdio(false);
	//std::cout.precision(18);

    int a, b, c;
 
	cin >> a >> b >> c;
 
    int i;

	repiin(i, b, 1) {
		if (((a * i) % b) == c) {
			Out("YES");

			return 0;
		}
	}

	Out("NO");
	
	return 0;
}


Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main(){
    int d;
    cin >> d;
    if(d == 25){
        cout << "Christmas" << endl;
    } else if(d == 24){
        cout<< "Christmas Eve" << endl;
    } else if(d == 23) {
        cout << "Christmas Eve Eve" << endl;
    } else if(d == 22) {
    cout << "Christmas Eve Eve Eve" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n,k,ans=0;
    cin>>n>>k;
    vector<int>p(n);
    for (int i=0; i<n; i++){
        cin>>p[i];
    }
    sort(p.begin(),p.end());
    for (int i=0; i<k; i++){
    ans+=p[i];
    }
    cout<<ans<<endl;


}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
int main() {}

class C {
 public:
  int N, a, factor4 = 0, factor2 = 0, factor1 = 0;
  ~C() {
    cin >> N;
    while (N--) {
      cin >> a;
      if (a % 2 == 0) {
        if (a % 4 == 0)
          ++factor4;
        else
          ++factor2;
      } else {
        ++factor1;
      }
    }
    if (factor1 <= factor4 + !factor2)
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
  }
} x;


Measured memory_bytes: 256
import sys


def main():
    input = sys.stdin.buffer.readline
    n = int(input())
    x = list(map(int, input().split()))
    ans = 10 ** 10
    for p in range(1, 101):
        s = 0
        for home in x:
            s += (home - p) ** 2
        ans = min(ans, s)
    print(ans)


if __name__ == "__main__":
    main()


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

int main(){
	string n;
	int a,b;
	cin>>n;
	a=n.size();
	sort(n.begin(), n.end());
	n.erase(unique(n.begin(), n.end()), n.end());
	b=n.size();
	if(a==b){
    	cout<<"yes";
    }else{
    	cout<<"no";
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define brep(i,n) for(int i=n-1;i>=0;i--)
#define brep1(i,n) for(int i=n;i>=1;i--)
#define rep1(i,n) for(int i=1;i<n;i++)
#define cY cout<<"Yes"<<endl
#define cN cout<<"No"<<endl
#define ll long long

unsigned const int MOD = 1e9+7;

ll lcm(ll a,ll b)
{
 
  ll r, x, tmp;
 
 
  x = a * b;
 
  /* 自然数 a > b を確認・入替 */
  if(a<b){
    tmp = a;
    a = b;
    b = tmp;
  }
 
  /* ユークリッドの互除法 */
  r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }
 
  return x/b;
}



int main(void){
    ll a,b;
    ll c,d;
    cin >> a >> b >> c >> d;
    ll e = lcm(c,d);
    ll ans1,ans2,ans3;
    ans1 = b/c - (a-1)/c;
    ans2 = b/d - (a-1)/d;
    ans3 = b/e - (a-1)/e;
    
    cout << b - a + 1 - ans1 - ans2 + ans3 << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int A,B,C;
  cin>>A>>B>>C;
  if(A==7&&B==5&&C==5){
cout<<"YES"<<endl;
  }
  else if(A==5&&B==7&&C==5){
cout<<"YES"<<endl;
  }
  else if (A==5&&B==5&&C==7){
    cout<<"YES"<<endl;
  }
  else{
    cout<<"NO"<<endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int maxn = 1<<19, mod = 1e9 + 7;
int n, m, pr = 0, dp[maxn], p[maxn][2];
string s;
int corner() {
	dp[0] = 2, dp[1] = 1;
	for(int i = 2; i <= n; i++) dp[i] = (dp[i-1] + dp[i-2])%mod;
	return dp[n];
}
void add(int &a, int b) {
	a += b;
	if(a >= mod) a -= mod;
}
int normal() {
	int ans = 0;
	for(int i = 0; i <= n; i++) {
		if(i) {
			add(p[i][0], p[i-1][0]);
			add(p[i][1], p[i-1][1]);
		}
		dp[i] = p[i][i&1];
		if(i == 1) {
			dp[i] = 1;
		}
		add(p[i+2][i&1], dp[i]);
		add(p[i+pr+2][i&1], mod - dp[i]);
	}
	for(int i = 1; i <= n; i++) {
		if(i + pr < n || ((i+pr)&1) != (n&1)) continue;
		ans = (ans + (n-i+1)*1ll*dp[i])%mod;
	}
	return ans;
}
bool check(int msk, int f = 0) {
	if((msk&1) && ((msk>>(n-1))&1)) return 0;
	if(msk == 0) return 0;
	int prev = -1, streak = 0, i = 0;
	if(f) while(!(msk&1)) {
		msk = (msk/2);}
	for(; i < n; i++) {
		int cur = (msk>>i)&1;
		if(prev == cur) streak++;
		else {
			if(prev == 1 && streak > 1) return 0;
			if(prev == 0 && (streak > pr || (streak&1) == 0)) return 0;
			streak = 1;
		}
		//cout << i << " " << cur << " " << streak << '\n';
		prev = cur;
	}
	if(prev == 1 && streak > 1) return 0;
			if(prev == 0 && (streak > pr || (streak&1) == 0)) return 0;
	
	return true;
}
int brute() {
	int ans = 0;
	for(int i = 0; i < 1<<n; i++) {
		ans += check(i, 1);
	}
	return ans;
}
int main() {
	cin >> n >> m >> s;
	if(s[0] == 'R')
		for(auto &i : s) i ^= 'B'^'R';
	while(pr < m && s[pr] == 'B') pr++;
	if(m == pr) return cout << corner(), 0;
	pr += pr%2 == 0;
	int cur = 0;
	for(auto &i : s) {
		if(i == 'B') cur++;
		else {
			if(cur&1) pr = min(cur, pr);
			cur = 0;
		}
	}
	cout << normal();
}


Measured memory_bytes: 6660
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <functional>
#include <map>
using namespace std;
#define INF (int)1e8;

int N, M;
int E[101][101];
bool is_used_E[101][101];

int status[101],cost[101];

void dijkstra(int s) {
	//初期化
	for (int i = 1; i <= N; i++) {
		status[i] = 0;
		cost[i] = INF;
	}
	cost[s] = 0;
	status[s] = 1;//コスト最小化中

	priority_queue<pair<int,int>, vector<pair<int,int>>, greater<pair<int,int>>>PQ;
	PQ.push(make_pair(cost[s], s));

	while (!PQ.empty()) {
		int u = PQ.top().second; PQ.pop();
		if (status[u] == -1)continue;

		//コスト最小化した隣接点と同じ最短経路に含まれる
		for (int i = 1; i <= N; i++) {
			if (E[u][i] == 0 || status[i]!=-1)continue;
			if (cost[u] == cost[i] + E[u][i]) {
				is_used_E[u][i] = true;
				is_used_E[i][u] = true;
			}
		}

		status[u] = -1;//コスト最小化終了

		//uに隣接した点のコストを更新
		for (int i = 1; i <= N; i++) {
			if (E[u][i] == 0)continue;
			if (status[i] != -1) {
				if (cost[i] > cost[u] + E[u][i]) {
					cost[i] = cost[u] + E[u][i];
					status[i] = 1;//コスト最小化中
					PQ.push(make_pair(cost[i], i));
				}
			}
		}
	}
}

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

	for (int i = 0; i < M; i++) {
		int a, b, c; cin >> a >> b >> c;
		E[a][b] = c;
		E[b][a] = c;
	}

	for (int i = 1; i <= N; i++) {
		dijkstra(i);
	}

	int cnt = 0;
	for (int i = 1; i <= N; i++) {
		for (int j = i + 1; j <= N; j++) {
			if (is_used_E[i][j])cnt++;
		}
	}

	cout << M - cnt << endl;

    return 0;
}

Measured memory_bytes: 256
# start:2020-05-28 00:22:02
import sys
sys.setrecursionlimit(10**8)
input = sys.stdin.readline

N, M = map(int,input().split())
S = list(map(int,input().split()))
T = list(map(int,input().split()))

MOD = 10**9+7
dp = [[0]*(M+1) for _ in range(N+1)]
rui = [[0]*(M+1) for _ in range(N+1)]
ans = 1
for i in range(N):
    for j in range(M):
        if S[i]==T[j]:
            dp[i+1][j+1] = rui[i][j] + 1
            dp[i+1][j+1] %= MOD
            ans += dp[i+1][j+1]
            ans %= MOD    
        rui[i+1][j+1] = rui[i+1][j] + rui[i][j+1] - rui[i][j] + dp[i+1][j+1]
        rui[i+1][j+1] %= MOD

print(ans)

Measured memory_bytes: 106716
#include<bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define ll long long
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for(ll i = 0; i < n; i++)
const ll INF = 1LL << 60;


int main(){
    ll N; cin >> N;
    vector<ll> nums;
    if(N <= 26){
        cout << char(N + 'a' - 1) << endl;
        return 0;
    }
    //どの区域の数字かを調べる
    int x = 2;
    ll sum = 26;
    while(1){
        if(sum < N && sum + pow(26, x) >= N ) break;
        sum += pow(26, x);
        x++;
    }

    //cout << x << " " << sum << endl; xがいくつ文字があるか、sumがスタートの位置
    string s = "";
    rep(i, x) s.push_back('a');

    ll k = N - sum;
    k--;
    int index = 1;
    while(k != 0){
        int tmp = k % 26;
        s[x - index] = tmp + 'a';
        k /= 26;
        index++;
    }
    cout << s << endl;
}

Measured memory_bytes: 4096
#include <cstdio>
using namespace std;

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

const int is = 1 << 16;
char ib[is], *ip = ib + is, it;
inline char getc() {
	if (ip == ib + is) { fread_unlocked(ib, 1, is, stdin); ip = ib; }
	return *ip++;
}
inline int read() {
	int r = 0;
	if (ip + 16 > ib + is) while ((it = getc()) & 16) r = r * 10 + it - '0';
	else while ((it = *ip++) & 16) r = r * 10 + it - '0';
	return r;
}

const int os = 1 << 16;
char ob[os], *op = ob, ot;
inline void putc(const char c) {
	*op++ = c;
	if (op == ob + os) { fwrite_unlocked(ob, 1, os, stdout); op = ob; }
}
// x shoud be greater than or equal to zero
inline void write(int x) {
	char d[6];
	int i = 0;
	while (true) {
		d[i] = x % 10 + 48;
		x /= 10;
		++i;
		if (x <= 0) break;
	}
	while (i--) {
		putc(d[i]);
	}
}

int A[200000];
signed main() {
	int n = read();
	int m0 = 0;
	int m1 = 0;
	REP(i, n) {
		int a = read();
		if (a > m0) {
			m1 = m0;
			m0 = a;
		} else if (a > m1) {
			m1 = a;
		}
		A[i] = a;
	}
	REP(i, n) {
		int a = A[i];
		if (a == m0) {
			write(m1);
		} else {
			write(m0);
		}
		putc('\n');
	}
	fwrite_unlocked(ob, 1, op - ob, stdout);
}


Measured memory_bytes: 2432
//Coded by Abhijay Mitra
#include <iostream>
#include <stdlib.h>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <numeric>
#include <vector>
#include <iterator> 
#include <map>
#include <set>
#include <climits>
#include <queue>
#include <cmath>
#include <stack>
#include <cctype>
#include <bitset>
// #include <bits/stdc++.h>
#define double long double
#define int long long int
#define ll int
#define ibs ios_base::sync_with_stdio(false)
#define cti cin.tie(0)
#define bp __builtin_popcount
#define pb emplace_back
#define koto_memory(a) cout<<(sizeof(a)/1048576.0)<<" MB";
#define res(v) sort(all(v)),v.erase(unique(all(v)), v.end());
#define timer cerr << "Time elapsed : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec \n";
#define deb(x) cout<<"\n["<<#x<<" = "<<x<<"]\n";
using vi = std::vector<int>;
using vvi = std::vector<vi>;
using pii = std::pair<int,int>;
using vpii = std::vector<pii>;
using vvpii = std::vector<vpii>;
#define mp         make_pair
#define rep(i,a,b) for (int i = a; i <= b; i++)
#define per(i,b,a) for (int i = b; i >= a; i--)
#define all(x)     x.begin(), x.end()
using namespace std;
const int N=2e6+10;
const int inf = /*0x3f3f3f3f*/1e18+10;
// const ll M = 998244353 ; // Mulo
// const int M = 1e9+7 ; // Mulo
const double Pi = 3.14159265;
#define F first
#define S second
void solve(){
  string s;cin>>s;
  cout<<s;
  if(s.back()=='s')cout<<'e'<<'s';
  else cout<<'s';
}
int32_t main()
{
  ibs;cti;
  solve();return 0;
  /*,cout<<"\n"*/;
  // cout<<"\n";
  int xx=0;
  int t;cin>>t;while(t--){/*xx++;cout<<"Case "<<xx<<":\n"*/;solve();cout<<"\n";}
  return 0;
}

Measured memory_bytes: 3616
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <string.h>
using namespace std; using ll = long long; using pll = pair<ll, ll>;
using vl = vector<ll>; using vll = vector<vl>; using vpll = vector<pll>;
int ctoi(char c) {
	switch (c) {
	case '0': return 0; case '1': return 1; case '2': return 2;
	case '3': return 3; case '4': return 4; case '5': return 5;
	case '6': return 6; case '7': return 7; case '8': return 8;
	case '9': return 9;  default: return 0;
	}
}
bool pairCompare(const pll firstElof, pll secondElof)
{
	return firstElof.first > secondElof.first;
}
//**Snippetリスト**//
//rep, vin, all, iteLoop//
//gcdlcm, isPrime, eratos, divisor, modinv, bitSearch, bitList, dfs, bfs//
//dijkstra, UnionFind, COM, digitDP//
ll i, j, k, l; ll N, M, K, H, W, L;
ll MOD = 1000000007; ll INF = 9999999999999; ll ans = 0;
vl flag, color, D; vll path;
//***********//
int main() {
	ll X;
	cin >> X;
	if (X == 5 || X == 7 || X == 3) {
		cout << "YES";
	}
	else cout << "NO";
}

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

using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
using ld = long double;
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define rep3(i, n) for (int i = 1; i < (int)(n+1); i++)
#define rep4(i, s, n) for (int i = (s); i < (int)(n+1); i++)
#define stlen(s) ll s.size()-1
#define all(v) v.begin(), v.end()
#define cout(n) cout<<std::fixed<<std::setprecision(n)
int main() {
const ll INF = 100100100100100100;
const ld pi = 3.141592653589793238462643383279502884197169399;
ld A,B,H,M,S;
cin>>A>>B>>H>>M;
S=A*A+B*B-2*A*B*cosl((60*H-11*M)*pi/360);
cout(12)<<sqrtl(S)<<endl;
return 0;
}


Measured memory_bytes: 4156
import java.util.*;
import java.io.*;
import java.awt.geom.*;
import java.math.*;

public class Main {

	static final Scanner in = new Scanner(System.in);
	static final PrintWriter out = new PrintWriter(System.out,false);
	static boolean debug = false;

	static void solve() {
		int h = in.nextInt();
		int w = in.nextInt();
		for (int i=0; i<h; i++) {
			for (int j=0; j<w; j++) {
				String s = in.next();
				if ("snuke".equals(s)) {
					int a = 'A' + j;
					out.print((char)a);
					out.println((i+1));
				}
			}
		}

	}

	public static void main(String[] args) {
		debug = args.length > 0;
		long start = System.nanoTime();

		solve();
		out.flush();

		long end = System.nanoTime();
		dump((end - start) / 1000000 + " ms");
		in.close();
		out.close();
	}

	static void dump(Object... o) { if (debug) System.err.println(Arrays.deepToString(o)); }
}

Measured memory_bytes: 10320
#include<algorithm>
#include<complex>
#include<ctype.h>
#include<iomanip>
#include<iostream>
#include<map>
#include<math.h>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<stdio.h>
#include<string>
#include<string>
#include<vector>

using namespace std;
typedef long long ll;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define pn(s) cout << (#s) << " " << (s) << endl
#define p_yes() p("Yes")
#define p_no() p("No")

const ll mod = 1e9 + 7;
const ll inf = 1e18;

template < typename T >
void vprint(T &V){
	for(auto v : V){
    	cout << v << " ";
	}
	cout << endl;
}

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

    // input
    int N;
    cin >> N;

    vector<ll> P(N);
    FOR(i, 0, N){
        ll p;
        cin >> p;
        p--;
        P[i] = p;
    }

    vector<ll> Q(N);
    FOR(i, 0, N){
        Q[P[i]] = i;
    }

    ll max_count = 1;
    ll count = 1;
    FOR(i, 0, N-1){
        if(Q[i]<Q[i+1]){
            count++;
            max_count = max(max_count, count);
        }else{
            count = 1;
        }
    }

    p(N-max_count);
    
    return 0;
}

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

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define ddrep(i, n) for (int i = n; i > 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define ssrep(i, s, t) for (int i = s; i <= t; ++i)

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))

using ll = long long;
using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using ld = long double;

long int M = 1e+7;
int main(void){
    int r;
    cin >> r;
    cout << r*6.28318 << endl;
    return 0;
}

Measured memory_bytes: 3776
#include <bits/stdc++.h>
using namespace std;
string str;
void solve()
{
    if (str=="AKIHABARA") cout<<"YES";
    else if (str=="KIHABARA"||str=="AKIHBARA"||str=="AKIHABRA"||str=="AKIHABAR") cout<<"YES";
    else if (str=="KIHBARA"||str=="KIHABRA"||str=="KIHABAR"||str=="AKIHBRA"||str=="AKIHBAR"||str=="AKIHABR") cout<<"YES";
    else if (str=="KIHBRA"||str=="KIHBAR"||str=="KIHABR"||str=="AKIHBR") cout<<"YES";
    else if (str=="KIHBR") cout<<"YES";
    else cout<<"NO";
    cout<<endl;
}
int main()
{
    while(cin>>str)
        solve();
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {
	static final long MOD = 1000000007;
	
	public static void main(String[] args) throws IOException {
		MyScanner sc = new MyScanner();
		PrintWriter out = new PrintWriter(System.out);
		int N = sc.nextInt();
		int M = sc.nextInt();
		char[] arr = sc.next().toCharArray();
		char first = arr[0];
		int minOdd = Integer.MAX_VALUE;
		int idx = 0;
		boolean firstPass = true;
		while (idx < M) {
			int cantFirst = 0;
			while (idx < M && arr[idx] == first) {
				cantFirst++;
				idx++;
			}
			if (idx < M) {
				if (firstPass && cantFirst % 2 == 0) cantFirst++;
				if (cantFirst % 2 == 1) {
					minOdd = Math.min(minOdd, cantFirst);
				}
				while (idx < M && arr[idx] != first) {
					idx++;
				}
			}
			firstPass = false;
		}
		long ans = 0;
		if (minOdd == Integer.MAX_VALUE) {
			long[][][] table = new long[2][2][N-1];
			
			table[0][1][0] = table[1][0][0] = table[0][0][0] = 1;
			for (int size = 1; size < N - 1; size++) {
				for (int i = 0; i < 2; i++) {
					for (int j = 0; j < 2; j++) {
						table[i][j][size] = table[0][j][size-1];
						if (i != 1) {
							table[i][j][size] += table[1][j][size-1];
							table[i][j][size] %= MOD;
						}
					}
				}
			}
			for (int i = 0; i < 2; i++) {
				for (int j = 0; j < 2; j++) if (i != 1 || j != 1) {
					ans += table[i][j][N - 2];
					ans %= MOD;
				}
			}
		} else if (N % 2 == 0) {
			int maxStep = (minOdd + 1) / 2;
			int tot = N / 2;
			long[] table = new long[tot + 1];
			long[] acum = new long[tot + 1];
			table[0] = 1;
			acum[0] = 1;
			for (int i = 1; i < tot; i++) {
				table[i] = (acum[i - 1] + MOD - (i - maxStep - 1 >= 0 ? acum[i - maxStep - 1] : 0)) % MOD;
				acum[i] = (acum[i - 1] + table[i]) % MOD;
			}
			for (int i = 1; i <= tot && i <= maxStep; i++) {
				ans += table[tot - i] * 2 * i;
				ans %= MOD;
			}
		}
		out.println(ans);
		
		out.flush();
	}
	
	static class MyScanner {
		private BufferedReader br;
		private StringTokenizer tokenizer;
		
		public MyScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}
		
		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}
		
		public int nextInt() {
			return Integer.parseInt(next());
		}
		
		public long nextLong() {
			return Long.parseLong(next());
		}
	}
}


Measured memory_bytes: 32248
#include<bits/stdc++.h>
using namespace std;
#define ll long long int 
int main()
{
    ll a=0,b=0,i,n,ans=0;
    cin>>n>>a>>b;
    i=n/(a+b);
    ans=i*a;
    i=n%(a+b);
    if(i<=a)
    cout<<ans+i;
    else
    cout<<ans+a;
}

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

using namespace std;

#define FastIO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

#define nl "\n"
#define sp " "
#define int long long
#define PI 3.141592653589793
#define scanstr(s) cin>>ws; getline(cin,s);

void solve()
{
	int n,m;
	cin>>n>>m;
	int s[m],c[m];
	for(int i=0;i<m;i++)
	{
		cin>>s[i]>>c[i];
	}
	for(int i=0;i<1000;i++)
	{
		string t=to_string(i);
		if(t.size()==n)
		{
			bool ok=true;
			for(int j=0;j<m;j++)
			{
				if(t[s[j]-1]!= '0'+c[j]) ok=false;
			}
			if(ok)
			{
				cout<<i<<endl;
				return ;
			}
		}
	}
	cout<<-1<<endl;
	return ;
}

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


Measured memory_bytes: 3720
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<map>
#include<queue>
#include<deque>
#include<iomanip>
#include<tuple>
using namespace std;
typedef long long int LL;
typedef pair<int,int> P;
typedef pair<LL,int> LP;
const int INF=1<<30;
const LL MAX=1e9+7;

void array_show(int *array,int array_n,char middle=' '){
	for(int i=0;i<array_n;i++)printf("%d%c",array[i],(i!=array_n-1?middle:'\n'));
}
void array_show(LL *array,int array_n,char middle=' '){
	for(int i=0;i<array_n;i++)printf("%lld%c",array[i],(i!=array_n-1?middle:'\n'));
}

string sa;

int main(){
	LL n,m;
	LL i,j,k;
	LL a,b,c;
	LL s=0;
	bool fir=true;
	cin>>sa;
	cin>>m;
	a=1,b=0;
	for(i=0;i<sa.size()-1;i++){
		if(sa[i]!=sa[i+1]){
			b+=a/2;
			if(fir){
				fir=false;
				s=b,b=0;
			}
			a=1;
		}else a++;
	}
	n=sa.size();
	if(sa[0]!=sa[n-1]){
		b+=a/2;
		s+=b;
		s*=m;
		cout<<s<<endl;
		return 0;
	}
	if(a==n){
		s=n*m/2;
		cout<<s<<endl;
		return 0;
	}
	s+=a/2;
	s+=b*m;
	for(i=0;i<sa.size();i++){
		if(sa[i]!=sa[n-1]){
			break;
		}else a++;
	}
	b=a/2;
	s+=b*(m-1);
	cout<<s<<endl;
}

Measured memory_bytes: 256
n,m,q=map(int,input().split())
train=[[0]*n for i in range(n)]
for i in range(m):
    l,r=map(int,input().split())
    train[l-1][r-1]+=1
for i in range(n):
    for j in range(n-1):
        train[i][j+1]+=train[i][j]
for i in range(q):
    p,q_=map(int,input().split())
    ans=0
    for j in range(p-1,q_):
        ans+=train[j][q_-1]
    print(ans)



Measured memory_bytes: 53336
/*************************************************************************
    > File Name: test.cpp
    > Author: Akira 
    > Mail: qaq.febr2.qaq@gmail.com 
 ************************************************************************/

#include<bits/stdc++.h>
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
#define MST(a,b) memset(a,b,sizeof(a))
#define CLR(a) MST(a,0)
#define Sqr(a) ((a)*(a))
using namespace std;

#define MaxN 100001
#define MaxM MaxN*10
#define INF 0x3f3f3f3f
#define PI 3.1415926535897932384626
const int mod = 1E9+7;
const double eps = 1e-6;
#define bug cout<<88888888<<endl;
#define debug(x) cout << #x" = " << x << endl;

int main()
{
    //std::ios::sync_with_stdio(false);
    LL N;
    scanf("%lld", &N);
    LL ans = 1;
    while(N)
    {
        ans*=N;
        if(ans>mod) ans%=mod;
        N--;
    }
    printf("%lld\n", ans);
    //system("pause");
}


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

using ll = long long;

#define for_(i,a,b) for(int i = (a);i < (b);i++)
#define rfor_(i,a,b) for(int i = (b)-1;i >= (a);i--)
#define rep(i,n) for_(i,0,(n))
#define rrep(i,n) rfor_(i,0,(n))

int N;

int S[100];
int k;

int main(){
  cin.tie(0);
  
  cin>>N;
  
  while(N) {
  	S[k] = (N%2+2)%2;
  	N -= S[k++];
  	N /= -2;
  }
  
  rrep(i, k)cout<<S[i];
  if(!k)cout<<0;
  cout<<endl;

  return 0;
}


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

int ri() {
	int n;
	scanf("%d", &n);
	return n;
}
#define MOD 1000000007
int main() {
	int n = ri();
	int a[n];
	for (auto &i : a) i = ri();
	
	std::vector<int> cnt(1 << 20);
	for (auto i : a) cnt[i]++;
	
	for(int i = 0; i < 20; i++)
		for(int j = 0; j < 1 << 20; j++) if (!(j >> i & 1)) cnt[j] += cnt[j | 1 << i];
	
	int beki2[n + 1];
	beki2[0] = 1;
	for (int i = 1; i <= n; i++) beki2[i] = beki2[i - 1] * 2 % MOD;
	
	int all = 0;
	for (int i = 0; i < 1 << 20; i++) {
		if (__builtin_popcount(i) & 1) all -= beki2[cnt[i]];
		else all += beki2[cnt[i]];
		if (all < 0) all += MOD;
		if (all >= MOD) all -= MOD;
	}
	std::cout << all << std::endl;
	
	return 0;
}





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

using namespace std;


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

    int n;
    cin >> n;
    vector<int> L(n);
    for (int i = 0; i < n; ++i) {
        cin >> L[i];
    }
    int cnt = 0;
    sort(L.begin(), L.end());
    for (int i = 0; i < n; ++i) {
        for (int j = i + 1; j < n; ++j) {
            for (int k = j + 1; k < n; ++k) {
                if (L[i] != L[j] && L[j] != L[k] && L[i] + L[j] > L[k])
                    cnt++;
            }
        }
    }
    cout << cnt << endl;
}

Measured memory_bytes: 3660
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define all(x) (x).begin(), (x).end()
using ll = long long;
using namespace std;
template <typename T> using vec = std::vector<T>;

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

    ll ans = 0;
    for (ll i = 1; i <= N; ++i) {
        ll g = (N/i)*(N/i+1)/2;
        ans+=i*g;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3604
#include<bits/stdc++.h>
using namespace std;
long long lcd(long long a,long long b){
  if(a<b) swap(a,b);
  while(b){
    long long temp = a%b;
    a = b;
    b = temp;
  }
  return a;
}
int main(){
  long long a,b;
  cin>>a>>b;
  cout<<a*b/lcd(a,b);
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
  
using namespace std;
  
template<class T> void ckmin(T &a, T b) { a = min(a, b); }
template<class T> void ckmax(T &a, T b) { a = max(a, b); }
  
#define pb push_back
#define mp make_pair
#define cotu cout
#define itn int
#define Red ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define F first
#define S second
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int i = 0; i < n; ++i)
#define repr(i,n) for(int i = n - 1; i >= 0; --i)
#define Rep(i, a, n) for(int i = (a); i <=(n); ++i)
#define repst(i, n) for(auto it = n.begin(); it != n.end(); ++it)
#define Repr(i, a, n) for(int i = (n); i >= (a); --i)
  
#define ordered_set tree<int , null_type,less<int >, rb_tree_tag,tree_order_statistics_node_update> 
  
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
  
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
  
const int inf = int(1e9);
const int mod = inf + 7;
const int N = 1e6 + 555; // TL MB
const double PI = acos(-1.0);
 
void mul(ll &x, ll y){
	x *= y;
	if(x >= mod) x %= mod;
}
 
void add(ll &x, ll y){
	x += y;
	if(x >= mod) x -= mod;
	if(x < 0) x += mod;
}
ll bp(ll a, ll n){
	ll r = 1;
	while(n){
		if(n & 1) mul(r, a);
		mul(a, a);
		n >>= 1;
	}
	return r;
}


void solve()
{	
	int n, m;
	cin >> n >> m;
	if(n < m) swap(n, m);
	if(abs(n - m) > 1){
		cout << 0;
	}
	else{
		int div = n / 2;
		ll ans = 1;
		if(abs(n - m) == 0){
			ans *= 2;
			for(int i = 0; i < n; ++i){
				ans *= 1ll * (n - i);
				ans %= mod;
				ans *= 1ll * (m - i);
				ans %= mod;
			}
		}
		else{
			for(int i = 0; i < n; ++i){
				ans *= 1ll * (n - i);
				ans %= mod;
				if(m - i) ans *= 1ll * (m - i);
				ans %= mod;
			}
		}
		cout << ans << '\n';
	}
}


 
 
int main()
{
 //	freopen("sparse.in", "r", stdin);
	//freopen("sparse.out", "w", stdout);
	   Red;
  	//int T; cin >> T; while(T--)
    solve();
    return 0;
}

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

# 1 "<stdin>"
# 1 "<built-in>"
# 1 "<command-line>"
# 31 "<command-line>"
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 32 "<command-line>" 2
# 1 "<stdin>"

using namespace std;

# 1 "../Algo/NumberTheory/modulo.h" 1
class ModuloOps {
public:
    ModuloOps(long long mod): MOD(mod) {
    }

    long long binPow(long long a, long long b) {
        if (b == 0) {
            return 1;
        }
        auto prev = binPow(a, b/2);
        return mul(mul(prev, prev), b % 2 == 1 ? a : 1);
    }

    long long inv(long long a) {
        return binPow(a, MOD - 2);
    }

    inline long long add(long long a, long long b) {
        return (a + b) % MOD;
    }

    inline long long sub(long long a, long long b) {
        return (a - b + MOD) % MOD;
    }

    inline void inc(long long &a, long long b) {
        a = add(a, b);
    }

    inline long long mul(long long a, long long b) {
        return (a * b) % MOD;
    }

    inline long long div(long long a, long long b) {
        return mul(a, inv(b));
    }

private:
    long long MOD;
};
# 5 "<stdin>" 2

ModuloOps MOD(1e9 + 7);

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    int n, k;
    cin >> n >> k;
    vector<long long> mem(k+1);
    long long ans = 0;
    for (int i = k; i > 0; i--) {
        long long cur = MOD.binPow(k/i, n);
        for (int j = 2; j*i <= k; j++) {
            cur = MOD.sub(cur, mem[j*i]);
        }
        mem[i] = cur;
        ans = MOD.add(ans, MOD.mul(cur, i));
    }
    cout << ans << endl;
}


Measured memory_bytes: 3968
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author champon
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define inf 1e18
#define ceill(a, b) (a+b-1)/b
#define ok cout << "ok" << endl;
#define sp << " " <<
ll mod = 1e9+7;
void ans(bool b, ostream& out=cout){ out << (b ? "Yes" : "No") << endl; }
void ans2(bool b, ostream& out=cout){ out << (b ? "YES" : "NO") << endl; }
template<typename T> inline bool chmax(T &a, T b){ if(a<b) a=b; return a<b; }
template<typename T> inline bool chmin(T &a, T b){ if(b<a) a=b; return b<a; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val){fill((T*)array, (T*)(array+N), val);}
int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy[] = {0, 1, 0, -1, 1, -1, -1, 1};

#ifndef INCLUDE_DEBUG_HPP
#define INCLUDE_DEBUG_HPP

class debug
{
public:
    template<typename T> void vdeb(T vec);
    template<typename T1, typename T2> void adeb(T1 *arr, T2 n);
    template<typename T> void mdeb(T mp);
};

#endif //INCLUDE_DEBUG_HPP

template<typename T> void debug::vdeb(T vec)
{
    cout << "#vector set debug" << endl;
    for(auto vv : vec) cout << vv << " ";
    cout << endl;
}

template<typename T1, typename T2> void debug::adeb(T1 *arr, T2 n)
{
    cout << "#adebug" << endl;
    for(int i=0; i<=n; i++) cout << arr[i] << " ";
    cout << endl;
}

template<typename T> void debug::mdeb(T mp)
{
    cout << "#map pair debug" << endl;
    for(auto const& m : mp) cout << m.first sp m.second << endl;
}
debug dbg;

class BPostalCode {
public:
	void solve(std::istream& in, std::ostream& out)
	{
	    int a, b;
	    in >> a >> b;
	    string s;
	    in >> s;

	    bool res = true;
	    for(int i=0; i<a; i++){
	        if(s[i] < '0' || '9' < s[i]) res = false;
	    }
	    if(s[a] != '-') res = false;
        for(int i=a+1; i<=a+b; i++){
            if(s[i] < '0' || '9' < s[i]) res = false;
        }

	    ans(res, out);
	}
};


int main() {
	BPostalCode solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


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

int n;

int main(){

    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    cin>>n;
    for(int i=0;i<=50000;i++){
        if((int(i*(double)1.08))==n){
            cout<<i<<endl;
            return 0;
        }
    }
    cout<<":("<<endl;

    return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <fstream>
#include <set>
#include <utility>
#include <algorithm>
#include <queue>
#include <stack>
#include <deque>
#include <numeric>
#include <sstream>
#include <list>
#include <map>
#include <stdlib.h>
#include <time.h>

#define rep(i,p,n) for(int i=(int)p;i<(int)n;i++)
#define repp(i,p,n) for(int i=(int)p;i>=(int)n;i--)
#define Sort(x) sort(x.begin(),x.end());
#define ll long long
#define INF 2000000000

using namespace std;

int main() {
	int n;
	cin >> n;
	vector<ll> a(n), b(n), c(n);
	rep(i, 0, n)cin >> a[i];
	rep(i, 0, n)cin >> b[i];
	rep(i, 0, n)cin >> c[i];
	Sort(a);
	Sort(c);
	ll ans = 0;
	rep(i, 0, n) {
		ll up = lower_bound(a.begin(), a.end(), b[i]) - a.begin();
		ll down = n-(upper_bound(c.begin(), c.end(), b[i]) - c.begin());
		//cout << up << " " << down << endl;
		ans += up*down;

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



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

int main(){
    using namespace std;
    long N, L;
    cin >> N >> L;
    if(L + N <= 0){
        cout << (N - 1) * (2 * L + N - 2) / 2 << endl;
    }else if(L < 0){
        cout << N * (2 * L + N - 1) / 2 << endl;
    }else{
        cout << (N - 1) * (2 * L + N) / 2 << endl;
    }
    return 0;
}

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

using namespace std;

#define YES cout << "YES" << endl;
#define NO  cout << "NO"  << endl;
#define Yes cout << "Yes" << endl;
#define No  cout << "No"  << endl;
 
#define INF INT_MAX
#define MOD 1000000007
#define PI  acos(-1)

using ll  = long long;
using ull = unsigned long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define rrep(i, n) for (ll i = (n)-1; i >= 0; i--)

int main(int argc, char *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    string S;
    cin >> S;

    bool flag = false;
    rep (i, S.size()) {
        if (i%2 == 0) {
            if (S[i] == 'R' || S[i] == 'U' || S[i] == 'D') {
                ;
            } else {
                flag = true;
                break;
            }
        } else {
            if (S[i] == 'L' || S[i] == 'U' || S[i] == 'D') {
                ;
            } else {
                flag = true;
                break;
            }
        }
    }

    if (flag) {
        No;
    } else {
        Yes;
    }
    return 0;
}

Measured memory_bytes: 256
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <limits>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x * x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18

int main() {

	LL h, w, a, b; cin >> h >> w >> a >> b;

	for (int i = 0; i < h; i++) {
		if (0 <= i && i < (h - b)) {
			for (int j = 0; j < w; j++) {
				if (0 <= j && j < a) {
					cout << '1';
				}
				else {
					cout << '0';
				}
			}

			cout << endl;
			
		}
		else {
			for (int j = 0; j < w; j++) {
				if (0 <= j && j < a) {
					cout << '0';
				}
				else {
					cout << '1';
				}
			}

			cout << endl;
		
		}
		
	}
	
	return 0;
}

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

using namespace std;

using ll = long long;
using ld = long double;

const double PI = 3.1415926535897932384626433832795;

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

int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
int lcm(int x, int y) { return x / gcd(x, y) * y; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }

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

	const int V_MAX = 100000;

	int n;
	cin >> n;

	vector<int> odd(V_MAX + 1), even(V_MAX + 1);
	for (int i = 0; i < n; i++) {
		int x;
		cin >> x;
		if ((i + 1) & 1) {
			odd[x]++;
		} else {
			even[x]++;
		}
	}

	int ma = INT_MIN, sec = 0, pos = 0;
	for (int i = 1; i <= V_MAX; i++) {
		if (even[i] > ma) {
			sec = ma;
			ma = even[i];
			pos = i;
		} else {
			sec = max(sec, even[i]);
		}
	}

	int ans = 0;
	for (int i = 1; i <= V_MAX; i++) {
		ans = max(ans, odd[i] + (i == pos ? sec : ma));
	}

	ans = n - ans;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 1148
package main

import "fmt"

func main() {
  var a, b, k int
  fmt.Scan(&a, &b, &k)
  var ans int
  for i := 100; k > 0; i-- {
    if a%i == 0 && b%i == 0 {
      ans = i
      k--
    }
  }
  fmt.Println(ans)
}


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

#define FastIO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define nl "\n"
#define sp " "
#define int long long
#define PI 3.141592653589793
#define scanstr(s) cin>>ws; getline(cin,s);

int32_t main()
{
	FastIO;
	int n;
	cin>>n;
	int a[n];
	for(int i=0;i<n;i++) cin>>a[i];
	sort(a,a+n,greater<int>());
	int ok=0;
	vector<int> p(2);
	int ans=1;
	for(int i=0;i<n;i++)
	{
		if(a[i]==a[i+1])
		{
			ans*=a[i];
			i++;
			ok++;
		}
		if(ok==2) break;
	}
	if(ok==2)
	{
		cout<<ans<<nl;
	}
	else cout<<"0\n";
}


Measured memory_bytes: 4412