akhauriyash/Code-Regression huggingface dataset:
// Created by Kshitij Anand NSIT
#include <bits/stdc++.h>
//#include <ext/numeric>
//using namespace __gnu_cxx;


using namespace std;


#define int long long
#define pb push_back
#define P pair<int,int>
#define F first
#define S second
#define vi vector<int>
#define vc vector<char>
#define vb vector<bool>
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define mp(a, b) make_pair(a, b)
#define min3(a, b, c) min(min(a, b), c)
#define min4(a, b, c, d) min(min(a, b), min(c, d))
#define max3(a, b, c) max(max(a, b), c)
#define max4(a, b, c, d) max(max(a, b), max(c, d))
#define fill(arr,val) memset(arr,val,sizeof(arr))
#define inf 1e18
#define ps(x,y) fixed<<setprecision(y)<<x
#define db(x)  cout<<#x<<" : "<<x<<endl


const int N = 1000000007;

void solve(){

    int n,a,b,c, ans=INT_MAX, count=0, sum=0;
    string s1 , s2;
    cin>>s1>>s2;

    n = sz(s1);

    for(int i=0; i<n - sz(s2) + 1; i++) {

        int k = 0;
        count = 0;
        for(int j=i; j<i + sz(s2); j++) {

            count+= (s1[j] != s2[k++]);
        }

        ans = min(count , ans);
    }

    cout<<ans<<endl;


}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    
    
  //  int t; cin>>t; while(t--)
    {     
      solve();
    }

  return 0;
}


Measured memory_bytes: 3656
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000
#define mod 1000000007
typedef long long ll;
const ll LINF = 1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }


int main(){
    //l,rペアで見てあげないと絶対にこたえにたどり着けない。
    //単純な一次元累積和だとlとrをペアで考えることはできないため難しい
    //lとrをペアで考える方法としてlとrの二次元座標空間を考える
    /*答えに(2,5を加えるのは)
          r
      1 2 3 4 5 6
    1         1 1
    2         1 1
l   3        
    4          
    1の部分。なぜならp<=l,q>=rのやつが答えになるから
    右上へと更新すればいいのか
     */
    int N,M,Q;
    cin>>N>>M>>Q;
    int sum[N+1][N+1]={};
    rep(i,M){
        int L,R;
        cin>>L>>R;
        sum[L][R]++;
    }
    for(int i=N;i>0;i--){
        for(int j=0;j<=N;j++){
            sum[i-1][j]+=sum[i][j];
        }
    }
    for(int i=0;i<=N;i++){
        for(int j=0;j<N;j++){
            sum[i][j+1]+=sum[i][j];
        }
    }
    int ans[Q];
    rep(i,Q){
        int p,q;
        cin>>p>>q;
        ans[i]=sum[p][q];
    }
    rep(i,Q){
        cout<<ans[i]<<endl;
    }
    return 0;
}

Measured memory_bytes: 2304
#include<iostream>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<map>
#include<utility>
#include<cmath>
#include<tuple>
#include<string>
#include<bitset>
#include<set>
using namespace std;
typedef long long ll;

