akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define vi vector<int>
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define pi 3.141592653589793238
#define eb emplace_back
#define rep(i,a,b) for (int i = a; i <= b; i++)
#define zip(i,a,b) for(int i=a;i<b;i++)
#define rzip(i,a,b) for(int i=a;i>=b;i--)
#define ll unsigned int
#define test int t;cin>>t; while(t--)
#define um unordered_map
#define en '\n'
#define us unordered_set
typedef pair<int, int>     pii;
typedef pair<char, int>    pci;
typedef pair<char, char>   pcc;
typedef vector<pii>       vii;
typedef long double ld;
#define all(v) v.begin(), v.end()
#define sz(x) (int)x.size()
#define INF (1e18+5)
#define inf (1e9+5)
#define mod 1000000007


void __print(int x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
// You should only debug a pair of simple data types. For example,
// the debug won't work if one of pair's elements is collection type
// (std::vector, std::map, std::set...).
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i : x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif


// bool check_prime(int n)  return whether a number is prime or not O(sqrt(N));
// int BE(int x,int n,int m)  return x^n%m; O(logN);
// void sieve()  from number 1-1000001 saare prime store kar lega  in bool is_prime[1000001] array
// vector<int> z_array(string s)  return vector which is Z-array of string s;
// vector<int> lps(string s)      return vector which is lps array of string s;



int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(0);
#ifndef ONLINE_JUDGE
	if (fopen("input.txt", "r"))
	{
		freopen ("input.txt" , "r" , stdin);
		freopen ("output.txt" , "w" , stdout);
	}
#endif
	//_______________________________-code starts-_______________________________________________

	int x;
	cin >> x;
	if (x >= 30)
		cout << "Yes" << en;
	else
		cout << "No" << en;


	return 0;
}



Measured memory_bytes: 3652
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<set>
#include<map>
#include<string>
#include<functional>
#include<queue>
#include<stack>
#include<math.h>
#define INF ((1<<30)-1+(1<<30))
#define EPS 1.0e-6

using namespace std;

typedef long long ll;

char s[105000];

//sheep:0,wolf:1
int animal[105000];
int n;

int solve()
{
	
	for (int i = 1; i <= n; i++) {
		if (animal[i] == 0) {
			if (s[i] == 'o')animal[i + 1] = animal[i - 1];
			if (s[i] == 'x')animal[i + 1] = 1 - animal[i - 1];
		}
		if (animal[i] == 1) {
			if (s[i] == 'o')animal[i + 1] = 1 - animal[i - 1];
			if (s[i] == 'x')animal[i + 1] = animal[i - 1];
		}
	}

	int ope=0;
	if (s[0] == 'x')ope = 1;

	if (animal[n] == animal[0] && animal[n+1] == animal[1]){
		for (int i = 0; i < n; i++) {
			if (animal[i] == 0)cout << "S";
			if (animal[i] == 1)cout << "W";
		}
		cout << endl;
		return 1;
	}
	return 0;
}

int main()
{
	scanf("%d",&n);
	scanf("%s", s);

	s[n] = s[0];

	animal[0] = 0; animal[1] = 0;
	int k = 0;
	k=solve();
	if (k == 1) return 0;
	animal[0] = 0; animal[1] = 1;
	k = solve();
	if (k == 1)return 0;
	animal[0] = 1; animal[1] = 0;
	k = solve();
	if (k == 1)return 0;
	animal[0] = 1; animal[1] = 1;
	k = solve();
	if (k == 1)return 0;

	cout << -1 << endl;

	return 0;
}


Measured memory_bytes: 896
package main

import (
	"fmt"
	"bufio"
	"os"
	"strconv"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)

func nextLine() int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}

func nextLineArray() []int {
	sc.Scan()
	arr := strings.Split(sc.Text(), " ")
	ret := []int{}
	for _, v := range arr {
		i, _ := strconv.Atoi(v)
		ret = append(ret, i)
	}
	return ret
}

func output(arr []int) {
	str := ""
	for i := 0; i < len(arr); i++ {
		str += fmt.Sprintf("%d", arr[i])
		if i != len(arr) - 1 {
			str += " "
		}
	}
	fmt.Println(str)
}

func main() {
	n := nextLine()
	a := nextLineArray()

	output(a)
	for i := 1; i < n; i++ {
		v := a[i]
		j := i - 1
		for j >= 0 && a[j] > v {
			a[j+1] = a[j]
			j--
		}
		a[j+1] = v
		output(a)
	}
}



Measured memory_bytes: 5324
//#include "stdc++.h"
#include<bits/stdc++.h>
#include<iostream>
#pragma warning(disable:4996)
#pragma comment(linker, "/STACK:336777216")
using namespace std;
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
//typedef tuple<int, int, int> t3;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;
typedef vector<int> vi;
#define m1 make_pair
#define pb push_back
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);
inline ll gcd(ll a,ll b){if(a==0) return b;return gcd(b%a,a);}
inline ll power(ll a,ll n,ll m){if(n==0) return 1;ll p=power(a,n/2,m);p=(p*p)%m;if(n%2) return (p*a)%m;else return p; }
#define flush fflush(stdout)
const ll MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;

int main()
{
    IOS;//ifstream fin("input.txt");ofstream fout("output.txt");
    int h,w;
    cin>>h>>w;
    string s[h];
    for(int i=0;i<h;i++)
        cin>>s[i];
    ll dp[h][w];
    for(int i=0;i<h;i++)
        for(int j=0;j<w;j++)
            dp[i][j]=0;
    dp[0][0]=1;
    for(int i=0;i<h;i++)
    {
        for(int j=0;j<w;j++)
        {
            if(s[i][j]=='#')
                dp[i][j]=0;
            else
            {
                if(i>=1)
                    dp[i][j]=(dp[i][j]%MOD+dp[i-1][j]%MOD)%MOD;
                if(j>=1)
                    dp[i][j]=(dp[i][j-1]%MOD+dp[i][j]%MOD)%MOD;
            }
        }
    }
    cout<<dp[h-1][w-1]<<endl;
    return 0;
}


Measured memory_bytes: 9088
#include <cstdio>
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <tuple>
#include <assert.h>
#include <deque>
#include <bitset>
#include <iomanip>
#include <limits>
#include <chrono>
#include <random>
#include <array>
#include <unordered_map>
#include <functional>
#include <complex>

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 long long MAX = 5100000;
const long long INF = 1LL << 60;
const long long mod = 1000000007LL;
//const long long mod = 998244353LL;

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

