akhauriyash/Code-Regression huggingface dataset:
package main

import (
    "bufio"
    "fmt"
    "os"
)

func scanInt(scanner *bufio.Scanner) (i int) {
    if scanner.Scan() {
        bs := scanner.Bytes()
        for _, b := range bs {
            i = i*10 + int(b-'0')
        }
    }
    return
}

func fee(n, k, x, y int) int {
    if n <= k {
        return x * n
    }
    return x * k + y * (n - k)
}

func main() {
    scanner := bufio.NewScanner(os.Stdin)
    scanner.Split(bufio.ScanWords)

    n := scanInt(scanner) // 1 <= n <= 10000
    k := scanInt(scanner) // 1 <= k <= 10000
    x := scanInt(scanner) // 1 <= y < x <= 10000
    y := scanInt(scanner) // 1 <= y < x <= 10000
    fmt.Println(fee(n, k, x, y))
}


Measured memory_bytes: 640
#!/usr/bin/env python3
import sys
from decimal import *


def solve(L: int):
    l = Decimal(L)
    print((l/3)**3)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    L = int(next(tokens))  # type: int
    solve(L)

if __name__ == '__main__':
    main()


Measured memory_bytes: 5332
//----------------------------templates
    #pragma GCC optimize ("Ofast")
    #pragma GCC target ("tune=native")
    #pragma GCC target ("avx")
    //----------------------------
    #include <bits/stdc++.h>
    using namespace std;

    typedef long long ll;
    typedef unsigned long long ull;
    #define int ll

    #define FOR(i,j,n) for (int i=(int)(j);i<(n);i++)
    #define REP(i,n) for (int i=0;i<(int)(n);i++)
    #define REPS(i,n) for (int i=1;i<=(int)(n);i++)
    #define REPN(i,n) for (int i=(int)(n)-1;i>=0;i--)
    #define REPNS(i,n) for (int i=(int)(n);i>0;i--)

    #define I(n) scanf("%lld", &(n))
    #define LL(n) scanf("%lld", &(n))
    #define pb(n) push_back((n))
    #define mp(i,j) make_pair((i),(j))
    #define eb(i,j) emplace_back((i),(j))
    #define y0 y3487465
    #define y1 y8687969
    #define j0 j1347829
    #define j1 j234892
    #define uniq(v) v.erase( unique(v.begin(), v.end()), v.end() )

    #define all(x) (x).begin(),(x).end()
    #define sz(x) ((int)(x).size())

    typedef vector<int> vi;
    typedef pair<int,int> pi;
    typedef vector<pi> vpi;
    typedef vector<vi> vvi;
    typedef vector<vpi> vvpi;
    typedef vector<vvi> vvvi;

    const int mod = 1000000007;

//--------------------------------------------
struct SegmentTree {
private:
    int n;
    vi node;

public:
    SegmentTree(vi v) {
        int sz = v.size();
        n = 1; while(n < sz) n *= 2;
        node.resize(2*n-1, 0);
        REP(i,sz) node[i+n-1] = v[i];
        REPN(i,n-2) node[i] = max(node[2*i+1], node[2*i+2]);
    }
    void update(int k, int x){
        k += n-1;
        node[k] = x;
        while(k){
            k = (k-1)/2;
            node[k] = max(node[2*k+1],node[2*k+2]);
        }
    }
    int getmax(int a, int b, int k=0, int l=0, int r=-1){
        if(r<0) r=n;
        if(r<=a || b<=l) return 0;
        if(a<=l && r<=b) return node[k];
        return max( getmax(a,b,2*k+1,l,(l+r)/2),getmax(a,b,2*k+2,(l+r)/2,r) );
    }
};


int n,c,x,v;
vpi sushi;
vi cl,ccl;

signed main(){
    I(n); I(c);
    sushi.resize(n);
    cl.resize(n);
    ccl.resize(n);

    REP(i,n){
        I(x); I(v);
        sushi[i] = mp(x,v);
    }

    int prev = 0;
    REP(i,n){
        cl[i] = sushi[i].second - (sushi[i].first - prev);
        prev = sushi[i].first;
    }
    prev = c;
    REP(i,n){
        ccl[i] = sushi[n-1-i].second - (prev - sushi[n-1-i].first);
        prev = sushi[n-1-i].first;
    }

    vi ruicl(n+1);
    FOR(i,1,n+1) ruicl[i] = ruicl[i-1] + cl[i-1];
    SegmentTree rc(ruicl);

    vi ruiccl(n+1);
    FOR(i,1,n+1) ruiccl[i] = ruiccl[i-1] + ccl[i-1];
    SegmentTree rcc(ruiccl);

    int ret = 0;
    REP(i,n+1) {
        ret = max(ret, ruicl[i] + max(0LL,rcc.getmax(0,n-i+1) - (i ? sushi[i-1].first : 0)));
    }
    REP(i,n+1) {
        ret = max(ret, ruiccl[i] + max(0LL,rc.getmax(0,n-i+1) - (i ? c - sushi[n-i].first : 0)));
    }
    cout << ret << endl;
}

Measured memory_bytes: 9840
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll mod2 = 998244353;
const ll INF = 1e18;
const long double EPS = 1e-10;

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

  int ans = 0;
  rep(i, n) {
    if (p[i] == i + 1) {
      ans++;
      i++;
    }
  }
  cout << ans << endl;


  
  return 0;
}

Measured memory_bytes: 640
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

#define MOD 1000000007
#define MOD2 998244353
#define int long long
#define EPS 1e-9
//#define PI 3.14159265358979

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

using namespace std;

template < typename T >
ostream &operator<<(ostream &os, const vector< T > &A) {
	for (int i = 0; i < A.size(); i++)
		os << A[i] << " ";
	os << endl;
	return os;
}
template <>
ostream &operator<<(ostream &os, const vector< vector< int > > &A) {
	int N = A.size();
	int M;
	if (N > 0)
		M = A[0].size();
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < M; j++)
			os << A[i][j] << " ";
		os << endl;
	}
	return os;
}

typedef pair< int, int > pii;
typedef long long ll;

struct edge {
	int from, to, d, c;
	edge(int _from = 0, int _to = 0, int _d = 0, int _c = 0) {
		from = _from;
		to = _to;
		d = _d;
		c = _c;
	}
	bool operator<(const edge &rhs) const {
		return (d == rhs.d) ? (c < rhs.c) : (d < rhs.d);
	}
};
struct aabb {
	int x1, y1, x2, y2;
	aabb(int x1, int y1, int x2, int y2) : x1(x1), y1(y1), x2(x2), y2(y2) {}
};

