akhauriyash/Code-Regression huggingface dataset:
/*Allah Vorosha*/
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define ull unsigned long long
#define pb push_back
#define n_p next_permutation
#define p_p prev_permutation
#define in insert
#define rev reverse
#define pf push_front
#define pob pop_back
#define uniq(v)         v.resize(distance(v.begin(),unique(v.begin(),v.end())))
#define all(x) (x).begin(),(x).end()
#define pof pop_front
#define ios ios_base::sync_with_stdio(0);cin.tie();cout.tie();
#define scn scanf
#define prt printf
#define rep(i, a, n) for(int i = a; i < n; i++)
#define mod 1000000007
#define yes cout << "YES\n"
#define no cout << "NO\n";
#define take for(auto &it : a) cin >> it;
#define out cout << a << "\n";
#define l_b lower_bound
#define u_b upper_bound
#define Max 100005
template<typename T> T mymax(T x, T y) {
    return (x > y ? x : y);
}

using namespace std;

const int N = 2e5 + 5;

void solve() {
    long long x, l;
    cin >> x >> l;
    ll m = x % 2019;
    ll p = x + (2019 - m);
    if(p <= l) {
        cout << 0 << '\n'; return;
    }
    ll ans = 1e8;
    for(ll i = x; i < l; i++) {
        for(ll j = i + 1; j <= l; j++) {
            ll prod = ((i % 2019) * (j % 2019)) % 2019;
            ans = min(ans, prod);
        }
    }
    cout << ans;
}

int main() {

    solve();
    return 0;
}


Measured memory_bytes: 3616
import java.util.*;

public class Main{
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt(), B=sc.nextInt(), C=sc.nextInt(), D=sc.nextInt();
    while(true) {
      C -= B;
      A -= D;
      if(C<=0) {
        System.out.println("Yes");
        break;
      }
      if(A<=0) {
        System.out.println("No");
        break;
      }
    }
  }
}

Measured memory_bytes: 35508
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (ll i = 0; i < n; i++)
#define Rep(i, r, n) for (ll i = r; i < n; i++)
#define debug(x) cout << #x << " = " << (x) << endl;
#define pb push_back
#define MOD 1000000007
//#define MOD 998244353
#define INF 1000000000000
#define EPS 0.00000000001
typedef long long ll;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    //---------------------------------------------

    int n;
    cin>>n;
    int c;
    vector<ll> a(100000+10);
    rep(i,n){
        cin>>c;
        a[c]++;
    }
    sort(rall(a));
    ll ans=0;
    ll memo;
    rep(i,100000+10){
        if(a[i]==0){
            memo=i;
            break;
        }
    }
    ll count=0;
    rep(i,memo){
        //debug(a[i]);
        count+=a[i]-1;
    }
    //debug(count);

    if(count%2==0){
        cout<<memo<<endl;
    }
    else{
        cout<<memo-1<<endl;
    }
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define repr(i,a,b) for(int i=a;i>=b;i--)
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define pc _putchar_nolock
#define mp make_pair
#define mt make_tuple
#define um unordered_map
#define inf (ll)9223372036854775807
using namespace std;
using ll=long long int;
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
void input(vector<int>&a,int n)
{
   rep(i,0,n-1)
   cin>>a[i];
}
void solve()
{
 int k,x; cin>>k>>x; if(k*500>=x) cout<<"Yes\n"; 
 else cout<<"No\n"; return;
}
int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int t=1;
  while(t--)
  {
	 solve();
  }
  return 0;
}


Measured memory_bytes: 3532
#include <iostream>
#include <math.h>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <iomanip>
#include <string.h>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()

typedef long long lint;

using namespace std;

