akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<queue>
#include<algorithm>
#include<map>
#include<set>
#include<vector>
#include<math.h>
#include<time.h>

using namespace std;

#define INF 1000000007
#define LINF (1LL << 62)

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


int h,w;
string s[101];

int main(){
	cin >> h >> w;
	for(int i = 1; i <= h; i++){
		cin >> s[i];
		s[i] = '#' + s[i] + '#';
	}
	for(int i = 0; i <= w+1; i++){
		s[0] += '#';
		s[h+1] += '#';
	}
	
	int dx[4] = {0,-1,0,1}, dy[4] = {1,0,-1,0};
	int ans = 0;
	for(int i = 1; i <= h; i++){
		for(int j = 1; j <= w; j++){
			if(s[i][j] == '#') continue;
			bool used[55][55] = {0};
			queue<pair<int,P>> q;
			q.push(make_pair(0,P(i,j)));
			int cnt = 0;
			used[i][j] = 1;
			while(!q.empty()){
				pair<int,P> fr = q.front();				
				q.pop();
				P p = fr.second;
				cnt = fr.first;
				for(int i = 0; i < 4; i++){
					int nx = dx[i]+p.first, ny = dy[i]+p.second;
					if(s[nx][ny] == '#') continue;
					if(used[nx][ny]) continue;
					used[nx][ny] = 1;
					q.push(make_pair(cnt+1,P(nx,ny)));
				}
			}
			ans = max(ans,cnt);
		}
	}
	
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 256
import heapq as hq
n, m = map(int, input().split())
items = [-int(i) for i in input().split()]
hq.heapify(items)
for _ in range(m):
    max_val = hq.heappop(items)
    hq.heappush(items, -(-max_val // 2))
print(-sum(items))

Measured memory_bytes: 14180
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] array = sc.nextLine().split("");
        int sum = 0;
        for (String s : array) {
            if (Integer.parseInt(s) == 1) {
                sum++;
            }
        }
        System.out.println(sum);
    }
}


Measured memory_bytes: 21588
import java.util.Scanner;

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[] a = new int[m];
        for (int i = 0; i < m; i++) {
            a[i] = sc.nextInt();
        }
        int count = 0;
        for (int i = 0; i < m; i++) {
            if (a[i] < x) {
                count++;
            } else {
                break;
            }
        }
        if (count <= m / 2) {
            System.out.println(count);
        } else {
            System.out.println(m - count);
        }

    }
}

Measured memory_bytes: 21844
#include <stdio.h>

int judgement(int n);

int main() {
  int number;
  int n;
  int i,j;
  int count=0;
  int judge=0;

  scanf("%d",&n);
  for(i=0;i<n;i++) {
    scanf("%d",&number);

    if(judgement(number) == 1) {
      count++;
    }

  }
  printf("%d\n",count);
  return 0;
}