int n;
vector<vector<pair<int, int>>> g;
vector<int> dp;
vector<int> res;
int dfs1(int cur, int pre) {
	int res = 0;
	for (auto next : g[cur]) {
		if (next.first == pre) continue;
		chmax(res, dfs1(next.first, cur) + next.second);
	}
	return dp[cur] = res;
}

void dfs2(int cur, int pre) {
	res[cur] = dp[cur];
	ll sz = g[cur].size();
	vector<int> left(sz + 1, 0);
	vector<int> right(sz + 1, 0);
	for (int i = 0; i < sz; i++) left[i + 1] = max(left[i], dp[g[cur][i].first] + g[cur][i].second);
	for (int i = 0; i < sz; i++) right[i + 1] = max(right[i], dp[g[cur][sz - i - 1].first] + g[cur][sz - i - 1].second);
	for (int i = 0; i < sz; i++) {
		int next = g[cur][i].first;
		if (next == pre) continue;
		int tmp1 = dp[cur];
		int tmp2 = dp[next];
		dp[cur] = max(left[i], right[sz - i - 1]);
		dp[next] = max(dp[next], dp[cur] + g[cur][i].second);
		dfs2(next, cur);
		dp[cur] = tmp1;
		dp[next] = tmp2;
	}
}
int main()
{
	/*
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	*/
	scanf("%d", &n);
	g.resize(n);
	dp = vector<int>(n);
	res = vector<int>(n);
	for (ll i = 0; i < n - 1; i++) {
		int s, t, w; scanf("%d %d %d", &s, &t, &w);
		g[s].emplace_back(t, w);
		g[t].emplace_back(s, w);
	}
	dfs1(0, -1);
	dfs2(0, -1);
	for (int i = 0; i < n; i++)  printf("%d\n", res[i]);
	return 0;
}



Measured memory_bytes: 5204
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
#include<bitset>
#include<stack>
#include<memory>
using namespace std;
using namespace std::chrono;
typedef long long int llint;
typedef double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase

/*
cout<<fixed<<setprecision(20);
cin.tie(0);
ios::sync_with_stdio(false);
*/
const llint mod=1000000007;
const llint big=2.19e15+1;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-15;
template <class T,class U>bool mineq(T& a,U b){if(a>b){a=b;return true;}return false;}
template <class T,class U>bool maxeq(T& a,U b){if(a<b){a=b;return true;}return false;}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){if(a==0){return b;}return a/gcd(a,b)*b;}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
template<class T>llint LBI(vector<T>&ar,T in){return lower_bound(ar.begin(),ar.end(),in)-ar.begin();}
template<class T>llint UBI(vector<T>&ar,T in){return upper_bound(ar.begin(),ar.end(),in)-ar.begin();}

