akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using static System.Console;
using static System.Math;

namespace CP
{
    class Atria
    {
        static void Main(string[] args)
        {
            int n = int.Parse(ReadLine());
            var dic = new Dictionary<char, int>();
            for (char i = 'a'; i <= 'z'; i++)
            {
                dic.Add(i, 0);
            }
            var r = ReadLine();
            for (int i = 0; i < r.Length; i++)
            {
                dic[r[i]]++;
            }

            for (int i = 0; i < n-1; i++)
            {
                var subdic = new Dictionary<char, int>();
                for (char j = 'a'; j <= 'z'; j++)
                {
                    subdic.Add(j, 0);
                }
                var s = ReadLine();
                for (int j = 0; j < s.Length; j++)
                {
                    subdic[s[j]]++;
                }
                for (char j = 'a'; j <= 'z'; j++)
                {
                    dic[j] = Min(dic[j], subdic[j]);
                }
            }

            var ans = new StringBuilder();
            foreach (var item in dic)
            {
                for (int i = 0; i < item.Value; i++)
                {
                    ans.Append(item.Key);
                }
            }
            WriteLine(ans.ToString());
        }
    }
}

Measured memory_bytes: 11220
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;

int main() {
  int N;
  cin >> N;
  vector<ll> H(N);
  rep(i, N)
    cin >> H[i];
  int ans = 0;
  int tmp = 0;
  rep(i, N-1) {
    tmp = 0;
    while(i+tmp < N-1 && H[i+tmp] >= H[i+tmp+1])
      tmp++;
    if(tmp > ans)
      ans = tmp;
    i += tmp;
  }
  cout << ans << endl;
  return 0;
}


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

using namespace std;

int main() {
  int n = 0;
  string s;
  
  cin >> n >> s;
  
  int count = 0;
  
  for (int i = 0; i <= s.length() - 3; i++) {
    if (s[i] == 'A' && s[i+1] == 'B' && s[i+2] == 'C') {     
      count++;
    }
  }
  
  cout << count << endl;
}

Measured memory_bytes: 256
#define r return
i,j,n,f[6];
w[8]={1,1,0,-1,-1,-1,0,1};
h[8]={0,1,1,1,0,-1,-1,-1};
char t[10][10],mark[2]={'o','x'};
 
int l(int dx,int dy,int x,int y,char m,int c){
if(t[x][y]=='.'||t[x][y]=='0')r 0;if(t[x][y]==m)r c;r l(dx,dy,x+dx,y+dy,m,c+1);}
int s(int x,int y,char m){
  int k,c;c=0;if(t[x][y]!='.')r 0;
  for(k=0;k<8;k++)c+=l(w[k],h[k],x+w[k],y+h[k],m,0);
  r c;
}
int p(int dx,int dy,int x,int y,char m){
  if(t[x][y]=='0'||t[x][y]=='.')r 0;if(t[x][y]==m)r 1;
  if(p(dx,dy,x+dx,y+dy,m)){t[x][y]=m;r 1;}
  else r 0;
}
int o(int x,int y,char m){
  int k;
  t[x][y]=m;for(k=0;k<8;k++)p(w[k],h[k],x+w[k],y+h[k],m);
  r 0;
}
 
int main(){
  for(i=0;i<10;i++)t[0][i]=t[9][i]='0';
  for(i=1;i<9;i++){
    scanf("%s",&t[i][1]);
    t[i][0]='0';
    t[i][9]='0';
  }
  f[1]=-1;
  for(n=0;;n=(n+1)%2){
    f[n]=-1;
    for(i=n?8:1;n?i>-1:i<9;n?i--:i++){
      for(j=n?8:1;n?j>-1:j<9;n?j--:j++){
        if(f[n]<s(i,j,mark[n])){
          f[2+n]=i;
          f[4+n]=j;
          f[n]=s(i,j,mark[n]);
        }
      }
    }
    if(f[n]!=0)o(f[2+n],f[4+n],mark[n]);
    if(f[0]==0&&f[1]==0)break;
  }
  for(i=1;i<9;i++){
    for(j=1;j<9;j++){
      printf("%c",t[i][j]);
    }
    puts("");
  }
  r 0;
}

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

using namespace std;

