akhauriyash/Code-Regression huggingface dataset:
using System;

namespace Atcoder2
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] hensu = Console.ReadLine().Split(' ');
            
            for(int i = 0; i < 5; i++)
            {
                if(hensu[i].Equals("0"))
                {
                    Console.WriteLine(i + 1);
                }
            }
        }
    }
}

Measured memory_bytes: 25876
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod = 1000000007;

int main()
{
	ll h, w;
	cin >> h >> w;
	if (h == 1 || w == 1) {
		cout << 1 << endl;
	}
	else cout << (h * w + 1) / 2 << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define sz(x) (int)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
using vc = vector<char>;
using vvc = vector<vc>;
ll dx[4]={0,1,0,-1};
ll dy[4]={1,0,-1,0};
int main(){
  ll n;
  cin>>n;
  vector<int> k(0);
  vector<int> a(n);
  rep(i,n){
    cin>>a[i];
  }
  k.pb(a[n-1]);
  for(int i=n-2;i>=0;i--){
    if(a[i]>=k[sz(k)-1]){
      k.pb(a[i]);
    }
    else if(a[i]<k[0]){
      k[0]=a[i];
    }
    else{
      auto Iter1 = upper_bound(all(k), a[i]);
      ll cu=Iter1 - k.begin();
      k[cu]=a[i];
    }
  }
  COUT(sz(k));
}


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



int main() {
    string S;
    int Q;
    cin>>S>>Q;
    string A,B;
    bool rev=false;
    rep(i,Q){
        int T;
        cin>>T;
        if(T==1){
            if(rev){rev=false;}
            else{rev=true;}
        }
        if(T==2){
            int F;
            char C;
            cin>>F>>C;
            if(F==1){
                if(rev){B.push_back(C);}
                else{A.push_back(C);}
            }
            if(F==2){
                if(rev){A.push_back(C);}
                else{B.push_back(C);}
            }
        }
    }
    S+=B;
    reverse(S.begin(),S.end());
    S+=A;
    if(!rev){reverse(S.begin(),S.end());}
    cout<<S<<endl;
}

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

public class Main
{

  public static void main(String[] args) throws IOException
  {
    BufferedReader r = new BufferedReader(new InputStreamReader(System.in), 1);
    int a = Integer.parseInt(r.readLine());

    System.out.println(a <= 999 ? "ABC" : "ABD");
  }

}


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

using namespace std;

typedef long long LL;
const LL MAXN=128;
const LL MAXK=100000+100;
const LL MOD=1e9+7;
LL a[MAXN],dp[MAXN][MAXK],sum[MAXN][MAXK];
LL n,k;

int main(){
	cin>>n>>k;
	for(LL i=1;i<=n;i++){
		cin>>a[i];
	}
	dp[0][0]=1;
	sum[0][0]=1;
	for(LL i=1;i<=k;i++){
		sum[0][i]=1;
	}
	for(LL i=1;i<=n;i++){
		for(LL j=0;j<=k;j++){
			dp[i][j]=(sum[i-1][j]+MOD-(j-a[i]-1<0?0:sum[i-1][j-a[i]-1]))%MOD;
			if(j) sum[i][j]=(sum[i][j-1]+dp[i][j])%MOD;
			else sum[i][j]=dp[i][j];
		}
	}

	cout<<dp[n][k]<<endl;
	return 0;
}


Measured memory_bytes: 162048
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<deque>
#include<regex>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>

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

typedef int long long ll;
using namespace std;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const ll MOD = 1e9 + 7;

int main() {
    int n;
    cin>>n;
    int ans=n*(n+1)/2;
    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<math.h>

typedef long long int int64;

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))

void run(void){
  int n;
  scanf("%d",&n);
  int a[100];
  int i;
  for(i=0;i<n;i++) scanf("%d",a+i);
  int min=200*200*100;
  int x;
  for(x=-100;x<=100;x++){
    int local=0;
    for(i=0;i<n;i++) local+=(x-a[i])*(x-a[i]);
    min=MIN(min,local);
  }
  printf("%d\n",min);
}

int main(void){
  run();
  return 0;
}

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

int main() {
  int n;
  cin >> n;
  vector<tuple<string, int, int>> a;
  for (int i = 1; i < n+1; i++) {
      string s;
      int p;
      cin >> s >> p;
      p = -p;
      a.push_back(tie(s, p, i));
  }
  sort(a.begin(), a.end());

  for (auto x: a) {
      cout << get<2>(x) << endl;
  }
}

Measured memory_bytes: 256
#include<cstdio> 
#include<cstring>
#include<algorithm>
#include<iostream>
#include<cmath>
#include<map>
#include<queue>
#include<set>
#define ms(i, j) memset(i, j, sizeof i)
#define LL long long
#define db double
#define fir first
#define sec second
#define mp make_pair
using namespace std;

namespace flyinthesky {

	LL H, W, n, x, y, preS[4][200000 + 5], preT[4][200000 + 5], gg[4];
	char s[200000 + 5], t[200000 + 5];
	
    void clean() {
    }
    int solve() {
    	
    	clean();
    	cin >> H >> W >> n >> x >> y;
    	scanf("%s%s", s + 1, t + 1);
    	
    	gg[0] = H - x + 1;
    	gg[1] = x;
    	gg[2] = y;
    	gg[3] = W - y + 1;
    	
    	for (LL i = 1; i <= n; ++i) {
    		for (LL j = 0; j < 4; ++j) preS[j][i] = preS[j][i - 1], preT[j][i] = preT[j][i - 1];
    		if (s[i] == 'D') ++preS[0][i];
    		if (s[i] == 'U') ++preS[1][i];
    		if (s[i] == 'L') ++preS[2][i];
    		if (s[i] == 'R') ++preS[3][i];
    		
			if (t[i] == 'D') ++preT[0][i];
    		if (t[i] == 'U') ++preT[1][i];
    		if (t[i] == 'L') ++preT[2][i];
    		if (t[i] == 'R') ++preT[3][i];
    		
    		for (LL j = 0; j < 4; ++j) if (preT[j][i] - preS[j ^ 1][i] >= gg[j]) preT[j][i]--;
		}
		
		for (LL i = 1; i <= n; ++i) {
			for (LL j = 0; j < 4; ++j) {
				if (preS[j][i] - preT[j ^ 1][i - 1] >= gg[j]) return printf("NO\n"), 0;
			}
		}
    	printf("YES\n");
    	
        return 0;
    } 
}
int main() {
    flyinthesky::solve();
    return 0;
}
/*
*/

