akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long long ll;
typedef pair<ll, ll> PLL;
typedef vector<int> VI;
typedef vector<char> VC;
typedef vector<double> VD;
typedef vector<string> VS;
typedef vector<ll> VLL;
typedef vector<PLL> VP;
const static int INF = 1000000000;
const static int MOD = 1000000007;
#define rep(i,n) for (ll i=0; i<(ll)(n); i++)
#define repd(i,n) for (ll i=n-1; i>=0; i--)
#define rept(i,m,n) for(ll i=m; i<n; i++)
#define stl_rep(itr, x) for (auto itr = x.begin(); itr != x.end(); ++itr)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define PF push_front
#define PB push_back
#define SORT(V) sort((V).begin(), (V).end())
#define RVERSE(V) reverse((V).begin(), (V).end())
#define paired make_pair
#define PRINT(V) for(auto v : (V)) cout << v << " "
//charを整数に
int ctoi(char c) { if (c >= '0' && c <= '9') { return c - '0'; } return 0; }
// 累積和 for (int i = 0; i < N; ++i) s[i+1] = s[i] + a[i]; 
void cum_sum(int N,vector<double> a, vector<double> &s){ for(int i=0; i<N; i++){ s[i+1]=s[i]+a[i];}}
//ユークリッドの控除法
ll gcd(ll a,ll b){
    if(b == 0) return a;
    return gcd(b,a%b);
}
//最小公倍数
ll lcm(ll a,ll b){
    ll g = gcd(a,b);
    return a / g * b; // Be careful not to overflow
}
//素数判定
bool is_prime(long long n) {
    if (n <= 1) return false;
    for (long long p = 2; p * p <= n; ++p) {
        if (n % p == 0) return false;
    }
    return true;
}
int getdigit(ll num){
    unsigned digit=0;
    while(num!=0){
        num /= 10;
        digit++;
    }
    return digit;
}
//空白文字も入力 getline(cin, S);
//桁数指定 setprecision

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N;
    cin >> N;
    VS S(N);
    vector<pair<char, int>> A(N);
    rep(i,N){
        cin >> S[i];
    }
    vector<char> ans;
    int mini=INF;
    vector<char> B={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
    rep(i,B.size()){
        int count=0;
        rep(j,N){
            rep(k,S[j].size()){
                if(B[i]==S[j][k]){
                    count++;
                }
            }
            if(count<mini){
                mini=count;
            }
            count=0;
        }
        if(mini>0){
            rep(k,mini){
                ans.push_back(B[i]);
            }
        }
        mini=INF;
    }
    sort(all(ans));
    rep(i,ans.size()){
        cout << ans[i];
    }
    cout << endl;
}





Measured memory_bytes: 256
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

H, W, K = MAP()

s = [input() for _ in range(H)]

tmp = 0
ans = [[0]*W for _ in range(H)]
for i in range(H):
	if "#" not in s[i]:
		if i != 0:
			ans[i] = ans[i-1]
			continue
		else:
			continue
	is_first = True
	tmp += 1
	for j in range(W):
		if s[i][j] == "#" and tmp != K:
			if is_first:
				is_first = False
			else:
				tmp += 1
		ans[i][j] = tmp

for i in range(H-1, -1, -1):
	if not any(ans[i]):
		ans[i] = ans[i+1]

for l in ans:
	print(*l)


Measured memory_bytes: 9588
#include <bits/stdc++.h>
using namespace std;
int bar(int a) {
	int p = 1;
	if (a == 1)
	{
		return p;
	}
	else
	{
		return a * bar(a - 1);
	}
}
int main() {
	
	int N;
	double ans = 0;
	cin >> N;
	vector<int> X(N), Y(N),Nu;
	for (size_t i = 0; i < N; i++)
	{
		cin >> X.at(i) >> Y.at(i);
		Nu.push_back(i);
	}
	do
	{
		for (size_t i = 0; i < N-1; i++)
		{
			ans += sqrt(pow(X.at(Nu.at(i)) - X.at(Nu.at(i+1)), 2) + pow(Y.at(Nu.at(i)) - Y.at(Nu.at(i+1)), 2));
		}
		
	} while (next_permutation(Nu.begin(), Nu.end()));
	cout << setprecision(10) << ans/bar(N) ;
	
}

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

using namespace std;

int n, x, ans;

int main() {
    cin >> n;

    for (int i = 1; i <= n; ++i) {
        cin >> x;

        if (x%2 && i%2)
            ++ans;
    }

    cout << ans;
    return 0;
}

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

using namespace std;

int main()
{
	long long res;
	int n, k, x, y;
	cin >> n >> k >> x >> y;
	if(n <= k) {
	 	cout << n * x << endl;
	}
	else {
	 	res = k * x;
	 	res += (n - k) * y;
	 	cout << res << endl;
    }

	return 0;
}	

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<iostream>
using namespace std;
int main(void){
	int N,A,B,C,D,AB,CD;
	cin>>N>>A>>B>>C>>D;
	AB=N/A*B;
	if(N%A!=0){
		AB+=B;
	}
	CD=N/C*D;
	if(N%C!=0){
		CD+=D;
	}
	if(CD>AB){
		cout<<AB<<endl;
	}
	else{
		cout<<CD<<endl;
	}
	return 0;
}


Measured memory_bytes: 3108
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args) {
		Main mainObj = new Main();
		mainObj.solve();
	}
	
	public void solve() {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		sc.close();
		
		if((a == 1 && b == 2) || (a == 2 && b == 1)) {
			System.out.println("3");
		}else if((a == 2 && b == 3) || (a == 3 && b == 2)) {
			System.out.println("1");
		}else {
			System.out.println("2");
		}
	}

}

Measured memory_bytes: 23124
#include <iostream>
#include <vector>
#include <array>
#include <set>
#include <cmath>
#include <string>
#include <sstream>
#include <queue> 
#include <list>
#include <stack>
#include <unordered_map>
#include <algorithm> 
#include <numeric>  
#include <functional>
#include <cassert>
#include <bitset>
#include <cctype>  
#include <iomanip> 
#include <limits>  
#include <regex>
// std::numeric_limits<int>::max(), min()
// std::setprecision(X)
// std::islower(), std::isupper(), std::tolower, std::toupper
// std::accumulate(m.begin(), m.end(), 0LL);
// std::sort(begin(),end()) // 0, 1, 2, 3 ,4 (default, less);
// std::priority_queue<int, vector<int>, less<int>> que; // 4, 3, 2, 1 (defualt, less) : 
// if ( std::regex_match(S, std::regex("(dream|dreamer|erase|eraser)*")) ) std::cout << "YES" << std::endl;
 
