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

/* clang-format off */
// #define int long long
// #define double long double
struct Fast {Fast() {cin.tie(0); ios::sync_with_stdio(false);}} fast;

template <typename T> inline size_t maxElement(T beginIt, T endIt) { return max_element(beginIt, endIt); }
template <typename T> inline size_t minElement(T beginIt, T endIt) { return min_element(beginIt, endIt); }
template <typename T> inline size_t maxIndex(T beginIt, T endIt) { return distance(beginIt, *max_element(beginIt, endIt)); }
template <typename T> inline size_t minIndex(T beginIt, T endIt) { return distance(beginIt, *min_element(beginIt, endIt)); }
template <typename T> inline int sum(T beginIt, T endIt) { return accumulate(beginIt, endIt, 0); }
template <typename T> inline int mean(T beginIt, T endIt) { return sum(beginIt, endIt) / distance(beginIt, endIt); }
template <typename T> inline void debug(T x) { cerr << x << " " << "(L:" << __LINE__ << ")" << endl; }
/* clang-format on */

signed main(void) {
  /* */
  int num;
  num = 0; // count
  // num = numeric_limits<int>::min(); // max
  // num = numeric_limits<int>::max(); // min
  int N;
  // array<int, 200000> A;
  string S;
  /* */

  cin >> S;
  cin >> N;

  for (unsigned int i = 0; i < S.size(); ++i) if (i % N == 0) cout << S[i];
  cout << endl;

  // cout << num << endl;
  return 0;
}


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

int main(){
    int n;
    cin >> n;
    map<int, int> a;
    rep(i, n-1){
        int an;
        cin >> an;
        an--;
        if(a.count(an)) a.at(an)+=1;
        else a[an]=1;
    }
    rep(i, n){
        if(a.count(i)) cout << a[i] << endl;
        else cout << 0 << endl;
    }
    return 0;
    
}

Measured memory_bytes: 12984
#include<iostream>
#include<math.h>
#include<string>
#include<vector>
#include<algorithm>
#include<sstream>
#include<stack>

using namespace std;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  string x;
  stack<char> sck;

  cin >> x;

  for(int i = 0; i < x.size(); i++){
    if(x[i] == 'S'){
      sck.push(x[i]);
    }
    else if(sck.empty() || sck.top() == 'T'){
      sck.push(x[i]);
    }
    else{
      sck.pop();
    }
  }
  cout << sck.size() << endl;
  
}


Measured memory_bytes: 720
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pi atan(1.0)*4
#define pb push_back
#define in(x) insert(x)
#define fl(x,y) for(ll i=x;i<y;i++)
#define vi vector<long long>
#define vs  vector<string>
#define vp(vi,x) cin>>x; vi.pb(x);
string en="\n";
string hlo="hello";
string Y="YES\n";
string Ys="Yes\n";
string N="NO\n";
string No="No\n";
string sp=" ";
#define E end()
#define B begin()
#define sz size()
#define EM empty()
#define fi first
#define se second
#define clr clear()
#define sqr(a) (a*a)
#define mk make_pair
#define mem(a,b) memset(a,b,sizeof(a))
#define all(cont) cont.begin(),cont.end()
bool isprm(ll a){for(ll i=2;i*i<=a;i++){if(a%i==0)return false;}return true;}
bool palin(string a){for(int i=0;i<a.sz;i++){if(a.at(i)!=a.at(a.sz-i-1))return 0;} return 1;}
bool isVowel(char ch){ ch=toupper(ch); if(ch=='A'||ch=='U'||ch=='I'||ch=='O'||ch=='E' ) return true; return false;}
/*int toInt(string s){int sm;stringstream ss(s);ss>>sm;return sm;}
LL bpow(LL a,LL b){if(b==0)return 1;LL r=bpow(a,b/2);if(b%2)return r*r*a;else return r*r;}
LL binpow(LL a,LL b){LL r=1;while(b>0){if(b&1)r=r*a;a=a*a;b>>=1;}return r;}
LL binpow(LL a,LL b,LL m){a%=m;LL r=1;while(b>0){if(b&1) r=r*a%m;a=a*a%m; b>>=1;}return r;}
template<typename T>inline T gcd(T a,T b){if(a<0)return gcd(-a,b);if(b<0)return gcd(a,-b);return (b==0)?a:gcd(b,a%b);}
template<typename T>inline T lcm(T a,T b) {if(a<0)return lcm(-a,b);if(b<0)return lcm(a,-b);return a*(b/gcd(a,b));}
*/
//bool isVowel(char ch){ ch=toupper(ch); if(ch=='A'||ch=='U'||ch=='I'||ch=='O'||ch=='E') return true; return false;}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll a,b,c,d,e,x,t,n,k,m,p,q,r,y,z,yy,sum=0,ct=0,flag=0;
    string s,s1,s2,s3,s4;
    char ch,ch1,ch2;
    deque<ll>d1,d2,d3;
    vector<string>vs1;
    string ss1;
    map<ll,ll>mp;
    //map<ll,ll>::iterator it;
    set<char>st1,st2;
    //set<ll>::iterator iter = st.begin();
    vector<pair<ll,ll> >v;
    double x1,y1,x2,y2,x3,y3,x4,y4;
    sum=0; ll mx=0,mn=3487327628458454875,cp=0;
    ll HR,MN,mnt,hrs,c1=0,c2=0; flag=0;
    ct=0; flag=0; cp=0;
    vector<ll>v1,v2,v3;
    //cin.ignore();
    //getline(cin,s);


         mn=3487327628458454875; flag=0,cp=0;
         cin>>n>>x>>t;
         p=(n/x);
         if(n%x!=0) p++;
         cout<<p*t<<endl;

     return 0;
}


Measured memory_bytes: 3664
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>
  
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
  
using namespace std;
  
typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;
  
const int INF=1<<29;
const double EPS=1e-9;
  
const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};


