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

using namespace std;

using ll = long long;
using ii = pair<int,int>;

#define ff first
#define ss second

const int maxn = 1e5+10;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	string n;
	cin >> n;
	if(n[n.size()-1]=='3'){
		cout << "bon\n";
	}
	else if(n[n.size()-1]=='2'||n[n.size()-1]=='4'||n[n.size()-1]=='5'||n[n.size()-1]=='7'||n[n.size()-1]=='9'){
		cout << "hon\n";
	}
	else{
		cout << "pon\n";
	}
	return 0;
}

Measured memory_bytes: 3648
#line 2 "../../library/template.hpp"
#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using pl = pair<ll, ll>;
using vl = vector<ll>;
#define rep(i, n) for(ll i = 0; i < (ll)n; i++)
#define rep3(i, l, r) for(ll i = l; i < (ll)r; i++)
#define per(i, n) for(ll i = n-1; i >= 0; i--)
#define per3(i, l, r) for(ll i = r-1; i >= (ll)l; i--)
#define all(v) begin(v), end(v)
template<class T, class U>
inline void cmax(T& a, U b) { if (a < b) a = b; }
template<class T, class U>
inline void cmin(T& a, U b) { if (a > b) a = b; }

struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    cerr << fixed << setprecision(15);
  }
} io_setup;

constexpr char el = '\n';
#line 2 "b2.cpp"

bool f(string s) {
  ll n = s.size();
  rep(i, n) {
    if (s[i] != s[n-1-i]) {
      return false;
    }
  }
  return true;
}

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

  ll n = s.size();

  if (f(s) and f(s.substr(0, (n-1)/2)) and f(s.substr((n+3)/2-1, n-(n+3)/2+1)))  {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    int n,m;
    cin>>n>>m;

    vector<int>v(n);
    ll sum=0;

    for (int i=0; i<m; ++i)
    {
        cin>>v[i];
        sum+=v[i];
    }
    if (sum>n)
        cout<<-1;
    else
    {
        cout<<n-sum;
    }
    

    



}

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

int main(){
  int a, b, c, d;
  cin>>a;
  cin>>b;
  cin>>c;
  cin>>d;

  int x = ( a + b + c + d) / 60;
  int y = ( a + b + c + d) % 60;

  cout<<x<<endl;
    cout<<y<<endl;

    return 0;

}



Measured memory_bytes: 3076
N, x = map(int, input().split())
A = list(map(int, input().split()))
cnt = 0
if A[0] > x:
  cnt += A[0] - x
  A[0] = A[0] - cnt

for i in range(N-1):
  if A[i] +  A[i+1] > x:
    tmp = A[i] +  A[i+1] - x
    cnt += A[i] +  A[i+1] - x
    A[i+1] = A[i+1] - tmp
    
print(cnt)

Measured memory_bytes: 14592
S = input()
max_len = 0
current_len = 0
for c in S:
    if c=='A' or c=='C' or c=='G' or c=='T':
        current_len += 1
    else:
        if current_len > max_len:
            max_len = current_len
        current_len = 0
if current_len > max_len:
    max_len = current_len
print(max_len)


Measured memory_bytes: 2940
#include <stdio.h>

int main(int argc, char *argv[])
{
	int n,k,x,y,sum=0;
	scanf("%d %d %d %d", &n,&k,&x,&y);

	if(n>k)
	{
		sum = x*k + y*(n-k);
	} 
	else
	{
		sum = x*n;
	}
	printf("%d\n", sum);

	return 0;
}

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

using namespace std;

