akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());
    ll n;
    cin >> n;
    vector<pair<ll, ll>> ab(n - 1);
    vector<vector<ll>> g(n);
    vector<ll> cnt(n, 0);
    rep(i, n - 1) {
        ll a, b;
        cin >> a >> b;
        a--; b--;
        ab[i] = make_pair(a, b);
        g[a].push_back(b);
        g[b].push_back(a);
        cnt[a]++;
        cnt[b]++;
    }
    ll mv = -1, mi = 0;
    rep(i, n) {
        if (mv < cnt[i]) {
            mv = cnt[i];
            mi = i;
        }
    }
    multiset<ll> s;
    rep(i, n) {
        ll c;
        cin >> c;
        s.insert(c);
    }
    auto it = s.end(); it--;
    vector<ll> ans(n, -1);
    queue<ll> q;
    q.push(mi);
    ans[mi] = *it; it--;
    while(!q.empty()) {
        ll v = q.front(); q.pop();
        for(auto x : g[v]) {
            if (ans[x] != -1) continue;
            ans[x] = *it;
            if (it != s.begin()) it--;
            q.push(x);
        }
    }
    ll score = 0;
    rep(i, n - 1) {
        ll a = ab[i].first, b = ab[i].second;
        score += min(ans[a], ans[b]);
    }
    printf("%lld\n", score);
    rep(i, n) printf("%lld%s", ans[i], (i == (n - 1)) ? "\n" : " ");
    return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int taka,ao,k;
    cin>>taka>>ao>>k;
    if(k>=ao+taka)
    cout<<0<<" "<<0;
    else 
    {
        if(k<=taka)
        {
            taka=taka-k;
        }
        else
        {k=k-taka;
        taka=0;
        if(k>=ao)
        {
            ao=0;
        }
        else
        ao=ao-k;
        }
        cout<<taka<<" "<<ao;
    }
    return 0;
}

Measured memory_bytes: 256
n = int(input())
s = []
for _ in range(n):
    s.append(input())

import collections
c = collections.Counter(s)
ans=[]
first=c.most_common()[0][1]
for tup in c.most_common():
    if tup[1] != first:
        break
    ans.append(tup[0])
ans.sort()

for i in ans:
    print(i)

Measured memory_bytes: 123260
#include <stdio.h>
#include <stdlib.h>
void paixu(int a[],int n)
{
    int i,k,t;
    for(i=1;i<n;i++){
        t=a[i];k=i-1;
        while(t>a[k]){
            a[k+1]=a[k];k--;
            if(k==-1)break;
        }
        a[k+1]=t;
    }
}
int main()
{
    int i,a[10];
    for(i=0;i<10;i++)
        scanf("%d",&a[i]);
    paixu(a,10);
    printf("%d\n%d\n%d\n",a[0],a[1],a[2]);
    return 0;
}



Measured memory_bytes: 2100
#include <bits/stdc++.h>
#define INF 2e18
#define MOD 10000007

using namespace std;

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