typedef vector< edge > edges;
typedef vector< edges > graph;
struct flow {
	int to, cap, rev, cost;
	flow(int to = 0, int cap = 0, int rev = 0, int cost = 0) : to(to), cap(cap), rev(rev), cost(cost) {}
};
typedef vector< vector< flow > > flows;

const int di[4] = {0, -1, 0, 1};
const int dj[4] = {-1, 0, 1, 0};
const int ci[5] = {0, 0, -1, 0, 1};
const int cj[5] = {0, -1, 0, 1, 0};
const ll LINF = LLONG_MAX / 2;
const int INF = INT_MAX / 2;
const double PI = acos(-1);

int pow2(int n) { return 1LL << n; }
template < typename T, typename U >
bool chmin(T &x, const U &y) {
	if (x > y) {
		x = y;
		return true;
	}
	return false;
}
template < typename T, typename U >
bool chmax(T &x, const U &y) {
	if (x < y) {
		x = y;
		return true;
	}
	return false;
}

struct initializer {
	initializer() {
		cout << fixed << setprecision(20);
	}
};
initializer _____;

int N, M, K, T, Q, H, W;
bool dfs(vector< vector< int > > &G, vector< int > &R, int x, int p) {
	if (x == N - 1) {
		R.push_back(x);
		return true;
	}
	for (auto j : G[x]) {
		if (j == p)
			continue;
		if (dfs(G, R, j, x)) {
			R.push_back(x);
			return true;
		}
	}
	return false;
}
int dfs2(vector< vector< int > > &G, int x, int p, int s) {
	int ret = 1;
	for (auto j : G[x]) {
		if (j == p || j == s)
			continue;
		ret += dfs2(G, j, x, s);
	}
	return ret;
}
signed main() {
	cin >> N;
	vector< vector< int > > G(N);
	rep(i, N - 1) {
		int a, b;
		cin >> a >> b;
		--a;
		--b;
		G[a].push_back(b);
		G[b].push_back(a);
	}
	vector< int > R;
	int f, s;
	dfs(G, R, 0, -1);
	f = R[R.size() / 2];
	s = R[R.size() / 2 - 1];
	//cout << f << " " << s;
	int fscore = dfs2(G, f, -1, s);
	string ans = (fscore > N - fscore ? "Fennec" : "Snuke");
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 13176
#include <stdio.h>
int main (int argc, char * argv[])
{
    int a,b,d,r;
    double f;
    scanf("%d %d",&a,&b);
    d = a / b;
    r = a % b;
    f = 1.0*a / b ;
    printf("%d %d %f\n",d,r,f);
    return 0;
    
}


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



int main(){
    ll d,t,s;
    cin >> d >>t >> s;
    if(t*s>=d){
        cout << "Yes" << endl;
        return 0;
    }
    else{
        cout << "No" << endl;
        return 0;
    }
}  


Measured memory_bytes: 3592
from sys import stdin
from itertools import product

N, *xyh = map(int, stdin.read().split())

xyh = list(zip(*[iter(xyh)] * 3))
xyh = [t for t in xyh if t[2] > 0]
xyh.sort(key=lambda x: x[2], reverse=True)

x1, y1, h1 = xyh[0]
if len(xyh) < 3:
    print(x1, y1, h1)
else:
    for X, Y in product(range(101), range(101)):
        H = h1 + abs(x1-X) + abs(y1-Y)
        if all([max(H-abs(x-X)-abs(y-Y), 0) == h for x, y, h in xyh[1:]]):
            print(X, Y, H)
            break

Measured memory_bytes: 3064
n = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))

from itertools import accumulate

A = list(accumulate(A))
B = list(accumulate(B[::-1]))[::-1]



ans = 0
for i in range(n):
  ans = max(A[i]+B[i], ans)
print(ans)



Measured memory_bytes: 3188
#include<cstdio>
#include<iostream>
#include<algorithm>
#define MAX 10000
#define NIL -1

using namespace std;

struct Node { int parent, left, right; };

Node T[MAX];
int n, D[MAX], H[MAX];  // D[]: Depth, H[]: Height

void setDepth(int u, int d) {
  if ( u == NIL ) return;
  D[u] = d;
  setDepth(T[u].left, d + 1);
  setDepth(T[u].right, d + 1);
}

int setHeight(int u) {
  int h1 = 0, h2 = 0;
  if ( T[u].left != NIL ) {
    h1 = setHeight(T[u].left) + 1;
  }
  if ( T[u].right != NIL ) {
    h2 = setHeight(T[u].right) + 1;
  }
  // return H[u] = ( h1 > h2 ? h1 : h2 );
  // return H[u] = h1 * ( h1 > h2 ) + h2 * ( h1 < h2 );
  return H[u] = max(h1, h2);
}

int getSibling(int u) {
  if ( T[u].parent == NIL ) return NIL;
  if ( T[T[u].parent].left != u && T[T[u].parent].left != NIL ) {
    return T[T[u].parent].left;
  }
  if ( T[T[u].parent].right != u && T[T[u].parent].right != NIL ) {
    return T[T[u].parent].right;
  }
  return NIL;
}

void print(int u) {
  cout << "node " << u << ": ";
  cout << "parent = " << T[u].parent << ", ";
  cout << "sibling = " << getSibling(u) << ", ";
  int deg = 0;
  if ( T[u].left != NIL ) deg++;
  if ( T[u].right != NIL ) deg++;
  cout << "degree = " << deg << ", ";
  cout << "depth = " << D[u] << ", ";
  cout << "height = " << H[u] << ", ";

  if ( T[u].parent == NIL ) {
    cout << "root" << endl;
  } else if ( T[u].left == NIL && T[u].right == NIL ) {
    cout << "leaf" << endl;
  } else {
    cout << "internal node" << endl;
  }
}

int main() {
  int v, l, r, root = 0;
  cin >> n;

  for ( int i = 0; i < n; i++ ) T[i].parent = NIL;

  for ( int i = 0; i < n; i++) {
    cin >> v >> l >> r;
    T[v].left = l;
    T[v].right = r;
    if ( l != NIL ) T[l].parent = v;
    if ( r != NIL ) T[r].parent = v;
  }

  for ( int i = 0; i < n; i++ ) if ( T[i].parent == NIL ) root = i;

  setDepth(root, 0);
  setHeight(root);

  for ( int i = 0; i < n; i++ ) print(i);

  return 0; 
}



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

ll a[16][16];
ll DP[1 << 16];
ll cost[1 << 16];
bool vis[1 << 16];
int N;

