akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std::literals::string_literals;
using i64 = long long;
using std::cout;
using std::endl;
using std::cin;

template<typename T>
std::vector<T> make_v(size_t a){return std::vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return std::vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

const int MOD = 1e9 + 7;

int main() {
	int n, k; scanf("%d%d", &n, &k); std::vector<int> a(n);
	for(int i = 0; i < n; i++) scanf("%d", &a[i]);
	sort(begin(a), end(a));
	
	int K = 0;
	auto dp = make_v<i64>(n + 1, k + 2); dp[0][0] = 1;
	for(int i = 0; i < n; i++) {
		for(int j = 0; j <= K; j++) {
			int L = j, R = std::min(k + 1, j + a[i] + 1);
			
			(dp[i + 1][L] += dp[i][j] % MOD) %= MOD;
			(dp[i + 1][R] += MOD - dp[i][j] % MOD) %= MOD;
		}
		K = std::min(k, K + a[i]);
		
		for(int j = 0; j <= K; j++) (dp[i + 1][j + 1] += dp[i + 1][j] %= MOD) % MOD;
	}
	
	printf("%lld\n", dp[n][k] % MOD);
	return 0;
}


Measured memory_bytes: 80256
#include<bits/stdc++.h>
#define int long long

using namespace std;

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

    int a, b;
    cin >> a >> b;
    if ((a + b) % 2)
        cout << "IMPOSSIBLE\n";
    else
        cout << (a + b) / 2 << '\n';

    return 0;
}


Measured memory_bytes: 256
#include <iostream>

int main() {
	int x, y;
	
	while(1) {
		std::cin >> x >> y;
		if(x==0 && y==0) break;
		if(x>y){
			std::cout << y << " " << x << std::endl;
		} else {
			std::cout << x << " " << y << std::endl;
		}
	}
}

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

using namespace std;

#define int long long
#define pb push_back
#define FOR(i, a, b) for(int i=(a);i<(b);i++)
#define REP(i, n) FOR(i, 0, n)


signed main () {
  cin.tie(0);
  cout << setprecision(10);

  int n, k; cin >> n >> k;

  map<int, int> a;
  REP(i, n) {
    a[(i+1)%k]++;
  }

  //REP(i, k) cout << a[i] << endl;

  int ans = 0;
  REP(i, k) {
    if((i * 2) % k == 0) ans += a[i] * a[i] * a[i];
  }

  cout << ans << endl;
}


Measured memory_bytes: 6528
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define sz(x) (int)(x.size())
#define fi first
#define se second
#define pii pair<int, int>

const int N = 3010;
int dp[N][N] = {0};
signed main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    string s, t;
    cin >> s >> t;
    s = " " + s, t = " " + t;
    int n = sz(s), m = sz(t);
    for (int i = 1; i < n; i++) {
        for (int j = 1; j < m; j++) {
            if (s[i] == t[j]) {
                dp[i][j] = dp[i - 1][j - 1] + 1;
            } else {
                dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]);
            }
        }
    }
    string ans = "";
    for(int i = n - 1, j = m - 1; i > 0 && j > 0;) {
        if(s[i] == t[j]) {
            ans += s[i];
            i--, j--;
        } else if(dp[i - 1][j] > dp[i][j - 1]) {
            i--;
        } else {
            j--;
        }
    }
    reverse(ans.begin(), ans.end());
    cout << ans << "\n";
}

Measured memory_bytes: 70784
#include <iostream>
using namespace std;
int main(void){
    int a,b,c;
    cin >> a >> b >> c;
    int d=0;
    for(int x=a;x<=b;x++){
        if(c%x==0){
            d++;
        }
        else{
            continue;
        }
    }
    cout << d << endl;
}



Measured memory_bytes: 3096
#include<iostream>


using namespace std;
typedef long long ll;


int main(){
    ll n, k;
    cin >> n >> k;
    if(n==k)
    {
        cout << 0 << endl;
        return 0;
    }
    if(n>k)
    {
        n = n % k;
    }
    if(n>k-n)
    {
        cout << k - n << endl;
    }
    else
    {
        cout << n << endl;
    }
    return 0;
    
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <utility>
#include <tuple>
#include <algorithm>
#include <numeric>
#include <cstdio>
#include <cstring>
#include <cmath>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  ll k;
  cin >> n >> k;
  vector<ll> a(n), f(n);
  rep(i, n) cin >> a[i];
  rep(i, n) cin >> f[i];
  sort(a.begin(), a.end());
  sort(f.rbegin(), f.rend());
  ll l = 0, r = 1e12;
  while (r-l >= 1) {
    ll mid = (l+r)/2, cnt = 0;
    rep(i, n) {
      if (a[i]*f[i] > mid)
        cnt += ceil(a[i]-mid/(double)f[i]);
    }
    if (cnt <= k)
      r = mid;
    else
      l = mid+1;
  }
  cout << l << endl;
  return 0;
}

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

vector<int> vec[100006];
int dp[100006];


int rec(int src)
{
	if(dp[src]!=  -1) return dp[src];
	
	bool leaf = true;
	int bestchild = 0;
	
	for( auto x:vec[src])
	{
		leaf = false;
		bestchild = max(bestchild,rec(x));
	}
	
	return dp[src] = leaf?0:bestchild+1;
}

void solve()
{
	int v,e;
	cin>>v>>e;
	for(int i = 0;i<e;i++)
	{
		int src,dest;
		cin>>src>>dest;
		vec[src].push_back(dest);
	}
	memset(dp,-1,sizeof(dp));
	int ans = 0;
	for(int i  = 1;i<=v;i++)
	{
		ans = max(ans,rec(i));
	}
	cout<<ans;
	
	
	
	
}



int main()
{
	solve();
}






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

using namespace std;

#define sp(x) cout<<setprecision(x);
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define all(a) (a).begin(), (a).end()
#define inf 10000000
#define linf INT64_MAX*0.99
#define print(s) cout<<(s)<<endl
#define lint long long
#define yes "Yes"
#define no "No"

typedef pair<int, int> P;
 
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n; cin>>n;
    vector<int> d(n);
    REP(i,n) cin>>d[i];
    sort(all(d));
    int ans= d[n/2]-d[n/2-1];
    print(ans);
    return 0;
}

Measured memory_bytes: 640
//include,namespace
 #include<bits/stdc++.h>
 #include<iostream> 
 #include <queue>
 #include <vector>
 #include <string>
 using namespace std;