Measured memory_bytes: 13184
a,b = list(map(int,input().split()))
c = [1,3,5,7,8,10,12]
d = [4,6,9,11]
e = [2]
if a in c and b in c:
  print("Yes")
elif a in d and b in d:
  print("Yes")
elif a in e and b in e:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 3060
def main():
    n = int(input().strip())
    s = input().strip()

    m = 0
    for i in range(1, len(s)):
        s1 = set()
        s2 = set()
        for x in s[0:i]:
            s1.add(x)
        for x in s[i:]:
            s2.add(x)
                
        m = max(m, len(s1 & s2))

    print(m)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
n=int(input())
x=[int(i) for i in input().split()]
y=[int(i) for i in input().split()]
l=[]
for a,b in zip(x,y):
    l.append(abs(a-b))
print("{:.6f}".format(sum(l)))
print("{:.6f}".format(sum([s**2 for s in l])**.5))
print("{:.6f}".format(sum([s**3 for s in l])**(1/3)))
print("{:.6f}".format(max(l)))



Measured memory_bytes: 5660
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		while (sc.hasNextLine()) {
			int[] road = new int[10];
			int sum = 0;
			String[] str = sc.nextLine().split(",");
			for (int i = 0; i < road.length; i++) {
				road[i] = Integer.parseInt(str[i]);
				sum += road[i];
			}
			int a = Integer.parseInt(str[road.length]);
			int b = Integer.parseInt(str[road.length + 1]);
			for (int i = 1; i < road.length; i++)
				road[i] += road[i - 1];
			double t = ((double)sum / (a + b)) * a;
			for (int i = 0; i < road.length; i++) {
				if (t <= road[i]) {
					System.out.println(i + 1);
					break;
				}
			}
		}

	}

}

Measured memory_bytes: 17148
// Hail god Yato
 
#include <bits/stdc++.h> 
using namespace std;
 
#define hs ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
const ll mod = 1000000007;
const ll INF = 1e18;
const ll MAX = 100001;
//
//
void solve(){
    int n, k;
    cin>>n>>k;
    vector<int> ans(n);
    for(int &i : ans)
        cin>>i;
    sort(ans.begin(), ans.end());
    cout<<accumulate(ans.begin(), ans.begin()+k, 0);
}
int main(){ 
        hs;
        ll t;
        t=1;
        // cin>>t;
        for (int i=1; i<=t; i++){
                //cout<<"Case #"<<i<<": ";
                solve();
         }
        return 0; 
}

Measured memory_bytes: 3620
///*
#include<iostream>
using namespace std;

int main() {

	int ag, bg, cp;
	int gedoku;
	cin >> ag >> bg >> cp;
	gedoku = ag + bg;

	if (bg >= cp || bg + ag >= cp) {
		cout << bg + cp;
	}
	else {
		cout << gedoku + bg + 1;
	}

	return 0;
}
//*/

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

using namespace std;

typedef long long ll;

int main(){
        vector <ll> a;
        int N;
        cin>>N;
        for(int i=0;i<N;i++){
                ll aa;
                cin>>aa;
                a.push_back(aa);
        }
        ll res=2000000010;
        ll x=a[0];
        ll y=0;
        for(int i=1;i<N;i++){
                y+=a[i];
        }
        for(int i=1;i<N;i++){
                res=min(abs(x-y), res);
                x+=a[i];
                y-=a[i];
        }
        cout<<res<<endl;
        return 0;
}


Measured memory_bytes: 2420
#include<iostream>
#include<cstdio>
#include<cstring>
#define x first
#define y second

inline bool check_min(int a,int &b){return a<b?b=a,1:0;}
inline bool check_max(int a,int &b){return a>b?b=a,1:0;}

namespace why
{
	int k;

	typedef std::pair<int,int> pii;
	typedef long long ll;

	const int N=52,M=202,MOD=1000000007;

	int C[M][M];

	ll qpow(ll a,ll b){ll c=1;for(;b;b>>=1,a=a*a%MOD)if(b&1)c=c*a%MOD;return c;}
	int gcd(int a,int b){return b?gcd(b,a%b):a;}
	int calc(int n)
	{
		int ret=0;
		for(int i=1;i<=n;i++)
			ret=((ll)ret+qpow(k,gcd(i,n)))%MOD;
		return ret*qpow(n,MOD-2)%MOD;
	}
	void initialize()
	{
		for(int i=0;i<M;i++)C[i][0]=1;
		for(int i=1;i<M;i++)
			for(int j=1;j<M;j++)
				C[i][j]=(C[i-1][j-1]+C[i-1][j])%MOD;
	}

	int begin[N],next[M],to[M];
	int n,m,e;
	int ans;

	void add(int x,int y,bool k=1)
	{
		to[++e]=y;
		next[e]=begin[x];
		begin[x]=e;
		if(k)add(y,x,0);
	}

	pii stk[M];
	int dfn[N],col[N];
	int siz[N],cnt_edge[N];
	int clk,cnt,top;

	void count(int c)
	{
		siz[c]=cnt_edge[c]=0;
		for(int p=1;p<=n;p++)
			if(col[p]==c)
			{
				siz[c]++;
				for(int i=begin[p];i;i=next[i])
					if(col[to[i]]==c)cnt_edge[c]++;
			}
		cnt_edge[c]/=2;
	}