ll solve(int state){
    if(state == 0){
        return 0;
    }
    ll& ret = DP[state];
    if(vis[state]){
        return ret;
    }
    vis[state] = 1;
    for(int subset = state; subset; subset = (subset - 1) & state){
        ret = max(ret , cost[subset] / 2 + solve(state ^ subset));
    }
    return ret;
}

int main(){
    cin >> N;
    for(int i = 0; i < N; ++i){
        for(int j = 0; j < N; ++j){
            cin >> a[i][j];
        }
    }
    for(int i = 0; i < N; ++i){
        for(int s = 0; s < (1 << N); ++s){
            if((1 << i) & s){
                for(int j = 0; j < N; ++j){
                    if((1 << j) & s){
                        cost[s] += a[i][j];
                    }
                }
            }
        }
    }
    cout << solve((1 << N) - 1) << endl;
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using pll = pair<ll, ll>;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define Rep(i, m, n) for(ll i = m; i < n; i++)
#define all(vec) vec.begin(), vec.end()
#define tmax(x, y, z) max((x), max((y), (z)))
#define tmin(x, y, z) min((x), min((y), (z)))
#define MINUS(a) memset(a, 0xff, sizeof(a))
#define ZERO(a) memset(a, 0, sizeof(a))
const ll INF = 1LL << 60;
const ll MM = 1000000000; const ll MOD = MM + 7; const ll MMM=9223372036854775807;//2^63 -1
#define ADD(a,b) a = (a + ll(b)) % MOD
#define MUL(a,b) a = (a * ll(b)) % MOD
ll GCD(ll x, ll y){ if(y == 0) return x; else return GCD(y, x % y);}
ll LCM(ll x, ll y){ return x / GCD(x, y) * y;}
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;}
template<typename A, size_t N, typename T> void FILL(A (&array)[N], const T &val){ fill( (T*)array, (T*)(array+N), val );}
using Graph = vector<vector<ll>>;
ll dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
ll ddx[8] = {1, 1, 0, -1, -1, -1, 0, 1}, ddy[8] = {0, 1, 1, 1, 0, -1, -1, -1};
//cout << fixed << setprecision(10);


int main(){
    ll n, ans = 0, ma; cin >> n;
    rep(i, n){
        ll a;
        cin >> a;
    if(i == 0){
        ma = a;
        continue;
    }
        if(ma > a){
            ans += ma-a;
        }
        else{
            ma = a;
        }
    }
    cout << ans << endl;

}


Measured memory_bytes: 3632
#![allow(unused_imports)]
#![allow(non_snake_case)]

use proconio::input;
use std::collections::HashMap;

fn main() {
    input! {
        s: usize,
    }

    let MOD: usize = 10usize.pow(9) + 7;

    let mut list = vec![0; s + 5];
    list[0] = 1;
    list[3] = 1;
    list[4] = 1;
    list[5] = 1;

    for i in 6..(s + 1) {
        for j in 0..(i - 2) {
            list[i] += list[j] % MOD;
        }
        list[i] = list[i] % MOD;
    }
    println!("{}", list[s]);
}


Measured memory_bytes: 2088
n = int(input())
a = list(map(int, input().split()))
count = 0
ans = 0
for i in a:
    if i%2 == 0:
        count += 1
        if i%3 == 0 or i%5 == 0:
            ans += 1
if count == ans:
    print('APPROVED')
else:
    print('DENIED')

Measured memory_bytes: 3060
using System;
using System.Collections.Generic;
using System.Linq;

namespace CSharpSample01
{


    class Program
    {

        

        static void Main(string[] args)
        {

            int[] data = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
            int A = data[0];
            int B = data[1];
            int K = data[2];

            for(int i = A; i <= B; i++)
            {
                if (i - A < K || B - i < K) Console.WriteLine(i);

            }

            


        }
    }
}

Measured memory_bytes: 13396
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
using namespace std;
int main(){
  int n,l;
  vector<string> s(100);
  cin >> n >> l;
  for (int i = 0; i < n; i++){
    cin >> s[i];
  }
  sort(s.begin(),s.begin() + n);
  for (int i = 0; i < n; i++){
    cout << s[i];
  }
  cout <<'\n';
return 0;   
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

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 cnt=0;

		for (int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
		}
		Arrays.sort(a);

		int[] dp = new int[a[n-1]+1];

		for (int i = 0; i < a.length; i++) {
			for (int j = a[i]; j < dp.length; j+=a[i]) {
				if(dp[a[i]]>1){
				 	dp[a[i]]++;
				 	break;
				}
				dp[j]++;
			}
		}
		for (int i = 0; i < a.length; i++) {
			if(dp[a[i]]==1) cnt++;
		}
		System.out.println(cnt);
	}
}

Measured memory_bytes: 50744
#include <bits/stdc++.h>
#include <chrono>
#define watch(x) cout << (#x) << " is " << (x) << endl
#define eps 1e-9

typedef long long ll;

using namespace std;

const int mod = 1e9+7;
const int N = 1e5+5;
int a[N];

int main()

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

    int n;

    cin >> n;

    vector <int> v;

    for (int i = 2; i < 1001; i++) {

        for (int j = 2; j*j < 1001; j++) {

            v.push_back(pow(i, j));
        }
    }

    sort(v.rbegin(), v.rend());

    for (auto x : v) {

        if (x <= n && x > 0) {

            cout << x;
            return 0;
        }
    }

    cout << 1;

    return 0;
}


Measured memory_bytes: 512
PROGRAM traveling
      IMPLICIT NONE
      INTEGER :: N
      INTEGER,ALLOCATABLE :: t(:), x(:),y(:)
      
      INTEGER :: i, dt, dx,dy, s
      LOGICAL :: flag = .TRUE.
      
      READ*,N
      N = N + 1
      ALLOCATE( t(N),x(N),y(N) )
      DO i = 2,N
        READ*,t(i),x(i),y(i)
      END DO
      t(1) = 0
      x(1) = 0
      y(1) = 0
      
      DO i = 1,N-1
        dt = t(i+1) - t(i)
        dx = abs( x(i+1)-x(i) )
        dy = abs( y(i+1)-y(i) )
        
        IF(dx+dy>dt)THEN
          flag = .false.
          EXIT
        END IF
        
        s = dy+dx -dt
        IF( mod(dx+dy,2)/=mod(dt,2) )THEN
          flag = .false.
          EXIT
        END IF
      END DO
      
      IF(flag)THEN
        print'(A)','Yes'
      ELSE
        print'(A)','No'
      END IF
      
      
      END PROGRAM

Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string s,s1,x,x1;
	cin>>s;
	s1=s;
	int h=0;
	for(int i=0;i<s.size();i++)
	{
		x+=(char)(h%2+'0');
		x1+=(char)(1^h%2+'0');
		h++;
	}
	int ans=0,ans1=0;
	for(int i=0;i<s.size();i++)
	{
		if(s[i]!=x[i])
		ans++;
	}
	for(int i=0;i<s1.size();i++)
	{
		if(s1[i]!=x1[i])
		ans1++;
	}
	cout<<min(ans,ans1);
	return 0;
}


Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
using P = pair<int,int>;