#define ll long long
typedef complex<double> P;

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

  for (size_t i = 0; i < m ; i++) {
    int a, b;
    cin >> a >> b;
    c[a-1]++;
    c[b-1]++;
  }

  for (size_t i = 0; i < n ; i++) {
    cout << c[i] << endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
using i64 = int64_t;
using u64 = uint64_t;
using f64 = double;
using f80 = __float80;

int main(){
  i64 n, m, sum=0;
  priority_queue<i64> q;
  cin >> n >> m;
  rep(i, n){
    ll tmp;
    cin >> tmp;
    q.push(tmp);
  }
  rep(i, m){
    i64 max = q.top();
    q.pop();
    q.push(max/2);
  }
  rep(i, n){
    sum += q.top();
    q.pop();
  }
  cout << sum << endl;
}

Measured memory_bytes: 1400
import bisect

n, m = map(int, input().split())
li = []
d = {}
for _ in range(m):
    p, y = map(int, input().split())
    li.append([p, y])
    if p not in d:     
        d[p] = [y]
    else:
        d[p].append(y)
for k, v in d.items():
    v.sort()
for p, y in li:
    r = bisect.bisect_right(d[p], y)
    print(str(p).zfill(6) + str(r).zfill(6))


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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;

#define each(i,a) for (auto&& i : a)
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
#define pb push_back
#define all(a) (a).begin(),(a).end()
#define chmin(x,v) x = min(x, v)
#define chmax(x,v) x = max(x, v)

const ll linf = 1e18;
const double eps = 1e-12;
const double pi = acos(-1);

template<typename T>
istream& operator>>(istream& is, vector<T>& vec) {
    each(x,vec) is >> x;
    return is;
}
template<typename T>
ostream& operator<<(ostream& os, const vector<T>& vec) {
    rep(i,vec.size()) {
        if (i) os << " ";
        os << vec[i];
    }
    return os;
}
template<typename T>
ostream& operator<<(ostream& os, const vector< vector<T> >& vec) {
    rep(i,vec.size()) {
        if (i) os << endl;
        os << vec[i];
    }
    return os;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s; cin >> s;
    const ll n = s.size();
    string t = "AKIHABARA";
    ll pos = 0;
    try {
        rep(i, n) {
            while (pos < t.size() && s[i] != t[pos] && t[pos] == 'A') ++pos;
            if (pos == t.size()) throw 1;
            if (s[i] != t[pos]) throw 1;
            ++pos;
        }
        if (pos < t.size()-1) throw 1;
        cout << "YES" << endl;
    }
    catch (int err) {
        cout << "NO" << endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, s, n) for(int i = s; i < (int)n; i++)
#define per(i, n) for(int i = n; i >= 0; i--)
#define ROF(i, s, n) for(int i = s; i >= (int)n; i--)
#define FORIT(i, A) for (auto i : A)
#define PRINT(x) cout << (x) << "\n"
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define MP make_pair
#define EACH(i, n) for (__typeof((n).begin()) i = (n).begin(); i != (n).end(); ++i)
#define SZ(a) int((a).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define CLR(a) memset((a), 0 ,sizeof(a))
#define NCLR(a) memset((a), -1 ,sizeof(a))
#define dump(x) cout << #x << " = " << (x) << "\n";
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << "\n";
#define sq(n) (n) * (n)
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef priority_queue<int> maxpq;
typedef priority_queue< int, vector<int>, greater<int> > minpq;
typedef complex<double> P;
static const double EPS = 1e-10;
static const double PI = acos( -1.0 );
static const int mod = 1000000007;
static const int INF = 1 << 30;
static const LL LL_INF = 1152921504606846976;
static const int dx[] = { -1, 0, 1, 0, 1, -1, 1, -1 };
static const int dy[] = { 0, -1, 0, 1, 1, 1, -1, -1 };

string str;
map<char, char> change;

int main() {
	for ( int i = 0; i < 26; i++ ) {
		change[ i + 'a' ] = ( i + 25 ) % 26 + 'a';
	}
	while ( getline( cin, str ) ) {
		for ( ;; ) {
			for ( int j = 0; j < str.size(); j++ ) {
				if ( str[ j ] >= 'a' && str[ j ] <= 'z' ) {
					str[ j ] = change[ str[ j ] ];
				}
			}
			bool is_can = false;
			for ( int j = 2; j < str.size(); j++ ) {
				if ( str.substr( j - 2, 3 ) == "the" ) {
					is_can = true;
					break;
				}
			}
			for ( int j = 3; j < str.size(); j++ ) {
				if ( str.substr( j - 3, 4 ) == "that" || str.substr( j - 3, 4 ) == "this" ) {
					is_can = true;
					break;
				}
			}
			if ( is_can ) {
				break;
			}

		}
		printf( "%s\n", str.c_str() );
	}
	return 0;
}

Measured memory_bytes: 1188
def lcs_fast(x, y):
    len_x = len(x)
    len_y = len(y)

    c = [0] * (len_y + 1)
    for i in range(len_x):
        c_prev = c[:]
        for j in range(len_y):
            if x[i] == y[j]:
                c[j+1] = c_prev[j] + 1
            elif c[j+1] < c[j]:
                c[j+1] = c[j]
    return c[-1]


if __name__ == "__main__":
    n = int(input())
    for i in range(n):
        x = input()
        y = input()
        # print(lcs(x, y))
        print(lcs_fast(x, y))


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

int main() {
    string S;
    cin >> S;
    string s1 = S.substr(0,S.size()/2);
    reverse(S.begin(),S.end());
    string s2 = S.substr(0,S.size()/2);
    int count = 0;
    for (int i = 0; i < s1.size(); i++){
        if (s1.at(i) != s2.at(i)) count++;
    }
    cout << count << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<cmath>
#include<iomanip>
#include<cstring>
#include<complex>
#include<cstdio>
#define initdp(a,b) for(int i=0;i<=a;i++)for(int j=0;j<=b;j++)dp[i][j]=-1;
#define fi first
#define se second
#define pb push_back
#define pii pair<int,int>
#define ppi pair<pii,int>
#define pip pair<int,pii>
#define ll long long
#define pll pair<ll,ll>
#define rep(i,n) for(int i=0;i<n;i++)
#define repd(i,n) for(int i=n-1;i>=0;i--)
#define inf 1000000001
#define inf1 1000000000000000001
#define mod 1000000007
#define pie 3.14159265358979323846
#define N 1000005
#define mid(l,r) l+(r-l)/2
using namespace std;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
int ddx[8]={1,1,0,-1,-1,-1,0,1},ddy[8]={0,1,1,1,0,-1,-1,-1};
void mad(ll &a,ll b){a=(a+b)%mod;if(a<0)a+=mod;}
ll gcd(ll a,ll b){ if(!a)return b;return gcd(b%a,a);}

void solve(){
	int n;
	cin>>n;
	pll xy[n];
	ll mini=1e18,maxi=-1e18,a=0,b=0,c=0,d=0;
	for(int i=0;i<n;i++){
		ll x,y;
		cin>>x>>y;
		if(x+y>maxi){
			maxi=x+y;
			a=i;
		}
		if(x+y<=mini){
			mini=x+y;
			b=i;
		}
		xy[i]=pll(x,y);
	}
	mini=1e18,maxi=-1e18;
	for(int i=0;i<n;i++){
		ll x=xy[i].fi;
		ll y=xy[i].se;
		if(x-y>maxi){
			maxi=x-y;
			c=i;
		}
		if(x-y<=mini){
			mini=x-y;
			d=i;
		}
	}
	vector<pll>p;
	p.pb(xy[a]);
	if(b!=a)p.pb(xy[b]);
	if(c!=b&&c!=a)p.pb(xy[c]);
	if(d!=c&&d!=b&&d!=a)p.pb(xy[d]);
	ll ans=-1e18;
	for(int i=0;i<p.size();i++){
		for(int j=i+1;j<p.size();j++)ans=max(ans,abs(p[j].fi-p[i].fi)+abs(p[j].se-p[i].se));
	}
	cout<<ans<<"\n";
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int t;
	//cin>>t;
	t=1;
	while(t--){
		solve();
	}
}

Measured memory_bytes: 6752
/*
@Date    : 2019-10-05 13:07:36
@Author  : Adscn (adscn@qq.com)
@Link    : https://www.cnblogs.com/LLCSBlog
*/
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define IL inline
#define RG register
#define gi geti<int>()
#define gl geti<ll>()
#define gc getchar()
#define File(a) freopen(a".in","r",stdin);freopen(a".out","w",stdout)
template<typename T>IL bool chkmax(T &x,const T &y){return x<y?x=y,1:0;}
template<typename T>IL bool chkmin(T &x,const T &y){return x>y?x=y,1:0;}
template<typename T>
IL T geti()
{
	RG T xi=0;
	RG char ch=gc;
	bool f=0;
	while(!isdigit(ch))ch=='-'?f=1:f,ch=gc;
	while(isdigit(ch))xi=xi*10+ch-48,ch=gc;
	return f?-xi:xi;
}
template<typename T>
IL void pi(T k,char ch=0)
{
	if(k<0)k=-k,putchar('-');
	if(k>=10)pi(k/10);
	putchar(k%10+'0');
	if(ch)putchar(ch);
}
typedef pair<ll,ll> pll;
int n;
const int N=2e5+7,P=1e9+7;
ll ksm(ll a,int b,ll c=1)
{
	for(;b;b>>=1,a=a*a%P)if(b&1)c=c*a%P;
	return c;
}
ll inv(ll x){return ksm(x,P-2);}
struct edge{int v,nxt;}e[N];
int head[N],cnt;
inline void add(int u,int v){e[++cnt]=(edge){v,head[u]},head[u]=cnt;}
inline void init(){memset(head,cnt=-1,sizeof head);}
vector<pll>dp[N];
ll All[N],Zero[N],One[N];
int id[N],num,d[N];
#define mp make_pair
#define fi first
#define se second
#define For_tree(x) for(int _i=head[x],v=e[_i].v;~_i;_i=e[_i].nxt,v=e[_i].v)
inline void dfs(int x)
{
	int hson=n+1,tot=0;
	For_tree(x)
	{
		dfs(v);++tot;
		if(d[v]>d[hson])hson=v;
	}
	if(hson!=n+1)id[x]=id[hson],d[x]=d[hson]+1;
	else id[x]=++num;
	dp[id[x]].push_back(mp(1,1));
	if(tot==1)return;
	for(int i=0;i<d[x];++i)All[i]=1,Zero[i]=1,One[i]=0;
	int dep;
	For_tree(x)
		for(int i=0;i<=d[v];++i)
		{
			dep=d[hson]-d[v]+i;
			pll t=dp[id[v]][i];
			(All[dep]*=(t.fi+t.se))%=P,(Zero[dep]*=t.fi)%=P;
		}
	For_tree(x)
		for(int i=0;i<=d[v];++i)
		{
			dep=d[hson]-d[v]+i;
			pll t=dp[id[v]][i];
			(One[dep]+=Zero[dep]*inv(t.fi)%P*t.se%P)%=P;
		}
	for(int i=0;i<d[x];++i)
	{
		pll &t=dp[id[x]][i];
		t.fi=(All[i]-One[i]+P)%P,t.se=One[i];
	}
}
int dep[N],tot[N],fa[N];
int main(void)
{
	n=gi;init();
	for(int i=1;i<=n;++i)fa[i]=gi,add(fa[i],i),dep[i]=dep[fa[i]]+1,++tot[dep[i]];
	d[n+1]=-1,++tot[0];
	dfs(0);
	ll ans=0;
	for(int i=0;i<=d[0];++i){
		pll t=dp[id[0]][i];
		(ans+=t.se*ksm(2,n+1-tot[d[0]-i])%P)%=P;
	}
	pi(ans);
	return 0;
}

Measured memory_bytes: 33776
#include<iostream>
using namespace std;
int main(void){
  int w,a,b;
  cin>>w>>a>>b;
  cout<<((b<=a+w&&a+w<=b+w)||(a<=b+w&&b+w<=a+w)?0:a+w<b?b-a-w:a-b-w);
  return 0;
}

Measured memory_bytes: 256
import sys

input = sys.stdin.readline

n = int(input())
mod = 10 ** 9 + 7

c = []

for i in range(n):
    c.append(int(input()))

d = {}
dp = [[1,0]]

p = -1
for ci in c:
    if p != ci:
        cnt = 0
        if ci in d:
            cnt = sum(dp[d[ci]]) % mod
        dp.append([sum(dp[-1]) % mod, cnt])
        d[ci] = len(dp) - 1
    p = ci

print(sum(dp[-1]) % mod)


Measured memory_bytes: 53188
# include<stdio.h>
long long int GCD(long long int a,long long int b)
{
long long int temp;
while(b!=0)
{
temp=a%b;
a=b;
b=temp; 
}
return a;
}
int main()
{
long long int a,b,gcd,lcm;
while(scanf("%lld%lld",&a,&b)==2)
{
gcd=GCD(a,b);
lcm=(a/gcd)*(b/gcd)*gcd;
printf("%lld %lld\n",gcd,lcm);
}
return 0;
}

Measured memory_bytes: 596
package main

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



func main() {
    var a,b int
    fmt.Scan(&a,&b)
    ans := b
    switch{
        case a<=5:
            ans = 0
        case a<=12:
            ans = b/2
    }
    fmt.Println(ans)
}





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 scanTwoNums(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, "")
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
using namespace std; 
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define FORD(i,a,b) for(int i=(a);i>=(b);i--)
inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }
const int INF = 1<<29;
typedef long long int ll;
inline int two(int n) { return 1 << n; }
inline int test(int n, int b) { return (n>>b)&1; }
inline void set_bit(int & n, int b) { n |= two(b); }
inline void unset_bit(int & n, int b) { n &= ~two(b); }
inline int last_bit(int n) { return n & (-n); }
inline int ones(int n) { int res = 0; while(n && ++res) n-=n&(-n); return res; }
template<class T> void chmax(T & a, const T & b) { a = max(a, b); }
template<class T> void chmin(T & a, const T & b) { a = min(a, b); }
const int MOD=1000000007;

bool isPowerOfTwo (ll x)  
{  
    return x && (!(x&(x-1)));  
}
bool isPrime(int n) 
{ 
    if (n <= 1)  return false; 
    if (n <= 3)  return true; 
    if (n%2 == 0 || n%3 == 0) return false; 
  
    for (int i=5; i*i<=n; i=i+6) 
        if (n%i == 0 || n%(i+2) == 0) 
           return false; 
  
    return true; 
}
int highestPowerof2(unsigned int n) 
{ 
    // Invalid input 
    if (n < 1) 
        return 0; 
  
    int res = 1;
    for (int i=0; i<8*sizeof(unsigned int); i++) 
    { 
        int curr = 1 << i; 
        if (curr > n) 
           break; 
  
        res = curr; 
    } 
  
    return res; 
} 
long long binpow(long long a, long long b) {
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}       
////////////////////////////////////////////////////////////////////

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);  
  cout.tie(NULL);
  int t=1;
  while(t--)
  {
      int n;
      string s;
      cin>>n>>s;
      int flag=0;
      vector<char> v;
      REP(i,n-1)
      {
          if(s[i]!=s[i+1])
          {
              v.push_back(s[i]);
          }    
      }
      v.push_back(s[n-1]);
      cout<<v.size(); 
  }
  return 0;
}

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