int main(void) {
	cin.tie(0);
	vector<int>a(4);
	cin>>a[0]>>a[1]>>a[2]>>a[3];
	SO(a);
	vector<int>b={1,4,7,9};
	cout<<(a==b?"YES":"NO")<<endl;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main () {
  string S;
  cin >> S;
  int n = (int)S.size();
  int dif = 0;
  for (int i = 1; i < n; i ++) {
    if (S[i - 1] != S[i]) dif ++;
  }
  cout << dif << endl;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long a,b,v,w,t;
	cin>>a>>v>>b>>w>>t;
	if (v<=w)   cout<<"NO";
	else
	{
		long long temp=(ceil)((double)abs(a-b)/(double)abs(v-w));
		if (temp<=t)   cout<<"YES";
		else   cout<<"NO";
	}
	return 0;
} 

Measured memory_bytes: 3720
def equal_cut(N: int, A: list) -> int:
    Sa = [0] * (N + 1)  # A の累積和
    for i, a in enumerate(A):
        Sa[i + 1] = Sa[i] + a

    li, ri = 1, 3
    ans = float('inf')
    for mi in range(2, N - 1):
        # 中心の区切り mi を固定して左右の区間内で最適な
        # 区切り位置 li, ri を決めていく
        # B, C, D, E = A[:li], A[li:mi], A[mi:ri], A[ri:]
        if ri <= mi:
            ri = mi + 1

        # 適切な li を決める
        for temp_li in range(li + 1, mi):
            P, Q = Sa[temp_li - 1], Sa[mi] - Sa[temp_li - 1]
            nP, nQ = Sa[temp_li], Sa[mi] - Sa[temp_li]

            if abs(nP - nQ) <= abs(P - Q):
                # nP と nQ が近くなら li を更新する
                li = temp_li
            else:
                # nP と nQ が遠ざかり始めたらこれ以上 li を
                # 右に移動しても差は広がる一方で探索する意味
                # がないので打ち切り
                break

        # 適切な ri を決める
        for temp_ri in range(ri + 1, N):
            R, S = Sa[temp_ri - 1] - Sa[mi], Sa[N] - Sa[temp_ri - 1]
            nR, nS = Sa[temp_ri] - Sa[mi], Sa[N] - Sa[temp_ri]

            if abs(nR - nS) <= abs(R - S):
                ri = temp_ri
            else:
                break

        P = Sa[li]
        Q = Sa[mi] - Sa[li]
        R = Sa[ri] - Sa[mi]
        S = Sa[N] - Sa[ri]
        temp = max(P, Q, R, S) - min(P, Q, R, S)

        if temp < ans:
            ans = temp

    return ans


if __name__ == "__main__":
    N = int(input())
    A = [int(s) for s in input().split()]
    ans = equal_cut(N, A)
    print(ans)


Measured memory_bytes: 25676
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pi atan(1.0)*4
#define pb(x) push_back(x)
#define in(x) insert(x)
#define fl(x,y) for(ll i=x;i<y;i++)
#define vi vector<long long>
#define vs  vector<string>
#define vp(vi,x) cin>>x; vi.pb(x);
string en="\n";
string t="hello";
string Y="YES\n";
string N="NO\n";
#define E end()
#define B begin()
#define sz size()
#define EM empty()
#define fi first
#define se second
#define clr clear()
#define sqr(a) (a*a)
#define mk make_pair
#define mem(a,b) memset(a,b,sizeof(a))
#define all(cont) cont.begin(),cont.end()
/*bool isprm(LL a){for(LL i=2;i*i<=a;i++){if(a%i==0)return false;}return true;}
bool palin(string a){for(int i=0;i<a.sz;i++){if(a.at(i)!=a.at(a.sz-i-1))return 0;} return 1;}
bool isVowel(char ch){ ch=toupper(ch); if(ch=='A'||ch=='U'||ch=='I'||ch=='O'||ch=='E') return true; return false;}
int toInt(string s){int sm;stringstream ss(s);ss>>sm;return sm;}
LL bpow(LL a,LL b){if(b==0)return 1;LL r=bpow(a,b/2);if(b%2)return r*r*a;else return r*r;}
LL binpow(LL a,LL b){LL r=1;while(b>0){if(b&1)r=r*a;a=a*a;b>>=1;}return r;}
LL binpow(LL a,LL b,LL m){a%=m;LL r=1;while(b>0){if(b&1) r=r*a%m;a=a*a%m; b>>=1;}return r;}
template<typename T>inline T gcd(T a,T b){if(a<0)return gcd(-a,b);if(b<0)return gcd(a,-b);return (b==0)?a:gcd(b,a%b);}
template<typename T>inline T lcm(T a,T b) {if(a<0)return lcm(-a,b);if(b<0)return lcm(a,-b);return a*(b/gcd(a,b));}
*/
int main()
{
    ll a,b,t,n,k,p,q,r,sum,ct=0,flag=0;
    string s="codeforces",s1,s2,s3;
    char ch;
    set<ll>st;
    map<ll,ll>mp;
    vector<ll>v;
    cin>>t;
    
      cout<<(t*t+t)/2<<endl;
}






Measured memory_bytes: 3608
using System;
using System.Text;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Threading.Tasks;
class Program
{
	static void Main(string[] args)
	{
		int N = int.Parse(Console.ReadLine());
		List<int> price = new List<int>();
		int sum = 0;
        for(var i = 0; i < N; i++)
		{
			int p = int.Parse(Console.ReadLine());
			sum += p;
			price.Add(p);
		}

		price.Sort((a, b) => (b - a));
		sum = sum - (price[0] / 2);
		Console.WriteLine(sum);
        
	}
}


Measured memory_bytes: 13268
#include<stdio.h>
//int asd(int ,int *,int *);
int main(void){
  int m,d,ans=0,ef=0;
  int *ten,*one;
  scanf("%d%d",&m,&d);
  if(m<4||d<22){
    printf("0");
    return 0;
  }
  for(int i=4;i<=m;i++){
   ef=0;
    for(int j=2;j<=9;j++){
      if(ef)break;
      for(int k=2;k<=9;k++){
        if(10*j+k>d){ef=1;
                     break;
                    }
       // printf("%d %d %d\n",j,k,i);
        if(j*k==i)ans++;
      }
    }
  }
  
  printf("%d",ans);
  return 0;
}

Measured memory_bytes: 128
a = input()
b = []

for x in a:
    if x == " ":
        pass
    else:
        b.append(int(x))


# abc
# ab+c
# ac+b
# ba+c
# bc+a
# ca+b
# cb+a

# a = b[0], b = b[1], c = b[2]

b0_str = str(b[0])
b1_str = str(b[1])
b2_str = str(b[2])

# ab+c
b01_str = b0_str + b1_str
ab_c = int(b01_str) + b[2]

# ac+b
b02_str = b0_str + b2_str
ac_b = int(b02_str) + b[1]

# ba+c
b10_str = b1_str + b0_str
ba_c = int(b10_str) + b[2]

# bc+a
b12_str = b1_str + b2_str
bc_a = int(b12_str) + b[0]

# ca+b
b20_str = b2_str + b0_str
ca_b = int(b20_str) + b[1]

# cb+a
b21_str = b2_str + b1_str
cb_a = int(b21_str) + b[0]

max_ans = 0
if max_ans < ab_c:
    max_ans = ab_c
if max_ans < ac_b:
    max_ans = ac_b
if max_ans < ba_c:
    max_ans = ba_c
if max_ans < bc_a:
    max_ans = bc_a
if max_ans < ca_b:
    max_ans = ca_b
if max_ans < cb_a:
    max_ans = cb_a

print(max_ans)


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

typedef long long   signed int LL;
typedef long long unsigned int LU;

#define incID(i, l, r) for(int i = (l)    ; i <  (r); i++)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define  inc(i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define  dec(i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)

#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))

#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define UB upper_bound
#define LB lower_bound
#define PQ priority_queue

#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
#define  FOR(it, v) for(auto it =  v.begin(); it !=  v.end(); ++it)
#define RFOR(it, v) for(auto it = v.rbegin(); it != v.rend(); ++it)

template<typename T> bool   setmin(T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool   setmax(T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

// ---- ----

string o, e;

int main() {
	cin >> o >> e;
	
	inc(i, o.size()) {
		cout << o[i];
		if(i < e.size()) { cout << e[i]; }
	}
	cout << endl;
	
	return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		//?¢???¢?´¢
		int n =  Integer.parseInt(br.readLine());
		String[] SStr = br.readLine().split(" ");
		int[] SInt = makeIntAryForBanhei(n, SStr);

		//??¢?´¢
		int q =  Integer.parseInt(br.readLine());
		String[] TStr = br.readLine().split(" ");
		int[] TInt = makeIntAry(q, TStr);

		System.out.println(search(SInt, TInt));
	}

	public static int search(int[] searched,int[] search){
		int count = 0;
		for(int i = 0 ; i < search.length ; i++ ){
			searched[searched.length - 1] = search[i];
			int y = 0;
			while(searched[y] != search[i]){
				y++;
			}
			if(y != searched.length -1){
				count++;
			}
		}
		return count;
	}

	public static int[] makeIntAryForBanhei(int n, String[] strAry){
		int[] intAry = new int[n+1];
		int i = 0;
		while(i < n){
			intAry[i] = Integer.parseInt(strAry[i]);
			i++;
		}
		intAry[i] = 0;
		return intAry;
	}

	public static int[] makeIntAry(int n, String[] strAry){
		int[] intAry = new int[n];
		int i = 0;
		while(i < n){
			intAry[i] = Integer.parseInt(strAry[i]);
			i++;
		}
		return intAry;
	}

}

Measured memory_bytes: 26724
#include <bits/stdc++.h>
#include <boost/range/adaptors.hpp>
#include <boost/range/irange.hpp>

using namespace std;
using namespace boost;
using namespace boost::adaptors;

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

    if (n % 2 == 1) {
        cout << 0 << endl;
        return 0;
    }

    int64_t num2 = n / 2;
    int64_t num5 = 0;
    for (int64_t k = 10; k <= n; k *= 5) {
        num5 += n / k;
    }

    cout << min(num2, num5) << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;
 
public class Main {
    static int scoreR;
    static int scoreS;
    static int scoreP;
	public static void main(String[] args) {
            Scanner scn = new Scanner(System.in);
            int h = scn.nextInt();
            int a = scn.nextInt();
            int ret = h % a == 0 ? h / a : h / a + 1;

            System.out.println(ret);
	}
	
}


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

#define FOR(i,l,r) for(int i = (l);i < (r);i++)
#define ALL(x) (x).begin(),(x).end()
template<typename T> bool chmax(T& a,const T& b){return a < b ? (a = b,true) : false;}
template<typename T> bool chmin(T& a,const T& b){return b < a ? (a = b,true) : false;}
typedef long long ll;

int N;
double D,X;

double rec(int n,double a,double z)
{
	double res = (a + z) / 2.0;
	double d = (z - a) / (n * 2 - 1);
	if(n != 1){
		res += rec(n - 1,(a * (n * 2 + 2) + d * 5) / (n * 2),(z * (n * 2 + 2) - d * 5) / (n * 2));
	}
	return res;
}


int main()
{
	scanf("%d%lf%lf",&N,&D,&X);

	printf("%.10f\n",rec(N,D,D + (N * 2 - 1) * X));

	return 0;
}


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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define each(i,c) for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define all(v) v.begin(), v.end()
#define mset(a, n) memset(a, n, sizeof(a))

typedef long long ll;

const int INF = 1000000000;
const int MOD = 1000000007;

int main () {
    int X, A, B; cin >> X >> A >> B;
    cout << (X-A)%B << endl;
}


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

#define REP(i, m, n) for (int i = (m); i < (int)(n); i++)
#define REPS(i, m, n) for (int i = (m); i <= (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define reps(i, n) for (int i = 0; i <= (int)(n); i++)
#define rrep(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define rreps(i, x) for (int i = (int)(x); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define fi first
#define se second
typedef long long ll;
typedef pair<int, int> P;
const int inf = INT_MAX;
const ll INF = 1LL << 60;
const ll mod = 1e9 + 7;
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; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val) { fill( (T*)array, (T*)(array+N), val ); }

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll X, A, B;
    cin >> X >> A >> B;

    if (-A + B <= 0) {
        cout << "delicious" << endl;
    } else if (-A + B <= X) {
        cout << "safe" << endl;
    } else {
        cout << "dangerous" << endl;
    }
    return 0;
}

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

