akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <set>
#include <cctype>
#include <vector>
#include <map>
#include <queue>
#include <list>
#include <algorithm>
#include <ctime>
#include <cstdio>
#include <cstring>
#include <iterator>
#include <limits>
#include <cmath>
#include <typeinfo>
 
 
using namespace std; 
 
 
// ||    


// upper to lower = + 32;
// lower to upper = - 32;

int firstDigit(int n) 
{ 
    while (n >= 10)  
        n /= 10;  
    return n; 
} 

int lastDigit(int n) 
{ 
    return (n % 10); 
} 


void sortString(string &str) 
{ 
   sort(str.begin(), str.end());
}
 
void reverseStr(string& str) 
{ 
    int n = str.length(); 
    for (int i = 0; i < n / 2; i++) 
        swap(str[i], str[n - i - 1]); 
} 

void bubbleSort(string s, int o, int n)
{  
    for(int i = 1; i <= n; i++) {
    	for(int j = 1; j <= n; j++)  {
       		if (s[o] < s[j]) {
       			swap(s[o], s[j]); 

       		}  
    	}
    }      
 
} 


bool allCharactersSame(string s) 
{ 
	int n = s.length();
    for (int i = 1; i < n; i++) 
        if (s[i] != s[0]) 
            return false; 
  
    return true; 
}
int factorial(int n) 
{ 
    return (n==1 || n==0) ? 1: n * factorial(n - 1);  
}
// Function to return cost 


int main() {
	int x = 0, a = 0;
	cin >> x >> a;
	if(x >= a) {
		cout << 10 << endl;
	}
	else {
		cout << 0 << endl;
	}

    return 0;
}

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

int main() {
  int N, a;
  cin >> N;
  set<int> mochi;
  for (auto i = 0; i < N; i++) {
    cin >> a;
    mochi.insert(a);
  }
  cout << mochi.size() << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
int main() {
  int n,m;
  cin>>n>>m;
  vector<pair<int,int>>kazu(m);
  rep(i,m){
    cin>>kazu[i].first>>kazu[i].second;
  }
  int keta1=0;
  int count1=0;
  int keta2=0;
  int count2=0;
  int keta3=0;
  int count3=0;
  rep(i,m){
    if(kazu[i].first==1){
      if(count1==0){
        keta1=kazu[i].second;
        if(n>=2&&keta1==0){
          cout<<-1<<endl;
          return 0;
        }
        count1++;
      }else{
        if(keta1!=kazu[i].second){
          cout<<-1<<endl;
          return 0;
        }
      }
    }else if(kazu[i].first==2){
      if(count2==0){
        keta2=kazu[i].second;
        count2++;
      }else{
        if(keta2!=kazu[i].second){
          cout<<-1<<endl;
          return 0;
        }
      }
    }else{
      if(count3==0){
        keta3=kazu[i].second;
        count3++;
      }else{
        if(keta3!=kazu[i].second){
          cout<<-1<<endl;
          return 0;
        }
      }
    }
  }
  if(n==1){
    cout<<keta1<<endl;
    return 0;
  }
  if(n==2){
    if(keta1==0)keta1++;
    for(int i=10;i<=99;i++){
      int a,x1,x2;
      a=i;
      x2=a%10;
      a/=10;
      x1=a%10;
      if(keta1==x1&&keta2==x2){
        cout<<keta1<<keta2<<endl;
        return 0;
      }
    }
  }
  if(n==3){
    if(keta1==0)keta1++;
    for(int i=100;i<=999;i++){
      int a,x1,x2,x3;
      a=i;
      x3=a%10;
      a/=10;
      x2=a%10;
      a/=10;
      x1=a%10;
      if(keta1==x1&&keta2==x2&&keta3==x3){
        cout<<keta1<<keta2<<keta3<<endl;
        return 0;
      }
    }
  }
  cout<<-1<<endl;
  return 0;
}

Measured memory_bytes: 764
# -*- coding: utf-8 -*-
"""
https://beta.atcoder.jp/contests/abc080/tasks/abc080_c

"""
import sys
from sys import stdin
input = stdin.readline


def solve(N, F, P):
    max_profit = float('-inf')

    for i in range(1, 2**10):
        profit = 0
        opens = [int(x) for x in bin(i)[2:].zfill(10)]
        for shop in range(1, N+1):
            match = [1 for a, b in zip(opens, F[shop]) if a and b]
            m = sum(match)
            profit += P[shop][m]
        if profit > max_profit:
            max_profit = profit
    return max_profit


def main(args):
    # N = 3
    # F = [[]]
    # F.append([1, 1, 1, 1, 1, 1, 0, 0, 1, 1])
    # F.append([0, 1, 0, 1, 1, 1, 1, 0, 1, 0])
    # F.append([1, 0, 1, 1, 0, 1, 0, 1, 0, 1])
    # P = [[]]
    # P.append([-8, 6, -2, -8, -8, 4, 8, 7, -6, 2, 2])
    # P.append([-9, 2, 0, 1, 7, -5, 0, -2, -6, 5, 5])
    # P.append([6, -6, 7, -9, 6, -5, 8, 0, -9, -7, -7])

    N = int(input())
    F = [[]]
    P = [[]]
    for _ in range(N):
        F.append([int(x) for x in input().split()])
    for _ in range(N):
        P.append([int(x) for x in input().split()])
    ans = solve(N, F, P)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])


Measured memory_bytes: 3064
#include<bits/stdc++.h>
typedef long long ll;
#define INF 100000000
#define MOD 100000007
int dx[4]={1,0,-1,0},dy[4]={0,-1,0,1};
using namespace std;
int main(void){
   int n,l;
   cin>>n>>l;
   int a[n];
   int tmp=INF;
   int sum=0;
   int id=0;
   for(int i=0;i<n;i++){
      a[i]=l+i;
      sum+=a[i];
      if(abs(a[i])<tmp){
         tmp=abs(a[i]);
         id=i;
      }
   }
   cout<<sum-(a[id])<<endl;
   return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <numeric>
#include <unordered_map>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <memory>
#include <iomanip>
#include <type_traits>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
constexpr long long MOD = 1e9 + 7;
constexpr long long MAX = 1000000;

//long long MOD = 998244353;
constexpr ll INF = 1e17;
constexpr double PI = 3.141592653589793;
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }

ll h, w;
vector<ll> dx = { -1, 0, 1, 0 };
vector<ll> dy = { 0, -1, 0, 1 };


bool isInField(ll x, ll y) {
    bool f = x >= 0 && x < w && y >= 0 && y < h;
    return f;
}

bool compare_x(pair<ll, ll> x, pair<ll, ll> y)
{
    if (x.first != y.first) {
        return x.first < y.first;
    }
    else {
        return x.second < y.second;
    }
}

bool compare_y(pair<ll, ll> x, pair<ll, ll> y)
{
    if (x.second != y.second) {
        return x.second < y.second;
    }
    else {
        return x.first < y.first;
    }
}

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

    ll h, n;
    cin >> h >> n;
    vector<ll> a(n), b(n);

    for (ll i = 0; i < n; i++)
    {
        cin >> a[i];
        cin >> b[i];
    }

    ll max = *std::max_element(b.begin(), b.end());

    // dp[i][j]: numbers of attack effects by using magics until i.
    vector<vector<ll>> dp(n + 1, vector<ll>(h + 1, INF));

    // need to initialize start point.
    dp[0][0] = 0ll;

    for (ll i = 0; i < n; i++)
    {
        for (ll j = 0; j <= h; j++)
        {
            // update without i+1 th magic.
            chmin(dp[i + 1][j], dp[i][j]);
            // update with i+1 th magic.
            chmin(dp[i + 1][min(j + a[i], h)], (dp[i + 1][j] + b[i]));
        }
    }

    cout << dp[n][h] << "\n";
    return 0;
}



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

string s,t;

int main(){
t="AKIHABARA";
cin>>s;
  int n=s.size();
int ind=0;
for(char c:t){
  if(ind==n||s[ind]!=c){

  if(c!='A'){
    cout << "NO"<<endl;
    return 0;
  }
  }else{
  ++ind;
  }
}
if(ind!=n){
cout<<"NO"<<endl;
return 0;
}
cout<<"YES"<<endl;
return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main() {
	int a, b, c, d = 0, e;
	cin >> a >> b >> c;
	for (int h = 1; h <= a; h++) {
		cin >> e;
		if (b % e == 0) {
			d += b / e;
		}
		else {
			d += b / e + 1;
		}
	}
	cout << c + d << "\n";
	cin >> e;
}

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

int main(){
  int N,K;
  cin >> N >>K;
  vector<int> cost(N);
  vector<int> sum(N);
  for(x:cost){
    cin >> x;
  }
  for(int i=1;i<min(N,K+1);i++){
    sum.at(i)=abs(cost.at(i)-cost.at(0));
  }
  if(N>K){
    for(int i=K+1;i<N;i++){
     for(int j=1;j<K+1;j++){
      if(j==1){
        sum.at(i) = sum.at(i-1)+abs(cost.at(i)-cost.at(i-1));
      }
      else{
        sum.at(i)= min(sum.at(i),
                    (sum.at(i-j)+abs(cost.at(i)-cost.at(i-j))));
      }
    }
  }
  }
  cout << sum.at(N-1)<<endl;
}


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

ans=0

for i in range(k+1):
    for j in range(k-i+1):
        Hand = []
        if i+j>n:
            break
        Hand=List[:i]
        Hand.extend(List[n-j:])
        tmp=sum(Hand)
        
        Hand.sort()
        
        for l in range(min(k-i-j,i+j)):
            if Hand[l]>=0:
                break
            tmp -= Hand[l]
        ans = max(ans,tmp)
        
print(ans)

Measured memory_bytes: 3064
#include <cstdio>
#include <iostream>
#include <vector>
#include <complex>
#include <cmath>

#define pb push_back

using namespace std;

typedef complex<double> P;
typedef vector<P> G;

/* 外積 */
double cross(const P& a, const P& b) {
    return imag(conj(a)*b);
}

/* 多角形の面積 */
#define curr(g, i) g[i]
#define next(g, i) g[(i+1)%g.size()]
double areaG(const G& g) {
    double A = 0;
    for (int i = 0; i < g.size(); ++i) 
        A += cross(curr(g, i), next(g, i));
    return abs(A/2.0);
}

int main(){
    G g;
    double x, y;
    int n;
    int cnt = 1;
    while(cin>>n,n){
        cout <<cnt<<" ";
        for(int i =0; i < n;i++){
            scanf("%lf %lf", &x, &y);
            g.pb(P(x,y));
        }
        printf("%.1f\n",areaG(g));
        g.clear();
        cnt++;
    }
}

Measured memory_bytes: 1320
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder
{
    static class Program
    {
        static void Main()
        {
            Solve();

            Console.ReadKey();
        }

        static void Solve()
        {
            long N = IO.GetLong();
            
            long[] str = new long[5];
            for(int i = 0; i < 5; i++)
            {
                str[i] = IO.GetLong();
            }

            long ans = 5 + (N-1) / str.Min();

            Console.WriteLine(ans);
        }

    }


    static class IO
    {
        static public string GetString() { return Console.ReadLine(); }
        static public int GetInt() { return int.Parse(Console.ReadLine()); }
        static public long GetLong() { return long.Parse(Console.ReadLine()); }
        static public List<string> GetStringList() { return Console.ReadLine().Split(' ').ToList(); }
        static public List<int> GetIntList() { return Console.ReadLine().Split(' ').Select(int.Parse).ToList(); }
        static public List<long> GetLongList() { return Console.ReadLine().Split(' ').Select(long.Parse).ToList(); }
        static public List<double> GetDoubleList() { return Console.ReadLine().Split(' ').Select(double.Parse).ToList(); }
        static public void WriteStrings<T>(IEnumerable<T> values) { foreach (var o in values) { Console.Write(o + " "); } }
    }
}

Measured memory_bytes: 13268
#include<bits/stdc++.h>
#define LL long long
#define REP(i,n) for(int i=0;i<(n);++i)
#define PER(i,n) for(int i=n-1;i>=0;--i)
#define REPA(i,n) for(int i=1;i<(n);++i)
#define foreach(i, n) for(auto &i:(n))
#define PII pair<int,int>
#define PLI pair<long long, int>
#define PLL pair<long long, long long>
#define MOD ((int)1e9 + 7)
#define INF ((int)1e9+5)
#define INFLL ((LL)4e18)
#define ALL(x) (x).begin(),(x).end()
#define BIT(x) (1LL << (x))
#define SIZE 4
using namespace std;

class board{
public:
	vector<vector<int>> data;
	int ncost;
	int hcost;
	PII zpoint;

	int culonecost(int i, int j){
		if(data[i][j]==0){
			return abs(SIZE-1-i) + abs(SIZE-1-j);
		}
		int x = (data[i][j]-1)%SIZE;
		int y = (data[i][j]-1)/SIZE;
		return abs(i-y) + abs(j-x);
	}

	void setup(){
		hcost = 0;
		REP(i, SIZE){
			REP(j, SIZE){
				hcost+=culonecost(i, j);
				if(data[i][j]==0){
					zpoint=PII(i, j);
				}
			}
		}
	}

	board(vector<vector<int>> d){
		REP(i, SIZE){
			REP(j, SIZE){
				data[i][j]=d[i][j];
			}
		}
		hcost = 0;
		setup();
	}

	board(){
		data.resize(SIZE, vector<int>(SIZE));
	}

	void swap(int i, int j, int k, int l){
		hcost -= culonecost(i, j);
		hcost -= culonecost(k, l);
		std::swap(data[i][j], data[k][l]);
		hcost += culonecost(i, j);
		hcost += culonecost(k, l);
		if(data[i][j]==0){
			zpoint=PII(i, j);
		}else{
			zpoint=PII(k, l);
		}
	}

	bool onboard(int i, int j){
		return 0<=i&&0<=j&&i<SIZE&&j<SIZE;
	}
	
};

int mx[]={1, 0, -1, 0}, my[]={0, 1, 0, -1};

bool func(board &boa, int time, int lx, int ly){
	if(boa.hcost - boa.culonecost(boa.zpoint.first, boa.zpoint.second) > time * 1)return false;
	if(boa.hcost==0)return true;
	bool res = false;
	REP(i, 4){
		int y = boa.zpoint.first;
		int x = boa.zpoint.second;
		int ny = y + my[i];
		int nx = x + mx[i];
		if(lx==nx&&ly==ny)continue;
		if(!boa.onboard(ny, nx))continue;
		boa.swap(y, x, ny, nx);
		res |= func(boa, time-1, x, y);
		boa.swap(y, x, ny, nx);
		if(res)return true;
	}
	return res;
}


int main(){
	board boa;
	REP(i, SIZE)
		REP(j, SIZE)cin>>boa.data[i][j];
	boa.setup();
	REP(i, 1000){
		if(func(boa, i, -1, -1)){
			cout << i << endl;
			break;
		}
	}
	return 0;
}



Measured memory_bytes: 3168
#include<bits/stdc++.h>
#define fast ios::sync_with_stdio(false);cin.tie(NULL)
using namespace std;
#define int long long
#define MOD 1000000007
typedef vector<int> vi;
typedef pair<int,int> pi;
#define inf 1e18
#define For(i,a,b) for (int i = a; i < b; i++)
#define Rep(i,a,b) for (int i = a; i <= b; i++)
#define ps(x,y) fixed << setprecision(y) << x 
#define pb push_back 
#define mp make_pair 

int c[55];
 
int32_t main()
{
    fast;
    int n, m; cin >> n >> m;
    For(i, 0, m) {
        int a, b; cin >> a >> b;
        ++c[a], ++c[b];
    }
    Rep(i, 1, n) cout << c[i] << '\n';

    
    
    
    return 0;
}

Measured memory_bytes: 3600
import java.util.*;
  
class Main{
    public static void main(String[] args){
         
        Scanner scan = new Scanner(System.in);
        double x1 = scan.nextDouble();
        double y1 = scan.nextDouble();
        double x2 = scan.nextDouble();
        double y2 = scan.nextDouble();
 
        double distance = Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));
 
        System.out.println(distance);
    }
}