int main(){
  lint X,Y;
  cin>>X>>Y;
  int ans=0;
  while(X<=Y){
    X=X*2;
    ans++;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
ll ans[100005];
int main(){
   double a,b,n;
   cin>>a>>b>>n;
   double x;
   
   if(n>=b-1) x =b-1;
   else x=n;
   cout<<floor(a*x/b) - a*floor(x/b)<<endl;
   
    return 0;
}

Measured memory_bytes: 3804
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    static class BSomeSums
    {        
        static void Main(string[] args)
        {
            var s = Console.ReadLine().Split(' ');
            var n = int.Parse(s[0]);
            var a = int.Parse(s[1]);
            var b = int.Parse(s[2]);

            var total = 0;

            for (int i = 1; i <= n; i++)
            {
                var sum = CalcSomeOfDigits(i);
                if (a <= sum && sum <= b)
                {
                    total += i;
                }
            }

            Console.WriteLine(total);
            Console.ReadLine();
        }

        static int CalcSomeOfDigits(int n)
        {
            int sum = 0;
            while (n > 0)
            {
                sum += n % 10;
                n = n / 10;
            }
            return sum;
        }
  }
}

Measured memory_bytes: 13140
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <queue>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <stdio.h>
#include <complex>
#include <cstdint>
#include <tuple>

#define M_PI       3.14159265358979323846

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }
inline int readInt() { int x; scanf("%d", &x); return x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<int, PII> TIII;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;

//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) int((a).size())
#define SQ(a) ((a)*(a))
#define EACH(i,c) for(typeof((c).begin()) 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,s,n) for(int i=s;i<(int)n;++i)
#define REP(i,n) FOR(i,0,n)
#define MOD 1000000007

int d[13];
bool f0[25];
bool f[25];

int calc() {
	int ret = 100;
	int pre = -100;
	REP(i, 25) {
		if (f[i]) {
			ret = min(ret, i - pre);
			pre = i;
		}
	}
	return ret;
}

int solve() {
	f0[0] = f0[24] = true;
	int n;
	scanf("%d", &n);
	REP(i, n) {
		int t;
		scanf("%d", &t);
		d[t]++;
	}
	if (d[0] >= 1)return 0;
	if (d[12] >= 2)return 0;
	if (d[12] == 1)f0[12] = true;
	VI sgl;
	FOR(i, 1, 12) {
		if (d[i] >= 3)return 0;
		if (d[i] == 2)f0[i] = f0[24 - i] = true;
		if (d[i] == 1)sgl.PB(i);
	}
	int ret = -1;
	REP(i, (1 << sgl.size())) {
		memcpy(f, f0, sizeof(f0));
		REP(j, sgl.size()) {
			if ((1 << j) & i)f[sgl[j]] = true;
			else f[24 - sgl[j]] = true;
		}
		ret = max(ret, calc());
	}
	return ret;
}

int main() {
	printf("%d\n", solve());
	return 0;
}

Measured memory_bytes: 256
N = int(input())
blue = [input() for i in range(N)]
M = int(input())
red = [input() for i in range(M)]

X = 0
check = []
for i in blue:
    yen = 0
    if i not in check:
        check.append(i)
        for j in blue:
            if j == i:
                yen += 1
        for j in red:
            if j == i:
                yen -= 1
    X = max(X, yen)

print(X)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define REP(i,x) for(int i=0,i##_len=(x);i<i##_len;++i)
#define rep(i,a,b) for(int i=(a),i##_len(b);i<i##_len;++i)
#define All(x) begin(x),end(x)
#define rAll(x) rbegin(x),rend(x)
using namespace std;
using ll = long long;

int main(){
    int N;cin>>N;
    if(N<=2){
        std::cout<<0<<endl;
        return 0;
    }
    string s;cin>>s;
    ll cnt[3]={};
    for(int i=0;i<N;++i) cnt[s[i]%3]++;
    ll ans=static_cast<ll>(N)*(N-1)*(N-2)/6;
    REP(i,3){
        ans-=(N-cnt[i])*cnt[i]*(cnt[i]-1)/2;
        ans-=cnt[i]*(cnt[i]-1)*(cnt[i]-2)/6;
    }
    rep(len,1,N) REP(i,N-2*len) {
        ans--;
        if(s[i]==s[i+len]||s[i+len]==s[i+2*len]||s[i+2*len]==s[i]){
            ans++;
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 3636
const int LG = 21;
const int FN = 400005;
const long long MOD = 1e9 + 7;
const long long INF = 1e9;
const long long INFLL = 1e18;

#include <bits/stdc++.h>

const double PI = acos(-1);

using namespace std;

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

#define forn(i, n) for (int (i) = 0; (i) != (n); (i)++)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define fi first
#define se second
#define re return
#define pb push_back
#define uniq(x) sort(all(x)); (x).resize(unique(all(x)) - (x).begin())

#ifdef LOCAL
#define dbg(x) cerr << __LINE__ << " " << #x << " " << x << endl
#define ln cerr << __LINE__ << endl
#else
#define dbg(x) void(0)
#define ln void(0)
#endif // LOCAL

int cx[4] = {-1, 0, 1, 0};
int cy[4] = {0, -1, 0, 1};
string Yes[2] = {"No", "Yes"};
string YES[2] = {"NO", "YES"};
string Psb[2] = {"Impossible", "Possible"};
string psb[2] = {"impossible", "possible"};

ll inq(ll x, ll y)
{
    if (!y) re 1 % MOD;
    ll l = inq(x, y / 2);
    if (y % 2) re l * l % MOD * x % MOD;
    re l * l % MOD;
}

ll rev(ll x)
{
    return inq(x, MOD - 2);
}

bool __precomputed_combinatorics = 0;
vector<ll> __fact, __ufact, __rev;

void __precompute_combinatorics()
{
    __precomputed_combinatorics = 1;
    __fact.resize(FN);
    __ufact.resize(FN);
    __rev.resize(FN);
    __rev[1] = 1;
    for (int i = 2; i < FN; i++) __rev[i] = MOD - __rev[MOD % i] * (MOD / i) % MOD;
    __fact[0] = 1, __ufact[0] = 1;
    for (int i = 1; i < FN; i++) __fact[i] = __fact[i - 1] * i % MOD, __ufact[i] = __ufact[i - 1] * __rev[i] % MOD;
}

ll fact(int x)
{
    if (!__precomputed_combinatorics) __precompute_combinatorics();
    return __fact[x];
}

ll cnk(int n, int k)
{
    if (k < 0 || k > n) return 0;
    if (!__precomputed_combinatorics) __precompute_combinatorics();
    return __fact[n] * __ufact[n - k] % MOD * __ufact[k] % MOD;
}

ll ds(ll x)
{
    ll r = 0;
    while (x > 0) r += x % 10, x /= 10;
    return r;
}

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll n;
    cin >> n;
    ll ans = 5000;
    for (int i = 1; i < n; i++)
    {
        int j = n - i;
        ans = min(ans, ds(i) + ds(j));
    }
    cout << ans;
}

/* Note:
Check constants at the beginning of the code.
    N is set to 4e5 but be careful in problems with large constant factor.
    Setting N in every problem is more effective.
Check corner cases.
    N = 1
No def int long long for now.
Add something here.
*/


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

int main() {
    double x1,y1,x2,y2;
	scanf("%lf %lf %lf %lf",&x1,&y1,&x2,&y2);
	printf("%.8lf\n",sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)));
    return 0;
}




Measured memory_bytes: 3232
//==========================Head files==========================
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
#include<queue>
#include<cmath>
#include<set>
#include<iostream>
#include<map>
#define LL long long
#define db double
#define mp make_pair
#define pr pair<int, int>
#define fir first
#define sec second
#define pb push_back
#define ms(i, j) memset(i, j, sizeof i)
using namespace std;
//==========================Templates==========================
inline int read() {
    int x = 0, f = 1; char c = getchar();
    while(c < '0' || c > '9'){if (c == '-') f = -1; c = getchar();}
    while(c >= '0' && c <= '9'){x = x * 10 + c - '0'; c = getchar();}
    return x * f;
}
inline LL readl() {
    LL x = 0, f = 1; char c = getchar();
    while(c < '0' || c > '9'){if (c == '-') f = -1; c = getchar();}
    while(c >= '0' && c <= '9'){x = x * 10 + c - '0'; c = getchar();}
    return x * f;
}
int power(int a, int b) {
	int ans = 1;
	while (b) {
		if(b & 1) ans = ans * a;
		b >>= 1; a = a * a;
	}
	return ans;
}
int power_mod(int a, int b, int mod) {
	a %= mod;
	int ans = 1;
	while (b) {
		if(b & 1) ans = (ans * a) % mod;
		b >>= 1, a = (a * a) % mod;
	}
	return ans;
}
LL powerl(LL a, LL b) {
	LL ans = 1ll;
	while (b) {
		if(b & 1ll) ans = ans * a;
		b >>= 1ll;a = a * a;
	}
	return ans;
}
LL power_modl(LL a, LL b, LL mod) {
	a %= mod;
	LL ans = 1ll;
	while (b) {
		if(b & 1ll) ans = (ans * a) % mod;
		b >>= 1ll, a = (a * a) % mod;
	}
	return ans;
}
LL gcdl(LL a, LL b) {return b == 0 ? a : gcdl(b, a % b);}
LL abssl(LL a) {return a > 0 ? a : -a;}
int gcd(int a, int b) {return b == 0 ? a : gcd(b, a % b);}
int abss(int a) {return a > 0 ? a : -a;}
//==========================Main body==========================
#define LD "%I64d"
#define D "%d"
#define pt printf
#define sn scanf
#define pty printf("YES\n")
#define ptn printf("NO\n")
//==========================Code here==========================
LL r;
int main() {
	cin >> r;
	cout << 3ll * r * r;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define BIG 1000000010
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
typedef long long int ll;


int main(){
  int n,m;
  int one[200010]={0},goal[200010]={0};
  cin>>n>>m;
  int s,g;
  rep(i,m){
    cin>>s>>g;
    if(s==1) one[g]=1;
    if(s==n) goal[g]=1;
    if(g==1) one[s]=1;
    if(g==n) goal[s]=1;
  }
  repi(i,1,n+1){
    if(one[i] && goal[i]){cout<<"POSSIBLE"<<endl;return 0; }
  }
  cout<<"IMPOSSIBLE"<<endl;

  return 0;
}


Measured memory_bytes: 1792
<?php
$count = (int)trim(fgets(STDIN));
$text = trim(fgets(STDIN));
$c = (int)($count/2);
if ($count%2 == 1) {
	print "No";
} else {
	$a_text = substr($text, 0, $c);
	$b_text = substr($text, $c);
	if($a_text == $b_text){
		print "Yes";
	} else {
		print "No";
	}
}

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

typedef long long int ll;

int main()
{
    ll n;
    string x;
    cin >> n >> x;
    ll h = 0, m = 1;
    for(ll i = 0;i < x.size();i++){
        if(x[i] == ')'){
            h--;
        }
        else{
            h++;
        }
        if(h < 0){
            m = min(h, m);
        }
    }


    if(m == 1){
        for(ll i = 0;i < h;i++){
            x.push_back(')');
        }
        cout << x;
    }
    else{
        for(ll i = 0;i < -m;i++){
            cout << '(';
        }
        cout << x;
        for(ll i = 0;i < h - m;i++){
            cout << ')';
        }
    }

    return 0;
}

Measured memory_bytes: 256
package main

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

var reader = bufio.NewReaderSize(os.Stdin, 1000000)

func readLine() []string {
	buf := make([]byte, 0, 1000000)
	for {
		line, prefix, err := reader.ReadLine()
		if err != nil {
			fmt.Printf("%s", err)
		}
		buf = append(buf, line...)
		if prefix == false {
			break
		}
	}
	s := string(buf)
	return strings.Split(s, " ")
}

func toints(s []string) []int {
	var ints []int
	for _, v := range s {
		int, _ := strconv.Atoi(v)
		ints = append(ints, int)
	}
	return ints
}

func main() {
	var k int
	var h []int

	a := toints(readLine())
	k = a[1]
	h = toints(readLine())

	numberOfRiders := 0
	for _, height := range h {
		if height >= k {
			numberOfRiders++
		}
	}

	fmt.Println(numberOfRiders)
}


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

using namespace std;

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

        if(s == "SUN"){
                cout << "7" << endl;
        }
        else if(s == "MON"){
                cout << "6" << endl;
        }
        else if(s == "TUE"){
                cout << "5" << endl;
        }
        else if (s == "WED"){
                cout << "4" << endl;
        }
        else if (s == "THU"){
                cout << "3" << endl;
        }
        else if(s == "FRI"){
                cout << "2" << endl;
        }
        else if(s == "SAT"){
                cout << "1" << endl;
        }
        return 0;
}

Measured memory_bytes: 3540
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<type_traits>
#include<math.h>
#include<fstream>
#include<set>
using namespace std;
typedef long long ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
#define out(str) cout << str << endl
#define ALL(a) (a).begin(),(a).end()
#define INF (1<<29)

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 state=0,ans=0,cntA=0;
string S;

int main(){
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());
    cin>>S;
    rep(i,S.length()-1){
        if(S[i]=='A'){
            cntA++;
        }
        else if(S[i]=='B'&&S[i+1]=='C'){
            ans+=cntA;
            i++;
        }
        else{
            cntA=0;
        }
    }
    out(ans);

    
    
}


Measured memory_bytes: 640
# -*- coding: utf-8 -*-
from collections import Counter
from itertools import accumulate

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

B = list(Counter(A).values())

C = [0] * N 
for i in B:
    C[i-1] += 1

F = list(accumulate(C))

S = [0] * N
f = [0] * N
S[0] = f[0] = sum(C) 
for i in range(2, N+1):
    S[i-1] = (S[i-2] + C[i-1] + S[0] - F[i-1] ) 
    f[i-1] = S[i-1] / i

f.sort()
n = 0     
K = 1
    
while K != N+1:
    if K <= f[n]:
        print(N-n)
        K += 1
    else:
        n += 1
    if n == N:
        for i in range(N-K+1):
            print(0)
        K = N+1    

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

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

int a[10][10];
int grid[10][10];
int res[10][10];

bool ok(int i, int j)
{
	return i >= 0 && j >= 0 && i < 10 && j < 10;
}

void rev(int x, int y)
{
	for (int dir = 0; dir < 5; dir++){
		int nx = x + dx[dir];
		int ny = y + dy[dir];
		if (ok(nx, ny)) grid[nx][ny] ^= 1;
	}
}

void solve()
{
	for (int x = 0; x < (1 << 10); x++){
		memset(res, 0, sizeof(res));
		memcpy((void *)grid, (void *)a, sizeof(grid));
		
		for (int i = 0; i < 10; i++){
			if (x & (1 << i)){
				res[0][i] = 1;
				rev(0, i);
			}
		}
		
		for (int i = 1; i < 10; i++){
			for (int j = 0; j < 10; j++){
				if (grid[i - 1][j]){
					res[i][j] = 1;
					rev(i, j);
				}
			}
		}
		
		int f = 0;
		for (int i = 0; i < 10; i++){
			for (int j = 0; j < 10; j++){
				f += grid[i][j];
			}
		}
		if (!f) break;
	}
	
	for (int i = 0; i < 10; i++){
		for (int j = 0; j < 10; j++){
			if (j) printf(" ");
			printf("%d", res[i][j]);
		}
		puts("");
	}
}

int main()
{
	int n;
	scanf("%d", &n);
	while (n--){
		for (int i = 0; i < 10; i++){
			for (int j = 0; j < 10; j++){
				scanf("%d", &a[i][j]);
			}
		}
		solve();
	}
	return 0;
}

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

int main() {
  int n,ans = 10000;
  cin >> n;
  vector<int>data(n);
  for(int i = 0;i < n;i++){
    cin >> data.at(i);
  }
  for(int i = 0;i < n;i++){
    int sum1 = 0,sum2 = 0;
    for(int j = 0;j < i;j++){
      sum1 += data.at(j);
    }
    for(int k = i;k < n;k++){
      sum2 += data.at(k);
    }
    if(abs(sum1 - sum2) <= ans){
      ans = abs(sum1 - sum2);
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<map>
#include<queue>
#include<set>
#include<cmath>
#include<stack>
#include<random>
#include<iterator>
#include <algorithm>
#include <functional>
#include <cassert>
using namespace std;

template <typename T>
void printvec(vector<T> v)
{
    for(auto it=v.begin();it != v.end();it++)
    {
        cout << (*it) << endl;
    }
    cout << endl;
}


struct ListNode {
    int val;
    ListNode *next;
    ListNode() : val(0), next(nullptr) {}
    ListNode(int x) : val(x), next(nullptr) {}
    ListNode(int x, ListNode *next) : val(x), next(next) {}
};


void printl(ListNode* l){
    ListNode *h;h=l;
    while(h!= NULL){
        cout << h->val<< endl;
        h = h->next;
    }
}

template <typename T>
void chmax(T& a,const T& b){if(b > a)a = b;}
template<typename T>
void chmin(T& a ,const T& b){if(a > b)a = b;}

int lower_bound(vector<int> v,int k){//vの中でk以下の値をみっけるないときは一番いひだりが帰ってくる
    int l(0),r(v.size());
    long long int mid;
    while(l<r){
        mid = (l+r)/2;
        if(mid == v.size() -1 ){
            return v.size()-1;
        }
        if(v[mid] <= k && v[mid+1] >k ){
            return mid;
        }else if(v[mid] > k){
            r = mid-1;
        }else{
            l = mid + 1;
        }
    }
    return l;
}
template <typename T>
void print2dvec(vector<vector<T>> v){
    for(int j=0;j<v[0].size();j++)
    {
        for(int i=0;i<v.size();i++){
            cout << v[i][j];
        }
        cout << endl;
    }
    
}


int lcs(string s1,string s2){
    int dp[50][50] = {0};
    cout << dp[2][2] << endl;
    //i,jは何文字目か
    for(int i=1;i<=s1.size();i++){
        for(int j = 1;j<=s2.size();j++){
            if(s1[i-1] ==s2[j-1] ){
                chmax(dp[i][j] , dp[i-1][j-1] + 1);
            }
            chmax(dp[i][j],dp[i-1][j]);
            chmax(dp[i][j] , dp[i][j-1]);
        }
    }
    return dp[s1.size()][s2.size()];
}


struct veccomp{
    bool operator()(const vector<int>& a,const vector<int>& b)const{
        return a[0] < b[0];
    }
};    

int main(){
    int n;
    cin >> n;
    if(n%10 == 2 || n%10 == 4||n%10 ==5||n%10 == 7||n%10 == 9 ){
        cout << "hon" << endl;
    }else if(n%10 == 3){
        cout << "bon" << endl;
    }else{
        cout << "pon" << endl;
    }
    return 0;
}


Measured memory_bytes: 3636
import java.io.*;
import java.math.*;
import java.util.*;

public class Main {

	static class Pair {
		public int x, y, id;
		public Pair() {
			x = y = 0;
		}
		public Pair(int x, int y, int i) {
			this.x = x;
			this.y = y;
			id = i;
		}
	}
	
	public static void main(String[] args) throws IOException {

		InputReader in = new InputReader(System.in);
		PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
		int n = in.nextInt();
		for(int i=0;i<n;i++) {
			int x = in.nextInt();
			if(x%2==0) {
				if((x%3!=0)&&(x%5!=0)) {
					out.print("DENIED");
					out.flush();
					return;
				}
			}
		}
		out.print("APPROVED");
		out.flush();

	}

	static class InputReader {
		StreamTokenizer tokenizer;

		public InputReader(InputStream stream) {
			tokenizer = new StreamTokenizer(new BufferedReader(new InputStreamReader(stream)));
			tokenizer.ordinaryChars(33, 126);
			tokenizer.wordChars(33, 126);
		}

		public String next() throws IOException {
			tokenizer.nextToken();
			return tokenizer.sval;
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public boolean hasNext() throws IOException {
			int res = tokenizer.nextToken();
			tokenizer.pushBack();
			return res != StreamTokenizer.TT_EOF;
		}
	}

}


Measured memory_bytes: 23380
import math #math.sqrt(x)

n,d = map(int, input().split())
x = []
for _ in range(n):
    x.append(list(map(int, input().split())))

ans = 0
for i in range(n):
    for q in range(n):
        sumv = 0
        if i == q:
            continue
        for j in range(d):
            sumv += (x[i][j] - x[q][j]) ** 2

        if math.sqrt(sumv).is_integer() == True:
            ans += 1

print(round(ans/2))

Measured memory_bytes: 3188
#define __USE_MINGW_ANSI_STDIO 0
        #include <iostream>
        #include <stdio.h>
        #include <stdlib.h>
        #include <vector>
        #include <algorithm>
        #include <queue>
        #include <map>
        #include <set>
        #include <stack>
        #include <string.h>
        #include <math.h>
         
        using namespace std;
         
        #define PI 3.141592653589793
        #define epsilon 0.000000001
        #define INF 1000000000000
        #define MOD 1000000007
         
        int main(){
            //freopen("dec.in", "r", stdin); freopen("dec.out", "w", stdout);
        	int N; cin >> N;
          	if(N/10 == 9 || N%10 == 9) cout << "Yes\n";
            else cout << "No\n";
            return 0;
        }

Measured memory_bytes: 256
S=input()
s1=int(S[:2])
s2=int(S[2:])
a=0
b=0
if s1<13 and s1>0:
    a=1
if s2<13 and s2>0:
    b=1
if a and b:
    print("AMBIGUOUS")
elif a:
    print('MMYY')
elif b:
    print('YYMM')
else:
    print('NA')

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

const int iMod	= 1000000007;

int ModF( const int X )
{
int i;
long long F;

	F = 1;
	for( i = 2; i <= X; i++ )
	{
		F *= i;
		F %= iMod;
	}

	return F;
}

int main()
{
int N;
int M;
long long F;

	ios::sync_with_stdio( false );
	cin.tie( 0 );

	cin >> N;
	cin >> M;

	if( N > M + 1 || N + 1 < M )
	{
		cout << 0 << endl;

		return 0;
	}

	F = ModF( N );
	F *= ModF( M );
	F %= iMod;

	if( N == M )
	{
		F *= 2;
		F %= iMod;
	}

	cout << F << endl;

	return 0;
}




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

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

    if(n==0) break;
    
    int c[10]={};
    int v;
    
    for(int i=0;i<n;i++){
      cin>>v;
      c[v]++;
    }
    
    for(int i=0;i<10;i++){
      if(c[i]==0) cout<<"-"<<endl;
      else{
	for(int j=0;j<c[i];j++){
	  cout<<"*";
	}
	cout<<endl;
      }
    }
  }
  
  return 0;
}



Measured memory_bytes: 3012
#include <algorithm>
#include <array>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;
#define int long long
constexpr long long INF = 1000000000000000000LL + 8;

struct cake {
    int pret, deli, popu;
    constexpr int score(int flug) {
        return (flug & 1 << 2 ? -1 : 1) * pret +
               (flug & 1 << 1 ? -1 : 1) * deli +
               (flug & 1 << 0 ? -1 : 1) * popu;
    }
    int finalScore() { return abs(pret) + abs(deli) + abs(popu); }
    cake operator+(const cake &other) {
        cake ret;
        ret.pret = pret + other.pret;
        ret.deli = deli + other.deli;
        ret.popu = popu + other.popu;
        return ret;
    }
};

int dipro(vector<cake> &cakes, int n, int m, int flug) {
    const cake unit_cake = {(flug & 1 << 2 ? 1 : -1) * INF,
                            (flug & 1 << 1 ? 1 : -1) * INF,
                            (flug & 1 << 0 ? 1 : -1) * INF};
    vector<cake> dp(m + 1, unit_cake), ndp(m + 1, unit_cake);
    dp[0] = ndp[0] = {0, 0, 0};

    for (int i = 0; i < n; i++) {
        const cake cake_i = cakes[i];

        for (int j = 1; j <= min(m, i + 1); j++) {
            const int score0 = dp[j].score(flug);
            const int score1 = (dp[j - 1] + cake_i).score(flug);

            if (score0 > score1)
                ndp[j] = dp[j];
            else
                ndp[j] = dp[j - 1] + cake_i;
        }
        dp = ndp;
    }

    return dp[m].finalScore();
}

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

    int n, m;
    cin >> n >> m;

    vector<cake> cakes;
    cakes.reserve(n);

    for (int i = 0; i < n; i++) {
        int x, y, z;
        cin >> x >> y >> z;

        cakes.push_back({x, y, z});
    }

    int ans = 0;

    for (int i = 0; i <= 0b111; i++) {
        const int now = dipro(cakes, n, m, i);
        ans = max(now, ans);
    }

    cout << ans << endl;
}


Measured memory_bytes: 384
import math

while True:
  n = int(input())
  if n == 0:
    break
  st = list(map(int,input().split()))
  ave = float(sum(st)) / float(n)
  for i in range(len(st)):
    st[i] = (st[i]-ave)**2
  sigma = math.sqrt(sum(st)/float(n))
  print("{:.6f}".format(sigma))


Measured memory_bytes: 5704
#include<iostream>
#include<queue>

using namespace std;

int main(){

        long int N,M;
        cin>>N>>M;

        priority_queue<int> que;
        int x;

        long int* ip = new long int[N];//item pricesの意
        for(int i = 0; i < N;i++){
                cin>>x;
                que.push(x);
        }

        for(int i = 0; i<M;i++){
                x = que.top();
                que.pop();
                x/=2;
                que.push(x);
        }

        long int sum = 0;
        for(int i = 0; i < N; i++){
                sum+=que.top();
                que.pop();
        }
        cout<<sum<<endl;


        return 0;
}



Measured memory_bytes: 892
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
struct Node
{
	int value;
   Node* prev,* next;
};
Node* head;
void Init()
{
    head=(Node*)malloc(sizeof(Node));
    head->next=head;
    head->prev=head;
}

Node* FindNode(int x)
{
	Node*temp=head->next;
	while(temp!=head&&temp->value!=x)
        temp=temp->next;
    return temp;
}
void Insert(int x)
{
	Node*temp=(Node*)malloc(sizeof(Node));
    temp->value=x;
    head->next->prev=temp;
    temp->next=head->next;
    head->next=temp;
    temp->prev=head;
}

void Delete(Node*temp)
{
	if(temp==head)
        return ;
	temp->next->prev=temp->prev;
	temp->prev->next=temp->next;
    free(temp);
}

void DeleteFirst()
{
    Delete(head->next);
}
void DeleteLast()
{
	Delete(head->prev);
}
/*
void PrintList()
{
    /*
    Node*temp=head->next;
    int flag=0;
    while(1)
    {
        if(temp==head)
            break;
        else
        {
            if(flag++>0)
                printf(" ");
            printf("%d",temp->value);
            temp=temp->next;
        }
    }
    printf("\n");
    
     Node* temp=head->next;
    while(temp->next!=head)
    {
        printf("%d ",temp->value);
        temp=temp->next;
    }
    printf("%d\n",temp->value);
}
*/
int main()
{
	int n;
	int i;
	scanf("%d",&n);
	char str[12];
	int x;
	Init();
    
	while(n--)
	{
		scanf("%s",str);
		if(str[0]=='i'){scanf("%d",&x);Insert(x);}
		else if(str[0]=='d'&&str[6]=='F')DeleteFirst();
		else if(str[0]=='d'&&str[6]=='L')DeleteLast();
		else if(str[0]=='d'){scanf("%d",&x);Delete(FindNode(x));}
	}
    
    /*
	for(i = 0; i < n; i++) {
        scanf("%s %d", str, &x);
        if (str[0] == 'i') {
            Insert(x);
        }
        else if(str[0] == 'd') {
            if(str[6] == 'F')
                DeleteFirst();
            else if(str[6] == 'L')
                DeleteLast();
            else
                //DeleteValue(x);
                Delete(FindNode(x));
        }
    }
    */
    Node* temp=head->next;
    while(temp->next!=head)
    {
        printf("%d ",temp->value);
        temp=temp->next;
    }
    printf("%d\n",temp->value);
    
    //PrintList();
	return 0;
}

Measured memory_bytes: 34412
import sys
N = int(input())
b = list(map(int, input().split()))

ans = []
while len(b) > 0:
  #print(b)
  poped = False
  for i in range(len(b)-1, -1, -1):
    #print(i+1, b[i])
    if i+1 == b[i]:
      ans.append(b.pop(i))
      poped = True
      break
  if not poped:
    print(-1)
    sys.exit()

ans.reverse()
for a in ans:
  print(a)

Measured memory_bytes: 3064
fun main(args: Array<String>) {
    val (N, M) = readLine()!!.split(" ").map(String::toInt)
    val favorite_list:MutableList<Int> = mutableListOf()
    favorite_list.addAll((1..M).map{ 0 })

    (1..N).forEach { i ->
        val kan = readLine()!!.split(" ").map(String::toInt)
        val K = kan[0]
        0.until(K).forEach { k ->
            favorite_list[kan[k + 1] - 1] += 1
        }
    }

    favorite_list.filter { it == N }.size.run(::println)
}

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

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

  int x = n % 500;
  if (x <= a)
  {
    cout << "Yes" << endl;
  }
  else
  {
    cout << "No" << endl;
  }

  return 0;
}

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

const int MAX_N = 1e5+12;
int N;
int P[MAX_N],a[MAX_N];

void solve()
{
	multiset<int> idx = {-1,-1, N, N};
	for(int i=0;i<N;++i){
		a[P[i]-1]=i;
	}
	long long ans = 0;
	for(int i=N-1;i>=0;--i){
		const int cur_p = a[i];
		auto it = idx.upper_bound(cur_p);
		int a = *prev(it, 2), b = *prev(it), x = *it, y = *next(it);
		// a .. b .. cur_p .. x .. y
		ans += (long long)(i+1)*(((long long)b-a)*(x-cur_p)+((long long)cur_p-b)*(y-x));
		idx.emplace(cur_p);
	}
	cout << ans;
}

int main()
{
	cin >> N;
	for(int i=0;i<N;++i)cin >> P[i];
	solve();
	return 0;
}

Measured memory_bytes: 5760
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define rreps(i,n) for(int i=((int)(n));i>0;i--)
#define repi(i,x) for(auto i=(x).begin(),i##_fin=(x).end();i!=i##_fin;i++)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define solve(a) ((a)?"Yes":"No")
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef pair<int , int> Pi;
typedef vector<Pi> VPi;
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
typedef vector<P> VP;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
const long long INFLL = 1LL<<60;
const int INF = 1<<30;
const double PI=acos(-1);
int main(){
	char s;
	int ans=0;
	cin >>s;
	if(isupper(s)){
		cout<<'A'<<endl;;
	}else{
		cout<<'a'<<endl;
	}
	//cout<<n+6<<endl;
}

Measured memory_bytes: 3620
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <functional>
#include <stack>
#include <iomanip>
#include <limits>
using namespace std;
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
using Graph=vector<vector<int>>;
using edge= struct{int to;ll cost;};

template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}