	int tarjan(int p,int h=0)
	{
		int lowp=dfn[p]=++clk,lowq;
		for(int i=begin[p],q;i;i=next[i])
			if((q=to[i])!=h && !dfn[q])
			{
				stk[++top]=pii(p,q);
				check_min(lowq=tarjan(q,p),lowp);

				if(lowq==dfn[p])
				{
					cnt++;
					while(top)
					{
						col[stk[top].x]=cnt;
						col[stk[top].y]=cnt;
						if(stk[top--].x==p)break;
					}
					count(cnt);
				}
				else if(lowq>dfn[p])
				{
					ans=(ll)ans*k%MOD;
					top--;
				}

			}
			else if(q!=h)check_min(dfn[q],lowp);

		return lowp;
	}

	void solve()
	{
		initialize();

		scanf("%d%d%d",&n,&m,&k);
		for(int u,v;m--;add(u,v))
			scanf("%d%d",&u,&v);
		
		cnt=clk=0,ans=1;

		for(int i=1;i<=n;i++)
			if(!dfn[i])tarjan(i);

		for(int i=1;i<=cnt;i++)
		{
			if(cnt_edge[i]==siz[i])ans=(ll)ans*calc(siz[i])%MOD;
			else ans=(ll)ans*C[k+cnt_edge[i]-1][cnt_edge[i]]%MOD;
		}
		printf("%d\n",ans);
	}
}

int main()
{
	why::solve();
	return 0;
}


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

const int N = 2e5 + 10;

int cnt[26];
char s[N];

int main(){
	int n;
	long long ans;
	scanf("%s", s + 1);
	n = strlen(s + 1);
	memset(cnt, 0, sizeof(cnt));
	for (int i = 1; i <= n; i++) cnt[s[i] - 'a']++;
	ans = 1LL * n * (n - 1) / 2;
	for (int i = 0; i < 26; i++) ans -= 1LL * cnt[i] * (cnt[i] - 1) / 2;
	ans++;
	printf("%lld\n", ans);
	return 0;
}

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

using ll = long long;
using ull = unsigned long long;
#define REP(NAME, NUM) for (int NAME = 0; NAME < (NUM); ++NAME)

template <typename T>
T gcd(T a, T b)
{
	if (a < b)
		swap(a, b);
	return b ? gcd(b, a % b) : a;
}

int main()
{
	ull n;
	cin >> n;
	ll g; cin >> g;
	REP(i, n-1)
	{
		ll c; cin >> c;
		g = gcd(g,c);
		if( g == 1 ) break;
	}
	
	cout << g << endl;
	return 0;
}

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

#define LEN 100005

typedef struct p {
	char name[100];
	int t;
} P;

P Q[LEN + 1];
int head, tail, n;

void enqueue(P x) {
	Q[tail] = x;
	if ((tail) == (LEN)) {
		tail = 1;
	} else {
		tail++;
	}
}

P dequeue()  {
	P x = Q[head];

	if ((head) == (LEN)) {
		head = 1;
	} else {
		head++;
	}

	return x;
}

int isEmpty() {
	return ((tail == head)? 1:0);
}

int main() {
	int elaps = 0;
	int i, q;
	P u;

	scanf("%d %d", &n, &q);

	for (i = 1; i <= n; i++) {
		scanf("%s", Q[i].name);
		scanf("%d", &Q[i].t);
	}

	head = 1;
	tail = n+1;

	while (1) {
		u = dequeue();

		if (u.t > q) {
			u.t = u.t - q;
			enqueue(u);
			elaps += q;
		} else {
			elaps += u.t;
			printf("%s %d\n",u.name, elaps);
		}
		if (isEmpty()) break;
	}

	return 0;
}

Measured memory_bytes: 10756
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int m = sc.nextInt();
    int X = sc.nextInt();
    int Y = sc.nextInt();
    int[] x = new int[n];
    int[] y = new int[m];
    for(int i = 0;i<n;i++){
      x[i] = sc.nextInt();
    }
    for(int i = 0;i<m;i++){
      y[i] = sc.nextInt();
    }
    sc.close();
    Arrays.sort(x);
    Arrays.sort(y);
    boolean ans = false;
    if(x[n-1]>y[0]){
      ans = true;
    }else{
      for(int i = X+1;i<=Y;i++){
        if(x[n-1]<i && i<=y[0]){
          ans = true;
          break;
        }
      }
      ans = !ans;
    }
    System.out.println(ans ? "War" : "No War");
  }
}

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

int main(){
  int a,b,c,t;
  cin >> a >> b >> c;

  if(a>=b){
    t=a;
    a=b;
    b=t;
  }
  if(b>=c){
    t=b;
    b=c;
    c=t;
  }
  if(a>=b){
    t=a;
    a=b;
    b=t;
  }

  cout << a << " " << b << " " << c << endl;

  return 0;

  
}

Measured memory_bytes: 1164
#include<bits/stdc++.h>
#define F first
#define S second
#define int long long
#define double long double
using namespace std;
typedef pair<int,int> P;
typedef pair<int,P> iP;
typedef pair<P,int> Pi;
typedef pair<P,P> PP;
double eps=1e-8;
int mod=1e9+7;
int inf=1LL<<55;

priority_queue<P,vector<P>,greater<P> > pq;

template <typename T>
int Count(const vector<T> &v, T l,T r){
  //counting [l,r]
  auto L = lower_bound(v.begin(), v.end(), l );
  auto R = upper_bound(v.begin(), v.end(), r );
  // [l,r) change upper -> lower
  return R-L;
}

signed main(){
  int a,b,c;
  cin>>a>>b>>c;
  int ans=b+min(c,a+b+1);
  cout<<ans<<endl;  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < b; i++)
//'A' = 65, 'a' = 97

int main()
{
    while (1) {
        int h, w;
        cin >> h >> w;
        if (h == 0 && w == 0) break;
        rep(i, 0, h) {
            rep(j, 0, w) {
                if (i % 2 == 1) {
                    if (j % 2 == 1) {
                        cout << "#";
                    }  else {
                        cout << ".";
                    }
                } else {
                    if (j % 2 == 1) {
                        cout << ".";
                    }  else {
                        cout << "#";
                    }
                }
            }
            cout << endl;
        }
        cout << endl;
    }
}



