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

int main(void){
    int n, count = 0, r = 0, flag = 0;
    cin >> n;
    for (int i = 0 ; i< 6; i++){
        if ( int(n / pow(10, i)) == 0){
            //cout << pow(10, i) << " " <<i << endl;
            r = i-1;
            break;
        }
        else if (n / pow(10, i) == 1){
            r = i; flag = 1;
            break;
        }
    }

    //cout << r << endl;
    for (int i = 0; i < r + 1; i += 2){
        if (i != r){
            count += (pow(10, i+1) - pow(10, i));
            //cout << count << endl;
        }
        else{
            count += (n - pow(10, i) + 1);
            //cout << count << endl;
        }

    }
    cout << count << endl;

}


Measured memory_bytes: 256
#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
inline void rd(int &x){
  int k;
  int m=0;
  x=0;
  for(;;){
    k = getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
inline void wt_L(char a){
  putchar_unlocked(a);
}
inline void wt_L(int x){
  int s=0;
  int m=0;
  char f[10];
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    putchar_unlocked('-');
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
int N;
int D[50];
int main(){
  int i;
  int res = 0;
  rd(N);
  {
    int Lj4PdHRW;
    for(Lj4PdHRW=(0);Lj4PdHRW<(N);Lj4PdHRW++){
      rd(D[Lj4PdHRW]);
    }
  }
  for(i=(0);i<(N);i++){
    int j;
    for(j=(i+1);j<(N);j++){
      res += D[i] * D[j];
    }
  }
  wt_L(res);
  wt_L('\n');
  return 0;
}
// cLay varsion 20191012-1

// --- original code ---
// int N, D[50];
// {
//   int res = 0;
//   rd(N,D(N));
//   rep(i,N) rep(j,i+1,N) res += D[i] * D[j];
//   wt(res);
// }

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

namespace A
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var WList = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();

            var total = WList.Sum();
            var half = total / 2;
            var count = 0;
            var prev = 0;
            foreach (var W in WList)
            {
                prev = count;
                count += W;

                if (half - count <= 0)
                {
                    if (total - 2 * prev > Math.Abs(total - 2 * count))
                    {
                        Console.WriteLine($"{Math.Abs(total - 2 * count)}");
                    }
                    else
                    {
                        Console.WriteLine($"{total - 2 * prev}");
                    }
                    return;
                }
            }
        }

        static int NumberOfDigits(long x)
        {
            if (x < 10) return 1;

            var result = 0;
            while (x > 0)
            {
                result++;
                x /= 10;
            }

            return result;
        }

        static int SumOfDigits(int x)
        {
            var sum = 0;
            while (x > 0)
            {
                sum += x % 10;
                x /= 10;
            }

            return sum;
        }
    }
}


Measured memory_bytes: 13396
#include <stdio.h>

int getDigit(int d) {
  int digit = 0;
  while (d != 0) {
    d = d / 10;
    ++digit;
  }

  return digit;
}

int main(int argc, char* argv[]) {
  int n;
  scanf("%d", &n);

  int i, cnt = 0;
  for (i = 1; i <= n; i++) {
    if (getDigit(i)%2 != 0) cnt++;
  }

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

  return 0;
}


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

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

#define pb push_back
#define rep(i, n) for(int i = 0; i < (n); i++)
#define dep(i, a, n) for(int i = a; i >= (n); i--)
#define FOR(i, a, n) for(int i = a; i < (n); i++)
#define mod (ll)(1e9+7)
#define int ll
#define INF 100000000

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

signed main() {
	ll d, g, result = INF;
  cin >> d >> g;
  vector<int> p(d), c(d);
  rep(i, d) cin >> p[i] >> c[i];
  rep(bit, 1 << d) {
    ll ch = 0, cnt = 0;
    rep(i, d) {
      if(bit & (1 << i)) {
        ch += p[i] * 100 * (i + 1) + c[i];
        cnt += p[i];
      }
    }
    if(ch >= g) {
      result = min(result, cnt);
      continue;
    }
    for(int i = d - 1; i >= 0; i--) {
      if(bit & (1 << i)) continue;
      rep(j, p[i]) {
        if(ch >= g) break;
        ch += 100 * (i + 1);
        cnt++;
      }
    }
    result = min(result, cnt);
  }
  cout << result << endl;
	return 0;
}

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

int main() {
    string s; cin >> s;
    const int n = s.size();
    int ans1 = 0, ans2 = 0;
    for(int i = 0; i < n; ++i) {
        const int c = s[i] - '0';
        ans1 += c != ((i + 1) & 1);
        ans2 += c != (i & 1);
    }
    cout << min(ans1, ans2) << endl;
}

Measured memory_bytes: 512
#include <iostream>
#include <vector>

using namespace std;