int judgement (int x)
{
  int i;

  if (x < 2) {
    return 0;
  }
  else if (x == 2) {
    return 1;
  }

  if (x % 2 == 0) {
    return 0;
  }

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



Measured memory_bytes: 2084
/**********************************************************************************************
******************************AUTHOR:**********************************************************
****************************ASHISH RANJAN******************************************************
***********************************************************************************************/
#include<iostream>
#include<algorithm>
#include<cmath>
#include<chrono>
#include<vector>
#include<string>
#include<cstring>
using namespace std;
using namespace std::chrono;
/*
auto start = high_resolution_clock::now();
auto stop = high_resolution_clock::now();
  auto duration = duration_cast<microseconds>(stop - start); 
  
    cout << "Time taken by function: "
         << duration.count() << " microseconds" << endl;
*/
#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL)
#define ll long long
#define mod 1000000007
#define fr(i,n) for(int i=0;i<n;i++)
#define frs(i,a,b) for(int i = a;i<b;i++)
#define meme(a,b) memset(a,b,sizeof(a)); //works only for 0 and -1
void solve(){
int n,k;
cin>>n>>k;
int mx = 4*n;
int mn = 2*n;
if(k>=mn&&k<=mx&&k%2==0)cout<<"Yes";
else cout<<"No";
}
int main(){
  fast();
// int t;cin>>t;
// while(t--){
    solve();
// }
 return 0;
}


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

const ll INF = 1e18;

int main(){
    int N, K; cin >> N >> K;
    vector<int> h(N);
    rep(i, N) cin >> h[i];

    int ans = 0;
    rep(i, N) if(h[i] >= K) ans++;
    cout << ans << endl;
}

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

int main(){

  int n, i;
cin >> n;
  int w[n],a= 0,sum = 0,an = 1e9;
  for(i = 0; i < n; i++){
    cin >> w[i];  
    sum += w[i];
  }
  
  for(i = 0; i < n; i++){
    a += w[i];
    an = min(abs(sum - a*2), an);
  } 
    cout<< an << endl;
    return 0;
  
  
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <cstdio>
#include <map>
using namespace std;
int n;
int a[1000000];
map<int, int>M;
int main()
{
    cin>>n;
    for(int i = 0; i < n; i++) cin>>a[i];
    int Max = 0, t = 0;
    for(int i = 0; i < n; i++){
        if(!M[a[i]]) { M[a[i]] = 1; t++; Max = max(Max, a[i]); }
    }
    for(int i = 0; i < n; i++) if(a[i] < Max-1) { cout<<"No"<<endl; return 0; }
    if(t > 2) { cout<<"No"<<endl; }
    else {
        int m = 0;
        for(int i = 0; i < n; i++) if(a[i] == Max-1) m++;
        if(m == 0) {
            if(2*(Max-m) <= n) cout<<"Yes"<<endl;
            else if(Max == n-1) cout<<"Yes"<<endl;
            else cout<<"No"<<endl;
            return 0;
        }
        if(m < Max && (m + 2*(Max-m) <= n)) cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }
}


Measured memory_bytes: 5376
#include<iostream>
using namespace std;
int main(){
	int a,i,j,k;
	int s=0;
	while(cin>>a){
		for(i=a;i<600;i+=a){
			s+=i*i*a;
		}
		cout<<s<<endl;
		s=0;
	}
	return 0;
}

Measured memory_bytes: 1160
n = int(input())
a = list(map(int, input().split()))
# 奇数の横は4の倍数
# 奇数は4が最低でも同数-1以上なければ死
# 2の倍数の横は2か4の倍数
# 2はひとまとめにして横は4でない場合は死
# つまり奇数と同扱い
# 4の倍数の横は何でもよい
# 奇数の数＋2が一つでもあれば一つ追加

odd, num4, num2 = 0, 0, True
for i in range(n):
    if a[i] % 4 == 0:
        num4+=1
    elif a[i] % 2 != 0:
        odd +=1
    elif num2:
        odd +=1
        num2 = False
print('Yes' if odd<=num4+1 else 'No')
exit(0)

Measured memory_bytes: 14252
#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;
using   ll=long long;
using   ld=long double;

#define fast        	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ordered_set 	tree<pll, null_type,less<pll>, rb_tree_tag,tree_order_statistics_node_update>

#define endl        	"\n"
#define pb          	push_back
#define mp          	make_pair
#define F           	first
#define S           	second
#define int             long long int

#define ALL(v)      	v.begin(),v.end()
#define ALLR(v)     	v.rbegin(),v.rend()
#define pii         	3.14159265358979323
#define inf     		LLONG_MAX
#define ones(x)     	__builtin_popcount(x)
#define fill(a,b)   	memset(a,b,sizeof(a))
#define mod 			1000000007

ll mod_pow(ll a,ll b) 
{
    ll res = 1;
    while(b)	
    {
        if(b&1) 	
        {
        	res=(res*a)%mod;
        }
        a=(a*a)%mod;
        b>>=1;
    }
    return res;
}

ll mod_inverse(ll a) 
{
	return mod_pow(a , mod-2);
}

void solve()
{
	int k , a , b;
	
	cin >> k >> a >> b;
	
	int tm = (a/k)*k;
	
	if(tm < a) {
		tm += k;
	}
	
	if(tm <= b && tm >= a) {
		cout << "OK" << endl;
	}
	else {
		cout << "NG" << endl;
	}
}

signed main() {
    fast;
    
    int t = 1;
    
    //cin >> t;
    
    while(t--) {
        solve();
    }
 
    return 0;
}


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

int main() {
  int h1, h2, m1, m2, k;
  cin >> h1 >> m1 >> h2 >> m2 >> k;
 
  cout << (60 * (h2 - h1) + m2 - m1 - k) << endl;
  
}

Measured memory_bytes: 3636
using System;

namespace ITP1_2_D
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] strs = Console.ReadLine().Split(' ');
            int w = int.Parse(strs[0]);
            int h = int.Parse(strs[1]);
            int x = int.Parse(strs[2]);
            int y = int.Parse(strs[3]);
            int r = int.Parse(strs[4]);
            Console.WriteLine(x >= r && x <= w - r && y >= r && y <= h - r ? "Yes" : "No");
        }
    }
}

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

using namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
int main(){
    fast
    char a;
    cin>>a;
    if(a>='A'&&a<='Z'){
        cout<<"A"<<endl;
    }

    else if(a>='a'&&a<='z'){
        cout<<"a"<<endl;
    }


   return 0;
}


Measured memory_bytes: 3596
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <math.h>
#include <cmath>
#include<cctype>
#include<string>
#include<set>
#include<iomanip>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include<bitset>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility> 
using namespace std;
using ll = long long;
template<typename T>using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll inf = 1145141919810364364LL;
#define all(x) (x).begin(),(x).end()
#define puts(x) cout << x << endl
#define rep(i,m,n) for(ll i = m;i < n;++i)
#define pb push_back
#define fore(i,a) for(auto &i:a)
#define rrep(i,m,n) for(ll i = m;i >= n;--i)


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

	int N;
	cin >> N;
	vector<int>a(N);
	for (int i = 0; i < N; i++)cin >> a[i];

	int cur = 1;
	int sub = 0;
	for (int i = 0; i < N; i++) {
		if (cur == a[i]) {
			sub++;
			cur++;
		}
	}
	if (sub >= 1)puts(N - sub);
	else puts(-1);
	
	return 0;
}

Measured memory_bytes: 1024
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.*;


public class Main {
    int N;
    long[] A;
    private void solve() {
        N = nextInt();
        BigInteger sum = BigInteger.ONE;
        A = new long[N];
        for(int i = 0;i < N;i++) {
            A[i] = nextLong();

            if (A[i] == 0) {
                out.println(0);
                return;
            }
        }


        for(int i = 0;i < N;i++) {
            sum = sum.multiply(new BigInteger(String.valueOf(A[i])));
            if (sum.compareTo(new BigInteger("1000000000000000000")) == 1) {
                break;
            }
        }

        if (sum.compareTo(new BigInteger("1000000000000000000")) == 1) {
            out.println(-1);
        } else {
            out.println(sum.longValue());
        }
    }

    public static void main(String[] args) {
        out.flush();
        new Main().solve();
        out.close();
    }

    /* Input */
    private static final InputStream in = System.in;
    private static final PrintWriter out = new PrintWriter(System.out);
    private final byte[] buffer = new byte[4096];
    private int p = 0;
    private int buflen = 0;

    private boolean hasNextByte() {
        if (p < buflen)
            return true;
        p = 0;
        try {
            buflen = in.read(buffer);
        } catch (IOException e) {
            e.printStackTrace();
        }
        if (buflen <= 0)
            return false;
        return true;
    }