Measured memory_bytes: 3120
#include<stdio.h>

int isPrime(int x){
  int i;
  if(x < 2) return 0;
  else if(x == 2) return 1;
  else if(x % 2 == 0) return 0;

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

  return 1;
}

int main(){
  int kosuu,n,i,count = 0;

  scanf("%d",&kosuu);

  for(i = 0;i < kosuu;i++){
    scanf("%d",&n);
    if(isPrime(n) == 1) count++;
  }

  printf("%d\n",count);

  return 0;
}


Measured memory_bytes: 2048
#include <cstdio>

int main(void){
    int a, b;
    char op;

    while(1){
        scanf("%d %c %d", &a, &op, &b);

        switch (op){
            case '+' :
                printf("%d\n", a+b);
                break;
            case '-':
                printf("%d\n", a-b);
                break;
            case '*':
                printf("%d\n", a*b);
                break;
            case '/':
                printf("%d\n", a/b);
                break;
        }

        if (op == '?'){
            break;
        }
    }

    return 0;
}

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

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

    int lower = max(A, C);
    int upper = min(B, D);
    int ans = max(upper - lower, 0);

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.*;
import static java.lang.System.*;

public class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		int total = 0;
		for (int i=0; i<4; i++) total += sc.nextInt();
		out.println(total/60);
		out.println(total%60);
	}
}


Measured memory_bytes: 26408
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
#define bit(n) (1LL << (n))
#define len(x) ((ll)(x).size())
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1000000007;
const double EPS = 1e-9;

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

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

__attribute__((constructor)) void initial() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
}

struct Robot {
  ll X, L, l, r;
  Robot(ll X, ll L) : X(X), L(L) {
    l = X - L, r = X + L;
  }

  bool operator<(const Robot& another) const {
    return r < another.r;
  };
};
// push_backで追加


signed main() {
  ll N;
  cin >> N;
  vector<Robot> Robots;
  rep(i, N) {
    ll X, L;
    cin >> X >> L;
    Robots.pb(Robot(X, L));
  }

  sort(all(Robots));
  ll temp = -LINF;
  int ans = 0;
  rep(i, N) {
    if (Robots[i].l >= temp) {
      ans++;
      temp = Robots[i].r;
    }
  }
  cout << ans << "\n";
}

Measured memory_bytes: 6512
S = input()
list_s = list(S)
count = 0
x = []
for i in range(3):
    if list_s[i] == 'R':
        count +=1
    elif list_s[i] == 'S':
        x.append(count)
        count = 0
x.append(count)
print(max(x))

Measured memory_bytes: 9108
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int H, W;
const int Hmax = 50;
string S[Hmax];

int main(){
	cin >> H >> W;
	for(int i=0; i<H; i++) cin >> S[i];

	queue<pair<int, int>> que;
	que.push({0, 0});
	vector<vector<int>> dist(H, vector<int>(W, 1e8));
	dist[0][0] = 0;
	while(!que.empty()){
		int x = que.front().first;
		int y = que.front().second;
		que.pop();
		int dx[] = {1, -1, 0, 0};
		int dy[] = {0, 0, 1, -1};
		for(int k=0; k<4; k++){
			int nx = x+dx[k];
			int ny = y+dy[k];
			if(nx<0||H<=nx||ny<0||W<=ny) continue;
			if(dist[nx][ny]<1e8 || S[nx][ny]=='#') continue;
			dist[nx][ny] = dist[x][y]+1;
			que.push({nx, ny});
		}
	}

	int nblack = 0;
	for(int i=0; i<H; i++){
		for(int j=0; j<W; j++){
			if(S[i][j]=='#') nblack++;
		}
	}

	if(dist[H-1][W-1]==1e8) cout << -1 << endl;
	else cout << H*W-nblack-(dist[H-1][W-1]+1) << endl;

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
int main()
{
	int n;
	int a[1000];
	memset(a,0,sizeof(a));
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
	}
	int sum=0;
	for(int i=1;i<=n-1;i++)
	{
		for(int j=i+1;j<=n;j++)
		{
			sum+=a[i]*a[j];
		}
	}
	printf("%d\n",sum);
	
	return 0;
}

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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	int n,m; cin>>n>>m;
	vector<int>x(m); for(auto&i:x)cin>>i;
	sort(x.begin(),x.end());
	vector<int>y(m-1);
	for(int i=0;i+1<m;++i){
		y.at(i)=abs(x.at(i)-x.at(i+1));
	}
	sort(y.begin(),y.end());
	cout<<(n<m?accumulate(y.begin(),y.end()-n+1,0):0)<<"\n"s;
}

Measured memory_bytes: 1024
#include <algorithm>
#include <bitset>
#include <cstdlib>
#include <iostream>
#include <map>
#include <string>
#include <vector>

#define int long long
using namespace std;
const int MOD = 1e9 + 7;
int comb(int n, int k);

vector<int> b{0};
int a[1000];
int N;
bool flag;
signed main()
{
    cin >> N;
    for (int i = 1; i <= N; i++) {
        int x;
        cin >> x;
        b.push_back(x);
    }
    flag = true;

    for (int i = N; i >= 1; i--) {
        bool CONT = true;
        for (int j = i; j >= 1; j--) {
            if (b[j] == j) {
                b.erase(b.begin() + j);
                a[i] = j;
                break;
            }
            if (j == 1) {
                flag = false;
            }
        }
    }
    if (flag) {
        for (int i = 1; i <= N; i++) {
            cout << a[i] << endl;
        }
    } else {
        cout << -1 << endl;
    }

    return 0;
}

int comb(int n, int k)
{
    const int mod = MOD;
    int comb_f[3000];
    comb_f[0] = 1;
    for (int i = 1; i < 2900; i++)
        comb_f[i] = (comb_f[i - 1] * i) % mod;
    int comb_res = 1;
    int comb_res_k = mod - 2;
    int comb_y = (comb_f[n - k] * comb_f[k]) % mod;
    while (comb_res_k) {
        if (comb_res_k & 1)
            comb_res = (comb_res * comb_y) % mod;
        comb_y = (comb_y * comb_y) % mod;
        comb_res_k /= 2;
    }
    return (comb_f[n] * comb_res) % mod;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout<<(ans)<<endl
#define STI(s) atoi(s.c_str())
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int
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;}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);};};
const ll MOD = 1000000007;
const int INF = INT_MAX;
const ll LLINF = 1LL<<62;