int main() {
  int N;
  cin >> N;
  ll E = 0;
  vector<vector<ll>> dist(N, vector<ll>(N));
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N; j++) {
      cin >> dist[i][j];
      if (i > j) E += dist[i][j];
    }
  }

  for(int k = 0; k < N; k++) {
    for(int i = 0; i < N; i++) {
      for(int j = 0; j < N; j++) {
        if (dist[i][j] > dist[i][k] + dist[k][j]) {
          cout << -1 << endl;
          return 0;
        }
      }
    }
  }

  ll sum = 0;
  for (int i = 0; i < N; i++) {
    for (int j = i + 1; j < N; j++) {
      for (int k = 0; k < N; k++) {
        if (j == k || i == k) continue;
        if (dist[i][j] == dist[i][k] + dist[k][j]) {
          sum += dist[i][j];
          break;
        }
      }
    }
  }
  cout << E - sum << endl;
  return 0;
}

Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = getInt(sc);
		int mod = n % 10;

		if (mod == 3) {
			System.out.println("bon");
		} else if (mod == 0 || mod == 1 || mod == 6 || mod == 8) {
			System.out.println("pon");
		} else {
			System.out.println("hon");
		}
	}

	/**
	 * *汎用メソッド <br>
	 * スキャナーからの入力値をlongで返却
	 *
	 * @return
	 */
	public static long getLong(Scanner sc) {

		return Long.parseLong(sc.next());
	}

	/**
	 * *汎用メソッド <br>
	 * スキャナーからの入力値をintで返却
	 *
	 * @return
	 */
	public static int getInt(Scanner sc) {

		return Integer.parseInt(sc.next());
	}

	/**
	 * *汎用メソッド <br>
	 * スキャナーからの入力値をStringで返却
	 *
	 * @return
	 */
	public static String getString(Scanner sc) {

		return sc.next();
	}

	/**
	 * *汎用メソッド <br>
	 * スキャナーからの入力値をint配列で返却
	 *
	 * @return
	 */
	public static int[] getIntArray(Scanner sc) {
		String line = "";
		// 直前にnext()を実行していると改行コードだけ取ってしまうのでその対策
		while (line.equals("")) {
			line = sc.nextLine();
		}

		String[] strArray = line.split(" ");
		int[] intArray = new int[strArray.length];
		for (int i = 0; i < strArray.length; i++) {
			intArray[i] = Integer.parseInt(strArray[i]);
		}
		return intArray;
	}

}


Measured memory_bytes: 35748
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long int ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
const ll MOD = 1000000007;