//解説動画

// (を+1, )を-1とみなし、折れ線で表す
//
// ・0で終わる
// ・折れ線はどこでも0未満にならない

// 折れ線の断片単位で考える
//
// 断片について開始点を0とし、以下2つを調べる
// ・最下点でどれだけ下がるか
// ・最終的にどれだけ増減するか

//         下,計
// (():    0, +1
// )(((:  -1, +2
// ))()): -3, -3

//増減の正のもの(左に配置, 増やしていくパート)と
//負のもの(右に配置, 減らしていくパート)に分けて、
//それぞれ0未満にならずに登り/降りできるか

//まず左から
//
//増減+のもの
//・くっつけられるものがあればすぐくっつけてよい
//・最下点が高い順にくっつけるのが最適
//
//増減-のもの
//右から見ていく。そのとき
// (下, 計) -> (下-計, -計)に変換すると増減+のものと同一視できる

bool check(vector<P> s){
    
    int h = 0;
    
    for( P p : s){//pair pについて順に
        int b = h + p.first;
        if(b<0) return false;
        h += p.second;
    }
    
    return true;
}


int main(){
    int n;
    cin >> n;
    
    int sum = 0;
    
    vector<P> ls, rs;
    
    for(int i=0; i<n; i++){
        string s;
        cin >> s;
        
        int h = 0, b = 0;
        
        for(int j=0; j<s.size(); j++){
            if(s[j]=='(')
                h++;
            else
                h--;
            b = min( b,h );
        }
        
        if(h>0)ls.emplace_back(b,h);
        else   rs.emplace_back(b-h,-h);
        
        sum += h;
    }
    
    if(sum!=0){
        cout << "No" << endl;
    }else{
        
        sort(ls.rbegin(), ls.rend());
        sort(rs.rbegin(), rs.rend());
        //rbegin, rendにすると大きい順にソートできる
        //pairのソートは第1成分の順, 第1成分が同じならば第2成分の順でソートされ、
        //pairの組は変わらない
        
        if(check(ls) && check(rs)){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 18928
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int K, A, B;
    cin >> K >> A >> B;
    if ((B - A < 2) || (K <= A)){
        cout << 1 + K << endl;
    } else {
        K -= A - 1;
        cout << B + (B - A) * ((K - 2) / 2) + (K % 2) << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

#define     mod             (int)1e9+7
#define     MOD             998244353
#define     ll              long long
#define     mp              make_pair
#define     F               first
#define     S               second
#define     t()             int test;cin>>test;while(test--)
#define     ii              pair<int,int>
#define     que_max         priority_queue <int>
#define     que_min         priority_queue <int, vector<int> , greater<int> >
#define     IOS             ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define     endl            "\n"
#define     grid            vector<vector<ll> >
typedef tree< int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
    cout << name << " : " << arg1 << endl;
    //use cerr if u want to display at the bottom
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}
#else
#define trace(...)
#endif




int32_t main()

{
#ifndef ONLINE_JUDGE
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#endif

    IOS;

    int n, W;

    cin >> n >> W;

    grid dp(n + 1, vector<ll>(W + 1, 0));

    std::vector<ll> wt(n + 1, 0), val(n + 1, 0);

    for (int i = 1; i <= n; i++)
    {
        cin >> wt[i] >> val[i];
    }


    for (int i = 1; i <= n; i++)
    {
        for (int w = 1; w <= W; w++)
        {
            dp[i][w] = dp[i - 1][w];
            if (wt[i] <= w)
            {
                dp[i][w] = max(dp[i - 1][w], val[i] + dp[i - 1][w - wt[i]]);
            }

        }

    }

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







}

Measured memory_bytes: 83076
#include<cstdio>
#include<cstring>
#include<queue>
#include<algorithm>
using namespace std;
const int maxn=510,maxL=10000010,inf=0x3f3f3f3f;
struct cyc{int v,flow,from;}e[maxn*maxn*2];
int tot=1,cnt,n,first[maxn],d[maxn],S,T,num[maxn],b[maxn],cur[maxn];
bool c[maxL];
inline int ab(int x){return x>0?x:-x;}
bool isprime(int x){
	if(x<=2)return 0;
	for(int i=2;i*i<=x;i++)if(x%i==0)return 0;
	return 1;
}
void insert(int u,int v,int w){
	tot++;e[tot].v=v;e[tot].flow=w;e[tot].from=first[u];first[u]=tot;
	tot++;e[tot].v=u;e[tot].flow=0;e[tot].from=first[v];first[v]=tot;
}
queue<int>q;
bool bfs(){
	memset(d,-1,sizeof(d));
	q.push(S);d[S]=0;
	while(!q.empty()){
		int x=q.front();q.pop();
		for(int i=first[x];i;i=e[i].from)
		if(d[e[i].v]==-1&&e[i].flow){
			d[e[i].v]=d[x]+1;
			q.push(e[i].v);
		}
	}
	return d[T]!=-1;
}
int dinic(int x,int a){
	if(x==T||a==0)return a;
	int f,flow=0;
	for(int& i=cur[x];i;i=e[i].from)
	if(d[e[i].v]==d[x]+1&&e[i].flow&&(f=dinic(e[i].v,min(a,e[i].flow)))>0){
		e[i].flow-=f;
		e[i^1].flow+=f;
		a-=f;
		flow+=f;
		if(a==0)break;
	}
	return flow;
}
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++){scanf("%d",&num[i]);c[num[i]]=1;}
	for(int i=1;i<=maxL-5;i++)if(c[i]!=c[i-1])b[++cnt]=i;
	S=0;T=cnt+1;
//	for(int i=1;i<=cnt;i++)printf("%d ",b[i]);printf("\n");
	int m1=0;
	for(int i=1;i<=cnt;i++)if(b[i]&1){
		m1++;
		insert(S,i,1);
		for(int j=1;j<=cnt;j++)if(!(b[j]&1)&&isprime(ab(b[i]-b[j])))insert(i,j,1);
	}else{
		insert(i,T,1);
	}
	int ans=0;
	while(bfs()){
		for(int i=S;i<=T;i++)cur[i]=first[i];
		ans+=dinic(S,inf);
	}
	//if((m1-ans)%2)printf("%d",cnt-ans+1);else
	//printf("%d",cnt-ans);
	printf("%d",cnt-ans+(m1-ans)%2);
	return 0;
}

Measured memory_bytes: 8576
import java.util.*;
import java.lang.Math;
public class Main {

    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        System.out.println(calc(sc.nextLong(), sc.nextLong(), sc.nextLong()));
        sc.close();
    }

    private static String calc(long A, long B, long K) {
        long resA = A < K ? 0 : A - K;
        long resB = A > K ? B : B < (K - A) ? 0 : B - (K - A);


        return String.format("%d %d", resA, resB);
    }
}