int main(void) {

    int n;
    cin>>n;
    vi v(n);
    rep(i,n)cin>>v[i];
    map<int,int> m;
    Sort(v);
    rep(i,v.size())m[v[i]]++;
    v.erase(unique(all(v)),v.end());

    if(m.size()==1&&m[0]==n)fin("Yes");
    else if(m.size()==2&&n%3==0&&m[0]==n/3)fin("Yes");
    else if(m.size()==3&&n%3==0){
        if(((v[0]^v[1])==v[2])&&m[v[0]]==n/3&&m[v[1]]==n/3)fin("Yes");
        else fin("No");
    }else fin("No");

}


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

using namespace std;

int N, M;
vector<int> OffsetOfStart;

void solve() {
	int total;

	total = min(N - OffsetOfStart[0], OffsetOfStart[M - 1]);
	--M;
	for (int i = 0; i < M; ++i) {
		total = min(total, min(2 * OffsetOfStart[i] + N - OffsetOfStart[i + 1], 2 * (N - OffsetOfStart[i + 1]) + OffsetOfStart[i]));
	}

	cout << total * 100 << endl;
}

int main() {
	int p, d;

	cin >> N >> M >> p;
	for (int i = 0; i < M; ++i) {
		cin >> d;
		OffsetOfStart.push_back((d - p + N) % N);
	}
	sort(OffsetOfStart.begin(), OffsetOfStart.end());
	solve();

	return 0;
}


Measured memory_bytes: 3212
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S; cin >> S;
    int cnt[26] = {};
    rep(i, S.length()) {
        cnt[S[i] - 'a']++;
    }
    rep(i, 26) {
        if (cnt[i] % 2 != 0) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;


    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{

    int i = 0 , j = 0;
    for(i=1 ; i<10 ; i++)
    {
        for(j=1; j<10;j++)
        {
            if(i==9 && j==10)
                break;
            printf("%dx%d=%d\n",i,j,i*j);
        }


    }




    return 0;

}

Measured memory_bytes: 524
#include <bits/stdc++.h>
#define REP(i,n) for (int i=0;i<(n);i++)
#define ALL(a) (a).begin(),(a).end()
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define ll long long
#define ull unsigned long long
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

using namespace std;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
	int m,n_min,n_max;
	while(cin>>m>>n_min>>n_max,m){
		vector<int> sc(m);
		vector<pair<int,int> > dif_sc(m);
		
		REP(i,m){
			cin >> sc[i];
			if(i)dif_sc[i] = make_pair(sc[i] - sc[i-1],i);
		}
		int max_dif = 0,max_i;
		REP(i,m){
			if(dif_sc[i].second >= n_min && dif_sc[i].second <= n_max)
				if(max_dif >= dif_sc[i].first){
					max_dif = dif_sc[i].first;
					max_i = i;
				}
		}
		cout << max_i << endl;
	}
  return 0;
}

Measured memory_bytes: 3128
import collections
mod = 10**9+7
fac = [1]
caf = [1]
n=int(input())

def pow(n,p):
    res=1
    while p >0:
        if p%2==0:
            n = n**2 % mod
            p //= 2
        else:
            res = res * n % mod
            p -= 1
    return res % mod

for i in range(1,n+2):
    fac.append((fac[i-1]*i)%mod)
    caf.append(pow(fac[i],mod-2)%mod)

def ncr(n,r):
    if n < r: return 0
    return fac[n]*caf[r]*caf[n-r]

def main():
    global n
    a=list(map(int,input().split()))

    ca= collections.Counter(a)
    tyo= ca.most_common()[0][0]
    kaburi=[i for i, x in enumerate(a) if x == tyo]

    for i in range(1,n+2):
        print((ncr(n+1,i)-ncr(n+1-(kaburi[1]-kaburi[0]+1),i-1))%mod)

main()

Measured memory_bytes: 81624
// include
// ------------------------------------------------
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

// func
// ------------------------------------------------
int CalcSumOfDigit(int n);      // 各桁の和を計算する。
int getDigit(int n);            // 数字の桁数を取得する。
string upper(string str);       // 英字を大文字に変換する。
string lower(string str);       // 英字を小文字に変換する。

// define
// ------------------------------------------------
#define all(a)        (a).begin(),(a).end()
#define rall(a)       (a).rbegin(),(a).rend()
#define sz(a)         int((a).size())
#define rep(i,n)      for(int(i)=0;(i)<(n);(i)++)
#define repe(i,n)     for(int(i)=0;(i)<=(n);(i)++)
#define vsort(v)      sort((v).begin(),(v).end())
#define rvsort(v)     sort(rall((v)))
#define vi            vector<int>
#define GCD(a,b)      __gcd((a),(b))
#define LCM(a,b)      (a)/GCD((a),(b))*(b)
#define kiriage(a,b)  ((a)+(b)-1)/(b)

const int INF = 1e9;

typedef long long ll;
typedef unsigned long long ull;

// code
// ------------------------------------------------
int main() {

  ll n;
  cin >> n;
  map<ll,ll> m;

  rep(i,n)
  {
    ll a;
    cin >> a;
    m[a]++;
  }

  for(auto itr = m.begin(); itr!=m.end();itr++)
  {
    if(itr->second > 1)
    {
      cout << "NO" << endl;
      return 0;
    }
  }  

  cout << "YES" << endl;
  return 0;
}
// funcの実体
// ------------------------------------------------
int getDigit(int n)
{
  int i = 1;
  while(1)
  {
    n = n / 10;
    if(n == 1)
      break;
    i++;
  }
  return i;
}
int CalcSumOfDigit(int n)
{
  int s = 0;
  while(n)
  {
    s += n % 10;
    n = n / 10;
  }
  return s;
}

