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

using namespace std;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define eee(a) (cerr << (#a) << ": " << (a) << endl);


using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
using mint = map<int, int>;

int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

const char sp = ' ';
const char cmm = ',';
const int MOD = 1e9+7;
const int INF = 1e9;
const ll LINF = 1e18;

ll mod(ll a, ll b){return (a%b+b)%b;}
ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b){return a*b/gcd(a,b);}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void Judge(bool b){b?Yes():No();}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void JUDGE(bool b){b?YES():NO();}
ll powmod(ll b, ll e){ll r=1;while(e>0){if(e&1)r=(r%MOD)*(b%MOD)%MOD;b=(b%MOD)*(b%MOD)%MOD;e>>=1;}return r;}
double distance(ll x1, ll y1, ll x2, ll y2){return sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));}

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; }
template<typename T>
void ppp(T n){cout << n << endl;}
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {return s << "(" << p.first << ", " << p.second << ")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
	int len = v.size();
    s << '[';
	for (int i = 0; i < len; ++i) {
		s << v[i]; if (i < len-1) s << ", ";
	}
    s << ']';
	return s;
}

struct aaa{
    aaa(){
        cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(15);
    };
}fastio;

int main(){

    int n;
	cin >> n;
	vector<int> d(n);
	rep(i, n) cin >> d[i];

	sort(d.begin(), d.end());
	if(d[n/2-1] == d[n/2]){
		ppp(0);
	}
	else{
		ppp(d[n/2]-d[n/2-1]);
	}

    return 0;
}


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

int main(){
    int k;
    string s;
    cin >> k >> s;
    if(s.size() > k){
        for(int i = 0; i < k; i++){
            cout << s.at(i);
        }
        cout << "..." << endl;
    }else{
        cout << s << endl;
    }
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define REP(i, x, y) for (ll i = x; i <= y; i++)
#define BIT(t) (1ll << t)
#define PER(i, y, x) for (ll i = y; i >= x; i--)
#define vll vector<ll>
#define vvll vector<vector<ll>>
#define pll pair<ll, ll>
#define SIZE(v) ll(v.size())
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
using namespace std;
typedef long long ll;
//        ios::sync_with_stdio(false);
//        cin.tie(nullptr);

pll ok(ll n, ll m, vll& a, ll mid, vll& sm){
        ll ans1 = 0;
        ll ans2 = 0;
        REP(i,0,n-1){
                ll tmp = mid - a[i];
                ll b = lower_bound(a.begin(), a.end(), tmp) - a.begin();
                ans1 += n - b;
                ans2 += sm[b] + (n-b) * a[i];
        }
        return {ans1, ans2};
}

int main(){
        ll n, m;
        cin >> n >> m;
        vll a(n), sm(n+1, 0);
        REP(i,0,n-1){
                cin >> a[i];
        }
        sort(a.begin(), a.end());

        PER(i,n-1,0){
                sm[i] = sm[i+1] + a[i];
        }
        ll lb = 0; ll ub = 1e18;
        while(ub - lb > 1){
                ll mid = (ub + lb) / 2;
                if(ok(n, m, a, mid, sm).first <= m){
                        ub = mid;
                }else{
                        lb = mid;
                }
        }
        pll tmp= ok(n, m, a, ub, sm);
        cout << tmp.second + (m - tmp.first) * lb << endl;

}

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

using namespace std;

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

	vector<int> ans(n);
	for (int i = 0; i < n - 1; i++) {
		int x;
		cin >> x;
		ans[x-1]++;
	}

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

	return 0;
}


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