#define rep(i, n) for(int i = 0; i < (int)(n);    i++)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
typedef long long ll;
typedef std::vector<int> vi;
typedef std::vector<std::vector<int>> vvi;

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

int R, S, P; 
int Get( char c ) {
  if ( c == 'r' ) return P;
  else if ( c == 's' ) return R;
  else return S;
}

int main (void) {
  std::cin.tie(0);  std::ios::sync_with_stdio(false);
  int N, K; std::cin >> N >> K;
  std::cin >> R >> S >> P;
  std::string T; std::cin >> T;

  std::vector<std::vector<char>> G(K);
  rep(i,N) G[ i % K ].push_back( T[i] );

  ll ans = 0;
  rep(i, K) {
    char c = '0';
    bool win = true;
    for(auto&& g : G[i]) {
      if ( c != g ) {
        win = false;
        ans += Get(g);
        c = g;
      }
      else {
        if ( win ) ans += Get(g);
        win = !win;
      }
    }
  }
  std::cout << ans << std::endl;

  return 0;
}


Measured memory_bytes: 5200
n, x = map(int, input().split())
L = [int(x) for x in input().split()]

d = 0
count = 0
if len(L) == 1:
    d += L[0]
    count += 1
    if d <= x:
        count += 1
    print(count)
else:
    for i in range(len(L)):
        d += L[i]
        count += 1
        if d > x:
            print(count)
            break
        if d == x:
            count += 1
            print(count)
            break
        if i+1 == len(L):
            if d <= x:
                count += 1
            print(count)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int N, K, X, Y, sum = 0;
  
  cin >> N >> K >> X >> Y;
  
  for(int i=1;i<=N;i++)
  {
    if(i<=K)
      sum += X;
    else
      sum += Y;
  }
    
  cout << sum << endl;
  
  return 0;
}


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

int main () {
	cin >> s;
	for (int i = 0; i < s.size(); i++) {
		if (i%2 == 1 && s[i] == 'R') {puts("No"); return 0;}
		if (i%2 == 0 && s[i] == 'L') {puts("No"); return 0;}
	}
	puts("Yes");
}

Measured memory_bytes: 256
//package april2020;

import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;

public class Main {
	public static void main(String[] args) throws IOException {
		FastReader scn = new FastReader();
		OutputStream out = new BufferedOutputStream ( System.out );
		int h=scn.nextInt(),w=scn.nextInt();
		int[][] g = new int[h][w];
		long MOD = (long)1e9+7;
		for(int i=0;i<h;i++) {
			String s = scn.next();
			for(int j=0;j<s.length();j++) {
				g[i][j]= s.charAt(j)=='#'?0:1;
			}
		}
		long[][] dp = new long[h][w];
		boolean flag = true;
		for(int i=h-1;i>=0;i--) {
			if(flag) {
				if(g[i][w-1]==0) {
					flag = false;
					dp[i][w-1]=0;
				}else {
					dp[i][w-1]=1;
				}
			}else {
				dp[i][w-1]=0;
			}
		}
//		System.out.println(MOD);
		flag = true;
		for(int i=w-1;i>=0;i--) {
			if(flag) {
				if(g[h-1][i]==0) {
					flag = false;
					dp[h-1][i]=0;
				}else {
					dp[h-1][i]=1;
				}
			}else {
				dp[h-1][i]=0;
			}
		}
		for(int i=h-2;i>=0;i--) {
			for(int j=w-2;j>=0;j--) {
				if(g[i][j]==0) {
					dp[i][j]=0;
				}else {
					dp[i][j]=(dp[i+1][j]%MOD+dp[i][j+1]%MOD)%MOD;
				}
			}
		}
//		for(int i=0;i<h;i++) {
//			for(int j=0;j<w;j++) {
//				System.out.print(g[i][j]+" ");
//			}
//			System.out.println();
//		}
		out.write((""+dp[0][0]+"\n").getBytes());
		out.close();
	}
	static class FastReader 
    { 
        BufferedReader br; 
        StringTokenizer st; 
  
        public FastReader() 
        { 
            br = new BufferedReader(new
                     InputStreamReader(System.in)); 
        } 
  
        String next() 
        { 
            while (st == null || !st.hasMoreElements()) 
            { 
                try
                { 
                    st = new StringTokenizer(br.readLine()); 
                } 
                catch (IOException  e) 
                { 
                    e.printStackTrace(); 
                } 
            } 
            return st.nextToken(); 
        } 
  
        int nextInt() 
        { 
            return Integer.parseInt(next()); 
        } 
  
        long nextLong() 
        { 
            return Long.parseLong(next()); 
        } 
  
        double nextDouble() 
        { 
            return Double.parseDouble(next()); 
        } 
  
        String nextLine() 
        { 
            String str = ""; 
            try
            { 
                str = br.readLine(); 
            } 
            catch (IOException e) 
            { 
                e.printStackTrace(); 
            } 
            return str; 
        } 
    }
}


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

const int MOD = 1000000007;

ll pow_mod(ll n,ll k,ll m){ll r = 1;for(; k > 0;k >>= 1) {if (k & 1) r = (r * n) % m; n = (n * n) % m;}return r;}

//ここから。
int main(){
    ll N;
    cin >> N;
    ll ans = pow_mod(10,N,MOD) - pow_mod(9,N,MOD) -pow_mod(9,N,MOD) + pow_mod(8,N,MOD);
    ans %= MOD;
    ans = (ans + MOD)%MOD;
    cout << ans << endl;
}

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

def main():
    N = int(input())
    TorF = True
    s = []
    for _ in range(N):
        num = int(input())
        if num%10 != 0:
            TorF = False
        s.append(num)
    
    ans = sum(s)        
    if sum(s)%10 != 0:
        print(ans)
    else:
        if TorF:
            print(0)
        else:
            s.sort()
            for i in s:
                if i%10 != 0:
                    print(ans-i)
                    exit()
    