Measured memory_bytes: 28112
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {

    BufferedReader br;
    PrintWriter out;
    StringTokenizer st;
    boolean eof;
    final long MOD = 1000L * 1000L * 1000L + 7;

    void solveA() throws IOException {
        int x = nextInt();
        int t = nextInt();
        outln(Math.max(0, x - t));
    }
    void solveB() throws IOException {
        String str = nextString();
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < str.length(); i++) {
            if (i % 2 == 0) {
                sb.append(str.charAt(i));
            }
        }

        outln(sb.toString());
    }
    void solveC() throws IOException {



    }
    void solveD() throws IOException {



    }

    void shuffle(int[] a) {
        int n = a.length;
        for(int i = 0; i < n; i++) {
            int r = i + (int) (Math.random() * (n - i));
            int tmp = a[i];
            a[i] = a[r];
            a[r] = tmp;
        }
    }
    private void outln(Object o) {
        out.println(o);
    }
    private void out(Object o) {
        out.print(o);
    }
    public Main() throws IOException {
        br = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);

        solveB();

        out.close();
    }
    public static void main(String[] args) throws IOException {
        new Main();
    }

    public long[] nextLongArr(int n) throws IOException{
        long[] res = new long[n];
        for(int i = 0; i < n; i++)
            res[i] = nextLong();
        return res;
    }
    public int[] nextIntArr(int n) throws IOException {
        int[] res = new int[n];
        for(int i = 0; i < n; i++)
            res[i] = nextInt();
        return res;
    }
    public String nextToken() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (Exception e) {
                eof = true;
                return null;
            }
        }
        return st.nextToken();
    }
    public String nextString() {
        try {
            return br.readLine();
        } catch (IOException e) {
            eof = true;
            return null;
        }
    }
    public int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }
    public long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }
    public double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }
}

Measured memory_bytes: 23380
#define _USE_MATH_DEFINES
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
struct edge { int u, v; ll w; };

ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

