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


int main(){
	int n;
	cin>> n;
	vector<long long int> a(n);
	vector<long long int> b(n);
	for(int i=0;i<n;i++){
		cin >> a.at(i) >> b.at(i);
	}
	sort(a.begin(),a.end());
	sort(b.begin(),b.end());
	if(n%2==1){
		cout << b.at((n-1)/2) - a.at((n-1)/2)+1 << endl;
	}else{
		cout << b.at(n/2) + b.at(n/2-1) - a.at(n/2) - a.at(n/2-1) +1;
	}
}


Measured memory_bytes: 6428
using System;
using System.Text.RegularExpressions;
using System.Linq;

class abc122_B
{
    static void Main(string[] args)
    {
        var input = Console.ReadLine();
        var regex = new Regex(@"([ATCG]+)", RegexOptions.Compiled);
        
        var matches = regex.Matches(input);
        var result = matches.Cast<Match>().SelectMany(g => g.Captures.Cast<Capture>()).Select(s => s.Length).DefaultIfEmpty(0).Max();

        Console.WriteLine(result);

    }
}

Measured memory_bytes: 15948
#include <iostream>
#include <cstdio>
#include <string>
#include <cmath>
#include <cctype>
#include <cstdlib>
#include <stack>
#include <queue>
#include <vector>
#include <algorithm>
#include <list>
#include<set>
#include<map>
#define MAX 100000
using namespace std;

int main() {
	int n, d;
	cin >> n;
	vector<int> v;
	for (int i = 0; i < n; i++) {
		cin >> d;
		v.push_back(d);
	}
	sort(v.begin(), v.end());
	if (n % 2 == 1) cout << 0 << endl;
	else {
		int k = v[n / 2] - v[n / 2 - 1];
		cout << k << endl;
	}
}




Measured memory_bytes: 892
while gets
	n = $_.to_i
	break if n == 0
	s, t, b = gets.split
	rm = { "A"=>["B","D"],      "B"=>["A","C","E"],      "C"=>["B","F"],
           "D"=>["A","E","G"],  "E"=>["D","B","F","H"],  "F"=>["E","C","I"],
           "G"=>["H","D"],      "H"=>["E","G","I"],      "I"=>["F","H"]}                 
  	rm.each_key{|k|
        rm[k].select!{|item| item != b}
  	}
  	prob = [Hash.new(0.0), Hash.new(0.0)]
  	prob[0][s] = 1.0
  	i = 0
  	n.times do 
  		rm.each{|k,v|
  			prob[1-i][k] = ((4.0 - v.size)/4) * prob[i][k]
  			v.each{|r|
  				prob[1-i][k] += prob[i][r] / 4
  			}
  		}
  		i = 1-i
  	end
	p prob[i][t]
end 

Measured memory_bytes: 8948
#include<bits/stdc++.h>
//ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> ppll;
typedef pair<ll,pll> plpl;
typedef tuple<ll,ll,ll> tl;
ll mod=1000000007;
ll mod2=998244353;
ll mod3=1000003;
ll mod4=998244853;
ll inf=1000000000;
double pi=2*acos(0);
#define rep(i,m,n) for(ll i=m;i<n;i++)
#define rrep(i,n,m) for(ll i=n;i>=m;i--)
int dh[4]={1,-1,0,0};
int dw[4]={0,0,1,-1};
int ddh[8]={-1,-1,-1,0,0,1,1,1};
int ddw[8]={-1,0,1,-1,1,-1,0,1};
ll lmax(ll a,ll b){
    if(a<b)return b;
    else return a;
}
ll lmin(ll a,ll b){
    if(a<b)return a;
    else return b;
}
ll gcd(ll a,ll b){
    if(a<b)swap(a,b);
    if(b==0)return a;
    if(a%b==0)return b;
    return gcd(b,a%b);
}
ll Pow(ll n,ll k){
    ll ret=1;
    ll now=n;
    while(k>0){
        if(k&1)ret*=now;
        now*=now;
        k/=2;
    }
    return ret;
}
ll beki(ll n,ll k,ll md){
  ll ret=1;
  ll now=n;
  while(k>0){
    if(k%2==1){
      ret*=now;
      ret%=md;
    }
    now*=now;
    now%=md;
    k/=2;
  }
  return ret;
}
ll gyaku(ll n,ll md){
  return beki(n,md-2,md);
}

int main(){
    ios::sync_with_stdio(false);cin.tie(0);
    ll n,c;cin>>n>>c;
    ll a[n],b[n];rep(i,0,n)cin>>a[i];
    rep(i,0,n)cin>>b[i];
    ll sum[401][401];
    rep(i,0,401){
        sum[i][0]=0;
        rep(j,1,401){
            ll y=beki(j,i,mod);
            sum[i][j]=(sum[i][j-1]+y)%mod;
        }
    }
    ll dp[n+1][c+1];
    memset(dp,0,sizeof dp);
    dp[0][0]=1;
    rep(i,0,n){
        rep(j,0,c+1){
            rep(k,j,c+1){
                dp[i+1][k]+=dp[i][j]*(sum[k-j][b[i]]-sum[k-j][a[i]-1]+mod);
                dp[i+1][k]%=mod;
            }
        }
    }
    cout<<dp[n][c]<<endl;
}


Measured memory_bytes: 2816
D,G = map(int,input().split())
P = []
C = []
for i in range(D) :
    p,c = map(int,input().split())
    P.append(p)
    C.append(c)
ans = float("inf")
for bit in range(1 << D) :
    AC = 0
    SCORE = 0
    for k in range(D) :
        if bit & (1 << k) :
            AC += P[k]
            SCORE += (k+1)*100*P[k]+C[k]
    if SCORE >= G :
        ans = min(ans,AC)
    else :
        for k in range(D-1,-1,-1) :
            if bit & (1 << k) :
                continue
            rest = G - SCORE
            if rest > (k+1)*100*P[k]+C[k] :
                AC += P[k]
                SCORE += (k+1)*100*P[k]+C[k]
            else :
                AC += rest//((k+1)*100)
                if rest % ((k+1)*100) :
                    AC += 1
                ans = min(ans,AC)
                break
print(ans)


Measured memory_bytes: 3064
input()
ss = input()
loss = ss[1:].count("E")
min_loss = loss
ss_before = ss[:-1]
ss_after = ss[1:]
for b, a in zip(ss_before, ss_after):
    loss += b == "W"
    loss -= a == "E"
    if loss < min_loss:
        min_loss = loss
