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

using namespace std;
#define IOS ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define ll long long
#define ld long double
#define MOD 1000000007
#define endl "\n"

bool isPrime(int n)
{
	if(n<2)
		return 0;
	if(n<4)
		return 1;
	if(n%2==0 || n%3==0)
		return 0;
	for(int i=5;i*i<=n;i+=6)
	{
		if(n%i==0 || n%(i+2)==0)
			return 0;
	}
	return 1;
}

int modexpo(int x,int p)
{
	int res=1;
	x=x%MOD;
	while(p)
	{
		if(p%2)
			res=res*x;
		p>>=1;
		x=x*x%MOD;
		res%=MOD;
	}
	return MOD;
}

int main()
{
	IOS;
	ll n,a,b;
	cin >>n>>a>>b;
	ll d=(b-a);
	if(d%2==0)
		cout << d/2 <<endl;
	else
	{
		ll a1=a+(d-1)/2;
		ll b1=(n-b+1)+(d-1)/2;
		cout <<min(a1,b1) <<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <array>
#include <deque>
#include <algorithm>
#include <utility>
#include <cstdint>
#include <functional>
#include <iomanip>
#include <numeric>
#include <assert.h>
#include <bitset>
#include <list>
#include <math.h>
using namespace std;

int main()
{
	string s;
	cin >> s;
	string t;
	for (int i = 0; i < s.length(); i++)
	{
		if (s[i] == '0')
		{
			t += '0';
		}
		else if (s[i] == '1')
		{
			t += '1';
		}
		else if (t.length() != 0)
		{
			t.pop_back();
		}
	}
	cout << t << endl;
}


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

int main()
{
    int N, M, X;
    cin >> N >> M >> X;
    int C[N], A[N][M];
    for (int i = 0; i < N; i++)
    {
        cin >> C[i];
        for (int j = 0; j < M; j++)
        {
            cin >> A[i][j];
        }
    }
    long long ans = 10000000000;
    for (int bit = 0; bit < (1 << N); bit++)
    {
        vector<int> score(N, 0);
        long long cost = 0;
        for (int i = 0; i < N; i++)
        {
            if (bit & (1 << i))
            {
                for (int j = 0; j < M; j++)
                {
                    score[j] += A[i][j];
                }
                cost += C[i];
            }
        }
        bool is_ok = true;
        for (int i = 0; i < M; i++)
        {
            if (score[i] < X)
            {
                is_ok = false;
            }
        }
        if (is_ok)
        {
            ans = min(ans, cost);
        }
    }
    if (ans != 10000000000)
    {
        cout << ans << endl;
    }
    else
    {
        cout << "-1" << endl;
    }
}


Measured memory_bytes: 3636
<?php
	$input = trim(fgets(STDIN));
	$input = str_replace(array("\r\n","\r","\n"), '', $input);
	$array = explode(" ", $input);

	$result = $array[0] * $array[1];

	if( $result % 2 == 0 ) {
    	echo "Even";
    } else {
      	echo "Odd";
    }
  
?>

Measured memory_bytes: 3576
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define REP(i,b) FOR(i,0,b)
#define INF 1e9

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

  if (x < 1200) {
    cout<<"ABC";
  } else {
    cout<<"ARC";
  }

  return 0;
}

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

using namespace std;
using ll = long long;
// #define int ll
using PII = pair<ll, ll>;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()

template<typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }

template<typename T> vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts) {
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type
fill_v(T &t, const V &v) { t=v; }
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t, const V &v ) { for(auto &e:t) fill_v(e,v); }

template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a){
  out<<'('<<a.first<<','<<a.second<<')'; return out;
}
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
  for(T& x: vec) {is >> x;} return is;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
  out<<'['; for(T i: a) {out<<i<<',';} out<<']'; return out;
}

int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0}; // DRUL
const int INF = 1<<30;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;

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

  ll n;
  cin >> n;
  vector<ll> l(n);
  REP(i, n) cin >> l[i];

  ll ma = 0, sum = 0;
  REP(i, n) {
    chmax(ma, l[i]);
    sum += l[i];
  }
  sum -= ma;

  if(ma < sum) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<utility>
#include<algorithm>
#include<cmath>
#include<climits>
using namespace std;

int main(){
	int h, w;
	cin >> h >> w;
	vector<string> s(h);
	for(int i=0; i<h; i++)
		cin >> s[i];
	for(int i=0; i<h; i++){
		for(int j=0; j<w; j++){
			if(s[i][j] != '#'){
				int n=0;
				if(i!=0){
					if(j!=0 && s[i-1][j-1]=='#')
						n++;
					if(s[i-1][j]=='#')
						n++;
					if(j!=w-1 && s[i-1][j+1]=='#')
						n++;
				}
				if(j!=0 && s[i][j-1]=='#')
					n++;
				if(j!=w-1 && s[i][j+1]=='#')
					n++;
				if(i!=h-1){
					if(j!=0 && s[i+1][j-1]=='#')
						n++;
					if(s[i+1][j]=='#')
						n++;
					if(j!=w-1 && s[i+1][j+1]=='#')
						n++;
				}
				s[i][j] = char('0'+n);
			}
		}
	}
	for(int i=0; i<h; i++)
		cout << s[i] << endl;
	return 0;
}

Measured memory_bytes: 256
#include"bits/stdc++.h"
#include<boost/multi_array.hpp>
#include<boost/optional.hpp>
#include<boost/range/irange.hpp>
#include<boost/range/algorithm.hpp>
#include<boost/range/adaptor/reversed.hpp>
namespace adaptor = boost::adaptors;
template<class T>using p_queue = std::priority_queue<T, std::vector<T>, std::greater<>>;

void Main()
{
	int r, d, x;
	std::cin >> r >> d >> x;
	for (int i : boost::irange(0, 10))
	{
		x = r * x - d;
		std::cout << x << std::endl;
	}
}

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

