akhauriyash/Code-Regression huggingface dataset:
a1=list(map(int,input().split()))
a2=list(map(int,input().split()))
a3=list(map(int,input().split()))
N=int(input())
b=[]
for i in range(N):
    c=int(input())
    b.append(c)
flag=False
tmp1=0
tmp2=0
tmp3=0
for i in range(3):
    for j in range(N):
        if b[j]==a1[i]:
            tmp1+=1
        if b[j]==a2[i]:
            tmp2+=1
        if b[j]==a3[i]:
            tmp3+=1
if tmp1==3:
    flag=True
if tmp2==3:
    flag=True
if tmp3==3:
    flag=True
tmp=0
for i in range(3):
    tmp=0
    for j in range(N):
        if b[j]==a1[i]:
            tmp+=1
        if b[j]==a2[i]:
            tmp+=1
        if b[j]==a3[i]:
            tmp+=1
    if tmp==3:
        flag=True
tmp=0
for i in range(N):
    if b[i]==a1[0]:
        tmp+=1
    if b[i]==a2[1]:
        tmp+=1
    if b[i]==a3[2]:
        tmp+=1
if tmp==3:
    flag=True
tmp=0
for i in range(N):
    if b[i]==a1[2]:
        tmp+=1
    if b[i]==a2[1]:
        tmp+=1
    if b[i]==a3[0]:
        tmp+=1
if tmp==3:
    flag=True
if flag:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 38384
from sys import stdin

N = int(stdin.readline().rstrip())
A = [int(x) for x in stdin.readline().rstrip().split()]
A.sort()
res = 1
if 0 in A:
  res = 0
else:
  for i in range(N):
    res *= A[i]
    if res > 10**18:
      res = -1
      break

print(res)

Measured memory_bytes: 21784
#include <iostream>
#include <iomanip>
#include <bits/stdc++.h>
#include <vector>
#include <iterator>
#include <string>
#define pan(i,n) for(int i=0;i<n;i++)
#define ll long long int
#define vi vector<int>
#define pb push_back
using namespace std;
 

int main(){
    int n;
    cin>>n;
    int r[n]{0};
    pan(i,n){
        int a;
        cin>>a;
        // cout<<a;
        r[a-1]=i+1;
    }
    pan(i,n) cout<<r[i]<<" ";
}


Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mp make_pair
#define pb push_back
#define x first
#define y second
#define pii pair<int, int>
#define p3i pair<pii, int>
#define pll pair<ll, ll>
#define p3l pair<pll, ll>
#define vi vector<int>
#define vpii vector<pii>
#define vp3i vector<p3i>
#define vpll vector<pll>
#define vp3l vector<p3l>
#define lseg L, (L+R)/2, N*2+1
#define rseg (L+R)/2+1, R, N*2+2
#define ub upper_bound
#define lb lower_bound
#define pq priority_queue
#define MN 1000000007
#define fox(k, x) for (int k=0; k<x; ++k)
#define fox1(k, x) for (int k=1; k<=x; ++k)
#define foxr(k, x) for (int k=x-1; k>=0; --k)
#define fox1r(k, x) for (int k=x; k>0; --k)
#define ms multiset
#define flood(x) memset(x, 0x3f3f3f3f, sizeof x)
#define drain(x) memset(x, 0, sizeof x)
#define rng() ((rand() << 14)+rand())
#define scan(X) do{while((X=getchar())<'0'); for(X-='0'; '0'<=(_=getchar()); X=(X<<3)+(X<<1)+_-'0');}while(0)
char _;
#define pi 3.14159265358979323846

int n, m, dp[200005], psa[200005];
int sum, ans=0;
string s;
int get(int N, int L){
  int hi = N;
  int lo = hi - L - 1;
  //cout << N << ' ' << L << ' ' <<lo << ' ' << hi << endl;
  int res = psa[hi];
  if (lo >= 0) res -= psa[lo];
  return res%MN;
}
int32_t main(){
  cin >> n >> m >> s;
  int pref = 0, lim, c = 0;
  fox(l, m){
    if (s[l] != s[0]) break;
    pref++;
  }
  if (pref % 2 == 1)
    lim = pref;
  else
    lim = pref + 1;
  if (pref == m){
    dp[0] = 1;
    dp[1] = 1;
    for(int l = 2; l <= n; ++l){
      dp[l] = (dp[l-1]+dp[l-2])%MN;
    }
    cout << (dp[n-2] + dp[n] + 0LL + MN)%MN;
    return 0;
  }
  if (n%2 == 1){
    if (pref != m){
      printf("0\n");
      return 0;
    }
  }
  fox(l, m){
    if (s[l]!=s[0]){
      if (c%2 == 1){
        lim = min(lim, c);
      }
      c=0;
    } else {
      c++;
    }
  }
  n/=2;
  lim /= 2;
  lim = min(lim, n-1);
  //cout << lim << endl;
  dp[0]= 1;
  int p=0;
  sum = 1;
  psa[0] = 1;
  fox1(l, n){
    while(l-p-1 > lim){
      sum = (sum - dp[p]) % MN;
      ++p;
    }
    dp[l] = sum;
    psa[l] = (psa[l-1] + dp[l]) % MN;
    sum = (sum + dp[l]) % MN;
    //cout << dp[l] << ' ';
  }
  fox(l, lim+1){
    //starting component
    ans = (ans + get(n-1-l, lim-l))%MN;
  }
  if (ans < 0) ans += MN;
  cout << ans*2%MN;
  return 0;
}


Measured memory_bytes: 1412
#import numpy as np
#from numpy import*
#from scipy.sparse.csgraph import shortest_path #shortest_path(csgraph=graph) # dijkstra# floyd_warshall
#from scipy.sparse import csr_matrix

from collections import* #defaultdict Counter deque appendleft
from fractions import gcd
from functools import* #reduce
from itertools import* #permutations("AB",repeat=2) combinations("AB",2) product("AB",2) groupby accumulate
from operator import mul,itemgetter
from bisect import* #bisect_left bisect_right
from heapq import* #heapify heappop heappushpop
from math import factorial,pi
from copy import deepcopy
import sys
sys.setrecursionlimit(10**8)
#input=sys.stdin.readline  #危険！基本オフにしろ！
 
def main():
    s=int(input())
    t=input()
    if s>=3200:
        print(t)
    else:
        print("red")
if __name__ == '__main__':
    main()

Measured memory_bytes: 5608
#include <stdio.h>

int dp[45];

int fib(int n)
{
    if( n == 0 || n == 1 ){
        dp[n] = 1;
    } else if( dp[n] == -1 ){
        dp[n] = fib(n-1) + fib(n-2);
    }

    return dp[n];
}

int main()
{
    int i;
    for( i = 0; i < 45; ++i ) dp[i] = -1;

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

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

    return 0;
}

Measured memory_bytes: 596
#include <cstdio>
#include <iostream>
#include <string>
#include <algorithm>
#include <cstring>
#include <queue>
#include <utility>
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <deque>