int a,b,c, d;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin>>a>>b>>c>>d;
    if (abs(c-a)<=d or (abs(b-a)<=d and abs(c-b)<=d)) cout<<"Yes";
    else cout<<"No";
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main() {
    string s, t;
    cin >> s;
    cin >> t;
    int l = s.size();
    for (int i = 0; i < l; ++i) {
        if (s == (t.substr(i, l) + t.substr(0, i))) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}

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

int main(){
  string S,T;
  cin>>S>>T;
  int q;
  cin>>q;
  std::vector<int> a(q),b(q),c(q),d(q);
  for(int i=0;i<q;i++)cin>>a[i]>>b[i]>>c[i]>>d[i];

  std::vector<int> s(S.size()+1),t(T.size()+1);
  s[0]=0;
  t[0]=0;
  for(int i=1;i<=S.size();i++){
    s[i]=s[i-1]+1;
    if(S[i-1]=='B')s[i]++;
  }
  for(int i=1;i<=T.size();i++){
    t[i]=t[i-1]+1;
    if(T[i-1]=='B')t[i]++;
  }

  for(int i=0;i<q;i++){
    if(((s[b[i]]-s[a[i]-1])-(t[d[i]]-t[c[i]-1]))%3==0)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
  }
}


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

#define int long long
using namespace std;
#define rep(i, n) for(int i=0;i<(n);++i)
typedef pair<int, int> pii;
const int INF = 1l << 60;

template<int M = 1000000007>
struct ModInt {
    int data;

    ModInt(int data) : data(data) {}

    ModInt() : data(0) {}

    inline ModInt<M> operator+(ModInt<M> const &right) const {
        int temp = data + right.data;
        return ModInt(temp > M ? temp - M : temp);
    }

    inline ModInt<M> &operator+=(ModInt<M> const &right) {
        data += right.data;
        data = data > M ? data - M : data;
        return *this;
    }

    inline ModInt<M> operator-(ModInt<M> const &right) const {
        int temp = data - right.data;
        return ModInt(temp < 0 ? temp + M : temp);
    }

    inline ModInt<M> &operator-=(ModInt<M> const &right) {
        data -= right.data;
        data = data < 0 ? data + M : data;
        return *this;
    }

    inline ModInt<M> operator*(ModInt<M> const &right) const {
        int temp = data * right.data % M;
        return ModInt(temp < 0 ? temp + M : temp);
    }

    inline ModInt<M> &operator*=(ModInt<M> const &right) {
        data = data * right.data % M;
        data = data < 0 ? data + M : data;
        return *this;
    }

    inline bool operator==(ModInt<M> const &right) const {
        return data == right.data;
    }

    inline bool operator!=(ModInt<M> const &right) const {
        return data != right.data;
    }

    inline operator int() const {
        return data;
    }
};

template<int M = 1000000007>
inline ostream &operator<<(ostream &os, const ModInt<M> mi) {
    os << mi.data;
    return os;
}

template<int M = 1000000007>
ModInt<M> powm(int a, int b) {
    ModInt<M> res = 1;
    while (b) {
        if (b & 1)res *= a;
        b >>= 1;
        a *= a;
        a %= M;
    }
    return res;
}

template<int M = 1000000007>
ModInt<M> comb(int n, int r) {
    if (n - r > r)return comb(n, n - r);
    ModInt<M> nn = 1;
    for (int i = r + 1; i <= n; ++i) {
        nn *= i;
    }
    ModInt<M> rr = 1;
    for (int i = 1; i <= n - r; ++i) {
        rr *= i;
    }
    return nn * powm(rr, M - 2);
}

const int mod = 1000000007;

signed main() {
    int n, a, b;
    cin >> n >> a >> b;
    //(2^n-1)-nCa-nCb
    ModInt<mod> ans = powm(2, n);
    ans += mod - 1;
    ans -= comb(n, a);
    ans -= comb(n, b);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#define rep(i, n) for ((i) = 0; (i) < (n); (i)++)

int main(void) {
    int n, i, j, len, t_score, h_score;
    int flag, t_len, h_len;
    char card_t[101] = {'\0'};
    char card_h[101] = {'\0'};
    t_score = 0;
    h_score = 0;

    scanf("%d", &n);

    rep(i, n) {
        scanf("%s %s", card_t, card_h);
        t_len = strlen(card_t);
        h_len = strlen(card_h);
        len = t_len > h_len ? h_len : t_len;
        flag = 0;
        rep(j, len) {
            if (card_t[j] < card_h[j]) {
                h_score += 3;
                flag = 1;
                break;
            } else if (card_t[j] > card_h[j]) {
                t_score += 3;
                flag = 1;
                break;
            }
        }
        if (flag) continue;
        if (t_len > h_len) t_score += 3;
        else if (t_len < h_len) h_score += 3;
        else {
            t_score++;
            h_score++;
        }
    }
    printf("%d %d\n", t_score, h_score);
    return 0;
}


Measured memory_bytes: 2056
#include<bits/stdc++.h> 
using namespace std; 
#define ll long long
#define pii pair<int,int>
#define ff first
#define ss second
#define vi vector<int>
#define fo(n) for(int i = 0;i < int(n);i++)
#define foo(a,b) for(int i = int(a);i <= int(b);i++)
#define mk make_pair
#define pb push_back
#define MAXN (int)1e6
#define mod 1000000007
#define all(x) x.begin(),x.end()
#define fastio ios_base:: sync_with_stdio(false)
#define inf (int)1e9

int main(){
	
	fastio;
	int n,x;
	cin >> n >> x;

	vi arr(n);
	fo(n) cin >> arr[i];

	int sum = 0;
	int t = n+1;

	for(int i = 0;i < n;i++){
		sum += arr[i];

		if(sum > x){
			t = i+1;
			break;
		}
	}

	cout << t << endl;

	return 0;
 }	

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int n,k;
vector <int> w;

bool check(int m) {

  int i=0;
  int cnt =0;
  while(1) {
    cnt++;
    if(cnt > k) return false;
    int sum =0;
    while(sum+w[i] <= m && i != n) sum+= w[i], i++;
    if(i == n) break;
  }

  return true;

}


int bainary_search(int R) {
  int L=0,M;

  while(L<R){
    M=(L+R)/2;
    if(check(M) == true) R = M;//,cout <<"true"<<endl;
    else L = M+1;
  }
  return L;

}

int main() {

  cin >> n >> k;

  w.resize(n);
  int maxR = 0;
  for(int i=0;i<n;i++) cin >> w[i],maxR+=w[i];
  
  cout <<  bainary_search(maxR) <<endl;

  return 0;
}

Measured memory_bytes: 1536
#include <stdio.h>
#include<string.h>
int main()
{
    char s[105];int x=1,y=1,z=1,l;
    scanf("%s",s);
    l=strlen(s);
    for(int i=0,j=(l-3)/2;i<j;i++,j--)
    {
        if(s[i]!=s[j])
        {
            x=0;
            break;
        }
    }
    for(int i=(l+1)/2,j=l-1;i<j;i++,j--)
    {
        if(s[i]!=s[j])
        {
            y=0;
            break;
        }
    }
    for(int i=0,j=l-1;i<j;i++,j--)
    {
        if(s[i]!=s[j])
        {
            z=0;
            break;
        }
    }
    if(x&y&z)
    printf("Yes\n");
    else
    printf("No\n");
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fastio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
const int maxn = 1e9 + 5;
#define INF 1000000000
const int MOD = 1e9+7;
const double PI = 3.14159265358979323846264338;



int main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	fastio	
	int h,w;
	cin >> h >> w;
	std::vector<string> a(h);
	for(int i=0; i<h; i++)cin >> a[i];
	std::vector<bool> row(h,false);
	std::vector<bool> col(w,false);
	for(int i=0; i<h; i++){
		for(int j=0; j<w; j++){
			if(a[i][j] == '#'){
				row[i]=true;
				col[j]=true;
			}
		}
	}
	for(int i=0; i<h; i++){
		if(row[i]){
			for(int j=0; j<w; j++){
				if(col[j]){
					cout << a[i][j];
				}
			}
			cout << "\n";			
		}
	}
	return 0;
}



Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define fi first
#define se second
#define pb push_back
#define rep(i, s, n) for (int i = s; i < n; i++)
#define rrep(i, s, n) for (int i = (n)-1; i >= (s); i--)
#define REP(i,n) for(int i = 0;i < n; i++)
#define all(a) a.begin(),a.end()
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
const long long MOD = 1000000007, INF = 1e18;
 
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0)
 
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;}
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;}
template<typename T>vector<T>
make_v(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
	return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}
 
template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}
 
template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){
	for(auto &e:t) fill_v(e,v);
}

/*bool operator<(const data &d)const{
	return hoge;
}*/

int N,M;

pair<int,int>solve(){
	vector<int>g[N];
	rep(i,0,M){
		int a,b;
		cin>>a>>b;
		a--;
		b--;
		g[a].push_back(b);
		g[b].push_back(a);
	}
	vector<int>color(N,-1);
	stack<int>st;
	st.push(0);
	color[0]=1;
	while(!st.empty()){
		int now = st.top();
		st.pop();
		for(auto e:g[now]){
			if(color[e]!=-1){
				if(color[e]!=color[now]^1)return{-1,-1};
				continue;
			}
			color[e]=color[now]^1;
			st.push(e);
		}
	}
	int black = 0,white = 0;
	rep(i,0,N){
		if(color[i])black++;
		else white++;
	}
	if(black&1)black = -1;
	else black /= 2;
	if(white&1)white = -1;
	else white /= 2;
	return {black,white};
}
 
