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

#define F(i, a, b) for(int i=a; i<b; i++)
#define mem(arr, val) memset(arr, val, sizeof(arr))
#define rev(str) reverse(str.begin(), str.end())
#define UPPER(str) transform(str.begin(), str.end(), str.begin(), ::toupper)
#define LOWER(str) transform(str.begin(), str.end(), str.begin(), ::tolower)

#define MOD 1000000007
#define INF 1000000000000001
#define epsilon 1e-15

typedef long long int ll;
typedef unsigned long long int ull;

const int MAX = 100;

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

	return gcd(b, a%b);
}



int main()
{

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif

    int K;
    cin >> K;
    if(K%7==0) K/=7;
    if(K==1){
    	cout << '1';
    	return 0;
    }

    ll x = 0;

    for(int i=1; i<=K; i++){
    	x = ((10*x)%K + 1)%K;
    	if(x%K == 0){
    		cout << i;
    		return 0;
    	}
    }

    cout << -1;

    return 0;
   
}

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

using namespace std;

#define PROBLEM "A"
#define TESTC ""

#define USE_CPPIO() ios_base::sync_with_stdio(0); cin.tie(0)
typedef pair<int, int> P;
#define F first
#define S second
#define INF 0x3f3f3f3f
#define MP make_pair
#define PB push_back
#define MAXN 100000

int main()
{
	#ifdef DBG
	freopen(PROBLEM TESTC ".in", "r", stdin);
	freopen(PROBLEM ".out", "w", stdout);
	#endif

	int N,M;
	while(~scanf("%d %d",&N,&M))
	{
		int flag[M+5];
		memset(flag,0,sizeof(flag));
		for(int i = 1; i <= N; i++)
		{
			int tmp;
			scanf("%d",&tmp);
			for(int j = 1; j <= tmp; j++)
			{
				int tmp2;
				scanf("%d",&tmp2);
				flag[tmp2]++;
			}
		}

		int cnt = 0;
		for(int k = 1; k <= M; k++)
		{
			// printf("%d: %d\n",k,flag[k]);
			if(flag[k] == N)
				cnt++;
		}
			
	
		printf("%d\n",cnt);
			
		
	}

	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[] a = new int[n];
        int[] a2 = new int[n];
        long sum = 0;
        for(int i=0; i<n; i++){
            a[i] = sc.nextInt();
            a2[i] = a[i] - i - 1;
            sum += a[i];
        }
        sc.close();

        Arrays.sort(a2);

        

        //long s = (sum - (long)(n+1)*(long)(n+2)/2) / n;
        long s = a2[n/2];
        long l = s + 1;
        long ss = s - 1;

        long ans1 = 0, ans2 = 0, ans3 = 0;
        for(int i=0; i<n; i++){
            ans1 += Math.abs(a[i] - s - i - 1);
            ans2 += Math.abs(a[i] - l - i - 1);
            ans3 += Math.abs(a[i] - ss - i - 1);
        }
        System.out.println(Math.min(Math.min(ans1, ans2), ans3));
    }
}

Measured memory_bytes: 89956
#pragma GCC optimize("O3")

#define _GLIBCXX_DEBUG
#include <iostream>
#include <vector>
#include <string>
#include <string_view>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
using namespace std;

/*----------macros----------*/

//output================
#define endl '\n'
#define fcout(a) cout << fixed << setprecision((int)(a))

//typedef===============
typedef long long       ll;
typedef long double     ld;
typedef pair<int, int>  Pii;
typedef pair<ll, ll>    Pll;

//const number==========
constexpr ll INF9   = (ll)1e9 + 1;
constexpr ll INF18  = (ll)1e18 + 1;
constexpr ll MOD    = 1000000007;
constexpr ll MOD2   = 998244353;
constexpr ld PI     = 3.141592653589793L;

//member================
#define pb push_back
#define eb emplace_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second

//others================
#define all(x)          (x).begin(), (x).end()
#define rall(x)         (x).rbegin(), (x).rend()
#define rep(i, n)       for(int i = 0; (i) < (n); ++(i))
#define reps(i, n)      for(int i = 1; (i) <= (n); ++(i))
#define rrep(i, n)      for(int i = n - 1; (i) >= 0 ; --(i))
#define repbit(bit, n)  for(int bit = 0; (bit) < (1 << (n)); ++(bit))
#define ifbit(bit, i)   if((bit) & (1 << (i)))
#define CtoI(c)         int((c)) - int('0')
#define ItoC(c)         char((c) + '0')

//functions=============
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

//vector<int> dx = {1, 0, -1, 0}, dy = {0, 1, 0, -1};
//vector<int> dx2 = { 1,1,0,-1,-1,-1,0,1 }, dy2 = { 0,1,1,1,0,-1,-1,-1 };

/*--------additional--------*/



/*----------main------------*/

int main() {
/*----------fastio----------*/
    std::cin.tie(nullptr);
    std::cout.tie(nullptr);
    std::ios::sync_with_stdio(false);
/*----------solve-----------*/

    int a, b, c; cin >> a >> b >> c;
    if(c - (a - b) > 0)
        cout << c - (a - b) << endl;
    else cout << 0 << endl;

return 0;
}

Measured memory_bytes: 3648
N, M = map(int, input().split())
Switch = []
for _ in range(M):
  Switch.append(sorted(list(map(int, input().split()))[1:]))
P = list(map(int, input().split()))

ans = 0
for n in range(2**N):
  #print(f'n: {n}')
  alllight = True
  for pi, S in enumerate(Switch):
    mask = n
    swon = 0
    for i in range(N):
      if (mask >> i) & 1:
        if i+1 in S: swon += 1
    #print(f'  sw: {pi}, p:{P[pi]}, swon: {swon}')
    if swon % 2 != P[pi]:
      alllight = False
      break
  if alllight: ans += 1

print(ans)

Measured memory_bytes: 3064
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;

class Program
{
    static void Main(string[] args)
    {
        WriteLine(hoge());
    }

    static char hoge()
    {
        var text = ReadLine();
        var k = long.Parse(ReadLine());
        long max = Math.Min(k, text.Length);
        for (int i = 0; i < max; ++i)
        {
            if (text[i] != '1') return text[i];
        }
        return '1';
    }
}