if __name__ == "__main__":
    main()

Measured memory_bytes: 3064
import math
import itertools
n=int(input())
L=[list(map(int,input().split())) for _ in range(n)]

dis=0
a=0
for x in itertools.permutations(L):
    for i in range(n-1):
        dis+=math.sqrt((x[i][0]-x[i+1][0])**2+(x[i][1]-x[i+1][1])**2)
    a+=1

print(dis/a)


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

int main() {
  int N, A,  B ;
  cin >> N >> A >> B ;
  if (N * A >= B) {
    cout << B << endl;
  }
  else if (N*A  < B ){
    cout << N * A << endl;
  }
}
   

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
 //Compiler version g++ 6.3.0

 int main()
 {
 	string n;
 	cin >> n;
 	int a=0,b=0;
 	for (int i = 0; i < n.size(); i++){
 		if(n[i]=='0'){
 			a++;
 		}else{
 			b++;
 		}
 	}
 	cout << min(a,b)*2 << endl;
 }

Measured memory_bytes: 512
use std::io::prelude::*;

fn input<T>() -> T
where
    T: std::str::FromStr,
{
    let stdin = std::io::stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}

fn main() {
    let h: usize = input();
    let w: usize = input();
    let mut a = vec![vec!['#'; w + 2]; h + 2];
    for i in 1..h + 1 {
        let s: Vec<char> = input::<String>().chars().collect();
        for j in 1..w + 1 {
            a[i][j] = s[j - 1];
        }
    }

    let out = std::io::stdout();
    let mut buf = std::io::BufWriter::new(out.lock());
    for i in 0..h + 2 {
        for j in 0..w + 2 {
            write!(buf, "{}", a[i][j]).unwrap();
        }
        writeln!(buf, "").unwrap();
    }
}


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

#define ll long long
#define vecll vector<long long>
#define vec2ll vector<vector<long long>>
#define vecpairll vector<pair<long long,long long>>
#define forll(s,a,b) for(long long s = a;s < b;s++)
#define forllde(s,a) for(long long s = a;s > 0;s--)

template <typename A, typename B>
string to_string(pair<A, B> p);
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);
 
string to_string(const string& s) {
  return '"' + s + '"';
}
 
string to_string(const char* s) {
  return to_string((string) s);
}
 
string to_string(bool b) {
  return (b ? "true" : "false");
}
 
string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}
 
template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}
 
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
 
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#define debug(...) cerr << "<" << #__VA_ARGS__ << ">:", debug_out(__VA_ARGS__)
#define INF LLONG_MAX


int main()
{
  vecll x(5);
  forll(i, 0, 5) cin >> x[i];
  forll(i, 0, 5) {
	if (x[i] == 0){
	  cout << i + 1 << endl;
	  break;
	}
  }
}


Measured memory_bytes: 3612
using System;
using System.Collections.Generic;
using System.Linq;

namespace ConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            var S = Console.ReadLine();

            var sum = 0;
            foreach (var item in S)
            {
                if (item == '+')
                    sum++;
                else
                    sum--;
            }

            Console.WriteLine(sum);
        }
    }
}


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

const int NMAX = 51;
const int MMAX = 101;
const int KMAX = 101;

const int MOD = 1000000007;

pair<int, int> edg[MMAX]; bitset<NMAX> oki;
set<int> mst[MMAX]; vector<pair<int ,int>> gph[NMAX];

int cmb[MMAX + KMAX][MMAX + KMAX];
int lev[NMAX], anc[MMAX], fth[NMAX], fte[NMAX];

void dfs(int x, int f, int c, int &nr) {
    fth[x] = f; oki[x] = true;
    lev[x] = lev[f] + 1; fte[x] = c;
    
    for (pair<int, int> it : gph[x]) {
        int y, e;
        tie(y, e) = it;
        
        if (y == f)
            continue;
        
        if (!oki[y])
            dfs(y, x, e, nr);
        else
        if (lev[x] > lev[y]) {
            anc[++nr] = -1; mst[e].insert(nr);
            for (int p = x; p != y; p = fth[p])
                mst[fte[p]].insert(nr);
        }
    }
    
    return;
}

int getroot(int x) {
    if (anc[x] < 0)
        return x;
    else
        return getroot(anc[x]);
}

int lgput(int x, int n) {
    if (!n)
        return 1;
    
    int y = lgput(x, n >> 1);
    y = (1LL * y * y) % MOD;
    
    if (n & 1)
        y = (1LL * y * x) % MOD;
    
    return y;
}

int gcd(int x, int y) {
    while (y) {
        int z = x % y;
        x = y; y = z;
    }
    
    return x;
}

