akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define _GLIBCXX_DEBUG

int main() {
    int h, w;
    cin >> h >> w;
    vector<string> vec(h);
    rep(i, h) cin >> vec[i];
    
    rep(i, w + 2){
        cout << '#';
    }cout << endl;
    
    rep(i, h){
        cout << '#' << vec[i] << '#' << endl;
    }
    
    rep(i, w + 2){
        cout << '#';
    }cout << endl;
}

Measured memory_bytes: 3612
#pragma GCC optimize("O3")
#pragma GCC target ("sse4")
 
#include "bits/stdc++.h"
#include "ext/pb_ds/tree_policy.hpp"
#include "ext/pb_ds/assoc_container.hpp"
#include "ext/rope"
 
using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define F0R(i, a) for(int i = 0; i < (a); ++i)
#define pb push_back
#define mp make_pair
#define sz(x) (int)x.size()
#define f first
#define s second
 
template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;
 
struct custom_hash 
{
    static uint64_t splitmix64(uint64_t x) 
    {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
 
    size_t operator()(uint64_t x) const 
    {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
string s;
int main()
{
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> s;
    vector<string> p1, p2;
    string tm = s.substr(0, 1);
    p1.pb(tm);
    string c = "";
    FOR(i, 1, sz(s))
    {
        c += s[i];
        if(p1[sz(p1) - 1] != c)
        {
            p1.pb(c);
            c = "";
        }
    }
    c = "";
    if(sz(s) > 1)
    {
        string t = s.substr(0, 2);
        p2.pb(t);
        FOR(i, 2, sz(s))
        {
            c += s[i];
            if(p2[sz(p2) - 1] != c)
            {
                p2.pb(c);
                c = "";
            }
        }
    }
    cout << max(sz(p1), sz(p2));
    return 0;
}

Measured memory_bytes: 21512
#include <iostream>
#include <set>
using namespace std;
typedef long long ll;
const ll MAX = 100010;
set<int> st{};
int main(){
    ll x;
    cin >> x;
    // get all prime numbers so far
    for (int i=2; i<x; i++) {
        bool prime = true;
        for (auto itr=st.begin(); itr != st.end(); itr++){
            if (i % *itr == 0) {
                prime = false;
                break;
            }
        }
        if (prime) st.insert(i);
    }
    for (int n=x; n<MAX; n++){
        bool prime = true;
        for (auto itr=st.begin(); itr != st.end(); itr++){
            if (n % *itr == 0) {
                prime = false;
                break;
            }
        }
        if (prime) {
            cout << n << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 4024
#include<iostream>
using namespace std;
int main()
{
  int n;
  cin>>n;
  for(int a=1;a<=9;a++)
  {
    for(int b=1;b<=9;b++)
    {
      if(n==a*b) {cout<<"Yes";
                  return 0;}
    }
  }
  cout<<"No";
}


Measured memory_bytes: 256
var input = require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");
var obj = {
  "list" : input,
  "index" : 0,
  "max" : input.length,
  "next" : function(){
    if(!this.hasNext()){throw "NoSuchElementException:次に要素は無いよ";}
    var returnObj = this.list[this.index];
    this.index++;
    return returnObj;
  },
  "hasNext" : function(){return (this.index < this.max);}
}
Main();
function next(){return obj.next();}
function nextInt(){return myconv(next(),1);}
function nextStrArray(){return myconv(next(),2);}//半角スペース分割
function nextIntArray(){return myconv(next(),4);}//半角スペース + 数値化
function nextCharArray(){return myconv(next(),6);}//1文字分割
function hasNext(){return obj.hasNext();}
function myout(t){console.log(t);}//標準出力
function myerr(t){console.error(t);}//標準エラー出力
//[no]要素の扱い。数値型
//不明値、異常時:引数そのまま返す　1:数値へ変換
//2:半角SPで分割 4:半角SPで分割し、数値配列へ
//6:1文字で分割  7:1文字で分割し、数値配列へ
//8:半角SPで結合 9:改行で結合 0:文字なしで結合
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 4:return i.split(" ").map((a)=>Number(a));case 6:return i.split("");case 7:return i.split("").map((a)=>Number(a));case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}catch(e){return i;}}
function Main(){
  var N = nextInt();
  var output = Math.floor(N / 11) * 2;
  var tmp = N % 11;
  if(tmp >= 7){
     output += 2;
  }else if(tmp > 0){
     output++;
  }
  myout(output);
}

Measured memory_bytes: 7372
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(k,i,n) for(ll i=k;i<n;++i)
int main(void){
    ll n;
    cin>>n;
    vector<ll>a(n);
    rep(0,i,n)cin>>a[i];
    sort(a.rbegin(),a.rend());
    ll al=0,bo=0;
    rep(0,i,n){
        if(i%2==0)al+=a[i];
        else bo+=a[i];
    }
    cout<<al-bo;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
const char nl = '\n';
using namespace std;
typedef long long ll;
typedef long double ld;
typedef complex<ld> pt;
const int MOD = 1e9 + 7;
const int INF = 0x3f3f3f3f;
const int N = 3010;

int n;
string s;
int dp[2][N];

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> s;
  for (int l = 0; l < n; l++) {
    dp[1][l] = l+1;
  }
  for (int i = 1; i < n; i++) {
    for (int l = 0; l < n-i; l++) {
      if (s[i-1] == '<') {
        dp[0][l] = dp[1][l];
      } else {
        dp[0][l] = (dp[1][n-i] + MOD - dp[1][l]) % MOD;
      }
      //cerr << i << " " << l << " -> " << dp[i][l] << nl;
    }
    for (int j = 1; j < n-i; j++) {
      dp[0][j] = (dp[0][j] + dp[0][j-1]) % MOD;
    }
    swap(dp[0], dp[1]);
  }
  cout << dp[1][0] << nl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
// const bool debug=true;
const bool debug=false;
#define DEBUG if(debug==true)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll MOD = 1000000007;

int main(void) {
    ll n,x;
    cin>>n>>x;
    ll a[n];
    rep(i,n){cin>>a[i];}
    ll _min[n];
    rep(i,n){_min[i]=1LL<<60;}
    ll res = 1LL<<60;
    rep(i,n){
        ll sum = x*i;
        rep(j,n){
            _min[j] = min(_min[j],a[(i+j)%n]);
            sum += _min[j];
        }
        DEBUG{cout << "i : " << i << " sum : " << sum << endl;}
        res = min(sum,res);
    }
    cout << res << endl;
    return 0;
}


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

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

  sort(h, h+n);

  int ans = 1e+9;
  for(int i = 0; i < n-k+1; i++){
    ans = min(ans, h[i+k-1] - h[i]);
  }

  cout << ans << endl;

  return 0;
}


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

const ll INF = 1LL << 60;

ll N, M;
vector<ll> x;
int main() {
    cin >> N >> M;
    x.resize(M);
    rep(i, M) cin >> x[i];
    sort(x.begin(), x.end());

    vector<ll> dist;
    for (int i = 1; i < M; i++) {
        ll d = abs(x[i] - x[i - 1]);
        dist.push_back(d);
    }
    sort(dist.rbegin(), dist.rend());

    // N 個の区間を選ぶ
    // cout << min(N - 1, (ll)dist.size()) << endl;
    ll removed_cnt = N - 1;
    ll total = accumulate(dist.begin(), dist.end(), 0LL);

    for (int i = 0; i < removed_cnt; i++) {
        // if (dist.size() - 1 < i) break;
        // cout << dist[i] << " ";
        if ((int)dist.size() - 1 >= i) {
            total -= dist[i];
        }
    }
    cout << total << endl;
}

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

using namespace std;

int main (void) {
    int N;
    cin >> N;
    vector<int> C(N-1);
    vector<int> S(N-1);
    vector<int> F(N-1);
    for ( int i = 0; i < N-1; i++ ) {
        cin >> C.at(i) >> S.at(i) >> F.at(i);
    }

    for ( int start = 0; start < N-1; start++ ) {
        int time = 0;
        for ( int i = start; i < N-1; i++ ) {
            /* 電車が発射する時刻まで待つ */
            if ( time <= S.at(i) )
                time = S.at(i);
            else
                time = ((time - 1) / F.at(i) + 1) * F.at(i);
            /* 次の駅に移動 */
            time += C.at(i);
        }
        cout << time << endl;
    }

    cout << 0 << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,k;
  cin>>n>>k;
  map<int,int64_t> mp;
  mp[0]++;
  int64_t sum = 0;
  while(n--){
    int a;cin>>a;
    sum += a;
    sum %= k;
    mp[sum]++;
  }
  int64_t ans = 0;
  auto f = [](int64_t x){return x*(x-1)/2;};
  for(auto x:mp)ans+=f(x.second);
  cout<<ans<<endl;
}

Measured memory_bytes: 4224
from collections import Counter, defaultdict
import sys
sys.setrecursionlimit(10 ** 5 + 10)
# input = sys.stdin.readline
from math import factorial
import heapq, bisect
import math
import itertools


import queue
from collections import deque



def main():
    num, m = map(int, input().split())
    data = list(map(int, input().split()))

    data.sort()
    count_data = Counter(data)

    amari_data = [0 for i in range(m)]
    overlap_amari = [0 for i in range(m)]

    for i in range(num):
        amari = data[i] % m
        amari_data[amari] += 1

    for now_num, count in count_data.items():
        if count >= 2:
            amari = now_num % m
            overlap_amari[amari] += count // 2

    # print(amari_data)
    # print(overlap_amari)

    ans = 0
    for i in range(m):
        if i == 0:
            kari = amari_data[i] // 2
            ans += kari
            amari_data[i] -= kari * 2
        else:
            kari = min(amari_data[i], amari_data[m - i])
            ans += kari
            amari_data[i] -= kari
            amari_data[m - i] -= kari

        kari = min(overlap_amari[i], amari_data[i] // 2)
        ans += kari
        overlap_amari[i] -= kari * 2

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 65196
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        String S = sc.next();
        char[] ans = S.toCharArray();
        int A1 = 0;
        int A2 = 0;
        if ('-' == S.charAt(A)) {
            for (int i = 0; A > i; i++) {
                if (ans[i] == '0' || ans[i] == '1' || ans[i] == '2' || ans[i] == '3' || ans[i] == '4' || ans[i] == '5' || ans[i] == '6' || ans[i] == '7' || ans[i] == '8' || ans[i] == '9') {

                } else {
                    A1 = 1;
                    break;
                }
            }
            for (int j = 0; B > j; j++) {
                if (ans[A + 1 + j] == '0' || ans[j + A + 1] == '1' || ans[j + A + 1] == '2' || ans[j + A + 1] == '3' || ans[j + A + 1] == '4' || ans[j + A + 1] == '5' || ans[j + A + 1] == '6' || ans[j + A + 1] == '7' || ans[j + A + 1] == '8' || ans[j + A + 1] == '9') {

                } else {
                    A2 = 1;
                    break;
                }
            }
        } else {
            A1 = 1;
            A2 = 1;
        }
        if (A1 == 0 && A2 == 0) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}


Measured memory_bytes: 23764
#include<bits/stdc++.h>
#define MAX 100005
#define pb push_back
#define mp make_pair
#define pii pair<long long,long long>
#define read(a) scanf("%d",&a)
#define p1(a) cout<<"Check "<<a<<endl;
#define p2(a,b) cout<<"Check "<<a<<' '<<b<<endl;
#define p3(a,b,c) cout<<"Check "<<a<<' '<<b<<' '<<c<<endl;
#define fo(i,n) for(i=0;i<n;i++)
#define ll long long
#define clr(a) memset(a,0,sizeof(a))
#define MOD 10000000000
#define INF 10000000000000;

using namespace std;

int main()
{
    int n,k;
    cin>>n>>k;
    int ar[n+10];
    ll dp[MAX];
    dp[0]=10000000000,dp[1]=0,ar[0]=1000000000;
    for(int i=1;i<=n;i++) scanf("%d",&ar[i]);
    for(int i=2;i<=n;i++){
        ll p = dp[i-1]+abs(ar[i]-ar[i-1]);
        for(int j=2;j<=k && j<=i;j++){
            ll q=dp[i-j]+abs(ar[i]-ar[i-j]);
            p=min(p,q);
        }
        dp[i]=p;
        //p3(dp[i],p,q);
    }
    cout<<dp[n]<<endl;


    return 0;
}


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

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> V(N + M);
  for (int i = 0; i < M; i++) V.at(i)++;

  int cnt = 0;
  for (int i = 0; i < N + M; i++) {
    for (int j = 0; j < i; j++) {
      if ((V.at(i) + V.at(j)) % 2 == 0) cnt++;
    }
  }

  cout << cnt << "\n";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define X first
#define Y second
#define pb emplace_back
#define FOR(i,a,b) for(int (i)=(a);i<(b);++(i))
#define EFOR(i,a,b) for(int (i)=(a);i<=(b);++(i))
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define reps(X,S,Y) for (int (X) = S;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = (Y)-1;(X) >=0;--(X))
#define rreps(X,S,Y) for (int (X) = (Y)-1;(X) >= (S);--(X))
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()
#define eb emplace_back
#define UNIQUE(X) (X).erase(unique(all(X)),(X).end())

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef ll LL;
typedef pii PII;
typedef pll PLL;
template<class T> using vv=vector<vector<T>>;
template<class T> inline bool MX(T &l,const T &r){return l<r?l=r,1:0;}
template<class T> inline bool MN(T &l,const T &r){return l>r?l=r,1:0;}
const ll MOD=1e9+7;

int N;
int A[114514];
bitset<4000001> bs;

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

  int tot = 0;
  bs[0] = 1;
  rep(i, N) {
    scanf("%d", &A[i]);
    tot += A[i];
    bs |= (bs << A[i]);
  }

  int lim = tot/2 + tot%2;
  reps(i, lim, tot+1) {
    if (bs[i]) {
      printf("%d\n", i);
      break;
    }
  }
}


Measured memory_bytes: 1664
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
using namespace std;
typedef long long ll;
const int M = 200010,inf = 0x3f3f3f3f;
int m,ans = inf;
int x[M],y[M];
char dir[M];
vector <pair<int,char> > v[M];
vector <pair<int,char> > slope[M << 1];

template<typename T>
inline void read(T &x){
    x = 0; char ch = getchar(); int f = 1;
    for(;ch < '0' || ch > '9'; ch = getchar()) if(ch == '-') f = -1;
    for(;ch >= '0' && ch <= '9'; ch = getchar()) x = x * 10 + ch - '0';
    x *= f;
}
inline void rotate(){
    for(int i = 1,l;i <= m; i++){
        l = 200000 - x[i]; x[i] = y[i]; y[i] = l;
        if(dir[i] == 'U') dir[i] = 'R';
        else if(dir[i] == 'R') dir[i] = 'D';
        else if(dir[i] == 'D') dir[i] = 'L';
        else if(dir[i] == 'L') dir[i] = 'U';
    }
}
int main(){
    read(m);
    for(int i = 1;i <= m; i++){
        read(x[i]); read(y[i]); dir[i] = getchar();
        while(dir[i] != 'U' && dir[i] != 'R' && dir[i] != 'D' && dir[i] != 'L') dir[i] = getchar();
    }
    for(int i = 1;i <= m; i++)
        if(dir[i] == 'L' || dir[i] == 'R')
            v[y[i]].push_back(make_pair(x[i],dir[i]));
    for(int i = 0;i <= 200000; i++){
        sort(v[i].begin(),v[i].end());
        for(int j = 0;j < (int)v[i].size() - 1; j++)
            if(v[i][j].second == 'R' && v[i][j + 1].second == 'L')
                ans = min(ans,(v[i][j + 1].first - v[i][j].first) * 5);
    }
    for(int i = 0;i <= 200000; i++) v[i].clear();
    for(int i = 1;i <= m; i++)
        if(dir[i] == 'U' || dir[i] == 'D')
            v[x[i]].push_back(make_pair(y[i],dir[i]));
    for(int i = 0;i <= 200000; i++){
        sort(v[i].begin(),v[i].end());
        for(int j = 0;j < (int)v[i].size() - 1; j++)
            if(v[i][j].second == 'U' && v[i][j + 1].second == 'D')
                ans = min(ans,(v[i][j + 1].first - v[i][j].first) * 5);
    }
    for(int t = 1;t <= 4; t++){
        for(int i = 0;i <= 400000; i++) slope[i].clear();
        for(int i = 1;i <= m; i++)
            if(dir[i] == 'U' || dir[i] == 'R')
                slope[x[i] + y[i]].push_back(make_pair(x[i],dir[i]));
        for(int i = 0;i <= 400000; i++){
            sort(slope[i].begin(),slope[i].end());
            for(int j = 0;j < (int)slope[i].size() - 1; j++)
                if(slope[i][j].second == 'R' && slope[i][j + 1].second == 'U')
                    ans = min(ans,(slope[i][j + 1].first - slope[i][j].first) * 10);
        }
        rotate();
    }
    if(ans == inf) printf("SAFE\n");
    else printf("%d\n",ans);
    return 0;
}
/*
2
11 1 U
11 47 D

230

4
20 30 U
30 20 R
20 10 D
10 20 L

SAFE

8
168 224 U
130 175 R
111 198 D
121 188 L
201 116 U
112 121 R
145 239 D
185 107 L

100
*/

Measured memory_bytes: 31192
import java.io.*;

import java.util.*;



class Main{

	private static ArrayList<Integer> calc_gcd_lcm(ArrayList<Integer> a){

		ArrayList<Integer> b = new ArrayList<Integer>();

				

		for(int i = 0;i<a.size()/2;i++){

			

			int x,y,x1,y1,j,k;
			x1 = 0;
			y1 = 0;

			if(a.get(i*2) > a.get(i*2+1)){
				x = a.get(i*2);
				y = a.get(i*2+1);
				x1 = x;
				y1 = y;
			}
			else{
				x = a.get(i*2+1);
				y = a.get(i*2);
				x1 = x;
				y1 = y;
			}

			j = x1%y1;
			
			while(j != 0){
				x1 = y1;
				y1 = j;
				j = x1%y1;
			}
			b.add(y1);
			k = x/y1*y;
			b.add(k);

			

			}

		return b;

	}

	private static void print_calc(ArrayList<Integer> a){

		String str1,str2;

		int x,y;

		

		for(int i = 0;i<a.size()/2;i++){	

			

			x = a.get(i*2);

			y = a.get(i*2+1);

			

			System.out.println( x + " " + y );

			

		}

	}

		public static void main(String args[]) throws IOException{

			ArrayList<Integer> val = new ArrayList<Integer>();

			Scanner scan = new Scanner(System.in);

			int n;

			

			while(scan.hasNext()){

					String str1 = scan.next();
					n = Integer.valueOf(str1).intValue(); 

					val.add(n);

			}

						

			

			ArrayList<Integer> res = new ArrayList<Integer>();

			res = calc_gcd_lcm(val);

			print_calc(res);

	}

}

Measured memory_bytes: 12000
#include <iostream>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <cmath>
#include <map>
#include <utility>
#include <queue>
#define ull unsigned long long
#define ll long long
#define mod 998244353
using namespace std;

int n;
int h[100001];
vector <int> dp(100001, 0);

int main()
{
    cin>>n;

    for (int i=0;i<n;i++){
        cin>>h[i];
    }

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

    cout<<dp[n-1];
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <cmath>
#include <string>
#include <iterator>
#define FI first
#define SE second
#define PF push_front
#define PB push_back
#define POF pop_front
#define POB pop_back
#define MA make_pair
#define ll long long
#define PA pair<ll,ll>
#define VE vector<ll>
#define VP vector<pair<ll,ll> >
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ROF(i,a,b) for(int i=b-1;i>=a;i--)
#define YES(i) cout<<(i?"YES":"NO")<<endl
#define Yes(i) cout<<(i?"Yes":"No")<<endl
using namespace std;
//
const int INF=1e9+7;
const int mod=1e9+7;
//
int main(){
  int H,W;
  char S[50][50];
  cin>>H>>W;
  FOR(i,0,H){
    FOR(j,0,W){
      cin>>S[i][j];
    }
  }
  FOR(i,0,H){
    FOR(j,0,W){
      if(S[i][j]=='#'){
        if(i-1>=0&&S[i-1][j]=='#'){
          continue;
        }else if(j-1>=0&&S[i][j-1]=='#'){
          continue;
        }else if(i+1<H&&S[i+1][j]=='#'){
          continue;
        }else if(j+1<W&&S[i][j+1]=='#'){
          continue;
        }else{
          Yes(0);
          return 0;
        }
      }
    }
  }
  Yes(1);
  return 0;
}

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

#ifndef ONLINE_JUDGE
#define debarr(a,x,y)cerr<<#a<<":";for(int i=x;i<=y;i++)cerr<<a[i]<<" ";cerr<<endl;
#define debmat(mat,row,col)cerr<<#mat<<":\n";for(int i=0;i<row;i++){for(int j=0;j<col;j++)cerr<<mat[i][j]<<" ";cerr<<endl;}
#define deb(...)dbs(#__VA_ARGS__,__VA_ARGS__)
template<class S, class T>ostream &operator<<(ostream &os, const pair<S, T> &p) {return os << "(" << p.first << "," << p.second << ")";}
template<class T>ostream &operator<<(ostream &os, const vector<T> &p) {os << "["; for (auto&it : p)os << it << " "; return os << "]";}
template<class T>ostream &operator<<(ostream &os, const set<T>&p) {os << "["; for (auto&it : p)os << it << " "; return os << "]";}
template<class T>ostream &operator<<(ostream &os, const multiset<T>&p) {os << "["; for (auto&it : p)os << it << " "; return os << "]";}
template<class S, class T>ostream &operator<<(ostream &os, const map<S, T>&p) {os << "["; for (auto&it : p)os << it << " "; return os << "]";}
template<class T>void dbs(string str, T t) {cerr << str << ":" << t << "\n";}
template<class T, class...S>void dbs(string str, T t, S... s) {int idx = str.find(','); cerr << str.substr(0, idx) << ":" << t << ","; dbs(str.substr(idx + 1), s...);}
#else
#define deb(...){}
#define debarr(a,x,y){}
#define debmat(mat,row,col){}
#endif
#define pr(x) {cout << x << "\n"; return;}
template<class T> bool umin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool umax(T &a, T b) { return a < b ? (a = b, true) : false; }

#define int              long long
#define ld               long double
#define fi               first
#define se               second
#define mp               make_pair
#define pb               push_back
#define rep(i,n)         for(int i=0;i<n;i++)
#define re(i,n)          for(int i=1;i<=n;i++)
#define fr(i,a,b)        for(int i=a;i<=b;i++)
#define fb(i,a,b)        for(int i=a;i>=b;i--)
#define sz(x)            (int)x.size()
#define all(x)           x.begin(),x.end()
#define ini(x,y)         memset(x,y,sizeof(x))
typedef vector<int>      vi;
typedef pair<int, int>   pii;
typedef vector<pii>      vii;
typedef map<int, int>    mii;
typedef set<int>         si;
const int N = 2e5 + 10;


void solve(int tc)
{
	string s; cin >> s;
	if (s.back() == 's') cout << (s + "es");
	else cout << s + 's';

}




signed main() {
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	int t = 1;
	//cin >> t;
	for (int i = 1; i <= t; i++) solve(i);
	return 0;
}

Measured memory_bytes: 3656
import java.io.*;

class Stack{
	private int[] StackArray;
	private final int maxSize = 100;
	private int top;
	
	public Stack(){
		StackArray = new int[maxSize];
		top = -1;
	}
	public int pop(){
		return StackArray[top--];
	}
	public void push(int o){
		StackArray[++top] = o;
	}
	public int peak(){
		return StackArray[top];
	}
}

public class Main {
	public static void main(String[] args)throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] op = br.readLine().split(" ");
		Stack st = new Stack();
		
		for(int i = 0;i<op.length;i++){
			char ch = op[i].charAt(0);
			int a,b;
			switch(ch){
				case '+':
					a = st.pop();
					b = st.pop();
					st.push(b+a);
					break;
				case '-':
					a = st.pop();
					b = st.pop();
					st.push(b-a);
					break;
				case '*':
					a = st.pop();
					b = st.pop();
					st.push(b*a);
					break;
				case '/':
					a = st.pop();
					b = st.pop();
					st.push(b/a);
					break;
				default:
					st.push(Integer.parseInt(""+op[i]));
					break;
			}
		}
		System.out.println(st.peak());
	}
}

Measured memory_bytes: 24340
s = "0" + gets.chomp
s = s.chars.map(&:to_i)
n = s.length
dp = Array.new(n+1){[10**9]*2}
dp[0][0] = 0
n.times do |i|
  d = s[i]
  dp[i+1][0] = [dp[i][0] + d, dp[i][1] + 10 - d].min
  dp[i+1][1] = [dp[i][0] + d + 1, dp[i][1] + 9 - d].min
end
p dp[n][0]

Measured memory_bytes: 162956
//#include "stdafx.h"
#include <iostream>
#include <set>
#include <queue>
#include <vector>
#include <algorithm>
#include <math.h>
#include <cmath>
#include <string>
#include <cstring>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
#include <tuple>
#include <numeric>
#include <assert.h>
#include <functional>
#include <unordered_map>

using namespace std;

/*-----------------------------------------------------------------------------
　定義
 -------------------------------------------------------------------------------*/
#define REP(i, n)				for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n)			for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define INF						2e9
#define MOD						(1000 * 1000 * 1000 + 7)
#define Ceil(x, n)				(((((x))+((n)-1))/n))		/* Nの倍数に切り上げ割り算 */
#define CeilN(x, n)				(((((x))+((n)-1))/n)*n)		/* Nの倍数に切り上げ */
#define FloorN(x, n)			((x)-(x)%(n))				/* Nの倍数に切り下げ */
#define IsOdd(x)				(((x)&0x01UL) == 0x01UL)			
#define IsEven(x)				(!IsOdd((x)))						
#define	BitSetV(Val,Bit)		((Val) |= (Bit))			
#define	BitTstV(Val,Bit)		((Val) & (Bit))				
#define ArrayLength(x)			(sizeof( x ) / sizeof( x[ 0 ]))
#define	MAX_QWORD				((QWORD)0xFFFFFFFFFFFFFFFF)
#define M_PI					3.14159265358979323846
typedef long long				ll;
typedef unsigned long long int	QWORD;
typedef pair<ll, ll>			P;

/*-----------------------------------------------------------------------------
　処理
 -------------------------------------------------------------------------------*/
int main()
{
	int N;
	cin >> N;
	vector<double> x(N);
	vector<string> u(N);
	REP(i, N) {
		cin >> x[i];
		cin >> u[i];
	}

	double ans = 0;
	REP(i, N) {
		if (u[i] == "JPY") {
			ans += x[i];
		} else {
			ans += (x[i] * 380000.0);
		}
	}

	cout << setprecision(16) << ans << endl; 
	return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<bits/stdc++.h>
using namespace std;
int con(string s){
  if(s=="yotta") return 24;
  if(s=="zetta") return 21;
  if(s=="exa") return 18;
  if(s=="peta") return 15;
  if(s=="tera") return 12;
  if(s=="giga") return 9;
  if(s=="mega") return 6;
  if(s=="kilo") return 3;
  if(s=="hecto") return 2;
  if(s=="deca") return 1;
  if(s=="deci") return -1;
  if(s=="centi") return -2;
  if(s=="milli") return -3;
  if(s=="micro") return -6;
  if(s=="nano") return -9;
  if(s=="pico") return -12;
  if(s=="femto") return -15;
  if(s=="ato") return -18;
  if(s=="zepto") return -21;
  if(s=="yocto") return -24;
  return 0;
}
int main(){
  int n;
  int i,j,k,x;
  cin >> n;
  while(n--){
    x=0;
    string s1="",s2="",s3="";
    cin >> s1 >> s2;
    while(con(s2)!=0) {
      x+=con(s2);
      //cout << x << endl;
      cin >> s2;
    }
    s3=s2;
    if(s1[0]=='0'){
      k=1; 
      j=0;
      while(s1[k]!='.') {
        k++;
        j++;
      }
      k++;
      while(s1[k]=='0') {
        k++;
      }
      cout << s1[k];
      if(k!=s1.size()-1){
        cout << ".";
        for(i=k+1;i<s1.size();i++) cout << s1[i];        
      }
      cout << " * 10^" << x-(k-1)+j;
      cout << " " << s3 << endl;
    }else{
      k=1;
      bool f=false;
      if(s1.size()==1) {
        f=true;
        cout << s1[0];
      }else{
        while(s1[k]!='.') {
          k++;
          if(k>=s1.size()) {
            f=true;
            break;
          }
        }
        cout << s1[0];
        if(k!=1){
          //cout << k<<endl;
          cout << ".";
          for(i=1;i<k;i++) cout << s1[i]; 
          if(f&&k<s1.size()) cout << s1[k];  
          for(i=k+1;i<s1.size();i++)cout << s1[i];   
        }else{
          cout << ".";
          for(i=k+1;i<s1.size();i++) cout << s1[i];   
        }
      }
      //cout << (int)x+(int)(s1.size()-1)  << endl;
      if(f) cout << " * 10^" << (int)x+(int)(s1.size()-1);
      else cout << " * 10^" << x+k-1;
      cout << " " << s3 << endl;
    }
    
  }
  return 0;
}

Measured memory_bytes: 1224
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

n,p = map(int,input().split())
f = factorization(p)
ans = 1
for i, ff in enumerate(f):
    if ff[1] >= n:
        ans *= ff[0] ** (ff[1]//n)
print(ans)


Measured memory_bytes: 3064
using System;
using System.Collections.Generic;
using System.Linq;
using static Atcoder;
using System.Threading.Tasks;
using System.ComponentModel;

public class Hello
{

    public static void Main()
    {
        int N = intRead();
        int[] A = SpRead(' ').Select(a => int.Parse(a)).ToArray();
        List<int> Ax = new List<int>();
        Ax.Add(0);
        foreach (int i in A) Ax.Add(i);
        Ax.Add(0);
        int B = 0;
        int S = 0;
        for (int i = 1; i <= N + 1; i++) { S += Math.Abs(Ax[i] - Ax[i - 1]); }
        for (int i = 1; i <= N; i++)
        {
            Console.WriteLine(S + Math.Abs(Ax[i - 1] - Ax[i + 1]) - (Math.Abs(Ax[i - 1] - Ax[i]) + Math.Abs(Ax[i] - Ax[i + 1])));
        }
    }

}


public class Atcoder
{
    static void Swap<T>(ref T a, ref T b)
    {
        var t = a;
        a = b;
        b = t;
    }
    public static int LCM(int a, int b)
    {
        int c = a * b;
        if (a < b) Swap(ref a, ref b);
        int d = a % b;
        while (d != 0)
        {
            a = b;
            b = d;
            d = a % b;
        }
        return c / b;
    }
    public static string strReverce(string s)
    {
        return new string(s.Reverse().ToArray());
    }
    public static int intRead()
    {
        return int.Parse(Console.ReadLine());
    }
    public static bool IsPrime(int n)
    {
        if (n < 2) return false;
        if (n == 2) return true;
        if (n % 2 == 0) return false;

        //double sqrtNum = Math.Sqrt(n);
        for (int i = 3; i < n; i += 2)
        {
            if (n % i == 0) return false;
        }
        return true;
    }
    public static string[] SpRead(char c)
    {
        return Console.ReadLine().Split(c);
    }
}


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

int main() {
  int N;
  cin >> N;
  vector<pair<int,int>> CSD(N);
  for (int i = 0; i < N; i++) {
    int x,y;
    cin >> x >> y;
    CSD[i] = make_pair(x+y,x-y);
  }
  sort(CSD.begin(),CSD.end());
  int MIN1 = CSD[0].first, MAX1 = CSD[N-1].first;
  int MAX2, MIN2;
  for (int i = 0; i < N; i++) {
    if (i == 0) {
      MAX2 = CSD[0].second;
      MIN2 = CSD[0].second;
    }
    else {
      MAX2 = max(MAX2,CSD[i].second);
      MIN2 = min(MIN2,CSD[i].second);
    }
  }
  cout << max(MAX1-MIN1,MAX2-MIN2) << endl;
}

Measured memory_bytes: 4772
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    char[] c = s.toCharArray();
    int total = 0;
    for(int i = 0;i<s.length();i++){
      if(c[i] == '1'){
        total += 1;
      }else if(c[i] == '2'){
        total += 2;
      }else if(c[i] == '3'){
        total += 3;
      }else if(c[i] == '4'){
        total += 4;
      }else if(c[i] == '5'){
        total += 5;
      }else if(c[i] == '6'){
        total += 6;
      }else if(c[i] == '7'){
        total += 7;
      }else if(c[i] == '8'){
        total += 8;
      }else if(c[i] == '9'){
        total += 9;
      }
    }
    if(total % 9 == 0){
      System.out.println("Yes");
    }else{
      System.out.println("No");
    }
  }
}


Measured memory_bytes: 40560
#include <stdio.h>

int main(void){
	
	int a,b,c,d,e,f;
	int g,h,i,j,k,l;
	int ans;
	
	scanf("%d %d %d %d %d %d",&a,&b,&c,&d,&e,&f);
	
	g=1*a;
	h=5*b;
	i=10*c;
	j=50*d;
	k=100*e;
	l=500*f;
	
	ans=g+h+i+j+k+l;
	
	if(ans>=1000){
		printf("1\n");
	}else{
		printf("0\n");
	}
	return 0;
}

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

void boost(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}

int main(){
    boost();
    ll a;
    long double c;
    cin >> a >> c;
    ll ans = a*c;
    cout << ans << endl;
}

Measured memory_bytes: 3760
import sys
readline = sys.stdin.buffer.readline

s = readline().rstrip().decode('utf-8')
s = s[::-1]
n = len(s)
l = ["dreamer","dream","eraser", "erase"]
for i in range(4):
    l[i] = l[i][::-1]

i=0
while i < n:
    flag = 0
    for j in range(4):
        if i+len(l[j]) <= n and s[i:i+len(l[j])] == l[j]:
            i += len(l[j])
            flag = 1
            break
    if not flag:
        print("NO")
        exit()
print("YES")

Measured memory_bytes: 41968
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args)throws Exception {
        BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
        StringBuilder word = new StringBuilder(input.readLine());
        for (int i = 0; i < word.length(); i++) {
            if (word.charAt(i) == '1'){
                word.setCharAt(i, '9');
            }else{
                word.setCharAt(i, '1');
            }
        }
        System.out.println(word);
    }
}


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

