akhauriyash/Code-Regression huggingface dataset:
import java.io.InputStream;
import java.io.PrintWriter;
import java.lang.reflect.Array;
import java.math.BigDecimal;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Scanner;
import java.util.Set;
import java.util.Stack;
import java.util.TreeMap;
import java.util.TreeSet;

import static java.util.Comparator.*;

public class Main {
    public static void main(String[] args) {
        PrintWriter out = new PrintWriter(System.out);
        Solver solver = new Solver(System.in, out);
        solver.solve();
        out.close();
    }
}
class Solver {
	Scanner sc;
	PrintWriter out;
    public Solver(InputStream in, PrintWriter out) {
    	sc = new Scanner(in);
    	this.out = out;
    }
    // ==================================================================
    public void solve() {
    	int X = Integer.parseInt(sc.next());
    	int Y = Integer.parseInt(sc.next());
    	int Z = Integer.parseInt(sc.next());
    	int K = Integer.parseInt(sc.next());
    	long[] A = new long[X];
    	for (int i = 0; i < X; i++) {
			A[i] = Long.parseLong(sc.next());
		}
    	long[] B = new long[Y];
    	for (int i = 0; i < Y; i++) {
			B[i] = Long.parseLong(sc.next());
		}
    	long[] C = new long[Z];
    	for (int i = 0; i < Z; i++) {
			C[i] = Long.parseLong(sc.next());
		}
    	long[] AB = new long[1000*1000];
    	int kk = 0;
    	for (int i = 0; i < X; i++) {
			for (int j = 0; j < Y; j++) {
				AB[kk] = A[i] + B[j];
//				out.println("AB[" + kk + "] = " + AB[kk] 
//						+ "  A[" + i + "] = " + A[i]
//						+ "  B[" + j + "] = " + B[j]);
				kk++;
			}
		}
    	Arrays.sort(AB);
    	long[] ABC = new long[3000 * 1000];
    	kk = 0;
    	for (int i = AB.length -1; i >= Math.max(0, AB.length - 3000) ; i--) {
			for (int j = 0; j < Z; j++) {
				ABC[kk] = AB[i] + C[j];
//				out.println("ABC[" + kk + "] = " + ABC[kk] 
//						+ "  AB[" + i + "] = " + AB[i]
//						+ "  C[" + j + "] = " + C[j]);
				kk++;
			}
		}
    	Arrays.sort(ABC);
    	for (int i = ABC.length - 1; i >= Math.max(0, ABC.length - K) ; i--) {
			out.println(ABC[i]);
		}
    }
}



Measured memory_bytes: 62728
#include <algorithm>
#include <cmath>
#include <iostream>
#include <vector>
using namespace std;
int main(int, char**)
{
	int n;
	cin >> n;
	vector<int> h(n), a(n);
	for (int i = 0; i < n; ++i)
	{
		cin >> h[i];
	}
	a[0] = 0;
	a[1] = abs(h[1] - h[0]);
	for (int i = 2; i < n; ++i)
	{
		a[i] = min({abs(h[i] - h[i - 1]) + a[i - 1], abs(h[i] - h[i - 2]) + a[i - 2]});
	}
	cout << a[n - 1] << endl;
	return 0;
}


Measured memory_bytes: 1024
import sys
readline = sys.stdin.buffer.readline

n, m = map(int, readline().split())
ac_lst = [False] * (n + 1)
wa_lst = [0] * (n + 1)
ac = w = 0
for _ in range(m):
    a, b = readline().split()
    a = int(a)
    if ac_lst[a]:
        continue
    if b == b'WA':
        wa_lst[a] += 1
    else:
        ac += 1
        w += wa_lst[a]
        ac_lst[a] = True
print(ac, w)


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

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

	while(true){
		c=c-b ;
		if(c<=0){
			cout<<"Yes" ;
			return  ;
		}

		a=a-d ;
		if(a<=0){
			cout<<"No" ;
			return  ;
		}

	}

}

int main(){

	int y ;

	y=1 ;
	//cin>>y ;

	while(y--)
	{	
		solve() ;
	}

}

Measured memory_bytes: 3628
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#define print(n) std::cout << n << std::endl
#define FOR(i,n) for(int i = 0; i < n; i++)
using namespace std;

int main(){
    int x,a,b;
    cin >> x >> a >> b;
    if(abs(x-a) < abs(x-b))print("A");
    else print("B");
}


Measured memory_bytes: 256
M[30];D(i,n,d){for(M[d]=(d>0&&M[d-1]<n)?M[d-1]:n;M[d]>0;M[d]--)if(n>M[d])D(i,n-M[d],d+1);else for(i=0;i<=d;i++)printf(d-i?"%d ":"%d\n",M[i]);}main(n){for(;scanf("%d",&n),n;)D(0,n,0);exit(0);}

Measured memory_bytes: 600
import java.util.*;
import java.io.*;

public class Main {
	
	public void solve() throws IOException{
		boolean flag = false;
		while( stdIn.hasNext() ){
			if( flag ){
				writer.println();
			}
			flag = true;
			String str = stdIn.next();
			char[][] result = new char[5][8];
			for(int i = 0; i < 5; i++){
				result[i][0] = ' ';
				result[i][1] = ' ';
				result[i][2] = '=';
				result[i][3] = '*';
				result[i][4] = '*';
				result[i][5] = '*';
				result[i][6] = '*';
				result[i][7] = '*';
			}
			int n = 5-str.length();
			int temp = n;
			while( n-- > 0 ){
				result[n][0] = '*';
				result[n][3] = ' ';
			}
			for(int i = 0; i < str.length(); i++){
				int x = str.charAt(i)-'0';
				int a = x/5;
				result[i+temp][a] = '*';
				int b = x%5+3;
				result[i+temp][b] = ' ';
			}
			for(int i = 0; i < 8; i++){
				for(int j = 0; j < 5; j++){
					writer.print(result[j][i]);
				}
				writer.println();
			}
		}
		writer.flush();
	}
			
	public static void main (String args[]) throws IOException{
		new Main().run();
	}
	
	Scanner stdIn;
	PrintWriter writer;
	
	public void run() throws IOException{
		stdIn = null;
		try{
			stdIn = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
			writer = new PrintWriter(System.out);
			solve();
			stdIn.close();
			writer.close();
		} catch (Exception e){
			e.printStackTrace();
			System.exit(1);
		}
	}
}

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

using namespace std;

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

    if(S == "Sunny"){
        cout << "Cloudy" << endl;
    }
    else if(S == "Cloudy"){
        cout << "Rainy" << endl;
    }
    else{
        cout << "Sunny" << endl;
    }
}

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