int main()
{
  int A,B;
  cin >> A >> B;
  
  int hi=1000,lo=0,mid,ans=-1;
  
  while(hi>=lo)
  {
    mid = (hi+lo)/2;
    
    int a=(mid*8)/100;
    int b=mid/10;
    
    if(a<A)lo=mid+1;
    else if(a>A)hi=mid-1;
    else if(a==A and b<B)lo=mid+1;
    else if(a==A and b>B)hi=mid-1;
    else if(a==A and b==B)
    {
      hi=mid-1;
      ans=mid;
    }
    
  }
  
  cout << ans;
  
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main()
{
    int a,b,c,d;
    while(scanf("%d %d %d",&a,&b,&c)==3)
    {
        d = b/a;
        if(d>=c)
        {
            cout<<c<<endl;
        }
        else
        {
            cout<<d<<endl;
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <ratio>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <climits>
#define ll long long
#define ld long double
#define mp make_pair
#define pb push_back
#define in insert
#define vll vector<ll>
#define endl "\n"
#define pll pair<ll,ll>
#define f first
#define s second
#define FOR(i,a,b) for(int i=(a),_b=(b); i<=_b; i++)
#define int ll
#define sz(x) (ll)x.size()
#define all(x) (x.begin(),x.end())
using namespace std;

 
const ll INF = 1e12;
const ll N =(1e5+5); // TODO : change value as per problem
const ll MOD = 1e9+7;

int a[N],arr[N];
// 2 4 3 1
map<int,int> pos;
void solve(){
	int n;
	cin >> n;
	
	for(int i =1;i <= n;i++)
		cin >> a[i],arr[i]  = a[i];
	sort(arr+1,arr+n+1);
	for(int i = 1;i<=n;i++) 
		pos[arr[i]] = i;
	int ans =0;
	for(int i =1;i<=n;i++){
		int dis = abs(pos[a[i]] - i);
		ans += (dis&1);
	}
	cout << (ans>>1ll) << endl;
}
signed main(){
 
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
     // freopen(".in","r",stdin);freopen(".out","w",stdout);
    
     ll tt=1;   
     // cin >> tt;
    while(tt--){    
        solve();
    }    
}

Measured memory_bytes: 11380
#include <bits/stdc++.h>
using namespace std;
#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 all(a) (a).begin(),(a).end()
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }
#define printpair(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<"{"<<_.first<<","<<_.second<<"}"<<", "; cerr<<"]"<<endl; }
#define dump(x) cerr<<#x<<": "<<x<<endl;
#define bit(k) (1LL<<(k))
typedef long long ll;
typedef pair<int, int> i_i;
typedef pair<ll, ll> l_l;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;
template< typename T1, typename T2 >
ostream &operator<<(ostream &os, const pair< T1, T2 >& p) {
  os << "{" <<p.first << ", " << p.second << "}";
  return os;
}
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; }

const int INF = (ll)1e9;
const ll INFLL = (ll)1e18+1;
const ll MOD = (ll)1e9+7;
const double PI = acos(-1.0);
/*
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const string dir = "DRUL";
*/

ll N;
ll calc(vector<l_l> &v){
    ll res = 0;
    int sz = v.size();
    priority_queue<ll> pq;
    sort(all(v));
    //大きい方から
    int idx = sz-1;
    for(int i = N - 1; i >= 0; i--){
        while(idx >= 0 && v[idx].first == i){
            pq.push(v[idx].second);
            idx--;
        }
        if(pq.empty())continue;
        res += pq.top();
        pq.pop();
    }
    return res;
}
void solve(){
    cin >> N;
    vector<l_l> lefts;
    vector<l_l> rights;
    ll base = 0;
    rep(i,N){
        ll K, L, R;
        cin >> K >> L >> R;
        K--;
        if(L >= R){
            base += R;
            lefts.emplace_back(K, L-R);
        }
        else{
            base += L;
            K++;
            rights.emplace_back(N-1-K, R-L);
        }
    }
    ll ans = base + calc(lefts) + calc(rights);
    cout << ans << endl;
}
int main() {
    int t;
    cin >> t;
    while(t--)solve();
}


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

int main(){
    int n, x = 0, MAX = 0;
    string s;
    cin >> n >> s;
    for(int i = 0; i < n; i++){
        if(s[i] == 'I') x++;
        else x--;
        MAX = max(MAX, x);
    }
    cout << MAX << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define rep(i, a, b) for(int i=(a); i<(b); i++)
#define per(i, a, b) for(int i=(b)-1; i>=(a); i--)
#define sz(a) (int)a.size()
#define de(a) cout << #a << " = " << a << endl
#define dd(a) cout << #a << " = " << a << " "
#define all(a) (a).begin(), (a).end()
#define pw(x) (1ll<<(x))
#define lb(x) ((x) & -(x))
#define endl "\n"
#define FI(x) freopen(#x".in","r",stdin)
#define FO(x) freopen(#x".out","w",stdout)
typedef double db;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
//typedef uniform_int_distribution<ll> RR;
const int P = 1e9 + 7;
//ll rnd(ll l, ll r) { mt19937 gen(rand()); RR dis(l, r); return dis(gen); }
int add(int a, int b) {if((a += b) >= P) a -= P; return a < 0 ? a + P : a;}
int mul(int a, int b) {return 1ll * a * b % P;}
int kpow(int a, int b) {int r=1;for(;b;b>>=1,a=mul(a,a)) {if(b&1)r=mul(r,a);}return r;}
//----
const int N = 1e5 + 7;
ll n, m, p[N], b[N], a[N], ans[N], now, vis[N], pp[N];
ll k;
int main(){
	//FI(a);
	ios::sync_with_stdio(0);
	cin.tie(0);
	//cout << setiosflags(ios::fixed);
	//cout << setprecision(2);
	cin >> n;
	rep(i, 1, n+1) cin >> a[i];
	per(i, 1, n+1) a[i] -= a[i-1];
//	rep(i, 1, n+1) de(a[i]);
	cin >> m >> k;
	rep(i, 1, m+1) cin >> b[i];
	rep(i, 1, n + 1) p[i] = i;
	rep(i, 1, m + 1) swap(p[b[i]], p[b[i]+1]);
	rep(i, 1, n+1) pp[p[i]] = i;
	rep(i, 1, n+1) p[i] = pp[i];
//	rep(i, 1, n+1) de(p[i]);
	rep(i, 1, n+1) if (!vis[i]){
		now = i;
		vi tmp;
		while (1) {
			vis[now] = 1;
			tmp.pb(now);
			now = p[now];
			if (now == i) break;
		}
		//de(sz(tmp));
		rep(i, 0, sz(tmp)) {
			int u = (i + k) % sz(tmp);
			//de(tmp[u]);
			ans[tmp[u]] = a[tmp[i]]; 
		}
	}
	//rep(i, 1, n+1) de(ans[i]);
	//de(a[1]);
	rep(i, 1, n+1) ans[i] += ans[i-1], cout << ans[i] << endl;	
	return 0; 
}



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

N, M = map(int,input().split())
AB = [list(map(int, input().split())) for _ in range(M)]

class UnionFind:
    def __init__(self, N):
        self.Parent = [-1]*N

    def root(self, A):
        if self.Parent[A] < 0: return A
        self.Parent[A] = self.root(self.Parent[A])
        return self.Parent[A]
    
    def size(self, A):
        return -self.Parent[self.root(A)]
    
    def connect(self, A, B):
        A = self.root(A)
        B = self.root(B)
        if A == B: return False
        if self.size(A) < self.size(B): A,B = B,A

        self.Parent[A] += self.Parent[B]
        self.Parent[B] = A
        return True

Uni = UnionFind(N+1)
ans = [0]*(M)
ans[M-1] = N*(N-1)//2

for i in reversed(range(1, M)):
    ans[i-1] = ans[i]
    if Uni.root(AB[i][0]) != Uni.root(AB[i][1]):
        ans[i-1] -= Uni.size(AB[i][0])*Uni.size(AB[i][1])
        Uni.connect(AB[i][0],AB[i][1])
for i in range(M):
    print(ans[i])
    

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

int main(){
  int N[32] = {1,1,1,2,1,2,1,5,2,2,1,5,1,2,1,14,1,5,1,5,2,2,1,15,2,2,5,4,1,4,1,51};
  int K;
  cin >> K;
  cout << N[K-1] << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		new Main().run();
	}

	private void run() {

		Scanner sc = new Scanner(System.in);

		int dir[][] = { { 0, -1 }, { 0, 1 }, { 1, 0 } };

		while (true) {
			final int w = sc.nextInt();
			final int h = sc.nextInt();

			if (w == 0 && h == 0) {
				break;
			}

			final int amount = sc.nextInt();
			final int capacity = sc.nextInt();
			final int init = sc.nextInt();

			int[][] map = new int[h][w];

			for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++) {
					map[i][j] = sc.nextInt();
				}
			}

			PriorityQueue<Walk> queue = new PriorityQueue<Walk>();
			for (int i = 0; i < w; i++) {
				boolean[][] b = new boolean[h][w];
				queue.offer(new Walk(0, init - 1, 0, i, b));
			}

			boolean flag = false;
			loop: while (!queue.isEmpty()) {
				Walk walk = queue.poll();
				int y = walk.y;
				int x = walk.x;

				if (walk.sanso <= 0) {
					continue;
				}
				if (y == h) {
					flag = true;
					System.out.println(walk.cost);
					break loop;
				}

				walk.visited[y][x] = true;

				if (map[y][x] <= 0) {
					walk.cost += (-map[y][x]);
				} else {
					walk.sanso = Math.min(map[y][x] + walk.sanso, capacity);
				}

				if (walk.cost > amount) {
					continue;
				}

				for (int i = 0; i < 3; i++) {
					int ny = y + dir[i][0];
					int nx = x + dir[i][1];
					if (nx < 0 || nx >= w || ny < 0 || ny > h
							|| (ny != h && walk.visited[ny][nx]))
						continue;

					boolean[][] nb = new boolean[h][w];
					for (int j = 0; j < h; j++) {
						nb[j] = Arrays.copyOf(walk.visited[j], w);
					}

					if (i == 2 && y == h - 1) {
						queue.offer(new Walk(walk.cost, walk.sanso, ny, nx, nb));
					} else {
						queue.offer(new Walk(walk.cost, walk.sanso - 1, ny, nx,
								nb));
					}
				}
			}

			if (!flag) {
				System.out.println("NA");
			}

		}
	}
}