string upper(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(97 <= *itr && *itr <= 122)
    {
      *itr = *itr - 32;
    }
  }
  return str;
}

string lower(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(65 <= *itr && *itr <= 90)
    {
      *itr = *itr + 32;
    }
  }
  return str;
}


Measured memory_bytes: 12800
#include<iostream>
#include<string>

using namespace std;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	if (a != c) {
		cout << 1 << endl;
	}
	else {
		cout << 0 << endl;
	}

	return 0;
}

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

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

typedef long long ll;
using namespace std;
int mod = 1000000007;

int main(void){
    vector<int> ans;
    while(true){
        int N, P; cin >> N >> P;
        if(N == 0 && P == 0) break;

        vector<int> stone(N, 0);
        bool cont = true;
        int turn = 0;
        int rem = P;
        while(cont){
            if(rem == 0){
                rem += stone[turn];
                stone[turn] = 0;
            }
            else{
                stone[turn]++;
                rem--;
                if(rem == 0){
                    cont = false;
                    rep(i, N) if(i != turn && stone[i] > 0) cont = true;
                }
            }
            if(cont) turn = (turn+1) % N;
        }
        ans.push_back(turn);
    }
    rep(i, ans.size()) cout << ans[i] << endl;
    return 0;
}


Measured memory_bytes: 3080
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  int x[N], y[N];
  int total = 0;
  for ( int i = 0; i < N; i++){
    cin >> x[i] >> y[i];
    total = total + ( y[i] - x[i] + 1);
  }
  cout << total << endl;
}


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

#define ll long long
#define ull unsigned long long
#define mii make_pair<int, int>
#define mll make_pair<ll, ll>
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define vc vector<char>
#define vvc vector<vector<char>>
#define all(v) (v).begin(), (v).end()

ofstream out("debug.txt");

ll m = 1e9 + 7;

ll maxP(vl &v, int n, int k)
{
    sort(all(v), greater<ll>());
    ll ans = 1;
    if (v[0] == 0 && (k & 1))
        return 0LL;
    if (v[0] < 0 && (k & 1))
    {
        for (int i = 0; i < k; ++i)
            ans = (ans * v[i]) % m;
        return ans;
    }
    int l = 0, r = n - 1;
    if (k & 1)
    {
        ans = (ans * v[l]) % m;
        ++l;
        --k;
    }
    k /= 2;
    for (int i = 0; i < k; ++i)
    {
        ll left = v[l] * v[l + 1],
           right = v[r] * v[r - 1];
        if (left > right)
        {
            ans = (ans * (left % m)) % m;
            l += 2;
        }
        else
        {
            ans = (ans * (right % m)) % m;
            r -= 2;
        }
    }
    return ans;
}

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

    ll n, k;
    cin >> n >> k;
    vl v(n);
    for (ll i = 0; i < n; ++i)
        cin >> v[i];
    cout << (maxP(v, n, k) + m) % m << '\n';
}

Measured memory_bytes: 4764
import java.util.Scanner;
 
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        boolean flg = true;
        for (int i = 0; i < S.length(); i++) {
        	if ((i%2 == 0 && S.charAt(i) == 'L') || 
        			(i%2 != 0 && S.charAt(i) == 'R')) {
        		flg = false;
        	} 
        }
        System.out.println(flg ? "Yes" : "No");
    }
}

Measured memory_bytes: 23764
#include <iostream>
#include <string>
#include <algorithm>
#include <bitset>

using lint = long long;
using namespace std;

struct F {
    lint b;
    int e;
};

bool solve() {
    lint N;
    cin >> N;
    if (N == 0) return false;

    string S;
    cin >> S;
    reverse(S.begin(), S.end());

    F a = {1LL << 52, 0};
    for (int k = 0; k < 52; ++k) {
        if (S[k] == '1') a.b += (1LL << k);
    }

    F ans = a;
    while (N > 0) {
        ans.b += a.b;
        if (ans.b >= (1LL << 53)) {
            ans.b >>= 1;
            ans.e += 1;
            a.b >>= 1;
            a.e += 1;
            --N;
        }
        if (a.b == 0) break;
        lint div = min(N, ((1LL << 53) - ans.b - 1) / a.b);
        ans.b += a.b * div;
        N -= div;
    }

    cout << bitset<12>(ans.e) << bitset<52>(ans.b) << endl;
    return true;
}

int main() {
    while (solve()) {}
    return 0;
}



Measured memory_bytes: 3156
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a, b;
	cin >> a >> b;
	string arr[a];
	for(int i=0; i<a; i++)
		cin >> arr[i];
	int dp[a + 5][b + 5];
	memset(dp, 0, sizeof(dp));
	dp[1][1] = 1;
	for(int i=1; i<=a; i++)
	{
		for(int j=1; j<=b; j++)
		{
			dp[i][j] += dp[i-1][j] + dp[i][j-1];
			if(arr[i - 1][j - 1] == '#') dp[i][j] = 0;
			dp[i][j] %= 1000000007;
 		}
	}
	printf("%d\n",dp[a][b]);
	return 0;
}

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


