akhauriyash/Code-Regression huggingface dataset:
const int LG = 21;
const int FN = 400005;
const long long MOD = 1e9 + 7;
const long long INF = 1e9;
const long long INFLL = 1e18;

#include <bits/stdc++.h>

using namespace std;

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

#define forn(i, n) for (int (i) = 0; (i) != (n); (i)++)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define fi first
#define se second
#define re return
#define pb push_back
#define uniq(x) sort(all(x)); (x).resize(unique(all(x)) - (x).begin())

#ifdef LOCAL
#define dbg(x) cerr << __LINE__ << " " << #x << " " << x << endl
#define ln cerr << __LINE__ << endl
#else
#define dbg(x) void(0)
#define ln void(0)
#endif // LOCAL

int cx[4] = {-1, 0, 1, 0};
int cy[4] = {0, -1, 0, 1};
string Ans[2] = {"No", "Yes"};
string ANS[2] = {"NO", "YES"};

ll inq(ll x, ll y)
{
    if (!y) re 1 % MOD;
    ll l = inq(x, y / 2);
    if (y % 2) re l * l % MOD * x % MOD;
    re l * l % MOD;
}

ll rev(ll x)
{
    return inq(x, MOD - 2);
}

bool __precomputed_combinatorics = 0;
vector<ll> __fact, __ufact, __rev;

void __precompute_combinatorics()
{
    __precomputed_combinatorics = 1;
    __fact.resize(FN);
    __ufact.resize(FN);
    __rev.resize(FN);
    __rev[1] = 1;
    for (int i = 2; i < FN; i++) __rev[i] = MOD - __rev[MOD % i] * (MOD / i) % MOD;
    __fact[0] = 1, __ufact[0] = 1;
    for (int i = 1; i < FN; i++) __fact[i] = __fact[i - 1] * i % MOD, __ufact[i] = __ufact[i - 1] * __rev[i] % MOD;
}

ll fact(int x)
{
    if (!__precomputed_combinatorics) __precompute_combinatorics();
    return __fact[x];
}

ll cnk(int n, int k)
{
    if (k < 0 || k > n) return 0;
    if (!__precomputed_combinatorics) __precompute_combinatorics();
    return __fact[n] * __ufact[n - k] % MOD * __ufact[k] % MOD;
}

int Root(int x, vector<int> &root)
{
    if (x == root[x]) return x;
    return root[x] = Root(root[x], root);
}

void Merge(int v, int u, vector<int> &root, vector<int> &sz)
{
    v = Root(v, root), u = Root(u, root);
    if (v == u) return;
    if (sz[v] < sz[u])
    {
        sz[u] += sz[v];
        root[v] = u;
    }
    else
    {
        sz[v] += sz[u];
        root[u] = v;
    }
}

int ok(int x, int n)
{
    return 0 <= x && x < n;
}

void bfs(int v, vi &dist, vector<vi> &graph)
{
    fill(all(dist), -1);
    dist[v] = 0;
    vi q = {v};
    for (int i = 0; i < q.size(); i++)
    {
        for (auto u : graph[q[i]])
        {
            if (dist[u] == -1)
            {
                dist[u] = dist[q[i]] + 1;
                q.push_back(u);
            }
        }
    }
}


signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int a, b, c;
    cin >> a;
    cout << 48 - a;
}

/* Note:
Check constants at the beginning of the code.
    N is set to 4e5 but be careful in problems with large constant factor.
    Setting N in every problem is more effective.
Check corner cases.
    N = 1
No def int long long for now.
Add something here.
*/


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
int S(int x)
{
    int res = 0;
    while (x > 0)
    {
        res += x % 10;
        x /= 10;
    }
    return res;
}

void _main()
{
    int N;
    cin >> N;
    cout << (N % S(N) == 0 ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
n,q=map(int,input().split())
s=input()
ac=[0]*n
tmp=0
for i in range(1,n):
	if s[i-1]=='A' and s[i]=='C':
		tmp+=1
	ac[i]=tmp

for i in range(q):
	l,r=map(int,input().split())
	print(ac[r-1]-ac[l-1])

Measured memory_bytes: 6084
#include <bits/stdc++.h>
using namespace std;
#define MAXN 200000
#define ll long long
#define rint register int
inline int rf(){int r;int s=0,c;for(;!isdigit(c=getchar());s=c);for(r=c^48;isdigit(c=getchar());(r*=10)+=c^48);return s^45?r:-r;}
ll S[MAXN+5], Ans; int n; ll Calc(int a, int b, int c){ll A[4]={S[a],S[b]-S[a],S[c]-S[b],S[n]-S[c]};return *max_element(A,A+4)-*min_element(A,A+4);}
void Work(int a, int b, int c)
{
	for(rint i = a-3, j, k; i <= a+3; i++) for(j = b-3; j <= b+3; j++) for(k = c-3; k <= c+3; k++)
		if(i<j&&j<k&&i>=1&&k<=n-1) Ans = min(Ans,Calc(i,j,k));
}
int main()
{
	n = rf(); generate(S+1,S+n+1,rf); partial_sum(S+1,S+n+1,S+1); Ans = S[n];
	for(rint b = 2, c, d, lef, rig, mid; b < n-1; b++)
	{
		for(lef = 1, c = rig = b-1; lef <= rig; S[b]-S[mid=lef+rig>>1]<=   S[b]    >>1 ? c = mid, rig = mid-1 : lef = mid+1);
		for(d = lef = b+1, rig=n-1; lef <= rig; S[mid=lef+rig>>1]-S[b]<=(S[n]-S[b])>>1 ? d = mid, lef = mid+1 : rig = mid-1); Work(c,b,d); 
	}	return !printf("%lld\n",Ans);
}

Measured memory_bytes: 1792
#!/usr/bin/env python
# coding: utf-8

# In[38]:


import collections


# In[52]:


N = int(input())
A = list(map(int, input().split()))


# In[54]:


a_cnt = collections.Counter(A)
p = sorted([i for i in a_cnt.items() if i[1] >= 2], reverse=True)
if len(p) > 0:
    if p[0][1]>=4:
        print(p[0][0]**2)
    elif len(p) > 1:
        print(p[0][0]*p[1][0])
    else:
        print(0)
else:
    print(0)


# In[ ]:






Measured memory_bytes: 22368
def get_primes(maxn):
    c = int(maxn**0.5)+1
    sieve = [True]*c
    sieve[0] = sieve[1] = False
    primes = []
    for p in range(2, c):
        if sieve[p]:
            primes.append(p)
            for i in range(2*p, c, p):
                sieve[i] = False
    return primes


def is_prime(n, primes):
    if n <= 1:
        return False
    c = int(n**0.5)+1
    for p in primes:
        if p > c:
            break
        if n != p and n % p == 0:
            return False
    return True


def solve():
    n, *A, = map(int, open(0).read().split())

    primes = get_primes(max(A))
    ans = 0
    for a in A:
        if is_prime(a, primes):
            ans += 1
    print(ans)


if __name__ == '__main__':
    solve()



Measured memory_bytes: 6588
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define int ll
#define double ld
const int inf=1e18;
///----------------------------------------------------
vector<vector<int> > dp;
int n;
int SLIM=10005;
struct st
{
    int s,w,v;
};
bool cmp(st x,st y)
{
    return x.w+x.s<y.w+y.s;
}
vector<st> vec;
void init()
{
    cin>>n;
    vec.resize(n);
    for(int i=0;i<n;i++)
    {
        cin>>vec[i].w>>vec[i].s>>vec[i].v;
    }
    dp.resize(n+1,vector<int>(SLIM,-inf));
    sort(vec.begin(),vec.end(),cmp);
}

void assin(int i,int j,int val)
{
    if(i<0||j<0||j>=SLIM||i>n)
        return ;
    dp[i][j]=max(dp[i][j],val);
}

void solve()
{
    dp[0][0]=0;
    int maxi=0;
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<SLIM;j++)
        {
            if(dp[i][j]<0)
                continue;
            assin(i+1,j,dp[i][j]);
            maxi=max(maxi,dp[i][j]);
            if(j<=vec[i].s)
            {
                assin(i+1,j+vec[i].w,dp[i][j]+vec[i].v);
                maxi=max(maxi,dp[i][j]+vec[i].v);
            }
        }
    }
    for(int i=0;i<=n;i++)
    {
        for(int j=0;j<SLIM;j++)
        {
//            if(dp[i][j]!=-inf)
//            cerr<<setw(3)<<dp[i][j]<<" ";
//            else
//                cerr<<setw(3)<<"inf"<<" ";
            maxi=max(maxi,dp[i][j]);
        }
//        cerr<<"\n";
    }
    cout<<maxi;
}
signed main()
{
    init();
    solve();
    return 0;
}



