signed main(){
	IOS();
	vector<pair<int,int>>ans;
	while(cin>>N>>M,N||M){
		auto t = solve();
		ans.push_back(t);
	}
	for(auto e:ans){
		if(e.fi==-1&&e.se==-1)cout<<0<<endl;
		else if(e.fi==-1||e.se==-1){
			cout<<1<<endl;
			cout<<max(e.fi,e.se)<<endl;
		}else if(e.fi==e.se){
			cout<<1<<endl;
			cout<<e.fi<<endl;
		}else{
			cout<<2<<endl;
			cout<<min(e.fi,e.se)<<endl;
			cout<<max(e.fi,e.se)<<endl;
		}
	}
}


Measured memory_bytes: 3244
(function() {
    'use strict';

    var fs = require('fs');
    var contents = fs.readFileSync('/dev/stdin', 'utf-8');

    var printTest = function(contents) {
        var a = contents.trim().split("\n");
        for (var i = 0; i < a.length; i++) {
            var n = parseInt(a[i]);
            if (n === 0) {
                break;
            }
            console.log("Case " + (i + 1) + ": " + n);
        }
    }

    printTest(contents);
})();

Measured memory_bytes: 20888
def zero_index(i: str) -> int:
  return int(i) - 1

n, k = map(int, input().split())
transition = list(map(zero_index, input().split()))
places = [0]
next_place = transition[0]
virgin = [True] * n
virgin[0] = False
while virgin[next_place]:
  virgin[next_place] = False
  places.append(next_place)
  next_place = transition[next_place]
start = places.index(next_place)
period = len(places) - start
if k < start:
  t = k
else:
  t = (k - start) % period + start
print(places[t] + 1)

Measured memory_bytes: 32176
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        a: usize,
        b: usize,
    }
    let mut ans = String::from("");
    if a <= b { 
        for _ in 0..b {
            ans = ans + &a.to_string()
        }
    } else {
        for _ in 0..a {
            ans = ans + &b.to_string()
        }
    };

    println!("{}", ans);
}

Measured memory_bytes: 4352
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <algorithm>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,b) FOR(i,0,b)
#define PB push_back
#define MP make_pair
pair<int,int> seg[1<<18];
void update(int k,int x){
  int id=k;
  k+=(1<<17)-1;
  seg[k].first+=x;
  seg[k].second=id;
  while(k>0){
    k=(k-1)/2;
    if(seg[k*2+1].first>=seg[k*2+2].first)seg[k]=seg[k*2+1];
    else seg[k]=seg[k*2+2];
  }
}

int main(){
  int n,r,l;
  int team[100000];
  memset(team,0,sizeof(team));
  cin>>n>>r>>l;
  for(int i=0;i<n;i++)update(i,0);
  int now=0,top=0;
  for(int i=0;i<r;i++){
    int a,b,c;
    cin>>a>>b>>c;a--;
    team[top]+=b-now;
    update(a,c);
    top=seg[0].second;
    now=b;
  }
  team[top]+=l-now;
  int ans=0;
  for(int i=1;i<n;i++)if(team[ans]<team[i])ans=i;
  cout<<ans+1<<endl;
  return 0;
}

Measured memory_bytes: 3604
import fractions
n,x0= map(int, input().split())
x= list(map(int, input().split()))
x.append(x0)
a=min(x)
for i in range(n+1):
    x[i]-=a
for i in range(n):
    x[i+1]=fractions.gcd(x[i],x[i+1])
print(x[-1])

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

typedef long long int ll;
#define mod 1000000007

ll dp[150][150];
ll n;

typedef long long int ll;

int main(){

    n;
    cin>>n;

    ll arr[n];
    vector <ll> vec;
    for(ll i=0;i<n;i++){
     ll x;
     cin>>x;
     vec.push_back(x);
    }
    //reverse(vec.begin(),vec.end());
    ll s = n;

    vector <ll> ans;
    vector <ll> temp;
    ll c = s;
    while(s>0){
        /*for(ll i=0;i<vec.size();i++){
            cout<<vec[i]<<" ";
        }cout<<endl;*/
        ll i;
        for(i=-1+vec.size();i>=0;i--){
            if(vec[i]!=i+1){
                temp.push_back(vec[i]);
            }else{
                ans.push_back(vec[i]);
                s-=1;
                c = s;
                break;
            }
        }
        for(i=i-1;i>=0;i--){
            temp.push_back(vec[i]);
        }
        /*for(ll i=0;i<temp.size();i++){
            cout<<temp[i]<<" $ ";
        }cout<<endl;*/
        if(temp.size()==vec.size()){
           cout<<-1<<endl;
           return 0;
        }
        vec.clear();
        vec = temp;
        temp.clear();
        reverse(vec.begin(),vec.end());

    }

    for(ll i=-1+ans.size();i>=0;i--){
        cout<<ans[i]<<endl;
    }

}


Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String n = sc.next();
        int sum = 0;
        for (char c : n.toCharArray()) {
            sum += c - '0';
        }
		System.out.println((sum % 9 == 0) ? "Yes" : "No");
	}
}

Measured memory_bytes: 40444
#include <bits/stdc++.h>
#define ADD(a, b) a = (a + ll(b)) % mod
#define MUL(a, b) a = (a * ll(b)) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define all(a) (a).begin(), (a).end()
#define sz(v) (int)(v).size()
#define pb push_back
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<int, pi> ppi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> mat;
typedef complex<double> comp;
void Debug() {cerr << '\n'; }
template<class FIRST, class... REST>void Debug(FIRST arg, REST... rest){
	cerr<<arg<<" ";Debug(rest...);}
template<class T>ostream& operator<<(ostream& out,const vector<T>& v) {
	out<<"[";if(!v.empty()){rep(i,0,sz(v)-1)out<<v[i]<<", ";out<<v.back();}out<<"]";return out;}
template<class S, class T>ostream& operator<<(ostream& out,const pair<S, T>& v){
	out<<"("<<v.first<<", "<<v.second<<")";return out;}
const int MAX_N = 500010;
const int MAX_V = 100010;
const double eps = 1e-6;
const ll mod = 1000000007;
const int inf = (1 << 30) - 1;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;
mt19937 rng; //use it by rng() % mod, shuffle(all(vec), rng)
///////////////////////////////////////////////////////////////////////////////////////////////////

int H, N;
int A[MAX_N];

void solve() {
	cin >> H >> N;
	int sum = 0;
	rep(i, 0, N) {
		int a; cin >> a; sum += a;
	}
	cout << (H <= sum ? "Yes" : "No") << "\n";
}