using namespace std;
typedef long long ll;
#define rep(i,j,n) for (int i = j; i < (n); i++)
#define CLR(mat) memset(mat, 0, sizeof(mat))
#define IN(a, b, x) (a<=x&&x<b)
#define out(ans) cout << ans << endl
typedef pair<ll,ll>P;
const ll mod=1e9+7;
const ll INF = 1e9;


int main(){

  int n;cin>>n;
  int a[n+10],b[n+10],c[n+10];
  rep(i,0,n){cin>>a[i];a[i]--;}
  rep(i,0,n)cin>>b[i];
  rep(i,0,n-1)cin>>c[i];
  a[n]=0;
  b[n]=0;
  c[n]=0;

  int ans=0;

  rep(i,0,n){
    ans+=b[a[i]];
    if(a[i+1]-a[i]==1)ans+=c[a[i]];
  }

  out(ans);

  return 0;
}


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

using namespace std ;

#define sz(v) (int)v.size()
#define ll long long
#define all(v)  v.begin() , v.end()
#define rall(v)  v.rbegin() , v.rend()
#define pf push_front
#define pb push_back
#define fast FastInputOutput() ;
#define Clear( container , value ) memset( container , value , sizeof container )
#define PI acos( -1.0 )
#define forn( t , v , be , n ) for( t v = be ; v < n ; v++ )
#define fore( x , j ) for( auto x : j )
#define se second
#define fr first
//#define c_b fflush(stdin);