print("{}".format(min_loss))

Measured memory_bytes: 3916
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;
using static System.Console;
using static System.Math;
using static Func;
class Z { static void Main() => new K(); }
class K
{
	int F => int.Parse(Str);
	long FL => long.Parse(Str);
	int[] G => Strs.Select(int.Parse).ToArray();
	long[] GL => Strs.Select(long.Parse).ToArray();
	string Str => ReadLine();
	string[] Strs => Str.Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
	const int MOD = 1000000007;
	public K()
	{
		SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
		Solve();
		Out.Flush();
	}
	long[] inv, fact, ifact;
	void Solve()
	{
		var I = G;
		int N = I[0], M = I[1];
		var LIM = N + 100;
		inv = new long[LIM];
		fact = new long[LIM];
		ifact = new long[LIM];
		fact[0] = ifact[0] = 1;
		for (var i = 1; i < LIM; i++)
		{
			inv[i] = Func.Inverse(i, MOD);
			fact[i] = fact[i - 1] * i % MOD;
			ifact[i] = ifact[i - 1] * inv[i] % MOD;
		}
		var f = Func.Factorize(M);
		var ans = 1L;
		foreach (var t in f.Values) ans = ans * Comb(t + N - 1, t) % MOD;
		WriteLine(ans);
	}
	long Comb(int n, int m) => fact[n] * ifact[m] % MOD * ifact[n - m] % MOD;
}
static class Func
{
	public static Dictionary<long, int> Factorize(this long n)
	{
		var d = new Dictionary<long, int>();
		for (var i = 2L; i * i <= n; i++)
			if (n % i == 0)
			{
				d.Add(i, 0);
				while (n % i == 0) { n /= i; d[i]++; }
			}
		if (n > 1) d.Add(n, 1);
		return d;
	}
	public static long Inverse(this long a, long mod)
	{
		if (a < 0) { a %= mod; if (a < 0) a += mod; }
		var t = SolveLinear(a, mod);
		return t.Item1 > 0 ? t.Item1 : t.Item1 + mod;
	}
	public static Tuple<long, long> SolveLinear(long n, long m)
	{
		if (n < 0) { var p = SolveLinear(-n, m); return p == null ? p : new Tuple<long, long>(-p.Item1, p.Item2); }
		if (m < 0) { var p = SolveLinear(n, -m); return p == null ? p : new Tuple<long, long>(p.Item1, -p.Item2); }
		if (n < m) { var p = SolveLinear(m, n); return p == null ? p : new Tuple<long, long>(p.Item2, p.Item1); }
		long a = 1, b = 0, c = 0, d = 1;
		while (m > 0)
		{
			var r = n % m;
			var q = n / m;
			n = m;
			m = r;
			var tmp = a;
			a = -a * q + b;
			b = tmp;
			tmp = c;
			c = -c * q + d;
			d = tmp;
		}
		return n != 1 ? null : new Tuple<long, long>(d, b);
	}
}

Measured memory_bytes: 19804
#include<iostream>
#include<string.h>
#include<algorithm>
using namespace std;
int main(){
    int n,i;
    cin>>n;
    long long int input[n];
    long long int ma[2];
    ma[0]=0;
    ma[1]=0;
    for(i=0;i<n;i++){
        cin>>input[i];
    }
 
    sort(input,input+n);
    reverse(input,input+n);
    int now=0;
i=0;
    for(i=1;i<n;i++){
        if(input[i]==input[i-1]){
            ma[now]=input[i];
            i++;
            now++;
           if(now==2)break;
        }
    }
 
    cout<<ma[0]*ma[1];
    }

Measured memory_bytes: 1024
s=input()
s_f=""
s_l=""
cnt=0
n=len(s)
m=int(n/2)
if n%2==0:
    s_f=s[:m]
    s_l=s[m:]
else:
    s_f=s[:m]
    s_l=s[m+1:]
    
s_l=s_l[::-1] 

for i in range(m):
    if s_f[i]!=s_l[i]:
        cnt+=1
print(cnt)
        

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define PII pair<int,int>
const int mxn = 3e3;
int dp[mxn+5][mxn+5];
string A,B;

int fn(int i, int j){

    if(i==A.size() || j==B.size()) return 0;
    if(dp[i][j]!=-1) return dp[i][j];
    if(A[i]==B[j]) return dp[i][j] = fn(i+1,j+1) + 1;
    return dp[i][j] = max( fn(i+1,j), fn(i,j+1) );
}

void solve(){

    cin>>A>>B;
    memset(dp,-1,sizeof(dp));
    int lcs=fn(0,0);
    
    int i=0,j=0;
    while(lcs){
        if(dp[i][j]==dp[i][j+1]) j++;
        else if(dp[i][j]==dp[i+1][j]) i++;
        else{
            cout<<B[j];
            i++;j++;
            lcs--;
        }
    }cout<<"\n";


}

int main(){

    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    solve();
    return 0;
}


Measured memory_bytes: 35840
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
using namespace std;

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

Measured memory_bytes: 640
h, w = gets.chomp.split(" ").map(&:to_i)

c = Array.new
10.times do
    c.push(gets.chomp.split(" ").map(&:to_i))
end

a = Array.new
h.times do
    a.push(gets.chomp.split(" ").map(&:to_i))
end

for k in 0..9 do
    for i in 0..9 do
        for j in 0..9 do
            c[i][j] = [c[i][j], c[i][k]+c[k][j]].min
        end
    end
end

ans = 0
for i in 0..h-1 do
    for j in 0..w-1 do
        ans += c[a[i][j]][1] if a[i][j] != -1
    end
end

puts ans

Measured memory_bytes: 2556
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>

#define int long long
 
#define rep(i, n) for (int i = 0; i < (n); i++)
#define itrep(i, a) for (auto i = (a).begin(); i != (a).end(); i++)
#define REP(i, a, n) for (int i = (a); i <= (n); i++)
#define all(a) (a).begin(), (a).end()
 
using namespace std;

bool inserted[200010];

