akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;

typedef long long LL;

const int maxn = 1e6 + 10;
const int M = 26;

char s[maxn];
int next[maxn];

struct Node
{
	LL cnt[M];
	Node() { memset(cnt, 0, sizeof cnt); }
	void operator += (const Node &a)
	{
		for (int i = 0; i < M; ++ i)
			cnt[i] += a.cnt[i];
	}
	Node operator + (const Node &a) const
	{
		Node res;
		for (int i = 0; i < M; ++ i)
			res.cnt[i] = cnt[i] + a.cnt[i];
		return res;
	}
	Node operator - (const Node &a) const
	{
		Node res;
		for (int i = 0; i < M; ++ i)
			res.cnt[i] = cnt[i] - a.cnt[i];
		return res;
	}
	void Putout()
	{
		for (int i = 0; i < M - 1; ++ i) printf("%lld ", cnt[i]);
		printf("%lld\n", cnt[M - 1]);
	}
} sum[maxn];

Node Calc(int len, LL n)
{
	LL x = len, y = len + (len - next[len]);
	if (n <= x) return sum[n];
	if (n <= y) return sum[len] + sum[n - len];
	Node a = sum[len], b = sum[len] + sum[len - next[len]];
	while (n >= x + y)
	{
		b += a;
		a = b - a;
		y += x;
		x = y - x;
	}
	return b + Calc(len, n - y);
}

int main()
{
	scanf("%s", s + 1);
	int n = strlen(s + 1) / 2;
	next[1] = 0;
	sum[1].cnt[s[1] - 'a'] = 1;
	for (int i = 2; i <= n; ++ i)
	{
		int j = next[i - 1];
		while (j && s[j + 1] != s[i]) j = next[j];
		next[i] = j + (s[j + 1] == s[i]);
		sum[i].cnt[s[i] - 'a'] = 1;
		sum[i] += sum[i - 1];
	}
	LL l, r;
	scanf("%lld%lld", &l, &r);
	Node res = Calc(n, r) - Calc(n, l - 1);
	res.Putout();
	return 0;
}


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

int main(){
    bool line = false;
    while(true){
        int money[4] = {10, 50, 100, 500};
        int n, have[4];
        cin >> n;
        if(n == 0)
            break;

        int sum = 0;
        for(int i=0; i<4; i++){
            cin >> have[i];
            sum += have[i]*money[i];
        }
        sum -= n;

        int aft[4];
        for(int i=0; i<4; i++){
            aft[3-i] = sum/money[3-i];
            sum -= aft[3-i] * money[3-i];
        }

        if(line)
            cout << endl;
        for(int i=0; i<4; i++){
            if(aft[i] < have[i])
                cout << money[i] << ' ' << have[i]-aft[i] << endl;
        }
        line = true;
    }
  
    return 0;
}

Measured memory_bytes: 3084
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
using P   = pair<ll, ll>;
using mat = vector<vector<ll>>;
typedef string::const_iterator State;
class ParseError {};

void IOS() { ios::sync_with_stdio(false), cin.tie(0); }

const ll INF = 1e16;
const ll INM = 114514;
const ll MOD = 1e9 + 7;
const ld EPS = 1e-12;

template <typename T>
void dump(T x) { cout << x << endl; }
void dumpf(ld x, int t) { cout << setprecision(t) << fixed << x << endl; }
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
	fill((T *)array, (T *)(array + N), val);
}
inline ll mod(ll a, ll b) {
	if (a > 0) return a % b;
	if (a % b == 0) return 0;
	ll x = -a / b + 1;
	a += x * b;
	return a % b;
}
ll powm(ll a, ll b, ll c) {
	if (b == 0)
		return 1;
	else if (b % 2 == 0) {
		ll d = powm(a, b / 2, c);
		return (d * d) % c;
	} else
		return (a * powm(a, b - 1, c)) % c;
}
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; }
ll dx[4] = {1, 0, -1, 0};
ll dy[4] = {0, 1, 0, -1};

struct edge {
	ll from, to, cost;
};

ll d[2502];

int main() {
	IOS();
	ll n, m, p;
	cin >> n >> m >> p;
	vector<edge> e(m);
	for (int i = 0; i < m; i++) {
		ll a, b, c;
		cin >> a >> b >> c;
		e[i] = (edge){a, b, -c + p};
	}
	for (int i = 1; i <= n; i++) {
		d[i] = INF;
	}
	bool ok = true;
	d[1]	= 0;
	for (int j = 0; j <= 2 * n; j++) {
		bool update = false;
		for (int i = 0; i < m; i++) {
			edge t = e[i];
			if (d[t.from] != INF && d[t.to] > d[t.from] + t.cost) {
				d[t.to] = d[t.from] + t.cost;
				update  = true;
				if (t.to == n && j >= n) {
					ok = false;
				}
			}
		}
	}
	dump(ok ? max(0ll, -d[n]) : -1);
	return 0;
}


Measured memory_bytes: 512
<?php

fscanf(STDIN,"%d",$n);
$a_li = explode(" ",trim(fgets(STDIN)));

$divi_four_c = 0;
$divi_two_c = 0;

foreach($a_li as $v){
  if($v%4==0){
    $divi_four_c++;
  }elseif($v%2==0){
    $divi_two_c++;
  }
  if($divi_two_c==2){
    $divi_four_c++;
    $divi_two_c = 0;
  }
}

if($divi_four_c>=(int)(count($a_li)/2)){
  echo "Yes";
}else{
  echo "No";
}



    



Measured memory_bytes: 12792
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>

void set_A(int *w,int N,int *A,int *len,int x){
	int count=0;
	int start=0,end=0;
	int s=0,e=0;

	while(1){
		s+=w[count];
		if(s>x){
			s-=w[count];
			start=count;
			break;
		}
		count++;
	}

	count=(N-1);
	while(1){
		e+=w[count];
		if(e>x){
			e-=w[count];
			end=count+1;
			break;
		}
		count--;
	}
	count=1;
	A[0]=0;
	for(int i=0;i<start;i++){
		A[0]+=w[i];
	}
	for(int i=start;i<end;i++){
		A[count++]=w[i];
	}
	A[count]=0;
	for(int i=end;i<N;i++){
		A[count]+=w[i];
	}
	*len=(count+1);
}