using namespace std;

typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vvll> vvvll;
typedef vector<string> vstr;

#define endl "\n"

ll power_mod(ll x, ll y, ll m){
  ll res = 1;
  if(y>0){
    res = power_mod(x,y/2,m);
    if(y%2==0) res = (res*res)%m;
    else res = (((res*res)%m)*x)%m;
  }
  return res;
}

ll trans(char c){
  return (ll)(c) + 1;
}

// r行c列の領域のハッシュ値を返す
vvvll rolling_hash2D(vstr str, ll r, ll c){
  ll h = str.size();
  ll w = str[0].size();
    if(h < r || w < c) return {}; // 空の配列を返す

  vll mod = {1000000000 + 7, 1000000000 + 9, 1000000000 + 21};
  vll base = {257, 521};

  ll mods = mod.size();

  vvvll res(h,vvll(w,vll(mods)));
  vvvll tmp(h,vvll(w,vll(mods)));

  for(ll m=0;m<mods;m++){
    ll k0 = power_mod(base[0],c,mod[m]); //行
    ll k1 = power_mod(base[1],r,mod[m]); //列

    for(ll i=0;i<h;i++){
      ll hog = 0;
      for(ll j=0;j<c;j++) hog = ( hog * base[0] % mod[m] + trans(str[i][j]) ) % mod[m];

      for(ll j=0;j+c<=w;j++){
        tmp[i][j][m] = hog;
        if(j+c < w) hog = ( hog * base[0] % mod[m] - k0 * trans(str[i][j]) + mod[m] * mod[m] + trans(str[i][j+c])) % mod[m];
      }
    }

    for(ll j=0;j+c<=w;j++){
      ll hog = 0;
      for(ll i=0;i<r;i++) hog = ( hog * base[1] % mod[m] + tmp[i][j][m]) % mod[m];

      for(ll i=0;i+r<=h;i++){
        res[i][j][m] = hog;
        if(i+r < h) hog = (hog * base[1] % mod[m] - k1 * tmp[i][j][m] + mod[m] * mod[m] + tmp[i+r][j][m]) % mod[m];
      }
    }

  }
  return res;
}
 
int main(){
    ll h, w;
    cin >> h >> w;
    vstr s(h);
    for(ll i=0;i<h;i++) cin >> s[i];
    ll r, c;
    cin >> r >> c;
    vstr t(r);
    for(ll i=0;i<r;i++) cin >> t[i];
    vvvll hs = rolling_hash2D(s,r,c);
    vvvll ht = rolling_hash2D(t,r,c);
    
    if(hs.size() == 0 || ht.size() == 0) return 0;
    
    for(ll i=0;i<h-r+1;i++){
        for(ll j=0;j<w-c+1;j++){
            if(hs[i][j] == ht[0][0]) cout << i << " " << j <<endl;
        }
    }
    
    return 0;
}


Measured memory_bytes: 169936
#include <iostream>

using namespace std;