signed main() {
	int N;
	cin >> N;

	string s, t;
	cin >> s >> t;

	int maxLen = 0;
	REP(len, 1, N) {
		bool ok = true;
		rep(i, len) {
			if (t[i] != s[N - len + i]) {
				ok = false;
				break;
			}
		}
		if (ok) maxLen = len;
	}

	cout << 2 * N - maxLen << 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;
int main(){
  int n;
  cin>>n;
  vector<int> a(n);
  REP(i,n){
    cin>>a[i];
  }
  sort(a.begin(),a.end());
  int ans;
  ans = a[n-1]-a[0];
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
N, M, Q = map(int, input().split())
abcd_list = [list(map(int, input().split())) for _ in range(Q)]
Alist = []
def dfs(array):
    if len(array) == N:
        Alist.append(array)
    else:
        if not array:
            for i in range(1, M+1):
                dfs(array[:] + [i])
        else:
            for i in range(array[-1], M+1):
                dfs(array[:] + [i])
dfs([])
ans = 0
for A in Alist:
    res = 0
    for a, b, c, d in abcd_list:
        if A[b-1] - A[a-1] == c:
            res += d
    ans = max(ans, res)
print(ans)

Measured memory_bytes: 23040
#include <iostream>
#include <algorithm>
using namespace std;
int main (){
    int n;
    int sum=0;
    cin >> n;
    int s[200000];
    for (int i=0;i<n;i++){
        cin >> s[i];
    }
    int q;
    cin >>q;
    int t[100000];
    for(int i=0;i<q;i++){
        cin >> t[i];

        int l=0,r=n;

        while(l<r){

            int mid=(l+r)/2;
            if(t[i]==s[mid]){
                sum++;
                break;
            }
            else if(t[i]>s[mid]){
                l=mid+1;
            }
            else{
                r=mid;
            }
        }
    }
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 3664
#include <cmath>
#include <iomanip>
#include <iostream>
#include <algorithm>
using namespace std;
int d, n, b, p[15], h[15];
int main() {
	cin >> d >> n >> b;
	for (int i = 0; i < n; i++) cin >> p[i] >> h[i];
	double ret = 1.0e+30;
	for (int i = 1; i <= b + 1; i++) {
		bool flag = true;
		for (int j = 0; j < n; j++) {
			if (p[j] * i % d == 0) flag = false;
		}
		if (!flag) continue;
		double u = 1.0 * d / i, z = 0.0;
		for (int j = 0; j < n; j++) {
			double pos = fmod(1.0 * p[j], u);
			double x = abs(pos - 0.5 * u) / (0.5 * u);
			double h2 = h[j] / (1 - x * x);
			z = max(z, h2);
		}
		z = max(z, u / 4.0);
		double v = sqrt(2 * z + u * u / 8.0 * (1.0 / z));
		ret = min(ret, v);
	}
	cout << fixed << setprecision(15) << ret << endl;
	return 0;
}

Measured memory_bytes: 3228
N,M = [int(item) for item in input().split(" ")]

result = [0]*N
wa = 0
ac = 0

for i in range(M):
    p,s = [i for i in input().split(" ")]
    if result[int(p)-1] != -1:
        if s == 'AC':
            wa += result[int(p)-1]
            result[int(p)-1] = -1
            ac += 1
        else:
            result[int(p)-1] += 1
        
            

print(ac,wa,sep=' ')

Measured memory_bytes: 3828
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int p = sc.nextInt();
        p += a * 3;
        
        System.out.println(p/2);
    }
}

Measured memory_bytes: 22100
x=int(input())
a=0
a=(x//11)*2
if x<=6:
	print(1)
elif x<=11:
	print(2)
else:
	if x%11==0:
		print(a)
	elif x%11<=6:
		a+=1
		print(a)
	elif  x%11<=11:
		a+=2
		print(a)
		


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

#define MAX_N 18
#define INF 1000000000
int N, M, a, b, c, x[MAX_N][MAX_N];
int dp[MAX_N][1 << MAX_N];

int main() {
	for (int i = 0; i < MAX_N; i++) {
		for (int j = 0; j < MAX_N; j++) { x[i][j] = INF; }
		for (int j = 0; j < (1 << MAX_N); j++) { dp[i][j] = INF; }
	
	}
	cin >> N >> M;
	for (int i = 0; i < M; i++) {
		cin >> a >> b >> c;
		x[a][b] = c;
	}
	dp[0][1] = 0;
	for (int i = 0; i < (1 << N); i++) {
		for (int j = 0; j < N; j++) {
			if (dp[j][i] < INF) {
				for (int k = 0; k < N; k++) {
					if ((i / (1 << k)) % 2 == 0) {
						int dist1 = dp[j][i] + x[j][k];
						int pos = i + (1 << k);
						if (dp[k][pos] > dist1) {
							dp[k][pos] = dist1;
						}
					}
				}
			}
		}
	}
	int maxn = INF;
	for (int i = 0; i < N; i++) {
		maxn = min(dp[i][(1 << N) - 1] + x[i][0], maxn);
	}
	if (maxn == INF) { maxn = -1; }
	cout << maxn << endl;
	return 0;
}

Measured memory_bytes: 19596
#include <stdio.h>
#include <iostream>
#include <math.h>
using namespace std;
int main()
{
	int n;
	while(~scanf("%d",&n)){
		int s = 0;
		bool f = 0;
		for(int i=0;i<n;i++){
			int a;
			scanf("%d",&a);
			if(a%2 == 0)
				s++;
		}
		int ans;
		ans = pow(3,n)-pow(2,s);
		printf("%d\n",ans);
	}
	
} 

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**9)
def main():
    N = int(input())
    s = ''
    l = []
    def calc3(s, N, i):
        if len(s) == N:
            l.append(s)
            return
        if len(s) > 0:
            s2 = s[:]
            z = i + 2
            for j in range(z):
                st = s[:]
                st += chr(ord('a')+j)
                if j == i + 1:
                    calc3(st[:], N, i+1)
                else:
                    calc3(st[:], N, i)
        else:
            s += 'a'
            calc3(s[:], N, i)
    calc3(s[:], N, 0)
    l = sorted(set(l))
    for i in l:
        print(i)
main()


Measured memory_bytes: 74332
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  map <string, int> mp;
  for (int i = 0; i < n; i++){
    string s;
    cin >> s;
    mp[s]++;
  }
  int mx = -1;
  for (auto now : mp){
    mx = max(mx, now.second);
  }
  for (auto now : mp){
    if (now.second == mx) cout << now.first << '\n';
  }
  return 0;
}

Measured memory_bytes: 25216
#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>

using namespace std;

#define FOR(i,k,n) for(int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

template<class T> void debug(T begin, T end){ for(T i = begin; i != end; ++i) cerr<<*i<<" "; cerr<<endl; }
inline bool valid(int x, int y, int W, int H){ return (x >= 0 && y >= 0 && x < W && y < H); }