int main() {
  string s;
  cin >> s;
  string oi, io;
  for (int i = 0; i < s.size(); i++) {
    if (i % 2 == 1) {
      oi.push_back('0');
    } else {
      oi.push_back('1');
    }
  }

  for (int i = 0; i < s.size(); i++) {
    if (i % 2 == 1) {
      io.push_back('1');
    } else {
      io.push_back('0');
    }
  }

  int cnt_oi = 0, cnt_io = 0;
  for (int i = 0; i < s.size(); i++) {
    if (s.at(i) != oi.at(i)) cnt_oi++;
    if (s.at(i) != io.at(i)) cnt_io++;
  }

  cout << min(cnt_oi, cnt_io) << endl;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define np next_permutation
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define pi acos(-1.0)
const ll INF = 1LL<<61;
template<class T>bool chmax(T &a, const T &b) { 
  if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) {
  if (b<a) { a=b; return 1; } return 0; }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
ll jou(ll N, ll P){if(P==0) return 1;
  if(P%2==0){ll t = jou(N, P/2);return t*t % mod;
  }return (N * jou(N, P-1)) % mod;}  //jou(n,mod-2)で逆元
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'大文字'+=32;    で小文字に
//  cout << fixed << setprecision (20);   小数点以下2０桁まで
//実行時間制約2秒では２×10^8回くらいまで計算できる




int main(){
  int n,m;
  string s;
  cin>>n>>m>>s;

  vector<int> p(n);
  int cnt=0;
  p[0]=0;
  repo(i,n){
    if(s[i-1]=='A'&&s[i]=='C') cnt++;
    p[i]=cnt;
  }

  rep(i,m){
    int l,r;
    cin>>l>>r;
    l--;r--;
    cout << p[r]-p[l] << endl;
  }

}

Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
int temp;
int a,b,c,x;
int main()
{
    cin>>a>>b>>c>>x;
    for(int i=0;i<=a;i++)
	  for(int j=0;j<=b;j++)
	    for(int k=0;k<=c;k++)
		  {
		  	if(i*500+j*100+k*50==x)
		  	  temp++;
		  } 
	cout<<temp;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF 1e18
#define PI M_PI
#define ll long long
#define vi vector<int>
#define all(v) v.begin(), v.end()
#define REP(i, n) for (int i=0; i<n; i++)
#define REPD(i, n) for (int i=n-1; i>=0; i--)
#define print(x) cout << x << endl;
#define debug(x) cout << #x << " = " << endl;

using namespace std;

void solve()
{
    string S;
    cin >> S;
    sort(S.begin(), S.end());
    if ((S[0] == S[1]) && (S[2] == S[3]) && (S[1] != S[2])) {
        print("Yes");
    } else {
        print("No");
    }
}

int main()
{
    solve();

    return 0;
}


Measured memory_bytes: 256
A[20000];z(int*a,int*b){return*b-*a;}
main(n,i,j){for(;scanf("%d",&n),n;puts(i>n?"No":"Yes")){
for(i=0;i<n*2;i++)scanf("%d",A+i);
for(i=qsort(A,n,4,z);i<n;A[i++]?i=n+1:1)for(j=0;j<n;j++)if(A[j+n])A[i]--,A[j+n]--;
}exit(0);}

Measured memory_bytes: 728
#include<bits/stdc++.h>
#define mod 1000000007
using namespace std;
const int N = 21;
vector< int > g[N+5];
int dp[N+5][1<<N];
int a[N][N];
int main()
{
    int n;
    scanf("%d",&n);
    for(int i=1;i<(1<<n);i++)
    {
        int B = __builtin_popcount(i);
        g[B].push_back(i);
    }
    for(int i=0;i<n;i++)    for(int j=0;j<n;j++)    scanf("%d",&a[i][j]);
    dp[0][0] = 1;
    for(int i=0;i<n;i++)
    {
        for(auto &x:g[i+1])
        {
            for(int j=0;j<n;j++)
            {
                if(!((1<<j)&x)) continue;
                dp[i+1][x] = (dp[i+1][x]+a[i][j]*dp[i][x^(1<<j)])%mod;
            }
        }
    }
    printf("%d\n",dp[n][(1<<n)-1]);
    return 0;
}


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

int main()
{
	int n;
	cin >> n;
	vector<vector<int>> v(n,vector<int>(3));
	vector<vector<int>> dp(n, vector<int>(3));
	for (int i = 0; i < n; i++) {
		cin >> v[i][0] >> v[i][1] >> v[i][2];
	}
	dp[0][0] = v[0][0];
	dp[0][1] = v[0][1];
	dp[0][2] = v[0][2];
	for (int i = 1; i < n; i++) {
		for (int cas = 0; cas <= 2; cas++) {
			dp[i][cas] = max(dp[i - 1][(cas + 1) % 3], dp[i - 1][(cas + 2) % 3])+v[i][cas];
		}
	}
	cout<<max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]));
	
}


Measured memory_bytes: 13608
#include<bits/stdc++.h>
#define mod 1000000007
#define int long long int
#define phi 1.6180339
#define rep(i,n) for(auto i=0;i<(n);i++)
#define endl "\n"
#define For(i,a,b) for(auto i=(a);i<(b);i++)
#define op1 cin.tie(NULL)
#define op2 cout.tie(NULL)
#define op3 std::ios_base::sync_with_stdio(false)
#define MAXX 1000001
using namespace std;
vector<int> arr(MAXX);
void trozen()
{
    int a,b;
    //int n;
    //cin>>n;
    cin>>a>>b;
    int temp=__gcd(a,b);
    cout<<(a*b)/temp<<endl;
}
int32_t main()
{
    op1;op2;op3;
    /*#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif*/
    trozen();
    return 0;
}


Measured memory_bytes: 11020
from itertools import permutations
from math import factorial


def distance(x1, y1, x2, y2):
    return ((x1-x2)**2 + (y1-y2)**2)**0.5


N = int(input())

xs, ys = [], []
for _ in range(N):
    x, y = map(int, input().split())
    xs.append(x)
    ys.append(y)

res = 0
for perm in permutations(range(N), N):
    for i, j in zip(perm[:N-1], perm[1:]):
        res += distance(xs[i], ys[i], xs[j], ys[j])

print(res/factorial(N))


Measured memory_bytes: 3064
#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;

