akhauriyash/Code-Regression huggingface dataset:
use std::io::*;

fn main() {
    let mut s: String = String::new();
    stdin().read_to_string(&mut s).ok();
    let mut itr = s.trim().split_whitespace();
    let n: usize = itr.next().unwrap().parse().unwrap();
    let p: usize = itr.next().unwrap().parse().unwrap();
    let mut s: Vec<usize> = itr
        .next()
        .unwrap()
        .chars()
        .map(|c| c.to_digit(10).unwrap() as usize)
        .collect();

    let mut ans = 0;
    if p == 2 {
        for i in 0..n {
            if s[i] % 2 == 0 {
                ans += i + 1;
            }
        }
    } else if p == 5 {
        for i in 0..n {
            if s[i] % 5 == 0 {
                ans += i + 1;
            }
        }
    } else {
        s.reverse();
        let mut cnt: Vec<usize> = vec![0; n + 1];
        let mut memo: Vec<usize> = vec![0; p + 1];
        let mut ten = 1;
        for i in 0..n {
            cnt[i + 1] = (cnt[i] + s[i] * ten) % p;
            ten = ten * 10 % p;
        }
        for i in 0..n + 1 {
            ans += memo[cnt[i]];
            memo[cnt[i]] += 1;
        }
    }
    println!("{}", ans);
}

// 2 or 5の場合は別


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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void solve() {
    string S, T;
    cin >> S >> T;
    ll ans = 0;
    rep(i, S.size()) {
        if (S[i] != T[i]) ans++;
    }
    cout << ans << '\n';
}

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


Measured memory_bytes: 3884
<?php
fscanf(STDIN, '%s', $key);
$prev = '';
for ($i=0; $i < 4; $i++) {
    if ($i > 0 && $key[$i] === $prev) {
        echo "Bad\n";
        exit;
    } 
    $prev = $key[$i];
}
echo "Good\n";

Measured memory_bytes: 4604
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <utility>
#include <string>
#include <vector>
#include <set>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const ll MOD=1e9+7;

bool dpx[8005][16001];//x
bool dpy[8005][16001];//y
vector<P> op;//命令列 first=0でx方向1でy方向2で最初x正
int main()
{
	string s;
	int x,y;
	cin>>s;
	cin>>x>>y;
	int tu=0;
	for(int i=0;i<s.size();)
	{
		if(s[i]=='F')
		{
			int cnt=0;
			while(i<s.size() && s[i]=='F')
			{
				cnt++;
				i++;
			}
			if(tu==0)
			{
				op.push_back(P(2,cnt));
			}else if(tu%2==0){
				op.push_back(P(0,cnt));
			}else{
				op.push_back(P(1,cnt));
			}
		}else{
			tu++;
			i++;
		}
	}
	fill(dpx[0],dpx[8005],false);
	fill(dpy[0],dpy[8005],false);
	dpx[0][8000]=true;
	dpy[0][8000]=true;
	int indx=0;
	int indy=0;
	for(int i=0;i<op.size();i++)
	{
		if(op[i].first==2)
		{
			indx++;
			dpx[indx][8000+op[i].second]=true;
		}else if(op[i].first==1){
			indy++;
			for(int j=0;j<16001;j++)
			{
				if(dpy[indy-1][j])
				{
					if(j+op[i].second<16001)
						dpy[indy][j+op[i].second]=true;
					if(j-op[i].second>-1)
						dpy[indy][j-op[i].second]=true;
				}
			}
		}else{
			indx++;
			for(int j=0;j<16001;j++)
			{
				if(dpx[indx-1][j])
				{
					if(j+op[i].second<16001)
						dpx[indx][j+op[i].second]=true;
					if(j-op[i].second>-1)
						dpx[indx][j-op[i].second]=true;
				}
			}
		}
	}
	if(dpx[indx][x+8000] && dpy[indy][y+8000])
		cout<<"Yes"<<endl;
	else
		cout<<"No"<<endl;
	return 0;
}

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

int main() {
	int N;
	cin >> N;
	vector<int> a(N);
	int sum = 0;
	
	for (int i = 0; i < N; ++i) {
		cin >> a[i];
		sum += a[i];
	}
	
	int mini = sum;
	int prefix_sum = 0;
	for (int i = 0; i < N; ++i) {
		cin >> a[i];
		prefix_sum += a[i];
		mini = min(mini, abs(prefix_sum - (sum - prefix_sum)));
	}
	
	cout << mini << endl;
	return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import sys
input = sys.stdin.readline


def main():
    n = int(input())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))

    result = 0
    for i in reversed(range(n)):
        if b[i] > a[i + 1]:
            result += a[i + 1]
            b[i] = b[i] - a[i + 1]
            a[i + 1] = 0

            if b[i] > a[i]:
                result += a[i]
                b[i] = b[i] - a[i]
                a[i] = 0
            else:
                result += b[i]
                a[i] = a[i] - b[i]
                b[i] = 0
        else:
            result += b[i]
            a[i + 1] = a[i + 1] - b[i]
            b[i] = 0
            continue

    print(result)


if __name__ == '__main__':
    main()