class Walk implements Comparable<Walk> {
	int cost;
	int sanso;
	int x, y;
	boolean[][] visited;

	public Walk(int cost, int sanso, int y, int x, boolean[][] visited) {
		super();
		this.cost = cost;
		this.sanso = sanso;
		this.x = x;
		this.y = y;
		this.visited = visited;
	}

	@Override
	public String toString() {
		StringBuilder builder = new StringBuilder();
		for (int i = 0; i < visited.length; i++) {
			builder.append(Arrays.toString(visited[i])).append('\n');
		}
		return "Walk [cost=" + cost + ", sanso=" + sanso + ", x=" + x + ", y="
				+ y + ", visited=\n" + builder + "]";
	}

	@Override
	public int compareTo(Walk arg0) {
		return this.cost - arg0.cost;
	}
}

Measured memory_bytes: 75696
#include <algorithm>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iostream>
#include <iterator>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define FOR(i,k,n) for(int(i)=(k);(i)<(n);++(i))
#define rep(i,n) FOR(i,0,n)
#define all(v) begin(v),end(v)
#define debug(x) std::cerr<<#x<<": "<<x<<"\n"
#define debug2(x,y) std::cerr<<#x<<": "<<x<<", "<<#y<<": "<<y<<"\n"
#define debug3(x,y,z) std::cerr<<#x<<": "<<x<<", "<<#y<<": "<<y<<", "<<#z<<": "<<z<<"\n"

using ll=long long;
using vi=std::vector<int>;
using vvi=std::vector<vi>;
using vll=std::vector<ll>;
using vvll=std::vector<vll>;
template<typename T> using vvec=std::vector<std::vector<T>>;
template<typename T>
auto make_v(size_t sz){return std::vector<T>(sz);}
template<typename T,typename... Ts>
auto make_v(size_t sz,Ts...ts){return std::vector<decltype(make_v<T>(ts...))>(sz,make_v<T>(ts...));}
template<typename T>
void fill_v(T&var,const T&x){var=x;}
template<typename V,typename T>
void fill_v(V&v,const T&x){for(auto&& w:v){fill_v(w,x);}}

template<typename T> std::ostream& operator<<(std::ostream&s,const std::vector<T>&v){
  int sz=v.size();s<<"\n";rep(i,sz){s<<v[i];if(i<sz-1){s<<"\t";}}s<<"\n";return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::vector<std::vector<T>>&v){
  for(auto&& w:v){s<<w;}return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::deque<T>&v){
  int sz=v.size();s<<"\n";rep(i,sz){s<<v[i];if(i<sz-1){s<<"\t";}}s<<"\n";return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::deque<std::deque<T>>&v){
  for(auto&& w:v){s<<w;}return s;}
template<typename T> std::ostream& operator<<(std::ostream&s, const std::set<T>&v){
  s<<"\n";for(auto&& elm:v){s<<elm<<"\t";}s<<"\n";return s;}

inline void scan(int&a){scanf("%d",&a);}
inline void scan(ll&a){scanf("%lld",&a);}
inline void scan(char&a){scanf(" %c",&a);}
inline void scan(double&a){scanf("%lf",&a);}
template<typename T>
inline void scan(std::vector<T>&v){for(auto&& sv:v){scan(sv);}}
template<typename First,typename...Args>
inline void scan(First&f,Args&...args){scan(f);scan(args...);}
inline void scan(std::string&s){char BUF[3000000];scanf(" %s",BUF);s=std::string(BUF);}
inline void print(int a){printf("%d\n",a);}
inline void print(ll a){printf("%lld\n",a);}
inline void print(double a){printf("%.12f\n",a);}
inline void print(std::string s){std::cout<<s<<"\n";}

using namespace std;

void solve() {
  ll a, b, n;
  scan(a, b, n);
  ll x = min(b-1, n);
  ll ans = a * (double(x) / b);
  print(ans);
}

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


Measured memory_bytes: 3228
///
// File:  c.go
// Author: ymiyamoto
//
// Created on Fri May 25 00:05:10 2018
//
package main

import (
	"fmt"
)

var N, M int
var visited []bool
var graph [][]int
var graph2 [][]int

func dfs(root int) {
	visited[root] = true

	for _, r := range graph[root] {
		if !visited[r] {
			dfs(r)
		}
	}
}

func main() {
	fmt.Scan(&N, &M)

	graph = make([][]int, N+M)
	for i := range graph {
		graph[i] = make([]int, 0)
	}

	for i := 0; i < N; i++ {
		var K int
		fmt.Scan(&K)
		for j := 0; j < K; j++ {
			var L int
			fmt.Scan(&L)
			L--
			graph[i] = append(graph[i], N+L)
			graph[N+L] = append(graph[N+L], i)
		}
	}

	//fmt.Println(graph)

	visited = make([]bool, N+M)
	dfs(0)

	for i := 0; i < N; i++ {
		if !visited[i] {
			fmt.Println("NO")
			return
		}
	}

	fmt.Println("YES")
}


Measured memory_bytes: 13696
#include <bits/stdc++.h>
using namespace std;
using ll =long long;
#define all(v) v.begin(),v.end()
 
int main() {
ll a,b,c,d;
  cin>>a>>b>>c>>d;
  ll t,o;
  if(a%d==0) {
t=a/d;
    
  }
  else {
t=a/d+1;
  }
  
    if(c%b==0) {
o=c/b;
    
  }
  else {
o=c/b+1;
  }

  
  if(t>=o) {
cout<<"Yes"<<endl;
  }
else {
cout<<"No"<<endl;
}
}
  


Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);cout.precision(10);}} fast;