    public boolean hasNext() {
        while (hasNextByte() && !isPrint(buffer[p])) {
            p++;
        }
        return hasNextByte();
    }

    private boolean isPrint(int ch) {
        if (ch >= '!' && ch <= '~')
            return true;
        return false;
    }

    private int nextByte() {
        if (!hasNextByte())
            return -1;
        return buffer[p++];
    }

    public String next() {
        if (!hasNext())
            throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = -1;
        while (isPrint((b = nextByte()))) {
            sb.appendCodePoint(b);
        }
        return sb.toString();
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

    public double nextDouble() {
        return Double.parseDouble(next());
    }
}

Measured memory_bytes: 48236
a, b = list(map(int, input().split()))

ans = 0
for i in [a, b]:
    if i == 1:
        ans += 300000
    elif i == 2:
        ans += 200000
    elif i == 3:
        ans += 100000
if a == 1 and b == 1:
    ans += 400000
print(ans)

Measured memory_bytes: 38384
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ll mod = 1e9 + 7;
//const ll mod = 998244353;
#define REP(i,n) for(int i=0;i<(int)n;++i)
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}
string num2bit(ll num, ll len){
    string bit = "";
    REP(i, len){
    bit += char('0'+(num>>i & 1));
    }
    return bit;
}

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

    string s;
    cin >> s;
    if(s=="ARC") cout << "ABC" << endl;
    if(s=="ABC") cout << "ARC" << endl;

    return 0;
}