int n, x, y, d, c[2005];
int main() {
	int i, j;
	cin >> n >> x >> y;
	for(i=1; i<=n; i++) for(j=i+1; j<=n; j++) {
		d = min(j-i, min((int)abs(i-x) + (int)abs(j-y), (int)abs(i-y) + (int)abs(j-x)) + 1);
		c[d]++;
	}
	for(i=1; i<n; i++) cout << c[i] << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define rep(i,a,b) for(long long i=a; i<b; i+=1)
#define repr(i,a,b) for(long long i=a; i<=b; i+=1)
#define vec vector<ll>
#define map map<string,int>
#define repa(p,A) for(auto p:A)
#define pb push_back
#define sort(a) sort(a.begin(),a.end())
#define reverse(a) reverse(a.begin(),a.end())
 
using namespace std;
int gcd (int v , int w , int u) {
  for(int i=min(v,min(w,u)); i>=1; i-=1) {
    if(v%i==0 && w%i==0 && u%i==0) {
      return i;
    }
  }
};
    
int main() {
  ll N;
  cin>>N;
  int count=0;
  rep(i,1,N+1) {
    rep(j,1,N+1) {
      rep(k,1,N+1) {
        count+=gcd(i,j,k);
        
      }
    }
  }
  cout<<count<<endl;
  
  
  
  
}

Measured memory_bytes: 3624
#include<cstdio>
#include<iostream>
#include<string>
#include<cmath>
#include<cstring>
#include<algorithm>
using namespace std;
int h[100005],n,m,ans=0;
int cnt=0,head[100005]={},to[200005]={},nxt[200005]={};
void add(int x,int y)
{
	nxt[++cnt]=head[x];
	head[x]=cnt;
	to[cnt]=y;
}
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++)
		{
			scanf("%d",&h[i]);
		}
	for(int i=1,x,y;i<=m;i++)
		{
			scanf("%d%d",&x,&y);
			add(x,y);
			add(y,x);
		}
	for(int i=1;i<=n;i++)
		{
			int flag=0;
			for(int j=head[i];j;j=nxt[j])
				{
					if(h[to[j]]>=h[i])
						{
							flag=1;
							break;
						}
				}
			if(flag==0) ans++;
		}
	printf("%d\n",ans);
	return 0;
}


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

int main(){
  int n,q;
  cin >>n;
  int a[n];
  for (int i=0;i<n;i++) cin>>a[i];
  cin >>q;
  int b[q];
  for (int i=0;i<q;i++) cin >>b[i];
  int cnt=0;
  for (int i=0;i<q;i++){
    for (int j=0;j<n;j++){
      if(a[j]==b[i]){
        cnt++;
        break;
      }
    }
  }
  cout<<cnt<<endl;
  return 0;
}




Measured memory_bytes: 3112
X = int(input())
x = X % 100
A, a = x // 5, x % 5
B, b = a // 4, a % 4
C, c = b // 3, b % 3
D, d = c // 2, c % 2
E = d % 2
if(X - X % 100 >= 100 * (A + B + C + D + E)):
  print(1)
else:
  print(0)

Measured memory_bytes: 3060
#include<stdio.h>
#include<math.h>
#include<string.h>
#include<iostream>
#include<algorithm>
#include<vector>
#include<utility>
#include<stack>
#include<queue>
#include<map>
#include<set>

#define fi first
#define se second
#define long long long

using namespace std;