typedef priority_queue<ll> PQ_HIGH;
typedef priority_queue<ll,VL,greater<ll>> PQ_LOW;

#define EPSILON 1.0e-12

bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
};
//降順
bool compare_by_b_high(pair<int, int> a, pair<int, int> b) {
    if(a.second != b.second){
        return a.second > b.second;
    }else{
        return a.first < b.first;
    }
};
bool compare_by_b_higheer(tuple<string, int, int> a, tuple<string, int, int> b) {
    if(get<0>(a) != get<0>(b)){
      return get<0>(a) <get<0>(b);
    }else{
        if(get<1>(a) != get<1>(b)){return get<1>(a) > get<1>(b);}
        else{return get<2>(a) > get<2>(b);}
    }
};


int main(){
  ll N;cin>>N;
  ll count=0;
  ll start=1;
  ll sum=0;
  while(start<=N){
    if(start%3==0||start%5==0){
      start++;
    }else{
      sum+=start;
      start++;
      count++;
    }
  }
  cout<<sum<<endl;
}


Measured memory_bytes: 3632
#include <stdio.h>

int main(void)
{
  int n = 0;
  int m = 0;
  int a[101][101];
  int i, j;
  int sum = 0;
  
  scanf("%d %d", &n, &m);

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


  for(i = 0; i < n; i++){
    for(j = 0; j < m; j++)
      sum += a[i][j];
    a[i][j] = sum;
    sum = 0;
  }

  for(i = 0; i < m; i++){
    for(j = 0; j < n; j++)
      sum += a[j][i];
    a[j][i] = sum;
    sum = 0;
  }

  for(i = 0; i < m; i++)
      sum += a[n][i];
  a[n][m] = sum;
  

  for(i = 0; i <= n; i++) {
    for(j = 0; j < m; j++) 
      printf("%d ", a[i][j]);
    
    printf("%d\n", a[i][j]);
  }
  
  return 0;
}

