akhauriyash/Code-Regression huggingface dataset:
n = int(input())
count = 0
checker = 0
while count<n:
    d1,d2 = list(map(int, input().split()))
    count += 1
    if d1==d2:
        checker += 1
        if checker ==3:
            print("Yes")
            exit()
    else:
        checker = 0
print("No")


Measured memory_bytes: 9120
fun main(args: Array<String>) {
    a83(readLineList())
}

fun readLineList(): Array<String> {
    val lineList = mutableListOf<String>()
    while (true) {
        val line = readLine()
        if (line.isNullOrBlank()) {
            break
        } else {
            lineList.add(line!!)
        }
    }
    return lineList.toTypedArray()
}

fun a83(args: Array<String>) {
    if (args.size != 1) {
        throw IllegalArgumentException()
    }
    val numList = args[0].split(" ").map { it.toInt() }
    val left = numList.take(2).sum()
    val right = numList.takeLast(2).sum()
    println(when {
        left > right -> "Left"
        left < right -> "Right"
        else -> "Balanced"
    })
}

Measured memory_bytes: 38180
import fractions
A, B, C, D = map(int, input().split())

all_pattern = B - (A - 1)
mul_c = B // C - (A - 1) // C
mul_d = B // D - (A - 1) // D
l = C * D // fractions.gcd(C, D)
mul_gcd = B // l - (A - 1) // l

res = all_pattern - mul_c - mul_d + mul_gcd
print(res)

Measured memory_bytes: 64620
#include <bits/stdc++.h>
using namespace std;
//mt19937 mrand(chrono::high_resolution_clock::now().time_since_epoch().count());
//int rnd(int x) { return mrand()%x;}
typedef long long ll;
ll gcd(ll a,ll b){return b==0?a:gcd(b,a%b);}
int a[200200];
int main(){
	int n;
	scanf("%d",&n);
	for(int i=2;i<=n;i++){
		int x;
		scanf("%d",&x);
		a[x]++;
	}
	for(int i=1;i<=n;i++){
		printf("%d\n",a[i]);
	}
	return 0;
}


Measured memory_bytes: 4492
#include <iostream>
#include <vector>
#include <algorithm>
#include <limits.h>

using namespace std;

int main()
{
	int N, K;
	cin >> N >> K;
	vector<long> h(N);
	for (int i = 0; i < N; i++)
	{
		cin >> h[i];
	}
	
	// 昇順ソート
	sort(h.begin(), h.end());
	
	long answer = LONG_MAX;
	// 0番目とK-1番目の差
	// 1番目とK番目の差
	// 2番目とK+1番目の差
	// N - K + 1通り試す
	for (int i = 0; i < N - K + 1; i++)
	{
		int left = i;
		int right = i + K - 1;
		long height = h[right] - h[left];
		answer = min(height, answer);
	}
	
	cout << answer << endl;
	
	return 0;
}

Measured memory_bytes: 1024
#include<iostream>
using namespace std;
int main(){
	int W,H,x,y,r;
	cin >> W >> H >> x >> y >> r;
	if((y-r >= 0 && x-r >= 0) && (y+r <= H && x+r <= W)){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
	return 0;
}

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

int N;


int main() {
    cin >> N;
    int memo[101010];
    fill(memo, memo+101010, 0);
    for (int j = 0; j < N; ++j) {
        int a, b;
        cin >> a >> b;
        ++memo[a];
        --memo[b+1];
    }
    int ret = 0;
    for (int j = 2; j < 101010; ++j) {
        memo[j] += memo[j-1];
        if (memo[j] >= j-1) {
            ret = max(ret, j-1);
        }
    }
    cout << ret << endl;
    return 0;
}

Measured memory_bytes: 3504
#include<iostream>
using namespace std;
long int ans,i,j,k,n;
int arr[100001][3],memo[100001][3]={0};
int dp(long int n)
{
	memo[0][0]=arr[0][0];
	memo[0][1]=arr[0][1];
	memo[0][2]=arr[0][2];
	for(i=1;i<n;i++)
	{
		for(j=0;j<3;j++)
		{
			for(k=0;k<3;k++)
			{
				if(k==j)
					continue;
				else
					memo[i][j]=max(memo[i][j],memo[i-1][k]+arr[i][j]);
			}
		}
	}
}
int main()
{
	cin>>n;
	for(i=0;i<n;i++)
	{
		cin>>arr[i][0]>>arr[i][1]>>arr[i][2];
	}
	dp(n);
	ans=max(memo[n-1][0],max(memo[n-1][1],memo[n-1][2]));
	cout<<ans;

}

Measured memory_bytes: 2560
import math
n, h = map(int, input().split())

a_max = 1
b = [0] * n
tmp = 0
for i in range(n):
  tmp, b[i] = map(int, input().split())
  if a_max < tmp: a_max = tmp
    
b.sort(reverse = True)
sum_b = 0
cnt_swing = 0
cnt_throw = 0
cnt_min = 10 ** 9
for i in range(n):
  sum_b += b[i]
  cnt_swing = i+1
  if h - sum_b <= 0:
    cnt_throw = 0
  else:
    cnt_throw = int(math.ceil((h-sum_b) / a_max))
  if cnt_swing + cnt_throw < cnt_min:
    cnt_min = cnt_swing + cnt_throw
    
    
print(cnt_min)

Measured memory_bytes: 7472
//{{{
#include<algorithm>
#include<cmath>
#include<fstream>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<random>
#include<set>
#include<sstream>
#include<sys/time.h>
#include<unordered_map>
#include<unordered_set>
#include<vector>
using ll = long long;
enum : int { M = (int)1e9 + 7 };
enum : ll { MLL = (ll)1e18L + 9 };
using namespace std;
#ifdef LOCAL
#include"rprint2.hpp"
#else
#define FUNC(name) template <ostream& out = cout, class... T> void name(T&&...){ }
FUNC(prints) FUNC(printw) FUNC(printwe) FUNC(printb) FUNC(printbe) FUNC(printd) FUNC(printde) FUNC(printdu);
#endif
template <class S, class T>
istream& operator >> (istream& in, pair<S, T>& p){ return in >> p.first >> p.second; }
template <class T>
istream& operator >> (istream& in, vector<T>& v){ for(auto& e : v){ in >> e; } return in; }
//}}}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    vector<int> as(n); cin >> as;
    ll l = 0, r = 1e9 + 1;
    vector<int> ans(n);
    while(l < r){
        ans.clear();
        ans.resize(n);
        int piv = (l + r) / 2;
        auto as2 = as;
        int next = piv;
        int i = 0;
        as.back() -= piv;
        for(; i < n; i++){
            ans[i] = next * 2;
            next = as[i] - next;
            if(next < 0){
                break;
            }
        }
        as.back() += piv;
        printde(i, ans);
        if(next == 0){
            break;
        }
        if(i & 1){
            l = piv + 1;
        }else{
            r = piv;
        }
        printde(l, r);
    }
    for(int i = 0; i < n; i++){
        cout << ans[i] << " \n"[i == n - 1];
    }
}