//REPmacro
 #define all(x) (x).begin(),(x).end()             //ソート
 #define FOR(i,x,n)for(int i=(x);i<(n);i++)
 #define FOR_R(i,x,n) for(int i=(n-1);i>=(x);i--)
 #define REP(i, n) FOR(i, 0, n)
 #define REP_R(i, n) FOR_R(i, 0, n)
//long long(define)
 using ll = long long;
 typedef long long ll;
 typedef long long int64;
 typedef long long lint;
 typedef long long lli;
////////////////いろいろあるよ//////////////////////////////////
int main(){
    string a;
  	cin >> a;
  	REP(i,(a.size()/2)){if(a[i]!=a[a.size()-i-1]){cout << "No" <<  endl;return 0;}}

  
  	string b = a;
  	b = b.erase((a.size()-1)/2);
    REP(i,(b.size()/2)){if(b[i]!=b[b.size()-i-1]){cout << "No" << endl;return 0;}}

  
  	string c = a;
  	c = c.erase(0,(a.size())+1/2);
    REP(i,(c.size()/2)){if(c[i]!=c[c.size()-i-1]){cout << "No" << endl;return 0;}}
  	
  	cout << "Yes" << endl;
}


Measured memory_bytes: 256
n,m = map(int,input().split())
stair = [0,1] + [0 for i in range(n)]
ba = 2
for i in range(m):
	a = int(input()) + 1
	for j in range(ba,a):
		stair[j] = stair[j - 1] + stair[j - 2]
	ba = a + 1
for i in range(ba,n + 2):
	stair[i] = stair[i - 1] + stair[i - 2]
print(stair[n + 1] % 1000000007)

Measured memory_bytes: 460040
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"
#define EPS 1e-10
using namespace std;
typedef long long llong;
int main() {
	int b, r, g, c, s, t;
	while (cin >> b >> r >> g >> c >> s >> t, t) {
		int coin = 100;
		int n = t - b * 5 - r * 3 - s;

		coin += 13 * (b * 5 + r * 3);

		coin += 15 * (b + r) + 7 * g + 2 * c;

		coin -= 3 * n;

		cout << coin << endl;

	}
	return 0;
}

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

int N;
int t[20][20];
int t0[20];

int dp[1<<17];
void solve(){
    for(int i=0;i<N;i++){
        scanf("%d",&t0[i]);
        for(int j=0;j<N;j++)scanf("%d",&t[i][j]);
    }

    fill_n(dp,1<<N,1e9);

    dp[0]=0;

    for(int i=0;i<(1<<N);i++){
        for(int j=0;j<N;j++){
            if((i>>j)&1)continue;
            int mi=t0[j];
            for(int k=0;k<N;k++){
                if((i>>k)&1)mi=min(mi,t[j][k]);
            }
            dp[i|(1<<j)]=min(dp[i|(1<<j)],dp[i]+mi);
        }
    }


    printf("%d\n",dp[(1<<N)-1]);
}

int main(){
    while(scanf("%d",&N),N)solve();
    return 0;
}

Measured memory_bytes: 1448
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rng(i, a, b) for (int i = int(a); i < int(b); i++)
#define rep(i, b) rng(i, 0, b)
#define gnr(i, a, b) for (int i = int(b) - 1; i >= int(a); i--)
#define per(i, b) gnr(i, 0, b)
#define bg begin()
#define ed end()
#define all(x) x.bg, x.ed
#define vi vector<int>
template <class t, class u>
bool chmax(t &a, u b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}
template <class t, class u>
bool chmin(t &a, u b)
{
    if (b < a)
    {
        a = b;
        return true;
    }
    return false;
}

signed main()
{
    int n;
    cin>>n;
    vector<int> mins(26,1000);
    rep(i,n){
        string s;
        cin >> s;
        vector<int> ss(26);
        rep(j, s.size())
        {
            ss[s[j] - 'a']++;
        }
        rep(j,26){
            chmin(mins[j], ss[j]);
        }
    }
    string alphabet = "abcdefghijklmnopqrstuvwxyz";
    rep(i, 26)
    {
        rep(j,mins[i]){
            cout << alphabet.substr(i, 1);
        }
    }
    cout << endl;
    return 0;
}

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