int main(void) {
    int n, m, k;
    cin >> n >> m >> k;
    
    for (int i = 1; i <= m; ++i) {
        int x, y;
        cin >> x >> y;
        
        edg[i] = make_pair(x, y);
        gph[x].push_back(make_pair(y, i));
        gph[y].push_back(make_pair(x, i));
    }
    
    int nr = 0, ans = 1;
    dfs(1, 0, 0, nr);
    
    for (int i = 0; i <= m + k - 1; ++i) {
        cmb[i][0] = 1;
        
        for (int j = 1; j <= i; ++j)
            cmb[i][j] = (cmb[i - 1][j - 1] + cmb[i - 1][j]) % MOD;
    }
    
    for (int i = 1; i <= m; ++i) {
        if (mst[i].empty())
            ans = (1LL * ans * k) % MOD;
        else {
            for (int x : mst[i]) {
                int r1 = getroot(*mst[i].begin()), r2 = getroot(x);
                
                if (r1 == r2)
                    continue;
                if (anc[r1] > anc[r2])
                    swap(r1, r2);
                
                anc[r1] += anc[r2];
                anc[r2] = r1;
            }
        }
    }
    
    for (int i = 1; i <= nr; ++i) {
        if (anc[i] > 0)
            continue;
        
        int val = 0;
        for (int j = 1; j <= m; ++j)
            if (mst[j].size())
                val += (getroot(*mst[j].begin()) == i);
        
        if (anc[i] < -1)
            ans = (1LL * ans * cmb[val + k - 1][k - 1]) % MOD;
        else {
            int aux = 0;
            for (int j = 1; j <= val; ++j)
                aux = (aux + lgput(k, gcd(val, j))) % MOD;
            
            aux = (1LL * aux * lgput(val, MOD - 2)) % MOD;
            ans = (1LL * ans * aux) % MOD;
        }
    }
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()
#ifdef _DEBUG_
	#define debug(...) printf(__VA_ARGS__)
#else
	#define debug(...) (void)0
#endif
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;

int main() {
	int N, T;
	scanf("%d%d", &N, &T);
	int ans = 0;
	int lst = 0;
	for(int i = 0; i < N; i++) {
		int t;
		scanf("%d", &t);
		if(lst < t) lst = t;
		ans += t + T - lst;
		lst = t + T;
	}
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 256
<?php

$x = (int)trim(fgets(STDIN));

function isPrime(int $n) {
    # 2はOK
    if ($n == 2) return true;

    # 2で割れたらダメ
    if ($n%2 == 0) return false;

    // 奇数だけチェックすればいいので2づつ増やす
    // n-1までチェックして一度でも割れたらダメ
    for ($i=3; $i<$n; $i+=2) {
        if ($n%$i == 0) return false;
    }
    return true;
}

$i=$x;
while (true) {
    if (isPrime($i)) {
        echo "$i\n";
        break;
    }
    $i++;
}


Measured memory_bytes: 4604
/********** Raaghav Raaj (cf: raaghavraaj, cc: mothercoder27) *************/
#include<bits/stdc++.h>
using namespace std;
#define fast cin.tie(NULL); cout.tie(NULL); ios_base::sync_with_stdio(false);
#pragma optimize("-O3")

// #ifndef ONLINE_JUDGE
// #include "../Codechef/trace.h"
// #else
// #define trace(args...)
// #endif

#define int long long
#define double long double
#define vi vector<int>
#define vc vector<char>
#define pi pair<int, int>
#define pii pair<pi,int>
#define rep(i,a,b) for(int i=a; i<b; i++)
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define sp " "
#define endl '\n'
#define all(v) v.begin(), v.end()
#define debug(data) for(auto it: data) cout<<it<<sp;
#define yes cout<<"YES"<<endl
#define no cout<<"NO"<<endl

const int sz = 1e10;

int gcd(int n, int m) {
	return __gcd(n, m);
}

int power(int a, int b) {
	a %= sz;
	int res = 1;
	while (b) {
		if (b & 1) res = (res * a) % sz;
		a = (a * a) % sz;
		b >>= 1;
	}
	return res;
}

int modInverse(int a) { //sz must be prime
	return power(a, sz - 2);
}

void solve() {
	int n, k; cin >> n >> k;
	vi v(n);
	rep(i, 0, n) cin >> v[i];

	rep(i, k, n) {
		if (v[i] > v[i - k]) cout << "Yes" << endl;
		else cout << "No" << endl;
	}
}

int32_t main() {
// #ifndef ONLINE_JUDGE
// 	freopen("input.txt", "r", stdin);
// 	freopen("output.txt", "w", stdout);
// 	freopen("tracefile.txt", "w", stderr);
// #endif
	fast;
	int T = 1;
	// cin >> T;
	rep(i, 1, T + 1) {
		// cout << "Case #" << i << ": " << endl;
		solve();
	}
}

Measured memory_bytes: 4792
#include <iostream>
#include <vector>
#include <map>
#include <string>
#include <cmath>
#include <algorithm>

#define FOR(i,a,b)  for(int (i)=(a);(i)<(b);(i)++)
#define REP(i,n)    FOR(i,0,n)
#define RER(i,n)    FOR(i,0,(n+1))
#define pb          push_back
#define mp(a,b)     make_pair((a),(b))
#define mset(m,v)   memset(m,v,sizeof(m))
using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pair<int, int> > vpii;
typedef long long ll;
typedef vector<ll> vl;
typedef pair<ll,ll> pll;
typedef vector<pair<ll, ll> > vpll;
typedef vector<string> vs;
typedef long double ld;
const double EPS    = 1e-10;
const int INF       = 1e+9;
const double PI     = acos(-1);


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

    int a[100];
    REP(i, n) {
        cin >> a[i];
    }

    sort(a, a + n);
    reverse(a, a + n);

    int sum = 1;
    int prev = a[0];
    FOR(i, 1, n) {
        int cur = a[i];
        if ( cur < prev ) {
            sum++;
            prev = cur;
        }
    }

    cout << sum << endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(void){
    int n = 0;
    cin >> n;
    int tbreak[] = {1,2,4,8,16,32,64};
    for (int i = 0; i < sizeof(tbreak)/sizeof(tbreak[0]); i++)
    {
        if(tbreak[i] > n){
            cout << tbreak[i-1];
            break;
        }
        if(n >= 64){
            cout << 64;
            break;
        }
    }
    
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define dep(i,a,b) for(int i=a;i>=b;i--)
#define ll long long
#define mem(x,num) memset(x,num,sizeof x)
#define reg(i,x) for(int i=last[x];i;i=e[i].next)
using namespace std;
inline ll read(){
    ll f=1,x=0;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
//******head by yjjr******
const int maxn=106;
int n,num=0;
struct node{int x,y;}a[maxn],ans[maxn<<4];
void Wri(int X,int Y){
    ans[++num]=(node){a[X].x,a[Y].x};
    ans[++num]=(node){a[X].x,a[Y].y};
    ans[++num]=(node){a[X].y,a[Y].x};
    ans[++num]=(node){a[X].y,a[Y].y};
}
int main(){
    n=read();
    if(n%2==1){
        rep(i,1,(n-1)/2)a[i]=(node){i,n-i};
        a[n/2+1]=(node){n,n};
        //rep(i,1,n/2+1)cout<<a[i].x<<' '<<a[i].y<<endl;
        rep(i,1,n/2-1)Wri(i,i+1);
        ans[++num]=(node){a[n/2].x,a[n/2+1].x};
        ans[++num]=(node){a[n/2].y,a[n/2+1].x};
        if(n/2+1>2)ans[++num]=(node){a[1].x,a[n/2+1].x},ans[++num]=(node){a[1].y,a[n/2+1].x};
    }else{
        rep(i,1,n/2)a[i]=(node){i,n-i+1};
        rep(i,1,n/2-1)Wri(i,i+1);
        if(n/2>2)Wri(n/2,1);
    }
    printf("%d\n",num);
    rep(i,1,num)printf("%d %d\n",ans[i].x,ans[i].y);
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#define MAXN 205
int main() {
    char str[MAXN];
    int flag, t, k, i, j;
	scanf("%s", str+1);
    k = strlen(str+1) - 1;
	while(1) {
		if((k & 1) == 1) k--;
    	flag = 1, t = k / 2;
    	for(i = t, j = k; i >= 1; i--, j--) 
    		if(str[i] != str[j]) {
    			flag = 0;
    			break;
			}
		if(flag) break;
		k--;
	}
	printf("%d\n", k);
    return 0;
}

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

int main(){
    ll h, w; cin >> h >> w;
    ll ans1 = 10e11, ans2 = 10e11;
    for(int i = 1; i < h; i++){
        ll halfh = (h-i) / 2, halfw = w / 2, h2 = h - i;
        ll s1 = i * w;
        ll s2 = halfh * w;
        ll s3 = (h2 - halfh) * w;
        ll s4 = halfw * h2;
        ll s5 = (w - halfw) * h2;
        ll maxs1 = max(max(s1, s2), s3), mins1 = min(min(s1, s2), s3);
        ll maxs2 = max(max(s1, s4), s5), mins2 = min(min(s1, s4), s5);
        ans1 = min(min(abs(maxs1 - mins1), abs(maxs2 - mins2)), ans1);
    } 
    for(int i = 1; i < w; i++){
        ll halfh = h / 2, halfw = (w-i) / 2, w2 = w - i;
        ll s1 = i * h;
        ll s2 = halfh * w2;
        ll s3 = (h - halfh) * w2;
        ll s4 = halfw * h;
        ll s5 = (w2 - halfw) * h;
        ll maxs1 = max(max(s1, s2), s3), mins1 = min(min(s1, s2), s3);
        ll maxs2 = max(max(s1, s4), s5), mins2 = min(min(s1, s4), s5);
        ans2 = min(min(abs(maxs1 - mins1), abs(maxs2 - mins2)), ans2);
    }
    cout << min(ans1, ans2) << endl;
}

Measured memory_bytes: 256
import java.util.*;

class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int list[] = new int[n];
		for(int i = 0;i < n;i++){
			list[i] = sc.nextInt();
		}
		for(int i = (n - 1);i > 0;i--){
			System.out.print(list[i] + " ");
		}
                System.out.print(list[0]);
		System.out.println();
	}
}


Measured memory_bytes: 26460
#include <bits/stdc++.h>
using namespace std;
long long lcm(long long a,long long b);
//long long gcd(long long c,long long d);
int main(){
   int n,i;
   long long c=0,z=0,t[101];
   cin>>n;
   for(i=0;i<n;i++){
      cin>>t[i];
   }
   for(i=1;i<n;i++){
      t[i]=lcm(t[i],t[i-1]);
   }
      cout<<t[n-1]<<'\n';
   return 0;
}
long long lcm(long long a,long long b){
return a/__gcd(a,b)*b;
}
/*long long gcd(long long c,long long d){
    if(b==0) return a;
    return gcd(b,a%b);
}*/

Measured memory_bytes: 3612
package main

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

func configure(scanner *bufio.Scanner) {
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 1000005), 1000005)
}
func getNextString(scanner *bufio.Scanner) string {
	scanned := scanner.Scan()
	if !scanned {
		panic("scan failed")
	}
	return scanner.Text()
}
func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}
func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}
func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}
func main() {
	fp := os.Stdin
	wfp := os.Stdout
	extra := 0
	if os.Getenv("I") == "IronMan" {
		fp, _ = os.Open(os.Getenv("END_GAME"))
		extra = 100
	}
	scanner := bufio.NewScanner(fp)
	configure(scanner)
	writer := bufio.NewWriter(wfp)
	defer func() {
		r := recover()
		if r != nil {
			fmt.Fprintln(writer, r)
		}
		writer.Flush()
	}()
	solve(scanner, writer)
	for i := 0; i < extra; i++ {
		fmt.Fprintln(writer, "-----------------------------------")
		solve(scanner, writer)
	}
}
func solve(scanner *bufio.Scanner, writer *bufio.Writer) {
	n := getNextInt(scanner)
	for i := 0; i < 1<<uint(n); i++ {
		fmt.Fprintf(writer, "%d:", i)
		for j := 0; j < n; j++ {
			if (i>>uint(j))&1 == 1 {
				fmt.Fprint(writer, " ")
				fmt.Fprint(writer, j)
			}
		}
		fmt.Fprintln(writer, "")
	}
}



