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

using namespace std;
int main() {

  int64_t N, M;

  cin >> N >> M;
  char A[N][N], B[M][M];
  
  for(int64_t i=0;i<N;i++)
    for(int64_t j=0;j<N;j++)
      cin >> A[i][j];

  for(int64_t i=0;i<M;i++)
    for(int64_t j=0;j<M;j++)
      cin >> B[i][j];
  
  for(int64_t i=0;i<N-M+1;i++) {
    for(int64_t j=0;j<N-M+1;j++) {
      bool b = true;
      for(int64_t k=0;k<M;k++) {
	for(int64_t l=0;l<M;l++) {
	  if(A[i+k][j+l] != B[k][l]) {
	    b = false;
	    goto jump;
	  }	    
	}
      }
      if(b) {
	cout << "Yes" << endl;
	return 0;
      }
    jump:
      ;
    }
  }
  cout << "No" << endl;
  
  return 0;
}
      


Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		long n = sc.nextLong();
		long x = sc.nextLong();
		long r;
		long a = n,b = x;
		while( (r = a % b) != 0 ) {
            a = b;
            b = r;
        }
        
       	n /= b;
		System.out.println(3*(n-1)*b);
		
	}
}


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

using namespace std;
 
int c[128];
 
void init(){
    c['I'] = 1;   c['V'] = 5;   c['X'] = 10;   c['L'] = 50; 
    c['C'] = 100; c['D'] = 500; c['M'] = 1000;
}
 
int main(){
    string str;
 
    init();
    while(cin >> str){
	int sum = 0;
	for(int i = 0 ; i < (int)str.size()-1 ; i++){
	    sum += c[str[i]]*((c[str[i]] < c[str[i+1]]) ? -1 : 1);
	}
	sum += c[str[str.size()-1]];
	cout << sum << endl;
    }
    return 0;
}

Measured memory_bytes: 3160
def main():
    n,k = tuple([int(t)for t in input().split()])

    t = [0]*n
    for _ in range(k):
        input()
        k = tuple([int(t)-1 for t in input().split()])
        for k_i in k:
            t[k_i]+=1
    
    ans = 0
    for t_i in t:
        if t_i==0:
            ans+=1
    print(ans)

if __name__ == "__main__":
    main()

Measured memory_bytes: 9208
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <complex>
#include <stack>
#include <unordered_map>
using namespace std;

int keta(int a){
    int count = 0;
    while(a != 0){
        count += a % 10;
        a /= 10;
    }
    
    return count;
}

int main(){
    int n;
    int min = 11451419;
    cin >> n;
    
    int i = 0;
    int sum = 0;
    for(i = 1; i <= n/2; i++){
        sum = 0;
        sum = keta(i) + keta(n-i);
        
        if(min > sum){
            min = sum;
        }
    }
    
    cout << min << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#define rep(i,n) for(int i=0;i<n;i++)

using namespace std;



int N;
string A, B, C;
int table[3][100] = {};
int ans = 0;
int num[2] = {};

int main() {
	cin >> N >> A >> B >>C;
	rep(i, N) {
		if (A[i] == B[i]) table[0][i] = 1;
		if (A[i] == C[i]) table[1][i] = 1;
		if (B[i] == C[i]) table[2][i] = 1;	
	}

	rep(i, N) {
		if (table[0][i] == 1 && table[1][i] == 1 && table[2][i]==1) num[0]++;
		else if (table[0][i] == 1 || table[1][i] == 1 || table[2][i] == 1)	num[1]++;
	}
	



	cout << 2*N-num[0]*2-num[1] << endl;

	
	return 0;
}

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

using namespace std;

int main() {
    int n;
    string tmp;
    cin >> n >> tmp;
    vector<string> str(n);
    for (int i=0; i<n; ++i)
        str.at(i) = tmp[i];

    sort(str.begin(), str.end());

    if (n%2 == 1) {
        cout << "No";
        return 0;
    }

    for (int i=0; i<n; i=i+2) {
        if (str[i] != str[i+1]) {
            cout << "No";
            return 0;
        }
    }
    cout << "Yes";
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <iterator>
#include <cmath>
#include <deque> 

using namespace std;


int a, b, c;

int main()
{
	scanf("%d%d%d", &a, &b, &c);
	
	if (a == b && b == c && a == c)
	{
		printf("Yes\n");
	}
	else
		printf("No\n");
	
	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; i--)
#define INF 1LL << 60
#define LLINF 1e12
#define PI 3.14159265359
#define ALL(a) (a).begin(), (a).end()
int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
int ny, nx;
typedef long long ll;
using namespace std;

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

ll lcm(ll m, ll n)
{
    if ((0 == m) || (0 == n))
        return 0;
    return ((m / gcd(m, n)) * n);
}

ll llpow(ll x, ll y)
{
    ll ans = 1;
    REP(i, y)
    ans *= x;
    return ans;
}

ll llmin(ll x, ll y) { return x < y ? x : y; }
ll llmax(ll x, ll y) { return x > y ? x : y; }

unsigned GetDigit(unsigned num) { return to_string(num).length(); }

template <typename Container>
bool exist_in(const Container &c, const typename Container::value_type &v)
{
    return (c.end() != std::find(c.begin(), c.end(), v));
}

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

ll nCr(int n, int r)
{
    if (n == r or n == 0)
        return 1;
    if (n < r)
        return 0;
    if (r == 1)
        return n;
    return nCr(n - 1, r - 1) + nCr(n - 1, r);
}

vector<ll> decom;

void decompositPrime(ll n)
{
    ll a = 2;
    while (n >= a * a)
    {
        if (n % a == 0)
        {
            decom.push_back(a);
            n /= a;
        }
        else
        {
            a++;
        }
    }
    decom.push_back(n);
}

//std::cout << std::defaultfloat << std::setprecision(10);
////////////////////////////////////////

int main()
{

    int N,M; cin >> N >> M;
    vector<int> P(100000), Y(100000);
    vector<int> yd[100001];

    REP(i,M){
        cin >> P[i] >> Y[i];
        yd[P[i]].push_back(Y[i]);
    }

    REP(i,N){
        sort(yd[i+1].begin(), yd[i+1].end());
    }

    REP(i,M){
        printf("%06d", P[i]);
        printf("%06d\n", lower_bound(yd[P[i]].begin(), yd[P[i]].end(), Y[i]) - yd[P[i]].begin() + 1);
    }

    return 0;
}


Measured memory_bytes: 7808
#include<bits/stdc++.h>
using namespace std;
///Welcome to Nasif's Code
#define bug printf("bug\n");
#define bug2(var) cout<<#var<<" "<<var<<endl;
#define co(q) cout<<q<<endl;
#define all(q) (q).begin(),(q).end()
typedef long long int ll;
typedef unsigned long long int ull;
const int MOD = (int)1e9+7;
const int MAX = 1e5+5;
#define pi acos(-1)
#define inf 1000000000000000LL
#define FastRead    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int s[MAX],c[MAX],t[MAX],temp[MAX],res[MAX];
int main()
{
    FastRead
    //freopen("output.txt", "w", stdout);
    int n,m;
    cin>>n>>m;
    for(int i=0; i<n; i++)
    {
        cin>>s[i]>>t[i]>>c[i];
    }
    for(int i=1; i<=m; i++)
    {
        for(int j=0; j<MAX; j++)
            temp[j]=0;
        for(int j=0; j<n; j++)
        {
            if(c[j]==i)
            {
                temp[s[j]-1]++;
                temp[t[j]]--;
            }
        }
        for(int j=1;j<MAX;j++)
          temp[j]+=temp[j-1];
        for(int j=0;j<MAX;j++)
          if(temp[j]) res[j]++;
    }
    int ans=0;
    for(int j=0;j<MAX;j++) ans=max(ans,res[j]);
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 5596
import java.math.BigInteger;
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);

		int MAX = 80;
		int N = scan.nextInt();

		for (int i = 0; i < N; i++) {
			String s1 = scan.next();
			String s2 = scan.next();
			if (s1.length() > MAX || s2.length() > MAX) {
				System.out.println("overflow");
				continue;
			}
			BigInteger ba = new BigInteger(s1);
			BigInteger bb = new BigInteger(s2);
			if (ba.add(bb).toString().length() > MAX)
				System.out.println("overflow");
			else
				System.out.println(ba.add(bb));

		}
	}
}