struct Fast { Fast() { std::cin.tie(0); ios::sync_with_stdio(false); } } fast;

signed main() {
	string S;

	cin >> S;

	int maxnum = 0;
	int cur = 0;

	for (int i = 0; i < S.length(); i++) {
		char c = S[i];
		if (c == 'A' | c == 'T' | c == 'C' | c == 'G') {
			cur++;
			maxnum = max(maxnum, cur);
		}
		else {
			cur = 0;
		}
	}

	cout << maxnum << endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <string>
#include<algorithm>
using namespace std;
 
string str;
long long int a[26];
long long int ans;

int main(){
    cin >> str;
    long long int L=str.length();
    int i,j;
    ans=L*(L-1)/2;
    for(i=0;i<L;i++){
        a[str[i]-(int)'a']++;
    }
    for(i=0;i<26;i++){
        ans-=a[i]*(a[i]-1)/2;

    }

    cout << ans+1 << endl;

    return 0;
}

Measured memory_bytes: 640
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
typedef long long ll;

int	desc(const void *a, const void *b)
{
	long *A = (long *)a;
	long *B = (long *)b;
	if (*B > *A) return 1;
	if (*B < *A) return -1;
	return 0;
}

int asc(const void *a, const void *b) {
	long *A = (long *)a;
	long *B = (long *)b;
	if (*A > *B) return 1;
	if (*A < *B) return -1;
	return 0;
}


int main()
{
	int n,k;
	scanf("%d%d", &n,&k);
	long h[n];
	long d[n-1];
	long i = 0;
	while (i < n)
	{
		scanf("%ld", &h[i]);
		i++;
	}
	qsort(h, sizeof h / sizeof *h , sizeof *h, desc);
	long j;
	i = 0;
	long min = __LONG_MAX__;
	long sum;
	while (i <= n - k)
	{
		j = i;
		sum = 0;
		// printf("%ld\n", h[i]);
		while (j < (i + k) - 1)
		{
			sum += h[j] - h[j + 1];
			j++;
		}
		// printf("min = %ld\n", sum);
		if (sum <= min)
			min = sum;
		i++;
	}
	printf("%ld", min);


	// i = 0;
	// while (i < n- 1)
	// {
	// 	d[i] = h[i] - h[i+1];
	// 	i++;
	// }
	// qsort(d, sizeof d / sizeof *d , sizeof *d, asc);
	// long ans=0;
	// i = 0;
	// while (i < k - 1)
	// {
	// 	ans += d[i];
	// 	i++;
	// }
	// printf("%ld",ans);
	return (0);
}


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

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define FORR(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--)

#define DEBUG(x) cout << #x << ": " << (x) << endl
#define PRINT(x) cout << x << endl
#define all(x) x.begin(),x.end()

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

    int N = s.size();

    vector<bool> R(N,false);
    vector<bool> L(N,false);
    vector<int> ans(N,1);

    for(int i=0;i<N-1;i++){
        if(s[i]=='R'&&s[i+1]=='L'){
            R[i]=true , L[i+1]=true;
        }
    }
    int series = 0;
    for(int i=0;i<N;i++){
        if(R[i]){
            if(series&1) ans[i+1]+=1;
            ans[i] += series/2 , ans[i+1]+=series/2;
            series = 0;
        }else{
            if(s[i]=='R'){
                series++;
                ans[i]=0;
            }
        }
    }


    for(int i=N;i>=0;i--){
        if(L[i]){
            if(series&1) ans[i-1]+=1;
            ans[i] += series/2 , ans[i-1]+=series/2;
            series = 0;
        }else{
            if(s[i]=='L'){
                series++;
                ans[i]=0;
            }
        }
    }

    for(int i=0;i<N-1;i++){
        cout << ans[i] << " ";
    }

     cout << ans[N-1] << endl;

    return 0;

}