using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
const int MAXN = 234567;
const LL INF = LL(1e18);
LL A[MAXN], presum[MAXN];

LL cal(LL mx1, LL mx2, LL mn1, LL mn2) {
   LL cur_max = max(mx1, mx2), cur_min = min(mn1, mn2);
   // printf("sum = %lld\n", cur_max - cur_min);
   return cur_max - cur_min;
}

int main() {
    int N;
    while (~scanf("%d", &N)) {
          presum[0] = 0;
          for (int i = 1; i <= N; i++) {
              scanf("%lld", &A[i]);
              presum[i] = presum[i - 1] + A[i];
          }
          LL ans = INF;
          for (int i = 2; i <= N - 2; i++) {
              LL sum1 = presum[i] / 2;
              LL sum2 = (presum[N] - presum[i]) / 2 + (((presum[N] - presum[i]) % 2) ? 1 : 0);
              auto mid1 = lower_bound(presum + 1, presum + i + 1, sum1) - presum;
              auto mid2 = lower_bound(presum + i + 1, presum + 1 + N, sum2 + presum[i]) - presum;
              LL MAX1 = presum[mid1], MIN1 = presum[i] - presum[mid1];
              LL MAX2 = presum[mid2] - presum[i], MIN2 = presum[N] - presum[mid2];
              LL MAX3 = INF, MIN3 = 0, MAX4 = INF, MIN4 = 0;
              if (mid1 > 1) {
                 MAX3 = MIN1 + A[mid1];
                 MIN3 = MAX1 - A[mid1];
              }
              if (mid2 - i > 1) {
                 MAX4 = MIN2 + A[mid2];
                 MIN4 = MAX2 - A[mid2];
              }
              // printf("i = %d MAX1 = %lld, MIN1 = %lld MAX2 = %lld MIN2 = %lld\n", i, MAX1, MIN1, MAX2, MAX2);
              // printf("MAX3 = %lld MIN3 = %lld MAX4 = %lld MIN4 = %lld\n", MAX3, MIN3, MAX4, MIN4);
              // printf("sum1 = %lld sum2 = %lld mid1 = %lld mid2 = %lld\n", sum1, sum2, mid1, mid2);
              if (mid1 != i && mid2 != N) {
                 // printf("FST = ");
                 ans = min(ans, cal(MAX1, MAX2, MIN1, MIN2));
              }
              if (mid1 != i) {
                 // printf("SEC = ");
                 ans = min(ans, cal(MAX1, MAX4, MIN1, MIN4));
              }
              if (mid2 != N) {
                 // printf("THR = ");
                 ans = min(ans, cal(MAX3, MAX2, MIN3, MIN2));
              }
              // printf("LST = ");
              ans = min(ans, cal(MAX3, MAX4, MIN3, MIN4));
          }
          printf("%lld\n", ans);
    }
    return 0;
}


Measured memory_bytes: 3328
num = gets.to_i
ary = gets.split.map(&:to_i)

puts ary.join(" ")

for i in 1..num-1

  compared = i - 1

  while compared >= 0 && ary[compared] > ary[i]

    ary[compared], ary[i] = ary[i], ary[compared]
    i -= 1
    compared -= 1
  end

  puts ary.join(" ")
end



Measured memory_bytes: 6888
function main(input) {
  var map = {};
  input[0].split(" ").forEach(v=>{
    map[v] = (map[v]||0)+1;
  });
  console.log(Object.keys(map).length == 2?"Yes":"No")

}

main(require('fs').readFileSync('/dev/stdin', 'utf8').split("\n"))


Measured memory_bytes: 7372
#include <bits/stdc++.h>
#define f first
#define s second
#define fore(i,a,b) for(int i = (a), ThxMK = (b); i < ThxMK; ++i)
#define pb push_back
#define all(s) begin(s), end(s)
#define _ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define sz(s) int(s.size())
#define ENDL '\n'
using namespace std;
typedef long double ld;
typedef long long lli;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<lli> vl;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
#define deb(x) cout << #x": " << (x) << endl;

const int N = 1e3;
const lli INF = 1e18;
const lli MOD = 200003;

vi m;
vi primes(1,2);
vector<vector<ld>>nk;
void sieve(){
	m = vi(N+1,0);
	for(int i = 4; i<N; i+=2)m[i]=1;
	for(int i = 3; i*i<=N; i+=2)if(!m[i])for(int j = i*i; j<N; j+=i)m[j]=1;
	for(int i = 3; i<N; i+=2)if(!m[i])primes.pb(i);
}

void pascal(){
	nk =vector<vector<ld>>(N,vector<ld>(N,0.0));
	fore(i,0,N)nk[i][0]=nk[i][i]=1.0;
	fore(i,1,N)fore(j,1,i)nk[i][j]=nk[i-1][j-1]+nk[i-1][j];
}

lli gcd(lli a, lli b){return (b?gcd(b,a%b):a);}

lli lcm(lli a, lli b){
	if(a<b)swap(a,b);
	lli c = gcd(a,b);
	a/=c;
	return a*b;
}

int popcount(lli x) { return __builtin_popcountll(x); }

lli poww(lli a, lli b){
	lli res =1;
	while(b){
		if(b&1) res = res * a;
		a = a*a;
		b/=2;
	}
	return res;
}

lli powm(lli a, lli b){
	lli res =1;
	while(b){
		if(b&1) res = (res * a)%MOD;
		a = (a*a)%MOD;
		b/=2;
	}
	return res;
}

bool isPrime(lli x){
	if(x==1)return 0;
	for(auto i:primes){
		if(i*i>x)return 1;
		if(x%i==0)return 0;
	}
	return 1;
}

// ---- コーディングはここから！ ('-')7

int main(){_
	int n; cin>>n;
	map<lli,int>v; fore(i,0,n){lli a;cin>>a; v[a]++;}
	vl r; for(auto &[i,j]:v)r.pb(i);
	n = sz(r);
	lli res =0;
	fore(i,0,n)fore(j,i+1,n)fore(k,j+1,n){
		if(r[i]+r[j]>r[k] and r[i]+r[k]>r[j] and r[k]+r[j]>r[i])res+=v[r[i]]*v[r[j]]*v[r[k]];
	}
	cout<<res<<ENDL;


}


Measured memory_bytes: 3644
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<map>
#include<queue>
#include<deque>
using namespace std;
typedef long long int LL;
typedef pair<int,int> P;
typedef pair<int,pair<int,int> > PP;
typedef pair<LL,int> LP;
const int INF=1<<30;


void array_show(int *a,int n){
	for(int i=0;i<n;i++)printf("%d%c",a[i],(i!=n-1?' ':'\n'));
}
void array_show(LL *a,int n){
	for(int i=0;i<n;i++)printf("%lld%c",a[i],(i!=n-1?' ':'\n'));
}

int t[100005];
int bef[100005];
bool used[100005];
vector<int> path_rev[100005];
vector<int> v1;
vector<P> v2;