uint32_t rd() {
	uint32_t res;
#ifdef __MINGW32__
	asm volatile("rdrand %0" :"=a"(res) ::"cc");
#else
	res = std::random_device()();
#endif
	return res;
}

int main() {
#ifndef LOCAL
	ios::sync_with_stdio(false);
    cin.tie(0);
#endif
    cout << fixed;
	cout.precision(20);
    cerr << fixed;
	cerr.precision(6);
	rng.seed(rd());
#ifdef LOCAL
	//freopen("in.txt", "wt", stdout); //for tester
	if(!freopen("in.txt", "rt", stdin)) return 1;
#endif	
	solve();
    cerr << "Time: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
	return 0;
}



Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {

	var a string

	if sc.Scan() {
		a = sc.Text()
	}

	for _, v := range a {
		if v >= 0x41 && v <= 0x5A {
			v += 0x20
		} else if v >= 0x61 && v <= 0x7A {
			v -= 0x20
		}

		fmt.Printf("%s", string(v))
	}

	fmt.Println("")
}



Measured memory_bytes: 1096
#include <stdio.h>
#include <string.h>

char weather[3][50] = {"Sunny", "Cloudy", "Rainy"};

int main(){
    char str[50];
    scanf("%s", str);
    for(int i = 0; i < 3; i++){
        if(strcmp(weather[i], str) == 0){
            printf("%s\n", weather[(i + 1) % 3]);
            return 0;
        }
    }
}

Measured memory_bytes: 128
while True:
    a = input().split()
    a[0] = int(a[0])
    a[1] = int(a[1])
    if a[0] == 0 and a[1] == 0:
        break
    if a[0] <= a[1]:
        print(a[0], a[1])
    else:
        print(a[1],a[0])


