akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

// iterator
#define REP(i,init, n) for(lli i=init;i<n;i++)
#define REPE(i,init, n) for(lli i=init;i<=n;i++)
#define REPIT(it,container) for(auto it = container.begin(); it != container.end(); it++)
#define REPIT_R(it,container) for(auto it = container.rbegin(); it != container.rend(); it++)

// input
#define cin1(x)             cin >> x
#define cin2(x, y)          cin >> x >> y
#define cin3(x, y, z)       cin >> x >> y >> z
#define ncin1(n, x)         REP(i, 0, n) {cin1(x[i]);}
#define ncin2(n, x, y)      REP(i, 0, n) {cin2(x[i], y[i]);}
#define ncin3(n, x, y, z)   REP(i, 0, n) {cin3(x[i], y[i], z[i]);}

// output
#define cout1(x)         cout << #x << ": " << x << endl;
#define ncout1(n, x)     REP(i, 0, n) {cout << #x << "[" << i << "]: "<< x[i] << endl;}

// sort
#define sort_r(x, y)        sort(x, y, greater<lli>()); // 降順(5,4,3,,,)

#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))

typedef long long int lli;
typedef pair<lli, lli> P;


bool state[100001][31];

int main() {
    lli N, C;
    cin2(N, C);
    lli s[N], t[N], c[N];
    lli min_t = LLONG_MAX, max_t = 0;
    REP(i, 0, N) {
        cin >> s[i] >> t[i] >> c[i];
        min_t = min(min_t, t[i]);
        max_t = max(max_t, t[i]);
    }

    REP(i, 0, N) {
        for (lli j = s[i]; j <= t[i]; j++ ) {
            state[j][c[i]] = true;
        }
    }

    lli ans = 0;
    REPE(i, min_t, max_t) {
        lli count = 0;
        REPE(j, 1, 30) {
            if (state[i][j])
                count++;
        }
        ans = max(ans, count);
    }
    cout << ans << endl;
}


Measured memory_bytes: 5632
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define INF pow(10,9)
int main(void){
    ll n,k;
    cin >> n >> k;
    vector<ll> h(n);
    for(ll i=0;i<n;i++){
        cin >> h[i];
    }
    sort(h.begin(),h.end());
    ll ans = INF;
    for(ll i=0;i<=n-k;i++){
        ll tmp = (h[i+k-1]-h[i]);
        if(tmp<ans){
            ans = tmp;
        }
        // cout << ans << endl;
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
{-# LANGUAGE BangPatterns #-}
import Control.Monad
import Data.Word
import qualified Data.ByteString.Char8 as BS
import Data.Array.Unboxed
import Data.Array.ST

-- Input: s t
-- Output: arr
--   arr ! (i,j) == length of lcs of (drop i s, drop j t)
lcsTable2 :: BS.ByteString -> BS.ByteString -> UArray (Int,Int) Word16
lcsTable2 !s !t = runSTUArray $ do
  let !m = BS.length s
      !n = BS.length t
  !arr <- newArray ((0,0),(m,n)) 0
  forM_ [m-1,m-2..0] $ \ !i -> do
    let !x = BS.index s i
    forM_ [n-1,n-2..0] $ \ !j -> do
      let !y = BS.index t j
      if x == y
        then do l2 <- readArray arr (i+1, j+1)
                writeArray arr (i,j) (l2 + 1)
        else do l0 <- readArray arr (i+1, j)
                l1 <- readArray arr (i, j+1)
                writeArray arr (i,j) (max l0 l1)
  return arr

main = do
  !s <- BS.getLine
  !t <- BS.getLine
  -- BS.length s <= 3000, BS.length t <= 3000, BS.all isAsciiLower s, BS.all isAsciiLower t
  let !table = lcsTable2 s t
      !m = BS.length s
      !n = BS.length t
  let recon !i !j | i >= m || j >= n = Nothing
                  | x == y = let !i' = i+1 ; !j' = j+1
                             in Just (x, (i', j'))
                  | table ! (i+1,j) >= table ! (i,j+1) = recon (i+1) j
                  | otherwise = recon i (j+1)
        where x = BS.index s i
              y = BS.index t j
      (result, _) = BS.unfoldrN (fromIntegral $ table ! (0,0)) (\(!i,!j) -> recon i j) (0,0)
  BS.putStrLn result


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

using namespace std;

int main()
{
    char s[1024], type[2];
    
    while (scanf("%s %s", s, type) && type[0] != 'X'){
        char t[1024];
        int resLen = 0;
        
        memset(t, 0, sizeof(t));
        
        for (int i = 0; s[i]; i++){
            if (i == 0){
                if (type[0] == 'U') t[resLen++] = toupper(s[i]);
                else t[resLen++] = tolower(s[i]);
            }
            else {
                if (islower(s[i])){
                    if (s[i - 1] == '_' && type[0] != 'D') t[resLen++] = toupper(s[i]);
                    else t[resLen++] = s[i];
                }
                else if (isupper(s[i])){
                    if (type[0] != 'D') t[resLen++] = s[i];
                    else {
                        t[resLen++] = '_';
                        t[resLen++] = tolower(s[i]);
                    }
                }
                else {
                    if (type[0] == 'D') t[resLen++] = s[i];
                }
            }
        }
        
        printf("%s\n", t);
    }
    
    return (0);
}

Measured memory_bytes: 1108
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int k = sc.nextInt();
		int[] a = new int[k];
		for(int i=0;i<k;i++) {
			a[i]=sc.nextInt();
		}
		
		long max = 2;
		long min = 2;
		
		
		for (int i=k-1;i>=0;i--) {
			max = (long)Math.floor((double)max/a[i])*a[i]+a[i]-1;
			min = (long)Math.ceil((double)min/a[i])*a[i];
			
		}
		
		if (max<min) {
			System.out.println(-1);
		} else {
			System.out.println(min+" "+max);
		}
	}

}


Measured memory_bytes: 50748
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <regex>
#define REP(i,n) for(int i = 0; i < n; i++)
#define FOR(i,j,n) for(int i = j; i < n; i++)
#define RFOR(i,j,n) for(int i = j-1; i >= n; i--)
#define PREC(n) fixed << setprecision(n)
#define print_array(v) REP(__k, v.size()) { cout << v[__k]; if(__k != v.size()-1) cout << " "; else cout << endl; }
#define YesorNo(a) printf(a?"Yes\n":"No\n")
#define _LIBCPP_DEBUG 0
using namespace std;
int64_t MOD = 1000000007;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  cout << 1110 - n << endl;
  return 0;
}
//templete by private_yusuke