Measured memory_bytes: 256
#include <iostream>
#include<algorithm>
#include<string>
#include <cmath>
#include <vector>
#include <map>
#include <cstdio>
#pragma region Macros
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
#define int long long
#define all(x) (x).begin(),(x).end()
#define swap(a,b) (a += b,b = a - b,a -= b)
#define ceil(a,b) ((a+b-1)/b)
int gcd(int a, int b) // assuming a,b >= 1
{
    if (a < b)
        swap(a, b);
    if (b == 0)
        return a;
    if (a % b == 0)
        return b;
    return gcd(b, a % b);
}
int lcm(int a, int b) // assuming a,b >= 1
{
    return  a * b / gcd(a, b);
}
using namespace std;
#pragma endregion
signed main() {
    int N;
    cin >> N ;
    if (N < 1200)
        cout << "ABC";
    else if (N < 2800)
        cout << "ARC";
    else
        cout << "AGC";
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<utility>
#include<algorithm> // sort
#include<map> // pair
#include<cmath>
#include<cstring>
#include<set>
using namespace std;
using ll = long long;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
#define rep(i, n) REP(i, 0, n)
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
#define all(x) (x).begin(),(x).end()
const ll mod = 1e9+7;
const int INF = 1e9;
const ll INFLONG = 1e18;
// vector<vector<ll>> vec(100000,vector<ll>(3,0));
int main(){
  ll k,x;
  cin >> k >> x;
  REP(i,x-k+1,x+k){
    cout << i << " ";
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <functional>
#include<vector>
#include<math.h>
#include<bitset>
#include<string>
#include <deque>
#include<queue>
#include<map>
using namespace std;


int tyousa[100009];
int sosuu[100009];
int dp[100009];
int main() {

	int Q;
	cin >> Q;
	tyousa[0] = tyousa[1] = 1;
	sosuu[0] = sosuu[1] = 1;

	for (int i = 2; i < 100008; i++) {
		
		dp[i] = dp[i - 1];
		
		if (!sosuu[i]) {
			
			for (int m = 2 * i; m < 100008; m += i) {
				
				tyousa[m] = 1;
				sosuu[m] = 1;
				
			}
			
			


			if (i % 2 == 1 && sosuu[(i + 1) / 2] == 0) {

			}
			else tyousa[i] = 1;
			
		}
		
		
		if (!tyousa[i])dp[i]++;
		
	}

	
	int a, b;
	vector<int> vec(Q);
	for (int i = 0; i < Q; i++) {
		cin >> a >> b;
		
		vec[i] = dp[b] - dp[a - 1];
	}

	for (int i = 0; i < Q; i++) {
		cout << vec[i] << endl;
	}

	return 0;
}



Measured memory_bytes: 2176
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define all(x) (x).begin(), (x).end()
using ll = long long;
using namespace std;
template <typename T> using vec = std::vector<T>;

int main() {
    string ans;
    vec<string> s(3);
    rep(i, 3) {
        cin >> s[i];
        ans += toupper(s[i][0]);
    }

    cout << ans << endl;
}


Measured memory_bytes: 3544
import math
N=int(input())
A=list(map(int,input().split()))
A.sort(reverse=True)
ans=A[0]
 
for i in range(int(N/2)-1):
    ans+=A[i+1]*2
 
if N%2==1:
    ans+=A[int(N/2)]
 
print(ans)

Measured memory_bytes: 32728
from itertools import permutations
n = int(input())
p = list(map(int, input().split()))
q = list(map(int, input().split()))

l = [i for i in range(1, n + 1)]

ans = 0
k = 0
for A in permutations(l):
    a = list(A)
    k += 1
    pf = True
    qf = True
    for i in range(n):
        if a[i] != p[i]:
            pf = False
        if a[i] != q[i]:
            qf = False
    if pf:
        ans = abs(ans - k)
    if qf:
        ans = abs(ans - k)

print(ans)


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define INF (ll)1e18+7
#define md (ll)1e9+7
#define mk make_pair
#define pi pair<int,int>
#define pb emplace_back 
#define all(s) s.begin(),s.end()
#define fr(i,a,b) for(int i=a;i<=b;i++)
#define rep(i,a,b) for(int i=a;i<b;i++)
#define sz(x) ((long long)x.size())
#define mez(s) memset(s,0,sizeof s)
#define mex(s) memset(s,-1,sizeof s)
typedef vector<int> vi; 
typedef vector<ll>vl;
typedef map<int,int> mp;
typedef queue<int> que;
typedef vector<pi> vp;
int n;
int gh[10005];
int solve(int x,int y,int z){
	return x*x+y*y+z*z+x*y+y*z+z*x;
}
int dp[101][101][101];
void dfs(int a,int b,int c){
	
	if(solve(a,b,c)<=n&&dp[a][b][c]==-1)
	{gh[solve(a,b,c)]++;
	dp[a][b][c]=1;
	}
	else
	return;
	dfs(a+1,b,c);
	dfs(a,b+1,c);
	dfs(a,b,c+1);
}

int main(){
//freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);
ios::sync_with_stdio(false);
cin.tie(0);
   int t=1;
  //cin>>t;
  mez(gh);
  mex(dp);
     while(t--){
     	cin>>n;
     	dfs(1,1,1);
     	fr(i,1,n)
     	cout<<gh[i]<<"\n";
	 }
     return 0;
}

Measured memory_bytes: 7616
d = int(input())
c = list(map(int, input().split()))
s = [list(map(int, input().split())) for _ in range(d)]

last = [0] * 26
for di in range(d):
    tmpl = [c[i] * (di + 1 - last[i]) for i in range(26)]
    ti = tmpl.index(max(tmpl))
    last[ti] = di + 1
    print(ti + 1)


Measured memory_bytes: 73556
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;

int main()
{
	int p[31];
	p[0] = 1;
	p[1] = 1;
	p[2] = 2;
	for (int i = 3; i <= 30; ++i)
	{
		p[i] = p[i-1] + p[i-2] + p[i-3];
	}
	while(1){
		int y, n;
		cin >> n;
		if(n == 0){
			break;
		}
		y = p[n] / 10 / 365 + 1;
		
		cout << y << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#include <stdio.h>
#include <string.h>
#define MAX 1000

int max(int x,int y){
  if(x > y) return x;
  else return y;
}

int LCS(char *s,char *t){
  int c[MAX+1][MAX+1];
  int maxl = 0;
  s[0] = ' ';
  t[0] = ' ';
  int m = strlen(s)-1;//size of s
  int n = strlen(t)-1;//size of t
  for(int i = 0; i <= m; i++) c[i][0] = 0;
  for(int j = 1; j <= n; j++) c[0][j] = 0;

  for(int i = 1; i <= m; i++){
    for(int j = 1; j <= n; j++){
      if(s[i] == t[j]){
	c[i][j] = c[i-1][j-1] + 1;
      }
      else {
	c[i][j] = max(c[i-1][j],c[i][j-1]);
      }
      maxl = max(maxl,c[i][j]);
    }
  }

  return maxl;
}
  

int main()
{
  int n;
  char s[MAX],t[MAX];
  scanf("%d",&n);
  for(int i = 0; i < n; i++){
    scanf("%s",&s[1]);
    scanf("%s",&t[1]);
    printf("%d\n",LCS(s,t));
  }
  return 0;
}



Measured memory_bytes: 5772
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <functional>
#include <map>
#include <iomanip>
#include <math.h> 
#include <stack>
#include <queue>
#include <bitset>
#include <cstdlib>
#include <tuple>
#include <cctype>
#include <ctype.h>
#include <set>
#include <sstream>
#include <time.h>
using namespace std;
//#define int long long
#define rep(i,s,n) for(int i = s;i<n;i++)
#define repe(i,s,n) for(int i = s;i<=n;i++)
#define rrep(i,s,n) for(int i = (n)-1;i>=(s);i--)
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define fi first
#define se second
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))
#define l1 list[index]
#define l2 list[index - 1]
#define l3 list[index + 1]
#define iif(i,j) ((i<0 && j<0) || (i>0 && j>0)) ? true : false 
typedef long long ll;
typedef pair<int, int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
typedef pair<pint, int> P1;
typedef pair<int, pint> P2;
typedef pair<pint, pint> PP;
static const ll maxLL = (ll)1 << 62;
const ll MOD = 1000000007;
const ll INF = 1e18;
int ca[12] = { 31,28,31,30,31,30,31,31,30,31,30,31 };

struct MyStruct
{
	int list[13];
};


signed main() {
	int i, j, n;
	string s;
	bool flag = false;
	vector<int>list(26,0);

	
	while (getline(cin, s)) {
		for (i = 0; i < s.length(); i++) {
			if (s[i] >= 'A' && s[i] <= 'Z') {
				list[s[i] - 65]++;
			}
			else if (s[i] >= 'a' && s[i] <= 'z') {
				list[s[i] - 97]++;
			}

		}

	}


	for (i = 0; i < 26; i++) {
		cout << (char)(i + 97) << " : " << list[i] << endl;
	}




	getchar();
	getchar();
	return 0;
}


Measured memory_bytes: 3212
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
using namespace std;
#define REP(i, j) for(int i = 0; i < (int)(j); ++i)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
typedef complex<double> P;

int main() {
  int N;
  while(cin >>N && N){
    vector<int> ns(N), ps(N), qs(N), rs(N);
    REP(i, N) cin >>ns[i] >>ps[i] >>qs[i] >>rs[i];
    int P, Q, R, C; cin >>P >>Q >>R >>C;
    bool f = true;
    REP(i, N){
      int p = ps[i], q = qs[i], r = rs[i], c = p * 4 + q * 9 + r * 4;
      if(p > P || q > Q || r > R || c > C) continue;
      f = false;
      cout <<ns[i] <<endl;
    }
    if(f) cout <<"NA" <<endl;
  }
  return 0;
}

Measured memory_bytes: 1212
#include <cstdio>
#include <algorithm>
#include <vector>
#include <string>

#define size_t int

using namespace std;

int main(int argc, char const *argv[]) {
  int N;
  scanf("%d", &N);
  for (size_t i = N; i <= 999; i++) {
    int x = i;
    // printf("%d\n", x);
    int a = x / 100;
    x -= a*100;
    int b = x / 10;
    x -= b*10;
    int c = x;
    // printf("%d %d %d\n", a, b, c);
    if (a == b && b == c && c == a) {
      printf("%d\n", i);
      return 0;
    }
  }
  return 0;
}


Measured memory_bytes: 128
s = list(map(int, input()))
count = 0
for i in range(len(s)-1):
    if s[i] + s[i+1] != 1:
        if s[i] == 0:
            s[i+1] = 1
        else:
            s[i+1] = 0
        count += 1
print(count)

Measured memory_bytes: 3956
#include <bits/stdc++.h>
using namespace std;
 
int main() {
	int n, ans = 0;
	cin >> n;

	vector<int> p(n);
	for(int i=0;i<n;i++) cin >> p.at(i);

	for(int i=1;i<n-1;i++){
		if(p.at(i-1)<p.at(i) && p.at(i)<p.at(i+1))
			ans++;
		else if(p.at(i-1)>p.at(i) && p.at(i)>p.at(i+1))
			ans++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<map>
#include<string.h>
#include<complex>
#include<math.h>
#include<queue>
#include <functional>
#include<time.h>
#include <stack>
#include<iomanip>
using namespace std;
#define rep(i,a,n) for(int i=(a);i<(n);i++)
#define ll long long
#define llint long long int
#define reverse(v)  reverse(v.begin(), v.end());
#define Yes(ans) if(ans)cout<<"Yes"<<endl; else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl; else cout<<"NO"<<endl;
#define hei(a) vector<a>
#define whei(a) vector<vector<a>>
#define UF  UnionFind 
#define Pint pair<int,int>
#define keta(a)  fixed << setprecision(a)
constexpr auto INF = 1000000000000000000;
constexpr auto mod = 1000000007;
//辞書順はnext_permutation( begin( v ), end( v ) );やで！
struct edge { int to, cost; };

ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0)return a;
	return gcd(b, a % b);
}

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

// mod. m での a の逆元 a^{-1} を計算するよ！
long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}


//aCbをmod.mで割った余りを求める
ll int c(ll int a, ll int b, ll int m) {
	ll int ans = 1;
	for (ll int i = 0; i < b; i++) {
		ans *= a - i;
		ans %= m;
	}
	for (ll int i = 1; i <= b; i++) {
		ans *= modinv(i, m);
		ans %= m;
	}
	return ans;
}
struct UnionFind {
	vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

	UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
		for (int i = 0; i < N; i++) par[i] = i;
	}
	int size(int a) {
		return par[root(a)];
	}

	int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
		if (par[x] == x) return x;
		return par[x] = root(par[x]);
	}

	void unite(int x, int y) { // xとyの木を併合
		int rx = root(x); //xの根をrx
		int ry = root(y); //yの根をry
		if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
		par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
	}

	bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
		int rx = root(x);
		int ry = root(y);
		return rx == ry;
	}
};