Measured memory_bytes: 5608
l =[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
i =int(input())
print(l[i-1])

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
 
int main() {
string s;cin>>s;
while(1){
s.pop_back();s.pop_back();
if(s.substr(0,s.size()/2)==s.substr(s.size()/2,s.size()/2)){
cout<<s.size()<<endl;return 0;
}
}
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>

int main() {
    int N;
    char S[10000];

    scanf("%d", &N);

    scanf("%s", S);

    int len = strlen(S);

    for (int i = 0; i < len; i++) {
        int x = S[i] - 'A';
        x = (x + N) % 26;
        putchar('A' + x);
    }
    printf("\n");

    return 0;
}

Measured memory_bytes: 128
#include<stdio.h>
    int main(void){
	int x,y,r,w,h;
    	scanf("%d %d %d %d %d",&w,&h,&x,&y,&r);
    	if(x-r<0 || x+r>w || y-r<0 || y+r>h){
    		printf("No\n");
    	}else if(x-r>=0 || x+r<=w || y-r>=0 || y+r<=h){
    		printf("Yes\n");
    	}
    	
	
	
	
                 return 0;	
}
 

Measured memory_bytes: 584
//#pragma GCC optimize ("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("avx,avx2,fma")

#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/rope>
#define pb push_back
#define F first
#define S second
#define ins insert
#define mp make_pair
#define fo(i, n1, n, x) for(int i = n1; i <= n; i += x)
#define foo(i, n, n1, x) for(int i = n; i >= n1; i -= x)
#define bit __builtin_popcount
#define md (l + ((r - l) / 2))
#define all(x) x.begin(),x.end()
#define eb emplace_back
#define ub upper_bound
#define lb lower_bound
#define ios ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define file(s) if (fopen(s".in", "r")) freopen(s".in", "r", stdin), freopen(s".out", "w", stdout)

using namespace std;
//using namespace __gnu_pbds;
//using namespace __gnu_cxx;


using ll = long long;

#define int ll

using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;



const int N = 2e5 + 11, mod = 1e9 + 7, mod2 = 998244353;
const int MAX = 1e5 + 11;
const int INF1 = 2e9 + 11;
const ll INF2 = 6e18 + 11;
const double INF3 = 1e8 + 11;
const int base = 500;
const int P = 31;
const int dx[] = {1, -1, 0, 0, 1, 1, -1, -1};
const int dy[] = {0, 0, 1, -1, 1, -1, 1, -1};
const double EPS = 1e-4;
const double PI = acos(-1.0);


//template<typename T> using ordered_set = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }


mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int x;
int root(int x) {
  int sign = 1;
  if (x < 0) sign = -1;
  x = abs(x);
  int l = 0, r = cbrtl(x);
  while (l <= r) {
    if (md * md * md * 1ll * md * md <= x) l = md + 1;
    else r = md - 1;
  }
  return (l - 1) * sign;
}
main() {
  file("threesum");
  ios;
  cin >> x;
  ll a = 6e18;
  a = root(a);
  fo(i, 1, a, 1) {
    int c = i * i * i * i * 1ll * i - x;
    int d = root(c);
    if (d * 1ll * d * d * d * d == c) return !(cout << i << " " << d);
  }
  return 0;
}
/**
a^5 = x + b^5
*/


Measured memory_bytes: 3712
#include<stdio.h>
#include<stdlib.h>

int main(void){

  char whe[3];
  int count=0,count_r=0;

  scanf("%s",whe);

for (int i = 0; i < 3; i++) {
  if((whe[i]!='R')&&(whe[i]!='S')){
    exit(1);
  }
}

  if(whe[0]=='R'){
    count++;
  }
  if((whe[0]=='R')&&(whe[1]=='R')){
    count++;
  }if((whe[1]=='R')&&(whe[2]=='R')){
    count++;
  }if((whe[0]!='R')&&(whe[1]=='R')&&(whe[2]!='R')){
    count=1;
  }if((whe[0]!='R')&&(whe[1]!='R')&&(whe[2]=='R')){
    count=1;
  }if((whe[0]!='R')&&(whe[1]=='R')&&(whe[2]=='R')){
    count=2;
  }
  printf("%d\n",count);



  return 0;
}

Measured memory_bytes: 1732
#include<cstdio>
#include<cstdlib>
#include<cstring>

struct Node{
	int key;
	Node *next, *prev;
};

Node *nil;

Node* listSearch(int key){
	Node *cur = nil->next;
	while(cur != nil && cur->key != key){
		cur = cur->next;
	}
	return cur;
}

void init(){
	nil = (Node *)malloc(sizeof(Node));
	nil->next = nil;
	nil->prev = nil;
}

void printList(){
	Node *cur = nil->next;
	int isf = 0;
	while( 1 ){
		if(cur == nil) break;
		if(isf++ > 0) printf(" ");
		printf("%d", cur->key);
		cur = cur->next;
	}
	printf("\n");
}

void deleteNode(Node *t){
	if(t == nil) return;
	t->prev->next = t->next;
	t->next->prev = t->prev;
	free(t);
}

void deleteFirst(){
	deleteNode(nil->next);
}

void deleteLast(){
	deleteNode(nil->prev);
}

void deleteKey(int key){
	deleteNode(listSearch(key));
}

void insert(int key){
	Node *x = (Node *)malloc(sizeof(Node));
	x->key = key;
	x->next = nil->next;
	nil->next->prev = x;
	nil->next = x;
	x->prev = nil;
}

int main(){
	int key, n , i;
	int size = 0;
	char com[20];
	int np = 0, nd = 0;
	scanf("%d",&n);
	init();
	for(i = 0; i<n; i++){
		scanf("%s%d",com,&key);
		if(com[0] == 'i'){ insert(key); np++; size++; }
		else if(com[0] == 'd'){
			if(strlen(com) > 6){
				if(com[6] == 'F') deleteFirst();
				else if( com[6] == 'L') deleteLast();
			}else{
				deleteKey(key); nd++;
			}
			size--;
		}
	}
	
	printList();
	
	return 0;
}

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

#define pb push_back
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define debug(x)  cerr << #x << " = " << x << endl
using namespace std;

typedef long long ll;
typedef long double ld;
typedef string str;
typedef pair<ll, ll> pll;

const ld PI = 3.14159265359;

const ll MOD = (ll) 998244353ll;
const ll MAXN = (ll) 2e5 + 10;
const ll INF = (ll) 2242545357980376863;
const ld EPS = (ld) 1e-8;

ll mk[MAXN], par[MAXN], deg[MAXN];
vector<ll> G[MAXN];

void DFS(ll u, ll p){
	par[u] = p;
	mk[u] = 1;
	for(auto adj : G[u]) if(mk[adj] == 0) DFS(adj, u);
}

queue<ll> q;
ll ord[MAXN];

bool CMP(ll i, ll j){
	return ord[i] < ord[j];
}

int main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	ll n, m;
	cin >> n >> m;
	ll u,v;
	for(int i = 0; i< n +m-1; i++){
		cin >> u >> v;
		deg[v] ++;
		G[u].pb(v);
	}
	ll root = -1;
	for(int i = 1; i <= n; i++) if(deg[i] == 0){
		root = i;
		q.push(i);
	}
	ll cnt = 0;
	ll fr;
	while(q.size()){
		fr = q.front();
		q.pop();
		for(auto adj : G[fr]){
			deg[adj] --;
			if(deg[adj] == 0) q.push(adj);
		}
		ord[fr] = cnt;
		cnt ++;
	}
	for(int i = 1; i<=n;i++) sort(all(G[i]), CMP);
	DFS(root, 0);
	
	
	
	for(int i = 1; i<= n;i++) cout << par[i] << '\n';
	return 0;
}


/*

                                 ____              ,----..               ,----..
   ,---,                       ,'  , `.           /   /   \             /   /   \
  '  .' \                   ,-+-,.' _ |          /   .     :           /   .     :
 /  ;    '.              ,-+-. ;   , ||         .   /   ;.  \         .   /   ;.  \
:  :       \            ,--.'|'   |  ;|        .   ;   /  ` ;        .   ;   /  ` ;
:  |   /\   \          |   |  ,', |  ':        ;   |  ; \ ; |        ;   |  ; \ ; |
|  :  ' ;.   :         |   | /  | |  ||        |   :  | ; | '        |   :  | ; | '
|  |  ;/  \   \        '   | :  | :  |,        .   |  ' ' ' :        .   |  ' ' ' :
'  :  | \  \ ,'        ;   . |  ; |--'         '   ;  \; /  |        '   ;  \; /  |
|  |  '  '--'          |   : |  | ,             \   \  ',  /          \   \  ',  /
|  :  :                |   : '  |/               ;   :    /            ;   :    /
|  | ,'                ;   | |`-'                 \   \ .'              \   \ .'
`--''                  |   ;/                      `---`                 `---`
                       '---'

*/


Measured memory_bytes: 16512
import java.util.Scanner;
public class Main {
	
	int toDigit(String str) {
		int digit = 0;
		int inc = 0;
		for(int r = str.length() - 1; r >= 0; r--) {
			digit += (int)((str.charAt(r) - '0') * Math.pow(10,  (inc++)));
		}
		return(digit);
	}
	
	int hit(String reply, String answer) {
		int count = 0;
		for(int r = 0; r < reply.length(); r++) {
			if(reply.charAt(r) == answer.charAt(r)) count++;
		}
		return(count);
	}
	
	int blow(String reply, String answer) {
		int count = 0;
		for(int r = 0; r < reply.length(); r++) {
			for(int c = 0; c < answer.length(); c++) {
				if(r == c) continue;
				else if(reply.charAt(r) == answer.charAt(c)) count++;
			}
		}
		return(count);
	}
	
	void doIt() {
		Scanner stdIn = new Scanner(System.in);
		String reply, answer;
		while(true) {
			reply = stdIn.next();
			answer = stdIn.next();
			if(toDigit(reply) + toDigit(answer) == 0) break;
			System.out.println(hit(reply, answer) + " " + blow(reply, answer));
		}
	}
	
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		new Main().doIt();
	}
}

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

int main(){
  int n,k;
  cin >> n >> k;
  vector<int> p(n);
  rep(i,n) cin >> p[i];
  rep(i,n) p[i]++;
  int s = 0;
  int mx = 0;
  queue<int> q;
  rep(i,n) {
    s += p[i];
    q.push(p[i]);
    if (q.size() > k) {
      s -= q.front(); q.pop();
    }
    if (q.size() == k) {
      mx = max(mx, s);
    }
  }
  double ans = mx;
  ans /= 2;
  printf("%.10f\n", ans);
  return 0;
}


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

