akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using ull = unsigned long long;

#define MOD 1000000007

int main(void) {
    string S;
    ll current = 0;
    ll count = 0;
    cin >> S;
    for(ll i = 0;i < S.size();i++) {
        if(S[i] == 'W') {
            count += i - current;
            current++;
        }
    }
    cout << count << endl;
    return 0;
}


Measured memory_bytes: 640
import java.util.HashMap;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Scanner cin = new Scanner(System.in);
		HashMap<String, PriorityQueue<Integer>> map = new HashMap<String,PriorityQueue<Integer>>();
		PriorityQueue<String> strs = new PriorityQueue<String>();
		while(cin.hasNext()){
			String str = cin.next();
			int  v = cin.nextInt();
			if(map.containsKey(str)){
				PriorityQueue<Integer> q = map.remove(str);
				q.add(v);
				map.put(str, q);
			}
			else{
				PriorityQueue<Integer> q = new PriorityQueue<Integer>();
				q.add(v);
				map.put(str, q);
				strs.add(str);
			}
		}
		while(!strs.isEmpty()){
			String s = strs.poll();
			PriorityQueue<Integer> ints = map.get(s);
			System.out.println(s);
			while(!ints.isEmpty()){
				System.out.print(ints.poll());
				if(ints.isEmpty()){
					System.out.println();
					break;
				}
				System.out.print(" ");
			}
		}
	}

}

Measured memory_bytes: 12000
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            var N = cin.ReadLong;
            var A = new long[N];
            for (long i = 0; i < N; i++)
            {
                A[i] = cin.ReadLong;
            }
            var MOD = 1000000007;

            var ans = 0L;
            for (int i = 0; i < 64; i++)
            {
                var count = 0L;
                for (long j = 0; j < N; j++)
                {
                    count += ((A[j] >> i) & 1);
                }
                var value = (long)Pow(2, i) % MOD;
                value = (value * count) % MOD;
                value = (value * (N - count)) % MOD;
                ans = (ans + value) % MOD;
            }

            Console.WriteLine(ans);
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); }}
        public int ReadInt { get { return int.Parse(Read); }}
        public long ReadLong { get { return long.Parse(Read); }}
        public double ReadDouble { get { return double.Parse(Read); }}
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret;}
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret;}
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret;}
    }
}


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

#define fr first
#define sc second
#define mk make_pair
#define pb push_back
#define pf push_front
#define pii pair <int ,int>
#define all(s) s.begin (), s.end ()

using namespace std;

const int N = 1e5 + 5;

int n, dp[N], c, k, ar[N], t[N * 4];

void update(int pos, int val, int v = 1, int tl = 1, int tr = n)
{
    if (tl == tr)
    {
        t[v] = val;
        return ;
    }
    int tm = (tl + tr) >> 1;

    if (pos <= tm)
        update(pos, val, v + v, tl , tm);
    else
        update(pos, val, v + v + 1, tm + 1, tr);

    t[v] = min(t[v + v], t[v + v + 1]);
}
int get(int l, int r, int v = 1, int tl = 1, int tr = n)
{
    if (l > r || l > tr || tl > r)
        return 1e9 + 7;

    if (l == tl && r == tr)
        return t[v];

    int tm = (tl + tr) >> 1;

    return min(
               get( l, min(tm, r), v + v, tl , tm),
               get( max(l, tm + 1), r, v + v + 1, tm + 1 , tr)
                );
}
main()
{
    memset(t, 65, sizeof(t));

    cin >> n >> c >> k;

    for (int i = 1; i <= n; i++)
        scanf("%d", &ar[i]);

    sort(ar + 1, ar + n + 1);

    update(1, 0);

    for (int i = 1; i <= n; i++)
    {
        dp[i] = 1e9 + 7;

        int pos = lower_bound( ar + 1, ar + n + 1, ar[i] - k ) - ar;

        pos = max(pos, i - c + 1);

//        cout << pos << endl;

        dp[i] = get(pos, i) + 1;

        update( i + 1, dp[i] );
    }
    cout << dp[n];
}


Measured memory_bytes: 2560
#include<iostream>
#include<vector>
#include<algorithm>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>
#include<climits>
#include<set>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
using namespace std;
typedef pair<int, int> pii;
typedef long long int ll;
typedef pair<ll,ll> pll;
int dx[4] = {1,0,0,-1};
int dy[4] = {0,1,-1,0};
#define MOD 1000000007
#define ARRAY_MAX 305

const ll INF = 1e15;

double dp[ARRAY_MAX][ARRAY_MAX][ARRAY_MAX];

double dfs(int one,int two,int three,int n){

    if(dp[one][two][three] >= 0){
        return dp[one][two][three];
    }
    if(one == 0 && two == 0 && three == 0){
        return 0.0;
    }
    double cnt = 0;
    if(one > 0){
        cnt += dfs(one-1,two,three,n)*one;
    }
    if(two > 0){
        cnt += dfs(one+1,two-1,three,n)*two;
    }
    if(three > 0){
        cnt += dfs(one,two+1,three-1,n)*three;
    }
    cnt += n;
    cnt *= 1.0/(one + two + three);   
    
    return dp[one][two][three] = cnt;
}


int main(){

    ll n;
    cin >> n;
    vector<ll> a(n);
    int one = 0,two = 0,three = 0;
    for(int i = 0;i < n;i++){
        cin >> a[i];
        if(a[i] == 1){
            one++;
        }else if(a[i] == 2){
            two++;
        }else{
            three++;
        }
    }

    memset(dp,-1,sizeof(dp));

    printf("%.12f\n",dfs(one,two,three,n));


    return 0;
}

Measured memory_bytes: 221952
#include<bits/stdc++.h>
using namespace std;
#define  mem(a,x) memset(a,x,sizeof(a));
#define  ft  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define  ll  long long
#define  pi  pair<int,int>
#define  pb  push_back
#define  F   first
#define  S   second
#define  B   begin()
#define  E   end()
const int N=2e5+3;
//string s,p;
//vector<int>v;
//map<int,int>mp;

int main()
{
    ft
    int t,i,j,n,m,l,r;
    cin>>n;
    for(i=0;i<n;i++)
    {
        cout<<"ACL";
    }
    return 0;
}