void check(int a,int m){
	v1.push_back(a);
	if(v1.size()>=m){
		bef[a]=v1[v1.size()-m];
	}
	v2.push_back(make_pair(v1.size()-1,a));
	for(int i=0;i<path_rev[a].size();i++){
		check(path_rev[a][i],m);
	}
	v1.pop_back();
}

void set_used(int a){
	if(used[a])return;
	used[a]=true;
	for(int i=0;i<path_rev[a].size();i++){
		set_used(path_rev[a][i]);
	}
}

int main(){
	int n,m;
	int i,j,k;
	int a,b,c;
	int s=0;
	cin>>n>>m;
	memset(t,-1,sizeof(t));
	for(i=0;i<n;i++){
		cin>>t[i];
		t[i]--;
		if(i==0){
			if(t[i]!=0)s++;
			continue;
		}
		path_rev[t[i]].push_back(i);
	}
	check(0,m);
	sort(v2.rbegin(),v2.rend());
	for(i=0;i<n;i++){
		if(v2[i].first<=m)break;
		j=v2[i].second;
		if(used[j])continue;
		s++;
		set_used(bef[j]);
	}
	cout<<s<<endl;
	return 0;
}


Measured memory_bytes: 14112
// fahadmd16(IIEST Shibpur)
#include<bits/stdc++.h>
using namespace std;

#define ll                                      long long
#define pb                                      push_back
#define pf                                      push_front
#define eb                                      emplace_back
#define mp                                      make_pair
#define ff                                      first
#define ss                                      second
#define db                                      double
#define pll                                     pair<ll, ll>
#define ALL(a)                                  (a).begin(),(a).end()
#define endl                                    "\n"

#define forn(i, n) for (ll i = 0; i < n; i++)
#define forn1(i, n) for (ll i = 1; i < n; i++)
#define ford(i, n) for (ll i = n - 1; i >= 0; i--)
#define ford1(i, n) for (ll i = n - 1; i >= 1; i--)
#define forab(i, a, b) for(ll i = a; i < b; i++)
#define forabd(i, a, b) for(ll i = a; i >= b; i--)
#define eps 1e-10

#define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)


#define IOS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

#define trace1(x)                cout<<#x<<": "<<x<<endl
#define trace2(x, y)             cout<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cout<<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
#define tracen( x , n ){ cout<<(#x)<<":";for(int i=0;i<n;i++)cout<<(#x)<<"["<<i<<"]:"<< x[i] << "    "; cout<<endl;}
#define tracenm( x , n , m ){ cout<<(#x)<<endl;for(int i=0;i<n;i++){ cout<<"Row #"<<i<<":"; for(int j=0;j<m;j++) cout<<x[i][j]<<"     "; cout << endl;}}
#define trace(v){ cout<<#v<<": ";for(auto it=v.begin();it!=v.end();it++)cout<<*it<<" ";cout<<endl;}
using namespace std;



const ll sz = 8000;
const ll mod = 1e9 + 7;
const db PI = acos(-1);



typedef vector<ll> VL;
typedef vector<pll > VLL;
typedef vector<vector<ll> > VVL;



ll power(ll n, ll k, ll m) {
	ll ans = 1;
	while (k) {
		if (k & 1)ans = (ans * n) % m;
		k /= 2;
		n = (n * n) % m;
	}
	return ans;
}

void solver() {
	string s, t; cin >> s >> t;
	int n = s.size();
	forn(i, n) {
		if (s[i] != t[i]) {cout << "No\n"; return;}
	}
	cout << "Yes\n";
}


int main() {
// #ifndef ONLINE_JUDGE
// 	freopen("input.txt", "r", stdin);
// 	freopen("output.txt", "w", stdout);
// #endif
	IOS;
	ll T = 1; //cin >> T;
	forn1(i, T + 1) {
		clock_t z = clock();
		solver();
		debug("Total Time: %.3f\n", (double)(clock() - z) / CLOCKS_PER_SEC);
	}
	return 0;
}


Measured memory_bytes: 3808
//#define _DEBUG
#include "bits/stdc++.h"
#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0,a1,a2,a3,a4,x,...) x
#define debug_1(x1) cout<<#x1<<": "<<x1<<endl
#define debug_2(x1,x2) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<endl
#define debug_3(x1,x2,x3) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<endl
#define debug_4(x1,x2,x3,x4) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<", "#x4<<": "<<x4<<endl
#define debug_5(x1,x2,x3,x4,x5) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<", "#x4<<": "<<x4<<", "#x5<<": "<<x5<<endl
#ifdef _DEBUG
#define debug(...) CHOOSE((__VA_ARGS__,debug_5,debug_4,debug_3,debug_2,debug_1,~))(__VA_ARGS__)
#else
#define debug(...)
#endif
#define rep(index,num) for(int index=0;index<(int)num;index++)
#define rep1(index,num) for(int index=1;index<=(int)num;index++)
#define brep(index,num) for(int index=(int)num-1;index>=0;index--)
#define brep1(index,num) for(int index=(int)num;index>0;index--)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-7
#define mp(a1,a2) make_pair(a1,a2)
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef long long ll;
typedef long double ld;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=(ll)1e+18+1;
int INF=1e+9+1;
map<int,int> ido;
multiset<int> num;
int main(){
	int H,W;
	int A[200001],B[200001];
	scan(H>>W);
	rep(i,H){
		scan(A[i]>>B[i]);
		A[i]--; B[i]--;
	}
	rep(j,W) ido[j]=0,num.insert(0);
	rep(i,H){
		auto itr=ido.lower_bound(A[i]);
		int lastfirst=-1,lastsecond=-1;
		while(itr!=ido.end()&&itr->first<=B[i]){
			lastfirst=itr->first;
			lastsecond=itr->second;
			itr=ido.erase(itr);
			auto msitr=num.find(lastsecond);
			num.erase(msitr);
		}
		debug(lastfirst,lastsecond,ido.size(),num.size());
		if(lastfirst!=-1&&B[i]<W-1){
			if(ido.find(B[i]+1)!=ido.end()){
				if(ido[B[i]+1]>lastsecond+B[i]-lastfirst+1){
					auto msitr=num.find(ido[B[i]+1]);
					num.erase(msitr);
					ido[B[i]+1]=lastsecond+B[i]-lastfirst+1;
					num.insert(lastsecond+B[i]-lastfirst+1);
				}
			}
			else{
				ido[B[i]+1]=lastsecond+B[i]-lastfirst+1;
				num.insert(lastsecond+B[i]-lastfirst+1);
			}
			debug(ido[B[i]+1]);
		}
		if(num.empty())	prin(-1);
		else prin(i+1+*num.lower_bound(0));
	}
	return 0;
}


Measured memory_bytes: 23868
N, M, K = map(int, input().split())
for a in range(N + 1):
    for b in range(M + 1):
        black = (a * M) + (b * N) - (a * b) * 2
        # print(a, b, black)
        if black == K:
            print("Yes")
            exit()