struct bit {
	vector<ll> v;
	bit(int n) : v(n + 1) {}
	ll sum(int i) {
		ll res = 0;
		for (; i > 0; i -= i & -i) res += v[i];
		return res;
	}
	void add(int i, ll x) {
		for (i++; i < v.size(); i += i & -i) v[i] += x;
	}
	int lower_bound(ll x) {
		if (x <= 0) return 0;
		int res = 0;
		for (int i = 1 << 24; i > 0; i >>= 1)
			if (res + i < v.size() && v[res + i] < x) {
				res += i; x -= v[res];
			}
		return res + 1;
	}
};

int main() {
	for (;;) {
		int n, k, m; cin >> n >> k >> m;
		if (n == 0) break;
		bit b(n);
		for (int i = 0; i < n; i++) b.add(i, 1);
		for (n--; n > 0; n--) {
			b.add(m - 1, -1);
			int x = (b.sum(m) + k) % n;
			if (x == 0) x = n;
			m = b.lower_bound(x);
		}
		cout << m << endl;
	}
}

Measured memory_bytes: 1272
class CombMod:
    def __init__(self, V, mod):
        self.fact = [1] * V
        self.finv = [1] * V
        for i in range(1, V):
            self.fact[i] = self.fact[i - 1] * i % mod
        self.finv[-1] = pow(self.fact[-1], mod - 2, mod)
        for i in range(V - 2, 0, -1):
            self.finv[i] = self.finv[i + 1] * (i + 1) % mod
        self.mod = mod

    def comb(self, a, b):
        return self.fact[a] * self.finv[b] % mod * self.finv[a - b] % mod


N, M, K = map(int, input().split())
mod = 998244353
tool = CombMod(N + 1, mod)

ans = 0
for k in range(K + 1):
    val = M * tool.comb(N - 1, k) % mod * pow(M - 1, N - 1 - k, mod) % mod
    ans = (ans + val) % mod
print(ans)


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

int main(){

    while(true){

    int n, x;
    cin >> n >> x;

    if((n==0)&&(x==0)) break;

    int counter=0;
    for(int i=1; i<n+1; i++){
        for(int j=1; j<n+1; j++){
            for(int r=1; r<n+1; r++){
                if((i!=j)&&(i!=r)&&(j!=r)){
                if(x == (i + j + r)){
                    counter++;
                }
                }
            }
        }
    }

    counter/=6;
    
    cout << counter << endl;

    }

    return 0;
}


Measured memory_bytes: 3100
#include <bits/stdc++.h>
using namespace std;
template<class T> bool chmax(T& a,T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T& a,T b) { if (a > b) { a = b; return true; } return false; }

int main() {
    int s, w;
    cin >> s >> w;
    if (s <= w) {
        cout << "unsafe" << '\n';
    } else {
        cout << "safe" << '\n';
    }
    
}

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

//BEGIN CUT HERE
//Binary Indexed Tree
//0-indexed
class Bit{
public:
    explicit Bit(int n):size(static_cast<unsigned int>(n)){
        tbl.resize(size,0);
    }
    void add(int a,ll w){//tbl[a]+=w
        for(int i=a;i<size;i|=i+1)tbl[i]+=w;
    }
    ll sum(int a){//v[0]+...+v[a]
        ll ret=0;
        for(int i=a;i>=0;i=(i&(i+1))-1){
            ret+=tbl[i];
        }
        return ret;
    }
private:
    unsigned int size;
    vector<ll> tbl;
};
//END CUT HERE

//AOJ->library->Range Query->RSQ
int main(){
    int n,q;
    cin>>n>>q;
    Bit bit(n);
    for(int i=0;i<q;i++){
        int a,b,c;cin>>a>>b>>c;
        if(a==0){
            b--;
            bit.add(b,c);
        }else{
            b--;c--;
            cout<<bit.sum(c)-bit.sum(b-1)<<endl;
        }
    }
}


Measured memory_bytes: 3536
#include<stdio.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<string.h>

#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define NDEBUG
#define eprintf(...) do {} while (0)
#endif
#include<cassert>

using namespace std;

typedef long long LL;
typedef vector<int> VI;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define EACH(i,c) for(__typeof((c).begin()) i=(c).begin(),i##_end=(c).end();i!=i##_end;++i)

template<class T> inline void amin(T &x, const T &y) { if (y<x) x=y; }
template<class T> inline void amax(T &x, const T &y) { if (x<y) x=y; }
template<class Iter> void rprintf(const char *fmt, Iter begin, Iter end) {
    for (bool sp=0; begin!=end; ++begin) { if (sp) putchar(' '); else sp = true; printf(fmt, *begin); }
    putchar('\n');
}

int N;

void MAIN() {
    scanf("%d", &N);
    printf("%d\n", (N-1)/2);
}

int main() {
    int TC = 1;
//    scanf("%d", &TC);
    REP (tc, TC) MAIN();
    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define debug(x) cout << "debug " << x << endl;
#define INF (1 << 29)
using namespace std;

int main(){
    int n, d, p[1001];
    int ans = 0;
    cin >> n >> d;
    //rep(i,n) cin >> p[i];
    rep(i,n){
        int inp;
        cin >> inp;
        if(inp >= d){
            ans += inp - d;
        }
    }
    if(ans < 1) cout << "kusoge" << endl;
    else cout << ans << endl;
}

Measured memory_bytes: 1164
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
using namespace std;

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)

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<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }



string S, T;
int main() {
    while (cin >> S >> T) {
        string res = "";
        for (int i = 0; i < S.size(); ++i) {
            bool check = true;
            string tmp = S;
            for (int j = 0; j < T.size(); ++j) {
                if (i + j >= S.size()) { check = false; break; }
                if (S[i+j] != '?' && S[i+j] != T[j]) { check = false; break; }
                tmp[i+j] = T[j];
            }
            if (check) {
                for (int i = 0; i < tmp.size(); ++i) {
                    if (tmp[i] == '?') tmp[i] = 'a';
                }
                if (res == "") res = tmp;
                else chmin(res, tmp);
            }
        }
        if (res != "") cout << res << endl;
        else cout << "UNRESTORABLE" << endl;
    }
}

Measured memory_bytes: 256
A, B = map(int, input().split())
import numpy as np
Grid = np.concatenate((np.zeros((50, 100), dtype='int64'),np.ones((50,100), dtype='int64')),axis=0)

for b in range(B-1):
    y, x = divmod(b, 50)
    Grid[2*y,2*x] = 1