int main() {
	long double a, b,ans;
	cin >> a >> b;
	ans = a * b;
	cout <<  (ll)ans << endl;
	return 0;
}


Measured memory_bytes: 3732
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <iomanip>
#include <limits>
using namespace std;

int main() {
    int A, B, C;
    cin >> A >> B >> C;
    if (B + C < A) {
        cout << 0 << endl;
    }
    else {
        cout << B + C - A << endl;
    }
}

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

int main(){
  int N, M, i, cnt = 0;
  cin >> N >> M;
  vector<int> X(M), dX(M - 1);
  for(i = 0; i < M; i++) cin >> X[i];
  sort(X.begin(), X.end());
  for(i = 0; i < M - 1; i++) dX[i] = X[i + 1] - X[i];
  sort(dX.begin(), dX.end());
  for(i = 0; i < max(0, M - N); i++) cnt += dX[i];
  cout << cnt << endl;
  return 0;
}

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

namespace ConsoleApp1
{
	class Program
	{
		static void Main(string[] args)
		{
			var inputs = Console.ReadLine().Split(' ');
			var a = long.Parse(inputs[0]);
			var b = long.Parse(inputs[1]);
			var c = long.Parse(inputs[2]);
			var d = long.Parse(inputs[3]);

			var s = new[]
			{
				a * c,
				a * d,
				b * c,
				b * d
			};

			Console.WriteLine(s.Max());
		}
	}
}


