akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,n,f=0;
    map<int ,int> _map1;
    cin>>n;
    for(int i = 0; i < n ; i++)
    {
        
        cin>>a;
        if(!_map1.count(a))
        {
            _map1[a] = 1;
        }
        else
        {
            f = 1;
        }
        
    }
    if(f == 1) cout<<"NO"<<endl;
    else cout<<"YES"<<endl;
}

Measured memory_bytes: 9600
#!/usr/bin/env python
# -*- coding: utf-8 -*-


def distance(p1, p2):
    return abs(p1[0] - p2[0]) + abs(p1[1] - p2[1])


n, m = map(int, input().split())
st = [[int(a) for a in input().split()] for _ in range(n)]
cp = [[int(a) for a in input().split()] for _ in range(m)]

for s in st:
    index, dist = 0, 9999999999999999999999
    for i, c in enumerate(cp):
        if distance(s, c) < dist:
            index, dist = i, distance(s, c)
    print(index + 1)


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

#define fastio ios_base::sync_with_stdio(0); cin.tie(0)

typedef long long ll;

const int M=2e5+5;
const int INF=2e9;
const int MOD=1e9+7; //prime number

void Solve(int n);

void Solve()
{
    float N,X;
    int T;
    cin >> N >> X >> T;
    int counter = ceil(N/X);
    cout <<  counter* T;

}
int main()
{
    fastio;
    Solve();

    return 0;
}
void Solve(int n)
{
    for(int i = 1; i <= n; ++i)
    {
        cout << "Case " << i << ":" << '\n';
        Solve();
        cout << '\n';
    }
}


Measured memory_bytes: 3732
#include<stdio.h>
int main()
{
    char s[4],t[4];
    gets(s);
    gets(t);
    int i,count=0;
    for(i=0;i<3;i++)
    {
        if(s[i]==t[i])
        {
            count++;
        }
    }
    printf("%d\n",count);
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  double a;
  double sum = 0.0;
  cin >> N;;
  for(int i=0; i<N; i++) {
    cin >> a;
    sum += 1/a;
  }
  cout << 1/sum << endl;
}

Measured memory_bytes: 256
// IO
#include <cstdio>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm
#include <algorithm>
#include <cmath>
#include <numeric>

// container
#include <vector>
#include <string>
#include <tuple>
#include <set>
#include <map>
#include <unordered_map>
#include <stack>
#include <queue>
#include <deque>

// others
#include <random>
#include <limits>
#include <functional>
#include <ctime>
#include <cassert>

// type alias
using lint = long long;
using ldouble = long double;
template <class T>
using greater_priority_queue = std::priority_queue<T, std::vector<T>, std::greater<T>>;


/* ----- class ----- */

template <class Cost = int>
struct Edge {
    int src, dst;
    Cost cost;
    Edge(int src = -1, int dst = -1, Cost cost = 1)
        : src(src), dst(dst), cost(cost){};

    bool operator<(const Edge<Cost>& e) const { return this->cost < e.cost; }
    bool operator>(const Edge<Cost>& e) const { return this->cost > e.cost; }
};

template <class Cost = int>
using Edges = std::vector<Edge<Cost>>;

template <class Cost = int>
using Graph = std::vector<std::vector<Edge<Cost>>>;


/* ----- debug ----- */

#if __has_include("../setting/source/debug.hpp")
#include "../setting/source/debug.hpp"
#endif


/* ----- short functions ----- */

template <class T>
inline T sq(T a) { return a * a; }

template <class T>
inline T iceil(T n, T d) { return (n + d - 1) / d; }

template <class T>
T gcd(T a, T b) {
    while (b > 0) {
        a %= b;
        std::swap(a, b);
    }
    return a;
}

template <class T, class U>
T ipow(T b, U n) {
    T ret = 1;
    while (n > 0) {
        if (n & 1) ret *= b;
        n >>= 1;
        b *= b;
    }
    return ret;
}

// 0-indexed
template <class T, class U>
inline T kthbit(T a, U k) { return (a >> k) & 1; }

template <class T, class U>
inline T mask(T a, U k) { return a & ((1 << k) - 1); }

template <class T>
std::map<T, int> compress(std::vector<T>& v) {
    std::sort(v.begin(), v.end());
    v.erase(std::unique(v.begin(), v.end()), v.end());

    std::map<T, int> rev;
    for (int i = 0; i < v.size(); ++i) rev[v[i]] = i;
    return rev;
}

template <class T>
T Vec(T v) { return v; }

template <class T, class... Ts>
auto Vec(size_t l, Ts... ts) {
    return std::vector<decltype(Vec<T>(ts...))>(l, Vec<T>(ts...));
}


/* ----- constants ----- */

// const int INF = std::numeric_limits<int>::max() / 3;
// const lint INF = std::numeric_limits<lint>::max() / 3;
// const ldouble PI = acos(-1);
// const ldouble EPS = 1e-10;
// std::mt19937 mt(int(std::time(nullptr)));


using namespace std;

int main() {
    int N;
    cin >> N;
    vector<pair<lint, lint>> P(N);
    for (auto& p : P) {
        cin >> p.second >> p.first;
    }
    sort(P.begin(), P.end());

    lint now = 0;
    for (auto p : P) {
        now += p.second;
        if (now > p.first) {
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;
    return 0;
}


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

void out(vector<int> a,int n){
    rep(j,n){
        cout << a[j];
        if(j!=n-1) cout << " ";
    }
    cout << endl;
}

void bubbleSort(vector<int> a,int n){
    int flag = 1,cnt = 0;
    while(flag){
        flag = 0;
        for(int i=n-1;i>=1;i--){
            if(a[i]<a[i-1]){
                swap(a[i],a[i-1]);
                cnt++;
                flag = 1;
            }
        }
    }
    out(a,n);
    cout << cnt << endl;
}

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    bubbleSort(a,n);
    return 0;
}


Measured memory_bytes: 3140
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<iomanip>
#include<set>
#include<queue>

using namespace std;

int main()
{
	int  n;
	cin >> n;
	
	cout << setprecision(10) << (double)((double)(n-n/2)/n) << endl;




}


Measured memory_bytes: 256
def f(x):
  if x%2:
    return 3*x+1
  else:
    return x//2
s = int(input())
result = [s]
count = 1
while True:
  can = f(result[-1])
  if can in result:
    print(count+1)
    break
  else:
    result.append(can)
    count += 1

Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {

	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		int q = sc.nextInt();
		
		boolean f = false;
		String ans = "";
		String pre = "kogakubu10gokan";
		for(int i=0;i<n;i++){
			int y = sc.nextInt();
			String nex = sc.next();
			if(!f && y>q){
				f = true;
				ans = pre;
			}
			pre = nex;
		}
		if(ans.equals("")) ans = pre;
		System.out.println(ans);
	}

}