Measured memory_bytes: 1024
N = int(input())
An = list(map(int, input().split()))
An.sort()
max_n = max(An)
dp = [0] * (max_n + 1)
for i in range(N):
    if dp[An[i]] != 0:
        dp[An[i]] = 2
        continue
    for j in range(1, max_n//An[i] + 1):
        dp[An[i]*j] += 1
ans = 0
for a in An:
    if dp[a] == 1:
        ans += 1
print(ans)


Measured memory_bytes: 32200
N, M = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
S = sum(A)
th = S / (4*M)

res = 0
for i in A:
    if i>=th:
        res += 1

if res>=M:
    print("Yes")
else:
    print("No")

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

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define endl '\n';
#define FASTER ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
const ll POSITIVE_INFINITY = 9223372036854775807;
const ll NEGATIVE_INFINITY = -9223372036854775807;
const ll MOD = 1000000007;
const ld PI = acos(-1.0);

template <typename T> inline T bigMod(T A,T B,T M = MOD){A %= M;T ret = 1;while(B){if(B & 1) ret = (ret * A) % M;A = (A * A) % M;B = B >> 1;}return ret;}
template <typename T> inline T invMod (T A,T M = MOD){return bigMod(A,M-2,M);}

const int N = 100005;
string str;
int n;

ll dp[N + 5][14];
ll F(int pos, int rem){
  if (pos >= n){
    if (rem % 13 == 5){
      return 1;
    }
    return 0;
  }
  if (dp[pos][rem] != -1){
    return dp[pos][rem];
  }
  ll sum = 0;
  if (str[pos] != '?'){
    sum = (sum % MOD) + (F(pos + 1, ((rem * 10) + (str[pos] - '0')) % 13) % MOD);
    sum %= MOD;
  }
  else {
    for (int i = 0; i <= 9; i++){
      sum = (sum % MOD) + (F(pos + 1, ((rem * 10) + i) % 13) % MOD);
      sum %= MOD;
    }
  }
  return dp[pos][rem] = sum % MOD;
}
int main(){
  FASTER;
  memset(dp, -1, sizeof dp);
  cin >> str;
  n = str.size();
  cout << F(0, 0) << '\n';
  return 0;
}


Measured memory_bytes: 19280
using System;
using System.Linq;
    class Program
    {
        static void Main(string[] args)
        {
            Console.ReadLine();
            var S = Console.ReadLine().ToArray();
            var max = 0;
            var result = 0;

            foreach(var c in S)
            {
                result += c == 'I' ? 1 : -1;
                if (max < result) max = result;
            }
            Console.WriteLine(max);
        }
    }

Measured memory_bytes: 13268
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <string>
#include <cmath>
using namespace std;
#define MOD 1000000007
#define INF 1<<30
#define LINF (ll)1<<62
#define MAX 510000
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll, ll> P;
typedef vector<pair<ll, ll>> vpl;

int main(){
    ll a,b,c; cin >> a >> b >> c;
    ll k; cin >> k;
    ll mx = max({a,b,c});
    ll sum = a+b+c-mx;
    rep(i,k) mx *= 2;
    cout << sum + mx << endl;
}

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

using namespace std; 

int main(){
 	int n,max_num = -1000001,min_num = 1000001,tmp;
 	long long int sum = 0;
 	scanf("%d",&n);
 	for(int i = 0; i < n; i++){
 		scanf("%d",&tmp);
 		sum += tmp;
 		max_num = max(max_num,tmp);
 		min_num = min(min_num,tmp);
 	} 	printf("%d %d %lld\n",min_num,max_num,sum); }


Measured memory_bytes: 2728
#include<bits/stdc++.h>
#include<unordered_map>
using namespace std;
#define ll long long
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for(ll i = 0; i < n; i++)
const ll INF = 100100100100;
const ll MOD = 1000000007;


ll combination(ll n, ll r){
    if(n < r) return 0;
    if(r == 0||r == n) return 1;
    else if(r == 1) return n;
    return (combination(n - 1, r - 1) + combination(n - 1, r));
}

bool checkKaibun(string str){
    string checkStr = str;
    reverse(checkStr.begin(), checkStr.end());
    if(str == checkStr) return true;
    else return false;
}

int keta(ll num){
    int digits = 0;
    while(num > 0){
        num /= 10;
        digits++;
    }
    return digits;
}


ll mpow(ll x, ll n){//繰り返し二乗法 計算量O(logN)
    ll ans = 1;
    while(n != 0){
        if(n&1) ans = ans * x % MOD;
        x = x * x % MOD;
        n  = n >> 1;
    }
    return ans;
}

int gcd(int a, int b){
    if(a % b == 0) return b;
    else return (gcd(b, a%b));
}


int main(){
    int K;
    cin >> K;
    ll ans = 0;
    for(int i = 1; i <= K; i++){
        for(int j = 1; j <= K; j++){
            for(int n = 1; n <= K; n++){
                int tmp = gcd(i,j);
                ans += gcd(tmp, n);
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using vs=vector<string>;
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define range(i,a,n) for(ll i=(a);i<(n);i++)
#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI 3.1415926535897932384

int dx[]={1,0,-1,0,1,-1,-1,1},dy[]={0,1,0,-1,1,1,-1,-1};
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s;a=0;} return os;}
void OUT(bool b){cout<<(b?"YES":"NO")<<endl;}
void Out(bool b){cout<<(b?"Yes":"No")<<endl;}
void out(bool b){cout<<(b?"yes":"no")<<endl;}
template<class T>
void puta(T&&t){cout<<t<<endl;}
template<class H,class...T>
void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}

int popcnt(int x){return __builtin_popcount(x);}
int popcnt(ll x){return __builtin_popcountll(x);}
int bsr(int x){return 31 - __builtin_clz(x);}
int bsr(ll x){return 63 - __builtin_clzll(x);}
int bsf(int x){return __builtin_ctz(x);}
int bsf(ll x){return __builtin_ctzll(x);}

/*他のライブラリを入れる場所*/

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n,d;
	cin>>n>>d;
	d--;
	vl a(n);
	double p=-1;
	rep(i,n){
		cin>>a[i];
		if(a[i]==1)p=i;
	}
	cout<<(int)ceil(1.0*(n-1)/d)<<endl;
	return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef pair<P,int> T;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define all(x) (x).begin(),(x).end()
#define sq(x) ((x)*(x))
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define repn(i,a,n) for(int (i)=(a);(i)<(int)(n);(i)++)
#define EQ(a,b) (abs((a)-(b))<eps)
template<class T> void chmin(T& a,const T& b){if(a>b)a=b;}
template<class T> void chmax(T& a,const T& b){if(a<b)a=b;}
int N,M,Q;
string s[2010];
struct imos2D{
	vector<vector<int> > f;
	vector<vector<int> > rui;
	imos2D(){}
	imos2D(int H,int W){
		f.resize(H);
		for(int i=0;i<H;i++)f[i].resize(W);
	}
	void set(int x,int y,int v){
		assert(x<f.size()&&y<f[0].size());
		f[x][y]=v;
	}
	void calc(){
		rui = f;
		for(int i=0;i<f.size();i++){
			for(int j=1;j<f[0].size();j++){
				rui[i][j]+=rui[i][j-1];
			}
		}
		for(int i=1;i<f.size();i++){
			for(int j=0;j<f[0].size();j++){
				rui[i][j]+=rui[i-1][j];
			}
		}
	}
	int get(int a,int b,int c,int d){
		if(c<0||d<0)return 0;
		if(c<a||d<b)return 0;
		int res = rui[c][d];
		if(a>0)res -= rui[a-1][d];
		if(b>0)res -= rui[c][b-1];
		if(a>0&&b>0)res += rui[a-1][b-1];
		return res;
	}
};
int main(){
	cin >> N >> M >> Q;
	for(int i=0;i<N;i++){
		cin >> s[i];
	}
	imos2D V(N,M);
	imos2D E(N,M);
	imos2D F(N,M);
	for(int i=0;i<N;i++){
		for(int j=0;j<M;j++){
			if(s[i][j]=='1'){
				V.set(i,j,1);
				if(i+1<N&&s[i+1][j]=='1')E.set(i,j,1);
				if(j+1<M&&s[i][j+1]=='1')F.set(i,j,1);
			}
		}
	}
	V.calc();
	E.calc();
	F.calc();
	for(int i=0;i<Q;i++){
		int a,b,c,d;
		cin >> a >> b >> c >> d;
		a--;b--;c--;d--;
		int ans = V.get(a,b,c,d)-E.get(a,b,c-1,d)-F.get(a,b,c,d-1);
		cout << ans << endl;
	}
	return 0;
}

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


int main() {
  int a, b, x, y;
  scanf("%d%d%d%d", &a, &b, &x, &y);
  printf("%lf %d\n", double(a) * double(b) / 2, x + x == a&&y + y == b);
}

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

struct Frac {
    int num, den;
    inline Frac(int _num, int _den) {
        int gcd = __gcd(_num, _den);
        num = _num / gcd;
        den = _den / gcd;
    }
    inline Frac operator+(const Frac &o) const {
        return Frac(num * o.den + o.num * den, den * o.den);
    }
    inline Frac operator-(const Frac &o) const {
        return Frac(num * o.den - o.num * den, den * o.den);
    }
    inline Frac operator*(int n) const {
        return Frac(num * n, den);
    }
    inline bool operator<(const Frac &o) const {
        return num * o.den < o.num * den;
    }
    inline bool operator<(int n) const {
        return num < den * n;
    }
};

inline int count_pat(int min_den, Frac f, int a, int n) {
    if (f.num == 0) return 1;
    if (f < 0) return 0;
    if (min_den > a || a == 1) return 0;
    if (n == 0) return 0;
    if (Frac(1, min_den) * n < f) return 0;
    int sum = 0;
    for (int i = min_den; i <= a; i++) {
        if (Frac(1, i) * n < f) break;
        sum += count_pat(i, f - Frac(1, i), a/i, n-1);
    }
    return sum;
}

int main() {
    int p, q, a, n;
    while (cin >> p >> q >> a >> n) {
        if (!(p || q || a || n)) break;
        cout << count_pat(1, Frac(p, q), a, n) << endl;
    }
    return 0;
}

Measured memory_bytes: 1164
from collections import Counter
def primeFactorize(n):
    fac = []
    if n < 2: return fac
    while n%2 == 0:
        n //= 2
        fac.append(2)
    for i in range(3,int(n**0.5)+1,2):
        while n%i == 0:
            n //= i
            fac.append(i)
    if n != 1: fac.append(n)
    return fac

n,p = map(int,input().split())
ans = 1
cnt = Counter(primeFactorize(p))
# print(cnt)
for k,v in cnt.items():
    if v < n: continue
    ans *= k**(v//n)
print(ans)

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

int main(){
  string s;
  cin >>s;
  for(char i='a';i<='z';i++){
    bool ok=false;
    for(int j=0;j<s.length();j++){
      if(i==s[j])
        ok=true;
    }
    if(!ok){
      cout <<i <<endl;
      return 0;
    }
  }
  cout <<"None" <<endl;
}


Measured memory_bytes: 512
N, M = map(int, input().split())
l_max = 0
r_min = 10**5+1
for i in range(M):
	l, r = map(int, input().split())
	l_max = max(l, l_max)
	r_min = min(r, r_min)
if(l_max <= r_min):
	print(str(r_min - l_max + 1))
else:
	print("0")

Measured memory_bytes: 3060
#include <iostream>

int main() {
    uint32_t case_num = 1;
    while (true) {
        uint32_t x;
        std::cin >> x;
        if (x == 0) {
            break;
        }
        std::cout << "Case " << case_num << ": " << x << std::endl;
        ++case_num;
    }
}


Measured memory_bytes: 3096
#include<stdio.h>
int main()
{
	int i,j;
	int sx,sy,tx,ty;
	scanf("%d %d %d %d",&sx,&sy,&tx,&ty);
	for(i = 1;i <= (ty - sy);i++)
	{
		printf("U");
	}
	for(i = 0;i < (tx - sx);i++)
	{
		printf("R");
	}
	for(i = 1;i <= (ty - sy);i++)
	{
		printf("D");
	}
	for(i = 0;i < (tx - sx);i++)
	{
		printf("L");
	}
	printf("L");
	for(i = 0;i < (ty - sy + 1);i++)
	{
		printf("U");
	}
	for(i = 0;i < (tx - sx + 1);i++)
	{
		printf("R");
	}
	printf("D");
	printf("R");
	for(i = 0;i<(ty - sy+1);i++)
	{
		printf("D");
	}
	for(i = 0;i<(tx - sx +1);i++)
	{
		printf("L");
	}
	printf("U");
	return 0;
}

Measured memory_bytes: 128
#pragma region
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define repc(i, m, n) for (int i = m; i < n; i++)
#define reprc(i, m, n) for (int i = m; i > n; i--)
#define all(v) v.begin(), v.end()
#define INF 1e9
#define EPS 1e-10
using namespace std;
typedef long long ll;
#pragma endregion

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

    rep(i, 9){
        rep(j, 9){
            if((i + 1) * (j + 1) == N){
                cout << "Yes" << endl;
                return 0;
            }
        }
    }

    cout << "No" << endl;
}

Measured memory_bytes: 256
process.stdin.resume();
process.stdin.setEncoding('utf8');

var lines = [];
var reader = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});