const ll Long_max = numeric_limits < ll > :: max() ;
const int Int_max = numeric_limits < int > :: max() ;

int dx[ ] = { 1, -1, 0, 0, 1, -1, -1, 1 } ;
int dy[ ] = { 0, 0, -1, 1, 1, -1, 1, -1 } ;

void File_input( string pathIn ) {
    freopen( pathIn.c_str(), "r", stdin ) ;
}

void File_output( string pathOut ) {
    freopen( pathOut.c_str(), "w", stdout ) ;
}

int msg() {
    srand( time( 0 ) ) ;
    vector < string > st = {
        "Wish everyone high ratings!",
        "Good luck!",
        "Have fun!",
        "Please, read all the problems!",
        "Go Go fight!"
    } ;
    cerr << st[ rand() % sz( st ) ] ;
    return 0 ;
}


void FastInputOutput() {
    ios_base :: sync_with_stdio( 0 ) ;
    cin.tie( 0 ) ;
    cout.tie( 0 ) ;
}

int a , b , c ;

int main(){

   cin >> a >> b >> c ;
   cout << ( a + b >= c ? "Yes" : "No" ) ;
}


Measured memory_bytes: 256
N,M = input().split()
s,c,a = [],[],[]
number = []
for i in range(int(M)):
    a_i = input().split()
    a.append(a_i)
    s.append(int(a_i[0]))
    c.append(int(a_i[1]))