Measured memory_bytes: 644
import * as fs from "fs";
import { captureRejectionSymbol } from "events";
namespace tutorial {
  const input = fs.readFileSync("/dev/stdin", "utf8");

  // inputに入力データ全体が入る
  function main(input) {
    // 1行目がinput[0], 2行目がinput[1], …に入る
    input = input.split("\n");
    let tmp = input[1].split(" ");
    //文字列から10進数に変換するときはparseIntを使います
    const n = parseInt(input[0], 10);

    let buka = [];
    for (let i = 0; i < n; i++) {
      buka[i] = 0;
    }

    for (let y = 0; y < n - 1; y++) {
      const number = parseInt(tmp[y], 10);
      buka[number - 1]++;
    }

    for (let j = 0; j < n; j++) {
      console.log("%d", buka[j]);
    }

    //出力
    return;
  }

  //*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
  main(input);
}


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

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int N;
    cin >> N;
    
    int sum = 0, L_max = 0;
    for (int i = 0; i < N; ++i) {
        int L_i;
        cin >> L_i;
        sum += L_i;
        L_max = max(L_max, L_i);
    }
    
    if (L_max < sum - L_max) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;

}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n); i >= 0; i--)
#define REP(i, m, n) for (int i = (int)(m); i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
typedef long long ll;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const long long INF = 1LL << 60;