#define rep(i,x,y) for(int i=(x);i<(y);++i)
#define debug(x) #x << "=" << (x)

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define dump(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define dump(x)
#endif

typedef long long int ll;
typedef pair<int,int> pii;
//template<typename T> using vec=std::vector<T>;

const int inf=1<<30;
const long long int infll=1LL<<58;
const double eps=1e-9;
const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};

namespace std {
    template <>
    class hash<std::pair<int, int>> {
    public:
        size_t operator()(const std::pair<int, int>& x) const{
            return size_t((size_t)x.first * (size_t)x.second);
        }
    };
}

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
	os << "[";
	for (const auto &v : vec) {
		os << v << ",";
	}
	os << "]";
	return os;
}

void solve(){
    vector<bool> is_prime(1e6+1,true);
    is_prime[0]=is_prime[1]=false;
    rep(i,2,1e+6+1){
        if(!is_prime[i]) continue;
        for(int j=i*2; j<1e6+1; j+=i) is_prime[j]=false;
    }
    while(true){
        int m,n;
        cin >> m >> n;
        if(m==0 and n==0) break;

        unordered_map<pii,int> encode;
        unordered_map<int,pii> decode;
        unordered_map<int,vector<int>> xs;
        {
            int x=0,y=0,dir=3;
            rep(i,1,m+1){
                encode[make_pair(x,y)]=i;
                decode[i]=make_pair(x,y);
                xs[y].push_back(x);
                int nx=x+dx[(dir+1)%4],ny=y+dy[(dir+1)%4];
                if(encode.find(make_pair(nx,ny))==encode.end()) dir=(dir+1)%4;
                else{
                    nx=x+dx[dir];
                    ny=y+dy[dir];
                }
                x=nx;
                y=ny;
            }
        }

        unordered_map<pii,int> dp;
        int y=decode[n].second+1,ans,max_num;
        if(is_prime[n]){
            dp[decode[n]]=1;
            ans=1;
            max_num=n;
        }else{
            dp[decode[n]]=0;
            ans=0;
            max_num=0;
        }
        while(xs.find(y)!=xs.end()){
            if(xs.find(y-2)!=xs.end()) for(int x:xs[y-2]) dp.erase(make_pair(x,y-2));
            for(int x:xs[y]){
                int tmp=-1;
                if(dp.find(make_pair(x-1,y-1))!=dp.end()) tmp=max(tmp,dp[make_pair(x-1,y-1)]);
                if(dp.find(make_pair(x,y-1))!=dp.end()) tmp=max(tmp,dp[make_pair(x,y-1)]);
                if(dp.find(make_pair(x+1,y-1))!=dp.end()) tmp=max(tmp,dp[make_pair(x+1,y-1)]);
                if(tmp==-1) continue;
                if(is_prime[encode[make_pair(x,y)]]){
                    ++tmp;
                    if(tmp>ans){
                        ans=tmp;
                        max_num=encode[make_pair(x,y)];
                    }else if(tmp==ans) max_num=max(max_num,encode[make_pair(x,y)]);
                }
                dp[make_pair(x,y)]=tmp;
            }
            ++y;
        }

        cout << ans << " " << max_num << endl;
    }
}

int main(){
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	solve();
	return 0;
}

Measured memory_bytes: 101796
// Math = ♥
// Sometimes it is people that no one imagines anything of who do things that no one can imagine
// After all this time? Always

#include <bits/stdc++.h>                        // uncomment before submission
//#include <ext/pb_ds/assoc_container.hpp>		// uncomment before submission
//#include <ext/pb_ds/tree_policy.hpp>			// uncomment before submission
//using namespace __gnu_pbds;					// uncomment before submission
using namespace std;
//<---------------------------------------------------Template----------------------------------------------------------->
#define int long long
#define ll long long
#define ld long double
const int INF = 1e15 + 7;
const int MAX = 1e5 + 7;
const int MOD = 1e9 + 7;
typedef pair<ll, ll> ii;
typedef vector<ll> vi;                  // Vector of long long
typedef vector<vi> vvi;                 // Vector of vi
typedef vector<ii> vii;                 // Vector of pairs
typedef vector<vii> vvii;               // Vector of Vector of pairs
typedef vector<bool> vb;                // Vector of bool
#define pq priority_queue               // Max heap (To convert to min heap, use negative sign before every value)
#define ff first                        // For pairs
#define ss second                       // For pairs
#define pb push_back                    // Pushback to vector
#define mp make_pair                    // Makes pairs to be stored as pair
#define all(c) (c).begin(), (c).end()   // Mainly used by me in sorting
// ordered_set adds two new functions to set - (set).find_by_order([kth element based on zero indexing]) and order_of_key()
// order_of_key returns number of elements less that parameter. If element exists, that order is its index
#define ordered_set tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>
//<----------------------------------------------------------------------------------------------------------------------->

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

    ld x = l / 3;
    x = x * x * x;
    printf("%0.9Lf\n", x);
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int maxn=200010;
string s;
int vis[28],l[maxn],r[maxn],num,now,cnt=26,len,last;
char ret,ans;
int main()
{
	cin>>s;
	len=s.length();
	r[0]=len-1;
	for(int i=len-1;i>=0;i--)
		if(!vis[s[i]-'a'])
		{
			cnt--;
			vis[s[i]-'a']=1;
			if(cnt==0)
			{	
				l[num++]=i;
				r[num]=i-1;	
				cnt=26;
				memset(vis,0,sizeof(vis));
			}
		}
//	cout<<num<<endl;
	l[num]=0;
	now=0;
	for(int i=num;i>=0;i--)
	{
		memset(vis,0,sizeof(vis));
		for(int j=now;j<=r[i];j++) vis[s[j]-'a']=1;
		for(int j=0;j<26;j++)
			if(!vis[j])
			{
				ret=j+'a';
				cout<<ret;
				ans=ret;
				break; 
			}
		for(int j=now;j<len;j++)
			if(s[j]==ret)
			{
				now=j+1;
				break;
			}
	}
	return 0;
} 

Measured memory_bytes: 644
//
//  atcoder.cpp
//
//
///
#include <bits/stdc++.h>
#include <boost/optional.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/bimap/bimap.hpp>
#include <boost/bimap/multiset_of.hpp>
#include <boost/multi_array.hpp>
#include <boost/integer/common_factor_rt.hpp>
#include <boost/algorithm/string.hpp>

#define REP(i, N) for(int i=0; i<(N); i++)
#define REC(f, ...) (void)0; const auto f = [&](const auto f, __VA_ARGS__)
using namespace std;
using namespace boost::integer;