Measured memory_bytes: 17248
import java.util.Scanner;

public class Main {

    //Main
    public static void main(String args[]) throws Exception {

        Scanner Input = new Scanner(System.in);

        int X = Input.nextInt();
        int Y = Input.nextInt();

        if (X == Y) {
            System.out.println("Draw");
        } else if (X == 1) {
            System.out.println("Alice");
        } else if (Y == 1) {
            System.out.println("Bob");
        } else if (X > Y) {
            System.out.println("Alice");
        } else if (Y > X) {
            System.out.println("Bob");
        }

    }
}


Measured memory_bytes: 21972
#include<stdio.h>
int main(){
    int i,a[1000],b[1000],c[1000];
    char op[1000];
    for(i=0;;i+=1){
        scanf("%d %c %d",&a[i],&op[i],&b[i]);
        if(op[i]=='?'){  
            break;
        }
        else if(op[i]=='+'){
            c[i]=a[i]+b[i];
        }
        else if(op[i]=='-'){
            c[i]=a[i]-b[i];
        }
        else if(op[i]=='*'){
            c[i]=a[i]*b[i];
        }
        else if(op[i]=='/'){
            c[i]=a[i]/b[i];
        }
    }
    for(i=0;;i+=1){
        if(op[i]=='?'){
            break;
        }
        printf("%d\n",c[i]);
    }
    return 0;
}

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

int main(void){
  int n,m,i,j,k,fg;
  char ch,str[2][100];


  while(scanf("%d\n",&n),n){
    for(i=0,j=0;i<n;i++,j++){
      scanf("%c %c\n",&str[0][i],&str[1][i]);
    }
    scanf("%d\n",&m);
    for(k=0;k<m;k++){
      scanf("%c\n",&ch);
      fg=0;
      for(i=0;i<j+1;i++){
	if(ch==str[0][i]){
	  printf("%c",str[1][i]);
	  fg=1;
	  break;
	}
      }
      if(!fg)printf("%c",ch);
    }
    printf("\n");
  }
  
  return 0;
}

Measured memory_bytes: 0
h,w=map(int,input().split())
s=['-'*(w+2)]
for i in range(h):
    s.append('-'+input()+'-')
s.append('-'*(w+2))
for j in range(1,h+1):
    t=[]
    for k in range(1,w+1):
        if s[j][k]=='#':
            t.append('#')
        else:
            c=[s[j-1][k-1],s[j][k-1],s[j+1][k-1],s[j-1][k],s[j+1][k],s[j-1][k+1],s[j][k+1],s[j+1][k+1]]
            t.append(str(c.count('#')))
    t=''.join(t)
    print(t)


Measured memory_bytes: 3064
using System;

public class Program
{
	public static void Main()
	{
		char[] line = Console.ReadLine().ToCharArray();
		string ans = string.Empty;
		foreach (var ch in line)
		{
			if (ch == 'B')
			{
				if (!string.IsNullOrEmpty(ans))
				{
					ans = ans.Substring(0, ans.Length - 1);
				}
			}
			else
			{
				ans += ch.ToString();
			}
		}
		Console.WriteLine(ans);
	}
}

Measured memory_bytes: 2648
#include <stdio.h>

int main(void)
{
    int a, b;
    scanf("%d", &a);    scanf("%d", &b);
    int n = 1;
    if (b == 1) {
        printf("%d\n", 0);
    } else if (a >= b) {
        printf("%d\n", n);
    } else {
        int dif = b - a;
        int k;
        if (dif % (a - 1) == 0) {
            k = dif / (a - 1);
        } else {
            k = dif / (a - 1) + 1;
        }
        n += k;
        printf("%d\n", n);
    }
    
    return 0;
}


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