for a in range(A-1):
    y, x = divmod(a, 50)
    Grid[99-2*y,2*x] = 0

print(*(100, 100))
for j in range(100):
    print(''.join(['.' if Grid[j,i]==0 else '#' for i in range(100)]))

Measured memory_bytes: 27364
#include<stdio.h>
int main(void)
{
	int a,d;
	scanf("%d",&d);
		while(d!=-1){
			if(10>d){
				printf("%d\n",4280-1150);
			}
			if(10<=d && 20>d){
				printf("%d\n",4280-(1150+(d-10)*125));
			}
			if(20<=d && 30>d){
				printf("%d\n",4280-(1150+10*125+(d-20)*140));
			}
			if(30<=d){
				printf("%d\n",4280-(1150+10*125+10*140+(d-30)*160));
			}
		scanf("%d",&d);
		}
	return 0;
}

Measured memory_bytes: 1028
from collections import defaultdict
MOD = 10**9 + 7
n = int(input())

d = defaultdict(int)
for m in range(2, n+1):
    while m % 2 == 0:
        d[2] += 1
        m = m // 2

    p = 3
    while m > 1:
        while m % p == 0:
            d[p] += 1
            m = m // p
        p += 2

ans = 1
for k, v in d.items():
    ans *= v + 1
    ans %= MOD

print(ans)


Measured memory_bytes: 3316
#include <bits/stdc++.h>  // include all standard C++ libraries

using namespace std;

// Loops
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define _rrep(i,n) rrepi(i,n,0)
#define rrepi(i,a,b) for(int i=int(a)-1;i>=int(b);--i)

#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define each(xi, x) for (auto&& xi : x)
// Note: we can use rep(i,N) or rep(i,from,to)


// typedef
using ll = long long;
template <class T> using vec = vector<T>;
using vi   = vector<int>;
using vvi  = vector<vi>;
using vvvi = vector<vvi>;
using pii  = pair<int, int>;


// Constants

// Shorter repr for frequently used terms
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second


// Algorithms
#define all(x) (x).begin(), (x).end()
#define uniq(v) v.erase( unique(all(v)), v.end() )
#define perm(c) sort(all(c));for(bool c##p=1;c##p;c##p=next_permutation(all(c)))

template<class T> pair<T, size_t> max(vector<T> &x){ auto it = max_element(all(x)); return mp(*it, it-x.begin()); }
template<class T> pair<T, size_t> min(vector<T> &x){ auto it = min_element(all(x)); return mp(*it, it-x.begin()); }

template<class T> inline bool chmax(T &maxval, const T &newval) { if (maxval<newval) { maxval=newval; return 1; } return 0; }
template<class T> inline bool chmin(T &minval, const T &newval) { if (minval<newval) { minval=newval; return 1; } return 0; }

// Utilities
// Grid world utilities
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
#define inside(H,W,y,x) 0<=(x) && (x)<(W) && 0<=(y) && (y)<(H)

inline int in() {int x; cin >> x; return x;} // read int from cin
inline  ll IN() {ll x; cin >> x; return x;}  // read ll from cin



// Debug
#ifdef LOCAL
  #include "dump.hpp"
  #define debug(x) cerr << #x << ": " << x << '\n'
#else
  #define dump(...)
  #define debug(x)
#endif

// Paste snippets here!!

//

int main(){
  cin.tie(0); ios::sync_with_stdio(false);    // Magic for faster cin
  int X=in();
  if(X==3 || X==5 || X==7) cout << "YES" << endl;
  else cout << "NO" << endl;
  return 0;
}

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

using ll = long long;

int main() {
    string S, T;
    cin >> S >> T;
    int ans = 0;
    rep(i, 3) {
        if (S[i] == T[i]) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
h, w, k = map(int, input().split())
dic = {}
for i in range(h):
  s = input()
  for j in range(w):
    if s[j] == '#':
      dic[(i, j)] = 1
res = 0
for ibit in range(2 ** h):
  for jbit in range(2 ** w):
    cnt = 0
    for tpl in dic:
      if ((ibit >> tpl[0]) & 1) and ((jbit >> tpl[1]) & 1):
        cnt += 1
    if cnt == k:
      res += 1
print(res)

Measured memory_bytes: 9208
use std::io;
use std::io::BufRead;

fn get_line() -> String {
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf
}
// todo : how to do this in main?
fn expand(n:u32, l:&str){
    for _ in 0..n {
        println!("{}",l);
    }
}

fn main(){
    let n = 2;
    get_line();
    let stdin = io::stdin();
    for line in stdin.lock().lines(){
        expand(n, &line.unwrap());
    }
}

Measured memory_bytes: 380
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<iomanip>
#include<cstring>
#include<string>
#include<cmath>
#include<map>
#include<vector>
#include<queue>
#include<set>
#define ll long long
using namespace std;

int main()
{
    //freopen(".in","r",stdin);
    //freopen(".out","w",stdout);
	int n,m;
	cin>>n>>m;
	int mm=m;
	if(n&1){
		for(int i=1;i<=m;i++){
			cout<<i<<" "<<i+2*mm-1<<endl;
			mm--;
		}
	}
	else{
		int jl=1,jr=1+n/2;
		for(int i=1;i<=m;i++){
			if(mm&1){
				cout<<jl<<" "<<jl+mm<<endl;
				jl++;
			}
			else{
				cout<<jr<<" "<<jr+mm<<endl;
				jr++;
			}
			mm--;
		}
	}
    return 0;
}



Measured memory_bytes: 3628
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <iomanip>
#include <vector>
#include <set>
#include <algorithm>
#include <utility>
#include <map>
#include <queue>

#define forr(i,a,b) for(int i = a; i < int(b); i++)
#define forn(i, n)  forr(i, 0, n)
#define pb push_back;
#define fst first;
#define snd second;

typedef long long ll;

using namespace std;

const int MAXN = 1024;
int N;


int main(){
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	//freopen("input.in", "r", stdin);

	string S;
	cin >> S;

	ll cantW = 0, ans = 0;
	for(int i = S.size()-1; i >= 0; i--){
		if(S[i] == 'W') cantW++;
		else ans += cantW;
	}
	cout << ans << endl;


	return 0;
}

Measured memory_bytes: 720
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
using ll = long long;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-8;
const int MOD = 1000000007;
// const int MOD = 998244353;
const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};
const int dy8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dx8[] = {0, -1, -1, -1, 0, 1, 1, 1};
template <typename T, typename U> inline bool chmax(T &a, U b) { return a < b ? (a = b, true) : false; }
template <typename T, typename U> inline bool chmin(T &a, U b) { return a > b ? (a = b, true) : false; }
struct IOSetup {
  IOSetup() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  }
} iosetup;