#include "boost/multiprecision/cpp_int.hpp"
#include "boost/multiprecision/cpp_dec_float.hpp"
namespace mp = boost::multiprecision;
typedef mp::cpp_int LL;
typedef mp::number<mp::cpp_dec_float<1024>> DD;// 仮数部が1024ビットの浮動小数点数型(TLEしたら小さくする)

 
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
typedef pair<dd,dd> d_d;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define rrep(i,r,l) for(ll i=r;i>=l;i--)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define fi first
#define se second
#define endl "\n"  //インタラクティブで消す！！！！！！！！！！！！！！！！！！！！！
#define SORT(v) sort(v.begin(),v.end())
#define ERASE(v) v.erase(unique(v.begin(),v.end()),v.end())
#define POSL(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define POSU(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
template<class T,class S>
inline bool chmax(T &a, S b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
template<class T,class S>
inline bool chmin(T &a, S b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

void mod_print(ll k){
    ll P=1000;
    rep(y,1,P){
        ll x=mod(y*k);
        if(x+P>=i_7){
            x-=i_7;
        }
        if(abs(x)<=P){
            //cout<<x<<"/"<<y;
            cout<<setprecision(5)<<(dd)x/(dd)y;
            return;
        }
    }
    cout<<"nun"<<endl;
}
#define all(c) c.begin(),c.end()
//////////////////////////



int main(){fastio
    ll h,w,k;cin>>h>>w>>k;
    string s[h];rep(i,0,h-1)cin>>s[i];
    ll ans=0;
    rep(i,0,(1ll<<h)-1){
        rep(j,0,(1ll<<w)-1){
            string a[h];
            rep(z,0,h-1)a[z]=s[z];
            rep(ki,0,h-1){
                if((i>>ki)&1){
                    rep(j,0,w-1)a[ki][j]='.';
                }
            }
            rep(kj,0,w-1){
                if((j>>kj)&1){
                    rep(i,0,h-1)a[i][kj]='.';
                }
            }
            ll cnt=0;
            rep(ki,0,h-1){
                rep(kj,0,w-1){
                    if(a[ki][kj]=='#')cnt++;
                }
            }
            if(cnt==k)ans++;
        }
    }
    
    cout<<ans;
    return 0;
}



Measured memory_bytes: 3644
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
#include<stdio.h>
#include <cstdint>
#include <stdlib.h> 
#include <time.h>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rrep(i,n) REP(i,1,n+1)
#define all(a) a.begin(), a.end()
#define fi first
#define se second
#define RNG(x, a, n) &((x)[a]), &((x)[n])
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
typedef long long ll;
typedef pair<ll, ll> Pll;
typedef pair<int, int> PII;
typedef vector<ll> Vl;
typedef vector<int> VI;
typedef tuple<int, int, int> TT;
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define rall(v) v.rbegin(), v.rend()
#define dmp(x,y) make_pair(x,y)
#define dmt(x, y, z) make_tuple(x, y, z)
#define pb(x) push_back(x)
#define pf(x) push_front(x)
const int MAX = 500000;
const int inf = 1000000007;
const ll mod = 1000000007;
const long double PI = (acos(-1));
const long double EPS = 0.0000000001;

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


ll n, q, a[100005], b[100005], c[100005], ans[100005];
ll cnt[100005];

int main() {

	cin >> n;
	rep(i, n) {
		cin >> a[i];
		cnt[a[i]]++;
		ans[0] += a[i];
	}
	cin >> q;

	rrep(i, q) {
		cin >> b[i] >> c[i];

		ans[i] = ans[i - 1] + (cnt[b[i]] * (c[i] - b[i]));

		cnt[c[i]] += cnt[b[i]];
		cnt[b[i]] = 0;
	}

	rrep(i, q)cout << ans[i] << endl;

	return 0;
}


Measured memory_bytes: 7528
function main(input) {
  input=input.trim();
  const a = parseInt(input.split(" ")[0], 10);
  const b = parseInt(input.split(" ")[1], 10);
  const c = parseInt(input.split(" ")[2], 10);
  if(b-a==c-b){
    console.log("YES");
  }else{
    console.log("NO");
  }
}



main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 11468
#include <stdio.h>

char str[11];
char alpha[] = {'a','b','c','d','e','f','g','h','i','j'};
int n;

// 0~ len-1まで決まっている。 d種類まで使っている 
void foo(int len, int d){
    if(len == n){
        for (int j = 0; j < len; j++)
        {
            printf("%c", *(str+j));
        }
        printf("\n");
    
        return;
    }
    else
    {
        for (int i = 0; i < d; i++)
        {
            str[len] = alpha[i];
            foo(len+1, d);
        }
        str[len] = alpha[d];
        foo(len+1, d+1);
    }
    
}

int main(void) {
    
    int i;
    
    scanf("%d", &n);

    foo(0, 0);

    return 0;
}



Measured memory_bytes: 1408
s = input()
t = input()
len_t = len(t)
ans = len_t
for i in range(len(s) - len_t + 1):
    tgt = s[i:i+len_t]
    cnt = 0
    for j in range(len_t):
        if t[j] != tgt[j]:
            cnt += 1
    ans = min(ans, cnt)
print(ans)

Measured memory_bytes: 9124
import java.util.*;
class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
  String str = sc.next();
  String str1 = sc.next();
  int cnt = 0;
  for(int i = 0; i<str.length(); i++) {
  char c = str.charAt(i);
    char c1 = str1.charAt(i);
    if(c==c1) cnt++;
  }
  System.out.println(cnt);
}
}