Measured memory_bytes: 3604
#include <iostream>
#include <cstdlib>

using namespace std;

int main() {
  int n, k, p;
  cin >> n;
  for( int i = 0; i < n; i++ ) {
    cin >> k >> p;
    cout << (k-1)%p+1 << endl;
  }
  return EXIT_SUCCESS;
}

Measured memory_bytes: 1164
#include <stdio.h>
#include <string.h>
 
int main(void){
  char temp, str[1001], re[1001], p[101];
  int i, j, a, b, q;
 
  scanf("%s", str);
  scanf("%d", &q);
  for(i = 0; i < q; i++){
    scanf(" %s%d%d", p, &a, &b);
    if(strcmp(p, "print") == 0){
      for(j = a; j <= b; j++){
    printf("%c", str[j]);
      }
      printf("\n");
    }else if(strcmp(p, "reverse") == 0){
      for(j = 0; a+j < b-j; j++){
    temp = str[a+j];
    str[a+j] = str[b-j];
    str[b-j] = temp;
      }
    }else if(strcmp(p, "replace") == 0){
      scanf(" %s", re);
      for(j = 0; a+j <= b; j++){
    str[a+j] = re[j];
      }
    }
  }
  return 0;
}


Measured memory_bytes: 2108
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;
typedef long long ll;

#define REP(i, n) for(ll i=0;i<(ll)(n);i++)
#define RREP(i, n) for(ll i=(ll)(n-1);i>=0;i--)
#define FOR(i, a, b) for(ll i=(ll)(a); i<=(ll)(b); i++)
#define RFOR(i, a, b) for(ll i=(ll)(a);i>=(ll)(b); i--)
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((ll)(x).size())
#define INF 1000000000000
#define MOD 10000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

signed main()
{
	int N;
	cin >> N;
	ll ans=1;
	ll maxnum = 1000000000000000000;
	bool flag = true;
	REP(i, N){
		ll tmp;
		cin >> tmp;
		if(tmp == 0){
			cout << 0 << endl;
			return 0;
		}
		if(maxnum/tmp<ans){
			flag = false;
		}
		ans*=tmp;
	}
	if(flag){
		cout << ans << endl;
	}else{
		cout << -1 << endl;
	}
}


Measured memory_bytes: 3636
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <tuple>
#include <cassert>
#include <functional>
#include <set>

using namespace std;
typedef long long ll;
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
const int INF = 1<<29;
const ll MOD = 1000000007;
const int MAX = 100000;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
// 法mでのaの逆元を計算
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
//最大公約数
int gcd(int x, int y) { return (x % y)? gcd(y, x % y): y; }
//最小公倍数
int lcm(int x, int y) { return x / gcd(x, y) * y; }


int main(){
    int H,W,N;
    cin >> H >> W >> N;
    int ma = max(H,W);
    int out = N/ma;
    if(N%ma!=0) out++;
    cout << out << endl;
    return 0;
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
#define ll long long

using namespace std;

int n;
int dp[2010][2010];
int inv[2][2010];  //0 belo, 1 crno
int cnt[2][2010][2010];
int seg[2][10010];
const int maxr=2005;
int cntw,cntb;

int toCode(char c)
{
    if(c=='W')
        return 0;
    return 1;
}

void update(int t, int l, int r, int br, int code)
{
    seg[code][t]++;
    if(l==r)
        return;
    int mid=(l+r)/2;
    if(br<=mid) update(2*t,l,mid,br,code);
    else update(2*t+1,mid+1,r,br,code);
}

int sum(int t, int l, int r, int L, int R, int code)
{
    if(l>=L && r<=R)
        return seg[code][t];
    if(L>r || l>R)
        return 0;
    int mid=(l+r)/2;
    int s1=sum(2*t,l,mid,L,R,code);
    int s2=sum(2*t+1,mid+1,r,L,R,code);
    return s1+s2;
}



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

	cin>>n;
	char c;
	int br;
	for(int i=1;i<=2*n;i++)
    {
        cin>>c;
        cin>>br;
        int code=toCode(c);
        //update(1,1,maxr,br,code);
        inv[code][br]=sum(1,1,n,br+1,n,code);
        //cout<<inv[code][br]<<endl;
        for(int i=0;i<n;i++)
            cnt[code][br][i]=sum(1,1,n,i+1,n,(code+1)%2);//,cout<<"/ "<<cnt[code][br][i]<<" ";
        //cout<<"*"<<sum(1,1,n,1,n,1);
        //cout<<endl;
        //cout<<"-"<<br<<" "<<code<<endl;
        update(1,1,n,br,code);
        if(code==0)cntw++;
        else cntb++;
    }
    for(int i=1;i<=n;i++)
        dp[i][0]=dp[i-1][0]+inv[0][i]+cnt[0][i][0];
    for(int i=1;i<=n;i++)
        dp[0][i]=dp[0][i-1]+inv[1][i]+cnt[1][i][0];
    for(int i=1;i<=n;i++)
        for(int j=1;j<=n;j++)
            dp[i][j]=min(dp[i-1][j]+inv[0][i]+cnt[0][i][j], dp[i][j-1]+inv[1][j]+cnt[1][j][i]);
    cout<<dp[n][n]<<endl;

    /*for(int i=0;i<=n;i++)
    {
        for(int j=0;j<=n;j++)
            cout<<dp[i][j]<<" ";
        cout<<endl;
    }*/

	return 0;
}


Measured memory_bytes: 47616
k,a,b = map(int,input().split())
ans = 0
if a+1 < b:
    k -= a-1
    if k%2 == 1:
        ans = k//2 * b + - (k//2 - 1) * a + 1
    else:
        ans = k//2 * b - (k//2 - 1) * a
else:
    ans = k+1
print(ans)

Measured memory_bytes: 9180
#include<bits/stdc++.h>
//#include <ext/pb_ds/;assoc_container.hpp>
//using namespace __gnu_pbds
using namespace std;
 

int main()
{
        //c_p_c();
        string s;
        cin>>s;
        int i=0;
        if(s=="RRR")
            cout<<3<<endl;
        else if(s=="RRS" || s=="SRR")
            cout<<2<<endl;
        else if(s=="SSS")
            cout<<0<<endl;
        else
            cout<<1<<endl;
    return 0;

}

