akhauriyash/Code-Regression huggingface dataset:
// #pragma GCC optimize(3,"Ofast","inline")
#include <bits/stdc++.h>
#include <iostream>
#include <fstream>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int mod = 1e9 + 7;
const ll infll = 1e18 + 9;
const int infint = 1e9 + 7;
const int MAXN = 2e5 + 7;
const double eps = 1e-9;
const long double pi = 3.1415926535897932384626433832795;
const long double e = 2.71828182845904523536028747135266;
inline ll read()
{
    ll kr = 1, xs = 0;
    char ls;
    ls = getchar();
    while (!isdigit(ls))
    {
        if (!(ls ^ 45))
            kr = -1;
        ls = getchar();
    }
    while (isdigit(ls))
    {
        xs = (xs << 1) + (xs << 3) + (ls ^ 48);
        ls = getchar();
    }
    return xs * kr;
}
// inline __int128 read128()
// {
//     __int128 kr=1,xs=0;char ls;ls=getchar();
//     while(!isdigit(ls)){
//         if(!(ls^45)) kr=-1;ls=getchar();
//     }
//     while(isdigit(ls)){
//         xs=(xs<<1)+(xs<<3)+(ls^48);ls=getchar();
//     }
//     return xs*kr;
// }
inline ull readull()
{
    ull xs = 0;
    char ls;
    ls = getchar();
    while (!isdigit(ls))
        ls = getchar();
    while (isdigit(ls))
    {
        xs = (xs << 1) + (xs << 3) + (ls ^ 48);
        ls = getchar();
    }
    return xs;
}
inline void writeull(ull x)
{
    if (x < 0)
    {
        x *= -1;
        putchar('-');
    }
    if (x >= 10)
        writeull(x / 10);
    putchar('0' + x % 10);
}
inline void write(ll x)
{
    if (x < 0)
    {
        x *= -1;
        putchar('-');
    }
    if (x >= 10)
        write(x / 10);
    putchar('0' + x % 10);
}
// inline void write(__int128 x){
//     if(x<0){x*=-1;putchar('-');}
//     if(x>=10) write(x/10);
//     putchar('0'+x%10);
// }
///////////////////////////////////////////////////////////////////////////////////////
char a[MAXN];
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t = 1;
    // t = read();
    while (t--)
    {
        scanf("%s",a);
        int now=0;
        for (int i=0;a[i];i++){
            now+=(a[i]-'0');
            now%=9;
        }
        if(!now) printf("Yes\n");
        else printf("No\n");
    }
    return 0;
}


Measured memory_bytes: 3880
s = raw_input()
nlist = map(int, s.split())
a, b, c= nlist

if a<b:
    if b<c:
        print '%d %d %d' %(a, b, c)
    elif c<a:
        print '%d %d %d' %(c, a, b)
    else:
        print '%d %d %d' %(a, c, b)
else:
    if a<c:        
        print '%d %d %d' %(b, a, c)
    elif c<b:
        print '%d %d %d' %(c, b, a)
    else:
        print '%d %d %d' %(b, c, a)

Measured memory_bytes: 6332
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream> 
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>  
using namespace std;
#define Ma_PI 3.141592653589793
#define eps 0.00000000000000000000000001
#define LONG_INF 10000000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define REP(i,n) for(long long i = 0;i < n;++i)
long long power(long long a,long long now) {
	long long ans = 1;
	while (now != 0) {
		if (now % 2 == 1) {
			ans *= a;
			ans %= MAX_MOD;
		}
		now /= 2;
		a *= a;
		a %= MAX_MOD;
	}
	return ans;
}
long long inv(long long a) {
	return power(a, MAX_MOD - 2);
}
long long permutation(long long a, long long b) {
	long long ans = 1;
	for (long long i = 0; i < b; ++i) {
		ans *= (a - i);
		ans %= MAX_MOD;
	}
	return ans;
}
long long combination(long long a, long long b) {
	long long ans = 1;
	for (long long i = 0; i < b; ++i) {
		ans *= (a - i);
		ans %= MAX_MOD;
		ans *= inv(i + 1);
		ans %= MAX_MOD;
	}
	return ans;
}
long long dp[1001][1001];
long long solve(long long a, long long b) {
	if (dp[a][b]) return dp[a][b];
	if (a < b) return 0;
	if (b == 1) return 1;
	return dp[a][b] = (solve(a-1,b-1) + b * solve(a-1,b)) % MAX_MOD;
}
int main() {
	long long n, k;
	cin >> n >> k;
	cout << solve(n, k) << endl;
	return 0;
}



Measured memory_bytes: 8628
use std::io;
use std::cmp;
use std::collections::BinaryHeap;
use std::collections::HashMap;
use std::collections::HashSet;

fn read_line() -> String {
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).ok();
    buf
}

fn check(s: &Vec<Vec<u8>>, n: usize, a: usize, b: usize) -> bool {
    for i in 0..n {
        for j in 0..n {
            let x = (i+n-a) % n;
            let y = (j+n-b) % n;
            let p = (j+n-a) % n;
            let q = (i+n-b) % n;
            if s[x][y] != s[p][q] {
                return false;
            }
        }
    }

    return true;
}