print("No")


Measured memory_bytes: 2940
import std.stdio, std.string, std.conv;
import std.typecons;
import std.algorithm, std.array, std.range, std.container;
import std.math;

void main() {
	alias Section = Tuple!(int, "l", int, "r");
	auto data = readln.split, N = data[0].to!int, M = data[1].to!int, Q = data[2].to!int;
	
	int[500][500] train;
	int[500][500] row_sum;		// row_sum[l][r] = t_1r + ... + t_lr
	
	foreach (i; 0 .. M) {
		data = readln.split, train[data[0].to!int-1][data[1].to!int-1]++;
	}
	
	foreach (r; 0 .. 500) {
		int s;
		foreach (l; 0 .. 500) {
			s += train[l][r];
			row_sum[l][r] = s;
		}
	}
	
	int[] p, q;
	
	foreach (j; 0 .. Q) {
		data = readln.split;
		p ~= data[0].to!int-1, q ~= data[1].to!int-1;
	}
	
	foreach (j; 0 .. Q) {
		int ans;
		foreach (r; p[j] .. q[j]+1) {
			if (p[j]==0) { ans += row_sum[q[j]][r]; /*row_sum[q[j]][r].writeln;*/ }
			else { ans += (row_sum[q[j]][r] - row_sum[p[j]-1][r]); /*(row_sum[q[j]][r] - row_sum[p[j]-1][r]).writeln;*/ } 
		}
		writeln(ans);
	}
	
	
}

Measured memory_bytes: 6524
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <algorithm>
#include<queue>
using namespace std;
int gcd(int a,int b)
{
    if(b == 0)
        return a;
    return gcd(b,a%b);
}
int main() {
    int a,w,b;
    while(cin>>w>>a>>b)
    {
        int d=0;
        if(a+w<=b)
            d=b-(a+w);
        else if(b+w<=a)
            d=a-(b+w);
        cout<<d<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
/*#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
Apparently, the tree supports the same operations as the set 
(at least I haven't any problems with them before), but also there are two new features — 
find_by_order() — The first returns an iterator to the k-th largest element (counting from zero)
order_of_key() — the number of items in a set that are strictly smaller than our item. 
https://codeforces.com/blog/entry/11080
using namespace __gnu_pbds; */
using namespace std;
#define test() int t;cin>>t;for(int test=1;test<=t;test++)
#define int long long
#define MOD 1000000007
#define pb push_back 
#define ins insert
#define fast(); ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ld long double
#define endl '\n'
int m(int a) {
    return ((a%MOD)+MOD)%MOD;
}
int p(int a, int b) {
    int res = 1;
    while(b > 0){
        if(b&1) res = m(m(res)*m(a));
        a = m(m(a)*m(a));
        b >>= 1;
    }
    return res;
} 
signed main(){
    fast();
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i=0; i<n; i++)  cin >> a[i];
    int mn = a[0], mx = -1;
    int moni = 1000;
    for(int i=1; i<n; i++){
        if(a[i] > a[i-1]){
            int num = moni/a[i-1];
            moni -= num*a[i-1];
            moni += num*a[i];
        }
    }
    cout << moni << endl;
    cerr << "\nTime elapsed : " << 1000 * clock() / CLOCKS_PER_SEC << " ms\n";
}

Measured memory_bytes: 3664
#pragma region

#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define _rep3(i, begin, end) for (register int i = (begin), i##_end = (end); i < i##_end; i++)
#define _irep3(i, begin, end) for (register int i = (end)-1, i##_begin = (begin); i >= i##_begin; i--)
#define _rep2(i, n) _rep3(i, 0, n)
#define _irep2(i, n) _irep3(i, 0, n)
#define _overload3(_1, _2, _3, name, ...) name
#define rep(...) _overload3(__VA_ARGS__, _rep3, _rep2, )(__VA_ARGS__)
#define irep(...) _overload3(__VA_ARGS__, _irep3, _irep2, )(__VA_ARGS__)
#define out(x) cout << (x) << '\n';
#define debug(x) cerr << #x << " = " << (x) << " (line: " << __LINE__ << ") " << endl;

using namespace std;
using ll = long long;
using vi = vector<int>;
using vl = vector<long long>;
using vb = vector<bool>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<long long>>;
using vvb = vector<vector<bool>>;

template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
  for (auto &v : vec) is >> v;
  return is;
}
template <typename T1, typename T2>
istream &operator>>(istream &is, pair<T1, T2> &pair) {
  cin >> pair.first >> pair.second;
  return is;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  os << "[ ";
  rep(i, vec.size()) i == 0 ? os << vec[i] : os << ", " << vec[i];
  os << " ]";
  return os;
}

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

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

void init() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(16) << boolalpha;
}

#pragma endregion

#define MOD 1000000007
#define INF 2147483647

int main() {
  init();

  string S;
  cin >> S;

  if (S[1] != S[0] || S[2] != S[0]) {
    out("Yes");
  } else {
    out("No");
  }
}


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

int main () {
  int A,B,i,j;
  cin>>A>>B;
  j=0;
  for(i=A;i<=B;i++){
    int a,b,c,d;
    a=i/10000;
    b=(i%10000)/1000;
    c=(i%100)/10;
    d=i%10;
    if((a==d)&&(b==c)){
      j++;
    }
  }
  cout<<j<<endl;
}

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

int main() {
	int S, h, m, s;
	cin >> S;
	h = (S - (S % 3600)) / 3600;
	m = ((S - 3600 * h) - (S % 60)) / 60;
	s = S % 60;
	cout << h << ":" << m << ":" << s << endl;
	return 0;
}

Measured memory_bytes: 3092
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

#define mp make_pair
#define pb push_back
#define ll long long

#define maxN 100011

int n, k, i;
ll a[maxN], l[maxN], r[maxN], sum[maxN];
ll ans;

int main()
{
    //freopen("test.in","r",stdin);

    scanf("%d%d", &n, &k);
    for (i = 1; i <= n; i++) {
        scanf("%lld", &a[i]);
        l[i] = l[i - 1] + max(0LL, a[i]);
        sum[i] = sum[i - 1] + a[i];
    }

    for (i = n; i > 0; i--)
        r[i] = r[i + 1] + max(0LL, a[i]);

    for (i = 1; i + k - 1 <= n; i++) {
        ans = max(ans, l[i - 1] + r[i + k] + max(0LL, sum[i + k - 1] - sum[i - 1]));
    }

    printf("%lld", ans);


    return 0;
}


Measured memory_bytes: 3328
#include <iostream>
#include <string>
#define rep(i, n) for (int i = 0; (i) < (int)(n); i++)
using namespace std;

int main() {
	long long X;
	cin >> X;
	long long i = 1;
	long long y = 100;
	while (1) {
		long long z = y / 100 + y;
		if (z >= X) {
			cout << i << endl;
			return 0;
		}
		i += 1;
		y = z;
	}
	return 0;
}

Measured memory_bytes: 3636
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
typedef long long ll;