int main()
{
    //    freopen("input.in", "r", stdin);
    int n; scanf("%d", &n);
    int gan = 0;
    for(int i = 0; i < n; i++)
    {
        int x; scanf("%d", &x);
        gan += (x&1);
    }
    printf("%s\n", (gan&1)? "NO" : "YES");
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;


public class Main {

	/**
	 * @param args
	 * @throws IOException
	 * @throws NumberFormatException
	 */
	public static void main(String[] args) throws NumberFormatException, IOException {
		// TODO 自動生成されたメソッド・スタブ
		BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
		int set;
		List<String>list = new ArrayList<String>();

		set = Integer.parseInt(bufferedReader.readLine());

		for(int i = 0; i < set; i++) list.add(bufferedReader.readLine().replaceAll("Hoshino", "Hoshina"));
		for(String value: list)System.out.println(value);


	}

}

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

using namespace std;

int n, s;
int dp[11][101][11];
int solve(int i, int j, int k);

int main(void){
	
	while(cin >> n >> s){
		if(n == 0 && s == 0){break;}
		fill_n(**dp,11*101*11,-1);
		cout << solve(0,0,10) << endl;
	}
}

int solve(int now, int sum, int b1){
	if(now == n){
		if(sum == s){return 1;}
		else return 0;
	}
	if(dp[now][sum][b1] != -1){return dp[now][sum][b1];}
	int t = 0;
	for(int i = 0; i < 10; i++){
		if(b1 != 10 && b1 >= i){continue;}
		t += solve(now+1, sum + i, i);
	}
	return dp[now][sum][b1] = t;
}

Measured memory_bytes: 1208
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <sstream>
#include <math.h>
#include <queue>
#include <map>
#include <set>
#include <ios>     // std::left, std::right
#include <iomanip> // std::setw(int), std::setfill(char)
using namespace std;


int main(){
long long N,vm,tmp,tmp_n,ans;
cin>>N;
vector<long long> vn;
std::set<long long> s;
for(long long i=1;i*i<=N;++i){
    if(N%i==0){
        vn.push_back(i);
        vn.push_back(N/i);
    }
    if((N-1)%i==0){
        s.insert(i);
        s.insert((N-1)/i);
    }
}
sort(vn.begin(), vn.end());

//Kで一回は割れるときcheck

for(long long i=1;i<vn.size();++i){
    tmp=vn[i];
    tmp_n=N;
    while(tmp_n%tmp==0){
       tmp_n/=tmp; 
    }
    if((tmp_n-1)%tmp==0){
        s.insert(tmp);

    }
}

tmp=s.size();
ans=tmp-1;

cout<<ans<<"\n";

return 0;
}


Measured memory_bytes: 384
#define _USE_MATH_DEFINES
#include<iostream>
#include <iomanip>
#include<stdio.h>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include <queue>
#include <utility>
#include <map>
#include <set>
#include <deque>
#include <numeric>
using namespace std;

int main() {
    int N,K;
    cin >> N >> K;
    vector<int>l(N);
    for (int i = 0; i < N; i++) {
        cin >> l[i];
    }
    sort(l.begin(), l.end());
    int ans = 0;
    for (int i = 0; i < K; i++)ans += l[N - i - 1];

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define dbg(x) cout<<#x<<"="<<x
#define nl cout<<"\n"
#define frn(i,n) for(int i = 0;i < n;i++)
#define fr(i,a,b) for(int i = a;i < b;i++)
#define pb push_back
#define trav(x,c) for(auto &x:c)
using namespace std;
const int mod = 1e9+7;
int toint(string s) {
  int ans = 0;
  for(char x: s) ans = ans*10 + (x - '0');
  return ans;
}

int lcs(string a, string b) {
  int n = a.size(), m = b.size();
  int dp[2][m+1];
  for(int i = 0;i <= n;i++) {
    for(int j = 0;j <= m;j++) {
      if(i==0||j==0) dp[i%2][j] = 0;
      else {
        if(a[i-1] == b[j-1]) dp[i%2][j] = 1 + dp[1-i%2][j-1];
        else dp[i%2][j] = max(dp[i%2][j-1], dp[1-i%2][j]);
      }
    }
  }
  return dp[n%2][m];
}

int sum(int x) {
  int s = 0;
  while(x) {
    s += x%10;
    x /= 10;
  }
  return s;
} 

bool equal(string s) {
  for(int i = 0,j = s.size()/2;j < s.size();i++,j++) {
    if(s[i] != s[j]) return false;
  }
  return true;
}

ll fact(int n) {
  ll ans = 1;
  fr(i,2,n+1) ans = (ans*i)%mod;
  return ans;
}

int main() {
  int h,w;
  cin>>h>>w;
  string a[h];
  frn(i,h) cin>>a[i];
  frn(i,h) {cout<<a[i];nl;cout<<a[i];nl;}
}



Measured memory_bytes: 256
#include <stdio.h>
int main(void)
{
	int a,b,c,d;
	scanf("%d%d%d%d",&a,&b,&c,&d);
	if(c+d<a+b){
		printf("Left");
		return 0;
	}else if(a+b<c+d){
		printf("Right");
	}else{
		printf("Balanced");
	}
	

}

Measured memory_bytes: 128
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;

//typedef
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

//conversion
inline LL toLong(string s) {LL v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) LL((a).size())
#define EACH(i,c) for(auto i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define UNTIL(p) while(!(p))

//constant
const double EPS = 1e-5;
const double PI  = acos(-1.0);

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

#define PUTS(x) cout << (x) << endl;

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    LL n,k;
    cin>>n>>k;

    LL cmb = (n-1)*(n-2)/2;
    if(cmb < k){
        PUTS(-1);
        return 0;
    }

    LL m = n - 1 + cmb - k;
    PUTS(m);
    REP(i,n-1){
        printf("%d %d\n", 1, 2+i);
    }
    int x = 2;
    int y = 1;
    REP(i, cmb - k){
        printf("%d %d\n", x, x+y);
        if(x + y == n){
            x++;
            y = 1;
        }else{
            y++;
        }
    }

}

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

//type
#define ll long long
typedef pair<int, int> P;
//定数
#define INF 1000000000000 //10^12:∞
#define MOD 1000000007    //10^9+7:合同式の法
#define MAXR 100000       //10^5:配列の最大のrange
//略記
#define PB push_back //挿入
#define MP make_pair //pairのコンストラクタ
#define F first      //pairの一つ目の要素
#define S second     //pairの二つ目の要素
#define Z class
// OTHER
// xの二乗を返す (関数テンプレート版)
template <typename T>
T square(T x) { return x * x; }
#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))
// loop
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repd(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= (b); i++)
#define FORD(i, a, b) for (ll i = a; i >= (b); i--)
#define FORA(i, I) for (const auto &i : I)

// vector
#define ALL(x) x.begin(), x.end()

// output
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define isYES(x) printf("%s\n", (x) ? "YES" : "NO")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define ln cout << '\n'
template <Z A>
void pr(A a)
{
  cout << a;
  ln;
}
template <Z A, Z B>
void pr(A a, B b)
{
  cout << a << ' ';
}

int ans = 0;
bool check = 0;
string s, t;
int N = 3;
vector<int> v(N);
int a, b, c;
int x, y;
char ch;

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

int main()
{
cin >> a >> b;
if(a*500>=b)Yes();
else No();
}

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

class D
{
	static void Main()
	{
		p = Enumerable.Range(0, 51).Select(i => (long)Math.Pow(2, i + 1) - 1).ToArray();
		c = p.Select(v => 2 * v - 1).ToArray();
		var h = Console.ReadLine().Split().Select(long.Parse).ToArray();
		Console.WriteLine(Find(h[0], h[1]));
	}

	static long[] p, c;
	static long Find(long n, long x) =>
		n == 0 ? 1 :
		x <= 1 ? 0 :
		x <= c[n - 1] + 1 ? Find(n - 1, x - 1) :
		x <= c[n - 1] + 2 ? p[n - 1] + 1 :
		x <= c[n] - 1 ? p[n - 1] + 1 + Find(n - 1, x - c[n - 1] - 2) :
		p[n];
}


Measured memory_bytes: 13396
#include <iostream>
#include <cmath>
#include <iomanip>
#include <algorithm>
#include <map>
#include <string>
#include <cstring>
#include <vector>
#include <unordered_map>
using namespace std;
#define i64 int64_t
void agc26c()
{
  int N;
  string S;
  cin >> N >> S;
  string a, b;
  for (int i = 0; i < 2 * N; i++)
  {
    if (i < N)
      a += S[i];
    else
      b += S[i];
  }
  reverse(b.begin(), b.end());
  unordered_map<string, i64> ha, hb;
  for (int i = 0; i < (1 << N); i++)
  {
    string x = "", y = "";
    for (int j = 0; j < N; j++)
    {
      if (i & (1 << j))
        x += a[j];
      else
        y += a[j];
    }

    string temp = x + "," + y;
    auto itr = ha.find(temp);
    if (itr != ha.end())
    {
      itr->second++;
    }
    else
    {
      ha[temp] = 1;
    }
  }
  for (int i = 0; i < (1 << N); i++)
  {
    string x = "", y = "";
    for (int j = 0; j < N; j++)
    {
      if (i & (1 << j))
        x += b[j];
      else
        y += b[j];
    }

    string temp = x + "," + y;
    auto itr = hb.find(temp);
    if (itr != hb.end())
    {
      itr->second++;
    }
    else
      hb[temp] = 1;
  }
  i64 sum = 0;
  for (auto it = ha.begin(); it != ha.end(); it++)
  {
    bool flag = false;
    auto itr_2 = hb.find(it->first);
    if (itr_2 == hb.end())
      continue;
    if (it->first.substr(0, N / 2) == it->first.substr(N / 2 + 1, N / 2))
    {
      flag = true;
    }
    if (flag == true)
    {
      sum += it->second * itr_2->second;
    }
    else
    {
      sum += it->second * itr_2->second;
    }
  }
  cout << sum;
  return;
}
int main(void)
{
  agc26c();
  return 0;
}


Measured memory_bytes: 68468
#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<int, int> 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 main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    int n = s.size();
    s = "." + s;
    bool exist = true;
    if(s[1] == '0' || s[n] == '1') exist = false;
    for(int i = 1; i < n; ++i){
        if(s[i] != s[n-i]) exist = false;
    }
    if(!exist){
        cout << -1 << endl;
        return 0;
    }
    s[n] = '1';
    queue<int> ones;
    for(int i = 1; i <= n; ++i){
        if(s[i] == '1') ones.push(i);
    }
    for(int i = 1; i < n; ++i){
        if(i == ones.front()) ones.pop();
        cout << i << " " << ones.front() << endl;
    }
    return 0;
}