Measured memory_bytes: 19220
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<stack>
#include<cstdio>
#include<bitset>
#include<unordered_map>
#include<climits>
#include<fstream>
using namespace std;
///////////////////library zone!!!!!!!!!!!!!!!!!!!!!!!!!!!!
typedef long long ll;
typedef long double ld;
#define all(a) (a).begin(),(a).end()
const ll mod = 1000000007;
const ll Mod = 998244353;
struct P {
	ll pos, cost;
	bool operator<(const P &b) const { return cost < b.cost; }
	bool operator>(const P &b) const { return cost > b.cost; }
};
struct B {
	ll to, cost;
};
struct E {
	ll from, to, cost;
	bool operator<(const E &b) const { return cost < b.cost; }
	bool operator>(const E &b) const { return cost > b.cost; }
};
struct H {
	ll x, y;
	bool operator<(const H &b) const {
		if (x != b.x) return x < b.x;
		return y < b.y;
	}
	bool operator>(const H &b) const {
		if (x != b.x) return x > b.x;
		return y > b.y;
	}
	bool operator==(const H &b) const { return x == b.x&&y == b.y; }
	bool operator!=(const H &b) const { return (*this) != b; }
};
ll gcd(ll i, ll j) {
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcd(j%i, i);
}
ll mod_pow(ll x, ll n, ll p = mod) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x % p;
		x = x * x % p;
		n >>= 1;
	}
	return res;
}//x^n%p
const ll Inf = 3023372036854775807;
const int inf = 1500000000;
#define int long long
//----------------------------------------------------
int n, a, b, k;
int f[500000];
signed main() {
	cin >> n >> a >> b >> k;
	f[0] = 1;
	for (int i = 1; i < 400000; i++) {
		f[i] = f[i - 1] * i%Mod;
	}
	int ans = 0;
	for (int i = 0; i <= k; i += a) {
		int t = i / a;
		if (t > n) break;
		int r = (k - i) / b;
		if ((k - i) % b != 0) continue;
		if (r > n) continue;
		int res = f[n] * mod_pow(f[n - t], Mod - 2, Mod) % Mod*mod_pow(f[t], Mod - 2, Mod) % Mod;
		res = res * f[n] % Mod * mod_pow(f[n - r], Mod - 2, Mod) % Mod*mod_pow(f[r], Mod - 2, Mod) % Mod;
		ans += res;
		ans %= Mod;
	}
	cout << ans << endl;
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
#pragma GCC optimize("O3")

#define fi first
#define se second
#define em emplace
#define eb emplace_back
#define mp make_pair
#define pi pair<int,int>
#define vi vector<int>
#define vpi vector<pair<int,int>>
#define vll vector<ll>
#define vpll vector<pair<ll,ll>>
#define endl '\n'

#define si(v) int((v).size())
#define all(v) (v).begin(), (v).end()
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i) 
#define rep2(i, n, m) for (ll i = n; i <= (ll)(m); ++i)
#define rep3(i, n, m) for (ll i = n; i >= (ll)(m); --i)

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

using ll = long long;
using ld = long double;
using namespace std;

constexpr ll MOD = 1000000007;

signed main()
{
  cout << fixed << setprecision(20);
  ios::sync_with_stdio(false);
  cin.tie(0);

  int a, b, c; cin >> a >> b >> c;
  if (b < c) {
    int ans = b * 2 + min(c - b, a);
    if (c - b > a) ++ans;

    cout << ans << endl;
  }
  else cout << b + c << endl;

  return (0);
}


Measured memory_bytes: 3608
import math
n=int(input())
p=2
c=0
curr=0
while n%p==0:
    curr+=1
    n//=p
j=0
j=(math.sqrt(1+8*curr)-1)//2
c+=int(j)
#print(j)
for i in range (3,int(math.sqrt(n))+1,2):
    p=i
    curr=0
    while n%p==0:
        curr+=1
        n//=p
    j=0
    j=(math.sqrt(1+8*curr)-1)//2
    c+=int(j)
    #print(j)
if n>2:
    c+=1
print(c)

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

const double PI = 3.14159265358979323846;
//using namespace boost::multiprecision;
using namespace std;
typedef long long ll;
//typedef unsigned long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define sz(x) ll(x.size())
//typedef pair<int, int> P;
//typedef pair<ll, int> P;
//typedef pair<ll, ll> P;
//const double INF = 1e10;
//const ll INF = LONG_LONG_MAX / 100;
//const ll INF = (1ll << 31) - 1;
//const ll INF = 1e15;
//const ll MINF = LONG_LONG_MIN;
//const int INF = INT_MAX / 10;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
//typedef pair<int, int> P;
//typedef pair<double, double> P;
#define ret() return 0;

bool contain(set<char> &s, char a) { return s.find(a) != s.end(); }

//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
const int mod = 1000000007;
//const ll mod = 1e10;
typedef priority_queue<long long, vector<long long>, greater<long long> > PQ_ASK;


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

    x /= a;

    if (x >= a * b / 2) {
        double c = 2.0 * x / a - b;
        printf("%.20f\n", atan2(b - c, a) / (2 * PI) * 360);
    } else {
        double c = x * 2 / b;
        printf("%.20f\n", atan2(b, c) / (2 * PI) * 360);
    }
}




Measured memory_bytes: 512
#include<stdio.h>

int main(void)
{
	int a,b,d,r;
	double f;
	scanf("%d %d",&a,&b);
	(((a>=1)&&(a<=1000000000))&&((b>=1)&&(b<=1000000000)));
	d = a / b;
	r = a % b;
	f = (double)a / (double)b;
	printf("%d %d %f\n",d,r,f);
	
	return 0;
}

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