int main() {
  int n, m; cin >> n >> m;
  vector<vector<int>> graph(n);
  while (m--) {
    int a, b; cin >> a >> b; --a; --b;
    graph[a].emplace_back(b);
    graph[b].emplace_back(a);
  }
  vector<int> ans(n, -1);
  ans[0] = 0;
  queue<int> que;
  que.emplace(0);
  while (!que.empty()) {
    int ver = que.front(); que.pop();
    for (int e : graph[ver]) {
      if (ans[e] == -1) {
        ans[e] = ver;
        que.emplace(e);
      }
    }
  }
  cout << "Yes\n";
  FOR(i, 1, n) cout << ans[i] + 1 << '\n';
  return 0;
}


Measured memory_bytes: 10244
package main

import "fmt"

func main() {
	list := [5]string{"a", "i", "u", "e", "o"}
	var c string
	var frag bool

	fmt.Scan(&c)

	for i := 0; i < 5; i++ {
		if list[i] == c {
			frag = true
			break
		}
	}

	if frag {
		fmt.Println("vowel")
	} else {
		fmt.Println("consonant")
	}
}

Measured memory_bytes: 512
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;
import java.util.Collections;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        KatanaThrower solver = new KatanaThrower();
        solver.solve(1, in, out);
        out.close();
    }

    static class KatanaThrower {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            long h = in.nextLong();

            Long[] a = new Long[n];
            Long[] b = new Long[n];
            for (int i = 0; i < n; i++) {
                a[i] = Long.parseLong(in.next());
                b[i] = Long.parseLong(in.next());
            }
            Arrays.sort(a, Collections.reverseOrder());
            Arrays.sort(b, Collections.reverseOrder());
            long amax = a[0];
            long bmax = b[0];
            int bpos = 0;
            long result = 0;
            while (0 < h && amax <= bmax) {
                h -= bmax;
                result++;
                bpos++;
                if (b.length <= bpos) {
                    break;
                }
                bmax = b[bpos];
            }
            if (0 < h) {
                result += (h % amax == 0) ? h / amax : h / amax + 1;
            }
            out.println(result);
        }

    }
}



Measured memory_bytes: 65956
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        try(Scanner sc = new Scanner(System.in)){
            while(true){
                int n = sc.nextInt();
                int r = sc.nextInt();
                if(n == 0 && r == 0) break;

                int[] card = new int[n];
                for(int i=0; i<card.length; i++){
                    card[i] = n-i;
                }

                for(int i=0; i<r; i++){
                    int p = sc.nextInt();
                    int c = sc.nextInt();

                    int[] move = new int[c];
                    for(int j=0; j<move.length; j++) {
                        move[j] = card[p - 1 + j];
                    }

                    int[] cut = new int[p-1];
                    for(int j=0; j<p-1;j++){
                        cut[j] = card[j];
                    }

                    for(int k = 0; k<p-1; k++){
                        card[k+c] = cut[k];
                    }

                    for(int l = 0; l<c; l++){
                        card[l] = move[l];
                    }

                }
                System.out.println(card[0]);
            }
        }
    }
}


Measured memory_bytes: 37592
#[derive(Debug, Clone)]
struct UnionFind {
    table: Vec<i32>,
    num: usize,
}
impl UnionFind {
    fn new(n: usize) -> UnionFind {
        UnionFind {
            table: vec![-1; n],
            num: n,
        }
    }
    fn root(&mut self, x: usize) -> usize {
        let mut r = x;
        if self.table[x] >= 0 {
            let t = self.table[x] as usize;
            r = self.root(t);
            self.table[x] = r as i32;
        }
        r
    }
    fn find(&mut self, x: usize, y: usize) -> bool {
        self.root(x) == self.root(y)
    }
    fn size(&mut self, x: usize) -> usize {
        let r = self.root(x);
        (-self.table[r]) as usize
    }
    fn union(&mut self, x: usize, y: usize) {
        let xr = self.root(x);
        let yr = self.root(y);
        if xr != yr {
            if self.size(xr) < self.size(yr) {
                self.table[yr] += self.table[xr];
                self.table[xr] = yr as i32;
            } else {
                self.table[xr] += self.table[yr];
                self.table[yr] = xr as i32;
            }
            self.num -= 1;
        }
    }
}

#[derive(Debug, Clone, Copy, PartialEq, PartialOrd, Ord, Eq)]
struct Edge {
    from: usize,
    to: usize,
    cost: i64,
}

// O(V^3)
fn mst_cost(mut edges: Vec<Edge>, n: usize) -> i64 {
    let mut res = 0;
    let mut uf = UnionFind::new(n);
    edges.sort_by(|x, y| x.cost.cmp(&y.cost));
    for e in edges {
        if !uf.find(e.from, e.to) {
            res += e.cost;
            uf.union(e.from, e.to);
        }
        if uf.num == 1 {
            break;
        }
    }
    res
}

fn solve() {
    let (v, e): (usize, usize) = (read::<usize>(), read::<usize>());
    let mut edges = vec![];
    for _ in 0..e {
        let edge = Edge {
            from: read(),
            to: read(),
            cost: read(),
        };
        edges.push(edge);
    }
    println!("{}", mst_cost(edges, v));
}

fn main() {
    let stack_size = 104_857_600;
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}

// =========
#[allow(unused_imports)]
use std::cmp::{max, min, Ord, Ordering, PartialOrd};
#[allow(unused_imports)]
use std::collections::{BinaryHeap, HashMap, HashSet};
#[allow(unused_imports)]
use std::process::exit;

#[allow(dead_code)]
const MOD: usize = 1000000007;
const INF: usize = 100_000_000_000;