int main() {
    int N;
    cin >> N;
    vector<int> cnt(3, 0);
    for(int n=0; n<N; n++) {
        int a;
        cin >> a;
        if(a%4==3) {
            cnt[1]++;
        } else {
            cnt[a%4]++;
        }
    }

    if(cnt[0]>=cnt[1]) {
        cout << "Yes" << endl;
    } else {
        if(cnt[0]+1==cnt[1] && cnt[2]==0) {
            cout << "Yes" << endl;
        } else {
            cout << "No" << endl;
        }
    }


    return 0;
    
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
#define pragi(a,b) for(ll i = a;i<b;i++)
#define pragj(a,b) for(ll j = a;j<b;j++)
#define pragk(a,b) for(ll k = a;k>=b;k--)
#define all(v) (v.begin(),v.end())
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define MP make_pair
#define MT make_tuple
#define F first
#define S second
#define KAKA ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
const int mod = 1e9 + 7;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<bool> vb;
typedef long double ld;
typedef pair<int, int> pii;
//typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef pair<ll, ll> pll;

int main()
{
    KAKA
    ll x;
    cin>>x;
    if(x >= 30) cout<<"Yes"<<"\n";
    else cout<<"No"<<"\n";
}

Measured memory_bytes: 3644
#include "bits/stdc++.h"
#include<random>
using namespace std;
typedef long long int lint;
typedef pair<lint, lint> plint;
typedef pair<double long, double long> pld;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for(lint i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(lint i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
template<typename T1, typename T2> pair<T1, T2> operator+(const pair<T1, T2>& l, const pair<T1, T2>& r) { return make_pair(l.first + r.first, l.second + r.second); }
template<typename T1, typename T2> pair<T1, T2> operator-(const pair<T1, T2>& l, const pair<T1, T2>& r) { return make_pair(l.first - r.first, l.second - r.second); }
const lint MOD = 1e9 + 7, INF = 1e18;

lint dp[100001];
lint N, K, arr[100];

lint mex(lint curr) {
	set<lint> st;
	REP(i, N) {
		if (curr - arr[i] < 0) continue;
		if (dp[curr - arr[i]] == INF) continue;
		st.insert(dp[curr - arr[i]]);
	}
	REP(i, N + 1) {
		if (st.find(i) == st.end()) {
			return i;
		}
	}
}

int main() {
	cin >> N >> K;
	REP(i, N) {
		cin >> arr[i];
	}
	REP(i, K + 1) dp[i] = INF;
	REP(i, K + 1) {
		if (i < arr[0]) dp[i] = 0;
		else dp[i] = mex(i);
	}
	if (dp[K] == 0) cout << "Second" << endl;
	else cout << "First" << endl;
}


Measured memory_bytes: 4384
#[allow(unused_imports)]
use itertools::Itertools;
#[allow(unused_imports)]
use num::*;
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;
#[allow(unused_imports)]
use std::collections::*;

fn solve() {
    input! {
        n: usize,
        av: [usize; n]
    };

    let v = av[1..n].into_iter().fold(0, |acc, &x| acc ^ x);
    let mut res = vec![0; n];
    res[0] = v;
    let all = v ^ av[0];
    for i in 1..n {
        res[i] = av[i] ^ all;
    }
    println!("{}", res.into_iter().join(" "));
}

fn main() {
    std::thread::Builder::new()
        .name("big stack size".into())
        .stack_size(256 * 1024 * 1024)
        .spawn(|| {
            solve();
        })
        .unwrap()
        .join()
        .unwrap();
}


Measured memory_bytes: 10152
import sys
input = sys.stdin.readline().rstrip
#input = sys.stdin.buffer.readline


#sys.setrecursionlimit(10**9)
#from functools import lru_cache

def RD(): return sys.stdin.read()
def II(): return int(input())
def MI(): return map(int,input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int,input().split()))
def LF(): return list(map(float,input().split()))
def TI(): return tuple(map(int,input().split()))
# rstrip().decode()

#import numpy as np


def main():
	s=input()
	#print(s)

	n=len(s)

	l=0
	r=n-1

	ans=0

	while l<r:

		if s[l]==s[r]:
			l+=1
			r-=1

		elif s[l]=="x":
			ans+=1
			l+=1

		elif s[r]=="x":
			ans+=1
			r-=1

		else:
			print(-1)
			exit()

	print(ans)
	return

if __name__ == "__main__":
	main()


Measured memory_bytes: 9248
S = input()

target = "keyence"
length = len(S)
if target in S[:7]:
    print("YES")
elif target in S[length-7:]:
    print("YES")
else:
    for i in range(1,8):
        if S[:i] == target[:i] and S[length-7+i:] == target[7-7+i:]:
            print("YES")
            break
    else:
        print("NO")

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i = (int)(a); i <= (int)(b); i++)
#define NFOR(i,a,b) for(int i = (int)(a); i >= (int)(b); --i)
#define endl "\n"
#define mp make_pair
#define X first
#define Y second
#define inf 1e9
#define mod 1000000007
#define pb push_back
#define Case cout<<"Case #"<<++cas<<": ";
#define fastio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define all(v) v.begin(),v.end()
#define sz(x) int(x.size())
// #define lli int
typedef long long int lli;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<pii> vii;
typedef pair<lli,lli> pll;
typedef vector<lli> vl;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef complex <long double> complex_t;
const long double PI = acos((long double)-1.0);

#define pr(...) dbs(#__VA_ARGS__, __VA_ARGS__)
template <class T> void dbs(string str, T t) {cerr << str << " : " << t << "\n";}
template <class T, class... S> void dbs(string str, T t, S... s) {int idx = str.find(','); cerr << str.substr(0, idx) << " : " << t << ","; dbs(str.substr(idx + 1), s...);}
template <class S, class T>ostream& operator <<(ostream& os, const pair<S, T>& p) {return os << "(" << p.first << ", " << p.second << ")";}
template <class T>ostream& operator <<(ostream& os, const vector<T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class T>ostream& operator <<(ostream& os, const set<T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class S, class T>ostream& operator <<(ostream& os, const map<S, T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class T> void prc(T a, T b) {cerr << "["; for (T i = a; i != b; ++i) {if (i != a) cerr << ", "; cerr << *i;} cerr << "]\n";}

int arr[100010];

int main() {
    int n; cin >> n;
    FOR(i, 1, n) {
        int temp; cin >> temp; arr[i] = temp;
    }
    int count1 = 0;
    FOR(i, 1, n-1) {
        if (arr[i] == i) {
            swap(arr[i], arr[i+1]), count1++;
        }
    }
    if (arr[n] == n) count1++;
    cout << count1 << endl;
return 0;}

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

#define REP(i, n) for (int i = 0; i < (n); ++i)

int main(void) {
    int n, m, c;

    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n >> m >> c;
    vector<int>a(m), b(m);
    REP(i, m) {
        cin >> b[i];
    }
    int cnt = 0;
    REP(i, n) {
        int sum = 0;
        REP(j, m) {
            cin >> a[j];
            sum += a[j] * b[j];
        }
        if (sum + c > 0) {
            cnt++;
        }
    }

    cout << cnt << "\n";
    return 0;
}

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


  #define en "\n"
  #define sqrt(n) sqrt((long double) n)
  #define all(c) (c).begin() , (c).end()
  #define MOD 1000000007
  #define mem(a) memset(a,0,sizeof(a))
  #define flash() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
  #define file_input(name) name!=""?freopen(name".in","r",stdin),freopen(name".out","w",stdout):0
  #define SORT(x) sort(all(x))
  #define REVERSE(x) reverse(all(x))


  using namespace std;

  typedef unsigned long long ull;
  typedef long long ll;
  typedef pair<int, int> pii;
  typedef pair<ll, ll> pll;
  typedef vector<int> vi;
  typedef set<int> seti;
  typedef pair<double, double> pdd;
  typedef long double ld;



  const double EPS=0.000000001;
  const double INFD32=1000000000;
  const ll INF64=1000000000000000000;
  const int INF32=1000000000;

  #define maxN 30000000
  bool check(int x){
    int digit;
    while(x){
      digit=x%10;
      x/=10;
      if(digit<2)return false;
    }
    return true;
  }
  signed main(void){
      int m,d;
      cin>>m>>d;
      int cnt=0;
      for(int i=1;i<=m;i++){
        for(int j=1;j<=d;j++){
          if((j/10)*(j%10)==i and (j/10)>=2 and (j%10)>=2){
            cnt++;
          }
        }
      }
      cout<<cnt;
      return 0;
    }


Measured memory_bytes: 256
from collections import deque
def BFS_dist(n, E, i0=0):
    Q = deque([i0])
    D = [-1] * n
    D[i0] = 0
    while Q:
        x = Q.popleft()
        for c in E[x]:
            if D[c] == -1:
                D[c] = D[x] + 1
                Q.append(c)
    return D

N = int(input())
A = [int(a) for a in input().split()]
B = [int(a) for a in input().split()]

M = 51
X = [[] for _ in range(M)]
for i in range(1, M):
    for j in range(1, i+1):
        X[i].append([i%j, 2**j])

def chk(S):
    M = 51
    X = [[] for _ in range(M)]
    for j in S:
        for i in range(j, M):
            X[i].append(i%j)
    DI = []
    for i in range(M):
        DI.append(BFS_dist(M, X, i))
    for i in range(N):
        if DI[A[i]][B[i]] < 0:
            return 0
    return 1

L1 = [i for i in range(1, 51)]
L2 = []
if chk(L1) == 0:
    print(-1)
else:
    while L1:
        while True:
            if chk(L1 + L2):
                if len(L1) == 0:
                    break
                L1.pop()
            else:
                L2.append(L1[-1]+1 if L1 else 1)
                L1 = [i for i in range(1, L2[-1])]
                break
        if len(L1) == 0:
            break

    print(sum([1<<l for l in L2]))


Measured memory_bytes: 3564
n=int(input())
m=list(range(1,n+1))
even=[]
odd=[]
for x in range (0,len(m)):
    if len(m)==0:
        print('0')
    else:
        if m[x] % 2 == 0:
            even.append(m[x])
        else:
            odd.append(m[x])

output = [[a, b] for a in even
              for b in odd]
print(len(output))


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

using namespace std;

int main() {
  	int a, b;
  	int c[4] = {0};
  cin >> a >> b;
  c[a] = 1;
  c[b] = 1;
  for(int i = 1; i < 4; i++) {
	if(!c[i])
    {
    	cout << i << endl;
      break;
    }
    
  }
 
 	return 0; 
}

Measured memory_bytes: 256
object Main {
  def main(args: Array[String]) = {
    
    val input: String = readLine()
    val list: Array[String] = input.split(" ")
    
    val a: Int = list(0).toInt
    val b: Int = list(1).toInt
    val c: Int = list(2).toInt

    var ans = "No"
    if (a < b && b < c) {
      ans = "Yes"
    }
    println(ans)
  }
  
//  def readLine(): String = {"5 5"}
}


Measured memory_bytes: 43708
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace Cook
{
    class Program
    {
        static void Main(string[] args)
        {
            long N = long.Parse(Console.ReadLine());
 
            long rowPoint = N;
            long colPoint = 1;
 
            while (N >= colPoint*colPoint)
            {
                if (N % colPoint == 0)
                {
                    rowPoint = N / colPoint;
                }
                colPoint++;
 
            }
            colPoint = N / rowPoint;
            Console.WriteLine((colPoint-1) +(rowPoint-1));
        }
        
    }
}

Measured memory_bytes: 11092
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;

namespace AOJ
{
    class Program
    {
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }
        static void Main(string[] args)
        {
            var dct = new Dictionary<string, Func<long, long, long>>();
            dct["+"] = ( p1,  p2) => p1 + p2;
            dct["-"] = ( p1,  p2) => p2 - p1;
            dct["*"] = (p1, p2) => p1 * p2;
            var Ai = ReadLine().Split();
            var stk = new Stack<long>();
            foreach (var s in Ai)
            {
                var vl = 0L;
                if (long.TryParse(s, out vl))
                {
                    stk.Push(vl);
                }
                else
                {
                    var p1 = stk.Pop();
                    var p2 = stk.Pop();
                    stk.Push(dct[s](p1, p2));
                }
            }
            WriteLine(stk.Pop());
        }
    }
}



Measured memory_bytes: 18400
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    ll a,b,c;
    cin>>a>>b>>c;
    swap(a,b);
    swap(a,c);
    cout<<a<<" "<<b<<" "<<c<<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);
    int n = sc.nextInt();
    
    int i = 1;
    int ans = 0;
    while (n != 0) {
      ans += i*(n % 10 == 1 ? 9 : 1);
      n /= 10;
      i *= 10;
    }
    
    System.out.println(ans);
  }
}