int main () {
    
    int x,y;
    cin >> x >>y;
    
    int grpa[] = {1,3,5,7,8,10,12};
    int grpb[] = {4, 6, 9, 11};
    
    for (int n=0 ; n<7 ; ++n ){
        if(x==grpa[n]){x=77;}
        if(y==grpa[n]){y=77;}
    }
    
    for (int n=0 ; n<4 ; ++n ){
        if(x==grpb[n]){x=88;}
        if(y==grpb[n]){y=88;}
    }
    
    if((x==77&&y==77)||(x==88&&y==88)||(x==2&&y==2)){
        cout<<"Yes\n";}
    else{cout<<"No\n";}
    
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define double long double
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define mod 1000000007
#define endl "\n"

double arr[3000][3000];

int32_t main()
{
	fast;
	int n;
	cin>>n;
	vector<double> v(n);
	for(int i=0;i<n;i++)
	{
		cin>>v[i];
	}
	for(int i=0;i<n+1;i++)
	{
		for(int j=0;j<n+1;j++)
			arr[i][j]=1;
	}
	double s=1;
	for(int i=1;i<n+1;i++)
	{
		s*=(1-v[i-1]);
		arr[i][0]=s;
		// cout<<arr[i][0]<<' ';
	}
	// cout<<endl;
	for(int i=1;i<n+1;i++)
	{
		for(int j=1;j<=i;j++)
		{
			// cout<<v[i-1]<<endl;
			if(i-1>=j)
				arr[i][j]=((arr[i-1][j]*(1-v[i-1]))+(arr[i-1][j-1]*(v[i-1])));
			else
				arr[i][j]=(arr[i-1][j-1]*(v[i-1]));
			// cout<<i<<' '<<j<<' '<<arr[i][j]<<endl;
		}
	}
	// cout<<c<<endl;
	double x=0;
	for(int i=(n+1)/2;i<n+1;i++)
	{
		// cout<<arr[n][i]<<endl;
		x+=arr[n][i];
	}
	cout<<fixed<<setprecision(10)<<x<<endl;
	return 0;
}

Measured memory_bytes: 140928
#include <bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define rep_start(a,i,n) for(ll i=a;i<=n;i++)
#define rev(i,n) for(ll i=n-1;i>=0;i--)
#define rev1(i,n) for(ll i=n;i>0;i--)
#define sz(a) int((a).size())
#define all(c) c.begin(),c.end()
#define tr(c,i) for(typeof(c).begin() i+=c.begin; i!=c.end(); i++)
#define present(c,x) (c.find(x)!=c.end())
#define cpresent(c,x) (find(all(c),x)!=c.end())
#define pb push_back
#define F first
#define S second
#define INF LONG_MAX
#define mod 1000000007
#define print1(a) cout<<a<<"\n";
#define print2(a,b) cout<<a<<" "<<b<<"\n";
#define print3(a,b,c) cout<<a<<" "<<b<<" "<<c<<"\n";
#define mt make_tuple
#define eb emplace_back

typedef long long int ll;
typedef vector<ll> vi;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef pair<ll,ll> ii;
typedef vector<ii> vii;
typedef tuple<int,int,int> State;

void solve(){
    int n;cin>>n;
    if(n%1000==0) cout<<0;
    else cout<<1000-n%1000;
}

signed main() {
    // your code goes here
    IOS
    ll t=1;
    //cin>>t;
    rep1(i,t){
        solve(); 
    }
    return 0;
}

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

#define foru(i, l, r) for(int i = (l); i <= (r); ++i)
#define ford(i, l, r) for(int i = (l); i >= (r); --i)

#define maxn 1000010

const ll mod = 1e9 + 7;

ll Pow(ll a, ll b) {
  if (b == 0) return 1;
  ll t = Pow(a, b / 2);
  t = (t * t) % mod;
  if (b % 2) return (t * a) % mod;
  return t;
}

ll gt[maxn], igt[maxn];

void init() {
  int maxm = 1e6;
  gt[0] = 1;
  for (int i = 1; i <= maxm; ++i) gt[i] = gt[i-1] * i % mod;
  igt[maxm] = Pow(gt[maxm], mod - 2);
  for (int i = maxm - 1; i >= 0; --i) igt[i] = igt[i+1] * (i+1) % mod;
}

ll C(int k, int n) {
  return gt[n] * igt[k] % mod * igt[n-k] % mod;
}

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
//    freopen("abc.inp", "r", stdin); freopen("abc.out", "w", stdout);
    int n; cin >> n;
    if (n == 1) {
      cout << 0; return 0;
    }
    ll cnt = 0;
    init();
    for (int i = 1; i <= n; ++i) {
      cnt = cnt + ( C(i, n) * Pow(8, n - i) % mod);
    }
    cout << (Pow(10, n) - Pow(8, n) - 2 * cnt + mod * mod) % mod;
    return 0;
}


Measured memory_bytes: 19288
def main():
    k = int(input())
    a, b = map(int, input().split(" "))
    ans = "NG"
    for i in range(b - a + 1):
        if a % k == 0:
            ans = "OK"
            break
        a += 1

    print(ans)

if __name__ == '__main__':
    main()


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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;

#define sz(a) int((a).size())
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define ini(a, i) memset(a, i, sizeof(a))
#define inin(a, n, i) memset(a, i, sizeof(a[0])*(n))
#define contains(c, i) ((c).find(i) != (c).end())
#define present(i, c) (find(all(c), i) != (c).end())

#define trav(x, c) for(auto& x : c)
#define rep(i, n) for(int i = 0; i < n; i++)
#define repa(i, b, e) for(int i = (b)-((b)>(e)); i != (e)-((b)>(e)); i += 1-2*((b)>(e)))
	
template<class T> bool chkmax(T &x, T y) { return x < y ? x = y, true : false; }
template<class T> bool chkmin(T &x, T y) { return x > y ? x = y, true : false; }
template<class A, class B> A cvt(B x) { stringstream s; s << x; A r; s >> r; return r; }

void read() {}
void print() {}
template<class T, class... Args> void read(T& a, Args&... args) { cin >> a; read(args...); }
template<class T, class... Args> void print(T a, Args... args) { cout << a << ' '; print(args...); }
template<class... Args> void println(Args... args) { print(args...); cout << '\n'; }

#define debug(args...) { string s_(#args); replace(all(s_), ',', ' '); stringstream ss_(s_); istream_iterator<string> it_(ss_); cerr_(it_, args); }
void cerr_(istream_iterator<string> it) { (void) it; }
template<class T, class... Args> void cerr_(istream_iterator<string> it, T a, Args... args) { cerr << *it << " = " << a << endl; cerr_(++it, args...); }