ans = True
for i in range(int(N)):
    number.append('')
for i in range(int(M)):
    if s[i]==1 and c[i]==0 and int(N)>1:
        if ans:
            print('-1')
            ans = False
    elif s[i] > int(N):
        if ans:
            print('-1')
            ans = False
    elif number[s[i]-1] == '' or number[s[i]-1] == c[i]:
        number[s[i]-1] = c[i]
    else:
        if ans:
            print('-1')
            ans = False
for i,elem in enumerate(number):
    if number[i] == '' and i == 0 and int(N) >1:
        number[i] = 1
    elif elem == '':
        number[i] = 0
if ans:
    strs = '' 
    for i in number:
        strs += str(i)
    print(int(strs))

Measured memory_bytes: 3192
#include<iostream>
#include<string>
#include<algorithm>
#include<utility>
#include<numeric>
#include<vector>
#include<map>
#include<set>
#include<tuple>
#include<stack>
#include<queue>
#include<functional>
#include<iterator>
#include<cmath>

using namespace std;

typedef pair<int,int> P;


const int max_n = 1e5;

int par[max_n];
int rnk[max_n];

void init(int n){
	for(int i=0; i<n; i++){
		par[i] = i;
		rnk[i] = 0;
	}
}

int find_root(int x){
	if(par[x] == x) return x;
	else			return par[x] = find_root(par[x]);
}