int main()
{
	int n;
	int ans;
	int a;
	while(true){
		cin >> n;
		if(n == 0) break;
		ans = 0;
		n = n / 4;
		while(n--){
			cin >> a;
			ans += a;
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 1156
#include<iostream>
#include<string>
using namespace std;
int main()
{
int a=0;
int n;
cin>>n;
int maxi=0;
for(int i=0;i<n;i++)
{
char b;
cin>>b;
if(b=='I')
a++;
else
a--;
maxi=max(maxi,a);
}
cout<<maxi<<endl;
return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<algorithm>
using namespace std;
int mod=1000000007;
int X1[1100];
int Y1[1100];
int X2[1100];
int Y2[1100];
pair<pair<int,int>,pair<int,int> > p[1100];
long long fact[210000];
long long inv[210000];
long long factinv[210000];
long long dp[1100];
long long getinv(long long a){
	int b=mod-2;
	long long ret=1;
	long long now=a;
	while(b){
		if(b%2)ret=ret*now%mod;
		b/=2;
		now=now*now%mod;
	}
	//printf("%lld: %lld\n",a,ret);
	return ret;
}
long long C(long long n,long long k){
	if(n<0||k<0)return 0;
	n+=k;
	return fact[n]*factinv[k]%mod*factinv[n-k]%mod;
}
int main(){
	int a,b,c;
	fact[0]=1;
	for(int i=1;i<210000;i++)fact[i]=fact[i-1]*i%mod;
	inv[1]=1;
	for(int i=2;i<210000;i++)inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
	factinv[0]=1;
	for(int i=1;i<210000;i++)factinv[i]=factinv[i-1]*inv[i]%mod;
	while(scanf("%d%d%d",&a,&b,&c),a){
		for(int i=1;i<=c;i++){
			scanf("%d%d%d%d",X1+i,Y1+i,X2+i,Y2+i);
			X1[i]--;X2[i]--;Y1[i]--;Y2[i]--;
			p[i]=make_pair(make_pair(X1[i],Y1[i]),make_pair(X2[i],Y2[i]));
		}
		std::sort(p+1,p+c+1);
		a--;b--;
		for(int i=0;i<c+2;i++)dp[i]=0;
		for(int i=1;i<=c;i++){
			int row=p[i].first.first;
			int col=p[i].first.second;
			dp[i]=C(row,col);
			for(int j=1;j<i;j++){
				//if(row<p[j].second.first||col<p[j].second.second)continue;
				dp[i]=(dp[i]+dp[j]*(mod+C(row-p[j].second.first,col-p[j].second.second)-C(row-p[j].first.first,col-p[j].first.second)))%mod;
			}
		}
		long long ret=C(a,b);
		for(int i=1;i<=c;i++)ret=(ret+dp[i]*(mod+C(a-p[i].second.first,b-p[i].second.second)-C(a-p[i].first.first,b-p[i].first.second)))%mod;
		printf("%lld\n",ret);
	}
}

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

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

    for(int i = 0; i < n; i++){
        cout << s[i] << t[i];
    }
    cout << endl;
   return 0;
}

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

/*
 b
lurd
 f
*/
struct Dice {
  long long l, r, f, b, d, u, x, y;
  Dice(long long _l = 4, long long _r = 3, long long _f = 2,
       long long _b = 5, long long _d = 6, long long _u = 1,
       long long _x = 0, long long _y = 0)
      : l(_l), r(_r), f(_f), b(_b), d(_d), u(_u), x(_x),
        y(_y) {}

  void RollN() {
    long long buff = d;
    d = b;
    b = u;
    u = f;
    f = buff;
    ++y;
  }

  void RollS() {
    long long buff = d;
    d = f;
    f = u;
    u = b;
    b = buff;
    --y;
  }

  void RollE() {
    long long buff = d;
    d = r;
    r = u;
    u = l;
    l = buff;
    ++x;
  }

  void RollW() {
    long long buff = d;
    d = l;
    l = u;
    u = r;
    r = buff;
    --x;
  }

  void RollL() {
    long long buff = f;
    f = l;
    l = b;
    b = r;
    r = buff;
  }

  void RollR() {
    long long buff = f;
    f = r;
    r = b;
    b = l;
    l = buff;
  }

  vector<Dice> makeDice() {
    vector<Dice> ret;
    for(int i = 0; i < 6; i++) {
      Dice d(*this);
      if(i == 1) d.RollN();
      if(i == 2) d.RollS();
      if(i == 3) d.RollS(), d.RollS();
      if(i == 4) d.RollE();
      if(i == 5) d.RollW();
      for(int j = 0; j < 4; j++) {
        ret.emplace_back(d);
        d.RollL();
      }
    }
    return (ret);
  }
};
long long a, b, c, d, e, f;
string s;
Dice die;

int main() {
  cin >> a >> b >> c >> d >> e >> f >> s;
  die = Dice(d, c, b, e, f, a);
  for(int i = 0; i < s.size(); ++i) {
    if(s[i] == 'N')
      die.RollN();
    else if(s[i] == 'W')
      die.RollW();
    else if(s[i] == 'E')
      die.RollE();
    else
      die.RollS();
  }
  cout << die.u << endl;
  return 0;
}


Measured memory_bytes: 3172
#include "bits/stdc++.h"
using namespace std;
#define int long long   // <-----!!!!!!!!!!!!!!!!!!!

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#define rrep2(i,a,b) for (int i=(a)-1;i>=b;i--)
#define chmin(a,b) (a)=min((a),(b));
#define chmax(a,b) (a)=max((a),(b));
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define printV(v) cerr<<(#v)<<":";for(auto(x):(v)){cerr<<" "<<(x);}cerr<<endl;
#define printVS(vs) cerr<<(#vs)<<":"<<endl;for(auto(s):(vs)){cerr<<(s)<< endl;}
#define printVV(vv) cerr<<(#vv)<<":"<<endl;for(auto(v):(vv)){for(auto(x):(v)){cerr<<" "<<(x);}cerr<<endl;}
#define printP(p) cerr<<(#p)<<(p).first<<" "<<(p).second<<endl;
#define printVP(vp) cerr<<(#vp)<<":"<<endl;for(auto(p):(vp)){cerr<<(p).first<<" "<<(p).second<<endl;}

inline void output(){ cerr << endl; }
template<typename First, typename... Rest>
inline void output(const First& first, const Rest&... rest) {
    cerr << first << " "; output(rest...);
}

using ll = long long;
using Pii = pair<int, int>;
using TUPLE = tuple<int, int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vp = vector<Pii>;
const int inf = 1ll << 60;
const int mod = 1e9 + 7;
using Graph = vector<vector<int>>;

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

  int sum = 0;
  int ma = 0;
  rep(i, 3) {
    int x;
    cin >> x;
    sum += x;
    chmax(ma, x);
  }

  cout << sum - ma << endl;
}


Measured memory_bytes: 256
import itertools
import copy
import math

# input
N, M, Q = map(int, input().split())
L = []
for _ in range(Q):
    a, b, c, d = map(int, input().split())
    L.append((a-1, b-1, c, d))

# process
ans = 0
for a1 in range(1, M+1):
    for a2 in range(a1, M+1):
        for a3 in range(a2, M+1):
            for a4 in range(a3, M+1):
                for a5 in range(a4, M+1):
                    for a6 in range(a5, M+1):
                        for a7 in range(a6, M+1):
                            for a8 in range(a7, M+1):
                                for a9 in range(a8, M+1):
                                    for a10 in range(a9, M+1):
                                        seq = [a1, a2, a3, a4, a5, a6, a7, a8, a9, a10]
                                        t = 0
                                        for a, b, c, d in L:
                                            if seq[b]-seq[a] == c:
                                                t += d
                                        
                                        ans = max(ans, t)

# output
print(ans)


Measured memory_bytes: 9244
/*
我的心脏怦怦跳，监管者就在附近
name:
Algorithm:
writer:Lxs(cdx)
place:
nothing is impossible
*/
#pragma GCC optimize(3,"Ofast","inline")
#include<bits/stdc++.h>
#include<string>
#include<iostream>
#include<cmath>
#include<set>
#include<stack>
#include<queue>
#include<unistd.h>
#include<stdio.h>
#include<cstring>
#define random(a,b) (rand()%(b-a+1)+a)
using namespace std;
bool prime(int x){
	 int i;
	 if(x<2) return 0;
	 for(i=2;i*i<=x;i++){
		if(x%i==0){return 0;}
	 }
	 return 1;
}
int main()
{
	long long a;
	long long n;
	cin>>a>>n;
	if(500*a<n) cout<<"No"<<endl;
	else cout<<"Yes"<<endl; 
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
  int A;
  int B;
  int C;
  int D;
  int L;
  int japanese;
  int math;

  scanf("%d", &L);
  scanf("%d", &A);
  scanf("%d", &B);
  scanf("%d", &C);
  scanf("%d", &D);

  japanese = A / C;
  if ((A % C) != 0){
    japanese += 1;
  }
  math = B / D;
  if ((B % D) != 0){
    math += 1;
  }

  if (japanese > math){
    printf("%d\n", L - japanese);
  }

  else {
    printf("%d\n", L - math);
  }

  return (0);
}

Measured memory_bytes: 596
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
using namespace std;

#define FOR(i,f,t) for(int i=(int)f; i<(int)t; i++)
#define FORR(i,f,t) for(int i=(int)f; i>(int)t; i--)
#define ms(obj, val) memset(obj, val, sizeof(obj))
#define pb push_back
#define SYNC ios_base::sync_with_stdio(false)
#define inf 2248012
#define mp make_pair
#define F first
#define S second
#define ri(x) scanf("%d",&x)
#define rii(x,y) scanf("%d %d",&x,&y)
#define riii(x,y,z) scanf("%d %d %d",&x,&y,&z)
#define lri(x) scanf("%lld",&x)
#define lrii(x,y) scanf("%lld %lld",&x,&y)
#define lriii(x,y,z) scanf("%lld %lld %lld",&x,&y,&z)

typedef vector<int> vi;
typedef long long ll;
typedef pair<int, int> ii;

const int MAXN = 5e3+3; //AREGLAAAAAAAAR!!!!

typedef long long ll;
int F,C;
char mat[52][52];
int d[52][52];
int mf[4]={1,-1,0,0}, mc[4]={0,0,1,-1};
bool valido(int f, int c){ return( f>-1 && c>-1 && f<F && c<C && mat[f][c]!='#'); }

int bfs(pair<int,int> p){
    queue <pair<int,int> > cola;
    cola.push(p);
    FOR(i,0,F) FOR(j,0,C) d[i][j]=-1;
    d[0][0]=0;
    while(!cola.empty()){
        int f=cola.front().F,c=cola.front().S; cola.pop();
        if(f==F-1 && c==C-1) return d[f][c];
        for(int k=0; k<4; k++){
            int nf=f+mf[k],nc=c+mc[k];
            if(valido(nf,nc) && d[nf][nc]==-1){
                d[nf][nc]=d[f][c]+1;
                cola.push(make_pair(nf,nc));
            }
        }
    }
    return -1;
}

int main(){
	rii(F,C);
	FOR(i,0,F) scanf("%s",mat[i]);
	int black=0;
	FOR(i,0,F) FOR(j,0,C) if(mat[i][j]=='#') black++;
	int ans=F*C;
	int s=bfs({0,0});
	if(s==-1){
		printf("-1\n");
		return 0;
	}
	ans-=black;
	ans-=s;
	ans--;
	printf("%d\n",ans);
	return 0;


}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(long long int i = 0; i < n; i++)
#define _rep(i, m, n) for(long long int i = m; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
//const int N = 1000000;
const ll mod = 1000000007;
using Graph = vector<vector<int>>;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
  
ll gcd(ll A, ll B){
    if(B == 0)return A;
    return gcd(B, A % B);
}
ll lcm(ll A, ll B){
    return A * (B / gcd(A, B));
}
  
/*------------------------------------------------------------------*/
int main(){
    ll n; cin >> n;
    vector<ll> x(n);
    rep(i, n) cin >> x[i];
    ll sum = abs(x[0]) + abs(x[n - 1]);
    _rep(i, 1, n) sum += abs(x[i] - x[i - 1]);
    rep(i, n){
        if(i == 0){
            cout << sum - (abs(x[0]) + abs(x[1] - x[0])) + abs(x[1]) << endl;
        }else if(i == n - 1){
            cout << sum - (abs(x[n - 1]) + abs(x[n - 1] - x[n - 2])) + abs(x[n - 2]) << endl;
        }else{
            cout << sum - (abs(x[i] - x[i - 1]) + abs(x[i + 1] - x[i])) + abs(x[i + 1] - x[i - 1]) << endl;
        }
    }
}

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

int main(){
    int N;
    cin >> N;
    vector<int> A(N-1);
    
    for ( int i = 0; i < N-1; ++i){
        cin >> A.at(i);
    }
    
    vector<int> res(N);
    for ( int i = 0; i < N-1; ++i){
        res.at(A.at(i)-1) = res.at(A.at(i)-1) + 1;
    }
    
    for ( int i = 0; i < N; ++i){
        cout << res.at(i) << endl;
    }
    
    return 0;
}


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

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

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;

int main() {
  string s;
  cin >> s;

  int a_pos = s.size() - 1;
  int z_pos = 0;

  rep(i, s.size()) {
    if (s[i] == 'A' && a_pos > i) a_pos = i;
    else if (s[i] == 'Z' && z_pos < i) z_pos = i;
  }

  cout << z_pos - a_pos + 1 << endl;

  return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define FOR(x,n) for(int x = 0; x < n; x++)
#define ALL(a) (a).begin(), (a).end()
#define SZ(a) ((int)(a).size())
using namespace std;
typedef long long ll;

const int MXN = 1e5 + 1;
ll A[MXN] = {};

int main() {
  ll N, K; cin >> N >> K;
  FOR(x,N) cin >> A[x];
  
  ll ans = -1e14, tmp = 0, tmp2 = 0;
  FOR(x,K) tmp += A[x];
  for(int i = K; i < N; i++) tmp2 += max(0LL, A[i]);
  ans = max(tmp2 + max(0LL,tmp), ans);
  
  for(int i = K; i < N; i++) {
    tmp2 += max(0LL, A[i-K]);
    tmp2 -= max(0LL, A[i]);
    tmp += A[i]; tmp -= A[i-K];
    
    ans = max(tmp2 + max(0LL,tmp), ans);
  }
  
  cout << ans << "\n";
  
}

Measured memory_bytes: 1024
import sys


def solve():
    input = sys.stdin.readline
    mod = 10 ** 9 + 7
    a = [list(map(int, input().rstrip('\n').split())) for _ in range(3)]
    n = int(input().rstrip('\n'))
    for _ in range(n):
        b = int(input().rstrip('\n'))
        for i in range(3):
            for j in range(3):
                if a[i][j] == b:
                    a[i][j] = -1
    for i in range(3):
        if a[i][0] == a[i][1] == a[i][2] == -1:
            print("Yes")
            exit()
        elif a[0][i] == a[1][i] == a[2][i] == -1:
            print("Yes")
            exit()
    if a[0][0] == a[1][1] == a[2][2] == -1:
        print("Yes")
        exit()
    elif a[0][2] == a[1][1] == a[2][0] == -1:
        print("Yes")
        exit()
    print("No")


if __name__ == '__main__':
    solve()


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

int main(){
	int b, r, g, c, s, t;
	while(cin >> b >> r >> g >> c >> s >> t, t) cout << 100 - (3 * t) + (2 * c) + (3 * s) + (7 * g) + (15 * (b + r)) + (16 * (5 * b + 3 * r)) << endl;
	return 0;
}

Measured memory_bytes: 1160
n = gets.to_i
a, b = gets.split(" ").map!{|i| i.to_i}
p = gets.split(" ").map!{|i| i.to_i}
atime = 0
btime = 0
ctime = 0
p.length.times do |i|
  if p[i] <= a 
    atime += 1
  elsif p[i] > a and p[i] <= b
    btime += 1
  else ctime += 1
  end
end
h = [atime, btime, ctime]
p h.min

Measured memory_bytes: 1788
#include<bits/stdc++.h>
#define fo(i,a,b) for((i)=(a);i<=(b);i++)
#define rfo(i,a,b) for((i)=(a);i>=(b);i--)
#define inrange(x,y,z) (((x)>=(y))&&((x)<=(z)))
#define ALL(vec) ((vec).begin(),(vec).end())
#define SOR(vec) sort(ALL(vec))
#define UNI(vec) (vec).erase(unique(ALL(vec)),(vec).end())
using namespace std;
int k,a,b;
int main(){
	#ifdef FILIN
		#ifndef DavidDesktop
			freopen(FILIN,"r",stdin);
			freopen(FILOUT,"w",stdout);
		#endif
	#endif
	ios::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>k>>a>>b;
	for(int i=a;i<=b;i++)
		if(i%k==0){
			cout<<"OK"<<endl;
			return 0;
		}
	cout<<"NG"<<endl;
	return 0;
}


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

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;

ll n, k;
vector<ll> a, f, af;

bool check(ll sec){
    ll tr = 0;
    for (int i = 0; i < n; ++i) {
        tr += max(0LL, ((af[i] - sec + f[i] - 1) / f[i]));
    }
    return tr <= k;
}

int main(){
    cin >> n >> k;
    a.assign(n, 0);
    f.assign(n, 0);
    af.assign(n, 0);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    for (int i = 0; i < n; ++i) {
        cin >> f[i];
    }
    sort(a.begin(), a.end());
    sort(f.begin(), f.end(), greater<ll>());

    for (int i = 0; i < n; ++i) {
        af[i] = a[i] * f[i];
    }

    ll left = -1;
    ll right = 1e12 + 10;

    while (right - left > 1) {
        ll mid = (right + left) / 2;

        if (check(mid)) right = mid;
        else left = mid;
    }
    cout << right << endl;
}

Measured memory_bytes: 4992
lines=readlines(open("/dev/fd/0"))
input()=shift!(lines)
int(s::String)=parse(Int,s)
intSub(s::SubString{String})=parse(Int,s)
intLine(s::Array{SubString{String},1})=map(intSub,s)
function main()
  a=intLine(split(input()))
  sort!(a)
  println(a[1]+a[2])
end
main()

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

int main() {
  string s;
  cin>>s;
  int n = s.length();
  if (s[0] == '0' || s[n-1] == '1' || s[n-2] == '0') {
    cout<<-1<<endl;
    return 0;
  }
  for (int i=1; i<(n-1)/2; i++) {
    if (s[i] != s[n-i-2]) {
      cout<<-1<<endl;
      return 0;
    }
  }
  vector<int> g[n];
  g[0].push_back(1);
  int i = 1;
  while (i < n - 1) {
    int j = i;
    while (i < n && s[i] == '0') {
      ++i;
      g[j].push_back(i);
    }
    ++i;
    g[j].push_back(i);
  }
  for (int i=0; i<n; i++) {
    for (int to: g[i]) {
      cout<<i+1<<" "<<to+1<<endl;
    }
  }
}

Measured memory_bytes: 6912
#include <functional>
#include <algorithm>
#include <iostream>
#include <numeric>
#include <iomanip>
#include <utility>
#include <cstdlib>
#include <sstream>
#include <bitset>
#include <vector>
#include <cstdio>
#include <ctime>
#include <queue>
#include <deque>
#include <cmath>
#include <stack>
#include <list>
#include <map>
#include <set>

using namespace std;

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

#define dump(x)  cerr << #x << " = " << (x) << endl
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back
#define sz size()

const double EPS = 1e-10;
const int INF = 100000000;

int main(){
    while(1){
    int m,n;
    vi f,d;
    cin>>m>>n;
    if(m==0 && n==0)break;
    rep(i,m){
        int a;
        cin>>a;
        f.pb(a);
    }
    rep(i,n){
        int b;
        cin>>b;
        d.pb(b);
    }
    
    int sum=0;
    int now=0;
    rep(i,n){
        now+=d[i];
        now+=f[now];
        sum++;
        if(now>=m)break;
        
    }
    cout<<sum<<endl;
    }
    return 0;
}

Measured memory_bytes: 1224
#include <algorithm>
#include <fstream>
#include <iostream>
using namespace std;
 
int main()
{
  long n, a[200000];
  cin >> n;
 
  long l, pc = 0, mc = 0, zc = 0;
  for (int i = 0; i < n; i++)
  {
    cin >> l;
    a[i] = l - (i + 1);
    if (l - (i + 1) > 0) pc++;
    if (l - (i + 1) < 0) mc++;
    if (l - (i + 1) == 0) zc++;
  }
  sort(a, a+n);
 
  long b;
  long h = n / 2;
  if (pc > mc + zc)
  {
    int o = pc - h;
    b = a[mc + zc + o - 1];
  }
  else if (mc > pc + zc)
  {
    int o = mc - h;
    b = a[mc - o];
  }
  else
  {
    b = 0;
  }
 
  long total = 0, val;
  for (int i = 0; i < n; i++)
  {
    val = a[i] - b;
    total += val > 0 ? val : -val;
  }
 
  cout << total << "\n";
 
}

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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit32(x) (1 << (x))
#define bit64(x) (1ll << (x))

using namespace std;

using i64 = long long;
using f80 = long double;
using vi32 = vector<int>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << endl; exit(0); }
inline void no() { cout << "No" << endl; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); return a / gcd(a, b) * b; }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { x = max(x, y); }
template <typename T> inline void amin(T &x, T y) { x = min(x, y); }
template <typename T> inline T exp(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }

void solve() {
  string s;
  cin >> s;
  int n = s.size();
  if (n & 1) no();
  rep(i, n / 2) {
    if (s.substr(i * 2, 2) != "hi") no();
  }
  yes();
}


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

typedef long long ll;

#define REP(i,m,n) for(int i=(int)m; i < (int)n; ++i)
#define rep(i,n) REP(i,0,n)
#define all(a) (a).begin(), (a).end()

int tmp6(int n) {
    int res = 1;
    while(true) {
        if(res > n) {
            res /= 6;
            break;
        }
        res *= 6;
    }
    return res;
}

int tmp9(int n) {
    int res = 1;
    while(true) {
        if(res > n) {
            res /= 9;
            break;
        }
        res *= 9;
    }
    return res;
}

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

    int n; cin >> n;
    // dp[i] := i 円を引き出す最小手順
    int dp[101010] = {};
    rep(i, 101010) dp[i] = 1e9;
    dp[0] = 0;

    for(int i = 1; i <= n; i++) {
        int tmp6 = 1;
        while(true) {
            if(i-tmp6 < 0) break;
            dp[i] = min(dp[i], dp[i-tmp6]+1);
            tmp6 *= 6;
        }
        int tmp9 = 1;
        while(true) {
            if(i-tmp9 < 0) break;
            dp[i] = min(dp[i], dp[i-tmp9]+1);
            tmp9 *= 9;
        }
    }

    cout << dp[n] << '\n';
    return 0;
}

Measured memory_bytes: 640
import qualified Data.ByteString.Char8 as BS
import Data.Maybe (fromJust)
import Control.Monad
import Data.List

getGroup :: Int -> Int
getGroup 2 = 2
getGroup x
    | elem x [4, 6, 9, 11] = 1
    | otherwise = 0

solve :: Int -> Int -> String
solve x y
    | (getGroup x) == (getGroup y) = "Yes"
    | otherwise = "No"


main :: IO ()
main = do
    [x, y] <- map (fst . fromJust . BS.readInt) . BS.words <$> BS.getLine
    putStrLn $ solve x y


Measured memory_bytes: 380
#include<cstdio>
#include<algorithm>
#include<queue>

#define F first
#define S second

using namespace std;

typedef pair<int, int> P;
int mx[] = { 0,1,0,-1 };
int my[] = { 1,0,-1,0 };
int map[1001][1001];
P sor[1001*1001];
pair<bool, P> go[1001][1001];
bool check(int, int);
int h, w;

int main() {

	scanf("%d%d", &h, &w);
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			scanf("%d", &map[i][j]);
			sor[map[i][j]] = make_pair(i, j);
			go[i][j].first = false;
		}
	}

	int ans = 0;
	go[sor[1].F][sor[1].S].S = sor[1];
	for (int i = 1; i <= h*w; i++) {
		P befor = make_pair(-1, -1);
		bool ok = false;
		for (int t = 0; t < 4; t++) {
			int MX = mx[t] + sor[i].F;
			int MY = my[t] + sor[i].S;
			if (!check(MX, MY) || map[sor[i].F][sor[i].S] < map[MX][MY]) continue;
			ok = true;
			if (go[MX][MY].F) {
				go[sor[i].F][sor[i].S].first = true;
				ans++;
				break;
			}
			if (befor.first == -1) befor = go[MX][MY].S;
			else if (befor != go[MX][MY].S) {
				ans++;
				go[sor[i].F][sor[i].S].first = true;
				break;
			}
		}
		if (!ok) go[sor[i].F][sor[i].S].S = sor[i];
		else if (!go[sor[i].F][sor[i].S].F) go[sor[i].F][sor[i].S].S = befor;
	}

	printf("%d\n", ans);
}

bool check(int i, int j) {
	if (i < h && i >= 0 && j < w && j >= 0) return true;
	return false;
}



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

int main(){
    string S;
    cin >> S;
    int n, count;
    n=S.size();
    count =0;

    for(int i=0; i<(n/2); i++){
        if(S.at(i) != S.at(n-i-1))
        {
            count++;
        }
    
        
        else{
            continue;
        }
    }
    cout << count << endl;
}

Measured memory_bytes: 256