akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <algorithm>
#define repu(i,x,y) for (int i=x; i<=y; ++i)
using namespace std;

int n,m,a[110];

int main()
{
    scanf("%d%d",&n,&m);
    repu(i,1,m)
        scanf("%d",&a[i]);
    repu(i,2,m-1)
        if (a[i]&1)
            if (!(a[1]&1))
                swap(a[1],a[i]);
            else
                if (!(a[m]&1))
                    swap(a[m],a[i]);
                else
                {
                    puts("Impossible");
                    return 0;
                }
    repu(i,1,m)
        printf("%d ",a[i]);
    if (m==1)
    {
        if (a[1]==1)
            printf("\n1\n1\n");
        else
            printf("\n2\n1 %d\n",a[1]-1);
        return 0;
    }
    printf("\n%d\n",m-(a[1]==1));
    if (a[1]>1)
        printf("%d ",a[1]-1);
    repu(i,2,m-1)
        printf("%d ",a[i]);
    printf("%d\n",a[m]+1);
    return 0;
}

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

using namespace std;

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

    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cmath>
#include <string>
#include <vector>
#include <utility>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <algorithm>
using namespace std;
typedef long double ld;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
#define rep(i,n)	for(int i=0;i<n;i++)
#define srep(i,a,n)	for(int i=a;i<n;i++)
#define REP(i,n)	for(int i=0;i<=n;i++)
#define rrep(i,n)	for(int i=n-1;i>=0;i--)
#define all(a)	begin(a),end(a)
#define mp(a,b)	make_pair(a,b)
#define fst	first
#define scn second

const ll inf = (ll)1e18;
const ll mod = (ll)1e9 + 7;
const ld eps = 1e-9;

ll dp[100][2];

int main() {
	while (true) {
		string a;	cin >> a;
		if (a == "0")	break;
		string b, c;	cin >> b >> c;
		if (c.size() != max(c.size(), max(a.size(), b.size()))) {
			cout << 0 << endl;
			continue;
		}
		while (a.size() < c.size())	a = "0" + a;
		while (b.size() < c.size())	b = "0" + b;
		int n = c.size();
		rep(i, n)	dp[i][0] = dp[i][1] = 0;
		srep(i, 1, 10){
			if (a[0] != '?'&&i != a[0] - '0')	continue;
			srep(j, 1, 10){
				if (b[0] != '?'&&j != b[0] - '0')	continue;
				srep(k, 1, 10) {
					if (c[0] != '?'&&k != c[0] - '0')	continue;
					if (k == i + j) {
						dp[0][0]++;
					}
					else if (k == i + j + 1) {
						dp[0][1]++;
					}
				}
			}
		}
		srep(i, 1, n) {
			rep(x, 10) {
				if (a[i] != '?'&&x != a[i] - '0')	continue;
				rep(y, 10) {
					if (b[i] != '?'&&y != b[i] - '0')	continue;
					rep(z, 10) {
						if (c[i] != '?'&&z != c[i] - '0')	continue;
						if (z == (x + y) % 10) {
							dp[i][0] = (dp[i][0] + dp[i - 1][(x + y) / 10]) % mod;
						}
						if (z == (x + y + 1) % 10) {
							dp[i][1] = (dp[i][1] + dp[i - 1][(x + y + 1) / 10]) % mod;
						}
					}
				}
			}
		}
		cout << dp[n-1][0] << endl;
	}
	return 0;
}

Measured memory_bytes: 3116
from collections import Counter, defaultdict
import sys
sys.setrecursionlimit(10 ** 5 + 10)
# input = sys.stdin.readline
from math import factorial
import heapq, bisect
import math
import itertools


import queue
from collections import deque


def main():
    num = int(input())
    data = [input() for i in range(3)]

    ans = 0
    for i in range(num):
        aaa = set([data[0][i], data[1][i], data[2][i]])
        ans += len(aaa) - 1
    print(ans)



if __name__ == '__main__':
    main()
    # test()



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

typedef long long int ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<ll, ll> Pair;
typedef vector<Pair> VP;

#define MOD 1000000007
#define times(n) rep(_idx, n)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, s, n) for(int i = (int)(s); i < (int)(n); i++)
#define all(a) (a).begin(),(a).end()
#define in(a, l, r) (l <= a && a < r)
#define pb push_back
#define mk make_pair
#define out(x) cout << (x) << endl;
#define DU(x) cerr << #x << " = " << (x) << endl;

template<typename _Ty>ostream& operator << (ostream& ostr, const vector<_Ty>& v) {if (v.empty()) {ostr << "[]";return ostr;}ostr << "[" << v.front();for (auto itr = ++v.begin(); itr != v.end(); itr++) {ostr << ", " << *itr;}ostr << "]";return ostr;}

int main() {
    string S; cin >> S;
    
    int a = 0, b = 0, c = 0;
    for(auto ch: S) {
        if(ch == 'a') a++;
        else if(ch == 'b') b++;
        else c++;
    }

    if(abs(a - b) < 2 && abs(b - c) < 2 && abs(a - c) < 2) out("YES")
    else out("NO")

    return 0;
}


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

using namespace std;

typedef long long ll;
typedef long double ld;
#define rep(i,a,n) for(ll i=a;i<n;i++)
#define per(i,n,a) for(ll i=n-1;i>=a;i--)
#define nl "\n"
#define LLMAX 1e18
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define pll pair<ll,ll>
#define fastread cin.tie(0); cout.tie(0); ios::sync_with_stdio(false);
#define online_judge

const ll MOD=1e9+7;

ll pow(ll n, ll e){
  if(e==0)
    return 1;
  else if(e==1)
    return n;
  else if(e%2==0)
    return pow(n,e/2);
  else
    return pow(n,e/2)*n;
}

bool prime(ll n){
  ll ct=0;
  rep(i,2,sqrt(n)+1){
    if(n%i==0)
      return false;
  }
  return true;
}

void solve(){
  fastread;
  ll n,m,temp,mi,q,ma=0,t;
  
  cin >> n;
  (n>=30)?cout << "Yes":cout << "No";
}