void unite(int x, int y){
	x = find_root(x);
	y = find_root(y);
	if(x == y) return;

	if(rnk[x] < rnk[y]){
		par[x] = y;
	}
	else{
		par[y] = x;
		if(rnk[x] == rnk[y]) rnk[x]++;
	}
}

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


int main(){
	int n,m;
	cin >> n >> m;

	init(n);

	int s,t;
	for(int i=0;i<m;i++){
		cin >> s >> t;
		unite(s,t);
	}

	int q;
	cin >> 	q;
	for(int i=0;i<q;i++){
		cin >> s >> t;
		if(same(s,t)) cout << "yes\n";
		else			cout << "no\n";
	}

	return 0;
}


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

struct data{
    int panel[8][8];
    bool check[8][8];
    int count;
};

int h,w,c;
int dx[4] = {1,0,-1,0};
int dy[4] = {0,1,0,-1};

void DFS(data& d,int x,int y, const int color, const int base_color){

    d.panel[y][x] = color;
    for(int i=0; i<4; i++){
        if(x+dx[i] >= 0 && x+dx[i] < w && y+dy[i] >= 0 && y+dy[i] < h){
            if(!d.check[y+dy[i]][x+dx[i]] && d.panel[y+dy[i]][x+dx[i]] == base_color){
                d.check[y+dy[i]][x+dx[i]] = true;
                DFS(d, x+dx[i], y+dy[i], color, base_color);
            }
        }
    }

}