vector<int> ans;

int main(void)
{
	int n;
	scanf("%d",&n);
	
	while(n)
	{
		int now = n%-2;
		n/=-2;
		if(now < 0) ++n, now+=2;
		ans.push_back(now);
	}
	
	reverse(ans.begin(),ans.end());
	for(int i=0; i<(int)ans.size(); ++i)
		printf("%d",ans[i]);
	if(!ans.size()) putchar('0');
	putchar('\n');
	return 0;
}

Measured memory_bytes: 256
import math
import itertools

N=int(input())
P=list(map(int,input().split()))
Q=list(map(int,input().split()))
ls=[]
for i in range(1,N+1):
    ls.append(i)
ls2 = list(itertools.permutations(ls,N))
#print(ls2)
cnt1 = 0
cnt2 = 0
for j in range(math.factorial(N)):
    for i in range(N):
        #print(j,i,P[i],ls2[j][i])
        if P[i] == ls2[j][i]:
            cnt1 += 1
        if Q[i] == ls2[j][i]:
            cnt2 += 1
    #print("cnt1",cnt1,"cnt2",cnt2)
    if cnt1 == N:
        a = j
    if cnt2 == N:
        b = j
    cnt1 = 0
    cnt2 = 0
#print(a,b)
print(abs(a-b))


Measured memory_bytes: 79896
/*author - Ashutosh Chitranshi*/
#include<bits/stdc++.h>
using namespace std;
#pragma GCC push_options
#pragma GCC optimize ("unroll-loops")
#define watch(x) cout << (#x) << " is " << (x) << "\n"
#define watch2(x,y) cout <<(#x)<<" is "<<(x)<<" and "<<(#y)<<" is "<<(y)<<"\n"
#define pow2(x) ((x)*(x))
#define ll long long
#define ld long double
#define eb emplace_back
#define pb push_back
#define pf push_front
#define mod 1000000007
#define clock (clock() * 1000.0 / CLOCKS_PER_SEC)
#define mp make_pair
#define ff first
#define ss second
#define null NULL
#define all(c) (c).begin(),(c).end()
#define nl "\n"
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector< vi > vvi;
typedef vector< vl > vvl;
typedef pair< int,int > ii;
typedef pair< ll,ll> pll;
typedef map< ll,ll> mll;
typedef map< int,int> mii;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll x;
    cin >> x;
   ll y = x;
    int c = 1;
  	while(true)
    {
      if(__gcd(y,360ll) == 360ll)
      {
        cout << c << nl;
        break;
      }
      y += x;
      c++;
    }
    return 0;
}

Measured memory_bytes: 3648
from collections import deque

def graph(N):# Nの無向グラフの作成
    graph = [[] for _ in range(N)]
    for _ in range(N-1):
        a, b = [int(x) for x in input().split()]
        graph[a-1].append(b-1)
        graph[b-1].append(a-1)
    return graph

def cnt(Q,graph):
    V = [False] * N#いったことがあるかどうか
    cnt = [0] * N
    for _ in range(Q):
        p, x = [int(x) for x in input().split()]
        cnt[p-1] += x#まず、それぞれのｘだけカウント増やしておく
    que = deque([0])#スタートは0から。
    while que:#木の末端にきてqueなくなるまで
        s = que.popleft()#取り出し（深さ探索）
        V[s] = True
        for i in graph[s]:#根についてる枝の数だけ
            if V[i] == False:#いったことがある方向には戻らないようにする
                cnt[i] += cnt[s]#枝に根の分カウント増やす
                que.append(i) #枝情報をqueに追加
    return(cnt)

N, Q = map(int, input().split())
A = graph(N)
print(*cnt(Q, A))