int check_ans(int *w,int N,int k,int P){
	int count=0;
	int W=0;
	for(int i=0;i<k;i++){
		W=0;
		while((W+w[count])<=P){
			W+=w[count++];
			if(count==N){return 1;}
		}
	}
	return -1;
}

int calc(int N,int K,int *w,int max,int average){
	int P=average;
	int W=0;
	int *A=(int*)malloc(sizeof(int)*N);
	int len=0;

	if(check_ans(w,N,K,max)==1){return max;}
	if(check_ans(w,N,K,P)==1){return P;}
	
	set_A(w,N,A,&len,average);

	while(check_ans(A,len,K,P)!=1){
		P++;
	}

	return P;
}

int main(void){	
	int N,K;
	int *w;
	int max=0,average=0;

	scanf("%d %d",&N,&K);

	w=(int*)malloc(sizeof(int)*N);
	for(int i=0;i<N;i++){
		scanf("%d",&w[i]);
		if(max < w[i]){
			max = w[i];
		}
		average+=w[i];
	}
	average/=K;

	printf("%d\n",calc(N,K,w,max,average));


	return 0;
}


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

int main(){
  char X, Y;
  cin >> X >> Y;
  map<char, int> abc;
  abc['A'] = 10;
  abc['B'] = 11;
  abc['C'] = 12;
  abc['D'] = 13;
  abc['E'] = 14;
  abc['F'] = 15;
  
  int Xv = abc[X];
  int Yv = abc[Y];
  
  if(Xv == Yv)
    cout << "=" << endl;
  else if(Xv > Yv)
    cout << ">" << endl;
  else
    cout << "<" << endl;
}


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

using namespace std;


long long n;
long long a, b, c, d;

void hawawa(){
	cin >> n >> a >> b >> c >> d;
	long long dif= abs(b - a);
	long long dif2 = abs(d - c);
	if (d * n - 2 < dif) {
		cout << "NO\n";
		return;
	}
	for (int i = 1; i * 2 <= n - 1; i++) {
		if (a + i * c - (n - i - 1) * d <= b && b <= a + i * d - (n - i - 1) * c) {
			cout << "YES\n";
			return;
		}
		if (a - i * c + (n - i - 1) * d >= b && b >= a - i * d + (n - i - 1) * c) {
			cout << "YES\n";
			return;
		}
	}
	cout << "NO\n";
}

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


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

int main () {
  string S;
  cin >> S;
  int N = S.size();
  int counta = 0;
  int countb = 0;
  
  if (S.at(0) == 'k'){
    counta++;
    if (counta == 1 && S.at(1) == 'e'){
      counta++;
      if (counta == 2 && S.at(2) == 'y'){
        counta++;
        if (counta == 3 && S.at(3) == 'e'){
          counta++;
          if (counta == 4 && S.at(4) == 'n'){
            counta++;
            if (counta == 5 && S.at(5) == 'c'){
              counta++;
              if (counta == 6 && S.at(6) == 'e'){
                counta++;
              }
            }
          }
        }
      }
    }
  }
  
  
  if (S.at(N-1) == 'e'){
    countb++;
    if (countb == 1 && S.at(N-2) == 'c'){
      countb++;
      if (countb == 2 && S.at(N-3) == 'n'){
        countb++;
        if (countb == 3 && S.at(N-4) == 'e'){
          countb++;
          if (countb == 4 && S.at(N-5) == 'y'){
            countb++;
            if (countb == 5 && S.at(N-6) == 'e'){
              countb++;
              if (countb == 6 && S.at(N-7) == 'k'){
                countb++;
              }
            }
          }
        }
      }
    }
  }
  
  if (counta + countb >= 7){
    cout << "YES" << endl;
  }
  else {
    cout << "NO" << endl;
  }
}
    
    
   
    
    
  
    
      
    
      
   
        
    

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

using namespace std;

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

    map<string, string> ans;
    ans["Sunny"] = "Cloudy";
    ans["Cloudy"] = "Rainy";
    ans["Rainy"] = "Sunny";
    string s;
    cin >> s;
    cout << ans[s];

    return 0;
}

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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
using ll = long long;
using P = pair<ll, ll>;
string char_to_string(char val) {
  return string(1, val);
}
int char_to_int(char val) {
  return val - '0';
}
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;
}
struct edge {
  ll to, cost;
};

int main() {
  string S, T; cin >> S >> T;
  bool f = false;
  for(int i = S.size() - 1; i >= 0; --i) {
    for(int k = i; k < i + T.size(); ++k) {
      if(!(S[k] == T[k - i] || '?' == S[k])) {
        break;
      }
      if(k == i + T.size() - 1) {
        for(int m = i; m < i + T.size(); ++m) {
          if(S[m] == '?') S[m] = T[m - i];
        }
        f = true;
      }
    }
    if(f) break;
  }
  REP(i, S.size()) if(S[i] == '?') S[i] = 'a'; // 後処理
  if(f) cout << S << endl;
  else cout << "UNRESTORABLE" << endl;
}

Measured memory_bytes: 3564
#include <iostream>

using namespace std;
typedef long long ll;
ll ans;

int sum[11][11];

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

  for(int i = 1; i <= 10; i++) {
    for(int j = 1; j <= 10; j++) {
      for(int k = 1; k <= n; k++) {
	int tmp = k % 10;
	int tmp2 = k;
	while((tmp2 / 10) != 0) {
	  tmp2 /= 10;
	}
	if(tmp2 == j && tmp == i)sum[i][j]++;
      }
    }
  }

  for(int i = 1; i <= n; i++) {
    int tmp = i % 10;
    int tmp2 = i;
    while((tmp2 / 10) != 0) {
      tmp2 /= 10;
    }
    ans += sum[tmp2][tmp];
  }

  cout << ans << endl;
	
    
}