int main(int argc, char const *argv[])
{
	long long n;
	cin>>n;
	if (n==0)
	{
		cout<<"0\n";
		return 0;
	}
	vector<int> ans;
	long long now=1;
	while (n!=0)
	{
		if (n%abs(now*2)!=0)
		{
			ans.push_back(1);
			n-=now;
		}
		else
		{
			ans.push_back(0);
		}
		now*=-2;
	}
	if (n!=0)
	{
		ans.push_back(1);
	}
	reverse(ans.begin(), ans.end());
	for (auto v:ans)
	{
		cout<<v;
	}
	cout<<endl;
	return 0;
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(1000000)

tree = dict()
cost = dict()

N = int(input())
for i in range(N - 1):
    a, b, c = map(int, input().split())
    if a in tree:
        tree[a].append(b)
    else:
        tree[a] = []
        tree[a].append(b)
    if b in tree:
        tree[b].append(a)
    else:
        tree[b] = []
        tree[b].append(a)
    cost[(a, b)] = c
    cost[(b, a)] = c
starts = []
ends = []
Q, K = map(int, input().split())
for i in range(Q):
    x, y = map(int, input().split())
    starts.append(x)
    ends.append(y)

depth = [1000000000000000 for i in range(N)]

def dps(position, total_cost):
    if depth[position - 1] > total_cost:
        depth[position - 1] = total_cost
    for next_position in tree[position]:
        if depth[next_position - 1] == 1000000000000000:
            dps(next_position, depth[position - 1] + cost[(position, next_position)])

depth[K-1] = 0
dps(K, 0)

for start, end in zip(starts, ends):
    print(depth[start - 1] + depth[end - 1])

Measured memory_bytes: 157784
#include <bits/stdc++.h>
using namespace std;
#define LOCAL
#pragma region Macros
typedef long long ll;
#define ALL(x) (x).begin(),(x).end()
const long long MOD=1000000007;
// const long long MOD=998244353;
const int INF=1e9;
const long long IINF=1e18;
const int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
const char dir[4]={'D','R','U','L'};

template<typename T>
istream &operator>>(istream &is,vector<T> &v){
    for (T &x:v) is >> x;
    return is;
}
template<typename T>
ostream &operator<<(ostream &os,const vector<T> &v){
    for (int i=0;i<v.size();++i){
        os << v[i] << (i+1==v.size()?"": " ");
    }
    return os;
}
template<typename T,typename U>
ostream &operator<<(ostream &os,const pair<T,U> &p){
    os << '(' << p.first << ',' << p.second << ')';
    return os;
}
template<typename T,typename U>
ostream &operator<<(ostream &os,const map<T,U> &m){
    os << '{';
    for (auto itr=m.begin();itr!=m.end();++itr){
        os << '(' << itr->first << ',' << itr->second << ')';
        if (++itr!=m.end()) os << ',';
        --itr;
    }
    os << '}';
    return os;
}
template<typename T>
ostream &operator<<(ostream &os,const set<T> &s){
    os << '{';
    for (auto itr=s.begin();itr!=s.end();++itr){
        os << *itr;
        if (++itr!=s.end()) os << ',';
        --itr;
    }
    os << '}';
    return os;
}

void debug_out(){cerr << '\n';}
template<class Head,class... Tail>
void debug_out(Head&& head,Tail&&... tail){
    cerr << head;
    if (sizeof...(Tail)>0) cerr << ", ";
    debug_out(move(tail)...);
}
#ifdef LOCAL
#define debug(...) cerr << " ";\
cerr << #__VA_ARGS__ << " :[" << __LINE__ << ":" << __FUNCTION__ << "]" << '\n';\
cerr << " ";\
debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

template<typename T> T gcd(T x,T y){return y!=0?gcd(y,x%y):x;}
template<typename T> T lcm(T x,T y){return x/gcd(x,y)*y;}

template<class T1,class T2> inline bool chmin(T1 &a,T2 b){
    if (a>b){a=b; return true;} return false;
}
template<class T1,class T2> inline bool chmax(T1 &a,T2 b){
    if (a<b){a=b; return true;} return false;
}
#pragma endregion

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S; cin >> S;
    if (S.back()!='s') S+='s';
    else S+="es";
    cout << S << '\n';
}

Measured memory_bytes: 3636
#define _CRT_SECURE_NO_WARNINGS
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("Ofast")
#include <set>
#include <map>
#include <deque>
#include <cmath>
#include <queue>
#include <random>
#include <bitset>
#include <time.h>
#include <string>
#include <cstdio>
#include <vector>
#include <cassert>
#include <iomanip>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
//++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++
#define endl '\n'
#define mp make_pair
#define pbc push_back
#define pob pop_back()
#define empb emplace_back
#define sp system("pause")
#define queuel queue<long long>
#define all(x) (x).begin(), (x).end()
#define matrix vector<vector<ll>>
#define pin(p) cin >> p.first >> p.second;
#define rev(v) reverse(v.begin(), v.end());
#define mx(a) max_element(a.begin(), a.end());
#define mn(v) min_element(v.begin(), v.end());
#define sout(s, c) for (auto i : s) cout << i << c;
#define pout(p) cout << p.first << " " << p.second;
#define er(v, l, r) erase(v.begin() + l, v.begin() + r);
#define vin(v) for (ll i = 0; i < v.size(); ++i) cin >> v[i];
#define vout(v, c) for (int i = 0; i < v.size(); ++i) cout << v[i] << c;
#define pushi(v, a) for (int i = 0; i < a.size(); ++i) v.push_back(a[i]);
#define sin(s, n) for (int i = 0; i < n; ++i){int a; cin >> a; s.insert(a);}
#define fastio() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
//++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++
using namespace std;
//++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef vector<vector<char> > fd;
//++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++
const ll INF = 1e18;
const int inf = 1e9;
const ld PI = acos(-1.0);
const ll mod1 = inf + 7;
const ll mod2 = inf + 9;
const int MAXN = 100001;
const ld EPS = 1.0e-8;

signed main()
{
	fastio();
	int n, i;
	cin >> n >> i;
	cout << (n - i + 1);
}	

Measured memory_bytes: 256
n = int(input())
p = [int(i) for i in input().split()]
m = [p[0]] * n
if n > 1:
	for i in range(1, n):
		m[i] = min(m[i-1], p[i])
ans = 0
for i in range(n):
	if p[i] == m[i]:
		ans += 1
print(ans)