fn main() {
    let n: usize = read_line().trim().parse().unwrap();
    let mut s = Vec::with_capacity(n);
    for i in 0..n {
        s.push(Vec::from(read_line().trim().as_bytes()));
    }
    let mut ans = 0;
    for a in 0..n {
        if check(&s, n, a, 0) {
            ans += n;
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>

using namespace std;

typedef pair<int, char> P;
typedef pair<int, P> PP;
 
bool compare(PP a, PP b)
{
    return a.first > b.first;
}
 
int main()
{
    int n, res[10];
    char ch;
 
    while (cin >> n, n) {
	vector<PP> v;
	for (int i = 0; i < n; i++) {
	    int sum = 0, f = 0;
	    cin >> ch;
	    for (int j = 0; j < n-1; j++) {
		cin >> res[j];
		if (res[j]==0) sum += 5;
		else if (res[j]==2) sum++;
		else f++;
	    }  
	    v.push_back(PP(sum, P(f, ch))); 
	}
	sort(v.begin(), v.end(), compare);
	for (int i = 0; i < n; i++) {
	    cout << v[i].second.second << endl;
	}
    }
    return 0;
}

Measured memory_bytes: 3016
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<climits>
#define mod 1000000007
typedef long long ll;
using namespace std;

int main(){
  int a,b; cin >> a >> b;
  cout << 6 - a - b << endl;
  return 0;
}

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

//typedef struct CARD {
//	char my_type[5] = {'S','H','C','D', 0};
//	int my_num[13] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13};
//}CARDS;

int main()
{
//	CARDS cardS;
	char my_type[5] = { 'S','H','C','D', 0 };
	int my_num[13] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 };

	char card_type;
	int card_num,max, count = 0;
	int hit[4][13] = { { 0 }, { 0 } };

	cin >> max;

	while (count < max)
	{
		cin >> card_type >> card_num;
		for (int i = 0; i < 4; i++) {
			if (my_type[i] == card_type) {
				for (int j = 0; j < 13; j++) {
					if (my_num[j] == card_num) {
						hit[i][j] = 1;
					}
				}
			}
		}
		count++;
	}

	for (int i = 0; i < 4; i++) {
		for (int j = 0; j < 13; j++) {
			if (hit[i][j] == 0) {
				cout << my_type[i] << ' ' << my_num[j] << endl;
			}
		}
	}

    return 0;
}

Measured memory_bytes: 1160
#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;

const int MAXN=400003;

int n,a,tot;
int x;
long long dp[2503][53],ans;

int main() {
    while(2 == scanf("%d%d", &n, &a)) {
        tot = a*n;
        memset(dp, 0, sizeof(dp));
        dp[0][0]=1;
        for(int i = 1 ; i <= n ; ++i) {
            scanf("%d", &x);
            for(int j = tot ; j >= x ; --j) {
                for(int k = 1 ; k <= i ; ++k) {
                    dp[j][k]+=dp[j-x][k-1];
                }
            }
        }
        ans=0;
        for(int j = tot ; j >= 1 ; --j) {
            for(int k = 1 ; k <= n ; ++k) {
                if(k * a == j) {
                    ans += dp[j][k];
                }
            }
        }
        printf("%lld\n", ans);
    }
    return 0;
}


Measured memory_bytes: 1152
#include<stdio.h>

int main(void)
{
   int i, j;
   char tmp, s[3];

   scanf("%s", s);

   for(i=1;i<3;i++){
      j=i;
      while((j>0)&&(s[j]<s[j-1])){
           tmp=s[j-1]; s[j-1]=s[j]; s[j]=tmp;
           j=j-1; 
           }
   }
 
   if((s[0]=='a')&&(s[1]=='b')&&(s[2]=='c')) printf("Yes\n");
   else printf("No\n");
 
   return 0;
}

Measured memory_bytes: 128
//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 push_back
#define koto_memory(a) cout<<(sizeof(a)/1048576.0)<<" MB";
#define res(v) v.resize(unique(v.begin(), v.end()) - v.begin());
#define cnt_res(v) std::distance(v.begin(),std::unique(v.begin(), v.end())); 
#define timer cerr << "Time elapsed : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec \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
int n,l[N],k[N],r[N],ans;vpii f,b;
void F(vpii a){
	priority_queue<int>q;
	for(auto i:a){
		q.push(-i.S);
		ans+=i.S;
		//we assume its left is best
		while(q.size()>i.F)ans+=q.top(),q.pop();
	}
}
void solve(){
	cin>>n;ans=0;f.clear(),b.clear();
	rep(i,1,n)cin>>k[i]>>l[i]>>r[i];
	rep(i,1,n){
		if(l[i]>r[i]){
			ans+=r[i];
			f.pb({k[i],l[i]-r[i]});
		}
		else{
			ans+=l[i];
			b.pb({n-k[i],r[i]-l[i]});
		}
	}
	sort(all(f)),sort(all(b));
	F(f),F(b);cout<<ans;
}
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: 15948
#include<bits/stdc++.h>
using namespace std;

#define int long long

int S;
const int mod = 1000000007;
int dp[100010];

signed main()
{
    cin >> S;

    dp[0] = 1;
    for(int i = 1; i <= S; i++)
    {
        if(i - 3 >= 0)
        {
            dp[i] = dp[i - 3];
            dp[i] = (dp[i - 1] + dp[i]) % mod;
        }
    }

    cout << dp[S] << endl;

    return 0;
}

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

int main()
{
    double m,n;
    cin >> n >> m;
    vector<int> vec(n);
    int sum = 0;
    for(int i = 0; i < n; ++i)
    {
        cin >> vec[i];
        sum += vec[i];
    }
    int cnt = 0;
    for(int i = 0; i < n; ++i)
    {
        if(vec[i] >= sum/((double)m*4))
        {
            cnt += 1;
        }
    }
    if(cnt >= m)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    
}

Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;

namespace ABC
{
    class ProgramC
    {
        static void Main(string[] args)
        {
            var inputs = Console.ReadLine().Split(" ");
            var n = long.Parse(inputs[0]);
            var k = long.Parse(inputs[1]);

            var result = 0d;
            for (var i = 1L; i <= n; i++)
            {
                var m = i;
                var count = 0;
                var tmp = 1d / n;
                while (m < k)
                {
                    m = m << 1;
                    tmp /= 2;
                    count++;
                }

                result += tmp;
            }

            Console.WriteLine(result);
        }
    }
}


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

long power(long x, long y, long mod){
  long ans = 1, tmp = x;;
  while(y>0){
    if(y & 1){
      ans *= tmp%mod;
      ans %= mod;
    }
    tmp *= tmp;
    tmp %= mod;
    y >>= 1;
  }
  return ans;
}

int main(){
  long n;
  cin >> n;
  long a[n];
  long rui = 0;
  long mod = INF;
  rep(i,n){
    cin >> a[i];
    rui += a[i];
    rui %= mod;
  }
  long ans = 0;
  rep(i,n){
    long tmp = rui-a[i];
    if(tmp<0)tmp += mod;
    ans += (a[i]*tmp)%mod;
    ans %= mod;
  }
  cout << (ans*power(2,mod-2,mod))%mod << endl;
  return 0;
}

Measured memory_bytes: 5180
#include<iostream>
#include<vector>
#include<string.h>

using namespace std;
vector<int> ans;
struct edge{int to;int time;};

bool virus[20000];
void dfs(vector<edge> e[],int cur,int time){
	for(int i = 0;i < e[cur-1].size();i++){
		edge te = e[cur-1][i];
		if(te.time > time){
			if(virus[cur-1]){
				virus[te.to-1] = true;
				dfs(e,te.to,te.time);
			}
		}
	}
}

int main(){
	while(true){
		int n,m;
		cin >> n >> m;
		if(n == 0 && m == 0) break;

		memset(virus,false,sizeof(virus));
		virus[0] = true;
		
		vector<edge> e[20000];
		for(int i = 0;i < m;i++){
			int t,s,d;
			cin >> t >> s >> d;
			edge te;
			te.to = d;
			te.time = t;
			e[s - 1].push_back(te);
		}
		
		dfs(e,1,0);
		
		int count = 0;
		for(int i = 0;i < n;i++){
			if(virus[i]){
				count++;
			}
		}
		ans.push_back(count);
	}
	
	for(int i = 0;i < ans.size();i++){
		cout << ans[i] << endl;
	}
	return 0;
}


Measured memory_bytes: 5124
//インクルード(アルファベット順)
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

using namespace std;
typedef long long ll;

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素



signed main(){
  ll A,B,V,W;
  ll T;
  cin>>A>>V>>B>>W>>T;
  ll diff=abs(A-B);
  if(W>=V){
    cout<<"NO"<<endl;
  }else{
    if(diff<=(V-W)*T){
      cout<<"YES"<<endl;
    }else{
      cout<<"NO"<<endl;
    }
  }
}

Measured memory_bytes: 3636
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
typedef long long ll;
using namespace std;
void DiscountFare() {
	int X, Y;
	cin >> X >> Y;
	cout << (X + (Y / 2)) << endl;
}
int main() {
	DiscountFare();
	return 0;
}

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

int main(){
  int n;
  string s;
  int west[400000] = {};
  int east[400000] = {};
  cin >> n >> s;
  east[0] = west[n-1] = 0;
  for(int i = 1; i < n; i++){
    east[i] = (s[i-1] == 'W' ? east[i-1] + 1 : east[i-1]);
    west[n-i-1] = (s[n-i] == 'E' ? west[n-i] + 1 : west[n-i]);
  }
  int ans = n;
  for(int i = 0; i < n; i++){
    ans = min(ans, east[i] + west[i]);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3972
n = int(input())
a = list(map(int, input().split()))
s = []
m = 1

def f(m, a):
    s_tmp = 0
    for i in range(n):
        s_tmp = s_tmp + m % a[i]
    return s_tmp

for i in range(n):
    m = m * a[i]

print(f(m-1, a))

Measured memory_bytes: 3316
#define _CRT_SECURE_NO_WARNINGS
#include <cassert>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;



int N;
int A, B;
int p[122];

int main() {
	//freopen("input.txt", "r", stdin);

	cin >> N;
	cin >> A >> B;
	for (int i=1; i<=N; i++) cin >> p[i];
	int a = 0;
	int b = 0;
	int c = 0;
	for (int i=1; i<=N; i++) {
		if (p[i] <= A) a++;
		else if (p[i] <= B) b++;
		else c++;
	}

	int ans = min(a, min(b, c));
	cout << ans << endl;


	return 0;
}

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

// ダブリングは、全体の要素数がN個あって1回移動した時にどの要素に到達するのか定まっているとき、
//「K個先の要素を求めるのに𝑂(𝐾) かかる」ような状況において
// ・前処理：𝑂(𝑁log𝐾)時間, 𝑂(𝑁log𝐾) 空間
// ・クエリ：𝑂(log𝐾)
// で行うことができるようにするアルゴリズムです。

int main() {
  ll n, K;
  cin >> n >> K;
  vector<int> a(n);
  rep(i, n) {
    cin >> a[i];
    a[i]--;  // 0-indexed に変更
  }

  int logK = 1;
  while ((1LL << logK) < K) logK++;
  // doubling[k][i] : i番目から 2^k 進んだ町
  vector<vector<int> > doubling(logK, vector<int>(n));
  rep(i, n) { doubling[0][i] = a[i]; }
  // 前処理 doubling の計算
  rep(k, logK - 1) {
    rep(i, n) doubling[k + 1][i] = doubling[k][doubling[k][i]];
  }

  int now = 0;
  for (int k = 0; K > 0; k++) {
    if (K & 1) now = doubling[k][now];
    K = K >> 1;
  }
  cout << now + 1 << endl;
}

Measured memory_bytes: 51704
import java.util.*;

public class Main {
    public static void main(String[] args) {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        
        if(a == b && b == c){
            System.out.println("No");
        }else if(a != b && b != c && c != a){
            System.out.println("No");
        }else{
            System.out.println("Yes");
        }
    }
}

Measured memory_bytes: 21972
require 'matrix'

include Math

vs = []
2.times {
	vs << Vector[*gets.split.map(&:to_f)]
	vs += gets.split.map(&:to_f).each_slice(3).map{|a| Vector[*a]}
}

d = vs[0].dup
vs[0] -= d
vs[3] -= d

if vs[1][2] != 1
	cos = vs[1][0] / sqrt(vs[1][0]**2 + vs[1][1]**2)
	sign = (vs[1][1] > 0 ? -1 : 1)
	mat = Matrix[[cos, -sign * sqrt(1-cos**2), 0], [sign * sqrt(1-cos**2), cos, 0], [0, 0, 1]]
	vs.map!{|v| mat * v}
end

cos = vs[1][0] / vs[1].r
sign = (vs[1][2] > 0 ? -1 : 1)
mat = Matrix[[cos, 0, -sign * sqrt(1-cos**2)], [0, 1, 0], [sign * sqrt(1-cos**2), 0, cos]]
vs.map!{|v| mat * v}

cos = vs[2][1] / vs[2].r
sign = (vs[2][2] > 0 ? -1 : 1)
mat = Matrix[[1, 0, 0], [0, cos, -sign * sqrt(1-cos**2)], [0, sign * sqrt(1-cos**2), cos]]
vs.map!{|v| mat * v}

vs = vs[3..5]
n = Vector[vs[1][1]*vs[2][2]-vs[1][2]*vs[2][1], vs[1][2]*vs[2][0]-vs[1][0]*vs[2][2], vs[1][0]*vs[2][1]-vs[1][1]*vs[2][0]]
n /= n.r

if n[1] == 0
	if n[0] == 0
		puts 'NO'
	else
		x = n.inner_product(vs[0]) / n[0]
		v1 = Vector[x, -sqrt(1-x*x), 0]
		v2 = Vector[x, sqrt(1-x*x), 0]
		if (v1-vs[0]).r <= 1 || (v2-vs[0]).r <= 1
			puts 'YES'
		else
			puts 'NO'
		end
	end
else
	s = n.inner_product(vs[0]) / n[1]
	t = n[0] / n[1]

	a = t*t+1
	b = s*t
	c = s*s-1
	if b*b-a*c > 0
		x1 = (b + sqrt(b*b-a*c)) / a
		x2 = (b - sqrt(b*b-a*c)) / a
		v1 = Vector[x1, s-t*x1, 0]
		v2 = Vector[x2, s-t*x2, 0]
		if ((v1-vs[0]).r < 1) ^ ((v2-vs[0]).r < 1)
			puts 'YES'
		else
			puts 'NO'
		end
	else
		puts 'NO'
	end
end

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

int main() {
  long long a;
  string b;
  cin>>a>>b;
  long long one=b[0]-'0';
  long long two=b[2]-'0';
  long long three=b[3]-'0';
  long long ans=three*a+two*a*10+one*a*100;
  ans/=100;
  cout<<ans<<endl;
}


Measured memory_bytes: 3628
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<stack>
#include<climits>
#include<cstring>
#include<queue>
#include<complex>
using namespace std;

typedef complex<double> P;

struct L : public vector<P>{
    L(const P &a, const P &b){
        push_back(a), push_back(b);
    }
};

struct C {
    P p; double r;
    C(const P &p, double r) : p(p), r(r) { }
};

const double EPS = 1e-8;

namespace std {
  bool operator < (const P& a, const P& b) {
    return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
  }
}

double cross(const P &a, const P &b){
    return imag(conj(a)*b);
}

double dot(const P &a, const P &b){
    return real(conj(a)*b);
}

int ccw(P a, P b, P c){
    b -= a;
    c -= a;
    if(cross(b,c) > 0) return +1;
    if(cross(b,c) < 0) return -1;
    if(dot(b,c) < 0) return +2;
    if(norm(b) < norm(c)) return -2;
    return 0;
}

P crosspoint(const L &l, const L &m) {
    double A = cross(l[1] - l[0], m[1] - m[0]);
    double B = cross(l[1] - l[0], l[1] - m[0]);
    if (abs(A) < EPS && abs(B) < EPS) return m[0]; // same line
    return m[0] + B / A * (m[1] - m[0]);
}

void tangentToCircle(double px, double py, double cx, double cy, double r){
    double x = px - cx;
    double y = py - cy;
    P contact1(r*(r*x + y*sqrt(x*x + y*y - r*r))/(x*x + y*y), r*(r*y - x*sqrt(x*x + y*y - r*r))/(x*x + y*y));
    P contact2(r*(r*x - y*sqrt(x*x + y*y - r*r))/(x*x + y*y), r*(r*y + x*sqrt(x*x + y*y - r*r))/(x*x + y*y));
    if (contact1 == contact2){
        cout << contact1.real() << " " << contact1.imag() << endl;
    }else{
        if(contact2 < contact1){
            swap(contact1, contact2);
        }
        printf("%.10f %.10f\n", contact1.real() + cx, contact1.imag() + cy);
        printf("%.10f %.10f\n", contact2.real() + cx, contact2.imag() + cy);
    }
}

int main(){
    double px, py, cx, cy, r;
    cin >> px >> py >> cx >> cy >> r;

    tangentToCircle(px, py, cx, cy, r);
    return 0;
}

Measured memory_bytes: 3272
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
#define bit(n) (1LL << (n))
#define len(x) ((ll)(x).size())
#define debug(var) cout << "[" << #var << "]\n" << var << endl
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1000000007;
const double EPS = 1e-9;

template <typename T>
ostream& operator<<(ostream& s, const vector<T>& v) {
  int len = v.size();
  for (int i = 0; i < len; ++i) {
    s << v[i];
    if (i < len - 1)
      s << ' ';
  }
  return s;
}

template <typename T>
ostream& operator<<(ostream& s, const vector<vector<T>>& vv) {
  int len = vv.size();
  for (int i = 0; i < len; ++i) {
    s << vv[i];
    if (i != len - 1)
      s << '\n';
  }
  return s;
}

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;
}

__attribute__((constructor)) void initial() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
}

int sum(int X) {
  int temp = 0;
  while (X) {
    temp += X % 10;
    X /= 10;
  }
  return temp;
}

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

  int ans = INF;
  repp(A, 1, N - 1) {
    int B = N - A;
    chmin(ans, sum(A) + sum(B));
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>

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

using namespace std;
typedef long long ll;

int main() {
    int n,r;
    while(cin >> n >> r) {
        if(n == 0 && r == 0) break;
        vector<int> v(n);
        rep(i,n) v[i] = n-i;
        
        rep(i,r) {
            int p,c;
            cin >> p >> c;

            vector<int> ret;
            REP(j,p-1,p-1+c) {
                ret.push_back(v[j]);
            }

            rep(j,p-1) {
                ret.push_back(v[j]);
            }

            REP(j,p-1+c,n) {
                ret.push_back(v[j]);
            }

            rep(j,n) v[j] = ret[j];
        }

        cout << v[0] << endl;
    }
    return 0;
}

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

using namespace std;


int main()
{
	string contestA= "ABC";
	string contestB= "ARC";
	string lastWeek;
	cin>> lastWeek;
	if(lastWeek==contestA)
		cout<< contestB;
		else
		{
			cout<< contestA;
		}
		 
	return 0;
}

Measured memory_bytes: 2992
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, N) for(int i = 0; i < N; i++)
#define rep2(i, N, a, b) for(int i = a; i < N; i += b)

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

	int ans = 1;
	rep2(i, 32, 2, 1){ //b
		if (i >= X) break ;
		int tmp = i;
		while(tmp * i <= X){ //p
			tmp *= i;
		}
		if (tmp == i) tmp = 0;
		ans = max(ans, tmp);
		// cout << i << ": " << tmp << endl;
	}
	cout << ans << endl;
}

Measured memory_bytes: 3604
import fractions
def extgcd(a,b):
    r = [1,0,a]
    w = [0,1,b]
    while w[2] != 1:
        q = r[2]//w[2]
        r2 = w
        w2 = [r[0]-q*w[0],r[1]-q*w[1],r[2]-q*w[2]]
        r = r2
        w = w2
    return [w[0],w[1]]
def mod_inv(a,mod):
    x = extgcd(a,mod)[0]
    return (mod + x % mod)% mod
def comb(n,k,mod):
    c = 1
    for i in range(k):
        c = c*(n-i)%mod
        c = c*mod_inv(i+1,mod)%mod
    return c
n = int(input())
a = list(map(int,input().split()))
g = a[0]
ans = 1
mod = 10**9 + 7
for i in range(1,n):
    p = fractions.gcd(g,a[i])
    g1 = (a[i]//p)*g
    ans *= (g1//g)
    ans %= mod
    ans += g1//a[i]
    ans %= mod
    g = g1
print(ans)

Measured memory_bytes: 6136
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define repi(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define repdi(i,a,b) for(ll i=(a)-1;i>=(b);--i)
#define repd(i,a) repdi(i,a,0)
#define itr(it,a) for( auto it = (a).begin(); it != (a).end(); ++it )
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()

using ll = long long;
using P = std::pair<ll, ll>;

constexpr ll INF = 1ll<<60;

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

template<class S, class T>
std::ostream& operator<< ( std::ostream& out, const std::pair<S,T>& a )
{ std::cout << '(' << a.first << ", " << a.second << ')'; return out; }

template<class T>
std::ostream &operator<< ( std::ostream& out, const std::vector<T>& a )
{ std::cout << '['; rep( i, a.size() ){ std::cout << a[i]; if( i != a.size()-1 ) std::cout << ", "; } std::cout << ']'; return out; }

ll n;
ll a[100010];
ll S[100010];
ll ans = INF;

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

  rep( i, n )
    std::cin >> a[i];

  rep( i, n )
    S[i+1] = S[i]+a[i];  

  rep( fl, 2 ) {
    bool f = fl;
    ll sum = 0, acc = 0;

    rep( i, n ) {
      ll now = S[i]+acc+a[i];

      if( f ) {
        if( now <= 0 ) {
          acc += -now+1;
          sum += -now+1;
        }
      } else {
        if( now >= 0 ) {
          acc -= now+1;
          sum += now+1;
        }
      }

      f ^= true;
    }

    chmin( ans, sum );
  }

  std::cout << ans << std::endl;

  return 0;
}

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

using namespace std;

vector<int> gr[123456];
int done[123456];
int visited[123456];
int dp[123456];

int dfs(int u) {
	if(visited[u]) return dp[u];
	visited[u] = 1;
	int res = 0;
	for(int x: gr[u]) {
		res = max(res, dfs(x) + 1);
	}
	dp[u] = res;
	return res;
}

int main() {
	int n,m;

	scanf("%d%d", &n, &m);
	int x,y;
	memset(dp, -1, sizeof dp);
	memset(done, 0, sizeof done);
	memset(visited, 0, sizeof visited);

	for(int i = 0; i < m; i++) {
		scanf("%d%d", &x, &y);
		x--; y--;
		gr[x].push_back(y);
		done[y] = 1;
	}

	int ans = 0;
	for(int i = 0; i < n; i++) {
		if(done[i] == 0) {
			dp[i] = 0;
			ans = max(ans, dfs(i));
		}
	}
	
	printf("%d\n", ans);
}


Measured memory_bytes: 12416
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));



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

	int H, W, D;
	cin >> H >> W >> D;
	int table[90000][2] = { 0 };
	REP(i, H) {
		REP(j, W) {
			int a;
			cin >> a;
			a--;
			table[a][0] = i;
			table[a][1] = j;
		}
	}
	
	vector<vector<int> > ans(D);
	REP(i, D) {
		ans[i].push_back(0);
		int a = i;
		int x = table[a][0], y = table[a][1];
		a += D;
		while (a < H*W) {
			ans[i].push_back(abs(x - table[a][0]) + abs(y - table[a][1]));
			x = table[a][0];
			y = table[a][1];
			a += D;
		}
	}
	
	REP(i, ans.size()) {
		FOR(j,1, ans[i].size()) {
			ans[i][j] += ans[i][j-1];
		}
	}

	int Q;
	cin >> Q;
	REP(i, Q) {
		int a, b;
		cin >> a >> b;
		a--;
		b--;
		cout << ans[a%D][b / D] - ans[a%D][a / D] << endl;
	}
	return 0;
}