int main(){
  int n; cin >> n;
  int m = (n/100) * 111;
  
  if(n<=m) cout << m << endl;
  else cout << m + 111 << endl;

  return 0;
}


Measured memory_bytes: 256
/* Levenshtein Distance ??¨????????¢?????¬??????????????\??????????????¢???*/
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
using namespace std;

typedef long long ll;
typedef ll int__;
#define rep(i,j) for(int__ (i)=0;(i)<(int)(j);(i)++)
#define repeat(i,j,k) for(int__ i=(j);i<(k);(i)++)
#define all(v) v.begin(),v.end()

int main()
{
  ios::sync_with_stdio(false);
  string s1,s2;
  cin>>s1>>s2;
  int m=s1.size();
  int n=s2.size();
  
  vector<vector<int>> DP(m+1,vector<int>(n+1));
  
  rep(i,n+1)DP[0][i]=i;
  rep(i,m+1)DP[i][0]=i;
  
  for(int i=1;i<=m;i++){
    for(int j=1;j<=n;j++){
      DP[i][j]=min( DP[i-1][j]+1 , DP[i][j-1]+1 ); 
      DP[i][j]=min( DP[i][j] , DP[i-1][j-1] + (s1[i-1]==s2[j-1]?0:1) ); 
    }
  }
  cout<<DP[m][n]<<endl;
  
  return 0;
}

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