Measured memory_bytes: 18840
#include <iostream>
#include <vector>
#include <string>

using namespace std;

#define TIMES(i_, n_) for(int i_ = 0; i_ < (n_); ++i_)

int put(vector<string> &field, int r, int c, char ch, bool actual = false) {
    static const int DR[] = {0, -1, -1, -1, 0, 1, 1, 1};
    static const int DC[] = {1, 1, 0, -1, -1, -1, 0, 1};
    int cnt = 0;
    TIMES(dir, 8) {
        int cur_r = r + DR[dir], cur_c = c + DC[dir];
        int tmp = 0;
        int phase = 0;
        while(0 <= cur_r && cur_r < 8 && 0 <= cur_c && cur_c < 8) {
            if(field[cur_r][cur_c] == ch) {
                cnt += tmp;
                if(actual && phase == 0) {
                    phase = 1;
                    cur_r = r+DR[dir];
                    cur_c = c+DC[dir];
                    continue;
                }
                break;
            }
            if(field[cur_r][cur_c] == '.') break;
            if(phase == 1) field[cur_r][cur_c] = ch;
            ++tmp;
            cur_r += DR[dir];
            cur_c += DC[dir];
        }
    }
    if(actual) {
        field[r][c] = ch;
    }
    return cnt;
}

bool mami(vector<string> &field) {
    int max_cnt = 0;
    int best_r, best_c;
    TIMES(r, 8) {
        TIMES(c, 8) {
            if(field[r][c] != '.') continue;
            int cnt = put(field, r, c, 'o');
            if(cnt > max_cnt) {
                max_cnt = cnt;
                best_r = r;
                best_c = c;
            }
        }
    }
    if(max_cnt > 0) {
        put(field, best_r, best_c, 'o', true);
    }
    return max_cnt > 0;
}

bool witch(vector<string> &field) {
    int max_cnt = 0;
    int best_r, best_c;
    for(int r = 7; r >= 0; --r) {
        for(int c = 7; c >= 0; --c) {
            if(field[r][c] != '.') continue;
            int cnt = put(field, r, c, 'x');
            if(cnt > max_cnt) {
                max_cnt = cnt;
                best_r = r;
                best_c = c;
            }
        }
    }
    if(max_cnt > 0) {
        put(field, best_r, best_c, 'x', true);
    }
    return max_cnt > 0;
}

bool solve() {
    vector<string> field(8);
    TIMES(i, 8) {
        cin >> field[i];
    }
    while(true) {
        bool changed = false;
        changed = mami(field) || changed;
        changed = witch(field) || changed;
        if(!changed) break;
    }
    TIMES(i, 8) {
        cout << field[i] << endl;
    }
    return false;
}

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

    while(solve()) ;
    return 0;
}

Measured memory_bytes: 1184
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N = int(readline())
H = list(map(int,readline().split()))
A = list(map(int,readline().split()))

"""
・最後の高さ -> 価値の総和
・BITでmaxを管理
"""

class BIT():
    def __init__(self, max_n):
        self.size = max_n + 1
        self.tree = [0] * self.size
        
    def __repr__(self):
        return self.tree.__repr__()
        
    def get_max(self,i):
        s = 0
        while i:
            t = self.tree[i]
            if s<t:
                s=t
            i -= i & -i
        return s
 
    def update(self, i, x):
        while i < self.size:
            if self.tree[i] >= x:
                return
            self.tree[i] = x
            i += i & -i

bit = BIT(N)

for i,(a,h) in enumerate(zip(A,H),1):
    x = bit.get_max(h)
    bit.update(h,x+a)

answer = bit.get_max(N)
print(answer)

Measured memory_bytes: 31424
N = int(input())
As = []
for _ in range(N):
    As.append(int(input()))