Measured memory_bytes: 25768
#include<bits/stdc++.h>
using namespace std;
long long n;
long long dp[26000000];
long long a[4],b[4];
long long v;
vector<int> ok;
int main(){
	#ifdef FILIN
		#ifndef DavidDesktop
			freopen(FILIN,"r",stdin);
			freopen(FILOUT,"w",stdout);
		#endif
	#endif
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>n;
	for(int i=1;i<=3;i++)
		cin>>a[i];
	for(int i=1;i<=3;i++)
		cin>>b[i];
	if(a[1]<b[1]) ok.push_back(1);
	if(a[2]<b[2]) ok.push_back(2);
	if(a[3]<b[3]) ok.push_back(3);
	memset(dp,-1,sizeof(dp)),dp[n]=0;
	for(int i=n;i>=1;i--){
		if(dp[i]==-1) continue;
		for(int j=0;j<ok.size();j++)
			if(i>=a[ok[j]])
				dp[i-a[ok[j]]]=max(dp[i-a[ok[j]]],dp[i]+b[ok[j]]);
		v=max(v,dp[i]+i);
	}
	v=max(v,dp[0]),n=v,memset(dp,-1,sizeof(dp)),dp[n]=0;
	ok.clear();
	if(a[1]>b[1]) ok.push_back(1);
	if(a[2]>b[2]) ok.push_back(2);
	if(a[3]>b[3]) ok.push_back(3);
	for(int i=n;i>=1;i--){
		if(dp[i]==-1) continue;
		for(int j=0;j<ok.size();j++)
			if(i>=b[ok[j]])
				dp[i-b[ok[j]]]=max(dp[i-b[ok[j]]],dp[i]+a[ok[j]]);
		v=max(v,dp[i]+i);
	}
	v=max(v,dp[0]);
	cout<<v<<endl;
	return 0;
}


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

int n, m, q;
int a[50];
int b[50];
int c[50];
int d[50];
int s[11];
int ans = 0;

void f(int i) {
	if (i > n) {
		int sum = 0;
		for (int i = 0; i < q; ++i) {
			if (s[b[i]] - s[a[i]] == c[i]) {
				sum += d[i];
			}
		}

		ans = max(ans, sum);
		return;
	}

	for (int v = s[i - 1]; v <= m; ++v) {
		s[i] = v;
		f(i + 1);
	}
}

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

	for (int i = 0; i < q; ++i) {
		cin >> a[i];
		cin >> b[i];
		cin >> c[i];
		cin >> d[i];
	}

	s[0] = 1;

	f(1);

	cout << ans;
	
	return 0;
}
	

Measured memory_bytes: 3600
#include <iostream>
#include <cstring>

using namespace std;

#define N 8

//  x 0 1 2 3 ...
// y
// 0
// 1
// 2
// 3
// ...

int pos[N];
int row_reserved[N];
bool col_owned[N];
bool down_owned[2 * N - 1];
bool up_owned[2 * N - 1];

void init_board() {
  memset(pos, -1, sizeof(pos));
  memset(row_reserved, -1, sizeof(row_reserved));
  memset(col_owned, false, sizeof(col_owned));
  memset(down_owned, false, sizeof(down_owned));
  memset(up_owned, false, sizeof(up_owned));
}

void print_board() {
  for(int i = 0;i < N;i++) {
    for(int j = 0;j < N;j++) {
      if(pos[i] == j) {
        cout << 'Q';
      } else {
        cout << '.';
      }
    }
    cout << endl;
  }
}

void set_queen(int x, int y) {
  pos[y] = x;
  col_owned[x] = true;
  down_owned[y - x + (N - 1)] = true;
  up_owned[x + y] = true;
}

void remove_queen(int x, int y) {
  pos[y] = -1;
  col_owned[x] = false;
  down_owned[y - x + (N - 1)] = false;
  up_owned[x + y] = false;
}

bool solve(int y) {
  int i;

  for(int j = 0;j < N;j++) {
    i = row_reserved[y] == -1 ? j : row_reserved[y];
    if(!col_owned[i] && !down_owned[y - i + (N - 1)] && !up_owned[i + y]) {
      set_queen(i, y);

      if(y + 1 >= N) {
        return true;
      }
      if(solve(y + 1)) {
        return true;
      } else {
        remove_queen(i, y);
      }
    }
  }

  return false;
}

int main() {
  int k, r, c;

  init_board();

  cin >> k;
  for(int i = 0;i < k;i++) {
    cin >> r >> c;
    row_reserved[r] = c;
  }

  solve(0);
  print_board();

  return 0;
}



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

int main() {
    int A, B, point = 0;
    cin >> A >> B;
    if (A > B) point += A--;
    else point += B--;
    if (A > B) point += A--;
    else point += B--;
    cout << point << endl;
    return 0;
}

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

int main() {
 string s;
 cin>>s;
 int n =s.size();
 int count=0;
 for(int i=0;i<n;i++){
   count+=s[i]-'0';
 }
 if(count%9==0)cout<<"Yes"<<endl;
 else cout<<"No"<<endl;
}

Measured memory_bytes: 3708
<?php

fscanf(STDIN, '%s', $S);

$l = strlen($S);
$count = 0;

for ($i=0; $i <$l ; $i++) { 
    if ( $S[$i] == $i % 2 ) {
        $count++;
    }
}

if ( $count >= $l / 2 ) {
    echo $l - $count;
} else {
    echo $count;
}

?>

Measured memory_bytes: 4728
use std::io;

fn main() {
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    let mut iter = buf.split_whitespace();

    let W: i32 = iter.next().unwrap().parse().unwrap();
    let H: i32 = iter.next().unwrap().parse().unwrap();
    let x: i32 = iter.next().unwrap().parse().unwrap();
    let y: i32 = iter.next().unwrap().parse().unwrap();
    let r: i32 = iter.next().unwrap().parse().unwrap();

    if x >= r && x <= W - r && y >= r && y <= H - r {
        println!("Yes");
    } else {
        println!("No");
    }
}


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

int solve(int x){
    int cnt = 0;
    set<int> st;
    while(x >= 10){
        if(st.count(x)==0) st.insert(x);
        else return -1;
        string s = to_string(x);
        int n = s.size();
        int ma = 0;
        for(int i=1;i<n;i++){
            int a = stoi(s.substr(0,i)), b = stoi(s.substr(i,n-i));
            ma = max(ma, a*b);
        }
        x = ma;
        cnt++;
    }
    return cnt;
}


int main() {
    int Q, N;
    cin >> Q;
    for(int i=0;i<Q;i++){
        cin >> N;
        cout << solve(N) << endl;
    }
    return 0;
}