reader.on('line', (line) => {
  lines.push(line);
});

reader.on('close', () => {
  var N = Number(lines[0]);
  var ary = lines[1].split(' ');
  var invAs = 0
  for (i = 0; i < N; i++){
    invAs += 1.0 / Number(ary[i])
  }
  console.log( 1.0 / invAs )
});


Measured memory_bytes: 11596
n = int(input())
s = input()
ans = n
w = [0 for i in range(n)]
e = [0 for i in range(n)]
m = [0 for i in range(n)]
for i in range(1,n):
    if s[i-1] == "W":
        w[i] = w[i-1] + 1
    else:
        w[i] = w[i-1]
for i in range(n-2,-1,-1):
    if s[i+1] == "E":
        e[i] = e[i+1] + 1
    else:
        e[i] = e[i+1]
for i in range(n):
    m[i] = e[i] + w[i]
print(min(m))

Measured memory_bytes: 29728
#include <bits/stdc++.h>
#define int long long
#define ll long long
#define vl vector<ll>
#define pl pair<ll,ll>
#define mp make_pair
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) for(ll i=0;i<b;i++)
#define per(i,a,b) for(int i=b-1;i>=a;i--)
#define YES(i) cout<<(i?"YES":"NO")<<endl
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define all(v) (v).begin(),(v).end()
using namespace std;
ll n,m;