Measured memory_bytes: 23124
#include <bits/stdc++.h>
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define sz(v) (int)(v).size()

using namespace std;
typedef long long ll;
int main()
{
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	ll N;
	cin >> N;
	map<string, int> list;
	ll ans = 0;
	rep(i, N)
	{
		string temp;
		cin >> temp;
		list[temp] = 1;
	}
	cout << sz(list) << '\n';
	return 0;
}


Measured memory_bytes: 19280
/*
ツ姪?路ツづ個催?短ツ仰猟猟」ツづ債、ツ閉敖優ツ静ヲツ探ツ催オツづ?嘉ーツつュツつアツづ?つェツづ?つォツづ慊つキツ。

ツづ慊つクツ、ツつアツづ個姪「ツ妥ィツづ?づ債、ツ禿シツ療債仕ツ様ツつェツ氾アツ湘ュツづ可姪環倒ツづ按形ツづ?づ按づ?づ?つ「ツづ慊つキツ。
ツづ按づゥツづ猟つュツ甘按単ツづ按渉按猟敖づ?、ツづ按づゥツづ猟つュツづュツつゥツづィツづ「ツつキツつ「ツデツーツタツ構ツ堕「ツづ可づ按づゥツづヲツつ、ツづ可陛渉環キツつオツつスツつ「ツづ?思ツつ、ツづ?つオツづ・ツつ、ツ。
ツ催?づ?甘按単ツづ?、ツづュツつゥツづィツづ「ツつキツつ「ツデツーツタツ構ツ堕「ツづ可づ按づゥツづ個づ債、ツ篠淞づ個づヲツつ、ツづ按陛渉環キツ陛サツ法ツづ?つキツ。


ツ?δ甘按単ツづ按陛渉環キツ法ツ??
ツ姪?路ツづ個陛?づ?ツづつづ個マツスツ姪堋づ?考ツつヲツづゥツ。
ツ篠淞づ個づヲツつ、ツづ按禿シツ療債づーツ考ツつヲツづゥツ。

 1
0 1
 0
1 0
 1

ツつアツづェツづーツ、ツ陛?づ?マツスツ姪堋づ?考ツつヲツづゥツづ?篠淞づ個づヲツつ、ツづ可陛渉環キツづ?つォツづゥツ。

010
011
000
110
010

ツ陛?つッツづゥツマツスツ姪堋づ可づ債、0ツづーツ鳴?づ淞づゥツ。
ツ陛?つッツづ按つ「ツマツスツ姪?ツ陛?づ「ツ、ツ陛?づ個古ーツ債キツ点)ツづ可づ債、1ツづーツ鳴?づ淞づゥツ。
ツつ?づ?づ債、ツ債カツ湘」ツつゥツづァツ右ツ可コツづ慊づ?閉敖優ツ静ヲツ探ツ催オツづーツつオツづ?、ツつサツづ個個仰嘉環づ個陛?青板づー2ツづ?環?づ?づ?1ツつキツづェツづ篠つ「ツつ「ツ。

 */