int main() {
  int n; cin >> n;
  while(true) {
    if(n==111 || n== 222 || n == 333 || n == 444 || n == 555 || n == 666 || n == 777 || n == 888 || n == 999) {
      cout << n << endl;
      return 0;
    } else {
      n++;
    }
  }

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define rep(i,a,b) for(long long i=a; i<b; i+=1)
#define repr(i,a,b) for(long long i=a; i<=b; i+=1)
#define vec vector<ll>
#define map map<string,int>
#define repa(p,A) for(auto p:A)
#define pb push_back
#define sort(a) sort(a.begin(),a.end())
#define reverse(a) reverse(a.begin(),a.end())

using namespace std;
int main() {
  ll N,Q;
  string S;
  cin>>N>>Q;
  cin>>S;
  vec A(N+1,0);
  ll count=0;
  rep(i,1,N) {
    if(S[i-1]=='A' && S[i]=='C') {
      A[i]=A[i-1]+1;
    }
    else A[i]=A[i-1];
  }
  
  rep(i,0,Q) {
    ll l,r;
    cin>>l>>r;
    cout<<A[r-1]-A[l-1]<<endl;
  }
}

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

using namespace std;
#define inputInt(a) int a; cin >> a; 
#define inputInt2(a,b) int a; int b; cin >> a >> b; 
#define inputInt3(a,b,c) int a; int b; int c; cin >> a >> b >> c;
#define inputLong(a) long a;cin >> a; 
#define inputIntArray(a,N) int a[N];for(int i=0;i<N;i++){cin >> a[i];}
#define inputLongArray(a,N) long a[N];for(int i=0;i<N;i++){cin >> a[i];}
#define inputIntArray2(a,b,N) int a[N]; int b[N]; for(int i=0;i<N;i++){cin >> a[i] >> b[i];}
#define output(answer) cout << answer << endl;
#define fN(i,N)    for(int i=0; i<N; i++)
#define fSE(i,s,e) for(int i=s; i<=e; i++)
#define ll long long
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define FOR(i,N) for(int i=0; i<N; i++)
#define cinv(v,N) vector<int> v(N); for(int i=0; i<N; i++){ cin >> v[i]; }
#define mt make_tuple
const ll MOD2 = 998244353;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main()
{
  //input
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int M1, D1, M2, D2; cin >> M1 >> D1 >> M2 >> D2;
  //main
  
  
  // output
  if(D2 == 1){cout << 1 << endl;}
  else{ cout << 0 << endl;}

  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int search(int S[], int n, int T[], int j){
  int i = 0;
  S[n] = T[j];
  while ( S[i] != T[j] ) i++;
  return i != n;
}

int main(){

  int n, q, C, j;
  int S[10000], T[500];
  C = 0;

  scanf("%d", &n);
  for ( j = 0; j < n; j++ ) scanf("%d", &S[j]);

  scanf("%d", &q);
  for ( j = 0; j < q; j++ ){
    scanf("%d", &T[j]);
    if ( search(S, n, T, j) ) C++;
  }

  printf("%d\n", C);

  return 0;
}

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

ll gcd(ll x,ll y){
  if (y==0){
    return x;
  }
  else{
    return gcd(y,x%y);
  }
}

int main(){
  ll n;
  cin >> n;
  vector<ll> v(n),l(1,0);
  rep(i,n){
    cin>>v.at(i);
  }
  rep(i,n){
    l.push_back(gcd(v.at(i),l.at(i)));
  }
  sort(l.begin(),l.end());
  cout << l.at(1) << endl;
}

Measured memory_bytes: 2168
// in the name of Allah

#include <bits/stdc++.h>
using namespace std;

#define endl '\n'
#define pb push_back
#define ll long long
#define double long double
#define sz(x) ((int) (x.size()))

#define fr first
#define se second

#define inf 1e9
#define max_n 123456
#define mod 1000000007

ll add(ll a, ll b) {
	a += b;
	if(a >= mod) return a - mod;
	return a;
}

ll mul(ll a, ll b) {
	a *= b;
	if(a >= mod) return a % mod;
	return a;
}

ll power(ll a, ll b) {
	ll p = 1;
	while(b) {
		if(b&1) p = mul(p, a);
		a = mul(a, a);
		b /= 2;
	}
	return p;
}


string s, t;
ll dp[3003][3003];
int w[3003][3003];

ll memo(int i, int j) {
	if(i < 0 || j < 0) return 0;
	if(dp[i][j] != -1) return dp[i][j];
	if(s[i] == t[j]) {
		w[i][j] = 2;
		return dp[i][j] = memo(i-1, j-1) + 1;
	}
	else {
		ll x = memo(i-1, j);
		ll y = memo(i, j-1);
		if(x >= y) {
			w[i][j] = 0;
			return dp[i][j] = x;
		}
		else {
			w[i][j] = 1;
			return dp[i][j] = y;
		}
	}
}

int main() {
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> s >> t;
	memset(dp, -1, sizeof dp);
	int len = memo(sz(s)-1, sz(t)-1);
	string res = "";
	int i = sz(s)-1;
	int j = sz(t)-1;
	while(true) {
		if(w[i][j] == 0) i--;
		else if(w[i][j] == 1) j--;
		else {
			res += s[i];
			i--;
			j--;
		}
		if(sz(res) == len) break;
	}
	reverse(res.begin(), res.end());
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 106240
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <cmath>

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

constexpr ll LLINF {1001002003004005006};//ll = 9*LLINF
constexpr int INTINF {1000000000};//int = 2*INTINF

#define  rep(i,n)   for(int i = 0; i < (n); ++i)
#define rrep(i,n)   for(int i = 1; i <= (n); ++i)
#define drep(i,n)   for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for(int i = s; i < t;  ++i)

template<typename T>
void maxs(T& x, T&& y) {
  x=std::max(x,y);
}
template<typename T>
void maxs(T& x, T& y) {
  x=std::max(x,y);
}

template<typename T>
void mins(T& x, T&& y) {
  x=std::min(x,y);
}
template<typename T>
void mins(T& x, T& y) {
  x=std::min(x,y);
}

int main() {
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  int N, K;
  std::string S;
  cin >> N >> K >> S;
  S[K-1] -= 'A';
  S[K-1] += 'a';
  cout << S << '\n';
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;

int main(){
    string s;
    cin >> s;
    int N = s.size();

    int l[N + 1];
    int r[N + 1];
    l[0] = 0;
    for(int i = 1; i <= N; i++){
        l[i] = l[i - 1];
        if(s[i - 1] == '<') l[i]++;
        else l[i] = 0;
    }

    r[N] = 0;
    for(int i = N - 1; i >= 0; i--){
        r[i] = r[i + 1];
        if(s[i] == '>') r[i]++;
        else r[i] = 0;
    }

    ll ans = 0;
    for(int i = 0; i <= N; i++){
        ans += max(l[i], r[i]);
    }

    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 4740
import numpy as np

n = int(input())
a = np.array([int(i) for i in input().split()], dtype=np.int64)

s = np.copy(a)
for i in range(1, n):
    s = np.maximum(a[:n-i]-s[1:n-i+1], a[i:]-s[:n-i])

print(s[0])


Measured memory_bytes: 12500
from sys import stdin
from sys import setrecursionlimit
from itertools import permutations
import numpy as np

h,w,k = map(int,input().split())
li = [["" for i in range(w)]for j in range(h)]
for i in range(h):
    s = stdin.readline().rstrip()
    for j in range(w):
        li[i][j] = s[j]

point = 0
c = np.array(li)

for i in range(2**h):
    for j in range(2**w):
        d = c.copy()
        count = 0
        for ii in range(h):
            if (i >> ii)&1:
                for iii in range(w):
                    d[ii][iii] = 0
        for jj in range(w):
            if (j >> jj)&1:
                for jjj in range(h):
                    d[jjj][jj] = 0
        d = d.flatten()
        if np.count_nonzero(d=="#") == k:
            point += 1

print(point)

Measured memory_bytes: 26416
//msol2019_a.cpp
//Sun Jun 16 14:27:26 2019

#include <iostream>
#include <string>
#include <queue>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#include <set>
#define INTINF 2147483647
#define LLINF 9223372036854775807
using namespace std;
using ll=long long;
typedef pair<int,int> P;

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

	cout << (180-360/n)*n<< endl;
//	printf("%.4f\n",ans);
}

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

int main(){
	long long int a,b,min=30000000;
	cin>>a>>b;
	if(b-a>=3000){
		cout<<0<<endl;
	}
	else{
		for(long long int i=a;i<b+1;i++){
			for(long long int j=a;j<i;j++){
			if(min> ((i%2019)*(j%2019))%2019){
				min = ((i%2019)*(j%2019))%2019;
			}
			}
			
		}
		cout<<min<<endl;
		
	}
	return 0;
}

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

#ifdef loc
    #include "loc_debug.h"
#else
    #define pr(...)
    #define pra(a,n)
    #define praa(a,n,m)
    #define prl()
#endif

typedef long long ll;
typedef long double ld;
#define fast_io ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define sz(a) int(a.size())
#define rep(i, s, n)  for(int i = s; i <= n; ++i)
#define rev(i, n, s)  for(int i = n; i >= s; --i)
#define fore(x, a) for(auto &&x : a)
#define fill(a, x) memset((a), (x), sizeof(a))
#define tcase int __t; cin >> __t; rep(tc, 1, __t)
#define F first
#define S second
#define gc getchar

const int mod = 1000000007;
#define _ %mod
const int N = 100005;



int main() {
    fast_io;
    int n;
    cin >> n;
    vector<int> a(2 * n, 0);
    rep(i, 0, 2 * n - 1) {
        cin >> a[i];
    }
    sort(all(a));
    int ans = 0;
    rep(i, 0, 2 * n - 1) {
        ans += a[i];
        i++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
a,b,c,d=map(int, input().split())
val=0
i=0
while True:
    if i%2==0:
        c=c-b
    else:
        a=a-d
    if a<=0 or c<=0:
        if c<=0:
            val=1
        break
    i=i+1
if val==1:
    print("Yes")
else:
    print("No")
    
     

Measured memory_bytes: 9184
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < n; i++)
using ll = long long;
using namespace std;
const int INF = 1e9;

int main() {

    string S;
    cin >> S;

    for (int i = 0; i < S.size(); i++) {
        for (int j = i; j < S.size(); j++) {
            string t = S;
            t.erase(t.begin() + i, t.begin() + j);
            if (t == "keyence") {
                cout << "YES" << endl;
                return 0;
            }
        }
    }

    cout << "NO" << endl;

    return 0;
}

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

using namespace std;

typedef long long LL;
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)

int main(){
	LL N,K; cin >> N >> K;
	LL a = N/K;
	LL b = (K%2==0?N/(K/2)-a:0);
	cout << a*a*a+b*b*b << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(int argc, char const *argv[])
{
    int n, a, b; cin >> n >> a >> b;
    int x1=0, x2=0, x3=0;
    int p;
    for(int i=0;i<n;++i) {
        cin >> p;
        if(p<=a) ++x1;
        else if(p>=a+1 && p<=b) ++x2;
        else if(p>=b+1) ++x3;
    }
    cout << min(x1, min(x2, x3)) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <cstring>
#include <iomanip>
#include <cmath>
#include <tuple>
#include <map>
#include <unordered_map>
#include <queue>
using namespace std;
typedef long long ll;

int main(int argc, char *argv[])
{
    ll n, i, j;
	cin >> n;
	vector<ll> a(n);
	ll answer = 0;
	map<ll, ll> mpi, mpj;
	for (i = 0; i < n; i++) {
		cin >> a[i];
		if (mpi.find(i + a[i]) == mpi.end())
			mpi[i + a[i]] = 1;
		else
			mpi[i + a[i]]++;
		if (mpj.find(i - a[i]) == mpj.end())
			mpj[i - a[i]] = 1;
		else
			mpj[i - a[i]]++;
	}

	for (auto itr = mpi.begin(); itr != mpi.end(); itr++) {
	    if (mpj.find(itr->first) != mpj.end())
			answer += itr->second * mpj[itr->first];
	}
				
	cout << answer << endl;

	return 0;
}


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

int main(){
    int n,m,ans=0;
    cin >> n >> m;
    vector<int> x(m),l(m-1);
    for(int i = 0;i < m;i ++){
        cin >> x[i];
    }
    sort(x.begin(),x.end());
    for(int i = 1;i < m;i ++){
        l[i-1] = x[i]-x[i-1];
    }
    sort(l.begin(),l.end());
    if(m>n){
        for(int i = 0;i < m-n;i ++){
            ans += l[i];
        }
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;
typedef unsigned long long ll;


int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    ll h,w;
    cin>>h>>w;
    ll ans;
    if(h==1 || w==1){
        cout<<1;
        return 0;
    }
    cout<<((h*w)+1)/2;


    return 0;
}





Measured memory_bytes: 256
n = int(input())
s_l = [ input() for _ in range(n) ]

d = {}
for i in list(s_l[0]):
    if i in d.keys():
        d[i] += 1
    else:
        d[i] = 1
c_l = set(list(s_l[0]))


for s in s_l[1:]:
    for c in list(c_l):
        count = list(s).count(c)
        if d[c] > count:
            d[c] = count

ans = []
for k in list(c_l):
    for _ in range(d[k]):
        ans.append(k)
ans = sorted(ans)
ans2 = ''
for a in ans:
    ans2 += a
print(ans2)

Measured memory_bytes: 9212
#include <bits/stdc++.h>
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
template <class T> using vec = vector<T>;
using ll = long long;
using vi = vec<ll>;
using vvi = vec<vi>;
using vvvi = vec<vvi>;
using pii = pair<ll, ll>;

// Constants

// Shorter repr for frequently used terms
#define pb push_back
#define mp make_pair

// 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)

// 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
  cout.precision(12);
  // Failed to predict input format

  string S; cin >> S;
  int Q; cin >> Q;
  int t, f; char c;
  int rev = 0;
  string prefix, suffix;
  rep(q,Q){
    cin >> t;
    if(t==1){
      rev ^= 1;
    } else {
      cin >> f >> c;
      f--;
      dump(rev, f, rev^f);
      if(rev ^ f){ suffix += c; }
      else { prefix += c; }
    }
  }
  if(rev){
    reverse(all(S));
    reverse(all(suffix));
    cout << suffix << S << prefix << endl;
  }
  else {
    reverse(all(prefix));
    cout << prefix << S << suffix << endl;
  }
  return 0;
}


Measured memory_bytes: 3964
#include<iostream>
using namespace std;
int main(){
	int a[5],amari=10,num=0;
  int i=0;
  for (i=0;i<5;i++){
  	cin>>a[i];
    if(!(a[i]%10==0)){
      if(amari>a[i]%10){
      	amari=a[i]%10;
        num=i;
      }
    }
  }
  int tasu=0;
  for(int j=0;j<5;j++){
  	if(!(num==j)){
    	if(!(a[j]%10==0)){
        	a[j]+=10-(a[j]%10);
        }
    }
  }
  int sum=0;
  for(int z=0;z<5;z++){
  	sum+=a[z];
  }
  cout<<sum;
  return 0;
}

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

int main()
{
	int a,b,c;
	cin>>a>>b>>c;
	if (a==b || b==c || c==a)
	{
		if (a==b && c!=a)
		{
		  cout<<"Yes";
		  return 0;
	    }
	    else
	    {
	       if (b==c && a!=b)
		   {
		     cout<<"Yes";
		     return 0;
	       }
	       else
	       {
	         if (a==c && b!=a)
		     {
		        cout<<"Yes";
		        return 0;
	         }
	         else
	         {
	    	    cout<<"No";
			    return 0;	
	         }
	      }
	    }
    }
    else
    {
      cout<<"No";
    }
	return 0;
}

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

#define For(i, l, r) for (register int i = (l), i##end = (int)(r); i <= i##end; ++i)
#define Fordown(i, r, l) for (register int i = (r), i##end = (int)(l); i >= i##end; --i)
#define Rep(i, r) for (register int i = (0), i##end = (int)(r); i < i##end; ++i)
#define Set(a, v) memset(a, v, sizeof(a))
#define Cpy(a, b) memcpy(a, b, sizeof(a))
#define debug(x) cout << #x << ": " << (x) << endl

using namespace std;

typedef long long ll;

template<typename T> inline bool chkmin(T &a, T b) { return b < a ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, T b) { return b > a ? a = b, 1 : 0; }

template<typename T = int>
inline T read() {
	T x(0), sgn(1); char ch(getchar());
	for (; !isdigit(ch); ch = getchar()) if (ch == '-') sgn = -1;
	for (; isdigit(ch); ch = getchar()) x = (x * 10) + (ch ^ 48);
	return x * sgn;
}

void File() {
#ifdef zjp_shadow
	freopen ("F.in", "r", stdin);
	freopen ("F.out", "w", stdout);
#endif
}

const int N = 2e5 + 1e3;

char S[N]; int lenT, n, fail[N], pre[N][26];

ll l, r, ans[26], f[100][26], len[100];

void Get_Fail() {
	For (i, 2, n) {
		int j = fail[i - 1];
		while (j && S[j + 1] != S[i]) j = fail[j];
		fail[i] = j + (S[j + 1] == S[i]);
	}
}

void Calc1(ll m, int opt) {
	if (m <= 0) return; 
	ll t = m % lenT; Rep (i, 26) ans[i] += opt * pre[t][i];
	t = m / lenT; Rep (i, 26) ans[i] += opt * t * pre[lenT][i];
}

int up = 0;
void Prepare() {
	len[1] = n; len[2] = n + lenT;
	Rep (i, 26)
		f[1][i] = pre[n][i], f[2][i] = pre[n][i] + pre[lenT][i];
	for (int i = 3; up = i - 1, (len[i] = len[i - 1] + len[i - 2]) <= r; ++ i)
		Rep (j, 26) f[i][j] = f[i - 1][j] + f[i - 2][j];
}

void Calc2(ll m, int opt) {
	Fordown (i, up, 1) if (len[i] <= m) {
		m -= len[i]; Rep (j, 26) ans[j] += opt * f[i][j];
	}
	Rep (j, 26) ans[j] += opt * pre[m][j];
}

int main () {

	File();

	scanf ("%s", S + 1); n = strlen(S + 1) >> 1; 

	Get_Fail();
	For (i, 1, n) Rep (j, 26) 
		pre[i][j] = pre[i - 1][j] + (S[i] - 'a' == j);

	l = read<ll>(), r = read<ll>(); 

	lenT = n - fail[n];

	if (n % lenT) 
		Prepare(), Calc2(l - 1, -1), Calc2(r, 1);
	else 
		Calc1(l - 1, -1), Calc1(r, 1);

	Rep (i, 26)
		printf ("%lld%c", ans[i], i == iend - 1 ? '\n' : ' ');

	return 0;

}

Measured memory_bytes: 13056
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
 
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 ll INF = 1LL << 60;


//------------------------------------------------
int main() {

    //main
    
    const double PI = acos(-1);
    
    int R;
    cin >> R ;

    double ans = 2*PI*R;

    cout << ans << endl;

    return 0;
}

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

const int MAX = 1111;
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};

int n, m, k;

string s[MAX];

bool was[MAX][MAX];

vector <pair <int, int> > cur, nxt;

bool good(int x, int y) {
    return x >= 0 && x < n && y >= 0 && y < m && !was[x][y];
}

void bfs(int x, int y) {
    int cc = 0;
    cur.push_back(make_pair(x, y));
    was[x][y] = true;
    while (!cur.empty()) {
        for (int i = 0; i < (int)cur.size(); ++i) {
            x = cur[i].first;
            y = cur[i].second;
            if (cc < k)
                nxt.push_back(make_pair(x, y));
            if (x == 0 || x == n - 1 || y == 0 || y == m - 1) {
                cout << cc / k + (cc % k != 0);
                return;
            }
            for (int j = 0; j < 4; ++j) {
                int nx = x + dx[j];
                int ny = y + dy[j];
                if (good(nx, ny) && (cc >= k || s[nx][ny] != '#')) {
                    was[nx][ny] = true;
                    nxt.push_back(make_pair(nx, ny));
                }
            }
        }
        cur = nxt;
        nxt.clear();
        ++cc;
    }
}

int main() {
#ifdef LOCAL
    freopen("xxx.in", "r", stdin);
    freopen("xxx.out", "w", stdout);    
#endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin >> n >> m >> k;
    int x, y;
    for (int i = 0; i < n; ++i) {
        cin >> s[i];
        for (int j = 0; j < m; ++j) {
            if (s[i][j] == 'S')
                x = i, y = j;
        }
    }
    bfs(x, y);
    return 0;
}

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

int main(){
	int dp[50],n;
	
	cin>>n;
	dp[1]=dp[0]=1;
	for(int i=2;i<=n;i++){
		dp[i] = dp[i-1]+dp[i-2];
	}
	cout<<dp[n]<<endl;
	return 0;
}

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

using namespace std;

int matchsticks[] = {0, 2, 5, 5, 4, 5, 6, 3, 7, 6};

const int N = 10004;
const int oo = 1e9;
int m, a[10];

int dp[N];

int main() {

	int n;
	scanf("%d %d", &n, &m);

	for(int i = 0; i < m; i++) scanf("%d", a + i);

	sort(a, a + m); reverse(a, a + m);

	for(int i = 1; i <= n; i++) {
		dp[i] = -oo;
		for(int j = 0; j < m; j++) {
			if(i - matchsticks[ a[j] ] >= 0) {
				dp[i] = max(dp[i], dp[i - matchsticks[ a[j] ] ]+1);
			}
		}
	}

	assert(dp[n] > 0);

	while(n) {
		for(int j = 0; j < m; j++) {
			if(n - matchsticks[ a[j] ] >= 0) {
				if(dp[n] == dp[ n - matchsticks[ a[j] ] ] + 1) {
					printf("%d", a[j]);
					n -= matchsticks[ a[j] ];
					break;
				}
			}
		}
	}
	printf("\n");
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
#define reps(i,s,n) for(ll (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define reptr(i,n) for(ll (i)=(n);(i)>=0;--(i))
#define All(x) (x).begin(),(x).end()
#define Rall(a) (a).rbegin(), (a).rend()
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>
#define mp make_pair
#define pb push_back
const ll MOD=1e9+7;
const ll INF=1e10+1;
using namespace std;
#define NOT_EXIST -1

int dy[]={1,-1,0,0,1,1,-1,-1,0};
int dx[]={0,0,1,-1,1,-1,1,-1,0};

int main(){
	ll N,T;
	cin >> N >> T;
	vector<pll> a;
	rep(i,N){
		ll c,t;
		cin >> c >> t;
		if(t <= T) a.pb({c,t});
	}
	if(a.size()==0) {cout << "TLE" << endl; return 0;}
	sort(All(a));
	cout << a[0].first << endl;
}

Measured memory_bytes: 256
<?php
list($a,$b,$k) = explode(" ",trim(fgets(STDIN)));
$i=0;
while($i<$k){
if($a+$i<=$b){
$c[]=$a+$i;
}
if($b-$i>=$a){
$c[]=$b-$i;
}
++$i;
}
$ans=array_unique($c);
sort($ans);
echo join(PHP_EOL,$ans);

Measured memory_bytes: 4728
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
using namespace std;
#define i64  long long
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(),(x).end()

// int DP[MEM_SIZE][MEM_SIZE] = {0};
// int GMEM[MEM_SIZE][MEM_SIZE] = {0};
template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return;std::cout << e << std::endl;}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T> void DEBUG(string str, T e){if(DEBUG_OUT == false)return;std::cout <<str<<" ";DEBUG(e);};
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }


//CODE
void solve(void)
{
  int A,B,C;
  cin>>A>>B>>C;
  int ANS = 0;
  if((A%2 == B%2)&&(B%2 ==C%2))
  {
    //NOP
  }
  else
  {
    if(A%2 == B%2)
    {
      A++;
      B++;
    }
    else if(A%2 == C%2)
    {
      A++;
      C++;
    }
    else if(B%2 == C%2)
    {
      C++;
      B++;
    }
    ANS++;
  }

  int MAX = max(A,max(B,C));
  ANS += (MAX - A)/2 + (MAX - B)/2 + (MAX - C)/2;
  cout<<ANS<<endl;
  
  
  

  
  
  return;
}


int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(9);
  solve();
  

 
  return 0;
}


Measured memory_bytes: 256
//defines e includes
#include <bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define rep1(i, n) for(int i=0;i<(int)n;i++)
#define rep2(i, a, b) for(int i=(int)a;i<(int)b;i++)
#define st first
#define nd second
#define pb push_back
#define pf push_front
#define p_b pop_back
#define p_f pop_front
#define mp make_pair
#define MAX 100010
#define oo INT_MAX
using namespace std;
//tipagem de pares
typedef pair<int, int> ii;
typedef pair<char, char> cc;
typedef pair<int, char> ic;
typedef pair<char, int> ci;
//tipagem de vetores
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<vector<int>> vvi;
typedef vector<pair<int, int>> vii;
typedef vector<bool> vb;
//tipagem de outras estruturas
typedef queue<int> qi;
typedef deque<int> dqi;
//tipagem de tipos primitivos
typedef long long int ll;
typedef unsigned long long int ull;

bool compare(pair<ll, ll> a, pair<ll, ll> b){
	if(a.nd == b.nd){
		return a.st > b.st;
	}
	return a.nd > b.nd;
}

int main()
{
	
	fastio;
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
	
	int n, m;
	cin >> n >> m;
	ll a[n], sum[n];
	rep1(i, n){
		cin >> a[i];
	}
	sort(a, a+n);
	rep1(i, n){
		//cout << a[i] << " ";
		sum[i] = (i == 0 ? a[i] : sum[i-1]+a[i]);
	}
	ll ans = sum[n-1];
	//cout << endl;
	vector<pair<ll, ll>> p(m);
	rep1(i, m){
		ll b, c;
		cin >> b >> c;
		p[i] = mp(b, c);
	}
	sort(p.begin(), p.end(), compare);
	vi lb(m, 0);
	int pos = 0, idx = 0;
	rep1(i, m){
		//cout << p[i].st << " " << p[i].nd << endl;
		pos = lower_bound(a, a+n, p[i].nd) - a;
		if(i == 0){
			lb[i] = min(pos, (int)p[i].st);	
		}else{
			if(lb[i-1]!=0){
				if(pos > lb[i-1]){
					lb[i] = (pos-lb[i-1] > p[i].st ? lb[i-1] + p[i].st : pos);
				}
			}
		}
		idx = max(idx, lb[i]);
	}
	ans = (idx == 0 ? ans : ans - sum[idx-1]);
	rep1(i, m){
		if(lb[i] != 0)
			ans += (i == 0 ? p[i].nd*lb[i] : p[i].nd*(lb[i]-lb[i-1]));
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3840
#include <iostream>

int main() {
  using namespace std;
  int max_hp, n, dmg[10000], mp[10000], dp[1000][10000];
  cin >> max_hp >> n;
  for(int i=0; i<n; i++){
    cin >> dmg[i] >> mp[i];
  }
  for(int i=0; i<n; i++) {
    for(int hp=0; hp<max_hp; hp++) {
      if(i==0) {
        if(hp-dmg[i]>=0) {
          dp[i][hp] = mp[i] + dp[i][hp-dmg[i]];
        } else {
          dp[i][hp] = mp[i];
        }
      } else {
        if(hp-dmg[i]>=0) {
          dp[i][hp] = min(dp[i-1][hp], mp[i] + dp[i][hp-dmg[i]]);
        } else {
          dp[i][hp] = min(dp[i-1][hp], mp[i]);
        }
      }
    }
  }
  cout << dp[n-1][max_hp-1];
}

Measured memory_bytes: 39296
n = int(input())
A = [0 for i in range(n)]
B = [0 for i in range(n)]
C = [0 for i in range(n)]
for i in range(n):
    A[i], B[i], C[i] = map(int, input().split())

DP = [[0 for j in range(3)] for i in range(n)]
DP[0][0], DP[0][1], DP[0][2] = A[0], B[0], C[0]
for i in range(1, n):
    DP[i][0] = max(DP[i - 1][1] + A[i], DP[i - 1][2] + A[i])
    DP[i][1] = max(DP[i - 1][0] + B[i], DP[i - 1][2] + B[i])
    DP[i][2] = max(DP[i - 1][0] + C[i], DP[i - 1][1] + C[i])

print(max(DP[n - 1][0], DP[n - 1][1], DP[n - 1][2]))

Measured memory_bytes: 40432
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vel;
typedef vector<int> vei;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> ve_vel;
typedef vector<vector<int>> ve_vei;
typedef vector<vector<char>> ve_vec;
typedef vector<vector<bool>> ve_veb;
typedef vector<vector<string>> ve_ves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pub push_back
#define pob pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)

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

    int X,Y; cin >> X >> Y;

    if(__gcd(X,Y) == Y) {
        cout << -1 << endl;
        return 0;
    }
    else {
        cout << X << endl;
        return 0;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
using namespace std;
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const int MOD2 = 998244353;

ll a[10010], b[10010];

int main(){
    int n;
    cin >> n;
    rep(i, n) cin >> a[i];
    rep(i, n) cin >> b[i];
    ll cnt = 0;
    rep(i, n) cnt += (b[i] - a[i]);
    if (cnt < 0) {
        cout << "No" << endl;
        return 0;
    }

    ll c = 0, d = 0;
    rep(i, n){
        if (a[i] < b[i]) c += (b[i] - a[i] + 1) / 2;
        else d += (a[i] - b[i]);
    }

    if (max(c, d) <= cnt) cout << "Yes" << endl;
    else cout << "No" << endl;   

    return 0;
}


Measured memory_bytes: 3764
<?php
$stdin = file_get_contents('php://stdin');
$line = explode("\n",$stdin);
$fi = 0;
$cnt = 0;
$list = array();
$key = new stdclass();
foreach($line as $l) {
  if (empty($l)) continue;
  if ($fi == 0) {
    $a = explode(" ",$l);
    $key->N = $a[0];
    $key->L = $a[1];
    $fi++;
    continue;
  }
  if ($fi > 0) {
    $a = explode(" ",$l);
    $key->LL[]=$a[0];
  }
}
asort($key->LL);
foreach($key->LL as $a) {
  printf("%s",$a);
}
printf("\n");


Measured memory_bytes: 3832
#include<bits/stdc++.h>
using namespace std;
#define next Next
#define gc getchar
//#define int long long
//char buf[1<<21],*p1=buf,*p2=buf;
//inline int gc(){return p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++;}
inline int read()
{
    int ret=0,f=0;char c=gc();
    while(!isdigit(c)){if(c=='-')f=1;c=gc();}
    while(isdigit(c)){ret=ret*10+c-48;c=gc();}
    if(f)return -ret;return ret;
}
signed main()
{
	double x,y;
	scanf("%lf",&x);
	y=x/3;
	printf("%.6lf\n",y*y*y);
}

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

//Made with <3 by MinumCoklatPanas
typedef long long ll;
const int INF = 1e9;
const ll INFF = 1e18;
const int MAXN = 510;
const int MOD = 1e9 + 7;
const double PI = acos(-1.0);
const double INFD = 1E9;
const double EPS = 1e-9;

vector< pair<int,int> > adj[100010];
ll sum[100010];

void dfs(int u,ll curSum,int prv)
{
    sum[u] = curSum;
    for (auto it : adj[u]) if (it.first != prv)
    {
        dfs(it.first,curSum + it.second,u);
    }
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    for (int i = 1 ; i < n ; i++)
    {
        int a,b,c;
        cin >> a >> b >> c;
        adj[a].push_back({b,c});
        adj[b].push_back({a,c});
    }
    int q,k;
    cin >> q >> k;
    dfs(k,0,-1);
    while (q--)
    {
        int u,v;
        cin >> u >> v;
        ll ans = sum[u] + sum[v];
        cout << ans << endl;
    }
    return 0;
}

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

int main(){
    int a[3];
    cin >> a[0] >> a[1] >> a[2];
    sort(a,a+3);
    if(!(a[0]-a[2]))cout << 1 << endl;
    else if(!(a[0]-a[1])||!(a[1]-a[2]))cout << 2 << endl;
    else cout << 3 << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,a[200005],t[200005];
int main(){
	cin>>n;
    for(int i=1;i<=n;i++) 
	    cin>>a[i],t[i]=a[i];
    sort(a+1,a+n+1);
    int p1=a[n/2],p2=a[n/2+1];
    for(int i=1;i<=n;i++)
	{
        if(t[i]<=p1) cout<<p2<<endl;
        else if(t[i]>=p2) cout<<p1<<endl;
	}
	return 0;
}

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

int main(){
  std::string S;
  std::cin >> S;

  int rl_pos = 0;
  int rl_dist = 0;
  int n[2] = {};
  char prev_c = 'L';
  std::vector<int> nc(S.size());
  for(int i = 0 ; i < S.size(); i++){
    char c = S[i];
    if(c == 'L'){
      if(prev_c == 'R'){
        rl_pos = i-1;
        rl_dist = 1;
      }
      nc[rl_pos+rl_dist] += 1;
      rl_dist = 1 - rl_dist;
    }
    prev_c = c;
  }
  for(int i = S.size()-1; i >= 0; i--){
    char c = S[i];
    if(c == 'R'){
      if(prev_c == 'L'){
        rl_pos = i;
        rl_dist = 0;
      }
      nc[rl_pos+rl_dist] += 1;
      rl_dist = 1 - rl_dist;
    }
    prev_c = c;
  }

  for(auto&& it: nc){
    std::cout << it << " ";
  }
  std::cout << std::endl;

  return 0;
}



Measured memory_bytes: 1024
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
using System.Linq;
using static System.Math;

class Program
{
    static void Main()
    {
        int[] inp = Console.ReadLine().Split().Select(int.Parse).ToArray();
        int H = inp[0];
        int W = inp[1];
        inp = Console.ReadLine().Split().Select(int.Parse).ToArray();
        int h = inp[0];
        int w = inp[1];

        int ans = H * W - (h * W + w * H - h * w);
        Console.WriteLine(ans);
    }
}

Measured memory_bytes: 13268
#include <bits/stdc++.h>
using namespace std;
#define rep(i, c) for(int i=0; i<(int)c; i++)
int main() {
	int k,a,b;
	cin >>k>>a>>b;
	string ans="NG";
	for(int i=a;i<=b;i++){
		if (!(i%k)){
			ans="OK";
			break;
		}
	}
	cout <<ans<<endl;
	return 0;
}


Measured memory_bytes: 3624
class UnionFind:
    def __init__(self, n):
        self.par = [i for i in range(n)]
        self.rank = [0] * (n)

    # 検索
    def find(self, x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    # 併合
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x!=y:
            if self.rank[x] < self.rank[y]:
                self.par[x] = y
            else:
                self.par[y] = x
                if self.rank[x] == self.rank[y]:
                    self.rank[x] += 1

    # 同じ集合に属するか判定
    def same_check(self, x, y):
        return self.find(x) == self.find(y)

n,m = map(int, input().split())

a = UnionFind(n)
for i in range(m):
    x,y,z = map(int, input().split())
    x-=1
    y-=1
    a.union(x,y)


for i in range(n):
    a.find(i)

print(len(set(a.par)))

Measured memory_bytes: 77728
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0;i < (n);i++)
using namespace std;
  
int main () {
  double n, count=0;
  cin >> n;
  rep(i,n) {
    if((i+1) % 2 == 1) {
      count++;
    }
  }
  double ans = count / n;
  cout << fixed << setprecision(10);

  cout << ans;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<numeric>

using namespace std;

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

int main()
{
	int N = 0;
	while (cin >> N && N != 0)
	{
		int W = 0, H = 0; cin >> W >> H;
		int ans = 0;
		vector<vector<int>> dat(W + 2, vector<int>(H + 2, 0));
		rep(i, N)
		{
			int x = 0, y = 0; cin >> x >> y;
			dat[x][y] = 1;
		}
		int S = 0, T = 0; cin >> S >> T;
		rep(i, H - T + 1)rep(j, W - S + 1)
		{
			int sum = 0;
			rep(k, T) rep(l, S) { sum += dat[j + l + 1][i + k + 1]; }
			ans = max(ans, sum);
		}
		printf("%d\n", ans);
	}
	return 0;
}

Measured memory_bytes: 3324
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cctype>

#include <algorithm>
#include <random>
#include <bitset>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <vector>
#include <chrono>
#include <iostream>
#include <limits>
#include <numeric>

#define LOG(FMT...) fprintf(stderr, FMT)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

// mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

template <class T>
istream& operator>>(istream& is, vector<T>& v) {
  for (T& x : v)
    is >> x;
  return is;
}

template <class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
  if (!v.empty()) {
    os << v.front();
    for (int i = 1; i < v.size(); ++i)
      os << ' ' << v[i];
  }
  return os;
}

int main() {
#ifdef LBT
  freopen("test.in", "r", stdin);
  int nol_cl = clock();
#endif
  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  int N, M;
  cin >> N >> M;
  function<bool(int, int)> get = [&](int i, int j) { return __builtin_parity(i & j); };
  for (int i = 1; i < (1 << N); ++i) {
    for (int j = 1; j < (1 << M); ++j)
      cout << (get(i, j) ^ get(i - 1, j) ^ get(i, j - 1) ^ get(i - 1, j - 1));
    cout << '\n';
  }

#ifdef LBT
  LOG("Time: %dms\n", int ((clock()
          -nol_cl) / (double)CLOCKS_PER_SEC * 1000));
#endif
  return 0;
}


Measured memory_bytes: 1280
#include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long int ll;
typedef vector< int > vi;
typedef pair< int, int > ii;
typedef vector< ii > vii;
typedef vector< ll > vll;
// #define DEBUG_MODE
#ifdef DEBUG_MODE
	#define debug(...) fprintf(stderr, __VA_ARGS__)
#else
	#define debug(...)
#endif

int n, h[25], mx[25];
int main () { 
#ifdef DEBUG_MODE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	scanf("%d", &n);
	for (int i = 0; i < n; i++) scanf("%d", &h[i]);
	mx[0] = h[0];
	for (int i = 1; i < n; i++) mx[i] = max(mx[i - 1], h[i]);
	int ans = 0;
	for (int i = 0; i < n; i++) ans += (mx[i] <= h[i]);
	printf("%d\n", ans);
}

Measured memory_bytes: 128
/* in the name of Anton */

/*
  Compete against Yourself.
  Author - Aryan Choudhary (@aryanc403)
*/

#ifdef ARYANC403
    #include "/home/aryan/codes/PastCodes/template/header.h"
#else
    #pragma GCC optimize ("Ofast")
    #pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx")
    #pragma GCC optimize ("-ffloat-store")
    #include<iostream>
    #include<bits/stdc++.h>
    #define dbg(args...)
#endif

using namespace std;
#define fo(i,n)   for(i=0;i<(n);++i)
#define repA(i,j,n)   for(i=(j);i<=(n);++i)
#define repD(i,j,n)   for(i=(j);i>=(n);--i)
#define all(x) begin(x), end(x)
#define sz(x) ((lli)(x).size())
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define endl "\n"

typedef long long int lli;
typedef long double mytype;
typedef pair<lli,lli> ii;
typedef vector<ii> vii;
typedef vector<lli> vi;


const auto start_time = std::chrono::high_resolution_clock::now();
void aryanc403()
{
#ifdef ARYANC403
auto end_time = std::chrono::high_resolution_clock::now();
std::chrono::duration<double> diff = end_time-start_time;
    cerr<<"Time Taken : "<<diff.count()<<"\n";
#endif
}

const lli INF = 0xFFFFFFFFFFFFFFFL;

lli seed;
mt19937 rng(seed=chrono::steady_clock::now().time_since_epoch().count());
inline lli rnd(lli l=0,lli r=INF)
{return uniform_int_distribution<lli>(l,r)(rng);}

class CMP
{public:
bool operator()(ii a , ii b) //For min priority_queue .
{    return ! ( a.X < b.X || ( a.X==b.X && a.Y <= b.Y ));   }};

void add( map<lli,lli> &m, lli x,lli cnt=1)
{
    auto jt=m.find(x);
    if(jt==m.end())         m.insert({x,cnt});
    else                    jt->Y+=cnt;
}

void del( map<lli,lli> &m, lli x,lli cnt=1)
{
    auto jt=m.find(x);
    if(jt->Y<=cnt)            m.erase(jt);
    else                      jt->Y-=cnt;
}

bool cmp(const ii &a,const ii &b)
{
    return a.X<b.X||(a.X==b.X&&a.Y<b.Y);
}

const lli mod = 1000000007L;
// const lli maxN = 1000000007L;

    lli T,n,i,j,k,in,cnt,l,r,u,v,x,y;
    lli m;
    string s;
    vi a;
    lli dp[2][2000];
    //priority_queue < ii , vector < ii > , CMP > pq;// min priority_queue .
//0 minimise and 1 maximise.
lli solve(lli pos,lli x)
{
    if(pos==n-2)
        return abs(a[pos]-a[n-1]);
    lli &ans=dp[x][pos];
    if(ans!=-1)
        return ans;
    ans=abs(a[pos]-a[n-1]);
    for(lli i=pos+1;i+1<n;++i)
    {
        if(x==1)
        {
            if(solve(i,!x)>ans)
                ans=solve(i,!x);
        }
        else
        {
            if(solve(i,!x)<ans)
                ans=solve(i,!x);
        }
    }
    return ans;
}

int main(void) {
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    // freopen("txt.in", "r", stdin);
    // freopen("txt.out", "w", stdout);
// cout<<std::fixed<<std::setprecision(35);
// cin>>T;while(T--)
{

    lli z,w;
    cin>>n>>z>>w;

    fo(i,n)
    {
        cin>>in;
        a.pb(in);
    }

    //1 play first.
    lli ans=abs(w-a[n-1]);
    for(lli i=0;i+1<n;i++)
    {
        if(solve(i,0)>ans)
            ans=solve(i,0);
    }
    cout<<ans<<endl;
}   aryanc403();
    return 0;
}


Measured memory_bytes: 3652
import sys
input = sys.stdin.readline

'''

'''

n = int(input())
arr = list(map(int, input().split()))
freq = [0] * (10**5 + 1)
cur_sum = 0
for v in arr:
    cur_sum += v
    freq[v] += 1

q = int(input())
for _ in range(q):
    b, c = map(int, input().split())

    if freq[b] > 0:
        cur_sum += (freq[b] * c - freq[b] * b)
        freq[c] += freq[b]
        freq[b] = 0
        print(cur_sum)
    else:
        print(cur_sum)

Measured memory_bytes: 85504
from itertools import repeat, product

def get_targets(a_grid):
    h = len(a_grid)
    w = len(a_grid[0])

    targets = [t for t in product(range(h), range(w)) if a_grid[t[0]][t[1]] == '#']

    return targets

def get_arounds(t, h, w):
    arounds = map(lambda a: (t[0] + a[0], t[1] + a[1]), ((0, 1), (1, 0), (0, -1), (-1, 0)))

    return list(filter(lambda x: -1 < x[0] < h and -1 < x[1] < w, arounds))

def main():
    h, w = tuple(map(int, input().split()))
    a_grid = [list(input()) for _ in range(h)]

    black_sq = get_targets(a_grid)

    if all([any([(sq in black_sq) for sq in get_arounds(bsq, h, w)]) for bsq in black_sq]):
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    main()


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

int solve(int a){
  int ret=0;
  for(int i=5; i<=a; i*=5){
    ret+=a/i;
  }
  return ret;
}

int main(){
  int n;
  while(true){
    int n;
    cin>>n;
    if(n==0)break;
    cout<<solve(n)<<endl;
  }
  return 0;
}

Measured memory_bytes: 1160