Measured memory_bytes: 3592
using System;
public class Hello{
    public static void Main(){
        int K=int.Parse(Console.ReadLine());
        string input=Console.ReadLine();
        
        if(K<input.Length) {
            Console.WriteLine(input.Substring(0,K)+"...");
        } else
        {
            Console.WriteLine(input);
        }
    }
    
}


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

int main() {
	// your code goes here
	int n,k,i;
	cin>>n>>k;
	double arr[n];
	double a=0,b,t;
	for(i=0;i<k;i++){
	    cin>>arr[i];
	    a+=((arr[i]*(arr[i]+1))/2)/arr[i];
	}
	b=a;
	for(;i<n;i++){
	    cin>>arr[i];
	    a+=(((arr[i]*(arr[i]+1))/2)/arr[i]-((arr[i-k]*(arr[i-k]+1))/2)/arr[i-k]);
	    b=max(b,a);
	}
	cout << fixed << setprecision(10) << b << '\n';
	return 0;
}


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

int main(){
	
	int n, m, x, gate;
	cin >> n >> m >> x;
	int sum1=0, sum2=0;
	for (int i = 0; i<m; i++){
		cin >> gate;
		if (gate < x) sum1++;
		if (gate > x) sum2++;
	}
	cout << min(sum1,sum2);
}	



Measured memory_bytes: 256
//-- In The Name of God --
#include<bits/stdc++.h>
using namespace std;


#define      mod     1e9+7
#define      pai     acos(-1)
#define      ff      first
#define      ss      second
#define      ll      long long
#define      pb      push_back
#define      mp      make_pair
#define      endl    "\n"
#define      fii     freopen("input.txt","r",stdin);
#define      foo     freopen("output.txt","w",stdout);
#define      fast    ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);

const   ll   mx=1e5+100;
ll arr[600][600];
map<pair<ll,ll>,bool>visit;
int main()
{
    fast;
    ll i,j,a,b,c,d,n,m,t;
    cin>>n>>m;
    memset(arr,-1,sizeof(arr));
    for(i=1;i<=n;i++)
    {
        for(j=1;j<=m;j++)
        {
            cin>>arr[i][j];
        }
    }
    vector<pair<pair<ll,ll>,pair<ll,ll> > >vec;
    ll flag=1;
    for(i=1;i<=n;i++)
    {
        if(flag==1)
        {
            for(j=1;j<m;j++)
            {
                if(arr[i][j]&1)
                {
                    if(arr[i][j+1]!=-1)
                    {
                        arr[i][j+1]+=1;
                        vec.pb(mp(mp(i,j),mp(i,j+1)));
                    }
                }
            }
            if(arr[i+1][m]!=-1 && arr[i][m]&1)
            {
                arr[i+1][m]+=1;
                vec.pb(mp(mp(i,j),mp(i+1,j)));
            }
            flag=2;
        }
        else if(flag==2)
        {
            for(j=m;j>1;j--)
            {
                if(arr[i][j]&1)
                {
                    arr[i][j-1]+=1;
                    vec.pb(mp(mp(i,j),mp(i,j-1)));
                }
            }
            if(arr[i+1][1]!=-1 && arr[i][1]&1)
            {
                arr[i+1][1]+=1;
                vec.pb(mp(mp(i,j),mp(i+1,j)));
            }
            flag=1;
        }
    }

    ll cnt=vec.size();
    cout<<cnt<<endl;
    for(auto it:vec)
    {
        a=it.first.first;
        b=it.first.second;
        c=it.second.first;
        d=it.second.second;
        cout<<a<<" "<<b<<" "<<c<<" "<<d<<endl;
    }
    return 0;

}



Measured memory_bytes: 10200
program prob70
    implicit none
    integer :: a(32)
    integer :: k
    a = (/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/)
    read(*,*) k
    write(*,*) a(k)



    stop
contains
end program prob70

Measured memory_bytes: 2852
# -*- coding: utf-8 -*-

import sys
import math
input = sys.stdin.readline

def io_generator():
	return input()

#+++++++++++++++++++

def main(io):
	x,y = map(int, io().split())
	ret = 0
	while x * (2 ** (ret + 1)) <= y:
		ret+=1
	return ret+1

#++++++++++++++++++++

if __name__ == "__main__":
	io= lambda : io_generator()
	print (main(io))

Measured memory_bytes: 3060
#include <cstdio>
#include <string>
#include <iostream>
#include <cctype>
using namespace std;
string shuffle(string a,int h){
   string head=a.substr(0,h);
   string tail=a.substr(h,a.size()-h);
   return tail+head;
}
int main(){
  string str;
  int n,h;
  std::ios::sync_with_stdio(false);
  while(1){
    cin>>str;
    if(str=="-") break;
    cin>>n;
    for(int i=0;i<=n-1;i++){
      cin>>h;
      str=shuffle(str,h);
    }
    cout<<str<<endl;
  }
  return 0;
}

Measured memory_bytes: 1212
package main

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

var sc = bufio.NewScanner(os.Stdin)

func init() {
	const maxWord = (1 << 30)
	buf := []byte{}
	sc.Buffer(buf, maxWord)
	sc.Split(bufio.ScanWords)
}

func input() string {
	sc.Scan()
	return sc.Text()
}

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}

func main() {
	s := input()
	ans := min(strings.Count(s, "0"), strings.Count(s, "1")) * 2
	fmt.Println(ans)
}


Measured memory_bytes: 896
import numpy as np
from itertools import combinations

N, D = map(int, input().split())
X = np.array([list(map(int, input().split())) for i in range(N)])
cnt = 0

for p1, p2 in combinations(X, 2):
    cnt+= (sum((p1-p2)**2)**.5).is_integer()
print(cnt)

Measured memory_bytes: 12500
def main():
    n,m,q=map(int,input().split())
    abcd=[]
    for _ in range(q):
        a,b,c,d=map(int,input().split())
        abcd.append((a,b,c,d))
    pmax=0
    aa=[1]*n
    while True:
        p=0
        for a,b,c,d in abcd:
            if aa[b-1]-aa[a-1]==c:
                p+=d
        if p>pmax:
            pmax=p
        for i in range(1,n+1):
            if aa[-i] < m:
                aa[-i]+=1
                while i>1:
                    aa[-i+1]=aa[-i]
                    i-=1
                break
        else:
            print(pmax)
            return