/* define */
#define FOR(I,X,Y) for(long long (I)=(X);(I)<(Y);(I)++)
#define REP(I,X,Y) for(long long (I)=(Y)-1;(I)>=(X);(I)--)
#define ALL(X) (X).begin(),(X).end()
#define pb push_back
#define COUNT(V,X) (upper_bound((V).begin(),(V).end(),X)-lower_bound((V).begin(),(V).end(),X))
#define debug(x) cerr<<#x<<':'<<x<<endl;
#define DEBUG(v) cerr<<#v<<':';for(auto xXx:v)cerr<<xXx<<' ';cerr<<endl;
#define Yes(X) if(X){cout<<"Yes"<<endl;}else{cout<<"No"<<endl;}
#define YES(X) if(X){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define ctoi(C) (C-'0')

/* alias */
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vii = vector<vector<int>>;
using vl = vector<long long>;
using vll = vector<vector<long long>>;
using pi = pair<int,int>;
using pl = pair<long long,long long>;
template<typename T> using PQ = priority_queue<T>;
template<typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

/* const */
const long long dx[] = {1,0,-1,0};
const long long dy[] = {0,1,0,-1};
const long long dx8[] = {1,1,0,-1,-1,-1,0,1};
const long long dy8[] = {0,1,1,1,0,-1,-1,-1};
const long long dx9[] = {1,1,0,-1,-1,-1,0,1,0};
const int INF = 1000000007;
const long long LINF = 1000000000000000007;

/* func */
template <typename T> inline bool chmin(T& a, const T& b) {if (a > b) a = b; return a > b;}
template <typename T> inline bool chmax(T& a, const T& b) {if (a < b) a = b; return a < b;}
long long max(long long x,int y){return max(x,(long long)y);}
long long max(int x,long long y){return max((long long)x,y);}
long long min(long long x,int y){return min(x,(long long)y);}
long long min(int x,long long y){return min((long long)x,y);}

/* liblary */



/* main */

signed main(){
    ll N,A,B;
    cin >> N >> A >> B;
    if(A > B){
        cout << 0 << endl;
        return 0;
    }
    if(N == 1){
        cout << (A == B) << endl;
        return 0;
    }
    if(N == 2){
        cout << 1 << endl;
        return 0;
    }
    ll upper = B*(N-1)+A;
    ll lower = A*(N-1)+B;
    cout << upper-lower+1 << endl;
}

Measured memory_bytes: 256
import fractions

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)
A,B,C,D = input().split()
A = int(A)-1
s = lcm(int(C),int(D))
#s = int(C)*int(D)
#numac = int(A)//int(C)#10//6 = 1
#numad = int(A)//int(D)#10//8 = 1
#numacd = int(A)//s#10//24 = 0
numa = int(A)//int(C) + int(A)//int(D) - int(A)//s
#numa = 1
#numbc = int(B)//int(C)#40//6 = 6
#numbd = int(B)//int(D)#40//8 = 5
#numbcd = int(B)//s#40//24= 1
numb = int(B)//int(C) + int(B)//int(D) - int(B)//s
#numb = 1
print(int(B)-int(A)-(numb - numa))

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

int main(){
    int n;
	cin >> n;
	string s;
	cin >> s;
	int cnt = 0;
	for(int i = 0;i < s.size();i++){
		if(s[i]=='A'&&s[i+1]=='B'&&s[i+2]=='C'){
			cnt++;
		}
	}
	cout << cnt << endl;
    return 0;
} 

Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#define FOR(i,n) for(int i=0;i<n;i++)
 
using namespace std;
 