Measured memory_bytes: 5340
#include <iostream>
#include <string>
#include <cstring>
#include <vector>
#include <algorithm>
#include <tuple>
#include <queue>
#include <set>
#include <math.h>
#include <array>
#include <list>
#include <set>
const int MOD=1000000007;
const int INF=1000000000;
using namespace std;
typedef long long ll;
typedef tuple<ll,int,int> tup;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vp;
int tmpmin=1e9;
int main(int argc,char const* argv[])
{
  int n;
  cin >> n;
  int cand[9];
  for(int i=0;i<9;i++)
    {
      cand[i]=111*(i+1);
    }
  for(int i=0;i<9;i++)
    {
      if(cand[i]>=n)
	{
	  cout << cand[i] << endl;
	  return 0;
	}
    }
  return 0;
}


Measured memory_bytes: 256
from collections import deque as que
q=que()
n,m=map(int,input().split())
e=[[] for i in range(n)]
for i in range(m):
    a,s=map(int,input().split())
    e[a-1].append(s-1);e[s-1].append(a-1)
table=[0]*n
ok=0
table[0]=1
q.append(0)
while len(q):
    now=q.popleft()
    for to in e[now]:
        if table[to]==0:
            table[to]=now+1
            q.append(to)
            ok+=1
if n-1==ok:
    print("Yes",*table[1:],sep="\n")