Measured memory_bytes: 18088
#include<bits/stdc++.h>
#define int long long
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef pair<int,int>P;
#define F first
#define S second
main(){
	int n;
	cin>>n;
	vector<P>v;
	r(i,n){
		int a,b;
		cin>>a>>b;
		v.push_back(P(a,b));
	}
	sort(v.begin(),v.end(),greater<P>() );
	cout<<v[0].first+v[0].second<<endl;
}

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

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        int H = Integer.parseInt(sc.next());
        int W = Integer.parseInt(sc.next());
        int h = Integer.parseInt(sc.next());
        int w = Integer.parseInt(sc.next());
        sc.close();

        int remain = (H - h) * (W - w);
        out.printf("%d\n", remain);
        out.flush();
    }
}


Measured memory_bytes: 23636
//ΔAGC029C
#include<iostream>
#include<cstdio>
#include<fstream>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<bitset>
#include<cmath>
#include<cstring>
#include<cstdlib>
using namespace std;
typedef long long LL;
typedef double DB;
const int N = 222222;
int n,a[N];
map<int,int> M;
set<int> S;
int ok(int x){
	int i,t=0;
	M.clear();
	S.clear();
	for(i=1;i<=n;i=i+1){
		if(a[i]>a[i-1])
			continue;
		t=a[i];
		while(!S.empty()&&*S.rbegin()>t){
			M[*S.rbegin()]=0;
			S.erase(*S.rbegin());
		}
		while(M[t]==x-1){
			M[t]=0;
			S.erase(t);
			t--;
		}
		if(t<=0)
			return 0;
		M[t]++;
		S.insert(t);
	}
	return 1;
}
int main()
{
	int i,l,r;
	scanf("%d",&n);
	for(i=1;i<=n;i=i+1)
		scanf("%d",a+i);
	for(i=2;i<=n;i=i+1)
		if(a[i-1]>=a[i])
			break;
	if(i>n){
		cout<<1;
		return 0;
	}
	for(i=2;i<=5;i=i+1){
		if(ok(i)){
			cout<<i;
			return 0;
		}
	}
	l=6,r=n;
	while(l<r){
		i=l+r>>1;
		if(ok(i))
			r=i;
		else
			l=i+1;
	}
	cout<<l;
	return 0;
}

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

//うますぎ
int main(){
    const ll mod = 1e9 + 7;
    ll n, m;
    cin >> n >> m;
    vector<ll> x(n), y(m);
    rep(i,n) cin >> x.at(i);
    rep(i,m) cin >> y.at(i);
    ll xsum = 0,ysum = 0;
    rep(i,n){
        xsum = (xsum + i * x.at(i) - (n - i - 1) * x.at(i))% mod;
    }
    rep(i,m){
        ysum = (ysum + i * y.at(i) - (m - i - 1) * y.at(i))%mod;
    }
    ll ans = (xsum * ysum) % mod;
    cout << ans << endl;
    return 0;
}

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