int main(){
  #ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
  freopen("error.txt", "w", stderr);
  #endif
  clock_t start, end;
  start = clock();
  solve();
  end=clock();
  double time_taken = double(end - start) / double(CLOCKS_PER_SEC); 
    cerr << "Time taken by program is : " << fixed  
         << time_taken << setprecision(5); 
    cerr << " sec " << endl;
  return 0;
}

Measured memory_bytes: 3768
S = input()
N = list(map(int,S))
L = len(N)

dp = [[0]*2 for i in [0]*(L+1)]
dp[0][1] = 1

for i in range(L):
    n = N[i]
    dp[i+1][0] = min(dp[i][0] + n, dp[i][1] + 10-n)
    if n == 9:
        dp[i+1][1] = dp[i][1]
    else:
        dp[i+1][1] = min(dp[i][0] + n + 1, dp[i][1] + 10 - (n+1))

print(dp[L][0])




Measured memory_bytes: 154360
import java.util.*;

class Main{
	public static void main(String[] $){
		Scanner s=new Scanner(System.in);
		int n=s.nextInt();
		int[]a=new int[n];
		Arrays.setAll(a,i->s.nextInt());
		
		ArrayList<String>r=new ArrayList<>();
		
		int m=0;
		for(int i=1;i<n;++i)
			if(Math.abs(a[m])<Math.abs(a[i]))
				m=i;
		
		for(int i=0;i<n;++i)
			if(a[m]>=0^a[i]>=0)
				r.add(m+1+" "+(i+1));
		if(a[m]>=0) {
			for(int i=1;i<n;++i)
				r.add(i+" "+(i+1));
		}else {
			for(int i=n;i>1;--i)
				r.add(i+" "+(i-1));
		}
		
		System.out.println(r.size());
		r.forEach(System.out::println);
	}
}


Measured memory_bytes: 28500
n,a,b = map(int,input().split())
m = 10**9+7

def comb(n,k):
    ans = 1
    for i in range(1,k+1):
        ans =  ans * ((n-i+1) * pow(i,m-2,m))%m
        ans = ans%m
    return ans%m

print((pow(2,n,m)-comb(n,a)-comb(n,b)-1)%m)


Measured memory_bytes: 3060
n = int(input())
m = list(map(int, input().split()))

ans = "APPROVED"

for i in range(len(m)):
    if ans == "DENIED":
        break;
    if m[i] % 2 == 0:
        if m[i] % 5 == 0 or m[i] % 3 == 0:
            ans = 'APPROVED'
        else:
            ans = 'DENIED'
            break;

print(ans)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n;
ll moder = 1000000007;
ll dp[100005];
ll f(int curr){
	if(curr>n) return 0;
	ll&ret = dp[curr];
	if(~ret) return ret;
	ret = 0;
	ret+=f(curr+1)+f(curr+2);
	return ret%=moder;
}
int main(){
	memset(dp,-1,sizeof(dp));
	int m;
	cin>>n>>m;
	dp[n] = 1;
	while(m--){
		int a;
		cin>>a;
		dp[a] = 0;
	}
	cout<<f(0);
}

Measured memory_bytes: 8932
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>

using namespace std;

int main()
{
	int c[3][3];

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

	for (int i = 0; i < 2; i++)
	{
		for (int j = 0; j < 2; j++)
		{
			if (c[i][j] + c[i + 1][j + 1] != c[i + 1][j] + c[i][j + 1])
			{
				cout << "No" << endl;
				return 0;
			}
		}
	}

	cout << "Yes" << endl;

	return 0;
}

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

#define rep(i, n) for (int i = 0; i < n; i++)
#define rep1(i, n) for (int i = 1; i <= n; i++)
#define show(a, n) rep(i,n) {cout<<a[i]<<' ';} cout<<endl;

using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long ll;
typedef pair<long long, long long> pll;

const int INF = 1 << 30;
const long long INFL = 1LL << 62;
const int MOD = 1000000007;
const int MAX = 100000;
const int N = 200000;

int main() {
	ll n;
	cin >> n;
	pll p[N];
	rep(i, n) cin >> p[i].second >> p[i].first;
	sort(p, p + n);
	ll time = 0;
	bool ans = true;
	rep(i, n) {
		time += p[i].second;
		if(time > p[i].first) ans = false;
		if(!ans) break;
	}
	if(ans) cout << "Yes" << endl;
	else cout << "No" << endl;

}


Measured memory_bytes: 3456
#include <iostream>
#include <cstdio>
#include <string>
#include <sstream>
#include <algorithm>
#include <math.h>
#include <map>
#include <iomanip>
#include <vector>
#include <queue>

#define PI 3.14159265359

#define INF 1000000;

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

typedef long long ll;

using namespace std;


/*
class ElectronicPetEasy
{
public:
	string isDifficult(int st1, int p1, int t1, int st2, int p2, int t2)
	{
		
	}
};
*/


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


int main()
{
	ll a, b;
	ll gcd_num, lcm;
	
	while (cin >> a >> b)
	{
		gcd_num = gcd(a, b);
		lcm = a * b / gcd_num;
		cout << gcd_num << " " << lcm << endl;
	}
	
	return 0;
}

Measured memory_bytes: 1156
// inputに入力データ全体が入る
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
  input = input.split("\n")
  tmp0 = input[0].split(" ")
  N = Number(tmp0[0])
  M = Number(tmp0[1])
  C = Number(tmp0[2])
  B = input[1].split(" ")

  var ans = 0;
  for(var i = 0; i < N; i++)
  {
    A = input[2 + i].split(" ")
    var tmpSum = 0
    for(var j = 0; j < M; j++)
    {
      tmpSum += Number(A[j]) * Number(B[j])
    }
    if( (tmpSum+ C) > 0){
      ans++;
    }

  }
  console.log(ans)
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
// Main("3 2\n2 1\n")