signed main() {
    cin>>n>>m;
    cout<<(1900*m+100*(n-m))*pow(2,m)<<endl;
}

Measured memory_bytes: 256
n = int(input())
s = input()
stack = []
cntLeft = 0
cntRight = 0
for ss in s:
    if ss == '(':
        stack.append('(')
    else:
        if len(stack) > 0:
            stack.pop()
        else:
            cntLeft += 1
cntRight = len(stack)
ans = ''
for i in range(cntLeft):
    ans += '('
ans += s
for i in range(cntRight):
    ans += ')'
print(ans)


Measured memory_bytes: 9092
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#define MN 101000

int cnt[MN], tot = 0;
int d[MN], d2[MN];
int h[MN], nxt[2 * MN], to[2 * MN], K = 0;
int ans1[MN], ans2[MN];

void ins(int u, int v) {nxt[++K] = h[u]; h[u] = K; to[K] = v;}

void dfs(int x, int fa)
{
	cnt[++tot] = d[x] - 2;
	for(int i = h[x]; i; i = nxt[i])
		if(to[i] != fa && d2[to[i]]) dfs(to[i], x);
}

void solve(int *ans)
{
	int now = 0;
	for(int i = 1; i <= tot; i++)
	{
		ans[now + cnt[i] + 1] = now + 1, now++;
		for(int j = 1; j <= cnt[i]; j++) ans[now] = now + 1, now++;
	}
}

