akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;   
#define ordered_set tree<ll, null_type,less_equal<ll>, rb_tree_tag,tree_order_statistics_node_update> 
#define PI 3.14159265
#define ll long long
#define ld long double
#define vi vector<int>
#define pb push_back
#define vll vector<ll>
#define vvi vector < vi >
#define pii pair<int,int>
#define pll pair<long long, long long>
#define mod 1000000007
#define inf 300000000000000001
#define infx 9223372036854775806
#define all(c) c.begin(),c.end()
#define mk(x,yy) make_pair(x,y)
#define mem(a,val) memset(a,val,sizeof(a))
#define eb emplace_back
#define ff first
#define ss second
#define re return
// #define endl "\n"
#define max2(x,y)           (x>y)?x:y
#define min2(x,y)           (x<y)?x:y
#define mid(s,e)               (s+(e-s)/2)
#define mini                   INT_MIN
#define maxo                   INT_MAX
#define rep(i,a,b) for(int i=a;i<(int)(b);++i)
#define read(a,n) for(int i=0;i<n;i++)cin>>a[i]
#define show(a,n) for(int i=0;i<n;i++)cout<<a[i]<<' ';cout<<endl
#define ene cout<<"\n";

ll gcd(ll a, ll b) 
{ 
    if (b == 0) 
        return a; 
    return gcd(b, a % b);  
      
}
ll power(ll x,  ll y, ll p) 
{ 
    ll res = 1;      // Initialize result 
  
    x = x % p;  // Update x if it is more than or  
                // equal to p 
  
    while (y > 0) 
    { 
        // If y is odd, multiply x with result 
        if (y & 1) 
            res = (res*x) % p; 
  
        // y must be even now 
        y = y>>1; // y = y/2 
        x = (x*x) % p;   
    } 
    return res; 
} 
 
bool compr(std::vector<ll> a, std::vector<ll> b)
{
    if(a[0]==b[0])
        return a[1]<b[1];
    else
        return a[0]<b[0];
}

bool comp(std::vector<ll> a, std::vector<ll> b)
{
    if(a[1]==b[1]&&a[2]==b[2])
        return a[0]<b[0];
    else if(a[1]==b[1])
        return a[2]>b[2];
    else
        return a[1]<b[1];
}
ll dp[100005] = {};
ll pre[100005] = {};
int main()
{
    #ifdef SHIVANSH 
     freopen("input.txt","r",stdin);
     freopen("output.txt","w",stdout);
    #endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n;
    cin>>n;
    ll a[n];
    for(ll i=0;i<n;i++)
        cin>>a[i];
    ll dp[n][n];
    ll dp2[n][n];
    for(ll i=0;i<n;i++)
    {
        dp[i][i] = a[i];
        dp2[i][i] = 0;
    }
    for(ll i=0;i<n-1;i++)
    {
        dp[i][i+1] = a[i]+a[i+1];
        dp2[i][i+1] = a[i]+a[i+1];
    }

    for(ll gap = 2;gap<n;gap++)
    {
        for(ll i=0;i<n-gap;i++)
        {
            ll mn = inf;
            ll mn2 = inf;
            for(ll j = i+1;j<=i+gap;j++)
            {
                ll tmp1 = dp[i][j-1];
                ll tmp2 = dp[j][i+gap];
                ll tc = tmp1+tmp2+dp2[i][j-1]+dp2[j][i+gap];
                if(tc<mn2)
                {
                    mn2 = tc;
                    mn = dp[i][j-1] + dp[j][i+gap];
                }
            }
            dp[i][i+gap] = mn;
            dp2[i][i+gap] = mn2;
        }
    }
    cout<<dp2[0][n-1]<<endl;
}

Measured memory_bytes: 6120
#include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
#include <string>
#include <cmath>
#include <algorithm>

using namespace std;

#define pb push_back
#define mp make_pair
#define ff first
#define ss second

typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> pii;
typedef vector<pii> vii;
typedef priority_queue<ll> pq;

const int MOD = 1e9+7;
const int INF = 2e9;
const ll INFL = 9e18;

int main() {
  int N, M; cin >> N >> M;
  vi Xs(M), diff(M-1);
  for (int i = 0; i < M; i++) {
    cin >> Xs[i];
  }
  sort(Xs.begin(), Xs.end());
  for (int i = 0; i < M - 1; i++) {
    diff[i] = Xs[i+1] - Xs[i];
  }
  sort(diff.begin(), diff.end());
  ll ans = 0;
  for (int i = 0; i < max(0, M - N); i++) {
    ans += diff[i];
  }
  cout << ans << endl;
  return 0;
}


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

int g[15][15];
const int mod = 1000000007;