#include <iostream>
#include <queue>
#include <cstring>
using namespace std;

class State{
public:
  int x, y, cost;
  State(int _x, int _y, int _cost){
    x = _x;
    y = _y;
    cost = _cost;
  }
};

int w, h;
int t[100][100];
bool closed[100][100];

int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};

void solve(){
  queue<State> open;
  memset(closed, 0, sizeof(closed));
  open.push(State(0, 0, 0)); //(0,0)ツつゥツづァツコツスツト0ツづ?スツタツーツト

  //ツ行ツつッツづゥツづ?つアツづォツつェツづ按つュツづ按づゥツづ慊づ?繰ツづィツ陛板つキ
  while(!open.empty()){
    State st = open.front(); open.pop();

    //ツつキツづ?づ可辿ツづ?つスツつアツづ?づ個つ?づゥツ催?標ツづ按づァツ鳴ウツ篠仰つキツづゥ
    if(closed[st.y][st.x]) continue;
    closed[st.y][st.x] = true;

    //ツゴツーツδ仰づ慊づ?行ツつォツ陳?つ「ツつスツづァツコツスツトツづー2ツづ?環?づ?づ?1ツつオツつスツづ?づ個つェツ督堋つヲ
    if(st.y == h - 1 && st.x == w - 1){
      cout << st.cost / 2 + 1 << endl;
      return;
    }

    //4ツ陛サツ古シツづ鳴閉ェツ甘イ
    for(int i = 0; i < 4; i++){
      int nx = st.x + dx[i];
      int ny = st.y + dy[i];

      if(0 <= nx && nx < w && 0 <= ny && ny < h && t[ny][nx] == 0){
        open.push(State(nx, ny, st.cost + 1));
      }
    }
  }

  cout << 0 << endl;
}

int main(){
  while(cin >> w >> h, w || h){
    w = w * 2 - 1;
    h = h * 2 - 1;

    //ツマツッツプツ青カツ青ャ
    for(int i = 0; i < h; i++){
      for(int j = 0; j < w; j++){
        //ツ縦ツづ個陛?づーツ禿シツ療債つキツづゥツ行ツづ?つ?づゥツづ?つォ
        if(i % 2 == 0){
          //2ツづ?環?づィツ静伉づェツづゥツ湘ェツ渉環づ債、ツ陛?つッツづゥツマツスツ姪?
          if(j % 2 == 0){
            t[i][j] = 0;
          }
          //2ツづ?環?づィツ静伉づェツづ按つ「ツ湘ェツ渉環づ債、ツ縦ツ陛?つェツつ?づゥツつゥツづ?つ、ツつゥツ禿シツ療債つウツづェツづゥ
          else{
            int x;
            cin >> x;
            t[i][j] = x;
          }
        }

        //ツ可。ツづ個陛?づーツ禿シツ療債つキツづゥツ行ツづ?つ?づゥツづ?つォ
        else{
          //2ツづ?環?づィツ静伉づェツづゥツ湘ェツ渉環づ債、ツ可。ツ陛?つェツつ?づゥツつゥツづ?つ、ツつゥツ禿シツ療債つウツづェツづゥ
          if(j % 2 == 0){
            int x;
            cin >> x;
            t[i][j] = x;
          }
          //2ツづ?環?づィツ静伉づェツづ按つ「ツ湘ェツ渉環づ債、ツ陛?づ個古ーツ債キツ点ツづ可づ按づゥツづ個づ?陛?つッツづ按つ「
          else{
            t[i][j] = 1;
          }
        }
      }
    }

    solve();
  }
}

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

using namespace std;

#define il inline
#define Rep(i, s, e) for (int i = s; i <= e; ++i)

const int N = 1000010;

il int read() {
	bool f = true; int x = 0; char c = getchar();
	while (c < '0' || c > '9') {if (c == '-') f = false; c = getchar();}
	while (c >= '0' && c <= '9') x = (x << 1) + (x << 3) + (c ^ 48), c = getchar();
	return f ? x : -x;
}

int t[N], n;
il int lowbit(int x) {return x & (-x);}
il void update(int x, int k) {while (x <= n) t[x] += k, x += lowbit(x);}
il int query(int x) {int ans = 0; while (x) ans += t[x], x -= lowbit(x); return ans;}

int m, lst[N], a[N], ans[N];
struct node {int l, r, pos;} q[N];
il bool cmp(node a, node b) {return a.r < b.r;}

int main() {
	n = read();
	m = read();
	Rep(i, 1, n) a[i] = read();
	Rep(i, 1, m) q[i].l = read(), q[i].r = read(), q[i].pos = i;
	sort(q + 1, q + m + 1, cmp);
	Rep(i, 1, m) {
		Rep(j, q[i - 1].r + 1, q[i].r) {
			if (lst[a[j]]) update(lst[a[j]], -1);
			update(j, 1), lst[a[j]] = j;
		}
		ans[q[i].pos] = query(q[i].r) - query(q[i].l - 1);
	}
	Rep(i, 1, m) printf("%d\n", ans[i]);
	return 0;
}

Measured memory_bytes: 17384
#include <bits/stdc++.h>
#include <stdio.h>
#include <algorithm>
using namespace std;
#define r(i,n) for(int i=0;i<n;i++)
#define rn(i,n) for(int i=1;i<=n;i++)

int main(void){
  int n;
  cin>>n;
  vector<int> d(n);
  r(i,n)cin>>d.at(i);

  sort(d.begin(),d.end());
  cout<<d.at(n/2)-d.at(n/2-1)<<endl;

  return 0;
}


Measured memory_bytes: 640
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int h = in.nextInt();
		int w = in.nextInt();
		int m = in.nextInt();
		
		HashSet<Long> bombs = new HashSet<Long>();
		int[] rs = new int[h + 1];
		int[] cs = new int[w + 1];
		for (int i = 0; i < m; i++) {
			int r = in.nextInt();
			rs[r]++;
			int c = in.nextInt();
			cs[c]++;
			bombs.add(hash(r,c));
		}
		
		int maxR = 0, maxC = 0;
		for (int r = 0; r <= h; r++) {
			maxR = Math.max(maxR, rs[r]);
		}
		for (int c = 0; c <= w; c++) {
			maxC = Math.max(maxC, cs[c]);
		}

		ArrayList<Integer> candidatesR = new ArrayList<Integer>();
		ArrayList<Integer> candidatesC = new ArrayList<Integer>();
		for (int r = 1; r <= h; r++) {
			if (rs[r] == maxR) {
				candidatesR.add(r);
			}
		}
		for (int c = 1; c <= w; c++) {
			if (cs[c] == maxC) {
				candidatesC.add(c);
			}
		}
		
		int max = maxR + maxC - 1;
		outer : for (int r : candidatesR) {
			for (int c : candidatesC) {
				if (!bombs.contains(hash(r,c))) {
					max++;
					break outer;
				}
			}
		}
		
		System.out.println(max);
		
		in.close();
	}
	
	static long hash(int r, int c) {
		return r * (long)10e6 + c;
	}
}