int main(){
    int n;
    char a[101];
    cin>>n;
    
    int r = 0;
    for(int i = 0;i<n;i++){
        cin >> a[i];
        if(a[i]=='Y') r++;
    }
    if(r>0) cout << "Four" << endl;
    else cout << "Three" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include <stdio.h>
#include <string>
#include <string.h>
#include <algorithm>
#include <functional>
#include <vector>

using namespace std;
int main()
{
	int Ans = 0;
	char a[5];

	cin >> a;

	for (int i = 0; i < 4; i++) {
		if (a[i] == '+') {
			Ans++;
		}
		else { Ans--; }
	}

	cout << Ans;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template<class Abel> struct UnionFind {
    vector<int> par;
    vector<int> rank;
    vector<Abel> diff_weight;

    UnionFind(int n = 1, Abel SUM_UNITY = 0) {
        init(n, SUM_UNITY);
    }

    void init(int n = 1, Abel SUM_UNITY = 0) {
        par.resize(n); rank.resize(n); diff_weight.resize(n);
        for (int i = 0; i < n; ++i) par[i] = i, rank[i] = 0, diff_weight[i] = SUM_UNITY;
    }

    int root(int x) {
        if (par[x] == x) {
            return x;
        }
        else {
            int r = root(par[x]);
            diff_weight[x] += diff_weight[par[x]];
            return par[x] = r;
        }
    }

    Abel weight(int x) {
        root(x);
        return diff_weight[x];
    }

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

    bool merge(int x, int y, Abel w) {
        w += weight(x); w -= weight(y);
        x = root(x); y = root(y);
        if (x == y) return false;
        if (rank[x] < rank[y]) swap(x, y), w = -w;
        if (rank[x] == rank[y]) ++rank[x];
        par[y] = x;
        diff_weight[y] = w;
        return true;
    }

    Abel diff(int x, int y) {
        return weight(y) - weight(x);
    }
};
int main(){
    int N,M;
    cin >> N >> M;
    
    UnionFind<int> uf(N);
    
    for(int i = 0; i < M; ++i){
        int l,r,d;
        cin >> l >> r >> d;
        --l; --r;
        
        if(uf.same(l,r)){
            int diff = uf.diff(l,r);
            if(diff != d){
                cout << "No" << endl;
                return 0;
            }
        }else{
            uf.merge(l,r,d);
        }
    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 1408
import heapq

K = int(input())

edge = [[] for i in range(K)]  # (node, cost) list list

for i in range(1, K):
    edge[i].append(( (i+1)%K, 1) )
    edge[i].append( ((i*10)%K, 0) )

# fro から to への最短距離(v は頂点数)
def dijkstra(fro, to, v):
    MAX = int(1e9)

    dist = [MAX]*v   # fro からの距離を格納する
    check = [False]*v  # すでにその頂点からを調べたかのフラグ

    dist[fro] = 0
    pq = [(0, fro)]    # (-cost, node)


    # 頂点は v 個あるので、v 周する
    for i in range(v):
        # 調べ済みでない頂点のうち、最も近い頂点を now に入れる
        nowNode = -1        # このターンにフォーカスするノード

        while True:
            nowNode = heapq.heappop(pq)[1]  # 最小コストから貪欲に取っていく
            if not check[nowNode]:    # まだチェックされていないノードだったら決定
                check[nowNode] = True
                break

        # その頂点からたどり着ける頂点の情報を更新する
        for (nextNode, cost) in edge[nowNode]:
            nextDist = dist[nowNode] + cost
            if nextDist < dist[nextNode]:  # 既存の通路より近いなら更新
                dist[nextNode] = nextDist
                heapq.heappush(pq, (dist[nextNode], nextNode))

    return dist[to]

print(dijkstra(1, 0, K) + 1)


Measured memory_bytes: 81968
import java.util.*;
  public class Main {
  
    public static void main(String[] args) { 
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        Map<Integer, List<Integer>> graph = new HashMap<>();
        for(int i = 0; i < m; i++) {
          int u = sc.nextInt();
          int v = sc.nextInt();
          if(!graph.containsKey(u))
            graph.put(u, new ArrayList<>());
          graph.get(u).add(v);
          if(!graph.containsKey(v))
            graph.put(v, new ArrayList<>());
          graph.get(v).add(u);
        }
        Map<Integer, Integer> memo = new HashMap<>(); 
        Queue<Integer> queue = new LinkedList<>();
        queue.offer(1);
        Set<Integer> visited = new HashSet<>();
        visited.add(1);
        while(!queue.isEmpty()) {
          int node = queue.poll();
          List<Integer> children = graph.get(node);
          for(int child : children) {
            if(visited.contains(child)) continue;
            visited.add(child);
            memo.put(child, node);
            queue.offer(child);
          }
        }
        if(memo.size() != n - 1)
          System.out.println("No");
        else {
          System.out.println("Yes");
          for(int i = 2; i <= n; i++)
            System.out.println(memo.get(i));
        }
    }
  }  

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

#define rep(i, j) for (int i = 0; i < j; i++)
#define all(obj) (obj).begin(), (obj).end()
#define rall(obj) (obj).rbegin(), (obj).rend()
typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;

int main() {

    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(10);
    cout << fixed;

    ll t1, t2, a1, a2, b1, b2;
    cin >> t1 >> t2 >> a1 >> a2 >> b1 >> b2;

    if ((a1 * t1 + a2 * t2) == (b1 * t1 + b2 * t2)) {
        cout << "infinity" << endl;
        return 0;
    }

    ll d = 0, d1 = 0, d2 = 0, t = 0;
    d1 = a1 * t1 + a2 * t2;
    d2 = b1 * t1 + b2 * t2;
    if (d1 < d2) {
        swap(a1, b1);
        swap(a2, b2);
        swap(d1, d2);
    }

    d = d1 - d2;
    if (a1 > b1) {
        cout << 0 << endl;
    } else {
        ll z = (b1 - a1) * t1;
        cout << 1 + z / d * 2  - (z % d == 0 ? 1 : 0) << endl;
        // cout << 1 + z / d * 2  << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

const int M = 1000000007;

int main()
{
  int h, w; cin >> h >> w;
  char a[1010][1010];
  for(int i = 1; i <= w; ++i) a[0][i] = '.';
  for(int i = 1; i <= h; ++i) a[i][0] = '.';
  for(int i = 1; i <= h; ++i) for(int j = 1; j <= w; ++j) cin >> a[i][j];
  
  int dp[1010][1010] = {};
  dp[0][1] = 1;
  for(int i = 1; i <= h; ++i) for(int j = 1; j <= w; ++j) {
    if(a[i-1][j]=='.') dp[i][j] = dp[i-1][j];
    if(a[i][j-1]=='.') dp[i][j] = (dp[i][j] + dp[i][j-1]) % M;
  }
  
  cout << dp[h][w] << endl;
  return 0;
}

Measured memory_bytes: 5248
import math
N = int(input())


def trial_division(n):
    # 2から√n以下の数字で割っていく
    tmp = int(math.sqrt(n)) + 1
    for num in range(2, tmp):
        while n % num == 0:
            n //= num
            primes[num] += 1
    # リストが空ならそれは素数
    if n != 1:
        primes[n] += 1
        return


primes = [0 for _ in range(N+1)]
for i in range(2, N+1):
    trial_division(i)

P74, P24, P14, P4, P2 = 0, 0, 0, 0, 0
for i in range(2, N+1):
    if primes[i] >= 74:
        P74 += 1
    if primes[i] >= 24:
        P24 += 1
    if primes[i] >= 14:
        P14 += 1
    if primes[i] >= 4:
        P4 += 1
    if primes[i] >= 2:
        P2 += 1

ans = 0
ans += P4*(P4-1)//2*(P2-2)
ans += P14*(P4-1)
ans += P24*(P2-1)
ans += P74
print(ans)


Measured memory_bytes: 38384
import numpy as np
n,m=map(int,input().split())
A=list(map(int,input().split()))
A.sort()
A=list(set(A))
AA=np.array(A)
cnt=0
 
from fractions import gcd
 
def lcm(a,b):
  return a*b//gcd(a,b)
 
while sum(AA%2)==0:
    cnt+=1
    AA//=2
if np.sum(AA%2)!=len(AA):
    ans=0
else:
  A=np.array(A)//2
  maxbai=A[-1]
  for i in range(len(A)):
    maxbai=lcm(A[-i-1],maxbai)
  x=m//maxbai
  ans=x//2+(x%2)
print(ans)


Measured memory_bytes: 23220
#include <bits/stdc++.h>
using namespace std;
struct Fast {
    Fast() {
        std::cin.tie(0);
        ios::sync_with_stdio(false);
        cout.precision(20);
    }
} fast;

/* define */
#define FOR(I, X, Y) for(long long(I) = (X); (I) < (Y); (I)++)
#define REP(I, X, Y) for(long long(I) = (Y)-1; (I) >= (X); (I)--)
#define ALL(X) (X).begin(), (X).end()
#define pb push_back
#define COUNT(V, X)                                                            \
    (upper_bound((V).begin(), (V).end(), X) -                                  \
     lower_bound((V).begin(), (V).end(), X))
#define debug(x) cerr << #x << ':' << x << endl;
#define DEBUG(v)                                                               \
    {                                                                          \
        cerr << #v << ':';                                                     \
        for(auto xv : v) cerr << xv << ' ';                                    \
        cerr << endl;                                                          \
    }
#define Yes(X) cout << (X ? "Yes" : "No") << endl;
#define YES(X) cout << (X ? "YES" : "NO") << endl;
#define ctoi(C) (C - '0')
#define pow2(x) ((long long)((long long)1 << x))

/* alias */
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vii = vector<vector<int>>;
using vl = vector<long long>;
using vll = vector<vector<long long>>;
using pi = pair<int, int>;
using pl = pair<long long, long long>;
template <typename T> using PQ = priority_queue<T>;
template <typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

/* const */
const long long dx[] = {1, 0, -1, 0};
const long long dy[] = {0, 1, 0, -1};
const long long dx8[] = {1, 1, 0, -1, -1, -1, 0, 1};
const long long dy8[] = {0, 1, 1, 1, 0, -1, -1, -1};
const long long dx9[] = {1, 1, 0, -1, -1, -1, 0, 1, 0};
const long long dy9[] = {0, 1, 1, 1, 0, -1, -1, -1, 0};
const int INF = 1000000007;
const long long LINF = 1000000000000000007;

/* func */
template <typename T> inline bool chmin(T &a, const T &b) {
    if(a > b) a = b;
    return a > b;
}
template <typename T> inline bool chmax(T &a, const T &b) {
    if(a < b) a = b;
    return a < b;
}
long long max(long long x, int y) {
    return max(x, (long long)y);
}
long long max(int x, long long y) {
    return max((long long)x, y);
}
long long min(long long x, int y) {
    return min(x, (long long)y);
}
long long min(int x, long long y) {
    return min((long long)x, y);
}

/* liblary */

/* main */

void solve(ll T, ll D, ll L) {
    ll x;
    ll last = 0;
    bool wet[T + D + 201900] = {0};
    FOR(i, 0, T) {
        cin >> x;
        if(L <= x) {
            FOR(j, 0, D) {
                wet[i + j] = true;
                if(i + j < last) j = last - i;
                last = i + j;
            }
        }
    }
    ll ans = 0;
    FOR(i, 0, T - 1) ans += wet[i];
    cout << ans << endl;
}

signed main() {
    ll T, D, L;
    while(true) {
        cin >> T >> D >> L;
        if(!T && !D && !L) return 0;
        solve(T, D, L);
    }
}


Measured memory_bytes: 3444
#インポート
import sys

#入力用
def ILI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def ISI(): return map(int, sys.stdin.readline().rstrip().split())
def II(): return int(sys.stdin.readline().rstrip())
def ISS(): return sys.stdin.readline().rstrip().split()
def IS(): return sys.stdin.readline().rstrip()

N = II()
i = 1
while i**2 <= N:
    i += 1
print((i-1)**2)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
//#include <atcoder/all>
#define ll long long int
#define MOD 1000000007
#define P pair<ll,ll>
#define INF 1000000000000000000

//using namespace atcoder;
using namespace std;

int main(void){
  ll n, a;
  cin >> n >> a;
  
  vector<ll> x(n);
  for (int i = 0; i < n; i++){
    cin >> x[i];
  }
  vector<vector<vector<ll>>> dp(n + 1, vector<vector<ll>>(n + 1, vector<ll>(2501, 0)));
  for (ll i = 0; i < n + 1; i++){
    dp[i][0][0] = 1;
  }

  for (ll i = 1; i < n + 1; i++){
    for (ll j = 1; j < n + 1; j++){
      for (ll k = 0; k < 2501; k++){
        if (k - x[i-1] >= 0)
          dp[i][j][k] = dp[i-1][j][k] + dp[i-1][j-1][k-x[i-1]];
        else
          dp[i][j][k] = dp[i-1][j][k];
      }
    }
  }
  ll ans = 0;
  for (ll i = 1; i < n + 1; i++){
    ans += dp[n][i][a*i];
  }
  cout << ans << endl;

  return 0;
}


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

#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep1(i, n) for (ll i = 1; i <= (ll)(n); i++)
#define INF 10000000000
#define MOD 1000000007
using ll = long long;
using Graph = vector<vector<int>>;

int main()
{
    int N, M;
    cin >> N >> M;
    string S;
    cin >> S;
    
    vector<int> next(N + 1, -1);
    for (int i = N; i >= 0; i--)
    {
        if (S[i] == '0')
            next[i] = i;
        else
            next[i] = next[i + 1];
    }

    vector<int> res;

    int s = N;
    while(s){
        int ns = next[max(0,s-M)];
        if(ns==s){
            cout<<-1<<endl;
            return 0;
        }
        res.push_back(s-ns);
        s = ns;
    }
    reverse(res.begin(), res.end());

    rep(i, res.size())
    {
        cout << res.at(i);
        if (i != res.size() - 1)
            cout << " ";
        else
            cout << endl;
    }
    return 0;
}


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



int main() {
    int n, m;
    cin >> n >> m;
    
    priority_queue<ll> a;
    rep(i,n) {
        ll x;
        cin >> x;
        
        a.push(x);
    }
    
    rep(i,m) {
        ll x = a.top();
        a.pop();
        
        a.push(x / 2);
    }
    
    ll ans = 0;
    rep(i,n) {
        ans += a.top();
        a.pop();
    }
    
    cout << ans << endl;
    
    
    
    return 0;
}


Measured memory_bytes: 4312
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;

namespace Main
{
    class Program
    {
        static void Main(string[] args)
        {
            //ここから
            //int n=Readint();
            //string[] str = Console.ReadLine().Split(' ');

            string[] str = Console.ReadLine().Split(' ');
            int n = int.Parse(str[0]);
            int k = int.Parse(str[1]);

            str = Console.ReadLine().Split(' ');
            var p = new int[n];
            for(int i = 0; i < n; i++)
            {
                p[i] = int.Parse(str[i]);
            }

            p=p.OrderBy(s => s).ToArray();

            int sum = 0;
            for(int i = 0; i < k; i++)
            {
                sum += p[i];
            }

            Cout(sum);
            //ここまで
        }

        static void Cout(string s)
        {
            Console.WriteLine(s);
            return;
        }

        static void Cout(int n)
        {
            Console.WriteLine(n);
            return;
        }

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

        static long Readlong()
        {
            return long.Parse(Console.ReadLine());
        }

        static int Min(int a, int b)
        {
            if (a < b) return a;
            return b;
        }

        static int Max(int a, int b)
        {
            if (a > b) return a;
            return b;
        }


    }

}


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

using namespace std;
#define ll long long int
int const mod=1000000007;
//vector<ll>v1[100001];
//vector<ll>v2(100001,0);
//vector<ll>h(100001,0);

int main()
{
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    ll ans=max(a*c,a*d);
    ans=max(ans,max(b*c,b*d));
    cout<<ans;
}


Measured memory_bytes: 3632
#include "bits/stdc++.h"
#define FI first.first
#define SE first.second
#define TH second
#define fi first
#define se second
#define th second

using namespace std;

void debug_out() { cerr << endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
 
#ifdef DEBUG
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

class DebugStream {}LOG;
template <typename T>DebugStream &operator<<(DebugStream &s, const T&) { return s; }
#ifdef DEBUG
#define LOG clog
#endif

typedef long long ll;
typedef pair<ll, ll> ii;
typedef long double ld;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());

const int maxN = 2e5 + 9, maxV = 1e6 + 9, MOD = 998244353, SQ = 335, lg = 20, bs = 29;

int T[maxN << 1], n;

int query(int l, int r) {
	int ret = 0;
	for(l += n, r += n; l < r; l >>= 1, r >>= 1) {
		if(l & 1) ret = max(ret, T[l++]);
		if(r & 1) ret = max(ret, T[--r]);
	}
	return ret;
}

void update(int w, int x) {
	w += n;
	T[w] = x;
	while(w > 1) {
		w >>= 1;
		T[w] = max(T[w << 1], T[w << 1 | 1]);
	}
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	#ifdef DEBUG
	freopen("input.txt", "r", stdin);
	#endif

	cin >> n;
	vector<ii> arr(n);
	for(int i = 0; i < n; i++)
		cin >> arr[i].fi >> arr[i].se;
	sort(arr.begin(), arr.end());

	vector<int> xs(n), ds(n), reach(n), wys(n + 1);
	for(int i = 0; i < n; i++) xs[i] = arr[i].fi, ds[i] = arr[i].se;

	for(int i = n - 1; i >= 0; i--) {
		int lm = int(lower_bound(xs.begin(), xs.end(), xs[i] + ds[i]) - xs.begin());
		lm = max(lm, query(i + 1, lm));
		reach[i] = lm;
		update(i, lm);
	}

	wys[n] = 1;
	for(int i = n - 1; i >= 0; i--)
		wys[i] = (wys[i + 1] + wys[reach[i]]) % MOD;
	cout << wys[0] << '\n';
}



Measured memory_bytes: 8064
from functools import lru_cache

n, x = map(int, input().split())
sizes = [1]
for i in range(50):
    sizes.append(sizes[-1] * 2 + 3)


@lru_cache(maxsize=None)
def count_patti(level, index):
    """
    左から index 番目までのパティの数
    :param level:
    :param index:
    :return:
    """
    if level == 0:
        return 1
    if index == 0:
        return 0
    if 1 <= index < (sizes[level] - 1) / 2:
        return count_patti(level - 1, index - 1)
    if index == (sizes[level] - 1) / 2:
        return count_patti(level - 1, sizes[level - 1] - 1) + 1
    if (sizes[level] - 1) / 2 < index < sizes[level] - 1:
        return count_patti(level - 1, sizes[level - 1] - 1) + 1 + \
               count_patti(level - 1, index - (sizes[level] - 1) / 2 - 1)
    else:
        return count_patti(level - 1, sizes[level - 1] - 1) + 1 + \
               count_patti(level - 1, sizes[level - 1] - 1)


print(count_patti(n, x - 1))


Measured memory_bytes: 3700
//author:luckYrat(twitter:@luckYrat_)
//#include <bits/stdc++.h>

//def
#include <iostream>

#include <cmath>
#include <algorithm>
#include <iomanip>

//array
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <utility>
#include <climits>



using namespace std;

using ll = long long;
using P = pair<ll,ll>;

#define anyfill(n,s) setw(n) << setfill(s)
#define loop(s) for(int i = 0; s > i; i++)
#define rep(i,q) for(int i = 0; (q) > i; i++)
#define repp(i,n,q) for(int i = n; (q) > i; i++)
#define dep(i,q) for(int i = (q); 0 < i; i--)


#define MAX 1000000000
const int mod = 1000000007;
#define EPS (1e-10)

#define pb push_back
#define fir first
#define scn second
#define ednl endl

#define YesNo(a) (a?"Yes":"No")
#define YESNO(a) (a?"YES":"NO")
#define yesno(a) (a?"yes":"no")


P ar4[4] = {{0,1},{0,-1},{1,0},{-1,0}};
P ar8[8] = {{-1,-1},{-1,0},{-1,1},{0,-1},{0,1},{1,-1},{1,0},{1,1}};
/*
確認ポイント
cout << fixed << setprecision(n) << 小数計算//n桁の小数表記になる
vector.unique()は隣接した同じ要素を削除するので先にソートをする

計算量は変わらないが楽できるシリーズ
C++11以降でmin({a,b,c...})で複数個のmic,maxを処理できる
min(max)_element(iter,iter)で一番小さい(大きい)値のポインタが帰ってくる
count(iter,iter,int)でintがiterからiterの間にいくつあったかを取得できる

*/
__attribute__((constructor))
void initial() {
 cin.tie(0);
 ios::sync_with_stdio(false);
}



int main(){
  int n,k;string s;cin>>n>>k>>s;
  for(int i = 0; n > i; i++){
    if(k-1 == i)s[i] = s[i]+abs('A'-'a');
  }
  cout << s << endl;
}


Measured memory_bytes: 256
n,k = map(int, raw_input().split())
a = map(int, raw_input().split())
mod = 10 ** 9 + 7
ans = 0
for i in xrange(n):
  inv = lt = 0
  for j in xrange(i+1, n):
    if a[i] > a[j]:
      inv += 1
  ans += inv * k
  for j in xrange(n):
    if a[i] > a[j]:
      lt += 1
  ans += lt * k * (k-1) / 2
  ans %= mod
print ans
  

Measured memory_bytes: 2692
{-# LANGUAGE BangPatterns #-}

import           Data.Char
import qualified Data.ByteString.Char8 as B
import qualified Data.Vector.Unboxed   as U
import qualified Data.IntMap           as M

readPair :: IO (Int, Int)
readPair = ((,) <$> U.head <*> U.last) . U.unfoldrN 2 (B.readInt . B.dropWhile isSpace) <$> B.getLine

main :: IO ()
main = do
  n <- readLn
  xls <- U.replicateM n readPair
  print $ solve xls

solve :: U.Vector (Int, Int) -> Int
solve = go 0 minBound . U.foldr (\(x, l) mp -> M.insertWith max (x + l) (x - l) mp) M.empty
  where
   go !k !t0 !mp = case M.minViewWithKey mp of
     Nothing       -> k
     Just ((t,s),mp1)
       | t0 <= s   -> go (k + 1) t mp1
       | otherwise -> go k t0 mp1

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

int main(){
  long long a[100001];
  int n;
  cin >> n;
  long long max = 0;
  a[0] = 0;
  for (int i = 1; i <= n; i++){
    scanf("%lld", &a[i]);
  }
  for (int i = 0; i <= n; i++){
      max += abs(a[i] - a[(i+1)%(n+1)]);
  }
  for (int i = 1; i <= n; i++){
    long long u = max - abs(a[i-1] - a[(i)%(n+1)]) - abs(a[i] - a[(i+1)%(n+1)])
    + abs(a[i-1] - a[(i+1)%(n+1)]);
    cout << u << "\n";
  }



  return 0;
}


Measured memory_bytes: 2048
type drink = {price: int; stock: int};;
let compare_drink d1 d2 = d1.price - d2.price;; 

let input_drink_array n = Array.init n @@ fun _ -> Scanf.scanf " %d %d" @@ fun a b -> {price = a; stock = b};;

let () = Scanf.scanf "%d %d" @@ fun n m -> 
  let drinks = input_drink_array n in (
    Array.fast_sort compare_drink drinks;
    let ans = ref 0 in
    let cnt = ref 0 in (
      for i = 0 to n - 1 do
        if drinks.(i).stock + !cnt < m then (
          ans := !ans + drinks.(i).price * drinks.(i).stock;
          cnt := !cnt + drinks.(i).stock
        ) else if !cnt < m then (
          let rest = m - !cnt in (
            ans := !ans + drinks.(i).price * rest;
            cnt := m;
          )
        )
      done;
      Printf.printf "%d\n" !ans
    )
  )
;;

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

int main() {
	int n;
	long long b[1000];
//	long long a[1000];
	cin >> n;
	int sum=0;
//	memset(a,-1,sizeof(a));
	for(int i=1;i<=n-1;i++) {
		cin >> b[i];
	}
//	a[0]=b[0];
//	b[n-2]=a[n-1];
	sum += b[1]+b[n-1];
	for(int i=1;i<n-1;i++) {
		sum += min(b[i+1],b[i]);
	}
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <map>
using namespace std;
int n, a[200000];
bool f(int x){
    int u=0;
    map<int, int> p;
    p[a[0]]=0;
    for(int i=1;i<n;i++){
        if(a[i] <= a[i-1]){
            u = a[i];
            while(u>0&&p[u]==x-1){
                u--;
            }
            if(u == 0)return false;
            p.erase(p.upper_bound(u), p.end());
            p[u]++;
        }
    }
    return true;
}
int main(void){
    int ng = 1, ok, m;
    cin >> n;
    bool p=true;
    for(int i=0;i<n;i++){
        cin>>a[i];
        if(i>0&&a[i]<=a[i-1])p=false;
    }
    if(p){
        cout<<1<<endl;
        return 0;
    }
    ok = n;
    while(ng + 1 < ok){
        m = (ng + ok)/2;
        if(f(m)){
            ok = m;
        }else{
            ng = m;
        }
    }
    cout << ok << endl;
}


Measured memory_bytes: 1024
import scala.collection.mutable
import scala.io.StdIn._
object Main extends App {

  val n = readInt
  if (n != 1) {
    val children = Array.fill(n) {
      Nil: List[Int]
    }
    val parents = Array.fill(n) {
      0
    }
    val childCount = Array.fill(n) {
      0
    }
    for ((p, c) ← readLine.trim.split(' ').map(_.toInt).zipWithIndex.map { case (p, i) ⇒ (p - 1, i + 1) }.reverse) {
      children(p) ::= c
      childCount(p) += 1
      parents(c) = p
    }
    val heights = Array.fill(n) {
      0
    }
    val queue = mutable.Queue[Int](0)
    var path = Nil: List[Int]
    while (queue.nonEmpty) {
      val top = queue.dequeue()
      path ::= top
      for (c ← children(top)) {
        heights(c) = heights(top) + 1
        queue.enqueue(c)
      }
    }
    val trees = Array.tabulate(n) { i ⇒ new PersistentUnionFind[Int](i) }
    val maxHeights = heights.max
    queue.enqueue(childCount.indices.filter(i ⇒ childCount(i) == 0): _*)
    while (queue.nonEmpty) {
      val top = queue.dequeue()
      if (top != 0) {
        trees(top).mergeAt(trees(parents(top)), maxHeights - heights(parents(top)))
        childCount(parents(top)) -= 1
        if (childCount(parents(top)) == 0) {
          queue.enqueue(parents(top))
        }
      }
    }
    val move = path.dropRight(1).zip(path.tail).map {
      case (f, t) ⇒
        heights(f) + heights(t) - (maxHeights - trees(f).mergedTime(trees(t)).get) * 2L
    }
    println(
      move.sum
    )
  }else {
    println(0)
  }

  class PersistentUnionFind[T](val value: T) {
    private var parent = this
    private var time = Int.MaxValue
    private var size = 1
    private def isTop: Boolean = parent == this
    private def top: PersistentUnionFind[T] = {
      if (parent != this) parent.top
      else this
    }
    def findAt(time: Int): PersistentUnionFind[T] = {
      if (time < this.time) {
        this
      }else {
        parent.findAt(time)
      }
    }
    def mergedTime(that: PersistentUnionFind[T]): Option[Int] = {
      var ti = this
      var ta = that
      var t = time
      while(ti != ta && (!ti.isTop || !ta.isTop)) {
        if (ti.time < ta.time){
          t = ti.time
          ti = ti.parent
        }else {
          t = ta.time
          ta = ta.parent
        }
      }
      if (ti == ta) Some(t)
      else None
    }
    def mergeAt(that: PersistentUnionFind[T], time: Int): Unit = {
      val ti = top
      val ta = that.top
      if (ti != ta){
        if (ti.size < ta.size){
          ti.parent = ta
          ti.time = time
          ta.size += ti.size
        }else {
          ta.parent = ti
          ta.time = time
          ti.size += ta.size
        }
      }
    }
  }
  implicit class Extension[T](val value: T) extends AnyVal {
    @inline def let[A](@inline func: T ⇒ A): A = func(value)
  }
}


Measured memory_bytes: 133048
# -*- coding: utf-8 -*-


def main():
    n = int(input())
    a = list(map(int, input().split()))
    b = [a[0]]
    ans = 1

    for i, j in zip(a, a[1:]):
        if i != j:
            b.append(j)

    m = len(b)
    i = 0
    j = 1

    while i + 1 < m:
        while j + 1 < m:
            if (b[i + 1] - b[i]) * (b[j + 1] - b[j]) < 0:
                ans += 1
                i = j + 1
            j += 1

        i += 1

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 14252
#include <bits/stdc++.h>
using namespace std;
#define pi 3.14159265359
#define int long long
#define pii pair<int,int>
const int mod=1e9 + 7;
 
int dx[]={-1, 0, 1, 0};
int dy[]={0, -1, 0, 1};
 

int dp[100][2];

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


 int n,k;
 cin>>n>>k;
 vector<int>v(n+1);
 map<int,int>m;
 m[0]++;

int sum=0;
int ans=0;
 for(int i=1;i<=n;i++)
 {
   int x; cin>>x;
   if(i>=k)
   {
     m[v[i-k]]--;
   }
   sum+=x; sum%=k;
   int t=sum-i; t+=(i*k);
  
   t%=k;

   ans+=m[t];
   v[i]=t;
   m[t]++;

 }

    cout<<ans<<"\n";

 }

    


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

int main () {
	
	long long int n = 0, x=0, i=0, zero=0, aux=0, res=0;
	vector <long long int> nums, sign;

	cin >> n;

	long long int chico = INT_MAX;
	for (i=0; i<n; i++) {
		cin >> x;
		nums.push_back(abs(x));
		chico = min(chico, abs(x));
		if (x >= 0) sign.push_back(1);
		else sign.push_back(-1);
	}

	int t = nums.size();

	for (i=0; i<n-1; i++) {
		if (sign[i] == -1 && nums[i] != 0) {
			sign[i] *= -1;
			sign[i+1] *= -1;
		}
	}

	if (sign[t-1] == -1) {
		if (chico != nums[t-1]) {
			sign[t-1] *= -1;

			for (i=0; i<n; i++) {
				if (nums[i] == chico) {
					sign[i] *= -1;
					break;
				}
			}
		}

	}

	for (i=0; i<n; i++) res += nums[i]*sign[i];

	
	cout << res << endl;

	return 0;
}

//11
//-1000000000 1000000000 -1000000000 1000000000 -1000000000 0 1000000000 -1000000000 1000000000 -1000000000 1000000000
//10000000000


Measured memory_bytes: 2036
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
#include <string>
#define REP(i,n) for(ll i = 0; i < (ll)n; i++)
using namespace std;
typedef long long ll;

int main(){
  ll r,g,b;
  cin >> r >> g >> b;
  string ans = ((g*10+b)%4==0) ? "YES" : "NO";
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
from collections import Counter
n = int(input())
a = sorted(Counter(list(map(int, input().split()))).items(), reverse=True)
g = [0]*(n+1)
g[n] = 1
for _, x in a:
  if sum(g) < x:
    print('No')
    break
  t = [0]*(n+1)
  for i in range(n, -1, -1):
    if g[i] <= x:
      t[i-1] = t[i] + g[i]
      x -= g[i]
      g[i] = 0
    else:
      t[i-1] = t[i] + x
      g[i] -= x
      x = 0
  t[n] = 0
  g = [x+y for x,y in zip(g, t)]
else:
  print('Yes')


Measured memory_bytes: 112712
#include<bits/stdc++.h> 
using namespace std; 
typedef  pair<int, int> iPair; 
//#define mod 1000000007
#define pb push_back
typedef long long ll;
typedef long double ld;
#define FOR(i,n) for(i=0;i<n;i++)
#define FORE(i,n) for(i=0;i<=n;i++)
 
 
ll gcd(ll a , ll b)
{
   if(b==0) return a;
   a%=b;
   return gcd(b,a);
   
}
    
ll maxl(ll a,ll b){
    if(a>b)return a;
    return b;
}
 
ll minl(ll a,ll b){
    if(a>b)return b;
    return a;
}
 
ll mod = 998244353;
 
ll mulmod(ll a, ll b,ll c){ 
    ll res = 0; 
    a = a % c; 
    while (b > 0){ 
        if (b % 2 == 1){ 
            res = (res + a) % c;
        }
        a = (a * 2) % c; 
        b /= 2; 
    } 
    return res % c; 
}
 
int binarySearch(int arr[], int l, int r, int x) 
{ 
    if (r >= l) { 
        int mid = l + (r - l) / 2; 
        if (arr[mid] == x) 
            return mid; 
        if (arr[mid] > x) 
            return binarySearch(arr, l, mid - 1, x); 
        return binarySearch(arr, mid + 1, r, x); 
    } 
    return -1; 
} 
 
int a[100005];
int tree[200005];
 
void build(int st,int low,int high){
    if(low==high){
        tree[st] = a[high]%2;
        return;
    }
    int mid = low+(high-low)/2;
    build(2*st,low,mid);
    build(2*st+1,mid+1,high);
    tree[st] = tree[2*st]+tree[2*st+1];
}
 
void update(int st,int start,int end,int ind,int val){
    if(start==end){
        tree[st] = val%2;
        return;
    }
    int mid = start+(end-start)/2;
    if(ind<=mid){
        update(2*st,start,mid,ind,val);
    }
    else update(2*st+1,mid+1,end,ind,val);
    tree[st] = tree[2*st]+tree[2*st+1];
}
 
int query(int st,int start,int end,int low,int high){
    if(start>high || end<low)return 0;
    int mid = start + (end-start)/2;
    if(start==low && end==high){
        return tree[st];
    }
    if(low>mid)return query(2*st+1,mid+1,end,low,high);
    if(high<=mid)return query(2*st,start,mid,low,high);
    return query(2*st,start,mid,low,mid)+query(2*st+1,mid+1,end,mid+1,high);
}

int main()
{
        ios_base::sync_with_stdio(false);
        int n;
        cin >> n;
        vector<int> ans(n);
        int temp;
        for(int i=0;i<n;i++){
            cin >> temp;
            ans[temp-1] = i+1;
        }
        for(int i=0;i<n;i++){
            cout << ans[i] << " ";
        }
        cout << endl;
        return 0;
}

Measured memory_bytes: 1280
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define M 1000000007
#define INF ((1LL<<62LL) - 1)

signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    string s; cin >> s;

    if(s.back() == 's') s = s+"es";
    else s += "s";

    cout << s << "\n";



}


Measured memory_bytes: 3648
#include <iostream>
#include <string>

using namespace std;

int main(void) {
	int k, s;

	cin >> k >> s;

	int cnt = 0;

	int z;

	for (int x = 0; x <= k; x++) {
		for (int y = 0; y <= k; y++) {
			z = s - x - y;
			if (z >= 0 && z <= k)
				cnt++;
		}
	}

	cout << cnt << endl;

	return 0;
}

Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <queue>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define FIX(a) ((a)%mod+mod)%mod
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string ac = "ACGT";
    string s;
    cin >> s;
    int ans = 0;
    int now = 0;
    for(char c: s){
        bool f = true;
        REP(i,4){
            if(c==ac[i]){
                now++;
                f=false;
                break;
            }
        }
        if(f){
            ans = max(ans,now);
            now=0;
        }
    }
    ans = max(ans,now);
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(int argc, char *argv[])
{
	long long A, B, C, K;
	cin >> A >> B >> C >> K;

	K -= A;
	K -= (K > 0) ? B : 0;
	A -= (K > 0) ? K : 0;

	A += (K < 0) ? K : 0;
	cout << A << endl;
	return 0;
}


Measured memory_bytes: 3584
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
typedef pair<int, int> pii;
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));
//priority_queue<int,vector<int>, greater<int> > q2;



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

	int N;
	cin >> N;
	vector<VI> A(N);
	REP(i, N) {
		REP(j, 3) {
			int a;
			cin >> a;
			A[i].push_back(a);
		}
		SORT(A[i]);
	}
	SORT(A);
	int ans = 0;
	REP(i, N-1) {
		if (A[i][0] == A[i + 1][0] && A[i][1] == A[i + 1][1] && A[i][2] == A[i + 1][2]) {
			ans++;
		}
	}
	cout << ans << endl;
	return 0;
}




Measured memory_bytes: 3296
#include <iostream>
#include <vector>
using namespace std;
typedef long long int LLI;

int main()
{
	int n;
	cin >> n;
	LLI sum = 0, tmp, min;
	
	cin >> tmp;
	while( tmp > 0 and tmp % 2 == 0 )
	{
		sum++;
		tmp/=2;
	}
	min = sum;
	
	for(int i = 1; i < n; i++)
	{
		sum = 0;
		cin >> tmp;
		while( tmp > 0 and tmp % 2 == 0 )
		{
			sum++;
			tmp/=2;
		}
		if( sum < min )
			min = sum;
	}
	cout << min;
}

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

#define rep(i, n) for(int i = 0; i < n; i ++)
#define COUNT(i, n) for(int i = 1; i <= n; i ++)
#define ITER(c) __typeof((c).begin())
#define each(c, it) for(ITER(c) it =(c).begin(); it!=(c).end(); it++)
#define ALL(c) c.begin(), c.end()
#define mp make_pair
#define pb push_back
#define MEMSET(v, h) memset((v), h, sizeof(v))
 
using namespace std; 

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

const int INF = 1 << 24;

int main(void){
    int n; cin >> n;

    for(double xa, ya, ra, xb, yb, rb, d; n -- && cin >> xa >> ya >> ra >> xb >> yb >> rb; cout << ((ra + rb < d) ? 0:(d < rb - ra && ra < rb) ? -2:(d < ra - rb && rb < ra) ? 2:1) << endl)
        d = sqrt(pow(xb - xa, 2) + pow(yb - ya, 2));

    return 0;
}

Measured memory_bytes: 1232
r,D,x = map(int,input().split())
ans = [0]*10

for i in range (1,11):
	if i == 1:
		ans[0] = r*x-D
		print(ans[0])
	else:
		ans[i-1] = r*ans[i-2]-D
		print(ans[i-1])


Measured memory_bytes: 2940
#include<bits/stdc++.h>
#define rep(i,n,m) for(int i = (n); i <(m); i++)
#define rrep(i,n,m) for(int i = (n) - 1; i >=(m); i--)
using namespace std;
using ll = long long;

int main()
{
    string s;
    cin >> s;
    vector<int> cnt(26, 0);
    for (auto c: s)
        ++cnt[c - 'a'];
    
    bool ans = true;
    rep(i, 0, 26)
        ans &= cnt[i] % 2 == 0;
    if (ans)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
import itertools
N = int(input())
pCake = range(N // 4 + 1)
pDonut = range(N // 7 + 1)

ptn = list(itertools.product(pCake, pDonut))

for i in ptn:
    if i[0] * 4 + i[1] * 7 == N:
        print('Yes')
        exit()

print('No')


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

using ll = long long;
int INF = numeric_limits<int>::max() / 2;
ll LINF = numeric_limits<ll>::max() / 2;
int MOD = 1e9 + 7;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int k,s;
    cin >> k >> s;
    int ans = 0;
    for(int i = 0; i <= k; i++){
        for(int j = 0; j <= k; j++){
            int t = s - i - j;
            if(0 <= t && t <= k) ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<stdio.h>

int main()
{
    int N, a=0, b=0, i, bucket;
    scanf("%d", &N);
    int arr[N], arr2[N];

    for(i=0; i<N; i++)
    {
        scanf("%d", &arr[i]);
    }
    for(i=0; i<N-1; i++)
    {
        if(arr[i+1]<arr[i])
        {
            if(a==0)arr2[a] = i;
            else arr2[a] = i+1;
            a++;
        }
    }
    if(a==0)printf("YES");
    else if(a==2)
    {
        bucket = arr[arr2[0]];
        arr[arr2[0]] = arr[arr2[1]];
        arr[arr2[1]] = bucket;

        for(i=0; i<N-1; i++)
        {
            if(arr[i+1]<arr[i])
            {
                b++;
                break;
            }
        }
        if(b==0)printf("YES");
        else printf("NO");
    }
    else printf("NO");

    return 0;
}

Measured memory_bytes: 1692
#include <stdio.h>
#include <stdint.h>
#include <inttypes.h>
#include <stdlib.h>

typedef unsigned long long int uint64;
typedef long long int          int64;

int main()
{
  int cnt;
  int A,B,C;
  int diff;

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

  diff = A-B;
  C -= diff;
  if (C < 0) {
    C = 0;
  }

  printf("%d", C);

  return 0;
}



Measured memory_bytes: 128