int counter(data& d, int x, int y){

    int ret = 0;

    for(int i=0; i<4; i++){
        if(x+dx[i] >= 0 && x+dx[i] < w && y+dy[i] >= 0 && y+dy[i] < h){
            if(d.panel[y+dy[i]][x+dx[i]] == d.panel[0][0]){
                if(!d.check[y+dy[i]][x+dx[i]]) {
                    ret++;
                    d.check[y+dy[i]][x+dx[i]] = true;
                    ret += counter(d, x + dx[i], y + dy[i]);
                }
            }
        }
    }
    return ret;

}

const int color[6] = {1,2,3,4,5,6};

int main() {

    while(true){

        cin >> h >> w >> c;

        if(h == 0){
            break;
        }

        data start;

        for(int i=0; i<h; i++){
            for(int j=0; j<w; j++){
                cin >> start.panel[i][j];
                start.check[i][j] = false;
            }
        }

        start.count = 0;

        queue<data> q;

        q.push(start);

        int ans = 1;

        while(!q.empty()){

            data d = q.front();
            q.pop();

            data connection;

            for(int i=0; i<6; i++){
                connection = d;
                connection.count++;
                DFS(connection, 0, 0, color[i], d.panel[0][0]);
                if(connection.count == 5){
                    if(color[i] == c) {
                        for(int i=0; i<h; i++){
                            for(int j=0; j<w; j++){
                                connection.check[i][j] = false;
                            }
                        }
                        connection.check[0][0] = false;
                        int count = counter(connection, 0, 0);
                        ans = max(count, ans);
                    }
                    continue;
                }
                for(int i=0; i<h; i++){
                    for(int j=0; j<w; j++){
                        connection.check[i][j] = false;
                    }
                }
                q.push(connection);
            }

        }

        cout << ans << endl;

    }

    return 0;
}