Measured memory_bytes: 3656
#include<cstdio> 
#include<algorithm>
#include<cstring>
#include<cmath>
#include<set>
#include<map>
using namespace std;
#define fo(i,j,k) for(i=j;i<=k;i++)
#define fd(i,j,k) for(i=j;i>=k;i--)
#define cmax(a,b) (a=(a>b)?a:b)
#define cmin(a,b) (a=(a<b)?a:b)
typedef long long ll;
const int N=1e6+5,M=2e6+5,mo=1e9+7;
int f[3],A[3][3],B[3][3],C[3][3],D[3][3],a[3][3],b[3][3],c[3][3],g[3];
int d[N],n,m,x,i,j,k,pos,l;
void ksm(int x)
{
	int i,j,k;
	fo(i,0,2) fo(j,0,2) c[i][j]=C[i][j];
	while(x)
	{
		if (x&1)
		{
			fo(i,0,2) fo(j,0,2) D[i][j]=0;
			fo(i,0,2) fo(j,0,2) fo(k,0,2)
				D[i][j]=(D[i][j]+1ll*a[i][k]*c[k][j])%mo;
			fo(i,0,2) fo(j,0,2) a[i][j]=D[i][j];
		}
		x>>=1;
		fo(i,0,2) fo(j,0,2) D[i][j]=0;
		fo(i,0,2) fo(j,0,2) fo(k,0,2)
			D[i][j]=(D[i][j]+1ll*c[i][k]*c[k][j])%mo;
		fo(i,0,2) fo(j,0,2) c[i][j]=D[i][j];
	}
}
int main()
{
	scanf("%d %d",&n,&m);
	fo(i,1,m) scanf("%d",d+i);
	pos=0;// finished pos
	f[0]=1;
	A[0][1]=2;A[1][2]=1;A[0][2]=1;
	A[0][0]=1;A[1][1]=1;A[2][2]=1;
	B[2][0]=1;B[0][0]=1;B[1][1]=1;B[2][2]=1;
	fo(i,0,2) fo(j,0,2) 
		fo(k,0,2) 
			C[i][j]+=A[i][k]*B[k][j];
	d[++m]=n;
	fo(l,1,m)
	{
		x=d[l]-pos-1;
		fo(i,0,2) fo(j,0,2) b[i][j]=a[i][j]=0;
		fo(i,0,2) a[i][i]=1;
		if (x)
			ksm(x);//use C, prod in a
		fo(i,0,2) fo(j,0,2) fo(k,0,2) b[i][j]=(b[i][j]+1ll*a[i][k]*A[k][j])%mo;
		fo(i,0,2) g[i]=0;
		fo(i,0,2) fo(j,0,2) g[j]=(g[j]+1ll*f[i]*b[i][j])%mo;
		fo(i,0,2) f[i]=g[i];
		pos=d[l];
	}
	printf("%d",f[2]);
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int main() {
  int A,ans;
  int B[]={1,1,1,2,1,2,1,5,2,2,1,5,1,2,1,14,1,5,1,5,2,2,1,15,2,2,5,4,1,4,1,51};
  cin >> A;
  for(int i=0; i<32; i++){
    if(i+1==A)
    ans=B[i];
  }
  
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <vector>

using namespace std;

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

  vector<long long> A(N);
  map<long long, int> mp;
  for (int i = 0; i < N; i++) {
    cin >> A[i];
    mp[A[i] + i]++;
  }

  long long ans = 0;
  for (int j = 0; j < N; j++) {
    ans += mp[j - A[j]];
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 27308
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		S = S.replaceAll("eraser","");
        S = S.replaceAll("erase","");
        S = S.replaceAll("dreamer","");
        S = S.replaceAll("dream","");

		if(S.length() == 0) {
			System.out.println("YES");
		}else {
			System.out.println("NO");
		}
	}
}


Measured memory_bytes: 30480
from fractions import gcd
n, m = [int(i) for i in input().split()]
a = [int(i)//2 for i in input().split()]


def two(x):
    i = 0
    while x % 2 == 0:
        i += 1
        x //= 2
    return i


if two(min(a, key=two)) != two(max(a, key=two)):
    print(0)
else:
    lcm = 1
    for i in a:
        lcm = i * lcm // gcd(i, lcm)
        if lcm > m:
            print(0)
            break
    else:
        print((m+lcm)//(2*lcm))


Measured memory_bytes: 16276
#include<iostream>
#include<cstdio>

using namespace std;

int main(void)
{
	int a, b, k;
	
	while(scanf("%d %d", &a, &b) != EOF){
		k = a + b;
		int ans = 0;
		while(k >= 1){
			k = k / 10;
			ans++;
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 1208
#include<stdio.h>
#include<stdlib.h>
 
#define INFTY 2097152//(1<<21)

struct Ver{
    int weight;
    int key;
    struct Ver *next;
};
 
void Input(int);
void Create(int,int,int);// create vertex
void ShortestPath(void);//find shortest path
int Set(int*);//set test veriable
int Heap(int*);//create heap tree

int n;
int *d;
struct Ver *ver;
 
int main(void){
    int i;
    int id;
 
    scanf("%d",&n);
 
    //dynamic malloc and initialize var
    d=(int*)malloc(sizeof(int)*n);
    ver=(struct Ver*)malloc(sizeof(struct Ver)*n);
    for(i=0;i<n;i++){
        ver[i].weight=-1;
        ver[i].key=-1;
        ver[i].next=NULL;
    }
 
    for(i=0;i<n;i++){
        scanf("%d",&id);
        Input(id);  
    }
 
    ShortestPath();
 
    for(i=0;i<n;i++) printf("%d %d\n", i, d[i]);

    free(d);
    return 0;
}
 
void Input(int id){
    int k, u, c;
    int i;

    scanf("%d", &k);
    for(i = 0; i < k; i++){
        scanf("%d", &u);
        scanf("%d", &c);
        Create(id, u, c);
    }

}
 
void Create(int id, int u, int c){
    struct Ver *new, *work;
 
    //memory and set address
    new=(struct Ver*)malloc(sizeof(struct Ver));
    new->next = NULL;
    new->weight = c;
    new->key = u;
 
    work = &ver[id];
    while(work->next != NULL){
      work = work->next;
    }
    work->next = new;
 
}
 
void ShortestPath(void){
    int S[n];
    int i;
    int s, u;
    struct Ver *work;
 
    for(i = 0; i < n; i++){
        S[i] = 0;
        d[i] = INFTY;
    }
    s = 0;
    d[s] = 0;
 
    //calc route
    while(Set(S) == 0){
        u = Heap(S);
        S[u] = 1;
        work = ver[u].next;

        while(work != NULL){

            if(S[work->key] == 1){
	    }else if(d[u] + work->weight < d[work->key]){
                d[work->key] = d[u] + work->weight;
            }
            work = work->next;

        }//end while
    }//end while
}
 
int Heap(int *S){
    int i;
    int min = INFTY;
    int u;
  
    for(i = 0; i < n; i++){
      if(S[i] == 1){
	continue;
      }
          
      if(d[i]<min){
	min=d[i];
	u=i;
      }

    }//end for    
    return u;
}

int Set(int *S){
    int i;
 
    for(i=0;i<n;i++){
        if(S[i]==0) return 0;
    }
    return 1;
}

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

int main() {
  int n;
  cin >> n;
  int f=0;
  if(n==2){
    cout << 2 << endl;
  }else{
    if(n%2==0){
      n=n+1;
    }
    while(f==0){
      f = 1;
      for(int i=3;i<sqrt(n);i=i+2){
        if(n%i==0){
          i=n;
          f=0;
        }
      }
      if(f==0){
        n=n+2;
      }
    }
    cout << n << endl;
  }
}


Measured memory_bytes: 256
# include <iostream>
# include <string>
# include <algorithm>

main()
{
    std::string s;
    std::cin >> s;
    int n = s.length();
    int flag = 0;
    for (int i=0; i<n; i++) {
        if (std::count(s.cbegin(), s.cend(), s[i]) != 2) {flag = 1;}
    }
    if (flag) {
        std::cout << "No" << std::endl;
    } else {
        std::cout << "Yes" << std::endl;
    }
}



Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = 1; i <= (int)(n); i++) 
#define dunk(n) cout << n << endl
#define all(a) (a).begin(),(a).end()
int main() {
    int n;
    long long ans = 0;
    string s;
    cin >> n >> s;
    vector<int> R,G,B;
    int r = 0,g = 0,b = 0;
    rep(i,n){
        if(s[i] == 'R') {
            R.push_back(i);
            r++;
        }
        if(s[i] == 'G') {
            G.push_back(i);
            g++;
        }
        if(s[i] == 'B') {
            B.push_back(i);
            b++;
        }
    }
    rep(i,r){
        rep(j,g){
            ans += b;
            if(R[i] > G[j]){
                //if(G[j]-(R[i]-G[j]) >= 0 && R[i]+(R[i]-G[j]) < n && s[G[j]-(R[i]-G[j])] == 'B' && s[R[i]+(R[i]-G[j])] == 'B') ans += (b-2);
                if(R[i]+(R[i]-G[j]) < n && s[R[i]+(R[i]-G[j])] == 'B') ans--;
                if(G[j]-(R[i]-G[j]) >= 0 && s[G[j]-(R[i]-G[j])] == 'B') ans--;
                if((R[i]+G[j])%2 == 0 && s[(R[i]+G[j])/2] == 'B') ans--;
                //else ans += b;
            }
            if(R[i] < G[j]){
                //if(R[i]-(G[j]-R[i]) >= 0 && G[j]+(G[j]-R[i]) < n && s[G[j]+(G[j]-R[i])] == 'B' && s[R[i]-(G[j]-R[i])] == 'B') ans += (b-2);
                if(G[j]+(G[j]-R[i]) < n && s[G[j]+(G[j]-R[i])] == 'B') ans--;
                if(R[i]-(G[j]-R[i]) >= 0 && s[R[i]-(G[j]-R[i])] == 'B') ans--;
                if((R[i]+G[j])%2 == 0 && s[(R[i]+G[j])/2] == 'B') ans--;
                //else ans += b;
            }
        }
        
    }
    dunk(ans);
}

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

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
using vec_b = vector<bool>;
using vec_str = vector<string>;
using graph = mat;
using edge = pair<ll,ll>;
using wgraph = vector<vector<edge>>;

#define INF (1LL << 60)
#define MOD 1000000007

#define REP(i,m,n) for(ll (i)=(m),i##_len=(n);(i)<(i##_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define _PR(x) cout << (x) << endl
#define _PS(x) cout << (x) << " "
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define pb push_back

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

ll lcm(ll a, ll b)
{
    return a * b / gcd(a, b);
}

int main()
{
    ll A, B;
    cin >> A >> B;
    _PR(lcm(A,B));



    return 0;
}

/*



*/

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

int main()
{
	int a,b,c;
	scanf("%d %d %d",&a,&b,&c);
	if((b-a)==(c-b))
		puts("YES");
	else
		puts("NO");
	
	return 0;
 } 

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

int main() {
    int h,n;cin>>h>>n;
    int sum=0;
    int a[n+1];for(int i=0;i<n;i++){
        cin>>a[i];
        sum+=a[i];
    }
    if(sum>=h)cout<<"Yes";
    else cout<<"No";
}

Measured memory_bytes: 640
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <regex>
#define ll long long
#define ull unsigned long long
#define REP(i,n) for(int i = 0; i < n; i++)
#define FOR(i,j,n) for(int i = j; i < n; i++)
#define RFOR(i,j,n) for(int i = j-1; i >= n; i--)
#define PREC(n) fixed << setprecision(n)
#define print_array(v) REP(__k, v.size()) { cout << v[__k]; if(__k != v.size()-1) cout << " "; else cout << endl; }
using namespace std;

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

	ll N;
	cin >> N;
	vector<ll> A(N);
	REP(i, N) cin >> A.at(i);
	vector<ll> arr(N+1);
	REP(i, N) arr[i+1] = arr[i] + A[i];
	map<ll, ll> m;
	m[0] = 0;
	ll res = 0;
	REP(i, N+1) {
		res += m[arr[i]];
		m[arr[i]]++;
	}
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 15872
n= int(input())
la=list(map(int, input().split()))
lb=list(map(int, input().split()))
lc=list(map(int, input().split()))
result=0
for i in range(n-1):
	if la[i]-la[i+1]==-1:
		result+=lc[la[i]-1]
print(sum(lb)+result)
		

Measured memory_bytes: 3060
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<vector>
#include<functional>
#include<algorithm>
#include<stdlib.h>
#include<string>
#include<string.h>
#define _USE_MATH_DEFINES
#include<math.h>
#include<deque>
#include<set>
#include<map>
#include<queue>
#include<list>
#include<iostream>
#include <bitset>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for(auto i=a;i<b;i++)
#define all(_x) _x.begin(), _x.end()
#define r_sort(_x) sort(_x.begin(), _x.end(), std::greater<int>())
#define vec_cnt(_a, _n) (upper_bound(all(_a), _n) - lower_bound(all(_a), _n))
#define vec_unique(_a) _a.erase(std::unique(all(_a)), _a.end());
ll gcd(ll a, ll b) { return a % b == 0 ? b : gcd(b, a % b); }
//ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }
#define INF 1 << 30
const int mod = 1000000007;
ll power(ll x, ll p) { ll a = 1; while (p > 0) { if (p % 2 == 0) { x *= x; p /= 2; } else { a *= x; p--; } }return a; }
ll mpower(ll x, ll p) { ll a = 1; while (p > 0) { if (p % 2 == 0) { x = x * x % mod; p /= 2; } else { a = a * x % mod; p--; } }return a; }
ll c(ll n, ll k) { ll a = 1; rep(i, 1, k) { a *= n - i + 1; a /= i; }return a; }
ll mc(ll n, ll m) { ll k = 1, l = 1; rep(i, n - m + 1, n + 1) k = k * i % mod; rep(i, 1, m + 1) l = l * i % mod; l = mpower(l, mod - 2); return k * l % mod; }
int main(void) {
	char s[100001], t[100001];
	int len, ls;
	ll ans = 0;
	scanf("%s%s", s, t);
	ls = strlen(s);
	len = strlen(t);
	map<char, int> mp;
	rep(i, 0, ls)mp[s[i]]++;
	rep(i, 0, len) {
		if (mp[t[i]] == 0) {
			puts("-1");
			return 0;
		}
	}
	vector<vector<int>> np(ls, vector<int>(26));
	int v;
	char* next;
	rep(i, 0, ls) {
		rep(i2, 0, 26) {
			if (mp[i2 + 'a'] == 0)continue;
			if (i == 0 || i && np[i - 1][i2] <= 1) {
				v = 1;
				next = s + i;
				while (*next != i2 + 'a') {
					next++;
					v++;
					if (next == s + ls)next = s;
					if (v >= ls)break;
				}
				np[i][i2] = v;
			}
			else np[i][i2] = np[i - 1][i2] - 1;
		}
	}
	rep(i, 0, len) {
		ans += (ll)np[ans % ls][t[i] - 'a'];
	}
	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 13696
#include <iostream>
using namespace std;
int main(void){
    int N;
    cin >> N;
    N = N % 10;
    
    switch(N) {
        case 2:
        case 4:
        case 5:
        case 7:
        case 9:
            cout << "hon" << endl;
            break;
        case 0:
        case 1:
        case 6:
        case 8:
            cout << "pon" << endl;
            break;
        case 3:
            cout << "bon" << endl;
            break;
    }
}


Measured memory_bytes: 3628
#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;
#ifdef ENABLE_DEBUG
#define dump(a) cerr<<#a<<"="<<a<<endl
#define dumparr(a,n) cerr<<#a<<"["<<n<<"]="<<a[n]<<endl
#else
#define dump(a) 
#define dumparr(a,n) 
#endif
#define FOR(i, a, b) for(ll i = a;i < b;i++)
#define For(i, a) FOR(i, 0, a)
#define REV(i, a, b) for(ll i = b-1;i >= a;i--)
#define Rev(i, a) REV(i, 0, a)
#define REP(a) For(i, a)
#define SIGN(a) (a==0?0:(a>0?1:-1))

typedef long long int ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef pair<ll, ll> pll;
typedef pair<ll,pll> ppll;
typedef vector<ll> vll;
typedef long double ld;
typedef pair<ld,ld> pdd;

const ll INF=(1LL<<50);
#if __cplusplus<201700L
ll gcd(ll a, ll b) {
  if(a < b) return gcd(b, a);
  ll r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}
#endif

template<class S,class T>
std::ostream& operator<<(std::ostream& os,pair<S,T> a){
  os << "(" << a.first << "," << a.second << ")";
  return os;
}
template<class T>
std::ostream& operator<<(std::ostream& os,vector<T> a){
  os << "[ ";
  REP(a.size()){
    os<< a[i] << " ";
  }
  os<< " ]";
  return os;
}


void solve(long long a, long long b){
  if(a>b){
    swap(a,b);
  }
  REP(b){
    cout<<a;
  }
  cout<<endl;
}

int main(){
  cout<<setprecision(1000);
  cin.tie(0);
  ios::sync_with_stdio(false);
    long long a;
    scanf("%lld",&a);
    long long b;
    scanf("%lld",&b);
    solve(a, b);
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
#define ll long long

void solve()
{
	ll H;
	cin>>H;
	ll sum=0;
	for(int i=0;;i++)
	{
		if(H >= 1ll<<i)
		sum+=(1ll<<i);
		else
		break;
	}
	cout<<sum<<endl;
}
int main()
{
	//int t;cin>>t;
	//while(t--)
	solve();
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>

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

int main() {
    ll h,w; cin >> h >> w;
    ll ans = 0;
    if (h % 2) {
        for (int i = 0; i < w; i++) {
            if (i % 2) ans += (h + 1) / 2;
            else ans += h / 2;
        }
    } else {
        ans = h * w / 2;
    }
    ans = h * w -ans;
    if (h == 1 || w == 1) ans = 1;
    cout << ans << "\n";
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <utility>
#include <cmath>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>


using namespace std;

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

ll gcd(ll a, ll b) {
	ll c = a % b;
	if (c == 0) {
		return b;
	}
	return gcd(b, c);
}


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


	vector<ll> a(n);
	ll max_a = 0;

	for(int i = 0; i < n; i++) {
		cin >> a[i];
		max_a = max(max_a, a[i]);
	}
	if (max_a < k) {
		cout << "IMPOSSIBLE" << endl;
		return 0;
	}
	ll g = a[0];

	for (int i = 1; i < n; i++) {
		g = gcd(g, a[i]);
	}

	if (k % g == 0) {
		cout << "POSSIBLE" << endl;
	} else {
		cout << "IMPOSSIBLE" << endl;		
	}


	
	return 0;
}

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

int main()
{
    long long int n,i;
    cin>>n;

    long long int h[n];

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

    long long int dp[n+2];

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

    cout<<dp[n-1];
}


Measured memory_bytes: 1792
#define _USE_MATH_DEFINES
#include <math.h>
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <numeric>
#include <stdio.h>
#include <vector>
#include <map>
#include <queue>

using namespace std;
typedef long long ll;
using Graph = vector<vector<ll>>;

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

int main() {
    ll N;
    cin >> N;
    ll a[N];
    rep(i,N) cin >> a[i];
    ll M = 0;
    ll b[N];
    rep(i,N) b[i] = 0;;
    rep(i,N){
        ll I = N-1-i;
        ll n = N/(I+1);
        ll cnt = 0;
        rep(j,n){
            if(b[(I+1)*(j+1)-1]==1) cnt++;
        }
        if(cnt%2!=a[I]){
            b[I]++;
            M++;
        }
    }
    cout << M << endl;
    rep(i,N){
        if(b[i]==1) cout << i+1 << endl;
    }
    return 0;
}



Measured memory_bytes: 6708
import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    N=I()
    ans=0
    for i in range(1,N+1):
        if i%3!=0 and i%5!=0:
            ans+=i
            
    print(ans)

main()


Measured memory_bytes: 72712
N = int(input())

ac = 0
wa = 0
tle = 0
re = 0

for i in range(N):
  s = input()
  
  if s=="AC":
    ac+=1
  elif s=="WA":
    wa+=1
  elif s=="TLE":
    tle+=1
  else:
    re+=1
      
print("AC x "+str(ac))
print("WA x "+str(wa))
print("TLE x "+str(tle))
print("RE x "+str(re))

Measured memory_bytes: 9188
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

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

    int rsum = 0;
    int wsum = 0;
    // 左からxカウントしたとき，Rがいくつあるか
    vector<int> racc(S.size() + 1, 0);
    for (int i = 0; i < S.size(); i++)
    {
        if (S[i] == 'R')
        {
            rsum++;
            racc[i + 1] = racc[i] + 1;
        }
        else
        {
            wsum++;
            racc[i + 1] = racc[i];
        }
    }

    int ans = N;
    for (int nr = 0; nr <= N; nr++)
    {
        int tmp_ans = 0;
        //exchange
        //左からnrカウントしたときwがいくつあるか？
        int lw = nr - racc[nr];
        //nr+1からNまで左からカウントしたとき，Rがいくつあるか
        int rw = rsum - racc[nr];
        tmp_ans += min(lw, rw);

        //change
        tmp_ans += max(lw, rw) - min(lw, rw);

        ans = min(tmp_ans, ans);
    }

    cout << ans << endl;
}

Measured memory_bytes: 4032
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<set>
#include<map>
#include<iomanip>

using namespace std;

int main(void) {
	string s;
	cin >> s;
	bool N = false, W = false, S = false, E = false;
	for (int i = 0; i < s.size(); i++) {
		if (s[i] == 'N') {
			N = true;
		}
		if (s[i] == 'W') {
			W = true;
		}
		if (s[i] == 'S') {
			S = true;
		}
		if (s[i] == 'E') {
			E = true;
		}
	}
	if (N == S && W == E) {
		cout << "Yes";
	}
	else {
		cout << "No";
	}
	return 0;
}

Measured memory_bytes: 256
s = gets.chomp.split("").map(&:to_i)

zi=0
oi=0

(0..s.count-1).each do |i|
  if i.even?
    if s[i] == 1
      zi += 1
    else
      oi += 1
    end
  else
    if s[i] == 0
      zi += 1
    else
      oi += 1
    end
  end
end

if zi <= oi
  puts zi
else
  puts oi
end

Measured memory_bytes: 7676
#4問目
import math
import fractions
import collections
A, B = map(int, input().split())

count = 0
gcd = fractions.gcd(A,B)

def devisor(num):
    array = []
    for i in range(1, math.floor(math.sqrt(num)) + 1):
        if(num % i == 0):
            array.append(i)
            array.append(math.floor(num / i))
    return array

def prime(n):
    prime = []
    while n % 2 == 0:
        prime.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            prime.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        prime.append(n)
    return prime

print(len(collections.Counter(prime(gcd))) + 1)

Measured memory_bytes: 5304
import std.stdio;
import std.algorithm;
import std.conv;
import std.numeric;
import std.math;
import std.string;

void main()
{
	auto tokens = split(chomp(readln()));
	auto N = to!ulong(tokens[0]);
	auto M = to!ulong(tokens[1]);

	ulong inc = 1;
	if (M % 2 == 1)
	{
		if (N % 2 == 0) ++N;
		inc = 2;
	}
	ulong blocks = M;
	ulong i;
	while (i < M/2 - N + 1)
	{
		if (M % (N + i) == 0)
		{
			blocks = N + i;
			break;
		}
		i += inc;
	}

	writeln(M / blocks);
	stdout.flush();
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#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 all(s) s.begin(), s.end()
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const int MX = 100005, INF = 1001001001;
const ll LINF = 1e18;
const double eps = 1e-10;
const int DIV = 1e9+7;

int main()
{
    vi n;
    int a, b, c;
    cin >> a >> b >> c;
    n.pb(a); n.pb(b); n.pb(c); 
    sort(all(n));
    cout << n[0]+n[1] << endl;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<vector>
#include<algorithm>
#include<string.h>
#include<set>
#include<fstream>
#include<map>
#include<string>
#include <stdio.h>
#include<bitset>
#include<queue>
#include<iomanip>
#include<cmath>
#include<stack>
#include<climits>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll>vl;
typedef vector<int>vi;
typedef vector<bool>vb;
typedef vector<double>vd;
typedef vector<char>vc;
typedef vector<string>vs;
#define MP make_pair
#define all(v) v.begin(),v.end()
const ll mod = 1000000007;
const ll OO = (ll)1e18;
const int dx[] = { 0, 1, -1, 0 };
const int dy[] = { 1, 0, 0, -1 };
ll gcd(ll a, ll b){ if (b == 0){ return a; }return gcd(b, a % b); }
ll fast_power(ll base, ll power){
	if (power == 1) return base;
	if (power % 2 == 0) return fast_power((base*base), power / 2);
	else return(base*fast_power((base*base), power / 2));
}
//#pragma warning (disable : 4996)
void Qalbaz()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	
}

int main(){
	//Qalbaz();
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	string str;
	cin >> str;
	str[0] = '2';
	str[1] = '0';
	str[2] = '1';
	str[3] = '8';
	cout << str;
	return 0;
}

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

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

long long MOD = 1000000000 + 7;

int main(){
  cout << setprecision(10);
  int K; cin >> K;

  queue<string> q;

  for(int i = 1; i <= 9; i++){
    q.push(to_string(i));
  }
  int num = 0;
  while(true){
    string now = q.front();
    q.pop();
    num++;
    if(num == K){
      cout << now << endl;
      break;
    }

    int last_num = now[now.size()-1] - '0';

    if(last_num > 0){
      q.push(now + to_string(last_num-1));
    }
    q.push(now + to_string(last_num));
    if(last_num < 9){
      q.push(now + to_string(last_num+1));
    }

  }

}


Measured memory_bytes: 9704
#include <iostream>
#include <map>
using namespace std;
typedef long long ll;
ll n, k, a[200010], bit[200010], sum[200010], ans;
map<ll, ll> mp;


ll su(ll i){
    ll s = 0;
    while(i>0){
        s += bit[i];
        i -= i & -i;
    }
    return s;
}

void add(ll i, ll x){
    while(i <= mp.size()){
        bit[i] += x;
        i += i & -i;
    }
}

int main(void){
    // Your code here!
    cin >> n >> k;
    for (ll i = 0; i < n; i++){
        cin >> a[i];
        a[i] -= k;
    }
    for (ll i = 0; i < n; i++){
        sum[i + 1] = sum[i] + a[i];
    }
    for (ll i = 0; i <= n; i++){
        mp[sum[i]]++;
    }
    ll t = 0;
    for (auto itr = mp.begin(); itr != mp.end(); itr++){
        t++;
        mp[itr->first] = t;
    }
    for (ll i = 0; i <= n; i++){
        ans += su(mp[sum[i]]);
        add(mp[sum[i]], 1);
    }
    cout << ans << endl;
}


Measured memory_bytes: 17408
// quote from https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8

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

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

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

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

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

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

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

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

macro_rules! out {
    ($x:expr) => {
        println!("{:?}", $x)
    };
}

fn main() {
    use std::char;
    input! {
        n: u8,
        s: String,
    }
    let s: String = s;
    let ans: String = s.bytes().map(|c| ((((c - b'A' + n) as u8) % 26) + b'A') as char).collect();
    println!("{}", ans)
}


Measured memory_bytes: 4352
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<ctime>
using namespace std;
typedef long long lt;
typedef double dd;
#define eps 1e-6
#define sqr(x) ((x)*(x))
 
int read()
{
    int f=1,x=0;
    char ss=getchar();
    while(ss<'0'||ss>'9'){if(ss=='-')f=-1;ss=getchar();}
    while(ss>='0'&&ss<='9'){x=x*10+ss-'0';ss=getchar();}
    return f*x;
}
 
const int maxn=1000010;
int n;
struct point{dd x,y;}p[maxn],O;
dd R;
 
dd getd(point a,point b){ return sqrt(sqr(a.x-b.x)+sqr(a.y-b.y));}
point getO(point p1,point p2,point p3)
{
    point res;
    dd a=p2.x-p1.x,b=p2.y-p1.y,c=p3.x-p2.x,d=p3.y-p2.y;
    dd e=sqr(p2.x)+sqr(p2.y)-sqr(p1.x)-sqr(p1.y);
    dd f=sqr(p3.x)+sqr(p3.y)-sqr(p2.x)-sqr(p2.y);
    res.x=(f*b-e*d)/(c*b-a*d)/2.0; 
    res.y=(a*f-e*c)/(a*d-b*c)/2.0;
    return res;
}
 
void mincir()
{
    O=p[1]; R=0;
    for(int i=1;i<=n;++i)
    if(getd(p[i],O)-R>eps)
    {
        O=p[i]; R=0;
        for(int j=1;j<i;j++)
        if(getd(p[j],O)-R>eps)
        {
            O=(point){(p[i].x+p[j].x)/2.0,(p[i].y+p[j].y)/2.0};
            R=getd(p[i],p[j])/2.0;
    
            for(int k=1;k<j;++k)
            if(getd(p[k],O)-R>eps)
            {
                O=getO(p[i],p[j],p[k]);
                R=getd(p[i],O);
            }
        }
    }
} 
 
int main()
{
    n=read();
    for(int i=1;i<=n;++i)
    scanf("%lf%lf",&p[i].x,&p[i].y);
    
    random_shuffle(p+1,p+1+n);
    
    mincir();
    printf("%.6lf",R);
    return 0;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"strconv"
)

var (
	readString func() string
	readBytes  func() []byte
	stdout     *bufio.Writer
)

func init() {
	readString, readBytes = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) (func() string, func() []byte) {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	f1 := func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
	f2 := func() []byte {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Bytes()
	}
	return f1, f2
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(readString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(stdout, f, args...)
}

func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(stdout, args...)
}

func eprintln(args ...interface{}) (int, error) {
	return fmt.Fprintln(os.Stderr, args...)
}

func eprintf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(os.Stderr, f, args...)
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

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

func max(a, b int) int {
	if a < b {
		return b
	}
	return a
}

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

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

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

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

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

// readString() string
// readInt() int
// readInt64() int64
// readFloat64() float64

// -----------------------------------------------------------------------------

func main() {
	defer stdout.Flush()
	N := readInt()
	K := readInt()
	S := readBytes()

	var j int
	for j < N && S[j] == '1' {
		j++
	}
	var i, ck int
	ans := j - i
	for j < N {
		for ck < K {
			for j < N && S[j] == '0' {
				j++
			}
			for j < N && S[j] == '1' {
				j++
			}
			ck++
		}
		ans = max(ans, j-i)
		for i < N && S[i] == '1' {
			i++
		}
		for i < N && S[i] == '0' {
			i++
		}
		ck--
	}
	println(ans)
}

// -----------------------------------------------------------------------------


Measured memory_bytes: 896
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <map>
#include <vector>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;++i)
#define ALL(v) v.begin(),v.end()
#define mod 1000000007

int main(){
  double q,h,s,d,n;
  cin >> q >>h >> s >>d;
  cin >> n;
  //ratio
  vector<pair<double,ll> > p(4);
  map<ll,ll>v;
  p[0]=make_pair(q/25,25);
  p[1]=make_pair(h/50,50);
  p[2]=make_pair(s/100,100);
  p[3]=make_pair(d/200,200);
  v[25]=q;
  v[50]=h;
  v[100]=s;
  v[200]=d;
  sort(ALL(p));
  /*
  for(auto it=p.begin();it!=p.end();it++){
    cout << it->second <<":"<< it ->first <<endl;
  }*/
  n*=100;
  ll ans=0;
  //cout << n << endl;
  for(auto it=p.begin();it!=p.end();it++){
    ll res=n/(it->second);
    n-=res*(it->second);
    ans+=res*v[it->second];
  //  cout << n <<endl;
  }
  cout << ans << endl;

}


Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>

using ll = long long int;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

ll dp[1001001][4];

int main(void){
	int n,i,j,k;
	std::cin >> n;
	dp[0][0] = 1ll;
	for(i=0; i<n; ++i){
		for(k=0; k<4; ++k){
			add_mod(dp[i+1][k|1],dp[i][k]);
			for(j=1; j<9; ++j){
				add_mod(dp[i+1][k],dp[i][k]);
			}
			add_mod(dp[i+1][k|2],dp[i][k]);
		}
	}
	std::cout << dp[n][3] << std::endl;
	return 0;
}


Measured memory_bytes: 34772
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		
		if (n/100 == (n%100)%10) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}

Measured memory_bytes: 21716