ans = 0
for idx,a in enumerate(As):
    if idx!=len(As)-1:
        tmp = As[idx]
        ans += tmp//2
        As[idx] = 1 * As[idx]%2

        tmp = min(As[idx], As[idx+1])
        # print('\t', tmp)
        ans += tmp
        As[idx] -= tmp
        As[idx+1] -= tmp
    else:
        tmp = As[idx]
        ans += tmp//2
        As[idx] = 1 * As[idx]%2
    # print(ans,As)

As = list(reversed(As))
for idx,a in enumerate(As):
    if idx!=len(As)-1:
        tmp = As[idx]
        ans += tmp//2
        As[idx] = 1 * As[idx]%2

        tmp = min(As[idx], As[idx+1])
        # print('\t', tmp)
        ans += tmp
        As[idx] -= tmp
        As[idx+1] -= tmp
    else:
        tmp = As[idx]
        ans += tmp//2
        As[idx] = 1 * As[idx]%2
    # print(ans,As)
# print('hhh')
print(ans)


Measured memory_bytes: 7132
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    string S;
    long long K;
    cin>>S;
    cin>>K;
    int a=S.size(),g=0;
    for(int i=0;i<a-1;i++){
        if(S.at(i)==S.at(i+1)){
        g++;
        }
    }
    if(a==1){
            cout<<K/2<<endl;
    }
    else if(g==a-1){
        cout<<a*K/2<<endl;
    }
    else{
    int c=0,s=1,ans=0;
    while(s<=a){
        int b=0;
        for(int j=s-1;j<a-1;j++){
          if(S.at(j)!=S.at(j+1)){
              break;
          }
        b++;
        }
        
        if(b%2==0){
            ans=ans+b/2;
        }
        else{
            ans=ans+b/2+1;
        }
        s=s+b+1;
    }
    int j=1;
    int e=0,f=0;
    while(j<a){
        if(S.at(j-1)!=S.at(j)){
        break;
        }
        j++;
        e++;
    }
    while(a>1){
        if(S.at(a-1)!=S.at(a-2)){
        break;
        }
        a--;
        f++;
    }
    if(S.at(0)==S.at(a-1)&&(e+f)%2==0&&e+f>1){
        c=1;
    }
    
    cout<<ans*K+c*(K-1)<<endl;
    }
}

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

    #define ll long long
    #define ff first
    #define ss second
    #define pb push_back
    #define vll vector<ll>
    #define mll map<ll,ll>
    #define MOD 1000000007
    #define pll pair<ll,ll>
constexpr ll INF = 1999999999999999997; 
    #define fastio ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
    int main() {
      fastio;

      int n;
      cin>>n;
      vector<pll>v;
      for(int i=0;i<n;i++)
      {
        ll a;
        cin>>a;
        v.pb({a,i+1});
      }
      sort(v.begin(),v.end());
      int c=0;
      int x=1;
      int pos=-1;
      for(auto j:v)
      {  //cout<<j.ff<<' '<<j.ss<<endl;
        if(j.ff==x)
        {
          if(j.ss>pos)
         { x++;
          c++;
          pos=j.ss;
        }
        }
      }
      if(c==0)
        cout<<-1<<endl;
      else
        cout<<n-c<<endl;
    }

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

int main() {
	long long a, b, k;
	cin>>a>>b>>k;
	
	if(a>=k){
		cout<<a-k<<' '<<b;
	}
	else{
		if(b>=k-a){
			cout<<0<<' '<<b-k+a;
		}
		else{
			cout<<0<<' '<<0;
		}
	}
	
	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define INF (1e9)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define ln '\n'
const long double PI = acos(-1.0L);
const long long MOD = 1000000007LL;
//const long long MOD = 998244353LL;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
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 main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    while (1) {
        int N,M; cin >> N >> M;
        if (N+M == 0) break;
        vector<int> d(N),v(N),A(M+1);
        rep(i,N) cin >> d[i] >> v[i];

        rep(i,N) {
            chmax(A[d[i]],v[i]);
        }

        cout << accumulate(all(A),0) << ln;
    }
}



Measured memory_bytes: 3140
#include<stdio.h>
char m[101][101];
int h,w,i,j;
int main()
{	
	scanf("%d%d",&h,&w);
	for(i=0;i<h;i++){
		scanf("%s",&m[i]);
	}
	if(h!=0){
	for(i=0;i<w+2;i++)printf("#");
	puts("");
	for(i=0;i<h;i++){
		printf("#%s#\n",m[i]);
	}
	for(i=0;i<w+2;i++)printf("#");
	puts("");
	}
	
	return 0;
}

Measured memory_bytes: 128
#include <cstdio>
#include <vector>
#include <map>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <set>
#include <cstring>
#include <string>
using namespace std;
#define LL long long
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define pii pair < int , int >