bool result=true;
int main()
{
    string S;
    cin>>S;
    FOR(i,S.size())
    {
        if((i+1)%2!=0){
            if(S[i]=='R'||S[i]=='U'||S[i]=='D')
                continue;
            else{
                result=false;
                break;
            }
        }
        else{
            if(S[i]=='L'||S[i]=='U'||S[i]=='D')
                continue;
            else{
                  result=false;
                  break;
            }
        }
    }
    if(result)
        cout<<"Yes"<<endl;
        else
            cout<<"No"<<endl;
    std::cin.get();
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<vector>
#include<cstdlib>
#include<map>
#include<queue>
#include<stack>
#include<deque>
#include<fstream>
#include<string>
#include<sstream>
#include<iomanip>
#include<numeric>
#include<cctype>
#include<random>
using namespace std;

//fixed << setprecision(10)
#define PI 3.141592653589793
#define Yes(a) a ? "Yes" : "No";
#define YES(a) a ? "YES" : "NO";
#define rep(i,n) for(int i=0;i<n;i++)

int gcd(int a,int b) {
	if (a < b) {
		int tmp = a;
		a = b;
		b = tmp;
	}
	int r = a % b;
	while (r != 0) {
		a = b;
		b = r;
		r = a % b;
	}
	return b;
}

map<int, int> prime;
void Prime(long long int n) {
	for (int i = 2; i <= n; i++) {
		int count = 0;
		while (n % i == 0) {
			count++;
			n /= i;
		}
		if (count != 0) {
			prime.insert(make_pair(i, count));
		}
	}
}

int main() {
	double  a, b, x;
	double s;
	cin >> a >> b >> x;
	double ans;
	double t;

	if (2 * x >= a* a* b) {
		s = 2.0 * (a * a * b - x) / a;
		t = s / (a * a);
	}
	else {
		s = x / a;
		t = (b * b) / s;
		t /= 2.0;
	}
	ans = atan(t) * 180.0 / PI;
	cout << fixed << setprecision(10);
	cout << ans << endl;
}

Measured memory_bytes: 256
def check(T):
    column = any([all( [T[i][j] for j in range(3)] ) for i in range(3)])
    row = any([all( [T[j][i]for j in range(3)] ) for i in range(3)])
    diagonal = all( [T[i][i] for i in range(3)]) or all( [T[i][2-i] for i in range(3)])
    return row or column or diagonal

a = 3
grid =[[0]*a for i in range(a)]

d = {}
for i in range(3):
    row = list(map(int,input().split()))
    for j in range(3):
        d[row[j]] = (i,j)


N = int(input())
for i in range(N):
    p = int(input())

    if p in d.keys():
        x,y = d[p]
        grid[x][y] = 1

print( "Yes" if check(grid) else "No")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  
  int N,K;

  cin >> N >> K ;

  int64_t ans=K;

  for(int i=0;i<N-1;i++) ans*=(K-1);
  
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n,m,sum,a[100005],b[100005];
int main(){
    ios::sync_with_stdio(false);
    cin >> n >> m;
    for(int i=0;i<m;i++)
    	cin >> a[i];
    sort(a,a+m);
    sum=a[m-1]-a[0];
    for(int i=1;i<m;i++)
    	b[i-1]=a[i]-a[i-1];
    sort(b,b+m-1,greater<int>());
    for(int i=0;i<min(n-1,m-1);i++)
    	sum-=b[i];
    cout << sum;
    return 0;
}

Measured memory_bytes: 1024
# D - Lucky PIN

N = int(input())
S = str(input())

# 文字列Sから3文字選ぶ組み合わせを数え上げるとTLE
# 暗証番号の組み合わせが高々1,000通りしかないので、
# それごとに条件に該当するかをチェックしてカウントする。
ans = 0
for i in range(10):
    for j in range(10):
        for k in range(10):
            # i, j, kの組み合わせが起き得るか
            chk = str(i)+str(j)+str(k)
            idx = 0
            for s in S:
                if s==chk[idx]:
                    idx += 1
                    if idx == 3:
                        ans += 1
                        break
print(ans)

Measured memory_bytes: 42332
S = list(map(int, input().split()))
A=S[0]
B=S[1]
K=S[2]
i=1
cnt=0
m=min(A,B)
while True:
    if(A%m==0 and B%m==0):
        cnt+=1
        if(cnt==K):
            print(m)
            exit()
    m-=1

Measured memory_bytes: 38256
/*Remember: The Struggle Is Important*/

//CF,CC,AtC,SPOJ: hp1999
//HE: hemant269
//HR: hemant2132

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

#define     int          long long int
#define     fast() 	     ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define     all(x)       x.begin(),x.end()
#define     mem(a,b)     memset(a,b,sizeof(a))
#define     gcd(a,b)     __gcd((a),(b))
#define     lcm(a,b)     ((a)*(b))/gcd((a),(b))
#define     pb           push_back
#define     ins          insert
#define     F            first
#define     S            second

const int inf=1e18,MOD=1e9+7;

void solve()
{
 int a,b,t;

 cin>>a>>b>>t;

 cout<<(t/a)*b;

}

int32_t main()
{
 fast();

 int t=1;
 //cin>>t;
 while(t--)
 {
  solve();
 }

 return 0;
}



Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using static System.Console;

class Program
{
    static void Main(string[] args)
    {
        var a = new int[5];
        for (int i = 0; i < a.Length; i++)
            a[i] = int.Parse(ReadLine());

        var _a = a.OrderByDescending(x => (10 - (x % 10)) % 10).ToArray();

        var ans = _a[0] + _a[1..].Select(x => (x % 10 > 0) ? (x + 10 - x % 10) : x).Sum();

        WriteLine(ans);
    }
}


Measured memory_bytes: 28476
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

typedef long long ll;

int main() {
	int N;
	cin >> N;
	ll prefix[5] = { };
	for(int i = 0; i < N; i++) {
		string S;
		cin >> S;
		if(S[0] == 'M') prefix[0]++;
		if(S[0] == 'A') prefix[1]++;
		if(S[0] == 'R') prefix[2]++;
		if(S[0] == 'C') prefix[3]++;
		if(S[0] == 'H') prefix[4]++;
	}
	sort(prefix, prefix + 5, greater<ll>());
	ll ans = 0;
	for(int i = 0; prefix[i] > 0 && i < 5; i++) {
		for(int j = i + 1; prefix[j] > 0 && j < 5; j++) {
			for(int k = j + 1; prefix[k] > 0 && k < 5; k++) {
				ans += prefix[i] * prefix[j] * prefix[k];
			}
		}
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
"""
"""
import sys
from sys import stdin
from bisect import bisect_right
input = stdin.readline


def create_prime_list(limit):
    """ ??¨??????????????????????????§limit?????§????´???°?????????????±???????
    https://ja.wikipedia.org/wiki/%E3%82%A8%E3%83%A9%E3%83%88%E3%82%B9%E3%83%86%E3%83%8D%E3%82%B9%E3%81%AE%E7%AF%A9
    """
    x = limit**0.5
    primes = []
    nums = [x for x in range(2, limit+1)]
    while nums[0]<=x:
        primes.append(nums[0])
        current_prime = nums[0]
        nums = [x for x in nums if x%current_prime != 0]
    primes.extend(nums)
    return primes


def main(args):
    # ??????????´???°?????????
    primes = create_prime_list(10000)
    twin_primes = []


    # prev = primes[0]
    # for p in primes[1:]:
    #     if p == prev + 2:
    #         twin_primes.append([prev, p])
    #     prev = p
    #
    # keys = [x[1] for x in twin_primes]
    # while True:
    #     n = int(input())
    #     if n == 0:
    #         break
    #     r = bisect_right(keys, n)
    #     print(*twin_primes[r-1])

    prev = primes[0]
    for p in primes[1:]:
         if p == prev + 2:
             twin_primes.append(p)
         prev = p

    while True:
        n = int(input())
        if n == 0:
            break
        r = bisect_right(twin_primes, n)
        print(twin_primes[r-1]-2, twin_primes[r-1])



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

Measured memory_bytes: 8524
package main

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

var (
	A, B, C, ans int
)

func readVariables() {
	A, B, C = nextInt(), nextInt(), nextInt()
}

func main() {
	readVariables()
	if A == B {
		ans++
	}
	if B == C {
		ans++
	}
	if C == A {
		ans++
	}
	if ans == 1 {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}

/* 以下、テンプレート*/

var scanner *bufio.Scanner

func init() {
	scanner = bufio.NewScanner(os.Stdin)
	scanner.Buffer(make([]byte, 0, 1000000), 1000000)
	scanner.Split(bufio.ScanWords)
}

//nextInt converts next token from stdin and returns integer value.
//nextInt panics when conversion into an integer fails.
func nextInt() int {
	if !scanner.Scan() {
		panic("No more token.")
	}
	num, err := strconv.Atoi(scanner.Text())
	if err != nil {
		panic("nextInt(): cannot convert to int: " + scanner.Text())
	}
	return num
}

func nextStr() string {
	if !scanner.Scan() {
		panic("No more token.")
	}
	return scanner.Text()
}

// MinInt は、2つの整数を受け取り、最小値を返します。
func MinInt(x, y int) int {
	if x < y {
		return x
	} else {
		return y
	}
}

//MaxInt は、2つの整数を受け取り、最大値を返します。
func MaxInt(x, y int) int {
	if x < y {
		return y
	} else {
		return x
	}
}

//AbsInt は、整数の絶対値を返します。
func AbsInt(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

//ModPow は整数の累乗関数で、剰余もサポートします。
//base^exponentの値をmoduleで割った余りを返します。
//moduloが1以下の場合には、剰余演算をしません。
//baseが負の値である場合には、返す値が負になることがあります。
func ModPow(base, exponent, modulo int) (result int) {
	result = 1
	for exponent > 0 {
		if exponent%2 == 1 {
			result *= base
			if modulo > 1 {
				result %= modulo
			}
		}
		base *= base
		if modulo > 1 {
			base %= modulo
		}
		exponent /= 2
	}
	return
}

//Gcd は、引数の整数全ての最大公約数を返します。
func Gcd(vals ...int) (result int) {
	if len(vals) == 0 {
		return
	}
	result = vals[0]
	for i := 1; i < len(vals); i++ {
		result = gcd(result, vals[i])
	}
	return
}

func gcd(x, y int) int {
	x, y = AbsInt(x), AbsInt(y)
	for y > 0 {
		x, y = y, x%y
	}
	return x
}

//Lcm は、与えられた整数の最小公倍数を返します。
func Lcm(vals ...int) (result int) {
	if len(vals) == 0 {
		return
	}
	result = vals[0]
	for i := 1; i < len(vals); i++ {
		result = lcm(result, vals[i])
	}
	return
}

func lcm(x, y int) int {
	return x * y / gcd(x, y)
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define int long long
#define double long double
#define rep(i,s,n) for(int i = (s); i < (n); i++)
#define all(v) begin(v), end(v)
#define allg(v) begin(v), end(v), greater<int>()



signed main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  
  string s;
  ll n, k, q;
  
  cin >> n >> k >> q;
  
  vector<ll> a(n, 0);  
  
  ll p;
  rep(i, 0, q) {
    cin >> p;
    a[p-1]++;
  }
  
  rep(i, 0, n)
    cout << ( (k -q +a[i] > 0) ?"Yes" :"No") << "\n";

}


Measured memory_bytes: 1408
using System;

public class dice
{
    private int[] data;
    public dice(string s = "1,5,6,4,2,3")
    {
        data = new int[6];
        string[] line = s.Split(',');
        for (int i = 0; i < 6; i++)
            data[i] = int.Parse(line[i]);

        // 0: ceilling 1: front 2: floor 3:right:4:back:5:left
    }
    public void roll(char c)
    {
        var w = new int[6];
        Array.Copy(data, w, 6);
        if (c == 'U' | c == 'N') { data[4] = w[0]; data[0] = w[1]; data[1] = w[2]; data[2] = w[4]; }
        else if (c == 'D' | c == 'S') { data[1] = w[0]; data[2] = w[1]; data[4] = w[2]; data[0] = w[4]; }
        else if (c == 'R' | c == 'E') { data[3] = w[0]; data[5] = w[2]; data[2] = w[3]; data[0] = w[5]; }
        else { data[5] = w[0]; data[3] = w[2]; data[0] = w[3]; data[2] = w[5]; }
    }
    public int peek(int n) => data[n];
}

public class hello
{
    public static void Main()
    {
        var b0 = new int[] { 0, 1, 3, 5, 4, 2 };
        var n = int.Parse(Console.ReadLine().Trim());
        var d = new dice[n];
        for (int i = 0; i < n; i++)
        {
            string[] line = Console.ReadLine().Trim().Split(' ');
            var a = Array.ConvertAll(line, int.Parse);
            var b = new int[6];
            for (int j = 0; j < 6; j++) b[b0[j]] = a[j];
            d[i] = new dice(string.Join(",", b));
        }
        Console.WriteLine(getAns(n, d) ? "Yes" : "No");

    }
    static bool getAns(int n, dice[] d)
    {
        for (int i = 0; i < n - 1; i++)
            for (int j = i + 1; j < n; j++)
                if (Issame(d[i], d[j])) return false;
        return true;
    }
    static bool Issame2(dice d, dice d2)
    {
        var a = new int[6];
        var b = new int[6];
        for (int i = 0; i < 6; i++)
        {
            a[i] = d.peek(i);
            b[i] = d2.peek(i);
        }
        Array.Sort(a);
        Array.Sort(b);
        for (int i = 0; i < 6; i++)
            if (a[i] != b[i]) return false;
        return true;
    }
    static bool Issame(dice d, dice d2)
    {
        if (!Issame2(d, d2)) return false;
        var ok = false;
    again:;
        for (int i = 0; i < 4; i++)
        {
            d.roll('D');
            if (d.peek(0) == d2.peek(0)) { ok = true; break; }
        }
        if (!ok) { d.roll('R'); goto again; }
        var da = "";
        var db = "";
        var w = new int[] { 1, 3, 4, 5 };
        for (int i = 0; i < 4; i++) da += d.peek(w[i]).ToString();
        for (int i = 0; i < 4; i++) db += d2.peek(w[i]).ToString();
        db += db;
        return db.IndexOf(da) != -1;
    }
}



Measured memory_bytes: 18532
from collections import deque

X, Y, A, B, C = map(int, input().split())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))
p.sort(reverse=True)
q.sort(reverse=True)
r.sort()
p = deque(p[:X][::-1])
q = deque(q[:Y][::-1])
ans = 0
while X + Y > len(p) + len(q):
    ans += r.pop()
while r:
    R = r.pop()
    if p[0] < q[0]:
        if p[0] < R:
            p.popleft()
            p.append(R)
        else:
            break
    else:
        if q[0] < R:
            q.popleft()
            q.append(R)
        else:
            break
ans += sum(p) + sum(q)
print(ans)


Measured memory_bytes: 108780
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <string>
#include <set>
#define INF 1000000000
using namespace std;
#define int unsigned long long
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define LOOP(i,N) for(int i=0;i<N;i++)
#define LOOP1(i,N) for(int i=1;i<=N;i++)
typedef pair<int,int> P;
typedef pair<int,pair<int,int> > PP;

#define MAN 200000

int pow(int n,int k){
  int r=1;
  LOOP(i,k)r*=n;
  return r;
}

int sqrt(int n){
  LOOP(i,n){
    if(n<i*i*i)return i-1;
  }
  return -1;
}

signed main(){
  int N,P;
  cin >> N >> P;
  int res=1;
  if(N==1){
    cout << P << endl;
    return 0;
  }if(N>41 || N>=P){
    cout << 1 << endl;
    return 0;
  }
  for(int i=2,c=P;i*i<=c;i++){
    // cerr << i << ":" << c;
    if(c%i){
      // cerr << "; :(" << endl;
      continue;
    }
    int ipn = pow(i,N);
    if(ipn>1000000000000LL)break;
    // cerr << "; " << ipn << endl;
    while(c%ipn==0){
      c/=ipn;
      res*=i;
    }
  }
  cout << res << endl;

}

/*

nこでわれないとだめ
x^n の最大化で整数値







*/


Measured memory_bytes: 256
import sys
N=int(input())
A=list(map(int,input().split()))
total=0
for i in range(N):
  total+=A[i]
if total*2/((N+1)*N)%1!=0:
  print("NO")
  sys.exit()
times=int(total*2/((N+1)*N))
if (times-A[0]+A[N-1])/N%1!=0 or times-A[0]+A[N-1]<0:
  print("NO")
  sys.exit()
B=(times-A[0]+A[N-1])/N
for i in range(N-1):
  B+=(times-A[i+1]+A[i])/N
  if (times-A[i+1]+A[i])/N%1!=0 or times-A[i+1]+A[i]<0:
    print("NO")
    sys.exit()
if B==times:
  print("YES")
else:
  print("NO")

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

using ll = long long;
using namespace std;
const int INFint = 2e9+1;
const ll INFll = 2e18+1;
ll MOD=1e9+7;


int main() {
  ll N,K;
  cin>>N>>K;
  ll tmp(0);
  for(int b(1);b<=N;b++){
    //cout << tmp << endl;
    if(b <= K){
      tmp += N;
    }else{
      tmp += max(((N/b+1)*K)-1,0ll);
      tmp -= max(N/b*b+K - N - 1,0ll);
    }
  }
  //cout << tmp << endl;
  cout << N*N - tmp << endl;
  return 0;
}

Measured memory_bytes: 256
from numpy import average
from decimal import Decimal, ROUND_HALF_UP

n=int(input())
x=list(map(int,input().split()))

p=Decimal(str(average(x))).quantize(Decimal('0'),rounding=ROUND_HALF_UP)

ans=0
for i in x:
	ans+=((i-p)**2)

print(ans)


Measured memory_bytes: 27092
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
using vll = vector<vl>;
using Pll = pair<ll, ll>;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(v) v.begin(), v.end()
#define sz(x) ((int) x.size())
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define F first
#define S second
const int MOD = 1e9+7;
const int INF = 2e9;
template<class T> void print(const T& t){ cout << t << endl; }
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; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int main(){
  ll h;
  cin >> h;
  ll ans = 0;
  ll num = 0;
  while(h!=0){
    h /= 2;
    num++;
  }
  ll tmp = 1;
  rep(i, num ){
    ans += tmp;
    tmp *= 2;
  }
  ans;
  print(ans);
}

Measured memory_bytes: 3564
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(int i = n;i >= 0;--i)
#define FOR(i,m,n) for(int i = m, i##_len=(n);i <i##_len; ++i)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
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; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}
const int INF = 1e9;
const ll LLINF = 1e16;

int main(void)
{
    int n, k, q;
    cin >> n >> k >> q;
    vector<int> r(n,0);
    vector<int> a(q);
    REP(i,q){
        cin >> a[i];
        r[a[i] - 1]++;
    }

    REP(i,n){
        if(k + r[i] - q <= 0){
            cout << "No" << endl;
        }
        else{
            cout << "Yes" << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b;
  while(cin>>a>>b){
    int r=a%b; 
    while(r!=0){ 
      a=b; 
      b=r; 
      r=a%b; 
    }
    cout<<b<<endl;
  }
  return 0;
}

Measured memory_bytes: 3052
//#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"

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

#define MOD 1000000007LL
#define INF (1LL<<60LL)
#define int long long
#define MAX_N (100001)
typedef long long ll;

using namespace std;

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int ans = 0;
	rep(i, 2) {
		int a, b; cin >> a >> b;
		ans += min(a, b);
	}
	cout << ans << endl;

}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm> // sort
#include <map> // pair
#include <numeric> // accumulate(begin,end,初期値)

typedef long long ll;
using namespace std;

#define FALSE printf("false\n");
#define TRUE printf("true\n");
#define all(x) (x).begin(),(x).end()
#define print(x) cout<<x<<endl;
#define rep(i,n) for(ll i = 0;i < n;++i)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define SUM(vec) accumulate(all(vec),0);

const ll INF = 1e9+7;

// 各桁の和
template<typename T>
T digit(T num){
  T sum = 0;
  while(num){
    sum += num % 10;
    num /= 10;
  }
  return sum;
}

template<typename T>T gcd(T a,T b){
  if(b == 0)
    return a;
  return gcd(b,a%b);
}
template<typename T>T lcm(T a, T b){
  T g = gcd(a,b);
  return a/g*b; 
}

int main(){
  string s,t;
  cin>>s;cin>>t;
  
  if(s.size() != t.size()){
    if(s.size() > t.size()){
      print("GREATER")
    }else{
	  print("LESS")
    }
    return 0;
  }
  
  rep(i,s.size()){
    if(s[i] == t[i])continue;
    
    if(s[i] > t[i]){
      print("GREATER")
      return 0;
    }else{
      print("LESS")
      return 0;
    }
  }
  
  print("EQUAL")
  return 0;
}


Measured memory_bytes: 256
public class Main{
  public void run(java.io.InputStream in, java.io.PrintStream out){
    java.util.Scanner sc = new java.util.Scanner(in);
    int n, i, j, max, a;
    double[] x, y;

    for(;;out.println(max)){
      n = sc.nextInt(); if(n == 0)break;
      x = new double[n]; y = new double[n];
      for(i = 0;i < n;i++){
        x[i] = sc.nextDouble(); y[i] = sc.nextDouble();
      }
      max = 1;
      for(i = 0;i < n;i++)for(j = i + 1;j < n;j++){
        if((x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j]) < 4){
          a = solve(x, y, n, i, j);
          if(max < a)max = a;
        }
      }
    }

    sc.close();
  }
  public static void main(String[] args){
    (new Main()).run(System.in, System.out);
  }
  private static int solve(double[] x, double[] y, int n, int i, int j){
    int count, res, k;
    double ax, ay, bx, by, hx, hy, lx, ly, s, ah;

    lx = x[j] - x[i]; ly = y[j] - y[i];
    s = lx * lx + ly * ly;
    ah = Math.sqrt(s) / 2;

    hx = x[i] + lx * ah / Math.sqrt(s);
    hy = y[i] + ly * ah / Math.sqrt(s);

    bx = ly * Math.sqrt((1.0 - ah * ah) / s);
    by = -lx * Math.sqrt((1.0 - ah * ah) / s);

    ax = hx + bx; ay = hy + by;
    bx = hx - bx; by = hy - by;

    count = 0;
    for(k = 0;k < n;k++)
      if((ax - x[k]) * (ax - x[k]) + (ay - y[k]) * (ay - y[k]) < 1.00001)count++;
    res = count;
    count = 0;
    for(k = 0;k < n;k++)
      if((bx - x[k]) * (bx - x[k]) + (by - y[k]) * (by - y[k]) < 1.00001)count++;
    if(res < count)res = count;
    return res;
  }
}

Measured memory_bytes: 51448
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int g_cd(int a, int b, int c){
    int flag = 1, res = 1;
    while (flag)
    {
        flag = 0;
        int m = min(a, min(b, c));
        if (m <= 1);
        else{
          for (int i = 2; i <= m; i++)
          {
            if (a % i == 0 and b % i == 0 and c % i == 0){
                a /= i, b/= i, c/= i; res *= i;
                flag = 1;break;
            }
          }
        }
    }
    
    return res;
}

int main(){
    int K; cin >> K;ll v = 0;
    for (int i = 1; i <= K; i++)
    {
        for (int j = 1; j <= K; j++)
        {
            for (int k = 1; k <= K; k++)
            {
                v += g_cd(i, j, k);
            }
            
        }
        
    }
    
    cout << v << endl;
}



Measured memory_bytes: 3624
#include "bits/stdc++.h"

#define ALL(a) (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define DESCSORT(c) sort(c.begin(), c.end(), greater<int>())

using namespace std;

using LL = long long int;
using LD = long double;

using pii = pair<int, int>;
using pll = pair<LL, LL>;
using pdd = pair<double, double>;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vl = vector<LL>;
using vvl = vector<vl>;
using vvvl = vector<vvl>;
using vd = vector<double>;
using vvd = vector<vd>;
using vs = vector<string>;
using vb = vector<bool>;
using vvb = vector<vb>;

const int INF = (1 << 30) - 1;
const LL INF64 = ((LL)1 << 62) - 1;
const double PI = 3.1415926535897932384626433832795;

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

int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }
LL gcd(LL x, LL y) { return y ? gcd(y, x % y) : x; }

int solve(int m, int d) {
	int y = 2004;
	if (m <= 2) {
		m += 12;
		y--; 
	}
	return (y + y / 4 - y / 100 + y / 400 + (13 * m + 8) / 5 + d) % 7;
}

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

	int m, d;
	while (cin >> m >> d) {
		if (m == 0 && d == 0) break;

		switch (solve(m, d)) {
			case 0:
				cout << "Sunday" << endl;
				break;
			case 1:
				cout << "Monday" << endl;
				break;
			case 2:
				cout << "Tuesday" << endl;
				break;
			case 3:
				cout << "Wednesday" << endl;
				break;
			case 4:
				cout << "Thursday" << endl;
				break;
			case 5:
				cout << "Friday" << endl;
				break;
			case 6:
				cout << "Saturday" << endl;
				break;
		}
	}
	return 0;
}

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define test ll t; cin>>t; while(t--)
#define ll long long 
#define pb push_back
int main(){	
	fast;
		ll n,b; cin>>n>>b;
		ll d=(ll)(floor(log(n)/log(b))+1);
		cout<<d;
		}

Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
#include <bitset>
#include <iomanip>
#include <stack>
#include <list>
#include <map>
#include <unordered_map>
#include <chrono>
#include <numeric>
using namespace std;
using ll = long long;
const ll INF = (ll)1e18+1;
const ll DIV = 1000000007;
//#define TEST
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
#ifdef TEST
    chrono::system_clock::time_point start, end;
    start = chrono::system_clock::now();
