akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize(2)
#include <cstdio>
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <queue>
#include <deque>
#include <list>
#include <climits>
#include <bitset>
#include <fstream>
#include <algorithm>
#include <functional>
#include <stack>
#include <string>
#include <cmath>
#define fi first
#define se second
#define re register
#define ls i << 1
#define rs i << 1 | 1
#define pb push_back
#define pii pair<int,int>
#define ios ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define mod 1000000007

#define int long long

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const double eps = 1e-8;
const int inf = 0x3f3f3f3f;
const long long INF = 0x3f3f3f3f3f3f3f3f;
const double pi = acos(-1.0);

inline int rd(){
  int x = 0, f = 1; char ch = getchar();
  while (ch < '0' || ch>'9') { if (ch == '-')f = -1; ch = getchar(); }
  while (ch >= '0' && ch <= '9') { x = x * 10 + ch - '0'; ch = getchar(); }
  return x * f;
}

void out(int a) {
  if (a < 0) putchar('-'), a = -a;
  if (a >= 10) out(a / 10);
  putchar(a % 10 + '0');
}
char s[2000010];
signed main(){
//int main() {
  scanf("%s",s);
  int ans = 0;
  for (int i = 0; i < strlen(s); i++) ans += s[i]-'0';
  cout << (ans % 9? "No" : "Yes");
  return 0;
}

Measured memory_bytes: 3948
import java.util.*;

public class Main {
	
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		if (a % 2 == 1 && b % 2 == 1) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
	
}

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

/* メモリ食い過ぎ注意 */
#define int long long

typedef long long ll;

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

/* define const */
const ll INF = (1ll << 60);
const ll MOD = (ll)1e9 + 7;
/* end defineing */

signed main()
{
    int n, a;
    cin >> n >> a;

    while (n - 500 >= 0)
    {
        n -= 500;
    }

    // cout << n << endl;
    if (n <= a || n % 500 == 0)
        cout << "Yes" << endl;
    else
    {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<map>
using namespace std;
int main()
{
	int n;
	cin>>n;
	if(n>=1800) cout<<"1"<<endl;
	else if(n>=1600) cout<<"2"<<endl;
	else if(n>=1400) cout<<"3"<<endl;
	else if(n>=1200) cout<<"4"<<endl;
	else if(n>=1000) cout<<"5"<<endl;
	else if(n>=800) cout<<"6"<<endl;
	else if(n>=600) cout<<"7"<<endl;
	else if(n>=400) cout<<"8"<<endl;
    return 0;
}

Measured memory_bytes: 3668
import Foundation

/*
// 1
let N = Int(readLine()!)!

// 1 2
let split = readLine()!.componentsSeparatedByString(" ")
let N = Int(split[0])!
let S = Int(split[1])!

// 1 2 3 4 5
let array = readLine()!.componentsSeparatedByString(" ").map { Int($0)! }
*/

let N = Int(readLine()!)!
let array = readLine()!.componentsSeparatedByString(" ").map { Int($0)! }
var dic = [Int: Int]()
var answer = 0
for e in array { 
  if dic[e] != nil {
    dic[e] = dic[e]! + 1
  } else {
    dic[e] = 1
  }
  answer += dic[e]! - 1
}

for e in array {
  print(answer - dic[e]! + 1 )
}

Measured memory_bytes: 18068
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<queue>
#include<stack>
#include<set>
#include<algorithm>
#include<utility>
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const int INF = 1001001001;

ll pow_mod(ll x, ll y) {
	ll res = 1;
	for (ll i = 0; i < y; i++) res = res * x % mod;
	return res;
}

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

int main() {
	string s;
	int q;
	cin >> s >> q;
	string front, back;
	back = s;
	bool forb = 1;
	for (int i = 0; i < q; i++) {
		int t;
		cin >> t;
		if (t == 1) {
			if (forb) forb = 0;
			else forb = 1;
		}
		else {
			int f;
			char c;
			cin >> f >> c;
			if (f == 1) {
				if (forb) front.push_back(c);
				else back.push_back(c);
			}
			else {
				if (forb) back.push_back(c);
				else front.push_back(c);
			}
		}
	}
	if (forb) {
		reverse(front.begin(), front.end());
		front += back;
		cout << front << endl;
	}
	else {
		reverse(back.begin(), back.end());
		back += front;
		cout << back << endl;
	}
	return 0;
}

Measured memory_bytes: 4320
//@formatter:off
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < int(n); ++i)
#define rrep(i,n) for (int i = int(n)-1; i >= 0; i--)
#define rep2(i,s,n) for (int i = int(s); i < int(n); ++i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vd vector<double>
#define vvd vector<vector<double>>
#define vs vector<string>
#define vc vector<char>
#define vvc vector<vector<char>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define vp vector<P>
#define vvp vector<vector<P>>
using namespace std;
using ll = long long;
using P = pair<int,int>;
using LP = pair<ll,ll>;
template<class S,class T> istream& operator>>(istream &is,pair<S,T> &p) { return is >> p.first >> p.second; }
template<class S,class T> ostream& operator<<(ostream &os,const pair<S,T> &p) { return os<<'{'<<p.first<<","<<p.second<<'}'; }
template<class T> istream& operator>>(istream &is,vector<T> &v) { for(T &t:v){is>>t;} return is; }
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) { os<<'[';rep(i,v.size())os<<v[i]<<(i==int(v.size()-1)?"":","); return os<<']'; }
void Yes(bool b) { cout << (b ? "Yes" : "No") << '\n'; }
void YES(bool b) { cout << (b ? "YES" : "NO") << '\n'; }
template<class T> bool chmin(T& a,T b) {if(a > b){a = b; return true;} return false;}
template<class T> bool chmax(T& a,T b) {if(a < b){a = b; return true;} return false;}
const int inf = 1001001001;
const ll linf = 1001001001001001001;
//@formatter:on

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int n;
    cin >> n;
    vvi G(n);
    rep(_, n - 1) {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        G[a].pb(b);
        G[b].pb(a);
    }
    vvi ls(2);
    auto dfs = [&](auto &self, int v = 0, int p = -1, int c = 0) -> void {
        ls[c].pb(v);
        for (int u : G[v]) {
            if (u == p) continue;
            self(self, u, v, 1 - c);
        }
    };
    dfs(dfs);
    if (ls[0].size() < ls[1].size()) swap(ls[0], ls[1]);
    int a = n / 3, b = n / 3;
    if (n % 3 == 2) a++, b++;
    else if (n % 3 == 1) a++;
    vi ans(n);
    if (ls[1].size() >= b) {
        rep(i, a) ans[ls[0][i]] = i * 3 + 1;
        rep(i, b) ans[ls[1][i]] = i * 3 + 2;
        int cnt = 0;
        rep2(i, a, ls[0].size()) {
            ans[ls[0][i]] = cnt * 3 + 3;
            cnt++;
        }
        rep2(i, b, ls[1].size()) {
            ans[ls[1][i]] = cnt * 3 + 3;
            cnt++;
        }
    } else {
        rep(i, a) ans[ls[0][i]] = i * 3 + 1;
        rep2(i, a, a + b) ans[ls[0][i]] = (i - a) * 3 + 2;
        int cnt = 0;
        rep2(i, a + b, ls[0].size()) {
            ans[ls[0][i]] = cnt * 3 + 3;
            cnt++;
        }
        rep(i, ls[1].size()) {
            ans[ls[1][i]] = cnt * 3 + 3;
            cnt++;
        }
    }
    for (int i : ans) {
        cout << i << ' ';
        assert(i <= n);
    }
    cout << endl;
}