Measured memory_bytes: 1900
#include <iostream>
#include <cassert>
#include <climits>
#include <bitset>
#include <stack>
#include <queue>
#include <iomanip>
#include <limits>
#include <string>
#include <cmath>
#include <set>
#include <map>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string.h>

using namespace std;

typedef long long ll;
typedef pair<ll,ll> P;

long long int INF = 3e18;
long long int mod = 4294967296;
double Pi = 3.1415926535897932384626;

//vector<ll> G[500005];
//vector<P> tree[500010];
priority_queue <ll> pql;
priority_queue <P> pqp;
//big priority queue
priority_queue <ll,vector<ll>,greater<ll> > pqls;
priority_queue <P,vector<P>,greater<P> > pqps;
//small priority queue
//top pop

int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,-1,1};
char dir[] = "DRUL";
//ll bit[500005];
//↓,→,↑,←

#define p(x) cout<<x<<endl;
#define el cout<<endl;
#define pe(x) cout<<x<<" ";
#define ps(x) cout<<fixed<<setprecision(15)<<x<<endl;
#define pu(x) cout<<x;
#define re(i,n) for(i=0;i<n;i++);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define deba(x) cout<< #x << " = " << x <<endl

ll rui(ll abc,ll bed){
    //abcのbed乗を計算する
    if(bed==0){return 1;}
    else{
        ll ced = rui(abc,bed/2);
        ced *= ced;
        ced %= mod;
        if(bed%2==1){ced*=abc; ced%=mod;}
        return ced;
    }
}
ll gcd(ll number1,ll number2){
    if(number1 > number2){
        swap(number1,number2);
    }
    if(number1 == 0 || number1 == number2){
        return number2;
    }else{
        return gcd(number2 % number1,number1);
    }
}

ll i,j,k,ii,jj;
ll n,m,num,sum;
ll ans;
ll a,b,c,e,g,h,w,ok,ng;
ll x[100005],y[100005];
bool flag,dame;
char s[1000005];


int main(){
    cin >> n;
	x[0] = 0;
	x[n+1] = 0;
	for(i=1;i<=n;i++){
		cin >> x[i];
	}
	for(i=0;i<n+1;i++){
		if(x[i] < x[i+1]){
			a = x[i+1];
		}else if(x[i] > x[i+1]){
			ans += x[i] - x[i+1];
			a = x[i+1];
		}
	}
	p(ans);
	return 0;

}

Measured memory_bytes: 256
#include<cstdio>
int main(){
	int t;
	scanf("%d",&t);
	for(int i=0;i<t;i++){
		int n,d;
		int a[7];
		scanf("%d%d",&n,&d);
		a[0]=d/64;
		a[1]=(d%64)/32;
		a[2]=(d%32)/16;
		a[3]=(d%16)/8;
		a[4]=(d%8)/4;
		a[5]=(d%4)/2;
		a[6]=d%2;
		for(int j=0;j<=6;j++){
			if(a[j]==0){
				a[j]=(n/2)*2;
			}else{
				a[j]=((n-1)/2)*2+1;
			}
		}
		printf("%d\n",a[0]*64+a[1]*32+a[2]*16+a[3]*8+a[4]*4+a[5]*2+a[6]);
	}
	return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;
using namespace std;
/////////////////// TYPES & MACROS ///////////////////////////////
#define INFLL 0x3fffffffffffffffLL
#define INF 0x3f3fffff
#define mp make_pair
#define eb emplace_back
#define pb push_back
#define all(x) x.begin(),x.end()
#define exist(s,e) (s.find(e)!=s.end())
#define ff first
#define ss second
#define EPS 1e-8
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>ordered_set;
const ll MOD=1000000007;
/////////////////// DEBUG MODE ///////////////////////////////////
#define D(x) cerr<<"DEBUG: "<<#x<<" is: "<<x<<'\n'
#define er(args...) {string _s=#args; replace(all(_s),',',' ');\
stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args);}
void err(istream_iterator<string>) { cout<<endl;}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}
/////////////////// GLOBAL VARIABLES /////////////////////////////
vector<vector<ll>> adj; vector<bool> vis;
/////////////////// FUNCTIONS ////////////////////////////////////
ll mexp(ll x, ll n, ll m){
  ll res=1;  while(n){if(n&1) res=(res*x)%m;n>>=1; x=((x%m)*(x%m))%m;}
  return res;
}
bool ispow2(ll x){ return x && (!(x&(x-1)));}
typedef struct _dsu{
//DATA MEMBERS
  vector<int> par;
  vector<int> rank;
//MEMBER FUNCTIONS
  _dsu(int n){
    par.resize(n);
    rank.resize(n);
    for(int i=0;i<n;++i) {
      rank[i]=0;
      par[i]=i;
    }
  }
  int find(int x){
    return x==par[x]?x:par[x]=find(par[x]);
  }
  void merge(int x, int y){
    if(rank[find(x)]>rank[find(y)]) par[find(y)]=find(x);
    else par[find(x)]=find(y);
    if(rank[find(x)]==rank[find(y)]) rank[find(y)]++;}
} DSU;
/////////////////// MAIN STARTS //////////////////////////////////
int main(){
  ios::sync_with_stdio(0);  cin.tie(0); cout<<fixed;   cerr<<fixed;
  cout<<setprecision(14); cerr<<setprecision(3);
  #ifdef DEBUG
  freopen("ip.txt","r",stdin); //freopen("op.txt","w",stdout);
  clock_t tStart = clock();
  #endif


	int n,m,ct=0; cin>>n>>m; vector<int> p(n);
	for(int i=0;i<n;++i) {cin>>p[i]; --p[i];}

	adj.resize(n); DSU d(n); vis.assign(n,false);

	for(;m>0;--m){
		int x,y; cin>>x>>y; --x,--y;
		adj[x].eb(y); adj[y].eb(x);
	}
	for(int i=0;i<n;++i){
		if(vis[i]) continue;
		queue<int> q; q.push(i); vis[i]=true;
		while(!q.empty()){
			int u=q.front(); q.pop();
			for(auto v: adj[u]){
				if(vis[v]) continue;
				q.push(v); vis[v]=true;
				d.merge(u,v);
			}
		}
	}

	for(int i=0;i<n;++i){
		if(p[i]==i || d.find(i)==d.find(p[i]))++ct;
	}
	cout<<ct<<'\n';

	#ifdef DEBUG
	cerr<<"\nExecution time: "<<(((double)clock() - tStart)/CLOCKS_PER_SEC)*1e3<<"ms.\n";
	#endif
  return 0;
}