main()

Measured memory_bytes: 9068
package main

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

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Scan()
	n, _ := strconv.Atoi(sc.Text())
	slice := make([]int, n)
	for i := 1; i <= n; i++ {
		sc.Scan()
		a, _ := strconv.Atoi(sc.Text())
		slice[a-1] = i
	}
	for i := 0; i < n; i++ {
		fmt.Print(slice[i], " ")
	}
	fmt.Println("")
}


Measured memory_bytes: 4992
#include <iostream>
#include <cmath>
#include <algorithm>
#include <climits>
#include <vector>
#include <string>
#include <set>
#include <iomanip>
#define REP(i,n) for (int i=0;i<(n);++i)
using namespace std;

int main(){
    long long a, b, x;
    cin >> a >> b >> x;

    if(a == 0) a = 0;
    else a = (a-1) / x + 1;

    b = b / x + 1;
    cout << b - a << endl;
    return 0;
}


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

using namespace std;
typedef long long ll;
#define int ll

#define REP(i,n) for(ll i=0;i<n;++i)
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const double DINF = std::numeric_limits<double>::infinity();
const int MOD = 1000000007;
#define MAX_N 100010

signed main()
{
    int n, a;
    cin >> n >> a;
    printf("%lld\n", n + 1 - a);
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

const int LENGTH = 20;

void change_str(char *, const char, const  char);

int main(void){
	char str[LENGTH];

	scanf("%19s",str);

	change_str(str, ',', ' ');

	printf("%s\n", str);

	return 0;
}

void change_str(char *p_str, const char before, const  char after){
	int i = 0;

	while (p_str[i] != NULL){
		if (p_str[i] == before){
			p_str[i] = after;
		}
		i++;
	}
}


Measured memory_bytes: 128
N = int(input())
A = list(map(int, input().split()))
C = sum(A)
Z = {}
for n in range(N):
    Z[A[n]] = 0
for n in range(N):
    Z[A[n]] += 1
D = []
Q = int(input())
for q in range(Q):
    x, y = map(int, input().split())
    if x in Z:
        C = C - x*Z[x]
        C = C + y*Z[x]
        D.append(C)
        if y in Z:
            Z[y] += 1*Z[x]
        else:
            Z[y] = Z[x]
        Z.pop(x)
    else:
        D.append(C)
for d in D:
    print(d)


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

int main() {
  
  int N;
  cin >> N;
  vector<int> bipa(N);
  
  for (int i = 0; i < N; i ++) {
    cin >> bipa.at(i);
  }
  
  sort (bipa.begin(), bipa.end());
  reverse (bipa.begin(), bipa.end());
  
  int sum = 0;
  
  for (int i = 0; i < N; i ++) {
    if (i % 2 == 0) {
      sum += bipa.at(i);
    }
    else {
      sum -= bipa.at(i);
    }
  }
  cout << sum << endl;
}


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

int main() {
    int A, B, C, X, Y;
    cin >> A >> B >> C >> X >> Y;
    int D=2*C;
    int min_cost=1000000000;
    for (int i=0; i<=100000; i++){
        int total=D*i+A*max(0,(X-i))+B*max(0,(Y-i));
        min_cost=min(min_cost, total);
    }
    cout << min_cost<< endl;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(100010)
n=int(input())
edge=[]
G=[[] for _ in range(n+1)]
for _ in range(n-1):
    x,y=map(int,input().split())
    edge.append([x,y])
    G[x].append(_)
    G[y].append(_)
k=0
root=0
for i in range(1,n+1):
    if k<len(G[i]):
        root=i
        k=len(G[i])
co=[1 for i in range(n+1)]
vis=[False for i in range(n+1)]
def dfs(node,lastco=-1):
    tmp=lastco
    for v in G[node]:
        if not vis[v]:
            tmp+=1
            co[v]=tmp%k
            vis[v]=True
            if node==edge[v][0]:
                dfs(edge[v][1],co[v])
            else:
                dfs(edge[v][0],co[v])

dfs(root)
print(k)
for i in range(n-1):
    print(co[i]+1)


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

#ifdef _PRINTDEBUG
  #include "lib/printdebug.hpp"
#else
  #define printdebug(...) 1
#endif
#define I_1000000007 (1000000007)
#define I_998244353   (998244353)
#define I_INF             (1<<28)
#define L_INF           (1LL<<60)
#define rep(i, n)      REP(i, 0, (n))
#define repc(i, n)     REPC(i, 0, (n))
#define REP(i, n, m)   for (int i = (int)(n); i <  (int)(m); i++)
#define REPC(i, n, m)  for (int i = (int)(n); i <= (int)(m); i++)
#define REPCM(i, n, m) for (int i = (int)(n); i >= (int)(m); i--)
#define yesno(cond)       YESNO((cond), "Yes", "No")
#define YESNO(cond, a, b) cout << ((cond) ? (a) : (b)) << "\n"
template<class T> inline bool chmin(T& a, const T& b) {
  if (a > b) { a = b; return true; } else return false;
}
template<class T> inline bool chmax(T& a, const T& b) {
  if (a < b) { a = b; return true; } else return false;
}

namespace solver {
  using namespace std;
  using ll = long long;

  int N;

  void init() {
    cin >> N;
  }

  void solve() {
    int n = N % 10;
    if(n == 2 || n == 4 || n == 5 || n == 7 || n == 9) cout << "hon\n";
    else if(n == 0 || n == 1 || n == 6 || n == 8) cout << "pon\n";
    else cout << "bon\n";
  }
}

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

Measured memory_bytes: 3652
n = int(input())
s = input()

ans = []

# いったんリストにする
str_list = list(s)

for j in range(len(str_list)):
  temp = ord(str_list[j])+n
  if temp >= 91:
    temp = temp-26
  ans.append(chr(temp))

# またリストから文字列へ戻す
str_changed = "".join(ans)
print(str_changed)


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

int main(){
    string S;cin>>S;
    if(S[0]==S[1] && S[2]==S[3] && S[0]!=S[2]) cout<<"Yes"<<endl;
    else if(S[0]==S[3] && S[1]==S[2] && S[0]!=S[1]) cout<<"Yes"<<endl;
    else if(S[0]==S[2] && S[1]==S[3] &&S[0]!=S[1]) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

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

using namespace std;

#define ll long long

int gcd(ll a, ll b){
	return (b > 0)? gcd(b, a % b) : a ;
}

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

int main(){
    ll A,B,K;
    ll ans = 1e9;
    cin >> A >> B >> K;
    for(int i =100; i > 0; i--){
        if(A % i == 0 && B % i == 0){
            K--;
            // cout << i << endl;
        }
        if(K == 0){
            cout << i << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 888
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scanf("%d", &n)
	var s string
	fmt.Scanf("%s", &s)
	prevColor := s[0]
	counter := 1
	for i:= 0; i < n; i++ {
		if s[i] != prevColor {
			counter++
			prevColor = s[i]
		}
	}
	fmt.Println(counter)
}


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

int main()
{
    int A1, A2, A3;
    int sum ;
    scanf("%d %d %d",&A1, &A2, &A3);
    sum = A1 + A2 + A3;
    if (sum >= 22)
        printf("bust");
    else
        printf("win");
    return 0;
}

Measured memory_bytes: 128
#include<stdio.h>

int main()
{
    int a, b, i;

    scanf("%d", &a);
    
    for(i = 3; i <=a; i++){
        if(i%3 == 0) printf(" %d", i);
        else {b = i;
              while(b)
                   {if(b%10 == 3) {printf(" %d", i);
                                  break;}
                   else b = b/10;
                   }
              }
    } 
printf("\n");
    return 0;
}



Measured memory_bytes: 1996
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
using namespace std;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = (int)1e9 + 7;

int main() {
    int n, m; cin >> n >> m;
    vector<vector<int>> g(n);
    while (m--) {
        int a, b; cin >> a >> b; a--, b--;
        g[a].emplace_back(b);
    }
    int mn = INF;
    vector<int> res;
    for (int r = 0; r < n; r++) {
        vector<int> d(n, -1), prv(n, -1);
        queue<int> que;
        que.emplace(r); d[r] = 0;
        while (!que.empty()) {
            int u = que.front(); que.pop();
            for (int v: g[u]) {
                if (d[v] == -1) {
                    d[v] = d[u] + 1;
                    prv[v] = u;
                    que.emplace(v);
                } else if (v == r && chmin(mn, d[u] + 1)) {
                    res.clear();
                    int cur = u;
                    while (~cur) res.emplace_back(cur), cur = prv[cur];
                }
            }
        }
    }
    if (res.empty()) {
        cout << -1 << endl;
    } else {
        cout << res.size() << endl;
        for (int v: res) cout << v + 1 << endl;
    }
    return 0;
}

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

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
#define dump(val) cerr << __LINE__ << ":\t" << #val << " = " << (val) << endl

using namespace std;

typedef long long int lli;

template<typename T>
vector<T> make_v(size_t a, T b) {
    return vector<T>(a, b);
}

template<typename... Ts>
auto make_v(size_t a, Ts... ts) {
    return vector<decltype(make_v(ts...))>(a, make_v(ts...));
}

int main() {
    int N;
    cin >> N;
    REP(i, 0, 100) {
        REP(j, 0, 100) {
            if (4 * i + 7 * j == N) {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
using namespace std;
namespace whatever{
	int readu(){
		char ch=getchar();
		while(!isdigit(ch))
			ch=getchar();
		int value=ch-'0';
		ch=getchar();
		while(isdigit(ch)){
			value=value*10+ch-'0';
			ch=getchar();
		}
		return value;
	}
	void writeull(long long n){
		if(n<10)
			putchar(n+'0');
		else{
			writeull(n/10);
			putchar(n%10+'0');
		}
	}
	struct set_type{
		unsigned long long *data;
		int size;
		void clear(){
			memset(data, 0, sizeof(unsigned long long)*size);
		}
		void resize(int k){
			size=(k+63)/64;
			size=(size+3)/4*4;
			data=new unsigned long long [size];
			clear();
		}
		void operator=(const set_type &b){
			assert(size%4==0);
			assert(size==b.size);
			memcpy(data, b.data, sizeof(unsigned long long)*size);
		}
		void operator|=(const set_type &b){
			assert(size%4==0);
			assert(size==b.size);
			for(int i=0; i<size; i+=4){
				data[i]|=b.data[i];
				data[i+1]|=b.data[i+1];
				data[i+2]|=b.data[i+2];
				data[i+3]|=b.data[i+3];
			}
		}
		int count(){
			assert(size%4==0);
			int result=0;
			for(int i=0; i<size; i+=4){
				result+=__builtin_popcountll(data[i]);
				result+=__builtin_popcountll(data[i+1]);
				result+=__builtin_popcountll(data[i+2]);
				result+=__builtin_popcountll(data[i+3]);
			}
			return result;
		}
		void set(unsigned index){
			assert(size%4==0);
			assert(index<size*64);
			data[index/64]|=(1ull<<(index%64));
		}
	};
	void run(){
		int n=readu();
		static char a[500][502];
		for(int i=0; i<n; ++i)
			gets(a[i]);
		static int cnt[10];
		static int index[500][500];
		for(int i=0; i<n; ++i)
			for(int j=0; j<n; ++j)
				if(a[i][j]!='#'){
					assert(isdigit(a[i][j]));
					index[i][j]=cnt[a[i][j]-'0']++;
				}
		static set_type set_data[2][500][10];
		for(int i=0; i<2; ++i)
			for(int j=0; j<n; ++j)
				for(int k=0; k<10; ++k)
					set_data[i][j][k].resize(cnt[k]);
		set_type (*cur_set_data)[10]=set_data[0];
		set_type (*next_set_data)[10]=set_data[1];
		long long result=0;
		cerr<<"clock(): "<<clock()/double(CLOCKS_PER_SEC)<<endl;
		for(int r=n-1; r>=0; --r){
			for(int c=n-1; c>=0; --c){
				if(isdigit(a[r][c])){
					for(int i=0; i<10; ++i){
						next_set_data[c][i]=cur_set_data[c][i];
						if(c<n-1)
							next_set_data[c][i]|=next_set_data[c+1][i];
						result+=(long long)next_set_data[c][i].count()*i*(a[r][c]-'0');
						if(i==a[r][c]-'0')
							next_set_data[c][i].set(index[r][c]);
					}
				}
				else{
					for(int i=0; i<10; ++i)
						next_set_data[c][i].clear();
				}
			}
			swap(cur_set_data, next_set_data);
		}
		cerr<<"clock(): "<<clock()/double(CLOCKS_PER_SEC)<<endl;
		writeull(result);
		putchar('\n');
	}
}
int main(){
	whatever::run();
}

Measured memory_bytes: 32512
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <numeric>
#include <string>
#include <functional>

using namespace std;

int ans;
long long N;

bool include357(long long num){
    bool is3=false;
    bool is5=false;
    bool is7=false;
    while(num!=0){
        if(num%10==3){is3=true;}
        else if(num%10==5){is5=true;}
        else if(num%10==7){is7=true;}
        num/=10;
    }
    return is3&&is5&&is7;
}

long long powll(long long x,int n){
    long long ret=1;
    for(int i=0;i<n;i++){
        ret*=x;
    }
    return ret;
}

void solve(long long num,int count){
    if(num>N){return;}

    if(include357(num)){ans++;}
    solve(num+3*powll(10,count),count+1);
    solve(num+5*powll(10,count),count+1);
    solve(num+7*powll(10,count),count+1);
    return;
}

int main(void){
    
    cin>>N;

    ans=0;

    solve(0,0);

    cout<<ans<<endl;
    
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
using namespace std;
const static int MAX_N = 12;
static int num[12], left[12], right[12];
static bool ret = false;
void dfs(int cur, int n, int num[], int left[],int l, int right[],int r) {
	if (cur == n) {
		for (int i = 0; i < l-1; i++) {
			if (left[i] > left[i + 1])
				return;
		}
		for (int j = 0; j < r - 1; j++) {
			if (right[j] > right[j + 1])
				return;
		}
		ret = true;
	} else {
		left[l] = num[cur];
		dfs(cur + 1, n, num, left, l + 1, right, r);
		right[r] = num[cur];
		dfs(cur + 1, n, num,left, l, right, r + 1);
	}
}

int main() {
	int n;
	for (scanf("%d ", &n); n; n--) {
		for (int i = 0; i < 10; i++) {
			scanf("%d", &num[i]);
		}
		dfs(0, 10, num, left, 0, right, 0);
		if (ret)printf("YES\n");
		else printf("NO\n");
		ret = false;
	}
}

Measured memory_bytes: 2548
import std.stdio;
import std.string;
import std.array;
import std.range;
import std.algorithm;
import std.conv;
import std.typecons;

string disp(bool result){
    if(result){
        return "Yay!";
    }else{
        return ":(";
    }
}

bool solve(int a, int b){
    if(a <= 8 && b <= 8){
        return true;
    }else{
        return false;
    }
}

void main(){
    auto ab = readln().chomp().split().map!(to!int).array();
    auto a = ab[0];
    auto b = ab[1];
    solve(a, b).disp().writeln();
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <stdio.h>
#include <cmath>
#include <set>
#include <map>
using namespace std;

vector<vector<int> >g;
int n,m,q;

vector<bool>visited;
vector<int>color;
void dfs(int s){
    for(int i=0;i<g[s].size();i++){
        if(color[g[s][i]]==-1){
            color[g[s][i]]=color[s];
            dfs(g[s][i]);
        }
    }
}
int main() {
    cin>>n>>m;
    g.resize(n);
    color.resize(n,-1);
    for(int i=0;i<m;i++){
        int s,t;
        cin>>s>>t;
        g[s].push_back(t);
        g[t].push_back(s);
    }
    for(int i=0;i<n;i++){
        if(color[i]==-1){
            color[i]=i;
            dfs(i);
        }
    }
    cin>>q;
    for(int i=0;i<q;i++){
        int s,t;
        cin>>s>>t;
        cout<<(color[s]==color[t]?"yes":"no")<<endl;
    }
    return 0;
}

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

int main(void)
{
	char name[20];
	int bef,aft;

	for(int i = 1; i <= 9; i++){
		cin >> name >> bef >> aft;
		cout << name << ' ' << bef+aft << ' ' << bef*200+aft*300 << endl;
	}

	return 0;
}

Measured memory_bytes: 1164
#include<bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,char> P;
int partition(P* A,int p,int r){
  int x=A[r].first;
  int i=p-1;
  for(int j=p;j<r;j++){
    if(A[j].first<=x){
      i++;
      swap(A[i],A[j]);
    }
  }
  swap(A[i+1],A[r]);
  return i+1;
}
void quicksort(P* A,int p,int r){
  if(p<r){
    int q=partition(A,p,r);
    quicksort(A,p,q-1);
    quicksort(A,q+1,r);
  }
}
signed main(){
  int n;
  cin>>n;
  P A[n];
  for(int i=0;i<n;i++)cin>>A[i].second>>A[i].first;
  map<int,string> m1,m2;
  for(int i=0;i<n;i++)m1[A[i].first]+=A[i].second;
  quicksort(A,0,n-1);
  for(int i=0;i<n;i++)m2[A[i].first]+=A[i].second;
  bool flag=1;
  for(int i=0;i<n;i++)flag&=m1[A[i].first]==m2[A[i].first];
  if(flag)cout<<"Stable"<<endl;
  else cout<<"Not stable"<<endl;
  for(int i=0;i<n;i++)cout<<A[i].second<<" "<<A[i].first<<endl;
  return 0;
}



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

int main()
{
    int n;
    cin>>n;
    int a,b,c;
    if(n>=100)
    {
        a = n/100;
        n -= 100*a;
        b = n/10;
        n -= 10*b;
        c = n;
    }else if(n>=10)
    {
        b = n/10;
        n -= b*10;
        c = n;
    }else{
        c = n;
    }
    if(c == 3)
    {
        cout<<"bon"<<endl;
    }else if(c == 1||c==6 || c==0 ||c==8)
    {
        cout<<"pon"<<endl;
    }else{
        cout<<"hon"<<endl;
    }
}

Measured memory_bytes: 3632
#include <iostream>
#include <vector>
// #include <algorithm>
#include <stdio.h>
#include <string>

int main(){
	int n, k;
	std::string s;
	std::cin >> n >> k >> s;
	for (int i = 0; i < n; ++i) {
		if (i+1==k) s[i] += -'A' + 'a';
	}
	std::cout << s << std::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 < (n); ++i)
#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)
#define INF 1e9
// constexpr ll INF = 1LL << 60;

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

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

int main(){
  int N;
  ll M;
  cin >> N >> M;
  vector<ll> a(N);
  ll maxa = 0;
  REP(i, N){
    cin >> a[i];
    maxa = max(a[i], maxa);
  }
  ll l = 1, g = a[0];
  REP(i, N){
    l = lcm(a[i], l);
    g = gcd(a[i], g);
  }
  l/=2;
  g/=2;
  ll ans = (M/l+1) / 2;
  if((l/g) % 2 ==0){
    ans = 0;
  }
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define FOR(i,a,b) for(int i=(a); i<=(b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define chmin(a,b) if((a)>(b)) (a)=(b);
#define chmax(a,b) if((a)<(b)) (a)=(b);
#define vi vector<int>
#define pii pair<int,int>
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define pb push_back
#define pf push_front
int gcd(int a,int b){/*a>=0,b>=0,￢(a=b=0)*/
  while(min(a,b)>0){if(a<b)swap(a,b);a%=b;}return max(a,b);
}
int dx[]={0,1,0,-1,1,-1,-1,1};
int dy[]={1,0,-1,0,1,1,-1,-1};
const int MOD = 1e9+7;
const int INF = 1e18+10;

/*----------------------------------------------*/
int n;
vi a(21),ans(2004,0);

void dfs(int i,int sum){
  if(i==n) {
    ans[sum]=1;
    return;
  }
  dfs(i+1,sum);
  dfs(i+1,sum+a[i]);
}

signed main(){
  cin>>n;
  rep(i,n) cin>>a[i];
  
  dfs(0,0);
  
  int q;cin>>q;
  rep(i,q){
    int m;cin>>m;
    if(ans[m]>0) cout<<"yes"<<endl;
    else cout<<"no"<<endl;
  }
  return 0;
}



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

int main(){
 	string n;
	cin >> n;
 	for(int i =0;i<3;i++)
		if(n[i] == '1')
          n[i]='9';
  		else
          n[i]='1';
	
	cout << n << endl;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int[] weight = new int[n];
        for (int i = 0; i < n; i++) {
            weight[i] = Integer.parseInt(sc.next());
        }
        int min = Integer.MAX_VALUE;
        for (int i = 0; i < n - 1; i++) {
            int left_sum = 0;
            int right_sum = 0;
            for (int j = 0; j <= i; j++) {
                left_sum += weight[j];
            }
            for (int j = i + 1; j < n; j++) {
                right_sum += weight[j];
            }
            if (min > Math.abs(left_sum - right_sum)) {
                min = Math.abs(left_sum - right_sum);
            }
        }
        System.out.println(min);
    }
}

Measured memory_bytes: 21844
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int ans = 0;
    int tmpAns = 0;
    char[] s = sc.nextLine().toCharArray();
    for (int cnt = 0; cnt < 3; cnt++) {
      if (s[cnt] == 'R') {
        tmpAns++;
      }
      if (s[cnt] == 'S' || cnt == 2) {
        ans = Math.max(tmpAns, ans);
        tmpAns = 0;
      }
    }
    System.out.println(ans + "");
    sc.close();
  }
}


Measured memory_bytes: 38584
// Problem : Divide them all
// Contest : CodeChef - Code Invicta
// URL : https://www.codechef.com/GHC32020/problems/MOON
// Memory Limit : 256 MB
// Time Limit : 1000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)
 
 
 
 
#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define pb push_back
#define vec vector<int>
#define fo(i, n) for (int i = 0; i < n; i++)
#define foo(i, a, b) for (int i = a; i < b; i++)
#define mp make_pair
#define deb(x) cout << #x << " --> " << x << endl;
 
#define deb1a(v)                  \
    cout << #v << "--->" << endl; \
    for (auto it : v)             \
    {                             \
        cout << it << " ";        \
    }                             \
    cout << endl;
#define deb2a(v)                  \
    cout << #v << "--->" << endl; \
    for (auto it : v)             \
    {                             \
        for (auto it1 : it)       \
        {                         \
            cout << it1 << " ";   \
        }                         \
        cout << endl;             \
    }
#define mod 998244353
#define so(v) sort(v.begin(),v.end())
#define fi first
#define se second
int power(int x, unsigned int y, int p){ int res = 1;x = x % p;while (y > 0)  { if (y & 1)res = (res*x) % p;y = y>>1;  x = (x*x)% p;} return res;}


int32_t main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s;
    cin>>s;
    if(s[2]==s[3]&&s[4]==s[5])
        cout << "Yes";
        else
        {
            cout << "No";
        }
        
} 

Measured memory_bytes: 256
using System;
 using System.Linq;

namespace Sample
{
  class Sample
  {
    static void Main(string[] args)
    {
    string S=Console.ReadLine();
      int s2=int.Parse(S.Replace("/",""));
    if(s2<=20190430){
      Console.WriteLine("Heisei");
    }else{
      Console.WriteLine("TBD");
    }
    }
  }

}

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

map<ll,ll>l2;
map<ll,ll>l3;

int main()
{
    ll s,y=0,x=0,n;
    cin>>n;s=n;
    ll l1[n+1];
    for(int i=1;i<=n;i++){
        cin>>l1[i];
    }
    sort(l1+1,l1+n+1);
//    if(y==1&&l1[1]==l1[2]&&2<=n){cout<<0<<endl;return 0;}
//    else if(y==1){cout<<1<<endl;return 0;}
    for(int i=1;i<=n;i++){
        //cout<<l2[l1[i]]<<endl;
        if(l2[l1[i]]){
            s-=1;continue;
        }
        if(l1[i]==l1[i+1]&&i+1<=n)s-=1;
        ll num=l1[i];
        for(int j=num;j<=l1[n];j+=num){
            //cout<<j<<" "<<num<<endl;
            l2[j]=1;
        }
    }
    cout<<s<<endl;

    return 0;
}


Measured memory_bytes: 67392
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <string>

using namespace std;
typedef long long ll;
string S;
int Q;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setprecision(10) << fixed;
    cin >> S >> Q;
    string pre, suf;
    int inv = 0;
    for(int i = 0; i < Q; i++){
        int t;
        cin >> t;
        if(t == 1){
            inv++;
        }else{
            int f;
            char c;
            cin >> f >> c;
            if(f == 1){
                if(inv%2 == 0){
                    pre += c;
                }else{
                    suf += c;
                }
            }else{
                if(inv%2 == 0){
                    suf += c;
                }else{
                    pre += c;
                }
            }
        }
    }
    string ans;
    reverse(pre.begin(), pre.end());
    ans += pre;
    ans += S;
    ans += suf;
    if(inv%2 == 0){
        cout << ans << endl;
    }else{
        reverse(ans.begin(), ans.end());
        cout << ans << endl;
    }
}

Measured memory_bytes: 1300
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 1000000000000000002

long long get(vector<long long> A,int l){
	long long ret = 0;
	for(int i=l;i<A.size();i+=2)ret += max(0LL,A[i]);
	return ret;
}

int main(){
	
	int N;
	cin>>N;
	bool f = false;
	vector<long long> A(N);
	for(int i=0;i<N;i++){
		cin>>A[i];
		if(A[i]>=0)f=true;
	}
	
	long long maxi = -Inf;
	int p;
	if(get(A,0)>get(A,1))p=0;
	else p=1;
	
	vector<int> ans;
	if(A.size()%2==p){
		ans.push_back(A.size());
		A.pop_back();
	}
	if(p==1){
		ans.push_back(1);
		A.erase(A.begin());
		p=0;
	}
	
	if(f){
		maxi = get(A,0);//max(get(A,0),get(A,1));
		
		while(A.back()<0){
			ans.push_back(A.size());
			A.pop_back();
			ans.push_back(A.size());
			A.pop_back();
		}
		
		while(A[0]<0){
			ans.push_back(1);
			A.erase(A.begin());
			ans.push_back(1);
			A.erase(A.begin());
		}
		
		
		while(A.size()!=0){
			bool x = false;
			for(int i=1;i+1<A.size();i++){
				if(i%2!=p)continue;
				if(A[i]<0){
					x=true;
					ans.push_back(i+1);
					A[i] = A[i-1]+A[i+1];
					A.erase(A.begin()+i+1);
					A.erase(A.begin()+i-1);
					break;
				}
			}

			if(x)continue;

			if(!x){
				while(true){
					x=false;
					for(int i=1;i+1<A.size();i++){
						if(i%2!=p){
							x=true;
							ans.push_back(i+1);
							A[i] = A[i-1]+A[i+1];
							A.erase(A.begin()+i+1);
							A.erase(A.begin()+i-1);
							break;
						}
					}
					if(!x)break;
				}
				
				
				//cout<<maxi<<endl;
				int ind = -1;
				for(int i=0;i<A.size();i++){
					if(i%2==p&&maxi==A[i]){
						ind=i;
						break;
					}
				}
				
				while(A.size()!=ind+1){
					ans.push_back(A.size());
					A.pop_back();
				}
				while(A.size()!=1){
					ans.push_back(1);
					A.erase(A.begin());
				}

				break;
			}
		}
	}
	else{
		maxi = -Inf;
		int ind = -1;
		for(int i=0;i<N;i++){
			if(A[i]>maxi){
				maxi=A[i];
				ind=i;
			}
		}
		
		while(A.size()!=ind+1){
			ans.push_back(A.size());
			A.pop_back();
		}
		while(A.size()!=1){
			ans.push_back(1);
			A.erase(A.begin());
		}
	}
	
	cout<<maxi<<endl;
	cout<<ans.size()<<endl;
	for(int i=0;i<ans.size();i++)cout<<ans[i]<<endl;

	return 0;
}

Measured memory_bytes: 3656
//code by lynmisakura.wish to be accepted!
#include<bits/stdc++.h>
using namespace std;

typedef long long ll;

int main(void){
    int N;scanf("%d",&N);
    vector<ll> d(N);
    ll sa = 0,sb = 0;
    vector<ll> a(N);for(int i = 0;i < N;i++)scanf("%lld",&a[i]);
    vector<ll> b(N);for(int i = 0;i < N;i++)scanf("%lld",&b[i]);
    for (int i = 0; i < N; ++i)
    {
        sa += a[i],sb += b[i];
        d[i] = a[i] - b[i];
    }
    if(sa < sb){
        cout << -1 << endl;return 0;
    }
    sort(d.begin(),d.end());
    
    ll sum = 0;
    int ans = 0;
    for (int i = 0; i < N; ++i)
    {
        if(d[i] < 0){ans++;sum -= d[i];}
    }
    reverse(d.begin(),d.end());
//    int ans = 0;
    for (int i = 0; i < N; ++i)
    {
        if(sum <= 0)break;
        else{
            ans++;
            sum -= d[i];
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 2560
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60


def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


def lcm(a, b):
    return a * b // gcd(a, b)


def main():
    N, M = map(int, readline().split())
    A = list(set(map(int, readline().split())))

    B = A[::]
    while not any(b % 2 for b in B):
        B = [b // 2 for b in B]

    if not all(b % 2 for b in B):
        print(0)
        return

    semi_lcm = 1
    for a in A:
        semi_lcm = lcm(semi_lcm, a // 2)
        if semi_lcm > M:
            print(0)
            return

    print((M // semi_lcm + 1) // 2)
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 11312
func main() {
  let k = Int(readLine()!)!
  let ab = readLine()!.split(separator: " ").map { Int($0)! }
  let (a, b) = (ab[0], ab[1])

  for i in a...b {
    if i % k == 0 {
      print("OK")
      return
    }
  }

  print("NG")
  return
}

main()


Measured memory_bytes: 8216