Measured memory_bytes: 2424
#include<bits/stdc++.h>
using namespace std;
#define rg register
#define rep(i,a,b) for (rg int i=(a);i<=(b);i++)
#define per(i,a,b) for (rg int i=(b);i>=(a);i--)
#define pb push_back
#define lowbit(x) (x&(-x))
#define mk make_pair
#define VI vector<int>
#define pii pair<int,int>
#define pLL pair<long long,long long>
#define fi first
#define se second
#define il inline
#define ll long long
#define db double
#define ld long double
#define inf 0x3f3f3f3f
#define getc() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<15,stdin),p1==p2)?EOF:*p1++)
char buf[1<<15],*p1 = buf,*p2 = buf;
inline ll read(){
    #define num ch-'0'
    char ch;bool flag=0;ll res;
    while(!isdigit(ch=getc()))
    (ch=='-')&&(flag=true);
    for(res=num;isdigit(ch=getc());res=res*10ll+num);
    (flag)&&(res=-res);
    #undef num
    return res;
}
inline void write(ll x){
	if (x < 0) x = ~x + 1ll, putchar('-');
	if (x > 9) write(x / 10ll);
	putchar(x % 10ll + '0');
}
#define mid ((l + r)>>1)
#define ls (x<<1)
#define rs ((x<<1)|1)
#undef mid
#undef ls
#undef rs
void solve()
{
	ll S = read();
	int res1,res2;
	res1 = res2 = (int)sqrt(S);
	while(S>1ll*res1*res2)
	{
		if(res1>res2) res2++;
		else res1++;
	}
	ll tmp = 1ll*res1*res2-S;
	for(ll i = 1;i<=sqrt(tmp);i++)
	{
		if(tmp%i==0)
		{
			if(i<=1e9 && (tmp/i) <= 1e9)
			{
				printf("0 0 %d %d %d %d",res1,i,tmp/i,res2);
				return;
			}
		}
	}
	printf("0 0 %d 0 0 %d",res1,res2);
}
int main()
{
	#ifndef ONLINE_JUDGE
	freopen("data.txt","r",stdin);
	#endif
//	int T = read();
//	while(T--)
	solve();
}

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

int main(){
    int N, M;
    cin >> N >> M;
    int p[M];
    string S[M];
    int clear_list[N*2] = {0};
    int clear=0;
    int penalty=0;
    
    for(int i = 0; i < M; i++){
        cin >> p[i] >> S[i];
        //        cout << p[i] << S[i] << endl;
    }
    for(int i = 0; i < M; i++){
        if(clear_list[p[i]] == 0){
            if(S[i] == "WA"){
                penalty++;
            }
            else{
                clear++;
                clear_list[p[i]] = 1;
            }
        }
    }
    for(int i = 0; i < M ;i++){
        if(clear_list[p[i]] == 0 && S[i] == "WA"){
            penalty--;
        }
    }
    cout << clear << " " << penalty << endl;
    return 0;
}



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

int main()
{
  int n,h,m,s;
  cin >> n;
  h = n/60/60;
  n=n%3600;
  m = n/60;
  s = n%60;
  cout << h << ':' << m << ':' << s << endl;
  return 0;
}

Measured memory_bytes: 1160
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
 
public class Main {
 
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
 
		int n = Integer.parseInt(br.readLine());
 
		if (n == 0) {
			System.out.println(0);
			return;
		}
 
		List<Integer> list = new ArrayList<>();
		while (n != 1) {
			if (n < 0) {
				list.add(-n % 2);
				n = (-n + 1) / 2;
			} else {
				list.add(n % 2);
				n = -(n / 2);
			}
		}
		System.out.print(1);
		Collections.reverse(list);
		for (int i : list) {
			System.out.print(i);
		}
		System.out.println();
	}
}

Measured memory_bytes: 23124
N, M = map(int, input().split())
T = {i: 0 for i in range(N+1)}
for i in range(M):
    l, r = map(int, input().split())
    T[l-1] += 1
    T[r] -= 1

for i in range(1, N):
    T[i] += T[i-1]

ans = 0
for i in range(N):
    if T[i] == M:
        ans += 1
print(ans)


Measured memory_bytes: 15592
#include <bits/stdc++.h>
// M - Candies

#define MOD 1000000007

using namespace std;

int dp[105][100005];
int psa[105][100005];

int main() {
    int N,K,i,j,temp,a;

    scanf("%d%d",&N,&K);

    dp[0][0] = 1;
    for (i = 0;i <= K;i++)
        psa[0][i] = 1;

    for (i = 1;i <= N;i++) {
        scanf("%d",&a);

        temp = 0;
        for (j = 0;j <= K;j++) {
            if (j - a - 1 < 0)
                dp[i][j] = psa[i - 1][j];
            else
                dp[i][j] = ((psa[i - 1][j] - psa[i - 1][j - a - 1]) % MOD + MOD) % MOD;

            temp += dp[i][j];
            temp %= MOD;

            psa[i][j] = temp;
        }
    }

    printf("%d\n",dp[N][K]);

    return 0;
}


Measured memory_bytes: 82176
#include <bits/stdc++.h>
#define INF 2e9
#define MOD 1000000007
using namespace std;
typedef long long llong;
typedef long double ldouble;

using Graph = vector<vector<int>>;

// int ctoi(const char c){
//   if('0' <= c && c <= '9') return (c-'0');
//   return -1;
// }

// int gcd(int a, int b){
//   int ma = max(a,b);
//   int mi = min(a,b);
//   if(mi == 0) return ma;

//   return gcd(mi, ma%mi);
// }

int main(){
  llong ans = 0;
  llong N, K;
  cin >> N >> K;
  for(llong i=0; i<K; ++i){
    ans += N-i;
    ans -= i;
    ans %= MOD;
  }
  ++ans;
  llong sum = ans;
  for(llong i=K; i<N+1; ++i){
    sum += N-i;
    sum -= i;
    sum %= MOD;
    ans += sum;
    ans %= MOD;
  }
  if(ans < 0) ans += MOD;
  cout << ans % MOD << endl;
}

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

using ll = long long;
using pii = pair<int, int>;
template <class T>
using v = vector<T>;
template <class T>
using vv = v<v<T>>;
#define ALL(c) (c).begin(), (c).end()