Measured memory_bytes: 11092
import           Control.Monad
import           Control.Monad.ST
import qualified Data.Array                  as A
import qualified Data.Array.ST               as ST
import qualified Data.Array.Unboxed          as AU
import           Data.Bits
import qualified Data.ByteString.Char8       as BS
import           Data.Char
import           Data.Int
import qualified Data.IntMap                 as IM
import           Data.List
import qualified Data.Map                    as M
import           Data.Maybe
import           Data.Ord
import qualified Data.Set                    as S
import           Data.Time
import qualified Data.Vector                 as V
import qualified Data.Vector.Mutable         as VM
import qualified Data.Vector.Unboxed         as VU
import qualified Data.Vector.Unboxed.Mutable as VUM

readInt :: IO [Int]
readInt = map (fst . fromJust . BS.readInt) . BS.words <$> BS.getLine

readInts :: Int -> IO [[Int]]
readInts n = replicateM n readInt

readInteger :: IO [Integer]
readInteger = map (fst . fromJust . BS.readInteger) . BS.words <$> BS.getLine

readIntegers :: Int -> IO [[Integer]]
readIntegers n = replicateM n readInteger

readString :: IO [String]
readString = map BS.unpack . BS.words <$> BS.getLine

readStrings :: Int -> IO [[String]]
readStrings n = replicateM n <$> readString

toPair :: [a] -> (a, a)
toPair [x, y] = (x, y)

count :: Eq a => a -> [a] -> Int
count a as = length $ filter (== a) as

main = do
  [n, m] <- readInt
  a <- readInt
  let a' = sum a
   in if length (filter (\x -> 4 * x * m >= a') a) >= m
        then putStrLn "Yes"
        else putStrLn "No"


Measured memory_bytes: 508
import java.util.Scanner;

public class Main {

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

		// 整数の入力
		int t = sc.nextInt();
		int x = sc.nextInt();
		double ans;

		ans = (double) t/x;

		System.out.println(String.format("%.10f", ans));

		sc.close();
	}
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
#include <string>
#include <algorithm>
using namespace std; //std::の省略のため
using ll = long long;

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

  ll t[n], a[n];
  for (int i = 0; i < n; i++)
    cin >> t[i] >> a[i];

  ll now_t = t[0], now_a = a[0];
  //cout << now_t << " : " << now_a << endl;

  ll k;

  for (int i = 1; i < n; i++)
  {
    k = max((now_t - 1)/ t[i] + 1, (now_a - 1) / a[i] + 1);

    now_t = t[i] * k;
    now_a = a[i] * k;

    //cout << now_t << " : " << now_a << endl;
  }

  ll ans = now_a + now_t;

  cout << ans << endl;
}


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

using namespace std;

#define rg register
#define In inline

const int N = 100;
const int inf = 0x3f3f3f3f;

typedef pair<int,int>pii;

namespace IO{
	In int read(){
		int s = 0,ww = 1;
		char ch = getchar();
		while(ch < '0' || ch > '9'){if(ch == '-')ww = -1;ch = getchar();}
		while('0' <= ch && ch <= '9'){s = 10 * s + ch - '0';ch = getchar();}
		return s * ww;
	}
	In void write(int x){
		if(x < 0)putchar('-'),x = -x;
		if(x > 9)write(x / 10);
		putchar('0' + x % 10);
	}
}
using namespace IO;

int f[N+5][N+5],clr[N+5][N+5];
int inv[N+5][N+5];
int h,w;

queue<pii>q;

int dfs(int i,int j){
	if(f[i][j] != -1)return f[i][j];
//cout<<"i="<<i<<" j="<<j<<endl;
	int ans = inf;
	vector<pii>v1,v2;
	v1.resize(0);
	v2.resize(0);	
	q.push(make_pair(i,j));
	inv[i][j] = 1;
	while(!q.empty()){
		pii u = q.front();
//cout<<" u.first="<<u.first<<" u.second="<<u.second<<endl;
		q.pop();
		inv[u.first][u.second] = 0;
		if(u != make_pair(i,j))v1.push_back(u);
		if(!inv[u.first][u.second+1]){
			if(clr[u.first][u.second+1] == clr[i][j]){
				q.push(make_pair(u.first,u.second+1));
				inv[u.first][u.second+1] = 1;
			}
			else v2.push_back(make_pair(u.first,u.second+1));
		}
		if(!inv[u.first+1][u.second]){
			if(clr[u.first+1][u.second] == clr[i][j]){
				q.push(make_pair(u.first+1,u.second));
				inv[u.first+1][u.second] = 1;
			}
			else v2.push_back(make_pair(u.first+1,u.second));
		}
	}
	for(rg int I = 0;I < v1.size();I++)ans = min(ans,dfs(v1[I].first,v1[I].second));
	for(rg int I = 0;I < v2.size();I++)ans = min(ans,dfs(v2[I].first,v2[I].second) + clr[i][j]);
//cout<<"i="<<i<<" j="<<j<<" ans="<<ans<<endl;
	return f[i][j] = ans;
}

char s[N+5];

int main(){
//	freopen("A.in","r",stdin);
//	freopen("A.out","w",stdout);
	h = read(),w = read();
	memset(clr,-1,sizeof(clr));
	for(rg int i = 1;i <= h;i++){
		scanf("%s",s + 1);
		for(rg int j = 1;j <= w;j++)clr[i][j] = (s[j] == '#');
	}
/*for(rg int i = 1;i <= h;i++){
	for(rg int j = 1;j <= w;j++)cout<<clr[i][j]<<" ";cout<<endl;
}*/
	memset(f,0x3f,sizeof(f));
	for(rg int i = 1;i <= h;i++)
		for(rg int j = 1;j <= w;j++)f[i][j] = -1;
	f[h][w] = clr[h][w];
	cout << dfs(1,1) << endl;
/*for(rg int i = 1;i <= h;i++){
	for(rg int j = 1;j <= w;j++)cout<<f[i][j]<<" ";cout<<endl;
}*/
	return 0;
}

Measured memory_bytes: 6132
#include <iostream>
using namespace std;
int main(){
  int n;
  cin >> n;
  if(n<1000)
    cout << (1000-n) << endl;
  else if(n%1000==0)
    cout << "0" << endl;
  else{
    int k=n/1000;
    int q=(k+1)*1000;
    int a=q-n;
    cout << a << endl;
  }
  return 0;
}

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

#define sync ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define endl "\n"
#define ends ' '
#define die(x) return cout << x << endl, 0
#define all(v) v.begin(), v.end()
#define sz(x) (int)(x.size())
#define debug(x) cerr << #x << ": " << x << endl
#define debugP(p) cerr << #p << ": {" << p.first << ", " << p.second << '}' << endl
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const ll INF = 1e9, MOD = INF + 7;
 
/////////////////////////////////////////////////////////////////////
 
const int N = 1e5 + 5;

int main() {
 
	sync;
	
	string s; cin >> s;
	for (int i = 1; i < sz(s); i++) if (s[i] == s[i - 1]) die(i << ends << i + 1);
	for (int i = 2; i < sz(s); i++) if (s[i] == s[i - 2]) die(i - 1 << ends << i + 1);
	cout << -1 << ends << -1 << endl;

	return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <unordered_map>
#include <map>
#include <algorithm>
#include <set>
#include <unordered_set>
#include <deque>
#include <cmath>
#include <stack>
#include <queue>

using namespace std;

int x;

int main(){
    vector<int> h;

    for(int i = 0; i < 3; i++){
        cin >> x;
        h.push_back(x);
    }

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

    cout << h[0] + h[1];

}

//g++ -std=c++14 comp.cpp; ./a.exe


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

#define long long long int
using namespace std;

int f(int n) {
    return n % 2 == 0 ? n / 2 : 3 * n + 1;
}


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cout.precision(6);
    int n, cnt = 1;
    cin >> n;
    set<int> a;
    a.insert(n);
    while (!a.count(f(n))) {
        cnt++;
        a.insert(f(n));
        n = f(n);

    }
    cout << cnt + 1;

    return 0;
}

Measured memory_bytes: 256
W, H, N = map(int, input().split())
x_l, x_r, y_b, y_u = 0, W, 0, H
for _ in range(N):
  x, y, a = map(int, input().split())
  if a == 1:
    x_l = max(x_l, x)
  elif a == 2:
    x_r = min(x_r, x)
  elif a == 3:
    y_b = max(y_b, y)
  else:
    y_u = min(y_u, y)
print(max(x_r - x_l, 0) * max(y_u - y_b, 0))

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

// 小数点以下桁数
// fixed << setprecision(i)

int64_t gcd(int64_t a,int64_t b){return (a%b==0?b:gcd(b, a%b));}
int64_t lcm(int64_t a,int64_t b){return a/gcd(a, b)*b;}
int factorial(int a){int b=1;while(a){b*=a--;}return b;} //13以下対応
bool is_prime(int a){if(a<=1)return false;for(int i=2;(int64_t)i*i<=a;i++){if(a%i==0)return false;}return true;}
int get_adp(double x, int n){return (int)round((x-(int)x)*pow(10,n))%10;} // 小数点以下の指定桁の値を取得
int64_t sigma(int64_t s, int64_t n){return n*(2*s+n-1)/2;}

//順列の全列挙
// vector<int> v(N);
// iota(v.begin(), v.end(), 1);       // v に 1, 2, ... N を設定
// do {
//	for(auto x : v) cout << x << " "; cout << "\n";     // v の要素を表示
// } while( next_permutation(v.begin(), v.end()) ); 

//bit全探索
// for (int tmp = 0; tmp < (1 << ビット数); tmp++) {
//	bitset<ビット数> s(tmp);
//	// (ビット列sに対する処理)
// }



int main()
{
	int x;
	cin >> x;
	cout << (x == 0 ? 1 : 0) << endl;
}

Measured memory_bytes: 3580
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
typedef vector<ll> vll;

#define INX(x) (cin >> x)
#define OUTX(x) (cout << x << endl)

#define ADD emplace_back
#define MP make_pair
#define VVEC(type) vector<vector<type>>

ll mypow(ll r, ll n)
{
    ll result = 1;
    for (ll i = 0; i < n; i++)
    {
        result *= r;
    }
    return result;
}

int main()
{
    ll N;
    INX(N);

    const ll num = 26;
    ll Ncp = N;
    ll tmp = num;
    ll keta = 0;
    while(Ncp > 0)
    {
        Ncp -= tmp;
        keta++;
        tmp *= num;
    }

    ll Ndash = N - (num * (1 - mypow(num, keta - 1)) / (1 - num)) - 1;
    const char chara = 'a';
    string result;
    result.resize(keta);
    result[keta] = NULL;
    for(ll i = mypow(num, keta - 1), j = 0; j < keta; i /= num, j++)
    {
        result[j] = chara + static_cast<char>(Ndash / i);
        Ndash = Ndash % i;
    }
    OUTX(result);

    return 0;
}


Measured memory_bytes: 3628
# include <bits/stdc++.h>
# define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
# define reps(i, n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(int i=((int)(n)-1); i>=0; --i)
# define rreps(i, n) for(int i=((int)(n)); i>0; --i)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define optimize_cin() cin.tie(0); ios::sync_with_stdio(false)
# define MSG(x) std::cout << #x << " : " << x << "\n";
using namespace std;
using lint = long long;
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; }