Measured memory_bytes: 107028
#include <bits/stdc++.h>
#define rep(i,n) for (long long i = 0; i < (n); ++i)
const int INF = 2147483647;//int max
const long long int MOD = 1000000007;
using namespace std;
using ll = long long;
using P = pair<int,int>;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//ミョ(-ω- ?)
int main() {
    string s;
    getline(cin,s);
    string res = "";
    rep(i,s.length()){
        if(s[i] == '0')res += '0';
        else if(s[i] == '1')res+='1';
        else if(s[i] == 'B' && !res.empty())res.pop_back();
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main(){
	int N;
	cin >> N;
	
	int A[100010];
	int a;
	
	for(int i=1; i<N+1; i++){
		cin >> a;
		A[a]=i;
	}
		
	for(int i=1; i<N+1; i++){
		cout << A[i] << " ";
	}
	  
	return 0;
}

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

struct Node {
  int len;
  Node *ch[26], *f;
  Node() : len(0), f(NULL) { memset(ch, 0, sizeof ch); }
};
struct SAM {
  Node *last, *root;
  SAM() { root = last = new Node(); };
  void add(int c) {
    Node *e = new Node(), *tmp = last;
    e->len = last->len + 1;
    for (; tmp && !tmp->ch[c]; tmp = tmp->f)
      tmp->ch[c] = e;
    if (!tmp) {
      e->f = root;
    } else {
      Node *nxt = tmp->ch[c];
      if (tmp->len + 1 == nxt->len)
        e->f = nxt;
      else {
        Node *np = new Node();
        *np = *nxt;
        np->len = tmp->len + 1;
        nxt->f = e->f = np;
        for (; tmp && tmp->ch[c] == nxt; tmp = tmp->f)
          tmp->ch[c] = np;
      }
    }
    last = e;
  }
};
constexpr int maxn = 5e5 + 10;
char s[maxn], t[maxn];
SAM a;
int main() {
  scanf("%s%s", s, t);
  const int m = strlen(s);
  for (int i = 0; i < 3 * maxn; ++i) {
    a.add(s[i % m] - 'a');
  }
  const int n = strlen(t);
  int ans = 0;
  Node *x = a.root;
  while (ans * n < 2 * m) {
    for (int i = 0; i < n && x != nullptr; ++i) {
      x = x->ch[t[i] - 'a'];
    }
    if (x != nullptr) {
      ans++;
    } else {
      break;
    }
  }
  if (ans * n >= 2 * m)
    ans = -1;
  printf("%d\n", ans);
  return 0;
}



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

using namespace std;

#define mod 1000000007LL

int main() {
	long long int N, M;
	cin >> N >> M;
	vector<long long int>X(N), Y(M);
	for (size_t i = 0; i < N; i++)
	{
		cin >> X[i];
	}
	for (size_t i = 0; i < M; i++)
	{
		cin >> Y[i];
	}
	long long int Xlen = 0, Ylen = 0;
	for (size_t i = 0; i < N - 1; i++)
	{
		Xlen += (X[i + 1] - X[i])*(i + 1)*(N - i - 1);
		Xlen %= mod;
	}
	for (size_t i = 0; i < M - 1; i++)
	{
		Ylen += (Y[i + 1] - Y[i])*(i + 1)*(M - i - 1);
		Ylen %= mod;
	}
	cout << Xlen*Ylen%mod << endl;

}

Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <map>
#include <iomanip>
typedef long long ll;
#define rep(i,a,b) for(int i=a;i<b;++i)
#define rrep(i,a,b) for(int i=a;i>=b;--i)
using namespace std;
ll mod = 1e9 + 7;

using namespace std;



int main()

{
	int H,W;

	cin >> H >> W;
	vector<vector<char>> data1(H, vector<char>(W));
	vector<vector<char>> data2(H+2, vector<char>(W+2));
	for (int i = 0; i < H; i++)
	{
		for (int j = 0; j < W; j++)
		{
			cin >> data1[i][j];
		}
		
	}
	for (int i = 0; i < H+2; i++)
	{
		for (int j = 0; j < W+2; j++)
		{
			data2[i][j] = '#';
		}

	}
	for (int i = 0; i < H; i++)
	{
		for (int j = 0; j < W; j++)
		{
			data2[i + 1][j + 1] = data1[i][j];
		}

	}
	for (int i = 0; i < H + 2; i++)
	{
		for (int j = 0; j < W + 2; j++)
		{
			cout << data2[i][j];
		}
		cout << endl;

	}

	
	return 0;
	
}


Measured memory_bytes: 256
def main():
    n, q = map(int, input().split())
    s = input()
    indic = {}
    for i in range(q):
        l, r = map(int, input().split())
        indic[i] = [l, r]
    
    ruisekidic = {}
    tmp = 0
    
    for i in range(n):
        if i == 0:
            mae = s[0]
            ruisekidic[i] = 0
        else:
            if mae == "A" and s[i] == "C":
                tmp += 1
                ruisekidic[i] = tmp
                mae = s[i]
            else:
                ruisekidic[i] = tmp
                mae = s[i]
    for i in range(q):
        [l, r] = indic[i]
        if l > 0:
            print(ruisekidic[r-1] - ruisekidic[l-1])
        else:
            print(ruisekidic[r-1])


    
if __name__ == "__main__":
    main()


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

vector <int> graph[200001];
int visited[200001];
int n,m;

int dfs(int a){
	int count=1;
	stack <int> s;
	s.push(a);
	visited[a]=1;
	while(!s.empty()){
		a=s.top();
		s.pop();
		for(auto i:graph[a]){
			if(visited[i]==0){
				s.push(i);
				visited[i]=1;
				++count;
			}
		}
	}
	return count;

}


int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin>>n>>m;
	
	int a,b;
	for(int i=0;i<m;++i){
		cin>>a>>b;
		graph[a].push_back(b);
		graph[b].push_back(a);
	}
	int ans=0;
	
	
	for(int i=1;i<n+1;++i){
		if(visited[i]==0){
			ans=max(dfs(i),ans);
		}
	}
	cout<<ans;
	
}



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

using namespace std;

typedef long long ll;

double getTime() {
  return clock() / (double) CLOCKS_PER_SEC;
}

void read() {};

template<typename T, typename... Args>
void read(T& a, Args&... args) {
  cin >> a;
  read(args...);
}

void print() {};

template <typename T, typename... Args>
void print(T a, Args... args) {
  cout << a << " \n"[sizeof...(args) == 0];
  print(args...);
}

const int N = 105;

char g[N][N];
bool used[N][N];
int dp[N][N][2];
int n, m;

int go(int x, int y, int cur) {
  if(x == n - 1 and y == m - 1) {
    return (cur == 0) * g[x][y] == '#';
  }
  if(dp[x][y][cur] != -1) return dp[x][y][cur];
  int res = 1e9;
  if(x + 1 < n) res = min(res, (cur == 0) * (g[x][y] == '#') + go(x + 1, y, (g[x][y] == '#') ));
  if(y + 1 < m) res = min(res, (cur == 0) * (g[x][y] == '#') + go(x, y + 1, (g[x][y] == '#') ));
  return dp[x][y][cur] = res;
}

int main() {
  cin >> n >> m;
  for(int i = 0; i < n; i++) {
    for(int j = 0; j < m; j++) {
      cin >> g[i][j];
    }
  }
  memset(dp, -1, sizeof dp);
  cout << go(0, 0, 0) << '\n';
  return 0;
}

Measured memory_bytes: 384
from re import match

s = input().replace('?','.')
t = input()
s_len = len(s)
t_len = len(t)

for i in range(s_len-t_len,-1,-1):
    if match(s[i:i+t_len],t):
        s = s.replace('.','a')
        print(s[:i]+t+s[i+t_len:])
        exit()
print('UNRESTORABLE')

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

using namespace std;

#define int ll
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<double> vd;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<pi> vp;
typedef vector<pl> vpl;

const int mod = 1e9 + 7;

signed main()
{
	ios_base::sync_with_stdio(false); 
	cin.tie(nullptr); 
	cout.tie(nullptr); 
	cerr.tie(nullptr);	

	int n, k;
	cin >> n >> k;

	vi a(n);
	for (auto& i : a)
		cin >> i;

	int sol = 0;

	for (int i = 0; i < n; ++i){
		for (int j = i + 1; j < n; ++j){
			if (a[j] < a[i])
				++sol;
		}
	}

	sol *= k;
	if (sol >= mod) sol %= mod;

	for (int i = 0; i < n; ++i){
		int t = 0;
		for (int j = 0; j < n; ++j){
			if (a[j] < a[i])
				++t;
		}

		int x = (k * (k -1)) / 2;
		if (x >= mod) x%=mod;

		x *= t;
		if (x >= mod) x%=mod;

		sol += x;
		if (sol >= mod) sol %= mod;
	}

	cout << sol << '\n';
}

//(k-1) * t + (k - 2) * t

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

signed main()
{
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << setprecision(10);

    int n;
    cin >> n;
    vector<string> s(n);
    vector<int> t(n);
    for (int i = 0; i < n; i++)
    {
        cin >> s[i] >> t[i];
    }
    string x;
    cin >> x;

    int ans = 0;
    bool sleep = false;
    for (int i = 0; i < n; i++)
    {
        ans += (sleep ? t[i] : 0);
        if (s[i] == x)
            sleep = true;
    }

    cout << ans << endl;
}


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

typedef long long ll;
ll mod = 1000000007;

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int a, b, c;
    cin >> a >> b >> c;
    if(a + b >= c) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
n = int(input())
t = [0] * (n+1)
x = [0] * (n+1)
y = [0] * (n+1)

j = True

for i in range(n):
    t[i+1], x[i+1], y[i+1] = map(int, input().split())


for d in range(0, n+1) :
    if t[d] % 2 == 1 and (x[d] + y[d]) %2 != 1 :
        j = False
    if t[d] % 2 == 0 and (x[d] + y[d]) %2 != 0 :
        j = False

for k in range(0, n) :
    a = t[k+1] - t[k]
    b = abs(x[k+1] - x[k]) + abs(y[k+1] - y[k])
    if a < b :
        j = False

if j == True:
    print('Yes')
else :
    print('No')

Measured memory_bytes: 11636
import sys
import operator
from collections import deque,Counter

input=sys.stdin.readline
h,w=map(int,input().split())
sx,sy=0,0
#print(sx,sy)
gx,gy=h-1,w-1
#print(gx,gy)
s=[list(input()) for _ in range(h)]
#白のブロックを数える
c=[]
for a in s:
  c+=a
c=Counter(c)
#print(c["."])
white=c["."]
#移動先4方向
dx = [1, 0, -1,  0]
dy = [0, 1,  0, -1]
#訪問リストを作る
visited=[[-1]*w for _ in range(h)]

def bfs(x,y):
  queue=deque([[x,y]])
  visited[x][y]=0
  while queue:
    
    x,y=queue.popleft()
    if [x,y]==[gx,gy]:
      return visited[x][y]
    for i in range(4):
      nx,ny=x+dx[i],y+dy[i]
      if nx>=0 and nx<h and ny>=0 and ny<w and s[nx][ny]=="." and visited[nx][ny]==-1:
        visited[nx][ny]=visited[x][y]+1
        queue.append([nx,ny])
        #print(queue)
    
bfs(sx,sy)
#print(*visited,sep="\n")
print(white-visited[gx][gy]-1 if visited[gx][gy]!=-1 else -1)

Measured memory_bytes: 9516
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=200003,INF=1<<30;

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll N,A,B;cin>>N>>A>>B;
    N%=12;
    for(int i=0;i<N;i++){
        if(i%2==0){
            A=A-B;
        }else B=A+B;
    }
    
    cout<<A<<" "<<B<<endl;
}





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