Measured memory_bytes: 7500
/*
ACplease
　　 ●
　　/⌒ヽ
　 ｜ 　|/⌒ヽ(ヽ
　 (｀　∥ー⌒) |
　|￣||￣￣￣￣￣|
　|―||―――――|
　|　Ｕ　　　　　|
　|￣￣￣￣￣￣￣|
　|＿＿＿＿＿＿＿|
　　|―――――|
　　|―――――|
ｗｗＷｗｗＷｗＷＷｗ
*/
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>
#include <cassert>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repe(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 KOZYUN(a) sort(all(a),greater<int>())
#define int ll
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORe(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
#define IN(a) cin >> a
#define INT(a) int a; cin >> a
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(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout<<fixed<<setprecision(15);
    srand((unsigned)time(NULL));
    
    string s; cin >> s;
    string rs = s;
    REVERSE(rs);
    if(s != rs){
        No;
        return 0;
    }
    string t = s.substr(0,(s.size()-1)/2);
    string rt = t;
    REVERSE(rt);
    if(t != rt){
        No;
        return 0;
    }
    string u = s.substr((s.size()+3)/2-1);
    string ru = u;
    REVERSE(ru);
    if(u != ru){
        No; 
        return 0;
    }
    Yes;

    return 0;
}

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

int main(){
  int n, r, x;
  cin >> n >> r;
  if (n < 10)
  {
    x = r + 100 * (10 - n);
  }
  if (n >= 10)
  {
    x = r;
  }
  cout << x;
  return 0;
}


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

int main() {
  int n;
  cin >> n;
  int cnt[200000] = {}, a;
  for (int i=1; i<n; i++) {
    cin >> a;
    cnt[--a]++;
  }
  for (int i=0; i<n; i++)
    cout << cnt[i] << endl;
  return 0;
}

Measured memory_bytes: 4424
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#include <random>
#include <chrono>

using namespace std;

typedef long long ll;
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());

void solve() {
	int n;
	cin >> n;
	vector<ll> a(n);
	for (int i = 0; i < n; i++)
		cin >> a[i];
	ll cur = 1000;
	for (int i = 0; i < n;) {
		bool is = 0;
		int j = i + 1;
		while (j < n && a[j - 1] <= a[j])
			j++;
		if (j - i > 1) {
			ll cnt = cur / a[i];
			cur %= a[i];
			cur += cnt * a[j - 1];
		}
		i = j;
	}
	cout << cur;
}

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
#if defined(_DEBUG)
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	int q = 1;
	//cin >> q;
	for (; q > 0; q--) {
		solve();
		cout << endl;
	}
}