typedef long long ll;
const int INF = 100000000;
const double EPS = 1e-8;
const int MOD = 1000000007;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

int main(){
  int N, L;
  const int D = 86400;
  while(cin>>N>>L && N){
    vector<int> usage(D);
    REP(i, N){
      int a, b, c; cin>>a>>b>>c;
      for(int u = a; u < b; u++) usage[u] += c;
    }
    double ub = 1000000, lb = 0;
    REP(iter, 100){
      double x = (lb + ub)/2;
      double Tank = L;
      bool ok = true;
      double fst, scn;
      REP(u, D * 2){
        Tank = Tank - usage[u % D] + x;
        if(Tank > L) Tank = L;
        if(Tank < 0) ok = false;
        if(u == D - 1) fst = Tank;
        if(u == 2 * D - 1) scn = Tank;
      }
      if(ok && fst <= scn){
        ub = x;
      }else{
        lb = x;
      }
    }
    printf("%.6lf\n", ub);
  }
  return 0;
}

Measured memory_bytes: 1564
#include<iostream>
#include<cmath>
#include<vector>
#include<iostream>

#define ll long long
using namespace std;

int main()
{
    int a, b;
    cin >> a >> b;
    int k=100;

    while(b/k==0) {
      k /= 10;
    }
    int p = a*k*10+b;
    for (int i=1; i<350; i++) {
      if(p == i*i) {
        cout << "Yes";
        return 0;
      }
    }
    cout << "No";
    return 0;
}


Measured memory_bytes: 256
h,w = map(int,input().split())
ahw = [[int(i) for i in input().split()] for j in range(h)]
hold = 0
ans = []
pos = [0,0]

for i in range(h):
  if i%2:
    for j in range(w):
      if hold:
        ans.append((pos[0],pos[1],i+1,j+1))
      if ahw[i][j]%2 and hold == 0:
        hold = 1
      elif ahw[i][j]%2 and hold:
        hold = 0
      if hold:
        pos[0] = i+1
        pos[1] = j+1
  else:
    for j in range(w-1,-1,-1):
      if hold:
        ans.append((pos[0],pos[1],i+1,j+1))
      if ahw[i][j]%2 and hold == 0:
        hold = 1
      elif ahw[i][j]%2 and hold:
        hold = 0
      if hold:
        pos[0] = i+1
        pos[1] = j+1
print(len(ans))
for i in ans:
  print(' '.join(map(str,i)))