Measured memory_bytes: 256
at = list(input())
at_i = 0
top_i = 0
if at[0] =='H':
  at_i = 1

if at[0] == 'D':
  at_i = -1

if at[2] == 'H':
	top_i = 1

if at[2] == 'D':
  top_i = -1

if top_i * at_i == 1:
    print("H")
else :
    print("D")


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




int main()
{
	int a,b,c;
	cin>>a>>b>>c;
	if(b<a) swap(a,b);
	if(c<b) swap(b,c);
	int k1=c-a,k2=c-b;
	if((k1%2==0&&k2%2==0)||(k1%2!=0&&k2%2!=0))
		cout<<(k1+k2)/2;
	else
	{
		k1++;
		cout<<(k1+k2)/2+1;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    cin.tie(0);ios::sync_with_stdio(false);
    
    int n;
    cin >> n;
    
    vector<pair<pair<string,int>,int>> rs(n);
    for(int i = 0 ; i < n;++i){
        cin >> rs[i].first.first >> rs[i].first.second;
        rs[i].first.second *= -1;
        rs[i].second = i+1;
    }
    
    sort(rs.begin(),rs.end());
    
    for(const auto &r : rs)
        cout << r.second <<'\n';
    
    return 0;
}


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

using namespace std;
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
#define REP(i,n) for(ll i = 0;i < (ll)n;i++)
#define REPD(i,n) for(ll i = (ll)n - 1;i >= 0;i--)
#define ALL(x) (x).begin(),(x).end()
#define FILLl(n,first_dimension_size,value) fill((ll*)n,(ll*)(n+first_dimension_size),value)
#define FILL(n,first_dimension_size,value) fill((int*)n,(int*)(n+first_dimension_size),value)
#define INF (1 << 29)
#define MOD 1000000007
//int dx[4] = {1,0,0,-1};
//int dy[4] = {0,1,-1,0};


int main(){

  int l;
  cin >> l;
  double d = l/3.0;
  long double res = d*d*d;
  cout << fixed << setprecision(15);
  cout << res << endl;



  return 0;
}


Measured memory_bytes: 256
#define  _CRT_SECURE_NO_WARNINGS
#pragma comment (linker, "/STACK:526000000")

#include "bits/stdc++.h"

using namespace std;
typedef string::const_iterator State;
#define eps 1e-11L
#define MAX_MOD 1000000007LL
#define GYAKU 500000004LL

#define MOD 998244353LL
#define seg_size 262144*2LL
#define pb push_back
#define mp make_pair
typedef long long ll;
#define REP(a,b) for(long long (a) = 0;(a) < (b);++(a))
#define ALL(x) (x).begin(),(x).end()

unsigned long xor128() {
	static unsigned long x = 123456789, y = 362436069, z = 521288629, w = time(NULL);
	unsigned long t = (x ^ (x << 11));
	x = y; y = z; z = w;
	return (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)));
}

void init() {
	iostream::sync_with_stdio(false);
	cout << fixed << setprecision(20);
}

#define int ll
void solve() {
	string s, t;
	cin >> s >> t;
	if (s.length() == 1) {
		cout << "Yes" << endl;
		return;
	}
	{
		int now = -1;
		for (int i = 1; i < s.length(); i += 2) {
			while (true) {
				now++;
				if (now >= t.length()) break;
				if (s[i] == t[now]) break;
			}
		}
		if (now < t.length()) {
			cout << "Yes" << endl;
			return;
		}
	}
	{
		int now = -1;
		for (int i = 0; i < s.length(); i += 2) {
			while (true) {
				now++;
				if (now >= t.length()) break;
				if (s[i] == t[now]) break;
			}
		}
		if (now < t.length()) {
			cout << "Yes" << endl;
			return;
		}
	}
	cout << "No" << endl;
}

#undef int
int main() {
	init();
	solve();
}


Measured memory_bytes: 3236
#include<iostream>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <iomanip>//setprecision
#include<math.h>
#include <functional>
#include<climits>
using namespace std;
#define ll  long long 
#define rep(i, n)        for(ll i=0; i<(ll)(n); ++i)
#define mod 1000000007
  vector<ll>to[1000005];
int main(){
  ll a;cin>>a;
  string b,c;cin>>b>>c;
  for(ll i=0;i<a;i++){
    string d=b.substr(i,a),e=c.substr(0,a-i);
    if(d==e)
    {
      cout<<a+i;
      return 0;
    }
  }
  cout<<a*2;
}