Measured memory_bytes: 92008
#include<bits/stdc++.h>
using namespace std;
#define  ft  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define  ll  long long
const int N=1e5+2;
ll d[N][3];
int main()
{
    ft
    ll t,i,j,n,m,l,r;
    cin>>n;
    for(i=0;i<n;i++)
    {
        for(j=0;j<3;j++)
        {
            cin>>d[i][j];
        }
    }
    for(i=1;i<n;i++)
    {
        for(j=0;j<3;j++)
        {
            r=0;
            for(l=0;l<3;l++)
            {
                if(j!=l)
                {
                    r=max(r,d[i][j]+d[i-1][l]);
                }
            }
            d[i][j]=r;
        }
    }
    l=0;
    for(i=0;i<3;i++)
    {
        l=max(l,d[n-1][i]);
    }
    cout<<l<<"\n";
    return 0;
}

Measured memory_bytes: 6000
n=int(input())
h=list(map(int,input().split()))
result='Yes'
 
for i in range(n-1):
  if i==0:
    if h[1] < h[0]:
      h[0]-=1
    if h[1] < h[0]:
      result='No'
      break
  else:
    if h[i-1] <= h[i] and h[i] <= h[i+1]:
      if h[i-1] <= h[i]-1 and h[i]-1 <= h[i+1]:
        h[i]-=1
      continue
    else:
      h[i]-=1
      if h[i-1] <= h[i] and h[i] <= h[i+1]:
        continue
      else:
        result='No'
        break

if n == 2:
  if h[1] < h[0]:
    h[1]-=1
    if h[1] < h[0]:
      result='No'

print(result)

Measured memory_bytes: 14704
fun main() {
    val s = readLine()!!
    val answerList = mutableListOf<String>()
    loop@ for (i in s.indices) {
        when (s.substring(i, i + 1)) {
            "0" -> answerList.add("0")
            "1" -> answerList.add("1")
            else -> if (answerList.size == 0) {
                continue@loop
            } else {
                answerList.removeAt(answerList.size - 1)
            }
        }
    }
    println(answerList.joinToString(""))
}

Measured memory_bytes: 35984
#include <bits/stdc++.h>
using namespace std;
const int MAX = 1024;

int h, w, n, maze[MAX][MAX];
int b[15];
int r[] = {1, -1, 0, 0};
int z[] = {0, 0, -1, 1};
int d[MAX][MAX];
int ans = 0;

int readchar() {
    for(;;) {
        int ch = getchar();
        if(ch != '\n' && ch != '\r') return ch;
    }
}

