akhauriyash/Code-Regression huggingface dataset:
# include <iostream>
# include <stdint.h>
# include <stdio.h>
# include <math.h>
using namespace std;


int main(){
	int n,m;
	cin >> n>> m;
	int A[n][m];
	int b[m],c[n] ={0};

	for(int i =0;i<n;i++){
		for(int j =0;j<m;j++){
			cin >>A[i][j];
		}
	}
	for(int i=0;i<m;i++){
		cin >>b[i];
	}
	for(int i=0;i<n;i++){
		for(int j =0;j<m;j++){
				c[i] += A[i][j] * b[j];
		}
	}
	for(int i=0;i<n;i++){
		cout <<c[i]<<"\n";
	}
	return 0;
}



Measured memory_bytes: 3096
#include<bits/stdc++.h>
using namespace std;
#define lp(i,n) for(int i=0;i<n;i++)
#define lpin(a,i,n) for(int i=0;i<n;i++){cin>>a[i];}

int  main(){
  while(1){
    int a,b;
    cin>>a>>b;
    if(a==0&&b==0) break;
    int n[50],it=0,count=a;
    fill(n,n+50,0);
    while(1){
      if(b==1){
	if(count==a-1&&n[it]!=0) break;
	if(count==a) break;
      }
      if(b==0){
	b+=n[it];
	if(n[it]!=0)
	count++;
	n[it]=0;
      }
      else{
	if(n[it]==0) count--;
	n[it]++;
	b--;
      }
      // cout<<it<<" "<<n[it]<<" "<<count<<endl;
      if(it==a-1) it=0;
      else it++;
    }
    cout<<it<<endl;
  }
  return 0;
}



Measured memory_bytes: 2992
import sys
inputs = sys.stdin.readlines()

S = inputs[0].strip()
K = int(inputs[1])

