akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>

int main(){
	int n, ok = 0;
	scanf("%d", &n);
	for (int i = 0; i <= 14; ++i) {
		for (int j = 0; j <= 25; ++j) {
			if (4 * j + 7 * i == n) {
				ok = 1;
			}
		}
	}

	printf(ok ? "Yes" : "No");
	return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main {

	private static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		int n = sc.nextInt();
		for (int i = 0; i <= 100 / 4 + 1; i++) {
			for (int j = 0; j <= 100 / 7 + 1; j++) {
				if (i * 4 + j * 7 == n) {
					System.out.println("Yes");
					return;
				}
			}
		}
		System.out.println("No");
	}
}

Measured memory_bytes: 21972
#-------------------------------------------------------------------
import sys
def p(*_a):
  _s=" ".join(map(str,_a))
  #print(_s)
  sys.stderr.write(_s+"\n")
#-------------------------------------------------------------------

N, W = map(int, input().split())
WV = [[0,0]]+[ list(map(int, input().split())) for _ in range(N) ]

#p(WV)

initW = 10**9+1

vmax = 1000*100

#値：w重さ (横：v価値)(縦：n品物)
dp = [[initW for v in range(vmax+1)] for _r in range(N+1)]

dp[0][0] = 0	#初期条件(必須！)


for iN in range(1,N+1):
	for iV in range(vmax+1):
		w,v = WV[iN]
		
		w0 =      dp[iN-1][iV]
		w1 = (w + dp[iN-1][iV-v]) if (iV-v >= 0) else initW
	
		dp[iN][iV] = min(w0, w1)

ans=0

for iV in range(vmax+1):
	w = dp[N][iV]
	if w>W: continue
	ans = max(ans,iV)

print(ans)


Measured memory_bytes: 171372
#include <iostream>
#include <stdio.h>
#include <memory.h>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <string>
#include <string.h>
#include <algorithm>

using ii = std::pair<int, int>;

int main()
{
	std::string a;
	std::cin >> a;

	long long int counts[26] = { 0, };

	for (auto& c : a)
		counts[c - 'a']++;

	long long int l = a.size();

	long long int total = l * (l + 1) / 2 + 1;

	for (int i = 0; i < 26; i++)
	{
		total -= counts[i] * (counts[i] + 1) / 2;
	}

	printf("%lld\n", total);

	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include<iomanip>
#include <cmath>
#include <climits>
#include <algorithm>
#include <stdio.h>
using namespace std;

int dp[100][100001];
int a[100];

int main(){
    int N;
    int K;

    cin >> N >> K;

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

      
    for(int i = 0; i < K + 1; i++){
        if(i <= a[0]){
            dp[0][i] = 1;
        }else{
            dp[0][i] = 0;
        }
    }

    for(int i = 1; i < N; i++){
        int sum = 0;
        for(int j = 0; j < K + 1; j++){
            sum = (sum + dp[i - 1][j]) % 1000000007;
            if(j - a[i] > 0){
                if(sum - dp[i - 1][j - a[i] - 1] < 0){
                    sum = 1000000007 + (sum - dp[i - 1][j - a[i] - 1]) % 1000000007;
                } else {
                    sum = (sum - dp[i - 1][j - a[i] - 1]) % 1000000007;
                }
            }
            dp[i][j] = sum;
        }
    }

    cout << dp[N - 1][K] << endl;

    /*
    for(int i = 0; i < N; i++){
        for(int j = 0; j < K + 1; j++){
            cout << dp[i][j] << " ";
        }
        cout << endl;
    }
    */
    return 0;

}

Measured memory_bytes: 39296
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define pi pair<ll, ll>
#define mp make_pair
#define pb push_back
#define vi vector<ll>
#define pd pair<double, double>
#define vp vector<pi>
#define f(i, n) for(int i = 0; i < n; i++)
#define fo(i, a, n) for(int i = a; i < n; i++)
#define mod (1000*1000*1000+7)
#define sz(x) int((x).size())
#define all(x) x.begin(),x.end()
#define DBG(v) cerr << #v << " = " << (v) << endl;
ll INF = (1ll<<30);

using namespace std;

int main(int argc, char* argv[])
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    int n; cin >> n;
    vi v(n);
    f(i, n) cin >> v[i];
    sort(all(v));
    ll ans = 0;
    f(i, n){
      fo(j, i+1, n){
        int k = lower_bound(v.begin()+j+1, v.end(), v[i] + v[j]) - v.begin();
        // DBG(k);
        ans += (k - j-1);
      }
    }
    cout << ans << endl;
    return 0;
}


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

using namespace std;

const int INF = 1e9;

int lower_b(vector<int> dp,int a){
    int lb = 0,ub=dp.size();
    while(ub-lb>1){
        int mid = (lb+ub)/2;
        if(dp[mid]<=a){
            ub = mid;
        }
        else
        {
            lb = mid;
        }
    }
    return ub;
}

int main()
{
    int N;
    cin >> N;
    vector<long long> A(N);
    for (int i = 0; i < N;i++){
        cin >> A[i];
    }
    
    vector<int> dp(N,INF);
    vector<set<int>> numbers(N);
    for (int i = 0;i<N;i++){
        auto it = lower_bound(dp.begin(), dp.end(), A[i]);
        *it = A[i];
        numbers[it - dp.begin()].insert(A[i]);
    }
    int len = lower_bound(dp.begin(),dp.end(),INF)-dp.begin();
    int l = INF;

    long long res = 0;
    for (int i = len - 1; i >= 0; i--)
    {
        auto it = numbers[i].lower_bound(l);
        it--;
        l = *it;
        res += *it;
    }
 
    cout << res << endl;
}


Measured memory_bytes: 13392
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>
#include<complex>

using namespace std;