Measured memory_bytes: 256
#![allow(unused, non_snake_case, dead_code, non_upper_case_globals)]
use std::cmp::*;
use std::collections::*;
use std::mem::*;

fn main() {
    let (r, w, e) = (std::io::stdin(), std::io::stdout(), std::io::stderr());
    let mut io = IO::new(r.lock(), w.lock(), e.lock());
    assert_eq!(!0usize, std::usize::MAX); //🙊
    let (a, b, c) = (io.read::<i64>(), io.read::<i64>(), io.read::<i64>());

    for i in 1..b {
        if a * i % b == c {
            io.writeln("YES");
            return;
        }
    }
    io.writeln("NO");
}

fn gcd(a: i64, b: i64) -> i64 {
    if b == 0 {
        return a;
    }
    return gcd(b, a % b);
}

static MOD: i64 = 1000000007;
static INF: i64 = std::i64::MAX >> 1;
// IO
use std::io::*;
struct IO<R: Read, W: Write, E: Write> {
    Read: R,
    Write: BufWriter<W>,
    Error: BufWriter<E>,
}
impl<R: Read, W: Write, E: Write> IO<R, W, E> {
    fn new(r: R, w: W, e: E) -> IO<R, W, E> {
        IO {
            Read: r,
            Write: BufWriter::new(w),
            Error: BufWriter::new(e),
        }
    }
    fn read<T>(&mut self) -> T
    where
        T: std::str::FromStr,
    {
        let next: String = self
            .Read
            .by_ref()
            .bytes()
            .map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect();
        next.parse().ok().unwrap()
    }
    fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
    fn chari(&mut self) -> Vec<i64> {
        self.chars()
            .iter()
            .map(|&c| (c as u8 - b'0') as i64)
            .collect::<Vec<i64>>()
    }
    fn readn<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read::<T>()).collect::<Vec<_>>()
    }
    fn readmat<T: std::str::FromStr>(&mut self, n: usize, m: usize) -> Vec<Vec<T>> {
        (0..n).map(|_| self.readn(m)).collect()
    }
    fn write<S: ToString>(&mut self, val: S) {
        self.Write.write(val.to_string().as_bytes());
    }
    fn writeln<S: ToString>(&mut self, val: S) {
        self.Write.write(val.to_string().as_bytes());
        self.Write.write(b"\n");
    }
    fn debug<S: std::fmt::Debug>(&mut self, val: S) {
        writeln!(self.Error, "(debug) {:?}", &val);
    }
    fn debug2<S: std::fmt::Debug, T: std::fmt::Debug>(&mut self, val1: S, val2: T) {
        writeln!(self.Error, "(debug2) {:?} -> {:?}", val1, val2);
    }
    fn debug3<S: std::fmt::Debug, T: std::fmt::Debug, U: std::fmt::Debug>(
        &mut self,
        val1: S,
        val2: T,
        val3: U,
    ) {
        writeln!(
            self.Error,
            "(debug3) {:?} -> {:?} -> {:?}",
            val1, val2, val3
        );
    }
}


Measured memory_bytes: 4352
#include <stdio.h>
int main(void){
    int n , x ;
    int i , j , k ;
    
    while(1){
        int count = 0;
        scanf("%d %d" , &n , &x) ;
        if(n == 0  && x == 0){break;}
        
        
        for(i = 1 ; i <= n ; i++){
            for(j = i + 1 ; j <= n ; j++ ){
                for(k = j + 1 ; k <= n ; k++){
                    if(i + j + k == x){
                        count++;
                    }
                }
            }
        }
        printf("%d\n" , count);
    }//while(1)
}


Measured memory_bytes: 2108
//#include "bits\stdc++.h"
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;
typedef long long LL;

int main()
{
    string a;

    cin >> a;

    for (int i = 0; i < 5; ++i) cout << a[i];
    cout << " ";
    for (int i = 0; i < 7; ++i) cout << a[i + 6];
    cout << " ";
    for (int i = 0; i < 5; ++i) cout << a[i + 14];

    cout << endl;

    return 0;
}

Measured memory_bytes: 256
"""
- https://atcoder.jp/contests/abc136/tasks/abc135_a
- |A−K|=|B−K| (others:IMPOSSIBLE)
- reg: 0≤A, B≤10^9
"""

a, b = map(int, input().split())
# 三項演算子
k = int ((a+b)/2) if (a+b) % 2 == 0 else 'IMPOSSIBLE'

print(k)


Measured memory_bytes: 2940
matrix = []
for i in range(3):
    matrix.append(list(map(int, input().split())))
col = [[0, 0, 0] for i in range(3)]
for _ in range(int(input())):
    n = int(input())
    for i in range(3):
        for j in range(3):
            if matrix[i][j] == n:
                col[i][j] = 1
                break
f = 0
sd1 = col[0][2] + col[1][1] + col[2][0]
if sd1 == 3:
    print('Yes')
    exit()
sd = 0
for i in range(3):
    s, s1 = 0, 0
    sd += col[i][i]
    for j in range(3):
        s += col[i][j]
        s1 += col[j][i]
    if s == 3 or s1 == 3:
        f = 1
        break
if f:
    print('Yes')
else:
    if sd == 3:
        print('Yes')
    else:
        print('No')


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

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

	vector<int> B(N-1);
	rep(i, N-1) {
		cin >> B[i];
	}

	int ans = B[0] + B[N-2];
	rep(i, N-2) {
		ans += min(B[i], B[i+1]);
	}

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


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

int main() {
    int X, A, B;
    cin >> X >> A >> B;
    if (B - A <= 0) cout << "delicious\n";
    else if (B - A <= X) cout << "safe\n";
    else cout << "dangerous\n";
}

Measured memory_bytes: 256
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))

d = {}
for i in A:
    if i not in d.keys():
        d[i] = 1
    else:
        d[i] = d[i] + 1

L = list(d.values())

if len(L) <= K:
    print(0)