Measured memory_bytes: 21972
#include <algorithm>
#include <bitset>
#include <deque>
#include <iostream>
#include <istream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <iomanip>
using namespace std;

typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define revrep(i, n) for(ll i = (n)-1; i >= 0; i--)
#define pb push_back
#define f first
#define s second
const long double M_PI = 3.14159265358979323846265;
const ll INFL = 1LL << 60;//10^18 = 2^60
//ll MOD = 998244353;
void pres(long double A, ll x = 10){cout << fixed << setprecision(x) << A << endl;}

ll sx, sy, tx, ty;
ll N;
vector<pair<ll, ll>> XY;

int main(){
  cin >> sx >> sy >> tx >> ty;
  sx += 10;
  sy += 10;
  tx += 10;
  ty += 10;
  cin >> N;
  XY.resize(N);
  rep(i, N){
    cin >> XY[i].f >> XY[i].s;
    XY[i].f += 10;
    XY[i].s += 10;
  }
  if(sx == tx && sy == ty){
    cout << 0 << endl;
    return 0;
  }
  if(sx == tx){
    long double dist = 1. * abs(ty - sy) * 100.0;
    rep(i, N){
      if(XY[i].f == sx && min(sy, ty) < XY[i].s && XY[i].s < max(sy, ty)){
        dist += (long double)(10.0 * M_PI - 20.0);
      }
    }
    pres(dist, 20);
    return 0;
  }
  if(sy == ty){
    long double dist = 1. * abs(tx - sx) * 100.0;
    rep(i, N){
      if(XY[i].s == sy && min(sx, tx) < XY[i].f && XY[i].f < max(sx, tx)){
        dist += (long double)(10.0 * M_PI - 20.0);
      }
    }
    pres(dist, 20);
    return 0;
  }

  if(sx > tx){
    swap(sx, tx);
    swap(sy, ty);
  }

  long double dist = 0;
  vector<pair<ll, ll>> in;
  rep(i, N){
    if(XY[i].f < min(sx, tx) || max(sx, tx) < XY[i].f){
      XY[i] = {-1, -1};
    }
    if(XY[i].s < min(sy, ty) || max(sy, ty) < XY[i].s){
      XY[i] = {-1, -1};
    }
  }

  rep(i, N){
    if(XY[i].f == -1) continue;
    if(sy > ty) XY[i].s *= -1;
    in.pb({XY[i].s, XY[i].f});
  }
  sort(in.begin(), in.end());
  vector<ll> cnt(N+1, INFL);
  if(sy <= ty){
    rep(i, in.size()){
      *lower_bound(cnt.begin(), cnt.end(), in[i].s) = in[i].s;
    }
    ll ok = 0;
    rep(i, N+1){
      if(cnt[i] != INFL) ok = i+1;
    }
    if(ok > min(tx - sx, abs(sy - ty))){
      dist += (long double)(10.0 * M_PI - 20.0);
      ok--;
    }
    dist += (long double)(5.0 * M_PI - 20.0) * ok;
  }else{
    rep(i, in.size()){
      *lower_bound(cnt.begin(), cnt.end(), in[i].s) = in[i].s;
    }
    ll ok = 0;
    rep(i, N+1){
      if(cnt[i] != INFL) ok = i+1;
    }
    if(ok > min(tx - sx, abs(sy - ty))){
      dist += (long double)(10.0 * M_PI - 20.0);
      ok--;
    }
    dist += (long double)(5.0 * M_PI - 20.0) * ok;
  }
  dist += (abs(sx - tx) + abs(sy - ty)) * 100.0;
  pres(dist, 20);
}


Measured memory_bytes: 9456
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <limits>
#include <stack>
#include <string>
#include <vector>

#define FOR(i,k,n) for (int (i)=(k); (i)<(n); ++(i))
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define eb emplace_back
#define all(v) begin(v), end(v)

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
template<class T> using vv=vector<vector< T > >;

struct union_find {
    int n;
    vi d;
    union_find() {}
    union_find(int n_): n(n_), d(n, -1) {}
    int root(int v) {
        if (d[v] < 0) {
            return v;
        }
        return d[v] = root(d[v]);
    }
    int size(int v) {
        return -d[root(v)];
    }
    bool unite(int x, int y) {
        x = root(x);
        y = root(y);
        if (x == y) {
            return false;
        }
        if (size(x) < size(y)) {
            swap(x, y);
        }
        d[x] += d[y];
        d[y] = x;
        return true;
    }
};

int main() {
    while (true) {
        int n, m;
        cin >> n >> m;
        if ( n == 0 ) { break; }
        vvi edges(m);
        rep (i, m) {
            int a, b, cost;
            cin >> a >> b >> cost;
            edges[i] = {cost, a, b};
        }
        sort(all(edges));

        int ans = 0;
        union_find uf(n);
        rep (i, m) {
            if ( uf.unite(edges[i][1], edges[i][2]) ) {
                ans += edges[i][0];
            }
        }
        printf("%d\n", ans);
    }
    return 0;
}

Measured memory_bytes: 3120
import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;

public class Main {
    int n;
    long[] as, bs, cs;
    public static void main(String[] args) {
        Main m = new Main();
        m.read();
        m.solve();
    }

    private void read() {
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        as = new long[n];
        bs = new long[n];
        cs = new long[n];
        for (int i = 0; i < n; i++)
            as[i] = sc.nextLong();
        for (int i = 0; i < n; i++)
            bs[i] = sc.nextLong();
        for (int i = 0; i < n; i++)
            cs[i] = sc.nextLong();
    }