if len(set(S)) == 1:
    print(len(S)*K // 2)
else:
    counts = []
    count = 1
    for i in range(len(S)-1):
        if S[i] == S[i+1]:
            count += 1
        else:
            counts.append(count)
            count = 1
    counts.append(count)
    if S[0] != S[-1]:
        t = 0
    else:
        if counts[0] % 2 == counts[-1] % 2 == 1:
            t = 1
        else:
            t = 0
        counts[0] += counts.pop()
    print(K*sum(map(lambda x: x//2, counts)) - t)

Measured memory_bytes: 3064
import math
import sys
#####sorting a dictionary by the values#####
def dict_sort(ans):
    ans=sorted(ans.items(),reverse=True,key=lambda kv:(kv[1]))
##### naive method for testing prime or not#####
def is_prime(n):
    if n==1:
        return 0
    for i in range(2,int(math.sqrt(n))+1):
        if n%i==0:
            return False
    return True
#####Primes till Nth#####
def seive_primes(n):
    flag=[0]*(n+10)
    flag[1]=flag[0]=1
    i=2
    while i*i<=n+1:
        if flag[i]==0:
            j=i*i
            while j<=n+1:
                flag[j]=1
                j+=i
        i+=1
    return flag
#####greatest common divisor of two numbers#####
def gcd(a,b):
    if b==0:
        return a
    return gcd(b,a%b)
#####least common multiplyer of two numbers#####
def lcm(a,b):
    return (a*b)//gcd(a,b)
#####function that return all the letters#####
def alphabates():
    return "abcdefghijklmnopqrstuvwxyz"
#####binary search#####
def binary_search(ls,n,flag):
    low=0
    hi=n-1
    while(low<=hi):
        mid=(low+hi)//2
        if ls[mid]==flag:
            return mid
        elif ls[mid]>flag:
            hi=mid-1
        else:
            low=mid+1
    return -1
#####Decimal to Binary(8 bits)#####
def Binary(n):
    if n==0:
        return "00000000"
    binary = "" 
    i = 0
    while n > 0 and i<=8: 
        s1 = str(int(n%2)) 
        binary = binary + s1 
        n /= 2
        i = i+1
        d = binary[::-1] 
    return d
#####quadratic#####
def qdrt(x,a,b,c):
    return a*x*x+b*x+c
#####taking an array/list as input#####
def inp():
    ls=list(map(int,input().split()))
    return ls
#####taking multiple inputs#####
def mult_inp():
    return map(int,input().split())
#####0-1 Knapsack#####
def knapSack(W, wt, val, n): 
    K = [[0 for x in range(W + 1)] for x in range(n + 1)]  
    for i in range(n + 1): 
        for w in range(W + 1): 
            if i == 0 or w == 0: 
                K[i][w] = 0
            elif wt[i-1] <= w: 
                K[i][w] = max(val[i-1]+K[i-1][w-wt[i-1]],  K[i-1][w]) 
            else: 
                K[i][w] = K[i-1][w] 
  
    return K[n][W] 
#####Main function starts from here#####
ls=inp()
ans=0
for i in range(ls[0]):
    a=inp()
    if math.sqrt(a[0]**2+a[1]**2)<=ls[1]:
        ans+=1
print(ans)



Measured memory_bytes: 9184
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<iostream>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<string>
#define nl n<<1
#define nr (n<<1)|1
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int>P;
const int INF=0x3f3f3f3f;
const ll INFF=0x3f3f3f3f3f3f3f3f;
const double pi=acos(-1.0);
const double eps=1e-9;
const ll mod=1e9+7;
int read()
{
    int x=0,f=1;char ch=getchar();
    while(ch<'0' | ch>'9') {if(ch=='-') f=-1;ch=getchar();}
    while(ch>='0' && ch<='9') {x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
void Out(int aa)
{
    if(aa>9)
        Out(aa/10);
    putchar(aa%10+'0');
}
int l[1010],r[1010];
int sum[1000010];
int ans[1000010];
int main()
{
    int n=read();
    for(int i=1;i<=n;i++)
    {
        l[i]=read(),r[i]=read();
        sum[l[i]]++,sum[r[i]+1]--;
    }
    for(int i=1;i<=100000;i++)
    {
        ans[i]=ans[i-1]+sum[i];
    }
    int res=0;
    for(int i=1;i<=100000;i++)
    {
        if(ans[i]>0)
            res++;
    }
    cout<<res;
    return 0;
}


Measured memory_bytes: 4736
A = [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]

K = int(input())

print(A[K-1])

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

using namespace std;

int main()
{
  string s;
  cin >> s;
  int sum = 0;
  for(int i = 0; i < int(s.length()); i++)
  {
    int num = s[i] - '0';
    sum += num;
    sum %= 9;
  }
  if(sum == 0)
  {
    cout << "Yes" << endl;
  }
  else
  {
    cout << "No" << endl;
  }
  return 0;
}

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

int index(int numToFind, std::vector<int> vectorToFindIn) {int len = vectorToFindIn.size();for (int i = 0; i < len; i++){if (vectorToFindIn[i] == numToFind){return i;}}return -1;}

ll gcd(ll a,ll b)
{
	if (b==0) return a;
	return gcd(b,a%b);
}
string to_upper(string a)
{
	for (int i=0;i<(int)a.size();++i) if (a[i]>='a' && a[i]<='z') a[i]-='a'-'A';
	return a;
}
 
string to_lower(string a)
{
	for (int i=0;i<(int)a.size();++i) if (a[i]>='A' && a[i]<='Z') a[i]+='a'-'A';
	return a;
}

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	string s,cur,t;
	cin>>s;
	int n=s.length(),ans=1;
	vector<string> v;
	t=s[0];
	cur="";
	for (int i=1;i<n;++i)
	{
		//cout<<i<<", t: "<<t<<", cur: "<<cur<<"\n";
		cur+=s[i];
		if (cur==t)
		{
			if (i<n-1)
			{
				cur+=s[i+1];
				t=cur;
				cur="";
				++i;
				++ans;
			}
		}
		else
		{
			++ans;
			t=cur;
			cur="";
		}
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 720
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<vector>
#include<queue>
#include<cmath>

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n-1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(a, n) sort(a, a+n)
#define VSORT(v) sort(v.begin(), v.end())

using namespace std;

int main()
{
    string s, t;

    cin >> s >> t;

    int slen = s.length(), tlen = t.length();
    int dp[slen+1][tlen+1] = {0};
    REP(i, slen+1) { dp[i][0] = 0; }
    REP(j, tlen+1) { dp[0][j] = 0; }

    REP(i, slen) {
        REP(j, tlen) {
            if(s[i] == t[j]) { dp[i+1][j+1] = dp[i][j] + 1; }
            else { dp[i+1][j+1] = max(dp[i][j+1], dp[i+1][j]); }
        }
    }

    string lcs = "";
    int i = slen-1, j = tlen-1;

    while((i >= 0) && (j >= 0)) {
        if(dp[i+1][j+1] != dp[i][j]) {
            if(dp[i+1][j+1] == dp[i][j+1]) { i -= 1; }
            else if(dp[i+1][j+1] == dp[i+1][j]) { j -= 1; }
            else {
                lcs += t[j];
                i -= 1; j -= 1;
            }
        } else { j -= 1; }
    }

    reverse(lcs.begin(), lcs.end());

    cout << lcs << endl;

    return 0;
}

Measured memory_bytes: 35456
#include<bits/stdc++.h>
using namespace std;
int main(){
    int a,b;
    cin>>a>>b;
    int g;
    int e=1000000000;
    int c[a];
    for(int i=0;i<a;i++){
		cin>>c[i];
	}
	sort(c,c+a);
	for(int i=0;i<a-b+1;i++){
		g=c[i+b-1]-c[i];
		e=min(g,e);
	}
	cout<<e<<endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define rep(it,st,en) for(int it=(st);it<(int)(en);++it)
#define allof(c) (c).begin(), (c).end()
#define mt make_tuple
#define mp make_pair
#define pb push_back
#define X first
#define Y second
typedef long long int ll; 
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
const int INF=(int)1e9; 
const double EPS=(ld)1e-7;

vvi g;

void dfs(int x, int p, vi& v){
    for(int y : g[x]){
        if(y != p){
            v[y] = v[x]+1;
            dfs(y,x,v);
        }
    }
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin>>n;
    g.resize(n);
    rep(i,0,n-1){
        int a,b;
        cin>>a>>b;
        --a,--b;
        g[a].pb(b);
        g[b].pb(a);
    }
    vi d1(n,0), d2(n,0);
    dfs(0,-1,d1);
    dfs(n-1,-1,d2);
    int cnt1 = 0, cnt2 = 0;
    rep(i,0,n) {
        if(d1[i] <= d2[i]) cnt1 ++;
        else cnt2 ++;
    }
    //cerr<<cnt1<<" "<<cnt2<<endl;
    if(cnt1 > cnt2) cout<<"Fennec"<<endl;
    else cout<<"Snuke"<<endl;
    return 0;
}


Measured memory_bytes: 12800
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <array>
#include <vector>
#include <functional>
#include <unordered_map> 
#include <map> 
#include <numeric>
#include <limits>
#include <utility>
#include <queue>
#include <random>
#include <bitset>
#include <memory>
using namespace std;
typedef long long LL;

int main() {
    int n, count = 0;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }

    for (int i = 1; i < n; i++) {
        if (a[i] == a[i - 1]) {
            a[i] = 200000;
            count++;
        }
    }

    cout << count << endl;

    return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e3+5,M=2e4+5,inf=0x3f3f3f3f,mod=1e9+7;
#define mst(a,b) memset(a,b,sizeof a)
#define lx x<<1
#define rx x<<1|1
#define reg register
#define PII pair<int,int>
#define fi first
#define se second
#define pb push_back
#define il inline
int main(){
	string a,b;
	cin>>a>>b;
	for(int i=0;i<a.size()+b.size();i++)
		if(i%2==0) cout<<a[i/2];
		else cout<<b[i/2];
	return 0;
}

Measured memory_bytes: 3628
#!/usr/bin/env python3
n, *s = map(int, open(0).read().split())
v = list(map(lambda x: abs(x), s))
c = 0
for i in s:
    c += i < 0
if c % 2 == 0:
    print(sum(v))
else:
    print(sum(v) - 2*min(v))


Measured memory_bytes: 14116
#include<iostream>
using namespace std;
//実行時間制限TLE
int main(){
  //(A+B)*10^100
  //先頭からN個のボール
  //AAABBBB | AAABBB
  long long int N,A,B;
  cin >> N >> A >> B;
  long long int blue_num = N / (A+B);
  long long int reminder = N % (A+B);
  //cout << "blue_num" << blue_num << endl;
  //cout << "reminder" << reminder << endl;
  if(A < reminder){
	//cout << "case 1" << endl;
	cout << blue_num*A+A << endl;
  }
  else{
	//cout << "case 2" << endl;
	cout << blue_num*A+reminder << endl;
  }
  return 0;
}


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

#define int long long

#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0,a1,a2,a3,x,...) x
#define REP1(i, s, cond, cal) for (signed i = signed(s); i cond; i cal)
#define REP2(i, s, n) REP1(i, s, < signed(n), ++)
#define REP3(i, n) REP2(i, 0, n)
#define rep(...) CHOOSE((__VA_ARGS__,REP1,REP2,REP3))(__VA_ARGS__)
#define rrep(i, s) rep(i, s, >= 0, --)

#define all(c) begin(c), end(c)
template<typename T>bool maxup(T& a, T&& b) { if (a < b) { a = b; return true; }; }
template<typename T>bool maxup(T& a, T& b) { if (a < b) { a = b; return true; }; }
template<typename T>bool minup(T& a, T&& b) { if (a > b) { a = b; return true; }; }
template<typename T>bool minup(T& a, T& b) { if (a > b) { a = b; return true; }; }

#define X first
#define Y second

using VV = vector<vector<int>>;
using V = vector<int>;
using P = pair<int, int>;
using IP = pair<int, P>;

template<typename T>
inline void input(vector<T>& v) { for (auto& x : v) cin >> x; }

signed main() {
	int N; cin >> N;
	V a(N), b(N);
	rep(i, N) cin >> a[i] >> b[i];
	reverse(all(a));
	reverse(all(b));
	V xs(N);
	rep(i, N) {
		int x = (i - 1 >= 0 ? xs[i - 1] : 0) + a[i];
		xs[i] = !!x * ((x - 1) / b[i] + 1) * b[i] - a[i];
	}
	cout << xs[N - 1] << endl;

	system("pause");
}

Measured memory_bytes: 2808
#include <cstring>
#include <iostream>
#include <algorithm>
#define rep(i,n) for(int i=0; i<(n); ++i)
#define reps(i,f,n) for(int i=(f); i<=(n); ++i)
#define outl(x) cout<< (x) << '\n'
#define fi first
#define se second
using ll = long long;
using namespace std;
using pii = pair<int,int>;

int N;
ll a[200010];

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

   cin >> N;

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

   for (int i=2; i<=N; ++i) {
      a[i] += a[i-1];
   }

   sort(a, a+N+1);


   int i = 0;
   ll ans = 0;
   while (i <= N) {
      // if (a[i] == a[i-1]) {
      //    ++i;
      //    ++cnt;
      // }
      ll tmp = a[i];
      ll cnt = 0;
      i++;
      while (i <= N && a[i] == tmp) {
         ++i;
         ++cnt;
      }
      ans += cnt * (cnt + 1) / 2;
      // ++i;
   }

   outl(ans);
}



Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
typedef long long int ll;

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	int n; cin >> n;
	vector<ll> a(n);
	ll ans=0;
	for(int i=0;i<n;i++){
		cin >> a[i];
		ans+=a[i]-(i+1);
	}
	cout << ans << endl;
}


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

using namespace std;
int cnt = 1;

struct Edge{
	int to;
};

void DFS_visit(int top, vector<vector<Edge>>& G, vector<vector<int>>& timestump)
{
	int next;
	timestump[top][0] = cnt++;
	Label:
	if(G[top].empty()){
		timestump[top][1] = cnt++;
	}else{
		next = G[top].begin()->to - 1;
		G[top].erase(G[top].begin());
		if(timestump[next][0] == 0){
			DFS_visit(next, G, timestump);
			goto Label;
		}else{
			goto Label;
		}
	}
}

void DFS(vector<vector<Edge>>& G)
{
	vector<vector<int>> timestump;
	timestump = vector<vector<int>>(G.size(), vector<int>(2, 0));

	for(int i = 0; i < G.size(); i++){
		if(timestump[i][0] == 0){
			DFS_visit(i, G, timestump);
		}
	}

	for(int i = 0; i < G.size(); i++){
		cout << i + 1 << " " << timestump[i][0] << " " << timestump[i][1] << endl;
	}
}

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

	vector<vector<Edge>> AdjList(num);
	for(int i = 0; i < num; i++){
		int u, k;
		cin >> u >> k;
		for(int j = 0; j < k; j++){
			int v;
			cin >> v;
			AdjList[i].push_back(Edge{v});
		}
	}

	DFS(AdjList);
	return 0;
}

Measured memory_bytes: 3128
s = input()
odd = ["R", "U", "D"]
even = ["L", "U", "D"]
for i in list(s[::2]):
    if i not in odd: 
        print("No")
        exit()
for i in list(s[1::2]):
    if i not in even: 
        print("No")
        exit()
print("Yes")


Measured memory_bytes: 3060
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.util.ArrayList;

public class Main
{
	public static void main(String[] args) throws IOException
	{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String s;
		while((s=br.readLine())!=null && !s.isEmpty())
		{
			int n = Integer.parseInt(s.split(" ")[0]);
			int sum = Integer.parseInt(s.split(" ")[1]);
			if(n==0 && sum==0) break;
			ArrayList<Integer> a = new ArrayList<Integer>();
			if(sum<10)
				for(int i=0; i<=sum; i++) a.add(i);
			else
				for(int i=0; i<10; i++) a.add(i);
			System.out.println(combination(a,0,sum,n));
		}
	}

	private static int combination(ArrayList<Integer> num, int index, int sum, int n)
	{
		if(n==0 || index == num.size()) 		 return 0; //answer not found 
		int rest=0;
		if((rest=sum-num.get(index))==0 && n==1) return 1; //answer found
		return combination(num, index+1, rest, n-1) + combination(num, index+1, sum, n);
	}	
}

Measured memory_bytes: 9724
#include <stdio.h>
#include <string.h>
#define M 100
int a[M];
int main()
{
	memset(a,0,sizeof(a));
    int i,j,n,k,temp,temp1,ans=0;
    scanf("%d %d",&n,&k);
    for(i=0;i<k;i++){
    	scanf("%d",&temp);
    	for(j=0;j<temp;j++){
	    	scanf("%d",&temp1);
	    	a[temp1]++;
	    }
    }
    for(i=1;i<=n;i++)
      if(a[i]==0) ans++;
    printf("%d\n",ans);
    return 0;
}

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

using namespace std;

typedef long long  ll;
const ll MOD = 1000000007;

// a, bの最大公約数と， ax+by=gcd(a, b)となるx,yを求める
ll Extgcd(ll a, ll b, ll &x, ll &y) {
    ll g = a;
    if(b != 0) {
        g = Extgcd(b, a % b, y, x);
        y -= (a / b) * x;
    }
    else {
        x = 1;
        y = 0;
    }

    return g;
}

// ax = gcd(a, m) (mod m) となるxを求める
// a, m が互いに素ならば関数値はmod m でのaの逆数となる
ll ModInverse(ll a, ll m)
{
    ll x, y;
    Extgcd(a, m, x, y);
    return (x % m + m) % m;
}

// // 組合せ
// ll Combination(ll n, ll r)
// {
//     if(n < r)
//         return 0;
//     if(n-r < r)
//         r = n-r;

//     ll ret = 1;
//     for(int i=0; i<r; i++) {
//         ret *= (n--);
//         ret %= MOD;
//         ret *= ModInverse(i + 1, MOD);
//         ret %= MOD;
//     }
//     return ret;
// }

const int MAX_N = 2 * 100010;
vector<ll> fact(MAX_N), rfact(MAX_N);
void Init() {
    fact[0] = rfact[0] = 1;
    for (int i = 1; i < MAX_N; ++i) {
        fact[i] = (fact[i - 1] * i) % MOD;
        rfact[i] = (rfact[i - 1] * ModInverse(i, MOD)) % MOD;
    }
}

ll Combination(ll n, ll k) {
    return ((fact[n] * rfact[n - k]) % MOD) * rfact[k] % MOD;
}

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

    Init();

    ll h, w, a, b;

    cin >> h >> w >> a >> b;
    ll ans = 0;
    for (int i = 1; i <= h - a; ++i) {
        ll l1 = Combination(i + b - 2, min((ll)i - 1, b - 1));
        ll l2 = Combination(h - i + w - b - 1, min(w - b - 1, h - i));
        ans = (ans + (l1 * l2) % MOD) % MOD;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3328
#include <iostream>
#include <vector>
#include <queue>
#include <cmath>
#include <cstdio>
using namespace std;
vector<double> dijkstra(int N, vector< vector<double> > G, int s){
  double INF = (1e12);
  priority_queue< pair<double,int> > wait;
  vector<double> result(N,INF);
  result[s] = 0.0;
  wait.push(make_pair(0.0,s));
  while(!wait.empty()){
    int nowpoint = wait.top().second;
    double nowcost = -wait.top().first;
    wait.pop();
    for(int i = 0; i < N; ++i){
      double nextcost = nowcost + G[nowpoint][i];
      if(nextcost < result[i]){
	result[i] = nextcost;
	wait.push(make_pair(-nextcost,i));
      }
    }
  }
  return result;
}

int main(){
  double x, y, xt, yt;
  int N;
  double INF = (1e12);
  cin >> x >> y >> xt >> yt >> N;
  vector< vector<double> > V(N+2,vector<double>(N+2,INF));
  double X[N], Y[N], R[N];
  for(int i = 0; i < N; ++i){
    cin >> X[i] >> Y[i] >> R[i];
  }
  for(int i = 0; i < N; ++i){
    for(int j = 0; j < N; ++j){
      V[i][j] = max(0.0,sqrt((X[i]-X[j])*(X[i]-X[j])+(Y[i]-Y[j])*(Y[i]-Y[j]))-R[i]-R[j]);
    }
  }
  for(int i = 0; i < N; ++i){
    V[i][N] = max(0.0,sqrt((X[i]-x)*(X[i]-x)+(Y[i]-y)*(Y[i]-y))-R[i]);
    V[N][i] = V[i][N];
    V[i][N+1] = max(0.0,sqrt((X[i]-xt)*(X[i]-xt)+(Y[i]-yt)*(Y[i]-yt))-R[i]);
    V[N+1][i] = V[i][N+1];
  }
  V[N][N+1] = sqrt((x-xt)*(x-xt)+(y-yt)*(y-yt));
  V[N+1][N] = V[N][N+1];
  printf("%.10f\n",dijkstra(N+2,V,N)[N+1]);
  return 0;
}


Measured memory_bytes: 21876
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc, wr = bufio.NewScanner(os.Stdin), bufio.NewWriter(os.Stdout)

func scanString() string   { sc.Scan(); return sc.Text() }
func scanRunes() []rune    { return []rune(scanString()) }
func scanInt() int         { a, _ := strconv.Atoi(scanString()); return a }
func scanInt64() int64     { a, _ := strconv.ParseInt(scanString(), 10, 64); return a }
func scanFloat64() float64 { a, _ := strconv.ParseFloat(scanString(), 64); return a }

func scanInts(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = scanInt()
	} 
	return res
}

func debug(a ...interface{}) { fmt.Fprintln(os.Stderr, a...) }

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}
func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

//•*¨*•.¸¸♪Main•*¨*•.¸¸♪(　-ω-)ノ　(　・ω・)

func main() {
	defer wr.Flush()
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 10000), 1001001)

	d := scanInt()
	g := scanInt()

	dp := make([][]int, d+1)
	dp[0] = make([]int, d*100+1)
	for i := 0; i < d*100+1; i++ {
		dp[0][i] = -1
	}
	dp[0][0] = 0

	for i := 0; i < d; i++ {
		p := scanInt()
		c := scanInt()
		dp[i+1] = make([]int, d*100+1)
		for j := 0; j < d*100+1; j++ {
			dp[i+1][j] = -1
		}
		dp[i+1][0] = 0

		for j := 0; j < d*100+1; j++ {
			if dp[i][j] == -1 {
				break
			}
			for k := 1; k < p; k++ {
				dp[i+1][j+k] = max(dp[i+1][j+k], max(dp[i][j+k], dp[i][j]+(i+1)*100*k))
			}
			dp[i+1][j+p] = max(dp[i+1][j+p], max(dp[i][j+p], dp[i][j]+(i+1)*100*p+c))
		}
	}

	for i := 0; i < d*100+1; i++ {
		if dp[d][i] >= g {
			fmt.Fprintln(wr, i)
			return
		}
	}

}


Measured memory_bytes: 768
#include<iostream>
using namespace std;
int main(){
    int m,k,r;
    while(1){
        cin>>m>>k>>r;
        if(m==-1 && k==-1 && r==-1)break;
        
        if(m==-1 | k==-1){
            cout<<"F"<<endl;
        }else if(m+k>=80){
            cout<<"A"<<endl;
        }else if(m+k>=65){
            cout<<"B"<<endl;
        }else if(m+k>=50){
            cout<<"C"<<endl;
        }else if(m+k>=30){
            if(r>=50){
                cout<<"C"<<endl;
            }else{
                cout<<"D"<<endl;
            }
        }else if(m+k<30){
            cout<<"F"<<endl;
        }
    }
    return 0;
}


Measured memory_bytes: 3072
#include <iostream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <cassert>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <string>
#include <algorithm>
#include <utility>
#define llint long long
#define inf 1e18
#define rep(x, s, t) for(llint (x) = (s); (x) < (t); (x)++)
#define Rep(x, s, t) for(llint (x) = (s); (x) <= (t); (x)++)
#define chmin(x, y) (x) = min((x), (y))
#define chmax(x, y) (x) = max((x), (y))

using namespace std;
typedef pair<llint, llint> P;

llint x;

int main(void)
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> x;
	llint ans = x / 500 * 1000;
	x %= 500;
	ans += x / 5 * 5;
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <new>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<tuple>

typedef long long ll;

using namespace std;
using Graph = vector<vector<ll>>;

#define rep(i, N) for (ll i = 0; i < (ll)(N); ++i)
#define ALL(a) (a).begin(),(a).end()

const ll inf = 1e18+7;
const ll mod = 1e9+7;

ll GetDigit(ll num){
    unsigned digit=0;
    while(num!=0){
        num /= 10;
        digit++;
    }
    return digit;
}

vector<bool> seen;

void dfs(const Graph &G,int v){
    seen[v] = true;

    for(auto next_v:G[v]){
        if(seen[next_v]) continue;
        dfs(G,next_v);
    }
}

int main(){
    string S,Sr,Ss,Ssr;
    cin >> S;

    Sr = S;
    reverse(ALL(Sr));

    for(int i=0;i<(S.size()-1)/2;i++){
        Ss += S[i];
    }

    Ssr=Ss;
    reverse(ALL(Ssr));

    if(S==Sr&&Ss==Ssr){
        cout<<"Yes"<<endl;
    }else{
      cout<<"No"<<endl;
    }
	return 0;
}



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

long long f(long long x, long long y){
	if (x % y == 0) return x * 2 - y;
	return x / y * y * 2 + f(y, x % y);
}

int main(){
	long long n, x;
	cin >> n >> x;
	cout << n + f(x, n - x) << '\n';
	return 0;
}

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

int main() {
    int m1, m2, d1, d2;
    cin >> m1 >> d1;
    cin >> m2 >> d2;
    if (m1 != m2) {
        cout << 1 << endl;
        return 0;
    }
    cout << 0 << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <list>
#include <algorithm>
#include <complex>
using namespace std;
double PI = 3.141592653589793238462643383279502884L;
const double EPS = 1e-10;
typedef complex<double> P;
inline bool eql(double a, double b) { return abs(b - a) < EPS; }
inline bool eql(P a, P b) { return eql(a.real(), b.real()) && eql (a.imag(), b.imag());}
inline P unit(P a) { return a/abs(a); }
inline P o15n(P a) { return a * P(0, 1); }
inline double dot(P a, P b) { return a.real()*b.real() + a.imag()*b.imag(); }
inline double cross(P a, P b) { return a.real()*b.imag() - a.imag()*b.real(); }
inline bool orthogp(P a, P b) { return eql(dot(a, b), 0.0); }
inline bool parap(P a, P b) { return eql(cross(a, b), 0.0); }
inline bool onlinep(P start, P end, P p) { return parap(end - start, p - start); }
inline bool onsegp(P start, P end, P p) { return abs(p-start)+abs(end-p) < abs(end-start)+EPS; }
inline double distance(P start, P end, P p) { return abs(cross(end-start, p-start))/abs(end-start); }
inline double distseg(P start, P end, P p) {
  if (dot(end-start, p-start) < EPS) return abs(p-start);
  else if (dot(start-end, p-end) < EPS) return abs(p-end);
  else return distance(start, end, p);
}
inline bool leftp(P start, P end, P p) { return cross(end-start, p-start) < EPS; }
inline bool rightp(P start, P end, P p) { return leftp(end, start, p); }
inline bool intersectp(P as, P ae, P bs, P be) {
  return (leftp(as, ae, bs) && rightp(as, ae, be))
         || (leftp(as, ae, be) && rightp(as, ae, bs));
}
inline bool intersectporig(P as, P ae, P bs, P be) {
  return (cross(ae-as, bs-as)*cross(ae-as, be-as) < EPS)
         && (cross(be-bs, as-bs)*cross(be-bs, ae-bs) < EPS);
}
inline P intersection(P as, P ae, P bs, P be) {
  double das = distance(bs, be, as);
  double dae = distance(bs, be, ae);
  return as + (ae-as)*dae/(das+dae);
}
typedef vector<int> vi;
const int INF = 1e9+7;
#define all(c) (c).begin(), (c).end()
#define tr(c, i) for(auto i = (c).begin(); i != (c).end(); i++)
#define rep(i, n) for(auto i=0;i<(n);i++)
#define pb push_back
#define sz(c) int((c).size())

typedef vector<P> vp;
vp v;

int EnclosePins()
{
  int outside = 0;
  for (int i = 0; i < sz(v); i++) {
    for (int j = 0; j < sz(v); j++) {
      if (i == j)
        continue;
      bool flag = true;
      for (int k = 0; k < sz(v); k++) {
        if (i == k || j == k)
          continue;
        flag = flag && leftp(v[i], v[j], v[k]);
        if (!flag)
          break;
      }
      if (flag) {
        outside++;
        break;
      }
    }
  }
  return sz(v) - outside;
}

int main(int argc, char **argv)
{
  int n;
  double x, y;
  char c;

  for (;;) {
    cin >> n;
    if (!n)
      break;
    v.clear();
    for (int i = 0; i < n; i++) {
      cin >> x >> c >> y;
      v.pb(P(x, y));
    }
    cout << EnclosePins() << endl;
  }
  return 0;
}

Measured memory_bytes: 1248
#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>;

const int mod = 2019;

int main() {
    int k;
    cin >> k;
    int ans = 0;
    for (int i = 1; i <= k; i++) {
        for (int j = 1; j <= k; j++) {
            for (int l = 1; l <= k; l++) {
                ans += __gcd(i,__gcd(j,l));
            }
        }
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;

int main(){
    int m,k;
    cin >> m >> k;
    if(k>=(1<<m)){
        cout << -1 << endl;
        return 0;
    }
    if(m==1){
        if(k==1){
            cout << -1 << endl;
        }
        else{
            cout << "0 0 1 1" << endl;
        }
        return 0;
    }
    vector <int> ans(1<<(m+1));
    int cur=0;
    for(int i=0;cur<(1<<m);){
        if(cur!=k){
            ans[i]=cur;
            ans[ans.size()-2-i]=cur;
            i++;
        }
        cur++;
    }
    ans[(1<<m)-1]=k;
    ans.back()=k;
    for(int i=0;i<ans.size();i++){
        cout << ans[i] << " ";
    }
    cout << endl;
    return 0;
}


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

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

    int h, w, k;
    cin >> h >> w >> k;
    vector<string> c(h), t(h);
    for (int i = 0; i < h; i++) cin >> c[i];

    int ans = 0;
    for (int m1 = 0; m1 < (1 << h); m1++) {
        for (int m2 = 0; m2 < (1 << w); m2++) {
            for (int i = 0; i < h; i++) t[i] = c[i];
            for (int i = 0; i < h; i++) {
                if (m1 & (1 << i)) {
                    for (int j = 0; j < w; j++) t[i][j] = 'R';
                }
            }
            for (int i = 0; i < w; i++) {
                if (m2 & (1 << i)) {
                    for (int j = 0; j < h; j++) t[j][i] = 'R';
                }
            }
            int cnt = 0;
            for (int i = 0; i < h; i++) {
                for (int j = 0; j < w; j++) cnt += t[i][j] == '#';
            }
            if (cnt == k) ans++;
        }
    }
    cout << ans << '\n';
}

Measured memory_bytes: 3644
#include<stdio.h>

int main(){
  int n1, n2;
  int temp;

  while(1){
    scanf("%d %d", &n1, &n2);

    if(n1 == 0 && n2 == 0) break;

    if(n1 > n2){
      temp = n1;
      n1 = n2;
      n2 = temp;
    }

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



Measured memory_bytes: 1928
def main():
    N, D = map(int, input().split())
    XY = []
    ans = 0
    for i in range(N):
        X, Y = map(int, input().split())
        if X*X+Y*Y<=D*D:
            ans += 1
    
    print(ans)

if __name__ == '__main__':
    main()

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

typedef long long ll;
typedef pair<int, int> pii;
int N;
vector<pii> S;
multiset<ll> L, R;
ll C, lp, rp;

int main() {
    scanf("%d", &N);
    S.resize(N);
    for(int i = 0; i < N; i++) {
        scanf("%d %d", &S[i].first, &S[i].second);
    }
    L.insert(-S[0].first);
    R.insert(S[0].first);
    C = lp = rp = 0;
    for(int i = 1; i < N; i++) {
        int plen = S[i - 1].second - S[i - 1].first;
        int clen = S[i].second - S[i].first;
        ll x = S[i].first;

        lp += clen;
        rp += plen;

        if(-lp - *L.begin() <= x && x <= rp + *R.begin()) {
            L.insert(-lp - x);
            R.insert(-rp + x);
        }
        else if(x < -lp - *L.begin()) {
            ll tx = -lp - *L.begin();
            L.erase(L.begin());
            L.insert(-lp - x);
            L.insert(-lp - x);
            R.insert(-rp + tx);
            C += tx - x;
        }
        else if(rp + *R.begin() < x) {
            ll tx = rp + *R.begin();
            R.erase(R.begin());
            R.insert(-rp + x);
            R.insert(-rp + x);
            L.insert(-lp - tx);
            C += x - tx;
        }
    }
    printf("%lld", C);
}


Measured memory_bytes: 10368
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int A, B, C;
  
  cin >> A >> B >> C;
  
  if((A==5&&B==5&&C==7)||(A==5&&B==7&&C==5)||(A==7&&B==5&&C==5))
  {
    cout << "YES" << endl;
  }
  else
  {
    cout << "NO" << endl;
  }
  
  return 0;
}

Measured memory_bytes: 384
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
using ll = long long;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
#define REP(var, a, b) for (int var = (a); var < (b); var++)
#define rep(var, n) for (int var = 0; var < (n); ++var)
#define ALL(c) (c).begin(), (c).end()
#define rALL(c) (c).rbegin(), (c).rend()
ll MOD = 1000000007;
const ll INF = 1LL << 60;

int main() {
  //
  vl t(5);
  rep(i, 5) cin >> t[i];
  vl id(5);
  rep(i, 5) id[i] = i;
  ll ans = INT_MAX;
  do {
    ll cur = 0;
    rep(i, 5) {
      cur += t[id[i]];
      if (i < 4 && cur % 10) {
        cur = (cur / 10 + 1) * 10;
      }
      // cerr << cur << " ";
    }
    // cerr << endl;
    ans = min(ans, cur);
  } while (next_permutation(ALL(id)));
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
N = int(input())

def dist(A, B):
    return abs(A[0] - B[0]) + abs(A[1] - B[1])

XY = [tuple(map(int, input().split())) for _ in range(N)]
INF = -10**10

ans = 0
for O in [(INF, INF), (-INF, INF), (INF, -INF), (-INF, -INF)]:
    S = XY[0]
    for xy in XY:
        if dist(O, S) < dist(O, xy):
            S = xy
    O = S
    for xy in XY:
        if dist(O, S) < dist(O, xy):
            S = xy
    ans = max(ans, dist(O, S))
print(ans)



Measured memory_bytes: 36048
#include <algorithm>
#include <array>
#include <assert.h>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;
typedef long long ll;
typedef long double ld;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define sz(x) ((int)(x).size())
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ld> vld;
typedef vector<vector<int>> vvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<ld>> vvd;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;


int main() {
    cout << setprecision(30);
    ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);

    ll n;
    cin >> n;
    cout << (3 * n * n) << endl;


    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
 
int main(){
 
  int N, K, P, ans=0;
 vector<int> p;
  
  cin >> N >> K;
  
  for(int i=0; i<N; i++){
   
    cin >>P;
    
    p.push_back(P);
    
  }
  
  sort(p.begin(), p.end());
  
   for(int i=0; i<K; i++){
   
    ans+=p[i];
    
    p.push_back(P);
    
  }

  cout << ans;

  
  return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int inf = INT_MAX;
const ll INF = LLONG_MAX;
const ll MOD = 1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b, const ll mod=MOD) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b, const ll mod=MOD) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b, const ll mod=MOD) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b, const ll mod=MOD) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n, A, B; cin >> n >> A >> B;
    cout << min(A * n, B) << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int d;
  cin >> d;
  string msg;
  switch (d) {
    case 25:
      msg = "Christmas";
      break;
    case 24:
      msg = "Christmas Eve";
      break;
    case 23:
      msg = "Christmas Eve Eve";
      break;
    case 22:
      msg = "Christmas Eve Eve Eve";
      break;

    default:
      break;
  }
  cout << msg << endl;
  return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;
class Program
{
    static void Main(string[] args)
    {
        string[] s = Console.ReadLine().Split();
        int[] h = new int[int.Parse(s[0])];
        int K = int.Parse(s[1]);
        for(int i = 0; i< h.Length; i++)
        {
            h[i] = int.Parse(Console.ReadLine());
        }
        Array.Sort(h);
        int min = int.MaxValue;
        for (int i = 0; i <= h.Length - K; i++)
        {
            int v = h[i + K - 1] - h[i];
            if (v < min)
                min = v;
        }
        Console.WriteLine(min);
    }
}

Measured memory_bytes: 15452
#include <iostream>
#include <algorithm>
#include<string>
#include<cmath>
#include<stack>
#include <vector>
#include<queue>
#include <random>
#include <cstdint>
#include <bitset>
#include <iomanip>
#include<utility>
using namespace std;
using ll = long long;


int main() {
	ll n, m, a[100001],ans=0;
	cin >> n >> m;
	a[0] = 0;
	for (int i = 1; i < n+1; i++) {
		cin >> a[i];
		a[i] += a[i - 1];
		a[i] %= m;
	}
	sort(a, a + n+1);
	ll memo = a[0], count = 1;
	for (int i = 1; i < n+1; i++) {
		if (a[i] == memo)count++;
		else {
			ans += (count * (count - 1)) / 2;
			count = 1;
			memo = a[i];
		}
	}
	ans += (count * (count - 1)) / 2;
	cout << ans << endl;
	return 0;
}


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

void A()
{
  int K, A, B;
  cin >> K >> A >> B;
  
  for( int i = A/K; i < B/K+1; ++i ){
  	if( A <= K*i && K*i <= B ){
      cout << "OK" << endl;
      return;
    }
  }

  cout << "NG" << endl;
}

int main()
{
  A();
  
  return 0;
}


Measured memory_bytes: 3624
/*
**    author : dhiraj govindvira
**      date : 20-Sep-2020 ~ Sunday
**      time : 10:11:57 AM
*/

#ifdef Dhiraj
    #include "D:/dhiraj/Programming/debug.h"
#else
    #include <bits/stdc++.h>
    using namespace std;
    #define d(...) 11
    #define cerr if(0) cerr
#endif

// Macro --------------------------------------------------------------------

#define ll                  long long int
#define FOR(i, a, b, s)     for(ll i = (a); ((s) > 0 ? i < (b) : i > (b)); i += (s))
#define FOR1(b)             FOR(i, 0, b, 1)
#define FOR2(i, b)          FOR(i, 0, b, 1)
#define FOR3(i, a, b)       FOR(i, a, b, (a) <= (b) ? 1 :-1)
#define FOR4(i, a, b, s)    FOR(i, a, b, s)
#define GET5(a, b, c, d, e, ...) e
#define FORC(...)           GET5(__VA_ARGS__, FOR4, FOR3, FOR2, FOR1)
#define loop(...)           FORC(__VA_ARGS__)(__VA_ARGS__)
#define all(x)              (x).begin(), (x).end()
#define rall(x)             (x).rbegin(), (x).rend()
#define endl                '\n'

// Template -----------------------------------------------------------------

// multiple input
template <typename... T> 
inline void inp(T&... args) {
    ((cin >> args), ...);
}
// scan vector
template <typename T> 
inline istream& operator >>(istream &in, vector<T> &a) {
    for(auto &x : a) in >> x;
    return in;
}
// scan pair
template <typename T, typename U> 
inline istream& operator >>(istream &in, pair<T, U> &a) {
    in >> a.first >> a.second; 
    return in;
}

// Solve --------------------------------------------------------------------

void solve(int &T)
{
    string s;
    cin >> s;

    if(s.back() == 's') s += "es";
    else s += "s";
    cout << s << endl;
}

// Main ---------------------------------------------------------------------

int main()
{
    #ifdef Dhiraj
        freopen("D:/dhiraj/Programming/i1.txt", "r", stdin);
        freopen("D:/dhiraj/Programming/o1.txt", "w", stdout);
        // freopen("D:/dhiraj/Programming/e1.txt", "w", stderr);
    #endif

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

    int t = 1;
    for(int i = 1; i <= t; i++) {
        cerr << "Case #" << i << "\n";
        solve(i);
    }
    return 0;
}

Measured memory_bytes: 3620
#include <stdio.h>
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <map>

//#include <bits/stdc++.h>
using namespace std;
#define print(x) cout<<(x)<<endl
#define prints(x, y) cout<<(x)<<" "<<(y)<<endl
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define r_rep(i, n) for(int i = (int)n-1; i >= 0; i--)
#define ll long long int
#define pb push_back
const long long MOD = 1000000007;
const long long INF = 1LL << 60;

string format(int num){
  string str_num = "";
  if (num >= 100)  str_num += to_string(num);
  else if (num >= 10) str_num +=  "0" + to_string(num);
  else str_num +=  "00" + to_string(num);
  return str_num;
}

int main() {
  int N, ans = 0;
  string s;
  cin >> N >> s;
  int num = 0;
  bool flag = false;

  while(num < 1000){
    string n_s = format(num);
    flag = false;
    int j = 0;
    rep(i, N){
      if(s[i] == n_s[j]) j++;
      if (j == 3) {
        flag = true;
        break;
      }
    }
    if(flag) ans++;
    num++;
  }
  
  print(ans);
  return 0;
}


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

using namespace std;

inline void Boost() {
	ios::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
}
typedef long long int ll;
typedef long double ld;


int main() {
	Boost();

	ll x, y;
	cin >> x >> y;

	ll a;
	a = x;
	int ops = 1;
	for(int ops = 1; ops <= 100000; ++ops) {
		if(a % y == 0) {
			a += x;
		}  else {
			cout << a;
			exit(0);
		}
	}
	cout << -1;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>

using namespace std;
#define ll long long
#define MOD 1000000007
#define INF (int)1e9
#define EPS 1e-9
/*
	A. AC or WA
*/

int main(){
	ll n,m;
	cin>>n>>m;
	if(m==n){
		cout<<"Yes";
		return 0;
	}
	else{
		cout<<"No";
		//return 0;
	}
    return 0;
}



Measured memory_bytes: 256
#pragma region
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue> 
#include <stack>
#include <set>
#include <list>

using namespace std;
typedef long long ll;
//#define rep(i, s, e) for (int(i) = (s); (i) < (e); ++(i))
#define rep(i, e) for (int(i) = 0; (i) < (e); ++(i))
#define all(x) x.begin(),x.end()
#pragma endregion


int main()
{
	int a, b; cin >> a >> b;
	string s = to_string(min(a, b));
	int c = max(a, b);
	rep(i, c)cout << s;
}


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


int main()
{
	string s;

	while (cin >> s)
	{
		if (s == "0") return 0;

		int sum = 0;
		for (char c : s)
		{
			sum += (c - '0');
		}
		cout << sum << endl;
	}
	return 0;
}

Measured memory_bytes: 3176
#include <bits/stdc++.h>
typedef long long LL;
const int maxn =  2e5+5;
using namespace std;
LL q,mid,psz,sum;
LL sumofs,sumofb;
int arr[maxn];
priority_queue<int>q1;
priority_queue<int>q2;

int main() {
	scanf("%lld",&q);
	while (q--) {
		int op,a,b;
		scanf("%d",&op);
		if (op == 1) {
			scanf("%d%d",&a,&b);
			psz++; sum+=b;
			if (psz == 1) mid = a;
			else{
				if (a > mid) {
					q2.push(-a);
					sumofb += a;
				} else {
					q1.push(a);
					sumofs += a;
				}
				while (1) {
					if (q1.size() > q2.size()) {
						sumofs -= q1.top();
						sumofb += mid;
						q2.push(-mid);
            			mid=q1.top();
            			q1.pop();
					}else if (q1.size()+1 < q2.size()) {
						sumofb += q2.top();
						sumofs += mid;
						q1.push(mid);
            			mid=-q2.top();
            			q2.pop();
					}else{
						break;
					}
				}
			}
			arr[psz] = a;
		}else{
			LL sofa = mid*(LL)q1.size()-sumofs+sumofb-mid*(LL)q2.size();
			sofa+=sum;
			printf("%lld %lld\n",mid,sofa);
		}
	}
}

/*
	while(q1.size() != q2.size()){
        if(q1.size() > q2.size()){
           	q2.push(-mid);
            mid=q1.top();
            q1.pop();
        }else{
            q1.push(mid);
            mid=-q2.top();
            q2.pop();
        }
    }
    */ 

Measured memory_bytes: 5108
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author lstd
 */

#include <iostream>
#include <fstream>

#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <bitset>
#include <random>
#include <chrono>
#include <complex>
#include <algorithm>
#include <utility>
#include <functional>
#include <cmath>
#include <cstring>
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <ctime>

using namespace std;

#define sqr(x) ((x)*(x))
#define mp make_pair
#define pb push_back
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define RE(i, n) FOR(i,1,n)
#define REP(i,n) FOR(i, 0, (int)(n)-1)
#define fst first
#define snd second

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
typedef long double ld;

string to_string(string s) {
    return '"' + s + '"';
}

string to_string(const char* s) {
    return to_string((string) s);
}

string to_string(bool b) {
    return (b ? "true" : "false");
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
    return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A>
string to_string(A v) {
    bool first = true;
    string res = "{";
    for (const auto &x : v) {
        if (!first) {
            res += ", ";
        }
        first = false;
        res += to_string(x);
    }
    res += "}";
    return res;
}



void debug_out() { cerr << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << to_string(H);
    debug_out(T...);
}

int XMOV[4] = {0, 0, 1, -1};
int YMOV[4] = {1, -1, 0, 0};

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

using namespace std;

int gcd(int a, int b){
	int mn = min(a,b);
	int mx = max(a,b);
	a = mn;
	b = mx;
	if (a == 0)
		return b;
	return gcd(b%a, a);
}

class CGCDOnBlackboard {
public:
	void solve(std::istream& in, std::ostream& out) {
		int n;
		in >> n;
		int x;
		vector<int> a, l, r;
		REP(i,n)
			in >> x, a.pb(x);
		l.assign(n+1, 0);
		r.assign(n+1, 0);
		l[0] = a[0];
		r[n-1] = a[n-1];
		for(int i = 1; i < a.size(); i++){
			int aux = l[i-1];
			l[i] = gcd(a[i], aux);
		}

		for(int i = n-2; i >= 0; i--){
			r[i] = gcd(a[i], r[i+1]);
		}

		int ans = max(l[n-2], r[1]);
		for(int i = 1; i < n; i++){
			ans = max(ans, gcd(l[i-1], r[i+1]));
		}
		out << ans;
	}
};

int main() {
	CGCDOnBlackboard solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}

Measured memory_bytes: 1528
#include <iostream>
#include <cassert>
#include <algorithm>
#include <functional>
#include <vector>


using namespace std;

int main()
{
  int N,M; cin >> N >> M;
  
  vector<pair<int,int>> ky(M);
  for(int i=0;i<M;++i)
  {
    int a,b; cin >> a >> b;
    ky[i].first  = 0;
    ky[i].second = a;
    
    for(int j=0;j<b;++j)
    {
      int c; cin >> c; --c;
      ky[i].first |= (1 << c);
    }
  }
  
  vector<int> dp(1<<N,-1);
  dp[0]=0;
  for(int i=0;i<(1<<N);++i)
  {
    for(int j=0;j<M;++j)
    {
      int k = (i | ky[j].first);
      if(dp[i]==-1){continue;}
      if(dp[k]==-1)
      {
        dp[k]=dp[i]+ky[j].second;
        continue;
      }
      dp[k] = min(dp[k],dp[i]+ky[j].second);
    }
  }
  
  cout << dp[(1<<N)-1] << endl;
}

Measured memory_bytes: 256