akhauriyash/Code-Regression huggingface dataset:
/*
黒板に NN 個の正の整数 A1,…,ANA1,…,AN が書かれています。
すぬけ君は，黒板に書かれている整数がすべて偶数であるとき，次の操作を行うことができます。

黒板に書かれている整数すべてを，22 で割ったものに置き換える。
すぬけ君は最大で何回操作を行うことができるかを求めてください。

【制約】

1≤N≤2001≤N≤200
1≤Ai≤1091≤Ai≤109
【数値例】
1)
　N=3N=3
　A=(16,12,24)A=(16,12,24)
　答え: 22
1 回操作を行う
*/

#include <iostream>
using namespace std;

int N;
int A[210];         // 最大 200 個なので余裕を持って 210 に --- 200 以上ならなんでもよいです

int main() {
    cin >> N;
    for (int i = 0; i < N; ++i) cin >> A[i];

    int res = 0;

    // 操作が行える限り操作を繰り返す
    while (true) {
        bool exist_odd = false;  // A[i] がすべて偶数かどうかを判定するフラグ
        for (int i = 0; i < N; ++i) {
            if (A[i] % 2 != 0) exist_odd = true;  // 奇数があったらフラグを立てる
        }

        if (exist_odd) break;  // 奇数があったら break

        // 操作を行えるなら操作を実際に行う
        for (int i = 0; i < N; ++i) {
            A[i] /= 2;
        }
        ++res;  // 操作回数をインクリメント
    }

    cout << res << endl;
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
a.sort()
minc = 100000000
for i in range(a[0], a[-1] + 1):
    count = 0
    for j in a:
        count += (i - j)** 2
    minc = min(minc, count)

print(minc)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include <algorithm>
using namespace std; 
  
typedef long long LL; 
typedef pair<int, int> pii; 
typedef pair<LL, LL> pll; 
typedef pair<string, string> pss; 
typedef vector<int> vi; 
typedef vector<string> vs;
typedef vector<vi> vvi; 
typedef vector<pii> vii; 
typedef vector<LL> vl; 
typedef vector<vl> vvl; 
  
double EPS = 1e-9; 
int INF = 100005; 
long long int mod=1000000007;
long long TES=1000007;
long long INFF = 1000000000000000005LL; 
double PI = acos(-1); 
int dirx[8] = { -1, 0, 0, 1, -1, -1, 1, 1 }; 
int diry[8] = { 0, 1, -1, 0, -1, 1, -1, 1 }; 
  
#ifdef TESTING 
#define DEBUG fprintf(stderr, "====TESTING====\n") 
#define VALUE(x) cerr << "The value of " << #x << " is " << x << endl 
#define debug(...) fprintf(stderr, __VA_ARGS__) 
#else 
#define DEBUG 
#define VALUE(x) 
#define debug(...) 
#endif 
  
#define FOR(a, b, c) for (int(a) = (b); (a) < (c); ++(a)) 
#define FORN(a, b, c) for (int(a) = (b); (a) <= (c); ++(a)) 
#define FORD(a, b, c) for (int(a) = (b); (a) >= (c); --(a)) 
#define FORSQ(a, b, c) for (int(a) = (b); (a) * (a) <= (c); ++(a)) 
#define FORC(a, b, c) for (char(a) = (b); (a) <= (c); ++(a)) 
#define FOREACH(a, b) for (auto&(a) : (b)) 
#define rep(i, n) FOR(i, 0, n) 
#define repn(i, n) FORN(i, 1, n) 
#define MAX(a, b) a = max(a, b) 
#define MIN(a, b) a = min(a, b) 
#define SQR(x) ((LL)(x) * (x)) 
#define RESET(a, b) memset(a, b, sizeof(a)) 
#define fi first 
#define se second 
#define mp make_pair 
#define pb push_back 
#define ALL(v) v.begin(), v.end() 
#define ALLA(arr, sz) arr, arr + sz 
#define SIZE(v) (int)v.size() 
#define SORT(v) sort(ALL(v)) 
#define REVERSE(v) reverse(ALL(v)) 
#define SORTA(arr, sz) sort(ALLA(arr, sz)) 
#define REVERSEA(arr, sz) reverse(ALLA(arr, sz)) 
#define PERMUTE next_permutation 
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#define TC(t) while (t--)

void solve()
{
    LL n,xr=0;
    cin>>n;
    LL res[n],inp[n];
    rep(i,n)
    {
        LL temp;
        cin>>temp;
        inp[i]=temp;
        xr=xr^temp;
    }
    rep(i,n) inp[i]^=xr;
    rep(i,n) cout<<inp[i]<<" ";
    cout<<endl;
    return;
}
 
int main()
{
    IOS();
    solve();
    return 0;
}





Measured memory_bytes: 5136
n,m = map(int,input().split())
s = [0] * m
c = [0] * m
a = [-1] * n
for i in range(m):
    s[i],c[i] = map(int,input().split())
#
ans = 0
if m == 0:
    if n == 1:
        ans = 0
    else:
        ans = 10 ** (n - 1)
elif n >= 2:
    for j in range(m):
            # 1桁目が0
            if s[j] == 1 and c[j] == 0:
                ans = -1
                break
            elif a[s[j] - 1] != -1 and a[s[j] - 1] != c[j]:
                ans = -1
                break
            else:
                a[s[j] - 1] = c[j]
    if ans != -1:
        if a[0] != -1:
            for k in range(n):
                if a[k] != -1:
                    ans += a[k] * 10 ** (n - k - 1)
        else:
            ans = 10 ** (n - 1)
            for k in range(n):
                if a[k] != -1:
                    ans += a[k] * 10 ** (n - k - 1)

elif n == 1 and m == 0:
    ans = 0
else:
    for j in range(m):
        if a[0] == -1:
            a[0] = c[j]
        elif a[0] != c[j]:
            ans = -1
            break
        ans = a[0]








print(ans)


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

bool isPrime(int n){
	if(n <= 1) return false;
	for(int i = 2; i*i <= n;i++){
		if(n %i == 0) return false;
	}

	return true;
}
int32_t main(){
	int n;
	cin >> n;

	int p = n;

	while(!isPrime(p)){
		p++;
	}
	cout << p << endl;
	return 0;
}

	

Measured memory_bytes: 256
a, b, c, k = (int(x) for x in input().split())

count = 0

if k <= a :
    count = 1 * k
else :
    if k <= a + b:
        count = 1 * a
    else : 
        count = 1 * a + -1 * (k - a - b)

print(count)


Measured memory_bytes: 9048
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<algorithm>
#include<iostream>
#include<string>
#include<vector>
#include<queue>
#include<map>
using namespace std;
typedef long long LL;
#define M(a,b) memset(a,b,sizeof(a))
#define pb push_back
const int maxn = 100000+10;
const LL mod = 1000000007;
int main() {

    LL x;
    scanf("%lld",&x);
    LL ans=0;
    ans=(x/11)<<1;
    x%=11;
    if (x<=6) {
        (x)&&(++ans);
    }
    else {
        ans+=2;
    }
    printf("%lld\n",ans);
    return 0;
}


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

int cost[10] = {-1, 2, 5, 5, 4, 5, 6, 3, 7, 6};

string myMax(string a, string b){
    

    if(a == "nil") return b;

    if(a.size() > b.size()) return a;
    else if(a.size() < b.size()) return b;
    else{
        
        sort(b.begin(), b.end());
        reverse(b.begin(), b.end());
        for(int i = 0; i < b.size(); i++){
            if(a[i] > b[i]) return a;
            
            if(a[i] < b[i]) return b;
        }
    }

    return a;
}

int main(){

    int n, m; cin >> n >> m;
    vector<int> a(m);
    for(int i = 0; i < m; i++) cin >> a[i];
    sort(a.begin(), a.end());
    reverse(a.begin(), a.end());
    vector<string> dp(n + 10, "nil");    
    dp[0] = "";
    
    for(int i = 0; i <= n; i++){
        for(int j = 0; j < m; j++){
            if(dp[i] == "nil") continue;
            dp[i + cost[a[j]]] = myMax(dp[i + cost[a[j]]], dp[i] + to_string(a[j]));
        }
    }

    cout << dp[n] << endl;

    return 0;
}


Measured memory_bytes: 33024
#include "bits/stdc++.h"
using namespace std;
const int MAX = 700000;
const int MOD = 1000000007;

long long  fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
/*第二引数で第一引数を割ったときの切り上げの計算*/
long long int maxtime(long long int x, long long int y) {
	return(x + y - 1) / y;

}
/*最大公約数*/
long long int lcm(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;

	if (number2 > number1) {
		m = number2;
		n = number1;
	}
	long long int s = -1;
	while (s != 0) {
		s = m % n;
		m = n;
		n = s;
	}
	return m;
}
/*最大公倍数*/
long long int gcd(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;
	return m / lcm(m, n) * n;
}
/*逆元計算*/
long long int  modinv(long long a, long long m) {
	long long int b = m, u = 1, v = 0;
	while (b) {
		long long int t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
// index が条件を満たすかどうか
vector<long long int >meguru;
bool isOK(int index, int key) {
	if (meguru[index] > key) return true;
	else return false;
}
// 汎用的な二分探索のテンプレ
int binary_search(int key) {
	int left = -1; 
	int right = (int)meguru.size();
	key = key - 1;
	while (right - left > 1) {
		int mid = left + (right - left) / 2;

		if (isOK(mid, key)) right = mid;
		else left = mid;
	}
	return left;
}
vector<long long int >megurulow;
bool SisOK(int index, int key) {
	if (megurulow[index] > key) return true;
	else return false;
}
// 汎用的な二分探索のテンプレ
int Sbinary_search(int key) {
	int left = -1;
	int right = (int)megurulow.size();
	while (right - left > 1) {
		int mid = left + (right - left) / 2;

		if (SisOK(mid, key)) right = mid;
		else left = mid;
	}
	return right;
}
long long modpow(long long a, long long n, long long mod) {
	long long res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}
double PI = 3.141592653589793238;
vector<vector<int>>G(100030);
int main() {
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		int a;
		cin >> a;
		meguru.push_back(a);
	}
	vector<int>b;
	for (int i = 0; i < n; i++) {
		int a;
		cin >> a;
		b.push_back(a);
	}
	for (int i = 0; i < n; i++) {
		int a;
		cin >> a;
		megurulow.push_back(a);
	}
	sort(meguru.begin(), meguru.end());
	sort(megurulow.begin(), megurulow.end());
	long long int ans = 0;
	for (int i = 0; i < n; i++) {
		long long int a = b[i];
		long long int ue = binary_search(a)+1;
		long long int sita = megurulow.size()-Sbinary_search(a);
		ans = ans + ue *sita;
		//cout << ue <<" " << sita << endl;
	}
	cout << ans;
}
	

Measured memory_bytes: 8520
n=int(input())
a=[int(i) for i in input().split()]
a.sort()
f=True
if n%2==0:
    for i in range(n):
        if a[i]!=i//2*2+1:
            f=False
            break
else:
    for i in range(n):
        if a[i]!=(i+1)//2*2:
            f=False
            break
print(2**(n//2)%(10**9+7) if f else 0)


Measured memory_bytes: 13880
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<stack>
#include<cstdlib> 
#include<fstream> 
using namespace std; 
long long N; 
int main(){
	scanf("%d",&N);
	for(int i=1;i<=3500;i++){
		for(int j=1;j<=3500;j++){
			if(1.0*N*i*j/(4*i*j-N*i-N*j)<=3500){
				double w=1.0*N*i*j/(4*i*j-N*i-N*j);
			    if(w==(int)w&&w>0){
					cout<<i<<" "<<j<<" "<<w<<endl; 
					return 0;
				}
			}
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <math.h>
#include <algorithm>
#include <set>
#include <iomanip>
#include <stdio.h>
#include <sstream>
#include <bits/stdc++.h>
using namespace std;
int main(void){
  long long int n;
  cin>>n;
  map<string,long long int> hoge;
  for(long long int i=0; i<n; i++){
    string s;
    cin>>s;
    hoge[s]++;
  }
  cout<<"AC x "<<hoge["AC"]<<endl;
  cout<<"WA x "<<hoge["WA"]<<endl;
  cout<<"TLE x "<<hoge["TLE"]<<endl;
  cout<<"RE x "<<hoge["RE"]<<endl;
}

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

int main(){
	int N;
	float x=0,ans=0;
	string S;
	cin>>N;
	for(int i=0;i<N;i++)
	{
		cin>>x>>S;
		if(S=="JPY")ans+=x;
		else ans+=x*380000.0;
	}
	cout<<ans;
	}

Measured memory_bytes: 384
#include<bits/stdc++.h>
#define fi first
#define se second
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define rrep(i, n) for (int (i) = 1; (i) <= (n); (i++))
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
#define yn {puts("Yes");}else {puts("No");}
#define printd(x) printf("%.12f\n", x);
template<class T> bool chmin(T& a, const T& b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> bool chmax(T& a, const T& b) {if (a < b) {a = b; return 1;} return 0;}
using namespace std;
using ll = long long;

int main() {
	int n;
	cin >> n;
	map<int, int> mp;
	rep (i, n) {
		int a;
		cin >> a;
		mp[a]++;
		mp[a - 1]++;
		mp[a + 1]++;
	}

	int ans;
	int val = -1;
	for (auto x: mp) if (chmax(val, x.se)) ans = x.fi;

	cout << val << endl;
	return 0;
}

Measured memory_bytes: 4736
#include<iostream>
#include<string>
#include<typeinfo>
#include<vector>
#include<algorithm>
#include<map>
#include<iomanip>
using namespace std;
int main()
{
	int a,b,c;
	cin >> a >> b >> c;
  	int n = a*100+b*10+c;
  	cout << (n%4 ? "NO" : "YES") << endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#include<cmath>


#define REP(i,n) for (int i = 0; (i) < (n); ++ (i))
#define FOR(i,n) for (int i = 1; (i) <= (n); ++ (i))
#define dump(x)  cout << #x << " = " << (x) << endl;
#define pb push_back
#define int long long
//#define lint long long

const int INF = 1e9;
const int MOD = 1e9+7;
//const lint LINF = 1e18;
const double eps = 0.000000001;//もとの値の10^(-16)まで

using namespace std;

//typedef pair<int, int> P;
//priority_queue< P, vector<P>, greater<P> > q;//ダイクストラの時、greaterで小さい順
string s;
int ans;
int dp[2000000][3];//桁数、,(0,0),(1,0),(0,1),(1,1)、
signed main(){
  cin >> s;
  dp[s.size()][0] = 2;//一緒、下回ってない
  dp[s.size()][1] = 1;//下回った

  for(int i = s.size()-1;i>=1;i--){
    if(s[s.size()-i]=='0'){
      dp[i][0] = dp[i+1][0] * 1 ;
      dp[i][0] %= MOD;
      dp[i][1] = dp[i+1][1] * 2;
      dp[i][1] %= MOD;
      dp[i][2] = dp[i+1][1] * 1 +dp[i+1][2] * 3;
      dp[i][2] %= MOD;

    }
    else{
      dp[i][0] = dp[i+1][0] * 2;
      dp[i][0] %= MOD;
      dp[i][1] = dp[i+1][0];
      dp[i][1] %= MOD;
      dp[i][2] = dp[i+1][1] * 3 +dp[i+1][2] * 3;
      dp[i][2] %= MOD;
    }
    //dump(dp[i][0]);
    //dump(dp[i][1]);
    //dump(dp[i][2]);
  }
  cout << (dp[1][0] + dp[1][1] + dp[1][2])%MOD << endl;
  return 0;
}


Measured memory_bytes: 4608
#include <stdio.h>
int main(void)
{
    int n, c = 0;
    char s[100];
    scanf("%d", &n);
    scanf("%s", &s);
    if (n % 2)
    {
        printf("No\n");
    }
    else
    {
        for (int i = 0; i < n / 2; i++)
        {
            if (s[i] != s[n / 2 + i])
            {
                c = 1;
                break;
            }
        }
        if (c)
            printf("No\n");
        else
            printf("Yes\n");
    }
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
#define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i)
#define per(i,N) for(int i=(N)-1;i>=0;--i)
#define perr(i,l,r) for(int i=r-1,i##_min(l);i>=i##_min;--i)
#define all(arr) (arr).begin(), (arr).end()
#define SP << " " <<
#define SPF << " "
#define SPEEDUP cin.tie(0);ios::sync_with_stdio(false);
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

inline void YesNo(bool b){ cout << (b?"Yes" : "No") << endl;}
inline void YESNO(bool b){ cout << (b?"YES" : "NO") << endl;}
inline void Yay(bool b){ cout << (b?"Yay!" : ":(") << endl;}

int main(void){
  SPEEDUP
  cout << setprecision(15);
  int N,C;
  ll K;
  cin >> N >> C >> K;
  vector<ll> v(N);
  rep(i,N)cin >> v[i];
  v.push_back(MAX_LL);
  ++N;
  sort(all(v));
  ll T = v[0];
  int count = 0;
  int ans = 0;
  rep(i,N){
    if(v[i]-T>K){
      ++ans;
      count = 0;
      T = v[i];
    }
    if(count == C){
      ++ans;
      count = 0;
      T = v[i];
    }
    ++count;
  }
  cout << ans << endl;
  return 0;
}


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

typedef unsigned long long ull;
typedef long long ll;

#define rep(i,x) for(int i=0;i<x;i++)

ull gcd(ull a, ull b)
{
  if(b == 0)
    return a;
  return gcd(b, a%b);
}

ull lcm(ull a, ull b)
{
  ull t = __gcd(a,b);
  return a*(b/t);
}
int main()
{
  ull n,m,l;
  cin >> n;

  cin >> m;
  rep(i,n-1)
  {
    cin >> l;
    m = lcm(m,l);
  }

  cout << m << endl;
  return 0;
}


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

ll add[3] = {-1, 0, 1};

void dfs(vector<ll> &nums, vector<ll> &ans) {
    ll num = 0, tens = 0;
    for (int i = nums.size() - 1; i > -1; i--) {
        num += nums[i] * pow(10, tens);
        tens++;
    }
    ans.push_back(num);

    if (nums.size() == 10) {
        return;
    }

    for (int i = 0; i < 3; i++) {
        ll can = nums.back() + add[i];
        if (can < 0 || can > 9)
            continue;
        nums.push_back(can);
        dfs(nums, ans);
        nums.pop_back();
    }
}

int main() {
    int K;
    cin >> K;
    vector<ll> ans;
    for (int i = 1; i < 10; i++) {
        vector<ll> nums;
        nums.push_back(i);
        dfs(nums, ans);
    }

    sort(all(ans));
    cout << ans[K - 1] << endl;
}

Measured memory_bytes: 5856
def solve(n, query):
    for l, r, d in query:
        if is_same(l, r):
            if d != diff(l, r):
                return 'No'
        else:
            unite(l, r, d)
    return 'Yes'


def find(x):
    if par[x] < 0:
        return x
    else:
        px = find(par[x])
        diff_weight[x] += diff_weight[par[x]]
        par[x] = px
        return px


def weight(x):
    find(x)
    return diff_weight[x]


def unite(x, y, w):
    w += diff_weight[x]-diff_weight[y]
    x = find(x)
    y = find(y)
    if x == y:
        return False
    else:
        if par[x] > par[y]:
            x, y = y, x
            w = -w
        par[x] += par[y]
        par[y] = x
        diff_weight[y] = w
        return True


def is_same(x, y):
    return find(x) == find(y)


def diff(x, y):
    return weight(y)-weight(x)


if __name__ == '__main__':
    n, m = map(int, input().split())
    par = [-1]*(n+1)
    diff_weight = [0]*(n+1)
    query = []
    for _ in range(m):
        l, r, d = map(int, input().split())
        query.append((l, r, d))
    print(solve(n, query))


Measured memory_bytes: 39148
ls = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k = int(input())
print(ls[k-1])


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
int main(){
  char s[600000];
  cin >> s;
  int n = strlen(s);
  long long d=0,e=1,f=1;
  for(int i=0;i<n-1;i++){
	if(s[i]=='>'&&s[i+1]=='<'){
      if(e<f){
        d=d+f;
      }
      else{
        d=d+e;
      }
      e=1;
      f=1;
    }
    else if(s[i]=='<'&&s[i+1]=='<'){
      d=d+e;
      e++;
    }
    else if(s[i]=='>'&&s[i+1]=='>'){
      d=d+f;
      f++;
    }
  }
  if(s[n-1]=='<'){
      d=d+e;
  }
  else{
    if(e<f){
      d=d+f;
    }
    else{
      d=d+e;
    }
  }
  cout << d << endl;
}

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

using namespace std;

using ll = long long;
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define FORE(i, a, b) for(int i=(a);i<=(b);++i)
#define rep(i, n) for(int i=0;i<(n);++i)
#define repe(i, n) for(int i=0;i<=(n);++i)
#define ALL(v) (v).begin(),(v).end()
#define SP cout<<fixed<<setprecision(10)
typedef pair<int, int> P;
const int INF = (int) 1e9;
const int MOD = (int) 1e9 + 7;

int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }

ll s(ll n) {
	if (n == 0) return 0;
	return n % 10 + s(n / 10);
}

int main(void) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	ll k;
	cin >> k;
	
	ll x=1;
	ll p=1;
	while(k>0){
		cout<<x<<endl;
		k--;
		ll nx1=x+p;
		ll nx2=x+p*10;
		if(nx1*s(nx2) <= nx2*s(nx1)){
			x = nx1;
		} else {
			x = nx2;
			p *= 10;
		}
	}
	
	return 0;
}

Measured memory_bytes: 256
import java.lang.reflect.Array;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Stream;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int total = sc.nextInt();
        int count = 0;

        for(int i=0; i<=a; i++){
            for (int j=0; j<=b; j++){
                for (int k=0; k<=c; k++){
                    int ans = k*50 + j*100 + i*500;
                    if(ans == total){
                        count++;
                    }
                }
            }
        }

        System.out.println(count);
    }
}


Measured memory_bytes: 23764
/*<<head>> {{{*/
#include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <cstring>
#include <vector>
#include <cstdio>
#include <string>
#include <cmath>
#include <queue>
#include <stack>
#include <set>
#include <map>
using namespace std;
typedef double db;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
#define dd(x) cout << #x << " = " << x << ", "
#define de(x) cout << #x << " = " << x << endl
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define per(i,a,b) for(int i=(b)-1;i>=(a);--i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define fi first
#define se second
//INF = 1 061 109 567 ; INF + INF = 2 122 219 134 ;
//LINF = 4 557 430 888 798 830 399 ; LINF + LINF = 9 114 861 777 597 660 798 ;
const int INF = 0x3f3f3f3f;     // -INF: 0xc0   abs(-INF) = INF + 1
const ll LINF = 0x3f3f3f3f3f3f3f3f;
/*}}}*/                         // zr, zm
const int MOD = (int)1e9+7;     // when MOD = 1e9+7, inv2 = 500000004
const int N = (int)1e6+7;

// ------- 变量 ------- //

int n;
int a[N];

// ------- 函数 ------- //

void Init() {
    rep(i, 0, n) scanf("%d", a+i);
}

int Solve() {
    db ans = 0;
    rep(i, 0, n) ans += 1.0 / a[i];
    return printf("%.12f\n", 1.0 / ans);
}

// ------- main ------- //

int main ()
{
    //ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    //freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);

    //Pre();
    //int t; scanf("%d", &t); while (t--) {
    while (~scanf("%d", &n)) {
    //while(fgets(s, N, stdin)) {   // 注意 fgets 会读入换行符
        //if (n == 0) break;
        //static int kase = 0; printf("Case %d: ", ++kase);
        Init();
        Solve();
        //if (t) puts("");
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int mx=200006;
int x[mx];
int main()
{
	int n,i;
	cin>>n; 
	int a[n];
	for(i=0;i<n;i++)
	{
		cin>>a[i];
	}
	for(i=0;i<n;i++)
	{
		int key=a[i]-1;
		if(x[key]==0)
		{
			x[a[i]]=1;
		}
		else
		{
			x[a[i]]=x[key]+1;
		}
	}
	int max=0;
	for(i=1;i<=n;i++)
	{
		if(x[i]>max)
		max=x[i];
	}
	cout<<n-max<<endl;
}

Measured memory_bytes: 1792
package main

import (
  "fmt"
)

func main() {
  var a int
  
  ans := 0
  for i := 0; i < 5; i++ {
    fmt.Scanf("%d", &a)
    if a == 0 {
      ans = i+1
    }
  }
  
  fmt.Printf("%d\n", ans)
}

Measured memory_bytes: 1832
#include <stdio.h>

int main (void) {
    int cnt = 15, s = 0;
    char i, *mes = "YES";
    while (1)
    {
        scanf("%c", &i);
        if (i=='\n') break;
        if (i=='o') s++;
        cnt--;
    }
    if (cnt+s<8) mes = "NO";
    printf("%s\n", mes);
}

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

int main()
{
  int n, ans = 0;
  cin >> n;
  vector<vector<int>> v(2, vector<int>(n));
  for (int i = 0; i < 2; i++)
  {
    for (int j = 0; j < n; j++)
    {
      cin >> v.at(i).at(j);
    }
  }

  int i, j, k;
  for (i = 0; i < n; i++)
  {
    int buf = 0;
    for (j = 0; j <= i; j++)
    {
      buf += v.at(0).at(j);
    }
    for (k = j - 1; k < n; k++)
    {
      buf += v.at(1).at(k);
    }
    ans = max(ans, buf);
  }
  cout << ans << endl;
}


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

using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define ll long long int
#define INF 1000000007
// cin.eof() 入力個数の問題
int main() {
int a[5];
rep(i,5){
  cin>>a[i];
  if(a[i]==0){
    cout<<i+1<<endl;
    return 0;
  }
}
    return 0;
}


Measured memory_bytes: 3624
import sys
input = sys.stdin.readline

s = list(input())
t = list(input())
n = len(s)-1
m = len(t)-1
value = [[0]*(m+1) for i in range(n+1)]


for i in range(n):
    for j in range(m):
        if s[i] == t[j]:
            value[i + 1][j + 1] = value[i][j] + 1
        elif value[i][j + 1] > value[i + 1][j]: #UP
            value[i + 1][j + 1] = value[i][j + 1]
        else:  # LEFT
            value[i + 1][j + 1] = value[i + 1][j]
i = n-1
j = m-1
ans=""
while i >= 0 and j >= 0:
    if s[i] == t[j]:
        ans = s[i] + ans
        i -= 1
        j -= 1
    elif value[i][j + 1] > value[i + 1][j]:
        i -= 1
    else:
        j -= 1
print(ans)


Measured memory_bytes: 112220
const BKRT = "\n";
const SPAC = " ";
const NOSP = "";

function Main(input){
	input = [].concat(...input.split(BKRT).map(a=>a.split(SPAC)));
  const strShift = ()=>input.shift();
  const intShift = ()=>~~input.shift();
  
  var S = strShift();
  
  return S[0]!=S[1]&&S[1]!=S[2]&&S[2]!=S[0]?"Yes":"No";
}

// If you are interested in the algorithms I used, 
// there is no need to read down from this line.

((b,c,d)=>"undefined"!=typeof require?console.log(Main(require("fs").readFileSync("/dev/stdin","utf8"))):[b=b.split("\n").slice(1,-1).join("\n"),c=function(){try{return Main(b)}catch(f){return f.stack||f.message}}(),d=typeof c,"string"==d||(c=JSON.stringify(c)),$("<form>").append([[10,b],0,[1,d],0,[10,c]].map(f=>$(f?"<textarea>":"<br>",f&&{rows:f[0],cols:40,text:f[1]}))).appendTo("body")])(`
baa
`);

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

int i = 1, x, n;

void checknum();
void include3();
void endchecknum();

int main() {
	cin >> n;
	checknum();
	return 0;
}

void checknum() {
	x = i;
	if (x % 3 == 0) {
		cout << " " << i;
		endchecknum();
	} else {
		include3();
	}
}

void include3() {
	if (x % 10 == 3) {
		cout << " " << i;
		endchecknum();
	} else {
		x /= 10;
		if (x) {
			include3();
		} else {
			endchecknum();
		}
	}
}

void endchecknum() {
	if (++i <= n) {
		checknum();
	} else {
		cout << endl;
		return;
	}
}

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

using ll = long long;
#define int long long

// [a -> b-1]
#define reps(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
// [0 -> a-1]
#define rep(i, a) reps(i, 0, (a))
// [a-1 -> b]
#define rreps(i, a, b) for (int i = (int)((a)-1); i >= (int)(b); i--)
// [a-1 -> 0]
#define rrep(i, a) rreps(i, a, 0)
#define all(v) (v).begin(), (v).end()
// next_permutation(all(v))
#define PERM(v) next_permutation(all(v))
/*sort(all(v));
 * (v).erase(unique(all(v)), v.end())*/
#define UNIQUE(v)\
	sort(all(v));\
	(v).erase(unique(all(v)), v.end())
#define MINV(v) min_element(all(v))
#define MAXV(v) max_element(all(v))
#define MIN3(a, b, c) min(min(a, b), c)
#define MIN4(a, b, c, d) min(MIN3(a, b, c), d)
#define MIN5(a, b, c, d, e) min(MIN4(a, b, c, d), e)
#define MIN6(a, b, c, d, e, f) min(MIN5(a, b, c, d, e), f)
#define MAX3(a, b, c) max(max(a, b), c)
#define MAX4(a, b, c, d) max(MAX3(a, b, c), d)
#define MAX5(a, b, c, d, e) max(MAX4(a, b, c, d), e)
#define MAX6(a, b, c, d, e, f) max(MAX5(a, b, c, d, e), f)
// b is [a, c)
#define RANGE(a, b, c) ((a) <= (b) && (b) < (c))
// c is [a, e) && d is [b, f)
#define RANGE2D(a, b, c, d, e, f) (RANGE((a), (c), (e)) && RANGE((b), (d), (f)))
#define chmin(a, b) a = min(a, (b))
#define chmin3(a, b, c) a = MIN3(a, (b), (c))
#define chmin4(a, b, c, d) a = MIN4(a, (b), (c), (d))
#define chmin5(a, b, c, d, e) a = MIN5(a, (b), (c), (d), (e))
#define chmin6(a, b, c, d, e, f) a = MIN6(a, (b), (c), (d), (e), (f))
#define chmax(a, b) a = max(a, (b))
#define chmax3(a, b, c) a = MAX3(a, (b), (c))
#define chmax4(a, b, c, d) a = MAX4(a, (b), (c), (d))
#define chmax5(a, b, c, d, e) a = MAX5(a, (b), (c), (d), (e))
#define chmax6(a, b, c, d, e, f) a = MAX6(a, (b), (c), (d), (e), (f))
#define fcout cout << fixed << setprecision(15)
#define YES(f) cout << ((f) ? YES_STR : NO_STR) << endl;

const string YES_STR = "Yes";
const string NO_STR = "No";

void solve(long long N, std::vector<long long> H) {
	if (N == 1) {
		YES(1);
		return;
	}
	H[0]--;
	if (H[0] > H[1]) {
		YES(0);
		return;
	}
	reps(i, 1, N-1) {
		if (H[i-1] < H[i]) H[i]--;
		if (H[i] > H[i+1]) {
			YES(0);
			return;
		}
	}
	YES(1);
}

signed main() {
	long long N;
	scanf("%lld",&N);
	std::vector<long long> H(N);
	for(int i = 0 ; i < N ; i++){
		scanf("%lld",&H[i]);
	}
	solve(N, std::move(H));
	return 0;
}


Measured memory_bytes: 1024
#include<stdio.h>

int main(){

  char a[1000][1200];

  int i=0;

  while(1){

    fgets(a[i],1200,stdin);
 
    if(a[i][0]=='0'&&a[i][1]=='\n')

      break;

    i++;

  }

  int s,t;

  int b[i];

  for(s=0;s<=i;s++){

    b[s]=0;

    for(t=0;a[s][t]!='\n';t++){

      b[s]+=a[s][t]-'0';

    }

  }

  int c;

  for(c=0;c<=i-1;c++){

    printf("%d\n",b[c]);

  }

  return 0;

}

Measured memory_bytes: 668
// I SELL YOU...! 
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<chrono>
#include<iomanip>
#include<map>
#include<set>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using TP = tuple<ll,ll,ll>;
void init_io(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(18);
}
const ll MAX = 1e7+1;
vector<ll> lst(MAX,1);
vector<ll> eratos(int max){
  vector<ll> res;
  vector<bool> cp_list(max+1,true);
  cp_list[0]=false;
  cp_list[1]=false;
  for(ll i=2;i<=max;i++){
    if(cp_list[i]){
      lst[i] = 2;
      res.push_back(i);
      for(ll j=2;j*i<=max;j++){
        cp_list[i*j]=false;
        ll c = 0,tmp=i*j;
        while(tmp%i==0){
          c++;
          tmp /= i;
        }
        lst[i*j] *= c+1;
      }
    }
  }
  return res;
}
signed main(){
  init_io();
  ll n,ans=0;
  cin >> n;
  vector<ll> plist = eratos(1e7);
  for(int i=1;i<=n;i++){
    ans += lst[i]*i;
  }
  cout << ans << endl;
}


Measured memory_bytes: 90976
N = gets.to_i
h = gets.split(' ').map(&:to_i)

check = 'Yes'
(N - 2).downto(0) do |i|
	if h[i] == h[i + 1] + 1
		h[i] -= 1
	elsif h[i] > h[i + 1] + 1 
		check = 'No'
		break
	end
end

puts check

Measured memory_bytes: 8580
#include <bits/stdc++.h>
using namespace std;
int main(){
	long long T1, T2, A1, A2, B1, B2; 
	cin >> T1 >> T2 >> A1 >> A2 >> B1 >> B2; 
	if(T1 * A1 + T2 * A2 == T1 * B1 + T2 * B2){
		cout << "infinity" << endl; return 0; 
	}
	long long D = T1 * A1 + T2 * A2 - (T1 * B1 + T2 * B2); // 1周期の差
	long long M = T1 * A1 - T1 * B1; // 1周期の中央での差
	if(M > 0 && D > 0){
		cout << 0 << endl; return 0; 
	}
	if(M < 0 && D < 0){
		cout << 0 << endl; return 0; 
	}
	long long ans = (abs(M) / abs(D)) * 2 + 1; 
	if(abs(M) % abs(D) == 0) ans --; 
	cout << ans << endl; 
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<numeric>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b));i>=((int)(a));i--)
typedef long long ll;
typedef pair<ll, ll> mp;

//Union-Find??¨

int par[100000];//?±????????????£???
vector<vector<int> >v(100000);

int find(int x){
	if(par[x]==x)return x;
	return par[x]=find(par[x]);//????????§????????§???
}

bool same(int x,int y){
	return find(x)==find(y);
}

void unify(int x,int y){
	x=find(x);
	y=find(y);
	if(x==y)return;
	par[x]=y;
}

int main(void){
	int n,m,f1,f2,q,s[10000],t[10000];
	cin>>n>>m;
	rep(i,n)par[i]=i;//union-find??¨????????????
	rep(i,m){
		cin>>f1>>f2;
		unify(f1,f2);
	}
	cin>>q;
	rep(i,q)cin>>s[i]>>t[i];//query
	rep(i,q)if(same(s[i],t[i])){
		cout<<"yes"<<endl;
	}else{
		cout<<"no"<<endl;
	}
	return 0;
}

Measured memory_bytes: 6220
# [] = list(map(int, input().split()))

n = int(input())
aList = list(map(int, input().split()))
hList = aList.copy()
header = aList[0]
for index, item in enumerate(aList[1:]):
    if header > item:
        hList[index+1] = header
    else:
        header = item
dif = 0
for i in range(n):
    dif += hList[i] - aList[i]
print(dif)

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

#define ll long long
#define fornum(A,B,C) for(A=B;A<C;A++)
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>

using namespace std;

/////////////////////////////////////////////////////
ll X, A;
char S[5];
ll i;
int main(){
    scanf("%s", &S);
    fornum(i,1,4){
        if(S[i-1]==S[i]){
            printf("Bad");
            return 0;
        }
    }

    printf("Good");
    return 0;
}

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

#define vi vector<int>
#define vl vector<long>
#define vvi vector<vector<int>>
#define vvl vector<vector<long>>
#define pint pair<int, int>
#define plong pair<long, long>

int main() {
    long N; 
    cin>>N;
    vl letter(14, 0);
    letter[0] = 1;
    REP(i, 0, 13) letter[i+1] = letter[i] * 26;
    long let = 0;
    long number = N;
    while(number - letter[let] >= 0){
        number -= letter[let];
        let++;
    }
    //cout << let << endl;
    string ans;
    int let_i = let;
    REP(i, 0, let){
        long c = number/letter[let - 1 - i];
        ans.push_back(char('a'+ c));
        //cout << number << " " << letter[let - 1 - i] << " " << c << endl;
        number -= c* letter[let - 1 - i];
    }
    cout << ans << endl;

}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define pb push_back
#define ins insert
#define all(x) (x).begin(),(x).end()
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[8]={1,0,-1,0,1,1,-1,-1};
const ll dx[8]={0,-1,0,1,1,-1,1,-1};
using Graph = vector<vector<int>>;
double nCk(int n, int k) {
double res=1.0;
for(int i=0; i<n; i++){
res*=0.5;}
for(int i=0; i<k; i++){
res*=(double)(n-i);
res/=(double)(k-i);
}
return res;}
struct edge{ll to, cost;};
typedef pair<ll,ll> P;
struct graph{
  ll V;
  vector<vector<edge> > G;
  vector<ll> d;

  graph(ll n){
    init(n);
  }

  void init(ll n){
    V = n;
    G.resize(V);
    d.resize(V);
    rep(i,V){
      d[i] = INF;
    }
  }

  void add_edge(ll s, ll t, ll cost){
    edge e;
    e.to = t, e.cost = cost;
    G[s].push_back(e);
  }

  void dijkstra(ll s){
    rep(i,V){
      d[i] = INF/10;
    }
    d[s] = 0;
    priority_queue<P,vector<P>, greater<P> > que;
    que.push(P(0,s));
    while(!que.empty()){
      P p = que.top(); que.pop();
      ll v = p.second;
      if(d[v]<p.first) continue;
      for(auto e : G[v]){
        if(d[e.to]>d[v]+e.cost){
          d[e.to] = d[v]+e.cost;
          que.push(P(d[e.to],e.to));
        }
      }
    }
  }
};
int main() {
  cout << fixed << setprecision(10);
  long double a,b,c; cin>>a>>b>>c;
  if(c==0){
  cout << (b-1)/a << endl;}
  else{
    cout << 2*(a-c)*(b-1)/(a*a) << endl;}
}
        


Measured memory_bytes: 3792
n,d=map(int,input().split())
x=[list(map(int,input().split())) for _ in range(n)]
ans=0
for i in range(n-1):
    for j in range(i+1,n):
        a=[]
        for y,z in zip(x[i],x[j]):
            q=(y-z)**2
            a.append(q)
        ans+=((sum(a))**0.5).is_integer()

print(ans)

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define REP(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, a, b) for(int i=(a); i<(b); ++i)
#define FORR(i, a, b) for(int i=(b)-1; i>=(a); --i)

#define DEBUG(x) cout<<#x<<": "<<(x)<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
#define ALL(a) (a).begin(), (a).end()

template<typename T> inline void CHMAX(T& a, const T b) {if(a<b) a=b;}
template<typename T> inline void CHMIN(T& a, const T b) {if(a>b) a=b;}

constexpr ll MOD=1000000007ll;
// constexpr ll MOD=998244353ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

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

constexpr long double pi = 3.141592653589793;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout<<setprecision(12)<<fixed;
  long double a, b, h, m;
  cin>>a>>b>>h>>m;
  long double A=(h+m/60)/12*2*pi, B=m/60*2*pi;
  long double C=abs(A-B);
  cout<<sqrt(a*a+b*b-2*a*b*cos(C))<<'\n';
  return 0;
}


Measured memory_bytes: 4184
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
#define MOD 1000000007;
#define MAX_N 1010
#define MAX_K 1010

/*
    Ball and Boxes 12
*/

ll p[MAX_N][MAX_K];

int main() {
    ll n, k;
    cin >> n >> k;

    srep(i,0,n+1){
        srep(j,1,k+1){
            if(i <= 1 || j == 1){
                p[i][j] = 1;
            }else if(i < j){
                p[i][j] = p[i][j-1];
            }else{
                p[i][j] = p[i][j-1] + p[i-j][j];
            }
            p[i][j] %= MOD;
        }
    }

    if(n < k){
        cout << '0' << endl;
        return 0;
    }

    cout << p[n-k][k] << endl;
    return 0;
}
 
 



Measured memory_bytes: 10984
N = int(input())

if N <= 6:
  print(1)
elif N <= 11:
  print(2)
else:
  x,y = divmod(N,11)
  if y == 0:
    print(x * 2)
  elif y <= 6:
    print(x * 2 + 1)
  else:
    print(x * 2 + 2)


Measured memory_bytes: 3064
#include<stdio.h>

struct cell{
    struct cell *prev;
    struct cell *next;
    int flag;
}s[200000];
int a[200000];

int main(){
    int i,j,p,n,m,q;
    struct cell *now;

    scanf("%d%d%d",&n,&m,&q);
    for(i = 0;i < m;i++){
        scanf("%d",&a[i]);
    }

    for(i = 0;i < n;i++){
        if(i)s[i].prev = &s[i - 1];
        else s[i].prev = &s[n - 1];
        if(i == n - 1)s[i].next = &s[0];
        else s[i].next = &s[i + 1];
        s[i].flag = 1;
    }
    now = &s[0];

    for(i = 0;i < m;i++){
        if(a[i] % 2){
            for(j = 0;j < a[i];j++){
                now = now -> prev;
            }
        }else{
            for(j = 0;j < a[i];j++){
                now = now -> next;
            }
        }
        now -> flag = 0;
        now -> prev -> next = now -> next;
        now -> next -> prev = now -> prev;
        now = now -> next;
    }

    while(q--){
        scanf("%d",&p);
        printf("%d\n",s[p].flag);
    }
    return 0;
}

Measured memory_bytes: 6068
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i,n) for (int i = 0; i < (n); ++i)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll INF=1LL<<60;
const int inf=(1<<30)-1;
const int mod=1e9+7;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;cin >> n;
    vector<int> a(n);
    for(int i=0;i<n;i++){
        cin >> a[i];
    }
    for(int i=1;i*2<=n;i++){
        if(n%i!=0){
            continue;
        }
        bool f=true;
        for(int j=0;j+i<n;j++){
            if(a[j]!=a[j+i]){
                f=false;
            }
        }
        if(f){
            cout << n/i << endl;
            return 0;
        }
    }
    cout << 1 << endl;
}



Measured memory_bytes: 3632
#include<stdio.h>

int main(void){

  int A, B, C;
  scanf("%d%d%d", &A, &B, &C);

  if( A==7 && B==5 && C==5) printf("YES\n");
  else if( A==5 && B==7 && C==5) printf("YES\n");
  else if( A==5 && B==5 && C==7) printf("YES\n");
  else printf("NO\n");

  return 0;

}


Measured memory_bytes: 128
#include <stdio.h>
#include <string.h>

int main() {
    char w[101] = { 0 };
    int s[200] = { 0 };
    int flag = 0;

    scanf("%s", w);

    for (int i = 0; i < strlen(w); i++) {
        s[w[i]]++;
    }

    for (int i = 'a'; i <= 'z'; i++) {
        if (s[i] % 2 != 0) {
            flag = 1;
            break;
        }
    }

    if (flag == 0) {
        printf("Yes\n");
    } else {
        printf("No\n");
    }
    return 0;
} 


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define YES cout<<"YES"<<endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define ANS cout << ans << endl
#define all(a) a.begin(),a.end()
#define SORT(a) sort(all(a))
#define REVERSE(a) reverse(all(a))
#define int long long
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define VIin(a) for(int i=0; i<a.size(); i++) cin >> a[i]
#define OUT(a) cout << a << endl
typedef vector<int> VI;
typedef vector<VI> VVI;
const int MOD=1e9+7;
const long long INF = 1LL << 60;
/*最大公約数*/int gcd(int x, int y) { return y ? gcd(y,x%y) : x;}
/*最小公倍数*/int lcm(int a, int b) { int g = gcd(a, b); return a / g * b; }
/*素数判定*/int isPrime(int n){if(n<2){return 0;}for(int i=2; i*i<=n; i++){if(n%i==0){return 0;}}return 1;}
/*約数列挙*/vector<int> getDivisor(int n){vector<int> v; for(int i=1; i*i<=n; i++){if(n%i==0){v.push_back(i);if(i!=n/i){v.push_back(n/i);}}}sort(v.begin(),v.end()); return v;}
//----------------------------------------------
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int n; cin >> n;
    string s; cin >> s;
    int ans = 1;
    rep(i,n-1) if(s[i] != s[i+1]) ans++;
    ANS;

    return 0;
}

Measured memory_bytes: 512
#include <stdio.h>

int main(){
    int a,b;
    int c;

    scanf("%d %d",&a,&b);
    
    if (10>b) c=a*10+b;
    else if (100>b) c=a*100+b;
    else c=a*1000+b;

    for (int i=2;i<=c;i++){
	if (c%i==0){
	    int x=i,y=c/i;

	    if (x==y){
		printf("Yes\n");
		return 0;
	    } else if (x > y){
		printf("No\n");
		return 0;
	    }
	}
    }

    return 0;
}

Measured memory_bytes: 128
def main():
    from itertools import accumulate
    n, *ab = map(int, open(0).read().split())
    c = list(zip(*[iter(ab)] * 2))
    c.sort(key=lambda x: (x[1], x[0]))
    *d, = map(lambda x: x[0], c)
    *f, = map(lambda x: x[1], c)
    t = list(accumulate(d))
    g = all(i <= j for i, j in zip(t, f))
    print('Yes' if g else 'No')


if __name__ == '__main__':
    main()


Measured memory_bytes: 50208
package main

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

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

var sc = bufio.NewScanner(os.Stdin)

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

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

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

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

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

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

const mod = 1000000007

func mpow(a, b int) int {
	if b == 0 {
		return 1
	} else if b%2 == 0 {
		tmp := mpow(a, b/2)
		return tmp * tmp % mod
	}
	return mpow(a, b-1) * a % mod
}

var fracMemo = []int{1, 1}

func mfrac(n int) int {
	if len(fracMemo) > n {
		return fracMemo[n]
	}
	if len(fracMemo) == 0 {
		fracMemo = append(fracMemo, 1)
	}
	for len(fracMemo) <= n {
		size := len(fracMemo)
		fracMemo = append(fracMemo, fracMemo[size-1]*size%mod)
	}
	return fracMemo[n]
}

var ifracMemo = []int{1, 1}

func mifrac(n int) int {
	if len(ifracMemo) > n {
		return ifracMemo[n]
	}
	if len(ifracMemo) == 0 {
		fracMemo = append(ifracMemo, 1)
	}
	for len(ifracMemo) <= n {
		size := len(ifracMemo)
		ifracMemo = append(ifracMemo, ifracMemo[size-1]*mpow(size, mod-2)%mod)
	}
	return ifracMemo[n]
}

func nCr(n, r int) int {
	if n == r {
		return 1
	}
	if n < r || r < 0 {
		return 0
	}
	ret := 1
	ret *= mfrac(n)
	ret %= mod
	ret *= mifrac(r)
	ret %= mod
	ret *= mifrac(n - r)
	ret %= mod
	return (ret)
}

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer([]byte{}, 1000000)

	N, K := getInt(), getInt()
	// N = 100000
	a := make([]int, N)
	for i := 0; i < N; i++ {
		a[i] = getInt()
	}

	if K == 1 {
		out(0)
		return
	}
	sort.Ints(a)
	comb := make([]int, N+5)
	for i := 0; i < N+5; i++ {
		comb[i] = nCr(i, K-1)
	}

	ans := 0
	for i := 0; i < 2; i++ {
		// out(a)
		for j := 0; j < N; j++ {
			now := comb[j]
			if i == 1 {
				now = -now
			}
			// out(j, now, a[j], ans)
			ans = (ans + (now*a[j])%mod) % mod
		}
		for j := 0; j < N/2; j++ {
			a[j], a[N-1-j] = a[N-1-j], a[j]
		}
	}

	out(ans)
}


Measured memory_bytes: 7040
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define invrepr(i,a,b) for(int i=b-1;i>=a;i--)
#define invrep(i,n) invrepr(i,0,n)
#define repitr(itr,a) for(auto itr=a.begin();itr!=a.end();++itr)
const int MOD=1e9+7;


int main() {
    ios_base::sync_with_stdio(false);
    int r;
    cin >> r;
    cout << fixed << setprecision(15) << 2*r*3.141592 << endl;
    return 0;
}

Measured memory_bytes: 3828
#include <iostream>
#include <sstream>
#include <bitset>
#include <memory>
#include <string>
#include <vector>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <deque>
#include <algorithm>
#include <random>
#include <iomanip>

using namespace std;

int main(int argc, char *argv[]) {
	int k, n;
	cin >> k >> n;
	vector<int> v;
	for (int i = 0; i < n; i++) {
		int t;
		cin >> t;
		v.push_back(t);
	}
	vector<int> d;
	for (int i = 1; i < n; i++) {
		d.push_back(v[i] - v[i - 1]);
	}
	d.push_back(k - accumulate(d.begin(), d.end(), 0));
	cout << k - *max_element(d.begin(), d.end()) << endl;
}









Measured memory_bytes: 2548
#include <bits/stdc++.h>
using namespace std;
int solve(vector<int> &arr, int n, int k) {
	vector<int> dp(n, 0);
	for(int i = 1; i < n; i++) {
    	dp[i] = INT_MAX;
		for(int j = 1; (i-j) >=0 and j <= k; j++)
        	dp[i] = min(abs(arr[i]-arr[i-j])+dp[i-j], dp[i]);
	}
	return dp[n-1];
}
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n, k; cin >> n >> k;
	vector<int> arr(n);
	for(int i = 0; i < n; i++) cin >> arr[i];
	cout << solve(arr, n, k) << endl;
}

Measured memory_bytes: 3972
#include<stdio.h>
#include<stdlib.h>

int main()
{
    int N,K,i;
    char string[10],line[51];
    gets(string);
    N=atoi(string);
    for(i=0;i<10;i++){
        if(string[i] == ' ')
        break;
    }
    K=atoi(&string[i]);

    gets(line);

    
    for(i=0;i<N;i++){
        if(i != K-1)
        printf("%c",line[i]);
        else
        printf("%c",line[i]+32);
        
    }

    return 0;
}

Measured memory_bytes: 128
using namespace std;

#include <iostream>
#include <vector>
#include <set>
#include <string>
#include <algorithm>
#include <utility>
#include <functional>
#include <queue>
#include <cmath>
#include <numeric>
#include <map>
using namespace std;


int main(void){
	int N,M;

	cin >> N >> M;

	cout << (N < M ? 0 : 10) << endl;

	return 0;
}


Measured memory_bytes: 764
from itertools import starmap
import sys
readline = sys.stdin.readline
q = int(readline())
while q:
    q -= 1
    p0, p1, p2, p3 = starmap(complex, zip(*[map(int, readline().split())] * 2))
    prod = (p1 - p0).conjugate() * (p3 - p2)
    print(2 if abs(prod.imag) < 1e-6 else 1 if abs(prod.real) < 1e-6 else 0)

Measured memory_bytes: 7756