fn read<T: std::str::FromStr>() -> T {
    use std::io::Read;
    let stdin = std::io::stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

// =========



Measured memory_bytes: 13148
#include <stdio.h>
#include <math.h>

double sx[501], sy[501], sz[501];
double lx[51], ly[51], lz[51], angs[51];

double getArg(int i, int j){
    return acos((sx[i]*lx[j] + sy[i]*ly[j] + sz[i]*lz[j])
                 /(sqrt(sx[i]*sx[i]+sy[i]*sy[i]+sz[i]*sz[i])*
                   sqrt(lx[j]*lx[j]+ly[j]*ly[j]+lz[j]*lz[j])));
}

int main(){
    int n, m, i, j, ans;
    while(scanf("%d",&n), n){
        for(i=0;i<n;i++) scanf("%lf%lf%lf",sx+i,sy+i,sz+i);
        scanf("%d",&m);
        for(i=0;i<m;i++) scanf("%lf%lf%lf%lf",lx+i,ly+i,lz+i,angs+i);

        ans = 0;
        for(i=0;i<n;i++){
            for(j=0;j<m;j++){
                if( getArg(i,j) < angs[j] ){
                    ans++;
                    break;
                }
            }
        }

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

Measured memory_bytes: 0
//我是菜鸡
#include<bits/stdc++.h>
#define _for(i,a,b) for(int i = (a);i<(b);++i)
#define _defor(i,a,b) for((i) = (a);(i)<(b);++i)
#define _rfor(i,a,b) for(int i = (a);i>(b);--i)
#define _sfor(p,st) for(auto p:st)
#define debug(q,x) cout<<q<<x<<endl
using namespace std;
typedef long long ll;
const int INF = 0x3f3f3f3f;
const int maxn = 1e5 + 5;
const int MOD = 1e9 + 7;
const double ext = 1e-6;
void deprint() {
	//ofstream cout("E:\\acm dream\\debug.txt");
	return;
}
int main() {
	//ifstream cin("E:\\acm dream\\in.txt");
	//ofstream cout("E:\\acm dream\\out.txt");
	//srand((unsigned)time(nullptr));
	ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	int n, m;
	while (cin >> n >> m) {
		int ans = 0;
		bool flag = false;
		int l = -INF, r = INF, L, R;
		_for(i, 0, m) {
			cin >> L >> R;
			if (L >= l&& L <= r)
			{
				l = L;
				if (R <= r)r = R;
			}
			else if (L <= l) {
				if (R < l)flag = true;
				else if(R<=r)r = R;
			}
			else flag = true;
		}
		if (flag)cout << 0;
		else cout << r - l + 1;
		cout << endl;
	}
	return 0;
}

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

using namespace std;
typedef pair<int, int> P;
typedef long long ll;

const int maxv = 10000 + 10;
struct edge
{
    int to, d, c;
    edge() {}
    edge(int to, int d, int c):to(to), d(d), c(c) {}
};
vector<edge> G[maxv];
int d[maxv];

int N, M;

void dijkstra(int s)
{
    priority_queue<P, vector<P>, greater<P> > que;
    memset(d, 0x3f, sizeof(d));
    d[s] = 0;
    que.push(P(0, s));
    while(!que.empty())
    {
        P p = que.top(); que.pop();
        int v = p.second;
        if(p.first > d[v]) continue;
        for(int i=0; i<G[v].size(); i++)
        {
            edge e = G[v][i];
            if(d[e.to] > d[v]+e.d)
            {
                d[e.to] = d[v] + e.d;
                que.push(P(d[e.to], e.to));
            }
        }
    }
}

int main()
{
    while(scanf("%d%d", &N, &M)==2 && N)
    {
        for(int i=0; i<N; i++)  G[i].clear();
        for(int i=0; i<M; i++)
        {
            int u, v, d, c;
            scanf("%d%d%d%d", &u, &v, &d, &c);
            u--; v--;
            G[u].push_back(edge(v, d, c));
            G[v].push_back(edge(u, d, c));
        }
        dijkstra(0);
        int ans = 0;
        for(int i=1; i<N; i++)
        {
            int mincost = 0x3f3f3f3f;
            for(int j=0; j<G[i].size(); j++)
            {
                edge e = G[i][j];
                if(d[e.to]+e.d==d[i] && e.c<mincost)
                    mincost = e.c;
            }
            ans += mincost;
        }
        printf("%d\n", ans);
    }
    return 0;
}

Measured memory_bytes: 3240
/**********************************JAI SAI RAM*****************************************/
//HELP IN CODEFORCES ROUND 638 DIV 2

#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
typedef long long int ll;
ll P=1000000007;
ll MAX=P*(P-7);
ll MIN=-1*MAX;
const int sizes=100001;
const int BLK = 1200;

int main()
{
    ll i,j,k,l,m,n,o,p,q,r,s,t,a[sizes],vis[sizes];
    cin>>n>>m;
    for(i=1;i<=n;i++)
    {
        cin>>a[i];
        vis[i]=1;
    }
     
    for(i=0;i<m;i++)
    {
        cin>>j>>k;
        if(a[j]<=a[k])
        vis[j]=0;
        if(a[k]<=a[j])
        vis[k]=0;
    }
    s=0;
    for(i=1;i<=n;i++)
    {
       // cout<<vis[i]<<" ";
        s+=vis[i];
    }
    cout<<s<<endl;
    return 0;
}


Measured memory_bytes: 5192
#include<iostream>
#include<algorithm>
#include<string>
#include<math.h>
using namespace std;
typedef long long ll;

int k,a,b;
	
int main()
{
	cin>>k>>a>>b;
	for(int i=a;i<=b;i++)
	{
		if(i%k==0)
		{
			cout<<"OK";
			return 0;
		}
	}
	cout<<"NG";
	return 0;
}

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

int main()
{
    int a, b;
    char op;
    while (true)
    {
        cin >> a >> op >> b;
        if (op == '?')  break;
        switch (op)
        {
        case '+': cout << a + b << endl; break;
        case '-': cout << a - b << endl; break;
        case '*': cout << a * b << endl; break;
        case '/': cout << a / b << endl; break;
        }
    }
    return 0;
}



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

int main() {
  int k, n;
  cin >> k>> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(a.begin(), a.end());
  int m = a[n-1]-a[0];
  for (int i = 1; i<n; i++) {
    m=min(m, a[i-1]-a[i]+k);
  }
  cout << m <<endl;
}

Measured memory_bytes: 1152
/*created by tanishk gupta*/
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define repl(i,a,n) for(long long int i=a;i<n;i++)
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef vector<int> VI;
typedef long long int ll;
typedef unsigned long long ull;
typedef pair<int,int> PII;
typedef double db;
mt19937 mrand(random_device{}());
const ll MOD=1e9+7;
const ll mod=1e9+7;
//const llint MOD;
const ll N=(ll)(1e6+1);
int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll add(ll a,ll b){return ((a%MOD)+(b%MOD))%MOD;}
ll mul(ll a,ll b){return ((a%MOD)*(b%MOD))%MOD;}
ll sub(ll a,ll b){return ((a%MOD)-(b%MOD)+MOD)%MOD;}
ll binpow(ll x, ll y){ll z = 1;while(y){if(y & 1) z = mul(z, x);x = mul(x, x);y >>= 1;}return z;}
ll inv(int x){return binpow(x, MOD - 2);}
ll divide(ll x, ll y){return mul(x, inv(y));}
ll fact[N];
void precalc(){fact[0] = 1;for(ll i = 1; i < N; i++)fact[i] = mul(fact[i - 1], i);}
ll C(ll n, ll k){return divide(fact[n], mul(fact[k], fact[n - k]));}
//bool prime[N];
//void sieve() {for(int i=2;i<N;i++) {prime[i]=true;}for (int p=2; p*p<=N; p++){if (prime[p] == true){for (int i=p*p; i<=N; i += p)prime[i] = false;}}}
ll legendpow(ll n, ll p){ll total = 0;while (n){n /= p;total += n;}return total;}

//head==================================================================================
//ll dp[1024][1024];
ll dp[3001][3001][4];

int main()
{
    int r,c,k;
    cin>>r>>c>>k;
    ll a[r+1][c+1];
    memset(a,0,sizeof(a));
    while (k--)
    {
        int x,y;
        ll v;

        cin>>x>>y>>v;
        a[x][y]=v;
    }
    ll ans=0;
    rep(i,1,r+1)
    {
        rep(j,1,c+1)
        {
            dp[i][j][1]=max(dp[i][j-1][1],a[i][j]+max({dp[i-1][j][1],dp[i-1][j][2],dp[i-1][j][3]}));
            dp[i][j][2]=max(dp[i][j-1][2],dp[i][j-1][1]+a[i][j]);
             dp[i][j][3]=max(dp[i][j-1][3],dp[i][j-1][2]+a[i][j]);


        }
    }
    cout<<max({dp[r][c][1],dp[r][c][2],dp[r][c][3]});

}


Measured memory_bytes: 355200
#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<bits/stdc++.h>
using namespace std;
struct data{
    long long x,y;
};
vector<data> d[600001];
data k1[600001],k2[600001];
long long n,m,sum,l,r,x,y,s[600001][2],v[600001][2],k[600001];
long long cmp(data a,data b){
    if(a.x==b.x)return a.y<b.y;
    return a.x<b.x;
}
void merger(long long s1,long long s2,long long a){
    long long d1=1,d2=1,cnt1=0,cnt2=0,p,la=100000000000000000;
    p=0;
    if(d[s2].size()){
        for(long long i=0;i<d[s1].size();i++){
            while(p<d[s2].size()-1&&d[s2][p+1].x+d[s1][i].y<=m)p++;
            if(d[s2][p].x+d[s1][i].y<=m){
                cnt1++;
                k1[cnt1].x=d[s1][i].x;
                k1[cnt1].y=d[s2][p].y;
            }
        }
    }
    p=0;
    if(d[s1].size()){
        for(long long i=0;i<d[s2].size();i++){
            while(p<d[s1].size()-1&&d[s1][p+1].x+d[s2][i].y<=m)p++;
            if(d[s1][p].x+d[s2][i].y<=m){
                cnt2++;
                k2[cnt2].x=d[s2][i].x;
                k2[cnt2].y=d[s1][p].y;
            }
        }
    }
    while(d1+d2<=cnt1+cnt2+1){
        if(d1>cnt1){
            if(la>k2[d2].y)d[a].push_back(k2[d2]);
            la=min(la,k2[d2].y);
            d2++;
        }else if(d2>cnt2){
            if(la>k1[d1].y)d[a].push_back(k1[d1]);
            la=min(la,k1[d1].y);
            d1++;
        }else if(cmp(k1[d1],k2[d2])){
            if(la>k1[d1].y)d[a].push_back(k1[d1]);
            la=min(la,k1[d1].y);
            d1++;
        }else{
            if(la>k2[d2].y)d[a].push_back(k2[d2]);
            la=min(la,k2[d2].y);
            d2++;
        }
    }
}
void dfs(long long a){
    d[a].clear();
    data da;
    if(!s[a][0]){
        da.x=0;
        da.y=0;
        d[a].push_back(da);
        return;
    }
    dfs(s[a][0]);
    dfs(s[a][1]);
    for(long long i=0;i<d[s[a][0]].size();i++){
        d[s[a][0]][i].x+=v[a][0];
        d[s[a][0]][i].y+=v[a][0];
    }
    for(long long i=0;i<d[s[a][1]].size();i++){
        d[s[a][1]][i].x+=v[a][1];
        d[s[a][1]][i].y+=v[a][1];
    }
    merger(s[a][0],s[a][1],a);
}
bool check(long long val){
    m=val;
    dfs(1);
    if(d[1].empty())return 0;
    return 1;
}
int main(){
    scanf("%lld",&n);
    for(long long i=2;i<=n;i++){
        scanf("%lld%lld",&x,&y);
        if(s[x][0]){
            s[x][1]=i;
            v[x][1]=y;
        }else{
            s[x][0]=i;
            v[x][0]=y;
        }
        sum=sum+y;
    }
    r=sum;
    while(l<r){
        long long mid=(l+r)/2;
        if(check(mid))r=mid;
        else l=mid+1;
    }
    printf("%lld\n",l);
}

Measured memory_bytes: 49528