int main()
{
	int n; scanf("%d", &n);
	if(n == 2) return 0 * puts("1 2"); 
	for(int i = 1; i < n; i++)
	{
		int u, v; scanf("%d%d", &u, &v);
		ins(u, v); ins(v, u);
		d[u]++; d[v]++;
	}
	memcpy(d2, d, sizeof(d));
	for(int i = 1; i <= n; i++)
		if(d[i] == 1) d2[i] = 0, d2[to[h[i]]]--;
	
	int id = 0;
	for(int i = 1; i <= n; i++)
		if(d2[i] > 2) return 0 * puts("-1");
		else if(d2[i] == 1) id = i;
	
	cnt[++tot] = 0; if(id) dfs(id, 0); else cnt[++tot] = n - 3; cnt[++tot] = 0;
	solve(ans1); std::reverse(cnt + 1, cnt + tot + 1); solve(ans2);

	bool ok = 0;
	for(int i = 1; i <= n; i++)
	{
		if(ans1[i] < ans2[i]) break;
		if(ans2[i] < ans1[i]) {ok = 1; break;}
	}

	if(ok) for(int i = 1; i <= n; i++) printf("%d ", ans2[i]);
	else for(int i = 1; i <= n; i++) printf("%d ", ans1[i]);
}

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

#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=ll(b);i--)

int main() {
	string s,t;
	cin >> s;
	t = s.substr(s.size()-1,1);
	if (t == "s") {
		s += "es";
	}
	else {
		s += "s";
	}
	cout << s << endl;
}



Measured memory_bytes: 3628
H, W = map(int, input().split())