template<class T, class S>  ostream& operator<<(ostream& os, const pair<T, S>& p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
template<class T> ostream& operator<<(ostream &os, const vector<T> &v) { os << '{'; string sep; for (const auto &x : v) os << sep << x, sep = ", "; return os << '}'; }
template<class T> ostream& operator<<(ostream &os, const set<T> &s) { os << '{'; string sep; for (const auto &x : s) os << sep << x, sep = ", "; return os << '}'; }
template<class T, class S> ostream& operator<<(ostream &os, const map<T, S> &m) { os << '{'; string sep; for (const auto &x : m) os << sep << x, sep = ", "; return os << '}'; }
template<class T, size_t size> ostream& operator<<(ostream &os, const array<T, size> &arr) { os << '{'; string sep; for (const auto &x : arr) os << sep << x, sep = ", "; return os << '}'; }

const int INF = 0x3F3F3F3F;
const int MAXN = (int) 1e6;
const int MOD = (int) 1e9+7;

//=========================

void run_test() {
	string s; read(s);
	int ans = 0;
	rep(i, sz(s)) {
		if(s[i] == 'R') {
			int j = i, c = 0;
			while(j < sz(s) && s[j] == 'R') c++, j++;
			chkmax(ans, c);
		}
	}
	println(ans);
}

//=========================

int main() {
	ios::sync_with_stdio(false); cin.tie(nullptr);
	//int t_ = 1, t__; cin >> t__; while(t_ <= t__) { cout << "Case #" << t_++ << ": "; run_test(); }
	// int t_; cin >> t_; while(t_--) run_test();
	run_test();
	return 0;	
}


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

using namespace std;

void set_color(int node, int color, vector<vector<pair<int, int> > >& edges, vector<bool>& hasVisited, vector<int>& colors)
{
    colors[node] = color;
    hasVisited[node] = true;

    for(auto edge : edges[node])
    {
        int next_node = edge.first;
        int cost = edge.second;
        if(!hasVisited[next_node])
        {
            set_color(next_node, (color + cost) % 2, edges, hasVisited, colors);
        }
    }
}

int main()
{
    int n;
    vector<vector<pair<int, int> > > edges;
    vector<bool> hasVisited;
    vector<int> colors;

    cin >> n;

    edges.resize(n + 1);
    hasVisited.resize(n + 1, false);
    colors.resize(n + 1);

    for(int i = 0; i < n - 1; ++i)
    {
        int u, v, w;
        cin >> u >> v >> w;
        edges[u].push_back(make_pair(v, w));
        edges[v].push_back(make_pair(u, w));
    }

    set_color(1, 0, edges, hasVisited, colors);

    for(int i = 1; i <= n; ++i)
    {
        cout << colors[i] << endl;
    }

    return 0;
}

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

int main() {
  int H, W;
  cin >> H >> W;
  rep(i, H){
    string S;
    cin >> S;
    cout << S << endl;
    cout << S << endl;
  }
  
  return 0;
}


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

int main()
{
  int n, k, len = 0;
  cin >> n >> k;
  for (int i = 0; i < n; i++)
  {
    int x;
    cin >> x;
    len += min((x - 0) * 2, abs(x - k) * 2);
  }
  cout << len << endl;
}


Measured memory_bytes: 3620
#define _USE_MATH_DEFINES
#include <array>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;
mt19937 mrand(random_device{}());
int rnd(int x) { return mrand() % x; }

int main() {
  int64 t1, t2;
  vector<int64> a1(2), a2(2), d(2);
  cin >> t1 >> t2;
  for (int i = 0; i < 2; ++i) {
    cin >> a1[i] >> a2[i];
    d[i] = a1[i] * t1 + a2[i] * t2;
  }
  if (d[0] == d[1]) {
    puts("infinity");
    return 0;
  }
  if (d[0] < d[1]) {
    swap(d[0], d[1]);
    swap(a1[0], a1[1]);
    swap(a2[0], a2[1]);
  }
  int64 extra = a1[1] * t1 - a1[0] * t1;
  if (extra < 0) {
    puts("0");
    return 0;
  }
  if (extra == 0) {
    puts("infinity");
    return 0;
  }
  int64 ret = extra / (d[0] - d[1]);
  extra -= ret * (d[0] - d[1]);
  ret *= 2;
  if (extra) ++ret;
  printf("%lld\n", ret);
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;
using namespace std;
typedef tree<pair<int,int>,null_type,less<pair<int,int>>,rb_tree_tag,tree_order_statistics_node_update> oset;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
	*this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
using ll = long long;
#define ar array 

void test_case() {
	string s;
	cin >> s;
	if(s.back() != 's')	
		cout<<s<<'s';
	else
		cout<<s<<"es";
}
 
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int T = 1;
	//cin >> T;
	while(T--){
		test_case();
	}
}


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

long long n;
int ans[20];
int main() {
	cin >> n;
	int l = 1;
	long long b = 26;
	while (n > b) {
		++l;
		n -= b;
		b *= 26;
	}
	--n;
	for (int i = 0; i < l; ++i) {
		ans[i] = n % 26;
		n /= 26;
	}
	for (int i = 0; i < l; ++i)
		cout << (char) ('a' + ans[l - i - 1]);
	cout << endl;

}


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

namespace A
{
    class Program
    {
        public static void Main(string[] args)
        {
            var n = ReadLineIntSpilit();
            Console.WriteLine((n[0]*500 >= n[1]) ? "Yes" : "No");
            ReadLine();
        }

        /// <summary>
        /// コンビネーション
        /// </summary>
        /// <param name="n"></param>
        /// <param name="m"></param>
        /// <returns></returns>
        static int nCm(int n, int m)
        {
            if (m == 0) return 1;
            if (n == 0) return 0;
            return n * nCm(n - 1, m - 1) / m;
        }

        /// <summary>
        /// stringを一文字ずつintにキャストして配列に変換します。
        /// </summary>
        /// <param name="str"></param>
        /// <returns></returns>
        public static int[] StringCharArrayIntArray(string str)
        {
            List<int> b = new List<int>();
            for (int i = 0; i < str.Length; i++) {
                b.Add( int.Parse(str[i].ToString()));
            }
            return b.ToArray();
        }

        public static string ReadLine()
        {
            return Console.ReadLine();
        }

        public static int ReadLineInt()
        {
            return int.Parse(Console.ReadLine());
        }

        public static string[] ReadLineStringSplit(char a = ' ')
        {
            return ReadLine().Split(a).ToArray();
        }

        public static int[] ReadLineIntSpilit(char a = ' ')
        {
            return ReadLine().Split(a).Select(x => int.Parse(x)).ToArray();
        }

        static string[] GetAplhaLowerArray() => new string[]{ "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[] GetAplhaUpperArray() => new string[] { "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" };
    }
}

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

int main(){
	int n, a, x, y;
	if(scanf("%d",&n)==EOF){return 0;}
	
	int evidence[n][n];
	memset(evidence, 0, sizeof(int)*n*n); //一応sizeof(lightbutton)でも良い？
	
	for(int i = 0; i<n; i++){
		if(scanf("%d",&a)==EOF){return 0;}
		for(int j = 0; j < a; j++){
			if(scanf("%d %d",&x, &y)==EOF){return 0;}
			if(y == 1){evidence[i][x-1] = 1;}
			else if(y == 0){evidence[i][x-1] = -1;}
		}
	}

	/*
	printf("\n");
	for(int i = 0; i<n; i++){
		for(int j = 0; j < n; j++){
			printf("%d ", evidence[i][j]);
		}
		printf("\n");
	}*/
	
	int ng = 0;
	int max =0;
	int numofhonest;
	for (int honest = 0; honest < (1 << n); honest++){
		//printf("pattern:%d\n", honest);
		for(int i = 0; i<n; i++){
			//その人が正直者ならば、その人が正直者だという人は全て正直者であり、
			//その人が不親切な者だという人は全て不親切な者である必要がある。
			if(honest & (1 << i)){
				for(int j = 0; j < n; j++){
					if((honest & (1 << j)) && evidence[i][j]==-1){ ng =1; break;} //printf("evi of %d : %d is honest?\n", i,j);
					if(!(honest& (1 << j)) && evidence[i][j]==1){ ng =1; break;} //printf("evi of %d : %d isn't honest?\n", i,j); 
				}
			}
			if(ng==1){break;}
		}
		if(ng==0){
			numofhonest =  __builtin_popcount(honest);
			if(max < numofhonest){max = numofhonest;}
		}else{
			ng = 0;
		}
	}

	printf("%d\n", max);
	return 0;
}



Measured memory_bytes: 1688
#include<iostream>
#include<string>
using namespace std;
int main(){
    string str,com,p;
    int q,a,b;
    cin >> str >>q;
    for(int t=0;t<q;t++){
        cin >> com >>a >>b;
        if(com=="print"){
            cout << str.substr(a,b-a+1)<<endl;
            
        }
        else if(com=="reverse"){
            string tmp=str.substr(a,b-a+1);
            int n=tmp.size();
            for(int i=0;i<n;i++)str[i+a]=tmp[n-i-1];
        }
        else if(com=="replace"){
            cin >>p;
            str=str.replace(a,b-a+1,p);
        }
    }
    return 0;
}


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

#define _USE_MATH_DEFINES
#include <math.h>

using namespace std;

int main()
{
  int S, W;
  cin >> S >> W;

  if (S > W) cout << "safe" << endl;
  else cout << "unsafe" << endl;
}

Measured memory_bytes: 3616
#include<bits/stdc++.h>
#define reg register
#define F(i,j,k) for(reg int i=j;i<=k;++i)
#define dF(i,j,k) for(reg int i=j;i>=k;--i)
using namespace std;
typedef long long ll;
int n,k;
const int mod=998244353;
const int MN=2005;
int C[MN<<1][MN<<1],pw[MN<<1];
inline ll solve(int i,int n){
	reg int k2=min(k-i/2,(i-1)/2);reg int k1=k-(k2<<1)-((i&1)==0);
	reg ll res=0,pos=1;
	for(reg int j=k2;j+k1>0&&j>=0;j--,pos*=-1)
		res+=pos*C[j+k1+n-1][j+k1-1]*pw[j]%mod*C[k2][j]%mod,
		res%=mod;
	return (res+mod)%mod;
}
int main(){
	cin>>k>>n;C[0][0]=1;pw[0]=1;
	F(i,1,4000){
		C[i][0]=1;pw[i]=(pw[i-1]+pw[i-1])%mod;F(j,1,i)C[i][j]=(C[i-1][j-1]+C[i-1][j])%mod;
	}
	reg ll ans=0;
	F(i,2,k<<1){
		if(~i&1)ans=(solve(i,n)+solve(i,n-1))%mod;
		else ans=solve(i,n);
		printf("%lld\n",ans);
	}
	return 0;
}

Measured memory_bytes: 61440
#include <bits/stdc++.h>
using namespace std;
#define INF 2000000000
typedef long long int ll;
typedef pair<ll,ll> ii;
typedef pair<ii,ll> iii;
typedef vector<ll> vi;
typedef vector<ii> vii;
#define getbit(n,i) (((n)&(1<<(i)))!=0)
#define setbit0(n,i) ((n)&(~(1<<(i))))
#define setbit1(n,i) ((n)|(1<<(i)))
#define togglebit(n,i) ((n)^(1<<(i)))
#define lastone(n) ((n)&(-(n)))
#define read freopen("debug\\in.txt","r",stdin)
#define write freopen("debug\\out.txt","w",stdout)
#define fi first
#define se second
#define getI(a) scanf("%d",&a)
#define getII(a,b) scanf("%d%d",&a,&b)
#define PI (acos(-1))
#define fastread ios_base::sync_with_stdio(false);cin.tie(NULL)
#define mod (1000000007)
#define asz 500005
#define pb push_back
#define ppf pop_front
#define ppb pop_back
#define pf push_front
   
int main()
{
    fastread;
    string s;
    ll i,j,k,l,n,m;
   cin>>n>>m;
   for(i=1;i<=100005;i++){
   	   ll res1=(i*8)/100;
   	   ll res2=(i*10)/100;
   	   if(res1==n&&res2==m){
   	   	     cout<<i;
   	   	     return 0;
		  }
   }
   cout<<"-1";
   return 0;
    return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <queue>

using namespace std;

int main()
{
    for (;;) {
        int w, h;
        cin >> w >> h;
        if (w == 0 && h == 0)
            break;

        int wall[59][59] = {};
        for (int i = 0; i < 2 * h - 1; ++i) {
            for (int j = (i + 1) % 2; j < 2 * w - 1; j += 2) {
                cin >> wall[j][i];
            }
        }

        int x = 0, y = 0, l = 1, min = 9999;
        queue<int> q;
        int visited[30][30] = {};
        q.push(x);
        q.push(y);
        q.push(l);
        visited[x][y] = 1;
        for (;;) {
            int f = 0;
            x = q.front();
            q.pop();
            y = q.front();
            q.pop();
            l = q.front();
            q.pop();

            if (x == w - 1 && y == h - 1) {
                if (l < min)
                    min = l;
            }

            // right
            if (2 * x + 1 < 2 * w - 1 &&
                    wall[2 * x + 1][2 * y] == 0 && visited[x + 1][y] == 0) {
                q.push(x + 1);
                q.push(y);
                q.push(l + 1);
                visited[x + 1][y] = 1;
                f = 1;
            }
            // down
            if (2 * y + 1 < 2 * h - 1 &&
                    wall[2 * x][2 * y + 1] == 0 && visited[x][y + 1] == 0) {
                q.push(x);
                q.push(y + 1);
                q.push(l + 1);
                visited[x][y + 1] = 1;
                f = 1;
            }
            // left
            if (2 * x - 1 >= 0 &&
                    wall[2 * x - 1][2 * y] == 0 && visited[x - 1][y] == 0) {
                q.push(x - 1);
                q.push(y);
                q.push(l + 1);
                visited[x - 1][y] = 1;
                f = 1;
            }
            // top
            if (2 * y - 1 >= 0 &&
                    wall[2 * x][2 * y - 1] == 0 && visited[x][y - 1] == 0) {
                q.push(x);
                q.push(y - 1);
                q.push(l + 1);
                visited[x][y - 1] = 1;
                f = 1;
            }

            if (f == 0 && q.empty())
                break;
        }

        cout << (min == 9999 ? 0 : min) << endl;
    }

    return 0;
}

Measured memory_bytes: 1240
#include <stdio.h>
#include <string.h>
int main(void){
  int i,j;
  char s[110],key[]="keyence";
  scanf("%s",s);
  int len=strlen(s);
  for(i=0;i<7&&s[i]==key[i];i++);
    for(j=0;j<7&&s[len-1-j]==key[6-j];j++);
  if(i+j>=7) puts("YES");
  else puts("NO");
  return 0;
}

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

int main(){
    int N;
    cin >> N;
    long A[N];
    for (int i=0;i<N;++i){
        cin >> A[i];
    }
    bool big = false,small = false;
    int cnt = 0;
    for (int i=1;i<N;++i){
        if(A[i]>A[i-1]) {
            big = true;
        } else if (A[i]<A[i-1]) {
            small = true;
        }
        if(big == true && small == true) {
            cnt++;
            big = false;
            small = false;
        }
    }
    cout << cnt+1 << endl;
}

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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
  os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
  for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
  for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}

ll powLL(ll a, ll n){
    ll res = 1;
    while(n>0){
        if(n&1){
            res *= a;
            res %= mod;
        }
        a = a*a;
        a %= mod;
        n >>= 1;
    }
    return res;
}

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

    ll N;
    cin >> N;
    vector<ll> C(N);
    REP(i, N) cin >> C[i];

    sort(C.rbegin(), C.rend());

    ll res = 0;
    REP(i, N){
    	ll kake = (i==0 ? 1 : (powLL(2, i-1)*(2+i))%mod);
    	kake *= powLL(2, 2*N-i-1);
    	kake %= mod;
    	//dump(kake)
    	ll val = (C[i]*kake)%mod;
    	res += val;
    	res %= mod;
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <math.h>
#include <strings.h>
using namespace std;

int main()
{
    int A,B,C;
    cin >> A >> B >> C;
    if(A!=B and B!=C){
        if(A==C){
            cout << "Yes";
        }else{
            cout << "No";
        }
    }else if(A==B and B==C){
        cout << "No";
    }else{
        cout << "Yes";
    }
    return 0;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    static final Scanner sc    = new Scanner(System.in);
    static final int     MOD   = (int) 1E9 + 7;
    
    public static void main(String[] args) {
        int[] a = new int[4];
        int N = nint();
        
        for (int i = 0; i < N; i++) {
            a[nint()]++;
        }
        
        double[][][] dp = new double[N+2][N+2][N+2];
        
        for (int i3 = 0; i3 <= N; i3++) {
            for (int i2 = 0; i2 <= N; i2++) {
                for (int i1 = 0; i1 <= N; i1++) {
                    int s = i1 + i2 + i3;
                    if (s == 0) continue;
                    
                    double temp = N;
                    if (i1 > 0) temp += i1 * dp[i1-1][i2  ][i3  ];
                    if (i2 > 0) temp += i2 * dp[i1+1][i2-1][i3  ];
                    if (i3 > 0) temp += i3 * dp[i1  ][i2+1][i3-1];
                    dp[i1][i2][i3] = temp / s;
                }
            }
        }
        
        System.out.println(dp[a[1]][a[2]][a[3]]);
    }
    
    @Deprecated
    static int nint() {
        return sc.nextInt();
    }

    @Deprecated
    static int[] nints(int N) {
        return nints(N, 0, 0);
    }

    @Deprecated
    private static int[] nints(int N, int padL, int padR) {
        int[] a = new int[padL + N + padR];
        for (int i = 0; i < N; i++)
            a[padL + i] = nint();
        return a;
    }

    static long nlong() {
        return sc.nextLong();
    }

    static long[] nlongs(int N) {
        return nlongs(N, 0, 0);
    }

    static long[] nlongs(int N, int padL, int padR) {
        long[] a = new long[padL + N + padR];
        for (int i = 0; i < N; i++)
            a[padL + i] = nlong();
        return a;
    }

    static double ndouble() {
        return sc.nextDouble();
    }

    static double[] ndoubles(int N) {
        return ndoubles(N, 0, 0);
    }

    static double[] ndoubles(int N, int padL, int padR) {
        double[] d = new double[N + padL + padR];
        for (int i = 0; i < N; i++) {
            d[padL + i] = ndouble();
        }
        return d;
    }

    static String nstr() {
        return sc.next();
    }

    static char[] nchars() {
        return sc.next().toCharArray();
    }

    static char[] nchars(int padL, int padR) {
        char[] temp = sc.next().toCharArray();
        char[] ret = new char[temp.length + padL + padR];
        System.arraycopy(temp, 0, ret, padL, temp.length);
        return ret;
    }

    static char[][] nchars2(int H, int W) {
        return nchars2(H, W, 0, 0);
    }

    static char[][] nchars2(int H, int W, int padLU, int padRD) {
        char[][] a2 = new char[H + padLU + padRD][W + padLU + padRD];
        for (int i = 0; i < H; i++)
            System.arraycopy(nchars(), 0, a2[padLU + i], padLU, W);
        return a2;
    }

    static long min(long... ls) {
        return Arrays.stream(ls).min().getAsLong();
    }

    static long max(long... ls) {
        return Arrays.stream(ls).max().getAsLong();
    }

    static long abs(long a) {
        return Math.abs(a);
    }
}


Measured memory_bytes: 304340
#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{HashMap, HashSet};
#[allow(unused_imports)]
use std::io::*;
#[allow(unused_imports)]
use std::str::*;

#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($iter:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let cin = stdin();
    let cin = cin.lock();
    let s: String = cin
        .bytes() // Bytes
        .map(|c| c.expect("failed reading char") as char)
        .skip_while(|c| c.is_whitespace()) // c が whitespace である限り skip
        .take_while(|c| !c.is_whitespace()) // c が whitespace でない限り要素を返す
        .collect();
    s.parse().ok().expect("failed parsing")
}

#[allow(non_snake_case)]
fn main() {
    input! {
        N:usize,
        M:usize,
        X:usize,
        A:[[usize; M + 1]; N]
    }
    let maxi = 1 << N;
    let mut m = std::usize::MAX;
    for i in 0..maxi {
        let mut v = vec![0; M];
        let mut m2 = 0;
        for k in 0..N {
            if ((i >> k) & 1) == 1 {
                m2 += A[k][0];
                for j in 0..M {
                    v[j] += A[k][j + 1];
                }
            }
        }
        let mut f = true;
        for j in 0..M {
            if v[j] < X {
                f = false;
            }
        }
        dbg!(m2, v);
        if f {
            m = min(m, m2);
        }
    }
    if m == std::usize::MAX {
        println!("-1");
    } else {
        println!("{}", m);
    }
}


Measured memory_bytes: 2200
import numpy as np
N, M, C = list(map(int, input().split()))
B = list(map(int, input().split()))

A = []
for i in range(N):
  A.append(list(map(int, input().split())))

count = 0
for i in range(N):
  score = (np.array(A)[i, :] * np.array(B)).sum() + C
  if score > 0:
    count += 1

print(count)

Measured memory_bytes: 12484
<?php

$N = trim(fgets(STDIN));
$h = explode(' ', trim(fgets(STDIN)));

// $N = 7;
// $h = [2, 9, 4, 5, 1, 6, 10];

$dp = [0];

for ($i = 1; $i < $N; ++$i) {
    $min = abs($h[$i] - $h[$i - 1]) + $dp[$i - 1];

    if ($i > 1 && $min > $cost = abs($h[$i] - $h[$i - 2]) + $dp[$i - 2]) {
        $min = $cost;
    }

    $dp[] = $min;
}

echo $dp[$N - 1].PHP_EOL;


Measured memory_bytes: 18932
N = int(input())
all_game = [[int(j) for j in input().split()] for i in range(N)]
point = [0] * N

for g_i in range(3):
    g = [int(no[g_i]) for no in all_game]
    dic = {}
    for x in g:
        if x not in dic:
            dic[x] = 1
        else:
            dic[x] += 1
    for p_i in range(N):
        if dic[g[p_i]] == 1:
            point[p_i] += g[p_i]

for line in point:
    print(line)


Measured memory_bytes: 5636
//----------------------------templates
    #pragma GCC optimize ("Ofast")
    #pragma GCC target ("tune=native")
    #pragma GCC target ("avx")
    //----------------------------
    #include <bits/stdc++.h>
    using namespace std;

    typedef long long ll;
    typedef unsigned long long ull;
    #define int ll

    #define FOR(i,j,n) for (int i=(int)(j);i<(n);i++)
    #define REP(i,n) for (int i=0;i<(int)(n);i++)
    #define REPS(i,n) for (int i=1;i<=(int)(n);i++)
    #define REPN(i,n) for (int i=(int)(n)-1;i>=0;i--)
    #define REPNS(i,n) for (int i=(int)(n);i>0;i--)

    #define I(n) scanf("%lld", &(n))
    #define LL(n) scanf("%lld", &(n))
    #define pb(n) push_back((n))
    #define mp(i,j) make_pair((i),(j))
    #define eb(i,j) emplace_back((i),(j))
    #define y0 y3487465
    #define y1 y8687969
    #define j0 j1347829
    #define j1 j234892
    #define uniq(v) v.erase( unique(v.begin(), v.end()), v.end() )

    #define all(x) (x).begin(),(x).end()
    #define sz(x) ((int)(x).size())

    typedef vector<int> vi;
    typedef pair<int,int> pi;
    typedef vector<pi> vpi;
    typedef vector<vi> vvi;
    typedef vector<vpi> vvpi;
    typedef vector<vvi> vvvi;

    const int mod = 1000000007;

//--------------------------------------------

int n,c;
int D[30][30];
int ci[501][501];

vvi x(3);

signed main(){
    I(n); I(c);
    REP(i,c) REP(j,c) I(D[i][j]);
    REP(i,n) REP(j,n) { I(ci[i][j]); ci[i][j]--; }

    REP(i,3) x[i].resize(c);
    REP(rem,3) REP(k,c)
        REP(i,n) REP(j,n)
            if ((i+j)%3 == rem) 
                x[rem][k] += D[ci[i][j]][k];
        
    // REP(rem,3) sort(all(x[rem]));
    int ret = 1e+13;
    REP(ix,c) REP(iy,c) REP(iz,c){
        if (ix == iy || iy == iz || iz == ix) continue;
        ret = min(ret, x[0][ix] + x[1][iy] + x[2][iz]);
    }
    cout << ret << endl;

}

Measured memory_bytes: 2176
#include <stdio.h>
//i　全体の文字数、j　キーワードの文字数
int main(void) {
	char s[102],p[102];
	int i,j,n,m,x,N;
	fgets(s,102,stdin);
	fgets(p,102,stdin);

	for(i=0;s[i]!=0;i++){}
    i--;
	s[i]=0;
	for(j=0;p[j]!=0;j++){}
    if(p[j-1]==10){
        j--;
        p[j]=0;
    }

	for(n=0;n<=2*i;n++){
        for(x=0,N=n,m=0;1;N++,m++){
            if(s[N%i]==p[m]){
            x++;
            if(x==j){
                break;
            }
            }else{
                break;
            }
        }
    if(x==j){
                break;
            }
	}

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


Measured memory_bytes: 2084
#include<bits/stdc++.h>
using namespace std;
#define ll  long long
#define endl '\n'
#define FASTINOUT ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define fr first
#define sc second
const ll mod = 1000000007;
const double PI = 3.141592653589793238463;
const int N=3e5+10;
int main()
{
    FASTINOUT;
    int x;
    cin>>x;
    int y=x/10;
    if (x%10==9 ||y==9)
        cout<<"Yes\n";
    else
        cout<<"No\n";
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void){
	int ai,n,i,min,max;
	long sum;
	scanf("%d",&n);
	for( i = 0;i < n;i++ ){
		scanf("%d",&ai);
		if( i == 0 ){
			min = ai;
			max = ai;
			sum = ai;
		}
		else{
			sum = sum + ai;
			if( min > ai ){
				min = ai;
			}
			if( max < ai ){
				max = ai;
			}
		}
	}
	printf("%d %d %ld\n",min,max,sum);
	return 0;
}

Measured memory_bytes: 600
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <queue>
#include <sstream>
#include <utility>
#include <vector>

#define REP(i, n) for(int i = 0; i < (n); i++)
#define ALL(a) (a).begin(), (a).end()
#define AALL(a, n) (a), a + n
#define FILL(a, n) memset((a), n, sizeof(a))
#define FILLZ(a) FILL(a, 0)

using namespace std;

typedef long long ll;

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

inline int toInt(string s) {
	int v;
	istringstream sin(s);
	sin >> v;
	return v;
}

int main() {
	int n, k, q;
	scanf("%d %d %d", &n, &k, &q);
	vector<int> a(q);
	for(auto&& e : a) {
		scanf("%d", &e);
	}

	vector<int> players(n, 0);
	for(auto&& e : a) {
		players[e - 1]++;
	}

	for(auto&& score : players) {
		puts(k - (q - score) > 0 ? "Yes" : "No");
	}

	return 0;
}

Measured memory_bytes: 1408
import sys
input = sys.stdin.buffer.readline
import math
import copy

def main():
    N,a,b = map(int,input().split())
    MOD = 10**9+7

    fac = [0 for _ in range(2*10**5+1)]
    fac[0],fac[1] = 1,1
    inv = copy.deepcopy(fac)
    invfac = copy.deepcopy(fac)
    
    for i in range(2,2*10**5+1):
        fac[i] = (fac[i-1]*i)%MOD
        inv[i] = MOD-(MOD//i)*inv[MOD%i]%MOD
        invfac[i] = (invfac[i-1]*inv[i])%MOD
        
    def coef(x,y):
        num = (((fac[x]*invfac[y])%MOD)*invfac[x-y]%MOD)
        return num

    def nume(N, r, mod):
        x = 1
        for i in range(1, r + 1):
            x = x * (N-i+1) % mod 
        return x

    s = pow(2,N,MOD) 
    a = nume(N,a,MOD)*invfac[a]
    b = nume(N,b,MOD)*invfac[b]
    ans = (s-1-a-b) % MOD

    print(int(ans))
    
if __name__ == "__main__":
    main()

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

void swap(int *u, int *v){
    int temp = *u;
    *u = *v;
    *v = *u;
}

int main(void){
    int n;
    cin >> n;
    int a[n], b[n];
    rep(i, n){
        cin >> a[i];
        b[i] = a[i];
    }
    sort(b, b+n);
    int m[2] = {b[n-1], b[n-2]};

    rep(i, n){
        if(a[i] != m[0]){
            cout << m[0] << endl;
        }else{
            cout << m[1] << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 3200