int main()
{
    int r = 0;
    cin >> r;
    cout << 3*r*r << endl;

    return 0;
}


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


int main(){
	//入力機構
	int N,K;
	std::cin>>N>>K;//K>=2
	std::vector<int> A(N,0);//配列はN個。intは100000(=N)以下を格納できる
	for(int i=0;i<N;i++){
		std::cin>>A[i];
	}

	//処理機構
	//A[]は1～Nを並べ替えたものなので、要素は全て1にしないといけない。
	//Aを1を除いてK-1個ずつ区切ると、そのまとまりをひとまとまりずつ1にすればよい
	//1を含むまとまりから始め、それからは隣のまとまりを1にしていく
	//つまり、答えは(N-1)/(K-1)を切り上げたもの
	int ans=(N-1+K-2)/(K-1);

	//出力機構
	std::cout<<ans<<std::endl;

	return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>
#include <chrono>
#include <random>
#include <functional>

using namespace std;

#define int long long
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define PI 3.14159265359

const int MOD = 1e9 + 7;
const int INF = 1e9 + 7;

template<int MOD> struct Fp {
    long long val;
    constexpr Fp(long long v = 0) noexcept : val(v % MOD) {
        if (val < 0) val += MOD;
    }
    constexpr int getmod() { return MOD; }
    constexpr Fp operator - () const noexcept {
        return val ? MOD - val : 0;
    }
    constexpr Fp operator + (const Fp& r) const noexcept { return Fp(*this) += r; }
    constexpr Fp operator - (const Fp& r) const noexcept { return Fp(*this) -= r; }
    constexpr Fp operator * (const Fp& r) const noexcept { return Fp(*this) *= r; }
    constexpr Fp operator / (const Fp& r) const noexcept { return Fp(*this) /= r; }
    constexpr Fp& operator += (const Fp& r) noexcept {
        val += r.val;
        if (val >= MOD) val -= MOD;
        return *this;
    }
    constexpr Fp& operator -= (const Fp& r) noexcept {
        val -= r.val;
        if (val < 0) val += MOD;
        return *this;
    }
    constexpr Fp& operator *= (const Fp& r) noexcept {
        val = val * r.val % MOD;
        return *this;
    }
    constexpr Fp& operator /= (const Fp& r) noexcept {
        long long a = r.val, b = MOD, u = 1, v = 0;
        while (b) {
            long long t = a / b;
            a -= t * b; swap(a, b);
            u -= t * v; swap(u, v);
        }
        val = val * u % MOD;
        if (val < 0) val += MOD;
        return *this;
    }
    constexpr bool operator == (const Fp& r) const noexcept {
        return this->val == r.val;
    }
    constexpr bool operator != (const Fp& r) const noexcept {
        return this->val != r.val;
    }
    friend constexpr ostream& operator << (ostream &os, const Fp<MOD>& x) noexcept {
        return os << x.val;
    }
    friend constexpr Fp<MOD> modpow(const Fp<MOD> &a, long long n) noexcept {
        if (n == 0) return 1;
        auto t = modpow(a, n / 2);
        t = t * t;
        if (n & 1) t = t * a;
        return t;
    }
};

using mint = Fp<MOD>;

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

  int A, B, C, D;
  cin >> A >> B >> C >> D;

  rep(i, 200){
    if(i%2 == 0){
      C -= B;
    }else{
      A -= D;
    }

    if(C <= 0){
      cout << "Yes" << endl;
      return 0;
    }
    if(A <= 0){
      cout << "No" << endl;
      return 0;
    }
  }

  return 0;
}


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