Measured memory_bytes: 3424
#include<bits/stdc++.h>
#include<vector>
#include<cmath>
#include<string>
#include<sstream>
#define ll long long 
#define ld long double
#define rep(i,n) for(i=0;i<n;i++)
#define mod 1000000007
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL) 
using namespace std;
int main()
{
	fastio;
	int n,k,i;
    cin>>n;
    string str,a;
    cin>>str;
    cin>>k;
    rep(i,n)
    {
        if (str[i]!=str[k-1])
            a.push_back('*');
        else 
            a.push_back(str[i]);
    }
    cout<<a<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int N;
  int X;
  cin >> N >> X;
  vector<int> L;
  for(int i=0;i<N;i++){
    int tmp;
    cin >> tmp;
    L.push_back(tmp);
  }
  int D=0;
  int count=1;
  for(int i=0;i<N;i++){
    D = D + L.at(i);
    if(D>X)break;
    count++;
  }
  cout << count << endl;
}

Measured memory_bytes: 256
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include <prettyprint.hpp>
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
ll MOD = 1e9+7;

int E, F;

bool is_valid(int m_a, int m_s) {
    if (m_a > F) return false;

    if(m_s * (100 + E) > E * m_a) return false;

    return true;
}


int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    
    int A, B, C, D;
    cin >> A >> B >> C >> D >> E >> F;

    vector<int> s(F+1, -1);
    s[0] = 0;

    REP(i, F+1) {
        if(s[i] == -1) continue;

        if(is_valid(i + 100 * A, s[i])) s[i + 100 * A] = max(s[i + 100 * A], s[i]);

        if(is_valid(i + 100 * B, s[i])) s[i + 100 * B] = max(s[i + 100 * B], s[i]);

        if(is_valid(i + C, s[i] + C)) s[i + C] = max(s[i + C], s[i] + C);

        if(is_valid(i + D, s[i] + D)) s[i + D] = max(s[i + D], s[i] + D);
    }

    double d = 0;
    int m = 0;
    FOR(i, 1, F+1) {
        if (double(s[i]) / i >= d) {
            m = i;
            d = double(s[i]) / i;
        }
    }

    cout << m << " " << s[m] << endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mp make_pair