int main(){
	char S[100000];
	scanf("%s",S);
	getchar();
	int l=strlen(S);
	l--;
	int i=0;
	for(i=l;i>0;){
		if(i<4){
			break;
		}
		if(S[i]=='r'&&S[i-1]=='e'&&S[i-2]=='s'&&S[i-3]=='a'&&S[i-4]=='r'&&S[i-5]=='e'){
			i-=6;
		}
		else if(S[i]=='r'&&S[i-1]=='e'&&S[i-2]=='m'&&S[i-3]=='a'&&S[i-4]=='e'&&S[i-5]=='r'&&S[i-6]=='d'){
			i-=7;
		}
		else if(S[i]=='e'&&S[i-1]=='s'&&S[i-2]=='a'&&S[i-3]=='r'&&S[i-4]=='e'){
			i-=5;
		}
		else if(S[i]=='m'&&S[i-1]=='a'&&S[i-2]=='e'&&S[i-3]=='r'&&S[i-4]=='d'){
			i-=5;
		}
		else{
			break;
		}
	}
	if(i==-1){
		printf("YES");
	}
	else{
		printf("NO");
	}
} 

Measured memory_bytes: 256
# coding UTF-8
# 
# problem B
# 

import numpy as np

n = int(input())
s = input()

ords = np.array([ord(x) for x in s])
after_ords = ords + n
after_ords[after_ords >= 91] = after_ords[after_ords >= 91] + 6
print(str.upper(''.join([chr(a) for a in after_ords])))


Measured memory_bytes: 12596
#include <stdio.h>
int main(int argc, char **argv)
{
  char s[1024*1024]={};
  int res[1024*1024]={};
  int n,q,l,r;
  int i;
  scanf("%d %d\n", &n, &q);
  gets(s);
  for (i=1;i<n;i++) {
    res[i] = res[i-1];
    if ((s[i]=='C') && (s[i-1]=='A')) {
      res[i]++;
    }
  }
  for (i=0;i<q;i++) {
    scanf("%d %d\n", &l, &r);
    l--;
    r--;
    printf("%d\n", res[r]-res[l]);
  }
  return 0;
}


Measured memory_bytes: 5888
#include <bits/stdc++.h>
//----***やべーやつら***----
using namespace std;
#define int long long

//----***型定義***----
using ll = long long;
using P = pair<int,int>;

//----***Like a Pythonista***----
#define REP(ii,jj,nn) for (ll ii=jj;ii<(nn);ii++)
#define RREP(ii,nn,jj) for (ll ii = nn; jj<ii;ii--)
#define each(i,...) for (auto&& i:__VA_ARGS__)
#define ALL(vec) (vec).begin(),(vec).end()
#define sum(...) accumulate(ALL(__VA_ARGS__),0LL)
#define dsum(...) accumulate(ALL(__VA_ARGS__),0.0)
#define vec(type,name,...) vector<type> name(__VA_ARGS__)
template<class T> inline auto max(const T& a){ return *max_element(ALL(a)); }
template<class T> inline auto min(const T& a){ return *min_element(ALL(a)); }
inline ll gcd(ll a,ll b){if(b == 0) return a;return  gcd(b,a%b);}
inline ll lcm(ll a,ll b){ll g = gcd(a,b);return a / g * b;}

//----***定数***----
#define MOD 1000000007
#define INF 100000000000000000
#define EPS 1e-9
const vector<vector<int>> DXY={{-1,0},{1,0},{0,-1},{0,1}};

//----***パーツ***----
#define fi first
#define se second
#define pb push_back
#define re return
#define br break

//----***入出力***---
void print() { std::cout << "\n"; }
template <class T>void print(const T &x) {std::cout << x<<"\n";}
template <class T, class... Args>void print(const T &x, const Args &... args) {std::cout << x << " ";print(args...);}
#define debug(var)  do{std::cerr << #var << " ↓ "<<"\n";view(var);}while(0);
#define dbg cerr<<"🥺🥺🥺🥺🥺🥺"<<endl;
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }

//----***初期時読み込み***----
struct initial{initial(){cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(15);};}initial_;

signed main(){
  int N;cin>>N;
  vector<int> Luca(N+1,0);
  Luca[0]=2;
  Luca[1]=1;
  REP(i,2,N+1){
    Luca[i]=Luca[i-2]+Luca[i-1];
  }
  print(Luca[N]);

}


Measured memory_bytes: 256
n = int(input())
dd = []
sb = 0
for _ in range(n):
    a, b = map(int, input().split())
    dd.append(a+b)
    sb -= b

abd = sorted(dd, reverse=True)

res = 0
for i in range(n):
    d = abd.pop(0)
    if i % 2 == 0:
        res += d

print(res+sb)

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

int main() {
    int m, f, r;
    while (true) {
        cin >> m >> f >> r;
        if (m == -1 && f == -1 && r == -1) {
            break;
        }

        int score = m + f;

        if (m == -1 || f == -1) {
            cout << 'F' << endl;
        } else if (score >= 80) {
            cout << 'A' << endl;
        } else if (score >= 65) {
            cout << 'B' << endl;
        } else if (score >= 50) {
            cout << 'C' << endl;
        } else if (score >= 30) {
            cout << (r >= 50 ? 'C' : 'D') << endl;
        } else {
            cout << 'F' << endl;
        }
    }
}