else:
    L.sort()
    print(sum(L[:-K]))


Measured memory_bytes: 33152
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Peaks solver = new Peaks();
        solver.solve(1, in, out);
        out.close();
    }

    static class Peaks {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            int m = in.nextInt();

            long[] h = new long[n + 1];
            for (int i = 1; i <= n; i++) {
                h[i] = in.nextInt();
            }

            boolean[] result = new boolean[n + 1];
            Arrays.fill(result, true);

            for (int i = 1; i <= m; i++) {
                int a = in.nextInt();
                int b = in.nextInt();

                if (h[a] < h[b]) {
                    result[a] = false;
                } else if (h[a] > h[b]) {
                    result[b] = false;
                } else {
                    result[a] = false;
                    result[b] = false;
                }
            }
            int count = 0;
            for (int i = 1; i <= n; i++) {
                if (result[i]) {
                    count++;
                }
            }
            out.append(String.valueOf(count));
        }

    }
}



Measured memory_bytes: 60640
#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <queue>
#include <utility>
using namespace std;

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

#define For(i, a, b) for(int i = (a); i < (b); i++)
#define Rep(i, n) For(i, 0, (n))
#define Rrep(i, n) for(int i = (n - 1); i >= 0; i--)
#define pb push_back

const int inf = 999999999;
const int mod = 1000000007;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

int main(){
	int a, b, c; cin >> a >> b >> c;
	int ans = 0;
	int n = max(a, max(b, c));
	ans = a + b + c - n;
	int k; cin >> k;
	Rep(i, k){
		n *= 2;
	}
	ans += n;
	cout << ans << endl;
}

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