Measured memory_bytes: 27036
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
char a[60],b[60];
int lena,lenb,lenn,lenx;
int main()
{
	cin>>a>>b;
	lena=strlen(a);
	lenb=strlen(b);
	lenn=min(lena,lenb);
	lenx=max(lena,lenb);
	for(int i=0;i<=lenn-1;i++)
	  cout<<a[i]<<b[i];
	if(lena>lenb)
	  for(int i=lenn;i<=lenx-1;i++)
		cout<<a[i];
	else for(int i=lenn;i<=lenx-1;i++)
			cout<<b[i];
	cout<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
// Welcome to my source code!

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

int calc(int p) {
    if (p & 1) {
        int t = p / 2 + 1;
        return p / 2 * (1 + p) + t;
    } else {
        return p / 2 * (1 + p);
    }
}

int main() {
    int n, k;
    cin >> n >> k;
    int p[n];
    for (int i = 0; i < n; i++) cin >> p[i];
    double t[n], cs[n];
    for (int i = 0, tmp; i < n; i++) {
        tmp = calc(p[i]);
        t[i] = (double)tmp / p[i];
        if (i == 0) cs[i] = t[i];
        else cs[i] = cs[i - 1] + t[i];
    }
    double ans = 0, tmp = 0;
    for (int i = 0; i < n - k + 1; i++) {
        tmp = cs[i + k - 1];
        if (i > 0) tmp -= cs[i - 1];
        chmax(ans, tmp);
    }
    cout << fixed << setprecision(8) << ans << endl;
}

Measured memory_bytes: 4096
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <utility>
using ll=long long;
using namespace std;

int main(){
    int H,W,M;
    cin>>H>>W>>M;
    vector<int> yoko(H,0);
    vector<int> tate(W,0);
    set<pair<int,int>> tar;
    int a,b;
    for(int i=0;i<M;i++){
        cin>>a>>b;
        a--,b--;
        tar.insert({a,b});
        yoko[a]++;
        tate[b]++;
    }
    /*
    for(auto p:yoko){
        cout<<p<<" ";
    }
    cout<<endl;
    for(auto p:tate){
        cout<<p<<" ";
    }
    cout<<endl;
    //*/
    int tmax=0,ymax=0;
    vector<int> tatemax;
    vector<int> yokomax;
    for(int i=0;i<H;i++){
        if(yoko[i]>ymax){
            ymax=yoko[i];
        }
    }
    for(int i=0;i<H;i++){
        if(yoko[i]==ymax){
            yokomax.push_back(i);
        }
    }
    for(int i=0;i<W;i++){
        if(tate[i]>tmax){
            tmax=tate[i];
        }
    }
    for(int i=0;i<W;i++){
        if(tate[i]==tmax){
            tatemax.push_back(i);
        }
    }
    //cout<<tmax<<" "<<ymax<<endl;
    int ans=tmax+ymax;
    if(tatemax.size()*yokomax.size()>M){
        cout<<ans<<endl;
        return 0;
    }
    int flag=0;
    for(int i=0;i<yokomax.size();i++){
        for(int j=0;j<tatemax.size();j++){
            if(tar.find({yokomax[i],tatemax[j]})==tar.end()){
                //cout<<i<<" "<<j<<endl;
                flag=1;
                break;
            }
        }
    }
    if(flag){
        cout<<ans<<endl;
    }else{
        cout<<ans-1<<endl;
    }

    return 0;
}

Measured memory_bytes: 23780
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const ll mod = 1e9 + 7;

int main() {
    int N;
    cin >> N;
    ll ans = 0;
    for(int a = 1; a <= N; a++){
        for(int b = 1; b <= N; b++){
            for(int c = 1; c <= N; c++){
                ans += gcd(gcd(a, b), c);
            }
        }
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 3636
#include <stdio.h>

int main()
{ int a;
 scanf("%d",&a);
 if (a==25)
    printf("Christmas");
 if (a==24)
    printf("Christmas Eve");
 if (a==23)
    printf("Christmas Eve Eve");
    if (a==22)
    printf("Christmas Eve Eve Eve");

    return 0;
}



Measured memory_bytes: 128
n,k=map(int,input().split())
X=list(map(int,input().split()))
ans=10**20
for i in range(n-k+1):
    jikan=abs(X[i]-X[i+k-1])+min(abs(X[i]), abs(X[i+k-1]))
    ans=min(ans, jikan)
print(ans)

Measured memory_bytes: 14224
#include<bits/stdc++.h>                                                                              
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
 
#define pb push_back
#define PII pair<int,int>
 
#define VS vector<string>
#define VI vector<int>
#define ll long long int
#define debug(x) cout << x << " :" <<#x << endl  
int main(void) {
    int n, a, b;
    cin >> n >> a >>b;
    int asum = 0;
    REP(i, n) {
      int sum = 0;
      int k = i + 1;
      while(k > 0) {
        sum += k % 10;
        k = k / 10;
      }
      if(a <= sum && sum <= b) asum += i + 1;
    }
    cout << asum << endl;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
    int n;
    string a, b;
    int ap, bp;

    ap = 0; bp = 0;
    cin>>n;
    for (int i=0; i<n; ++i) {
        cin>>a>>b;
        if (a < b) {
            bp += 3;
        } else if (a > b) {
            ap += 3;
        } else {
            ap += 1;
            bp += 1;
        }
    }
    cout<<ap<<" "<<bp<<endl;

    return 0;
}



Measured memory_bytes: 3120
#include <iostream>

using namespace std;

int main(){
    int A, B;
    cin >> A >> B;

    if(13 <= A){
        cout << B << endl;
    }
    else if(6 <= A){
        cout << B / 2 << endl;
    }
    else {
        cout << "0" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
"""MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWO:,'..'xXWWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMO. .:kOo.,kNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMO. .lNWWo..lXMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
MNOxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxMMMMWKxoloxKWNc  .:xxd;  ,dxxxkXMXkxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxMM
MKc''''''''''''''''.  ..'''''.   .''''.  .''MMMWx..,:. .xXo''.  .''.  ..'';kMk;'''''.  .'.''.  .''''''.  ..''.   .''MM
MWNXNNNNNNNNNNNNNNNO' ;KNNNNNKo. cKNNNd. lXNMMMK; ,0Wx. :NWXXl .dNNO' ;KNNNWMWNNNNNXc .kNNNNx. cXNNNNNO' ;KNN0; 'ONNMM
MMMMMMMMMMMMMMMMMWM0' :NMMMMWMX: .OMWWx. oWMMMMWx. ';. .dNMWWo .xMM0' :NWWMMMMMMMMWWl .OMMMWk. lWWMMWM0' ;XMMX: ,KMMMM
MMMMMMWMWkccccccccc;. :NMWNNNKd. :XMMWx. oWMMMWKo. .',. .,ldx; .dMM0' :NMMMMMMMNNWMWl .OMMMWk. lWMMMMM0' ;XMMX: ,0MMMM
MMWXKNWMWxcc,. .;cc;. :XMk,''..'lKWMMWx. oWMNx:. .lONNKxl.     .xMM0' :NMMMMMM0:,oKO' ,KMMMMk. lWWNkoc,. .;::;. ,KMMMM
MMXc.lXMMWWWNd..xWM0' :NM0;  ;kXWMMMWNl  oWMK:.;xXWWMWXx:. ,c' .dMM0' :NMMMMMMKc. ...;kWMMMMk. lWWc .:;. .clc:. ,KMMMM
MWWx. lXMWMMMK, lWM0' :NMMNx'.,ldxxoc'   oWMWNKNWWWN0o' .:kNWo .dMM0' :NMMMMMMMNO;  ,OWWWMMMk. lWM' lXx. lNMMX: ,KMMMM
MMMWk'.,xKNX0c..kWM0' :NMMMMNkl;,'',:l:  oWMMMMMWMWO' 'l0WMWWo .xMM0' :NMMMMMMMMMNd. .oXWMMMk. lWMd.....;0WMMX: ,KMMMM
MMMMWKo'...'..:kWMM0' :NMMMMMMMWWNNWWWx. oWMMMMMMMMWOxXWMWMWWo .xMM0' :NMMMMMMMMMMMKl. ,kNMMk. lWMWKkxx0NMWMMX: ,KMMMM
MMMMMMMN0kxk0XNWMMWKl;xNMMMMMMMMMMMMWM0c;kWMMMMMMMMMMMWWMMMMWk;:OMMXl,dNMMMMMMMMMMMMWO; .dNM0c;kWWMMMMMMMMMMMNd,oXMMMM
MMMMMMMMWWMWMMMMMMMMMWWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWWMMWWMMWMMMMMMMMMMMMMMNkxKWMMWWMMMMMMMMMMMMMMWMMWMMMMM
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM"""


#				 Author: Udit "luctivud" Gupta @ https://www.linkedin.com/in/udit-gupta-1b7863135/					 #


import math;   		from collections import *
import sys;   		from functools import reduce
import time;   		from itertools import groupby

# sys.setrecursionlimit(10**6)

# def input()         : return sys.stdin.readline()
def get_ints()      : return map(int, input().strip().split())
def get_list()      : return list(get_ints())
def get_string()    : return list(input().strip().split())
def printxsp(*args) : return print(*args, end="")
def printsp(*args)  : return print(*args, end=" ")


DIRECTIONS = [(+0, +1), (+0, -1), (+1, +0), (+1, -1)] 
NEIGHBOURS = [(-1, -1), (-1, +0), (-1, +1), (+0, -1),\
              (+1, +1), (+1, +0), (+1, -1), (+0, +1)]



# MAIN >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

# for _test_ in range(int(input())): 
s = input()
if s[-1] == 's' :
	print(s+'es')
else:
	print(s+'s')






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

using namespace std;
using ll =long long;
using db = double;
using vll = vector<long long>;

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
#define che(a,string) cout<<"//"<<string <<"=="<<(a)<<"//" <<endl;
#define SORT(a) sort((a).begin(),(a).end())
#define rSORT(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define leftunique(a) {SORT(a);(a).erase(unique((a).begin(),(a).end()),(a).end());}
//leftuniqueは配列から同じ要素のものを取り除く 例 4 6 2 1 3 4 1 2 なら 1 2 3 4 6 になる
#define debug(x)  cout << #x << " = " << (x) << endl;
bool IsInt(double a){int b = a/1;if(a==b){return true;}else {return false;}}
bool coY() {cout <<"Yes"<<endl;}
bool coN(){cout <<"No"<<endl;}
const int mod = 1e9 + 7;
const ll INF = 1LL << 60;
//ここから書き始める

int main()
{
	cout <<setprecision(10);
	ll a, b;
	string sa, sb;
	cin >> a >> b >> sa >> sb;
	ll g = __gcd(a,b);
	string za,zb;
	for(int i = 0 ; i < a; i += a/g){
		za.push_back(sa[i]);
	}
	for(int i = 0 ; i < b; i += b/g){
		zb.push_back(sb[i]);
	}
	if(za!=zb){
		cout << -1 << endl;
	}else cout << a*b / g << endl;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+5;
int n,a[N],d[N],t[N<<2];
void build(int l,int r,int k)
{
    if(l==r){t[k]=d[l];return;}
    int m=l+r>>1;
    build(l,m,k<<1);build(m+1,r,k<<1|1);
    t[k]=max(t[k<<1],t[k<<1|1]);
}
int qmx(int l,int r,int k)
{
    if(l==r) return l;
    int m=l+r>>1;
    if(t[k<<1]>=t[k<<1|1]) return qmx(l,m,k<<1);
    return qmx(m+1,r,k<<1|1);
}
void fix(int l,int r,int k,int x,int v)
{
    if(l==r){t[k]-=v;return;}
    int m=l+r>>1;
    if(x<=m) fix(l,m,k<<1,x,v);
    else fix(m+1,r,k<<1|1,x,v);
    t[k]=max(t[k<<1],t[k<<1|1]);
}
vector<int>v,s;
priority_queue<int,vector<int>,greater<int> >q,del;
bool flag=false;
bool judge()
{
    v.push_back(s[0]);v.push_back(s[1]);v.push_back(s[2]);
    for(int i=0;i<v.size()-1;i++)
        if(a[v[i]]==v[i+1])
    {
        v.pop_back();v.pop_back();v.pop_back();
        return false;
    }
    flag=true;
    return true;
}
int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++) q.push(i);
    for(int i=1;i<=n;i++) scanf("%d",&a[i]),d[a[i]]++;
    if(n==2){printf("-1\n");return 0;}
    build(1,n,1);
    for(int i=1;i<=n;i++)
    {
        if(t[1]==n-i) v.push_back(qmx(1,n,1)),del.push(v.back());
        else
        {
            while(!del.empty()&&!q.empty()&&del.top()==q.top()) del.pop(),q.pop();
            if(v.size()==0||a[v.back()]!=q.top()) v.push_back(q.top()),q.pop();
            else
            {
                int s=q.top();q.pop();
                while(!del.empty()&&!q.empty()&&del.top()==q.top()) del.pop(),q.pop();
                if(q.size()==0) v.push_back(s);
                else
                {
                    v.push_back(q.top());q.pop();
                    q.push(s);
                }
            }
        }
        fix(1,n,1,v.back(),n);
        fix(1,n,1,a[v.back()],1);
    }
    s.push_back(v.back());v.pop_back();
    s.push_back(v.back());v.pop_back();
    s.push_back(v.back());v.pop_back();
    sort(s.begin(),s.end());
    while(!judge())
        if(!next_permutation(s.begin(),s.end())) break;
    if(!flag){printf("-1\n");return 0;}
    for(int i=0;i<v.size();i++)
        printf(i==v.size()-1?"%d\n":"%d ",v[i]);
}


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

std::vector<int> color;
std::vector<std::pair<int, int>> G[10000];
std::vector<int> d;
std::vector<int> p;
int INF = 1001001001;
int sum = 0;
std::priority_queue<std::pair<int, int>> que;

void dijkstra(int n){
    for(int i = 0; i < n; i++){
        color[i] = 0;
        d[i] = INF;
    }

    d[0] = 0;
    p[0] = -1;

    que.push(std::make_pair(0, 0));

    while(que.empty() != 1){
        std::pair<int, int> f = que.top();
        que.pop();
        int u = f.second;

        color[u] = 1;

        // if(d[u] < )

        for(int i = 0; i < G[u].size(); i++){
            std::pair<int, int> pair = G[u][i];
            if(color[pair.first] != 1){
                if(d[u] + pair.second < d[pair.first]){
                    d[pair.first] = d[u] + pair.second;
                    que.push(std::make_pair(d[pair.first] * (-1), pair.first));
                }
            }
        }

    }
    
    for(int i = 0; i < d.size(); i++){
        sum += d[i];
    }

}

int main(void){
    int n;
    int tmp1, tmp2;
    std::cin >> n;

    color.resize(n);
    d.resize(n);
    p.resize(n);

    int u, k, v;

    for(int i = 0; i < n; i++){
        std::cin >> u >> k;
        for(int j = 0; j < k; j++){
            std::cin >> tmp1 >> tmp2;
            G[u].push_back(std::make_pair(tmp1, tmp2));
        }
        
    }
    
    
    dijkstra(n);
    
    for(int i = 0; i < n; i++){
        std::cout << i << " " << d[i] << std::endl;
    }

    return 0;
}


Measured memory_bytes: 7996
import java.util.*;

public class Main {
    
    static int N;
    static int[] A;
    
    public static void main(String[] args) throws Exception {

        Scanner sc = new Scanner(System.in);
        
        N = sc.nextInt();
        A = new int[N];
        
        int ans = 0;
        for(int i = 0; i < N; i++){
            ans += sc.nextInt() - 1;
        }
        
        System.out.println(ans);
    }
}


Measured memory_bytes: 25816
N, K = map(int, input().split())
A = []
for _ in range(N):
    a, b = map(int, input().split())
    A.append((a, b))
A.sort(key=lambda x:x[0])
b_sum = 0
for a, b in A:
    b_sum += b
    if b_sum >= K:
        print(a)
        break

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

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

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

    int ans = 0;
    for (int i = 0; i < N; i++) {
        if (p[i] != i) continue;

        if (i + 1 < N) swap(p[i], p[i + 1]);
        else swap(p[i], p[i - 1]);
        ans++;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 640
import fractions
import sys
from functools import reduce
readline = sys.stdin.readline

def gcd(*numbers):
    return reduce(fractions.gcd, numbers)

a = list(map(int, readline().split()))
N = a[0]
X = a[1]
city = list(map(int, readline().split()))

cnt = 0
for i in range(N):
    city[i] -= X
    if city[i] < 0:
        city[i] = 0 - city[i]

print(str(gcd(*city)))

Measured memory_bytes: 16276
#include <iostream>
#include <set>
#include <vector>

#include <algorithm>


using namespace std;


int main() {
	int N;

	vector<int> va;
	vector<int> vb;

	cin >> N;
	for (int i = 0; i < N; i++)
	{
		int a, b;
		cin >> a >> b;

		va.push_back(a);
		vb.push_back(b);
		
	}


	if (N % 2 == 1) {//奇数

		sort(va.begin(), va.end());
		int min = va[(N + 1) / 2 -1];


		sort(vb.begin(), vb.end());
		int max = vb[(N + 1) / 2 -1];

		
		cout << max - min + 1;

	}
	else
	{

		sort(va.begin(), va.end());
		int min = va[(N) / 2 - 1];
		int min1 = va[(N) / 2];


		sort(vb.begin(), vb.end());
		int max = vb[(N) / 2 - 1];
		int max1 = vb[(N) / 2];

		int s = -1;
		if ((min + min1) % 2 == 1)s--;
		if ((max + max1) % 2 == 1)s++;

		min = (min + min1) / 2;
		max = (max + max1) / 2;

		cout << (max - min + 1)*2 +s;

	}


	return 0;

}

Measured memory_bytes: 5008
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <set>
#define fi first
#define se second
using namespace std;
const int maxn = 1e5 + 100;
typedef long long LL;
typedef pair<int, long long> PLI;
typedef pair<int, int> PII;
vector<PLI> G[maxn];
set<PII> S;
int son[maxn], sz[maxn];
int tree[maxn*4];
int n, tot;
LL ANS = 0, Min = 1e18;
void dfs0(int x, int fa){
    sz[x] = 1;
    for(auto e : G[x]){
        if(e.fi == fa) continue;
        dfs0(e.fi, x);
        sz[x] += sz[e.fi];
        son[x] = max(son[x], sz[e.fi]);
    }
    son[x] = max(son[x], n - sz[x]);
}

void dfs(int x, int fa, LL v){
    sz[x] = 1;
    for(auto e : G[x]){
        if(e.fi == fa) continue;
        dfs(e.fi, x, e.se+v);
        sz[x] += sz[e.fi];
    }
    ANS += v;
}

int main()
{
    cin>>n;
    for(int i = 1; i < n; i++){
        int x, y, w;
        cin>>x>>y>>w;
        G[x].push_back({y, w});
        G[y].push_back({x, w});
    }
    int X;
    dfs0(1, 1);
    for(int i = 1; i <= n; i++) if(son[i] <= n/2) X = i;
    dfs(X, X, 0);
    for(auto e : G[X]){
        if(sz[e.fi] == (n+1)/2) { Min = e.se; break; }
        Min = min(e.se, Min);
    }
    cout<<ANS*2 - Min<<endl;
}


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

using namespace std;

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

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;

int main() {
  vector<string> A = {"Sunny", "Cloudy", "Rainy"};
  string s;
  cin >> s;
  int k = 0;
  for (k = 0; k < 3; ++k) {
    if (A[k] == s) break;
  }
  k = (k + 1) % 3;
  cout << A[k] << endl;
  return 0;
}


Measured memory_bytes: 256
r,c=map(int, input().split())
S=[]
for num in range(r):
  A=list(map(int, input().split()))
  S.append(A)
  A.append(sum(A))

#print(list(zip(*S)))
C=[]
for t in (zip(*S)):
  C.append(sum(t))
S.append(C)
for i in S:
  print(*i)


Measured memory_bytes: 6228
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i <= n; i++)
#define INF 2e9
#define IMAX 1000000007
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long llong;

int main()
{
	//142_C
	int N;
	cin >> N;
	int i;
	int j[N] = {};

	REP(idx, N) {
		cin >> i;
		j[i - 1] = idx + 1;
	}

	REP(idx, N) {
		cout << j[idx] << " ";
	}

	return 0;
}


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

int checker(const void* a0, const void* b0) {
    const int* a = (int*)a0;
    const int* b = (int*)b0;

    if(*a < *b) return 1;
    else if(*a > *b) return -1;

    return 0;
}


int main() {
    int n,k;
    cin>>n>>k;
    int hp[n];
    for(int i=0; i<n; i++) cin>>hp[i];

    if(n<=k) {
        cout<<0<<endl;
        return 0;
    }

    qsort(hp, n, sizeof(int), checker);

    int64_t ans = 0;
    for(int i=k; i<n; i++) ans += hp[i];

    cout<<ans<<endl;




    return 0;
}

Measured memory_bytes: 1788
import math as mt
a, b, h, m = map(float, input().split())
radm = 90 - 6 * m
radh = -m/2 + 90 - 30 * h
radm, radh = mt.radians(radm), mt.radians(radh)
mx, my = b*mt.cos(radm), b*mt.sin(radm)
hx, hy = a*mt.cos(radh), a*mt.sin(radh)
ans = (mx-hx)*(mx-hx) + (my-hy)*(my-hy)
print(mt.sqrt(ans))

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

char a[55][55], b[55][55];

int main() {
  int n, m;
  cin >> n >> m;
  
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < m; i++) cin >> b[i];
  
  for (int p = 0; p <= n - m; p++)
    for (int q = 0; q <= n - m; q++) {
      bool ok = true;
      for (int i = 0; i < m; i++)
        for (int j = 0; j < m; j++)
          ok &= a[p + i][q + j] == b[i][j];
      if (ok) {
        cout << "Yes" << endl;
        return 0;
      }
    }
  
  cout << "No" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <cmath>
#include <time.h>
#include <stdio.h>
#define int long long
using namespace std;
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
int mypow(int x, int y) {
	if (y == 0)return 1;
	if (y % 2)return mypow(x, y - 1)*x;
	else return mypow(x, y / 2)*mypow(x, y / 2);
}
int Max(int x, int y) {
	if (x > y)return x;
	else return y;
}
int Min(int x, int y) {
	if (x < y)return x;
	else return y;
}

/*Library End!*/

int n, m, a[50], b[50];
bool g[50][50], vi[50];
void dfs(int v) {
	vi[v] = true;
	for (int v2 = 0; v2 < n; v2++) {
		if (g[v][v2] == false)continue;
		if (vi[v2] == true)continue;
		dfs(v2);
	}
}
signed main(){
	cin >> n >> m;
	for (int i = 0; i < m; i++) {
		cin >> a[i] >> b[i];
		a[i]--, b[i]--;
		g[a[i]][b[i]] = g[b[i]][a[i]] = true;
	}
	int ans = 0;
	for (int i = 0; i < m; i++) {
		g[a[i]][b[i]] = g[b[i]][a[i]] = false;
		for (int j = 0; j < n; j++)vi[j] = false;
		dfs(0);
		bool br = false;
		for (int j = 0; j < n; j++)if (vi[j] == false)br = true;
		if (br)ans++;
		g[a[i]][b[i]] = g[b[i]][a[i]] = true;
	}
	cout << ans << endl;
end:;
	system("PAUSE");
	return 0;
}


Measured memory_bytes: 504
#include <bits/stdc++.h>
using namespace std;
typedef int64_t ll;
#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define reps(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; --i)
#define ALL(v) (v).begin(), (v).end()
#define SZ(v) ((int)(v).size())
#define DUMP(x) cerr << #x << " = " << (x) << endl;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const double PI = acos(-1);



int main(void)
{
    int n;
    cin >> n;
    ll ans = 1;
    reps(i, n) ans = (ans * i) % MOD;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Text;


class Program
{
    static void Main(string[] args)
    {
        // 入力
        var s = Console.ReadLine();
        //var n = int.Parse(Console.ReadLine());
        //int[] n = Console.ReadLine().Split().Select(int.Parse).ToArray();

        //文字列の反転
        var tmp = new string(s.Reverse().ToArray());

        var c1 = "maerd";
        var c2 = "remaerd";
        var c3 = "esare";
        var c4 = "resare";

        StringBuilder t1 = new StringBuilder("");
        bool ok = true;
        while (tmp.Length > 0)
        {
            if (tmp.StartsWith(c1))
            {
                tmp = tmp.Remove(0, c1.Length);
                t1.Append(c1);
            }
            else if (tmp.StartsWith(c2))
            {
                tmp = tmp.Remove(0, c2.Length);
                t1.Append(c2);
            }
            else if (tmp.StartsWith(c3))
            {
                tmp = tmp.Remove(0, c3.Length);
                t1.Append(c3);
            }
            else if (tmp.StartsWith(c4))
            {
                tmp = tmp.Remove(0, c4.Length);
                t1.Append(c4);
            }
            else
            {
                ok = false;
                break;
            }
        }

        // 出力
        var t2 = new string(s.Reverse().ToArray());
        var ans = "YES";
        if (t1.ToString() != t2)
        {
            ans = "NO";
        }
        Console.WriteLine(ans);
    }
}

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

#define rep(i, n) for(int i = 0; i<(n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef long long ll;

int main() {
    ll A, B, K;
    cin >> A >> B >> K;

    ll m = min(A, K);
    A -= m;
    K -= m;
    B = max(0LL, B - K);

    cout << A << " " << B << endl;
}

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

using i32 = std::int_fast32_t;
using i64 = std::int_fast64_t;
template <typename T> constexpr T inf = numeric_limits<T>::has_infinity ? numeric_limits<T>::infinity() : numeric_limits<T>::max() / 4;

#define REP(i, stop) FOR(i, 0, stop)
#define FOR(i, start, stop) for (int i = start, i##_len = stop; i < i##_len; ++i)
#define RREP(i, n) for (int i = n; i-- > 0;)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define COMP(key) [](const auto& a, const auto& b) { return a.key < b.key; }

template<typename T, typename U> istream& operator>>(istream& is, pair<T, U>& a) { return is >> a.first >> a.second; }
template<typename T> istream& operator>>(istream& is, vector<T>& a) { for (T& x : a) is >> x; return is; }

void LOG(const int& x) { cerr << x << "\n"; }
template<typename T> void LOG(const vector<T>& a) { for (const T& x : a) cerr << x << " "; cerr << "\n"; }
template<typename T, std::size_t S> void LOG(const T (&a)[S]) { REP(i, S) cerr << a[i] << " "; cerr << "\n"; }
template<typename T, std::size_t S, std::size_t R> void LOG(const T (&a)[S][R]) { REP(i, S) { REP(j, R) cerr << a[i][j] << " "; cerr << "\n"; } }

i64 ceil(i64 a, i64 b) { return (a - 1) / b + 1; }
i64 gcd(i64 a, i64 b) { while (b != 0) { i64 t = b; b = a % b; a = t; } return a; }
i64 lcm(i64 a, i64 b) { return a / gcd(a, b) * b; }
i64 gcd(const vector<i64>& v) { return accumulate(ALL(v), 1LL, static_cast<i64(*)(i64, i64)>(gcd)); }
i64 lcm(const vector<i64>& v) { return v.empty() ? 0LL : accumulate(v.begin() + 1, v.end(), v[0], static_cast<i64(*)(i64, i64)>(lcm)); }
i64 pow(i64 x, i64 y, i64 z) { i64 a = 1; while (y > 0) { if (y & 1) a = a * x % z; x = x * x % z; y /= 2; } return a; }
i64 inv(i64 x, i64 m) { return pow(x, m - 2, m); }

struct InitCpp { InitCpp() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(10); } } initCpp;

const i64 M = 1000000007;
using P = pair<i64, i64>;
signed main() {
  i64 n, k;
  cin >> n >> k;
  vector<i64> A(n);
  cin >> A;
  vector<i64> nx(n);
  map<i64, i64> mp;
  set<i64> nw;
  REP(i, n) {
    if (mp.count(A[i])) {
      i64 idx = mp[A[i]];
      nx[idx] = i;
      mp[A[i]] = i;
    } else {
      nw.insert(i);
      mp[A[i]] = i;
    }
  }
  for (i64 i : nw) {
    nx[mp[A[i]]] = i;
  }
  i64 idx = 0;
  i64 t = 1;
  while (idx < n) {
    if (nx[idx] <= idx) {
      t += 1;
    }
    idx = nx[idx];
    idx += 1;
  }
  cerr << "period: " << t << "\n";
  k %= t;
  idx = 0;
  t = 0;
  while (idx < n) {
    if (nx[idx] <= idx) {
      t += 1;
    }
    if (t >= k) {
      break;
    }
    idx = nx[idx];
    idx += 1;
  }
  cerr << "from: " << idx << endl;
  while (idx < n) {
    if (nx[idx] > idx) {
      idx = nx[idx];
    } else {
      cout << A[idx] << " ";
    }
    idx += 1;
  }
}


Measured memory_bytes: 26496
#include <stdio.h>

int main(void)
{
	int N, A, B;
	
	scanf("%d",&N);
	if(N==1){
		printf("Hello World\n");
	}else{
		scanf("%d",&A);
		scanf("%d",&B);
		printf("%d\n",A+B);
	}
	
	return 0;
}


Measured memory_bytes: 128
import collections
def modpow(a,n,p):
    if n==0:
        return 1
    x=modpow(a,n//2,p)
    x=(x*x)%p
    if (n%2)==1:
        x=(x*a)%p
    return x%p
def modinv(a,p):
    return modpow(a,p-2,p)
N,M=map(int,input().split())
l=[]
pf={}
m=M
p=10**9+7
frac=[1]*(2*(10**7))
ans=1
for i in range(2,int(m**0.5)+1):
    while m%i==0:
        pf[i]=pf.get(i,0)+1
        m//=i
if m>1:pf[m]=1
#print(pf)
for i in range(1,2*(10**7)):
    frac[i]=(frac[i-1]*i)%p
#print(frac[:7])
keys=list(pf.keys())
values=list(pf.values())
for i in range(len(keys)):
    l.append([keys[i],values[i]])
#print(l)
for i in range(len(l)):
    a=l[i][1]
    ans=(ans*frac[a+N-1]*modinv(frac[a],p)*modinv(frac[N-1],p))%p
print(ans%p)

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

int main()
{
    int X, tmp;
    cin >> X;
    tmp = X;

    int x;
    while (tmp > 0)
    {
        x += tmp % 10;
        tmp /= 10;
    }

    if (X % x == 0)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }

    return 0;
}

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

const int64_t MOD = 1e9 + 7;
struct mint
{
    int64_t x;
    mint(int64_t x = 0) : x((x % MOD + MOD) % MOD) {}
    mint operator-() const { return mint(-x); }
    mint &operator+=(const mint a)
    {
        if ((x += a.x) >= MOD)
            x -= MOD;
        return *this;
    }
    mint &operator-=(const mint a)
    {
        if ((x += MOD - a.x) >= MOD)
            x -= MOD;
        return *this;
    }
    mint &operator*=(const mint a)
    {
        (x *= a.x) %= MOD;
        return *this;
    }
    mint operator+(const mint a) const { return mint(*this) += a; }
    mint operator-(const mint a) const { return mint(*this) -= a; }
    mint operator*(const mint a) const { return mint(*this) *= a; }
    mint pow(int64_t n) const
    {
        if (n == 0)
            return 1;
        mint t = pow(n >> 1);
        t *= t;
        if (n & 1)
            t *= *this;
        return t;
    }
    mint inv() const { return pow(MOD - 2); }
    mint &operator/=(const mint a) { return *this *= a.inv(); }
    mint operator/(const mint a) const { return mint(*this) /= a; }
};

int main()
{
    int N;
    cin >> N;
    vector<int64_t> A(N);
    for (int i = 0; i < N; i++)
    {
        cin >> A.at(i);
    }

    mint res = 0;
    for (int i = 0; i < 61; i++)
    {
        int cnt0 = 0, cnt1 = 0;
        for (int j = 0; j < N; j++)
        {
            if ((A.at(j) & ((int64_t)1 << i)) == 0)
                cnt0++;
            else
                cnt1++;
        }
        res += mint(cnt0) * mint(cnt1) * mint(2).pow(i);
    }
    cout << res.x << endl;
}

Measured memory_bytes: 2560
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>
#include <math.h>
#include <set>
#include <bitset>

using namespace std;

typedef long long ll;

const ll prime = 10000000000 + 7;

/*
vector<int> z_algorithm(const string& s) {
	vector<int> prefix(s.size());
	for (int i = 1, j = 0; i < s.size(); i++)
	{
		if (i + prefix[i - j] < j + prefix[j]) {
			prefix[i] = prefix[i - j];
		}
	}
}
*/

int main() {
	
	ll d, g;
	cin >> d >> g;
	vector<ll> p(d), c(d);
	for (ll i = 0; i < d; i++)
	{
		cin >> p[i] >> c[i];
	}

	ll sum = 0;
	ll count = 1 << 29;
	ll currentCount = 0;

	for (int i = 0; i < pow(2, d); i++)
	{
		sum = 0;
		currentCount = 0;
		for (ll j = 0; j < d; j++)
		{
			if (i & (1 << j)) {
				currentCount += p[j];
				sum += p[j] * 100 * (j+1) + c[j];
			}
		}
		if (sum >= g) {
			count = min(count, currentCount);
		}
		else {
			for (ll j = 0; j < d; j++)
			{
				ll idx = d - 1 - j;
				if (!(i & (1 << idx))) {
					ll num = (g - sum - 1) / (100 * (idx + 1)) + 1;
					if (num < p[idx]) {
						// ok
						currentCount += num;
						count = min(count, currentCount);
						break;
					}
					else {
						break;
					}
				}
			}
		}
	}

	cout << count << endl;


	return 0;
}

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

using namespace std;

#define ll long long
ll input(){
	ll x=0,f=0;char ch=getchar();
	while(ch<'0'||ch>'9') f|=ch=='-',ch=getchar();
	while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
	return f? -x:x;
}

const int N=107,M=1e5+7;
const ll mod=1e9+7;

ll dp[N][M],sum[M];
int a[N];

int main(){
	int n=input(),k=input();

	for(int i=0;i<n;i++) a[i]=input();
	for(int i=0;i<=n;i++) dp[i][0]=1;
	for(int i=1;i<=n;i++){
		sum[0]=0;
		for(int j=1;j<=k+1;j++) sum[j]=sum[j-1]+dp[i-1][j-1];
		for(int j=1;j<=k;j++) dp[i][j]=(sum[j+1]-sum[max(0,j-a[i-1])])%mod;
	}

	printf("%lld\n",dp[n][k]);
}


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

int main(){
  string str;

  while(getline(cin,str),str != "."){
    stack<char> st;
    int len = str.size();
    bool flg = false;

    for(int i = 0 ; i < len ; i++){
      if(str[i] == '(' || str[i] == '['){
	st.push(str[i]);
	continue;
      }
      if(str[i] == ')'){
	if(st.empty()){
	  flg = true;
	  break;
	}
	else if(st.top() == '(') st.pop();
	else{
	  flg = true;
	  break;
	}
      }
      else if(str[i] == ']'){
	if(st.empty()){
	  flg = true;
	  break;
	}
	else if(st.top() == '[') st.pop();
	else{
	  flg = true;
	  break;
	}
      }
    }

    if(!flg&&st.empty()) cout << "yes" << endl;
    else cout << "no" << endl;
  }

  return 0;
}

Measured memory_bytes: 1176
#include <bits/stdc++.h>
#define isFile 0
#define NAME "taskA"
#define scan 1
using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ull> vull;
typedef vector<pii> vpii;

#define mp make_pair
#define pb push_back
#define fr first
#define sc second

#define ins insert
#define all(v) v.begin(), v.end()
#define rep(i,a,n) for (int i=a;i<n;i++)
#define bit(n, i) (n >> i) & 1
#define bpc(x) __builtin_popcountll(x)
#define rev(a) reverse(all(a))
#define skip continue
#define read(a) for(auto &i : a) cin >> i
#define print(a) for(auto i : a) cout << i << ' '
#define unique(a) sort(all(a));    a.resize(unique(all(a)) - a.begin())

//                D  R  U   L
const int dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
const int dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
const int day[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

void faster() {
    if (isFile) {
        freopen(NAME".in", "r", stdin);
        freopen(NAME".out", "w", stdout);
    }
    if (scan) {
        ios_base::sync_with_stdio(false);
        cin.tie(0);
        cout.tie(0);
    }
}

const ll  INF = 1e18;
const int inf = 2e9;
const int MOD = 1e9 + 7;
//const int MOD = 998244353;
const ld  PI = acos(-1);
const ld  EPS = 3E-16;
const int ALPHA = 26;
const int N = (int)1e5 + 5;
const int M = 123;

ll dp[N];
ll a[N];
int n;

void solve() {
    cin >> n;
    for(int i = 1; i <= n; i++)
        cin >> a[i];

    for(int i = 0; i < N; i++)
        dp[i] = inf;

    dp[1] = 0;

    for(int i = 1; i <= n; i++) {
        dp[i + 1] = min(dp[i + 1], dp[i] + abs(a[i + 1] - a[i]));
        dp[i + 2] = min(dp[i + 2], dp[i] + abs(a[i + 2] - a[i]));
    }

    cout << dp[n] << endl;
}

int main() {
    faster();
    int t = 1;
//    cin >> t;
    while(t--) {
        solve();
    }
    return 0;
}


Measured memory_bytes: 1792
from itertools import combinations 
n,k=map(int,input().split())
m = (n-1)*(n-2)//2
if k>m:
    print(-1)
else:
    es = []
    for i in range(2,n+1):
        es.append('1 %d' % i)
        
    idx = 0
    for i,j in combinations(range(2,n+1),2):
        if idx == m-k:
            break
        es.append('%d %d' % (i,j))
        idx +=1
    print(len(es))
    print(*es,sep="\n")

Measured memory_bytes: 3716
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {

	@SuppressWarnings("resource")
	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		Map<Integer, Integer> map = new HashMap<>();

		for (int i = 0; i < n; i++) {
			int key = scanner.nextInt();
			if (map.containsKey(key)) {
				map.put(key, map.get(key) + 1);
			} else {
				map.put(key, 1);
			}
		}

		int cnt = 0;
		for (int value : map.values()) {
			if (value % 2 != 0) {
				cnt++;
			}
		}

		System.out.println(cnt);
	}
}


Measured memory_bytes: 61096
#include <bits/stdc++.h>
using namespace std;
template<class T> bool chmax(T& a,T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T& a,T b) { if (a > b) { a = b; return 1; } return 0; }

int main() {
	string s;
	cin >> s;
	cout << s.substr(0, 3) << endl;
	return 0;
}

Measured memory_bytes: 3624
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <regex>
#define REP(i,n) for(int i = 0; i < n; i++)
#define FOR(i,j,n) for(int i = j; i < n; i++)
#define RFOR(i,j,n) for(int i = j-1; i >= n; i--)
#define PREC(n) fixed << setprecision(n)
#define print_array(v) REP(__k, v.size()) { cout << v[__k]; if(__k != v.size()-1) cout << " "; else cout << endl; }
#define YesorNo(a) printf(a?"Yes\n":"No\n")
#define _LIBCPP_DEBUG 0
using namespace std;
int64_t MOD = 1000000007;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a, b, c;
  cin >> a >> b >> c;
  cout << (b / a > c ? c : b / a) << endl;
  return 0;
}
//templete by private_yusuke

Measured memory_bytes: 256