Measured memory_bytes: 7296
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key

typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef long double ld; 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;

const int SD = 1;
char a[501][501];
char b[501][501];
char grid[501][501];

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	srand(SD);
	int h, w; cin >> h >> w;
	for(int i=0;i<h;i++)
	{
		for(int j=0;j<w;j++)
		{
			a[i][j]=b[i][j]='.';
		}
	}
	for(int i = 0; i < h; i++)
	{
		for(int j = 0; j < w; j++)
		{
			cin >> grid[i][j];
			if(grid[i][j]=='#') a[i][j]=b[i][j]='#';
			if(j==0||j==w-1||i==0||i==h-1)
			{
				if(i==0)
				{
					a[i][j]='#';
				}
				else if(i==h-1)
				{
					b[i][j]='#';
				}
				else if(j==0)
				{
					a[i][j]='#';
				}
				else
				{
					b[i][j]='#';
				}
			}
			else
			{
				if(i&1) b[i][j]='#';
				else a[i][j]='#';
			}
		}
	}
	for(int i = 0; i < h; i++)
	{
		for(int j = 0; j < w; j++)
		{
			cout << a[i][j];
		}
		cout << '\n';
	}
	cout << '\n';
	for(int i = 0; i < h; i++)
	{
		for(int j = 0; j < w; j++)
		{
			cout << b[i][j];
		}
		cout << '\n';
	}
}	


Measured memory_bytes: 1536
#include<iostream>
#include<climits>
#include<vector>
#include<list>
#include<functional>
#include<algorithm>
#include<string>
#include<cmath>
#include<complex>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
#define INF (int)1e9
#define INFL (ll)1e11
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

const int p = 1000000007;

ll fac(int n) {
	if (n == 0) return 1;
	return n*fac(n - 1) % p;
}

ll pow(int a, int b) {
	if (b == 0) return 1;
	if (b % 2) return pow(a, b - 1)*a%p;
	ll tmp = pow(a, b / 2);
	tmp = tmp*tmp%p;
	return tmp;
}

ll inv(int a) {
	return pow(a, p - 2);
}

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

	int N;
	cin >> N;
	vector<ll> A(N);
	vector<ll> sum(N + 1, 0);
	REP(i, N) {
		cin >> A[i];
		sum[i + 1] = (sum[i] + inv(i + 1)) % p;
		//cout << sum[i + 1] << "\n";
	}
	ll res = 0;
	REP(i, N) {
		ll tmp = (sum[N - i] + sum[i + 1] - sum[1]) % p;
		tmp = tmp*A[i] % p;
		res += tmp;
		res %= p;
	}
	res *= fac(N);
	res %= p;
	cout << res << "\n";

	return 0;
}

Measured memory_bytes: 3328
#include <iostream>
#include <string>
#include <map>
using namespace std;

int main(){
  int n,q;
  cin >> n >> q;
  map<int,string> nm;
  nm[0] = "kogakubu10gokan";
  for(int i=0;i<n;i++){
    int num; string s;
    cin >> num >> s; nm[num] = s;
  }
  bool ju = true;
  map<int,string>::iterator itr = ++nm.begin();
  for(;itr!=nm.end();itr++){
    if(itr->first > q){
      cout << (--itr)->second << endl;
      ju = false; break;
    }
  }
  if(ju) cout << (--nm.end())->second << endl;
}

Measured memory_bytes: 1212
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define MOD 1000000007
#define MOD2 998244353
#define pb emplace_back
#define mp make_pair
#define all(v) v.begin(),v.end()
#define sz(x) (ll)x.size()
#define F first
#define S second
#define FOR(i,a,b) for(ll i=a;i<=b;++i)
#define ROF(i,a,b) for(ll i=a;i>=b;--i)
#define trace(x) cerr<<#x<<": "<<x<<'\n';
typedef long long ll;
using namespace std;
using namespace __gnu_pbds;
#define T int
#define ordered_set tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>
auto clk=clock();
 
ll mexp(ll a, ll b, ll m){
    ll ans=1;
    a%=m;
    while(b){
        if(b&1) ans=ans*a%m;
        b>>=1;
        a=a*a%m;
    }
    return ans;
}

int main(){
    IOS
    srand(chrono::high_resolution_clock::now().time_since_epoch().count());

    ll h;
    cin >> h;
    int lg = 0;
    while(h > 0){
        h /= 2;
        lg++;
    }
    cout << (1LL<<lg) - 1;

    cerr<<endl<<endl<<"Time: "<<fixed<<setprecision(12)<<(long double)(clock()-clk)/CLOCKS_PER_SEC<<" ms"<<endl<<endl;
 
    return 0;
}

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

#define rep(i, from, to) for (int i = from; i < (to); ++i)
#define trav(a, x) for (auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

int main() {
	cin.sync_with_stdio(false);
	cin.exceptions(cin.failbit);
	int N, C, K;
	cin >> N >> C >> K;
	vi T(N);
	rep(i,0,N) cin >> T[i];
	sort(all(T));
	int lastt = -1, bcount = 0;
	int buses = 0;
	trav(t, T) {
		if (lastt == -1) lastt = t;
		if (t - lastt > K || bcount == C) {
			lastt = t;
			bcount = 0;
			buses++;
		}
		bcount++;
	}
	buses++;
	cout << buses << endl;
	exit(0);
}

Measured memory_bytes: 640
from collections import Counter
N = int(input())
A = list(map(int,input().split()))
ac = Counter(A)
ans = 0
for i in range(max(A)+1):
    now = 0
    if i-1 in ac:
        now += ac[i-1]
    if i in ac:
        now += ac[i]
    if i+1 in ac:
        now += ac[i+1]
    ans = max(ans,now)
print(ans)

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