int main(){
    int score = 0;
    int N = 26;
    int D;
    cin>> D;

    vector<int> c(N);
    vector<vector<int>> s(D, vector<int>(N));
    vector<int> t(D);
    vector<int> last(N, 0);

    for(int i=0; i<N; i++){
        cin>>c[i];
    }
 
    for(int i=0; i<D; i++){
        for(int j=0; j<N; j++){
            cin>>s[i][j];
        }
    }
    for(int i=0; i<D; i++){
        cin>>t[i];
        t[i]--;
    }

    for(int d = 0; d < D; d++){
        score += s[d][t[d]];
        last[t[d]] = d+1;

        int penalty = 0;
        for(int i = 0; i < N; i++){
            penalty += c[i]*((d+1)-last[i]);    
        }
        //cout<<"ペナルティ : "<<penalty<<endl;
        score -= penalty;        
 
        cout<< score <<endl;
    }
    return 0;
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
#define REP(i, n) for (ll i = 0; i < (ll)n; i++)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
using namespace std;
typedef long long int ll;
typedef vector<int > vecint;
typedef vector<ll > vecll;
typedef vector<vector<int > > vec2int;
typedef vector<bool > vecbool;
typedef vector<string > vecstr;
////////////////////////////////////////////////
int main()
{
  int n, m;
  cin >> n >> m;
  priority_queue<int > q;
  int tmp;
  REP(i,n){
    cin >> tmp;
    q.push(tmp);
  }
  REP(i,m){
    tmp = q.top();q.pop();
    tmp /= 2;
    q.push(tmp);
  }
  ll ans = 0;
  while(!q.empty()){
    tmp = q.top();q.pop();
    ans += tmp;
  }
  cout << ans << endl;
}



Measured memory_bytes: 892
#include<bits/stdc++.h>
using namespace std;
void fl()
{
	freopen(".in","r",stdin);
	freopen(".out","w",stdout);
}
int main()
{
//    fl();
	int h,w,n;
	scanf("%d%d%d",&h,&w,&n);
	int x=max(h,w);
	int ans=(n+x-1)/x;
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 256
R,G,B=map(int,input().split())
K=int(input())


for _ in range (K) :
    if R < G :
        pass
    else:
        G*=2
        continue

    if G < B :
        pass
    else:
        B*=2
        continue
    
if R < G < B :
    print('Yes')
else :
    print('No')

Measured memory_bytes: 9108
#include<bits/stdc++.h>
using namespace std;
int main()
{
    bool yymm=false,mmyy=false;
    string s,fst="",lst="";
    cin>>s;
    for(int i=0; i<4; i++)
    {
        if(i<2)
            fst+=s[i];
        else
            lst+=s[i];
    }
    int f=stoi(fst);
    int l=stoi(lst);
    if(f>=0 && f<=99)
    {
        if(l>=1&& l<=12)
        {
            yymm=true;
        }
    }
    if(f>=1&& f<=12)
    {
        if(l>=0&&l<=99)
        {
            mmyy=true;
        }
    }
    if(yymm && mmyy)
        cout<<"AMBIGUOUS\n";
    else if( yymm ==true && mmyy== false)
    {
        cout<<"YYMM\n";
    }
    else if(yymm==false && mmyy==true)
    {
        cout<<"MMYY\n";
    }
    else
        cout<<"NA\n";
}


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


using namespace std;
#define MAX_N 500

int H, W;
string str[MAX_N+1];
string A[MAX_N+1], B[MAX_N+1];


int main(){
	scanf("%d%d", &H, &W);
	for(int i=0; i<H; i++){
		cin>>str[i];
	}
	for(int i=0; i<H; i++){
		for(int j=0; j<W; j++){
			if(i==0 || (i!=H-1 && (j%2==0 || str[i][j]=='#'))){
				printf("#");
			}else{
				printf(".");
			}
		}printf("\n");
	}printf("\n");
	for(int i=0; i<H; i++){
		for(int j=0; j<W; j++){
			if(i==H-1 || (i!=0 && (j%2==1 || str[i][j]=='#'))){
				printf("#");
			}else{
				printf(".");
			}
		}printf("\n");
	}
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;

int main(int argc, char** argv){
	int n,m;
	cin >> n >> m;
		cout << ((n * (n-1)) + (m * (m-1))) / 2;
	return 0;
}

Measured memory_bytes: 256
from collections import deque
S = list(input())
Q = int(input())
perm = 0
d = deque(S)

for i in range(0, Q):
    l = input().split()
    if len(l) == 1:
        perm += 1
    else:
        if (int(l[1])+perm) % 2 == 0:
            d.append(l[2])
        else:
            d.appendleft(l[2])
 
S0 = list(d)
if perm % 2 != 0:
    S0.reverse()
ans = ""
for i in range(0, len(S0)):
    ans = ans + S0[i]
print(ans)


Measured memory_bytes: 10000
#include<iostream>
using namespace std;
int main(){
    int x, y;
    while(true){
        cin >> x >> y;
        if (x == 0 && y == 0)
           break;
        for (int i=1; i<=x;i++){
            if (i%2 == 1){
             for (int p=1; p<=y;p++){
                 if(p%2==1){
                     cout << "#";
                 }
                 else if(p%2==0){
                     cout <<".";
                 }
                 
             }
             cout << endl;
            
            }
            else if(i%2==0){
                for(int q=1; q<=y;q++){
                    if (q%2==1){
                        cout << ".";
                    }
                    else if(q%2==0){
                        cout << "#";
                    }
                }
                cout << endl;
            }        
        }cout << endl;
    }
    return 0;
}


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

using namespace std;

#define pb push_back
#define ff first
#define ss second
#define sz(x) (int)x.size()
#define all(x) (x).begin(),(x).end()
#define F(i,x,n,y) for(i=x;i<n;i+=y)
#define fi(i,x,n) for(i=x;i<n;++i)
#define f(n) for(int i=0;i<n;++i)
#define fr(i,x,n) for(i=x;i>=n;--i)
#define endl '\n'

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> ii;

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int a,b,k;
    cin>>a>>b>>k;
    int i;
    set<int> s;
    if(a+k-1>=b||b-k+1<=a){
        fi(i,a,b+1) cout<<i<<endl;
        return 0;
    }
    fi(i,a,a+k){
        s.insert(i);
    }
    fi(i,b-k+1,b+1){
        s.insert(i);
    }
    for(auto x:s){
        cout<<x<<endl;
    }
    return 0;
}



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

using namespace std;
typedef long long ll;

#define rep(i , j , n) for(long long i = j ; i <= n ; i++)
const ll N = 123456;

ll a[N];

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    ll n , k;
    cin >> n >> k;

    ll total = n * n;

    if(k == 0) {
        cout << total << endl;
    }
    else {
        ll sum = 0;
        rep(i , 1 , n) {
            if(i - 1 <= k - 1) {
                sum += n;
                //cout << i << " less " << n << endl;
                continue;
            }
            ll extra = (i - k);
            ll div = n / i;
            ll rem = n % i;
            sum += (i - extra) * div;
            sum += min(k - 1 , rem);
            //cout << i << " more " << (n - extra) * div + min(k - 1 , rem) << endl;
        }
        cout << total - sum << endl;
    }
    return 0;
}


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

template <typename _tp> inline void read(_tp&x){
	char c11=getchar(),ob=0;x=0;
	while(c11!='-'&&!isdigit(c11))c11=getchar();if(c11=='-')ob=1,c11=getchar();
	while(isdigit(c11))x=x*10+c11-'0',c11=getchar();if(ob)x=-x;
}

const int N = 101000;
pair <int,int> p[N];
int n,m;

int main(){
	read(n),read(m);
	for(int i=1,x,y;i<=n;++i) read(x),read(y), p[i] = make_pair(x,y);
	sort(p+1,p+n+1);
	ll ans = 0;
	for(int i=1;i<=n;++i){
		int ct = min(p[i].second,m);
		ans += (ll)ct * p[i].first;
		m -= ct;
		if(!m) break;
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 1024
import java.util.*;
public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      long[] a = new long[n+1];
      long[] b = new long[n];
      long cnt = 0;
      for(int i = 0;i < n+1;i++)a[i] = sc.nextLong();
      for(int i = 0;i < n;i++)b[i] = sc.nextLong();
      
      for(int i = 0;i < n;i++){
      	long x = Math.min(a[i],b[i]);
        cnt += x;
        a[i] -= x;
        b[i] -= x;
        long y = Math.min(a[i+1],b[i]);
        cnt += y;
        a[i+1] -= y;
        b[i] -= y;
      }
      System.out.println(cnt);
    }
}


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

using namespace std;


int main()
{
    int x,n;
    cin>>x>>n;
    vector<int>nms(105);
    for(int i=0;i<n;i++){
        int tm;
        cin>>tm;
        nms[tm]=1;
    }
    int l=x,r=x;
    while(1){
        if(l<1||nms[l]==0){
            cout<<l<<'\n';
            break;
        }
        l--;
        if(r>100||nms[r]==0){
            cout<<r<<'\n';
            break;
        }
        r++;
    }
    return 0;

}
/***
5 4 1
1000000000 1000000000 1000000000 1000000000 1000000000
1000000000 1000000000 1000000000 1000000000
3 4 730
60 90 120
80 150 80 150
*/


Measured memory_bytes: 3632
#include <cstdio>

using namespace std;

int main() {
    long long a, b, c, k;
    
    scanf("%lld %lld %lld %lld", &a, &b, &c, &k);
    
    if (k % 2 == 0) {
        printf("%lld\n", a - b);
    } else {
        printf("%lld\n", b - a);
    }
    
    return 0;
}


Measured memory_bytes: 128
main :: IO ()
main = do
  n <- readLn
  case solve n of
      res -> do
          print $ length res
          putStr . unlines . map (unwords.map show) $ map (\(x, y) -> [x, y]) res

solve :: Int -> [(Int, Int)]
solve n
    | even n = [(x, y)|x<-[1..n], y<-[x+1..n], x + y /= n + 1]
    | otherwise = [(x, y)|x<-[1..n], y<-[x+1..n], x + y /= n || y == n ]

Measured memory_bytes: 1660
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rep2(j,n) for(int j = 0; j < (n); ++j)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("YES");}else{puts("NO");}
const int MX = 200005;