int main(){
    int h,a; cin>>h>>a;

    int ans=0;
    while(h>0){
        h-=a;
        ans++;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
#define N (int)1e5
#define F first
#define S second
typedef pair<int, int> P;
int n, m, ans;
int l[3 * N + 1], r[3 * N + 1];
P lr[3 * N + 1];
int bit[N + 1], bit2[N + 1];
int sum(int i, int *b)
{
	int s = 0;
	while (i > 0)
	{
		s += b[i];
		i = i & (i - 1);
	}
	return s;
}
void add(int i, int x, int *b)
{
	while (i <= m)
	{
		b[i] += x;
		i += i & -i;
	}
}
int main()
{
	cin >> n >> m;
	for (int i = 0; i < n; i++)
	{
		cin >> lr[i].S >> lr[i].F;
		l[i] = lr[i].S;
		r[i] = lr[i].F;
		lr[i].F = lr[i].F - lr[i].S + 1;
	}
	sort(lr, lr + n);
	int p1 = 0, p2 = 0;
	for (int i = 1; i <= m; i++)
	{
		ans = 0;
		p2 = lower_bound(lr, lr + n, make_pair(i, 0)) - lr;
		ans = n - p2;
		for (int j = p1; j < p2; j++)
		{
			add(lr[j].S, -(lr[j].S - 1), bit);
		    add(lr[j].S, 1, bit2);
			add(lr[j].F + lr[j].S , lr[j].F + lr[j].S - 1, bit);
			add(lr[j].F + lr[j].S, -1, bit2);
		}
		p1 = p2;
		for (int j = 0; j <= m; j += i)
		{
			ans += sum(j, bit) + sum(j , bit2) * (j);
			ans -= sum(j - 1, bit) + sum(j -1, bit2) * (j - 1);
		}
		cout << ans << endl;
	}
	return 0;
}



Measured memory_bytes: 6400
#include <bits/stdc++.h>
#define int long long int
#define ii pair<int,int>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
using namespace std;
#define MOD 998244353
#define output(x) for (auto a:x) cout<<a<<" ";cout<<endl;
#define output2(x) for (auto a:x) cout<<a.fi<<" "<<a.se<<endl;
 
int power(int x,int y,int mod) 
{ 
 	int ret = 1;
 	x = x % mod;
 	while (y){
 		if(y&1) ret = (ret*x)%mod;
 		y = y>>1;
 		x = (x*x)%mod;
    } 
    return ret%mod; 
}

int isprime(int x)
{
	for (int i=2;i*i<=x;i++)
		if (x%i==0) return 0;
	return 1;
}

void solve()
{	
	string inp,inp2;
	cin>>inp>>inp2;
	for (int i=0;i<inp.size();i++){
		if (inp[i]!=inp2[i]){
			cout<<"No"<<endl;
			return;
		}
	}
	cout<<"Yes"<<endl;
	
	
	
	
}
 
 
signed main(){
	// int t;
	// cin>>t;
	// while (t--)	
	solve();	
 
}

Measured memory_bytes: 3600
//#include<bits/stdc++.h>
#include<iostream>
#include<iomanip>
#include<cstring>
#include<stack>
#include<vector>
//#include<conio.h>
#include<string>
#include<map>
#include<cstdlib>
#include<queue>
#include<math.h>
#include<time.h>
#include<cstdio>
#include<stdio.h>
#include<algorithm>
using namespace std;
inline int read(){
	int ans=0,flag=1;
	char ch=getchar();
	while((ch>'9'||ch<'0')&&ch!='-') ch=getchar();
	if(ch=='-') flag=-1,ch=getchar();
	while(ch>='0'&&ch<='9'){
		ans=(ans<<1)+(ans<<3)+(ch^'0');
		ch=getchar();
	}
	return ans*flag;
}
int n,k,ans;
priority_queue<int,vector<int>,less<int> >q; 
int main(){
	n=read(),k=read();
	for(int i=1;i<=n;i++)
		q.push(read()); 
	for(int i=1;i<=k;i++)
		ans+=q.top(),q.pop();
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
#define fi first
#define se second
map<int,int> mp;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
ll n,a,b;
cin>>n>>a>>b;
ll seg=b-a+1;
if(seg<=0||(n<2&&a!=b)){
    cout<<0<<endl;
    return 0;
}
ll mi=a*n,ma=b*n;
mi+=(b-a);
ma-=(b-a);
cout<<ma-mi+1<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define ALL(v) (v).begin(), (v).end()
using ll = long long;
using P = pair<int, int>;
constexpr int INF = 1e9;
constexpr long long LINF = 1e18;
constexpr long long MOD = 1e9 + 7;

signed main() {
    int k, a, b;
    cin >> k >> a >> b;
    for (int i = a; i <= b;i++){
        if(i%k==0){
            cout << "OK" << endl;
            return 0;
        }
    }
    cout << "NG" << endl;
    return 0;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)


signed main(){
    FAST;

    int h, m;
    cin>>h>>m;
    while(m--){
        int x;
        cin>>x;
        h-=x;
    }
    if(h<=0) cout<<"Yes";
    else cout<<"No";
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
const int MAX=505;
int result[MAX*MAX];
int n;
pair<int,int> a[MAX];
int main()
{
	cin>>n;
	for(int i=1;i<=n;++i){
		cin>>a[i].first;
		a[i].second=i;
	}
	sort(a+1,a+n+1);
//	for(int i=1;i<=n;++i) cout<<a[i].second<<endl;
	for(int i=1;i<=n;++i){
		result[a[i].first]=a[i].second;
	}
	int curr=n*n;
	for(int i=n;i>=1;--i){
		int temp=n-a[i].second;
		while(temp>0){
			if(result[curr]==0){
				result[curr]=a[i].second;
				temp--;
				curr--;
			}
			else if(result[curr]==a[i].second){
				cout<<"No"<<endl;
				return 0;
			}
			else{
				curr--;
				continue;
			}
		}
	}
	curr=1;
	for(int i=1;i<=n;++i){
		int temp=a[i].second-1;
		while(temp>0){
			if(result[curr]==0){
				result[curr]=a[i].second;
				temp--;
				curr++;
			}
			else if(result[curr]==a[i].second){
				cout<<"No"<<endl;
				return 0;
			}
			else{
				curr++;
				continue;
			}
		}
	}
	cout<<"Yes"<<endl;
	for(int i=1;i<=n*n;++i) cout<<result[i]<<" ";
	return 0;
}

Measured memory_bytes: 2176
#include <bits/stdc++.h>
using namespace std;
#define fastIO                        \
	ios_base::sync_with_stdio(false); \
	cin.tie(NULL);                    \
	cout.tie(NULL)
// g++ -std=c++11 -O2 -Wall *.cpp -o *
#define eps 1e-9
#define MAX 10000010
#define MOD 1000000007
#define PI 3.14159265358979323846
#define Fi first
#define Se second
#define PB push_back
#define MP make_pair
#define all(a) a.begin(), a.end()
#define maxof(a) *max_element(all(a))
typedef long long ll;
typedef pair<int, int> pr_int;

int main()
{
	fastIO;
	// freopen("input.txt", "r", stdin);
	// freopen("output.out", "w", stdout);

	int n;

	cin >> n;
	if (n % 1000)
		cout << 1000 - n % 1000;
	else
		cout << 0;

	cout << "\n";
}


Measured memory_bytes: 3684
import java.util.*;

class Main{
    public static void main(String args[]){
        Scanner sc=new Scanner(System.in);
        while(sc.hasNext()){
            double t1=sc.nextDouble();
            double t2=sc.nextDouble();
            
            if(t1<35.5&&t2<71.0){
                System.out.println("AAA");
            }else if(t1<37.5&&t2<77.0){
                System.out.println("AA");
            }else if(t1<40.0&&t2<83.0){
                System.out.println("A");
            }else if(t1<43.0&&t2<89.0){
                System.out.println("B");
            }else if(t1<50.0&&t2<105.0){
                System.out.println("C");
            }else if(t1<55.0&&t2<116.0){
                System.out.println("D");
            }else if(t1<70.0&&t2<148.0){
                System.out.println("E");
            }else{
                System.out.println("NA");
            }
        }
    }
}


Measured memory_bytes: 28536
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using static MyIO;


public struct Edge
{
	public int From;
	public int To;
	public int Cost;

	public Edge(int from, int to, int cost)
	{
		From = from;
		To = to;
		Cost = cost;
	}
}


public class E
{
	public static void Main()
	{
		(new Solver()).Solve();
	}	
}


public class Solver
{
	private int N;
	private int M;
	private int P;
	private Edge[] edges;

	public Solver()
	{
		N = GetInt();
		M = GetInt();
		P = GetInt();
		edges = new Edge[M];
		for(int i = 0; i < M; i++)
		{
			int A = GetInt() - 1;
			int B = GetInt() - 1;
			int C = - (GetInt() - P);
			edges[i] = new Edge(A, B, C);
		}
	}

	public void Solve()
	{
		var adj = Enumerable.Range(0, N).Select(_ => new List<int>()).ToArray();
		var rev_adj = Enumerable.Range(0, N).Select(_ => new List<int>()).ToArray();
		foreach(Edge e in edges)
		{
			if(e.From != e.To)
			{
				adj[e.From].Add(e.To);
				rev_adj[e.To].Add(e.From);
			}
		}

		bool[] fromS = bfs(0, adj);
		bool[] toG = bfs(N - 1, rev_adj);

		var subEdges = new List<Edge>(M);
		foreach(Edge e in edges)
		{
			if(fromS[e.From] && fromS[e.To] && toG[e.From] && toG[e.To])
				subEdges.Add(e);
		}

		if(hasNegativeLoop(N, 0, subEdges))
		{
			Console.WriteLine(-1);
			return;
		}

		int[] d = bellman_ford(N, 0, subEdges);
		Console.WriteLine(Math.Max(0, - d[N - 1]));
	}

	private static bool[] bfs(int s, List<int>[] adj)
	{
		bool[] visited = new bool[adj.Length];
		var queue = new Queue<int>();
		visited[s] = true;
		queue.Enqueue(s);
		while(queue.Count > 0)
		{
			int v = queue.Dequeue();
			foreach(int u in adj[v])
			{
				if(!visited[u])
				{
					visited[u] = true;
					queue.Enqueue(u);
				}
			}
		}
		return visited;
	}

	private int[] bellman_ford(int N, int s, List<Edge> edges)
	{
		int[] d = Enumerable.Repeat(int.MaxValue, N).ToArray();
		d[s] = 0;
		while(true)
		{
			bool update = false;
			foreach(Edge e in edges)
			{
				if((d[e.From] != int.MaxValue) && (d[e.To] > d[e.From] + e.Cost))
				{
					d[e.To] = d[e.From] + e.Cost;
					update = true;
				}
			}
			if(!update)
				break;
		}
		return d;
	}

	private bool hasNegativeLoop(int N, int s, List<Edge> edges)
	{
		int[] d = new int[N];
		for(int i = 0; i < N; i++)
		{
			foreach(Edge e in edges)
			{
				if(d[e.To] > d[e.From] + e.Cost)
				{
					d[e.To] = d[e.From] + e.Cost;
					if(i == N - 1)
						return true;
				}
			}
		}
		return false;
	}
}


public static class MyIO
{
	private static string[] args = null;
	private static int num = -1;
	private static int used = -1;

	private static string getArg()
	{
		if(used == num)
		{
			args = Console.ReadLine().Split(' ');
			num = args.Length;
			used = 0;
		}
		return args[used++];
	}

	public static int GetInt(){ return int.Parse(getArg()); }
	public static long GetLong(){ return long.Parse(getArg()); }
	public static double GetDouble(){ return double.Parse(getArg()); }
	public static string GetString(){ return getArg(); }
}





Measured memory_bytes: 15712
#include <stdio.h>

int main(){
	int n, b, f, r, v;
	int i, j, k;
	int A[4][3][10] = {0};
	
	scanf("%d", &n);

	for(i=0; i<n; i++) {
		scanf("%d %d %d %d", &b, &f, &r, &v);
		A[b-1][f-1][r-1] += v;
	}

	for(i=0; i<4; i++) {						// building
		if(i != 0){
			printf("####################\n");
		}
		for(j=0; j<3; j++) {					// floor
			for(k=0; k<10; k++) {				// room
				printf(" %d", A[i][j][k]);
			}
			printf("\n");
		}
	}
	return 0;
}

Measured memory_bytes: 612
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include <cmath>

using namespace std;
const long long INF = (long long) (1e18)+1;

int main() {
  long long h;
  long long w;
  cin >> h >> w;
  long long ans;
  if ((h == 1) || (w == 1)) {
    ans = 1;
  } else if ( h % 2 == 0 ) {
    // cout << "?!" << endl;
    ans = h / 2 * w;
  } else if (w % 2 == 0) { // h is odd, w is not
    // cout << ((h+1) / 2) * (w/2) << endl;
    // cout << (h/2) * (w/2) << endl;
    ans = ((h+1) / 2) * (w/2) + (h/2) * (w/2);    
  } else {
    // cout << "?" << endl;
    ans = ((h+1) / 2) * ((w+1)/2) + (h/2) * (w/2);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <stdio.h>
using namespace std;
typedef long long ll;

int main() {
	ll s;
	cin>>s;
	if(s>1000000000LL) {
		ll m = sqrt(s);
		if(m*m==s) {
			printf("0 0 %ld 0 0 %ld\n",m,m);
			return 0;
		}
		m += 1LL;
		ll diff = m*m-s;
		printf("0 0 %ld %ld %ld %ld\n",m,1,diff,m);
	}else {
		cout << "0 0 1 0 0 " << s << endl;
	}
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
typedef long long ll;
ll n,m,s[2500],t[2500],fa[51],r[51],ans;
ll find(ll x){
    if(fa[x]==x)return x;
    return fa[x]=find(fa[x]);
}
void uni(ll x,ll y){
    x=find(x);
    y=find(y);
    if(x==y)return ;
    if(r[x]<r[y])fa[x]=y;
    else fa[y]=x;
    if(r[x]==r[y])r[x]++;
}
int main(void){
    cin>>n>>m;
    for(int i=0;i<m;i++){
        cin>>s[i]>>t[i];
    }
    for(int i=0;i<m;i++){
        for(int k=1;k<=n;k++){
            fa[k]=k;
            r[k]=0;
        }
        for(int j=0;j<m;j++){
            if(i==j)continue;
            uni(s[j],t[j]);
        }
        for(int k=1;k<=n;k++){
            if(find(fa[k])!=find(fa[1])){ans++;break;}
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define rt return 0
#define endln "\n"
#define for1(i, a, b) for (long long int i = a; i < b; i++)
#define for2(i, a, b) for (long long int i = a; i > b; i--)
//  cout << fixed << setprecision(0) << pi <<" "<<npi<<endl;typedef long long int i;
typedef long long int lli;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    lli t, x, y, a, b, c;
    cin >> x >> y >> a >> b >> c;
    vector<lli> v1, v2, v3;
    for1(i, 0, a)
    {
        cin >> t;
        v1.pb(t);
    }
    for1(i, 0, b)
    {
        cin >> t;
        v2.pb(t);
    }
    for1(i, 0, c)
    {
        cin >> t;
        v3.pb(t);
    }
    sort(v1.rbegin(), v1.rend());
    sort(v2.rbegin(), v2.rend());
    sort(v3.rbegin(), v3.rend());
    vector<lli> v4;
    for1(i, 0, x)
    {
        v4.pb(v1[i]);
    }
    for1(i, 0, y)
    {
        v4.pb(v2[i]);
    }
    sort(v4.begin(), v4.end());
    lli k = 0;
    for1(i, 0, x + y)
    {
        if (v3[k] > v4[i])
        {
            v4[i] = v3[k];
            k++;
        }
        else
        {
            break;
        }
        if (k == c)
        {
            break;
        }
    }
    lli s = 0;
    for1(i, 0, x + y)
    {
        s += v4[i];
    }
    cout << s << endl;
}

Measured memory_bytes: 4852
#include <bits/stdc++.h>
using namespace std;
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define in(x,y,h,w) x >= 0 && x < h && y >= 0 && y < w

#define int long long
//typedef    long long          ll;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      P;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
 
const int INF=1e+18;
const double EPS=1e-9;
const int MOD=1000000007;

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

signed main(){
	int ans = 0,m,d;
	cin >> m >> d;
	for(int i = 1;i <= m;i++){
		for(int j = 10;j <= d;j++){
			if(j % 10 >= 2 && j / 10 >= 2 && (j % 10) * (int)(j / 10) == i) ans++;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define SZ(v) int((v).size())
#define ALL(vec) begin(vec), end(vec)
using namespace std;
typedef long long i64;
template<typename T> inline bool uax(T &x, T y) {return (y > x) ? x = y, true : false;}
template<typename T> inline bool uin(T &x, T y) {return (y < x) ? x = y, true : false;}
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); \
  stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
string to_string(char c) { return "'" + string(1, c) + "'";}
string to_string(string s) { return '"' + s + '"';}
string to_string(const char* s) { return to_string((string) s);}
template<typename A> string to_string(A);
template<typename A, typename B> string to_string(pair<A, B> p){
  return "(" + to_string(p.first) + ": " + to_string(p.second) + ")";}
template<typename A> string to_string(A v) {bool f = false; string r = "{"; 
  for (auto x: v) {if (f) r += ", "; r += to_string(x); f = true;} return r += "}";}
template<typename A> string to_string(vector<vector<A>> v) {string r; 
  for (auto x: v) r += "\n" + to_string(x); return r;}
void err(istream_iterator<string>) { cerr << endl; }
template<typename T,typename... Args> void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " =: " << to_string(a) << "; "; err(++it, args...); }
template<typename T> void kek(T ans) {cout << ans << endl; exit(0);}
//~ int const MOD = 1e9 + 7;
int const MOD = 998244353;
long long const INF = 1e18 + 42;
/*************************************/

int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  
  int n;
  cin >> n;
  vector<vector<int>> g(n);
  int k = 0;
  map<pair<int,int>,int> ids;
  vector<int> ans(n - 1);
  for (int i = 0; i < n - 1; ++i) {
    int u, v;
    cin >> u >> v; --u, --v;
    g[u].push_back(v);
    g[v].push_back(u);
    uax(k, SZ(g[u]));
    uax(k, SZ(g[v]));
    ids[{u,v}] = ids[{v,u}] = i;
  }
  function<void(int,int)> go = [&] (int u, int p) {
    int t = 0;
    if (p != -1) {
      t = ans[ids[{u,p}]] + 1;
      t %= k;
    }
    for (int &v : g[u]) if (v != p) {
      ans[ids[{v,u}]] = t;
      t = (t + 1) % k;
      go(v, u);
    }
  };
  go(0, -1);
  cout << k << '\n';
  for (int x : ans) {
    cout << x + 1 << '\n';
  }
  
  return 0;
}


Measured memory_bytes: 18944
import java.util.Scanner;

class Solver {
    void solve(Scanner in) {
        String S = in.next();
        String T = in.next();
        int sum = 0;
        for (int i = 0; i < 3; i++) {
            if (S.charAt(i) == T.charAt(i)) {
                sum++;
            }
        }
        System.out.println(sum);
    }
}

class Main {
    public static void main(String... args) {
        Scanner in = new Scanner(System.in);

        new Solver().solve(in);

        in.close();
    }
}

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

// See debug.cc for usage etc
#define DEBUG 0

template <class... Args>
string dbgFormat(const char* fmt, Args... args) {
  size_t len = snprintf(nullptr, 0, fmt, args...);
  char buf[len + 1];
  snprintf(buf, len + 1, fmt, args...);
  return string(buf);
}

#if DEBUG
  #define DLOG(...)        cerr << dbgFormat(__VA_ARGS__) << endl
  #define DCALL(func, ...) func(__VA_ARGS__)
#else
  #define DLOG(...)
  #define DCALL(func, ...)
#endif

ll N, K;
vector<ll> V;

string toString(auto v) {
  stringstream ss;
  ss << "[";
  for (auto it = v.begin(); it != v.end(); it++) {
    if (it != v.begin())  ss << ", ";
    // if the value_type is not printable, modify the following line.
    ss << *it;
    // e.g., if it is a pair, use "ss << pairToString(*it)"
  }
  ss << "]";
  return ss.str();
}



int main() {
#if !DEBUG
  ios_base::sync_with_stdio(false);
#endif

  cin >> N >> K;
  V.resize(N);
  for (ll i = 0; i < N; i++) {
    cin >> V.at(i);
  }
  ll answer = 0;
  for (ll y = 0; y <= min(N, K); y++) {
    for (ll a = 0; a <= y; a++) {
      ll b = y - a;
      vector<ll> w(y);
      copy(V.begin(), V.begin() + a, w.begin());
      copy(V.end() - b, V.end(), w.begin() + a);
      DLOG("w = %s", toString(w).c_str());
      sort(w.begin(), w.end());
      ll sum = 0;
      for (ll k = 0; k < y; k++) {
	if (k >= K-y || w.at(k) > 0)  sum += w.at(k);
      }
      DLOG("(a,b) = (%lld, %lld), sum = %lld", a, b, sum);
      if (sum > answer)  answer = sum;
    }
  }
  cout << answer << endl;

  return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define MODV 1000000007
#define INFLL LLONG_MAX // 9223372036854775807
#define EPS 1e-9
#define rep(i, n) for(ll i=0, i##_len=(ll)(n); i<i##_len; i++)
#define repf(i, n) for(ll i=1, i##_len=(ll)(n+1); i<i##_len; i++)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
#define Init() std::ios::sync_with_stdio(false); std::cin.tie(0); std::cout<<fixed<<setprecision(15);
template<class T>bool chmax(T &a, const T &b){ if(a<b){ a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b){ if(b<a){ a=b; return 1; } return 0; }
using namespace std;

int main(){
    Init();
    ll n; cin >> n;
    // nが偶数の場合はn/2個、奇数の場合はn/2+1個のグループに分ける。
    // 偶数; (1, n), (2, n-1), ... ,(n/2, n/2+1)
    // 奇数; (1, n-1), (2, n-2), ..., ((n-1)/2, (n-1)/2+1), (n)
    // 異なるグループのノードを全て連結するようなグラフによって問題条件を満たすグラフを構築できる。
    ll invalid = (n%2 == 0 ? n+1 : n);
    vi ans_a, ans_b;
    for(ll i=1; i<=n; i++){
        for(ll j=i+1; j<=n; j++){
            if(i+j == invalid) continue;
            ans_a.push_back(i);
            ans_b.push_back(j);
        }
    }
    cout << ans_a.size() << endl;
    for(ll i=0; i<ans_a.size(); i++) cout << ans_a[i] << " " << ans_b[i] << endl;
}

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

typedef long long  ll;
typedef pair<ll,ll> pll;
typedef vector<ll> vll;

#define INPUT(arr,n) for(ll i = 0;i<n;i++) cin>>arr[i];
#define PRINT(arr,n) for(ll i = 0;i<=n;i++) printf("%lld ",arr[i]);printf("\n");
#define MEM(var,val) memset(var,(val),sizeof(var))
#define MAX(a,b) ((a) > (b) ? (a) : (b))
#define MIN(a,b) ((a) < (b) ? (a) : (b))
#define mp make_pair
#define pb push_back

const ll NMAX = 100000+7;
const ll MOD = 1000*1000*1000+7;
const ll INT_BITS = 32 ;
ll arr[NMAX];
ll dp[NMAX];

inline ll add(ll a, ll b) {
  ll r = a + b;
  return (r >= MOD ? r - MOD : r);
}

inline ll sub(ll a, ll b) {
  ll r = a - b;
  return (r < 0 ? r + MOD : r);
}

inline ll mul(ll a, ll b) {
  ll r = a * b;
  return (r >= MOD ? r % MOD : r);
}

ll N,K;

bool check(ll a){
	return a%2==1;
}


int func(ll k){
	if(k<=0)return 0;
	if(dp[k]!=-1) return dp[k];
	int losin=1;
	for(ll i = 0;i<N;i++){
		if(k>=arr[i]){
		    // cout<<k<<" "<<i<<" "<<arr[i]<<endl;
			losin = losin and func(k - arr[i]);
		}
	}
	// cout<<k<<" "<<1-losin<<endl;
	dp[k]=1-losin;
	return 1-losin;
}

int main(int argc, char const *argv[])
{
	cin>>N>>K;
	INPUT(arr,N);
	MEM(dp,-1);
	if(func(K))
		cout<<"First\n";
	else
		cout<<"Second\n";
	return 0;
}

Measured memory_bytes: 4096
n,m =(int(i) for i in input().split())
x = list(int(i) for i in input().split())
x.sort()
sa = []
ans = 0
if m <= n:
  print('0')
  exit()
for i in range(m-1):
  sa.append(x[i+1]-x[i])
s2 = sorted(sa,reverse = True)
#print(s2)
for i in range(n-1,len(s2)):
  ans += s2[i]
print(ans)

Measured memory_bytes: 13968
#include <vector>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <cstdlib>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define REP(i,n) for(int i=0;i<n;i++)
#define REPS(i,n,s) for(int i=s;i<n;i++)
#define SORT(c) sort((c).begin(),(c).end())
#define ALL(a) (a).begin(),(a).end()

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

  vector<pair<int, int>> pair_list;
  REP(i, n) {
    int a;
    cin >> a;
    pair_list.push_back(make_pair(a, i+1));
  }

  SORT(pair_list);

  REP(i, n) {
    if(i != 0) {
      cout << " ";
    }
    cout << pair_list[i].second;
  }

  cout << endl;

  return 0;
}


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

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

template<typename P, typename Q>
ostream& operator << (ostream& os, pair<P, Q> p)
{
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

template<typename T>
ostream& operator << (ostream& os, vector<T> v)
{
  os << "(";
  each (i, v) os << i << ",";
  os << ")";
  return os;
}

lli trinaly_search(lli small, lli large, function<lli(lli)>fn)
{
  for (int i = 0; i < 100; ++i) {
    lli left = (large - small) / 3 + small;
    lli right = (large - small) * 2 / 3 + small;
    if (fn(right) < fn(left)) large = right;
    else small = left;
  }

  lli mx = small;
  for (lli i = small; i <= large; ++i) {
    if (fn(mx) < fn(i)) mx = i;
  }
  return mx;
}

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  int q;
  while (cin >> q) {
    while (q--) {
      lli a, b;
      cin >> a >> b;

      lli small = 0;
      lli large = 1e11 + 1;
      while (small + 1 < large) {
        lli mid = (small + large) / 2;

        auto fn = [&] (lli c) {
          lli x = c;
          lli y = mid + 1 - c;
          if (a <= x) ++x;
          if (b <= y) ++y;
          return x * y;
        };

        if (fn(trinaly_search(0, mid, fn)) < a * b) small = mid;
        else large = mid;
      }
      cout << small << endl;
    }
  }

  return 0;
}


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

int main(){
    int S;
    cin >> S;
    int a = S / 1000;
    int b = (S - a * 1000 ) / 100;
    int c = (S - a * 1000 - b * 100) / 10;
    int d = S - a * 1000 - b * 100 - c * 10;
    if (a == b || b == c || c == d){
        cout << "Bad" << endl;
    }
    else {
        cout << "Good" << endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
inline void rd(int &x){
  int k, m=0;
  x=0;
  for(;;){
    k = getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
inline void wt_L(char a){
  putchar_unlocked(a);
}
inline void wt_L(int x){
  char f[10];
  int m=0, s=0;
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    putchar_unlocked('-');
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
int N;
int main(){
  int d, i, k, res=0;
  rd(N);
  for(i=(1);i<(N+1);i++){
    k = i;
    d = 0;
    while(k){
      k/=10;
      d^=1;
    }
    res += d;
  }
  wt_L(res);
  wt_L('\n');
  return 0;
}
// cLay varsion 20190802-2

// --- original code ---
// int N;
// {
//   int i, k, d, res = 0;
//   rd(N);
//   rep(i,1,N+1){
//     k = i;
//     d = 0;
//     while(k) k/=10, d^=1;
//     res += d;
//   }
//   wt(res);
// }


Measured memory_bytes: 256
// --------------
// Tejas Pandey  |
// 30 - 05 - 20  |
// Kawaiiiiiii   |
// --------------

#include <bits/stdc++.h>
using namespace std;
     
#define mod 1000000007
#define vi vector<int>
typedef long long int ll;
     
int main (void){
  //freopen("in.txt","r",stdin);
  //freopen("out.txt","w",stdout);
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  string s;
  cin >> s;
  for(int i = 0;i < s.size();i++) if(s[i] == '?') cout << 'D'; else cout << s[i];
  cout << "\n";
  return 0;
}


Measured memory_bytes: 3760
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String str[] = br.readLine().split(" ");

		int h = Integer.parseInt(str[0]);
		int w = Integer.parseInt(str[1]);

		String matrix[][] = new String[h][w];

		for (int i = 0; i < h; i++) {
			str = br.readLine().split("");
			for (int j = 0; j < w; j++) {
				matrix[i][j] = str[j];
			}
		}

		for (int i = 0; i < h; i++) {
			for (int j = 0; j < w; j++) {
				if (j > 0 && i > 0) {
					if (matrix[i - 1][j].equals("#") && matrix[i][j - 1].equals("#")) {
						System.out.println("Impossible");
						return;
					}
				}
			}
		}
		System.out.println("Possible");
	}
}

Measured memory_bytes: 33104
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, a, b) for(int i = a; i < b; i++)
#define all(x) x.begin(), x.end()
#define fi first
#define se second
#define pb push_back
#define debug(x) cerr <<__LINE__<< ": " << #x << " = " << x << endl
#define debug_vec(v) cerr<<__LINE__<<": "<<#v<<" = ";rep(i,v.size())cerr<<" "<<v[i];cerr<<endl
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = (1<<30) - 1;
const ll LINF = (1LL<<60) - 1;

void solve() {
    int n, m;
    cin >> n >> m;
    vector<int> A(n);
    int sum = 0;
    rep(i, n) {
        cin >> A[i];
        sum += A[i];
    }
    int cnt = 0;
    rep(i, n) {
        if (A[i] * 4 * m >= sum) cnt++;
    }
    if (cnt >= m) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

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


Measured memory_bytes: 3668
{-# LANGUAGE BangPatterns #-}
import Control.Monad
import Data.Maybe
import Debug.Trace
import Data.List
import qualified Data.Map.Strict as Map
import qualified Data.IntMap.Strict as IntMap
import qualified Data.Set as Set
import qualified Data.IntSet as IntSet
import Data.Functor
import Data.Array
-- import Data.Array.Unboxed
import Control.Monad.ST
import Data.Array.ST

main :: IO ()
main = do
  (n:k:_) <- fmap (map read . words) getLine :: IO [Int]
  vs <- map read . words <$> getLine :: IO [Int]
  print $ solve n k vs

solve n k vs = maximum $ map cost [0..(min n k)]
  where
    cost i = maximum [ 
      sum . deleteNegative (k-i) . sort $ (take j vs) ++ (drop (n - i + j) vs) | j <- [0..i]]
    deleteNegative l [] = []
    deleteNegative l (a:as) 
      | l <= 0 = a:as 
      | otherwise = if a < 0 
                    then deleteNegative (l-1) as
                    else (a:as)

Measured memory_bytes: 1020
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <math.h> 
#include <iomanip>
#include <string.h>
#include <vector>
using namespace std;

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long
#define PI 3.14159265358979323846264338327950L


const int N = 2e5 + 5;

 
int vis[N];


int32_t  main() {

	IOS;

 
	int a, b, h, m;

	cin >> a >> b >> h >> m;


	long double tmp1 = (long double)h * 5 + (long double)m / 60  * 5 ;
	//cout << tmp1 << endl;
	long double diff = abs(tmp1 - m);

	long double degree = diff * 6 ;
	//cout << degree << endl;
	long double rad = (degree * PI) / 180;

	long double rsq = (long double)(a * a + b * b) - (long double)(2 * a *
		b) * cosl(rad);

	cout << fixed << showpoint << setprecision(20) << sqrt(rsq) << endl;

}

Measured memory_bytes: 3536
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(int)(n); i++)

using namespace std;
using LL = long long;
using P = pair<int,int>;

int main(){
	int N;
	cin >> N;
	int ans=1;
	while(ans*2 <= N) ans*=2;
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <list>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <deque>

#define dump(x) cerr << #x << "=" << (x) << endl;
using namespace std;
using ll = long long;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define IN(x) int (x); cin >> x
#define INS(x) string (s); cin >> s
#define INL(x) ll (x); cin >> x
#define VINT(a,n) vector<int> a(n)
#define VIN(a,n) VINT(a,n); REP(i,n){cin >> a[i];}
#define ALL(x) (x).begin(),(x).end()

#define M 1000000007
long long mod(long long val, long long m) {
  long long res = val % m;
  if (res < 0) res += m;
  return res;
}
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}



vector<vector<ll>> mem(100010,vector<ll>(2, -1));
ll temp;
ll count (vector<char>& l, int i, bool hoge){
  if (l[i]=='1'){
    return mod(modpow(3, l.size()-i-1, M) + mod(2*count(l, i+1, hoge), M), M);
  }
  else if (l[i]=='0'){
    return count(l, i+1, false);
  }
  else
    return 1;
}

int main () {
  vector<char> l;
  char ch;
  while ((ch = getchar()) != '\n')
    l.push_back(ch);

  int ans = mod(count(l, 0, false), M);
  cout<<ans;
      
  
}


Measured memory_bytes: 7552
#include <iostream>
#include <string>
using namespace std;
int main() {
	string str;
	cin >> str;
	int array[26] = { 0 };
	int flg = 0;
	for (int i = 0;str[i] != '\0';i++) {
		array[str[i] - 'a']++;
	}
	for (int i = 0;i < 26 && flg == 0;i++) {
		if (array[i] > 1)
			flg = 1;
	}

	if (flg == 0) {
		cout << "yes" << endl;
	}
	else {
		cout << "no" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include<iostream>	// 入出力
#include<stdio.h>	// printf()が使える 小数は%fで
#include<math.h>	// 数学の関数
#include<vector>	// 配列
#include<string>	// 文字列
#include<map>		// 連想配列
#include<stack>		// スタック
#include<queue>		// キュー
#include<algorithm> // ソートとか

using namespace std;

using ll = long long;

int main()
{
	
	int A, B, C, D;

	cin >> A >> B >> C >> D;

	int start = (A > C) ? A : C;

	int end = (B < D) ? B : D;

	if (end - start < 0)
	{
		cout << 0 << endl;
	}
	else
	{
		cout << end - start << endl;
	}

	return 0;
}

Measured memory_bytes: 256
# Aizu Problem ALDS_1_2_C: Stable Sort
#
import sys, math, os

# read input:
PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
    sys.stdin = open("sample-input2.txt", "rt")


def printA(A):
    print(' '.join([str(a) for a in A]))


def bubble_sort(A):
    for i in range(len(A) - 1):
        for j in range(len(A) - 1, i, -1):
            if A[j][1] < A[j - 1][1]:
                A[j], A[j - 1] = A[j - 1], A[j]
    return A

def selection_sort(A):
    for i in range(len(A)):
        mini = i
        for j in range(i, len(A)):
            if A[j][1] < A[mini][1]:
                mini = j
        if mini != i:
            A[i], A[mini] = A[mini], A[i]
    return A

def is_stable(A, B):
    for val in range(1, 10):
        v = str(val)
        if [a[0] for a in A if a[1] == v] != [b[0] for b in B if b[1] == v]:
            return False
    return True
        
N = int(input())
A = list(input().split())
A_bubble = bubble_sort(A[:])
printA(A_bubble)
print("Stable" if is_stable(A, A_bubble) else "Not stable")
A_select = selection_sort(A[:])
printA(A_select)
print("Stable" if is_stable(A, A_select) else "Not stable")

Measured memory_bytes: 7840
my@e;
map {$/=$_;0*map {(@e[$^a]++;$//=$^a)while $/%%$^a},2..$_},2..get;
$_={+@e.grep: *>$_-2};
say .(75)+.(25)*+^-.(3)+.(15)*+^-.(5)+.(5)*+^-.(5)*(.(3)-2)/2

Measured memory_bytes: 79924
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef unsigned int UI;

int main()
{
  int N;
  cin >> N;
  vector <int> V(N);
  for (int i = 0; i < N; ++i)
    cin >> V[i];
  sort(V.begin(), V.end());
  long long ans = 0;
  for (int i = 0; i < N; ++i) {
    for (int j = i+1; j < N; ++j) {
      vector<int>::iterator vi = lower_bound(V.begin(), V.end(), V[i]+V[j]);
      --vi;
      int id = vi - V.begin();
      if (id <= j) continue;
      ans += id - j;
    }
  }
  cout << ans << endl;
  return 0;
}


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

const int INF = pow(2, 31) - 1;
#define ll long long
#define DEBUG(x) cout << "DEBUG>" << #x << ":" << x << endl;
#define REP(i,n) for(ll i=0;i<(n);i++)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}

int main() {
  int N;
  cin >> N;
  vector<int> A1(N);
  vector<int> A2(N);
  REP(i, N) {
    cin >> A1[i];
  }
  REP(i, N) {
    cin >> A2[i];
  }
  vector<int> cs_A1(N + 1, 0);
  vector<int> cs_A2(N + 1, 0);
  REP(i, N) {
    cs_A1[i + 1] = cs_A1[i] + A1[i];
    cs_A2[i + 1] = cs_A2[i] + A2[i];
  }
  int ans = 0;
  REP(i, N) {
    ans = max(ans, cs_A1[i + 1] + cs_A2[N] - cs_A2[i]);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Math;

namespace CSharp
{
    static class Program
    {
        static void Main(string[] args)
        {
            ReadInt(out var n, out var d);

            int ans = 0;
            for (int i = 0; i < n; i++)
            {
                ReadLong(out var x, out var y);
                if (x * x + y * y <= (long)d * d)
                {
                    ans++;
                }
            }

            Console.WriteLine(ans);
        }

        #region Helpers

        static int[] ReadIntArray() => Console.ReadLine().Split().Select(s => int.Parse(s)).ToArray();
        static long[] ReadLongArray() => Console.ReadLine().Split().Select(s => long.Parse(s)).ToArray();

        static int[] ReadLineIntArray(int count) => Enumerable.Repeat(0, count).Select(_ => int.Parse(Console.ReadLine())).ToArray();
        static long[] ReadLineLongArray(int count) => Enumerable.Repeat(0, count).Select(_ => long.Parse(Console.ReadLine())).ToArray();

        static string ReadString() => Console.ReadLine();
        static int ReadInt() => int.Parse(Console.ReadLine());
        static long ReadLong() => long.Parse(Console.ReadLine());

        static void ReadInt(out int first)
        {
            var array = ReadIntArray();
            first = array[0];
        }

        static void ReadInt(out int first, out int second)
        {
            var array = ReadIntArray();
            first = array[0];
            second = array[1];
        }

        static void ReadInt(out int first, out int second, out int third)
        {
            var array = ReadIntArray();
            first = array[0];
            second = array[1];
            third = array[2];
        }

        static void ReadInt(out int first, out int second, out int third, out int fourth)
        {
            var array = ReadIntArray();
            first = array[0];
            second = array[1];
            third = array[2];
            fourth = array[3];
        }

        static void ReadLong(out long first)
        {
            var array = ReadLongArray();
            first = array[0];
        }

        static void ReadLong(out long first, out long second)
        {
            var array = ReadLongArray();
            first = array[0];
            second = array[1];
        }

        static void ReadLong(out long first, out long second, out long third)
        {
            var array = ReadLongArray();
            first = array[0];
            second = array[1];
            third = array[2];
        }

        static void ReadLong(out long first, out long second, out long third, out long fourth)
        {
            var array = ReadLongArray();
            first = array[0];
            second = array[1];
            third = array[2];
            fourth = array[3];
        }

        static string YesNo(bool condition) => condition ? "Yes" : "No";
        static string YESNO(bool condition) => condition ? "YES" : "NO";

        #endregion
    }
}

Measured memory_bytes: 46848
use std::io::{stdin, Read, StdinLock};
use std::str::FromStr;

#[allow(dead_code)]
struct Scanner<'a> {
    cin: StdinLock<'a>,
}
#[allow(dead_code)]
impl<'a> Scanner<'a> {
    fn new(cin: StdinLock<'a>) -> Scanner<'a> {
        Scanner { cin: cin }
    }

    fn read<T: FromStr>(&mut self) -> Option<T> {
        let token = self.cin.by_ref().bytes().map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        token.parse::<T>().ok()
    }

    fn input<T: FromStr>(&mut self) -> T {
        self.read().unwrap()
    }
}

fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin);

    let (mut a, b):(String, String) = (sc.input(), sc.input());
    a.push_str(&b);
    let num: f64 = a.parse().unwrap();
    println!("{}", if num.sqrt().floor() == num.sqrt().ceil() {
        "Yes"
    } else {
        "No"
    });
}


Measured memory_bytes: 4352
#include <algorithm>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <vector>

using namespace std;

#define rep(i, n) for (int64_t i = 0; i < (int64_t)(n); i++)
#define irep(i, n) for (int64_t i = 0; i <= (int64_t)(n); i++)
#define rrep(i, n) for (int64_t i = (n)-1; i >= 0; i--)
#define rirep(i, n) for (int64_t i = n; i >= 0; i--)

int main() {
  string s;
  cin >> s;

  int K;
  cin >> K;

  for (char &c : s) {
    int d = c - 'a';
    if (d > 0 && 26 - d <= K) {
      c = 'a';
      K -= 26 - d;
    }
  }

  K %= 26;
  int d = s.back() - 'a';
  d = (d + K) % 26;
  s.back() = 'a' + d;

  cout << s << endl;

  return 0;
}

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

using namespace std;
using ll = long long;

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)

int main() {
  string s, t;
  cin >> s >> t;
  int n = s.size();
  int ans = 0;
  rep(i, n) {
    if (s[i] != t[i]) ++ans;
  }
  cout << ans << endl;
  return 0;
}


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

int main(){
	ll w, h; cin >> w >> h;
	vector<pair<ll, bool> > v;
	for(ll i = 0; i < w + h; ++i){
		ll p; cin >> p;
		v.push_back(pair<ll, bool>(p, i < w));
	}
	ll ans = 0;
	ll po[] = {w + 1, h + 1};
	sort(v.begin(), v.end());
	for(auto e : v){
		ans += e.first * max<ll>(0, po[(int)e.second]);
		--po[(int)!e.second];
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 6512
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define MOD 1000000007
using namespace std;

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

int main() {
    int N, K;
    cin >> N >> K;
    int V[N];
    for (int i = 0; i < N; i++) {
        cin >> V[i];
    }

    long long maximum = 0;

    for (int A = 0; A <= K; A++) {
        for (int B = 0; A + B <= K; B++) {
            vector<int> myBag;
            long long sum = 0;
            if (A + B >= N) {
                for (int i = 0; i < N; i++) {
                    myBag.push_back(V[i]);
                    sum += V[i];
                }
            } else {
                for (int i = 0; i < A; i++) {
                    myBag.push_back(V[i]);
                    sum += V[i];
                }
                for (int i = 0; i < B; i++) {
                    myBag.push_back(V[N - i - 1]);
                    sum += V[N - i - 1];
                }
            }
            sort(myBag.begin(), myBag.end());
            for (int i = 0; i < K - (A + B) && i < A + B; i++) {
                if (myBag[i] < 0) sum -= myBag[i];
            }
            maximum = max(maximum, sum);
        }
    }

    cout << maximum << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int n,w;
long long dp[100][100001];
long long func(int i,int w,int *a,long long* v){
    if(i==n)
        return 0;
    if(dp[i][w]!=-1)
        return dp[i][w];
    if(w>=a[i])
    dp[i][w]=v[i]+func(i+1,w-a[i],a,v);
    dp[i][w]=max(dp[i][w],func(i+1,w,a,v));
    return dp[i][w];
}

int main()
{
   cin>>n>>w;
   int a[n];
   long long v[n];
   for(int i=0;i<n;i++)
    for(int j=0;j<=w;j++) 
        dp[i][j]=-1;
   for(int i=0;i<n;i++)
    cin>>a[i]>>v[i];
    cout<<func(0,w,a,v);
}

Measured memory_bytes: 78336
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define endl "\n"
#define fastio ios_base::sync_with_stdio(false); cin.tie(nullptr);
#define all(x) x.begin(),x.end()
#define y1 omg
#define INF 1000000010
#define FOR(x, n) for(int x=0; x<n; x++)
#define ini(x, n) memset(x, n, sizeof(x));
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef pair<int, ii> iii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef vector<ll> vl;

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

ll x;

int main() {
	cin >> x;
	ll t = 100;
	for (int i=1; ; i++) {
		t += t / 100;
		if (t >= x) {
			cout << i;
			return 0;
		}
	}
}

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

#define pb push_back
#define ll long long
#define pi pair<int,int>
#define pii pair<int,pi>
#define pl pair<ll,ll>
#define pll pair<ll,pl>
#define debug cout<<"debugging"<<endl
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
int I_LIMIT = 999999999;
ll L_LIMIT = 19999999999999999;
ll mod = 1000000007;
vector <int> v[100005];

void solve()
{
    string s;
    cin>>s;

    int n = s.length();
    if(s[n-1]=='s')
        s+="es";
    else
        s+="s";
    cout<<s<<"\n";
}
int main()
{
    IOS;
    solve();
}


Measured memory_bytes: 5988