int main(){
  int N;
  string S;
  cin >> N >> S;
  int ans=1;
  for(int i=0; i<N-1; i++){
    if(S.at(i)!=S.at(i+1)) ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 512
#include<stdio.h>

int A[1000000];
int n;

int search(int key){
  int left = 0;
  int right = n;
  int mid;
  while( left < right ){
    mid = (left + right )/2;
    if ( key == A[mid] )
      return 1;
    if ( key > A[mid] )
      left = mid+1;
    else if ( key < A[mid] )
      right = mid;
  }
  return 0;
}

main(){
  int i, j, k, sum = 0;

  scanf("%d",&n);
  for ( i = 0 ; i < n ; i++ ) {
    scanf("%d", &A[i]);
  }

  scanf("%d",&j);
  for ( i = 0 ; i < j ; i++ ){
    scanf("%d",&k);
    if ( search( k ) )
      sum++;
  }
  printf("%d\n", sum);

  return 0;
}



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

int main()
{
    int a,b,c;
    scanf("%d%d%d",&a,&b,&c);
    printf("%d\n",max(max(a,b),c)-min(min(a,b),c));
    return 0;
}


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

int main() {
	int N, M, K;
	cin >> N >> M >> K;
	for (int i = 0;i <= N;i ++) {
		 for (int j = 0;j <= M;j ++) {
		 	if (i * M + j * N - i * j * 2 == K) {
				cout << "Yes";
				return 0;
		 	}
		 }
	}
	cout << "No";
	return 0;
}

Measured memory_bytes: 256
/*
AuThOr GaRyMr
*/
#include<bits/stdc++.h>
#define rb(a,b,c) for(int a=b;a<=c;++a)
#define rl(a,b,c) for(int a=b;a>=c;--a)
#define LL long long
#define IT iterator
#define PB push_back
#define II(a,b) make_pair(a,b)
#define FIR first
#define SEC second
#define FREO freopen("check.out","w",stdout)
#define rep(a,b) for(int a=0;a<b;++a)
#define KEEP while(1)
#define SRAND mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define random(a) rng()%a
#define ALL(a) a.begin(),a.end()
#define POB pop_back
#define ff fflush(stdout)
#define fastio ios::sync_with_stdio(false)
#define debug_pair(A) cerr<<A.FIR<<" "<<A.SEC<<endl;
using namespace std;
const int INF=0x3f3f3f3f;
typedef pair<int,int> mp;
typedef pair<mp,mp> superpair;
int main(){
	fastio;
	int s,w;
	cin>>s>>w;
	if(w>=s){
		cout<<"unsafe";
	}
	else{
		cout<<"safe";
	}
	return 0;
}


Measured memory_bytes: 3640
a,b = map(int,input().split())
def cal(n):
  if n % 4 == 1:
    return 1
  if n % 4 == 3:
    return 0
  if n % 4 ==2:
    return n + 1
  else:
    return n
  
print(cal(a-1) ^ cal(b))

Measured memory_bytes: 61792
#include <float.h>
#include <inttypes.h>
#include <limits.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <math.h>
#ifdef __cplusplus
#include <bits/stdc++.h>
#endif

#include <immintrin.h>

#define getchar getchar_unlocked
#define putchar putchar_unlocked
int32_t nextint(void){ char c=getchar(); while(c!='-'&&(c<'0'||'9'<c)) c=getchar(); bool s=false; if(c=='-'){s=true;c=getchar();} uint32_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar(); } return s?-x:x; }
int64_t nextlong(void){ char c=getchar(); while(c!='-'&&(c<'0'||'9'<c)) c=getchar(); int s=0; if(c=='-'){s=1;c=getchar();} uint64_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar(); } return s?-x:x; }
uint32_t nextstr(char *s){ char c=getchar(); while(c==' '||c=='\n') c=getchar(); uint32_t len=0; while(c!=' '&&c!='\n'){ *s++=c; len++; c=getchar(); } *s='\0'; return len; }

#define xor_add(xmm0, xmm1, xmm2) do{ __m128i xmm7 = _mm_add_epi32(xmm1, xmm2); xmm0 = _mm_xor_si128(xmm0, xmm7); }while(0)

int a[200000];
int b[200000];
int main(void){
	int n=nextint();
	for(int i=0; i<n; i++){
		a[i]=nextint();
	}
	for(int i=0; i<n; i++){
		b[i]=nextint();
	}
	int ans=0;
	int m1=(n+3)/4*4;
	int m=(n+15)/16*16;

	__m128i xmm0 = _mm_setzero_si128();
	for(int i=0; i<m1; i+=4){
		__m128i xmm1 = _mm_set1_epi32(a[i+0]);
		__m128i xmm2 = _mm_set1_epi32(a[i+1]);
		__m128i xmm3 = _mm_set1_epi32(a[i+2]);
		__m128i xmm4 = _mm_set1_epi32(a[i+3]);
		for(int j=0; j<m; j+=8){
			__m128i xmm5 = _mm_loadu_si128((__m128i*)&b[j+0]);
			__m128i xmm6 = _mm_loadu_si128((__m128i*)&b[j+4]);
			xor_add(xmm0, xmm1, xmm5);
			xor_add(xmm0, xmm1, xmm6);
			xor_add(xmm0, xmm2, xmm5);
			xor_add(xmm0, xmm2, xmm6);
			xor_add(xmm0, xmm3, xmm5);
			xor_add(xmm0, xmm3, xmm6);
			xor_add(xmm0, xmm4, xmm5);
			xor_add(xmm0, xmm4, xmm6);
		}
	}
	int c[4];
	_mm_storeu_si128((__m128i*)&c, xmm0);
	ans^=c[0];
	ans^=c[1];
	ans^=c[2];
	ans^=c[3];
	if(n%2==1){
		for(int i=0; i<n; i++){
			ans^=a[i];
			ans^=b[i];
		}
	}
	printf("%d\n", ans);
}


Measured memory_bytes: 3152
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include<inttypes.h>
#include<string.h>
#include<math.h>

typedef int32_t i32;
typedef int64_t i64;

#define MAX(a,b) ((a) > (b) ? (a) : (b))
#define MIN(a,b) ((a) < (b) ? (a) : (b))
#define ABS(a) ((a) > (0) ? (a) : -(a))