int main(){

	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

	int k , x;
	cin >> k >> x;
	bool space = false;
	for ( int i = max( -1000000, x - k + 1 ) ; i <= min( 1000000, x + k - 1 ) ; i++ ){
		if ( space ) cout << " ";
		else space = true;
		cout << i ;
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <numeric>
#include <bitset>

using namespace std;
using ll = long long;
using ld = long double;
const ll mod =  1000000007;

#define REP(i, n) for (ll i = 0; i < (n); ++i)
#define REP_FROM(i, j, n) for (ll i = (j); i < (n); ++i)
#define all(x) (x).begin(),(x).end()

ll power(ll base, ll exponent){ if(exponent % 2){ return power(base, exponent - 1) * base % mod; }else if(exponent){ ll root_ans = power(base, exponent / 2); return root_ans * root_ans % mod; }else{ return 1; }}
ll inverse(ll x){ return power(x, mod - 2);}
ll gcd(ll a, ll b) {if(a < b) gcd(b, a);ll r;while(r=a%b) {a=b;b=r;}return b;}
struct combination{ vector<ll> fact, inv; combination(int sz) : fact(sz + 1), inv(sz + 1){ fact[0] = 1; for(int i = 1; i <= sz; i++){ fact[i] = fact[i - 1] * i % mod; } inv[sz] = power(fact[sz], mod - 2); for(int i = sz - 1; i >= 0; i--){ inv[i] = inv[i + 1] * (i + 1) % mod; } } ll C(int p, int q) const{ if(q < 0 || p < q) return 0; return (fact[p] * inv[q] % mod * inv[p - q] % mod); } };

int bsearch(const vector<ll>& a, ll x){
  int lft = 0;
  int rgt = a.size();
  while (rgt - lft > 1) {
    int mid = (lft + rgt) / 2;
    if(a[mid] < x) {
      lft = mid;
    }
    else {
      rgt = mid;
    }
  }
  return lft;
}

signed main() {
  ios::sync_with_stdio(false);
  ll n;
  cin >> n;
  if(n==1) {
    cout << "Yes" << endl;
    cout << 2 << endl;
    cout << "1 1" << endl;
    cout << "1 1" << endl;
    return 0;
  }
  if(n < 3) {
    cout << "No" << endl;
    return 0;
  }
  vector<vector<ll>> a(3, vector<ll>(2));
  a[0][0] = 1;
  a[0][1] = 2;
  a[1][0] = 2;
  a[1][1] = 3;
  a[2][0] = 3;
  a[2][1] = 1;
  ll cnt = 3;
  while(cnt < n) {
    int inc = a.size();
    if(n < cnt + inc) {
      cout << "No" << endl;
      return 0;
    }
    a.emplace_back(0);
    REP(i, inc) {
      a[a.size()-1].push_back(cnt+i+1);
      a[i].push_back(cnt+i+1);
    }
    cnt += inc;
  }
  cout << "Yes" << endl;
  cout << a.size() << endl;
  REP(i, a.size()) {
    cout << a[i].size() << " ";
    REP(j, a[i].size()) {
      cout << a[i][j] << " ";
    }
    cout << endl;
  }
  return 0;
}


Measured memory_bytes: 3200
s = input()

length = len(s)

ans = ''

for a in range(length):
    if s[a] == '0':
        ans += '0'
    elif s[a] == '1':
        ans += '1'
    elif s[a] == 'B':
        if ans != '':
            ans = ans[:-1]

print(ans)


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

int	main()
{
    string S;
    cin >> S;
    int N = S.size();
    int max_len = 0;
    set<char> ATGC_set({'A', 'T', 'G', 'C'});
    int i, j;
    for (i = 0; i < N; i = j + 1) {
        int len = 0;
        for (j = i; j < N; ++j) {
            if (ATGC_set.count(S.at(j)))
                ++len;
            else
                break;
        }
        if (max_len < len)
            max_len = len;
    }
    cout << max_len << endl;
}


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

void solve() {
	int N;
	cin >> N;
	LL L;
	cin >> L;
	vector<LL> input;
	for(int i=0; i<N; i++) {
		LL p;
		cin >> p;
		input.push_back(p);
	}
	bool ok = false;
	int pos = -1;
	for(int i=0; i<N-1; i++) {
		if(input[i] + input[i+1] >= L) ok = true, pos = i+1;
	}
	if(!ok) {
		cout << "Impossible" << endl;
		return ;
	}
	cout << "Possible" << endl;
	vector<int> order;
	for(int i=pos; i>=1; i--) {
//		cout << i << endl;
		order.push_back(i);
	}
	for(int i=pos+1; i<N; i++)
//		cout << i << endl;
		order.push_back(i);
	reverse(order.begin(), order.end());
	for(int i=0; i<order.size(); i++)
		cout << order[i] << endl;
}

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

Measured memory_bytes: 2548
#include<iostream>
using namespace std;
int main()
{
    int x,y,n,m,i,ma=-1000,mi=10000;
    cin>>n>>m>>x>>y;
    int a[105]={0},b[105]={0};
    for(i=0;i<n;i++)
    {
        cin>>a[i];
        if(a[i]>ma)
            ma=a[i];
    }
    for(i=0;i<m;i++)
    {
        cin>>b[i];
        if(b[i]<mi)
            mi=b[i];
    }
    if(mi>ma && (mi>x) && (mi<=y))
        cout<<"No War"<<endl;
    else
        cout<<"War"<<endl;
    return 0;
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()

def main():
    N = II()
    V = LI()
    C = LI()
    ans = sum(max(v - c, 0) for v, c in zip(V, C))
    return ans

print(main())

Measured memory_bytes: 3064
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>


using namespace std;
using ll = long long;
using ull = unsigned long long;

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

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















int main() {
	ll n;
	cin >> n;
	vector<string> s(n);
	map<string, ll> mp;
	ll mx = 0;
	REP(i, n) {
		cin >> s[i];
		mp[s[i]]++;
		mx = max(mx, mp[s[i]]);
	}
	sort(s.begin(), s.end());
	REP(i, n) {
		if (mp[s[i]] == mx) {
			cout << s[i] << endl;
			mp[s[i]] = -1;
		}
	}
}

Measured memory_bytes: 26752
/*
START BY THE NAME OF ALMIGHTY ALLAH
THIS WONT BE ACCEPTED
STOP_GIVING_UP
*/
#include<bits/stdc++.h>
#define l(i,a,n)for(int i=a;i<n;i++)
#define PB push_back
#define IN insert
#define MP make_pair
#define LW(v) sort(v.begin(),v.end());
#define HI(v) sort(v.begin(),v.end(),greater<long long>());
using namespace std;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    long long t,r=1,r1=0,r2=0,k=0,a,b,c=1,m,d=0,n,e,f,x=0,g,p=0,q=0,y=0,z=0;
    vector<long long>v;
    vector<long long>u;
    set<long long>s;
    std::vector<int>::iterator it;
    string  s1,s2,s3,s4;

    cin>>n;
    m=n%10;


    if(m==2||m==4||m==5||m==7||m==9)
    {
        cout<<"hon"<<endl;
    }
   else if(m==0||m==1||m==6||m==8)//||m==9)
    {
        cout<<"pon"<<endl;
    }
    else{
        cout<<"bon"<<endl;

}    }


Measured memory_bytes: 3644
import sys
sys.setrecursionlimit(1000000000)
import math
from fractions import gcd
from itertools import count, permutations
from functools import lru_cache
from collections import deque, defaultdict
from pprint import pprint
ii = lambda: int(input())
mis = lambda: map(int, input().split())
lmis = lambda: list(mis())
INF = float('inf')
N1097 = 10**9 + 7

def meg(f, ok, ng):
    while abs(ok-ng)>1:
        mid = (ok+ng)//2
        if f(mid):
            ok=mid
        else:
            ng=mid
    return ok
#

def main():
    N=ii()
    d = defaultdict(int)
    for i in map(str, range(1, N+1)):
        i = str(i)
        a, b = i[0], i[-1]
        d[(a, b)] += 1
    print(sum(d[(a, b)] * d[(b, a)] for a in map(str, range(1,9+1)) for b in map(str, range(1,9+1))))

main()


Measured memory_bytes: 5296
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int n,x;
  int a[n];
cin >> n >> x;
for(int i=0;i<n;i++){
    cin >> a[i];
}
 int min=10000,sum=0;
for(int i=0;i<n;i++){
    if(min>a[i]) min = a[i];
    sum += a[i];
}
cout << n+(x-sum)/min;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n;
long long arr[409];
long long dp[409][409];
long long sum[409];
long long bt(int l,int r){
	if((r-l+1) == 1)return 0;
 	long long &ret = dp[l][r];
  	if(ret != -1)return ret;
 	ret = 1000000000000000009;
  	for(int i=l;i<r;i++){
    	 ret = min(ret,bt(l,i) + bt(i+1,r) + sum[r] - sum[l-1]);
    }
	return ret;
}
int main(){
	cin>>n;
  	for(int i=1;i<=n;i++){
     	cin>>arr[i];
      	sum[i] = arr[i] + sum[i-1];
    }
  	memset(dp,-1,sizeof(dp));
  	cout<<bt(1,n)<<endl;
}


Measured memory_bytes: 1536
#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 yn(f) ((f)?"Yes":"No")
#define YN(f) ((f)?"YES":"NO")

#define MAX 110000

int dp[MAX], h[MAX];

signed main(){
	cout<<fixed<<setprecision(7);
	
	int N, K;
	
	cin>>N>>K;
	
	for(int i = 1; i <= N; i++){
		cin>>h[i];
		dp[i] = INF;
	}
	dp[1] = 0;
	for(int i = 1; i < N; i++){
		for(int j = 1; j <= K && i+j <= N; j++){
			dp[i+j] = min(dp[i+j],dp[i]+abs(h[i+j]-h[i]));
		}
	}
	
	cout<<dp[N]<<endl;
	
	return 0;
}

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

int main(){
    int n,k=0,ans=1;
    cin >> n;
    vector<ll> a(n),b(n,0);
    rep(i,n) cin >> a[i];
    sort(a.begin(),a.end());
    rep(i,n-1){
        if(a[i]==a[i+1]){
            b[k]++;
        }else{
            ans++;
            b[k]++;
            k++;
        }
    }
    b[k]++;
    rep(i,n){
        if(b[i]==0) break;
        if(b[i]%2==0) ans--;
    }
    cout << ans << endl;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int N,i,o=0;
	cin>>N;
	for(i=1;i<=N;i++)
	{
		int j=0;
		int p=i;
		while(p)
		{
			p/=10;
			j++;
		}
		if(j&1)
			o++;
	}
	cout<<o<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  string s;cin>>s;
  if(s.at(0)!=s.at(1)&&s.at(1)!=s.at(2)&&s.at(2)!=s.at(3))cout<<"Good"<<endl;
  else cout<<"Bad"<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <array>
#include<unordered_map>
#include<unordered_set>

using namespace std;
#define IO                 \
	ios::sync_with_stdio(0); \
cin.tie(0);              \
cout.tie(0);
#define forn(i, n) for (int i = 0; i < n; i++)
#define forse(i, s, e) for (int i = s; i < e; i++)
#define pb push_back
#define pf push_front
#define rb pop_back
#define rf pop_front
#define mp make_pair
#define fi first
#define se second
#define all(vec) vec.begin(), vec.end()
#define getcurrtime() \
	cerr << "Time = " << ((double)clock() / CLOCKS_PER_SEC) << endl

#define watch(x) cerr << (#x) << " is " << (x) << endl;

#ifndef LOCAL
#define cerr if(false)cerr
#endif
typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll P=1e9+7;
double PI=3.141592653589793;
const int arrn = 4e6 + 1;


void solve(){
	int k,a,b;
	cin >> k >> a >> b;
	if(b>=(k*((a+k-1)/k))) cout << "OK";
	else cout << "NG";
}

int main() {
	IO;
	int T=1;
//	cin >> T;
	forn(c,T){
		solve();
	}
}



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

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n, k; cin >> n >> k;
    vector<long long> h(n);
    for (int i = 0; i < n; i++) cin >> h[i];
    sort(h.begin(), h.end());
    long long ans = 0;
    for (int i = 0; i < n; i++) {
        if (i < n-k) ans += h[i];
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 1792
from fractions import gcd

n = int(input())
a = [int(_) for _ in input().split()]

gcd_left = [0] * n
gcd_right = [0] * n
gcd_left[1] = a[0]
gcd_right[n-2] = a[n-1]

for i in range(2, n):
    gcd_left[i] = gcd(gcd_left[i-1],a[i-1])

for i in range(n-3, -1, -1):
    gcd_right[i] = gcd(gcd_right[i+1],a[i+1])

gcd_ex = [0] * n
gcd_ex[0] = gcd_right[0]
gcd_ex[n-1] = gcd_left[n-1]

for i in range(1,n-1):
    gcd_ex[i] = gcd(gcd_left[i], gcd_right[i])

print(max(gcd_ex))

Measured memory_bytes: 16164
#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
const int Maxn=10;
int n=5,a[Maxn];
inline int read()
{
	int s=0,w=1;
	char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=getchar();}
	while(ch>='0' && ch<='9')s=(s<<3)+(s<<1)+(ch^48),ch=getchar();
	return s*w;
}
int main()
{
	for(int i=1;i<=n;++i)
	a[i]=read();
	for(int i=1;i<=n;++i)
	if(!a[i])
	{
		printf("%d\n",i);
		break;
	}
	return 0;
}

Measured memory_bytes: 3760
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <cmath>
#include <utility>
#include <map>
#include <unordered_map>
#define rep(i,n) for(int i=0;i<n;++i)
using namespace std;
typedef long long int ll;

int main() {
  int N;
  cin>>N;
  
  int ans=1;
  for(int i=2;i<=N;i*=2){
    if(i<=N && N<i*2){
      cout<<i<<endl;
      return 0;
    }
  }
  
  cout<<ans<<endl;
}


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

using namespace std;
using ll = long long;
constexpr int mo = 1e9+7;
constexpr int  mod = mo;
constexpr int inf = 1<<30;
int main(){
    ll n;
    cin>>n;
    unsigned long long ret = 0ull;
    ret = (n-1)*n/2ull;
    cout << ret << endl;
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <bitset>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
#define rep(i,n) for(i=0 ; i < (n); ++i)
#define rrep(i,n) for(i  1; i <= (n); ++i)
#define drep(i,n) for(i  (n)-1; i >= 0; --i)
#define fin(ans) cout<<(ans)<<endl
#define P 1000000007
#define STI(s) atoi(s.c_str())//string to int
#define mp(p,q) make_pair(p,q)
#define Sort(a) sort(a.begin(),a.end())
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
const int INF = INT_MAX;
const long long LLINF = 1LL<<60;
//g++ -std=c++1z main.cpp
//./a.exe

bool isPrime(int x){
    int i;
    if(x < 2)return 0;
    else if(x == 2) return 1;
    if(x%2 == 0) return 0;
    for(i = 3; i*i <= x; i += 2) if(x%i == 0) return 0;
    return 1;
}


int main(void){ios::sync_with_stdio(false);cin.tie(0);
//////////////////////////////////////////////////////
  int n,i,m=0,all=0; 
  cin >> n;
  int L[n];
 
 
  rep(i,n){
      cin >> L[i];}
 
 rep(i,n){
      if(L[i]>=m){
          m = L[i];
      }
      all += L[i];
  }
  if(all-m>m){
      cout << "Yes" << endl;
  }
  else{
      cout << "No" << endl;
  }
  





//////////////////////////////////////////////////////
return 0;}

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

using namespace std;

using ll = long long;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  vector<pair<int, char>> v(m);
  for (auto&& [i, c] : v) {
    cin >> i >> c;
    i--;
  }
  int ans = -1;
  for (int x = 999; x >= 0; x--) {
    string sx = to_string(x);
    if ((int)sx.length() != n) continue;
    bool ok = true;
    for (auto&& [i, c] : v) {
      if (sx[i] != c) {
        ok = false;
        break;
      }
    }
    if (ok) ans = x;
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 3680
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    long long ans=0;
    for(int i=1;i<=n;i++){
        if(i%3!=0&&i%5!=0)
            ans+=i;
    }
    cout<<ans<<"\n";
    return 0;
}

Measured memory_bytes: 3624
import math
import fractions

A,B,C,D = list(map(int, input().split()))

Cans = (B // C  + (-A // C)) + 1
Dans = (B // D  + (-A // D)) + 1

CDlcm = C * D // fractions.gcd(C, D)

CDans = (B // CDlcm  + (-A // CDlcm)) + 1

ans = (B - A + 1) - (Cans + Dans - CDans)
print(ans)


Measured memory_bytes: 5048
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

int main() {
    int N;
    string S;
    cin >> N >> S;
    if (N % 2 == 1) {
        cout << "No"
             << "\n";
        return 0;
    }
    string T1 = S.substr(0, (N / 2));
    string T2 = S.substr((N / 2), (N / 2));
    if (T1 == T2) {
        cout << "Yes"
             << "\n";
    }
    else {
        cout << "No"
             << "\n";
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

ll ssum[1000010];
ll tsum[1000010];

int main(){
	string s, t;
	cin >> s >> t;
	rep(i, s.size()) if(s[i] == 'A') ssum[i+1]--; else ssum[i+1]++;
	rep(i, t.size()) if(t[i] == 'A') tsum[i+1]--; else tsum[i+1]++;
	rep(i, s.size()+1) {
		ssum[i+1] += ssum[i];
		if(ssum[i+1] < 0) (ssum[i+1] += 99) %= 3;
		ssum[i+1] %= 3;
	}
	rep(i, t.size()+1) {
		tsum[i+1] += tsum[i];
		if(tsum[i+1] < 0) (tsum[i+1] += 99) %= 3;
		tsum[i+1] %= 3;
	}
	int q;
	cin >> q;
	rep(i, q) {
		int a, b, c, d;
		cin >> a >> b >> c >> d;
		if((ssum[b]-ssum[a-1] + 99) % 3 == (tsum[d]-tsum[c-1] + 99) % 3) cout << "YES" << endl;
		else cout << "NO" << endl;
		//cout << (ssum[b]-ssum[a-1] + 3) % 3 << " " << (tsum[d]-tsum[c-1] + 3) % 3 << endl;
	}
}


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

int main(void){
    int n;
    cin >> n;
    int sum = 0;
    int mx = 0;
    rep(i,n) {
        int p;
        cin >> p;
        sum += p;
        mx = max(mx, p);
    }
    cout << sum - mx/2 << endl;
    return 0;
}


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

#define rep(i,x,y) for(int i=(x);i<(y);++i)
#define debug(x) #x << "=" << (x)

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define print(x)
#endif

const int inf=1e9;
const int64_t inf64=1e18;
const double eps=1e-9;

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
    os << "[";
    for (const auto &v : vec) {
    	os << v << ",";
    }
    os << "]";
    return os;
}

using i64=int64_t;

void solve(){
    i64 N;
    cin >> N;
    vector<i64> a(N);
    i64 s=0;
    rep(i,0,N){
        cin >> a[i];
        s+=a[i];
    }

    i64 ans=inf64,x=0;
    rep(i,0,N-1){
        x+=a[i];
        ans=min(ans,abs(x-(s-x)));
    }
    
    cout << ans << endl;
}

int main(){
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    solve();
    return 0;
}


Measured memory_bytes: 1792