int main() {
    string s;
    cin >> s;
    int ans;
    if (s == "SUN") ans = 7;
    if (s == "MON") ans = 6;
    if (s == "TUE") ans = 5;
    if (s == "WED") ans = 4;
    if (s == "THU") ans = 3;
    if (s == "FRI") ans = 2;
    if (s == "SAT") ans = 1;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3552
import unittest
from io import StringIO
import sys


def input():
    return sys.stdin.readline().rstrip()


def resolve():
    A, B = map(int, input().split())
    ans = A-2*B
    if ans > 0:
        print(ans)
    else:
        print("0")


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """12 4"""
        output = """4"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """20 15"""
        output = """0"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """20 30"""
        output = """0"""
        self.assertIO(input, output)


if __name__ == "__main__":
    resolve()


Measured memory_bytes: 52208
H,W = map(int,input().split())
S = ["."*(W+2)]
for _ in range(H):
    a = input().strip()
    a = "."+a+"."
    S.append(a)
S.append("."*(W+2))
flag = 0
for i in range(1,H+1):
    for j in range(1,W+1):
        if S[i][j]=="#":
            if S[i][j+1]=="." and S[i-1][j]=="." and S[i][j-1]=="." and S[i+1][j]==".":
                flag = 1
                break
    if flag==1:break
if flag==0:
    print("Yes")
else:
    print("No")

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define all(obj) (obj).begin(), (obj).end()
#define rall(obj) (obj).rbegin(), (obj).rend()
#define collect(arr, size) rep(i,size) cin >> arr[i];
#define int long long

signed main(){
    int N; cin >> N;
    int total = 0;
    int most_expensive = -1;
    rep(i,N){
        int p; cin >> p;
        total += p;
        most_expensive = max(most_expensive, p);
    }
    cout << total - most_expensive/2 << endl;
}

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

int N;
pair <long long, long long> A[200005];

pair <pair <int, int>, pair <int, int> > Exp[200005];

char S[1005];

int Matrix[105][105];

int add = 40;

pair <int, int> desc(long long x){
    pair <int, int> ans = make_pair(0, 0);
    while(x % 2 == 0){
        ans.first++;
        x /= 2;
    }
    while(x % 5 == 0){
        ans.second++;
        x /= 5;
    }

    return ans;
}

void Read(){
    cin >> N;
    cin.get();
    for(int i = 1; i <= N; i++){
        cin.getline(S + 1, 1005);
        long long up = 0, down = 1;
        bool after = 0;
        for(int j = 1; S[j]; j++){
            if(S[j] == '.')
                after = true;
            else{
                up = up * 10 + S[j] - '0';
                if(after)
                    down *= 10;
            }
        }
        A[i] = make_pair(up, down);
        Exp[i] = make_pair(desc(up), desc(down));
    }
}

void Solve(){
    long long ans = 0;
    for(int i = 1; i <= N; i++){
        int diff1 = Exp[i].first.first - Exp[i].second.first;
        int diff2 = Exp[i].first.second - Exp[i].second.second;
        for(int k = 0; k <= diff1 + add; k++)
            for(int p = 0; p <= diff2 + add; p++)
                ans += Matrix[k][p];
        Matrix[-diff1 + add][-diff2 + add]++;

    }

    cout << ans << '\n';
}

int main()
{
    Read();
    Solve();
    return 0;
}


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

int main() {
  int A,B,C;
  cin >> A >> B >> C;
  if(A+B+C==17&&A*B+B*C+C*A==95&&A*B*C==175){
    cout << "YES" << endl;
  }else{
    cout << "NO" << endl;
  }
}

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

int main(){
  int H, W;
  cin >> H >> W;

  vector<vector<int>> val(H, vector<int>(W));
  for(int h = 0; h < H; h++){
    for(int w = 0; w < W; w++){
      int a;
      cin >> a;
      val[h][w] = a;
    }
  }
  for(int h = 0; h < H; h++){
    for(int w = 0; w < W; w++){
      int b;
      cin >> b;
      val[h][w] -= b;
    }
  }

  vector<vector<vector<bool>>> dp(H, vector<vector<bool>>(W, vector<bool>(160 * 80 * 2 + 1)));
  dp[0][0][abs(val[0][0])] = true;
  for(int h = 0; h < H; h++){
    for(int w = 0; w < W; w++){
      for(int x = 0; x <= (H + W) * 80; x++){
	if(h > 0){
	  dp[h][w][abs(x - val[h][w])] = dp[h][w][abs(x - val[h][w])] || dp[h - 1][w][x];
	  dp[h][w][abs(x + val[h][w])] = dp[h][w][abs(x + val[h][w])] || dp[h - 1][w][x];
	}
	if(w > 0){
	  dp[h][w][abs(x - val[h][w])] = dp[h][w][abs(x - val[h][w])] || dp[h][w - 1][x];
	  dp[h][w][abs(x + val[h][w])] = dp[h][w][abs(x + val[h][w])] || dp[h][w - 1][x];
	}
      }
    }
  }
  for(int x = 0; x <= H * W * 80; x++){
    if(dp[H - 1][W - 1][x]){
      cout << x << endl;
      return 0;
    }
  }
						      
}


Measured memory_bytes: 22528
#include <iostream>
#include <string>
using namespace std;
int main()
{
  string S;
  cin >> S;
  cout << S;
  if (S[S.length()-1]=='s') {
    cout << "es" << endl;
  } else {
    cout << "s" << endl;
  }
  return 0;
}


Measured memory_bytes: 3568
def read_input():
    h, w = map(int, input().split())

    return h, w

def short_divide(h, w):
    long_side = max(h, w)
    short_side = min(h, w)

    short1 = short_side // 3
    short2 = (short_side - short1) // 2
    short3 = short_side - short1 - short2

    block1 = short1 * long_side
    block2 = short2 * long_side
    block3 = short3 * long_side

    return max(block1, block2, block3) - min(block1, block2, block3)


def long_divide(h, w):
    long_side = max(h, w)
    short_side = min(h, w)

    long1 = long_side // 3
    long2 = (long_side - long1) // 2
    long3 = long_side - long1 - long2

    block1 = long1 * short_side
    block2 = long2 * short_side
    block3 = long3 * short_side

    return max(block1, block2, block3) - min(block1, block2, block3)


def long_first(h, w):
    long_side = max(h, w)
    short_side = min(h, w)

    mindiff = float('inf')

    for i in range(1, long_side):
        long_block = i * short_side

        long_rest = long_side - i
        short_short_side = short_side // 2
        short_long_side = short_side - short_short_side

        short_short_block = short_short_side * long_rest
        short_long_block = short_long_side * long_rest

        maxarea = max(long_block, short_short_block, short_long_block)
        minarea = min(long_block, short_short_block, short_long_block)

        if mindiff > maxarea - minarea:
            mindiff = maxarea - minarea

    return mindiff


def short_first(h, w):
    long_side = max(h, w)
    short_side = min(h, w)

    mindiff = float('inf')

    for i in range(1, short_side):
        short_block = i * long_side

        short_rest = short_side - i
        long_short_side = long_side // 2
        long_long_side = long_side - long_short_side

        long_short_block = long_short_side * short_rest
        long_long_block = long_long_side * short_rest

        maxarea = max(short_block, long_short_block, long_long_block)
        minarea = min(short_block, long_short_block, long_long_block)

        if mindiff > maxarea - minarea:
            mindiff = maxarea - minarea

    return mindiff



def submit():
    h, w = read_input()

    if h % 3 == 0 or w % 3 == 0:
        print(0)
        return

    print(min(long_first(h, w), short_first(h, w), long_divide(h, w), short_divide(h, w)))

if __name__ == '__main__':
    submit()

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

int main(void)
{
    char s[15],t[15];
    scanf("%s%s",s,t);
    int len = strlen(s);
    for(int i = 0; i < len; i++)
    {
        if(s[i] != t[i])
        {
            printf("No");
            return 0;
        }
    }
    printf("Yes");
}


Measured memory_bytes: 3796
from collections import defaultdict
import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


INF = float('inf')


s = S()
n = len(s)
d = defaultdict(lambda: [0, 0])  # RL の位置 に対応する r, l の数の辞書

# 右から見ていって対応する r を探す
r = 0
i = 0
while i < n:
    if s[i:i + 2] == 'RL':
        d[i][0] = r
        r = 0
        i += 2
    elif s[i] == 'R':
        r += 1
        i += 1
    else:
        i += 1

l = 0
i = 0
s = s[::-1]
while i < n:
    if s[i:i + 2] == 'LR':
        d[n - i - 2][1] = l
        l = 0
        i += 2
    elif s[i] == 'L':
        l += 1
        i += 1
    else:
        i += 1


ans = [0] * n
for k, v in d.items():
    r, l = v
    ans[k] += 1
    ans[k + 1] += 1
    if r % 2 == 0:
        ans[k] += r // 2
        ans[k + 1] += r // 2
    else:
        ans[k] += r // 2
        ans[k + 1] += r // 2 + 1
    if l % 2 == 0:
        ans[k] += l // 2
        ans[k + 1] += l // 2
    else:
        ans[k] += l // 2 + 1
        ans[k + 1] += l // 2
print(*ans)


Measured memory_bytes: 18828
length = gets.chomp
str = gets.chomp
splitted_str = str.split("")

max_count = (0..str.length).map {|num|
  ary_a = splitted_str.take(num)
  ary_b = splitted_str.drop(num)
  ary_a & ary_b
}.max_by {|ary| ary.length}.count


p max_count

Measured memory_bytes: 1788
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <random>
#include <complex>
#include <iomanip>
#include <cassert>
 
using namespace std;

typedef long long ll;

int main() {
  ios_base::sync_with_stdio(false); cin.tie(0);
#ifdef LOCAL
  freopen("input.txt", "r", stdin);
#endif
  int n, jj, v, p;
  cin >> n >> jj >> v >> p;
  v = n - v;
  vector <int> a(n);
  for (int i = 0; i < n; ++i) cin >> a[i];
  sort(a.rbegin(), a.rend());
  int x = a[p - 1];
  int cnt = 0;
  for (int i = 0; i < n; ++i) if (a[i] >= x) ++cnt;
  int id = -1;
  for (int i = 0; i < n; ++i) {
    if (a[i] < x) {
      id = i;
      break;
    }
  }
  if (id != -1) {
    int l = id - 1, r = n;
    while (r - l > 1) {
      int m = (l + r) >> 1;
      vector <int> who;
      for (int i = 0; i < n; ++i) {
        if (a[i] > a[m]) who.push_back(a[i]);
      }
      sort(who.rbegin(), who.rend());
      vector <int> go;
      while (who.size() > p - 1) {
        go.push_back(who.back());
        who.pop_back();
      }
      for (int &x : go) {
        x -= a[m];
      }
      sort(go.rbegin(), go.rend());
      bool fl = true;
      ll sum = 0;
      for (int i = 0; i < (int)go.size(); ++i) {
        sum += go[i];
        if ((ll)min(i + 1, v) * jj < sum) {
          fl = false;
          break;
        }
      }
      if (fl) l = m;
      else r = m;
    }
    cnt += l - id + 1;
  }
  cout << cnt << '\n';
} 


Measured memory_bytes: 1952
N, M = map(int, input().split())
s_c = [list(map(int, input().split())) for _ in range(M)]

s_c = sorted(s_c, key=lambda x: x[0])
ans= ""
#print(s_c)
f = True
#けたループ


for i in range(N):
  tmp = []
  for j in range(M):
    if s_c[j][0] == 1 and s_c[j][1] == 0 and N != 1:
      f = False
      break
    if s_c[j][0] == i + 1:
      tmp.append(s_c[j][1])
  if len(set(tmp)) == 1:
    ans += str(tmp[0])
  elif len(set(tmp)) >= 2:
    f = False
    break
  else: #条件がない
    if i == 0 and N != 1:
      ans += "1"
    else:
      ans += "0"
#print(ans)
if f :
  print(ans)
else:
  print("-1")

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

int main() {
  int a;
  cin >> a;
  
  int b;
  cin >> b;
  
  if (a*b%2 == 0) {
    cout << "Even" << endl;
  } else {
    cout << "Odd" << endl;
  }
}

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

using namespace std;


int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    long long n;
    cin >> n;
    vector<int> hs(n);
    for (auto& h : hs) {
        cin >> h;
    }
    function<int (int, int, int)> calc = [&](int i, int j, int k) {
        if (i > j) {
            return 0;
        }
        if (i == j) {
            return hs[i] - k;
        }
        int lowest = hs[i];
        int lowest_index = i;
        for (int l = i; l <= j; ++l) {
            if (hs[l] < lowest) {
                lowest = hs[l];
                lowest_index = l;
            }
        }
        return lowest-k + calc(i, lowest_index-1, lowest)  + calc(lowest_index+1, j, lowest);
    };
    cout << calc(0, n-1, 0) << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int main() {
	int x,ans=0;
	int c[6] = { 1,5,10,50,100,500 };
	int v[6] = { 0,5,10,50,100,1000 };
	cin >> x;
	for (int i = 5; i >= 0; i--) {
		int t = x / c[i];
		x -= t*c[i];
		ans += t*v[i];
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
let scan_int () = Scanf.scanf " %d" (fun x -> x)
let scan_string () = Scanf.scanf " %s" (fun x -> x)

let rec judge s i h =
  if i = h then true
  else if s.[i] = s.[i+h] then judge s (i+1) h
  else false

let () =
  let n = scan_int() in
  let s = scan_string() in
  if n mod 2 = 0 && judge s 0 (n/2) then Printf.printf "Yes\n"
  else Printf.printf "No\n"

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

int n;
int a[3010];
long long int dp[3002][3002][3];

long long int rek(int x, int y, int z) {
	if (x > y) return 0;
	long long int &ret = dp[x][y][z];
	if (ret != -1) return ret;

	if (z == 0) {
		ret = max(rek(x+1, y, 1) + a[x], rek(x, y-1, 1) + a[y]);
	}
	else {
		ret = min(rek(x+1, y, 0) - a[x], rek(x, y-1, 0) - a[y]);
	}
	
	return ret;
}

int main () {
	
	cin >> n;
	for (int i = 0; i < n; i ++) cin >> a[i];
	memset(dp, -1, sizeof dp);
	cout << rek(0, n-1, 0);
	
	
	return 0;
}

Measured memory_bytes: 211584
# coding: utf-8
# Your code here!
import sys
input = sys.stdin.readline

A, B, C, X = [int(input()) for _ in range(4)]


cnt = sum(1 for a in range(A+1) if X - 500*a >=0 for b in range(B+1) if 0 <= X-500*a-100*b <= 50*C)
print(cnt)

Measured memory_bytes: 2940
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const ll mod = 1000000007;
const int INF = 1001001001;

int main(){
    ll n ; cin >> n;
    vector<ll> a(n);
    rep(i,n){
        cin >> a.at(i);        
    }
    sort(a.begin(),a.end());
    ll x = a.at(0);
    ll y = a.at(n-1);
    vector<pair<ll,ll>> op;

    ll mxm;

    if(x>=0){
        ll m = a.at(0);
        for(int i=1;i<n-1;i++){
            op.push_back(make_pair(m,a.at(i)));
            m = m - a.at(i);
        }
        op.push_back(make_pair(a.at(n-1),m));
        mxm = a.at(n-1) - m;
    }else if(y<0){
        ll m = a.at(n-1);
        for(int i=0;i<n-1;i++){
            op.push_back(make_pair(m,a.at(i)));
            m = m - a.at(i);
        }
        mxm = m;
    }else{
        ll m = a.at(0);
        auto it = lower_bound(a.begin(),a.end(),0);
        ll start = it - a.begin();
        for(int i=start;i<n-1;i++){
            op.push_back(make_pair(m,a.at(i)));
            m = m - a.at(i);
        }
        op.push_back(make_pair(a.at(n-1),m));
        m = a.at(n-1) - m;
        for(int i=1;i<start;i++){
            op.push_back(make_pair(m,a.at(i)));
            m = m - a.at(i);
        }
        mxm = m;
    }
    cout << mxm << endl;
    for(auto i:op){
        cout << i.first << " " << i.second << endl;
    }
    return 0;
}

Measured memory_bytes: 4336
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
const int mod = 1e9+7;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
int main(){
	cout << fixed << setprecision(10);
	int n;
	cin >> n;
  	vector<int> v;
	if(n==0){
		cout << 0 << endl;
		return 0;
	}
	if(n==1){
		cout << 1 << endl;
		return 0;
	}
	if(n==-1){
		cout << 11 << endl;
		return 0;
	}
	while(n/(-2)!=0){
		//cout << n << endl;
		if(n%(-2)==0) v.push_back(0);
		else v.push_back(1);
		if(n<0){
			n *= -1;
			n += n%2;
			n /= 2;
		}else{
			n /= (-2);
		}
		if(n==1){
			v.push_back(1);
			break;
		}
		if(n==-1){
			v.push_back(1);
			v.push_back(1);
			break;
		}
	}

	reverse(v.begin(),v.end());
	for(auto u : v){
		cout << u;
	}
	cout << endl;
	return 0;
}


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

//相似に着目！a,b,cを三辺の長さ、rを内接円の半径とする
//半径xの円を二つ描けるかチェックすることを考える。三角形の内部の点で境界からの距離がx以上である場合円の中心となることができる
//そのような点の集合は三角形を成す。この三角形は元の三角形と相似であり(1-x/r)倍小さい
//この小さい三角形の中から二点を選んで距離を2x以上にできる場合のみ半径xの円を二つ書くことができるので
//答えは(1-x/r)*max{a,b,c}=2xを満たすようなxである。
int main() {
	int x1, y1, x2, y2, x3, y3;
	cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
	double a, b, c;
	a = sqrt((x1 - x2)*(x1 - x2) + (y1 - y2)*(y1 - y2));
	b = sqrt((x1 - x3)*(x1 - x3) + (y1 - y3)*(y1 - y3));
	c = sqrt((x2 - x3)*(x2 - x3) + (y2 - y3)*(y2 - y3));
	pair<double,double> vec1, vec2;
	vec1.first = x2 - x1;
	vec1.second = y2 - y1;
	vec2.first = x3 - x1;
	vec2.second = y3 - y1;
	double s = abs((vec1.first*vec2.second - vec1.second*vec2.first)/2);
	double r = 2 * s / (a + b + c);
	double key = max(a, max(b, c));
	cout << fixed<<setprecision(12)<<key * r / (key + 2 * r) << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <queue>
#define int long long
#define mp make_pair
using namespace std;

typedef pair<int,int> PP;
typedef pair<int,PP> P;

signed main(){
	int n,m,k,a,b,c,t,s[3000],sum = 0;
	cin >> n >> m >> k >> a >> b >> c >> t;
	priority_queue<P> que;
	for(int i = 0;i < m;i++){
		cin >> s[i];
		s[i]--;
	}
	for(int i = 0;i < m - 1;i++){
		int nowt = s[i] * b;
		if(nowt > t) continue;
		if(i) sum++;
		if(nowt + (s[i + 1] - s[i] - 1) * a <= t){
			sum += s[i + 1] - s[i] - 1;
			continue;
		}
		int local = s[i] + (t - nowt) / a;
		sum += local - s[i];
		int semit = nowt + (local + 1 - s[i]) * c;
		if(semit > t) continue;
		int semilocal = min(s[i + 1] - 1,local + (t - semit) / a + 1);
		que.push(mp(semilocal - local,mp(i,local + 1)));
	}
	if(s[m - 1] * b <= t) sum++;
	for(int i = 0;i < k - m;i++){
		if(que.empty()) continue;
		P p = que.top();que.pop();
		int d = p.first,num = p.second.first,eki = p.second.second;
		int nowt = (eki - s[num]) * c + s[num] * b;
		//cout << d << " " << num << " " << eki << " " << nowt << endl;
		if(nowt + (s[num + 1] - eki - 1) * a <= t){
			sum += s[num + 1] - eki;
			continue;
		}
		sum += d;
		int local = eki + (t - nowt) / a;
		int semit = nowt + (local + 1 - eki) * c;
		if(semit > t) continue;
		int semilocal = min(s[num + 1] - 1,local + (t - semit) / a + 1);
		que.push(mp(semilocal - local,mp(num,local + 1)));
	}
	cout << sum << endl;
	return 0;
}

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

using namespace std; 

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef long long LL;
typedef priority_queue<int> PQ_DESC;
typedef priority_queue<int, vector<int>, greater<int>> PQ_ASC;
typedef priority_queue<PII> PQ_DESC_PII;
typedef priority_queue<PII, vector<PII>, greater<PII>> PQ_ASC_PII;

#define ALL(c) (c).begin(),(c).end()
#define PB push_back
#define MP make_pair
#define SORT_ASC(c) sort(ALL(c))
#define SORT_DESC(c) sort(ALL(c), greater<typeof(*((c).begin()))>())
#define SIZE(a) int((a).size())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ROF(i,a,b) for(int i=(b-1);i>=(a);--i)
#define REP(i,n) FOR(i,0,n)
#define REP(i,n) FOR(i,0,n)
#define PER(i,n) ROF(i,0,n)

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int LARGE_INT = 1e9+100;
const int INF = 2e9+100;
const LL INF_LL = (LL)INF * 300 * 300;
const int MOD = 1e9+7;

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

LL modpow(LL a, LL n) {
    LL res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}

LL modinv(LL a) {
    LL b = MOD, u = 1, v = 0;
    while (b) {
        LL t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= MOD;
    if (u < 0) u += MOD;
    return u;
}

LL moddev(LL a, LL b){
	return a * modinv(b) % MOD;
}

void Main()
{
    string s; cin >> s;
    int k; cin>>k;

    int n = SIZE(s);
    //dump(n)

    const int OK = 1;
    const int NG = 0;

    vector<vector<vector<LL>>> dp(n+1);
    REP(i,n+1){
        dp[i].resize(4);
        REP(j,4){
            dp[i][j].resize(2);
        }
    }

    int tmp = s[0] - '0';
    dp[0][0][OK] = 1;
    dp[0][0][NG] = 0;
    dp[0][1][OK] = tmp-1;
    dp[0][1][NG] = 1;
    dp[0][2][OK] = 0;
    dp[0][2][NG] = 0;
    dp[0][3][OK] = 0;
    dp[0][3][NG] = 0;


    FOR(i,1,n){
        int now = s[i] - '0';
        //dump(now)
        REP(kk,k+1){
            // type == ok
            if(kk != 0){
                //1~9
                dp[i][kk][OK] += dp[i-1][kk-1][OK] * 9;
            }
            //0
            dp[i][kk][OK] += dp[i-1][kk][OK] * 1;
            
            // type == ng
            if(now ==0){
                //0
                dp[i][kk][NG] = dp[i-1][kk][NG] * 1;
            }
            else{
                if(kk != 0){
                    //now
                    dp[i][kk][NG] += dp[i-1][kk-1][NG] * 1;
                    //1~now
                    dp[i][kk][OK] += dp[i-1][kk-1][NG] * (now-1);
                }
                //0
                dp[i][kk][OK] += dp[i-1][kk][NG] * 1;
            }
        }
    }

    cout << (dp[n-1][k][OK] + dp[n-1][k][NG]) << endl;

    

	return;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
    return 0;
}

Measured memory_bytes: 256
N, x = map(int, input().split())
A = map(int, input().split())
#A = sorted(A, reverse=True)
A = sorted(A)

tmp = 0
count = 0
for i, a in enumerate(A):
    if tmp + a > x:
        break
    if (i == len(A) -1) and tmp + a < x:
        break
    tmp += a
    count += 1

print(count)


Measured memory_bytes: 3060
#include "bits/stdc++.h"
using namespace std;

int main() {
    int A,B,K;
    cin >> A >> B >> K;
    
    int i=0;
    int X=530000;
    
    while(i < K){
        X--;
        if(A%X == 0 && B%X == 0){
            i++;
        }
    }
    
    cout << X << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#define ll long long
using namespace std;
int main(){
    int n;
    cin>>n;
    map<int,int> a;
    for(int i=0;i<n;i++){
        int ai;
        cin>>ai;
        a[ai]=i;
    }
    for(const auto& item:a){
        cout<<item.second+1<<" ";
    }
    cout<<endl;
    return 0;
}

Measured memory_bytes: 5504
/*
    Reference :-
*/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define F first
#define S second
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define forn1(i, n) for (int i = 1; i < int(n); i++)
#define PI pair<int,int>
#define all(vec) vec.begin(),vec.end()
ll mod=1000000007;
ll power(ll n,ll k){
    ll ans=1;
    while(k){
        if(k&1)ans=(ans*n)%mod;
        k/=2;
        n=(n*n)%mod;
    }
    //ans=(ans-1+mod)%mod;
    return ans;
}

int main(){
    //std::ios::sync_with_stdio(false);
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int n;
    cin>>n;
    map<string,int> ma;
    int maxi=0;
    forn(i,n){
        string s;
        cin>>s;
        ma[s]++;
        maxi=max(maxi,ma[s]);
    }
    vector<string> vec;
    for(auto it=ma.begin();it!=ma.end();it++)if(it->S==maxi)vec.pb(it->F);
    sort(all(vec));
    forn(i,vec.size())cout<<vec[i]<<endl;

	return 0;
}


Measured memory_bytes: 25584
n = int(input())
List = list(map(int, input().split()))

dic = {}

for i in range(n):
  dic[List[i]] = i +1

#print(dic)

for i in range(n):
  if i != n-1:
    print(dic[i+1],end =' ')
  else:
    print(dic[i+1])

Measured memory_bytes: 20512
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0;i<(n);i++)
typedef long long ll;
int main() {
  ll a=0,n,b=1,ans1=0,ans2=0,ans3=0,memoa,memob;
  string word;
  bool flag;
  cin>>n>>a>>b;
  if((b-a)%2==0){cout<<ll((b-a)/2)<<endl;}
  else {
  memoa=a;memob=b;
  b=b-a+1;ans2+=a-1;a=0;ans2+=ll(b/2);
  b=memob;a=memoa;a+=n-b;ans3+=n-b;b=n+1;ans3+=ll((b-a)/2);
  cout<<min(ans2,ans3)<<endl;
  }


  //vector<vector<bool>> sinsetsu(15,vector<bool>(14)),usotsuki(15,vector<bool>(14));
  //vector<vector<int>> sss(15,vector<int>(14))
  //vector<vector<int>> sss(h,vector<int>(w));
  //vector<int> a(k),b(k);
  //char x;
}

Measured memory_bytes: 256
n = int(input())
M = {}
for i in range(n):
    query, *x = input().split()
    if query == "0":
        M[x[0]] = x[1]
    elif query == "1":
        if x[0] in M:
            print(M[x[0]])
        else:
            print(0)
    elif query == "2":
        M.pop(x[0], None)


Measured memory_bytes: 41872
k=int(input())

a=[]
judge=0
a.append("")
a.append(7%k)
for i in range(2,k+1):
    a.append((a[i-1]*10+7)%k)
for i in range(1,k+1):
    if a[i]==0:
        print(i)
        judge=1
        break
if judge==0:
    print(-1)

Measured memory_bytes: 48568
n = gets.chomp.to_i

v = gets.chomp.split(" ").map(&:to_i)
cost = gets.chomp.split(" ").map(&:to_i)

ans = 0
n.times do |i|
    if v[i] - cost[i] > 0
        ans += v[i] - cost[i]
    end
end

puts ans


Measured memory_bytes: 1788
#include<iostream>

using namespace std;
int main(){
	int count=0;
	char S[5];
	cin >> S;
	for(int i=0;i<4;i++){
		if(S[i]=='+'){
			count++;
		}
		else{
			count--;
		}
	}
	cout << count << endl;
	return 0;
	
}

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

int main() {
  int people, amount; cin >> people >> amount;
  
  vector<int> wants(people);
  
  for(int i = 0; i < people; i++) {
    cin >> wants.at(i);
  }
  std::stable_sort(wants.begin(), wants.end());
  
  int ans = 0;
  for(int i = 0; i < people; i++) {
    int current = wants.at(i);
    if(i == (people-1) && current != amount) {
      break;
    }
    
    if(amount >= current) {
      amount -= current;
      ans++;
    } else {
      break;
    }
  } 
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 3644
#include <iostream>
#include <string>
#include <cstring>
#include <fstream>
#include <cmath>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <map>
#include <deque>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <list>
#include <unordered_map>
#include <bitset>
#include <sstream>

typedef  long long ll;
#define mop 1000000007
using namespace std;


int main() {
    

    ll a,b;
    cin >> a >> b;
    ll g = min(a,b);
    ll t = max(a,b);
    for(ll i=0;i<t;i++){
        cout << g;
    }
    cout << endl;
}

Measured memory_bytes: 256
//Don't have to see. start------------------------------------------
var read = require('readline').createInterface({
  input: process.stdin, output: process.stdout
});
var obj; var inLine = [];
read.on('line', function(input){inLine.push(input);});
read.on('close', function(){
  obj = init(inLine);
  console.error("\n");
  var start = Date.now();
  Main();
  var end = Date.now() - start;
  myerr("time : " + end + "ms");
  myerr("memory : " + Math.round(process.memoryUsage().heapTotal / 1024) + "KB");
});
function makeClone(obj){return JSON.parse(JSON.stringify(obj));}
function nextInt(){return myconv(next(),1);} function nextStrArray(){return myconv(next(),2);}
function nextIntArray(){return myconv(next(),4);} function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();}
function init(input){  
  var returnObj = {
    list : input, index : 0, max : input.length,
    hasNext : function(){return (this.index < this.max);},
    next : function(){if(!this.hasNext()){throw "ArrayIndexOutOfBoundsException ‚There is no more input";}else{var returnInput = this.list[this.index++];return returnInput;}}
  };
  return returnObj;
}
function myout(s){console.log(s);}
function myerr(s){console.error("debug:" + require("util").inspect(s,false,null));}
//param "no" is
//unknown or outlier : return i. 1: parseInt.
//2: split space. 4: split space and parseInt.
//6: split 1 character. 7: split 1 character and parseInt.
//8: join space. 9: join nextline. 0: join no character.
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 4:return i.split(" ").map(Number);case 6:return i.split("");case 7:return i.split("").map(Number);case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}catch(e){return i;}}

//Don't have to see. end------------------------------------------
function Main(){
  var one = nextIntArray();
  var N = one[0];
  var M = one[1];
  var list = new Array(N);
  var kyori = new Array(N);
  for(var i = 0; i < N; i++){
    list[i] = {
      child : []
    };
    kyori[i] = new Array(3);
  }
  for(var i = 0; i < M; i++){
    var tmp = nextIntArray();
    list[tmp[0] - 1].child.push(tmp[1] - 1);
  }
  
  var tmp = nextIntArray();
  var s = tmp[0] - 1;
  var t = tmp[1] - 1;
  var maeIndex = 0;
  var atoIndex = 1;
  var queue = new Array(100007);
  queue[0] = [s, 0];
  kyori[s][0] = 0;
  var output = -1;
  while(maeIndex != atoIndex){
    var now = queue[maeIndex];
    var v = now[0];
    var L = now[1];
    var nl = (L + 1) % 3;
    maeIndex++;
    var child = list[v].child;
    for(var i = 0; i < child.length; i++){
      if(kyori[child[i]][nl] == null){
        kyori[child[i]][nl] = kyori[v][L] + 1;
        queue[atoIndex] = [child[i], nl];
        atoIndex++;
      }
    }
  }
  if(kyori[t][0] != null){
    output = Math.floor(kyori[t][0] / 3);
  }
  myout(output);
}

Measured memory_bytes: 132500
w="yjsnpi"
a=[]
output=[]
while (w!="0 0"):
    w=input()
    b=w.split()
    x=int(b[0])
    y=int(b[1])
    if (x>y):
        output.append("{0} {1}".format(y,x))
    else:
        output.append("{0} {1}".format(x,y))
output.remove("0 0")
for k in output:
    print(k)

Measured memory_bytes: 5868
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

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

  int n;
  cin >> n;

  set<P> s;

  for (int i = 1; i <= n; i++) {
    if (i != n - i) {
      int a = i;
      int b = n - i;
      if(a == 0 || b == 0) continue;
      if (a < b) swap(a, b);

      s.insert(P(a, b));
    }
  }

  int ans = s.size();

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 23680
D = int(input())
listC = list(map(int, input().split()))
answerL = []
for i in range(D):
    listS = list(map(int, input().split()))
    maxi = max(listS)
    target = listS.index(maxi)
    answerL.append(target+1)
for ans in answerL:
    print(ans)

Measured memory_bytes: 9200
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N,M,X,A;
  cin>>N>>M>>X;
  int P[N+1]={0};
  for(int i=0;i<M;i++){
    cin>>A;
    P[A]++;
  }
  int l=0,r=0;
  for(int i=0;i<X;i++) l+=P[i];
  for(int i=X;i<N;i++) r+=P[i];
  cout<<min(l,r)<<endl;
}

Measured memory_bytes: 256
#include <memory.h>

#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <utility>
#include <vector>

using namespace std;

#define MOD 998244353
#define INIT -1

int main()
{
    int n;
    cin >> n;
    int xorsum = 0;
    int a[200000];
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        xorsum = xorsum ^ a[i];
    }
    for (int i = 0; i < n; i++) {
        int ans = xorsum ^ a[i];
        cout << ans << " ";
    }
    cout << endl;

}

Measured memory_bytes: 4284
#include <bits/stdc++.h>
#define rep(i,n) for (int i = (0); i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define show(x) cout << #x << " = " << (x) << endl
#define show2(x,y) cout << #x << " = " << (x) << ", " << #y << " = " << (y) << endl
#define show3(x,y,z) cout << #x << " = " << (x) << ", " << #y << " = " << (y) <<  ", " << #z << " = " << (z) << endl
#define showv(v) rep(i,v.size()) printf("%d%c", v[i], i==v.size()-1?'\n':' ')
#define showv2(v) rep(j,v.size()) showv(v[j])
#define showt(t,n) rep(i,n) printf("%d%c", t[i], i==n-1?'\n':' ')
#define showt2(t,r,c) rep(j,r) showt(t[j],c)
#define showvp(p) rep(i,p.size()) printf("%d %d\n", p[i].first, p[i].second);
#define printv(v) rep(i,v.size()) printf("%d\n", v[i])
#define printt(t,n) rep(i,n) printf("%d\n", t[i])
#define incl(v,x) find(rng(v),x)!=v.end()
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
typedef vector<pii> vp;
typedef vector<tiii> vt;
const int mod = 1000000007;
const double EPS = 1e-9;
const int INF = (1<<30)-1;
const ll INFLL = (1LL<<62)-1;
#define dame { puts("No"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
inline int in() { int x; scanf("%d",&x); return x;}
//cout << fixed << setprecision(10);
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int dp[100050];

int main () {
  int h, n;
  cin >> h >> n;
  vi a(n), b(n);
  rep(i,n) {
    cin >> a[i] >> b[i];
  }

  rep(i,100050) dp[i] = INF;
  dp[0] = 0;
  rep(j,n) {
    rep(i,50000) {
      if (dp[i] == INF) continue;
      chmin(dp[i+a[j]], dp[i]+b[j]); 
    }
  }

  int ans = INF;
  for (int i = h; i <= h+10000; ++i) {
    chmin(ans, dp[i]);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#include<cxxabi.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define mp make_pair
#define fi first
#define se second
#define All(x) (x).begin(),(x).end()
#define TYPEVS(x) typeid(x).name()
#define TYPEGC(x) abi::__cxa_demangle(typeid(x).name(), 0, 0, 0)
#define Y1 "YES"
#define N1 "NO"
#define ENDL '\n'
#define count2(x) _builtin_popcount(x)
int main(){
	long double n,m;
	cin>>n>>m;
	ll p=floor(n*m); 
	cout<<p;
}


Measured memory_bytes: 3732
S=list(map(int,input()))
L=len(S)
M=2019
d=10

U=[]
for x in range(L):
    if x==0:
        U=[1]
    else:
        U.append((U[-1]*d)%M)
        
T=[0]
for x in range(1,L+1):
    T.append((T[-1]+S[-x]*U[x-1])%M)

D={}
for x in T:
    if x in D:
        D[x]+=1
    else:
        D[x]=1

r=0
for x in D.values():
    r+=(x*(x-1))//2

print(r)


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

using namespace std;

int main(){
	/*freopen("in.txt.txt","r",stdin);
	freopen("out.txt.txt","w",stdout);*/
	int n;
	cin>>n;
	int a,b;
	cin>>a>>b;
	int largest=(b/n)*n;
	if(a<=largest)	puts("OK");
	else puts("NG");

}

Measured memory_bytes: 3636
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    int n;
    cin >> n;
    vector<int> v(n);
    for (auto &&i : v) scanf("%d", &i);
    int M = 1000000;
    vector<vector<int>> div(M+1);
    for (int i = 1; i <= M; ++i) {
        for (int j = i; j <= M; j += i) {
            div[j].emplace_back(i);
        }
    }
    vector<int> cnt(M+1);
    for (int i = 0; i < n; ++i) {
        cnt[v[i]]++;
    }
    int ans = 0;
    for (int i = 1; i <= M; ++i) {
        if(cnt[i]){
            int ok = 1;
            for (auto &&j : div[i]) {
                if(i != j) {
                    if(cnt[j]) ok = 0;
                }else {
                    if(cnt[j] > 1) ok = 0;
                }
            }
            if(ok) ans += cnt[i];
        }
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 122376
#include <stdio.h>
bool broken[200];
long long int a[200];
int n;
long long int f(){
    long long int temp;
    bool t=true;
    while(t){
        t=false;
    for(int i=n;i>0;i--){
        temp=0;
        for(int j=i;j<=n;j+=i)if(!broken[j])temp+=a[j];
        if(temp<0){
            t=true;
            for(int j=i;j<=n;j+=i)broken[j]=true;
        }
    }
    }
    temp=0;
    for(int i=1;i<=n;i++)if(!broken[i])temp+=a[i];
    return temp;
}
long long int max(long long int x,long long int b){return x>b?x:b;}
int main(){
    long long int temp=0;
    int mid;
    scanf("%d",&n);
    for(int i=1;i<=n;i++)scanf("%lld",&a[i]);
    temp=f();
    mid=n/2;
    for(int i=1;i<=mid;i++)for(int j=i+1;j<=mid;j++){
        for(int k=1;k<=n;k++)broken[k]=false;
        broken[i]=broken[j]=true;
        for(int k=1;k<=n;k++)if(k%i==0||k%j==0)broken[k]=true;
        temp=max(temp,f());
    }
    printf("%lld\n",temp);
}

Measured memory_bytes: 128
//#pragma GCC optimize(2)
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int mod=1e9+7;
const int MAXN=1e5+9;
const double eps=1e-8;
const long double pi=3.1415926535897932384626433832795;
const long double e=2.71828182845904523536028747135266;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0),cout.tie(0);
    int t=1;
    while(t--){
        int da,db;
        cin >> da >> db;
        for (int i=1;i<=1000;i++){
            if(floor(i*0.08)==da&&floor(i*0.1)==db) {
                cout << i <<endl;
                return 0;
            }
        }
        cout << -1 << endl;
    }
    return 0;
}


Measured memory_bytes: 256
s = input()

al = [chr(ord('a') + i) for i in range(26)]
c = dict()
for _al in al:
    c[_al] = [0]

for i in range(len(s)):
    for _al in al:
        if _al == s[i]:
            c[_al].append(c[_al][-1] + 1)
        else:
            c[_al].append(c[_al][-1])

f = False
for _al in al:
    tmp = []
    curmin = []
    for i in range(len(c[_al])):
        cur = c[_al][i] * 2 - i

        tmp.append(cur)
        if i == 0:
            curmin.append(cur)
        else:
            curmin.append(min(cur, curmin[-1]))

        if i >= 2 and tmp[-1] > curmin[-3]:
            y = i
            f = True
            break

    if f:
        break

if f:
    for j in range(len(tmp)):
        if tmp[j] == curmin[-3]:
            x = j + 1
            break
    print(' '.join([str(x), str(y)]))
else:
    print('-1 -1')


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

using namespace std;

const int AMAX = 100000;

void solve() {
    long long N, K;
    cin >> N >> K;
    vector<long long> cnt(AMAX + 1);
    for (int i = 0; i < N; i++)
    {
        int a, b;
        cin >> a >> b;
        cnt[a] += b;
    }

    for (int ans = 1; ans <= AMAX; ans++)
    {
        if (K <= cnt[ans])
        {
            cout << ans << endl;
            return;
        }
        K -= cnt[ans];
    }
}

int main() {
    solve();
    return 0;
}

Measured memory_bytes: 4024
N, M = map(int, input().split())
As = list(map(int, input().split()))
As.sort()
BC = [list(map(int, input().split())) for _ in range(M)]
def f(l):
    b, c = l
    return c
BC.sort(key = f)
cnt = 0
b, c = BC.pop()
for i in range(N):
    if cnt == b:
        if BC:
            b, c = BC.pop()
            cnt = 0
            if As[i] < c:
                As[i] = c
                cnt += 1
        else:
            break
    else:
        if As[i] < c:
            As[i] = c
            cnt += 1
print(sum(As))

Measured memory_bytes: 32968
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<utility>
#include<queue>
#include<string.h>
#include<string>
using namespace std;
typedef long long LL;

#define _CRT_SECURE_NO_WARNINGS
int N;
int t[100010];
int x[100010];
int y[100010];
int main() {
	scanf("%d",&N);
	for (int i = 1; i <= N;i++) {
		scanf("%d %d %d",t+i,x+i,y+i);
	}
	bool flag = true;
	t[0] = 0;
	x[0] = 0;
	y[0] = 0;
	for (int i = 1; i <= N; i++) {
			int a = abs(x[i] - x[i - 1]) + abs(y[i] - y[i - 1]);
			if (t[i] - t[i - 1] < a || (t[i] - t[i - 1] - a) % 2 == 1) {
				flag = false;
				break;
			}
	}
	
	if (flag) {
		printf("Yes\n");
	}
	else {
		printf("No\n");
	}

	return 0;
}

Measured memory_bytes: 1280
def result(_m, _f, _r):
    if _m==-1 or _f==-1: return "F"
    elif _m+_f>=80: return "A"
    elif _m+_f>=65: return "B"
    elif _m+_f>=50: return "C"
    elif _m+_f>=30 and _r>=50: return "C"
    elif _m+_f>=30: return "D"
    else: return "F"

while True:
    m,f,r = map(int, input().split())
    if m==-1 and f==-1 and r==-1: break
    print(result(m,f,r))


Measured memory_bytes: 5592
a = input()
b = input()

if len(a) != len(b):
    print('GREATER' if len(a) > len(b) else 'LESS' if len(a) < len(b) else 'EQUAL')
else:
    flg  = True
    for k,v in zip(a,b):
        if k > v:
            flg = False
            print('GREATER')
            break
        elif k < v:
            flg = False
            print('LESS')
            break
        else:
            pass
        
    if flg:
        print('EQUAL')

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

#define ll long long
#define mx  200005
#define mod 1000000009
#define lim 10000000
#define inf 2000000000
#define N 18
#define eps 100000
using namespace std;
int fre[mx],sum[mx],a[mx];
ll n;

ll getCount(int x)
{
	memset(fre,0,sizeof(fre));

	sum[0]=0;
	for(int i=1;i<=n;i++)
	{
		if(a[i]>=x)sum[i]=sum[i-1]+1;
		else sum[i]=sum[i-1]-1;
	}

	fre[eps]=1;
	int pre=0;
	ll ans=0;

	for(int i=1;i<=n;i++)
	{
		if(sum[i]>sum[i-1])pre+=fre[sum[i]+eps]+1;
		else pre=pre-fre[sum[i-1]+eps]+1;
		fre[sum[i]+eps]++;
		ans+=1LL*pre;
	}
	return ans;
}

int main(){
	ios_base::sync_with_stdio(false);
	cin>>n;
	ll req=n*(n+1)/2;
	req=ceil(req/2);
	vector<int>v;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
		v.push_back(a[i]);
	}
	sort(v.begin(),v.end());
	v.erase(unique(v.begin(),v.end()),v.end());
	int lo=0,hi=v.size()-1;

	for(int i=1;i<=30;i++)
	{
		int mid=(lo+hi+1)/2;
		if(getCount(v[mid])>=req)
			lo=mid;
		else
			hi=mid-1;
	}

	cout<<v[lo]<<"\n";
	return 0;
}


Measured memory_bytes: 2296
#include<iostream>
using namespace std;
string S,T;
main()
{
	cin>>S>>T;
	int ans=T.size();
	for(int i=0;i+T.size()<=S.size();i++)
	{
		int c=0;
		for(int j=0;j<T.size();j++)c+=S[i+j]!=T[j];
		if(ans>c)ans=c;
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 3632