typedef long long int ll;

typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef pair<string,string> Pstring;
typedef pair<double,double> Pdouble;

#define REP(i,n) for(ll i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define Precision(i) cout << fixed << setprecision(i)

const double PI=3.14159265358979323846;
const int MOD = 1000000007;
const int INF = 1e9;
const ll LINF = 1e18;

int main() {

  ll s,w;
  cin >> s >> w;
  if(s<=w) cout << "unsafe" << endl;
  else cout << "safe" << endl;
  
}

Measured memory_bytes: 3624
using System;
using System.Linq;//リストの使用
using System.Collections.Generic;
using System.Text;//テキストの高速出力に必要
class Program
{
static string s = Console.ReadLine();
static long sn = s.Length;
static string t = Console.ReadLine();
static long tn = t.Length;
static List<long>[] alphabetsList = new List<long>[26];//a,b…があるのは何文字めか
static long lookingNum = sn;//何文字目を見ているか
static long answer = 0;

	static void Main()
	{
    for(long i = 0; i < 26; i++)
    {
      alphabetsList[i] = new List<long>();
    }

    for(long i = 0; i < sn; i++)
    {
      alphabetsList[s[(int)i]-'a'].Add(i+1);
    }

    for(long i = 0; i < tn; i++)
    {
      long alphaCount = alphabetsList[t[(int)i]-'a'].Count;
      
      if(alphaCount == 0)
      {
        answer = -1;
        break;
      }

      if(alphabetsList[t[(int)i]-'a'][(int)alphaCount-1] <= lookingNum)//1周
      {
        answer += sn-lookingNum;
        answer += alphabetsList[t[(int)i]-'a'][0];
        lookingNum = alphabetsList[t[(int)i]-'a'][0];
      }else
      {
        long nextNum = alphabetsList[t[(int)i]-'a'][(int)Search(0,alphaCount-1,-1,t[(int)i]-'a')];
        answer += nextNum-lookingNum;
        lookingNum = nextNum;
      }
    }

		Console.WriteLine(answer);
	}