else:print("No")

Measured memory_bytes: 38892
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		solve();
	}

	private static void solve() {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] t = new int[N];
		int[] v = new int[N];

		for (int i = 0; i < N; i++) {
			t[i] = sc.nextInt();
		}

		for (int i = 0; i < N; i++) {
			v[i] = sc.nextInt();
		}
		sc.close();

		int totalTime = 0;
		for (int i = 0; i < N; i++) {
			totalTime += t[i];
		}

		int[] vmax = new int[totalTime * 2 + 1];
		vmax[0] = 0;

		int elapsed = 0;

		for (int i = 0; i < N; i++) {
			for (int j = elapsed * 2 + 1; j < (elapsed * 2 + 1) + (t[i] * 2); j++) {
				vmax[j] = v[i];
			}
			elapsed += t[i];
		}
		vmax[totalTime * 2] = 0;

		double[] vact = new double[totalTime * 2 + 1];
		vact[0] = 0;

		for (int i = 1; i < vact.length - 1; i++) {
			vact[i] = Math.min(vact[i - 1] + 0.5, vmax[i]);
		}

		vact[vact.length - 1] = 0;

		for (int i = vact.length - 2; i > 0; i--) {
			if (vmax[i] > vmax[i + 1] && vmax[i + 1] != 0) {
				vact[i] = Math.min(vact[i + 1] + 0.5, Math.min(vact[i], vmax[i + 1]));
			} else {
				vact[i] = Math.min(vact[i + 1] + 0.5, Math.min(vact[i], vmax[i]));
			}
		}

		double area = 0;
		for (int i = 0; i < vact.length - 1; i++) {
			area += (vact[i] + vact[i + 1]) * 0.5 / 2;
		}
		System.out.println(area);
	}
}

Measured memory_bytes: 23764
#include<bits/stdc++.h>
#define rep(i,a,b) for (int i=(a); i<=(b); i++)
#define per(i,a,b) for (int i=(a); i>=(b); i--)
using namespace std;
typedef long long LL;

inline int read() {
    int x=0,f=1; char ch=getchar();
    while (!(ch>='0'&&ch<='9')) {if (ch=='-')f=-1;ch=getchar();}
    while (ch>='0'&&ch<='9') {x=x*10+(ch-'0'); ch=getchar();}
    return x*f;
}

const int N = 5005;
const int MOD = 1000000007;

struct edge{int go,next;} e[N<<1]; int cnt=0,last[N]; inline void ins(int u,int v) {e[++cnt].go=v; e[cnt].next=last[u]; last[u]=cnt;}

int n,ans=0;
LL f[N];
LL size[N],dp[N][N];

inline void add(LL *a,int n,LL *b,int m) {
	int ret[N];	rep(i,0,n+m) ret[i]=0;
	rep(i,0,n) rep(j,0,m) {
		ret[i+j]=(ret[i+j]+a[i]*b[j])%MOD;
		if (j%2==0) ret[i]=(ret[i]+MOD-a[i]*b[j]%MOD*f[j/2]%MOD)%MOD;
	}
	rep(i,0,n+m) a[i]=ret[i];
}

inline void dfs(int x,int fa) {
	size[x]=1; dp[x][1]=1;
	for (int i=last[x];i;i=e[i].next) {
		if (e[i].go==fa) continue;
		dfs(e[i].go,x);
		add(dp[x],size[x],dp[e[i].go],size[e[i].go]);
		size[x]+=size[e[i].go];
	}
}

int main() {

	#ifndef ONLINE_JUDGE
	//	freopen("data.in","r",stdin);
	//	freopen("data.out","w",stdout);
	#endif

	n=read(); rep(i,1,n-1) {int u=read(),v=read(); ins(u,v); ins(v,u);}
	f[0]=1; rep(i,1,n/2) f[i]=(f[i-1]*(2*i-1))%MOD; dfs(1,0);
	for (int i=2;i<=n;i+=2) ans=(ans+f[i/2]*dp[1][i])%MOD;
	printf("%d\n",ans);

	return 0;
	
}


Measured memory_bytes: 194560
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  
  int H, W;
  cin >> H >> W;
  
  for (int i=0; i<W+2; i++)
    cout << '#';
  cout << endl;
  
  for (int i=0; i<H; i++){
    string a;
    cin >> a;
    cout << '#' << a << '#' <<endl;
  }
  
  for (int i=0; i<W+2; i++)
    cout << '#';
  cout << endl;
  
}

Measured memory_bytes: 256
//AOJ 0034

#include<iostream>

using namespace std;