Measured memory_bytes: 3648
//============================================================================
// Name        : JOI.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <math.h>
#include <stdio.h>
#include <vector>
using namespace std;
typedef long long ll;
string S;
int main(){
	cin>>S;

	if(S=="a"||S=="i"||S=="u"||S=="e"||S=="o")cout<<"vowel"<<endl;
	else cout<<"consonant"<<endl;


	return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() {
    long long N, sum = 0;
    long long list[10000];
    long long max = -1000000, min = 1000000;
    cin >> N;
    for (long long i = 0; i < N; i++) {
        cin >> list[i];
        sum += list[i];
        if (list[i] > max)
            max = list[i];
        if (list[i] < min)
            min = list[i];
    }
    cout << min << " " << max << " " << sum << "\n";
    return 0;    
}


Measured memory_bytes: 3176
#include<bits/stdc++.h>
using namespace std;
inline void rd(long long &x){
  int k, m=0;
  x=0;
  for(;;){
    k = getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
inline void wt_L(char a){
  putchar_unlocked(a);
}
inline void wt_L(long long x){
  char f[20];
  int m=0, s=0;
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    putchar_unlocked('-');
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
int main(){
  long long A, B, X, res;
  rd(A);
  rd(B);
  rd(X);
  res = (B+X) / X - (A+X-1) / X;
  wt_L(res);
  wt_L('\n');
  return 0;
}
// cLay varsion 20190715-1

// --- original code ---
// {
//   ll A, B, X, res;
//   rd(A, B, X);
//   res = (B+X) / X - (A+X-1) / X;
//   wt(res);
// }


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cctype>
#include <ctime>
#include <climits>
#include <cfloat>
#include <cstdint>
#include <cstddef>
#include <cinttypes>
#include <memory>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <array>
#include <valarray>
#include <string>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <stack>
#include <bitset>
#include <queue>
#include <complex>
#include <tuple>
#include <utility>
#include <functional>
#include <algorithm>
#include <numeric>

using namespace std;

const double EPS = 1e-10;
const int64_t INF = 1e9;

const int MAX_N = 1e5;

int N, K;
int64_t a[MAX_N];

int64_t s[MAX_N + 1];
int64_t sp[MAX_N + 1];

// [a, b)
int64_t su(int64_t *ary, int a, int b)
{
	return ary[b] - ary[a];
}

void solve()
{
	s[0] = sp[0] = 0;
	for (int i = 0; i < N; ++i) {
		s[i + 1] = s[i] + a[i];
		if (a[i] >= 0) sp[i + 1] = sp[i] + a[i];
		else sp[i + 1] = sp[i];
	}

	int64_t r = 0;
	for (int i = 0; i + K <= N; ++i) {
		int64_t t = su(sp, 0, i) + su(sp, i + K, N);
		int64_t t2 = su(s, i, i + K);
		if (t2 < 0) { t2 = 0; }
		r = max(r, t + t2);
		//printf("%d: %" PRId64 "\n", i, t + t2);
	}
	printf("%" PRId64 "\n", r);
}

int main()
{
	scanf("%d%d", &N, &K);
	for (int i = 0; i < N; ++i) {
		scanf("%" SCNd64, &a[i]);
	}
	solve();

	return 0;
}



Measured memory_bytes: 2560
import sys
input = sys.stdin.readline
import numpy as np

def main():
    N, K = [int(item) for item in input().split()]
    h =np.array([int(item) for item in input().split()])
    dp = np.full(N+K, 10**10+1, dtype='int64')
    dp[0] = 0

    for i in range(1, N):
        max1 = min(N, i+K)
        cost = abs(h[i:max1] - h[i-1])
        dp[i:max1] = np.minimum(dp[i:max1], dp[i-1] + cost)

    print(dp[N-1])

main()

Measured memory_bytes: 23076
#include <cstdio>
#include <cstring>
long long n;char s[100001];int m;
int main()
{scanf("%lld",&n);
	long long k=0;int pw;long long rdx=26;
	for(pw=1;;++pw)
	{
		k+=rdx;rdx*=26;
		if(k>=n)break;
	}
	rdx/=26;k-=rdx;
	n-=k;--n;
for(int i=1;i<=pw;++i)	{
		s[++m]=n%26+'a';n/=26;
	}
	for(int i=m;i>=1;--i)printf("%c",s[i]);putchar(10);return 0;
}

Measured memory_bytes: 1644
#include<bits/stdc++.h>
using namespace std;
namespace FAST_IO
{
	template<typename T> void read(T &a)
	{
		a=0;
		int f=1;
		char c=getchar();
		while(!isdigit(c))
		{
			if(c=='-')
			{
				f=-1;
			}
			c=getchar();
		}
		while(isdigit(c))
		{
			a=a*10+c-'0';
			c=getchar();
		}
		a=a*f;
	}
	template <typename T> void write(T a)
	{
		if(a<0)
		{
			a=-a;
			putchar('-');
		}
		if(a>9)
		{
			write(a/10);
		}
		putchar(a%10+'0');
	}
	template <typename T> void writeln(T a)
	{
		write(a);
		puts("");
	}
}
int n;
struct p
{
	int id,pp;
};
p ps[100001];
bool cmp(p a,p b)
{
	return a.pp<b.pp;
}
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>ps[i].pp;
		ps[i].id=i;
	}
	sort(ps+1,ps+n+1,cmp);
	for(int i=1;i<=n;i++)
	{
		cout<<ps[i].id<<" ";
	}
}

Measured memory_bytes: 1536
use proconio::input;

fn main() {
    input!(n: u32);
    let cal = |i: u32, j: u32, k: u32| i * i + j * j + k * k + i * j + j * k + k * i;
    let mut ans = vec![0; n as usize + 1];
    for i in (1..=n).take_while(|i| i * i <= n) {
        for j in (1..=n).take_while(|j| i * i + j * j <= n) {
            for k in (1..=n).take_while(|&k| cal(i, j, k) <= n) {
                ans[cal(i, j, k) as usize] += 1;
            }
        }
    }
    for x in ans.iter().copied().skip(1) {
        println!("{}", x);
    }
}


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

using ll=long long;

int main() {
  int a,b; cin >>a >>b;
  if (0<a and a<=b) {
    cout <<"Positive" <<endl;
  } else if (a<=b and b<0) {
    if ((b-a+1)%2==0) {
      cout <<"Positive" <<endl;
    } else {
      cout <<"Negative" <<endl;
    }
  } else if (a<=0 and 0<=b) {
    cout <<"Zero" <<endl;
  }
  return 0;
}


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

int main()
{
	long long  m = 100010;
	long long m1 = INT_MAX - 1000000010;
	long long N,W;
	cin>>N>>W;
	long long v[N+1];
	long long w[N+1];
	long long dp[N+1][m];
	for(int i=1; i<=N; i++)
	{
		long long temp1,temp2;
		cin>>temp1>>temp2;
		w[i] = temp1;
		v[i] = temp2;
	}
	//dp[i][j] is min weight till ith index and value eq to j
	for(int i=0; i<=N; i++)
	{
		for(int j=0; j<=m; j++)
		{
			if(j==0)
			{
				dp[i][j] = 0;
			}else if(i==0 && j!=0)
			{
				dp[i][j] = m1;
			}else
			{
				if(j-v[i]<0)
				{
					dp[i][j] = dp[i-1][j];
				}
				else
				{		
					dp[i][j] = min(dp[i-1][j-v[i]]+w[i] ,dp[i-1][j]);
				}
			}
		}
	}
	long long ans;
	for(int i=0; i<m; i++)
	{
		if(dp[N][i]<=W)
		{
			ans= i;
		}
	}
		
	cout<<ans;
	return 0;
}

Measured memory_bytes: 79104
#include <iostream>
using namespace std;
int main(void){
	int n,a[200010],i,all;
	cin >> n;
	cin >> a[0];
	all = a[0];
	for (i=1 ; i<n ; i++) {
		cin >> a[i];
		all = all^a[i];
	}
	for (i=0 ; i<n ; i++){
		printf("%d",all^a[i]);
		if (i!=n-1) {
			printf(" ");
		}
	}
	cout << '\n';
}


Measured memory_bytes: 4384
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
int INF = 1e9+7;
int mod = 1234567;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
signed main() {
    int N;
    cin >> N;
    vector<int>a(N);
    for(int i = 0; i < N; i++) {
        cin >> a[i];
        if(a[i]%2 == 1) {
            cout << "first" << endl;
            return 0;
        }
    }
    cout << "second" << endl;
}


Measured memory_bytes: 3972
#include<cstdio>
#include<cstring>

#define M 1090003
#define L 14

char H[M][L];; /* Hash Table */

int getChar(char ch){
  if ( ch == 'A') return 1;
  else if ( ch == 'C') return 2;
  else if ( ch == 'G') return 3;
  else if ( ch == 'T') return 4;
}

/* convert a string into an integer value */
long long getKey(char str[]){
  long long sum = 0, p = 1, i;
  for ( i = 0; i < strlen(str); i++ ){
    sum += p*(getChar(str[i]));
    p *= 5;
  }
  return sum;
}

int h1(int key){ return key; }
int h2(int key){ return key+1; }
int hash(int key,int crash){return (h1(key)+crash+crash*h2(key))%M;}

int find(char str[]){
  long long key=getKey(str);
  int hvalue,crash=0;
  while(true){
    hvalue=hash(key,crash);
    if(strcmp(H[hvalue],str)==0) return 1;
    if(strlen(H[hvalue])==0) return 0;
    crash++;
  }
}

int insert(char str[]){
  long long key=getKey(str);
  int hvalue,crash=0;
  while(true){
    hvalue=hash(key,crash);
    if(strcmp(H[hvalue],str)==0) return 1;
    else if(strlen(H[hvalue])==0){
      strcpy(H[hvalue],str);
      return 0;
    }
    crash++;
  }

}

int main(){
    int i, n, h;
    char str[L], com[9];
    for ( i = 0; i < M; i++ ) H[i][0] = '\0';

    scanf("%d", &n);

    for ( i = 0; i < n; i++ ){
	scanf("%s %s", com, str);

	if ( com[0] == 'i' ){
	    insert(str);
	} else {
	    if (find(str)){
		printf("yes\n");
	    } else {
		printf("no\n");
	    }
	}
    }

    return 0;
}



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

int main(int argc, char *argv[]){
  int N, M, Q;
  cin >> N >> M;
  cin >> Q;
  int i, j;
  int a[Q];
  for(i=0; i<Q; ++i){
    cin >> a[i];
  }
  int ind[M];
  for(i=0;i<M;++i){ind[i] = -1;}
  int laststock = 0;
  int lastcount[M];
  int before[M];
  int bef = -1;
  for(i=Q-1; i>=0; --i){
    int index = ind[a[i]-1];
    if(index == -1){
      ind[a[i]-1] = laststock;
      lastcount[laststock] = 1;
      laststock++;
    }else{
      if(index == 0 || lastcount[index] < lastcount[index-1]){
        lastcount[index]++;
      }
    }
  }
  int maxind = -1;
  int maxcover = N;
  for(i=0; i<M; ++i){
    if(ind[i] < 0){break;}
    bool f1 = false;
    bool f2 = false;
    if(ind[i] > maxind){
      maxind = ind[i];
      f1 = true;
    }
    if(lastcount[ind[i]] <= maxcover){
      maxcover = lastcount[ind[i]];
      f2 = true;
    }
    if(f1 && f2){
      lastcount[ind[i]] = N;
    }
  }
  bool ans = true;
  for(i=0; i<laststock; ++i){
    if(lastcount[i] < N){
      ans = false;
    }
  }
  if(ans){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  return 0;
}

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


Measured memory_bytes: 3092
a,b,c=map(int,input().split())
d=0
while a%2==0 and b%2==0 and c%2==0:
    if a==b==c:
        print(-1)
        break
    d+=1
    ha=a//2
    hb=b//2
    hc=c//2
    a=hb+hc
    b=ha+hc
    c=ha+hb
else:print(d)

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

bool CardGame(int y1, int y2, int o)
{
  int ok = 0;
  for (int i = 1; i <= 10; i++) {
    if (i == y1 || i == y2 || i == o)
      continue;
    if (i + y1 + y2 <= 20)
      ok++;
  }
  return ok > 3;
}

int main(int argc, char **argv)
{
  int c1, c2, c3;
  while (cin >> c1 >> c2 >> c3) {
    if (CardGame(c1, c2, c3))
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
  return 0;
}

Measured memory_bytes: 1156
import heapq
from collections import deque
from enum import Enum
import sys
import math
from _heapq import heappush, heappop
import copy

BIG_NUM = 2000000000
HUGE_NUM = 99999999999999999
MOD = 1000000007
EPS = 0.000000001
#sys.setrecursionlimit(3**12)


class TRAMP:
    def __init__(self,arg_mark,arg_number,arg_input_index):
        self.mark = arg_mark
        self.number = arg_number
        self.input_index = arg_input_index

N = int(input())
table = []
for input_index in range(N):
    mark,number = map(str,input().split())
    table.append(TRAMP(mark,int(number),input_index))

def Partition(left,right):
    global table
    i = left-1
    pivot = table[right].number
    for start in range(left,right):
        if table[start].number <= pivot:
            i += 1
            table[i],table[start] = table[start],table[i]
    table[i+1],table[right] = table[right],table[i+1]
    return i+1

def quickSort(left,right):
        if left < right:
            q = Partition(left,right)
            quickSort(left,q-1)
            quickSort(q+1,right)

quickSort(0, N-1)
stable_FLG = True

for i in range(1,N):
    if table[i].number == table[i-1].number and table[i].input_index < table[i-1].input_index:
        stable_FLG = False
        break

if stable_FLG:
    print("Stable")
else:
    print("Not stable")

for i in range(N):
    print("%s %d"%(table[i].mark,table[i].number))




Measured memory_bytes: 30296
// i_am_arin

#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<long long> vll;
typedef vector<string> vs;


#define f(i, a, n) for(ll i=a; i<(ll)n; i++)
#define f2(i, a, b) for(ll i=a; i<=(ll)b; i++)
#define PB push_back
#define FF first
#define SS second
const ll MOD = 1e9+7;
const ll INF = LLONG_MAX;

ll dp[100005];
ll a[100005];
ll n;
void fill(){
	f(i,0,100005) dp[i]=-1;
}



ll go(ll n){
	if(n==2) return abs(a[n]-a[n-1]);
	if(n==1) return 0;
	if(n<0) return INF;
	if(dp[n]!=-1) return dp[n];

	return dp[n]=min((go(n-1)+abs(a[n]-a[n-1])),go(n-2)+abs(a[n]-a[n-2]));

}

void solve(){
cin>>n;
fill();
f(i,1,n+1) cin>>a[i];
cout<<go(n)<<endl;
}

int main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int t=1;
	//cin>>t;
	while(t--){
		solve();
	}
	return 0;
}

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

int main() {
    long long H;
    cin>>H;
    long long val=1;
    long long ans=0;
    while(H>0){
        ans+=(val);
        H=H/2;
        val=val*2;
    }
    cout<<ans;
	return 0;
}

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

using namespace std;

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

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

const int MAX = 100001;
double dp[MAX+1][20], ans[MAX], pr[20];

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

  pr[1] = 1.;
  for(int i=2;i<20;++i)
	pr[i] = pr[i-1] * 0.5;

  double sum = 0.;
  dp[1][1] = 1.;
  for(int i=1;i<MAX;++i){
	for(int j=1;j<20;++j){
	  if(dp[i][j] > 0){
		sum += dp[i][j] * pr[j];
		if(j == 1)
		  dp[i+1][2] += dp[i][1];
		else{
		  dp[i+1][1] += dp[i][j] * (1 - pr[j]);
		  dp[i+1][j+1] += dp[i][j] * pr[j];
		}
	  }
	}
	ans[i] = sum;
  }

  int N;
  while(cin>>N,N){
	cout << fixed << setprecision(3) << ans[N] << endl;
  }
  
  return 0;
}

Measured memory_bytes: 17668
#include<algorithm>
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
int A=0,B=0,N=0,sum=0,Xa,Xb,min1[3];
int main(void){	
	cin>>A>>B>>N;
	if(N%1000!=0){Xa=N/1000+1;}
	else{Xa=N/1000;}
	if(N%500!=0){Xb=N/500+1;}
	else{Xb=N/500;}
	min1[0]=Xa*A;
	min1[1]=Xb*B;
	if(N%1000!=0&&N%1000<=500&&Xa>=2){
		min1[2]=(Xa-1)*A+B;
	}
	else{
		min1[2]=1001*20;
	}
	sum=min(min1[0],min(min1[1],min1[2]));
	cout<<sum<<endl;
	return 0;
}
//


Measured memory_bytes: 3104
import java.util.*;
import static java.lang.System.out;

// String
public class Main {
	public static void main(String[] args) {
		new Main().AOJ0050();
	}
	Scanner sc = new Scanner(System.in);
	
	void AOJ0050(){	// Apple and Peach
		while(sc.hasNext()) out.println(sc.nextLine().replaceAll("apple", "PEACH").replaceAll("peach", "apple").replaceAll("PEACH", "peach"));
	}
	
	void AOJ0039(){	// Roman Figure ローマ数字 -> 10進数
		HashMap<Character,Integer> dic = new HashMap<Character,Integer>();
		dic.put('I', 1);	dic.put('V', 5);	dic.put('X', 10);	dic.put('L', 50);
		dic.put('C', 100);	dic.put('D', 500);	dic.put('M', 1000);
		while(sc.hasNext()){
			char[] c = sc.next().toCharArray();
			int ans=0,last=dic.get(c[0]);
			for(int i=0; i<c.length; i++){
				if(last>=dic.get(c[i])){
					ans+=dic.get(c[i]);
					last=dic.get(c[i]);
				}else{
					ans+=dic.get(c[i])-last-last;
					last=dic.get(c[i]);
				}
			}
			out.println(ans);
		}
	}
	
	void AOJ0020(){	// Capitalize 大文字変換
		while(sc.hasNext())	out.println(sc.nextLine().toUpperCase());
	}
	
}

Measured memory_bytes: 12000
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
 
#define endl '\n'
#define ll long long
 
using namespace std;
 
int gcd(int a, int b) 
{
	while (b != 0) {
		int r = a % b;
		a = b;
		b = r;
	}
	return a;
}
 
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
 
	int n;
	cin >> n;
 
	long long sum = 0;
	for (int i = 1; i <= n; i++)
	{
		for (int j = 1; j <= n; j++)
		{
			for (int k = 1; k <= n; k++)
			{
				sum += gcd(i, gcd(j, k));
			}
		}
	}
	cout << sum << endl;
 
	return 0;
}

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

int main(){

  long long int n, a[111111];
  long long int ans = 0;
  long long int cnt = 0;
  long long int p = 1<<30;

  cin >> n;
  for(long long int i=0;i<n;i++){
    cin >> a[i];
    ans += abs(a[i]);
    if(a[i] < 0) cnt++;
    p = min(p, abs(a[i]));
  }

  //cout << cnt << " " << ans << " " << p << endl;

  if(cnt%2 == 1) ans -= 2*p;


  cout << ans << endl;

}


Measured memory_bytes: 1024
A, B, C = map(int, input().split())

S = A + B + C
D = max(A, B, C)
S_ = S
while True:
    if S_ % 3 == 0:
        E = S_ // 3
        if E >= D:
            F = 3*E - A - B - C
            if F % 2 == 0:
                ans = F // 2
                break
    S_ += 2

print(ans)

Measured memory_bytes: 3060
#!/usr/bin/env python3

import itertools
mod = 1000000007

h, w, k = list(map(int, input().split()))

dp = [[0]*(w) for _ in range(h+1)]

dp[0][0] = 1

for h_ in range(1, h+1):
    for bridges in itertools.product([0, 1], repeat=w-1):
        flag = 0
        for j in range(len(bridges)-1):
            if bridges[j] == 1 and bridges[j+1] == 1:
                flag = 1
                continue
        if flag == 1:
            continue
        # print(bridges)
        for w_ in range(w):
            if w_ > 0:
                if bridges[w_-1] == 1:
                    dp[h_][w_] += dp[h_-1][w_-1] % mod
                    continue
            if w_ < w-1:
                if bridges[w_] == 1:
                    dp[h_][w_] += dp[h_-1][w_+1] % mod
                    continue
            dp[h_][w_] += dp[h_-1][w_] % mod

# print(dp)

print(dp[-1][k-1] % mod)


Measured memory_bytes: 9188
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
    
int main()
{
    int N;
    cin >> N;
    int K;
    cin >> K;
    bool D[10] = {true,true,true,true,true,true,true,true,true,true}; 
    for( int i = 0;i < K; ++i ){
        int temp = 0;
        cin >> temp;
        D[temp] = false; 
    }
    int keta = 0;
    int result[6];
    for( int result = N; result < N * 100; ++result ){
        bool check = true;
        int c = result;
        do{
            if( !D[c % 10] ){ 
                check = false;
                break;
            } 
            c = c / 10;
        }while(c > 0);
        if( check ){
            cout << result << endl;
            break;
        }
    }    
    return 0; 
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>

using namespace std;

typedef long long int ll;

const int N = (int) 1e5 + 10;
const ll oo = 1e18;

int n;
int a[N];

void solve() {
  cin >> n;
  for(int i = 0; i < n; ++i) cin >> a[i];
  a[0]--;
  for(int i = 1; i < n; ++i) {
    if(a[i] - 1 >= a[i - 1]) a[i]--;
    else if(a[i] >= a[i - 1]) continue;
    else {
      cout << "No" << endl;
      return;
    }
  }
  cout << "Yes" << endl;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.precision(20);
  cout << fixed;
  solve();
  return 0;
}


Measured memory_bytes: 640
#include<stdio.h>
#include<math.h>

int main(void)

{
	int a ,b ,c;
	
	while(scanf("%d %d %d",&a ,&b ,&c)!=EOF)
	{
		if(a==-1 && b==-1 && c==-1)
		{
		  break; 
		} 
		else if(a==-1 || b==-1 && c==-1 )
		{
			printf("F\n");
		}
		
		else if(a+b<30)
		{
			printf("F\n");
		}
		else if (a+b>=80)
		{
			printf("A\n");
		}
		else if(a+b>=65 && a+b<80)
		{
			printf("B\n");
		}
		else if (a+b>=50 && a+b<65)
		{
			printf("C\n");
		}
		else if(a+b>=30 && a+b<50 &&c<50)
		{
				printf("D\n");
		}
	
		else if(a+b>=30 && a+b<50)
		{
			
			if(c>=50)
			{
				printf("C\n");
			}	
		}

	}
	
	
}


Measured memory_bytes: 2576
#塩基を入力
base = input()
"AとTのペアで出力、CとGのペアで出力"
if base == "A":
    print("T")
elif base == "T":
    print("A")
elif base == "C":
    print("G")
#AでもTでもCでもなければGなのでCを出力
else:
    print("C")

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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long

int32_t main(){

        IOS;
     //    int n, m;
     //    cin >> n >> m;
     //    if(m == 1)
     //     { cout << 0 << endl;return 0; }
     //    int j=n, ans = 1;
     //    while(j < m){
     //         j = (j+n)-1;
     //         ans++;
     //    }
     //    cout << ans << endl;
          int n;
          cin >> n;
          vector<int> v(n+1);
          for(int i=1;i<=n;i++)
               cin >> v[i];
          int start=1,i=1,j=2;
          int ans=0;
          while(i < n){
               if(v[i] >= v[j]){
                   i++; j++;
               }
               else{
                    if(j!=n){
                         ans = max(ans,(i-start));
                         start = j;
                         i = j;j++;
                    }else{
                         break;
                    }
               }
          }
          ans = max(ans,(i-start));
          cout << ans << endl;

        
    return 0;
}



Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <unordered_map>
#include <cmath>
#include <queue>
#include <deque>
#include <set>
#include <iomanip>
#include <utility>
#define ll long long
#define ld long double
using namespace std;

int A[10010];
unordered_map<int, int> mx;
unordered_map<int, int> p[10010];
ll mod=1000000007;
ll modpow(ll a, ll b, ll m){
    ll res=1, p=0, now=a%m;
    b %= (m-1);
    for(int i=0; b>p; ++i){
        if(b&((ll) 1<<i)){
            res=(res*now)%m;
            p |= ((ll) 1<<i);
        }
        now=(now*now)%m;
    }
    return res;
}
ll modinv(ll a, ll m){
    return modpow(a, m-2, m);
}
ll moddiv(ll a, ll b, ll m){
    return (a*modinv(b, m))%m;
}


int main() {
	int N;
	cin >> N;
	for(int i=0; i<N; ++i) cin >> A[i];
	for(int i=0; i<N; ++i){
		int t=A[i];
		for(int j=2; j*j<=t; ++j){
			while(t%j==0){
				++p[i][j];
				t /= j;
			}
		}
		if(t>1) ++p[i][t];
		for(auto it : p[i]) mx[it.first]=max(mx[it.first], it.second);
	}
	ll lcm=1;
	for(auto it : mx){
		lcm=(lcm*modpow(it.first, it.second, mod))%mod;
	}
	ll ans=0;
	for(int i=0; i<N; ++i){
		ans=(ans+moddiv(lcm, A[i], mod))%mod;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3328
#include <stdio.h>
int main()
{
    int r, c, tmp;
    scanf("%d %d", &r, &c);
    int lst[r+1][c+1];
    for (int i = 0; i <= r; i++){
        for (int j = 0; j <= c; j++){
            lst[i][j] = 0;
        }
    }
    for (int i = 0; i < r; i++){
        for (int j = 0; j < c; j++){
            scanf(" %d", &lst[i][j]);
        }
    }
    for (int i = 0; i <= r; i++){
        for (int j = 0; j <= c; j++){
            if (i < r && j < c){
                lst[i][c] += lst[i][j];
                lst[r][j] += lst[i][j];
            }
            else {
                lst[r][c] += lst[i][j];
            }
        }
    }
    lst[r][c] /= 4;
    for (int i = 0; i <= r; i++){
        for (int j = 0; j <= c; j++){
            if (j != c){
                printf("%d ", lst[i][j]);
            }
            else {
                printf("%d\n",lst[i][j]);
            }
        }
    }
    return 0;
}


Measured memory_bytes: 2100
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>

using namespace std;

int check(int k) {

	if (k % 2 == 1) { return 1; }
	else if ((k % 3) == 0 || (k % 5) == 0) { return 1; }

	return 0;
}

int N, A[2000];

int main(void) {

	cin >> N;

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

	int num = 0;
	for (int i = 1; i <= N; i++) {
		num += check(A[i]);
	}

	if (num == N) { cout << "APPROVED" << endl; }
	else { cout << "DENIED" << endl; }


	return 0;
}

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

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define a first
#define b second
#define sz size()
#define pb(x) push_back(x) 
#define bg begin()
#define ed end()
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define mp(x,y) make_pair(x,y)
const ll MOD=1000000007;

vector<ll> pw2(51,1); vector<ll> pw10(19,1);
ll maxx(ll x,ll y,ll z){return max(max(x,y),z);}
ll minn(ll x,ll y,ll z){return min(min(x,y),z);}
ll mid(ll x,ll y,ll z){return x>y?y>=z?y:min(z,x):x>=z?x:min(y,z);}
ll gcd(ll x,ll y){if(x%y==0) return y;else return gcd(y,x%y);}
ll lcm(ll x,ll y){return x*(y/gcd(x,y));}
ll myceil(ll x,ll y){if(x<=y) return 1;else if(x%y==0) return x/y;else return x/y+1;}

//a,b x
int main(){
	ll N,M; cin>>N>>M;
    vector<ll> ans(N+1,0);
    rep(i,M){
        ll x,y; cin>>x>>y;
        ans[x]++;
        ans[y]++;
    }
	rep1(i,N) cout<<ans[i]<<endl;	
	
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define ceiv(a, b) (1 + (int)((a) - 1)/(int)(b))
//#define int long long

signed main(){
    string s; int k;
    cin >> s >> k;
    int n = (int) s.length();
    
    set<string> substrs;
    
    for(int l = 1; l <= k; l++){
        for(int i = 0; i + l <= n; i++){
            substrs.insert(s.substr(i,l));
        }
    }
    
    string ans;
    for(string str: substrs){
        ans = str;
        k--;
        if(k==0) break;
    }
    
    cout << ans << endl;
}

Measured memory_bytes: 1664
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Kyoto2016_B
{
    class Program
    {
        static int N, K;
        //static char[] A = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M','N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' }
        static string AA = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
        static void Main(string[] args)
        {
            var G = new int[26];

            var t = scan;
            N = t[0]; K = t[1];
            

            for (int i = 0; i < N; i++)
            {
                var s = Console.ReadLine();
                G[AA.IndexOf(s[0])]++;
            }

            int ans = 0;
            while (true)
            {
                Array.Sort(G);
                Array.Reverse(G);
                for (int i = 0; i < K; i++)
                {
                    if (G[i] == 0) goto end;
                    G[i]--; 
                }
                ans++;
            }
            end:

            Console.WriteLine(ans);
        }

        static int[] scan { get { return Array.ConvertAll(Console.ReadLine().Split(), int.Parse); } }
    }
}


Measured memory_bytes: 3160
import numpy as np
from collections import deque
h, w = map(int, input().split())
s = [input() for _ in range(h)]

segment = [[0]*w for _ in range(h)]
idx = 1
dxy = [[1, 0], [0, 1], [-1, 0], [0, -1]]
for y in range(h):
    for x in range(w):
        if segment[y][x] == 0:
            segment[y][x] = idx
            state = s[y][x]
            que = deque([[y, x, state]])
            while len(que) > 0:
                y_cur, x_cur, state = que.popleft()
                for dx, dy in dxy:
                    y_next = y_cur + dy
                    x_next = x_cur + dx
                    state_next = '.' if state == '#' else '#'
                    if x_next < 0 or y_next < 0 or x_next >= w or y_next >= h:
                        continue
                    elif s[y_next][x_next] != state_next:
                        continue
                    elif segment[y_next][x_next] == 0:
                        segment[y_next][x_next] = idx
                        que.append((y_next, x_next, state_next))
            idx += 1

# print(segment)
idx_max = idx
nbw = [[0, 0] for _ in range(idx_max+1)]
for y in range(h):
    for x in range(w):
        idx = segment[y][x]
        if s[y][x] == '#':
            nbw[idx][0] += 1
        else:
            nbw[idx][1] += 1
ans = 0
for nb, nw in nbw:
    ans += nb*nw
print(ans)


Measured memory_bytes: 31980
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        A solver = new A();
        solver.solve(1, in, out);
        out.close();
    }

    static class A {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            int n = Integer.parseInt(in.next());
            int k = Integer.parseInt(in.next());
            int ans = 0;
            if (k == 1) {
                out.println(0);
            } else {
                out.println(n - k);
            }

        }

    }
}



Measured memory_bytes: 35752
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;


//      DEEP

using namespace std;
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define all(v) v.begin(),v.end()
#define pb push_back
#define endl '\n'
#define mp make_pair

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef pair<int,int> pi;
typedef pair<long long,long long> pll;
typedef set<int> si;


/*
typedef tree<int,null_type,less<int>,rb_tree_tag,
tree_order_statistics_node_update> indexed_set;
*/
/*
typedef tree<
pair<int, int>,
null_type,
less<pair<int, int>>,
rb_tree_tag,
tree_order_statistics_node_update> ordered_set;
*/

const ll mod = 1e9 + 7;
const ll modl=998244353;
const double pie=3.1415926535;
                                                    //power
ull power(ull x,ull y){
   if(y==0) return 1;
   else{
     if(y%2==0) return power(x*x,y/2);
     else return x*power(x*x,(y-1)/2);
   }
}

                        //                    Modular Exponentiation

ll mod_power(ll x, ll y, ll m)
{
    ll r = 1;     // Initialize result

    x = x % m; // Update x if it is more than or equal to m

    if (x == 0) return 0; // In case x is divisible by m;

    while (y > 0)
    {
        // If y is odd, multiply x with result
        if (y & 1)
            r = (r*x) % m;

        // y must be even now
        y = y/2;
        x = (x*x) % m;
    }
    return r;
}

                                                      //GCD
ll gcd(ll x,ll y){
   if(y==0)return x;
   return gcd(y,x%y);
}
                                              // SIEVE

/*
bool isPrime[100001];
void sieve(int N) {

        for(int i = 0; i <= N;++i) {
            isPrime[i]=true;
        }
        isPrime[0]=false;
        isPrime[1]=false;

        for(int i = 2; i * i <= N; ++i) {
             if(isPrime[i] == true) {
                 for(int j = i * i; j <= N ;j += i)
                     isPrime[j] = false;
            }
        }
    }
*/


int main(){
    boost;
    int TESTS=1;
    //cin>>TESTS;
    while(TESTS--){
       int n;
       cin>>n;
       for(int i=1;i*i<=n;i++){
         if(n%i==0){
          if(i<=9&&(n/i)<=9){
            cout<<"Yes"<<endl;
            return 0;
          }
         }
       }
       cout<<"No"<<endl;
    }
}












Measured memory_bytes: 3652