Measured memory_bytes: 24980
import math

class Calc:
    def __init__(self,a,op,b):
        self.a = a
        self.b = b
        self.op = op

    def calc(self):
        if self.op == "+":
            return self.a + self.b
        elif self.op == "-":
            return self.a - self.b
        elif self.op == "*":
            return self.a * self.b
        elif self.op == "/":
            try:
                ans = self.a / self.b
            except ZeroDivisionError:
                return 0
            else:
                return ans
        else:
            return "Invalid Operator."

def main():
    data = []
    while 1:
        n = input().split()
        a = int(n[0])
        op = n[1]
        b = int(n[2])
        if op == "?":
            break

        data.append(Calc(a,op,b))

    for i in data:
        print(int(i.calc()))

if __name__ == "__main__":
    main()

Measured memory_bytes: 5660
/*#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,popcnt,abm,mmx,tune=native")
#pragma GCC target("avx2")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("fast-math")*/
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <math.h>
#include <cmath>
#include <vector>
#include <map>
#include <algorithm>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <cassert>
#include <random>
#include <deque>
#include <bitset>
#include <string>
#include <queue>
#include <complex>

//#define int long long

#define mp(a, b) make_pair(a, b)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()

#define endl '\n'


using namespace std;
typedef long long ll;
typedef long double ld;

mt19937 mrand(random_device{}());

const double PI = acos((double)-1);
const double eps = 1e-7;
const ll inf0 = 1023 * 1024 * 1024;
const ll inf = inf0 * inf0;
const ll mod = 1e9 + 7;
//const ll mod = 998244353;

void solve();
void scan();

signed main() {
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
#endif
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(false);
	cout << fixed; cout.precision(15);
	solve();
	return 0;
}

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

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

int main(){
    for(int i=0; i<3000; i++){
        int a,b;
        cin>>a>>b;
        if(a==0 && b==0) break;

        if(a>b) swap(a,b);
        cout<<a<<" "<<b<<endl;
    }

    return 0;
}



Measured memory_bytes: 3060
//raja1999
#include <bits/stdc++.h>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip> 
//setbase - cout << setbase (16); cout << 100 << endl; Prints 64
//setfill -   cout << setfill ('x') << setw (5); cout << 77 <<endl;prints xxx77
//setprecision - cout << setprecision (14) << f << endl; Prints x.xxxx


using namespace std;
#define f(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) f(i,0,n)
#define fd(i,a,b) for(i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define vi vector< int >
#define vl vector< ll >
#define ss second
#define ff first
#define ll long long
#define pii pair< int,int >
#define pll pair< ll,ll >
#define sz(a) a.size()
#define inf (1000*1000*1000+5)
#define all(a) a.begin(),a.end()
#define tri pair<int,pii>
#define vii vector<pii>
#define vll vector<pll>
#define viii vector<tri>
#define mod (1000*1000*1000+7)
#define pqueue priority_queue< int >
#define pdqueue priority_queue< int,vi ,greater< int > >

//std::ios::sync_with_stdio(false);
vector <vi  >adj(200005);
int main(){
	std::ios::sync_with_stdio(false);
	int n,m,i,j,a,b;
	cin>>n>>m;
	rep(i,m)
	{
		cin>>a>>b;
		adj[a].pb(b);
		adj[b].pb(a);
	}
	rep(i,adj[1].size())
	{
		rep(j,adj[adj[1][i]].size())
		{
			if(adj[adj[1][i]][j]==n)
			{
				cout<<"POSSIBLE"<<endl;
				return 0;
			}
		}
	}
	cout<<"IMPOSSIBLE"<<endl;
} 


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

long long N,M,a[1010][3],ans=-(1LL<<60);