int main(){

	int l[10];
	int v[2];
	char tmp;
	int sum;
	double x;

	while(cin>>l[0]){
		cin>>tmp;
		for(int i=1;i<10;i++){
			cin>>l[i];
			cin>>tmp;
		}
		cin>>v[0];
		cin>>tmp;
		cin>>v[1];

		sum = 0;
		for(int i=0;i<10;i++){
			sum+=l[i];
		}
		x = sum * v[0]/(v[0]+v[1]);

		sum = 0;
		int cnt = 0;
		for(int i=0;i<10;i++){
			sum+=l[i];
			cnt++;
			if(sum>=x){
				cout<<cnt<<endl;
				break;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 1156
#include <iostream>
#include <array>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
using namespace std;

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

    string N;
    cin >> N;

    bool check = false;
    for(size_t i = 0; i < N.size() - 2; ++i){
        if(N.substr(i, 3) == string(3, N[i])){
            check = true;
            break;
        }
    }
    cout << (check ? "Yes" : "No") << endl;

    return 0;
}

Measured memory_bytes: 256
X, N = list(map(int, input().split()))
p = list(map(int,input().split()))
ma = 10 ** 9 + 7
for i in range(-200, 200):
    if i not in p:
        dis = abs(i - X)
        if dis < ma:
            ans = i
            ma = dis
print(ans)

Measured memory_bytes: 61668
import heapq
N = int(input())
a = [int(i) for i in input().split()]

before = []
after = []
before_sum = 0
after_sum = 0
for i in range(N):
    heapq.heappush(before, a[i])
    before_sum += a[i]

for i in range(2*N, 3*N):
    heapq.heappush(after, -a[i])
    after_sum -= a[i]

c = [0] * (N+1)
c[0] = before_sum
c[N] = after_sum
for i in range(N):
    before_sum = before_sum - heapq.heappushpop(before, a[N+i]) + a[N+i]
    c[i+1] += before_sum
    after_sum = after_sum - heapq.heappushpop(after, -a[(2*N)-i-1]) - a[(2*N)-i-1]
    c[N-i-1] += after_sum

print(max(c))

Measured memory_bytes: 40336
#include<bits/stdc++.h>
#define ll long long
using namespace std;
#define maxn 500010
#define mod 1000000007
ll a[maxn],b[maxn];
bool cmp(ll p,ll q){
    return p>q;
}
int n;
ll k;
bool sol(ll x){
    ll sum=0,y;
    for(int i=0;i<n;i++){
        if(a[i]*b[i]>x){
            y=x/b[i];
            sum+=a[i]-y;
        }
    }
    if(sum<=k) return true;
    return false;
}
int main(){
    scanf("%d%lld",&n,&k);
    for(int i=0;i<n;i++) scanf("%lld",&a[i]);
    for(int i=0;i<n;i++) scanf("%lld",&b[i]);
    sort(a,a+n);
    sort(b,b+n,cmp);
    ll l=0,r=1e14,mid;
    while(l<r){
        mid=(l+r)/2;
        if(!sol(mid)) l=mid+1;
        else r=mid;
    }
    printf("%lld\n",r);
    return 0;
}

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


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

    int n;
    string s;
    cin>>n>>s;
    int h=0,w=0;
    for(int i=0;i<n;i++){
        if('A'<=s[i] && s[i]<='M') h++;
        if('N' <= s[i] && s[i] <= 'Z') h--;
        if('a' <= s[i] && s[i] <= 'm') w++;
        if('n' <= s[i] && s[i] <= 'z') w--;
    }
    int ans = abs(h) + abs(w);
    cout << ans << endl;
    for(int i=0;i<abs(h);i++){
        if(h<0){
            cout << 'N';
        }
        else cout << 'A';
    }
    for(int i=0;i<abs(w);i++){
        if(w<0){
            cout << 'n';
        }
        else cout << 'a';
    }
    cout << endl;
}


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

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

    ll dp[101][5][2] = {}; // dp[i桁目][0以外の個数(4以上はカウント不要)][strict]
    dp[0][0][1] = 1;
    for(int i=1;i<=n.size();i++){
        int x = n[i-1] - '0';
        for(int j=0;j<=9;j++){
            for(int p = 0;p<4;p++){
                // strict
                if(j == x){
                    dp[i][(j == 0?p:p+1)][1] += dp[i-1][p][1];
                }else if(j < x){
                    dp[i][(j == 0?p:p+1)][0] += dp[i-1][p][1];
                }
                // not strict
                dp[i][(j == 0?p:p+1)][0] += dp[i-1][p][0];
            }
        }
    }
    cout << dp[n.size()][k][0] + dp[n.size()][k][1] << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define ALL(x) (x).begin(), (x).end()
#define REP(i ,n) for(int i = 0; i < (int)(n); i++)
#define pb push_back
typedef vector<int>vint;
typedef vector<ll>vll;
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

int main()
{
    int N;
    cin >> N;
    if(N >= 30){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 3632
package main

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

var sc, wr = bufio.NewScanner(os.Stdin), bufio.NewWriter(os.Stdout)

func scanString() string { sc.Scan(); return sc.Text() }
func scanInt() int { a,_ := strconv.Atoi(scanString()); return a }
func scanInt64() int64 { a,_ := strconv.ParseInt(scanString(),10,64); return a }
func scanFloat64() float64 { a,_ := strconv.ParseFloat(scanString(),64); return a }

func scanInts(n int) []int {
	res := make([]int, n); for i := 0; i < n; i++ { res[i] = scanInt() }; return res
}

func abs(a int) int { if a<0 { return -a }; return a }
func min(a,b int) int { if a<b { return a }; return b }
func max(a,b int) int { if a>b { return a }; return b }

//•*¨*•.¸¸♪Main•*¨*•.¸¸♪(　-ω-)ノ　(　・ω・)

func main() {
	defer wr.Flush()
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 10000), 1001001)

	h := scanInt()
	w := scanInt()
	n := scanInt()

	t := max(w,h)
	fmt.Fprintln(wr, (n+t-1)/t)
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n,m;cin >> n >> m;
	vector<int> a(m);
	vector<int> b(m);
	rep(i,m){
		cin >> a.at(i) >> b.at(i);
	}
	vector<int> c;
	vector<int> d;
	rep(i,m){
		if(a.at(i)==1) c.pb(b.at(i));
		if(b.at(i)==n) d.pb(a.at(i));
	}
	sort(c.begin(),c.end());
	sort(d.begin(),d.end());
	int i=0,j=0;
	while(i<c.size() && j<d.size()){
		if(c.at(i)==d.at(j)){
			cout << "POSSIBLE" << endl;
			return 0;
		}
		if(c.at(i)<d.at(j)){
			if(i>=c.size()-1){
				if(j>=d.size()-1) break;
				j++;
			}
			else{
				i++;
			}
		}
		else{
			if(j>=d.size()-1){
				if(i>=c.size()-1) break;
				i++;
			}
			else{
				j++;
			}
		}
	}
	cout << "IMPOSSIBLE" << endl;
}

Measured memory_bytes: 2812
//
// Created by xfr on 2019/3/16.
//
#include <iostream>
using namespace std;

void output(int num[], int n)
{
    for(int i=0;i<n;i++)
    {
        printf("%d", num[i]);
        if(i == (n-1))
        {
            printf("\n");
        }
        else {
            printf(" ");
        }
    }
}

int main()
{
    int n;
    scanf("%d", &n);
    int num[n];
    for(int i=0; i<n; i++)
    {
        scanf("%d", &num[i]);
    }
    output(num, n);
    for(int i=1; i<n; i++)
    {

        int temp = num[i];
        int j = i - 1;
        while(j>=0 && temp < num[j])
        {
            num[j+1] = num[j];
            j--;
        }
        num[j+1] = temp;
        output(num, n);
    }
}



Measured memory_bytes: 3196
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def S(): return input().rstrip()
def LS(): return S().split()
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = 1e10

#solve
def solve():
    s = S()
    ans = "CODEFESTIVAL2016"
    x = 0
    for i in range(len(s)):
        x += ans[i] != s[i]
    print(x)
    return


#main
if __name__ == '__main__':
    solve()


Measured memory_bytes: 38512
#include <stdio.h>
#include <algorithm>

using namespace std;

long long a , b , ans;
void work () {
	scanf ( "%lld%lld" , &a , &b );
	ans = min ( a , b / 2 );
	a -= ans;
	b -= ans * 2;
	printf ( "%lld\n" , ans + b / 4 );
}
int main () {
	work ();
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(i,a,b) for(ll i=(a);i<(a);i++)
#define REP(i,a) FOR(i,0,a)
string S;
int main(){
	cin.tie(0);
	cin.sync_with_stdio(false);
	cin>>S;
	cout<<'A'<<(S[1]=='B' ? 'R':'B')<<'C'<<endl;
}


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

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

int main(void) {
  int n, x, d;
  cin >> n >> x;
  for (int i = 0; i < n; i++) {
    int in;
    cin >> in;
    if (i == 0)
      d = abs(x - in);
    else
      d = gcd(d, abs(x - in));
  }
  cout << d << endl;
}


Measured memory_bytes: 384
#include<iostream>
#include<cstdio>
using namespace std;
#define INF 1001001001
int n,m,a,b,c,d,x1,x2,y1,y2;
int r[21][21];
int used[21],dis[21];

int select(){
	int p=INF,q;
	for(int i=1;i<=n;i++){
		if(used[i]==0&&dis[i]<p){
			p=dis[i];q=i;
		}
	}
	return q;
}
int dijkstra(int s,int g){
	int q=1,u;
	for(int i=0;i<=n;i++)used[i]=0;
	for(int i=0;i<=n;i++)dis[i]=r[s][i];
	used[s]=1;
	while(q<n){
		u=select();
		used[u]=1;q++;
		for(int i=1;i<=n;i++){
			dis[i]=min(dis[i],dis[u]+r[u][i]);
		}
	}
	return dis[g];
}

int main(){
	scanf("%d%d",&n,&m);
	for(int i=0;i<=n;i++){
		for(int j=0;j<=n;j++){
			r[i][j]=(i==j)?0:INF;
		}
	}
	for(int i=0;i<m;i++){
		scanf("%d,%d,%d,%d",&a,&b,&c,&d);
		r[a][b]=c;r[b][a]=d;
	}
	scanf("%d,%d,%d,%d",&x1,&x2,&y1,&y2);
	
	cout<<y1-y2-dijkstra(x1,x2)-dijkstra(x2,x1)<<endl;
	return 0;
}

Measured memory_bytes: 1208
#include <cstdio>
#include <cstring>
#include <queue>
#define N 110
#define INF 0x3f3f3f3f
using namespace std;
//stack<int> s;
int n;
int m[N][N];
int used[N];
int d[N];
void bfs(int root){
    queue<int>q;
    while(!q.empty()) q.pop();
    q.push(root);
    d[root] = 0;
    while(!q.empty()){
        int u = q.front();
        used[u] = 1;
        q.pop();
        for(int i = 1; i <= n; i++){
            if(used[i] == 0 && m[u][i]){
                q.push(i);
                d[i] = d[u] + 1;
                used[i] = 1;
            }
        }
    }
}
int main(){
    for(int i = 0; i < N; i++) for(int j = 0; j < N; j++) m[i][j] = 0;
    for(int i = 0; i < N; i++) used[i] = 0;
    for(int i = 0; i < N; i++) d[i] = INF;
    scanf("%d", &n);
    for(int p = 0; p < n; p++){
        int node, k;
        scanf("%d %d", &node, &k);
        for(int i = 0; i < k; i++){
            int b;
            scanf("%d", &b);
            m[node][b] = 1;
        }
    }
    bfs(1);
    //for(int i = 1; i <= n; i++) if(used[i] == 0) bfs(i);
    for(int i = 1; i <= n; i++){
        printf("%d %d\n", i, d[i] == INF ? -1 : d[i]);
    }
    return 0;
}


Measured memory_bytes: 2788
#include<bits/stdc++.h>
using namespace std;
#define ALL(obj) (obj).begin(),(obj).end()
#define RALL(obj) (obj).rbegin(),(obj).rend()
#define REP(i, n) for(int i=0;i<(n);++i)
#define RANGE(i, a, b) for(int i=(a);i<(b);++i)
#define RREP(i, n) for(int i=(n)-1;i>= 0;--i)

#define endl '\n'
#define pb push_back
#define eb emplace_back
#define pque priority_queue
#define umap unordered_map
#define uset unordered_set
#define BIG 2000000000
#define VERYBIG 1000000000000000ll
#define PI 3.141592653589793238
#define dcout cout<<fixed<<setprecision(50)

const long long dx[]={1,0,-1,0,1,1,-1,-1}, dy[]={0,-1,0,1,1,-1,1,-1};
const long long MOD = 1e9+7;

// typedef long long ll;
#define int long long
#define double long double

template<typename T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template<typename T> inline T LCM(T a,T b){T c=GCD(a,b);a/=c;return a*b;}
template<typename T> inline T nCr(T a,T b){T i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
template<typename T> inline T nHr(T a,T b){return nCr(a+b-1,b);}
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;}

typedef pair<int, int> INTP;
typedef vector<int> INTV;
struct edge2 {int to, cost;};
struct edge3 {int from, to, cost;};

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

  char c; cin >> c;
  cout << char(c+1) << endl;
}


Measured memory_bytes: 764
using System;

namespace abc111A
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            string A = Console.ReadLine();
            string[] B = new string[3];
            for (int n = 0; n < 3; n++)
            {
                B[n] = A.Substring(n, 1);
                if (B[n] == "9")
                    B[n] = "1";
                else
                    B[n] = "9";
            }
            Console.WriteLine(B[0] + B[1] + B[2]);
        }
    }
}


Measured memory_bytes: 13140