    private void solve() {
        Arrays.sort(as);
        Arrays.sort(bs);
        Arrays.sort(cs);
        int[] cntB = new int[n];
        long[] cntA = new long[n];
        int j = n - 1;
        for (int i = n-1; i >= 0; i--) {
            if (i != n-1)
                cntB[i] = cntB[i+1];
            for (; j >= 0; j--) {
                if (bs[i] >= cs[j])
                    break;
                cntB[i]++;
            }
        }
        j = n - 1;
//        Arrays.fill(cntA, 1);
        for (int i = n-1; i >= 0; i--) {
            if (i != n-1)
                cntA[i] = cntA[i+1];
            for (; j >= 0; j--) {
                if (as[i] >= bs[j])
                    break;
                cntA[i] += cntB[j];
            }
        }
        long ans = 0L;
        for (long c: cntA)
            ans += c;
        System.out.println(ans);
    }
}


Measured memory_bytes: 97752
H, W = (int(i) for i in input().split())
glid = [[i for i in input()] for i in range(H)]


def search(x, y):
    try:
        if glid[x][y] == '#' and x != -1 and y != -1:
            return 1
        else:
            return 0
    except:
        return 0


ans = []
for i in range(H):
    ans.append([0 for _ in range(W)])
    for j in range(W):
        if glid[i][j] == '#':
            ans[i][j] = '#'
        else:
            li = [(i-1, j-1), (i, j-1), (i-1, j), (i+1, j+1),
                  (i, j+1), (i+1, j), (i+1, j-1), (i-1, j+1)]
            for x, y in li:
                ans[i][j] += search(x, y)

for i in range(H):
    for j in range(W):
        print(ans[i][j], end="")
    print()


Measured memory_bytes: 3572
#include<iostream>
#include <cstring>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
  int N, M;
  cin >> N >> M;
  pair<ll, int>p[N];
  rep(i, N){
    int a, b;
    cin >> a >> b;
    p[i]=make_pair(a, b);
  }
  sort(p, p+N);
  ll ans = 0;
  rep(i, N){
    ans += (p[i].first)*(p[i].second);
    M -= p[i].second;
    if(M<=0){
      ans += (ll) M*(p[i].first);
      break;
    }
  }
  cout << ans << endl;
  
}

Measured memory_bytes: 1792
import math

n = (int)(input())
x = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

ret = x[n-1]

print("{}".format(ret))


Measured memory_bytes: 3060
import sys

from collections import deque
# q = deque(); q.append(x); q.appendleft(x); q.pop() -> x; q.popleft() -> x
from collections import defaultdict
# d = defaultdict(lambda: []); d[key] -> []
import heapq
# hq = []; heapq.heappush(hq, x); heapq.heappop(hq) -> x; heapq.heappushpop(hq, x) -> x
import bisect
# i = bisect.bisect_left([1,2,3,4], 1.5); i = bisect.bisect_right([4,3,2,1], 1.5)

#import numpy as np
#from scipy.misc import comb

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in ss]
ss2nnn = lambda ss: [s2nn(s) for s in ss]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [sys.stdin.readline().rstrip() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    #L = int(i2s(), 2)
    S = i2s()
    N = len(S)
    MOD = int(1e+9) + 7
    dp1 = [0] * (N+1)  # 上からi-1桁までで a + b <= L が未確定のパターン数
    dp2 = [0] * (N+1)  # 上からi-1桁までで a + b <= L が確定済のパターン数
    dp1[0] = 1
    for i, s in enumerate(S):
        n11 = dp1[i]
        n12 = dp2[i]
        n21 = 0
        n22 = 0
        if s == '0':
            n21 += n11  # 未確定のとき、(0,0) のみ、パターン数変わらず
            n22 += n12 * 3  # 確定済のとき、(0,0),(0,1),(1,0) 全てOKなので、パターン数3倍
        else:
            #n21 += n11 * 3  # 未確定のとき、(0,0),(0,1),(1,0) 全てOKなので、パターン数3倍
            #n22 += n12 * 3  # 確定済のとき、(0,0),(0,1),(1,0) 全てOKなので、パターン数3倍
            # ↑惜しい、未確定かつ(0,0)のとき確定済に遷移する、という状態遷移考察が抜けている
            n21 += n11 * 2
            n22 += n11 * 1 + n12 * 3
        dp1[i+1] = n21 % MOD
        dp2[i+1] = n22 % MOD
    n = (dp1[N] + dp2[N]) % MOD
    print(n)

main()


Measured memory_bytes: 41200
#include <cstdio>

using namespace std;

int n;
int a[111111];

int main(void) {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", a+i);

  int res = 0;
  for (int i = 0; i < n; i++) {
    if (i == a[a[i]-1]-1) res += 1;
  }
  printf("%d\n", res/2);
  return 0;
}


Measured memory_bytes: 512
#! /usr/bin/env python3
# -*- coding:utf-8 -*-

def isGoodTap(s):
    for i, x in enumerate(s):
        if i%2:
            if x == 'R': return False
        else:
            if x == 'L': return False
    return True

def main():
    s = input()
    if isGoodTap(s): print("Yes")
    else: print("No")

if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef long long ll;
const int INF = (int)1e9 + 7;
#define REP(i, n) for (int i = 0, i < (n); i++)
#define ALL(obj) (obj).begin(), (obj).end() //コンテナじゃないと使えない!!
#define debug(x) cerr << #x <<
//cin,coutより遅いので注意
template <class T = int>
void in() //in<string>();とか書く intのときはそのままin();
{
    T x;
    cin >> x;
    return (x);
}
template <class T>
void print(T &x) { cout << x << "\n"; }

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

    int a, b, c, d;
    cin >> a >> b >> c >> d;
    cout << max(0LL, min(b, d) - max(a, c)) << "\n";
}

Measured memory_bytes: 256
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
#include <set>
#include <map>
#include <time.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


int table[1000][1000],row_memo[1000],col_memo[1000];

int main(){

	int H,W;
	scanf("%d %d",&H,&W);

	for(int row = 0; row < H; row++)row_memo[row] = 0;
	for(int col = 0; col < W; col++)col_memo[col] = 0;

	for(int row = 0; row < H; row++){
		for(int col = 0; col < W; col++){
			scanf("%d",&table[row][col]);
			if(table[row][col] == 0){
				row_memo[row]++;
				col_memo[col]++;
			}
		}
	}

	for(int row = 0; row < H; row++){
		for(int col = 0; col < W; col++){
			if(col > 0)printf(" ");
			printf("%d",((1-table[row][col])+row_memo[row]+col_memo[col])%2);
		}
		printf("\n");
	}

	return 0;
}



Measured memory_bytes: 7128
#include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cmath>

struct bit{
    std::vector<int> v;
    int siz;

    void init(int n)
    {
        for(siz=1;siz<=n;siz<<=1);

        v.resize(siz+2);
    }
    void add(int pos, int val)
    {
        while(pos <= siz)
        {
            v[pos] += val;
            pos += (pos & -pos);
        }
    }