#define eb emplace_back
#define fi first
#define se second
using namespace std;
using cd = complex <double>;

const long long INF = 1e18; 
const int mod = 1e9 + 7;//200003;786433;998244353;
const double Pi = acos(-1);
  
void Fastio()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
}

int n, x, p;
int a[200005];

signed main()
{
	Fastio();
	cin >> n >> x;
	if(x == 1 || x == 2 * n - 1)
	{
		cout << "No";
		return 0;
	}
	cout << "Yes\n";
	if(x == 2)
	{
		if(n == 2)
		{
			cout << 1 << endl << 2 << endl << 3 << endl;
			return 0;
		}
		a[n - 1] = 4;
		a[n] = 2;
		a[n + 1] = 1;
		a[n + 2] = 3;
		p = 5;
		for(int i = 1; i <= 2 * n - 1; i++)
		{
			if(a[i] == 0)
			{
				a[i] = p;
				p++;
			}
		}
	}
	else
	{
		a[n - 1] = x - 1;
		a[n] = x;
		a[n + 1] = x + 1;
		a[n + 2] = x - 2;
		int p = 1;
		for(int i = 1; i <= 2 * n - 1; i++)
		{
			while(x - 2 <= p && p <= x + 1)
			{
				p++;
			}
			if(a[i] == 0)
			{
				a[i] = p;
				p++;
			}
		}
	}
	for(int i = 1; i <= 2 * n - 1; i++)
	{
		cout << a[i] << '\n';
	}
}

Measured memory_bytes: 4312
r={'N':(1,5,2,3,0,4),'S':(4,0,2,3,5,1),'E':(3,1,0,5,4,2),'W':(2,1,5,0,4,3)}
d=input().split()
for x in input():
    d=[d[y]for y in r[x]]
print(d[0])


Measured memory_bytes: 5568
#include <iomanip>
#include <random>
#include <time.h>
#include <vector>
#include <math.h>
#include <algorithm>
#include <queue>
#include <functional>
#include <map>
#include <string>
#include <iostream>
#include <cstdlib>
#include <typeinfo>

using namespace std;
int main() {
	long long int n, t, a[200020], ans = 0;
	cin >> n >> t;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		if (!i)ans += t;
		else {
			if (a[i] - a[i - 1] > t)ans += t;
			else ans += a[i] - a[i - 1];
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 1792
import java.io.*;
import java.util.*;


class Main {
    public static void main(String[] args) {
        MyScanner sc = new MyScanner();
        out = new PrintWriter(new BufferedOutputStream(System.out));
        int n=sc.nextInt();
        long[]a=new long[n];
        for(int i=0;i<n;++i)a[i]=sc.nextLong();
        long ans=0;
        long c=1;
        for(int i=0;i<n;++i){
            long q=(a[i]-1)/c;
            ans+=q;
            if(q>0)
                a[i]=1;
            c=Math.max(c,a[i]+1);
        }
        out.println(ans);
        out.close();
    }
    // http://codeforces.com/blog/entry/7018
    //-----------PrintWriter for faster output---------------------------------
    public static PrintWriter out;
    //-----------MyScanner class for faster input----------
    public static class MyScanner {
        BufferedReader br;
        StringTokenizer st;
        public MyScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }
        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
        int nextInt() {
            return Integer.parseInt(next());
        }
        long nextLong() {
            return Long.parseLong(next());
        }
        double nextDouble() {
            return Double.parseDouble(next());
        }
        String nextLine(){
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
}


Measured memory_bytes: 35832
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <array>
#include <stdio.h>
#include <string.h>
#include <math.h>
using namespace std;

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

    int n;
    cin >> n;

    vector<pair<int, int>> a(n * 3);
    for (int i = 0; i < n * 3; i++) {
        cin >> a[i].first;
        a[i].second = i;
    }

    sort(a.begin(), a.end());
    vector<int> b(n * 3);
    for (int i = 0; i < n * 3; i++) {
        b[a[i].second] = i;
    }

    vector<array<int64_t, 2>> sum(n + 1);
    int64_t r = -1LL << 60;
    for (int k = n; k <= n * 2; k++) {
        int h;
        if (k == n) {
            int64_t s = 0;
            int j = 0;
            for (int i = n * 3 - 1; i >= 0; i--) {
                if (a[i].second < k) {
                    s += a[i].first;
                    h = i;
                    if (++j >= n) break;
                }
            }
            sum[k - n][0] = s;
        } else {
            if (b[k - 1] > h) {
                sum[k - n][0] = sum[k - 1 - n][0] + a[b[k - 1]].first - a[h].first;
                for (h++; a[h].second >= k; h++);
            } else {
                sum[k - n][0] = sum[k - 1 - n][0];
            }
        }
    }
    for (int k = n * 2; k >= n; k--) {
        int h;
        if (k == n * 2) {
            int64_t s = 0;
            int j = 0;
            for (int i = 0; i < n * 3; i++) {
                if (a[i].second >= k) {
                    s += a[i].first;
                    h = i;
                    if (++j >= n) break;
                }
            }
            sum[k - n][1] = s;
        } else {
            if (b[k] < h) {
                sum[k - n][1] = sum[k + 1 - n][1] + a[b[k]].first - a[h].first;
                for (h--; a[h].second < k; h--);
            } else {
                sum[k - n][1] = sum[k + 1 - n][1];
            }
        }
        r = max(r, sum[k - n][0] - sum[k - n][1]);
    }

    cout << r << endl;

    return 0;
}

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

using namespace std;
#define endl "\n"

const int MOD = 1e9 + 7;

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

	string c;
	cin >> c;
	cout << (char)(c[0] + 1)  << endl;



	return 0;
}


Measured memory_bytes: 256