Measured memory_bytes: 78592
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vvll> vvvll;
typedef vector<string> vstr;
typedef pair<ll, ll> pll;
typedef vector<pll> vp;
typedef map<ll, ll> mll;
typedef map<string, ll> mstrll;
#define pb push_back
#define mp make_pair
#define fir first
#define sec second
#define maxs(x, y) (x = max(x, y))
#define mins(x, y) (x = min(x, y))
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(ll i = ll(a); i < ll(b); i++)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep,)(__VA_ARGS__)
#define each(i, n) for(auto&& i: n)
#define out(x) cout << (x)
#define indent() cout << '\n'
#define print(x) cout << (x) << '\n'
#define debug(x) cerr << #x << ": " << (x) << '\n'
ll gcd(ll a, ll b){return b != 0 ? gcd(b, a % b) : a;}
ll lcm(ll a, ll b){return a / gcd(a, b) * b;}
ll factorial(ll a){return a < 2 ? 1 : factorial(a - 1) * a;}
ll summation(ll a){return a < 1 ? 0 : (a * a + a) / 2;}
const ll INF = 1e16;
const ll MOD = 1e9 + 7;
const ll N = 200005;
const ll M = 100005;
const string ALPHABETS = "abcdefghijklmnopqrstuvwxyz";
ll dx[] = {-1, 0, 1, 0}, dy[] = {0, -1, 0, 1};
//ll dx[] = {-1, 0, 1, -1, 1, -1, 0, 1}, dy[] = {-1, -1, -1, 0, 0, 1, 1, 1};
ll n, m, x, y, z, w, h;
string s, t;

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    while(cin >> x >> y >> z){
        ll ans = 0, tmp = 0, cnt = 0, mx = -INF, mn = INF;
        ll a[N] = {}, b[N] = {}, c[N] = {};
        vll v;
        print(max(0LL, z * (x - 1) + y - y * (x - 1) - z + 1));
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long a[200000],cnt[200000];
int main()
{
	long long n,q,sum;
	cin>>n;
	for (long long i = 0; i < n; ++i)
	{
		cin>>a[i];
		cnt[a[i]]++;
		sum += a[i];
	}
	cin>>q;
	for (long long i = 0; i < q; ++i)
	{
		long long b,c;
		cin>>b>>c;
		sum = sum - b*cnt[b];
		sum = sum + cnt[b]*c;
		cnt[c] += cnt[b];
		cnt[b] = 0;
		cout<<sum<<endl;
	}
	
	return 0;
}

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

int main(){
    int n;
    string s;
    cin >> n >> s;
    vector<char> num(3);
    int cnt = 0;
    for(int i = 0; i <= 9; i++){
        for(int j = 0; j <= 9; j++){
            for(int k = 0; k <= 9; k++){
                num[0] = i + '0';
                num[1] = j + '0';
                num[2] = k + '0';
                int d = 0;
                for(int l = 0; l < s.size(); l++){
                    if(num[d] == s[l]){
                        d++;
                        if(d == 3){
                            cnt++;
                            break;
                        }
                    }
                }
            }
        }
    }
    cout << cnt << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define rep(i, n) for(int i=0; i<n; i++)
#define REP(i, n) for(int i=0; i<=n; i++)
#define repr(i, n) for(int i=n; i>0; i--)
#define REPR(i, n) for(int i=n; i>=0; i--)
const ll INF = 1LL<<60;
const int INT_INF = 1e9;
const ll MOD = 1e9+7;
template<class T> void puts(T x) { std::cout << x << std::endl; }
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; }
using namespace std;

int n, m;
vector<pair<int, int>> p;
priority_queue<int> pq;

int main() {
    cin >> n >> m;
    rep(i, n) {
        int a, b;
        cin >> a >> b;
        p.emplace_back(make_pair(a, b));
    }
    sort(p.begin(), p.end());

    ll ans = 0;
    int tmp = 0;
    rep(i, m) {
        while (p[tmp].first <= i+1 && tmp < n) {
            pq.push(p[tmp].second);
            tmp++;
        }

        if (!pq.empty()) {
            ans += pq.top();
            pq.pop();
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 1908
#include <iostream>

using namespace std;

char a(char c, int n) {
  c = c + n;
  if(c > 90) {
    c -= 26;
  }

  return c;
}

int main() {
  int N;
  string S;
  cin >> N;
  cin >> S;

  for(int i = 0, l = S.length(); i < l; ++i) {
    S[i] = a(S[i], N);
  }

  cout << S;

  return 0;
}

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

int main(){
	int n, k ,q;
	cin >> n >> k >> q;
	vector<int> ans(n,k);
	vector<int> wa(n);
	vector<int> a(q);
	rep(i,q) cin >> a[i];
	rep(i,q){
		wa[a[i] -1]++;
	}
	rep(i,n){
		ans[i] += wa[i];
		ans[i] -= q;
	}
	rep(i,n){
		if(ans[i] > 0) cout << "Yes" << endl;
		else cout << "No" << endl;
	}
}

Measured memory_bytes: 4320
# coding:utf-8

import sys
import math
import time
#import numpy as np
import collections
from collections import deque
import queue
import copy


#X = str(input()).split()
#a = [int(x) for x in input().split()]


N = int(input())
AB=[]
A = []
B = []
C = []

for i in range(N):
  AB.append(str(input()).split())
  A.append(int(AB[i][0]))
  B.append(int(AB[i][1]))
  C.append([B[i]-A[i], A[i], B[i]])

C = sorted(C, key = lambda x: (x[2], x[0]))
unko = 1
time = 0

#print(C)

for i in range(N):
  if(C[i][2]-time-C[i][1]<0):
    print("No")
    unko = 0
    break
  else:
    time += C[i][1]

if(unko==1):
  print("Yes")



Measured memory_bytes: 124244
#include <algorithm>
#include <iostream>

using namespace std;

int main() {
  int n;
  cin >> n;
  int m = 0;
  int ans = 0;
  for (int i = 0; i < n; i++) {
    int p;
    cin >> p;
    ans += p;
    m = max(m, p);
  }
  ans -= m / 2;
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
A = [list(map(int, input().split())) for _ in range(3)]
N = int(input())
b = [int(input()) for _ in range(N)]

f=0
for v in b:
	for i in range(9):
		if A[i // 3][i % 3] == v:
			f|=1<<i
ans = 0
for v in [7,56,73,84,146,273,292,448]:
  ans |= f&v==v;
print('Yes' if ans else 'No')


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


int main() {

  int N, K;
  string S;
  cin >> N >> K >> S;

  // 0 が何個、1 が何個ならんでいるかを保持する配列
  vector<int> v;
  
  // 今見ている数 1 or 1
  int current = 1;
  
  // 今見ている数が何個並んでいるか
  int count = 0;

  for (int i = 0; i < N; i++) {
    if (S[i] == (char) '0' + current) {
      count++;
    } else {
      v.push_back(count);
      current = 1 - current;
      count = 1;
    }
  }
  // 最後の分
  if (count != 0) {
    v.push_back(count);
  }

  // 1-0-1-0-1 と 1 を最後にする
  if (v.size() % 2 == 0){
    v.push_back(0);
  }

  int answer = 0;
  int add = 2 * K + 1;

  // 累積和
  vector<int> sum(v.size()+1);
  for (int i = 0; i < v.size(); i++) {
    sum[i + 1] = sum[i] + v[i];
  }

  for (int i = 0; i < v.size(); i += 2) {
  
    int left = i;
    int right = min(i + add, (int) v.size());

    int tmp = sum[right] - sum[left];

    answer = max(answer, tmp);
  }

  cout << answer << endl;

  return 0;

}

Measured memory_bytes: 1272
function main(input) {
  const tmp = input.trim().split(' ').map((n) => parseInt(n, 10))

  if (tmp[0] <= tmp[2] && tmp[2] <= tmp[0] + tmp[1]) {
    console.log('YES')
  } else {
    console.log('NO')
  }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'))

Measured memory_bytes: 29504
#include <iostream>
#include <string>
using namespace std;
int main() {
    int dates[] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
    string days[] = {"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"};
 
    int m,d;
    while (cin >> m >> d && m != 0 || d != 0) {
        int day = 2;
        for (int i=0; i<m-1; ++i) {
            day = (day + dates[i]) % 7;
        }
        day = (day + d) % 7;
 
        cout << days[day] << endl;
    }
}

Measured memory_bytes: 1196
#d=["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"]
#import numpy as np
#n=int(input())
#li=input().split()
#import fractions
#n=int(input())
#S=input()
#import math

lis=list(map(int,input().split()))
ans=lis[2]
for i in range(10):
    ans=lis[0]*ans-lis[1]
    print(ans)


Measured memory_bytes: 2940
import java.util.Scanner;

class Main{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
       int n = sc.nextInt();
       int x[] = new int[n+1];
       int y[] = new int[n+1];
       int t[] = new int[n+1];
       x[0] = 0;
       y[0] = 0;
       t[0] = 0;
       for(int i = 1; i < n+1; i++){
           t[i] = sc.nextInt();
           x[i] = sc.nextInt();
           y[i] = sc.nextInt();
           if(i > 0){
               int dis = Math.abs(x[i]-x[i-1]) + Math.abs(y[i]-y[i-1]);
               int diff = t[i] - t[i-1];
               if(diff < dis || dis % 2 != diff % 2){
                   System.out.println("No");
                   return;
               }
           }
       }
       System.out.println("Yes");
    }
}



Measured memory_bytes: 89024
#include <cstdio>
#include <algorithm>
#include <stack>
#include <queue>
#include <deque>
#include <vector>
#include <string>
#include <string.h>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <map>
#include <set>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <numeric>
#include <cctype>
#include <bitset>
#include <cassert>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(s) s.begin(), s.end()
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const int MX = 100005, INF = 1001001001;
const ll LINF = 1e18;
const double eps = 1e-10;
const int DIV = 1e9+7;

int main()
{
    int x, a, b;
    cin >> x >> a >> b;
    if(abs(x-a) > abs(x-b)) cout << 'B' << endl;
    else cout << 'A' << endl;
    cout << endl;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    
    int W[10]={0};
    int K[10]={0};
    int c=0;
    int total_W=0;
    int total_K=0;
    
    for(int i=0;i<10;i++){
        cin>>W[i];
    }
    for(int i=0;i<10;i++){
        cin>>K[i];
    }
    
    for(int i=0;i<10;i++){
        for(int j=0;j<10;j++){
            if(W[j]<W[j+1]&&j!=9){
            c=W[j];
            W[j]=W[j+1];
            W[j+1]=c;
            }
        }
    }
    total_W=W[0]+W[1]+W[2];
    
     for(int i=0;i<10;i++){
        for(int j=0;j<10;j++){
            if(K[j]<K[j+1]&&j!=9){
            c=K[j];
            K[j]=K[j+1];
            K[j+1]=c;
            }
        }
    }
    total_K=K[0]+K[1]+K[2];
    
    cout<<total_W<<" "<<total_K<<endl;
    return 0;

}

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

int main() {
	int count[4][3][10], n;
	scanf("%d", &n);
	for (int i = 0; i < 4; i++) {
		for (int j = 0; j < 3; j++) {
			for (int k = 0; k < 10; k++)count[i][j][k] = 0;
		}
	}
	int b, f, r, v;
	for (int i = 0; i < n; i++) {
		scanf("%d %d %d %d", &b, &f, &r, &v);
		if (count[b - 1][f - 1][r - 1] != 0) {
			count[b - 1][f - 1][r - 1] += v;
		}
		else count[b - 1][f - 1][r - 1] = v;
	}
	for (int i = 0; i < 4; i++) {
		for (int j = 0; j < 3; j++) {
			for (int k = 0; k < 10; k++) {
				printf(" %d", count[i][j][k]);
				if (k == 9) {
					printf("\n");
					if (j == 2 && i < 3)printf("%s\n", "####################");
				}
			}
		}
	}
}


Measured memory_bytes: 3208
#include<stdio.h>
#define MAX 101

main(){
  int i, j, a, b, c, v;
  int G[MAX][MAX];
  scanf("%d",&c);

  for(i = 1; i <= c; i++){
    for(j = 1; j <= c; j++){

      G[i][j] = 0;

    }
  }

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

    scanf("%d %d", &b, &a);

    for(j = 1; j <= a; j++){

      scanf("%d",&v);

      G[i][v] = 1;
    }
  }


 
 for(i = 1; i <= c; i++){
    for(j = 1; j <= c; j++){

      printf("%d",G[i][j]);

      if(j < c)printf(" ");
    }
printf("\n");
 }
 return 0;
}

Measured memory_bytes: 640
use proconio::input;

fn main() {
    input! {
        a: f64,
        b: f64,
        h: f64,
        m: f64,
    }
    let pi = std::f64::consts::PI;
    let from00 = h * 60. + m;
    let (h_angle, m_angle) = (from00 * 2. * pi / (12. * 60.), from00 * 2. * pi / 60.);
    println!("{}", cosine_theorem(a, b, m_angle - h_angle));
}

fn cosine_theorem(a: f64, b: f64, angle: f64) -> f64 {
    (a * a + b * b - 2. * a * b * angle.cos()).sqrt()
}


Measured memory_bytes: 3100
import { readFileSync } from 'fs'
import { reverse } from 'dns'
import { start } from 'repl'
 
let lines: string[] = [];
const reader = require('readline').createInterface({
    input: process.stdin,
    output: process.stdout
});
 
reader.on('line', function (line: string) {
    lines.push(line);
});
reader.on('close', function () {
    let n = parseInt(lines[0])
    let l = lines[1].split(' ').map(function (_) { return parseInt(_); })

    l.sort((a: number, b: number) => a - b)

    let ans = 0

    for (let i = 0; i < n; i++) {
        for (let j = i; j < n; j++) {
            for (let k = j; k < n; k++) {
                if(l[i] != l[j] && l[j] != l[k] && l[k] != l[i]) {
                    //console.log(l[i], l[j], l[k])
                    if(l[i] + l[j] > l[k]) {
                        ans++
                    }
                }
            }
        }   
    }
    
    console.log(ans)
});

Measured memory_bytes: 33012
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<iostream>
#include<cmath>
#include<cctype>
#include<set>
#include<queue>
#include<vector>
#include<map>
using namespace std;
typedef long long LL;

inline int read() {
	int x=0,f=1;char ch=getchar();for(;!isdigit(ch);ch=getchar())if(ch=='-')f=-1;
	for(;isdigit(ch);ch=getchar())x=x*10+ch-'0';return x*f;
}

const int N = 305, mod = 998244353;
int a[N][N], b[N][N];

int ksm(int a,int b) {
	int res = 1;
	while (b) {
		if (b & 1) res = 1ll * res * a % mod;
		a = 1ll * a * a % mod;
		b >>= 1;
	}
	return res;
}

int main() {
//	freopen("a.in", "r", stdin);
	int n = read(), m = read(), cnt = 0;
	for (int i = 1; i <= n; ++i) 
		for (int j = 1; j <= m; ++j) a[i][j] = read();
	for (int i = 1; i <= n; ++i) 
		for (int j = 1; j <= m; ++j) 
			if (a[i][j]) {
				if (!b[j][j]) {
					for (int k = j; k <= m; ++k) b[j][k] = a[i][k];
					cnt ++;
					break;
				}
				else {
					for (int k = j; k <= m; ++k) a[i][k] ^= b[j][k];
				}
			}
	cout << 1ll * (ksm(2, n) - ksm(2, n - cnt) + mod) % mod * ksm(2, m - 1) % mod;
	return 0;
}

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

using namespace std;
typedef pair<int,int> pii;
typedef long long int lli;

const int MAXS = 12;
const int MAXD = 10;

int k;

lli dp[MAXS][MAXD];

lli rearrange(lli k)
{
	vector< int > s;

	while( k > 0 )
	{
		s.push_back( k%10 );
		k /= 10;
	}

	int acc = 0;

	for(int i = 0 ; i < s.size() - 1 ; i++)
	{
		s[i] += acc;
		acc = 0;

		if( abs( s[i] - s[i + 1] ) > 1 )
		{
			if( s[i] > s[i - 1] )
			{
				s[i] = s[i + 1];
				s[i + 1]++;

				if( s[i + 1] == 10 )
				{
					acc = 1;
					s[i] = 0;
					s[i + 1] = 0;
				}
			}
			else s[i] = s[i + 1] - 1;

			for(int j = i - 1 ; j >= 0 ; j--)
				s[j] = max( s[j + 1] - 1 , 0 );
		}
	}

	if( acc != 0 ) s.push_back( acc );

	lli ans = 0;

	for(int i = s.size() - 1 ; i >= 0 ; i--)
	{
		ans *= 10;
		ans += s[i];
	}

	return ans;
}

int main()
{
	scanf("%d",&k);

	k--;

	lli ans = 1;

	for(int i = 1 ; i <= k ; i++)
	{
		ans++;
		ans = rearrange( ans );
	}

	printf("%lld\n",ans);
}

Measured memory_bytes: 256
import math
from functools import reduce
from fractions import gcd

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

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
#! //Users/daigofujiwara/anaconda3/bin python3

#h行で列和がyかy+1であるかどうかとサンプルを出力

input1=input()

input2=input()

x,y=input1.split(" ")
N,M=int(x),int(y)

A=input2.split(" ")

A=[int(a) for a in A ]

B=[]
for a in A:
    B.append(a//2)


Mb=lcm_list(B)
gmp=None


T=1
for b in B:
    if not (Mb//b)%2==1:
        T=0
if T==1:
    gmp=Mb




if gmp is None:
    print(0)
else:
    print(int(math.floor(M/gmp+1.0)/2.0))




Measured memory_bytes: 17284
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
using namespace std;
int main() {
	int m,n;
	while(scanf("%d %d",&m,&n),m) {
		bool die[1000]={0};
		int idx=0,M=m;
		for(int i=1;i<=n;i++) {
			char s[10];
			scanf("%s",s);
			if(M==1) continue;
			if(i%15==0) {
				if(strcmp(s,"FizzBuzz")!=0) die[idx]=1,M--;
			}else if(i%3==0) {
				if(strcmp(s,"Fizz")!=0) die[idx]=1,M--;
			}else if(i%5==0) {
				if(strcmp(s,"Buzz")!=0) die[idx]=1,M--;
			}else {
				if(i!=atoi(s)) die[idx]=1,M--;
			}
			do {idx=(idx+1)%m;}while(die[idx]);
		}
		idx=0;
		while(die[idx]) idx++;
		printf("%d",idx+1);
		for(int i=idx+1;i<m;i++) {
			if(!die[i]) printf(" %d",i+1);
		}
		printf("\n");
	}
}

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

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
#define dump(val) cerr << __LINE__ << ":\t" << #val << " = " << val << endl

using namespace std;

typedef long long int lli;

int main() {
    int N, A, B;
    cin >> N >> A >> B;
    cout << min(N * A, B) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define MAX_N 1000001
#define MAX_M 100010
const long long mod=1e9+7;
#define vec vector<int>
#define vecll vector<ll>
#define vecllvec vector<vector<ll>>
#define vecb vector<bool>
#define vecBvec vector<vector<bool>>
#define vecst vector<string>
#define veche vector<char>
#define vecd vector<double>
#define vecvec vector<vector<int>>
#define vecDvec vector<vector<double>>
#define vecHvec vector<vector<char>>
#define all(x) (x).begin(),(x).end()
#define ent cout<<endl
#define printvec(vec) for(int aqw=0;aqw<vec.size();aqw++){cout<<vec[aqw]<<" ";}ent;
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define REP(i,m,n) for(int i=m;i<(int)n;++i)
#define INF 1e+9
#define P pair<int, int>;
#define YES "Yes"
#define NO "No"
#define MAX_V 1000
#define PI 3.141592653589793
// cout << setprecision(15) << std::fixed;

// テレンス「もしかしてACですかーッ!?」　ジョセフ「Yse! Yse! Yse! Oh~MyGod」

int main(){
  string s;
  cin>>s;
  stack<char> St;
  for(int i=0;i<s.size();i++){ 
    if(St.empty()||St.top()=='T'){
      St.push(s[i]);
    }
    else if(St.top()=='S'){
      if(s[i]=='T') St.pop();
      if(s[i]=='S') St.push(s[i]);
    }

  }
  cout<<St.size()<<endl;
}



Measured memory_bytes: 644
// 問題の URL を書いておく
// 

#include <algorithm>
#include <array>
#include <bitset>
#include <cmath>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>

using namespace std;

//#define ENABLE_PRINT

#if defined(ENABLE_PRINT)

#define Print(v) \
do {\
    cout << #v << ": " << v << endl; \
}while(0)

#define PrintVec(v) \
do {\
    for(int __i = 0; __i < v.size(); ++__i) \
    { \
        cout << #v << "[" << __i << "]: " << v[__i] << endl; \
    }\
}while(0)

#else

#define Print(v) ((void)0)
#define PrintVec(v) ((void)0)

#endif

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

using ll = int64_t;

int main(int, const char**)
{
    int n;
    cin >> n;
    ll ans = 0;
    ll prev = 0;
    rep(i, n)
    {
        ll t;
        cin >> t;
        if(t < prev)
        {
            ans += prev - t;
        }
        else
        {
            prev = t;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3592
while True:
  h,w = map(int,input().split())
  
  if h == 0 and w == 0:
    break

  loop = 1
  for i in range(h):
    if loop%2 == 1:
      print('#.'*(w//2) + (w%2 == 1)*'#')
  
    if loop%2 == 0:
      print('.#'*(w//2) + (w%2 == 1)*'.')
  
    loop += 1

  print('')


Measured memory_bytes: 5612
#include <bits/stdc++.h>
using namespace std;
 
int main()
{
  
  vector<int> math{1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  int K;
  cin >> K;
  cout << math.at(K-1) << endl;
}

Measured memory_bytes: 256
// abc112_d
#include <bits/stdc++.h>
#ifdef LOCAL
#include "../cxx-prettyprint/prettyprint.hpp"
#endif
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;

#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define REP_REV(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= m ; --(i))
#define ALL(x) x.begin(), x.end()

#define INF ((1 << 29)-1)
#define MOD (1000000007)

#define print2D(h, w, arr) REP(i, h) { REP(j, w) cout << arr[i][j] << " "; cout << endl; }
#define print_line(vec, n) {for(int i=0;i<(n-1);i++) cout << (vec)[i] << " "; cout << (vec)[(n)-1] << endl;}
template<class T> void print(const T& x){cout << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }
struct PreMain {PreMain(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}} premain;


vector<ll> get_divisors(ll n){
    vector<ll> res;
    for (int i = 1; i * i <= n; i++){
        if (i * i == n){
            res.emplace_back(i);
        }
        if (n % i == 0){
            res.emplace_back(i);
            res.emplace_back(n / i);
        }
    }
    sort(ALL(res));
    return res;
}


int main() {
#ifdef LOCAL
    ifstream in("../arg.txt"); cin.rdbuf(in.rdbuf());
#endif

    int N, M;
    cin >> N >> M;

    auto divs = get_divisors(M);
    reverse(ALL(divs));

    for (auto d: divs){

        int x = M / (int)d;

        if (x >= N){
            print(d);
            return 0;
        }
    }



    return 0;
}


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

int main() {
  int x,y;
  int ans=0;

  cin >> x >> y;

  if(x==1) {ans+=300000;}
  else if(x==2) {ans+=200000;}
  else if(x==3) {ans+=100000;}

  if(y==1) {ans+=300000;}
  else if(y==2) {ans+=200000;}
  else if(y==3) {ans+=100000;}

  if(x==1&&y==1) {ans+=400000;}

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
import java.util.*;
import java.io.*;
import java.lang.*;

class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    int n =0;
    char a,b;
    String S = scan.nextLine();
    String T = scan.nextLine();
    for(int i = 0; i<3;i++){
        a = S.charAt(i);
        b = T.charAt(i);
      if(a==b){
        n++;}
    }
    System.out.println(n);
  }
}

Measured memory_bytes: 21844
#include<bits/stdc++.h>
#define ll long long

using namespace std;



int main(){
    string S, T;
    cin >> S;
    cin >> T;
    int n=S.length();
    int count=0;
    for(int i=0;i<n;i++){
        if(T[i] != S[i])
        count++;
    }
    cout << count;
    
    

}

Measured memory_bytes: 3892
#include"bits/stdc++.h"
using namespace std;

void Main() {
  int X;
  cin >> X;
  if (X == 3 || X == 5 || X == 7) cout << "YES" << endl;
  else cout << "NO" << endl;
}

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

Measured memory_bytes: 256
import std.algorithm;
import std.array;
import std.container;
import std.conv;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

void scan(T...)(ref T a) {
    string[] ss = readln.split;
    foreach (i, t; T) a[i] = ss[i].to!t;
}
T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

long calc(int m, int[] a) {
    auto pq = new MaxHeap;
    foreach (e; a) pq.insert(e);

    foreach (_; 0..m) {
        int x = pq.front; pq.popFront();
        pq.insert(x / 2);
    }

    long sum = 0;
    while (pq.length > 0) {
        sum += pq.front;
        pq.popFront();
    }
    return sum;
}

void main() {
    int n, m; scan(n, m);
    auto a = readints;
    writeln(calc(m, a));
}

alias MaxHeap = BinaryHeap!(Array!int, "a < b");


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

int main(){
	int n; cin >> n;
    string s; cin >> s;
    int ok = 0;
    if(n%2 == 0){
        ok = 1;
        for(int i = n/2; i < n; i++)
            if(s[i-n/2] != s[i])
                ok = 0;
    }
    
    if(!ok) cout << "No" << endl;
    else cout << "Yes" << endl;
	return 0;
}


Measured memory_bytes: 256
def main():
  n,*t=map(int,open(0).read().split())
  (x,y),*t,(a,b)=sorted(zip(*[iter(t)]*2))
  r_min=[b]
  l_max=[a]
  for l,r in t[::-1]:
    r_min+=min(r_min[-1],r),
    l_max+=max(l_max[-1],l),
  m=max(0,y-x+1)+max(0,r_min.pop()-l_max.pop()+1)
  for l,r in t:
    i=r_min.pop()
    j=l_max.pop()
    v=min(y,r)
    w=max(x,l)
    m=max(m,max(0,i-j+1)+max(0,v-w+1),max(0,min(i,y)-max(j,x)+1)+max(0,r-l+1))
    y,x=v,w
  m=max(m,max(0,b-a+1)+max(0,y-x+1))
  print(m)
main()

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

int A[1000000],n;

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

int main(){
	int i, q, k, sum = 0;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&A[i]);
	}

	scanf("%d",&q);
	for(i=0;i<q;i++){
		scanf("%d",&k);
		if (bs(k)) sum++;
	}
	printf("%d\n",sum);

	return 0;
}



Measured memory_bytes: 3568
using System.Collections.Generic;
using System;

public class P
{
    public int x { get; set; }
    public int y { get; set; }
}
public class Hello
{
    public static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var h = int.Parse(line[0]);
        var w = int.Parse(line[1]);
        var a = int.Parse(line[2]);
        var d = new Dictionary<int, P>();
        for (int i = 0; i < h; i++)
        {
            line = Console.ReadLine().Trim().Split(' ');
            for (int j = 0; j < w; j++)
            {
                var ww = int.Parse(line[j]);
                d[ww] = new P { x = i + 1, y = j + 1 };
            }
        }
        var dd = new long[h * w + 1];
        for (int i = a+1; i <= h*w; i++)
            dd[i] = dd[i - a] + Math.Abs(d[i].x - d[i - a].x) + Math.Abs(d[i].y - d[i - a].y);
        var q = int.Parse(Console.ReadLine().Trim());
        for (int i = 0; i < q; i++)
        {
             line = Console.ReadLine().Trim().Split(' ');
            var L = int.Parse(line[0]);
            var r = int.Parse(line[1]);
            Console.WriteLine(dd[r] - dd[L]);
        }
    }
}

Measured memory_bytes: 28992
import sys

input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)


def dfs(G, v, p, point):
    """G: graph, v: vertex, p: parent"""
    # Loop for each child
    for c in G[v]:
        if c == p:
            continue
        point[c] += point[v]
        dfs(G, c, v, point)


def main():
    N, Q = map(int, input().split())
    G = [[] for _ in range(N)]
    for _ in range(N - 1):
        a, b = map(int, input().split())
        a -= 1
        b -= 1
        G[a].append(b)
        G[b].append(a)

    point = [0] * N
    for i in range(Q):
        p, x = map(int, input().split())
        p -= 1
        point[p] += x

    dfs(G, 0, -1, point)
    print(" ".join(map(str, point)))


if __name__ == "__main__":
    main()


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

using namespace std;

const int md = 1e9 + 7;

int h, w, a, b;
long long f[222222], inv[222222];

long long pw(long long x, int y){
	if (y == 1) return x;
	long long tmp = pw(x, y / 2);
	tmp = tmp * tmp % md;
	if (y % 2) tmp = tmp * x % md;
	return tmp;
}

long long c(int a, int b){
	return f[b] * inv[a] % md * inv[b - a] % md;
}

long long que(int m, int n){
	return c(m - 1, m + n - 2);
}

int main(){
//	freopen("input.inp", "r", stdin);
	scanf("%d%d%d%d",&h,&w,&a,&b);
	f[0] = inv[0] = 1;
	for(int i = 1; i <= 200000; ++i) f[i] = f[i - 1] * i % md, inv[i] = pw(f[i], md - 2);
	long long an = 0;
	for(int i = b + 1; i <= w; ++i){
		an += que(h - a, i) * que(a, w - i + 1) % md;
		an %= md;
	}
	printf("%lld",an);
	return 0;
}

Measured memory_bytes: 3328
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
const ll mod = 1000000007;
// const int max = 510000;

ll fact[510000],fact_inv[510000];

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

ll combo(ll n, ll r){
    return ( fact[n] * fact_inv[r] ) %mod * fact_inv[n-r] %mod;
}

int main(){
  ll N,M,K;cin>>N>>M>>K;
  ll i,j,k,l;
  fact[0]=1;
  repn(i,N*M){
    fact[i] = fact[i-1] * i %mod;
  }
  fact_inv[N*M] = power(fact[N*M] , mod-2);
  for(i=N*M-1;i>=0;i--){
    fact_inv[i] = fact_inv[i+1]*(i+1) %mod;
  }
  ll ans=0;
  repn(i,N){
    ans+=i*(N-i)*M*M;
    ans%=mod;
  }
  repn(i,M){
    ans+=i*(M-i)*N*N;
    ans%=mod;
  }
  // cout<<ans<<endl;
  ans*=combo(N*M-2,K-2);
  ans%=mod;
  cout<<ans<<endl;
}


Measured memory_bytes: 5888
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ld;
#define vec(s) vector

#define vvec(s) vector<vector
>
typedef vector<lli> vi;
typedef vector<vi> vvi;
typedef pair<lli,lli> pii;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define Yes(x) cout<<(x?"Yes":"No")<<endl;
#define YES(x) cout<<(x?"YES":"NO")<<endl;
#define out(s) cout<<s<<endl;
#define Reverse(x) reverse(all(x));
#define Sort(x) sort(all(x));
#define pb(s) push_back(s);
#define sp " " 
#define INF 10000000000
#define LINF 9000000000000000000
#define all(s) s.begin(),s.end()
void vout(vi v){
    for(lli i=0;i<v.size();i++)
    cout<<v.at(i)<<endl;
}
int main(){
    cout << std::fixed << std::setprecision(10);
    lli cnt = 0;
    lli n;
    cin >> n;
    vi l(n);
    rep(i, n) {
        cin >> l[i];
    }
    rep(i, n) {
        for (lli j = i + 1; j < n;j++)
        {
            for (lli k = j + 1; k < n;k++)
            {
                if ((l[i] + l[j] > l[k]) &&( l[i] + l[k] > l[j]) && (l[k] + l[j] > l[i])&&l[i]!=l[j]&&l[j]!=l[k]&&l[k]!=l[i])
                {
                    cnt++;
                }
            }
        }
    }
    out(cnt);
}

Measured memory_bytes: 3632
/*   Author : S7a2a7d   */
#include <bits/stdc++.h>

#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")


using namespace std;

#define fast_io ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define pb push_back
#define ll long long
#define rep(i,n)  for(ll i=0;i<n;i++)
#define repi(i,n)  for(ll i=1;i<=n;i++)
#define mem(arr,x) memset(arr,x,sizeof(arr))

typedef vector<ll> vi;
typedef vector<char> vc;
     
#define mp make_pair
#define ff first
#define ss second
     
const double PI = 3.1415926535897932;
const int mod = 1e9 + 7;  
const int inf = 1e9 + 5;

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

int main()
{
  fast_io;
  int T=1;
  //cin>>T;
  while(T--)
  {
    string s;
    cin>>s;
    if(s[(int)s.length()-1]=='s')
    {
      cout<<s<<"es";}
      else
      {
        cout<<s<<'s';

      }

     
  }
    
}

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

int ice[91][91];//????°?
int max_ice = 0;//?????§?????°

int search(int x, int y, int cnt){//x??§?¨?,y??§?¨?,?????°count
	int dx[4] = { 0, 1, 0, -1 }, dy[4] = { 1, 0, -1, 0 };//??????????§????
	ice[x][y] = 0;//??????
	for (int i = 0; i < 4; i++){
		if (ice[x + dx[i]][y + dy[i]] == 1){//????°??????????
			search(x + dx[i], y + dy[i], cnt + 1);//?¬????????°?????§????
		}
	}
	ice[x][y] = 1;//?????£???????????´???
	if (max_ice < cnt){
		max_ice = cnt;//?????§?????°??´??°
	}
	return 0;
}

int main(){
	int m, n;
	while (cin >> m >> n, m, n){
		max_ice = 0;
		for (int i = 0; i < n; i++){
			for (int j = 0; j < m; j++){
				ice[i][j] = 0;
			}
		}
		for (int i = 0; i < n; i++){
			for (int j = 0; j < m; j++){
				cin >> ice[i][j];//????°?????????????
			}
		}
		for (int i = 0; i < n; i++){
			for (int j = 0; j < m; j++){
				if (ice[i][j] == 1){//???????????????????????¢?´¢??????
					search(i, j, 1);
				}
			}
		}
		cout << max_ice << endl;//?????§?????°??????
	}
	return 0;
}

Measured memory_bytes: 3104
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;


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

	int n, m, i, j, k, x;
	cin >> n >> m >> k;
	bool found = false;

	for (i = 0; i <= n; i++) {
		for (j = 0; j <= m; j++) {
			x = i * (m - j) + j * (n - i);
			if (x == k) found = true;
		}
	}
	if (found) cout << "Yes\n";
	else cout << "No\n";

	return 0;
}


Measured memory_bytes: 384
# coding: utf-8
from math import log2
n=int(input())
a=list(map(int,input().split()))
ans=0
while True:
    for i in range(len(a)):
        if a[i]%2==0:
            a[i]//=2
        else:
            print(ans)
            exit()
    ans+=1


Measured memory_bytes: 3060
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>

typedef struct label
{
    int top;    //1
    int front;  //2
    int right;  //3
    int left;   //4
    int back;   //5
    int bottom; //6
} Dice;

void diceroll(Dice *d, const char dir)
{
    int tmp;
    switch (dir)
    {
    case 'E':
    {
        tmp = d->top;
        d->top = d->left;
        d->left = d->bottom;
        d->bottom = d->right;
        d->right = tmp;
        break;
    }
    case 'N':
    {
        tmp = d->top;
        d->top = d->front;
        d->front = d->bottom;
        d->bottom = d->back;
        d->back = tmp;
        break;
    }
    case 'S':
    {
        tmp = d->top;
        d->top = d->back;
        d->back = d->bottom;
        d->bottom = d->front;
        d->front = tmp;
        break;
    }
    case 'W':
    {
        tmp = d->top;
        d->top = d->right;
        d->right = d->bottom;
        d->bottom = d->left;
        d->left = tmp;
        break;
    }
    }
}

void place_front(Dice *d, int q2)
{
    char direction[] = "NENEN";
    int i = 0;
    while (d->top != q2)
    {
        diceroll(d, direction[i]);
        i++;
        if (i == 5)
        {
            break;
        }
    }
    diceroll(d, 'S');
}

void place_top(Dice *d, int q1)
{
    int i = 0;
    while (d->top != q1)
    {
        diceroll(d, 'W');
        i++;
        if (i == 3)
        {
            break;
        }
    }
}

bool is_same_dice(Dice *d1, Dice *d2)
{
    place_front(d2, d1->front);
    if (d1->front != d2->front) //サイコロが1周しても違う数字ならfalse
    {
        return false;
    }
    place_top(d2, d1->top);
    if (d1->top != d2->top)
    {
        return false;
    }
    if (d1->right == d2->right && d1->left == d2->left && d1->back == d2->back && d1->bottom == d2->bottom)
    {
        return true;
    }
    return false;
}

bool loop(Dice d[100], int count)
{
    int i, j;
    for (i = 0; i < count; i++)
    {
        for (j = 1; j < count - i; j++)
        {
            if (is_same_dice(&d[i], &d[i + j])) //d[i]とd[i]より添え字が大きい全てのdを比較
            {
                return false;
            }
        }
    }
    return true;
}

int main(void)
{
    Dice d[100];
    int count, i;
    scanf("%d", &count);
    for (i = 0; i < count; i++)
    {
        scanf("%d %d %d %d %d %d", &d[i].top, &d[i].front, &d[i].right, &d[i].left, &d[i].back, &d[i].bottom);
    }
    if (loop(d, count))
    {
        puts("Yes");
    }
    else
    {
        puts("No");
    }

    return 0;
}



Measured memory_bytes: 2080
#include <stdio.h>
#include <iostream>
#include <vector>
#include <list>
#include <cmath>
#include <fstream>
#include <algorithm>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <complex>
#include <iterator>
#include <cstdlib>
#include <cstring>
#include <sstream>

using namespace std;

#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) (EQ((a).real(),(b).real()) && EQ((a).imag(),(b).imag()))

typedef complex<double> P;
typedef long long ll;

const int MAX_SIZE = 10000;

// OÏ
double cross(P a, P b) {
  return (a.real() * b.imag() - a.imag() * b.real());
}
// a1,a2ð[_Æ·éüªÆb1,b2ð[_Æ·éüªÌð·»è
int is_intersected_ls(P a1, P a2, P b1, P b2) {
    // üªª½sÈêÍdÈÁÄ¢È¢±ÆÉ·é
    if(abs(cross(a2-a1,b2-b1)) < EPS){
        return 0;
    }
    return ( cross(a2-a1, b1-a1) * cross(a2-a1, b2-a1) < EPS ) &&
        ( cross(b2-b1, a1-b1) * cross(b2-b1, a2-b1) < EPS );
}
// a1,a2ð[_Æ·éüªÆb1,b2ð[_Æ·éüªÌð_vZ
P intersection_ls(P a1, P a2, P b1, P b2) {
  P b = b2-b1;
  double d1 = abs(cross(b, a1-b1));
  double d2 = abs(cross(b, a2-b1));
  double t = d1 / (d1 + d2);

  return a1 + (a2-a1) * t;
}

struct edgeInfo{
    P a;
    P b;
    int o;
    int l;
};

P p1,p2;

class Point{
public:
    P p;
    int l;
    int o;
    int t;

    bool operator<(const Point &pp)const{
        double dist1=abs(p1-pp.p);
        double dist2=abs(p1-this->p);
        return dist2<dist1;
    }
};

int main(){
    int data;
    cin>>data;
    while(data--){
        int x,y;
        cin>>x>>y;
        p1=P(x,y);
        cin>>x>>y;
        p2=P(x,y);
        int n;
        cin>>n;
        vector<edgeInfo> edges;
        for(int i = 0; i < n; i++){
            int xs,ys,xt,yt,o,l;
            cin>>xs>>ys>>xt>>yt>>o>>l;
            edgeInfo e;
            e.a=P(xs,ys);
            e.b=P(xt,yt);
            e.l=l;
            e.o=o;
            edges.push_back(e);
        }
        vector<Point> crossPoint;
        // ð_ðßé
        for(int i = 0;i < n; i++){
            if(is_intersected_ls(edges[i].a,edges[i].b,p1,p2)){
                P res=intersection_ls(edges[i].a,edges[i].b,p1,p2);
                Point pp;
                pp.l=edges[i].l;
                pp.o=edges[i].o;
                pp.p=res;
                pp.t=pp.l^pp.o;
                crossPoint.push_back(pp);
            }
        }
        // ð_ðp1Éß¢ÔÉ\[g
        sort(crossPoint.begin(),crossPoint.end());

        if(crossPoint.size()==0){
            cout<<0<<endl;
            continue;
        }

        // »ÝÌ©ªÌHüîñ(1:nã,0:nº)
        int sit=0;
        sit=crossPoint[0].t;
        // ð_ðp1Éß¢ÔÉ
        int cnt=0;
        for(int i = 1; i < crossPoint.size(); i++){
            if(crossPoint[i].t!=sit){
                sit=crossPoint[i].t;
                cnt++;
            }
        }
        cout<<cnt<<endl;
    }
}

Measured memory_bytes: 952