int main() {
  int a,b;
  cin >> a >> b;
  if(a<b){
    cout << "0";
  }
  else{
    cout << "10";
  }
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define pii pair<ll,ll>
#define vi vector<ll>
#define vii vector<pii>
#define mi map<ll,ll>
#define mii map<pii,ll>
#define ms map<string,ll>
#define itr ::iterator
#define all(x) x.begin(),x.end()
#define f(i,a,b) for(ll i=a;i<b;i++)
#define fe(i,a,b) for(ll i=a;i<=b;i++)
#define fn(i,a,b) for(ll i=a;i>b;i--)
#define fm(it,m) for(it = m.begin();it != m.end();++it)
#define db(i) cout<<i<<"  "
#define M 1000000007

int main()
{ ll t=1;
  //cin>>t;
  while(t--)
  { ll h=0,n=0,k=0;
    cin>>h>>n;
    ll a[n];
    f(i,0,n)
     {cin>>a[i];
      k=k+a[i];
     }
    if(k>=h)
        cout<<"Yes";
    else cout<<"No";

  }
return 0;
}


Measured memory_bytes: 1024
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np
from functools import reduce

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

x = ri()
max_ = 0
for i in range(int(x**0.5), 0, -1):
    for j in range(1, 10):
        if i**j <= x:
            max_ = max(i**j, max_)
        else:
            break
print(max_)












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

using namespace std;

void swap(int *xp, int *yp){
    int temp = *xp;
    *xp = *yp;
    *yp = temp;
}

void printArray(int arr[], int n){
    for(int i=0; i<n; i++){
        if(i==n-1){
            cout<<arr[i];
        }
        else{
            cout<<arr[i]<<" ";
        }
    }
}

void selectionSort(int arr[], int n){
    
    int sCount = 0;
    
    for(int i=0; i<n-1; i++){
        int mini = i;
        for(int j=i+1; j<n; j++){
            if(arr[j]<arr[mini]){
                mini = j;
            }
        }
        if(i!=mini){
        swap(&arr[i],&arr[mini]);
        sCount++;
        }
    }
    
    printArray(arr,n);
    cout<<endl;
    cout<<sCount<<endl;
}

int main(){
    
    int n;
    cin >> n;
    
    int arr[n];
    for(int i=0; i<n; i++){
        cin >> arr[i];
    }
    
    selectionSort(arr,n);
    return 0;
}


Measured memory_bytes: 3104
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    int h[100010];
    rep(i, n) cin >> h[i];
    int l = h[0];
    rep(i, n - 1) {
        if(h[i] < h[i + 1]) l = h[i + 1];
        else if(l > h[i + 1] + 1) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;

    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
typedef long long ll;
#define pb push_back
#define mii map <int, int>
#define mll map <ll, ll>
#define pii pair <int, int>
#define pll pair <ll, ll>
#define vi vector <int>
#define vd vector <double>
#define vll vector <ll>
#define fi first
#define se second
#define si set <int>
#define sll set <ll>
#define spii set <pii>
#define vpii vector <pair <int,int> >
#define vpll vector <pair <long long,long long> >
#define vvi vector <vector <int> >
#define vvpii vector <vector <pii > >
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(),(x).rend()


using namespace std;
const ll INFLL = 1e18;
const int MAXN = 1e6+100;
const ll INF = 1e9;
const ll mod1=1e9+7;
const ll mod2=2e9+11;

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    #ifdef LOCAL
    freopen("a.in","r",stdin);
    #endif
    int x;
    cin>>x;
    for (int i=x;i<1000000000;i++)
    {
        bool ok=true;
        for (ll j=2;j*j<=i;j++)
        {
            if (i%j==0)
            {
                ok=false;
                break;
            }
        }
        if (ok) {
            cout << i;
            return 0;
        }
    }


}

Measured memory_bytes: 256
import * as fs from "fs";

const input = (fs.readFileSync("/dev/stdin", "utf8") as string).split("\n");
//const n = +input[0];
//const a = [];
//for(let i=0;i<n;i++){
//	a.push(input[i+1].split(" ").map((x:string):number=>+x));
//}

//const [n, m] = input[0].split(" ").map((x: string): number => +x);
//const a = input[1].split(" ").map((x: string): number => +x);

function compareFunc(a, b){
    return a-b;
}

const [a, b]: number[] = input[0].split(' ').map((x: string): number => +x);

if(a >=10 || b>= 10){
    console.log(-1);
}else{
    console.log(a*b);
}



Measured memory_bytes: 7372
#include <iostream>
#include <cstdio>
#include <cassert>
#include <cstring>
#include <vector>
#include <valarray>
#include <array>
#include <queue>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <complex>
#include <random>
#include <bitset>
#include <stack>

using namespace std;
using ll = long long;
using ull = unsigned long long;


const int MN = 110;
const ll INF = 1LL<<55;

struct E {
    int t;
    ll a, b, d;
    ll cost(ll f) {
        if (f <= d) return a*f;
        return a*d + b*(f-d);
    }
};
vector<E> g[MN];
vector<E> rg[MN];

void solve(int s, int f, ll dp[], bool rev = false) {
    if (f == 0) {
        fill_n(dp, MN, 0);
        return;
    }
    fill_n(dp, MN, INF);
    using P = pair<ll, int>;
    priority_queue<P, vector<P>, greater<P>> q;
    q.push(P(0, s));
    dp[s] = 0;
    while (!q.empty()) {
        P p = q.top(); q.pop();
        if (dp[p.second] < p.first) continue;
        auto gp = (!rev) ? g[p.second] : rg[p.second];
        for (E e: gp) {
            if (p.first+e.cost(f) < dp[e.t]) {
                dp[e.t] = p.first+e.cost(f);
                q.push(P(p.first+e.cost(f), e.t));
            }
        }
    }
}

int main() {
    int n, m, s, t;
    ll f;
    cin >> n >> m >> s >> t >> f;
    int exc_s = -1;
    E exc;
    for (int i = 0; i < m; i++) {
        int s, t;
        ll a, b, d;
        cin >> s >> t >> a >> b >> d;
        if (a < b) {
            exc_s = s;
            exc = E{t, a, b, d};
        } else {
            g[s].push_back(E{t, a, b, d});
            rg[t].push_back(E{s, a, b, d});
        }
    }
    ll re = INF;
    if (exc_s != -1) {
        static ll dp0[MN], dp1[MN], dp2[MN], dp3[MN], dp4[MN];
        solve(s, f, dp0);
        solve(t, f, dp1, true);
        for (int i = 0; i <= f; i++) {
            solve(exc_s, i, dp2, true);
            solve(exc.t, i, dp3);
            for (int x = 0; x < n; x++) {
                solve(x, f-i, dp4);
                for (int y = 0; y < n; y++) {
                    re = min(re, exc.cost(i)+dp0[x]+dp1[y]+dp2[x]+dp3[y]+dp4[y]);
                }
            }
        }
    } else {
        static ll dp[MN];
        solve(s, f, dp);
        re = dp[t];
    }
    if (re >= INF/2) {
        cout << "Impossible" << endl;
    } else {
        cout << re << endl;
    }
    return 0;
}

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

int main() {
	int a[25] = { 0 };
	string s;
	cin >> s;

	for (int i = 0; i<s.size(); i++) {
		a[s[i] - 97]++;
	}

	for (int i = 0; i<25; i++) {
		if (a[i] % 2 != 0) {
			cout << "No" << endl;

			return 0;
		}
	}
	cout << "Yes" << endl;
	
}

Measured memory_bytes: 384
n=int(input())
arr=list(map(int,input().split()))
cum=[0]*n
mod=10**9+7
cum[0]=arr[0]%mod

for i in range(1,n):
    cum[i]=cum[i-1]+arr[i]
    cum[i]%=mod

ans=0
for i in range(n):
    ans+=(arr[i]*((cum[-1]-cum[i])%mod))%mod
    ans%=mod
print(ans)

Measured memory_bytes: 93752
#include <bits/stdc++.h>
#define ll long long
#define endl "\n"
#define the_flash ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define input_output freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout)

using namespace std;

int main()
{
	//input_output;
	the_flash;
	string w;
	cin >> w;
	for (char ch = 'a'; ch <= 'z'; ch++)
	{
		int count = 0;

		for (int i = 0; i < w.length(); i++)
		{
			if (w[i] == ch)
				count++;
		}

		if (count % 2 == 1)
		{
			cout << "No" << endl;
			return 0;
		}
	}

	cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 3652
class Edge
    attr_accessor :from, :to, :cost
    def initialize(from, to, cost)
        @from = from
        @to = to
        @cost = cost
    end

    def comp(r)
        return @cost < r.cost || (@cost == r.cost && @to < r.to) || (@cost == r.cost && @to == r.to && @from <= r.from)
    end

    def inspect
        return "(" + @from.to_s + " -> " + @to.to_s + ", cost:" + @cost.to_s + ")"
    end
end

class Heap
    def initialize
        @heap = []
    end

    def push(e)
        @heap.push(e)
        now = @heap.length - 1
        while now > 0
            to = (now-1)/2
            if @heap[to].comp(@heap[now])
                break
            else
                temp = @heap[to]
                @heap[to] = @heap[now]
                @heap[now] = temp
                now = to
            end
        end
    end

    def pop
        size = @heap.size
        @heap[0] = @heap[size-1]
        @heap.pop
        back = size-2
        now = 0
        while now * 2 + 1 <= back
            if @heap[now].comp(@heap[now*2+1])
                if now * 2 + 2 > back || (now * 2 + 2 <= back && @heap[now].comp(@heap[now*2+2]))
                    break
                else
                    temp = @heap[now]
                    @heap[now] = @heap[now*2+2]
                    @heap[now*2+2] = temp
                    now = now*2+2
                end
            else
                temp = @heap[now]
                @heap[now] = @heap[now*2+1]
                @heap[now*2+1] = temp
                now = now*2+1
            end
        end
    end

    def top
        return @heap[0]
    end

    def print
        p @heap
    end

    def empty
        return @heap.length == 0
    end
end



class Graph
    def initialize(n)
        @N = n  
        @edge = []
        for i in 0...n
            @edge.push([])
        end
    end

    def addEdge(f, t, c)
        @edge[f].push(Edge.new(f,t,c))
    end

    def dijkstra(s)
        dist = Array.new(@N, -1)
        dist[s] = 0
        que = Heap.new()
        for e in @edge[s]
            if dist[e.to] == -1
                que.push(e)
            end
        end
        while !que.empty
            move = que.top
            que.pop
            if dist[move.from] + move.cost < dist[move.to] || dist[move.to] == -1
                dist[move.to] = dist[move.from] + move.cost
                for e in @edge[move.to]
                    if dist[e.to] == -1
                        que.push(e)
                    end
                end 
            end
        end
        return dist
    end
end

n = gets.split.map(&:to_i)
n = n[0]
g = Graph.new(n)
for i in 0...(n-1)
    a,b = gets.split.map(&:to_i)
    a-=1
    b-=1
    g.addEdge(a,b,1)
    g.addEdge(b,a,1)
end
distF = g.dijkstra(0)
distS = g.dijkstra(n-1)
fennec = 0
for i in 1...(n-1)
    if distF[i] <= distS[i]
        fennec += 1
    else
        fennec -= 1
    end
end
if fennec > 0
    puts "Fennec"
else
    puts "Snuke"
end
#as = gets.split.map(&:to_i)

=begin
    N, M = gets.split.map(&:to_i)
    AS = N.times{ gets.to_i }
=end


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

/**
 * Made by egor https://github.com/chermehdi/egor.
 * 
 * @author Azuz
 * 
 */
public class Main {

    void solve(Scanner in, PrintWriter out) {
      int s = in.nextInt();
      int w = in.nextInt();

      out.println(s <= w ? "unsafe" : "safe");
    }

    public static void main(String[] args) {
        try(Scanner in = new Scanner(System.in);
            PrintWriter out = new PrintWriter(System.out)) {
            new Main().solve(in, out);
        }
    }
}


Measured memory_bytes: 35812
#include <iostream>
using namespace std;
class Card {
public:
	int num;
	char ch;
};
inline void bubbleSort(Card a[], int n){
	bool flag = 1;
	for (int i = 0; flag; i++) {
		flag = 0;
		for (int j = n - 1; j >= i + 1; j--) {
			if (a[j].num < a[j - 1].num) {
				swap(a[j], a[j - 1]);
				flag = 1;
			}
		}
	}
}
inline void selectionSort(Card a[], int n) {
	for (int i = 0; i < n-1; i++) {
		int minj = i;
		for (int j = i + 1; j < n; j++) {
			if (a[j].num < a[minj].num) {
				minj = j;
			}
		}
		swap(a[i], a[minj]);
	}
}
inline void put(Card a[], int n) {
	cout << a[0].ch << a[0].num;
	for (int i = 1; i < n; i++) {
		cout << ' ' << a[i].ch << a[i].num;
	}
	cout << endl;
}
inline bool isStable(Card c1[], Card c2[], int n) {
	for (int i = 0; i < n; i++) {
		if (c1[i].ch != c2[i].ch)
			return false;
	}
	return true;
}
int main() {
	const int n = 36;
	Card ar1[n], ar2[n];
	int num;
	cin >> num;
	for (int i = 0; i < num; i++) {
		cin >> ar1[i].ch >> ar1[i].num;
	}
	for (int i = 0; i < num; i++)
		ar2[i] = ar1[i];
	bubbleSort(ar1, num);
	put(ar1, num);
	cout << "Stable" << endl;
	selectionSort(ar2, num);
	put(ar2, num);
	if (isStable(ar1, ar2, num)) 
		cout << "Stable" << endl;
	else cout << "Not stable" << endl;
	
	return 0;
}

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

int main() {
	int i,n,a,b,c,d,s[200005];
	string ss;
	cin >> n >> a >> b >> c >> d >> ss;
	a=a-1; b=b-1; c=c-1; d=d-1;
	for(i=0;i<n;i++){
		if(ss[i]=='#') s[i]=1;
		else s[i]=0;
	}
	for(i=a+1;i<c;i++){
		if(s[i-1]==1&&s[i]==1){
			cout << "No" << endl;
			return 0;
		}
	}
	for(i=b+1;i<d;i++){
		if(s[i-1]==1&&s[i]==1){
			cout << "No" << endl;
			return 0;
		}
	}
	if(a<b&&d<c){
		int flag=0;
		for(i=b+1;i<=d+1;i++){
			if(s[i-2]==0&&s[i-1]==0&&s[i]==0) flag=1;
		}
		if(flag==1) cout << "Yes" << endl;
		else cout << "No" << endl;
	} else {
		cout << "Yes" << endl;
	}
	return 0;
}

Measured memory_bytes: 1284
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,n) for(int i = 0; i < n; ++i)
#define rep2(i,st,ed) for(int i = st; i < ed; ++i)
#define mk(x,y) make_pair(x,y)
#define pb(x) push_back(x)
const ll mod = 1e9 + 7;
const ll N = 2e5 + 200;
const int INF = 0x3f3f3f3f;
const double eps = 1e-7;



int main(){
	string s;
	cin>>s;
	if(s == "ABC"){
		cout<<"ARC"<<endl;
	}else{
		cout<<"ABC"<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 3628
import java.io.IOException;

import java.io.BufferedReader;
import java.io.InputStreamReader;

import java.util.Arrays;
import java.util.Comparator;

public class Main {
    public static void main(String[] args) throws IOException {
        try (
            BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in))) {
            final String s = reader.readLine();

            final String[] sl = s.split(" ");
            int A = Integer.parseInt(sl[0]);
            int B = Integer.parseInt(sl[1]);
            int C = Integer.parseInt(sl[2]);

            Integer[] X = new Integer[3];

            X[0] = A;
            X[1] = B;
            X[2] = C;

            Arrays.sort(X, Comparator.reverseOrder());

            System.out.println(X[0] * 10 + X[1] + X[2]);
        }
    }
}


Measured memory_bytes: 22868
#include <iostream>
#include <vector>

using namespace std;

int main()
{
    int N, M;
    cin >> N >> M;

    vector<int> v(N);
    for(int i = 0; i < M; i++) {
        int a, b;
        cin >> a >> b;
        v[a-1]++;
        v[b-1]++;
    }

    for(int i = 0; i < N; i++) {
        cout << v[i] << endl;
    }
    return 0;
}


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

using ll = long long;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define ddrep(i, n) for (int i = n; i > 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define ssrep(i, s, t) for (int i = s; i <= t; ++i)

#define rng(a) a.begin(), a.end()
#define rrng(a) a.rbegin(), a.rend()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))

using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  rep(i, (int)v.size()) {
    if (i)
      os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}

template <typename T, size_t S> void printArray(const T (&array)[S]) {
  for (auto val : array)
    std::cout << val << ", ";
  std::cout << "\n";
}

const int mod = 1e9 + 7;
const int inf = 1e9 + 5;

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

  int x, t; std::cin >> x >> t;
  std::cout << max(0, x - t) << "\n";
}


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

int main(){
  
  string s;
  
  cin >> s;
  
  if(s[0] != s[1] && s[1] != s[2] && s[2] != s[0]) cout << "Yes" << endl;
  else cout << "No" << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <functional>
#include <utility>
using namespace std;
typedef unsigned long ulong;

class Solver {

public:
	static void solve() {
		int t, d;
		cin >> t >> d;
		int ta, tb;
		cin >> ta >> tb;
		int da, db;
		cin >> da >> db;

		double res = 1000;

		for (int i = 0; da * i <= d; i++) {
			int delta = d - da * i;
			for (int j = 0; db * j <= delta; j++) {
				if (i == j && i == 0)continue;

				double tTemp = 1.0 * (ta * da * i + tb * db * j) 
					/ (da * i + db * j);
				res = min(res, abs(t - tTemp));
			}
		}

		cout << res;
	}

};

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


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

// def
#define debug(x) cout << #x << ": " << x << endl
#define out(x) cout << x << endl
#define repeat(i, a, b) for (int i = (a); i < (b); i++)
#define revrepeat(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define revrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define foreach(e, v) for (auto &e : v)
#define all(x) (x).begin(), (x).end()
#define CYES cout << "Yes" << endl
#define CNO cout << "No" << endl
#define SPC(x) cout << fixed << setprecision(x)
#define ZERO(a) memset(a, 0, sizeof(a))
#define MINUS(a) memset(a, 0xff, sizeof(a))

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vector<int>> vii;
typedef vector<ll> vl;
typedef vector<vector<ll>> vll;
typedef pair<int, int> P;
typedef complex<ld> Point;
const int MOD = 1e9 + 7;
const int INF = 1e9;
const int MAX_V = 1e5 + 5;
const int MAX_N = 1e5 + 5;
const double PI = acos(-1);

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

// make vector of divisor O(sqrt(n))
vector<long long> divisor(long long n) {
    vector<long long> res;
    for (long long i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            res.push_back(i);
            if (i != n / i) res.push_back(n / i);
        }
    }
    return res;
}
bool is_prime(long long n) {
    for (long long i = 2; i * i <= n; i++) {
        if (n % i == 0) return false;
    }
    return n != 1; // exclude 1
}

// factorization O(sqrt(n))
map<long long, long long> prime_factor(long long n) {
    map<long long, long long> res;
    for (long long i = 2; i * i <= n; i++) {
        while (n % i == 0) {
            ++res[i];
            n /= i;
        }
    }
    if (n != 1) res[n] = 1;
    return res;
}

int main() {
    ll x;
    cin >> x;
    int ans = 1;
    repeat(i, 2, x + 1) {
        auto m = prime_factor(i);
        bool ok = true;
        ll xn = m.begin()->second;
        foreach (e, m) {
            ll size = e.second;
            if (xn != size or size == 1) {
                ok = false;
                break;
            }
        }
        if (ok) chmax(ans, i);
    }

    out(ans);
}


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

public class Main {
    public static void main(String[] args) {
        try {
            // 標準入力
            InputStreamReader isr = new InputStreamReader(System.in);
            BufferedReader br = new BufferedReader(isr);
            String strArr[]= br.readLine().split(" ");
            long a = Long.parseLong(strArr[0]);
            long b = Long.parseLong(strArr[1]);
            long c = Long.parseLong(strArr[2]);
            long ans1 = a + b;
            long ans2 = a + c;
            long ans3 = b + c;
            if (ans1 < ans2 && ans1 < ans3) {
                System.out.println(ans1);
            } else if (ans2 < ans1 && ans2 < ans3) {
                System.out.println(ans2);
            } else {
                System.out.println(ans3);
            }
        } catch (IOException e) {
            e.printStackTrace();
           }
    }
}

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

int find(int u,int o,int* a,int x){

    if(o<=u+1){return 0;}

    int k = (u+o)/2;
    if(a[k] == x){return 1;}
    else if(a[k] <x){
        return find(k,o,a,x);
    }
    else {
        return find(u,k,a,x);
    }


}

int main(){
    int r[4000],g[4000],b[4000];
    int rlen = 0;
    int glen = 0;
    int blen = 0;
    int N;
    cin >> N;
    for(int i=1;i<=N;i++){
        char c;
        cin >> c;
        if(c=='R'){
            r[rlen]=i;
            rlen +=1;}
        else if(c=='G'){
            g[glen]=i;
            glen+=1;
        }
        else{
            b[blen] = i;
            blen +=1;
        }

    }
    if(rlen ==0 || glen == 0 || blen == 0){cout << 0 << endl;}
    else{
        long long int sum=0;
        for(int i=0;i<rlen;i++){
            for(int j=0;j<glen;j++){
                if( (r[i]+g[j])%2==0){
                    int x=(r[i]+g[j])/2;
                    if(find(-1,blen,&(b[0]),x)==1){sum+=1;}

                }

            }
        }
        for(int i=0;i<rlen;i++){
            for(int j=0;j<blen;j++){
                if( (r[i]+b[j])%2==0){
                    int x=(r[i]+b[j])/2;
                    if(find(-1,glen,&(g[0]),x)==1){sum+=1;}
                    
                }

            }
        }
        for(int i=0;i<blen;i++){
            for(int j=0;j<glen;j++){
                if( (b[i]+g[j])%2==0){
                    int x=(b[i]+g[j])/2;
                    if(find(-1,rlen,&(r[0]),x)==1){sum+=1;}
                    
                }

            }
        }
        cout << (long long int)rlen*glen*blen - sum << endl;
    }


    return 0;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int numbers[] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  int k;
  cin >> k;
  cout << numbers[k-1];
}

Measured memory_bytes: 256
import java.io.*;

public class Main{
	public static void main(String args[]){
		try{
			new Main();
		}catch(IOException e){
			e.printStackTrace();
		}
	}

	public Main() throws IOException{
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String line;

		while((line = in.readLine()) != null){
			int size = Integer.parseInt(line);
			for(int n=0; n<size; n++){
				line = in.readLine();
				String[] tmp = line.split(" ");
				int s = Integer.parseInt(tmp[0]);
				int g = Integer.parseInt(tmp[1]);
				if(s <=5 && g <= 5 && s<=g){
					for(int i=s; i<=g; i++){
						System.out.print(i);
						if(i!=g){
							System.out.print(" ");
						}
					}
					System.out.println();
				}
				else if(s <=5 && g <= 5 && s>g){
					for(int i=s; i>=g; i--){
						System.out.print(i);
						if(i!=g){
							System.out.print(" ");
						}
					}
					System.out.println();
				}
				else if(s<=5 && g>5){
					for(int i=s; i<=g; i++){
						System.out.print(i);
						if(i!=g){
							System.out.print(" ");
						}
					}
					System.out.println();
				}
				else if(s>5 && g<=5){
					for(int i=s; i<=9; i++){
						System.out.printf("%d ", i);
					}

					for(int i=5; i>=g; i--){
						System.out.print(i);
						if(i!=g){
							System.out.print(" ");
						}
					}
					System.out.println();
				}
				else if(s>5 && g>5 && s<=g){
					for(int i=s; i<=g; i++){
						System.out.print(i);
						if(i!=g){
							System.out.print(" ");
						}
					}
					System.out.println();
				}
				else if(s>5 && g>5 && s>g){
					for(int i=s; i<=9; i++){
						System.out.printf("%d ", i);
					}

					for(int i=5; i>0; i--){
						System.out.printf("%d ", i);
					}

					for(int i=0; i<5; i++){
						System.out.printf("%d ", i);
					}

					for(int i=5; i<=g; i++){
						System.out.print(i);
						if(i!=g){
							System.out.print(" ");
						}
					}
					System.out.println();
				}
			}
		}
	}
}

Measured memory_bytes: 11000
#include"bits/stdc++.h"
#include<boost/multi_array.hpp>
#include<boost/optional.hpp>
#include<boost/range/irange.hpp>
#include<boost/range/algorithm.hpp>
#include<boost/range/adaptor/reversed.hpp>
#include<boost/operators.hpp>
#include<boost/dynamic_bitset.hpp>
namespace adaptor = boost::adaptors;
template<class T>using p_queue = std::priority_queue<T, std::vector<T>, std::greater<>>;

void Main()
{
	int N;
	std::cin >> N;
	std::vector<std::pair<int, int>> vec(N);
	for (auto& p : vec)
	{
		std::cin >> p.second >> p.first;
	}
	boost::sort(vec);
	int sum = 0;
	for (auto&& p : vec)
	{
		sum += p.second;
		if (p.first < sum)
		{
			std::cout << "No" << std::endl;
			return;
		}
	}
	std::cout << "Yes" << std::endl;
}

int main()
{
	std::cin.tie(nullptr);
	std::ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	Main();
}

Measured memory_bytes: 1792
/**
  * @brief atcoder
  * @author yao
  */
#include <cstdlib>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <utility>
#include <algorithm>
#include <functional>
#include <climits>
#define ft first
#define sd second
#ifdef DBG
#   define dbg_pri(x...) fprintf(stderr,x)
#else
#   define dbg_pri(x...) 0
#   define NDEBUG
#endif //DBG
#include <cassert>

typedef unsigned int uint;
typedef long long int lli;
typedef unsigned long long int ulli;

#define N 512

const int dir[4] = {-N,-1,N,1};
int a[N*N], dis[N*N];
int que[N*N];
int cq,nq;
int f[N*N];

int main()
{
    int n;
    scanf("%d", &n);
    for(int i=0;i<n*n;++i) scanf("%d", &a[i]), --a[i];
    for(int i=1;i<=n;++i)for(int j=1;j<=n;++j)
        dis[i*N+j] = std::min(std::min(i,n-i+1),std::min(j,n-j+1)), f[i*N+j] = 1;
    int ans = 0;
    for(int i=0;i<n*n;++i)
    {
        int pos = a[i]/n*N + a[i]%n + N + 1;
        --dis[pos], f[pos] = 0;
        ans += dis[pos];
        nq = cq = 0;
        que[nq++] = pos;
        while(cq < nq)
        {
            int u = que[cq++];
            for(int d=0;d<4;++d)
            {
                int v = u + dir[d];
                if(dis[u]+f[v] >= dis[v]) continue;
                dis[v] = dis[u]+f[v];
                que[nq++] = v;
            }
        }
    }
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 5588
N = int(input())
H = list(map(int, input().split()))

is_mono_inc = True
now = min(H) #現ステップでこれより大きい必要 
for i in range(N):
    if now <= H[i]:
        now = H[i]
    elif now > H[i] and now <= H[i]+1:
        now = H[i]+1
    else:
        is_mono_inc = False

if is_mono_inc:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 20532
#include<stdio.h>
#include<stdlib.h>

int n, A, B, C;
int l[8];
int max = 4680;

int MIN(int a, int b){return a<b?a:b;};

int dfs(int cur, int a, int b, int c, int ta, int tb, int tc){
    if(cur == n){
        if(a * b * c == 0){return max;}
        return abs(A-a) + abs(B-b) + abs(C-c) + 10*((ta-1) + (tb-1) + (tc-1));
    }
    int ret0 = dfs(cur+1, a, b, c, ta, tb, tc);
    int ret1 = dfs(cur+1, a+l[cur], b, c, ta+1, tb, tc);
    int ret2 = dfs(cur+1, a, b+l[cur], c, ta, tb+1, tc);
    int ret3 = dfs(cur+1, a, b, c+l[cur], ta, tb, tc+1);
    
    return MIN(ret3,MIN(ret2,MIN(ret0, ret1)));
}

int main(void){
    scanf("%d%d%d%d", &n, &A, &B, &C);
    for(int i = 0; i < n; i++){scanf("%d", &l[i]);}
    printf("%d\n", dfs(0, 0, 0, 0, 0, 0, 0));
    return 0;
}

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

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, pii> pipii;
typedef pair<pii, int> piipi;
typedef pair<pii, pii> piipii;

#define mp make_pair
#define fi first
#define se second
#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()
#define eb emplace_back

int a[100005];
ll dp[100005][4];
int main(){
    int n;
    scanf("%d", &n);

    for(int i=1;i<=n;i++){
        for(int j=0;j<3;j++) dp[i][j] = -1e18;
    }

    scanf("%d", &a[1]);
    dp[1][0] = a[1];
    for(int i=2;i<=n;i++){
        char s[2];
        scanf("%s", s);
        scanf("%d", &a[i]);
        for(int j=0;j<3;j++){
            int op = j%2;
            if(s[0] == '-') op = (op+1)%2;

            // open
            if(s[0] == '-'){
                if(op == 0) dp[i][j+1] = max(dp[i][j+1], dp[i-1][j] + a[i]);
                else dp[i][j+1] = max(dp[i][j+1], dp[i-1][j] - a[i]);
            }

            // close
            if(j > 0){
                if(op == 0) dp[i][j-1] = max(dp[i][j-1], dp[i-1][j] + a[i]);
                else dp[i][j-1] = max(dp[i][j-1], dp[i-1][j] - a[i]);
            }

            // none
            if(op == 0) dp[i][j] = max(dp[i][j], dp[i-1][j] + a[i]);
            else dp[i][j] = max(dp[i][j], dp[i-1][j] - a[i]);
        }
    }   
    ll ans = -1e18;
    for(int j=0;j<3;j++) ans = max(ans, dp[n][j]);
    printf("%lld\n", ans);
}

Measured memory_bytes: 7256
#include <bits/stdc++.h>
#define ll long long int
#define yorn(f) cout<<((f)?"Yes":"No")<<endl;
#define YORN(f) cout<<((f)?"YES":"NO")<<endl;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define println(x) cout << x << endl;
using namespace std;
int main()
{
    int n;
    cin >> n;
    println((double)(n - n / 2) / n)
    return 0;
}

Measured memory_bytes: 3716
#include <stdio.h>
#define N 100
int F[N];
int n;
int i;
int f(int n){
if(n==0||n==1){
  return F[n]=1;
 }
 if(F[n]!=0){
   return F[n];
 }
 return F[n]=f(n-2)+f(n-1);
}
int main(){
  for(i=0;i<N;i++){
    F[i]=0;
  }
  scanf("%d",&n);
  printf("%d\n",f(n));
  f(n);
}



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

template <typename T> T gcd(T x, T y) {
  if (y == 0)
    return x;
  return gcd(y, x % y);
}

template <typename T> T lcm(T x, T y) {
  if (x == 0 || y == 0)
    return 0;
  return x / gcd(x, y) * y;
}

int ctoi(char c) {
  if (c >= '0' && c <= '9') {
    return c - '0';
  }
  return 0;
}

vector<int> p;
vector<int> r;

void init(int n) {
  p.reserve(n);
  r.reserve(n);
  for (int i = 0; i < n; i++) {
    p[i] = i;
    r[i] = 0;
  }
}

int root(int x) { return p[x] == x ? x : p[x] = root(p[x]); }

bool same(int x, int y) { return root(x) == root(y); }

void unite(int x, int y) {
  x = root(x);
  y = root(y);
  if (x == y)
    return;

  if (r[x] < r[y])
    p[x] = y;
  else {
    p[y] = x;
    if (r[x] == r[y])
      r[x]++;
  }
}

int main() {
  int N, M, Q;
  cin >> N >> M >> Q;
  N++;
  vector<vector<int>> v(N, vector<int>(N, 0));
  for (int i = 0; i < M; i++) {
    int L, R;
    cin >> L >> R;
    v[L][R] += 1;
  }

  vector<vector<int>> s(N, vector<int>(N, 0));

  for (int i = 1; i < N; i++) {
    for (int j = 1; j < N; j++) {
      s[i][j] = s[i][j - 1] + v[i][j];
    }
  }

  for (int i = 0; i < Q; i++) {
    int p, q;
    cin >> p >> q;
    int ans = 0;
    for (int j = p; j <= q; j++) {
      ans += s[j][q] - s[j][p - 1];
    }
    cout << ans << endl;
  }
}

Measured memory_bytes: 2944
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
typedef long long ll;
#define MOD 1000000007
using namespace std;
ll gcd(ll a, ll b) {
    if (a < b) gcd(b, a);
    ll r = 1;
    while (r != 0) {
        r = a % b;
        a = b;
        b = r;
    }
    return a;
}
int main() {
    ll n, m;
    cin >> n >> m;
    string s, t;
    cin >> s >> t;
    ll lcm = n * m / gcd(n, m);
    map<ll, char> mp;
    for (int i = 0; i < n; i++) {
        mp[1 + i * lcm / n] = s[i];
    }
    for (int i = 0; i < m; i++) {
        if (mp[1 + i * lcm / m] != mp['#'] && mp[1 + i * lcm / m] != t[i]) {
            cout << -1 << endl;
            return 0;
        }
    }
    cout << lcm << endl;
}


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

int main(){
    long long n;
    cin >> n;

    long long a[5];
    long long mi = LLONG_MAX;
    for(int i = 0;i < 5;i++){
        cin >> a[i];
        mi = min(a[i], mi);
    }

    cout << 5+(n-1) / mi << endl;

    return 0;
}


Measured memory_bytes: 256
package main

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

func main() {
	r := bufio.NewReader(os.Stdin)
	var n int
	var s string
	fmt.Fscan(r, &n, &s)

	wc := make([]int, n+1)
	for i := 1; i <= n; i++ {
		wc[i] = wc[i-1]
		if s[i-1] == 'W' {
			wc[i]++
		}
	}
	red := n - wc[n]
	fmt.Println(wc[red])
}


Measured memory_bytes: 4816
#include <cstdio>
int a[100005];
int main() {
	
	int n, ans = 0;
	scanf("%d",&n);
	for(int i = 1; i <= n; i++) scanf("%d", &a[i]);
	for(int i = 1; i <= n; i++) {
		if(a[i] == i) {
			ans ++;
			i ++;
		}
	}
	printf("%d", ans);
} 

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

int main() {
  int N, T, Sum=0, cnt=0;
  cin >> N >> T;
  vector<int> A(N);
  rep(i, N) cin >> A.at(i);
  cnt=T;
  Sum+=T;
  for(int i=1; i<N; i++){
    if(cnt>A.at(i)) Sum+=A.at(i)+T-cnt;
    else Sum+=T;
    cnt=A.at(i)+T;
  }
  cout << Sum << endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
using namespace std;
#define int long long

signed main() {
    int n, t;
    cin >> n >> t;
    int a[n];
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    int sum = 0;
    for (int i = 1; i < n; i++) {
        sum += min(t, a[i] - a[i - 1]);
    }
    sum += t;
    cout << sum << endl;
    return 0;
}


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

int main(){
  int N,M,X,Y;
  cin>>N>>M>>X>>Y;
  vector<int> x(N),y(M);
  for(int i=0;i<N;i++){
    cin>>x.at(i);
  }
  for(int i=0;i<M;i++){
    cin>>y.at(i);
  }
  
  sort(x.begin(),x.end());
  sort(y.begin(),y.end());
  X=max(X,x.at(N-1));
  Y=min(Y,y.at(0));
  if(X<Y){
    cout<<"No War"<<endl;
  }else{
    cout<<"War"<<endl;
  }
}

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

 

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


    int n;
    cin>>n;
    ll a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    for(int i=0;i<n-1;i++){
        if(i && a[i-1] == a[i]) continue;
        if(a[i] >= a[i+1]) a[i]--;
    }
    for(int i=0;i<n-1;i++){
        if(a[i]>a[i+1]){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;

}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
template <typename T>
inline void readin(T &x) {
	x = 0;
	T fh = 1;
	char ch = getchar();
	for (; !isdigit(ch); ch = getchar()) if (ch == '-') fh = -1;
	for (; isdigit(ch); ch = getchar()) x = (x << 1) + (x << 3) + (ch ^ 48);
	x *= fh;
}
inline void d_read(double &x) {
	x = 0.0;
	int fh = 1;
	char ch = getchar();
	for (; !isdigit(ch); ch = getchar()) if (ch == '-') fh = -1;
	for (; isdigit(ch); ch = getchar()) x = x * 10 + (ch ^ 48);
	if (ch == '.') {
		double num = 1.0;
		ch = getchar();
		for (; isdigit(ch); ch = getchar()) x = x + (num /= 10) * (ch ^ 48);
	}
	x *= fh;
}

template <typename T>
inline void wt(T x) {
	if (x > 9) wt(x / 10);
	putchar(x % 10 + 48);
}
template <typename T>
inline void writeln(T x, char c) {
	if (x < 0) {
		putchar('-');
		x = -x;
	}
	wt(x);
	putchar(c);
}

int main() {
	int a, b, c;
	cin >> a >> b >> c;
	cout <<  ((a - 1) / b + 1) * c << endl;
	return 0;
}




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

int main(){
    int a,b;
    cin >> a >> b;
    string s;
    cin >> s;
    for(int i=0;i<s.size();i++){
        if(i==a){
            if(s[i]=='-')continue;
            else{
                puts("No");
                return 0;
            }
        }
        if(s[i]=='-'){
            puts("No");
            return 0;
        }

    }
    puts("Yes");
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
const int N=2e5+4;
int n,m;
ll K;
ll a[N],b[N];
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 void smax(int &x,int y) {
	x=x<y?y:x;
}
int main() {
	n=read(),m=read(),K=read();
	for (register int i=1;i<=n;++i) a[i]=a[i-1]+read();
	for (register int i=1;i<=m;++i) b[i]=b[i-1]+read();
	int ans=0;
	for (register int i=1;i<=n;++i) {
		if (a[i]>K) break;
		int res=K-a[i];
		int pos=upper_bound(b+1,b+m+1,res)-b-1;
		smax(ans,i+pos);
	}
	for (register int i=1;i<=m;++i) {
		if (b[i]>K) break;
		int res=K-b[i];
		int pos=upper_bound(a+1,a+n+1,res)-a-1;
		smax(ans,i+pos);
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 6872
#include <iostream>
using namespace std;
int main(void){
    int N,p[100001],count=0,tmp;
    cin>>N;
    for(int i=1;i<=N;i++){
        cin>>p[i];
    }
    for(int i=1;i<=N;i++){
        if(i==p[i]){
            tmp=p[i];
            p[i]=p[i+1];
            p[i+1]=tmp;
            count++;
        }
    }
    cout<<count<<endl;
    return 0;
}

Measured memory_bytes: 640
import sys
import itertools
import collections


def solve():
    input = sys.stdin.readline
    mod = 10 ** 9 + 7
    n, k = list(map(int, input().rstrip('\n').split()))
    ls = [0] + list(map(lambda x: int(x) - 1, input().rstrip('\n').split()))
    ls = [i % k for i in list(itertools.accumulate(ls))]
    
    d = collections.defaultdict(int)
    t = 0
    for i, x in enumerate(ls):
        t += d[x]
        d[x] += 1
        if i >= k - 1:
            d[ls[i - k + 1]] -= 1
    print(t)


if __name__ == '__main__':
    solve()


Measured memory_bytes: 113512