using ll = long long;
namespace bst = boost;
template<typename T> class in {
    T value;
public:
    in() { cin >> value; }
    operator const T&() const { return value; }
    operator T&() { return value; }
    in& operator=(T source) { value = source; return *this; }
};
template<> class in<string> : public string {
public:
    in() { cin >> *this; }
};
template<class T> class inseq : public T {
public:
    template<typename... Arg> inseq(Arg... arg) : T(forward<Arg>(arg)...) { for (auto&& i : *this) cin >> i; }
};
template<class T> using invec = inseq<vector<T>>;

auto solve() {
  in<ll> A, B, C, K;
  
  ll r = 0;
  
  ll her = min(A, K);
  r+=her;
  A-=her;
  K-=her;
  her = min(B, K);
  B-=her;
  K-=her;
  her = min(C, K);
  r-=her;
  C-=her;
  K-=her;





  return r;
}

template<typename T> void plot(const T& func) { cout << func() << endl; }
template<> void plot<void()>(void(&func)()) { func(); }
template<> void plot<double()>(double(&func)()) { cout << setprecision(9) << func() << endl; }

int main() {
  plot(solve);

  return 0;
}



Measured memory_bytes: 3596
package main

import(
    "fmt"
    "sort"
    "strings"
)



func main() {
    var n,a,b int
    fmt.Scan(&n,&a,&b)
    fmt.Println(min32(a*n,b))
}





// Pairsort
type Pair struct {
    first,second int64
}

type By func(p1, p2 *Pair) bool

func (by By) Sort(pairs []Pair) {
    ps := &pairSorter{
            pairs : pairs,
            by: by,
    }
    sort.Sort(ps)
}

type pairSorter struct {
    pairs []Pair
    by func(p1, p2 *Pair) bool
}

func (s *pairSorter) Len() int {
    return len(s.pairs)
}

func (s *pairSorter) Swap(i, j int) {
    s.pairs[i], s.pairs[j] = s.pairs[j], s.pairs[i]
}

func (s *pairSorter) Less(i, j int) bool {
    return s.by(&s.pairs[i], &s.pairs[j])
}

func first (p1, p2 *Pair) bool {
        return p1.first < p2.first
}

func second (p1, p2 *Pair) bool {
        return p1.second < p2.second
}
// end



func abs32(a int) int {
    if a<0{
        return -a
    }
    return a
}

func abs64(a int64) int64 {
    if a<0{
        return -a
    }
    return a
}

func min32(a, b int) int {
    if a >= b {
        return b
    }
    return a
}

func max32(a, b int) int {
    if a >= b {
        return a
    }
    return b
}

func min64(a, b int64) int64 {
    if a >= b {
        return b
    }
    return a
}

func max64(a, b int64) int64 {
    if a >= b {
        return a
    }
    return b
}

func gcd(a, b int64) int64 {
    if a % b == 0 {
        return b
    } else {
        return gcd(b, a%b)
    }
}

func lcm(a, b int64) int64 {
    return a / gcd(a, b) * b
}

func scanNums(len int) (nums []int){
    var num int
    for i:=0; i<len; i++{
        fmt.Scan(&num)
        nums = append(nums,num)
    }
    return
}

func scanNums64(len int) (nums []int64){
    var num int64
    for i:=0; i<len; i++{
        fmt.Scan(&num)
        nums = append(nums,num)
    }
    return
}

func scanString(len int) (str []string){
    var s string
    for i:=0; i<len; i++{
        fmt.Scan(&s)
        str = append(str,s)
    }
    return
}

func makeTwoNums(n,m int) ([][]int){
    Nums := make([][]int, n)
    for i:=0; i<n; i++{
        Nums[i] = make([]int, m)
    }
    return Nums
}

func sortString(s string) string{
    t := strings.Split(s, "")
    sort.Strings(t)
    return strings.Join(t, "")
}

func reverseString(s string) string{
    t := []rune(s)
    for i,j := 0, len(s)-1 ; i < j ; i, j = i+1, j-1 {
        t[i], t[j] = t[j], t[i]
    }
    return string(t)
}

func stringRev(s []byte,l int,r int) []byte{
    for i:=0;i<(r-l+1)/2;i++{
        s[l-1+i], s[r-1-i] = s[r-1-i], s[l-1+i]
    }
    return s
}