ans = float('inf')
for i in range(1, H):
    a = i * W
    b = ((H - i) // 2) * W
    c = ((H - i) - (H - i) // 2) * W
    tmp = max(a, b, c) - min(a, b, c)
    ans = min(ans, tmp)
    
for i in range(1, H):
    a = i * W
    b = (H - i) * (W // 2)
    c = (H - i) * (W - W // 2)
    tmp = max(a, b, c) - min(a, b, c)
    ans = min(ans, tmp)
    
for i in range(1, W):
    a = i * H
    b = (H // 2) * (W - i)
    c = (H - H // 2) * (W - i)
    tmp = max(a, b, c) - min(a, b, c)
    ans = min(ans, tmp)
    
for i in range(1, W):
    a = i * H
    b = ((W - i) // 2) * H
    c = ((W - i) - (W - i) // 2) * H
    tmp = max(a, b, c) - min(a, b, c)
    ans = min(ans, tmp)    
    
print(ans)

Measured memory_bytes: 3064
# -*- coding: utf-8 -*-
def logic():
    text = input()
    i = 0
    check = False
    while i < 3:
        count = text.count(text[i])
        if count != 2:
            print("No")
            return True
        elif count == 2:
            check = True
            text.replace(text[i],"")
        else:
            print("No")
            return True
        i += 1
    if check:
        print("Yes")

if __name__ == '__main__':
    logic()

Measured memory_bytes: 3064
/// kazuki08
/*
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long
typedef long long ll;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
//#define inf 1000000000
#define mod 1000000007
#define dmp(x) cerr<<"line "<<__LINE__<<" "<<#x<<":"<<x<<endl
#define fs first
#define sc second
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define mt make_tuple
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
    return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
    o<<"{";
    for(const T& v:vc) o<<v<<",";
    o<<"}";
    return o;
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int n,t[555];
string s[555],x;

signed main(){
IOS;
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
  
  cin >> n ;
  for(int i=1;i<=n;i++)cin >> s[i] >> t[i];
  cin >> x;
  bool f = false;
  int ans = 0;
  for(int i=1;i<=n;i++){
    if(f){
      ans+=t[i];
    }
    if(s[i]==x)f = true;
  }
  cout << ans << endl;


return 0;
}
///....


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

int main(){
    int n,m;
    cin >> n >> m;
    dsu d(n);
    vector<int> v(2);
    for(int i=0; i<m; i++){
        cin >> v.at(0) >> v.at(1);
        d.merge(v.at(0)-1,v.at(1)-1);
    }
    //int ans = 0;
    /*
    for(int i=n; i>=1; i--){  
        if(d.same(0,i-1) == 1){
           ans += 0;
        }
        else{
            ans += 1;
        }
    }
    */
    vector<vector<int>> group = d.groups();
    cout << group.size() - 1 << endl;
}

Measured memory_bytes: 9020
#include<stdio.h>

int main()
{
	char a1,b1,c1,d1;
	int a,b,c,d;
	int t=0;
	scanf("%c%c%c%c",&a1,&b1,&c1,&d1);
	a=(int)(a1-'0');
	b=(int)(b1-'0');
	c=(int)(c1-'0');
	d=(int)(d1-'0');
	if (a+b+c+d==7) t=1;
	else if (a+b+c-d==7) t=2;
	else if (a+b-c+d==7) t=3;
	else if (a-b+c+d==7) t=4;
	else if (a+b-c-d==7) t=5;
	else if (a-b+c-d==7) t=6;
	else if (a-b-c+d==7) t=7;
	else if (a-b-c-d==7) t=8;
	
	switch(t){
	case 1:	printf("%d+%d+%d+%d=7",a,b,c,d);break;
	case 2:	printf("%d+%d+%d-%d=7",a,b,c,d);break;
	case 3:	printf("%d+%d-%d+%d=7",a,b,c,d);break;
	case 4:	printf("%d-%d+%d+%d=7",a,b,c,d);break;
	case 5:	printf("%d+%d-%d-%d=7",a,b,c,d);break;
	case 6:	printf("%d-%d+%d-%d=7",a,b,c,d);break;
	case 7:	printf("%d-%d-%d+%d=7",a,b,c,d);break;
	case 8:	printf("%d-%d-%d-%d=7",a,b,c,d);break;
	default:printf("no answer!");break;
	}

}

Measured memory_bytes: 128
#include<iostream>
#include<vector>
#include<string>
using namespace std;
int main(){
    int n;
    string s,t;
    cin>>n;
    cin>>s>>t;
    for(int i=0; i<n; i++){
        cout<<s[i]<<t[i];
    }
    cout<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define _MACRO(_1, _2, _3, NAME, ...) NAME
#define _repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define _rep(i,n) _repl(i,0,n)
#define rep(...) _MACRO(__VA_ARGS__, _repl, _rep)(__VA_ARGS__)
#define pb push_back
#define all(x) begin(x),end(x)
#define uniq(x) sort(all(x)),(x).erase(unique(all(x)),end(x))
#ifdef LOCAL
#define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
void _dbg(string){cerr<<endl;}
template<class H,class... T> void _dbg(string s,H h,T... t){int l=s.find(',');cerr<<s.substr(0,l)<<" = "<<h<<", ";_dbg(s.substr(l+1),t...);}
template<class T,class U> ostream& operator<<(ostream &o, const pair<T,U> &p){o<<"("<<p.first<<","<<p.second<<")";return o;}
template<class T> ostream& operator<<(ostream &o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}
#else
#define dbg(...) {}
#endif

template<int mod=1000000007>
class ModInt {
  int x;
public:
  ModInt() : x(0) {}
  ModInt(const ModInt &y): x(y.x) {}
  ModInt(int64_t y){ x = y % mod; if(x < 0) x += mod; }
  ModInt &operator += (const ModInt &p){ x += p.x; if(x >= mod) x -= mod; return *this; }
  ModInt &operator -= (const ModInt &p){ x -= p.x; if(x < 0) x += mod; return *this; }
  ModInt &operator *= (const ModInt &p){ x = (int) (1LL * x * p.x % mod); return *this; }
  ModInt &operator /= (const ModInt &p){ *this *= p.inverse(); return *this; }
  ModInt operator -() const { return ModInt(-x); }
  ModInt operator + (const ModInt &p) const { return ModInt(*this) += p; }
  ModInt operator - (const ModInt &p) const { return ModInt(*this) -= p; }
  ModInt operator * (const ModInt &p) const { return ModInt(*this) *= p; }
  ModInt operator / (const ModInt &p) const { return ModInt(*this) /= p; }
  ModInt operator ^ (const int64_t y) const { return pow(y); }
  bool operator == (const ModInt &p) const { return x == p.x; }
  bool operator != (const ModInt &p) const { return x != p.x; }
  ModInt operator = (const int64_t y) { return *this = ModInt(y); }
  ModInt inverse() const {
    int a = x, b = mod, u = 1, v = 0, t;
    while(b > 0){
      t = a/b; a -= t*b; swap(a, b);
      u -= t*v; swap(u, v);
    }
    return ModInt(u);
  }
  ModInt pow(int64_t y) const {
    if(x==0) return ModInt(0);
    int64_t r = 1, t = x;
    while(y > 0){
      if(y&1) r = r*t%mod;
      t = t*t%mod; y >>= 1;
    }
    return ModInt(r);
  }
  friend ostream &operator << (ostream &os, const ModInt<mod> &p) { return os<<p.x; }
  friend istream &operator >> (istream &is, ModInt<mod> &a) { int64_t x; is>>x; a = ModInt<mod>(x); return is; }
};
using Int = ModInt<>;

int main(){
  int h,w;
  cin>>h>>w;
  vector<string> v(h);
  rep(i,h) cin>>v[i];

  vector<vector<Int>> dp(h, vector<Int>(w,0));
  dp[0][0] = 1;

  rep(i,h) rep(j,w) if(v[i][j] == '.'){
    if(i>0) dp[i][j] += dp[i-1][j];
    if(j>0) dp[i][j] += dp[i][j-1];
  }

  cout << dp[h-1][w-1] << endl;

  return 0;
}


Measured memory_bytes: 5248
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
using namespace std;
typedef long long ll;

const int N=1000005,mod=1e9+7;
int fac[N],rev[N],n,m,L,R;

int power(int x,int p){
	int res=1;
	for(;p;p>>=1,x=(ll)x*x%mod)
		if(p&1)res=(ll)res*x%mod;
	return res;
}

void init(int n){
	fac[0]=1;
	rep(i,1,n) fac[i]=(ll)fac[i-1]*i%mod;
	rev[n]=power(fac[n],mod-2);
	per(i,n,1) rev[i-1]=(ll)rev[i]*i%mod;
}

int C(int n,int m){
	return m<0||m>n?0:(ll)fac[n]*rev[m]%mod*rev[n-m]%mod;
}
int S(int n,int m){
	return C(n+1,m+1);
}

int solve(int s){
	int res=0;
	rep(x,1,s/m){
		int rem=s-x*m,now=0;
		rep(j,0,min(rem/x,n-m))
			if(j%2==0) now=(now+(ll)S(rem-j*x-1,n-1)*C(n-m,j))%mod;
			else now=(now+mod-(ll)S(rem-j*x-1,n-1)*C(n-m,j)%mod)%mod;
		res=(res+now)%mod;
		if(x==1) continue;
		now=0;
		rep(j,0,min(rem/(x-1),n-m))
			if(j%2==0) now=(now+(ll)S(rem-j*(x-1)-1,n-1)*C(n-m,j))%mod;
			else now=(now+mod-(ll)S(rem-j*(x-1)-1,n-1)*C(n-m,j)%mod)%mod;
		res=(res+mod-now)%mod;
	}
	return (S(s-1,n-1)+mod-(ll)res*C(n,m)%mod)%mod;
}

int main(){
	cin>>n>>m>>L>>R;
	init(N-5);
	cout<<(solve(R+n)+mod-solve(L-1+n))%mod<<endl;
	return 0;
}

Measured memory_bytes: 8064
#include <iostream>
#include<math.h>
#include<stdlib.h>
using namespace std;

int main()
{
    long long int a,b,x,c,d;
    cin>>x>>a>>b;
    c= abs(x-a);
    d= abs(x-b);

    if(c<d)
    {
        cout<<'A'<<endl;
    }
    if(c>d)
    {
        cout<<"B"<<endl;
    }



}


Measured memory_bytes: 256