int main() {
  int N;
  cin >> N;
  int l[N];
  int maxn = 0;
  int sum = 0;
  rep(i,N){
    cin >> l[i];
    maxn = max(maxn, l[i]);
    sum += l[i];
  }
  if(sum - maxn > maxn) {
    cout << "Yes" << endl;
  } else {
    cout << "No" <<  endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<string>
#include<set>
#include<map>
#include<vector>
#include<queue>
#include<stack>
#include<deque>
#include<tuple>
#include<algorithm>
#include<numeric>
#include<limits>
#include<boost/multiprecision/cpp_int.hpp>
using namespace boost::multiprecision;
using namespace std;
#define BEGIN ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define END return EXIT_SUCCESS
#define up(I,A,B) for(auto I=(A);I<=(B);++I)
#define dw(I,A,B) for(auto I=(A);I>=(B);--I)
#define rep(I,N) up(I,0,N-1)
#define all(C) (C).begin(),(C).end()
#define rall(C) (C).rbegin(),(C).rend()
#define ft first
#define sd second
#define mp make_pair
#define mt make_tuple
#define pf push_front
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define rs resize
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T>inline void                                      in(T &p){cin>>p;}
template<class T1,class T2>inline void                            in(T1 &p1,T2 &p2){cin>>p1>>p2;}
template<class T1,class T2,class T3>inline void                   in(T1 &p1,T2 &p2,T3 &p3){cin>>p1>>p2>>p3;}
template<class T1,class T2,class T3,class T4>inline void          in(T1 &p1,T2 &p2,T3 &p3,T4 &p4){cin>>p1>>p2>>p3>>p4;}
template<class T1,class T2,class T3,class T4,class T5>inline void in(T1 &p1,T2 &p2,T3 &p3,T4 &p4,T5 &p5){cin>>p1>>p2>>p3>>p4>>p5;}
template<class T>inline void                                      ins(T &p){for_each(all(p),in<decltype(p[0])>);}
template<class T>inline void                             out(T p){cout<<p<<"\n";}
template<class T1,class T2>inline void                   out(T1 p1,T2 p2){cout<<p1<<" "<<p2<<"\n";}
template<class T1,class T2,class T3>inline void          out(T1 p1,T2 p2,T3 p3){cout<<p1<<" "<<p2<<" "<<p3<<"\n";}
template<class T1,class T2,class T3,class T4>inline void out(T1 p1,T2 p2,T3 p3,T4 p4){cout<<p1<<" "<<p2<<" "<<p3<<" "<<p4<<"\n";}
inline void                                              out(ld p){printf("%.12Lf\n",p);}
template<class T>inline void outml(T p){for_each(all(p),out<decltype(p[0])>);}//ml=multi line
template<class T>inline void outol(T V){auto n=V.size();rep(i,n)cout<<V[i]<<" \n"[i==n-1];}//ol=one line
inline void solve(void){
  string s;
  in(s);
  ll cnt_g=0,cnt_p=0,cnt_win=0,cnt_lose=0;
  for(auto e:s){
    if(e=='g'&&cnt_p<cnt_g){
      cnt_win++;
      cnt_p++;
    }else if(e=='p'&&cnt_p==cnt_g){
      cnt_lose++;
      cnt_g++;
    }else if(e=='g'){
      cnt_g++;
    }else if(e=='p'){
      cnt_p++;
    }
  }
  out(cnt_win-cnt_lose);
}
int main(void){
  BEGIN;
  solve();
  END;
}


Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <queue>
#include <map>
using namespace std;
typedef long long ll;
const int INF = 1<<30; 
const int MOD = 1e9 + 7;
const int dy[] = {1, 0, -1, 0};
const int dx[] = {0, 1, 0, -1};
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(8);
    double a;
    while(cin >> a)
    {
        vector<double> v;
        v.push_back(0);
        v.push_back(a);
        for(int i = 2; i <= 10; i++)
        {
            if(i % 2 == 0) v.push_back(v[i - 1] * 2);
            else v.push_back(v[i - 1] / 3);
        }
        double ans = 0;
        for(int i = 0; i < v.size(); i++) ans += v[i];
        cout << ans << "\n";
    }
    return 0;
}




Measured memory_bytes: 3188
#include<iostream>

using namespace std;

int main(void)
{
  int k,a,b;
  cin >> k >> a >> b;
  
  for(int i = a; i <= b; i++)
  {
    if(i % k == 0)
    {
      cout << "OK";
      return 0;
    }
  }
  
  cout << "NG";
  return 0;
}

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

//http://hos.ac/slides/20140319_bit.pdf
template<class T, int MAX_N>
struct FenwickTree { //0-indexed
    int N;
    T data[MAX_N];
    void init(int n) {
        N = n;
        memset(data, 0, sizeof(data));
    }
    T sum(int j) { //[0, j)
        T ret = 0;
        for(int x = j - 1; x >= 0; x = (x & (x + 1)) - 1)
          ret += data[x];
        return ret;
    }
    void add(int j, T w) { // 0 <= j < N
        for(int x = j; x < N; x |= x + 1)
          data[x] += w;
    }
};

//Range Minimum Query
template<class T, int MAX_N>
struct SegmentTree {
    int n;
    T data[MAX_N * 2 - 1];
    const T INF = (1LL << 31) - 1LL;//rewrite
    void init(int n_) {
        n = 1;
        while(n < n_) n *= 2;
        fill_n(data, 2 * n - 1, INF);
    }
    void update(int k, T a) {//0-indexed
        k += n - 1;
        data[k] = a;
        while(k > 0) {
            k = (k - 1) >> 1;
            data[k] = min(data[k * 2 + 1], data[k * 2 + 2]); 
        }
    }
    T __query(int a, int b, int k, int l, int r) {
        if(r <= a || b <= l) return INF;
        if(a <= l && r <= b) return data[k];
        else {
            T val_l = __query(a, b, k * 2 + 1, l, (l + r) >> 1);
            T val_r = __query(a, b, k * 2 + 2, (l + r) >> 1, r);
            return min(val_l, val_r);
        }
    }
    T query(int a, int b) { //[a, b)
        return __query(a, b, 0, 0, n);
    }
};

SegmentTree<long long, 1 << 17> segt;
int main() {
    cin.tie(0); ios::sync_with_stdio(false);
    int N, Q; cin >> N >> Q;
    segt.init(N);
    for(int i = 0; i < Q; ++i) {
        int com, x, y;
        cin >> com >> x >> y;
        if(com == 0) {
            segt.update(x, static_cast<long long>(y));
        }
        else
          cout << segt.query(x, y + 1) << '\n';
    }
    return 0;
}

Measured memory_bytes: 5212
using System;

public class Problem_C
{
  public static void Main(string[] args)
  {
    var nums = Array.ConvertAll(Console.ReadLine().Split(), long.Parse);
    long x = nums[0], y = nums[1];
    var i = 0;
    long num;
    for (i = 0; ; i++)
    {
      num = x * (long) Math.Pow(2, i);
      if (num > y) break;
    }
    Console.WriteLine($"{i}");
  }
}


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

int main(){
    long int K;
    cin>>K;
    queue<long long> S;
    S.push(1);
    S.push(2);
    S.push(3);
    S.push(4);
    S.push(5);
    S.push(6);
    S.push(7);
    S.push(8);
    S.push(9);
    long long count=9,ans=K,f;
    int amari;
    while(count<K&&K>=10){
        f=S.front();
        amari=f%10;
        if (amari==0){
            S.push(10*f);
            count+=1;
            if (count==K) ans=10*f;
            S.push(10*f+1);
            count+=1;
            if (count==K) ans=10*f+1;
            S.pop();
        }
        else if(amari==9){
            S.push(10*f+8);
            count+=1;
            if (count==K) ans=10*f+8;
            S.push(10*f+9);
            count+=1;
            if (count==K) ans=10*f+9;
            S.pop();
        }
        else{
            S.push(10*f+amari-1);
            count+=1;
            if (count==K) ans=10*f+amari-1;
            S.push(10*f+amari);
            count+=1;
            if (count==K) ans=10*f+amari;
            S.push(10*f+amari+1);
            count+=1;
            if (count==K) ans=10*f+amari+1;
            S.pop();
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 768
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.util.NoSuchElementException;

public class Main {

	static PrintWriter out;
	static InputReader ir;

	static void solve() {
		int a=ir.nextInt();
		int b=ir.nextInt();
		if(a==1) a+=13;
		if(b==1) b+=13;
		out.println(a>b?"Alice":a<b?"Bob":"Draw");
	}

	public static void main(String[] args) throws Exception {
		ir = new InputReader(System.in);
		out = new PrintWriter(System.out);
		solve();
		out.flush();
	}

	static class InputReader {

		private InputStream in;
		private byte[] buffer = new byte[1024];
		private int curbuf;
		private int lenbuf;

		public InputReader(InputStream in) {
			this.in = in;
			this.curbuf = this.lenbuf = 0;
		}

		public boolean hasNextByte() {
			if (curbuf >= lenbuf) {
				curbuf = 0;
				try {
					lenbuf = in.read(buffer);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (lenbuf <= 0)
					return false;
			}
			return true;
		}

		private int readByte() {
			if (hasNextByte())
				return buffer[curbuf++];
			else
				return -1;
		}

		private boolean isSpaceChar(int c) {
			return !(c >= 33 && c <= 126);
		}

		private void skip() {
			while (hasNextByte() && isSpaceChar(buffer[curbuf]))
				curbuf++;
		}

		public boolean hasNext() {
			skip();
			return hasNextByte();
		}

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

		public int nextInt() {
			if (!hasNext())
				throw new NoSuchElementException();
			int c = readByte();
			while (isSpaceChar(c))
				c = readByte();
			boolean minus = false;
			if (c == '-') {
				minus = true;
				c = readByte();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res = res * 10 + c - '0';
				c = readByte();
			} while (!isSpaceChar(c));
			return (minus) ? -res : res;
		}

		public long nextLong() {
			if (!hasNext())
				throw new NoSuchElementException();
			int c = readByte();
			while (isSpaceChar(c))
				c = readByte();
			boolean minus = false;
			if (c == '-') {
				minus = true;
				c = readByte();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res = res * 10 + c - '0';
				c = readByte();
			} while (!isSpaceChar(c));
			return (minus) ? -res : res;
		}

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

		public int[] nextIntArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}

		public long[] nextLongArray(int n) {
			long[] a = new long[n];
			for (int i = 0; i < n; i++)
				a[i] = nextLong();
			return a;
		}

		public char[][] nextCharMap(int n, int m) {
			char[][] map = new char[n][m];
			for (int i = 0; i < n; i++)
				map[i] = next().toCharArray();
			return map;
		}
	}
}

Measured memory_bytes: 21204
#define  _CRT_SECURE_NO_WARNiINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <fstream>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
using namespace std;
#define eps 0.000000001
#define LONG_INF 10000000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define REP(i,n) for(long long i = 0;i < n;++i)
int main() {
	string s, t;
	cin >> s >> t;
	s += s;
	for (int i = 0; i < t.length(); ++i) {
		int failed = 0;
		for (int q = 0; q < t.length(); ++q) {
			if (s[i + q] != t[q]) {
				failed = 1;
				break;
			}
		}
		if (failed == 0) {
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 888
#include <iostream>
#include <string>
using namespace std;
int main(){
  string S[7] = {"SUN","MON","TUE","WED","THU","FRI","SAT"};
  string t;
  cin >> t;
  for(int i = 0; i < 7; i++ ){
    if(t == S[i]) cout << 7-i << endl;
  }
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Contest
{
    class Program
    {
        static int Main(string[] args)
        {
            new Program().Process();

            return 0;
        }

        private CommonInput cin;

        private void Process()
        {
            this.cin = new CommonInput();

            int x;

            x = cin.GetInt();

            Console.WriteLine("{0}", x * x * x);
        }
    }

    public class CommonInput
    {
        public CommonInput()
        {
            this._s = new string[0];
            this._i = 0;
        }

        private string[] _s;
        private int _i;
        private char[] _sep = { ' ', ',' };

        public string GetLine()
        {
            if (this._i < this._s.Length)
                return this._s[this._i++];

            string line;
            this._i = 0;
            do
            {
                line = Console.ReadLine();
            } while (line == "");

            this._s = line.Split(this._sep, StringSplitOptions.RemoveEmptyEntries);

            return this._s[this._i++];
        }

        public int GetInt()
        {
            return int.Parse(this.GetLine());
        }

        public long GetLong()
        {
            return long.Parse(this.GetLine());
        }

        public double GetDouble()
        {
            return double.Parse(this.GetLine());
        }
    }
}

Measured memory_bytes: 5628
#include<iostream>
#include <vector>
#include<cmath>
using namespace std;

int main(){
    int n;
    cin >> n;
    int a[n+2];
    int diff[n+2];
    
    a[n+1] = 0;
    a[0] = 0;
    for(int i=1;i<n+1;i++){
        cin >> a[i];
    }
    long long sum = 0;
    for(int i=0;i<n+1;i++){
        diff[i] = abs(a[i+1]-a[i]);
        sum += diff[i];
    }
    for(int i=0;i<n;i++){
        cout << sum-diff[i] - diff[i+1] + abs(a[i]-a[i+2]) <<endl;
    }
    return 0;
}

Measured memory_bytes: 2048
#include <bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
#define F first
#define S second
#define all(x) x.begin(),x.end()
using namespace std;
const int MX = 2e5+5;
const int MOD = 998244353;
ll bit[MX];
void upd(ll x,ll val){
    for( ; x<MX ; x+=x&-x)
        bit[x] += val;
}
ll ex(ll x,ll y){
    if(y == 0)
        return 1ll;
    if(y&1)
        return x * ex(x * x % MOD, y / 2) % MOD;
    return ex(x * x % MOD, y / 2);
}
ll get(int x){
    ll ans = 0;
    for( ; x>0 ; x-=x&-x)
        ans += bit[x];
    return ans;
}
struct Point{
    int x,y;
    ll a,b,c,d;
    bool operator<(const Point& p) const{
        if(x == p.x)
            return y < p.y;
        return x < p.x;
    }
};
int n,m;
vector<Point> v;
map<int,vector<int> > mp;
int main(){
    cin >> n;
    for(int i=0 ; i<n ; ++i){
        int x,y;
        cin >> x >> y;
        mp[y].push_back(x);
    }
    m=0;
    for(auto vec : mp){
        m++;
        for(auto el : vec.S){
            v.push_back({el,m});
        }
    }
    memset(bit,0,sizeof(bit));
    sort(all(v));
    for(int i=0 ; i<n ; ++i){
        v[i].d = get(v[i].y);
        v[i].a = get(m) - get(v[i].y);
        upd(v[i].y,1);
    }
    memset(bit,0,sizeof(bit));
    for(int i=n-1 ; i>=0 ; --i){
        v[i].b = get(v[i].y);
        v[i].c = get(m) - get(v[i].y);
        upd(v[i].y,1);
    }
    ll ans = 0;
    for(int i=0 ; i<n ; ++i){
        ll two = ex(2,n);
        ll num = 0;
        num += ex(2,v[i].a + v[i].d);num %= MOD;
        num += ex(2,v[i].c + v[i].b);num %= MOD;
        num += ex(2,v[i].a + v[i].c);num %= MOD;
        num += ex(2,v[i].d + v[i].b);num %= MOD;
        num -= ex(2,v[i].a);
        if(num < 0)num+=MOD;
        num -= ex(2,v[i].b);
        if(num < 0)num+=MOD;
        num -= ex(2,v[i].c);
        if(num < 0)num+=MOD;
        num -= ex(2,v[i].d);
        if(num < 0)num+=MOD;
        ans += (two - num + MOD)%MOD;
        ans %= MOD;
    }
    cout << ans-n << "\n";
}

Measured memory_bytes: 34540
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<ll>;
using vs = vector<string>;
#define  rep(i,n) for(ll i = 0; i < (n); ++i)
#define  red(i,n) for(ll i = (n)-1; i >= 0; --i)
#define  all(a)   begin(a),end(a)
#define  pb(a)    push_back(a)
#define  mp(a,b)  make_pair(a,b)
#define  yn(a)    cout << ( (a)?"Yes\n":"No\n" );
inline ll gcd(ll a,ll b) { return b?gcd(b,a%b):a; }
const ll INF = 1e9+9, LINF = 1e18;


int main()
{
    ll n,ans=0;
    cin>>n;
    ll a[n];
    rep(i,n)cin>>a[i],a[i]-=i+1;
    sort(a,a+n);
    rep(i,n)ans+=abs(a[i]-a[n/2]);
    cout<<ans<<endl;
    
    return 0;
}


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

int main() {
  int N;
  cin >> N;
 
  vector<int> p(N);
  p.at(0) = -1;
  for (int i = 1; i < N; i++) {
    cin >> p.at(i);
  }
 
  vector<vector<int>> children(N);
  for (int i = 1; i < N; i++) {
    int parent = p.at(i) - 1;
    children.at(parent).push_back(i);
  }
 
  for (int i = 0; i < N; i++) {
    cout << children.at(i).size() << endl;
  }
}


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

int main() {
  int l ;
  int n ;
  cin >> l >> n;
  vector<int> vec(n);
 for (int i=0; i<n; i ++){
   cin >> vec.at(i);
 }
 int s =l-vec.at(n-1)+vec.at(0);
  for (int i=0; i<(n-1); i ++){
    if(vec.at(i+1)-vec.at(i) >s){
      s=vec.at(i+1)-vec.at(i);}
  }
  cout << l-s << endl;
}

Measured memory_bytes: 1024