  static long Search(long min, long max, long MinorMax, long listNum)//二分探索法で最小値-1最大値1を求める
  {
    while (true)
    {
      long mid = min + (max - min) / 2;
      if(MinorMax == 1)
      {
        if(Check(mid,listNum)) min = mid;//さらに大きくても成り立つかも
        else max = mid;
      }else
      {
        if(Check(mid,listNum)) max = mid;//さらに小さくても成り立つかも
        else min = mid;
      }

      if(max - min <= 1)
      {
        if(MinorMax == 1)
        {
          if(Check(max,listNum)) return max;//最大値で成り立つかの確認を優先
          else return min;
        }else
        {
          if(Check(min,listNum)) return min;//最小値で成り立つかの確認を優先
          else return max;
        }

      break;
      }  
    }
  }

  static bool Check(long testNum, long listNum)
  {
    if(lookingNum < alphabetsList[(int)listNum][(int)testNum]) return true;
    return false;
  } 
  
}

Measured memory_bytes: 15828
#include <iostream>
using namespace std;
int c[999999];
int main(){
      int a,q=0,i,mn=9999999;
      cin>>a;
      for (i=1;i<=a;++i){
            cin>>c[i];
            q+=c[i];
            mn=min(c[i],mn);
      }
      cout <<q+(mn-a)-mn;
}