func inside(h,w,H,W int) bool{
    if h>=0 && h<H && w>=0 && w<W{
        return true
    }
    return false
}



Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int main(){


  int n;
  cin>>n;
  vector<int> a(n+1);
  vector<int> b(n);
  for(int i=0;i<n+1;i++){
    cin>>a[i];
  }
  for(int i=0;i<n;i++){
    cin>>b[i];
  }
  long long ans=0;
  long long m=0;
  
  for(int i=0;i<n;i++){
    m=min(a[i],b[i]);
    ans+=m;
    a[i]-=m;
    b[i]-=m;
    m=min(a[i+1],b[i]);
    ans+=m;
    a[i+1]-=m;
    b[i]-=m;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 1024
using System;
using System.Collections.Generic;
using System.Text;
using System.Numerics;
using System.IO;

namespace SolutionCS
{
    class Program
    {
        static void Main(string[] args)
        {
            int A = int.Parse(Console.ReadLine());

            for (int B = 1; B < 10; B++)
            {
                if (0 == A % B && A / B < 10 )
                {
                    Console.WriteLine("Yes");
                    return;
                }
            }

            Console.WriteLine("No");
        }
    }
}



Measured memory_bytes: 11092
//#pragma GCC optimize("03,unroll-loops")
//#pragma GCC target("avx,avx2,fma")

#include<bits/stdc++.h>
typedef long long ll;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ordered_set tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_node_update>
#define pb           push_back
#define ff           first
#define ss           second
#define gcd(a, b)    __gcd(a, b)
#define lcm(a, b)    ((a)*((b)/gcd(a,b)))
#define all(v)       v.begin(),v.end()
#define rall(v)      v.rbegin(),v.rend()
#define lllim        2147483648
#define Pi           2*acos(0.0)
#define pii          pair<int,int>
#define pll 	     pair<ll,ll>
#define mem(a,b)     memset(a, b, sizeof(a))
#define fill_(a,b)   fill(a,a+n,b);
#define mod          1000000007
#define fast_cin     ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define filein       freopen("input.txt","r", stdin)
#define D(x)         cerr << __LINE__ << ": " << #x << " = " << (x) << '\n'
#define case		 int t,cas=1;cin>>t;while(t--)
#define rep(i,a,n)   for(int i=a;i<n;i++)
#define rev(i,n,a)   for(int i=n;i>=a;i--)
#define sim 		 template<class T

/*------------------------------Graph Moves----------------------------*/
//const int fx[]= {+1,-1,+0,+0};
//const int fy[]= {+0,+0,+1,-1};
//const int fx[]= {+0,+0,+1,-1,-1,+1,-1,+1};  // Kings Move
//const int fy[]= {-1,+1,+0,+0,+1,+1,-1,-1}; // Kings Move
//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
/*---------------------------------------------------------------------*/

sim > void ckmin(T& a, const T& b) {
    a= b < a? b:a;
}
sim > void ckmax(T& a, const T& b) {
    a= b > a? b:a;
}

///.............................input.................................///
sim > void readvec( std::vector<T>& v, const int n) {
    rep(i,0,n) {
        T p;
        std::cin>>p;
        v.pb(p);
    }
}
///...........................input end...............................///


using namespace std;
using namespace __gnu_pbds;

const int maxn=200005;

void solve()
{
  string s;
  cin>>s;
  if(s[s.size()-1]=='s')
  {
	  s+="es";
  }
  else
   s+="s";
   
   cout<<s<<endl;

}


int main()
{
    fast_cin;


    //case
    {
        //  cout<<"Case "<<cas++<<": ";
        solve();
    }

    return 0;
}


Measured memory_bytes: 3664
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define F first
#define S second
#define mod 1000000007
#define all(a) a.begin(),a.end()
#define dbg(n) cout<<#n<<' '<<n<<endl;
#define dbg_v(v) cout<<#v<<":";for(auto c:v) cout<<" "<<c; cout<<endl;
int power(ll x,ll y){ll res = 1;while(y>0){if(y&1)res = (res*x)%mod;y=y>>1;x=(x*x)%mod;}return res;}
void solve(){
	ll n;
	cin>>n;
	ll ans=1,ans1=2,ans2=1;
	if(n==1)
		cout<<0<<endl;
	else{
		for(int i=0;i<n;i++)
			ans=(ans*10LL)%mod;
		for(int i=0;i<n;i++){
			ans1=(ans1*9LL)%mod;
			ans2=(ans2*8LL)%mod;
		}
		cout<<((ans+ans2)%mod-ans1+mod)%mod<<endl;
	}
}
int main(){ 
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);	
	int T=1;
	//cin>>T;
	while(T--){
		solve();
	}
}


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

using namespace std;

#define frei(i,a,b) for (int i = (a), _b = (b); i <= _b; i++)
#define fred(i,a,b) for (int i = (a), _b = (b); i >= _b; i--)
#define fri(i,n) for (int i = 0, _n = (n); i < _n; i++)
#define frd(i,n) for (int i = (n) - 1; i >= 0; i--)
#define foreach(it, ar) for ( typeof(ar.begin()) it = ar.begin(); it != ar.end(); it++ )

#define uint64 unsigned long long
#define int64 long long
#define all(ar) ar.begin(), ar.end()
#define pb push_back
#define pf push_front
#define mp make_pair
#define ff first
#define ss second
#define pr pair

#define BIT(n) (1<<(n))
#define AND(a,b) ((a) & (b))
#define OR(a,b) ((a) | (b))
#define XOR(a,b) ((a) ^ (b))
#define sqr(x) ((x) * (x))

typedef pair<int, int> pii;
typedef pair<int, pii> piii;
typedef vector<pii> vii;
typedef vector<int> vi;

#define PI 3.1415926535897932385
#define INF 1000111222
#define eps 1e-7
#define maxN 5005


pair<int, pii> maxp(pair<int, pii> a, pair<int, pii> b) {
    if(a.ff > b.ff) {
        return a;
    }
    return b;
}

bool ColRowZero(pair<int, pii> x) {
    return (x.ss.ff == 0 || x.ss.ss == 0);
}

const int inf = 1e9 + 5;
int main(int argc, char const *argv[])
{
    /* code */
    string s, t;
    cin >> s >> t;
    int n = s.size();
    int m = t.size();
    vector<vector<pair<int,pii>>> dp(n + 1, vector<pair<int, pii>>(m + 1, {0, {0,0}}));
    //dp[0][0] = {0, {0, 0}};
    for(int i = 1; i <= n; i++) {
        for(int j = 1; j <= m; j++) {
            if(s[i-1] == t[j-1]) {
                dp[i][j] = maxp(dp[i][j], {dp[i-1][j-1].ff + 1, {i-1, j-1}});
            } else {
                dp[i][j] = maxp(dp[i-1][j-1],maxp(dp[i][j-1], dp[i-1][j]));
            }
        }
    }
    pair<int, pii> ans = {0, {0, 0}}, prev;
    /* for(int i = 1; i <= n; i++) {
        for(int j = 1; j <= m; j++) {
            cout << dp[i][j].ff << " ";
        }
        cout << endl;
    }
    cout << endl << endl;*/
    for(int i = 1; i <= n; i++) {
        for(int j = 1; j <= m; j++) {
            ans = maxp(ans, dp[i][j]);
        }
    }
    
    string ret = "";
    int f = 0;
    while(true) {
        if(ColRowZero(ans)) {
            f++;
        }
        //cout << ans.ff << " " << ans.ss.ff << "  " << ans.ss.ss << endl;
        prev = dp[ans.ss.ff][ans.ss.ss];
        if( (f == 1 && ans.ff == 1)||  (prev.ss.ff != ans.ss.ff && prev.ss.ss != ans.ss.ss)) {
            ret += s[ans.ss.ff];
        }
        ans = prev;
        if(f == 2) break;
    }
    //cout << ans.ff << " " << ans.ss.ff << "  " << ans.ss.ss << endl;
    reverse(ret.begin(), ret.end());
    cout << ret << endl;
    return 0;
}


Measured memory_bytes: 105984
#include <bits/stdc++.h>
using namespace std;
int main() {
  int a,b,c;
  cin >> a >> b >> c;
  cout << min(min(abs(a - b) + abs(b - c),abs(b - c) + abs(c - a)),abs(c - a) + abs(a -b)) << endl;
}

Measured memory_bytes: 256