#endif
    long A,B;
    cin >> A >> B;

    if((A==1 || B==1) && (A==2 || B==2)) cout << 3 << endl;
    else if((A==1 || B==1) && (A==3 || B==3)) cout << 2 << endl;
    else cout << 1 << endl;
#ifdef TEST
    end = chrono::system_clock::now();
    cerr << static_cast<double>(chrono::duration_cast<chrono::microseconds>(end - start).count() / 1000.0) << "[ms]" << endl;
#endif
    return 0;
}

Measured memory_bytes: 3596
/*
    Author: Alam Khan
    AUST CSE 40th Batch

*/

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

typedef long long ll;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef deque<ll> dl;
typedef stack<ll> stl;
typedef set<ll> sl;
typedef map<string, ll> msl;
typedef map<ll,ll> mll;
#define sf(n)     scanf("%lld",&n)
#define sff(n,m)     scanf("%lld %lld",&n,&m)
#define sfff(n,m,r)     scanf("%lld %lld %lld",&n,&m,&r)
#define sfs(n)     scanf("%s",n)
#define pf(n)     printf("%lld\n",n)
#define pff(n,m)     printf("%lld %lld\n",n,m)
#define pfff(n,m,r)     printf("%lld %lld %lld\n",n,m,r)
#define pfs(n)     printf("%s\n",n)
#define pfcs(i,n)     printf("Case %lld: %lld\n",i,n)
#define pb     push_back
#define prf     printf
#define inf     2e18
#define low     -1000000000000
#define PI        acos(-1.0)
#define rep1(i,n) for(i=1;i<n;i++)
#define rep0(i,n) for(i=0;i<n;i++)
#define rep(i,a,n) for(i=a;i<n;i++)
#define repe1(i,n) for(i=1;i<=n;i++)
#define repe0(i,n) for(i=0;i<=n;i++)
#define repe(i,a,n) for(i=a;i<=n;i++)