int main()
{
    int K, N;
    cin >> N >> K;
    v<int> D(K, -1), R;
    for (int i = 0; i < 10; i++)
        R.push_back(i);

    for (int i = 0; i < K; i++)
    {
        int a;
        cin >> a;
        D[i] = a;
        R[a] = -1;
    }
    int ans = 0;
    int i = 0;

    for (int i = N; i < N * 10; i++)
    {
        int G = i;
        bool f = true;
        while (G >= 1)
        {
            int mod = G % 10;
            G = G / 10;
            if (find(ALL(D), mod) != D.end())
                f = false;
        }

        if (f)
        {
            ans = i;
            break;
        }
    }

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

Measured memory_bytes: 3564
function Main(input) {
  var sum = 0;
  var last = 1;
  while(input!=1){
    input = Math.floor(input/2);
    sum += last;
    last*=2
  }
  sum+=last
  console.log(sum)
}Main(require("fs").readFileSync("/dev/stdin", "utf8").trim());


Measured memory_bytes: 7372
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const int INF=1e9;

vector<int> G[10000];
int c[10000],num[10000],cnt;

void dfs(int v){
    num[v]=c[cnt++];
    for(int u:G[v]){
        if(num[u]==0){
            dfs(u);
        }
    }
}

int main(){
    int n;
    cin>>n;
    pair<int,int> p[n];
    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=0;
    for(int i=0;i<n;i++){
        cin>>c[i];
        ans+=c[i];
    }
    sort(c,c+n,greater<int>());
    ans-=c[0];
    dfs(0);
    cout<<ans<<endl;
    for(int i=0;i<n;i++){
        if(i)cout<<" ";
        cout<<num[i];
    }
    cout<<endl;
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
#define int long long
#define double long double
using namespace std;
const int MOD = 1000000007;
const int INF = 1e12;
using Graph = vector<vector<int>>;

signed main(){
  int N;
  cin >> N;
  vector<int> A(N);
  for( int i = 0; i < N; i++ ) cin >> A[i];
  vector<int> R(N+1, 0);
  for( int i = 0; i < N; i++ ) R[i+1] = (A[i]+R[i]);
  int ans = 0;
  for( int i = 0; i < N; i++ ){
    int b = (R[N]-R[i+1]);
    b %= MOD;
    int tasu = A[i]*b;
    tasu %= MOD;
    ans += tasu;
    ans %= MOD;
  }
  cout << ans%MOD << endl;

}


Measured memory_bytes: 6368
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
ll MOD = 1000000007;

int main() {
  ll N,M;
  cin >> N >> M;
  vector<ll> H(N);
  ll ans = 0;
  rep(i,N){
    cin >> H.at(i);
  }
  vector<vector<ll>> G(N);
  rep(i,M){
    ll a,b;
    cin >> a >> b;
    a--;b--;
    G.at(a).push_back(b);
    G.at(b).push_back(a);
  }
  rep(i,N){
    bool flag = true;
    for(ll h:G.at(i)){
      if(H.at(i) <= H.at(h)){
        flag = false;
      }
    }
    if(flag){
      ans++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 9852
s = gets.chomp.split("").map(&:to_i)
n = s.size
ans = 0
_p = 2019

h = Hash.new(0)
digit = 1
tmp = 0
(n-1).downto(0) do |i|
    tmp += s[i] * digit % _p
    h[tmp % _p] += 1
    digit *= 10
    digit %= _p
end

h.each do |key, value|
    ans += value * (value-1) / 2 if 2 <= value
end

puts ans + h[0]

Measured memory_bytes: 26516
n, L, *a = map(int, open(0).read().split())

cant = 0
for i in range(n-1):
    if a[i]+a[i+1]>=L:
        l, r = i, i+1
        break
else: cant = 1

if cant: print("Impossible")
else:
    print("Possible")
    for i in range(l): print(i+1)
    for i in range(n-2, l-1, -1): print(i+1)

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

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

typedef long long ll;

using namespace std;
int main()
{
    ll N, K;
    string S;
    cin >> N >> K;
    cin >> S;

    ll ans = 0;
    ll countR = 0, countL = 0;
    ll countRL= 0;
    bool rFlag = false, lFlag = false;
    REP(i, N)
    {
        if (S[i] == 'R')
        {
            if (lFlag)
            {
                lFlag = false;
                rFlag = true;
                ans += countL - 1;
                countL = 0;
                countR = 1;
            }
            else
            {
                countR++;
                rFlag = true;
            }
        }
        else if (S[i] = 'L')
        {
            if (rFlag)
            {
                rFlag = false;
                lFlag = true;
                ans += countR - 1;
                countR = 0;
                countL = 1;
                countRL++;
            }
            else
            {
                countL++;
                lFlag = true;
            }
        }
    }

    if (rFlag)
    {
        ans += countR - 1;
    }
    else if (lFlag)
    {
        ans += countL - 1;
    }

    if (countRL + 1 <= K)
    {
        ans = N - 1;
    }
    else
    {
        ans += 2 * K;
    }

    cout << ans << endl;
}


Measured memory_bytes: 512
#include<stdio.h>
int main(void)
{
	int l,r,d,i,n=0;
	scanf("%d%d%d",&l,&r,&d);
	for(i=0;i<=r;i+=d){
		if(l<=i&&r>=i){
			n++;
		}
	}
	printf("%d\n",n);
	return 0;
}

Measured memory_bytes: 1708
#include<bits/stdc++.h>
using namespace std;
string s;
int n,d,c;
int main()
{
    cin>>n>>s;
    for(int i=0; s[i]; i++)
    {
        if(s[i]=='(')c++;
        else c--;
        d=min(d,c);
    }
    for(int i=0; i<-d; i++)cout<<"(";
    cout<<s;
    for(int i=0; i<c-d; i++)cout<<")";
    return 0;
}


Measured memory_bytes: 256
package main

import (
  "fmt"
)

func main() {

  var m, d int

  fmt.Scan(&m, &d)

  var result int
  for i:=1; i<=m; i++ {
    for j:=1; j<=d; j++ {
      if j>=10 && (j/10) >= 2 && (j%10) >= 2 && ((j/10) * (j%10) == i) {
        result += 1
      }
    }
  }
  fmt.Println(result)
}

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

template<class T>
T gcd(T a, T b) {
    if (a < b) swap(a, b);
    if (b == 0) return a;
    return gcd(b, a%b);
}

template< typename T >
void divisor(T n, vector<T>& divisors) {
    T root_n = (T)sqrt(n);
    for (int i = 1; i <= root_n; ++i) {
        if (n % i == 0) {
            divisors.push_back(i);
            if (n / i != i) divisors.push_back(n / i);
        }
    }
}

int main() {
    ll A, B;
    cin >> A >> B;
    vector<ll> divisors;
    divisor(gcd(A, B), divisors);
    vector<ll> primes;
    sort(divisors.begin(), divisors.end());
    for (const auto & item : divisors) {
        bool prime = true;
        // 1は後回し
        if (item == 1) continue;
        for (const auto & p : primes) {
            if (item % p == 0) {
                prime = false;
                break;
            }
        }
        if (prime) {
            primes.push_back(item);
        }
    }
    cout << primes.size() + 1 << endl;
}


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

template<typename T> T gcd(T a, T b) {
    if(!b) return a;
    return gcd(b, a % b);
}
template<typename T> T lcm(T a, T b) {
    return a * b / gcd(a, b);
}

template<typename T> void chmin(T& a, T b) { a = (a > b) ? b : a; }
template<typename T> void chmax(T& a, T b) { a = (a < b) ? b : a; }
int in() { int x; scanf("%d", &x); return x; }

using namespace std;

typedef long long Int;
typedef unsigned uint;

const double PI = acos(-1.0);

double X, Y, P;
int D, A;

int main(void) {
	X = 0.0;
	Y = 0.0;
	P = 90.0;

	for ( ; scanf("%d,%d", &D, &A) == 2 && !(A == 0 && D == 0); ) {
		X = X + cos(P * PI / 180) * D;
		Y = Y + sin(P * PI / 180) * D;
		P -= A;
	}
	printf("%d\n%d\n", (int) X, (int) Y);
    return 0;
}

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

int main(void)
{
    int w,h,x,y,r;
    string ans;
    
    cin >> w >> h >> x >> y >> r;
    
    ans="No";
    if ((x-r)>=0 && (x+r)<=w && (y-r)>=0 && (y+r)<=h)
        ans="Yes";

    cout << ans << endl;
}



Measured memory_bytes: 3200
#include <iostream>
#include <vector>
#include <algorithm>

int main(void){
  int N;
  int temp;
  int f,r;
  std::vector <int> v;
  std::cin >> N;
  for(int i=0;i<N;i++){
    std::cin >> temp;
    v.push_back(temp);
  }
  // Sort
  std::sort(v.begin(),v.end());
  for(int i=0;i<N-1;i++){
    f=v[i];
    r=v[i+1];
    if(f==r){
      std::cout << "NO" << std::endl;
      return 0;
    }
  }
  std::cout << "YES" << std::endl;
  return 0;
}


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

int main(){
  ll a,b,k;
  cin>>a>>b>>k;
  for(int i=0;i<k;i++){
    if(i%2==0){
      if(a%2){
        a--;
      }
      b+=a/2;
      a/=2;
    }else{
      if(b%2){
        b--;
      }
      a+=b/2;
      b/=2;
    }
  }
  cout<<a<<" "<<b;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#define _USE_MATH_DEFINES
#include<math.h>
#include<queue>
#include<deque>
#include<stack>
#include<cstdio>
#include<utility>
#include<set>
#include<list>
#include<cmath>
#include<stdio.h>
#include<string.h>
#include<iomanip>
#include<cstdio>
#include<cstdlib>
#include<cstring>
using namespace std;
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define REP(i, n) FOR(i, 0, n - 1)
#define NREP(i, n) FOR(i, 1, n)
using ll = long long;
using pii = pair<int, int>;
using piii = pair<pii, pii>;
const ll dx[4] = { 0, -1, 1, 0 };
const ll dy[4] = { -1, 0, 0, 1 };
const int INF = 1e9 + 7;
int gcd(int x, int y) {
	if (x < y)swap(x, y);
	if (y == 0)return x;
	return gcd(y, x%y);
}
void mul(ll a, ll b) {
	a = a * b % INF;
}
double mysqrt(double x) {
	double l = 0, r = x;
	for (int i = 0; i < 64; ++i) {
		double m = (l + r) / 2.0;
		if (m*m < x)l = m;
		else r = m;
	}
	return l;
}
///////////////////////////////////////

int main() {
	int N;
	cin >> N;
	int sum = 0;
	while (N > 0) {
		sum += N % 10;
		N /= 10;
	}
	if (sum == 1) {
		cout << 10 << endl;
	}
	else {
		cout << sum << endl;
	}
	return 0;
}

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

#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep1(i, n) for (ll i = 1; i < (ll)(n); i++)
#define INF 1000000000000
#define MOD 1000000007
using ll = long long;


int main(){
  int n,a;
  cin >> n >> a;
  vector<int> x(n);
  int M = 0;
  rep(i,n){
    cin >> x.at(i);
    M = max(M,x.at(i));
  }
  vector<vector<vector<ll>>> dp(55, vector<vector<ll>>(55, vector<ll>(2600, 0)));

  for(int j = 0; j <= n; j++){
    for(int k = 0; k <= j; k++){
      for(int s = 0; s <= j*M; s++){
        if(j==0&&k==0&&s==0)dp.at(j).at(k).at(s)=1;
        else if(j>=1&&x.at(j-1)>s)dp.at(j).at(k).at(s)=dp.at(j-1).at(k).at(s);
        else if(j>=1&&k>=1&&s>=x.at(j-1))dp.at(j).at(k).at(s)=dp.at(j-1).at(k).at(s)+dp.at(j-1).at(k-1).at(s-x.at(j-1));
        else dp.at(j).at(k).at(s)=0;
        //cout<<dp.at(j).at(k).at(s)<<endl;
      }
    }
  }
  ll ans = 0;
  for(int i = 1; i <= n; i++)ans += dp.at(n).at(i).at(i*a);
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 62976
#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <complex>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <bitset>
#include <ctime>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cassert>
#include <cstddef>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <sstream>
#include <fstream>
#include <functional>

using namespace std;
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define RREP(i, a) for(int (i) = (a) - 1; (i) >= 0; (i)--)
#define FORR(i, a, b) for(int (i) = (a) - 1; (i) >= (b); (i)--)
#define DEBUG(C) cerr << #C << " = " << C << endl;
using LL = long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<LL>;
using VVL = vector<VL>;
using VD = vector<double>;
using VVD = vector<VD>;
using PII = pair<int, int>;
using PDD = pair<double, double>;
using PLL = pair<LL, LL>;
using VPII = vector<PII>;
template<typename T> using VT = vector<T>;
#define ALL(a) begin((a)), end((a))
#define RALL(a) rbegin((a)), rend((a))
#define SORT(a) sort(ALL((a)))
#define RSORT(a) sort(RALL((a)))
#define REVERSE(a) reverse(ALL((a)))
#define MP make_pair
#define FORE(a, b) for (auto &&a : (b))
#define EB emplace_back
#define GREATER(T) T, VT<T> greater<T>
template<typename T> inline bool chmax(T &a, T b){if (a < b){a = b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if (a > b){a = b;return true;}return false;}

const int INF = 1e9;
const int MOD = INF + 7;
const LL LLINF = 1e18;

LL A, B, N;

LL calc(LL X) {
    return (A * X / B) - A * (X / B);
}

int main(void) {
    cin >> A >> B >> N;

    if (B <= N) {
        cout << calc(B - 1) << endl;
        return 0;
    }

    cout << calc(N) << endl;
}


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

int main(){
  string s;
  cin >> s;
  
  int ans = 0;
  int m = 0;
  
  for(int i = 0; i < s.size(); i++){
  	if(s.at(i) == 'A' || s.at(i) == 'C' || s.at(i) == 'G' || s.at(i) == 'T'){
    	ans++;
    }
  	else{
    	ans = 0;
    }
    m = max(m, ans);
  }
  cout << m << endl;
}

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

int main() {
int N=0;
int M=0;
int total=0;
    cin >> N;
  	cin >> M;
	vector<int> high(N);
	for (int i = 0; i < N; i++) {
 	 cin >> high.at(i);
	}//高さ入力
  
  vector<int> good(N);//良いかどうか調べる配列
   	for (int j = 0; j < M; j++) {
      	int A=0;
      	int B=0;
 		 cin >> A >> B;
        int C = A-1;
      	int D = B-1;
      	 
      	if (high.at(C) < high.at(D)) {
          good.at(C)++;
		}
		else if (high.at(C) == high.at(D) ) {
  		  good.at(C)++;
            good.at(D)++;
        }
		else {
 			good.at(D)++;
		}
    }
	for (int k =0 ; k< N; k++){
    	if(good.at(k) == 0){
        total++;
        }
    }
 cout << total << endl;
}

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

#define ul unsigned long long
#define ll long long

int main()
{
  ll n;
  string os,ks;
  cin>>n;
  map<string,int> m;
  
  for (ll i = 0; i < n; i++)
  {
    cin>>os;
    cin>>ks;
    if (os=="insert") {
      m[ks]=1;
    }
    else if (os== "find")
    {
      if (m[ks]) cout<<"yes"<<endl;
      else cout<<"no"<<endl;
    }
  }
  

  return 0;
}



Measured memory_bytes: 52468
#include <bits/stdc++.h>
using namespace std;
const int N = 190;
int n, m;
char a[N][N];
int o;
int f[2][N][N][N];
int main() { 
	cin >> n >> m;
	for(int i = 1; i <= n; i++) scanf("%s", a[i] + 1);
	for(int j = m; j; j--) {
		for(int i = 1; i <= n; i++) {
			for(int k = i; k <= n; k++) if(a[k][j] == a[i][j]) {
				f[o][j][i][k] = j;
				if (a[i][j] == a[i][j + 1]) {
					f[o][j][i][k] = max(j, f[o][j + 1][i][k]);
				}
			} else break;
		}
	}
	for(int ans = 0; ans <= 20; ans++) {
		if (f[o][1][1][n] == m) {
			printf("%d\n", ans); return 0;
		}
		memset(f[1 - o], 0, sizeof f[1 - o]);
		for(int j = 1; j <= m; j++) {
			for(int i = 1; i <= n; i++) {
				for(int z = i; z <= n; z++) {
					if(ans == 1 && j == 1 && i == 1 && z == n) {
						int kkk = j;
					}
					int g = f[o][j][i][z];
					if (f[o][j][i][z] > 0 && f[o][j][i][z] < m)
						g = max(g, f[o][ f[o][j][i][z] + 1 ][i][z]);
					if (i != z) {
						int l = i, r = z - 1, ret = l;
						while (l <= r) {
							int mid = l + r >> 1;
							if (f[o][j][i][mid] >= f[o][j][mid + 1][z]) {
								ret = mid, l = mid + 1;
							} else r = mid - 1;
						}
						g = max(g, min(f[o][j][i][ret], f[o][j][ret + 1][z]));
						ret ++;
						if (ret < z)
							g = max(g, min(f[o][j][i][ret], f[o][j][ret + 1][z]));
					}
					f[1 - o][j][i][z] = g;
				}
			}
		}
		o = 1 - o;
	}
}


Measured memory_bytes: 53888
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <algorithm>
#define _USE_MATH_DEFINES
#include <cmath>
#include <numeric>
#include <iomanip>
#include <deque>
#include <tuple>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <sstream>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>

#define rep(i, x) for (int i = 0; i < (int)(x); i++)
#define FOR(i, a, done) for (int i = (a); i < (done); ++i)
#define all(a) (a).begin(), (a).end()
#define F first
#define S second
#define x first
#define y second
#define pb push_back
#define pf push_front

namespace mp = boost::multiprecision;
using cpp_int = mp::cpp_int;
using ll = long long;
using namespace std;

ll M = 1000000007;

int main()
{
    int k,x;
    cin>>k>>x;
    ll sum=0;
    sum=500*k;
    if(sum>=x){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
}


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

int main()
{
    char b;
    cin >> b;

    if(b == 'A')    cout << 'T' << endl;
    if(b == 'T')    cout << 'A' << endl;
    if(b == 'G')    cout << 'C' << endl;
    if(b == 'C')    cout << 'G' << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<cmath>
#include<cstring>
#include<algorithm>
using namespace std;
long long mp[305][305];
bool vis[305][305];
int main()
{
    int n;
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
        for(int j=1;j<=n;j++)
            scanf("%lld",&mp[i][j]);
    memset(vis,0,sizeof(vis));
    bool flag=1;
    for(int k=1;k<=n&&flag;k++)
        for(int i=1;i<=n&&flag;i++)
            for(int j=1;j<=n&&flag;j++)
            {
                if(i!=j&&j!=k&&k!=i)
                {
                    if(mp[i][k]+mp[j][k]<mp[i][j]) flag=0;
                    else if(mp[i][k]+mp[k][j]==mp[i][j]) vis[i][j]=1;
                }
            }
    if(!flag) return 0*printf("-1\n");
    long long ans=0;
    for(int i=1;i<=n;i++)
        for(int j=i+1;j<=n;j++)
            if(!vis[i][j]) ans+=mp[i][j];
    printf("%lld\n",ans);
}



Measured memory_bytes: 1024
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <algorithm>

using namespace std;
int main(void)
{
    int n,k;
    int x;

    cin >> n >> k;

    int sum = 0;
    for (int i = 0; i < n; i++) {
        cin >> x;
        if (x < abs(x - k)) {
            sum += 2 * x;
        }
        else {
            sum += 2 * abs(x - k);
        }
    }

    cout << sum << endl;

    return 0;
}

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

int main() {
	int A;//高橋HP
	int B;//高橋攻撃
	int C;//青木HP
	int D;//青木攻撃
	int r = 0;//勝敗

	cin >> A>>B>>C>>D;
	while (r == 0) {
		if (B >= C) {
			r = 1;
			cout << "Yes";
		}
		else {
			C = C - B;
			if (D >= A) {
				r = 1;
				cout << "No";
			}
			else {
				A = A - D;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <stack>
#include <queue>
#include <functional>
#include <limits.h>
#include <set>
#include <map>
#include <tuple>
using namespace std;

#define ll long long
#define ull unsigned long long
#define rep(i,N) for (ll i=0;i<N;i++)
#define loop(i,N,M) for(ll i=N;i<M;i++)
#define MAX(v) *max_element(v.begin(),v.end())
#define MIN(v) *min_element(v.begin(),v.end())
#define SORTL2S(type,v) sort(v.begin(),v.end(),greater<type>())
#define SORTS2L(type,v) sort(v.begin(),v.end())
#define SORTMF(v,func) sort(v.begin(),v.end(),func)
#define MP(a,b) make_pair(a,b)

#if __has_include("debug.hpp")
#include "debug.hpp"
#else
template<typename T>
void debug(T& obj) {}
#endif

//----------------------------------------------------------------------
void solve() {

	ll h,n,sum=0;
	cin >> h >> n;
	vector<ll> vec(n);
	rep(i,n) {
		cin >> vec[i];
		sum += vec[i];
	}
	if (sum >= h) {
		cout << "Yes";
	} else {
		cout << "No";
	}

}
//----------------------------------------------------------------------

int main(int argc, char* argv[]) {
	solve();
	return 0;
}


Measured memory_bytes: 3908
#include<iostream>
#include<algorithm>

int const MAXN = 40;
int const INF = 5000;
int const MAXG = 401;

int N, Ma, Mb;
int a[MAXN], b[MAXN], c[MAXN];

int dp[MAXN+1][MAXG][MAXG];

int main() {
  std::cin >> N >> Ma >> Mb;
  int ma = 0, mb = 0, mc = 0;
  for(int i = 0; i < N; ++i) {
    std::cin >> a[i] >> b[i] >> c[i];
    ma += a[i]; mb += b[i]; mc += c[i];
  }
  for(int i = 0; i <= N; ++i) for(int j = 0; j <= ma; ++j) {
    std::fill(dp[i][j], dp[i][j]+mb+1, INF);
  }
  dp[0][0][0] = 0;
  for(int i = 1; i <= N; ++i) for(int j = 0; j <= ma; ++j) {
    for(int k = 0; k <= mb; ++k) {
      int aa = a[i-1], bb = b[i-1], cc = c[i-1];
      int nv = (j >= aa && k >= bb)? dp[i-1][j-aa][k-bb] + cc: INF;
      dp[i][j][k] = std::min(dp[i-1][j][k], nv);
    }
  }
  int ans = INF;
  for(int k = 1; k*Ma <= ma && k*Mb <= mb; ++k) ans = std::min(ans, dp[N][k*Ma][k*Mb]);
  if(ans >= INF) ans = -1;
  std::cout << ans << std::endl;
  return 0;
}


Measured memory_bytes: 24960
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) {
	    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String input = null;
		for(int i = 1; ; i++){
		    try {
			    input = br.readLine();
		        
		    } catch (IOException e) {
	    	}
		    int x = Integer.parseInt(input);
	    	if(x == 0){
    		    break;
	    	}   
		    System.out.println("Case " +  i + ": " + x );
		}
	}
}


Measured memory_bytes: 31952
#include<iostream>
#include<string>

int main(){

    std::string a, b;
    std::cin >> a >> b;

    if(a.at(0) <= b.at(0)){
        for(size_t i = 0; i < std::stoul(b); i++){
            std::cout << a;
        }std::cout << std::endl;
    }else{
        for(size_t i = 0; i < std::stoul(a); i++){
            std::cout << b;
        }std::cout << std::endl;
    }

    return 0;
}


Measured memory_bytes: 256
/*#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<map>
#include<cstdio>
#include<stack>
#include<queue>
#include<fstream>
#include<cstdio>
#include<deque>
#include<iomanip>
#include <numeric>*/
#include<bits/stdc++.h>

using namespace std;
#define ok1 printf("ok1\n");
#define ok2 printf("ok2\n");
#define M 1000000000000000000LL
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);(i)--)
#define all(a) (a).begin(),(a).end()
#define reall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
#define MIN(a,b) a=min((a),(b))
#define MAX(a,b) a=max((a),(b))
#define SIZE(v) (int)v.size()
const double pi = acos(-1.0);


typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef deque<ll> dll;
typedef pair<ll, ll> P;
const ll mod = 1e9 + 7;
ll dx[4] = {1,0,-1,0};
ll dy[4] = {0,1,0,-1};

ll calc(ll n, ll x){
	if(n < 0) return 0;
	return n/x + 1;
}
int main(){
   ll a,b,x;
   cin >> a >> b >> x;
   cout << calc(b,x) - calc(a-1,x) << endl;
    return 0;
}  


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
//debug
#ifdef grief
#define debug(...) do{\
	fprintf(stderr , "%s - %d : (%s) = " , __PRETTY_FUNCTION__ , __LINE__ , #__VA_ARGS__ );\
	_DO(__VA_ARGS__);\
}while(0)
template<typename I> void _DO(I&&x){
	cerr<<x<<endl;
}
template<typename I,typename...T> void _DO(I&&x,T&&...tail){
	cerr<<x<<" , ";
	_DO(tail...);
}
#else
#define debug(...)
#endif
//type
typedef long long ll;
typedef pair<int,int> pii;
typedef long long ll;
typedef pair<ll,ll> pll;
typedef priority_queue<pll,vector<pll>,greater<pll> > heap;
//macro
#define SZ(x) ((ll)(x).size())
#define ALL(x) (x).begin(),(x).end()
#define F first
#define S second
#define mkp make_pair
#define pb push_back
const ll INF=4e18;
const ll MAX=1e6+5;
const ll MOD=1e9+7;
//}}}
string s1,s2;
int main(){
	ios_base::sync_with_stdio(0); cin.tie(0);
	cin>>s1;
	cin>>s2;
	for(int i=0;i<SZ(s1);i++){
		cout<<s1[i];
		if(i<SZ(s2))
			cout<<s2[i];
	}
	cout<< '\n';
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)

ll mod = 1e09;

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

  string s;
  cin >> s;
  vector<char> c;
  int ans, flag;
  REP(i, s.size() - 1){
    c.pb(s[i]);
    if(i % 2){
      flag = 1;
      REP(j, (i + 1) / 2){
        if(s[j] != s[j + (i + 1) / 2]){
          flag = 0;
          break;
        }
      }
      if(flag) ans = i + 1;
    }
  }
  cout << ans << endl;
  return 0;
}


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

int n,k;
long long t,t2;

int main(){
	cin >> n >> k;
	if(k&1){
		t=n/k;
		cout << t*t*t;
	}
	else{
		t2=t=n/k;
		if(n%k>=k/2)t2++;
		cout << t*t*t+t2*t2*t2;
	}
	return 0;
} 

Measured memory_bytes: 256
#include<iostream>
#include<vector>

using namespace std;

int main(){
	int n,r;
	while(cin >> n >> r,n|r){
		vector<int> v;
		for(int i=0;i<n;i++)
			v.push_back(n-i);
		for(int i=0;i<r;i++){
			int p,c;
			cin >> p >> c;
			p--;
			vector<int> a;
			for(int j=p;j<p+c;j++)
				a.push_back(v[j]);
			for(int j=0;j<p;j++)
				a.push_back(v[j]);
			for(int j=p+c;j<n;j++)
				a.push_back(v[j]);
			v=a;
		}
		cout << v[0] << endl;
	}
	return 0;
}

Measured memory_bytes: 1220
import sys
sys.setrecursionlimit(10 ** 6)
# input = sys.stdin.readline    ####
int1 = lambda x: int(x) - 1
def II(): return int(input())

def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())

def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

def printlist(lst, k='\n'): print(k.join(list(map(str, lst))))
INF = float('inf')

import numpy as np

def solve():
    n = II()
    D = np.zeros((10, 10))

    for i in range(1, n+1):
        s = list(str(i))
        l = int(s[0])
        r = int(s[-1])
        # print(s, l, r)
        D[l][r] += 1
    # print(D)

    ans = 0
    for i in range(10):
        for j in range(10):
            ans += D[i][j] * D[j][i]
    print(int(ans))

if __name__ == '__main__':
    solve()


Measured memory_bytes: 14044
using System;
using System.Collections.Generic;
					
public class my
{
	public static void Main()
	{
		var n = my.GetInt();
		var A = my.GetIntArray(n);
		
		var B = new int[n];
		
		my.CountingSort(A, out B, 10000);
		
		my.WriteArray(B);
	}
	
	private static void CountingSort(int[] A, out int[] B, int k)
	{
		var C = new int[k+1];
		B = new int[A.Length];
		
		// Counting element of A
		for(int j = 0; j < A.Length; j++) {
			C[A[j]]++;
		}
		
		// Summing element of less than i
		for(int i = 1; i <= k; i++) {
			C[i] = C[i] + C[i-1];
		}

		for(int j = A.Length - 1; j >= 0; j--) {
			B[C[A[j]] - 1] = A[j];
			C[A[j]]--;
		}
	}
	
	private static int GetInt()
	{
		return int.Parse(Console.ReadLine());
	}
	
	private static int[] GetIntArray()
	{
		return Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
	}

	private static int[] GetIntArray(int n)
	{
		var A = new int[n];
		var s = Console.ReadLine().Split(' ');

		for(int i = 0; i < n; i++) {
			A[i] = int.Parse(s[i]);
		}
		return A;
	}
	
	private static int[] GetIntArray(int n, string t)
	{
		var A = new int[n];
		var s = t.Split(' ');

		for(int i = 0; i < n; i++) {
			A[i] = int.Parse(s[i]);
		}
		return A;
	}

	private static int[] GetIntArray(char c)
	{
		return Array.ConvertAll(Console.ReadLine().Split(c), int.Parse);
	}
	
	private static int[] GetIntArray(char c, string s)
	{
		return Array.ConvertAll(s.Split(c), int.Parse);
	}
	
	private static int[] GetIntArray(string s)
	{
		return Array.ConvertAll(s.Split(' '), int.Parse);
	}
	
	private static double[] GetDoubleArray()
	{
		return Array.ConvertAll(Console.ReadLine().Split(' '), double.Parse);
	}
	
	public static string Reverse(string s)
	{
		var c = s.ToCharArray();
		Array.Reverse(c);
		
		return new String(c);
	}
	
	private static void WriteArray(int[] a)
	{
		Console.WriteLine(string.Join(" ", Array.ConvertAll( a, x=>x.ToString() ) ) );
	}

	private static void WriteArray(long[] a)
	{
		Console.WriteLine(string.Join(" ", Array.ConvertAll( a, x=>x.ToString() ) ) );
	}
	
	private static void WriteVector(Vector v)
	{
		Console.WriteLine(string.Format("{0:f8} {1:f8}", v.X, v.Y));
	}
}

public struct Vector
{
	public double X,Y;
}

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

int divisors(int n)
{
    int ret = 0;
    for (int i = 1; i * i <= n; ++i)
    {
        if (n % i == 0)
        {
            ret++;
            if (n / i != i)
                ret++;
        }
    }
    return ret;
}

int main()
{
    string a, b;
    cin >> a >> b;

    string temp = a + b;
    int ret = stoi(temp);

    cout << (divisors(ret) % 2 ? "Yes" : "No") << endl;
    return 0;
}

Measured memory_bytes: 3620
n,k = list(map(int,input().split()));

ans = 0;
for i in range(k,n+2) :
    ans += (n*(n+1)//2 - (n-i)*(n-i+1)//2 -(i-1)*i//2 +1)%(10**9+7);

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


Measured memory_bytes: 9184
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace std;
using namespace __gnu_pbds; 
#define ll          long long int
#define ull         unsigned long long int
#define pb          push_back
#define pii         pair<int,int>
#define F           first
#define S           second
#define vi          vector<int>
#define vli          vector<ll>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define M_PI        3.14159265358979323846
#define mp          make_pair
#define sz(x)       (int)x.size()
#define matrix      vector<vector<ll>>
#define forn(i,a,b)  for(int i=a;i<b;i++)
#define eps 0.0000000001
#define all(a)      (a).begin(),(a).end()
#define ordered_set     tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> 

const long long INF = (long long) 1e11+1;
const long long mod = (long long) 100000000 ;
const long long hell = (long long) 1000000007;


ll power(ll x,ll y)
{
  ll res=1;
  while(y>0){
    if(y%2) res=(x*res);
    x=(x*x);    
    y=y/2;
  }
  return res;
}

ll modinv(ll x,ll m){
  return power(x,m-2);
}

void solve();


void fastIO() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}

ll gcd(ll a,ll b)
{
    while( b != 0)
	{
		ll  t = b;
		b= a %t;
		a = t;
	}
	return a;
}

int main(){
   fastIO();
   int test;
   //cin>>test;
   test=1;

   while(test--)
   solve();
}


void solve(){
    int n;
    cin>>n;
    ll ans=0;
    for(int i=1;i<=n;i++){
        for(int j=1;j<=n;j++){
            for(int k=1;k<=n;k++){
                ll g=gcd(i,j);
                g=gcd(g,k);
                ans+=g;
            }
        }
    }
    cout<<ans;
}


///Before submit=>
///    *check for integer overflow,array bounds
///    *check for n=1

/*
  For freq or prime factors

for(auto pri:prime){
  while(k%pri==0){
    pcnt[pri]++;
    k/=pri;
  }
}*/

// gcd of strings
/*
string getgcd(string s1,string s2){
    
    while(true){
        if(s1.length()<s2.length()){
            swap(s1,s2);
            continue;
        }
        if(s2.empty())
        return s1;
        
        if(s1.substr(0,s2.length())!=s2)
        return "";
        
        s1=s1.substr(s2.length());
    }
}
*/
/*
// for user defined DS hashmap and set
 
struct hash_pair{
      size_t operator()(const pair<int,pair<int,int>>& p) const{
          auto hash1=hash<int>()(p.F) ;
          auto hash2=hash<int>()(p.S.F) ;
          auto hash3=hash<int>()(p.S.S) ;
          return (hash1^hash2)^hash3;
      }  
};
struct pair_hash
{
	template <class T1, class T2>
	std::size_t operator () (std::pair<T1, T2> const &pair) const
	{
		std::size_t h1 = std::hash<T1>()(pair.first);
		std::size_t h2 = std::hash<T2>()(pair.second);

		return h1 ^ h2;
	}
};
*/



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

int main() {
  int N;
  long K;
  std::cin >> N >> K;
  /*std::vector<int> a(N), b(N);
  for (long i=0; i<N; i++) {
    std::cin >> a.at(i) >> b.at(i);
  }*/
  map<int,long> m;
  for (int i=0; i<N; i++) {
    int ai, ki;
    cin >> ai >> ki;
    m[ai] += ki;
  }
  
  /*for (auto it=m.begin(); it!=m.end(); it++) {
    cerr << it->first << ' ' << it->second << endl;
  }*/
  
  for (auto it=m.begin(); it!=m.end(); it++) {
    K -= it->second;
    //cerr << it->first << endl;
    if (0>=K) {
      cout << it->first << endl;
      break;
    }
  }
  return 0;
}

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

#define LL long long
#define ft first
#define sd second
#define mp(x,y) make_pair(x,y)
//#define int LL
using namespace std;
//const int N   = ;
//const int mod = ;
const int INF =numeric_limits<int >::max();
#define For(n) for (int i=1;i<=n;++i)
#define rep(i,n) for (int i=1;i<=n;++i)
#define repp(i,x,y) for (int i=x;i<=y;++i)
void read(int &x)
{
	x=0;
	char ch=getchar();
	int f=1;
	while (!isdigit(ch)) (ch=='-'?f=-1:0),ch=getchar();
	while ( isdigit(ch)) x=x*10+ch-'0',ch=getchar();
	x*=f;
}
int gcd(int x,int y)
{
	return y?gcd(y,x%y):x;
}
int n;
signed main()
{
	read(n);int tmp=gcd(360,n);
	tmp=360*n/tmp;
    printf("%d",tmp/n);

}



Measured memory_bytes: 3768
#include<bits/stdc++.h>
using namespace std;
constexpr int64_t mod=1e9+7;

int main()
{
  int n;
  cin>>n;
  set<char> s;
  for (int i = 0; i < n; ++i)
  {
    char tmp;
    cin>>tmp;
    s.insert(tmp);
  }
  cout<<(s.size()==3?"Three":"Four");
}

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

using namespace std;

int main() {
    int n;
    cin >> n;
    if (n > 81) cout << "No";
    else {
        for (int i = 1; i * i <= n; i++) {
            if ((((n / i) * i) == n) && (((n / i) < 10) && (i < 10))) {
                cout << "Yes";
                return 0;
            }
        }
        cout << "No";
    }
    return 0;
}


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

#define rep(i, m, n) for(int(i) = (int)(m); i < (int)(n); ++i)
#define rep2(i, m, n) for(int(i) = (int)(n)-1; i >= (int)(m); --i)
#define REP(i, n) rep(i, 0, n)
#define REP2(i, n) rep2(i, 0, n)
#define all(hoge) (hoge).begin(), (hoge).end()
#define en '\n'
using ll = long long;
using ull = unsigned long long;
template <class T>
using vec = vector<T>;
template <class T>
using vvec = vector<vec<T>>;
typedef pair<ll, ll> P;
constexpr long long INF = 1LL << 60;
constexpr int INF_INT = 1 << 25;
constexpr long long MOD = (ll)1e9 + 7;
//constexpr long long MOD = 998244353LL;
using ld = long double;
static const ld pi = 3.141592653589793L;
typedef vector<ll> Array;
typedef vector<Array> Matrix;

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

//グラフ関連
struct Edge {
    ll to, cap, rev;
    Edge(ll _to, ll _cap, ll _rev) {
        to = _to;
        cap = _cap;
        rev = _rev;
    }
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

void add_edge(Graph &G, ll from, ll to, ll cap, bool revFlag, ll revCap) {
    G[from].push_back(Edge(to, cap, (ll)G[to].size()));
    if(revFlag)
        G[to].push_back(Edge(from, revCap, (ll)G[from].size() - 1));
}

void solve() {
    ll n;
    cin >> n;
    vec<ll> a(n);
    REP(i, n) {
        cin >> a[i];
    }

    ll p = 1;
    ll ans = 0;
    REP(i, n) {
        a[i]--;
        ll num = a[i] / p;

        if(num) {
            ans += num;
        } else {
            chmax(p, a[i] + 2);
        }
        chmax(p, 2LL);
    }
    cout << ans << en;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    /*
    ll t;
    cin >> t;
    while(t--)*/
    solve();

    return 0;
}


Measured memory_bytes: 3992
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);++i)
#define ALL(v)   (v).begin(),(v).end()
#define debug(x) cerr<<#x<<": "<<(x)<<endl
#define INF      (int)1e9
#define EPS      (double)1e-9
#define MOD      ((int)1e9+7)
using namespace std;
typedef long long     llong;
typedef vector<int>   vi;
typedef vector<vi >   vvi;
typedef vector<vvi >  vvvi;
typedef pair<int,int> pii;
template<class Type> void line(const Type &a){int cnt=0;for(const auto &elem:a){if(cnt++)cout<<' ';cout<<elem;}cout<<endl;}

int main(){
	long double a,b;
	cin>>a>>b;
	
	cout<<llong(a*b)<<endl;
}

Measured memory_bytes: 3736