Measured memory_bytes: 256
n = int(input())
x = list(map(int, input().split()))

# 体力総和最小値となる座標Pを求める
ave = int(sum(x) / n * 10)
round = ave / 10 - int(ave / 10)
if round - int(round) < 0.5:
    p = int(ave / 10)
else:
    p = int(ave / 10) + 1

# 座標Pの時の体力の総和を求める
ans = 0
for i in range(n):
    ans += (x[i - 1] - p) ** 2

print(ans)


Measured memory_bytes: 38256
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cassert>
#include<cstring>
#include<climits>
#include<sstream>
#include<deque>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<bitset>

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

using namespace std;

typedef long long ll;

long long extgcd(long long a,long long b,long long& x,long long& y) {
  long long d = a;
  if(b != 0){
    d = extgcd(b,a%b,y,x);
    y -= (a/b)*x;
  }
  else
    x = 1,y = 0;
  return d;
}

long long mod_inv(long long a,long long m) {
  long long x,y;
  extgcd(a,m,x,y);
  return (m+x%m)%m;
}

ll mod = 1000000007;
ll fact[200100];

int main() {
  fact[0] = 1;
  REP(i,1,200100) fact[i] = ( fact[i-1] * (ll)i ) % mod;
  int H,W,A,B;
  cin >> H >> W >> A >> B;
  ll ans = 0;
  rep(y,H-A) {
    ll frac = fact[y+B-1];
    ll deno = ( fact[y] * fact[B-1] ) % mod;
    ll s = ( frac * mod_inv(deno,mod) ) % mod;
    frac = fact[(W-B-1)+(H-y-1)];
    deno = ( fact[W-B-1] * fact[H-y-1] ) % mod;
    ll t = ( frac * mod_inv(deno,mod) ) % mod;
    ( ans += ( ( s * t ) % mod ) ) %= mod;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1792
#ifndef BZ
#pragma GCC optimize "-O3"
#endif
#include<bits/stdc++.h>
#define FASTIO ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#define rep(a, c) for (int(a) = 0; (a) < (c); (a)++) 
#define ll long long
#define vi vector<ll>
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pli pair<ll, int> 
#define pb push_back
#define str string
#define mod 998244353
#define pi 3.14159265
using namespace std;
int main()
{
    ll n,sum;
    cin >> n;
    sum=0;
    ll count[n+1];
    for(ll i=1;i<=n;i++)
    {
        count[i]=1;
    }
    for(ll i=2;i<=n;i++)
    {
        for(ll j=1;i*j<=n;j++)
        {
            count[i*j]+=1;
        }
    }
    for(int i=1;i<=n;i++)
    {
        sum=sum+count[i]*i;
    }
    cout << sum << endl;
}

Measured memory_bytes: 81712
// inputに入力データ全体が入る
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
	input = input.split("\n");
	tmp = input[0].split(" ");
	//文字列から10進数に変換するときはparseIntを使います
	var K = parseInt(tmp[0], 10);
	var S = parseInt(tmp[1], 10);
	var x, y, z;
	var count = 0;
	for (var i = 0; i <= K; i++) {
		x = i;
		for (var j = 0; j <= K; j++) {
			y = j;
			z = S - (x + y);
			if (0 <= z && z <= K) {//z=S-(x+y)という関係を用いてforを2つに減らす
			count += 1;
			}
		}
	}
		//出力
	console.log('%d',count);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<map>
#include<cstdlib>
#include<vector>
#include<set>
#include<deque>
#include<queue>
#include<math.h>
#include<chrono>
#include<list>
#include<random>
#include<bitset>
#include<assert.h>
#include<ctime>
#include<cstdio>
#include <unordered_map>

using namespace std;

#define fast_input() {ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); }
//#define ll long long
using ll = long long;

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

/*
MIKUNO - 15/02/1999
*/
const int N = 1e5 + 5;
//	priority_queue <ll, vector<ll>, greater<ll> > q;
int n, m, k, cnt, rs, q;

int main()
{
	fast_input();
	int n;
	cin >> n;
	vector<int>a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	vector<int>dp(n, 1e9);
	dp[0] = 0;
	for (int i = 1; i < n; i++) {
		dp[i] = min(dp[i], dp[i - 1] + abs(a[i - 1] - a[i]));
		if (i >= 2) {
			dp[i] = min(dp[i], dp[i - 2] + abs(a[i - 2] - a[i]));
		}
	}
	cout << dp[n - 1];
}

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

int main(){
  vector<int> n, x, r;

  while(true){
    int a, b; cin >> a >> b;
    if(a==0 && b==0) break;
    n.push_back(a);
    x.push_back(b);
    r.push_back(0);
  }

  for(int l=0; l<(int)n.size(); l++){
    for(int i=1; i<=n[l]; i++){
      for(int j=i; j<=n[l]; j++){
        if(j==i) continue;
        for(int k=j; k<=n[l]; k++){
            if(k==i || k==j) continue;
            if(i+j+k==x[l]) r[l]++;
        }
      }
    }
  }

  for(int i=0; i<(int)n.size(); i++) cout << r[i] << endl;

  return 0;
}



Measured memory_bytes: 3164