#define ll long long
#define ld long double
#define INF 1e9
#define LINF (ll)INF*INF
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(int i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

const double PI=acos(-1);
const double EPS=1e-9; //うまくいかなかったらゆるめる

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef pair<pii,int> ppi;
typedef pair<int,pii> pip;
typedef vector<pii> vp;
typedef vector<vi> vvi;

int gcd(int a, int b){if(b==0) return a;return gcd(b,a%b);}
int lcm(int a, int b){return a/gcd(a,b)*b;}


signed main(void) {
    string a,b;
    cin >> a >> b;
    rep(i,a.size())if(a[i] != b[i]){
        cout << "No" << endl;
        return 0;
    }
    cout << "Yes" << endl;

}


Measured memory_bytes: 3128
import numpy as np
n,m,c = map(int,input().split())
f = lambda:list(map(int,input().split()))
base = np.array(f())
count = 0
for i in range(n):
  comp = np.array(f())
  ans = np.dot(base, comp)+c
  if ans > 0:
    count+=1
print(count)

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

using namespace std;

long long fib(long long n, vector<long long>& memo) {
    if (memo[n] >= 0) {
        return memo[n];
    }

    if (n == 0) {
        return 1;
    }
    else if (n == 1) {
        return 1;
    }
    else {
        long long ret = fib(n - 1, memo) + fib(n - 2, memo);
        memo[n] = ret;
        return ret;
    }
}

void Main() {
    long long n;
    cin >> n;

    vector<long long> memo(n + 10, -1LL);
    memo[0] = 1;
    memo[1] = 1;
    long long ans = fib(n, memo);
    cout << ans << endl;
}

int main() {
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}



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

#define what_is(x) cerr << #x << " is " << x << endl;
#define what_is_v(x) cerr << #x << " is "; for(auto&e: (x)) cerr << e << ' '; cerr << '\n'; //vector, set
#define what_is_a(x, n) cerr << #x << " is "; for(int i=0;i<n;i++) cerr << x[i] << ' '; cerr <<  '\n'; //n first element of array
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define st first
#define nd second
#define cerr_pair(x) '{' << x.st << ", " << x.nd << '}'
#define pwhat_is(x) cerr << #x << " is " << cerr_pair(x) << endl;
#define pwhat_is_v(x) cerr << #x << " is "; for(auto&e: (x)) cerr << cerr_pair(e) << ' '; cerr << '\n'; //vector, set
#define pwhat_is_a(x, n) cerr << #x << " is "; for(int i=0;i<n;i++) cerr << cerr_pair(x[i]) << ' '; cerr <<  '\n'; //n first element of array
#define endl '\n'
// #define int long long

typedef pair<int,int> pii;
const int N = 1e5+5;
const int INF = 1e9;
const int MOD = 1e9+7;

int n;
string s;
int32_t main()
{
	IOS
	//freopen("input.txt", "r", stdin);
	cin >> n >> s;
	if (n&1) return 0*puts("No");
	int mid = n/2;
	for(int i=0; i<mid; i++){
		if (s[i] != s[i+mid]) return 0*puts("No");
	}
	puts("Yes");
	return 0;
}


Measured memory_bytes: 256
N = int(input())
a = list(map(int, input().split()))
alice = 0
bob = 0

while True:
    alice += a.pop(a.index(max(a)))
    if len(a) <= 0:
        break
    bob += a.pop(a.index(max(a)))
    if len(a) <= 0:
        break

print(alice-bob)

Measured memory_bytes: 3060
/*
Date&Time: 12:19pm 3/10/2020
*/

#include <bits/stdc++.h>

using namespace std;

#define int long long

const int N = 2e5 + 10;

int ver[N * 2], nex[N * 2], head[N], cnt[2], ans[N], color[N];
int n, tot;
vector<int> a[3];

inline void add(int x, int y) {
	ver[++tot] = y;
	nex[tot] = head[x];
	head[x] = tot;
}

void dfs(bool c, int x, int fa) {
	color[x] = c;
	cnt[c]++;
	for (int i = head[x]; i; i = nex[i]) {
		int y = ver[i];
		if (y == fa) continue;
		dfs(!c, y, x);
	}
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin >> n;
	for (int i = 1; i <= n; i++) {
		a[i % 3].push_back(i);
	}
	for (int i = 1, u, v; i < n; i++) {
		cin >> u >> v;
		add(u, v), add(v, u);
	}
	dfs(1, 1, 0);
	int fl = 0;
	int r = cnt[0], b = cnt[1];
	if (r > b) swap(r, b), fl = !fl;
	int x = n / 3;
	int zero = 0, one = 0, two = 0;
	if (r <= x) {
		for (int i = 1; i <= n; i++) {
			if (color[i] == fl) {
				ans[i] = a[0][zero++];
			}
			else {
				ans[i] = one < a[1].size() ? a[1][one++] : two < a[2].size() ? a[2][two++] : a[0][zero++];
			}
		}
	}
	else{
		for (int i = 1; i <= n; i++) {
			if (color[i] == fl) {
				ans[i] = one < a[1].size() ? a[1][one++] : zero < a[0].size() ? a[0][zero++] : a[1][one++];
			}
			else {
				ans[i] = two < a[2].size() ? a[2][two++] : zero < a[0].size() ? a[0][zero++] : a[1][one++];
			}
		}
	}
	for (int i = 1; i <= n; i++) cout << ans[i] << ' ';
	cout << '\n';
}

Measured memory_bytes: 19692
#define mod 1000000007
#define PI acos(-1)
#include<time.h>
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<map>
#include<queue>
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long ll;
const ll INF=0x7fffffffffffffff;
const int inf=0x7fffffff;
const int N=1e5+5;
clock_t start,finish;
void time_in(){start=clock();}
void time_out(){finish=clock();double tim=(double)(finish-start)/CLOCKS_PER_SEC;printf("Running time is %lf\n",tim);}
inline ll mul(ll a,ll b){ll s=0;while(b){if(b&1)s=(s+a)%mod;a=(a<<1)%mod;b>>=1;}return s%mod;}
inline ll pow_mul(ll a,ll b){ll s=1;while(b){if(b&1)s=mul(s,a);a=mul(a,a);b>>=1;}return s;}
inline ll poww(ll a,ll b){ll s=1;while(b){if(b&1)s=(s*a)%mod;a=(a*a)%mod;b>>=1;}return s%mod;}
inline bool read(int &ret){char c=getchar();int sgn;if(c==EOF)return 0;while(c!='-'&&(c<'0'||c>'9'))c=getchar();
	sgn=((c=='-')?-1:1);ret=((c=='-')?0:(c-'0'));while(c=getchar(),c>='0'&&c<='9')ret=ret*10+(c-'0');ret*=sgn;return 1;}
inline void write(int x){if(x>9)write(x/10);putchar(x%10+'0');}
int fact[10]={1,1,2,6,24,120,720,5040,40320,362880};
int st[4][2]={1,0,0,1,-1,0,0,-1};
//vector<int>vt[N];
//priority_queue<int>q;
int t,cas;
int n,m,k;
int main()
{
	int a[N];
	while(~scanf("%d",&n))
	{
		for(int i=0;i<n;i++)
		{
			scanf("%d",&a[i]);
		}
		if(n&1)
		{printf("0\n");continue;}
		sort(a,a+n);
		int x=n>>1;
		if(a[x]>a[x-1])
		{
			printf("%d\n",a[x]-a[x-1]);
		}
		else printf("0\n");
	}
}


Measured memory_bytes: 640
#include<stdio.h>
int main()
{
    int N,R;
    scanf("%d %d",&N,&R);
    if(N>10){
        printf("%d", R);

    }
    else {
        N=100*(10-N);\
        N=N+R;
        printf("%d",N);

    }
    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1e9;
const ll LINF = 1e15;
const int MOD = 1000000007;
const double PI = acos(-1);
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};

int n, a, b, c;
vector<int> v;

int dfs(int i, int x, int y, int z, int s, int t, int u) {
	if (i == n) {
		if (s == 0 || t == 0 || u == 0) return INF;
		else return abs(a-x) + abs(b-y) + abs(c-z) + 10*(s+t+u-3);
	}
	int res = INF;
	res = min(res, dfs(i+1, x + v[i], y, z, s+1, t, u));
	res = min(res, dfs(i+1, x, y + v[i], z, s, t+1, u));
	res = min(res, dfs(i+1, x, y, z + v[i], s, t, u+1));
	res = min(res, dfs(i+1, x, y, z, s, t, u));
	return res;
}

int main() {
	cin >> n >> a >> b >> c;
	v.resize(n);
	rep(i,n) cin >> v[i];
	cout << dfs(0, 0, 0, 0, 0, 0, 0) << endl;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;

int dsum(string s) {
    int ret = 0;
    REP(i,s.length()) {
        ret += (int)(s[i]-'0');
    }
    return ret;
}

int main(int argc, char const *argv[]) {
    int n;
    cin >> n;
    
    int ans = INF;
    for (int i = 1; i <= n/2+1; ++i) {
        string s = to_string(n-i);
        string t = to_string(i);
        int tmp = dsum(s)+dsum(t);
        ans = min(ans, tmp);
    }

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

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
using namespace std;

int main(){

  vector<int> a(101);
  int tmp;
  while(cin >> tmp){
    a[tmp]++;
  }
  int ans = *max_element(a.begin(), a.end());
  for(int i=0; i<101; i++){
    if( a[i] == ans ) cout << i << endl;
  }

  return 0;
}

Measured memory_bytes: 2988
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<string>

using namespace std;
int main(){
    
    int N,A,B;
    cin >> N >> A >>B;

    if(N*A<B){
        cout<<N*A<<endl;
    }
else{
    cout <<B<<endl;
}

 return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(t) (t).begin(),(t).end()
typedef long long ll;

int main() {
	//int Ans=0;
	int N; cin >> N;
	vector<int> ResNum(4,0);
	REP(i,N){
		string inp;
		cin >> inp;
  	if (inp=="AC"){
				ResNum[0]++;
		}
		if (inp=="WA"){
				ResNum[1]++;
		}
		if (inp=="TLE"){
				ResNum[2]++;
		}
		if (inp=="RE"){
				ResNum[3]++;
		}
	}

	cout << "AC x "<< ResNum[0] << '\n';
	cout << "WA x "<< ResNum[1] << '\n';
	cout << "TLE x "<< ResNum[2] << '\n';
	cout << "RE x "<< ResNum[3] << '\n';
	return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define LL long long
using namespace std;
inline int read(){
	static int x,f; x = 0,f = 1; static char c; c = getchar();
	while (!isdigit(c)){ if (c == '-') f = -1; c = getchar(); }
	while (isdigit(c)) x = x * 10 + c - '0',c = getchar();
	return x * f;
}
inline void write(int x){ if (x < 0) x = -x,putchar('-'); if (x > 9) write(x/10); write(x%10+'0'); }

const int N = 305,P = 1e9 + 7;
inline int power(int x,int y){
	static int r; r = 1; while (y){ if (y&1) r = (LL)r * x % P; x = (LL)x * x % P,y >>= 1; } return r;
}
inline void upd(int &x,int v){ x = (x+v>=P)?(x+v-P):(x+v); }
int n,m,ex[N],ey[N];

int pw[N<<1],fac[N<<1],nfac[N<<1],inv[N<<1],match[N<<1],s[N<<1];
int G[N<<1],F[N<<1][N<<1]; bool vis[N<<1][N<<1];
inline int dp(int l,int r){
	if (l >= r) return 0;
	if (vis[l][r]) return F[l][r];
	int i; vis[l][r] = 1;
	for (i = l; i <= r; ++i) if (match[i] && (match[i] < l || match[i] > r)) return F[l][r] = 0;
	F[l][r] = G[s[r]-s[l-1]];
	for (i = l+1; i < r; ++i) F[l][r]-=(LL)G[s[r]-s[i]]*dp(l,i)%P,F[l][r]%=P;
	F[l][r] = (F[l][r]%P+P)%P;
	return F[l][r];
}
int main(){
	int i,j,ans = 0;
	fac[0] = nfac[0] = inv[0] = fac[1] = nfac[1] = inv[1] = 1; pw[0] = G[0] = 1,pw[1] = 2;
	for (i = 2; i <= 600; ++i){
		fac[i] = (LL)fac[i-1] * i % P;
		inv[i] = (LL)(P-P/i) * inv[P%i] % P;
		nfac[i] = (LL)nfac[i-1] * inv[i] % P;
		pw[i] = (pw[i-1]<<1) % P;
		if (i % 2 == 0) G[i] = (LL)fac[i] * nfac[i>>1] % P * power(pw[i>>1],P-2) % P;
	}
	n = read(),m = read();
	for (i = 0; i <= (n<<1); ++i) match[i] = 0;
	for (i = 1; i <= m; ++i) ex[i] = read(),ey[i] = read(),match[ex[i]] = ey[i],match[ey[i]] = ex[i];
	for (i = 1; i <= (n<<1); ++i) s[i] = s[i-1] + (match[i] ? 0 : 1);
	for (i = 1; i <= m; ++i) if (ex[i] > ey[i]) swap(ex[i],ey[i]);
	for (i = 1; i <= (n<<1); ++i) for (j = i; j <= (n<<1); ++j) vis[i][j] = 0;
	for (i = 1; i <= (n<<1); ++i) for (j = i; j <= (n<<1); ++j){
		upd(ans,(LL)G[s[n<<1]-(s[j]-s[i-1])] * dp(i,j) % P);
	}
	cout << ans << '\n';
	return 0;
}

Measured memory_bytes: 2048
//sppsfver - 20.08.2020
#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using pll = pair <ll, ll>;
const int MAX = 1e5+5;
const ll MOD = 1e9+7;

struct point{
	ll x, y;
};

bool cmp1 (point a, point b){
	return (a.x < b.x || (a.x == b.x && a.y < b.y));
}
bool cmp2 (point a, point b){
	return (a.y < b.y || (a.y == b.y && a.x < b.x));
}

ll dist (point a, point b){
	return max (((a.y - b.y) - (a.x - b.x)),
				((a.y + b.y) - (a.x + b.x)));
}

ll n, x, y, mx;
vector <point> v;
ll maxAbsValExpr() {
    ll res = 0, smallest, cur;
    for (ll p : {1, -1}) {
        for (ll q : {1, -1}) {
            smallest = p * v[0].x + q * v[0].y + 0;
            for (ll i = 1; i < n; ++i) {
                cur = p * v[i].x + q * v[i].y;
                res = max(res, cur - smallest);
                smallest = min(smallest, cur);
            }
        }
    }
    return res;
}


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

	cin >> n;
	for (int i = 0; i < n; i++){
		cin >> x >> y;
		v.push_back ({x, y});
	}
	cout << maxAbsValExpr() << endl;
    return 0;
}


Measured memory_bytes: 7404
using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		string str = Console.ReadLine();
		long K = long.Parse(str);
		long kt = 0;
		double[] AN = new double[100001];
		long[] ANa = new long[100001];
		long a = 1;
		long ct = 1;
		long at = 1;
		while(ct<=100000){
			AN[ct] = a / (double)sn(a);
			ANa[ct] = a;
			a += at;
			ct += 1;
			if(a==9){
				at = 10;
			} else if(a==99){
				at = 100;
			} else if(a==9999){
				at = 1000;
			} else if(a==99999){
				at = 10000;
			} else if(a==999999){
				at = 100000;
			} else if(a==9999999){
				at = 1000000;
			} else if(a==99999999){
				at = 10000000;
			} else if(a==999999999){
				at = 100000000;
			} else if(a==9999999999){
				at = 1000000000;
			} else if(a==99999999999){
				at = 10000000000;
			} else if(a==999999999999){
				at = 100000000000;
			} else if(a==99999999999999){
				at = 1000000000000;
			}
		}
		for(var i=1;i<=100000;i++){
			bool flag = true;
			for(var j=i+1;j<=100000;j++){
				if(AN[j] < AN[i]){
					flag = false;
					break;
				}
			}
			if(flag){
				if(i>=0){
					Console.WriteLine(ANa[i]);
				}
				kt += 1;
			}
			if(kt >= K){
				break;
			}
		}
	}
	public static long sn(long x){
		long ans = 0;
		while(x > 0){
			ans += x % 10;
			x /= 10;
		}
		return ans;
	}
}

Measured memory_bytes: 12384
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <tuple>
#include <map>
#include <queue>
#include <math.h>
#include <set>
#include <stack>
#include <deque>
#include <bitset>
using namespace std;

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

	cout << max({ a * 10 + b + c,a + b * 10 + c,a + b + c * 10 }) << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>

int main(void){
    int i, AC=1, C=0;
    char S[15];
    scanf("%s", S);
    if(S[0]!='A'){
        printf("WA\n");
        return 0;
    }
    for(i=2; i<=strlen(S)-2; i++){
        if(S[i]=='C') C++;
    }
    if(C!=1){
        printf("WA\n");
        return 0;
    }
    C=0;
    for(i=0; i<strlen(S); i++){
        if(S[i]-'Z' <= 0)C++;
    }
    if(C!=2){
        printf("WA\n");
        return 0;
    }
    printf("AC\n");
    return 0;
}

Measured memory_bytes: 128
def gcd(x,y):
    while y != 0:
        x,y = y, x%y
    return x

def lcm(x,y):
    return (x*y) // gcd(x,y)

def div_num(a,x,y):
    return a//x + a//y - a//lcm(x,y)

a,b,c,d = map(int,input().split())

ans = (b-a+1) - ( div_num(b,c,d) - div_num((a-1),c,d) )

print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <cstdio>

using namespace std;

int binary_searcher(int A[],int key,int n)
{
    int mid,left=0,right=n;
    while(left<right)
    {
        mid=(left+right)/2;
        if(A[mid]==key) return 1;
        else if(key<A[mid]) right=mid;
        else left=mid+1;
    }
    return 0;
}

int main()
{
    int i,q,key,n,sum=0;
    int A[100000 + 10];
    scanf("%d",&n);
    for(int i=0;i<n;i++) scanf("%d",&A[i]);
    scanf("%d",&q);
    for(int i=0;i<q;i++)
    {
        scanf("%d",&key);
        if(binary_searcher(A,key,n)) sum++;
    }
    printf("%d\n",sum);
    return 0;

}



Measured memory_bytes: 3544
n = int(input())
num_list = [ (int(input()),i+1) for i in range(n) ]
num_list_2 = sorted(num_list)
num_list_3 = [ (num_list_2[i][0],num_list_2[i][1],i+1) for i in range(n) ]

ans = sum([ abs(i[1] - i [2]) % 2 for i in num_list_3]) // 2
print(ans)

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

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(), (x).end()

using namespace std;

template <typename T> T &chmin(T &a, const T &b) {return a = min(a, b);}
template <typename T> T &chmax(T &a, const T &b) {return a = max(a, b);}

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

const int INF = 1e9;
const ld eps = 1e-9, pi = acos(-1.0);

int main(){
    int n, x;
    while(cin >> n >> x && (n || x)){
        int res = 0;
        REP(i, n) REP(j, i) REP(k, j) if(i+j+k==x-3) res++;
        cout << res << endl;
    }
    return 0;
}


Measured memory_bytes: 3112
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
ll mod=1e9+7;
int N,A,B,C,l[8];

int main(){
  string s;
  cin>>s;
  int si(0),ti(0),cnt(0);
  for (int i(0);i<s.size();i++){
    if (s[i]=='S'){
      si+=1;
    }else{
      ti+=1;
      if (ti>si){
        cnt+=1;
        ti--;
      }else {
        si--;ti--;
      }
    }
  }
  cout << cnt + si << endl;
}


Measured memory_bytes: 640
import math

x=int(input())


def isPrime(n):
  if n == 2:
    return True
  if n % 2 == 0:
    return False
  
  # nの平方根まで計算する
  m = math.floor(math.sqrt(n)) + 1
  for p in range(3, m, 2):
      if n % p == 0:
        return False
  return True

for i in range(x,10**6):
  if isPrime(i):
    print(i)
    exit(0)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
typedef long long ll;
const ll NIL = (-1)*(pow(2, 63) - 1);
struct Node {
    ll key = NIL;
    int p = -1, l = -1, r = -1; // p, l, r is all id
};
Node u[500000];
int id, root;
void insert(int node){
    int y = u[node].p, x = root;
    while(x != -1 && u[x].key != NIL){
        y = x;
        if(u[node].key < u[x].key)x = u[x].l;
        else x = u[x].r;
    }
    u[node].p = y;

    if(y == -1)root = node;
    else if(u[node].key < u[y].key)u[y].l = node;
    else u[y].r  = node; 
}
void inorder(int node){
    if(u[node].l != -1)inorder(u[node].l);
    if(u[node].r != -1) {
        cout << " " << u[node].key;
        inorder(u[node].r);
        return;
    }
    cout << " " << u[node].key;
    return;
}
void preorder(int node){
    cout << " " << u[node].key;
    if(u[node].l == -1 && u[node].r == -1)return;
    if(u[node].l != -1)preorder(u[node].l);
    if(u[node].r != -1)preorder(u[node].r);
}
void find(ll v){
    int node = root;
    bool found = 0;
    while(node != -1 && !found){
        if(u[node].key == v)found = 1;
        else if(u[node].key  < v)node = u[node].r;
        else node = u[node].l;
    }
    if(found)printf("yes\n");
    else printf("no\n");
}
int main(){
    root = -1;
    ll n; cin >> n;
    rep(i,n){
        string com;
        ll v;
        cin >> com;
        if(com == "insert" || com == "find")cin >> v;
        if(com == "insert"){
            u[id].key = v;
            insert(id++);
        }
        else if(com == "print"){
            inorder(root);
            printf("\n");
            preorder(root);
            printf("\n");
        }
        else find(v);
    }
    return 0;
}


Measured memory_bytes: 14884
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cstdint>
#include <cstdlib>
#include <cmath>
#include <complex>
#include <chrono>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
#include <random>
#include <utility>
#include <limits>
#include <list>
#include <type_traits>

/* template start */
 
#define rep(i, a, b) for (long long i = (a); (i) < (b); (i)++)
#define all(i) i.begin(), i.end()

#ifdef LOCAL
#define debug(...) std::cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

void debug_out(){std::cerr<<std::endl;}

template<typename Head,typename... Tail>
void debug_out(Head h,Tail... t){
  std::cerr<<" "<<h;
  if(sizeof...(t)>0)std::cout<<" :";
  debug_out(t...);
}
 
template <typename T1, typename T2>
std::ostream& operator<<(std::ostream& os, std::pair<T1, T2> pa) {
  return os << pa.first << " " << pa.second;
}
 
template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (std::size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}
 
template<typename T1,typename T2>
inline bool chmax(T1& a,T2 b){return a<b && (a=b,true);}
 
template<typename T1,typename T2>
inline bool chmin(T1& a,T2 b){return a>b && (a=b,true);}

template<typename Num>
constexpr Num mypow(Num a, long long b) {
  if(b==0)return 1;
  if (a==0)return 0;
  Num x = 1;
  while (b > 0) {
    if(b & 1)x*=a;
    a*=a;
    b >>= 1;
  }
  return x;
}

/* template end */

using ll = long long;

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

  ll n;
  std::cin>>n;

  std::vector<ll> a(n);
  for(auto&& e:a)std::cin>>e;

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

  ll money=1000;

  rep(i,0,n-1){
    if(a[i]<a[i+1]){
      ll stock=money/a[i];
      money%=a[i];
      money+=stock*a[i+1];
    }
  }

  std::cout<<money<<"\n";

  return 0;
}

Measured memory_bytes: 3656
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,b) for(int i=(a); i<(b); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

ll func(ll k){
    ll res = 0;
    if(k == -1) res = 0;
    if(k % 4 == 1) res = 1;
    if(k % 4 == 3) res = 0;
    if(k % 4 == 2) res = k+1;
    if(k % 4 == 0) res = k;
    return res;
}
int main(){
    ll a,b; cin >> a >> b;
    ll ans = func(b) ^ func(a-1);
    cout << ans << endl;
}

Measured memory_bytes: 256
use proconio::input;

fn main() {
  input! {
    a: isize,
    b: isize,
    c: isize,
    d: isize,
  }
  let x = (c+b-1)/b;
  let y = (a+d-1)/d;
  if x <= y {
    println!("Yes");
  } else {
    println!("No");
  }
}


Measured memory_bytes: 2092
#include<algorithm>
#include<cmath>
#include<iostream>
#include<map>
#include<vector>
using namespace std;

struct Point{
    int x,y;
    bool operator==(const Point A)
    {    return x==A.x && y==A.y;
    }
};

int main(){
    int N;cin>>N;
    vector<Point>p(N+1);
    for(int i=1;i<=N;i++){
        cin>>p[i].x>>p[i].y;

    }

    vector<Point>Sa;
    for(int i=1;i<=N;i++){
        for(int j = 1;j<=N;j++){
            Point PPP={};
            PPP.x = p[i].x - p[j].x;
            PPP.y = p[i].y - p[j].y;
            // x=0,y=0は含めない
            //cout << "PPP" << ':' << p[i].x  << "," << p[i].y << endl;
            if(!(PPP.x == 0 && PPP.y == 0))
                Sa.push_back(PPP);
        }

    }

    int Yousosu = 0;
    for(int i=1;i<=Sa.size();i++){
        //cout << i << ':' << Sa[i].x  << "," << Sa[i].y << endl;
        int num = count(Sa.begin(),Sa.end(),Sa[i]);
        if(Yousosu < num)
            Yousosu = num;
    }

    // 最小の和の求め方：N個のボール-最も多かった直線の数
    cout << N-Yousosu << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
using Graph = vector<vector<int>>;
using Graphl = vector<vector<ll>>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define Rep(i, k, n) for (int i = k; i < (int)(n); i++)
#define RRep(i, k, n) for (int i = k; i > (int)(n); i--)
#define FOR(itr, v) for (auto itr = (v).begin(); itr != (v).end(); ++itr)
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define ALL(a)  (a).begin(),(a).end()
#define rALL(a)  (a).rbegin(),(a).rend()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T> void PrintVector(const vector<T> &vec) {for (auto val : vec) cout << val << " "; cout << endl;}
const long long INF = 1LL << 60;
const long long minusINF = -(1LL << 40);
const int MOD = 1000000007;
const double PI = acos(-1); //3.14~
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

int main()
{
    char c; cin >> c;
    if (c >= 'A' && c <= 'Z') puts("A");
    else puts("a");
}

Measured memory_bytes: 3632
import java.util.BitSet;
import java.util.Scanner;

public class Main {
	static Scanner sc = new Scanner(System.in);
	static int N, M, R;
	static int[][] S, T;
	static int[] E = new int[3];

	public static void main(String[] args) throws Exception {
		while (true) {
			N = sc.nextInt();
			if (N == 0) break;
			M = sc.nextInt();
			R = sc.nextInt();
			S = new int[N][4];
			T = new int[M][4];
			for (int i = 0; i < N; ++i) {
				S[i][0] = sc.nextInt();
				S[i][1] = sc.nextInt();
				S[i][2] = sc.nextInt();
				S[i][3] = sc.nextInt();
			}
			for (int i = 0; i < M; ++i) {
				T[i][0] = sc.nextInt();
				T[i][1] = sc.nextInt();
				T[i][2] = sc.nextInt();
				T[i][3] = sc.nextInt();
			}
			E[0] = sc.nextInt();
			E[1] = sc.nextInt();
			E[2] = sc.nextInt();

			BitSet[] bs = new BitSet[M];
			for (int i = 0; i < M; ++i) {
				bs[i] = new BitSet(N);
				for (int j = 0; j < N; ++j) {
					bs[i].set(j, cross(j, i));
				}
			}
			double[] v = new double[M];
			for (int i = 0; i < M; ++i) {
				v[i] = 1. * T[i][3] / (sq(T[i][0] - E[0]) + sq(T[i][1] - E[1]) + sq(T[i][2] - E[2]));
			}
			double ans = 0;
			for (int i = 1; i < (1 << M); ++i) {
				BitSet set = new BitSet(N);
				double sum = 0;
				for (int j = 0; j < M; ++j) {
					if ((i & (1 << j)) != 0) {
						set.or(bs[j]);
						sum += v[j];
					}
				}
				if (sum > ans && set.cardinality() <= R) ans = sum;
			}

			System.out.printf("%.6f\n", ans);
		}
	}

	static boolean cross(int bi, int li) {
		boolean in1 = inside(bi, T[li][0], T[li][1], T[li][2]);
		boolean in2 = inside(bi, E[0], E[1], E[2]);
		if (in1 != in2) return true;
		if (in1 && in2) return false;
		double den = sq(E[0] - T[li][0]) + sq(E[1] - T[li][1]) + sq(E[2] - T[li][2]);
		double num = (S[bi][0] - T[li][0]) * (E[0] - T[li][0]) + (S[bi][1] - T[li][1]) * (E[1] - T[li][1])
				+ (S[bi][2] - T[li][2]) * (E[2] - T[li][2]);
		double t = num / den;
		if (t < 0 || t > 1) return false;
		double xt = T[li][0] + t * (E[0] - T[li][0]);
		double yt = T[li][1] + t * (E[1] - T[li][1]);
		double zt = T[li][2] + t * (E[2] - T[li][2]);
		double dist = sq(xt - S[bi][0]) + sq(yt - S[bi][1]) + sq(zt - S[bi][2]);
		return dist <= sq(S[bi][3]) + 1e-9;
	}

	static boolean inside(int bi, int x, int y, int z) {
		return sq(x - S[bi][0]) + sq(y - S[bi][1]) + sq(z - S[bi][2]) < sq(S[bi][3]);
	}

	static int sq(int v) {
		return v * v;
	}

	static double sq(double v) {
		return v * v;
	}
}

Measured memory_bytes: 94944
#include <stdio.h>

void push(int d,int *p,int x[]){
	*p = *p + 1;
	x[*p] = d;
}

int pop(int *p,int x[]){
	*p = *p - 1;
	return x[(*p)+1];
}

int main(void) {
	int x,a,d[16]={0},p=0,r;
	while(scanf("%d",&a) != EOF){
		if(a != 0){push(a,&p,d);}
		else{r = pop(&p,d);printf("%d\n",r);}
	}
	return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //GCC5.4.1で配列の範囲外アクセスをエラーにする

//cmdで g++ test.cpp とするとコンパイルできる
//制限1秒なら10^6は余裕 10^7は多分間に合う 10^8はよほど単純でないと厳しい
// https://github.com/atcoder/live_library
// cppdbg: test.exeのterminalに標準入力を打てる

#define ALL(x) x.begin(),x.end()
#define get_tp(t,i) get<i>(t)
#define len(x) (ll)(x.size())
#define ub(a,x) (upper_bound(ALL(a),x)-a.begin())
#define lb(a,x) (lower_bound(ALL(a),x)-a.begin())
typedef long long ll; //long long
typedef pair<int,int> pii; //pair<int,int>
typedef pair<long long,long long> pllll; //pair<ll,ll>
typedef vector<int> vi; //vector<int>
typedef vector<vector<int>> vvi; //vector<vector<int>>
typedef vector<ll> vll; //vector<long long>
typedef vector<vector<ll>> vvll; //vector<vector<long long>>
typedef priority_queue<ll, vector<ll>, greater<ll> > gpq; //逆順priority_queue
typedef priority_queue<ll> pq;

//const int MOD=998244353;
const int MOD=1000000007; //10^9+7
const long double PI=3.1415926535897932;

int main(){
    string S;cin>>S;
    int ans=0;
    for(int i=0;i<3;i++){
        if(S[i]=='1')ans++;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3628
#include <iostream>
#include <string>
using namespace std;
int main(void){
    // Your code here!
    string s;
    string out;
    
    cin >> s;
    for (int i = 0; i < s.length(); ++i)
    {
        if(i % 2 == 0) out.push_back(s[i]);
    }
    
    cout << out << endl;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
    string s,t;cin>>s>>t;
    if(s.length()+1==t.length())
    {
        for(ll i=0;i<s.length();i++)
        {
            if(s[i]!=t[i])
            {
                cout<<"No"<<endl;
                return 0;
            }
        }
        cout<<"Yes"<<endl;
    }
    else
        cout<<"No"<<endl;
}


Measured memory_bytes: 3624
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int count = scanner.nextInt();
        scanner.nextLine();
        List<Integer> list = new ArrayList<>();
        for (int i = 0; i < count; i++) {
            list.add(scanner.nextInt());
        }
        boolean bool = list.stream()
                .filter(f -> f % 2 == 0)
                .allMatch(f -> f % 3 == 0 || f % 5 == 0);

        if (bool) {
            System.out.println("APPROVED");
        } else {
            System.out.println("DENIED");
        }
    }
}

Measured memory_bytes: 27472
#include<iostream>
using namespace std;
int main(){
	int x[10000], y[10000], p, q ,v,w;
	for (q = 0; q < 30000; q++){
		cin >> x[q] >> y[q];
		if (x[q] == 0 && y[q] == 0){
			p = q;
			break;
		}
	}
	for (v = 0; v < p; v++){
		if (x[v] < y[v]){
			cout << x[v] << " " << y[v] << endl;
		}
		else cout << y[v] << " " << x[v] << endl;
	}
	return 0;
}


Measured memory_bytes: 3116
H,N = [int(i) for i in input().split()]
AB = [[int(i) for i in input().split()] for j in range(N)]
DP = [10000000000]*(H+1)#DP[h] = 体力をh削るのに必要な魔力のmin
DP[0] = 0
for h,curmp in enumerate(DP):
    for a,b in AB:
        goal = min(h+a,H)
        DP[goal] = min(DP[goal],curmp+b)
print(DP[-1])

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

class UnionFind {
    public:
    // 親の番号を格納する。親だったら-(その集合のサイズ)
    vector<int> Parent; // 
    // 作るときはParentの値を全て-1にする。
    // こうすると全てバラバラになる
    UnionFind(int N) {
        Parent = vector<int>(N, -1);
    }
    // Aがどのグループに属しているか調べる。
    int root(int A){
        if (Parent[A] < 0) return A;//自分が親の場合
        return Parent[A] = root(Parent[A]);//Aの親を入れ替える
    }
    // 自分のいるグループの頂点数を調べる
    int size(int A) {
        return -Parent[root(A)]; //親をとってきたい
    }
    // AとBをくっつける
    bool connect(int A, int B){
        //AとBを直接繋ぐのではなく、root(A)にroot(B)をくっつける
        A = root(A);
        B = root(B);
        if (A == B){
            //すでにくっついてるからくっつけない
            return false;
        }
        //大きい方(A)に小さい方(B)をくっつけたい
        //大小が逆だったらヒックり返す
        if(size(A) < size(B))swap(A, B);

        //Aのサイズを更新する
        Parent[A] += Parent[B];
        //Bの親をAに変更する
        Parent[B] =A;
        return true;
    }
};

int main(){
    int N, M;cin>>N>>M;
    vector<int> A(M), B(M);
    for(int i=0; i< M;i++){
        cin >> A[i] >> B[i];
        A[i]--;B[i]--;//0オリジンに
    }
    vector<long long> ans(M);
    ans[M-1] =(long long)N * (N-1) /2;

    UnionFind Uni(N);
    for(int i=M-1; i>=1; i--){
        ans[i-1] = ans[i];
        // 繋がってなかったのが繋がったとき
        if (Uni.root(A[i]) != Uni.root(B[i])){
            ans[i-1] -= (long long)Uni.size(A[i]) * Uni.size(B[i]);
            Uni.connect(A[i], B[i]);
        }
    }
    for(int i=0;i<M;i++){
        cout << ans[i] << endl;
    }
    return 0;
}



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

int main(){
	string S;
	cin >> S;
	bool flag=false;
	for(int i=0;i<3;i++)if(S[i]=='7')flag=true;
	if(flag)cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h> //C++の標準ライブラリを一行で一括でインクルードする
#include <math.h> //数学関数と数学定数を利用する
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
template<class T> void chmax(T &a,T b) { if (a<b) a=b;}
template<class T> void chmin(T &a,T b) { if (a>b) a=b;}

int main(){
  int n;
  cin >> n;
  vector<int> c(9,0);
  
  rep(i,n){
    int tmp;
    cin >> tmp;
    if(tmp <= 399){
      c[0]++;
    }else if(tmp >= 400 && tmp <= 799){
      c[1]++;
    }else if(tmp >= 800 && tmp <= 1199){
      c[2]++;
    }else if(tmp >= 1200 && tmp <= 1599){
      c[3]++;
    }else if(tmp >= 1600 && tmp <= 1999){
      c[4]++;
    }else if(tmp >= 2000 && tmp <= 2399){
      c[5]++;
    }else if(tmp >= 2400 && tmp <= 2799){
      c[6]++;
    }else if(tmp >= 2800 && tmp <= 3199){
      c[7]++;
    }else if(tmp >= 3200){
      c[8]++;
    }
  }
  
  int color = 0;
  
  rep(i,8){
    if(c[i] > 0) color++;
  }
  
  //min
  if(color == 0){
    cout << 1;
  }else{
    cout << color;
  }
  //max
  cout << " " << color+c[8];
  
  return 0;
}

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

bool c[26][26];
string s, t;

string solve() {
  int i, j, n, cnt;
  char S, T;
  n = s.size();

  for (i = 0; i < 26; i++) {
    for (j = 0; j < 26; j++) {
      c[i][j] = false;
    }
  }

  for (i = 0; i < n; i++) {
    c[s[i] - 'a'][t[i] - 'a'] = true;
  }

  for (i = 0; i < 26; i++) {
    cnt = 0;
    for (j = 0; j < 26; j++) {
      if (c[i][j] == true) {
        cnt += 1;
      }
    }
    if (cnt > 1) {
      return "No";
    }
  }

  for (i = 0; i < 26; i++) {
    cnt = 0;
    for (j = 0; j < 26; j++) {
      if (c[j][i] == true) {
        cnt += 1;
      }
    }
    if (cnt > 1) {
      return "No";
    }
  }

  return "Yes";
}

int main() {
  cin >> s >> t;
  cout << solve() << "\n";
  return 0;
}


Measured memory_bytes: 776
fn read<T: std::str::FromStr>() -> T {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).ok();
    buf.trim().parse().ok().unwrap()
}

fn main() {
    let n: usize = read();
    let a: Vec<usize> = (0..n).map(|_| read()).collect();
    let mut b: Vec<usize> = a.clone();
    b.sort();
    b.reverse();
    for &i in a.iter() {
        println!("{}", if i == b[0] { b[1] } else { b[0] });
    }
}


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

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = std::int64_t;
using P = std::tuple<int,int>;

int H, W;
int A[200100], B[200100];
std::set<P> reps;
std::multiset<int> vals;

int main(){
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    
    std::cin >> H >> W;
    
    for(int i=0;i<H;++i){
        std::cin >> A[i] >> B[i];
    }

    for(int i=1;i<=W;++i){
        reps.emplace(i, 0);
        vals.emplace(0);
    }

    for(int i=0;i<H;++i){
        int res;

        if(reps.empty()){
            res = -1;
        }else if(auto it = reps.lower_bound(std::make_tuple(A[i], 0)); it == reps.end()){
            res = *vals.begin() + (i + 1);
        }else if(auto [p, ignored] = *it; p > B[i]){
            res = *vals.begin() + (i + 1);
        }else{
            int v2 = -1;
            if(it != reps.begin()){
                auto pr = std::prev(it);
                v2 = snd(*pr) + (B[i] + 1) - fst(*pr);
            }
            
            int lastIndex = -1, lastValue = -1;
            while(it != reps.end() && fst(*it) <= B[i]){                
                std::tie(lastIndex, lastValue) = *it;
                // std::cout << "Deleted: " << lastIndex << ", " << lastValue << " (at i = " << i << ")" << std::endl;
                vals.erase(vals.find(lastValue));
                it = reps.erase(it);
            }

            int v1 = lastValue + (B[i] + 1) - lastIndex;
            
            if(B[i] + 1 <= W &&
               (it == reps.end() || fst(*it) != B[i] + 1) &&
               (v2 == -1 || v1 < v2)){
                // std::cout << "Added: " << (B[i] + 1) << ", " << v1 << " (at i = " << i << ")" << std::endl;

                reps.emplace(B[i] + 1, v1);
                vals.emplace(v1);
            }

            if(reps.empty()){
                res = -1;
            }else{
                res = *vals.begin() + (i + 1);
            }
        }
        
        std::cout << res << std::endl;
    }
}


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

const int MOD = 1000000007;

int dp[100010][20]; // dp[i][j] := i桁目まで見てj余る数が何通り

string s;
int n;

int rec(int p, int mod) {
    int &res = dp[p][mod];

    if (p == n) {
        if (mod == 5) return 1;
        else return 0;
    }

    if (res != -1) {
        return res;
    }

    if (s[p] == '?') {
        res = 0;
        for (int i = 0; i < 10; ++i) {
            int nmod = (mod * 10 + i) % 13;
            res += rec(p + 1, nmod);
        }
        res %= MOD;
    } else {
        int dig = s[p] - '0';
        res = rec(p + 1, (mod * 10 + dig) % 13);
    }

    // cout << p << ' ' << mod << ' ' << res << endl;
    return res;
}

signed main() {
    while (cin >> s) {
        n = s.size();
        memset(dp, -1, sizeof dp);
        int ans = rec(0, 0);
        cout << ans << endl;
    }
}


Measured memory_bytes: 23936
#include <bits/stdc++.h>
#define ll unsigned long long
using namespace std;
ll tab[500];
ll odd,even,n,p;
ll ans=1,check=0;
ll comb(int n,int m)
{
	ll ret=1,tg=1;
	for(ll i=n-m+1;i<=n;i++)
    {	ret*=(ll)i; if(tg<=m && ret%tg==0) ret/=tg,tg++;}
	tab[m]=ret;
	return ret;
}
int main()
{
	cin>>n>>p;
	for(ll i=1,a;i<=n;i++)
	{
		cin>>a;
		if(a%2==1) odd++;
		else even++;
	}
	for(ll i=1;i<=even;i++)
	ans<<=1;
	for(ll i=0;i<=odd;i++)
	if(i%2==p)check+=comb(odd,i);
	ans=(ll)ans*(ll)check;
	cout<<ans;
	return 0;
}
/*
50 0
562949953421312
114321165548
562949953421312
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
*/

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

using ll=long long;
int main(){
    ll n,m;
    cin>>n>>m;
    ll res=1;
    for(int i=1;i*i<=m;i++){
        if(m%i==0){
            ll x=i;
            if(x*n<=m) res=max(res,x);
            x=m/i;
            if(x*n<=m) res=max(res,x);
        }
    }
    cout<<res<<endl;
    return 0;
}

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

using namespace std;
typedef long long ll;
//ループ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
//コンテナ
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
#define D()
//定数
#define INF 1000000000000 //10^12
#define MOD 10000007 //10^9+7
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素

int main(){
    int n, m, buf;
    cin >> n >> m;
    REP(i,m) {cin >> buf; n -= buf;}
    cout << (n>=0 ? n : -1) << endl;
}

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

int main()
{
    int a,b,c,ans = 3;
    cin >> a >> b >> c;

    if(a == b) ans--;
    if(a == c) ans--;
    if(b == c) ans--;
    if(a == b && a == c && c == b) ans++;
    
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <numeric>
#include <algorithm>

using namespace std;
using lint = long long;
constexpr int MOD = 1000000007, INF = 1010101010;
constexpr lint LINF = 1LL << 60;

template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
	for (const auto &e : vec) os << e << (&e == &vec.back() ? "\n" : " ");
	return os;
}

#ifdef _DEBUG
template <class T>
void dump(const char* str, T &&h) { cerr << str << " = " << h << "\n"; };
template <class Head, class... Tail>
void dump(const char* str, Head &&h, Tail &&... t) {
	while (*str != ',') cerr << *str++; cerr << " = " << h << "\n";
	dump(str + (*(str + 1) == ' ' ? 2 : 1), t...);
}
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else 
#define DMP(...) ((void)0)
#endif

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int N;
	cin >> N;
	string S;
	cin >> S;

	lint ans = 0;
	for (int i = 0; i < 10; i++) {
		for (int j = 0; j < 10; j++) {
			for (int k = 0; k < 10; k++) {
				
				bool fi, fj, fk;
				fi = fj = fk = false;
				for (int idx = 0; idx < N; idx++) {
					if (!fi && S[idx] - '0' == i) {
						fi = true;
						continue;
					}
					if (fi && !fj && S[idx] - '0' == j) {
						fj = true;
						continue;
					}
					if (fj && !fk && S[idx] - '0' == k) fk = true;
				}

				if (fk) {
					ans++;
					DMP(i, j, k);
				}

			}
		}
	}

	cout << ans << "\n";

	return 0;
}

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

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	int N;
	cin >> N;
	vector<int> a(100009);
	for (int i = 0; i < N; ++i) {
		int x;
		cin >> x;
		++a[x];
	}
	int ans = 0;
	for (int i = 0; i <= 100000; ++i) {
		ans = max(ans, a[i] + a[i + 1] + a[i + 2]);
	}
	cout << ans << '\n';	
	
	return 0;
}


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

int main() {
  int N;
  cin >> N;
  
  vector<int> boss(N-1);
  for(int i = 0; i < N-1; i++) cin >> boss.at(i);
  
  vector<int> num(N);
  for (int i = 0; i < N-1; i++){
    num.at(boss.at(i) - 1) += 1;
  }
  
  for(int i = 0; i < N; i++) cout << num.at(i) <<endl;
}

Measured memory_bytes: 4792
#include<bits/stdc++.h>
using namespace std;
int main(){
	
	int n, k = 1;
    cin >> n >> k ;
    int ar[n + 5];
    long double sum = 0;
    for (int i = 0; i < n; ++i){
        cin >> ar[i];
        sum += ar[i];
    }
    long double p = sum / (4 * k);
    sum = 0;
    for (int i = 0; i < n; ++i){
        if( ar[i] >= p ) sum ++;
        if( sum == k ){
            cout << "Yes";
            return 0;
        }
    }
    cout <<"No";
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
using namespace std;


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

int main(){
    int a;
    cin >> a ;
    cout << a+a*a+a*a*a << endl;
    return 0;
}

Measured memory_bytes: 3576