void run (void) {
  i32 n = 1000;
  scanf ("%" SCNi32, &n);
  i32 *s = (i32 *) calloc (n, sizeof (i32));
  for (i32 i = 0; i <n; ++i) {
    scanf ("%" SCNi32, s + i);
  }
  const i32 f = 100;
  i64 *dpB = (i64 *) calloc (n + f, sizeof (i64));
  i64 *dpD = (i64 *) calloc (n + f, sizeof (i64)) + f;
  i64 max = 0;// A = N - 1;
  for (i32 d = 1; n - 1 - 2 * d > 0; ++d) {
    if (d <= f) {
      memset (dpB, 0, sizeof (i64) * n);
      memset (dpD, 0, sizeof (i64) * n);
      for (i32 i = n - 1; i >= 0; --i) {
	dpB[i] = dpB[i + d] + s[i];
      }
      for (i32 i = 0; i < n; ++i) {
	dpD[i] = dpD[i - d] + s[i];
      }
    }
    for (i32 k = 2; k * d < n - 1; ++k) {
      i32 b = n - 1 - k * d;
      if (b % d == 0 && b / d + 1 < k) continue;
      i64 sum = 0;
      if (d > f) {
	for (i32 i = 1; i < k; ++i) {
	  sum += s[i * d + b] + s[i * d];
	}
      } else {
	sum = dpB[b + d] + dpD[(k - 1) * d];
      }
      max = MAX(max, sum);
    }
  }
  printf ("%" PRIi64 "\n", max);
}

int main (void) {
  run();
  return 0;
}


Measured memory_bytes: 2176
# -*- coding: utf-8 -*-
"""
Created on Sat Aug 11 17:33:57 2018
ABC105B
@author: maezawa
"""

n = int(input())

ans = 'No'

for m in range(26):
    for l in range(15):
        if 4*m + 7*l == n:
            ans = 'Yes'
            break
print(ans)

Measured memory_bytes: 2940
using System;

namespace AtCoder {

    class Program {
        static void Main(string[] args) {

            var temp = Console.ReadLine().Split(' ');
            var A = int.Parse(temp[0]);
            var P = int.Parse(temp[1]);

            var p = A * 3 + P;
            Console.WriteLine(p / 2);
        }
    }
}


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

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

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

	string S;
	bool ok[2];
	ok[0] = ok[1] = true;
	cin >> S;
	rep(i, 0, SZ(S))
	{
		if (i % 2 == 1 && S[i] == 'R')ok[0] = false;
		if (i % 2 == 0 && S[i] == 'L')ok[1] = false;
	}

	if (ok[0] && ok[1])
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <iomanip>
using namespace std;
 
int main(){
    int N; cin>>N;
    long sum = 0;
    for(int i=0;i<N;i++){
        int j;cin>>j;
        sum += j;
    }
    cout<<sum-N<<endl;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10 ** 7)

'''
#import numpy as np
import math, string, itertools, fractions, heapq, collections, re, array, bisect, copy, functools, random
from collections import deque, defaultdict, Counter
from heapq import heappush, heappop
from itertools import permutations, combinations, product, accumulate, groupby
from bisect import bisect_left, bisect_right, insort_left, insort_right
from operator import itemgetter as ig
#sys.setrecursionlimit(10 ** 7)
'''
inf = 10 ** 20
'''
INF = float("INF")
mod = 10 ** 9 + 7
"""dd = [(-1, 0), (0, 1), (1, 0), (0, -1)];
ddn = dd + [(-1, 1), (1, 1), (1, -1), (-1, -1)];
ddn9 = ddn + [(0, 0)]
for dx, dy in dd:
        nx = j + dx; ny = i + dy
            if 0 <= nx < w and 0 <= ny < h:"""

def wi(): return list(map(int, sys.stdin.readline().split()))
def wip(): return [int(x) - 1 for x in sys.stdin.readline().split()]  # WideIntPoint
def ws(): return sys.stdin.readline().split()
def si(): return int(sys.stdin.readline())  # SingleInt
def ss(): return input()
def hi(n): return [si() for _ in range(n)]
def hs(n): return [ss() for _ in range(n)]  # HeightString
def s_list(): return list(input())
def mi(n): return [wi() for _ in range(n)]  # MatrixInt
def mip(n): return [wip() for _ in range(n)]
def ms(n): return [ws() for _ in range(n)]
def num_grid(n): return [[int(i) for i in sys.stdin.readline().split()[0]] for _ in range(n)]  # NumberGrid
def grid(n): return [s_list() for _ in range(n)]

def main():
'''

N = int(input())
h = list(map(int, input().split()))
dp = [inf]*N
dp[0] = 0
for i in range(1, N):
    if i >= 2:
        dp[i] = min(abs(h[i]-h[i-1]) + dp[i-1], dp[i])
        dp[i] = min(abs(h[i]-h[i-2]) + dp[i-2], dp[i])
    else:
        dp[i] = min(abs(h[i]-h[i-1]) + dp[i-1], dp[i])

print(dp[N-1])

'''
if __name__ == '__main__':
    main()
'''

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

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N; i++) cin >> A.at(i);
  int count = 0;
  for (int i = 0; i < N; i++){
    if (A.at(i) % 2 == 1) count++;
  }
  
  if (count % 2 == 0) cout << "YES" << endl;
  else cout << "NO" << endl;
}


Measured memory_bytes: 3796
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<bitset>
#include<vector>
#include<deque>
#include<list>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<cmath>
#include<iomanip>
#include <functional>
using namespace std;
typedef long long ll;
const int mod = 1000000007;
const int INF = 1 << 28;
const double EPS = 1e-10;
//cout << fixed << std::setprecision(9)
//memset(a, 0, sizeof(a));
//--------------------------

int n;
int a, b;
int p[111];
int l1, l2, l3;


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

	for (int i = 0;i < n;i++) {
		if (p[i] <= a) l1++;
		if (a < p[i] && p[i] <= b) l2++;
		if (p[i] > b) l3++;
	}

	cout << min(l1, min(l2, l3)) << endl;

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define SORT(c) sort((c).begin(),(c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG false
 
typedef long long ll;
typedef pair<int, int> ii;

#define MAXI 1000000

int main() {

	vector<int> bin, tri;
	
	for(int i = 0; i*i <= MAXI; i++){
		bin.push_back(i*i);
	}
	for(int i = 0; i*i*i <= MAXI; i++){
		tri.push_back(i*i*i);
	}
	
	int e;
	while(cin >> e, e){
		int ans = IINF;
		for(int i = 0; tri[i] <= e; i++){
			int ee = e;
			int sum = 0;
			sum += i;
			ee -= tri[i];
			if(DEBUG) cout << "\t" << sum << endl;
			auto it2 = upper_bound(bin.begin(), bin.end(), ee);
			it2--;
			int tmp = distance(bin.begin(), it2);
			sum += tmp;
			if(DEBUG) cout << "\t" << sum << endl;
			ee -= *it2;
			sum += ee;
			ans = min(ans, sum);
		}
		cout << ans << endl;
	}
	

	return 0;
}

Measured memory_bytes: 2968