Measured memory_bytes: 3272
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int MOD = pow(10, 9) + 7;
//const int MOD = 998244353;
//const int MOD = ;
int mod(int A, int M) {return (A % M + M) % M;}
const int INF = 1LL << 60;
const string ABC = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const string abc = "abcdefghijklmnopqrstuvwxyz";
template <class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template <class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
int divCeil(int A, int B) {return (A + (B - 1)) / B;}

signed main()
{
  string s;
  cin >> s;
  int n = s.size();

  vector<string> S = {""};
  for (int i = 0; i < n; i++)
  {
    if (s.at(i) == 'A') S.at(S.size() - 1) += "A";
    else if (i < n - 1 && s.substr(i, 2) == "BC")
    {
       S.at(S.size() - 1) += "X";
       i++;
    }
    else S.push_back("");
  }
  
  int N = S.size();

  int ans = 0;
  for (int i = 0; i < N; i++)
  {
    int a = 0, x = 0;
    string ss = S.at(i);
    int nn = ss.size();
    for (int j = 0; j < nn; j++)
    {
      if (ss.at(j) == 'X')
      {
        ans += a;
        x++;
      }
      else a++;
    }
    cerr << ss << " " << ans << endl;
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 3448
#include<stdio.h>
int main(){
	int A, B, C;
	int K, i;
	int Goukei;
	int Dekai, Big = 0;
	scanf("%d %d %d", &A, &B, &C);
	scanf("%d", &K);
	Dekai = A;
	if (A < B){
		Dekai = B;
		if (B < C){
			Dekai = C;
		}
	}
	else if (A < C){
		Dekai = C;
	}
	Big = Big + Dekai;
	for (i = 0; i < K; i++){
		Dekai = Dekai * 2;
	}
	Goukei = A + B + C + Dekai - Big;
	printf("%d\n",Goukei );
	return 0;
}

Measured memory_bytes: 128
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
	static class Restaurant{
		public Restaurant(int id, String name, int score) {
			this.id = id;
			this.name = name;
			this.score = score;
		}
		int id;
		String name;
		int score;
	}
	public static void main(String[] args) {
		try(Scanner sc = new Scanner(System.in)){
			int N = sc.nextInt();
			List<Restaurant> restaurants = new ArrayList<>();
			for(int i = 0; i < N; i++) {
				restaurants.add(new Restaurant(i + 1, sc.next(), sc.nextInt()));
			}
			restaurants.stream()
				.sorted((l, r) -> {
					int c = l.name.compareTo(r.name);
					if(c != 0) return c;
					return r.score - l.score;
				})
				.forEach(r -> System.out.println(r.id));
		}
	}
}


Measured memory_bytes: 26964
fun main(args: Array<String>) {
  val (N) = readLine()!!.split(" ").map { it.toInt() }
  for (a in 1..9) {
    for (b in 1..9) {
      if (N == a * b) {
        println("Yes")
        return
      }
    }
  }
  println("No")
}



Measured memory_bytes: 38264
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define INF 9999999999

int main(){
  string s;
  cin >> s;
  int s_len, i=0;
  s_len = s.length();
  while(i < s_len){
    string sub = s.substr(i, 5);
    if (sub == "dream"){
      if (s[i+5] == 'e' && s[i+6] == 'r'){
        string sub2 = s.substr(i+5, 5);
        if (sub2 == "erase"){
          i += 5;
        }else{
          i += 7;
        }
      }else{
        i += 5;
      }
    }else if (sub == "erase"){
      if (s[i+5] == 'r'){
        i += 6;
      }else{
        i += 5;
      }
    }else{
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES" << endl;
  return 0;
}

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

int main() {
  int N, K;
  cin >> N >> K;
  ll ans = 1;
  if (N == 1) {
    cout << K << endl;
    return 0;
  }
  for (int i = 1; i <= N-1; i++) {
    ans *= (K-1);
  }
  cout << ans*K << endl;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <cmath>

using namespace std;

int main()
{
    int X;
    if (scanf("%d", &X) < 1) return 0;

    int x = abs(X);

    int ans = 0;
    int time = 0;
    int i = 1;
    while (true)
    {
        time += i;

        if (x <= time)
        {
            ans = i;
            break;
        }

        i++;
    }

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


Measured memory_bytes: 128
from sys import stdin
n,m = map(int,stdin.readline().rstrip().split())
li = [list(map(int,stdin.readline().rstrip().split())) for _ in range(m)]
for i in range(1000):
    s = str(i)
    if len(s) != n:
        continue
    flag = True
    for j,k in li:
        if s[j-1] != str(k):
            flag = False
    if flag:
        print(s)
        exit()
print(-1)   

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <stack>
#include<algorithm>
#include<sstream>
#include<iomanip>
#include<deque>
#include<list>


using namespace std;

typedef long long ll;

typedef pair<int, int> pii;

const ll MOD_CONST = 1000000007;
const ll BIG_NUM = 1000000000000000000;
const int BIG_INT = 1000000000;



int main() {
	ll a, b, c, k;
	cin >> a >> b >> c >> k;

	ll ans = (a - b) *(k % 2==0 ? 1 : -1);
	cout << ans << endl;
}



Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0;i < (int)(n);i++)
using ll = long long;
const ll MOD=1000000007;
const long long INF = 1LL << 60;
const double pi=acos(-1.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; }

ll H,W;
vector<vector<ll>> table;
vector<string> grid;

bool movable(ll sx,ll sy,ll gx,ll gy){
  if(sx<0||sx>W||sy<0||sy>=H) return false;
  if(gx<0||gx>W||gy<0||gy>=H) return false;
  
  if(grid.at(sy).at(sx)=='#') return false;
  if(grid.at(gy).at(gx)=='#') return false;
  
  return true;
}

//dp
ll dp(ll x,ll y){
  if(x==0&&y==0) return 1;
  if(table.at(y).at(x)>-1) return table.at(y).at(x);
  
  table.at(y).at(x)=0;
  if(movable(x-1,y,x,y)) table.at(y).at(x)+=dp(x-1,y);
  if(movable(x,y-1,x,y)) table.at(y).at(x)+=dp(x,y-1);
  
  return table.at(y).at(x)%=MOD;
}
int main()
{
  cin>>H>>W;
  table=vector<vector<ll>>(H,vector<ll>(W,-1));
  grid=vector<string>(H); rep(i,H) cin>>grid.at(i);
  
  //dp
  cout<<dp(W-1,H-1)<<endl;
  return 0;
}


Measured memory_bytes: 13496
#include <bits/stdc++.h>
using namespace std;
using ll =long long;
#define all(v) v.begin(),v.end()
 
int main() {
 string S="abcdefghijklmnopqrstuvwxyz";
  char a;
  cin>>a;
  for(ll i=0;i<26;i++) {
    
if(a==S[i]) {
cout<<S[i+1]<<endl;
}
  }
}


Measured memory_bytes: 3636
n,k = gets.chomp.split.map(&:to_i)
array = Array.new
hash = Hash.new
n.times do |i|
  a,b = gets.split.map(&:to_i)
  array.push(a)
  hash[a] = hash[a].to_i + b
end

array.uniq!
array.sort!
cnt = 0
array.size.times do |j|
  cnt += hash[array[j]]
  if cnt >= k then
    puts array[j]
    exit
  end
end

Measured memory_bytes: 10620
n = int(input())
a = list(map(int, input().split()))
b = []
y = 0
for i in range(n):
    if i % 2 == 0:
        y += a[i]
    else:
        y -= a[i]
b.append(y)
for i in range(n - 1):
    y = 2 * (a[i] - y // 2)
    b.append(y)
print(" ".join(map(str, b)))

Measured memory_bytes: 19096
import java.util.*;
import java.io.*;

class Main {

	void solve() {
		
		//自分より後ろに、自分より小さいものがあっちゃだめ
		
		//あるiについて、その地点までの最小値がi未満であれば、満たさない
		int n = inint();
		int[] a = inintar(n);
		
		int count = 0;
		
		int min = Integer.MAX_VALUE;
		for (int i=0; i<n; i++) {
			
			min = Math.min(min, a[i]);
			if (min >= a[i]) count++;
			
		}
		
		out.println(count);
		
	}

	public static Scanner in = new Scanner(System.in);
	public static PrintWriter out = new PrintWriter(System.out);

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

	public int inint() {
		return in.nextInt();
	}

	public long inlong() {
		return in.nextLong();
	}

	public double indouble() {
		return in.nextDouble();
	}

	public String instr() {
		return in.next();
	}

	public char inchar() {
		return in.next().charAt(0);
	}

	public int[] inintar(int num) {
		int[] a = new int[num];
		for (int i=0; i<num; i++) {
			a[i] = in.nextInt();
		}
		return a;
	}

	public char[] incharar() {
		return in.next().toCharArray();
	}

	public char[][] incharmap(int h, int w) {
		char[][] a = new char[h][w];
		for (int i=0; i<h; i++) {
			String temp = in.next();
			for (int j=0; j<w; j++) {
				a[i][j] = temp.charAt(j);
			}
		}
		return a;
	}

}

Measured memory_bytes: 85364
#include<stdio.h>
#include<iostream>
#include<iomanip>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<algorithm>
#include<string>
#include<math.h>
#include<numeric>
#include<complex>
#include<ctype.h>

using namespace std;
typedef long long ll;

#define REP(i,n) for(int i=0;i<n;++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define pn(s) cout << (#s) << " " << (s) << endl

const ll mod = 1e9 + 7;
const ll inf = 1e18;

void pV(vector<ll> A){
    cout << "[vector]" << endl;
    for(int i=0; i<A.size(); i++){
        cout << A[i] << " ";
    }
    cout << endl;
}

int H[1000] = {};
int T;

float temperature(int height){
    return T - 0.006 * height;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    // input
    int N;
    cin >> N;

    int A;
    cin >> T >> A;

    FOR(i, 0, N){
        cin >> H[i];
    }

    float minDiff = abs(A - temperature(H[0]));
    int answer = 0;

    FOR(i, 1, N){
        float diff = abs(A - temperature(H[i]));
        if(diff < minDiff){
            minDiff = diff;
            answer = i;
        }
    }

    p(answer+1);
    
    return 0;
}

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

#ifdef TESTING
  #include "dump.hpp"
#else
  #define DUMP(...)
  #define DEBUG(...)
#endif

typedef unsigned int ui;
typedef long long ll;
typedef unsigned long long ull;
#define SZ(a) int((a).size())
#define _REP(_1,_2,_3,_4,name,...) name
#define _REP4(i,b,e,s) for(decltype(e) _b=(b),_e=(e),i=_b+(0<(s)?0:(s));(0<(s)?i<_e:_e<=i);i+=(s))
#define _REP3(i,b,e) for(decltype(e) _b=(b),_e=(e),i=(_b<_e?_b:_b-1);(_b<_e?i<_e:_e<=i);(_b<_e?i++:i--))
#define _REP2(i,n) for(decltype(n) i=0,_n=(n);i<_n;i++)
#define _REP1(n) for(decltype(n) _i=0,_n=(n);_i<_n;_i++)
#define REP(...) _REP(__VA_ARGS__,_REP4,_REP3,_REP2,_REP1)(__VA_ARGS__)
#define FOR(it,c) for(auto&& it=begin(c);it!=end(c);it++)
#define ROF(it,c) for(auto&& it=rbegin(c);it!=rend(c);it++)
#define EB emplace_back
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define INT(n) int n;assert(0<scanf("%d",&n))
#define STR(s) string s;cin>>s

int main(){
  INT(h); INT(w);
  vector<string> bd;
  REP(h){STR(s); bd.PB(s);}
  int d[50][50], dx[] = {1, 0, -1 , 0}, dy[] = {0, 1, 0, -1}, wh = 0;
  REP(i, h){
    REP(j, w){
      d[i][j] = 1 << 30;
      if (bd[i][j] == '.'){wh++;}
    }
  }
  d[0][0] = 1;
  queue<pair<int, int>> q;
  q.push(MP(0, 0));
  while(!q.empty()){
    pair<int, int> p = q.front(); q.pop();
    REP(i, 4){
      int x0 = p.first, x = x0 + dx[i], y0 = p.second, y = y0 + dy[i];
      if (0 <= x && x < w && 0 <= y && y < h && h * w < d[y][x] && bd[y][x] == '.'){
        d[y][x] = d[y0][x0] + 1;
        q.push(MP(x, y));
      }
    }
  }
  if (d[h - 1][w - 1] < h * w){
    printf("%d\n", wh - d[h - 1][w - 1]);
  } else {
    printf("-1\n");
  }
  return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env ruby

require 'set'

class Hash
  def push(key, value)
    self[key] = [] if self[key] == nil
    self[key].push(value)
  end
end

class Array
  def lower_bound(value)
    left = -1;
    right = self.length;
    while left + 1 < right
      mid = left + (right - left) / 2;
      if self[mid] >= value
        right = mid
      else
        left = mid
      end
    end
    right
  end

  def unique
    res = [self.first]
    each_cons(2) do |a, b|
      if a != b
        res.push(b)
      end
    end
    res
  end
end

def get_ints
  gets.chomp.split.map(&:to_i)
end

def get_ints_minus_one
  get_ints.map { |x| x - 1 }
end

def get_int
  gets.chomp.to_i
end

N = get_int
A = []
N.times do |i|
  A[i] = get_int
end

a_sorted = A.sort
max = a_sorted.last
second_max = a_sorted.reverse[1]

A.each do |a|
  if a == max
    puts second_max
  else
    puts max
  end
end


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


int dp[10][110];


void makeDP(){
	dp[0][0] = 1;
	for(int i = 0;i <= 9;i++){
		for(int j = 100;j >= i;j--){
			for(int k = 9;k >= 1;k--){
				dp[k][j] += dp[k-1][j-i];
			}
		}
	}
}


int main(){
	int n, s;

	makeDP();

	while(cin >> n >> s, n || s) cout << dp[n][s] << endl;
	
	return 0;
}

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

bool isprime(long long int val) {
    if (val <= 1)return false;
    for (long long int i = 2; i*i <= val; i++) {
        if (val%i == 0LL)return false;
    }
    return true;
}

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

    vector<int> db;
    int n,p;
    while(cin>>n>>p){
        if(n==-1) break;
        vector<int> v;
        vector<int> ans;
        for(int i=1;v.size()<=100;i++){
            if(isprime(n+i)){
                v.push_back(n+i);
            }
        }
        int m = v.size();
        for(int i=0;i<m;i++){
            for(int j=i;j<m;j++){
                ans.push_back(v[i]+v[j]);
            }
        }
        sort(ans.begin(),ans.end());
        cout << ans[p-1] << endl;
        db.push_back(ans[p-1]);
    }

    //for(auto i:db) cerr<<i<<" ";


}


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

using namespace std;

int main() {

	int r, c;
	cin >> r >> c;

	int a[101][101] = {};
	int r_total = 0;

	for (int i = 0; i < r; i++) {
		for (int j = 0; j < c; j++) {
			cin >> a[i][j];
			r_total += a[i][j];
		}
		a[i][c] = r_total;
		r_total = 0;
	}

	int c_total = 0;
	for (int j = 0; j <= c; j++) {
		for (int i = 0; i <= r; i++) {
			c_total += a[i][j];
		}
		a[r][j] = c_total;
		c_total = 0;
	}

	int total;

	for (int i = 0; i <= r; i++) {
		for (int j = 0; j <= c; j++) {
			printf("%d%c", a[i][j], j < c ? ' ' : '\n');
		}
	}

	return 0;
}

Measured memory_bytes: 1192
#include <bits/stdc++.h>
using namespace std;
#define pii pair<int,int>
#define pll pair<long long, long long >
#define ll long long
#define lcm(a,b) (a)/__gcd((a),(b))*(b)
#define pb push_back
#define mp make_pair
#define x first
#define y second
#define maxn 1000000007
#define inf 100000000000000000
#define endl '\n'
#define trace(x) cerr << #x << ": " << x << endl;
#define trace2(x, y) cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z) cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d)cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
ll add(ll a, ll b)
{
  return a+b;
}
int dir8[2][8] = {{1,-1,0,0,1,-1,1,-1},{0,0,1,-1,1,-1,-1,1}};
int dir4[2][4] = {{1,-1,0,0},{0,0,1,-1}};
ll m,n,row,col;
ll a[200006],h[200006];
ll tree[1000006],dp[200006];
ll query(ll node,ll b,ll e,ll i,ll j)
{
  if(b>j || e < i)return -inf;
  if(b>=i && e<=j)return tree[node];
  ll left = 2*node;
  ll right = left+1;
  ll mid = (b+e)/2;
  ll p1 = query(left,b,mid,i,j);
  ll p2 = query(right, mid+1,e,i,j);
  return max(p1,p2);
}
void update(ll node,ll b,ll e, ll i, ll x)
{
  if(b > i || e < i)return;
  if(b==e)
  {
    tree[node]  = max(tree[node],x);
    return;
  }

  ll left = 2*node;
  ll right = left+1;
  ll mid = (b+e)/2;
  update(left,b,mid,i,x);
  update(right,mid+1,e,i,x);
  tree[node] = max(tree[left],tree[right]);
}
void solve()
{
  scanf("%lld",&n);
  for(int w=0;w<n;w++)scanf("%lld",&h[w]);
  for(int w=0;w<n;w++)scanf("%lld",&a[w]);
  for (int i = 0; i < 4 * n; ++i) tree[i] = 0;
  for (int i = 0; i <= n; ++i) dp[i] = 0;
  for(int w=0;w<n;w++)dp[h[w]]=a[w];
  for(int w=0;w<n;w++)
  {
    m = query(1,1,n,1,h[w]-1);
    if(m == -inf)m=0;
    dp[h[w]] = max(dp[h[w]],add(m,a[w]));
    update(1,1,n,h[w],dp[h[w]]);
  }
  ll ans = 0;
  for(int w=1;w<=n;w++)ans = max(ans,dp[w]);
  cout << ans << endl;

}
void test()
{
  int t;
  //scanf("%d",&t);
  t = 1;
  for(int test=1;test<=t;test++)
  {
    solve();
  }
}
int main()
{
  test();
  return 0;
}


Measured memory_bytes: 12800
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int MAXL=100005;
char c[MAXL];
int l,d[30],e[30][MAXL],f[30][MAXL];
int main(){
	scanf("%s",c+1);
	l=strlen(c+1);
	for(int i=1;i<=l;i++){
		int v=c[i]-'a';
		e[v][d[v]+1]=i-f[v][d[v]];
		f[v][++d[v]]=i;
		if(e[v][d[v]]<=2&&d[v]>=2){
			printf("%d %d\n",f[v][d[v]-1],f[v][d[v]]);
			return 0;
		}
	}
	printf("-1 -1\n");
}

Measured memory_bytes: 20864
# # Make IO faster
# import sys
# input = sys.stdin.readline

# # get single (or) multiple str
# X = input()

# # get single int
# N = int(input())
# # get multiple int (e.g., 2)
# X, Y = map(int, input().split())
# # get multiple int (e.g., 2) for N lines
# XY = [list(map(int, input().split())) for _ in range(N)]

# from IPython import embed; embed(); exit();

# 全部入り
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
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
import numpy as np
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

D, T, S = MAP()

if D <= S * T:
    print("Yes")
else:
    print("No")


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

int main() {
  ll X;
  cin >> X;

  ll ans = 0;
  ll now = 100;
  while(now < X) {
    now = now * 1.01;
    ans++;
  }

  cout << ans << endl;

}


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

int main(void) {
  char S[11] = "..........";
  int flag = 0;
  int i;

  scanf("%s", S);

  if (strlen(S) % 2) goto exit;

  for (i = 0; i < (int)strlen(S) - 1; i += 2) {
    if ((S[i] == 'h') && (S[i+1] == 'i')) {
      flag = 1;
    }
    else {
      flag = 0;
    }
  }

  exit:
    if (flag) {
        printf("Yes\n");
    }
    else {
      printf("No\n");
    }
  return (0);
}


Measured memory_bytes: 128
/*input
abcdefghjldfjhskgdfgkdfjghdfjkghkdfghjkdfhjkaa
aaaaaaaaaaaaaaaaaaaaaaaaa
*/
//assic value of ('0'-'9') is(48 - 57) and (a-z) is (97-122) and (A-Z) is(65-90) and 32 for space
#include<bits/stdc++.h>
using namespace std;
#define ll          long long
#define pb          push_back
#define	endl		'\n'
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define is_empty(v) v.empty()
#define vs			vector< string >
#define vvi			vector< vector< ll,ll > >
#define all(it,a)   for(auto it=(a).begin();it!=(a).end();it++) 
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define inf         1000000007
#define rep(i,a,b)	for(ll int i=a;i<b;i++)
#define repr(i,a,b) for(ll int i=a;i>b;i--)
#define reprr(i,a,b) for(ll int i=a;i>=b;i--)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define sum(v)      accumulate(v.begin(),v.end(),(ll)0)
//map <long long int,long long int> ma;
//set <long long int, greater <long long int> > s;

vector< vi > pos(26,vi ());
int solve()
{
	string s,t;
	cin>>s>>t;
	rep(i,0,sz(s))
	{
		pos[s[i]-'a'].pb(i);
	} 

	ll last_pos=-1,cnt=0;
	rep(i,0,sz(t))
	{
		// vi a = pos[t[i]-'a'];
		ll idx = ubnd(pos[t[i]-'a'].begin(), pos[t[i]-'a'].end(),last_pos)-pos[t[i]-'a'].begin();
		if(idx==sz(pos[t[i]-'a'])){
			cnt++;
			if(sz(pos[t[i]-'a'])>=1) last_pos=pos[t[i]-'a'][0];
			else 
			{
				cout<<"-1\n";
				return 0;
			}
		}
		else
		{
			last_pos = pos[t[i]-'a'][idx];
		}
	}

	cout<<cnt*sz(s)+last_pos+1<<"\n";
}

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

	ll t=1;
	// cin>>t;
	while(t--)
		solve();
}

Measured memory_bytes: 1736
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
using ll = long long;
const ll INF = 1e9 + 7;

int main(){
    string S,T; cin >> S >> T;
    int A,B; cin >> A >> B;
    string U; cin >> U;
    
    if (S==U) A-=1;
    if (T==U) B-=1;
    
    cout << A <<  " " << B;
}

Measured memory_bytes: 256
def dfs(index):
    global ans
    if index == N:
        if blst.count(1) >= K - 1:
            tmp = a[0]
            anstmp = 0
            for i in range(1, N):
                if blst[i - 1] == 0:
                    if tmp < a[i]:
                        tmp = a[i]
                    continue
                if tmp >= a[i]:
                    anstmp += tmp - a[i] + 1
                    tmp += 1
                else:
                    tmp = a[i]
            ans = min(ans, anstmp)
        return
    for i in range(2):
        blst[index - 1] = i
        dfs(index + 1)
    return

N, K = map(int, input().split())
a = list(map(int, input().split()))
blst = [0] * (N - 1)
ans = float('inf')
dfs(1)

print(ans)


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

int __cd(int a,int b, int k) {
    int maxd = min(a,b);
    int cnt = 0;
    for(int i=maxd;i>0;i--) {
        if(a%i==0 && b%i==0) {
            cnt++;
            if(cnt == k){
                return i;
            }
        }
    }
    return 1;
}

int main(void) {
    int A,B,K;
    
    cin >> A >> B >> K;
    cout << __cd(A,B,K) << endl;

    return 0;
}


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

public class AtCoder_154_E
{
    public static void Main()
    {
        //var exStdIn = new System.IO.StreamReader("input.txt");
        //System.Console.SetIn(exStdIn);

        char[] n = Console.ReadLine().ToCharArray();
        int k= int.Parse(Console.ReadLine());

        long[] pow = new long[] {1, 9, 9 * 9, 9 * 9 * 9};

        if (k > n.Length)
        {
            Console.WriteLine("0");
            return;
        }

        long ans = 0;
        for (int i = 0; i < k && i < n.Length; i++)
        {
            int left = int.Parse(n[i].ToString());
            if (left == 0)
            {
                k++;
                if (i == n.Length - 1)
                {
                    ans--;
                }
                continue;
            }
            if (i < n.Length - 1)
            {
                // 一番大きい暗いを選ばない
                ans += pow[k - i] * nCm(n.Length - i - 1, k - i);
            }
            if (left > 1)
            {
                if (i == k - 1)
                {
                    ans += (left - 1);
                }
                else
                {
                    ans += (left - 1) * pow[k - i - 1] * nCm(n.Length - i - 1, k - i - 1);
                }
            }
        }
        ans++;

        Console.WriteLine(ans);
    }
    // Copyright (C) 2013 sz-x638 All rights reserved.
    // http://zweihander638.blog.fc2.com
    public static long nCm(int n, int m)
    {
        if (m == 0) return 1;
        if (n == 0) return 0;
        return n * nCm(n - 1, m - 1) / m;
    }
}


Measured memory_bytes: 13140