    int sum(int pos)
    {
        int ret = 0;
        while(pos)
        {
            ret += v[pos];
            pos -= (pos & -pos);
        }
        return ret;
    }
};
std::vector<int> x;
int n;
int t;
int check(int m)
{
    bit b;
    b.init(2*n+4);
    int pos = n+1;
    long long int ans = 1LL * n * (n+1) / 2LL;
    b.add(pos, 1);
    for(int i=0;i<n;i++)
    {
        if(x[i] >= m) pos++;
        else pos--;
        ans -= 2 * b.sum(pos);
        b.add(pos, 1);
    }
    return ans <= 0;
}
int main()
{
    scanf("%d", &n);
    for(int i=0;i<n;i++)
    {
        scanf("%d", &t);
        x.push_back(t);
    }
    int l = 0;
    int r = 1000000009;
    while(l < r)
    {
        int m = (l+r) / 2;
        if(check(m)) l = m+1;
        else r = m;
    }
    printf("%d", r-1);
}

Measured memory_bytes: 1784
n=gets.to_i
h=gets.split.map(&:to_i)

if n==1
    puts "Yes"
    return
end

cur=0
(n-1).times do |i|
    if h[cur]-h[i+1]>1
        puts "No"
        return
    elsif h[i+1]>h[cur]
        cur=i+1
    end
end
puts "Yes"


Measured memory_bytes: 20704
/*
*          Name : chaitanya
*
*     Institute : ANITS,Visakhapatnam
*
*/
#include<cstdio>
#include<iostream>
#include<sstream>
#include<fstream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<complex>
#include<cstring>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<numeric>
#include<limits>
#include<climits>
#include<cfloat>
#include<functional>
#include<iterator>
#include <random>
#define infy  1000000000
#define all(x) begin(x),end(x)
#define ll long long int
#define ff first
#define ss second
#define pb push_back
const ll m = 1000000007;
#pragma GCC optimization ("O3")
const int N = 1000010;
using namespace std;
vector<string> vec_splitter(string s) {
  s += ',';
  vector<string> res;
  while(!s.empty()) {
    res.push_back(s.substr(0, s.find(',')));
    s = s.substr(s.find(',') + 1);
  }
  return res;
}
void debug_out(
vector<string> __attribute__ ((unused)) args,
__attribute__ ((unused)) int idx, 
__attribute__ ((unused)) int LINE_NUM) { cerr << endl; } 
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
  if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
  stringstream ss; ss << H;
  cerr << args[idx] << " = " << ss.str();
  debug_out(args, idx + 1, LINE_NUM, T...);
}
#ifndef ONLINE_JUDGE
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
#else
#define debug(...) 42
#endif

ll f[2000010];

ll lcm(ll a,ll b)
{
  return (a*b)/__gcd(a,b);
}
ll binpow(ll a, ll b) {
     ll res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}
 
ll find_ncr(ll n, ll r)
{
    ll m1=max(r,n-r);
    ll i,j,s,d=1,k;
    s=1;
 
    for(i=m1+1;i<=n;i++)
    {
        s=((s%m)*(i%m))%m;
    }
 
    m1=min(r,n-r);
 
    for(i=1;i<=m1;i++)
    {
        k=binpow(i,m-2);
        d=((d%m)*(k%m))%m;
    }
 
    k=(s%m*(d%m))%m;
 
    return k;
}

int main()
{
  // int x = -1, y = 10000;
  // double z = 0.2;
  // string s2 = "beginner1010";
  // long long b = 1LL << 60;
    
  // // debug(x, y, z, s, b);
    
  // double aux = 1010.0;
  // string code = "code";
    
  // debug(code + "forces",-aux / 10 * 2.3);
  // freopen("input.txt","r",stdin);
  // freopen("output.txt","w",stdout);
  //ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
  int n,a,b;
  cin >> n >> a >> b;
  for (int i = a; i <= b; ++i)
  {
    if (i % n == 0)
    {
      cout << "OK";
      return 0;
    }
  }
  cout << "NG";
  return 0;
}



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

using namespace std;

/*-------------------------------*/
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define RFOR(i, a, b) for(int i = (b) - 1; i >= (a); i--)
#define REP(i, n) for(int i = 0; i < (n); i++)
#define rep(i, n) for(int i = 0; i < (n); i++)
#define RREP(i, n) for(int i = (n) - 1; i >= 0; i--)
#define rrep(i, n) for(int i = (n) - 1; i >= 0; i--)
#define all(i) (i).begin(),(i).end()
#define pb push_back
#define mp make_pair

typedef long long ll;
typedef pair<int, int> pint;
typedef vector<int> vi;
typedef vector<vector<int> > vii;
typedef vector<long long> llv;
typedef vector<pint> vpint;

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

int main(void)
{
  int i[5];
  int x, y;
  rep(a, 5) cin >> i[a];

  x = i[1] % i[3] != 0 ? i[1] / i[3] + 1 : i[1] / i[3];
  y = i[2] % i[4] != 0 ? i[2] / i[4] + 1 : i[2] / i[4];
  x = max(x, y);

  cout << i[0] - x << endl;

  return 0;
}

Measured memory_bytes: 3092
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stdlib.h>
#include <math.h>
#include <numeric>


int main() {
	int a, b, k;

	std::cin >> a >> b >> k;

	for (size_t i = a; i < std::min(a + k, b + 1); i++)
	{
		std::cout << i << std::endl;
	}

	for (size_t i = std::max(b - k + 1, a + k); i <= b; i++)
	{
		std::cout << i << std::endl;
	}

	return 0;
}

Measured memory_bytes: 256
import scala.io.StdIn.readLine;
import scala.reflect.ClassTag;
object Main {
    def main(args: Array[String]): Unit = {
        val pq = new PriorityQueue[Int]();
        def go(ret: List[Int]): List[Int] = {
            val line = readLine;
            if (line.startsWith("insert")) {
                val Array(command, id) = line.split(" ");
                pq.insert(id.toInt);
                go(ret);
            } else if (line.startsWith("extract")) {
                pq.extract match {
                    case None => go(ret);
                    case Some(id) => go(id :: ret);
                }
            } else {
                ret.reverse;
            }
        }
        println(go(Nil).mkString("\n"))
    }
    
}
class PriorityQueue[A](implicit ord: Ordering[A], m: ClassTag[A]) {
    import ord._;
    val heap = m.newArray(2000000);
    var length = 0;
    def insert(id: A): Unit = {
        def go(idx: Int): Unit = {
            val parent = if (idx % 2 != 0) (idx - 1) / 2 else (idx - 2) / 2;
            if (parent >= 0) {
                if (heap(idx) > heap(parent)) {
                    swap(idx, parent);
                    go(parent);
                }
            }
        }
        heap(length) = id;
        go(length);
        length += 1;
    }
    