Measured memory_bytes: 23892
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(int i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(int i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(int i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define uniq(x) (x).erase(unique((x).begin(), (x).end()), (x).end())

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n, a, b;
    cin >> n >> a >> b;
    
    while((a > 0) && (b <= n)) {
        if ((a + 1) == b) {
            a--;
        }
        else {
            a++;
        }
        
        if ((b - 1) == a) {
            b++;
        }
        else {
            b--;
        }
    }
    
    cout << ((a < 1) ? "Borys" : "Alice") << endl;
    return 0;
}

Measured memory_bytes: 256
#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(){
  int N,D;
  cin >> N >> D;
  
  int X[N][D];
  rep(i,N){
    rep(j,D){
      cin >> X[i][j];
    }
  }
  
  int counter=0;
  rep(i,N){
    for(int j=i+1; j<N; j++){
      double D2= 0;
      rep(k,D){
        D2 += pow(abs(X[i][k]-X[j][k]),2);
      }
      int D = pow(D2,0.5);
      if(D2 == (double)pow(D,2)) counter++;
    }
  }
  cout << counter << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <queue>
#include <algorithm>
#include <vector>
#include <cassert>

struct M {
    int hp;
    int criticals;
};

size_t div_ceil(size_t x, size_t y) {
    return (x % y  == 0) ? (x / y) : (1 + x / y);
}

size_t require_direct(size_t hp, size_t d_critical, size_t d_normal, size_t total) {
    if (hp <= d_normal * total) {
        return 0;
    } else {
        return div_ceil(hp - d_normal * total, d_critical - d_normal);
    }
}

bool judge(const std::vector<size_t> &hps, size_t d_critical, size_t d_normal, size_t total) {
    size_t critical_total = 0;
    for (size_t hp : hps) {
        auto r_d = require_direct(hp, d_critical, d_normal, total);
        if (r_d == 0) {
            return critical_total <= total;
        } 
        critical_total += r_d;
        if (critical_total > total) {
            return false;
        }
    }
    return true;
}

int main()
{
    size_t n;
    size_t critical, normal;
    std::cin >> n >> critical >> normal;
    std::vector<size_t> hps; hps.reserve(n);

    for (size_t i = 0; i < n; i++) {
        size_t hp;
        std::cin >> hp;
        hps.push_back(hp);
    }

    std::sort(hps.begin(), hps.end(), std::greater<size_t>{});

    size_t total_min = div_ceil(hps.front(), critical) - 1; //ng
    size_t total_max = div_ceil(hps.front(), normal) + 1;   //ok
    assert(normal < critical);
    assert(!judge(hps, critical, normal, total_min));
    assert(judge(hps, critical, normal, total_max));
    while (total_min + 1 < total_max) {
        size_t mid = (total_max + total_min) / 2;
        if (judge(hps, critical, normal, mid)) {
            total_max = mid;
        } else {
            total_min = mid;
        }
    }

    std::cout << total_max << std::endl;
    return 0;
}


Measured memory_bytes: 1024
#include "iostream"
#include "vector"

using namespace std;

int main(void) {
    long H, W;
    
    cin >> H >> W;
    
    long long ans;
    
    if (H == 1 || W == 1) {
        ans = 1;
    } else {
        ans = (H * W + 1) / 2;
    }
    
    cout << ans << endl;
    return 0;
}

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

int main() {
  int N; cin >> N;
  vector<long long> A(N), S(N);
  for (int i = 0; i < N; i++) cin >> A.at(i);
  sort(A.begin(), A.end());
  for (int i = 0; i < N; i++) {
    if (i == 0) S.at(i) = A.at(i);
    else S.at(i) += S.at(i-1) + A.at(i);
  }
  int ans = 1;
  for (int i = N-2; i >= 0; i--) {
    if (S.at(i) * 2 >= A.at(i+1)) ans++;
    else break;
  }
  cout << ans << endl;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#include <numeric>
using namespace std;
#define ll long long
#define fastio                  \
  ios_base::sync_with_stdio(0); \
  cin.tie(0), cout.tie(0)
const ll mod = 10e9 + 7;
int main()
{
  fastio;
  ll n,d;
  cin>>n>>d;
  ll j,k;
  int count=0;
  for(int i=0;i<n;i++)
  {
	  cin>>j>>k;
	  if(j*j+k*k<=d*d)
	  {
		  count++;
	  }
  }
  cout<<count<<'\n';
  return 0;
}


Measured memory_bytes: 3648
#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 < (n); i++)
#define irep(i, n) for (int64_t i = 0; i <= (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() {
  int H, W, K;
  cin >> H >> W >> K;

  vector<vector<bool>> white(H, vector<bool>(W));
  rep(i, H) {
    string s;
    cin >> s;
    rep(j, W) { white[i][j] = (s[j] == '1'); }
  }

  int result = numeric_limits<int>::max();
  rep(s, 1 << (H - 1)) {
    int G = 1;
    vector<int> group(H);
    rep(i, H) {
      group[i] = G - 1;
      if (((s >> i) & 1) == 1) {
        G++;
      }
    }

    vector<int> cnt(G, 0);
    vector<int> diff(G);
    int score = 0;
    rep(j, W) {
      fill(diff.begin(), diff.end(), 0);
      rep(i, H) { diff[group[i]] += (white[i][j] ? 1 : 0); }

      bool cut = false;
      rep(i, G) { cut = cut || (cnt[i] + diff[i] > K); }

      if (cut) {
        score++;
        copy(diff.begin(), diff.end(), cnt.begin());
      } else {
        rep(i, G) { cnt[i] += diff[i]; }
      }

      bool impossible = false;
      rep(i, G) { impossible = impossible || cnt[i] > K; }
      if (impossible) {
        score = H + W;
        break;
      }
    }
    score += bitset<10>(s).count();
    // cerr << bitset<10>(s) << " " << score << "\n";

    result = min(result, score);
  }
  cout << result << endl;

  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        if (a > b) { int t = a; a = b; b = t; }
        if (a > c) { int t = a; a = c; c = t; }
        if (b > c) { int t = b; b = c; c = t; }

        System.out.println((a == b && a != c) || (a != b && b == c) ? "Yes" : "No");
    }
}


Measured memory_bytes: 21844
n, k = map(int, input().split())
p = list(map(lambda i: (i + 1) / 2, list(map(int, input().split()))))
suma = sum(p[0:k]) 
max = suma
for i in range(k, n):
    suma += (p[i] - p[i - k])
    if suma > max:
        max = suma

print('{:.8f}'.format(max))


Measured memory_bytes: 25060
n=int(input())
sp=[]
for i in range(n):
    a=list(map(str,input().split()))
    a.append(i+1)
    sp.append(a)

sp=sorted(sp,key=lambda x:int(x[1]),reverse=True)
sp=sorted(sp,key=lambda x:x[0])

for i in range(len(sp)):
    print(sp[i][2])

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
  ll n,m;
  cin>>n>>m;
  map<ll,string>mx;
  string s;
  ll x,pen=0,p[n +1]={0},pos=0;
  for(ll i=0;i<m;i++)
  {
    	cin>>x>>s;
    	if(s=="AC"&&mx[x]!="AC")
    	mx[x]="AC",pen+=p[x],pos++;
    	else if(s=="WA"&&mx[x]!="AC")
          p[x]++;
  }
  
  
  cout<<pos<<" "<<pen;}


Measured memory_bytes: 11904