int main()
{
    ll i,n,t,k,j,x=0,y=0,m;
    sff(n,m);
    if(n>=10 || m>=10)
    {
        cout<<-1<<endl;
    }
    else cout<<n*m<<endl;
    return 0;
}



Measured memory_bytes: 256
#include<cstdio>
using namespace std;
int d2b(int n,int b,char c[])
{
    int i=0,k;                                                                                                                                                   
    while(n!=0)
    {
        k=n%b;
        n/=b;
        if(k<0){k-=b;n+=1;}//这里是负进制的重点
        if(k>9)c[i]=char(k-10+'A');
        else c[i]=char(k+'0');
        i++;
    }
    return i-1;
}
int main()
{
    int a,n,i;
    char b[40];
    scanf("%d",&a);
    n=-2;
    if(a==0)printf("0");
    for(i=d2b(a,n,b);i>=0;i--)printf("%c",b[i]);
    
}

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

using namespace std;

int main() {
  int A,B,K;
  cin>>A>>B>>K;
  int cnt = 0;

  for(int ii=min(A,B); ii>=1; ii--){
    if(A%ii==0 && B%ii==0){
      cnt++;
    }
    if(cnt==K){
      cout<<ii<<endl;
      return 0;
    }

  }


}


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

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define MOD 1000000007
typedef long long ll;

int main() {
    string s;
    cin >> s;
    int len = (int)s.length(), ans = 0;
    rep(i, len/2){
        if(s[i] != s[len-(i+1)]) ans++;
    }
    cout << ans << endl;
}



Measured memory_bytes: 256