    def extract: Option[A] = {
        if (length < 1) {
            None
        } else if (length == 1) {
            length -=1;
            Some(heap(0));
        } else {
            val ret = Some(heap(0));
            length -= 1;
            heap(0) = heap(length);
            heapify(0);
            ret;
        }
    }
    def build: Unit = {
        def go(idx: Int): Unit = {
            if (idx < length) {
                go(idx * 2 + 1);
                go(idx * 2 + 2);
                heapify(idx);
            }
        }
        go(0);
    }
    def heapify(idx: Int): Unit = {
        val left = idx * 2 + 1;
        val right = idx * 2 + 2;
        if (right < length) {
            val m = max(idx, left, right);
            if (idx != m) {
                swap(idx, m);
                heapify(m);
            }
        } else if (left < length) {
            if (heap(left) > heap(idx)){
                swap(idx, left);
            }
        }
    }
    def max(k1: Int, k2: Int, k3: Int): Int = {
        val v1 = heap(k1); val v2 = heap(k2); val v3 = heap(k3);
        if (v2 > v1) {
            if (v3 > v2) k3 else k2;
        } else {
            if (v3 > v1) k3 else k1;
        }
    }
    def swap(a: Int, b: Int): Unit = {
        val tmp = heap(a);
        heap(a) = heap(b);
        heap(b) = tmp;
    }
}



Measured memory_bytes: 507604
#include<iostream>
using namespace std;
int main()
{
   string s;
   int l,i,sum=0;
   cin>>s;
   l=s.size();
   for(i=0;i<l;i++)
   {
       s[i]=int(s[i]-48);
       sum+=s[i];
   }
   if(sum%9==0)
   {
       cout<<"Yes"<<endl;
   }
   else
    cout<<"No"<<endl;
}

Measured memory_bytes: 3696
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>

using namespace std;

#define int long long
#define rep(i,n) for(int i = 0; i < (n); i++)
#define INF ((long long)1e18)
#define MOD ((int)1e9+7)
#define endl "\n"

#define yn(f) ((f)?"Yes":"No")
#define YN(f) ((f)?"YES":"NO")

#define MAX 110


int dp[5][MAX];

long long power_mod(long long x, long long n){
	long long ans = 1;
	for(;n;n>>=1,x*=x,ans%=MOD,x%=MOD)
		if(n&1)ans*=x;
	return ans%MOD;
}

signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);
	
	int ans = 0;
	int N;
	
	cin>>N;
	
	for(int i = 0; i < 4; i++){
		dp[i][0] = 1;
	}
	
	for(int i = 0; i < N; i++){
		for(int k = 0; k < 4; k++){
			for(int j = 0; j < 4; j++){
					dp[k][i+1] += dp[j][i];
					dp[k][i+1] %= MOD;
			}
		}
		if(i >= 1){
			dp[1][i+1] = (dp[1][i+1]+MOD-dp[0][i-1])%MOD;
			dp[2][i+1] = (dp[2][i+1]+MOD-dp[0][i-1])%MOD;
			dp[1][i+1] = (dp[1][i+1]+MOD-dp[2][i-1])%MOD;
		} 
		if(i >= 2){
			dp[1][i+1] = (dp[1][i+1]+MOD-dp[0][i-2]*3%MOD)%MOD;
			dp[2][i+1] = (dp[2][i+1]+MOD+dp[2][i-2])%MOD;
		}
		// cout<<i<<" "<<dp[0][i]<<endl;
	}
	
	for(int i = 0; i < 4; i++){
		ans += dp[i][N-1];
	}
	
	ans %= MOD;
	
	cout<<ans<<endl;
	
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define MOD	1000000007
#define int	long long
#define pii pair<int,int> 
#define vi vector<int>
using namespace std;

int32_t main(){
	int n;
	cin >> n;
	
	cout << n*n*n << endl;

	return 0;
}



Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>
#include <deque>
#include <numeric>

using namespace std;

#define mod 1000000007

int main()
{
	int n;
	cin >> n;
	map<int, int> m;
	for(int i = 0; i < n; i++){
		int a;
		cin >> a;
		if(m.find(a) == m.end()) m[a] = 0;
		m[a]++;
	}
	int ans = 0;
	for(auto itr = m.begin(); itr != m.end(); itr++){
		if((*itr).second % 2 == 1) ans++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 4864
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<algorithm>
using namespace std;

int main() {
	int n;
	cin >> n;
	int a = n / 10;
	int b = n % 10;
	if (a == 9 || b == 9)
		cout << "Yes";
	else
		cout << "No";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
void f(int a, int b, int u) {
	if (u) {
		int d = ((a ^ b) & u) & -((a ^ b) & u);
		u ^= d;
		int c = a ^ (u & -u);
		f(a, c, u);
		f(c ^ d, b, u);
	} else {
		printf("%d ", a);
	}
}
signed main() {
	int n, a, b;
	scanf("%d%d%d", &n, &a, &b);
	if (__builtin_parity(a ^ b)) {
		puts("YES");
		f(a, b, (1 << n) - 1);
	} else {
		puts("NO");
	}
}

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

using namespace std;
typedef long long lint;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector<lint> vl;
typedef pair<lint,lint> pll;
#define mpr make_pair

void solve(){
    int n; cin>>n;
    vl a(n);
    lint xand = 0;
    for (int i=0; i<n; ++i){
        cin>>a[i];
        xand ^= a[i];
    }
    if (xand == 0) {
        cout<<"DRAW\n"; return;
    }
    int bit = 33;
    for (bit=33; bit>=0; bit--){
        if (xand & (1LL<<bit)) break;
    }
    int cnt = 0;
    for (lint v : a)
        if (v & (1LL<<bit))
            cnt++;
    assert(cnt%2);
    int k = cnt/2;

    if (k % 2 == 0) cout<<"WIN\n";
    else
    {
        if ((n- cnt)%2==0 ) cout<<"LOSE\n";
        else cout<<"WIN\n";
    }
}

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

    int n, k; cin>>n>>k;
    vl a(n);
    for (lint &i : a) cin>>i;

    for (int i = k; i<n; ++i){
        if (a[i] > a[i-k]) cout<<"Yes\n";
        else cout<<"No\n";
    }

}


Measured memory_bytes: 4784