Measured memory_bytes: 6784
n, k = map(int, input().split())
d = [0]*k
a = [0]*n
for i in range(k):
    d[i] = int(input())
    b = list(map(int, input().split()))
    for i in b:
        a[i-1] += 1

flag = 0
for i in a:
    if i == 0:
        flag += 1
        
print(flag)

Measured memory_bytes: 9152
#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,b;
	cin>>a>>b;
	if(a==1&&b==2||a==2&&b==1) cout<<3;
	else if(a==1&&b==3||a==3&&b==1) cout<<2;
	else cout<<1;
	
	
	
	
}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <string>
using namespace std;
int main() {
    long long k;
    cin >> k;
    if (k % 2 == 0 || k % 5 == 0) {
        cout << -1 << endl;
        return 0;
    }
    else if (k == 1 || k == 7) {
        cout << 1 << endl;
        return 0;
    }
    int cnt = 1;
    int seven = 7;
    // unsigned long long i;
    while (seven != 0) {
        // string s = "7";
        cnt++;
        seven = (seven * 10 + 7) % k ;
    }

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

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

using namespace std;

//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//
//using namespace __gnu_pbds;
//template<typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

//class Timer {
//    clock_t start;
//    string name;
//public:
//    Timer() {name = "";start = clock();}
//    Timer(string s){name = s;start = clock();}
//    ~Timer() {fprintf(stderr, "%s: %.3gs\n", name.c_str(), 1.0*(clock() - start) / CLOCKS_PER_SEC);}
//};

//#define isValid(a, b) ((a) >= 0 && (a) < (b))
//int dr[]  =  {0, -1, -1, -1,  0,  1, 1, 1};
//int dc[]  =  {1,  1,  0, -1, -1, -1, 0, 1};

#define all(x) (x).begin(), (x).end()
#define pb push_back
#define eb emplace_back
#define um unordered_map
#define us unordered_set
#define endl '\n'
#define what_is(x) cerr << fixed << setprecision(2) << boolalpha << #x << " = " << x << endl

const double EPS = 1e-9;
const double PI = acos(-1.0);

template<typename T> inline T sq(T a){return a*a;}
template<typename T1, typename T2> inline pair<T1, T2> mp(T1 a, T2 b){return make_pair(a, b);}
template<typename T1, typename T2> inline T1 safeMod(T1 a, T2 m){return (a%m + m)%m;}/*handling negative sign of remainder*/
template<typename T1, typename T2> inline bool isEq(T1 a, T2 b){return abs(a - b) < EPS;}
template<typename T1, typename T2, typename T3> inline bool isEq(T1 a, T2 b, T3 eps){return abs(a - b) < eps;}
template<typename T> inline bool isKthBitOn(T n, int k){assert(n <= numeric_limits<T>::max());assert(k<=numeric_limits<T>::digits);T ONE = 1;return bool((n & (ONE<<k)));}
template<typename T> inline void setKthBit(T& n, int k){assert(n <= numeric_limits<T>::max());assert(k<=numeric_limits<T>::digits);T ONE = 1;n = (n|(ONE<<k));}
//mt19937 rng((int)chrono::steady_clock::now().time_since_epoch().count());
//template<typename T> inline T nextRand(T lo, T hi){return uniform_int_distribution<T>(lo, hi)(rng);}

#define toRad(deg) ((deg)*PI/180.0)
#define toDeg(rad) ((rad)*180.0/PI)

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;

const int oo = 0x3f3f3f3f;
const int MAX = 200010;
const int MOD = 1000000007;
const int precision = 10;

int main()
{
    //assert(freopen("in.txt", "r", stdin));
    //assert(freopen("out.txt", "w", stdout));
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    //cout << fixed << setprecision(precision);
    int a, b;
    cin >> a >> b;
    if(1 <= a && a <= 9 && 1 <= b && b <= 9)cout << a*b <<endl;
    else cout << "-1" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <utility>
#include <vector>
#include <cmath>
#include <map>
#include <string>

using namespace std;

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

    int n, m;
    cin >> n >> m;

    int lmax = 0;
    int rmin = 100000;

    for (size_t i = 0; i < m; i++)
    {
        int l, r;
        cin >> l >> r;
        if (l > lmax) lmax = l;
        if (r < rmin) rmin = r;
    }

    int ans = rmin - lmax + 1;
    if (ans < 0) ans = 0;
    
    cout << ans << "\n";

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(void){
  int n;
  cin>>n;
  int l[n],r[n];
  int cnt(0);
  for(int i(0);i<n;i++){
    cin>>l[i]>>r[i];
    cnt+=1+r[i]-l[i];
  }
  cout<<cnt<<endl;
  return 0;
}

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

int main() {
int N = 0;
  cin >> N;
  int a[N-1] = {0};
  int sum[N+1] = {0};
  
  for(int i = 0; i < N-1; i++){
    cin >> a[i];
  }
  
  for(int i = 0; i < N-1; i++){
    sum[a[i]]++;
  }
  
  for(int i = 1; i <= N; i++){
    cout << sum[i] << endl;
  }
  
}


Measured memory_bytes: 5204
#include<iostream>
#include<math.h>
#include<string>
#include<algorithm>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

using namespace std;

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

    if(a >= 13)cout<<b;
    else if(a >= 6)cout<<b/2;
    else cout<<"0";
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <stdio.h>
#include <iomanip>
#include <limits>
#include <list>
#include <string>
#include <queue>
#include <deque>
#include <tuple>
#include <map>
#include <sstream>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define FOR(i,a,b) for(int i=a; i<(int)(b); i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort(ALL(x))
#define CLR(a) memset((a), 0 ,sizeof(a))
#define PB push_back
#define MP make_pair
#define SP << " " <<
const int INF = 1001001001;
const ll LINF = 100100100100100100;
const double EPS = 1e-10;
const long double PI  = acos(-1.0L);
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
#define chmax(a,b) a = (((a)<(b))?(b):(a))
#define chmin(a,b) a = (((a)>(b))?(b):(a))

__attribute__((constructor))
void initial(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

signed main(){
  int n; cin>>n;
	VI x(n); rep(i,n) cin>>x[i]; sort(ALL(x));
	int l=x[0], r=x[n-1], ans=INF;
	for(int i=l; i<=r; i++){
		int tmp = 0;
		rep(j,n) tmp += pow(x[j]-i,2);
		chmin(ans,tmp);
	}
	cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using P = pair<ll, ll>;
#define rep(i, n)  for (int i = 0; i <  (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define all(x) (x).begin(), (x).end()
const ll INF = ll(1e18)+1;

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

    ll d,t,s;
    cin >> d >> t >> s;

    if(t*s >= d) cout << "Yes";
    else cout << "No";
}

Measured memory_bytes: 3628
N, x = map(int, input().split())
a = list(map(int, input().split()))
a[0], cnt = (x, a[0] - x) if a[0] > x else (a[0], 0)
for i in range(1, N):
    if a[i] + a[i - 1] > x:
        cnt += a[i] + a[i - 1] - x
        a[i] = x - a[i - 1]
print(cnt)

Measured memory_bytes: 14252
#include <bits/stdc++.h>
using namespace std;
char ctoc(char c){
	switch(c){
	case 'A': return 'a';
	case 'B': return 'b';
	case 'C': return 'c';
	}
}
int main() {
	int N,K;
	string S;
	cin>>N>>K>>S;
	S.at(K-1)=ctoc(S.at(K-1));
	cout<<S<<endl;
	return 0;
}

Measured memory_bytes: 256
process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', function(chunk){
  var line = chunk.toString().split('\n');
  var seconds = Number(line[0]);
  var hour_sec = 60 * 60;
  var minute_sec = 60;

  var h = Math.floor(seconds / hour_sec);
  var m = Math.floor((seconds % hour_sec) / minute_sec);
  var s = seconds % hour_sec % minute_sec;

  console.log(h + ':' + m + ':' + s);
});



Measured memory_bytes: 15532
/**
 *  author: Behradm
 *  Created: 2020.07.05 16:29:41
 *  In The Name Of God
**/
#include <bits/stdc++.h>

using namespace std;

int my_ceil(double a) {
  if (a - (int) a == 0.5)
    return (int) a + 1;
  return ceil(a);
}

int main() {   
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  cout << abs(n - (my_ceil(n / 1000.0) * 1000)) << '\n';
  return 0;
}


Measured memory_bytes: 3756
s = list(input())
k = int(input())
t = list(map(lambda x:ord(x)-ord("a"),s)) #a-zを0-25に正規化

for i in range(len(t)):
  diff = 26-t[i] #aになるまでの差
  if diff != 26 and diff <= k: 
    t[i]+=diff
    k-=diff
  else:
    continue

t[-1]+=k #k余りを一番最後に足す

u = "".join(list(map(lambda x:chr((x%26+ord("a"))),t)))
print(u)

Measured memory_bytes: 11256
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.IO.Compression;
using System.Linq;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Text;
using System.Text.RegularExpressions;
using Console = System.Console;

namespace Atcoder
{

    class Program
    {
        private const long COMDIV = 1000000007;

        static void Main(string[] args)
        {
            var X = int.Parse(Console.ReadLine());
            int i = 1;
            while (true)
            {
                if ((X * i) % 360 == 0)
                {
                    Console.WriteLine(i);
                    return;
                }
                i++;
            }
        }
    }
}

Measured memory_bytes: 27340
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<climits>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<bitset>
#include<iomanip>
using namespace std;

#define rep(i,j,n) for(int i=(j);i<(n);i++)
#define rep2(i,j,n) for(int i=(j);i<=(n);i++)
#define all(i) i.begin(),i.end()
#define INF 1e9

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef pair<int, int> pi;
typedef long long i64;

int main() {
	int n;
	cin >> n;
	if (n % 10 == 9 || n / 10 == 9) {
		cout << "Yes\n";
	}
	else {
		cout << "No\n";
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
    int n, x=0, y=0, t=0;
    cin>>n;
    bool flag=true;
    for(int i=0; i<n; i++) {
        int x1, y1, t1;
        cin>>t1>>x1>>y1;
        if((abs(x1-x)+abs(y1-y)>abs(t1-t)) || ((abs(x1-x)+abs(y1-y))%2!=abs(t1-t)%2)) {
            flag=false;
        }
        x=x1;
        y=y1;
        t=t1;
    }
    if(flag) {
        cout<<"Yes";
    } else {
        cout<<"No";
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define popcnt(a) __builtin_popcount(a)
#define IO() (void)freopen("in.in", "rt", stdin),freopen("out.out", "wt", stdout)
#define FastIO() ios::sync_with_stdio(false);
#define debug(x) cout << __LINE__ << ": " << #x << " = " << (x) << endl

typedef long long ll;
const ll MOD=1e9+7;
const int N = 1e7+9, M = 1e5+9, OO = 0x3f3f3f3f;
const double EPS = 1e-10;

inline int readi(){int n;scanf("%d", &n);return n;}
inline ll readll(){ll n;scanf("%I64d", &n);return n;}
inline char readc(){char c;scanf("%c ", &c);return c;}
inline double readd(){double n;scanf("%lf", &n);return n;}
inline bool dCMP(const long double& a, const long double& b){return fabsl(a-b)<EPS;}
int arr[N];
int main()
{
	#ifdef _LOCAL_DEFINE
	IO();
	#endif
	int n,l;
	scanf("%d %d",&n,&l);//n = readi(),l = readi()
	int mn = OO;
	ll sum=0;
	for(int i=0;i<n;++i)
	{
		int x = l+i;
		sum+=x;
		mn = (abs(mn)>abs(x))?x:mn;

	}
	printf("%lld\n",sum-mn);
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <iomanip>
#define rep(i, n) for(int i = 0; i < n; ++i)
using namespace std;

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

  int n, k; cin >> n >> k;
  double ans = 0;
  for(int i = 1; i <= n; ++i) {
      int tmp = i;
      int cnt = 0;
      while(tmp < k) {
          tmp *= 2;
          cnt++;
      }

      ans += 1.0/n * pow(0.5, cnt);
  }
  cout << fixed << setprecision(10);
  cout << ans << endl;
  return 0;
}


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

// template {{{  0 
// using {{{ 1
using ll = long long int;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vii = vector<pii>;
using vll = vector<pll>;
// }}} 1
// definition {{{ 1
// scaning {{{ 2
#define Scd(x) scanf("%d", &x)
#define Scd2(x,y) scanf("%d%d", &x, &y)
#define Scd3(x,y,z) scanf("%d%d%d", &x, &y, &z)
#define Scll(x) scanf("%lld", &x)
#define Scll2(x,y) scanf("%lld%lld", &x, &y)
#define Scll3(x,y,z) scanf("%lld%lld%lld", &x, &y, &z)
#define Scc(c) scanf("%c", &c);
#define Scs(s) scanf("%s", s);
#define Scstr(s) scanf("%s", &s);
// }}} 2
// constants {{{ 2
#define EPS (1e-7)
#define INF (2e9)
#define PI (acos(-1))
// }}} 2
// systems {{{ 2
#define Repe(x,y,z) for(ll x = z; x < y; x++)
#define Rep(x,y) Repe(x,y,0)
#define RRepe(x,y,z) for(ll x = y-z-1; x >= 0; x--)
#define RRep(x,y) RRepe(x,y,0)
// }}} 2
// output {{{ 2
#define YesNo(a) (a)?printf("Yes\n"):printf("No\n")
#define YESNO(a) (a)?printf("YES\n"):printf("NO\n")
// }}} 2
// }}} 1
// input {{{ 1
// }}} 1
// }}} 0

int main() {

    int N;
    Scd(N);

    char s[333],t[333];
    Scs(s);
    Scs(t);

    Rep(i,N){
        printf ("%c%c", s[i],t[i] );
    }
    printf ("\n");

    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
#include <bitset>
#include <time.h>
#include <tuple>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = 1e12;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define rep(i,N) for(ll i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1
#define MAX_N 100100

ll sq(ll num) { return num*num; }
ll mod_pow(ll x, ll n) {
	if (n == 0)return 1;
	if (n == 1)return x%MOD;
	ll res = sq(mod_pow(x, n / 2));
	res %= MOD;
	if (n % 2 == 1) {
		res *= x;
		res %= MOD;
	}
	return res;
}
ll mod_add(ll a, ll b) { return (a + b) % MOD; }
ll mod_sub(ll a, ll b) { return (a - b + MOD) % MOD; }
ll mod_mul(ll a, ll b) { return a*b % MOD; }

ll n, k;

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


Measured memory_bytes: 3104
// テ・ツ淞コテヲツ慊ャテ」ツδ?」ツδウテ」ツδ療」ツδャテ」ツδシテ」ツδ?(テァツクツョテ・ツーツ湘ァツ可?

#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define int long long
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
typedef pair<int, int> pii;
typedef long long ll;
constexpr ll INF = 1001001001001001LL;
constexpr ll MOD = 1000000007LL;

// s テ」ツ?ォテ・ツ青ォテ」ツ?セテ」ツつ古」ツ?ヲテ」ツ??」ツつ?ABC テ」ツつ津・ツ?ィテ」ツ?ヲ u テ」ツ?ォテ・ツ、ツ嘉」ツ?暗」ツつ?
string replace_user(string s, string u) {
    string t = "CBA", orig = s;
    int N = s.length(), M = t.length(), P = u.length();
    if(N < M) return s;

    string ret = "", temp = "";
    // cout << "reversed: " << t << endl;
    rep(i,0,N) {
        if(temp.length() < M) {
            temp = s[i] + temp;
            if(temp == t) {
                ret += u;
                temp = "";
            }
        }
        else {
            char c = temp[M-1];
            ret += c;
            temp.pop_back();
            temp = s[i] + temp;
            if(temp == t) {
                ret += u;
                temp = "";
            }
        }
        // cout << "ret = " << ret << ", temp = " << temp << endl;
    }
    reverse(temp.begin(), temp.end());
    // cout << "ret = " << ret << ", temp = " << temp << endl;
    s = ret + temp;
    return s;
}

map<string, int> m;

void solve(string s) {
    if(m.count(s)) return;
    m[s]++;
    s = replace_user(s, "X");
    int cnt[3] = {};
    rep(i,0,s.length()) if(s[i] != 'X') cnt[ s[i] - 'A' ]++;
    rep(i,0,3) {
        if(cnt[i]) continue;
        replace(s.begin(), s.end(), 'X', (char)('A' + i));
        if(!m.count(s)) solve(s);
    }
}

signed main() {
    string s; cin >> s;
    solve(s);
    if(m.count("ABC")) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 21960
#include<iostream>

//最大公約数
constexpr auto m_gcd(size_t m, size_t n){
    if(m == 0){
        return n;
    }else if(n == 0){
        return m;
    }else{
        return m_gcd(n, m % n);
    }
}

//最小公倍数
constexpr auto m_lcm(size_t m, size_t n){
    if(n != 0 && m != 0){
        return m * n / m_gcd(m, n);
    }else{
        return 0lu;
    }
}

// aからbでnで割れる数
constexpr auto f(size_t a, size_t b, size_t n){
    return (b / n) - (a - 1) / n;
}

int main(){
    
    size_t a, b, c, d;
    std::cin >> a >> b >> c >> d;

    std::cout << (b - a + 1) - f(a, b, c) - f(a, b, d) + f(a, b, m_lcm(c, d)) << std::endl;
    
    return 0;
}


Measured memory_bytes: 256
def main():
    N = int(input())
    A = list(map(int, input().split()))
    if 0 in A:
        print(0)
        return
    limit = 10**18
    ans = 1
    for a in A:
        if limit % a != 0:
            if limit / a <= ans:
                ans = -1
                break
        else:
            if limit / a < ans:
                ans = -1
                break
        ans *= a
    print(ans)

if __name__ == '__main__':
    main()


Measured memory_bytes: 21708