int main(){
    cin>>N>>M;
    for(int i=0;i<N;i++){
        for(int j=0;j<3;j++){
            cin>>a[i][j];
        }
    }
    for(int bit=0;bit<8;bit++){
        vector<long long>v;
        for(int i=0;i<N;i++){
            long long s=0;
            for(int j=0;j<3;j++){
                if(bit&(1<<j)){
                    s+=a[i][j];
                }else{
                    s-=a[i][j];
                }
            }
            v.push_back(s);
        }
        sort(v.begin(),v.end());
        reverse(v.begin(),v.end());
        long long mx=0;
        for(int i=0;i<M;i++){
            mx+=v[i];
        }
        ans=max(ans,mx);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define For(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define all(x) x.begin(),x.end()
#define sz(x) ((int)x.size())
#define MOD (ll)(1e9+7)
#define INF 1e17
#define int ll
#define EPS (1e-6)
using namespace std;
using ll=long long;
using pii=pair<int,int>;

int gcd(int a,int b) { return b==0?a:gcd(b,a%b); }
int lcm(int a,int b) { return a/gcd(a,b)*b; }

int fpow(int b,int p)
{
	if(p==0) return 1;
	int h=fpow(b,p/2);
	if(p%2) return h*b%MOD*h%MOD;
	return h*h%MOD;
}

int32_t main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	int n,a,b; cin>>n>>a>>b;
	int l; cin>>l;
	int t;
	int ans=0;
	For(i,1,n-1){
		cin>>t;
		if((t-l)*a<=b) ans+=(t-l)*a;
		else ans+=b;
		l=t;
	}
	cout<<ans<<"\n";
	return 0;
}





























Measured memory_bytes: 256
import java.util.Scanner;
 
public class Main {
 
	static int ans;
 
	public static void main(String[] args) {
 
		Scanner sc = new Scanner(System.in);
 
		int N = sc.nextInt();
		int K = sc.nextInt();
		int s = sc.nextInt();
		int p = sc.nextInt();
		int r = sc.nextInt();
 
		String T = sc.next();
 
		ans = 0;
 
		boolean[] skipped = new boolean[N + 1];
 
		for (int i = 0; i < N; i++) {
			if (i < K || T.charAt(i - K) != T.charAt(i) || skipped[i - K]) {
				switch (T.charAt(i)) {
					case 'p':
						ans += p;
						break;
					case 'r':
						ans += r;
						break;
					case 's':
						ans += s;
						break;
					default:
				}
			} else if (i >= K) {
				skipped[i] = true;
			}
		}
 
		System.out.println(ans);
	}
}

Measured memory_bytes: 39860
#include <bits/stdc++.h>
using namespace std;
#define rep(i,c) for(int i=0;i<c;++i)
int main(){
 string s;
 cin >> s;
 if(s[0]!=s[1]&&s[1]!=s[2]&&s[0]!=s[2]){
     cout << "Yes" << endl;
 }else{
     cout << "No" << endl;
 }
 return 0;
}

Measured memory_bytes: 256
isLeapYear y | y`mod`400==0 = True
             | y`mod`100==0 = False
             | y`mod`4==0   = True
             | otherwise    = False

leapYears [a,b] = let ly = [show y|y<-[a..b],isLeapYear y]
                  in if length ly == 0
                      then ["NA\n"]
                      else ly ++ [""]

main = getContents>>=mapM_ putStrLn.init.concat.map (leapYears.map(read::String->Int).words).init.lines

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


void solve() {
  int A,B,C;
  scanf("%d %d %d", &A,&B,&C);
  int min = C-(A-B);
  if (min<0) {
    min = 0;
  }
  cout << min << "\n";
}

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


Measured memory_bytes: 256
n = gets.to_i
ary = []

n.times do
  ary << gets.to_i
end

maxaL = []
maxaR = []

maxL = 0
maxR = 0

n.times do |i|
  maxL = [maxL, ary[i]].max
  maxR = [maxR, ary[n - i - 1]].max
  maxaL << maxL
  maxaR << maxR
end
maxaR.reverse!
maxaL.unshift(0)
maxaL.push(0)

maxaR.unshift(0)
maxaR.push(0)

ans = 0
tmp = 0

for i in 1 .. n
  puts [maxaL[i - 1], maxaR[i + 1]].max
end


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

int main()
{
    int n, x;
    cin >> n >> x;
    vector<int> a(n);
    ll ans = 0;
    rep(i, n) cin >> a[i];
    rep(i, n - 1)
    {
        if (a[i + 1] + a[i] > x)
        {
            int count = a[i + 1] + a[i] - x;
            ans += count;
            a[i + 1] -= count;
            if (a[i + 1] < 0)
                a[i + 1] = 0;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 640
#include<bits//stdc++.h>
using namespace std;
int dp[160][1010][1010];


int main(){
    int q;
    cin >> q;
    string a[q],b[q];
    for(int i = 0; i < q; i++){
        cin >> a[i] >> b[i]; 
    }

    for(int i = 0; i < q; i++){
        for(int j = 0; j < a[i].size(); j++){
            for(int k = 0; k < b[i].size(); k++){
                dp[i][j][k] = 0;
            }
        } 
    }


    int match = 0;
    int value = 0;
    for(int i = 0; i < q; i++){
        for(int j = 1; j < a[i].size() + 1; j++){
            for(int k = 1; k < b[i].size() + 1; k++){
                if(a[i][j - 1] == b[i][k - 1]) match = 1;
                else match = 0;
                value = max({dp[i][j - 1][k - 1] + match, dp[i][j - 1][k], dp[i][j][k - 1]});
                dp[i][j][k] = value;
            }
        } 
    }
    for(int i = 0; i < q; i++){
        cout << dp[i][a[i].size()][b[i].size()] << endl;
    }
    return 0;
}


Measured memory_bytes: 82280
#include <bits/stdc++.h>
#define ALL(e) e.begin(), e.end()
#define RALL(e) e.rbegin(), e.rend()
#define mp(a, b) make_pair(a, b)
#define pb push_back
#define dbg(x) (cerr << #x << ":" << x << endl)
#define mid (l + r) / 2
#define pii pair <int, int>
#define fi first
#define sc second
#define N 1000000009

using namespace std;

#define int long long

signed main(){
	ios::sync_with_stdio(0);
	int h;
	cin >> h;

	int lg = 0;

	while(h > 0){
		h /= 2;
		lg++;
	}

	cout << fixed << (int)pow(2, lg) - 1 << endl;

	return 0;
}

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

const int MAX_M = 100000;

int N, M;
int a[MAX_M], b[MAX_M];
pair<int, int> itv[MAX_M];

int main() {
    cin >> N >> M;
    for (int i = 0; i < M; i++) cin >> a[i] >> b[i];
    for (int i = 0; i < M; i++) {
        itv[i].first = b[i];
        itv[i].second = a[i];
    }
    sort(itv, itv + M);
    int ans = 0, B = 0;
    for (int i = 0; i < M; i++) {
        if (B < itv[i].second) {
            ans++;
            B = itv[i].first - 1;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string s;
  cin >> s;
  
  if(s[0]=='R'&&s[1]=='R'&&s[2]=='R') cout << '3' << endl;
  else if(s[0]=='R'&&s[1]=='R') cout << '2' << endl;
  else if(s[1]=='R'&&s[2]=='R') cout << '2' << endl;
  else if(s[0]=='R') cout << '1' << endl;
  else if(s[1]=='R') cout << '1' << endl;
  else if(s[2]=='R') cout << '1' << endl;
  else cout << '0' << endl;
}

Measured memory_bytes: 3580
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const int iinf = 1 << 28;
const long long llinf = 1ll << 60;
const double PI = 3.14159265;

void work() {
    vector<int> v{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 a; cin>>a;
    cout << v[a-1] << endl;
}

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    work();
    return 0;
}


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

using namespace std;
#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

typedef long long ll; typedef vector<int> VI; typedef pair<int,int> pii;
const int mod = (int)1e9 + 7;
void dbg(){ cerr << "\n"; }  
template <typename T,typename ...T2> void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }


int main()
{
	//cin.tie(0); ios_base::sync_with_stdio(false);
	int n;
	cin >>n;
	vector<int> a(n);
	rep(i,n) cin >>a[i];
	
	sort(all(a));
	if(n==2){
		cout <<a[1] <<" "<<a[0] <<"\n";
		return 0;
	}
	int sn = a[n-1];
	set<int> st;
	rep(i,n) st.insert(a[i]);
	
	int ps= lower_bound(all(a), a[n-1]/2) - a.begin();
	ll mn=1LL<<50; int ans =0;
	rep(i, 3){
		int cnd=-1, cnd2=-1;
		if(ps+i <n && st.count(a[ps+i])){
			//cout <<a[n-1] <<" "<< a[ps+i] <<"\n";
			cnd = ps+i;
		}
		if(ps-i >=0 && st.count(a[ps-i])){
			//cout <<a[n-1] <<" "<< a[ps-i] <<"\n";
			cnd2=ps-i;
		}
		if(cnd >=0 && abs(a[n-1] - 2*a[cnd]) < mn){
			mn = abs(a[n-1] - 2*a[cnd]); ans = cnd;
		}
		if(cnd2 >=0 && abs(a[n-1] - 2*a[cnd2]) < mn){
			mn = abs(a[n-1] - 2*a[cnd2]); ans = cnd2;
		}
		
	}
	
	cout << a[n-1] <<" " <<a[ans] <<"\n";
	
	return 0;
	
}


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

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

using namespace std;

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

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

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

void solve() {
  i64 a, v, b, w, t;
  cin >> a >> v >> b >> w >> t;
  if (a > b) swap(a, b);
  if (a + v * t >= b + w * t) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <numeric>
#include <math.h>
#include <stdio.h>
#include <climits>
#include <cfloat>
#include <string>
#include <unordered_map>
using namespace std;

int main(){
	long long int a, b, n;
	cin >> a >> b >> n;
	long long int x;
	if(n < b){
		x = n;
	}else{
		if(n%b == b-1){
			x = (n/b+1)*b - 1;
		}else{
			x = (n/b)*b - 1;
		}
	}
	long long int ans = (a*x)/b - a*(x/b);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3596
#define _USE_MATH_DEFINES
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <list>
#include <queue>
#include <deque>
#include <algorithm>
#include <numeric>
#include <utility>
#include <complex>
#include <functional>
#include <typeinfo>

#define REP(i, x) for (int i = 0; i < (int)(x); i++)
#define REP1(i, x) for (int i = 1; i <= (int)(x); i++)
#define RREP(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define RREP1(i, x) for (int i = ((int)(x)); i > 0; i--)
/*
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
struct edge { int u, v; ll w; };

#define all(x) (x).begin(),(x).end()
*/

using namespace std;

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

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

    int ans = 0;

    int a[105];
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    sort(a, a + n);
    for (int i = 0; i < n; i++)
    {
        x -= a[i];
        if (x >= 0)
            ans++;
        else
            break;
    }
    if(x>0)
        ans--;

    cout << ans;
}

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

using namespace std;

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define MOD 1000000007
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)

signed main(){

    string s;
    cin>>s;
    s.push_back('F');
    s.push_back('F');
    s.push_back('F');

    lli ans=0;

    lli aCnt=0;
    lli bcCnt=0;
    lli state=0;
    REP(i,0,s.size()-2){
        if(state==0){
            if(s.at(i)=='A')aCnt++;
            else{
                i--;
                state=1;
                continue;
            }
        }
        else{
            if(s.at(i)=='A'){
                state=0;
                ans += (aCnt*bcCnt);
                bcCnt=0;
                i--;
            }
            else if(s.at(i)=='B' && s.at(i+1)=='C'){
                bcCnt++;
                i++;
            }
            else{
                ans += (aCnt*bcCnt);
                aCnt=0;
                bcCnt=0;
                state=0;
            }
        }
    }
    cout<<ans<<endl;

	return 0;
}

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

using namespace std;

int main()
{
    long long a,b,k;  cin >> a >> b >> k;
    if(k >= a)  k-=a , a = 0;
    else   a-=k , k = 0;
    if(k >= b)  k-=b , b = 0;
    else   b-=k;
    cout << a << " " << b;
    return 0;
}


Measured memory_bytes: 256
//

#include <bits/stdc++.h>

using namespace std;

int main(void)
{
	long long x; cin>>x;
	long long ans = x /11;
	if(ans*11 == x){
		cout<<ans*2<<endl;
	}
	else if(x-ans*11 > 6){
		ans++;
		cout<<ans*2<<endl;
	}
	else{
		ans = ans*2;
		ans++;
		cout<<ans<<endl;
	}
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using ll=long long;
using namespace std;
#define rep_i(i, n) for (int i = 0; i < (n); ++i)
#define rep_ll(i, n) for (long long i = 0; i < (n); ++i)
#define r_rep_i(i, start, end) for (int i = (start); i < (end); ++i)
#define r_rep_ll(i, start, end) for (long long i = (start); i < (end); ++i)
#define debug_vi(v) copy((v).begin(), (v).end(), ostream_iterator<int>(cout, " "));
#define debug_vll(v) copy((v).begin(), (v).end(), ostream_iterator<long long>(cout, " "));
#define debug_vd(v) copy((v).begin(), (v).end(), ostream_iterator<double>(cout, " "));
#define sort_v(v) sort((v).begin(), (v).end()); //昇順
#define d_sort_vi(v) sort((v).begin(), (v).end(), greater<int>()); //降
#define d_sort_vd(v) sort((v).begin(), (v).end(), greater<double>()); //昇順
#define say(t) cout << (t) << endl;
#define sum_vi(v) accumulate((v).begin(), (v).end(), 0);
#define sum_vll(v)accumulate((v).begin(), (v).end(), 0LL);

ll gcd(ll a, ll b) { return b?gcd(b, a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a, b)*b;}
const int IINF=(1<<30);
const ll LLINF = 1LL<<60;


int main(){
  cin.tie(0);

  ios::sync_with_stdio(0);
  int n;
  cin >> n;
  vector<int> hoge(n);
  int tmp;
  bool f = true;
  rep_i(i, n){
    cin >> tmp;
    if(tmp % 2 == 0){
      if(tmp % 3 == 0 || tmp % 5 == 0){
        continue;
      }else{
        f = false;
      }
    }else{
      continue;
    }
  }
  if (f){
    cout << "APPROVED" << endl;
  }else{
    cout << "DENIED" << endl;
  }
  
}

Measured memory_bytes: 256
<?php
fscanf(STDIN, "%d %d %d", $K, $A, $B);
$bis = 1;
if ($A + 2 < $B) {
    // 操作回が$Kに達するか、$A枚になるまで叩く
    $hits = min($A - $bis, $K);
    $K -= $hits;
    $bis += $hits;
    if ($K != 0) {
        $ex = intdiv($K, 2);
        $bis += ($B - $A) * $ex;
        $K -= $ex * 2;
    }
    $bis += $K;
} else {
    $bis += $K;
}
echo $bis;


Measured memory_bytes: 4728
n=int(input())
a=list(map(int,input().split()))
cnt=0
maxi=0
for i in range(n-1):
    if a[i]>=a[i+1]:
        cnt+=1
        i+=1
    else:
        maxi=max(maxi,cnt)
        i+=1
        cnt=0
maxi=max(maxi,cnt)
print(maxi)

Measured memory_bytes: 63856
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
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 sum[100005];

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, q;
    string s;
    cin >> n >> q >> s;
    s += "!!";
    rep(i,n-1){
        if(s[i] == 'A' && s[i+1] == 'C') ++sum[i+2];
    }
    for(int i = 1; i <= n; ++i){
        sum[i] += sum[i-1];
    }
    rep(i,q){
        int l, r;
        cin >> l >> r;
        int ans = sum[r] - sum[l];
        cout << ans << endl;
    }
    return 0;
}


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

using namespace std;

int main() {
	int a, b, c;
	int min;
	cin >> a >> b >> c;
	min = a + b;
	if (min > a + c) {
		min = a + c;
	}
	if (min > b + c) {
		min = b + c;
	}

	cout << min << endl;
	return 0;

}

Measured memory_bytes: 256
using System;
using System.Linq;

namespace ABC170
{
    class C_ForbiddenList
    {
        static void Main(string[] args)
        {
            // 1行目の入力
            string[] input1 = Console.ReadLine().Split(' ');
            int x = int.Parse(input1[0]);
            int n = int.Parse(input1[1]);

            if (n == 0)
            {
                Console.WriteLine(x);
                return;
            }

            // 2行目の入力
            string[] input2 = Console.ReadLine().Split(' ');
            int[] p = new int[n];
            for(int i = 0; i < n; i++)
            {
                p[i] = int.Parse(input2[i]);
            }

            // 禁止リストを昇順にソート
            p = p.OrderBy(asc => asc).ToArray();
            // 禁止リストのインデックス
            int index = 0;

            // 答えになる値
            int ans = 0;
            for(int i = 1; i <= 101; i++)
            {
                // 答えになる値と基準値の差の絶対値
                int ansAbs = Math.Abs(x - ans);
                // 現在の値と基準値の差の絶対値
                int currentAbs = Math.Abs(x - i);
                // 現在の値のほうが基準値に近い場合
                if (currentAbs < ansAbs)
                {
                    // 現在の値と禁止リストの値が一致すれば
                    if (index < n && p[index] == i)
                    {
                        // インデックスを加算し、次の値の判定
                        index++;
                        continue;
                    }
                    ans = i;
                }
            }
            Console.WriteLine(ans);
        }
    }
}


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

int main() {

	int N;
	cin >> N;
	map<ll, ll> A; // (Aiが, n個）
	ll s = 0;
	for (int i = 0; i < N; i++) {
		ll a;
		cin >> a;
		A[a]++;
		s += a;
	}
	int Q;
	cin >> Q;
	for (int i = 0; i < Q; i++) {
		ll B, C;
		cin >> B >> C;
		ll n = A[B];
		A[B] = 0;
		A[C] += n;
		s = s - B * n + C * n;
		cout << s << endl;
	}
	return(0);
}


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

const int MAX_N = 200000;
int BIT[MAX_N + 1];
int A[MAX_N], unzip[MAX_N];
int N;
map<int, int> zip;

int sum(int i)
{
  i++;
  int s = 0;
  while (i > 0){
    s += BIT[i];
    i -= i & -i;
  }
  return s;
}

void add(int i, int x)
{
  i++;
  while (i <= N){
    BIT[i] += x;
    i += i & -i;
  }
}

int main()
{
  cin >> N;
  for (int i = 0; i < N; ++i){
    cin >> A[i];
    unzip[i] = A[i];
  }
  
  sort(unzip, unzip + N);
  for (int i = 0; i < N; i++){
    zip[unzip[i]] = i;
  }

  long long ans = 0;
  for (int j = 0; j < N; j++){
    ans += j - sum(zip[A[j]]);
    add(zip[A[j]], 1);
  }
  cout << ans << endl;

  return 0;
}

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

int main(){
  int n;
  cin >> n;
  int a[n+2], diff[n+2];
  a[0] = a[n+1] = 0;
  for ( int i = 1; i <= n; i++){
    cin >> a[i];
  }
  int sum = 0;
  for ( int i = 1; i <= n+1; i++){
    diff[i] = abs(a[i] - a[i-1]);
    sum += diff[i];
  }

  int ans;
  for ( int i = 1; i <= n; i++){
    ans = sum - diff[i] - diff[i+1] + abs(a[i+1] - a[i-1]);
    cout << ans << endl;
  }

  return 0;
}

Measured memory_bytes: 2048
//一番最初のAと一番最後のZを記録する.
#include<iostream>
using namespace std;
int main(){
  string s; cin >> s;
  int A_p=999999,Z_p=0;
  for(int i=0;i<s.size();i++){
    if(s[i]=='A'){
      if(i+1 < A_p) A_p = i+1;
    }
    if(s[i]=='Z'){
      if(i+1 > Z_p) Z_p = i+1;
    }
  }
  cout << Z_p - A_p + 1 << endl;
  return 0;
}

Measured memory_bytes: 640
# n, m, l = map(int, input().split())

# list_n = list(map(int, input().split()))

# n = input()
# list = [input() for i in range(N)

# list = [[i for i in range(N)] for _ in range(M)]

# import sys
# input = sys.stdin.readline

A = int(input())
B = int(input())

if A > B:
    print("GREATER")
elif B > A:
    print("LESS")
else:
    print("EQUAL")


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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}


signed main(){
    string a,b,c;
    cin>>a>>b>>c;
    if(a[a.size()-1]==b[0]&&b[b.size()-1]==c[0])cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
    return 0;
}


Measured memory_bytes: 256
import math


def main(a, b, c, d):
    tkhs = math.ceil(a / d)
    aok = math.ceil(c / b)

    if tkhs >= aok:
        return 'Yes'
    else:
        return 'No'


if __name__ == '__main__':
    A, B, C, D = map(int, input().split(' '))
    print(main(A, B, C, D))


Measured memory_bytes: 9188
#include<bits/stdc++.h>
#define fu(i,r,t) for(int i=r;i<=t;i++)
#define fd(i,r,t) for(int i=r;i>=t;i--)
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long
#define endl '\n'
using namespace std;
const int INF=1e17+5;
const int maxn=1e5+5;
int n,m,a[maxn],b[maxn],ans,sum;
vector<int>t;
int32_t main()
{
    IOS;
    cin>>n>>m;
    fu(i,n,min(m,n+2018))
    {
        t.push_back(i%2019);
    }
    ans=INF;
    for(auto i:t)
    {
        for(auto j:t)
        {
            if(i==j)continue;
            ans=min(ans,((i*j)%2019));
        }
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template<class T> ostream& operator<<(ostream &os, vector<T> V) { os << "[ "; 
  for(auto v:V)os << v << " "; return os << "]";
}
template<class T> ostream& operator<<(ostream &os, set<T> S){ os << "{ "; 
  for(auto s:S) os<<s<<" ";  return os<<"}"; 
}
template<class L, class R> ostream& operator<<(ostream &os, pair<L,R> P) {
  return os<<"("<<P.first<<","<< P.second << ")";
}
template<class L, class R> ostream& operator<<(ostream &os, map<L,R> M) {
  os<<"{ ";for(auto m:M)os<<"("<<m.first<<":"<<m.second<<")";
  return os<<"}";
}
#define cerr cout
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...) 1
#endif
// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/tree_policy.hpp> 
// using namespace __gnu_pbds;
// #define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
// find_by_order(k)  returns iterator to kth element starting from 0;
// order_of_key(k) returns count of elements strictly smaller than k;
//For multiset use less_equal operator but it does support erase operations for multiset
#define ll long long
#define ld long double
#define vll vector<ll>
#define pll pair<ll,ll>
#define vpll vector<pll>
#define I insert 
#define pb push_back
#define F first
#define S second
#define endl "\n"
#define all(v) (v).begin(),(v).end()
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<pii,int> ppi;
typedef vector<pii> vpii;
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define mp make_pair


const int mod = 1e9+7;

inline int add(int a,int b){a+=b;if(a>=mod)a-=mod; return a;} 
inline int sub(int a,int b){a-=b;if(a<0) a += mod; return a;}
inline int mul(int a, int b){ return a*1ll*b%mod;}
inline int power(int x, ll y){
  int res = 1;
  while(y){
    if(y&1) res = mul(res , x);
    x = mul(x,x);
    y >>= 1;
  }
  return res;
}
const int N  = 2e5 + 100;
int A[N];

int main(){
  fio; cout<<fixed<<setprecision(25);	
  int ans = 0;
  int sm = 0;
  int n ; cin >> n;
  for(int i =1;i <= n ; ++i){
    cin >> A[i];
    sm = add(sm , A[i]);
  }
  for(int i = 1; i <= n;++i){
    ans = add(ans , mul(A[i], sub(sm , A[i])));
  }
  ans = mul(ans , power(2 , mod-2));
  
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 4376
#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef vector<double> Vec;
typedef vector<Vec> Mat;
typedef pair<ll,ll> P;
typedef pair<double,ll> Pd;
typedef pair<double,double> PD;
typedef priority_queue<P,vector<P>,greater<P> > P_queue;
typedef priority_queue<Pd,vector<Pd>,greater<Pd> > Pd_queue;

const ll MOD=998244353;
const ll mod=1000000007;
const ll INF=1e15;
const double DEL=1e-6;

#define _GLIBCXX_DEBUG
#define REP(i,a,b) for(int i=(int)a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define mp make_pair
#define ALL(a) a.begin(),a.end()
#define SORT(a) sort(ALL(a))
#define U_ERASE(V) V.erase(unique(ALL(V)), V.end());

void Add(ll &a, ll b){
    a=(a+b)%mod;
    return;
}

void Pro(ll &a, ll b){
    a=(a*b)%mod;
    return;
}

int main(){
    ll N; cin>>N;
    vec d(N); rep(i,N) cin>>d[i];
    ll S=0,T=0;
    for(auto e : d) Add(S,e);
    Pro(S,S);
    for(auto e : d) Add(T,e*e);
    Add(S,mod-T);
    if(S%2) S+=mod;
    cout<<S/2<<endl;
    
    
}

Measured memory_bytes: 4752
#include<bits/stdc++.h>
using namespace std;
char s[100005];
int main()
{
	scanf("%s",s);
	int l=strlen(s);
	int sum=0;
	for(int i=0;i<l;i++)
		if(s[i]!=s[i+1])
			sum++;
	printf("%d\n",sum-1);
	return 0;
}

Measured memory_bytes: 384
using System;
using System.Collections.Generic;
using System.Linq;

namespace _0546
{
    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {
                int n = int.Parse(Console.ReadLine());
                int k = int.Parse(Console.ReadLine());
                if (n == 0 && k == 0) break;
                string[] card = new string[n];
                for (int i = 0; i < n; i++) card[i] = Console.ReadLine();
                HashSet<string> set = new HashSet<string>();
                for (int i = 0; i < Math.Pow(n,k); i++)
                {
                    int a = i;
                    List<int> use = new List<int>();
                    bool flag = true;
                    for (int j = 0; j < k; j++)
                    {
                        if (use.Contains(a % n)) flag = false;
                        use.Add(a % n);
                        a /= n;
                    }
                    if (flag)
                    {
                        string s = "";
                        foreach (var item in use) s += card[item];
                        set.Add(s);
                    }
                }
                Console.WriteLine(set.Count());
            }
        }
    }
}


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

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;

const double PI = acos(-1);
#define MOD 1000000007

#define pb push_back
#define F first
#define S second
#define test int tc; cin>>tc; while(tc--)
#define forn(i,n) for(i=0;i<n;i++)
#define rforn(i,n) for(i=n-1;i>=0;i--)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define sz(x) x.size()
#define el <<'\n'
#define sp <<' '

#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (abs(a*b)/gcd(a,b))
#define sqr(a) (a*a)

#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);

main()
{
    ///optimize();
    ll n,m;
    while(cin>>n>>m){
        if(n>m) cout<<"safe" el;
        else cout<<"unsafe" el;
    }






}





///Brainless people are gonna understand this code.




///Brainless_Loco Terminates Here!


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

bool det[10];

int main()
{
    int N, M;
    scanf("%d %d", &N, &M);
    int keta[N];
    bool flg = true;
    for(int i = 0; i < M; ++i) {
        int s, c;
        scanf("%d %d", &s, &c);
        --s;
        if(!det[s]) { keta[s] = c; det[s] = true; continue; }
        // det[s] == true;
        if(keta[s] != c) { flg = false; }
    }
    if(det[0] && keta[0] == 0 && N > 1) { flg = false; }
    if(!det[0]) {
        if(N > 1) keta[0] = 1;
        else keta[0] = 0;
    }
    for(int i = 1; i < N; ++i) {
        if(!det[i]) keta[i] = 0;
    }
    int res = 0;
    for(int i = 0; i < N; ++i) {
        res *= 10;
        res += keta[i];
    }
    if(flg) { printf("%d\n", res); }
    else { printf("-1\n"); }
    return 0;
}

Measured memory_bytes: 256
s=list(input())
if(len(s)==1):
    print(0)
else:
    a=s[:]
    fir,sec=0,0
    for i in range(len(s)-1):
        if(s[i]==s[i+1]):
            s[i+1] = str(1 - (ord(s[i])-48))
            fir+=1
    for i in range(len(s)-1,0,-1):
        if(a[i]==a[i-1]):
            a[i-1] = str(1 - (ord(a[i])-48))
            sec+=1
    print(min(fir,sec))
    
    


Measured memory_bytes: 10156
#PypyでもTLE A[:half]のような箇所が遅い？
# -->二分探索のスタート地点を変えるだけで処理すると毎回新規リストを作らなくなる

N = int(input())
A = list(map(int, input().split()))
for i in range(1, N): #累積和
    A[i] += A[i - 1]

def calc(lb, ub):
    max_num = A[ub] #右端を最大値としてとる
    lb -= 1 #左端の一個前
    if lb == -1: #一個前がない
        min_num = 0 #最小値を0とする
    else: #一個前が存在する
        min_num = A[lb] #一個前を最小値とする
    total = A[ub] - min_num #最大値 - 最小値 = この範囲のトータル
    # print (total)
    while (ub - lb) > 1: #indexの差が1より大きいとき
        mid = (lb + ub)//2 #真ん中を定める
        if A[mid] - min_num > total/2: #真ん中までの和が全体の半分を超えているとき
            ub = mid #右半分を真ん中に移動
        else: #真ん中までの和が全体の半分に満たないとき
            lb = mid #左半分を真ん中に移動
    # print ('ub', ub)

    #一番近い場所の左右でより半分に近くなる方を求めて、その値を返す
    a1, b1 = A[ub] - min_num, max_num - A[ub]
    diff1 = abs(b1 - a1)
    # print ('diff1', diff1)
    a2, b2 = A[ub - 1] - min_num, max_num - A[ub - 1]
    diff2 = abs(b2 - a2)
    # print ('diff2', diff2)
    if diff2 < diff1:
        a1, b1 = a2, b2
    return a1, b1

# print (calc(A, 0))
# half = 2
# P, Q = calc(0, half - 1)
# print (P, Q)

ans = 10 ** 9 #大きな数を答えとしておく
for half in range(2, N - 1): #左側、右側それぞれに最低2つずつ成分を含む領域でのみ考える
    P, Q = calc(0, half - 1)
    R, S = calc(half, N - 1)
    # print (P, Q, R, S)
    tmp = max(P, Q, R, S) - min(P, Q, R, S)
    # print (tmp)
    ans = min(tmp, ans)

# print ('ans', ans)
print (ans)


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

int main() {
    int N;
    cin >> N;
    vector<int> A(N);
    for (int i = 0; i < N; i++)
        cin >> A[i];

    vector<int> L(N + 1), R(N + 1);
    L[0] = 0; R[N] = 0;
    for (int i = 0; i < N; i++)
        L[i + 1] = max(L[i], A[i]);
    for (int i = N - 1; i >= 0; i--)
        R[i] = max(R[i + 1], A[i]);

    for (int i = 0; i < N; i++) {
        int l = L[i];
        int r = R[i + 1];

        cout << max(l, r) << endl;
    }
    return 0;
}

Measured memory_bytes: 3968
#include <iostream>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <math.h>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <climits>
#include <bitset>
#include <list>
#include <map>
#include <set>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

int main(){
	int n;
	ll a, b;
	cin >> n >> a >> b;
	ll x[n];
	for(int i=0; i<n; i++) cin >> x[i];
	ll ans=0;
	for(int i=1; i<n; i++) ans+=min(a*(x[i]-x[i-1]), b);
	cout << ans << endl;
	return 0;
}

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

int main()
{
  int N;scanf("%d",&N);
  string ans="Yes";
  int t[N+1],x[N+1],y[N+1];
  for(int i=1;i<N+1;i++)scanf("%d %d %d",&t[i],&x[i],&y[i]);
  t[0]=0;x[0]=0;y[0]=0;
  for(int i=1;i<N+1;i++)
  {
    if(abs(x[i]-x[i-1])+abs(y[i]-y[i-1])>t[i]-t[i-1])ans="No";
    if((t[i]-t[i-1]-abs(x[i]-x[i-1])-abs(y[i]-y[i-1]))%2==1)ans="No";
  }
  cout<<ans<<endl;
}

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

int card[1000], tmp[1000], n, r;
int main()
{
loop:
  cin >> n >> r;
  if(!n && !r)
    return 0;
  for(int i = n; i > 0; i--)
    card[n - i] = i;
  for(int i = 0; i < r; i++)
  {
    int c, p;
    cin >> p >> c;
    for(int j = 0; j < p - 1; j++)
      tmp[j] = card[j];
    for(int j = 0; j < c; j++)
      card[j] = card[j + p - 1];
    for(int j = 0; j < p - 1; j++)
      card[j + c] = tmp[j];
  }
  cout << card[0] << endl;
  goto loop;
}

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

int main()
{
  int n; cin >> n;
  unordered_map<int, int> um;
  
  while (n--)
  {
    int a; cin >> a;
    if (um.find(a) != um.end())
    {
      cout << "NO" << endl;
      return 0;
    }
    um[a] = 1;
  }
  
  cout << "YES" << endl;
}

Measured memory_bytes: 8520
#include <iostream>
#include<algorithm>
#include<cmath>
#include <string>

 int main (){

	 int a, b, c;

	 std::cin >> a >> b >> c;

	 if (c - b - a <= 0) {
		 std::cout << "Yes" << std::endl;
		 return 0;
	 }

	 std::cout << "No" << std::endl;

	 return 0;
}

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

using namespace std;

int main() {
	int n;
	cin >> n;
	vector<int> a(n);
	for (int i = n-1; i >= 0; --i) {
		cin >> a[i];
	}
	cout << a[0];
	for (int i = 1; i < n; ++i) {
		cout << ' ' << a[i];
	}
	cout << endl;
}


Measured memory_bytes: 3064
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <climits>
#include <iomanip>
#include <bitset>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <list>
#include <map>
#include <unordered_map>

using namespace std;

const int N = 200005;

int n;
int arr[N];

bool ok(int x) {
  map <int, int> cnt;
  for (int i = 1; i < n; i++) {
    if (arr[i] <= arr[i - 1]) {
      int ce = arr[i];
      while (!cnt.empty() && (--cnt.end())->first > ce) {
        cnt.erase(--cnt.end());
      }
      cnt[ce]++;
      while (cnt[ce] >= x) {
        cnt.erase(ce--);
        cnt[ce]++;
        if (ce == 0) return 0;
      }
    }
  }
  return 1;
}

int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  bool ww = 1;
  for (int i = 1; i < n; i++) {
    if (arr[i] <= arr[i - 1]) {
      ww = 0;
    }
  }
  if (ww) {
    cout << 1 << endl;
    return 0;
  }
  int l = 1, r = 1e9;
  while (l + 1 < r) {
    int mid = (l + r) >> 1;
    if (ok(mid)) {
      r = mid;
    } else {
      l = mid;
    }
  }
  cout << r << endl;
  return 0;
}


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

int abc114_b(){
    // 入力
    long int s;
    int ss[8]={999,999,999,999,999,999,999,999};
    cin >> s;
    
    for(int i=0 ; i<8 ; ++i){
        ss[i] = abs(753 - (s%1000));
        s /= 10;
        if(s<100) break;
    }
    sort(ss,ss+8);
    int ans = ss[0];
    
    cout << ans <<endl;
    return 0;
}

int main() {
    abc114_b();
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std; 
int main() {
    int n, k;
    cin>>n>>k;
    int a[n];
    for (int i = 0; i < n; i++) {
        cin>>a[i];
    }
    vector<int> dp(n, INT_MAX);
    dp[0] = 0;
    for(int i=0; i<n; i++) {
		for(int j = i + 1; j <= i + k; j++) {
			if(j<n) {
				dp[j]=min(dp[j], dp[i]+abs(a[j]-a[i]));
			}
		}
	}
	cout<<dp[n - 1];
    return 0; 
}

Measured memory_bytes: 1024