int bfs(int x, int y, int x2, int y2)
{
    //cout << x << y << x2 << y2 << endl;

    queue<int> q;
    q.push(x * 10000 + y);
    while(!q.empty()) {
        int v = q.front();
        q.pop();
        for(int i = 0; i < 4; ++i) {
            int x1 = v / 10000 + r[i];
            int y1 = v % 10000 + z[i];
            if(x1 == x2 && y1 == y2) {
                d[x1][y1] = d[v / 10000][v % 10000] + 1;
                return 0;
            }
            if(x1 >= 0 && y1 >= 0 && x1 < h && y1 < w && maze[x1][y1] != 'X' && d[x1][y1] == -1) {
                 d[x1][y1] = d[v / 10000][v % 10000] + 1;
                 q.push(x1 * 10000 + y1);
            }
        }
    }
    return 0;
}
int main()
{
    cin >> h >> w >> n;
    for(int i = 0; i < h; ++i)
        for(int j = 0; j < w; ++j) {
             maze[i][j] = readchar();
        if(maze[i][j] == 'S') {
            b[0] = i * 10000 + j;
        }
        if(maze[i][j] != 'S' && maze[i][j] != 'X' && maze[i][j] != '.') {
            b[maze[i][j] - '0'] = i * 10000 + j;
        }
    }
    for(int i = 0; i < n; ++i) {
        memset(d, -1, sizeof(d));
        d[b[i] / 10000][b[i] % 10000] = 0;
        bfs(b[i] / 10000, b[i] % 10000, b[i + 1] / 10000, b[i + 1] % 10000);
        ans += d[b[i + 1] / 10000][ b[i + 1] % 10000];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 9408
object Main {
  def main(args: Array[String]): Unit = {
    val sc = new java.util.Scanner(System.in)
    val N = sc.nextInt
    var s: Set[Int] = Set()
    var ans: String = "YES"
    for (i <- 0 until N) {
      var a = sc.nextInt
      if (s.contains(a)) ans = "NO"
      else s = s + a
    }
    print(ans)
  }
}


Measured memory_bytes: 118068
#include<iostream>
#include<string>
int main()
{
    int N;
    std::string a[100];
    std::cin>>N;
    std::string res="Yes";
    for(int i=0;i<N;i++)
    {
        std::cin>>a[i];
    }
    for(int j=1;j<N;j++)
    {
        if(a[j-1].back()!=a[j].front())
        {
            res="No";
            std::cout<<res<<std::endl;
            return 0;
        }
        for(int k=0;k<j;k++)
        {
            if(a[k]==a[j])
            {
                res="No";
                std::cout<<res<<std::endl;
                return 0;
            }
        }
    }
    std::cout<<res<<std::endl;
    return 0;
}

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

int main() {
	int a[3],i;
	string s;
	cin>>s;
	for(i=0;i<3;i++)
	   a[i]=0;
    if(s.size()!=3)
       cout<<"No";
    else
      {
      	  for(i=0;i<3;i++)
    		{
    			++a[s[i]-'a'];
    		}
    	for(i=0;i<3;i++)
    	  {
    	  	  if(a[i]!=1)
    	  	    {
    	  	    	 cout<<"No"<<'\n';
    	  	    	 return 0;
    	  	    }
    	  }
    	 cout<<"Yes"<<'\n'; 
      }
	// your code goes here
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
#define sf(n) scanf("%d", &n)
#define pd(n) printf("%.12lf", n)
#define pf(n) printf("%d", n)
#define p() printf("\n")
#define ps() printf(" ")
#define ll long long
#define ull unsigned long long
#define MAX 1e9
const int mod = 1000 * 1000 * 1000 + 7;
#define ex 1e18
#define dbl 2e09
#define qu(q) queue<int> q
#define pqu(q) priority_queue<int> q
#define len(s) s.length()
#define sz(x) int(x.size())
#define pb(x) push_back(x)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define F first
#define S second
#define clr(x) x.clear()
#define LOG(x) std::cout << x << std::endl;
 
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const double PI = 3.14159265359;
 
int dx[4] = {1, -1, 0, 0};
int dy[4] = {0, 0, 1, -1};


vector<ll>v;
queue<ll>q;

int main(){
   
   int n;
   cin>>n;
   for(int i=1;i<=9;++i){
      v.pb(i);
      q.push(i);
   }  
   while(v.size()<n){
      ll t=q.front();
      ll x=t%10;
      q.pop();
      if(x>0){
         v.pb(t*10+(x-1));
         q.push(t*10+(x-1));
      }
      v.pb(t*10+(x));
      q.push(t*10+(x));
      if(x!=9){
         v.pb(t*10+(x+1));
         q.push(t*10+(x+1));
      }
   }

   cout<<v[n-1]<<endl;
   return 0;
}

Measured memory_bytes: 1620
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
vector<vector<char >> Map(52,vector<char> (52,'#'));

int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};

int bfs(int sx,int sy,int gx,int gy){
    vector<vector<int>> dist(52,vector<int>(52,-1));
    dist[sx][sy]=0;
    queue<int> X;queue<int> Y;
    X.push(sx);Y.push(sy);
    int ans=0;
    while (!X.empty()){
        int x=X.front();    X.pop();
        int y=Y.front();    Y.pop();
        for(int i=0;i<4;i++){
            if(Map[x+dx[i]][y+dy[i]]=='.' && dist[x+dx[i]][y+dy[i]]==-1){
                dist[x+dx[i]][y+dy[i]]=dist[x][y]+1;
                if(y+dy[i]==gy && x+dx[i]==gx){
                    ans=dist[x+dx[i]][y+dy[i]];
                }
                X.push(x+dx[i]);
                Y.push(y+dy[i]);
            }
        }
    }
    if(dist[gx][gy]==-1)ans=-1;
    return ans;
}
int main(){
    int H,W;    cin>>H>>W;
    int ans=0;
    for(int i=1;i<=H;i++){
        for(int j=1;j<=W;j++){
            cin>>Map[j][i];
            if(Map[j][i]=='.')ans++;
        }
    }
    int b=bfs(1,1,W,H);
    if(b!=-1){
        ans=ans-b-1;
    }
    else{
        ans=-1;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n) for(int i=1;i<=(n);i++)
#define lol long long
#define SUM(n) ((n)+1)*(n)/2 //1〜nまでの総和を求める式
#define mp make_pair
#define fi first
#define se second
#define pu push_back
#define SYOU(x) fixed<<setprecision(x+1) //小数点桁数を指定する
#define abs(x,y) max(x,y)-min(x,y)
#define all(v) v.begin(),v.end()
#define UPDigit(a,b) (a+b-1)/b //小数点切り上げ
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const int MOD=int(1e9)+7; 
using namespace std;
using pii = pair<lol, lol>;
typedef vector<int> vit;

/*
struct SegmentTree{
  
  vector<lol> SumV(1000005,0);
  vector<lol> MaxV(1000005,0);
  vector<lol> MinV(1000005,0);
  int N;
  
  void update(int i,int x){
    i += N - 1;
    minv[i] = x;
    maxv[i] = x;
    sumv[i] = x;
    while(i > 0){
      i = (i - 1)/2;
      maxv[i] = max(maxv[i*2+1],maxv[i*2+2]);
      minv[i] = min(minv[i*2+1],minv[i*2+2]);
      sumv[i] = sumv[i*2+1]+sumv[i*2+2];
    }
  }
  
  void add(int i,int x){
    i += N - 1;
    sumv[i] += x;
    maxv[i] += x;
    minv[i] += x;
    while(i > 0){
      i = (i - 1)/2;
      sumv[i] = sumv[i*2+1]+sumv[i*2+2];
      minv[i] = min(minv[i*2+1],minv[i*2+2]);
      maxv[i] = max(maxv[i*2+1],maxv[i*2+2]);
    }
  }
  
  int getmax(int a,int b,int k,int l,int r){
    if(r <= a || b <= l) return -INF;
    if(a <= l && r <= b) return maxv[k];
    else{
      int c1 = getmax(a,b,2*k+1,l,(l+r)/2);
      int c2 = getmax(a,b,2*k+2,(l+r)/2,r);
      return max(c1,c2);
    }
  }
  
  int getmin(int a,int b,int k,int l,int r){
    if(r <= a || b <= l) return INF;
    if(a <= l && r <= b) return minv[k];
    else{
      int c1 = getmin(a,b,2*k+1,l,(l+r)/2);
      int c2 = getmin(a,b,2*k+2,(l+r)/2,r);
      return min(c1,c2);
    }
  }
  
  int getsum(int a,int b,int k,int l,int r){
    if(r <= a || b <= l) return 0;
    if(a <= l && r <= b) return sumv[k];
    else{
      int c1 = getsum(a,b,2*k+1,l,(l+r)/2);
      int c2 = getsum(a,b,2*k+2,(l+r)/2,r);
      return c1+c2;
    }
  }
}
*/

//最大公約数
lol gcd(lol x, lol y){
  if(x < y) swap(x, y);
  lol r = x % y;
  while(r != 0){
    x = y;
    y = r;
    r = x % y;
  }
  return y;
}
//最小公倍数
lol lcm(lol x, lol y){
  lol a = x * y;
  return (a / gcd(x, y));
}


signed main(void){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  string s;
  int a[10] = {};
  rep(i, n){
    cin >> s;
    if(s == "AC"){
      a[0] ++;
    } else if(s == "WA"){
      a[1] ++;
    } else if(s == "TLE"){
      a[2] ++;
    } else {
      a[3] ++;
    }
  }
  printf("AC x %d\nWA x %d\nTLE x %d\nRE x %d\n", a[0], a[1], a[2], a[3]);
  return 0;
}


Measured memory_bytes: 3720
#include <iostream>
#include <fstream>
#include <vector>
#include <queue>
#include <string>
#include <limits>
#include <algorithm>
#include <map>
#include <sstream>
#include <unordered_map>
#include <set>

using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
static ull tenq = 1000000000;
static ull mod = tenq + 7;

using namespace std;

int main()
{
  string s;
  cin >> s;
  int i;
  ll num0 = 0;
  ll num1 = 0;
  for (i = 0; i < s.size();i++)
  {
    if (s[i] == '0') num0++;
    else num1++;
  }

  cout << 2 * min(num0, num1) << endl;

  return 0;
}


Measured memory_bytes: 512
#include<iostream>

using namespace std;

int main(){
  int n;
  cin >> n;
  for(int i=1;i <= n;i++){
    int x = i;
    if(x % 3 == 0){
      cout << " " << i;
      continue;
    }
    while(x){
      if(x % 10 == 3){
        cout << " " << i;
        break;
      }
      x /= 10;
    }
  }
  cout << endl;
}


Measured memory_bytes: 3112
#include <iostream> 
#include <vector> 
using namespace std; 
  
typedef long long ll; 
  
vector<ll> set(int n) { 
  vector<int> a(n); 
  for(int i=2; i<n; i++) a[i]=i-1; 
  a[1]=2;   
  for(int i=2; i*2<n; i++) { 
    for(int j=i*2; j<n; j+=i) a[j]-=a[i]; 
  } 
  vector<ll> ans(1000001); 
  ans[1]=a[1]; 
  for(int i=2; i<1000001; i++) ans[i]=ans[i-1]+a[i]; 
  return ans; 
} 
  
int main() { 
  vector<ll> ans=set(1000001); 

  int t; 
  cin >> t; 
  
  while(t--) { 
    int x; 
    cin >> x; 
    cout << ans[x] << endl; 
  } 
  return 0; 
}


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

#define rep(i, n)    for(int i = 0; i < (n); ++i)
#define repA(i, a, n)  for(int i = a; i <= (n); ++i)
#define repD(i, a, n)  for(int i = a; i >= (n); --i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
#define fill(a)  memset(a, 0, sizeof (a))
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

int main() {
	cin.sync_with_stdio(0); cin.tie(0);
	cin.exceptions(cin.failbit);
	int n;cin>>n;
	int c[n],s[n],f[n];
	rep(i,n-1) cin>>c[i]>>s[i]>>f[i];
	rep(i,n){
		ll ans=0;
		int st = i;
		while(st<n-1){
			ll z = (ans/f[st])*f[st];
			if(z<ans) ans = z+f[st];
			else ans = z;
			ans = max(ans,1LL*s[st]);
			ans+=c[st];
			st++;
		}
		cout<<ans<<'\n';
	}
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
  int n,q,C;
  int i,j;
  int count=0,scount=0;

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

  //重複を数える
  for(i=n-1; i>0; i--){
    for(j=i-1; j>=0; j--){
      if(S[i]==S[j]){
        scount++;
      }
    }
  }

  scanf("%d",&q);
  int T[q];
  for(i=0; i<q; i++){
    scanf("%d",&T[i]);
  }

 //数列Tの中で数列Sに含まれる個数
  for(i=0; i<q; i++){
    for(j=0; j<n; j++){
      if(T[i]==S[j]) {
        count++;
        break;
      }
    }
  }

//printf("重複数 %d\n",scount);
//printf("服む個数 %d\n",count);
  printf("%d\n",count);

  return 0;

}



Measured memory_bytes: 2144
a,b,ab,a_c,b_c=map(int,input().split())
ans=[]
#そのまま
ans.append(a*a_c+b*b_c)
#合体（余りは捨てる）
ans.append(max(a_c,b_c)*ab*2)
#合体（足らない分は買う）
c=min(a_c,b_c)
ans.append(c*ab*2+(a_c-c)*a+(b_c-c)*b)
print(min(ans))

Measured memory_bytes: 3060
import java.util.*;

class Main {
	public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        String out = "No";
        for (int c =0; c < 3; c++ ){
            if ((a * b * c) % 2 == 1){
                out = "Yes";
            	break;
            }
        }
        System.out.println(out);
    }
}

Measured memory_bytes: 21844
import java.util.*;
import java.io.*;
class Main {
	public static void main (String[] args) throws java.lang.Exception {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		System.out.println((x / 3600) + ":" + (x % 3600 / 60) + ":" + (x % 60));
	}
}



Measured memory_bytes: 26188
n,w=map(int,input().split())
W=[]
V=[]
for i in range(n):
  a,b=map(int,input().split())
  W.append(a)
  V.append(b)
DP=[[0]*(w+1) for j in range(n+1)]
for p in range(n):
  for q in range(w+1):
    if q<W[p]:
      DP[p+1][q]=DP[p][q]
    else:
      DP[p+1][q]=max(DP[p][q], DP[p][q-W[p]]+V[p])
print(DP[n][w])

Measured memory_bytes: 149888
/*
 * Author : Andrew J
*/
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define all(x) x.begin() , x.end()
#define rall(x) x.rbegin() , x.rend()
#define vz(x) x.size()
using ll = long long;
using ii = pair <int , int>;
void in(int &x);
const int N = 3e5 + 10;
const int INF = 1e9 + 50;
const int MOD = 1e9 + 7;
int n, k;
int v[N], dp[N], tree[N * 8];

void update(int idx , int l , int r , int x , int val) {
  if (l == x && r == x) {
    tree[idx] = val;
    return;
  }
  if (r < x || l > x) return;
  int mid = (l + r) / 2;
  update(idx * 2 , l , mid , x , val);
  update(idx * 2 + 1 , mid + 1 , r , x , val);
  tree[idx] = max(tree[idx * 2] , tree[idx * 2 + 1]);
}

int rangeMax(int idx , int l , int r , int a , int b) {
  if (r < a || l > b) return -INF;
  if (a <= l && r <= b) return tree[idx];
  int mid = (l + r) / 2;
  return max(
    rangeMax(idx * 2 , l , mid , a , b),
    rangeMax(idx * 2 + 1 , mid + 1 , r , a , b)
  );
}

int main() {
  in(n); in(k);
  set <int> distinct;
  for (int i = 1 ; i <= n ; i++) {
    in(v[i]);
    distinct.insert(v[i]);
  }

  vector <int> delm;
  delm.pb(-1);
  for (int x : distinct) {
    delm.pb(x);
  }

  for (int cur = 1 ; cur <= n ; cur++) {
    int &sol = dp[cur];
    sol = 1;
    int lb = (int)(lower_bound(all(delm) , v[cur] - k) - delm.begin());
    int ub = (int)(upper_bound(all(delm) , v[cur] + k) - delm.begin());
    ub--;
    sol = max(sol , rangeMax(1 , 1 , n , lb , ub) + 1);
    int curPos = (int)(lower_bound(all(delm) , v[cur]) - delm.begin());
    update(1 , 1 , n , curPos , sol);
  }
  printf("%d\n" , *max_element(dp + 1 , dp + n + 1));
  return 0;
}

void in(int &x){
	bool neg = false;
	register int c;
	x = 0;
	c = getchar();
	if(c == '-'){
		neg = true;
		c = getchar();
	}
	for (; c > 47 && c < 58; c = getchar())
	x = (x << 1) + (x << 3) + c - 48;
	if (neg) x *= -1;
}


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

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using WGraph = vector<vector<pair<int, ll>>>;

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

// constexpr int dx[4] = {-1, 0, 0, 1}, dy[4] = {0, -1, 1, 0};
constexpr int INF = 1e9;
constexpr int MOD = 1e9 + 7;
constexpr long long LINF = 1e18;
constexpr double EPS = 1e-10;
constexpr double PI = M_PI;

constexpr int dx[3][9] = {
    {-2, -1, 0, -2, -1, 0, -2, -1, 0},
    {-1, 0, 1, -1, 0, 1, -1, 0, 1},
    {0, 1, 2, 0, 1, 2, 0, 1, 2}
};
constexpr int dy[3][9] = {
    {-2, -2, -2, -1, -1, -1, 0, 0, 0},
    {-1, -1, -1, 0, 0, 0, 1, 1, 1},
    {0, 0, 0, 1, 1, 1, 2, 2, 2}
};

void solve() {
    ll h, w;
    int n;
    cin >> h >> w >> n;
    vector<pair<int, int>> black(n);
    for (int i=0; i<n; ++i) {
        cin >> black.at(i).first >> black.at(i).second;
    }

    vector<ll> res(10);
    res.at(0) = (h-2) * (w-2);
    set<pair<int, int>> st;
    for (auto p : black) st.insert(p);
    for (auto p : black) {
        int cx = p.first, cy = p.second;
        for (int i=0; i<3; ++i) {
            for (int j=0; j<3; ++j) {
                int cnt = 0;
                bool in = true;
                for (int k=0; k<9; ++k) {
                    int nx = cx + dx[i][k], ny = cy + dy[j][k];
                    if (nx < 1 || h < nx || ny < 1 || w < ny) {
                        in = false;
                        break;
                    }
                    if (st.count({nx, ny})) ++cnt;
                }
                if (in) ++res.at(cnt);
            }
        }
    }
    for (int i=1; i<10; ++i) {
        res.at(i) /= i;
        res.at(0) -= res.at(i);
    }
    for (ll x : res) cout << x << '\n';
}

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

    solve();

    return 0;
}


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

#define NDEBUG
#ifdef DEBUG
#include "../cout11.h"
#undef NDEBUG
#endif
#include <cassert>

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> ii;
typedef pair<ll,ll> llll;
typedef pair<double,double> dd;

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ii> vii;
typedef vector<vector<ii>> vvii;
typedef vector<ll> vll;

#define sz(a)  int((a).size())
#define pb  push_back
#define FOR(var,from,to) for(int var=(from);var<=(to);++var)
#define rep(var,n)  for(int var=0;var<(n);++var)
#define rep1(var,n)  for(int var=1;var<=(n);++var)
#define repC2(vari,varj,n)  for(int vari=0;vari<(n)-1;++vari)for(int varj=vari+1;varj<(n);++varj)
#define ALL(c)  (c).begin(),(c).end()
#define RALL(c)  (c).rbegin(),(c).rend()
#define tr(i,c)  for(auto i=(c).begin(); i!=(c).end(); ++i)
#define found(s,e)  ((s).find(e)!=(s).end())
#define mset(arr,val)  memset(arr,val,sizeof(arr))
#define mid(x,y) ((x)+((y)-(x))/2)
#define IN(x,a,b) ((a)<=(x)&&(x)<=(b))

ll gcd(ll a, ll b) { while(a) swap(a, b%=a); return b; }



ll solve(int N, int K) {
    // N:[1, 1e5]
    // K:[0, N)

    // a % b >= K
    // a = Pb + Q
    // Q: [0..b-1] がK以上
    // a = P*b + [K, b-1]
    // a: b進法で1の位がK以上
    // a:[1,N] b:[1,N]
    // K <= b-1,
    // K+1 <= b

    ll total = 0;
    for (int b=K+1; b<=N; ++b) {
        int w = b - K;
        int Pmax = N / b;
        // [0..Pmax)b + [K, b-1]
        int a_cnt = Pmax * w;
        if (K == 0) --a_cnt; //[0, b-1]なので
        int rem = N - Pmax*b;
        assert(IN(rem, 0, b-1));
        if (rem >= K) a_cnt += 1 + (rem - K); // (K-1);
#ifdef DEBUG
        fprintf(stderr, "b=%d: %d  ;; %dx%d, rem=%d, (+%d)\n", b, a_cnt, Pmax,w, rem, rem-K);
#endif
        total += a_cnt;
    }
    return total;
}

int main() {
    int N,K;cin>>N>>K;
    cout << solve(N,K) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>

using namespace std;

bool isPrime(int x);

int main() {
	size_t count, n;
	int x;

	count = 0;
	cin >> n;
	for(int i = 0; i < n; ++i) {
		cin >> x;
		if(isPrime(x)) {
			count++;
		}
	}

	cout << count << endl;

	return 0;
}

bool isPrime(int x) {
	if(2 == x || 3 == x || 5 == x || 7 == x) { return true; }
	if(0 == x % 2 || 0 == x % 3 || 0 == x % 5 || 0 == x % 7) { return false; }
	if(121 > x) { return 1 < x; }

	for(int i = 11; i <= sqrt(x); i += 2) {
		if(0 == x % i) { return false; }
	}
	return true;
}


Measured memory_bytes: 3064
#include <algorithm>
#include <climits>
#include <cmath>
#include <iostream>
#include <unordered_map>
#include <vector>

const int mod = 1e9 + 7;

int main()
{
    int n, a, b;
    std::cin >> n >> a >> b;

    std::string s;
    std::cin >> s;

    int count_a = 0, count_b = 0;
    for (int i = 0; i < n; i++) {
        if (s[i] == 'a' && count_a + count_b < a + b) {
            std::cout << "Yes" << std::endl;
            count_a++;
        } else if (s[i] == 'b' && count_a + count_b < a + b && count_b + 1 <= b) {
            std::cout << "Yes" << std::endl;
            count_b++;
        } else {
            std::cout << "No" << std::endl;
        }
    }
}


Measured memory_bytes: 896
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cmath>
#include <algorithm>
#include <utility>
#include <functional>
#define debug(x) cout << #x << " = " << x << endl
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define repr(i,n) for(int i = (n); i > -1; i--)
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const double EPS = 1e-9;

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

  int n,m;
  cin>>n;
  string s[n];
  rep(i,n) cin>>s[i];
  cin>>m;
  string t[m];
  rep(i,m) cin>>t[i];
  int ans = 0;
  rep(i,n) {
    int score = 0;
    rep(j,n) {
      if(s[i] == s[j]) score++;
    }
    rep(j,m) {
      if(s[i] == t[j]) score--;
    }
    ans = max(score, ans);
  }
  cout << ans << endl;


  return 0;
}


Measured memory_bytes: 256
n,k=map(int, input().split())
num=[0]*100001
for i in range(n):
    a,b = map(int, input().split())
    num[a] +=b
cnt = 0
for i in range(1, 100001):
    cnt += num[i]
    if cnt >= k:
        print(i)
        exit()



Measured memory_bytes: 5748