int main() {
    int x;
    cin >> x;
    ll ans = 1;
    FOR(i, 2, x) {
        FOR(j, 2, x) {
            ll s = pow(i, j);
            if (x >= s && s >= ans)
                ans = s;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define owo(i,a, b) for(int i=(a);i<(b); ++i)
#define uwu(i,a, b) for(int i=(a)-1; i>=(b); --i)
#define senpai push_back
#define ttgl pair<int, int>
#define ayaya cout<<"ayaya~"<<endl
 
using namespace std;
/*#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
gpu_hash_map<int, int> mp;*/
using ll = long long;
using ld = long double;
const ll MOD = 1000000007;
const ll root = 62;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
ll binpow(ll a,ll b){ll res=1;while(b){if(b&1)res=(res*a)%MOD;a=(a*a)%MOD;b>>=1;}return res;}
ll modInv(ll a){return binpow(a, MOD-2);}
const double PI = acos(-1);
const double eps = -1e6;
const int INF = 0x3f3f3f3f;
const int NINF = 0xc0c0c0c0;
const ll INFLL = 0x3f3f3f3f3f3f3f3f;
const ll NINFLL = 0xc0c0c0c0c0c0c0c0;
const int mxN = 100001;
int cnt[10];
int main() {
    //freopen("file.in", "r", stdin);
    //freopen("file.out", "w", stdout);
    mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
    cin.tie(0)->sync_with_stdio(0);
    int a, b, c, d;
    cin>>a>>b>>c>>d;
    cnt[a]++;
    cnt[b]++;
    cnt[c]++;
    cnt[d]++;
    if(cnt[1]>0&&cnt[7]>0&&cnt[9]>0&&cnt[4]>0) {
        cout<<"YES\n";
    }else {
        cout<<"NO\n";
    }
    return 0;
}

Measured memory_bytes: 3628
/// Kazuki Hoshino


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef pair<ll, ll> pll;
typedef vector<ll> vl;
typedef vector<pi> vpi;
#define inf 1000000000000000
#define mod 1000000007
#define rep(i,a,b) for (int i = a; i <= b; i++)
#define rep1(i, a, b) for(int i =a; i >=b; i--)
#define f first
#define ss second
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define mt make_tuple
#define endl '\n'

ll n, a[202020], b[202020], dif=inf, sum , ans=inf;


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

//freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);


cin >> n;

rep(i, 1, n){
cin >> a[i] >> b[i];
if(a[i]>b[i])ans = min(ans, b[i] );
sum+=a[i];
}

if(ans==inf){
    cout << 0 << endl;
}
else {
    cout << sum-ans << endl;
}







return 0;}
///....


Measured memory_bytes: 640
#include <stdio.h>
int main(void){
    int i = 0, cnt = 0;
    char s[3];
    scanf("%s", &s);
    
    for (i; i<4; i++){
        if (s[i] == 'A'){
            cnt++;
        }
    }
    if (cnt != 3 && cnt != 0){
        printf("Yes\n");
    }
    else {
        printf("No\n");
    }
    }




Measured memory_bytes: 128
class Dice:
    def __init__(self):
        self.u=1
        self.w=2
        self.s=3
        self.e=4
        self.n=5
        self.d=6
        self.dic={"W":0,"S":1,"E":2,"N":3}
     
    def __init__(self,u,w,s,e,n,d):
        self.u=u
        self.w=w
        self.s=s
        self.e=e
        self.n=n
        self.d=d
        self.dic={"W":0,"S":1,"E":2,"N":3}
 
    def rot(self,way):
        if isinstance(way,str):
            way=self.dic[way]
 
        if(way==0):
            c=self.u
            self.u=self.e
            self.e=self.d
            self.d=self.w
            self.w=c
        elif way==1:
            c=self.u
            self.u=self.n
            self.n=self.d
            self.d=self.s
            self.s=c
        elif way==2:
            c=self.u
            self.u=self.w
            self.w=self.d
            self.d=self.e
            self.e=c
    def get_nums(self):   
        return {self.u,self.w,self.s,self.e,self.n,self.w,self.d}

def mk_dice():
    u,s,e,w,n,d=map(int,input().split())
    return Dice(u,w,s,e,n,d)
 
import random
q=int(input())
dice_col=[]
ans=True
for j in range(q):
    dice_b=mk_dice()
    for dice in dice_col:
        if(dice.get_nums()==dice_b.get_nums()):
            for i in range (1000):
                dice.rot(random.randint(0,2))
                if(dice.u==dice_b.u and dice.d==dice_b.d and dice.w==dice_b.w and dice.s==dice_b.s and dice.e==dice_b.e and dice.n==dice_b.n):
                    ans=False
    dice_col.append(dice_b)
 
if ans:
    print('Yes')
else:
    print('No')

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

#define ll long long int
#define ld long double
#define vl vector<ll>
#define vi vector<int>
#define vvl vector<vl>
#define vvi vector<vi>
#define pb push_back
#define P pair<ll,ll>
#define mp make_pair
#define F first
#define S second
#define rep(i,n) for(ll i=0; i<n; i++)
#define Sort(v) sort(v.begin(), v.end())
#define all(v) v.begin(),v.end()

ll mo = 1000000007;
ll MO = 998244353;

ll modpower(ll a, ll b, ll mod){
	ll ans = 1;
	if(b == 0){
		return 1;
	}
	if(b%2 == 1){
		ans = a;
	}
	ll x = modpower(a,b/2,mod)%mod;
	ans *= (x*x)%mod;
	ans %= mod;
	return ans;
}

void pri(vl a){
	for(auto i:a)
		cout<<i<<" ";
	cout<<endl;
}

//-------------------------------------------------------------------------------

void solve(){
	ll n; cin>>n;
	if(n%2==0){
		cout<<-1<<endl; return;
	}
	ll ans = 1, val = 7;
	int x;
	while(val%n != 0){
		// cout<<val<<endl;
		val %= n;
		val = (val*10+7);
		ans++;
		if(ans>n){
			cout<<-1<<endl;
			return;
		}
	}
	cout<<ans<<endl;
}

int main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(0);
	int nt = 1;
	// cin>>nt;
	while(nt--){
		solve();
	}
	return 0;
}

Measured memory_bytes: 3652
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Oct 18 17:04:29 2017

@author: goto
"""
y=0
x=input()

x_int=[int(i)for i in list(str(x))]
for i in range(len(x_int)):
    y+=x_int[i]
    

if int(x)%y==0:
    print("Yes")
else:
    print("No")
    




Measured memory_bytes: 3060
// AOJ 1028: ICPC: Ideal Coin Payment and Change
// 2017.10.14

#include <stdio.h>

int n[6];
int c[6] = { 500, 100, 50, 10, 5, 1 };
int k[1001];

int pay(int p)
{
	int i, k, cnt;

	for (cnt = 0, i = 0; i < 6; i++) if (c[i] <= p) {
		k = p/c[i]; if (k > n[i]) k = n[i];
		cnt += k;
		p -= c[i]*k;
	}
	if (p > 0) return -1;
	return cnt;
}

int main()
{
	int p, i, j, q, cnt, ans;

	for (p = 1; p <= 1000; p++) {
		for (cnt = 0, q = p, j = 0; j < 6; j++) if (c[j] <= q) {
			cnt += q/c[j];
			q %= c[j];
		}
		k[p] = cnt;
	}

	while (scanf("%d", &p) && p > 0) {
		for (j = 5; j >= 0; j--) scanf("%d", n+j);
		ans = 0x7fffffff;
		for (i = p; i <= p+1000; i++) {
			if ((j = pay(i)) < 0) continue;
			if ((cnt = j + k[i-p]) < ans) ans = cnt;
		}
		printf("%d\n", ans);
	}
	return 0;
}

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

int main() {
    int n;
    cin >> n;
    int arr[n];
    int i;
    int freq[1000001] = {0};
    for(i=0;i<n;i++)
    {
        cin >> arr[i];
        freq[arr[i]]++;
    }
    int divi[1000001] = {0};
    for(i=1;i<1000001;i++)
    {
        if(freq[i] != 0)
        {
            int j;
            for(j=i;j<1000001;j=j+i)
                divi[j]+=freq[i];
        }
    }
    //cout << freq[3] << " " << freq[6] << '\n';
    int cnt = 0;
    for(i=0;i<n;i++)
    {
        if(divi[arr[i]] == 1)
            cnt++;
    }
    cout << cnt << '\n';
}

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

int main () {
	int N;
	int flag = 0;
	char arale;
	
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> arale;
		if (arale == 'Y') {
			flag++;
		}
	}
	if (flag > 0) {
		cout << "Four" << endl;
	} else {
		cout << "Three" << endl;
	}
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define REP(i,n) for (int64_t i=0; i<(n); ++i)
#define P pair<int,int>
using ll=int64_t;
using namespace std;
#define ketasuu(n) fixed<<setprecision(n)
#define btoe(p) p.begin(),p.end()
#define etob(p) p.rbegin(),p.rend()


const vector<P> dx={{1,0}, {0,1}, {-1,0}, {0,-1}};
const vector<P> ddx={{-2,-2},{-2,-1},{-2,0},{-2,1},{-2,2}, {-1,-2},{-1,-1},{-1,1},{-1,2}, {0,-2},{0,2}, {1,-2},{1,-1},{1,1},{1,2}, {2,-2},{2,-1},{2,0},{2,1},{2,2}};

int main(){
    int h,w; cin>>h>>w;
    P c,d;
    cin>>c.first>>c.second>>d.first>>d.second;
    c.first--; c.second--; d.first--; d.second--;
    vector<string> s(h);
    rep(i,h) cin>>s[i];
    vector<vector<int>> p(h,vector<int>(w,-1));
    deque<P> che, che2;
    che.push_back(c);
    che2.push_back(c);
    p[c.first][c.second]=0;
    int now=0;
    while(!che.empty()){
        now++;
        while(!che.empty()){
            rep(i,4){
                P kari=che[0];
                kari.first+=dx[i].first; kari.second+=dx[i].second;
                if(0<=kari.first && kari.first<h && 0<=kari.second && kari.second<w && s[kari.first][kari.second]=='.'){
                    if(p[kari.first][kari.second]<=p[che[0].first][che[0].second] && p[kari.first][kari.second]!=-1) continue;
                    che.push_back(kari);
                    che2.push_back(kari);
                    p[kari.first][kari.second]=p[che[0].first][che[0].second];
                }
            }
            che2.push_back(che[0]);
            che.pop_front();
        }
        for(auto &v: che2){
            rep(i,20){
                P kari=v;
                kari.first+=ddx[i].first; kari.second+=ddx[i].second;
                if(0<=kari.first && kari.first<h && 0<=kari.second && kari.second<w && s[kari.first][kari.second]=='.'){
                    if(p[kari.first][kari.second]==-1){
                        p[kari.first][kari.second]=now;
                        che.push_back(kari);
                    }
                }
            }
        }
        che2.clear();
    }
    cout<<p[d.first][d.second] <<endl;
    return 0;
}


Measured memory_bytes: 9612
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i < (b); i++)
#define rrep(i, a, b) for (int i = a; i >= b; i--)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <class T>
inline bool chmin(T& a, T b) {
   if (a > b) {
      a = b;
      return true;
   }
   return false;
}
template <class T>
inline bool chmax(T& a, T b) {
   if (a < b) {
      a = b;
      return true;
   }
   return false;
}
const int inf = 1 << 20;
const int mod = 1e9 + 7;

int dp[3005][3005];

int main() {
   string s, t;
   cin >> s >> t;
   rep(i, 0, s.size()) {
      rep(j, 0, t.size()) {
         if (s[i] == t[j]) dp[i + 1][j + 1] = dp[i][j] + 1;
         chmax(dp[i + 1][j + 1], dp[i][j + 1]);
         chmax(dp[i + 1][j + 1], dp[i + 1][j]);
      }
   }
   string ans = "";
   int i = (int)s.size(), j = (int)t.size();
   while (i > 0 && j > 0) {
      if (dp[i][j] == dp[i - 1][j])
         i--;
      else if (dp[i][j] == dp[i][j - 1])
         j--;
      else {
         ans = s[i - 1] + ans;
         i--, j--;
      }
   }
   cout << ans << endl;
   return 0;
}

Measured memory_bytes: 35456
#include<iostream>
#include<cstring>
using namespace std;
char a[200];
bool b[5];
int main()
{
	memset(b,false,sizeof(b));
    for(int i=1;i<=100;i++)
    	cin>>a[i];
    for(int i=1;i<=100;i++)
    {
		if(a[i]=='C') b[1]=true;
		if(a[i]=='F' && b[1]) {
			cout<<"Yes"<<endl;
			return 0;
		}
	}
	cout<<"No"<<endl;
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  std::ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  string s;
  cin>>s;
  int count=0;
  int n=s.length();
    for(int i=0;i<n;i++){
      if(s[i]=='x') count++;
  }
  cout<<(count<8? "YES":"NO")<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#define B 1
#define W 2
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;

short d[] = {0,1,-1};
int n,m,p;
short G[7*7*7+1][8][8];

bool check(int x,int y,int z)
{
  for(int i=0;i<3;i++)
    {
      for(int j=0;j<3;j++)
	{
	  for(int k=0;k<3;k++)
	    {
	      if(i+j+k == 0)
		continue;

	      short dx = d[k],dy = d[j],dz = d[i];
	      short c = G[z][y][x];
	      short cnt = 0;
	      short nx,ny,nz;
	      nx = ny = nz = 0;

	      while((0 <= x+nx && x+nx < n) && (0 <= y+ny && y+ny < n) && (0 <= z+nz && z+nz < n) && G[z+nz][y+ny][x+nx] == c)
		nz-=dz,ny-=dy,nx-=dx;
	      nz+=dz,ny+=dy,nx+=dx;

	      while((0 <= x+nx && x+nx < n) && (0 <= y+ny && y+ny < n) && (0 <= z+nz && z+nz < n) && G[z+nz][y+ny][x+nx] == c)
		cnt++,nz+=dz,ny+=dy,nx+=dx;
		
	      if(cnt >= m)
		return true;
	    }
	}
    }
  return false;
}

int main()
{
  while(cin >> n >> m >> p,n|m|p)
    {
      rep(i,p+1)
	rep(j,n+1)
	  rep(k,n+1)
            G[i][j][k] = 0;
      int found = -1;
      rep(i,p)
	{
	  int x,y,z = 0;
	  cin >> x >> y;
	  x--,y--;
	  while(G[z][y][x]!=0)
	    z++;
	  G[z][y][x] = i%2?W:B;
	  if(found == -1 && m/2 <= i)
	    if(check(x,y,z))
	      found = i;    
	}
      if(found == -1)
	cout << "Draw" << endl;
      else 
	found%2?cout << "White " << found+1 << endl:cout << "Black " << found+1 << endl; 


    }
  return 0;
}

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

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

            return 0;
        }

        private void Process()
        {
            for (int i = 1; i <= 9; i++)
                for (int j = 1; j <= 9; j++)
                    Console.WriteLine("{0}x{1}={2}", i, j, i * j);
        }
    }
}

Measured memory_bytes: 5596
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long int
// #define ll long long int
#define ld long double
#define ff first
#define ss second
#define mp make_pair
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define pb push_back
#define eb emplace_back
#define pii pair<int, int>
#define endl '\n'
#define all(x) x.begin(),x.end()
#define f(i,j,l) for(i=j;i<l;i++)
#define smax(a,b) a=max(a,b)
// #if !defined(ONLINE_JUDGE)
// #include "debugging.h"
// #endif
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
// find_by_order(k)  returns iterator to kth element starting from 0;
// order_of_key(k) returns count of elements strictly smaller than k;
// erase,insert same as normal set

// int const mod = 7340033;
// int const mod = 998244353;
long long const mod = 1e9+7;
int power(int a,int b,int m){
    int res = 1;
    while(b){
        if(b&1){
            // res = res*a;
            res = (res*a)%m;
        }
        a=(a*a)%m;
        // a%=m;
        b=b/2;
    }
    return res;
}

int inverse(int x , int m){
    return power(x,m-2,m);
}

int const N = 5e5+5;
int const inf = 2e9;

void solve(){  
    int i,j;   
    int n;
    cin >> n;
    int a[n];
    for(i=0;i<n;i++){
        cin >> a[i];
    }

    int ans = 1000;

    for(i=1;i<n;i++){
        if(a[i] > a[i-1]){
            int x = ans/a[i-1];
            ans = ans + (a[i]-a[i-1])*x;
        }
    }
    cout<<ans<<endl;
}        



int32_t main(){
    IOS;
    int t;
    t = 1;
    // precompute();
    // cin>>t;  
    for(int tt=1;tt<=t;tt++){
        solve();
    }
    return 0;
}


/*


*/

Measured memory_bytes: 3652
import bisect, sys
from itertools import accumulate
input = sys.stdin.readline
n = int(input())
a = sorted(map(int,input().split()))
b = sorted(map(int,input().split()))
c = sorted(map(int,input().split()))

ans = 0
b_sect = [0]
for i in range(n)[::-1]:
    b_sect.append(n-bisect.bisect_right(c,b[i]))
acc = list(accumulate(b_sect))[::-1]

for i in a:
    t = bisect.bisect_right(b,i)
    ans += acc[t]
print(ans)

Measured memory_bytes: 25488
//=======================//
// coder: Andy - Tohrumi //
//=======================//

#include <bits/stdc++.h>

using namespace std;

#define fastio ios_base::sync_with_stdio(); cin.tie(0); cout.tie(0);
#define rep(i, a, b) for(__typeof(b) i = a; i < b; i++)
#define Rep(i, a, b) for(__typeof(a) i = a; i > b; i--)
#define mp make_pair
#define ll long long

typedef pair<ll, ll> ii;

priority_queue<ii> pq;

signed main() {
	fastio;
	int n; cin >> n;
	int a[n];
	ll ans[n], counter[n];
	rep(i, 0, n) {
		ans[i] = 0;
		cin >> a[i];
		counter[i] = 1;
		pq.push(mp(a[i], i));
	}
	while(pq.size() > 1) {
		ii t1, t2;
		t1 = pq.top(); pq.pop();
		t2 = pq.top(); pq.pop();
		ans[t1.second] += (ll)counter[t1.second] * (t1.first - t2.first);
		pq.push(mp(t2.first, min(t1.second, t2.second)));
		counter[min(t1.second, t2.second)] += counter[max(t1.second, t2.second)];
	}
	ans[0] += n * pq.top().first;
	rep(i, 0, n) {
		cout << ans[i] << "\n";
	}
	return 0;
}


Measured memory_bytes: 6832
#include "bits/stdc++.h"
 
typedef long long ll;
#define int ll
#define fi first
#define se second
#define SORT(a) sort(a.begin(),a.end())
#define rep(i,n) for(int i = 0;i < (n) ; i++) 
#define REP(i,n) for(int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define INF LLONG_MAX/2
 
using namespace std;
int MOD = 1000000007;

signed main(){
    
    int n;
    cin >> n;
    map<int,int> m;
    m[0];
    m[1];
    set<pair<int,int>> s;
    rep(i,n){
        int a;
        cin >> a;
        s.insert(MP(a,0));
    }
    rep(i,n){
        int a;
        cin >> a;
        s.insert(MP(a,1));
    }
    int ans = 1;
    for(auto x:s){
        int p = x.se;
        int q = (x.se+1)%2;
        if(m[q] == 0)m[p]++;
        else{
            ans *= m[q];
            ans %= MOD;
            m[q]--;
        }
    }
    cout << ans << endl;

    return 0;   
}
// g++ -std=c++14 code1.cpp
// rm -r -f test;oj dl https://ddcc2019-final.contest.atcoder.jp/tasks/ddcc2019_final_a
// rm -r -f test;oj dl http://cf16-exhibition-final-open.contest.atcoder.jp/tasks/cf16_exhibition_final_a

Measured memory_bytes: 12800
#include <algorithm>
#include <climits>
#include <iostream>
#include <string>
#include <utility>
#include<vector>
#include<iomanip>
#include<map>
#include <queue>
#include<cmath>
#include<cstdio>
#include<iomanip>
#include<set>
#include <bits/stdc++.h>
 
using namespace std;
using ll = long long int;
 
#define REP(i,n) for(ll i=0;i<(ll)(n);i++) //REP(i, 5) cout<<i;
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define MOD 10000007 //10^9+7
 
int main(void){
  
  string s;;
  cin>>s;
 
  REP(i,3){
    if(s[i] == '7'){
      cout<<"Yes"<<endl;
      return 0;
    }
  }
  cout<<"No" <<endl; 
  return 0;
}


Measured memory_bytes: 3624
#include<iostream>
#include<iomanip>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<unordered_map>
#include<stack>
#include<queue>
#include<math.h>
#include<functional>
#include<bitset>
using namespace std;
using ll = long long;
using ld = long double;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
#define MOD 998244353LL
#define INF 1000000000LL
#define EPS 1e-10
#define FOR(i,n,m) for(ll i=n;i<(int)m;i++)
#define REP(i,n) FOR(i,0,n)
#define DUMP(a) REP(d,a.size()){cout<<a[d];if(d!=a.size()-1)cout<<" ";else cout<<endl;}
#define ALL(v) v.begin(),v.end()
#define UNIQUE(v)  sort(ALL(v));v.erase(unique(ALL(v)),v.end());
#define pb push_back

vector<vector<ll>> g;

void dfs(int u, vector<int> &trail) {
	while (!g[u].empty()) {
		int v = g[u].back();
		g[u].pop_back();
		for (int i = 0; i < g[v].size(); i ++) {
			if (g[v][i] == u) {
				g[v].erase(g[v].begin() + i);
				break;
			}
		}
		dfs(v, trail);
	}
	trail.push_back(u);
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n, m;
	cin >> n >> m;
	g.resize(n);
	vector<ll> c(n, 0);
	REP(i, m) {
		ll a, b;
		cin >> a >> b;
		a--;
		b--;
		c[a]++;
		c[b]++;
		g[a].pb(b);
		g[b].pb(a);
	}
	ll c4 = 0,c6 = 0;
	REP(i, n) {
		if(c[i] % 2) {
			cout << "No" << endl;
			return 0;
		}
		if(c[i] == 4) c4++;
		if(c[i] >= 6) c6++;
	}
	if(c6) {
		cout << "Yes" << endl;
		return 0;
	}
	if(c4 <= 1) {
		cout << "No" << endl;
		return 0;
	}

	vector<int> trail;
	dfs(0, trail);
	vector<vector<ll>> v(n);
	REP(i, trail.size() - 1) {
		v[trail[i]].pb(i);
	}
	ll s = -INF, t = INF;
	REP(i, n) {
		if((ll)v[i].size() == 2) {
			s = max(s, v[i][0]);
			t = min(t, v[i][1]);
		}
	}
	if(s >= t) {
		cout << "Yes" << endl;
		return 0;
	}
	vector<pll> seg;
	REP(i, n) {
		if((ll)v[i].size() == 2) {
			seg.pb({v[i][0], v[i][1]});
		}
	}
	sort(ALL(seg));
	ll mx = -1;
	bool ok = false;
	REP(i, seg.size()) {
		if(mx >= seg[i].second) {
			ok = true;
		}
 		mx = max(mx, seg[i].second);
	}
	if(ok) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

/* --------------------------------------- */


Measured memory_bytes: 17016
#include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;
typedef long long ll;
ll inf = 1e5;
ll w[105], v[105];
ll dp[105][100005];
ll a[200005];
int main(){
	ll n;
	cin >> n;
	ll count = 0;
	
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	for (int i = 1; i <= n; i++) {
		for (int j = i-1; j < i; j++) {
			if (i-count != a[j]) {
				count++;
			}
		}
	}
	if (count == n) {
		cout << "-1" << endl;
		return 0;
	}
	cout << count << endl;
	
	return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double db;
#define endl '\n'
#define fi first
#define se second
#define pi pair<ll,ll>
#define pii pair<ll,pi>
#define pb push_back
#define mk make_pair
int main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	long double n, d;
	cin >> n >> d;
	int cnt = 0;
	for (int i = 0; i < n; i++) {
		int x1, y1;
		cin >> x1 >> y1;
		//x1 = abs(x1), y1 = abs(y1);
		long double  ans = (hypot(x1 , y1));
		//cout << ans << endl;
		if (ans <= d)
			cnt++;
	}
	cout << cnt << endl;
}


Measured memory_bytes: 3864
#include<string>
#include<iostream>
#include<algorithm>
#include<set>
#include<math.h>
#include<vector>
#include<sstream>
#include<queue>
#include<functional>
#include<bitset>
#include<cstdio>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include <string.h>
using namespace std;
int a[105];
int main() {
	long long a, b, c, x, y;
	cin >> a >> b >> c >> x >> y;
	long long res;
	if (x > y) {
		res = min((a*x + b*y), (a*(x - y) + 2 * y*c));
		res = min((2 * x*c), res);
	}
	else {
		res = min((a*x + b*y), (b*( y-x) + 2 * x*c));
		res = min((2 * y*c), res);
	}
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 256
"use strict";

// read lines from stdin
const input = require("fs")
  .readFileSync("/dev/stdin", "utf8")
  .split("\n");

const firstLine = input[0].split(" ");
const N = parseInt(firstLine[0], 10);
const M = parseInt(firstLine[1], 10);

const survay = [];

for (let i = 1; i <= N; i++) {
  const line = input[i].split(" ");
  const K = parseInt(line[0], 10);

  for (let j = 1; j <= K; j++) {
    const voted = parseInt(line[j], 10);
    survay[voted] = survay[voted] ? survay[voted]+1 : 1;
  }
}

let ans = 0;

for (let i = 1; i <= M; i++) {
  if (survay[i] === N) { ans++; }
}

console.log(ans);


Measured memory_bytes: 21064
#define D(x) cout << #x " = " << x << endl
#define DD(x, y) cout << "(" #x ", " #y ") = (" << x << ", " << y << ")" << endl
#define DDD(x, y, z) cout << "(" #x ", " #y ", " #z ") = (" << x << ", " << y << ", " << z << ")" << endl
#define DV(v) for (auto __macro_vi : v){ cout << __macro_vi << " ";} cout << endl;
#define DA(a, n) for (int __macro_i = 0; __macro_i < n; ++__macro_i) { cout << a[__macro_i] << " "; } cout << endl;
#define REP(i, n) for (int i = 0; i < n; ++i)
#define ALL(v) (v).begin(), (v).end()
#include<iostream>
#include<vector>
#include<cassert>
#include<cmath>
#include<iomanip>
template<class T, class U> std::ostream& operator<<(std::ostream& os, const std::pair<T, U>& p){ os << "(" << p.first << ", " <<  p.second << ")"; return os; }

using namespace std;


int a, b, x;


double vol(double deg) {
    if (deg < 0) return a * a * b;
    if (deg >= 90) return 0;
    double rad = deg  * M_PI / 180;
    double h = tan(rad) * a;
    if (h <= b) {
        return a * a * b - h * a * a / 2;
    }
    return a * b * b * tan(M_PI / 2 - rad) / 2;
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> a >> b >> x;
    double mn = 0;
    double mx = 90;
    while (abs(mx - mn) > 0.0000001) {
        double mid = (mx + mn) / 2;
        double v = vol(mid);
        if (v > x) mn = mid;
        else mx = mid;
    }
    cout << fixed << setprecision(10) << mx << endl;
}


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

using namespace std;

#define sp(x) cout<<setprecision(x);
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define all(a) (a).begin(), (a).end()
#define inf 10000000
#define linf INT64_MAX*0.99
#define print(s) cout<<(s)<<endl
#define lint long long
#define yes "Yes"
#define no "No"

typedef pair<int, int> P;
 
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n; cin>>n;
    vector<double> a(n);
    double ans=0; 
    REP(i,n){
        cin>>a[i];
        ans+= (1/a[i]);
    }
    ans= 1/ans;
    cout<<fixed;
    cout<<setprecision(5)<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ADD(a, b) a = (a + ll(b)) % mod
#define MUL(a, b) a = (a * ll(b)) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define all(a) (a).begin(), (a).end()
#define sz(v) (int)(v).size()
#define pb push_back
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<int, pi> ppi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> mat;
typedef complex<double> comp;
void Debug() {cerr << '\n'; }
template<class FIRST, class... REST>void Debug(FIRST arg, REST... rest){
	cerr<<arg<<" ";Debug(rest...);}
template<class T>ostream& operator<<(ostream& out,const vector<T>& v) {
	out<<"[";if(!v.empty()){rep(i,0,sz(v)-1)out<<v[i]<<", ";out<<v.back();}out<<"]";return out;}
template<class S, class T>ostream& operator<<(ostream& out,const pair<S, T>& v){
	out<<"("<<v.first<<", "<<v.second<<")";return out;}
const int MAX_N = 500010;
const int MAX_V = 100010;
const double eps = 1e-6;
const ll mod = 1000000007;
const int inf = (1 << 30) - 1;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;
mt19937 rng; //use it by rng() % mod, shuffle(all(vec), rng)
///////////////////////////////////////////////////////////////////////////////////////////////////

ll A, B, C;

void solve() {
	cin >> A >> B >> C;
	rep(i, 0, 200) {
		if(A % 2 || B % 2 || C % 2) {
			cout << i << "\n";
			return;
		}
		ll a = A, b = B, c = C;
		A = (b + c) / 2;
		B = (a + c) / 2;
		C = (b + a) / 2;
	}
	cout << -1 << "\n";
}

uint32_t rd() {
	uint32_t res;
#ifdef __MINGW32__
	asm volatile("rdrand %0" :"=a"(res) ::"cc");
#else
	res = std::random_device()();
#endif
	return res;
}

int main() {
#ifndef LOCAL
	ios::sync_with_stdio(false);
    cin.tie(0);
#endif
    cout << fixed;
	cout.precision(20);
    cerr << fixed;
	cerr.precision(6);
	rng.seed(rd());
#ifdef LOCAL
	//freopen("in.txt", "wt", stdout); //for tester
	if(!freopen("in.txt", "rt", stdin)) return 1;
#endif	
	solve();
    cerr << "Time: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
	return 0;
}



Measured memory_bytes: 256
#include<stdio.h>
#define F j==n-1?"\n":" "
int main()
{
	int n,t[51],i,j;
	for(;scanf("%d",&n),n;)
	{
		for(i=0;i<n;i++)
			scanf("%d",&t[i]);
		for(i=0;i<n;)
		{
			for(j=i;j+1<n&&t[j+1]-t[j]==1;)
				j++;
			if(i==j)
				printf("%d%s",t[i],F),i++;
			else
				printf("%d-%d%s",t[i],t[j],F),i=j+1;
		}
	}
	return 0;
}

Measured memory_bytes: 600
#pragma GCC optimize(2)
#pragma GCC optimize(3)   
#include<bits/stdc++.h>
#include<cstdlib>
//#include <ext/pb_ds/assoc_container.hpp> 
//#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
//using namespace __gnu_pbds; 
//#define ordered_set tree<pair<int,int>, null_type,less<pair<int,int>>, rb_tree_tag,tree_order_statistics_node_update>
typedef long long ll;
typedef vector < ll > vl;
typedef vector < vl > vvl;
typedef pair < ll, ll > pll;
typedef long double ld;
typedef vector < pair < ll, ll > > vpll;
#define Boost() ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb push_back
#define forn(i,n) for (ll i = 0; i < n; i++)
#define fo(i,n) for (ll i = 1; i <= n; i++)
#define fore(i,l,r) for (ll i = l; i <= r; i++)
#define rev(i,n) for(ll i=n-1;i>=0;i--)
#define all(c) c.begin(), c.end()
#define go(c,it) for(auto it=(c).begin(); it!=(c).end(); it++)
//#define back(c,it) for(auto it=(c).rbegin(); it!=(c).rend(); it++)
#define fi first
#define se second
#define MOD 998244353
#define MAX 1000000007
#define N 2000009
#define N1 100007
ll power(ll a,ll b){ll res=1;a=a%MOD;while(b>0){if(b&1){res=(res*a)%MOD;}a=(a*a)%MOD;b>>=1;}return res;}
ll fact[500009];
ll fermat_inv(ll y){return power(y,MOD-2);}
ll nCrMod(ll n, ll r){ ll p=fact[n];ll q=(fact[r]*fact[n-r])%MOD;return (p*fermat_inv(q))%MOD;} 
ll gcd(ll a, ll b){return (b==0)?a:gcd(b,a%b);}
const ld PI = acos(-1.0);
vl g[N1];


  int main(){
      #ifndef ONLINE_JUDGE
      freopen("input.cpp","r",stdin);
      freopen("output.cpp","w",stdout);
      #endif
      Boost();
      int t;
      //cin>>t;
      t=1;
      int t1=t;
      while(t--)
      {
        ll n,m,k1;
        cin>>n>>m>>k1;
        char a[n+1][m+1];
        fo(i,n)
        {
          fo(j,m)
          cin>>a[i][j];
        }
        ll ans=0;
        ll i,j,k,l,p,r;
        ll z=power(2,n);
        ll y=power(2,m);
        for(i=0;i<z;i++)
        {
          map<ll,ll> m2;
          for(j=0;j<n;j++)
          {
            if(i&(1<<j))
            {
              m2[j+1]=1;
            }
          }
          for(k=0;k<y;k++)
          {
            map<ll,ll> m1;
            for(l=0;l<m;l++)
            {
              if(k&(1<<l))
                m1[l+1]=1;
            }
            ll c=0;
            char ch[n+1][m+1];
            for(p=1;p<=n;p++)
            {
              for(r=1;r<=m;r++)
              {
                if(m2[p]==1||m1[r]==1)
                  ch[p][r]='@';
                else
                  ch[p][r]=a[p][r];
              }
            }
            fo(p,n)
            {
              fo(r,m)
              {
                //cout<<ch[p][r];
                if(ch[p][r]=='#')
                  c++;
              }
              //cout<<endl;
            }
            if(c==k1)
              ans++;
            //cout<<endl<<endl;
            
          }
          
        }
        cout<<ans<<endl;
      }
      
      return 0;
  }

Measured memory_bytes: 6016
#include <iostream>
#include <bitset>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <map>
using namespace std;
using ll = long long int;
#define REP(i,n) for(int i=0;i<n;i++)

int main()
{
    string s; cin >> s;
    string t; cin >> t;

    sort(s.begin(), s.end());
    sort(t.begin(), t.end(), greater<char>());
    bool is_smaller = false;
    bool is_equal = true;
    for (int index = 0; index < min(s.size(),t.size()); index++)
    {
        if (s[index] < t[index])
        {
            is_smaller = true;
        }
        if (s[index] != t[index])
        {
            is_equal = false;
        }
    }
    if (is_equal == true && s.size() == min(s.size(),t.size() )&& s.size() != t.size())
    {
        is_smaller = true;
    }

    if (is_smaller)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 632
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1e9
#define PI 3.14159265359
#define MOD 1000000007
#define ALL(v) v.begin(),v.end()
#define ALLR(v) v.rbegin(),v.rend()
typedef long long ll;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//isPrime
//modpow modinv
//getDigit
int main() {
  cout << fixed << setprecision(10);
  vector<int> a(3);
  rep(i,3) cin >> a.at(i);
  sort(ALL(a));
  if(a.at(0)==5&&a.at(1)==5&&a.at(2)==7){
    cout << "YES" << endl;
  }else{
    cout << "NO" << endl;
  }
}


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

int main()
{
  int n;
  cin>>n;
  
  int a[n],dp[n];
  
  int i;
  for(i=0;i<n;i++)
    cin>>a[i];
  
  dp[0]=0;
  dp[1]=abs(a[1]-a[0]);
  
  for(i=2;i<n;i++)
  {
    dp[i] = min(abs(a[i]-a[i-1])+dp[i-1],abs(a[i]-a[i-2])+dp[i-2]);
  }
  cout<<dp[n-1];
}

Measured memory_bytes: 1024
#include <iostream>
#include <stdlib.h>
#include <vector> //vector
#include <algorithm> //sort()
#include <numeric>

#define rep(i, n) for(int i=0; i<(int)(n);i++)
#define all(x) (x).begin(), (x).end()
#define debug(a) cout << "debug (" #a "):" << endl << (a) << endl;

typedef uint64_t ulint;
typedef int64_t lint;

using namespace std;

template<class T> inline bool chmin(T& a, T b);
template<class T> inline bool chmax(T& a, T b);
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v);

template<class T> lint sum(vector<T> a);
template<class T> double ave(vector<T> a);

//uint64_t a, b, c, d;
//uint64_t i, j;
lint n, m, x, a;
lint h, w;

int main(){
//////////////////////////////////////////////////////

    cin >> x >> a;






    cout << ((x<a)?0:10) << endl;

    

   

    // sort(input.begin() , input.end());

    // uint64_t max = numeric_limits<uint64_t>::max();


    //////////////////////////////////////////////////////
    // DP

//     // 無限大の値
//     const uint64_t INF = (uint64_t)1 << 60;
//     //const int64_t NINF = -1 * ((int64_t)1 << 60 );
 
//     // DP テーブル
//     uint64_t dp[100010];

//     //DPテーブル初期化（最小化用）
//     for (int i = 0; i < 100010; ++i)
//     {
//         //dp[i] = INF;
//         dp[i] = 0;
//     } 

//     // 初期条件
//     dp[0] = 0;

//     // ループ
//     for (int i = 1; i <= n; ++i) {
//         //chmin( dp[i], dp[i - 1] + abs( input[i] - input[i - 1] ));
//         //if (i < 2)continue;
//         //chmin( dp[i], dp[i - 2] + abs( input[i] - input[i - 2] ));



//         // chmax ( dp [i] , dp[i - 1]);
//         // chmax ( dp [i] , dp[i - 1] + input[i]);
//         // cout << "dp[" << i <<"] = " << dp[i] << endl;

//     }



// //////////////////////////////////////////////////////

//     cout << dp[n] << endl;

//////////////////////////////////////////////////////
// Ctrl + Opt + N to make
    return 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;
}


// vectorprint用
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
	int len = v.size();
	for (int i = 0; i < len; ++i) {
		s << v[i]; if (i < len - 1) s << "\t";
	}
	return s;
}

// //合計
// template<class T> lint sum(vector<T> a)
// {
//     return std::accumulate(a.begin(), a.end(), 0);
// }


// //平均
// template<class T> double ave(vector<T> a)
// {
//     return std::accumulate(a.begin(), a.end(), 0.0) / a.size();
// }


Measured memory_bytes: 256
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
INF = 10**10
MOD = 10**9 + 7
X = int(input())
for i in range(1000):
    for j in range(-1000,1000):
        #print (i**5 - j**5)
        if i**5 - j**5 == X:
            print (i,j)
            exit()
   

Measured memory_bytes: 9172
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <iomanip>
#include <bitset>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <list>
#include <map>

using namespace std;

int main() {
  int n, m, x, y;
  cin >> n >> m >> x >> y;
  fixed(cout); cout.precision(12);
  cout << (1ll * n * m) / 2.0 << " ";
  if (n % 2 == 0 && m % 2 == 0 && x == n / 2 && y == m / 2) {
    cout << 1 << endl;
  } else {
    cout << 0 << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<math.h>
#include<queue>
#include<deque>
#include<stack>
#include<cstdio>
#include<utility>
#include<set>
#include<list>
#include<cmath>
#include<stdio.h>
#include<string.h>
#include<iomanip>
#include<cstdio>
#include<cstdlib>
#include<cstring>
using namespace std;
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define REP(i, n) FOR(i, 0, n - 1)
#define NREP(i, n) FOR(i, 1, n)
using ll = long long;
using pii = pair<int, int>;
using piii = pair<pii, pii>;
const ll dx[4] = { 0, -1, 1, 0 };
const ll dy[4] = { -1, 0, 0, 1 };
const int INF = 1e9 + 7;
int gcd(int x, int y) {
	if (x < y)swap(x, y);
	if (y == 0)return x;
	return gcd(y, x%y);
}
void mul(ll a, ll b) {
	a = a * b % INF;
}
using Graph = vector<vector<int>>;
ll mypow(ll x, ll n, ll m) {
	if (n == 0) {
		return 1;
	}
	if (n % 2 == 0) {
		return mypow(x*x%m, n / 2, m);
	}
	else {
		return x * mypow(x, n - 1, m) % m;
	}
}
long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
///////////////////////////////////////


int main() {
	ll n, a, b; cin >> n >> a >> b;
	if (n == 2)cout << '0' << endl;
	else {
		ll key = mypow(2, n, INF) - (ll)1;
		key += INF;
		key%=INF;
		ll x = 1;
		ll y = 1;
		for (ll i = 1; i <= a; ++i) {
			x *= (n + 1 - i);
			x %= INF;
			x *= modinv(i, INF);
			x %= INF;
		}
		for (int i = 1; i <= b; ++i) {
			y *= (n + 1 - i);
			y %= INF;
			y *= modinv(i, INF);
			y %= INF;
		}
		cout << (key-x-y+2*INF)%INF << endl;
	}
	return 0;
}


Measured memory_bytes: 256
n = int(input())
h = list(map(int, input().split()))

a = True
for i in range(n-1):
    if h[i] <= h[i+1]:
        pass
    elif h[i] == h[i+1] + 1:
        h[i+1] = h[i+1]+1
    else:
        a = False
        print('No')
        break

if a == True:
    print('Yes')

Measured memory_bytes: 14396
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>

using namespace std;

int main(){
    long long int n,a,b,c,d,e;
    cin >> n >> a >> b >> c >> d >> e;
    cout << max({(n-1)/a,(n-1)/b,(n-1)/c,(n-1)/d,(n-1)/e})+5 << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<n; i++)
#define rep1(i, n) for(int i=1; i<=n; i++)
#define repr(i, n) for(int i=n-1; i>=0; i--)
#define repr1(i, n) for(int i=n; i>=1; i--)
#define all(v) v.begin(),v.end()
using ll = long long;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = 1e9+7;
const double EPS = 1e-10;
const double PI = acos(-1);
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; }

int main() {
    int n, k; cin >> n >> k;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];

    vector<ll> v;
    for (int i = 0; i < n; i++) {
        ll sum = 0;
        for (int j = i; j < n; j++) {
            sum += a[j];
            v.push_back(sum);
        }
    }

    ll res = 0;
    for (int i = 40; i >= 0; i--) {
        int cnt = 0;
        vector<ll> next;
        for (auto &x: v) {
            if (x & (1ll << i)) {
                next.push_back(x);
                cnt++;
            }
        }

        if (cnt >= k) {
            v = next;
            res |= 1ll << i;
        }
    }
    cout << res << endl;
}


Measured memory_bytes: 6516
#include<iostream>
#define MIN -1000000000000000000
using namespace std;

int input[100010];

int main() {
	while(1){
		int N,K;
		long long int sum=0,nummax=MIN;
		cin >> N >> K;
		if(N==0 && K==0)break;
		
		for(int i=0;i<100010;i++)input[i]=0;
		
		for(int i=0;i<N;i++){
			cin >> input[i];
			sum+=input[i];
			if(i+1>=K){
				sum-=input[i-K];
				if(nummax<sum)nummax=sum;
			}
		}
		cout << nummax <<endl;
	}
	return 0;
}

Measured memory_bytes: 1544