Measured memory_bytes: 26404
#include<bits/stdc++.h>
using namespace std;
int a[4],b;
int main()
{
    int t=2;
    while(t--)
    {cin>>b;a[b]=1;}
    t=1;
    while(t<=3)
    {if(a[t]==0){cout<<t<<endl; return 0;} t++; }
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<cmath>
using namespace std;
#define REP(i, limit) for(int i=0; i< limit; ++i)
#define FOR(i, j, limit) for(int i=j; i< limit; ++i)
#define DUMP(a) REP(d,a.size()){cout<<a[d];if(d!=a.size()-1)cout<<" ";else cout<<endl;}
#define ECHO(x) cout<<x<<endl;
#define LL long long
int INF = 2147483647;
LL LINF = 9223372036854775807;
LL MOD = 1000000007;
typedef pair<int, int>P;
typedef pair<LL, LL>PL;
typedef vector<int> vi;
typedef vector<LL> vl;


int main(){
  string s;
  int x[3];
  REP(i, 3) x[i]=0;
  cin>>s;
  REP(i, s.size()){
    ++x[s[i]-'a'];
  }
  int m = max({abs(x[0]-x[1]), abs(x[1]-x[2]), abs(x[2]-x[0])});
  if(m<=1)cout<<"YES"<<endl;
  else cout<<"NO"<<endl;

  return 0;
}


Measured memory_bytes: 512
# -*- coding: utf-8 -*-
n, k = map(int, input().split())
v = list(map(int, input().split()))

ans = 0

for l in range(k+1):
    for r in range(k-l+1):
        hand = []
        if l+r > n:
            continue

        hand = list(v[:l])
        hand.extend(list(v[len(v)-r:]))
        d = k - l - r

        now = sum(hand)
        hand.sort()

        for i in range(min(d, len(hand))):
            if hand[i] >= 0:
                break
            now -= hand[i]

        ans = max(ans, now)

print(ans)


Measured memory_bytes: 3064
s=input()
if s == 'SUN':
    print(7)
elif s == 'MON':
    print(6)
elif s == 'TUE':
    print(5)
elif s == 'WED':
    print(4)
elif s == 'THU':
    print(3)
elif s == 'FRI':
    print(2)
elif s == 'SAT':
    print(1)

Measured memory_bytes: 3060
#include "bits/stdc++.h"
using namespace std;


int main()
{
	int n;
	cin >> n;
	vector<int> d(n);
	for (int i = 0; i < n; i++) {
		cin >> d.at(i);
	}

	sort(d.begin(), d.end());
	int ans;
	if (d.at(n / 2 - 1) == d.at(n / 2)) {
		ans = 0;
	} else {
		ans = d.at(n / 2) - d.at(n / 2 - 1);
	}

	cout << ans << endl;
}


Measured memory_bytes: 768
#include <iostream>
using namespace std;
int main(){
  while(1) {
    int n;cin >> n;if(n==0)break;
    int  dp[301]={1};
    for(int i=1;i<18;i++)for(int j=i*i;j<=n;j++)dp[j]+=dp[j-i*i];
    cout<<dp[n]<<endl;
  }
  return 0;
}

Measured memory_bytes: 1160
n,m=map(int,input().split())
a=[list(map(int,input().split())) for _ in range(m)]

s = sorted(a,key=lambda x:(x[0],x[1]))
f=s[0][0]
d=1
for i in range(m):
    if s[i][0] == f:
        s[i][1]=d
        d+=1
    else:
        f=s[i][0]
        d=1
        s[i][1]=d
        d+=1
for i in range(m):
    print("{:06}".format(a[i][0]) +"{:06}".format(a[i][1]))

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

long p = 1000000007;
vector<long> f(100001, -1);

int main() {
    int n, m;
    cin >> n >> m;
    rep(i, m) {
        int a;
        cin >> a;
        f[a] = 0;
    }
    if (f[1] == -1) f[1] = 1;
    if (f[2] == -1) f[2] = f[1] + 1;
    for (int i = 3; i <= n; i++) {
        // if (i == 0) continue;
        // if (i == 1 && f[i] == -1) {
        //     f[1] = 1;
        //     continue;
        // }
        // if (i == 2 && f[i] == -1) {
        //     f[2] = f[1] + 1;
        //     continue;
        // }
        if (f[i] == -1) f[i] = (f[i-1] + f[i-2]) % p;
    }
    cout << f[n] << endl;
}

Measured memory_bytes: 3900
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
int s[15][2];
int p(int a,int b)
{
	if(b==0) return 1;
	else return a*p(a,b-1);
}
int main()
{
	int i,j,k,n,a;
	cin>>n;
	for(i=1;i<=n;i++)
	{
		cin>>a;
		if(a%2==0)
		{
			s[i][0]=1;
			s[i][1]=2;
		}	
		else
		{
			s[i][0]=2;
			s[i][1]=1;
		}
	}
	int sum=0,zj=1;
	for(i=1;i<=n;i++)
	{
		sum+=s[i][0]*p(3,n-i)*zj;
		zj*=s[i][1];
	}	
	cout<<sum<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main(){
	string s;
	int t;
	cin>>t;
	for(int u=0;u<t;u++){
	cin>>s;
	int sum=-1;
	for(int i=0;i<s.size();i++){
		sum+=s[i]-'0';
	}
	if((s.size()+sum/9)%2==0)cout<<"Fabre wins."<<endl;
	else cout<<"Audrey wins."<<endl;
	}
	return 0;
}

Measured memory_bytes: 1192
from datetime import date
s = str(input())
f = int(s[:2])
l = int(s[2:])

def validate_date(m):
  try:
    date(2000, int(m), 1)
    return True
  except ValueError:
    return False

f_month = 0
l_month = 0

if(validate_date(f)): f_month = 1
if(validate_date(l)): l_month = 1

if(l_month == 1 and f_month == 1):print('AMBIGUOUS')

if(l_month == 1 and f_month == 0):print('YYMM')

if(l_month == 0 and f_month == 1):print('MMYY')

if(l_month == 0 and f_month == 0):print('NA')

Measured memory_bytes: 3312
#import numpy as np
#import collections
#import math

#f = open('./input_B.txt')
##
#N=int(f.readline())
#L=list(map(int, f.readline().split()))

N=int(input())
L=list(map(int, input().split()))

#L.sort()
ans=0
for i in range(N):
    Li=L[i]
    for j in range(i+1,N):
        Lj=L[j]
        for k in range(j+1,N):
            Lk=L[k]
            T=[Li,Lj,Lk]
            T.sort()
            if T[0]!=T[1] and T[1]!=T[2] and T[0]+T[1]>T[2]:
                ans+=1
            
print(ans)

Measured memory_bytes: 68300
///apigs property
#include<bits/stdc++.h>
#define fast ios_base::sync_with_stdio(0) , cin.tie(0) , cout.tie(0)
#define F first
#define S second
#define pb push_back
#define vll vector< ll >
#define vi vector< int >
#define pll pair< ll , ll >
#define pi pair< int , int >
#define all(s) s.begin() , s.end()
#define sz(s) s.size()
#define md (s + e) / 2
#define mid (l + r) / 2
#define msdp(dp) memset(dp , -1 , sizeof dp)
#define mscl(dp) memset(dp , 0 , sizeof dp)
using namespace std;
typedef long long ll;
ll q, dp[405][405], a[555555] , b[555555], k, m, n, o, p;
map < ll , ll > mp;
vll adj[555555];
const ll mod = 1e9+7;
ll mem(ll l , ll r){
	if(l == r)return 0;
	ll &ret = dp[l][r];
	if(ret != -1)return ret;
	ret = 1e18;
	for(ll i = l ; i < r ; i++){
		ret = min( ret , a[r] - a[l - 1] + mem(l , i) + mem(i + 1 , r));
	}
	return ret;
}
void solve(){
	msdp(dp);
	cin >> n;
	for(ll i = 1 ; i <= n ; i++){
		cin >> a[i];
		a[i] += a[i - 1];
	}
	cout << mem(1 , n) << endl;
}
int main() {
    fast ;
	// cin >> q;
    q = 1;
    while(q--){
    	solve();
	}
}



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

int main() {
    int N, M;
    cin >> N >> M;
    vector<int>s(M);
    vector<int>c(M);
    for (int i = 0; i < M; ++i) {
        cin >> s[i] >> c[i];
        s[i] = N - s[i];
    }
    int mx = 1;
    for (int i = 0; i < N; ++i) {
        mx *= 10;
    }
    if (N == 1) {
        int i = 0;

        int flag = 1;
        int k = i;
        vector<int>d(N);
        for (int j = 0; j < N; ++j) {
            d[j] = k % 10;
            k /= 10;
        }
        for (int l = 0; l < M; ++l) {
            if (d[s[l]] != c[l]) flag = 0;
        }
        if (flag) {
            cout << i << "\n";
            return 0;
        }
    }
    for (int i = mx/10; i < mx; ++i) {
        int flag = 1;
        int k = i;
        vector<int>d(N);
        for (int j = 0; j < N; ++j) {
            d[j] = k % 10;
            k /= 10;
        }
        for (int l = 0; l < M; ++l) {
            if (d[s[l]] != c[l]) flag = 0;
        }
        if (flag) {
            cout << i << "\n";
            return 0;
        }
    }
    cout << -1 << "\n";
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
long long a[200010] , b[200010];
int main()
{
	long long n,m,k;	cin>>n>>m>>k;
	long long ans=0 , now=0 , enda=0 , finalans=0;
	for(int i=1;i<=n;i++)
		cin>>a[i];
	for(int i=1;i<=m;i++)
		cin>>b[i];
	for(int i=1;i<=n;i++)
		if(now+a[i]<=k)
			now+=a[i] , ans++ , enda=i , finalans=max(finalans,ans);
		else
			break;
	//cout<<ans<<" "<<finalans<<endl;
	for(int i=1;i<=m;)
	{
		if(now+b[i]<=k)
			now+=b[i] , ans++ , i++;
		else if(enda<1)
			break;
		else
			now-=a[enda] , enda-- , ans--;
		finalans=max(ans , finalans);
	}
	cout<<finalans<<endl;
}

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

#define int long long
#define fi first
#define se second
#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 rep11(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define repm(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define pb(n) push_back(n)
#define mp make_pair
#define INF LONG_LONG_MAX
#define MOD 1000000007
#define Yes cout << "Yes" << endl;
#define No cout << "No" << endl;

int n,k,MAX,MIN,ans,hoge;

signed main() {
    cin >> n >> k;
    rep1(i,n) hoge += i;
    for(int i=0; i<k; ++i) {
        MIN = min(hoge, MIN+i);
        MAX = min(hoge,MAX+n-i);
    }
    rep(i,n-k+2) {
        ans = (ans+MAX-MIN+1)%MOD;
        MIN = min(hoge, MIN+k+i);
        MAX = min(hoge, MAX+n-k-i);
    }
    cout << ans << endl;
}




Measured memory_bytes: 3636
SA = input()
SB = input()
SC = input()

def next(SA, SB, SC, turn):
    next_turn = ''
    if turn == 'a':
        if len(SA) == 0:
            print('A')
            exit()
        else:
            next_turn = SA[0]
            SA = SA[1:]
    elif turn == 'b':
        if len(SB) == 0:
            print('B')
            exit()
        else:
            next_turn = SB[0]
            SB = SB[1:]
    elif turn == 'c':
        if len(SC) == 0:
            print('C')
            exit()
        else:
            next_turn = SC[0]
            SC = SC[1:]
    return SA, SB, SC, next_turn

turn = 'a'
while True:
    SA, SB, SC, turn = next(SA, SB, SC, turn)



Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main(){
    string S;cin>>S;
    int ans=0,now=0;
    for (int i = 0; i < S.size(); i++)
    {
        if(S[i]=='A' or S[i]=='T' or S[i]=='G' or S[i]=='C')now++;
        else ans=max(ans,now),now=0;
    }
    printf("%d\n",max(ans,now));
    return 0;
}

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

#define REP(i,s,n) for(int i=s; i<n; ++i)
#define rep(i,n) REP(i,0,n)
#define SORT(c) sort((c).begin(),(c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX

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

/*
class Node {
public:
  int num;
  int index;
  bool operator<(const Node& b) const {
    if(num < b.num) return (num < b.num);
    else return index > b.index;
  }

  Node(){
    num=0; index=0;
  }
  Node(int n, int i) : num(n), index(i){
  }
};
*/

int main(){

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

  ll cnt = 2;
  ll ans = a[0] - 1;
  REP(i, 1, n){
    ans += (ll)((a[i] - 1) / cnt);
    if(cnt == a[i]) cnt++;

    //cout << "i:" <<i<<"\ta[i]:" << a[i] << "\tans" <<ans<<"\tcnt" << cnt<<endl;
  }

  cout << ans <<endl;

  return 0;
}


Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
using pint = pair<int, int>;
using ll = long long;
using ull = unsigned long long;
using vll = vector<long long>;
using pll = pair<ll, ll>;
#define FOR(i, begin, end) \
    for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) \
    for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define VREP(s, ite) for (auto ite = s.begin(); ite != s.end(); ++ite)
#define FI first
#define SE second
#define ALL(v) v.begin(), v.end()
#define endl "\n"
#define ciosup  \
    cin.tie(0); \
    ios::sync_with_stdio(false);
#define eb emplace_back
#define vint vector<int>
constexpr ll INF = 1e15 + 7LL;
constexpr ll MOD = 1e9 + 7LL;
template <typename T>
istream &operator>>(istream &is, vector<T> &v) {
    for (int i = 0; i < v.size(); ++i) {
        is >> v[i];
    }
    return is;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
    if (v.size() == 0) return os;
    for (int i = 0; i < v.size() - 1; ++i) {
        os << v[i] << " ";
    }
    os << v[v.size() - 1];
    return os;
}

void solve() {
    ll n;
    cin >> n;
    string s;
    cin >> s;
    ll totw = 0, totr = 0;
    vll numw(n, 0), numr(n, 0);
    REP(i, n) {
        if (i > 0) {
            numw[i] = numw[i-1];
            numr[i] = numr[i-1];
        }
        if (s[i] == 'R') {
            totr++;
            numr[i]++;
        } else {
            totw++;
            numw[i]++;
        }
    }
    /* cout << numw << endl; */
    /* cout << numr << endl; */
    ll ans = min(n - totw, n - totr);
    REP(i, n-1) {
        ll tmp = 0;
        ll rightw = totw - numw[i], needw = n - (i + 1) - rightw;
        ll leftr = numr[i], needr = i + 1 - leftr;
        /* cout << i << " :"  << rightw << " " << leftr << endl; */
        if (numw[i] >= needw) {
            tmp += needw;
            needr -= needw;
            tmp += needr;
            /* cout << "TE"  << tmp << endl; */
            ans = min(ans, tmp);
        } else {
            tmp += numw[i];
            needr -= numw[i];
            tmp += (needw - numw[i]);
            tmp += needr;
            /* cout << needr << " : 0" << endl; */
            /* cout << "TE2"  << tmp << endl; */
            ans = min(ans, tmp);
        }
    }
    cout << ans << endl;
}

int main() {
    char tmp;
    while (cin >> tmp) {
        cin.putback(tmp);
        solve();
    }
}


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

using namespace std;

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

#define MAX_K 55
#define ISVOWEL(c) c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u'

string get_code(string s, int k) {
    string ret = s.substr(0, 1);
    REP(i, 1, s.size()) {
        if(ISVOWEL(s[i-1])) ret.push_back(s[i]);
    }
    return ret.substr(0, k);
}

int main() {
	int n;
	set<string> codes[MAX_K];
	while(cin >> n, n) {
	    rep(k, MAX_K) codes[k].clear();
	    rep(_, n) {
	        string s;
	        cin >> s;
	        REP(k, 1, MAX_K) codes[k].insert(get_code(s, k));
	    }
	    int ans = -1;
	    REP(k, 1, MAX_K) {
	        // for(string s : codes[k]) cout << s << ", " ;
	        // cout << endl;
	        if(codes[k].size() == n) {
	            ans = k;
	            break;
	        }
	    }
	    cout << ans << endl;
	}
}



Measured memory_bytes: 3412
#include <bits/stdc++.h>
#define vi               vector<int>
#define pb(x)            push_back(x)
#define all(x)           x.begin(), x.end()
#define sortall(x)       sort(all(x))
#define sortrev(x)       sort(all(x), greater<int>())
#define debug(x)         cout << '>' << #x << ':' << x << endl;
#define int              long long
#define ld               long double
#define endl 			 "\n";
#define mp 				 make_pair
#define pii 			 <int, int>
#define lb 				 lower_bound
#define ub				 upper_bound
const int mod = 1000000007;
using namespace std;

const int N = 2e5 + 5;
 
int n, m, k, ans = 0;
int a[N], b[N];
 
int32_t main()
{
	ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
	cin >> n >> m >> k;
	for(int i = 1; i <= n; i++)
	{
		cin >> a[i];
		a[i] += a[i - 1];
	}
	for(int i = 1; i <= m; i++)
	{
		cin >> b[i];
		b[i] += b[i - 1];
	}
	int ans = 0;
	int idx = m;
	for(int i = 0; i <= n; i++)
	{
		if(a[i] > k)
			break;
		while(a[i] + b[idx] > k)
			idx--;
		ans = max(ans, i + idx);
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 6752
using System;
public class Hello{
    public static void Main(){
        string[] str = Console.ReadLine().Split(' ');
       int a = int.Parse(str[0]);
       int b = int.Parse(str[1]);
       int c = int.Parse(str[2]);
   if(a<b && b<c){
    Console.WriteLine("Yes");
}else{
    Console.WriteLine("No");
}
}
}


Measured memory_bytes: 15948
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <deque>
#include <queue>
using namespace std;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
typedef long long ll;
typedef pair<int,int> P;

int main() {
    int n;
    cin >> n;
    string s;
    cin >> s;
    int ans = 0;
    rep(i, 0, n-1){
        int dis2 = 0;
        map<char, int>sm,tm;
        
        rep(j, 0, i+1){
            sm[s[j]]++;
        }
        
        rep(j, i+1, n){
             if(sm[s[j]] && !tm[s[j]])dis2++;
             tm[s[j]]++;
        }
        ans = max(ans,dis2);
    }
    
    cout << ans << endl;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n; cin >> n;
  vector<int> ans(n+1);
  for(int x=1; x<=100; x++) {
    for(int y=1; y<=100; y++) {
      for(int z=1; z<=100; z++) {
        ll val = x*x + y*y + z*z + x*y + y*z + z*x;
        if(val <= n) ans[val]++;
      }
    }
  }
  for(int i=1; i<=n; i++) cout << ans[i] << "\n";
  return 0;
}


Measured memory_bytes: 3556
#include <bits/stdc++.h>
#include <numeric>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define rep1(i,n) for (int i = 1; i <= n; ++i)
template<typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> inline T intceil(T a, T b) { return (a + (b - 1)) / b; }
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
const long long MOD = 1e9+7;
#define precout(val) cout << std::fixed << std::setprecision(20) << val;
const string alphabet = "abcdefghijklmnopqrstuvwxyz";
const int dy[4] = { 0, 1, 0, -1 };
const int dx[4] = { 1, 0, -1, 0 };
static const double pi = 3.141592653589793;

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

  int N; cin >> N;
  string S; cin >> S;

  vector<int> whsum(N+1, 0);
  vector<int> blsum(N+1, 0);
  for (int i = 0; i < N; ++i) {
    whsum[i+1] = whsum[i] + (S[i] == '.' ? 1 : 0);
    blsum[i+1] = blsum[i] + (S[i] == '#' ? 1 : 0);
  }

  long long res = 1LL<<60;
  for (int left = 0; left <= N; ++left) {
    long long tmp = 0;
    // left を全部白に
    tmp += blsum[left] - blsum[0];

    // right を全部黒に
    tmp += whsum[N] - whsum[left];

    chmin(res, tmp);
  }

  cout << res << endl;
}

// goal: ...###

// 5
// #.##.


Measured memory_bytes: 2196
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
string s;
cin>>s;
if(n%2!=0)
cout<<"No";
else
{
if(s.substr(0,n/2)==s.substr(n/2,n/2))
cout<<"Yes";
else
cout<<"No";
}
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>

long long h[1500001], w[1500001];
long long hh[1500], ww[1500];

int main() {
	int n, m;
	while (std::cin >> n >> m && (n || m)) {
		std::memset(h, 0, sizeof(h));
		std::memset(w, 0, sizeof(w));

		int numX = 0, numY = 0;
		for (int i = 0; i < n; i++) {
			std::cin >> hh[i];
		}
		for (int i = 0; i < m; i++) {
			std::cin >> ww[i];
		}

		for (int sy = 0; sy < n; sy++) {
			for (int y = 0; y < n - sy; y++) {
				long long num = 0;
				for (int i = 0; i <= sy; i++) {
					num += hh[i + y];
				}
				h[num]++;
			}
		}

		for (int sx = 0; sx < m; sx++) {
			for (int x = 0; x < m - sx; x++) {
				int num = 0;
				for (int i = 0; i <= sx; i++) {
					num += ww[i + x];
				}
				w[num]++;
			}
		}

		long long cnt = 0;
		for (int i = 0; i < 1500001; i++) {
			cnt += h[i] * w[i];
		}

		std::cout << cnt << std::endl;
	}

	return 0;
}

Measured memory_bytes: 26492
#include<bits/stdc++.h>
typedef long long int ll;
using namespace std;
#define sz 502
#define mod 998244353
ll n,q,i,j,k,t,arr[sz],brr[sz],crr[sz],a,b,c,d,m,x,y,l,r,z,dp[sz][sz][sz];
vector<ll>v;
int main()
{
    scanf("%lld %lld %lld",&a,&b,&c);
    b--;
    n=b/a;
    q=c/a;
    if(n!=q)
        printf("OK\n");
    else
        printf("NG\n");
    return 0;
}


Measured memory_bytes: 3692
macro_rules! get {
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
            get!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
            get!($($t),*)
        ).collect::<Vec<_>>()
    };
}

fn main() {
    let s = get!(String).chars().collect::<Vec<_>>();
    println!("{}{}{}", s.first().unwrap().to_string(), (s.len() - 2).to_string(), s.last().unwrap().to_string());
}

Measured memory_bytes: 4352
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define MAX_N 100

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

int main(){
    long x, y;
    cin >> x >> y;
    long ans = 1;
    while(x * (long)(pow(2, ans)) <= y) ans++;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3944
#include <stdio.h>

int main(void)
{
	int a[20000],b[20000];
	char op[20000];
	
	int i=0;
	
	while(1)
	{
		scanf("%d %c %d",&a[i],&op[i],&b[i]);
		
		if(op[i] == '?')
		{
			goto next;
		}
		
		i++;
	}
	
	next:
	
	for(i=0;;i++)
	{
		switch(op[i])
		{
			case '+':
			{
				printf("%d\n",a[i]+b[i]);
			}
			break;
			
			case '-':
			{
				printf("%d\n",a[i]-b[i]);
			}
			break;
			
			case '*':
			{
				printf("%d\n",a[i]*b[i]);
			}
			break;
			
			case '/':
			{
				printf("%d\n",a[i]/b[i]);
			}
			break;
			
			case '?':
			{
				goto finish;
			}
			break;
		}
	}
	
	finish:
	
	return 0;
}


Measured memory_bytes: 2104
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<iomanip>
typedef long long int ll;
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define REP(i,n) for (unsigned int i=0;i<(n);i++)
#define EREP(i,n) for (int i=1;i<=(n);i++)
#define ALL(a) (a).begin(),(a).end()
//#define EVEL 1

#ifdef EVEL
#define DEB(X) cout << #X << ":" <<X<<" " ;
#define TF(f) f ? cout<<"true  " : cout<<"false ";
#define END cout<<"\n";
#else
#define DEB(X) {}
#define TF(f) {}
#define END {}
#endif
const int MOD =  1000000007 ;
const int INF = 2000000000;


    int A,B,C,D;
    string S,T;
int main(){
    cin>>A>>B;
    cout<<max({A+B,A-B,A*B})<<endl;
    return 0;

}


Measured memory_bytes: 256
import numpy as np

N = int(input())

A = np.zeros([N, 3], dtype='int32')

for i in range(N):
    a, b, c = map(int, input().split())
    A[i] = [a, b, c]

dp = np.zeros([N+1, 3], dtype='int32')

for i in range(N):
    dp[i+1][0] = A[i][0] + max(dp[i][1], dp[i][2])
    dp[i+1][1] = A[i][1] + max(dp[i][0], dp[i][2])
    dp[i+1][2] = A[i][2] + max(dp[i][0], dp[i][1])

print(dp[-1].max())


Measured memory_bytes: 14772
N = int(input())
A = []
B = []
for _ in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)

A = sorted(A)
B = sorted(B, reverse=True)
ret = 0
pre_a = 0
pre_b = float('inf')
for i in range(N):
    ret += min(A[i] - pre_a, pre_b - B[i])
    pre_a = A[i]
    pre_b = B[i]

ret += pre_b
print(ret)


Measured memory_bytes: 12208
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <array>
#include <cmath>
#include <iomanip>

using namespace std;
int main(void)

{
	cin.tie(0);
	ios::sync_with_stdio(false);
	double A, B, H, M;
	cin >> A >> B >> H >> M;
	double sita = abs(H * M_PI / 6 + M * M_PI / 360 - M * M_PI / 30);
	if (sita > M_PI)
	{
		sita = 2 * M_PI - sita;
	}
	double result = sqrt(A * A + B * B - 2 * A * B * cos(sita));
	cout << fixed << setprecision(20) << result;
	return 0;
}


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

using namespace std;

struct SegTree {
    int n;
    vector<int> node;
    SegTree(int sz) {
        n = 1;
        while (n < sz) n *= 2;
        node.resize(2 * n - 1, INT_MAX);
    }
    void update(int p, int v) {
        p += n - 1;
        node[p] = v;
        while (p) {
            p = (p - 1) / 2;
            node[p] = min(node[2 * p + 1], node[2 * p + 2]);
        }
    }
    int get(int a, int b, int k = 0, int l = 0, int r = -1) {
        if (r < 0) r = n;
        if (b <= l || r <= a) return INT_MAX;
        if (a <= l && r <= b) return node[k];
        return min(get(a, b, k * 2 + 1, l, (l+r) / 2), get(a, b, k * 2 + 2, (l+r) / 2, r));
        
    }
};

int main()
{
    int n, q;
    cin >> n >> q;
    SegTree s(n);
    while (q--) {
        int c, x, y;
        cin >> c >> x >> y;
        if (c == 0) {
            s.update(x, y);
        } else {
            cout << s.get(x, y+1) << endl;
        }
    }
}


Measured memory_bytes: 3820
#include <iostream>
#include <fstream>

using namespace std;

int main() {
    char c;
    int a = 1;
    cin >> c;
    a = a * (c-'a' + 1);
    cin >> c;
    a = a * (c-'a' + 1);
    cin >> c;
    a = a * (c-'a' + 1);
    if (a == 6){
        cout << "Yes";
    }
    else{
        cout << "No";
    }
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.lang.Math;

class Main{
    private static int[] PrimeNumber = new int[1000000];
    private static int p;

    public static void main(String[] args){
        InputStreamReader inputStreamReader = new InputStreamReader(System.in);
        BufferedReader reader = new BufferedReader(inputStreamReader);
        
        String str;
        int[] num;

        p = 0;
        int N = 1000000;
        int[] cntList = cntPrimeNumber(N);
        try {
            while(reader.ready()){
                str = reader.readLine();
                num = getNum(str);
                System.out.println(cntList[num[0]]);
            }
            reader.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    private static int[] cntPrimeNumber(int N) {
        int cnt = 0;
        int[] cntList = new int[N+1];


        PrimeNumber[0] = 0;
        PrimeNumber[1] = 0;

        for(int i = 2; i < N+1; i++) {
            if (judgePrimeNumber(i)) {
                cnt++;
            }
            cntList[i] = cnt;
        }

        return cntList;
    }

    private static boolean judgePrimeNumber(int n){
        if (n == 2) {
            PrimeNumber[p++] = n;
            return true;
        }
        else {
            int m = (int) Math.sqrt(n);
            for (int i = 0; PrimeNumber[i] <= m; i++) {
                if (n % PrimeNumber[i] == 0) {
                    return false;
                }
            }
            PrimeNumber[p++] = n;
            return true;
        }
    }

    private static int[] getNum(String str){
        String[] data = str.split(" "); 
        int[] num = new int[data.length];

        for (int i = 0; i < data.length; i++){
            num[i] = Integer.parseInt(data[i]);
        }
        return num;
    }

}


Measured memory_bytes: 32780
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
  int w;
  cin>>w;
  while(w!=-1){
    int ans;
    int c=1150;
    w-=10;
    if(w>0){
      c+=125*min(w,10);
      w-=10;
    }
    if(w>0){
      c+=140*min(w,10);
      w-=10;
    }
    while(w>0){
      c+=160*min(w,10);
      w-=10;
    }
    
    ans=4280-c;
    cout<<ans<<"\n";
    cin>>w;
  }
  return 0;
}



Measured memory_bytes: 3100