using namespace std;
using ll = long long;
typedef pair<int, int> ii;
typedef vector<ii> vii; 
typedef vector<int> vi;

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

	ll a; long double b;
	cin >> a >> b;
	
	ll c = (b * 100);
	cout << a * c / 100 << endl;
	
}

Measured memory_bytes: 3744
#include <bits/stdc++.h>
#define SORT(x) sort((x).begin(), (x).end())
#define ALL(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < n; i++)
#define reps(i, m, n) for (ll i = m; i < n; i++)
#define repr(i, m, n) for (ll i = m; i >= n; i--)
#define de(x) cout << #x << "=" << x << endl;
template <class T>
bool maxi(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool mini(T &a, const T &b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
#define INF2 1000000000000000037
#define INF 1000000007
#define MOD 1000000007
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
//--GLOBAL---------------------------------

//--MAIN-----------------------------------
void Main() {
    ll X; cin>>X;
    cout<< ( (X/100)*5>=X%100 ? 1 : 0 )<<"\n";
}   
//--START----------------------------------
int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
}
//-----------------------------------------


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

using namespace std;
#ifdef _DEBUG
#define _GLIBCXX_DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
#define ll long long
#define DBG 1
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define loop(n) rep(loop, (0), (n))
#define all(c) begin(c), end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
using pii = pair<int, int>;
// template<class T> ostream &operator<<(ostream &os,T &t){dump(t);return os;}
template <typename T, typename S>istream &operator>>(istream &is, pair<T, S> &p) { is >> p.first >> p.second; return is; }
//template <typename T, typename S>ostream &operator<<(ostream &os, pair<T, S> &p) {os << p.first << " " << p.second;return os;}

template <typename T> void printvv(const vector<vector<T>> &v) {
	cerr << endl;
	rep(i, 0, v.size()) rep(j, 0, v[i].size()) {
		if (typeid(v[i][j]).name() == typeid(INF).name() and v[i][j] == INF) {
			cerr << "INF";
		}
		else
			cerr << v[i][j];
		cerr << (j == v[i].size() - 1 ? '\n' : ' ');
	}
	cerr << endl;
}

#ifndef _DEBUG
#define printvv(...)
#endif
void YES(bool f) { cout << (f ? "YES" : "NO") << endl; }
void Yes(bool f) { cout << (f ? "Yes" : "No") << endl; }
template <class T, class U>bool chmin(T& a, U b) { if (a > b) { a = b; return true; }return false; }
template <class T, class U>bool chmax(T& a, U b) { if (a < b) { a = b; return true; }return false; }
//約数を求める 未ソート
vector<int> divisor(int x) {
	vector<int> ret;
	int i;
	for (i = 1; i * i < x; i++) {
		if (x % i)
			continue;
		ret.emplace_back(i);
		ret.emplace_back(x / i);
	}
	if (i * i == x)
		ret.emplace_back(i);
	return ret;
}

signed main(signed argc, char *argv[]) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(12);

	int N; cin >> N;

	unordered_set<int>ms;

	auto ds = divisor(N);
	dump(ds);
	for (int q : ds) {
		int m = N / q - 1;
		if (N == m * q + q and q<m and m>0) {
			ms.insert(m);
		}
	}
	dump(ms);
	int ans = 0;
	for (auto x : ms) {
		ans += x;
	}
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 512
var
        i,k:longint;
        n:ansistring;
begin
        readln(n);
        for i:=1 to length(n) do
            if k=0 then begin if n[i]='C' then inc(k); end
            else if k=1 then begin if n[i]='F' then inc(k); end
            else break;
        if k=2 then writeln('Yes')
        else writeln('No');
end.

Measured memory_bytes: 128
import sys
input=sys.stdin.readline
from collections import defaultdict
from math import gcd

def main():
    mod=1000000007
    n=int(input())
    AB=[tuple(map(int,input().split())) for _ in range(n)]
    Cnt=defaultdict(int)
    zero=0
    for a,b in AB:
        if a==0 and b==0:
            zero+=1
        elif a==0:
            Cnt[(0,1)]+=1
        elif b==0:
            Cnt[(1,0)]+=1
        elif b!=0 and a>0:
            Cnt[(a//gcd(a,b),b//gcd(a,b))]+=1
        else: #b!=0 and a<0:
            Cnt[(-a//gcd(a,b),-b//gcd(a,b))]+=1
    ans=1
    for Key in list(Cnt.keys()):
        if Key!=(0,1) and Key!=(1,0):
            a,b=Key
            if b>0:
                ans*=pow(2,Cnt[Key],mod)+pow(2,Cnt[(b,-a)],mod)-1
                ans%=mod
                Cnt[(b,-a)]=0
            else:
                ans*=pow(2,Cnt[Key],mod)+pow(2,Cnt[(-b,a)],mod)-1
                ans%=mod
                Cnt[(-b,a)]=0
            Cnt[Key]=0
        else:
            ans*=pow(2,Cnt[(0,1)],mod)+pow(2,Cnt[(1,0)],mod)-1
            ans%=mod
            Cnt[(0,1)],Cnt[(1,0)]=0,0
    print((ans-1+zero)%mod)
    
if __name__=='__main__':
    main()

Measured memory_bytes: 152424
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <string.h>
#include <string>
#include <vector>
#include <limits.h>
#include <stack>
#include <queue>
#include<cstdlib>
#define maxn 10000000
#define pi acos(-1)
using namespace std;
int a[100007];
int b[50007];
int n,q,ans;
int linearSearch(int x)
{
	int i=0;
	a[n]=x;
	while(a[i]!=x)i++;
	if(i>=n)return 0;
	return 1;
}
int binarySearch(int x)
{
	int l=0,r=n,mid;
	while(l<r)
	{
		mid=(l+r)/2;
		if(a[mid]==x)return 1;
		else if(x<a[mid])r=mid;
		else l=mid+1;
	}
	return 0;
}
int main(){
	ans=0;
	cin>>n;
	for(int i=0;i<n;i++)cin>>a[i];
	cin>>q;
	for(int i=0;i<q;i++)cin>>b[i];
	for(int i=0;i<q;i++)
	{
		ans+=binarySearch(b[i]);
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 3660
#include <stdio.h>
#define MAX 50
int fibonacci(int);
int F[MAX];
int main(){
        int i, n=0;
        scanf("%d", &n);
        for(i=0; i<MAX; i++) {
                F[i] = -1;
        }
        printf("%d\n", fibonacci(n));
        return 0;
}


int fibonacci(n){
        if(n == 0||n == 1) {
                return F[n] = 1;
        }
        if(F[n]!=-1) {
                return F[n];
        }
        return F[n] = fibonacci(n-2) + fibonacci(n-1);
}

Measured memory_bytes: 596
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;
 


public class Main {
	static int a1[]= {0,-1,0,1};
	static int b1[]= {-1,0,1,0};
	private static Scanner sc = new Scanner(System.in);
	//result = Math.pow(num1, num3)
	//StringBuffer str = new StringBuffer(hoge1);
	//String hoge2 = str.reverse().toString();
	//map.containsKey(A)

	//Map<String, Integer> map = new HashMap<String, Integer>(n);
	/*for ( キーのデータ型 key : マップの名前.keySet() ) {
		データのデータ型 data = マップの名前.get( key );
		
		// keyやdataを使った処理;
	}*/
	//int i = Integer.parseInt(s);
	//Queue<String> qq=new ArrayDeque<>(); //add,poll,peek
	//Deque<String> qq=new ArrayDeque<>();//push,pop,peek
	//ArrayList<String> cc = new ArrayList<>(n);
	//Collections.sort(list);
	//Array.sort(list);   cc.contains(tmp)
	//Arrays.asList(c).contains("a")
	//list.set(1,"walk");
	public static void main(String[] args) {
		int N=sc.nextInt();
		long X=sc.nextLong();
		ArrayList<Integer> cc = new ArrayList<>(N);
		long sum=0;
		for(int i=0;i<N;i++) {
			cc.add(sc.nextInt());
			sum+=cc.get(i);
		}
		boolean a=true;
		if(sum==X) {
			p(N);
			a=false;
		}
		Collections.sort(cc);
		long ans=0;
		int ctn=0;
		for(int i:cc) {
			if(i<=X) {
				X-=i;
				ctn++;
				if(i==cc.get(cc.size()-1)) {
					if(X>0)ctn--;
				}
			}
			
		}
		if(a) {
			//if(ctn==X)p(ctn-1);
			 p(ctn);
		}
	}
	static void p(String ans) {System.out.println(ans);};
	static void p(int ans) {System.out.println(ans);};
	static void p() {System.out.println();};
	static void p(long ans) {System.out.println(ans);};
	static void p(double ans) {System.out.println(ans);};
}
	


Measured memory_bytes: 22996
#include <cstdio>
#include <cctype>
#include <algorithm>
#define repu(i,x,y) for (int i=x; i<=y; ++i)
using namespace std;

typedef long long LL;
int n,fa[100100],top,stk[4000000][2],s[100100];
struct edge
{
    int v;
    edge *nxt;
} poole[400100],*tpe=poole,*fste[100100];
struct data
{
    int u,v;
    data *nxt;
} pool[8000000],*tp=pool,*fst[530000];

int getint()
{
    char ch;
    while (!isdigit(ch=getchar()));
    int x=ch-'0';
    for (; isdigit(ch=getchar()); x=x*10+ch-'0');
    return x;
}

int find(int x)
{
    if (fa[x]==x)
        return x;
    return fa[x]=find(fa[x]);
}

void insert(int u,int v)
{
    if (u>v)
        swap(u,v);
    int t=(LL(u)*n+v)&524287;
    for (data *i=fst[t]; i; i=i->nxt)
        if (i->u==u && i->v==v)
        {
            stk[++top][0]=u,stk[top][1]=v;
            return;
        }
    *tp=(data){u,v,fst[t]},fst[t]=tp++;
}

void erase(int u,int v)
{
    if (u>v)
        swap(u,v);
    int t=(LL(u)*n+v)&524287;
    data **lst=&fst[t];
    for (data *i=fst[t]; i; lst=&i->nxt,i=i->nxt)
        if (i->u==u && i->v==v)
        {
            *lst=i->nxt;
            return;
        }
}

int main()
{
    n=getint();
    repu(i,1,n*2-2)
    {
        int u=getint(),v=getint();
        *tpe=(edge){v,fste[u]},fste[u]=tpe++;
        *tpe=(edge){u,fste[v]},fste[v]=tpe++;
        insert(u,v),++s[u],++s[v];
    }
    repu(i,1,n)
        fa[i]=i;
    repu(j,1,n-1)
    {
        int u,v;
        while (1)
        {
            u=stk[top][0],v=stk[top][1];
            if (!top--)
            {
                puts("NO");
                return 0;
            }
            if (find(u)==u && find(v)==v)
                break;
        }
        if (s[u]>s[v])
            swap(u,v);
        s[v]+=s[u],fa[u]=v;
        for (edge *i=fste[u],*t; i; i=t)
        {
            t=i->nxt,erase(u,find(i->v));
            if (fa[i->v]!=v)
                insert(v,fa[i->v]),i->nxt=fste[v],fste[v]=i;
        }
    }
    puts("YES");
    return 0;
}

Measured memory_bytes: 20992
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int q = sc.nextInt();
		char[] acgt = sc.next().toCharArray();
		int[] cArray = new int[n];
		int count = 0;

		for (int i = 0; i < n - 1; i++) {
			if (acgt[i] == 'A' && acgt[i + 1] == 'C') {
				count++;
			}
			cArray[i + 1] = count;
		}

		for (int j = 0; j < q; j++) {
			int l = sc.nextInt() - 1;
			int r = sc.nextInt() - 1;
			System.out.println(cArray[r] - cArray[l]);
		}
		sc.close();
	}
}


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

int main(){
	int n; cin >> n;
	string s;
	double money;
	double ans = 0;
	for(int i = 0; i < n; ++i){
		cin >> money >> s;
		if(s == "JPY") ans += money;
		else ans += 380000.0 * money;
	}
	cout << fixed;
	cout << setprecision(6);
	cout << ans << endl;
}


Measured memory_bytes: 256
program bite_eating
  implicit none
  integer :: n, l, m, s, i
  read(*,*) n, l
  m = 1000000
  s = 0
  do i = 1, n
    if (abs(m).gt.abs(l+i-1)) m = l+i-1
    s = s+l+i-1
  end do
  write(*,'(i0)') s-m
  stop
end program bite_eating

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;using ll=int_fast64_t;using ld=long double;using pll=pair<ll,ll>;constexpr ll INF=1LL<<60,MOD=1e9+7;//998244353;
void solve();int main(){cin.tie(nullptr);ios::sync_with_stdio(false);cout<<fixed<<setprecision(10);solve();return 0;}
#define SELECTOR(_1,_2,_3,_4,SELECT,...) SELECT
#define rep(...) SELECTOR(__VA_ARGS__,_rep2,_rep1,_rep0)(__VA_ARGS__)
#define _rep0(i,n) for(ll i=0;i<n;++i)
#define _rep1(i,k,n) for(ll i=k;i<n;++i)
#define _rep2(i,k,n,d) for(ll i=k;d>0?i<n:i>n;i+=d)
#define endl "\n"
#ifdef __LOCAL
#include "ostreams.h"
#endif
template<class T> inline bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T &a,const T &b){if(a>b){a=b;return 1;}return 0;}
template<class T> vector<T> make_vector(size_t a,T b){return vector<T>(a,b);}
template<class... Ts> auto make_vector(size_t a,Ts... ts){return vector<decltype(make_vector(ts...))>(a,make_vector(ts...));}
void print(){cerr<<endl;} template<class T,class... Ts> void print(const T& a,const Ts&... ts){cerr<<a<<' ';print(ts...);}

void solve(){
    ll n; cin >> n;
    vector<ll> A(n);
    rep(i, n) cin >> A[i];

    ll res = INF;
    rep(x, -100, 101){
        ll score = 0;
        for(auto a : A){
            score += (x - a) * (x - a);
        }
        chmin(res, score);
    }

    cout << res << endl;
}

Measured memory_bytes: 256
import heapq
def dijkstra_heap(s):
    d = [float("inf")] * n
    used = [True] * n 
    d[s] = 0
    used[s] = False
    edgelist = []
    for e in edge[s]:
        heapq.heappush(edgelist,e)
    while len(edgelist):
        minedge = heapq.heappop(edgelist)
        if not used[minedge[1]]:
            continue
        v = minedge[1]
        d[v] = minedge[0]
        used[v] = False
        for e in edge[v]:
            if used[e[1]]:
                heapq.heappush(edgelist,[e[0]+d[v],e[1]])
    return d
import sys
input = sys.stdin.readline
n =int(input())

edge = [[] for i in range(n)]
#edge[i] : [weght,to]
for i in range(n-1):
    a, b, c = map(int,input().split())
    a, b = a-1, b-1
    edge[a].append([c,b])
    edge[b].append([c,a]) 
q, k = map(int, input().split())
k = k-1
d = dijkstra_heap(k)
for i in range(q):
  x, y = map(int, input().split())
  x, y = x-1, y-1
  print(d[x]+d[y])

Measured memory_bytes: 100272
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <stdio.h>
#include <stdlib.h>

using namespace std;
//DP用
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 long long INF = 1LL << 60;

int main() {
    int a,b;
    cin >> a >> b;
    int ans;
    if(a+b == 3)
        ans = 3;
    if(a+b == 4)
        ans = 2;
    if(a+b == 5)
        ans = 1;
    cout << ans;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <math.h>
#include <cassert>
#define rep(i,n) for(int i = 0; i < n; ++i )
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
  int n,k,c; string s;
  cin >> n >> k >> c >> s;

  vector<int> l,r;
  int i = 0;
  while(l.size()<k){
    if(s[i]=='o') { 
      l.push_back(i);
      i += c+1;
    } else {
      ++i;
    }
  }
  reverse(s.begin(),s.end());

  i = 0;
  while(r.size()<k){
    if(s[i]=='o') { 
      r.push_back(n-1-i);
      i += c+1;
    } else {
      ++i;
    }
  }
  reverse(r.begin(),r.end());
  
  rep(i,k) if(l[i]==r[i]) printf("%d\n", l[i]+1);  
}


Measured memory_bytes: 3444
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ii = pair<int, int>;
#define sz(x) (int)(x).size()
/* --- */
int main() {
int min=200010,n,j,count=0;
cin>>n;
for(int i =0; i<n; i++)
{
	cin>>j;
	if(j<=min)	
	{
		count++;
		min=j;
	}
}
cout<<count<<endl;
}


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

int m, d;

int main() {
	scanf("%d %d", &m, &d);
    int ans = 0;
    for (int i = 1; i <= m; i ++) {
        for (int j = 10; j <= d; j ++) {
            int f = j / 10, s = j % 10;
            if (f < 2 || s < 2) continue;
            if (f * s == i) ans ++;
        }
    }
    printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main (){
int x,y;
cin >> x >> y;
if(x==y) cout << "Draw";
else if (x==1)  cout << "Alice";
else if (y==1) cout << "Bob";
else if(x> y) cout << "Alice";
else if (x<y) cout << "Bob";
 return 0;}

Measured memory_bytes: 256
#include <bits/stdc++.h>
   
  #define TRACE(x) cerr << #x << " = " << x << endl
  #define pb push_back
  #define mp make_pair
  #define fi first
  #define se second
   
  #define SZ(x) (int)(x).size()
   
  using namespace std;
   
  typedef unsigned long long ll;
  typedef pair<int, int> pii;
   
  template<class Num>
  Num mabs(Num A){
    if(A < 0) return -A;
    return A;
  }
  
  const int N = 2e5 + 10;
  
  int n;
  pii cord[N];
  int suma[N], razxy[N], razyx[N];
  
  int main(){
    scanf("%d", &n);
    
    for(int i = 0; i < n; i++){
      scanf("%d %d", &cord[i].fi, &cord[i].se);
    }
    
    sort(cord, cord + n);
    
    for(int i = 0; i < n; i++){
      suma[i] = cord[i].fi + cord[i].se;
      razxy[i] = cord[i].fi - cord[i].se;
      razyx[i] = cord[i].se - cord[i].fi;
    }
    
    sort(suma, suma + n);
    sort(razxy, razxy + n);
    sort(razyx, razyx + n);
    
    int ans = 0;
    for(int i = 0; i < n; i++){
      ans = suma[n - 1] - suma[i];
      ans = max(ans, razyx[i] + razxy[i]);
      ans = max(ans, razxy[i] + razyx[n - 1]);
      ans = max(ans, suma[i] - suma[0]);
    }
    
    printf("%d\n", ans);
    
    return 0;
  }


Measured memory_bytes: 7732
#include<bits/stdc++.h>
#define mod 1000000007
#define int long long int
#define phi 1.6180339
#define rep(i,n) for(auto i=0;i<(n);i++)
#define endl "\n"
#define For(i,a,b) for(auto i=(a);i<(b);i++)
#define op1 cin.tie(NULL)
#define op2 cout.tie(NULL)
#define op3 std::ios_base::sync_with_stdio(false)
#define MAXX 1000001
using namespace std;
vector<int> arr(MAXX);
void trozen()
{
    int n;
    cin>>n;
    vector<int> v1(n);
    for(auto &i:v1) cin>>i;
    int ans=INT_MAX;
    for(int i=0;i<n;i++)
    {
        int s1=0,s2=0;
        for(int k=0;k<=i;k++)
            s1+=v1[k];
        for(int k=i+1;k<n;k++)
            s2+=v1[k];
        ans=min(ans,abs(s1-s2));
    }
    cout<<ans<<endl;
}
int32_t main()
{
    op1;op2;op3;
    /*#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif*/
    trozen();
    return 0;
}


Measured memory_bytes: 10984
#include<iostream>
#include<vector>
#include<algorithm>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>
#include<climits>
#include<set>


using namespace std;
typedef pair<int, int> pii;
typedef long long int ll;
typedef pair<ll, ll> pll;
int dx[4] = { 1,0,0,-1 };
int dy[4] = { 0,1,-1,0 };

#define ARRAY_MAX 100005

const ll INF = 1e9 + 7;
const ll MOD = 1e9 + 7;

//約数の列挙
template<typename T>
vector<T> divisor(T n) {
	vector<T> res;
	for (T i = 1; i * i <= n; i++) {
		if (n % i == 0) {
			res.push_back(i);
			if (i != n / i) {
				res.push_back(n / i);
			}
		}
	}
	return res;
}

int main() {

	int n;
	cin >> n;
	vector<int> a(n);
	int maxi = 0;
	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
		maxi = max(maxi, a[i]);
	}

	vector<int> div = divisor(maxi);

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

	int ans = 0;
	for (int i = 0; i < n; i++)
	{
		auto itr = lower_bound(div.begin(), div.end(), a[i]);
		ans += (*itr - a[i]);
	}
	cout << ans << endl;
}


Measured memory_bytes: 3188
"use strict";

const main = arg => {
    const input = arg.trim().split("\n");
    let card = []
    for(let i = 0; i<3; i++){
        let tmp = input[i].split(" ").map(el => parseInt(el))
        card.push(tmp)
    }
    const N = parseInt(input[3]);
    let nums = []
    for(let i = 4; i<3+1+N;i++){
        let b = parseInt(input[i])
        for(let i = 0; i<3; i++){
            for(let j=0; j<3; j++){
                if(card[i][j] == b) card[i][j] = true
            }
        }
    }
    // raw
    for(let i = 0;i<3;i++){
        if(card[i][0] === true && card[i][1] === true && card[i][2] === true){
            console.log("Yes")
            return
        }
    }

    for(let i = 0; i<3;i++){
        if(card[0][i] ===true && card[1][i] === true && card[2][i] === true ){
            console.log("Yes")
            return
        }
    }
    // cross
    if(card[0][0] === true && card[1][1] === true && card[2][2] === true){
        console.log("Yes")
        return
    }
    if(card[2][0] === true && card[1][1] === true && card[0][2] === true){
        console.log("Yes")
        return
    }
    console.log("No")
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));  

Measured memory_bytes: 7372
//Author:- mr_gamer
//C++ is my favorite programming language!!


#include<bits/stdc++.h>
#define ll long long int
using namespace std;

ll power(ll x,ll y)
{
    ll res = 1;
    while(y>0){
        if(y&1)
            res *= x;
        y>>=1;
        x*=x;
    }
    return res;
}

int main()
{
    int n;
    cin>>n;
    cout << power(n,3)<< '\n';
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,n1,n2) for(int i=n1;i<n2;i++)
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

typedef long long int ll;
typedef pair<ll,ll> Pi;
const int INF=(ll)(1LL<<31)-1;
const ll INFl=(ll)9223372036854775807;
const int MAX=10000;
const ll MOD=(ll)1e9+7;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a, b)*b;}
//int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int n,m;
int a[110],b[110];
vector<pair<int,int> > ans;

int main(){
	while(1){
		cin>>n>>m;
		int suma=0,sumb=0;
		if(n==0&&m==0)break;
		for(int i=0;i<n;i++){
			cin>>a[i];
			suma+=a[i];
		}
		sort(a,a+n);
		for(int i=0;i<m;i++){
			cin>>b[i];
			sumb+=b[i];
		}
		sort(b,b+m);
		if(abs(suma-sumb)%2==1){
			ans.push_back(pair<int,int>(-1,-1));
			continue;
		}
		int t=(suma-sumb)/2;
		pair<int,int> PP;
		int bs=INF;
		for(int i=0;i<n;i++){
			for(int j=0;j<m;j++){
				if(a[i]-b[j]==t){
					if(bs>(a[i]+b[j])){
						bs=min(a[i]+b[j],bs);
						PP=pair<int,int>(i,j);
					}
				}
				
			}
		}
		
		if(bs!=INF){
			ans.push_back(pair<int,int>(a[PP.first],b[PP.second]));
			//cout<<a[PP.first]<<" "<<b[PP.second]<<endl;
		}else{
			ans.push_back(pair<int,int>(-1,-1));
		//cout<<-1<<endl;
		}
		A:;
	}
	for(int i=0;i<ans.size();i++){
		if(ans[i].first==-1&&ans[i].second==-1){
			cout<<-1<<endl;
		}else{
			cout<<ans[i].first<<" "<<ans[i].second<<endl;
		}
	}
}


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

using namespace std;

typedef long long ll;

template<typename T>
void _dump(const char* s, T&& head)
{
  cerr << s << "=" << head << endl;
}

template<typename T, typename... Args>
void _dump(const char* s, T&& head, Args&&... tail)
{
  while (*s != ',')
    cerr << *s++;
  cerr << "=" << head << ",";
  _dump(s + 1, tail...);
}

template<typename T>
void _dumpv(const char* s, T&& v)
{
  cerr << *s << "=";
  for (auto it = v.begin(); it != v.end(); it++) {
    cerr << *it << " ";
  }
  cerr << endl;
}

#define dump(...) _dump(#__VA_ARGS__, __VA_ARGS__)
#define dumpv(...) _dumpv(#__VA_ARGS__, __VA_ARGS__)

const ll MOD = 1000000007;

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  // freopen("template.1", "r", stdin);

  int A, B, C;
  cin >> A >> B >> C;
  int ans;
  ans = min(B / A, C);
  dump(ans);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<string>
#include<stack>
#include<cstdio>
#include<cmath>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<int,P> P1;

#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define rep(i,x) for(int i=0;i<x;i++)
#define rep1(i,x) for(int i=1;i<=x;i++)
#define rrep(i,x) for(int i=x-1;i>=0;i--)
#define rrep1(i,x) for(int i=x;i>0;i--)
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define uniq(vec) vec.erase(unique(vec.begin(),vec.end()),vec.end())
#define mp1(a,b,c) P1(a,P(b,c))

const int INF=1000000000;
const int dir_4[4][2]={{1,0},{0,1},{-1,0},{0,-1}};
const int dir_8[8][2]={{1,0},{1,1},{0,1},{-1,1},{-1,0},{-1,-1},{0,-1},{1,-1}};

int main(){
	int cnt = 0;
	string s;
	cin >> s;
	for(int i = 0 ; i+1 < s.size() ; i ++){
		if(s[i] != s[i+1])cnt ++;
	}
	cout << cnt << endl;
}



Measured memory_bytes: 512
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-9;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

int n;
double t,a;

int main(){
	cin>>n>>t>>a;
	double m=inf;
	int res;
	for(int i=0;i<n;i++){
		double h;
		cin>>h;
		double x=t-0.006*h;
		if(fabs(x-a)<m){
			m=fabs(x-a);
			res=i;
		}
	}
	cout<<res+1<<endl;
}

Measured memory_bytes: 256
n=int(input())
s=input()
a=[0]*(200010)
b=[0]*(200010)
w=[0]*(200010)
for i in range(n):
  if(s[i]=='.'):
    a[i]+=1
for i in range(n):
  b[i+1]=b[i]
  w[i+1]=w[i]
  if(a[i]==1):
    w[i+1]+=1
  else:
    b[i+1]+=1
ans=n
for i in range(n+1):
  ans=min(ans,b[i]+(w[n]-w[i]))
print(ans)

Measured memory_bytes: 14332
W, a, b = map(int, input().split())

A = a + W
if b > a:
    if b - A <= 0:
        print(0)
    else:
        print(b - A)
else:
    B = b + W
    if a - B <= 0:
        print(0)
    else:
        print(a-B)


Measured memory_bytes: 2940
A, B, K = map(int, input().split())
n = 0
N = min(A, B)
for i in range(100):
    m = N-i
    if A % m == 0 and B % m == 0:
        n += 1
    else:
        pass
    
    if n == K:
        ans = m
        break

print(ans)

Measured memory_bytes: 3060
n = gets.to_i
as = gets.split.map(&:to_i).sort

ans = 0
now = 0
(0..n-2).each do |i|
  a = as[i]
  now += a
  if now * 2 >= as[i+1]
    ans += 1
  else
    ans = 0
  end
end
puts ans + 1


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

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define watch(a) { cout << #a << " = " << a << endl; }
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }

typedef long long ll;
int const inf = 1<<29;

int main() {

  int N;
  string S;

  cin >> S;
  N = S.size();
  bool ok1 = 0, ok2 = 0;
  rep(i, N) {
    ok1 |= S[i] == 'C';
    ok2 |= S[i] == 'F' && ok1;
  }

  cout << (ok2 ? "Yes" : "No") << endl;
  
  return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define REP(i,n,N) for(int i=n;i<N;i++)
#define p(S) cout<<(S)<<endl
#define ck(a,b) (0<=(a)&&(a)<(b))

using namespace std;

int main(){
	int n;
	cin>>n;
	string s;
	stack<int> st;
	bool flag=true;
	REP(i,0,n){
		cin>>s;
		if(s=="A") st.push(1);
		else{
			if(st.empty()){
				flag=false;
				break;
			}
			st.pop();
		}
	}
	if(!flag) 	p("NO");
	else		p(st.empty()?"YES":"NO");

	return 0;
}

Measured memory_bytes: 3152
#include <bits/stdc++.h>
using namespace std;
#define INF_LL 1LL << 40
#define INF 2000000000
#define MOD 1000000007
#define ll long long
#define all(x) x.begin(), x.end()
#define REP(i, a, b) for(int i = a; i < b; i++)
#define rep(i, n) REP(i, 0, n)
#define prique priority_queue
#define double float
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<P> vp;
typedef vector<ll> vl;
typedef vector<vector<int>> matrix;
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};
int sign[2] = {1, -1};
template <class T> bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}
struct edge {
    int to, cost;
};

int main() {
    int n;
    cin >> n;
    cout << (n - 1) / 2 << endl;
}


Measured memory_bytes: 256