Measured memory_bytes: 1156
#include<stdio.h>
#include<string.h>
int main(void){
    int a=0,b=0,c=0,d=0,f=0,l=0,k=0,t=0,i=0;
    char x[10000],y[8]={0},z[10000]={0},p[10000]={0},q[]="replace",w[]="reverse",e[]="print";
    scanf("%s",x);
    scanf("%d",&a);
    strcpy(z,x);
    for(l=0;l<a;l++){
            scanf("%s %d %d",y,&d,&f);
            if(strcmp(y,e)==0){
                for(t=d;t<f+1;t++){
                    printf("%c",x[t]);
                }
                printf("\n");
            }else if(strcmp(y,w)==0){
                for(i=0,c=d;c<f+1;c++,i++){
                    z[c]=x[f-i];

                }

            }else if(strcmp(y,q)==0){
                for(c=d;c<=f;c++){
                    scanf(" %c",&p[c]);
                    z[c]=p[c];
                }
            }

        for(i=d;i<=f;i++){
        x[i]=z[i];
        }
    }
    return 0;
}

Measured memory_bytes: 620
#include <iostream>

using namespace std;

void call(int);
void call2(int);

int main(int argc, char* argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n;
    cin >> n;
    call(n);
    //call2(n);
/*
    cout << n % 3 << endl;
    cout << n % 10 << endl;
    cout << n / 10 << endl;
    cout << (n / 10) % 10 << endl;
    cout << ((n / 10) % 10) / 10 << endl;
*/
    return 0;
}

void call(int n) {
    
    for ( int i = 1; i <= n; i++) {
        //check_num
        int x = i;
        if ( x % 3 == 0 ) {
            cout << " " << i;
        } else if ( x % 10 == 3 ) {
            cout << " " << i;
        } else { /* else if ((x /= 10) % 10 == 3 ){
            cout << " " << i;
        } */
        while ( x ) {
            x /= 10;
            if (x % 10 == 3) {
                cout << " " << i;
                break;
            }
        }
        }

        
    }
    cout << endl;
}

void call2(int n) {
    int i = 1;
CHECK_NUM:
    int x = i;
    if ( x % 3 == 0 ){
        cout << " " << i;
        goto END_CHECK_NUM;
    }
INCLUDE3:
    if ( x % 10 == 3) {
        cout << " " << i;
        goto END_CHECK_NUM;
    }
    x /= 10;
    if ( x ) goto INCLUDE3;
    END_CHECK_NUM:
    if ( ++i <= n ) goto CHECK_NUM;
    cout << endl;
}


Measured memory_bytes: 3240
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  vector<long long> a(n),s(n+1);
  for(int i=0;i<n;i++){
    cin >> a[i];
    s[i+1]=s[i]+a[i];
  }
  sort(s.begin(),s.end());
  long long ans=0;
  long long cnt=0;
  for(int i=1;i<n+1;i++){
    if(s[i-1]==s[i]){
      cnt++;
      ans+=cnt;
    }
    else{
      cnt=0;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3328
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;

int N, K;
vector<int> v;

int main()
{
	int tmp;
	int ans = 0;
	scanf("%d %d", &N, &K);
	for (int i = 0; i < N; i++) {
		scanf("%d", &tmp);
		v.push_back(tmp);
	}
	sort(v.begin(), v.end());
	for (int i = 0; i < K; i++) {
		ans += v[N - 1 - i];
	}
	printf("%d\n", ans);
}

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

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

    string s;
    cin >> s;

    int a, b, c, d;
    a = s[0] - '0';
    b = s[1] - '0';
    c = s[2] - '0';
    d = s[3] - '0';

    string op;
    if(a+b+c+d==7) op = "+++";
    if(a+b+c-d==7) op = "++-";
    if(a+b-c+d==7) op = "+-+";
    if(a+b-c-d==7) op = "+--";
    if(a-b+c+d==7) op = "-++";
    if(a-b+c-d==7) op = "-+-";
    if(a-b-c+d==7) op = "--+";
    if(a-b-c-d==7) op = "---";
    
    rep(i, 3) cout << s[i] << op[i];
    cout << s[3] << "=7" << endl;

    return 0;
}

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

typedef long long ll;
#define pii pair<int , int>
#define _FastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define MAXX 1005

int n , a , b;

int main()
{
    _FastIO;
    string s;
    cin >> s;
    if(s == "ABC"){
        cout << "ARC" << endl;
    }
    else
        cout << "ABC" << endl;
    return 0;
}


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

int findSumDigits(int n) {
  int sum = 0;
  while (n > 0) {
    sum += n % 10;
    n /= 10;
  }

  return sum;
}

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

  int sum = findSumDigits(N);

  if (N % sum == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }

  return 0;
}

Measured memory_bytes: 256
#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>
#include<string>
#include<cmath>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<vector>
#include<complex>
#include<unordered_map>
#define deg(x) cout<<#x<<"="<<x<<endl;
#define fd(x) for(int i=0;i<x;i++)
#define fdd(a,x) for(int i=a;i<x;i++)
#define fx(x,n) for(int i=n-1;i>=x;i--)
#define mst(x) memset(x,0,sizeof(x));
#define fi first
#define se second
#define TB ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#define ok "ok"
#define HH puts("");
#define ls rt<<1
#define rs rt<<1|1
#define pb(a,b) a.push_back(b);
#define FIN  freopen("1.in","r",stdin);
#define FOUT freopen("1.out","w",stdout);
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<string,int> pss;
typedef unsigned long long ull;
const ll mod=1e18;
const ll inf=1e18;
const double eps=1e-8;
const double pi=acos(-1);



int main(){
    TB
    ll n,a,b;
    cin>>n>>a>>b;
    ll sum=a+b;
    ll k=n%sum;
    ll ans=n/sum;
    ans*=a;
    if(k>=a) ans+=a;
    else ans+=k;
    cout<<ans<<'\n';
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>   //PBDS
#include <ext/pb_ds/tree_policy.hpp>       //PBDS
#define int long long int
#define vi vector<int>
#define vii vector<pair<int,int>>
#define pi pair<int,int>
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define mi map<int,int>
#define PI   3.141592653589
#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define f(i,x,n) for(int i=x;i<n;i++)
#define rf(i,x,n) for(int i=n-1;i>=x;i--)
#define check(x)   cerr<<#x<<" : "<<x<<endl;
#define ordered_set tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update>
#define fbo find_by_order                    //return iterator PBDS
#define ook order_of_key                     //return number :)) PBDS
#define baar exit(0)
using namespace __gnu_pbds;
using namespace std;
int powmod(int base,int exponent,int mod)
{
	int ans=1;
	while(exponent){
		if(exponent&1)ans=(ans*base)%mod;
		base=(base*base)%mod;
		exponent/=2;
	}
	return ans;
}
signed main()
{ 
   fast
   string s,t;
   cin>>s>>t;
   if(t.substr(0,s.size())==s)
   {
   	cout<<"Yes";
   }
   else cout<<"No";
}

Measured memory_bytes: 3564