akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;
#define SIZE_OF_ARRAY(a) (sizeof(a)/sizeof(a[0]))

unsigned GetDigit(unsigned num){
    return std::to_string(num).length();
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string A ,B;
    cin >> A;
    cin >> B;
    int ans = 10000000;
    string solve;
    int second;
    std::sort(A.begin(),A.end());
    std::sort(B.begin(),B.end(),greater<>());
    A.push_back(EOF);
    B.push_back(EOF);
    for(int i = 0;i < (A.size() > B.size() ? A.size() : B.size());i++){
        if(A == B){
            solve ="No";
            break;
        }
        if(A.at(i) > B.at(i) || B.at(i) == EOF){
            solve = "No";
            break;
        }else if(A.at(i) < B.at(i) || A.at(i) == EOF){
            solve = "Yes";
            break;
        }
    }
    cout << solve << endl;
}


Measured memory_bytes: 256
from heapq import heappop, heappush
import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
    n = int(input())
    ans = 0
    camels0 = [[] for _ in range(n)]
    camels1 = [[] for _ in range(n)]
    for _ in range(n):
        k, l, r = map(int, input().split())
        if l>r:
            camels0[k-1].append(l-r)
        elif l<r and k<n:
            camels1[n-k-1].append(r-l)
        ans += min(l, r)
    h = []
    for i in range(n):
        for j in camels0[i]:
            heappush(h, j)
        while len(h)>i+1:
            heappop(h)
    ans += sum(h)
    h = []
    for i in range(n):
        for j in camels1[i]:
            heappush(h, j)
        while len(h)>i+1:
            heappop(h)
    ans += sum(h)
    print(ans)

Measured memory_bytes: 47544
N = int(input())
A = list(map(int, input().split()))

backward = [0]
for a in reversed(A):
    backward.append(backward[-1] + a)
backward.reverse()
backward.pop()

backward_lower = [0]
for a in reversed(A):
    backward_lower.append((backward_lower[-1] + 1) // 2 + a)
backward_lower.reverse()
backward_lower.pop()

forward = [1]
for i in range(N):
    forward.append((forward[-1] - A[i]) * 2)
    if forward[-1] > backward[i]:
        break


ans = 0
for i in range(N + 1):
    if i < len(forward):
        if backward_lower[i] > forward[i]:
            print(-1)
            break
        ans += min(forward[i], backward[i])
    else:
        ans += backward[i]
else:
    print(ans)

Measured memory_bytes: 674212
"use strict";
const Main = (input) =>{
    let xs = input.trim().split('\n');
    let H = xs[1].trim().split(' ').map(v=>parseInt(v,10));
    let count = 0;
    let Max = 0;
    for(let i =0; i<xs[0]; i++){
        if(H[i]>= Max){
        count++
        }
        if(Max < H[i]){
        Max = H[i];
        }
    }
    console.log(count);
}
Main(require('fs').readFileSync('/dev/stdin','utf8'));

Measured memory_bytes: 7372
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vb = vector<bool>;
using vc = vector<char>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using pii = pair<int, int>;
#define fix10 cout << fixed << setprecision(10);
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define MOD 998244353

int main(){
  int n;
  cin >> n;
  vector<long> cnt(n,0);
  long maxi = 0;
  rep(i,n){
    long d;
    cin >> d;
    maxi = max(maxi,d);
    if(i != 0 && d == 0){
      cout << 0 << endl;
      return 0;
    }
    cnt.at(d)++;
  }
  long ans = 1;
  rep(i,maxi){
    //ans *= pow(cnt.at(i),cnt.at(i+1));
    rep(j,cnt.at(i+1)){
      ans *= cnt.at(i);
      ans %= MOD;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
char a1[505][505], a2[505][505];
int main(){
	int n, m, i, j;
	char ch;
	scanf("%d %d", &n, &m);
	for(i = 1 ; i <= n ; ++i)
		for(j = 1 ; j <= m ; ++j){
			ch = getchar();
			while(ch != '.' && ch != '#')
				ch = getchar();
			a1[i][j] = a2[i][j] = ch;
		}
	for(i = 1 ; i <= n ; i += 2)
		for(j = 1 ; j <= m - 1 ; ++j)
			a1[i][j] = '#';
	for(i = 2 ; i <= n ; i += 2)
		for(j = 2 ; j <= m ; ++j)
			a2[i][j] = '#';
	for(i = 1 ; i <= n ; ++i)
		a1[i][1] = a2[i][m] = '#';
	for(i = 1 ; i <= n ; ++i)
		printf("%s\n", (a1[i] + 1));
	printf("\n");
	for(i = 1 ; i <= n ; ++i)
		printf("%s\n", (a2[i] + 1));
	return 0;
}

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

struct BipartiteMatching {
    int n;
    std::vector<std::vector<int>> G;
    std::vector<int> match;
    std::vector<bool> used;
    BipartiteMatching(int n) : n(n), G(n), match(n), used(n) {}
    void addEdge(int u, int v) {
        G[u].push_back(v);
        G[v].push_back(u);
    }
    bool dfs(int v) {
        used[v] = true;
        for (int i = 0; i < G[v].size(); i++) {
            int u = G[v][i], w = match[u];
            if (w < 0 || !used[w] && dfs(w)) {
                match[v] = u;
                match[u] = v;
                return true;
            }
        }
        return false;
    }
    std::vector<std::pair<int, int>> getMaxMatching() {
        std::vector<std::pair<int, int>> ret;
        fill(match.begin(), match.end(), -1);
        for (int i = 0; i < n; i++) {
            if (match[i] < 0) {
                fill(used.begin(), used.end(), false);
                dfs(i);
            }
        }
        for (int i = 0; i < n; i++) {
            if (i < match[i]) { ret.push_back({i, match[i]}); }
        }
        return ret;
    }
};

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

int main() {
    int X, Y, E;
    cin >> X >> Y >> E;
    BipartiteMatching bm(X + Y);
    for (int i = 0; i < E; i++) {
        int x, y;
        cin >> x >> y;
        bm.addEdge(x, X + y);
    }
    cout << bm.getMaxMatching().size() << endl;
}


Measured memory_bytes: 3208
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;
using ll = long long int;
using int64 = long long int;
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const int INF = 1LL << 29;
const ll LONGINF = 1LL << 60;
const ll MOD = 1000000007LL;

int dp[1000010][2];
int main() {
    string s; cin >> s;
    reverse(s.begin(), s.end());

    s += string(5, '0');
    int N = s.size();
    
    fill(dp[0], dp[N+5], INF);
    dp[0][0] = 0;
    for(int i=0; i<N; i++) {
        int c = s[i] - '0';
        for(int j=0; j<2; j++) {
            if(dp[i][j] == INF) continue;
            // fprintf(stderr, "dp[%d][%d] = %d\n", i, j, dp[i][j]);
            int a = c + j;
            for(int x=0; x<10; x++) {
                int add = x + (x < a ? x + 10 - a : x - a);
                int nj = (x < a);
                chmin(dp[i+1][nj], dp[i][j] + add);
            }
        }
    }
    cout << dp[N][0] << endl;
    return 0;
}


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

int main() {
    int n;
    cin >> n;
    vector<ll> a(n);
    unordered_map<ll, ll> counter;
    rep(i, n) {
        cin >> a[i];
        counter[a[i]]++;
    }
    ll ans = 0;
    for (auto p : counter) {
        ans += p.second * (p.second - 1) / 2;
    }
    rep(i, n) {
        ll diff = counter[a[i]] * (counter[a[i]] - 1) / 2;
        diff -= (counter[a[i]] - 1) * (counter[a[i]] - 2) / 2;
        cout << ans - diff << endl;
    }
}

Measured memory_bytes: 9160
#define ENABLE_DEBUG 0
// Kana's kitchen {{{
#include<bits/stdc++.h>
#define ALL(v) std::begin(v),std::end(v)
#define LOOP(k) for(lint ngtkana_is_a_genius=0; ngtkana_is_a_genius<(lint)k; ngtkana_is_a_genius++)
using lint=long long;
using ld=long double;
template<class T> using numr=std::numeric_limits<T>;
struct input_t {
    template<class T> operator T() {
        T t;
        std::cin>>t;
        return t;
    }
} input;
#ifdef NGTKANA
#include<debug.hpp>
#else
#define DEBUG(...)(void)0
#endif
/*}}}*/

template<std::size_t N,class T,class...Args>auto mkvec(std::size_t sz,Args...args){
    if constexpr(N==1)return std::vector<T>(sz,args...);
    else return std::vector(sz,mkvec<N-1,T>(args...));
}

auto cmn=[](auto&x,auto y){if(x>y){x=y;return true;}return false;};

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

    lint n=input,m=input,X=input;

    auto a = mkvec<2,lint>(n,m);
    std::vector<lint>c(n);
    for(lint i=0;i<n;i++){
        c.at(i)=input;
        for(lint j=0;j<m;j++){
            a.at(i).at(j)=input;
        }
    }

    lint inf=numr<lint>::max();
    lint ans=inf;
    for(lint bs=0; bs<(1ll<<n); bs++){
        std::vector<lint>now(m);
        lint cost=0;
        for(lint i=0;i<n;i++)if(bs>>i&1ll){
            cost+=c.at(i);
            for(lint j=0;j<m;j++){
                now.at(j)+=a.at(i).at(j);
            }
        }
        DEBUG(bs, cost, now);
        if (std::all_of(ALL(now), [X](lint x){ return X<=x; })){
            cmn(ans, cost);
        }
    }
    if (ans==inf)ans=-1;
    std::cout<<ans<<'\n';
}


Measured memory_bytes: 3664
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()
#define bit(k) (1LL<<(k))
#define SUM(v) accumulate(all(v), 0LL)

typedef pair<int, int> i_i;
typedef pair<ll, ll> l_l;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;
struct fast_ios{ fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; }fast_ios_;

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

#define TOSTRING(x) string(#x)
template <typename T> istream &operator>>(istream &is, vector<T> &vec) { for (T &x : vec) is >> x; return is; }
template <typename T> ostream &operator<<(ostream &os, const vector<T> &v) { os  << "["; for(auto _: v) os << _ << ", "; os << "]"; return os; };
template <typename T> ostream &operator<<(ostream &os, set<T> &st) { os << "("; for(auto _: st) { os << _ << ", "; } os << ")";return os;}
template <typename T, typename U> ostream &operator<<(ostream &os, const pair< T, U >& p){os << "{" <<p.first << ", " << p.second << "}";return os; }
template <typename T, typename U> ostream &operator<<(ostream &os, const map<T, U> &mp){ os << "["; for(auto _: mp){ os << _ << ", "; } os << "]" << endl; return os; }

#define DUMPOUT cerr
void dump_func(){ DUMPOUT << endl; }
template <class Head, class... Tail> void dump_func(Head &&head, Tail &&... tail) { DUMPOUT << head; if (sizeof...(Tail) > 0) { DUMPOUT << ", "; } dump_func(std::move(tail)...); }

#ifdef DEBUG
#define dbg(...) dump_func(__VA_ARGS__)
#define dump(...) DUMPOUT << string(#__VA_ARGS__) << ": "; dump_func(__VA_ARGS__)
#else
#define dbg(...)
#define dump(...)
#endif

const int INF = (ll)1e9;
const ll INFLL = (ll)1e18+1;
const ll MOD = 1000000007;
// const ll MOD = 998244353;
const long double PI = acos(-1.0);

/*
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const string dir = "DRUL";
*/


int main() {
    int N,L;
    cin >> N >> L;
    vector<string> S(N);
    cin >> S;
    sort(all(S));
    rep(i,N){
        cout << S[i];
    }
    cout << endl;
}


Measured memory_bytes: 3568
#include <bits/stdc++.h>
#define double long double
#define int long long
#define MAXN 3010
using namespace std;
	int n;
	double P[MAXN];
	double dp[MAXN][MAXN];
double solve(int id,int heads){
	if(dp[id][heads]!=-1)return dp[id][heads];
	if(id==n+1){
		if(heads>n-heads)return dp[id][heads]=(double)1;
		else return dp[id][heads]=(double)0;
	}
	double op1 = solve(id+1,heads+1);
	double op2 = solve(id+1,heads);
	return dp[id][heads]=P[id]*op1+(1-P[id])*op2;
}


int32_t main(){
	for(int i=0;i<MAXN;i++)for(int j=0;j<MAXN;j++)dp[i][j]=-1;
	cin>>n;
	for(int i=1;i<=n;i++)cin>>P[i];
	cout<<setprecision(10)<<fixed;
	cout<<solve(1,0)<<endl;
}


Measured memory_bytes: 142080
# from https://ikatakos.com/pot/programming_algorithm/contest_history/atcoder/2019/0106_educational_dp_4
import sys
mod=1000000007

def prepare(n):
    fact=[1]*(n+1)
    for i in range(1,n+1):
        fact[i]=fact[i-1]*i%mod
    inv=[1]*(n+1)
    inv[n]=pow(fact[n],mod-2,mod)
    for i in range(n-1,0,-1):
        inv[i]=inv[i+1]*(i+1)%mod
    return fact,inv

#n=int(input())
h,w,n=map(int,input().split())
walls=[tuple(map(int, line.split())) for line in sys.stdin.readlines()]
walls.append((1,1))
walls.append((h,w))
walls.sort()
fact,inv=prepare(h+w)
dp=[1]
for i,(cy,cx) in enumerate(walls[1:],start=1):
    res=0
    for j,(py,px) in enumerate(walls[:i]):
        if cx<px:
            continue
        dy,dx=cy-py,cx-px
        res-=dp[j]*fact[dy+dx]%mod*inv[dy]%mod*inv[dx]%mod
        res%=mod
    dp.append(res)
print(-dp[-1]%mod)


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

int main() {
    
    ll x, y; cin >> x >> y;
    ll ans = 1;
    while (true) {
        x *= 2;
        if (x <= y) {
            ans++;
        }
        else break;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){return o<<"("<<p.fs<<","<<p.sc<<")";}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){o<<"sz = "<<vc.size()<<endl<<"[";for(const T& v:vc) o<<v<<",";o<<"]";return o;}
int to[18][100000];
int N,x[100000],L,Q;
int main(){
	cin>>N;
	rep(i,N) cin>>x[i];
	cin>>L;
	rep(i,N){
		int nid=upper_bound(x,x+N,x[i]+L)-x-1;
		to[0][i]=nid;
	}
	rep(i,17) rep(j,N) to[i+1][j]=to[i][to[i][j]];
	cin>>Q;
	rep(tt,Q){
		int a,b;
		scanf("%d %d",&a,&b);
		a--,b--;
		if(a>b) swap(a,b);
		int t=0;
		for(int i=17;i>=0;i--){
			if(to[i][a]<b){
				t|=(1<<i);
				a=to[i][a];
			}
		}
		cout<<t+1<<endl;
	}
}


Measured memory_bytes: 8192
import static java.lang.System.*;
import java.util.*;

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

        char b = sc.next().toCharArray()[0];

		if(b=='A') out.println('T');
		if(b=='T') out.println('A');
		if(b=='C') out.println('G');
		if(b=='G') out.println('C');
    }
}


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

int main(void){
	int a = 0;
	string s;
	cin >> s;
	if (s[0] == '+')a++;
	else {
		a--;
	}
	if (s[1] == '+')a++;
	else {
		a--;
	}
	if (s[2] == '+')a++;
	else {
		a--;
	}
	if (s[3] == '+')a++;
	else {
		a--;
	}

	cout << a;
	return 0;
}

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

#define all(x) begin(x), end(x)

using i64 = int_fast64_t;
using u64 = uint_fast64_t;
using f64 = double;
using p64 = pair<i64, i64>;

constexpr i64 INF = INT_FAST64_MAX / 2;

i64 f(i64 x) {
    return x ? 1 + f(x % __builtin_popcountl(x)) : 0;
}

void solve() {
    i64 n;
    cin >> n;
    string x;
    cin >> x;
    i64 cnt = count(all(x), '1');

    if (cnt == 1) {
        for (i64 i = 0; i < n; i++) {
            cout << (x[i] == '1' ? 0 : (x[n - 1] == '1') ^ (i == n - 1) ? 2 : 1) << endl;
        }
        return;
    }

    vector<i64> modc(n), modf(n);
    i64 ci = 1, fi = 1;
    for (i64 i = 0; i < n; i++) {
        modc[n - i - 1] = ci;
        modf[n - i - 1] = fi;
        ci = (ci << 1) % (cnt + 1);
        fi = (fi << 1) % (cnt - 1);
    }

    i64 sumc = 0, sumf = 0;
    for (i64 i = 0; i < n; i++) {
        if (x[i] == '0') continue;
        sumc = (sumc + modc[i]) % (cnt + 1);
        sumf = (sumf + modf[i]) % (cnt - 1);
    }

    for (i64 i = 0; i < n; i++) {
        i64 y = x[i] == '0'
            ? (sumc + modc[i]) % (cnt + 1)
            : (sumf - modf[i] + cnt - 1) % (cnt - 1);
        cout << 1 + f(y) << endl;
    }
}

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


Measured memory_bytes: 6780
import sys
N = int(input())
A = [int(x) for x in input().split()]
if N == 1:
    print(1)
    sys.exit()

inc = 0  # 1: 単調非減少,　-1 : 単調非増加, 0: 未確定
ans = 1
for i in range(N - 1):
    if A[i] < A[i + 1]:
        if inc == -1:
            ans += 1
            inc = 0
        elif inc == 0:
            inc = 1
    elif A[i] > A[i + 1]:
        if inc == 1:
            ans += 1
            inc = 0
        elif inc == 0:
            inc = -1

print(ans)


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

using ll = long long;

const int mod = 1000000007;
const int INF = 1000000000;
const double EPS = 1e-9;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    bool ok = true;
    for (int i = 0; i < N; ++i) {
        int A;
        cin >> A;
        if (A % 2 == 0) {
            if (A % 3 != 0 && A % 5 != 0) ok = false;
        }
    }
    cout << (ok ? "APPROVED" : "DENIED") << endl;
}


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

// types
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef vector<pll> vpll;

// macros
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  ll h,w,n;
  cin >> h >> w>> n;

  ll ans = n/max(h,w);
  if(n%max(h,w)!=0)
    ans++;
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>

using namespace std;

typedef long long ll;

void solve(ll x, ll y, ll v[], int m) {
    int dx[4] = {-1, 0, 0, 1};
    int dy[4] = {0, -1, 1, 0};
    char mode[4] = {'R', 'U', 'D', 'L'};
    for (int i = 0; i < m; i++) {
        int dir = 0;
        ll t = abs(x + v[i] * dx[0]) + abs(y + v[i] * dy[0]);
        for (int j = 0; j < 4; j++) {
            ll nx = x + v[i] * dx[j];
            ll ny = y + v[i] * dy[j];
            if (abs(nx) + abs(ny) < t) {
                t = abs(nx) + abs(ny);
                dir = j;
            }
        }
        x = x + v[i] * dx[dir];
        y = y + v[i] * dy[dir];

        cout << mode[dir];
    }
    cout << endl;
    return;
}

int main() {
    int N, m = 34;
    ll X[1003], Y[1003];
    ll d[34];
    ll  t = 1;
    for (int i = 0; i < 33; i++) {
        d[32-i] = t;
        t *= 2;
    }
    d[33] = 1;

    cin >> N;

    int even = 0, odd = 0;

    for (int i = 0; i < N; i++) {
        cin >> X[i] >> Y[i];
        if ( ( abs(X[i]) + abs(Y[i])) % 2 == 0) {
            even++;
        } else {
            odd++;
        }
    }
    if (even && odd) {
        cout << -1 << endl;
        return 0;
    }

    if (odd) { m -= 1; }
    cout << m << endl;

    for (int i = 0; i < m; i++) {
        cout << d[i];
        if (i == m-1) { cout << endl; }
        else { cout << " "; }
    }
    for (int i = 0; i < N; i++) {
        solve(X[i], Y[i], d, m);
    }
    return 0;
}

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

using namespace std;
using ll = long long;
using IP = pair<int, int>;

const ll linf = 1LL << 62;
const int inf = 99999999;
const int dx[4] = { 1,0,-1,0 };
const int dy[4] = { 0,1,0,-1 };
const ll atcoder = 1e9 + 7;

#define Endl endl
#define mp make_pair
#define all(v) v.begin(),v.end()
#define pb push_back
#define pr(x) cout << x << endl
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)
#define rep(i,n) for(int i= 0;i<n;i++)

ll gcd(ll a, ll b) {//最大公約数
	if (a%b == 0)return b;
	else gcd(b, a%b);
}

ll lcm(ll a, ll b) {//最小公倍数
	return (a / gcd(a, b))*b;
}

int main(){
	
	int x, y;
	cin >> x >> y;
	if (x%y == 0)pr(-1);
	else pr(x);

	//system("pause");
	return 0;
}

Measured memory_bytes: 256
package main

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

// I/O
type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func (s *Scanner) nextFloatSlice(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextFloat()
	}
	return res
}

// Arithmetic
func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

func abs(x int) int {
	if x > 0 {
		return x
	}
	return -x
}

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

// Sort
type Val struct {
	id, num int
}
type ByNum []Val

func (a ByNum) Len() int           { return len(a) }
func (a ByNum) Less(i, j int) bool { return a[i].num < a[j].num }
func (a ByNum) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }

func gcd(a, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}

func lcm(a, b int) int {
	return a / gcd(a, b) * b
}

func main() {
	sc := NewScanner()
	wtr := bufio.NewWriter(os.Stdout)
	A, B := sc.nextInt(), sc.nextInt()

	fmt.Fprintln(wtr, lcm(A, B))
	wtr.Flush()
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef pair<string , int> s_i;
typedef vector<ll> vel;
typedef vector<int> vei;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> ve_vel;
typedef vector<vector<int>> ve_vei;
typedef vector<vector<char>> ve_vec;
typedef vector<vector<bool>> ve_veb;
typedef vector<vector<string>> ve_ves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pub push_back
#define puf push_front
#define pob pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
//#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
const int64 INF = 1LL << 58;
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 (a>b) { a=b; return 1; } return 0; }
template<typename T> void remove(T & vector, unsigned int index){vector.erase(vector.begin() + index);}

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

    int N; cin >> N;
    vector<map<int , int>> r(N), b(N);
    veb used(N, false);
    rep(i,N) cin >> r[i][1] >> r[i][0]; rep(i, N) cin >> b[i][0] >> b[i][1];

    sort(rall(r));
    sort(all(b));
    

    int cnt = 0;
    rep(i,N) {
        rep(j,N) {
            if( r[i][1] < b[j][0] and r[i][0] < b[j][1] and !used[j]) {cnt++; used[j] = true; break;}
        }
    }
    cout << cnt << endl;
    return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
typedef vector<int> vec1;
typedef vector<string> vec2;
typedef vector<double> vec3;

int main() {
  
  ll n;
  cin >> n;
  vec1 ans(n);
  int a;
  for(int i = 0; i < n-1; i++) {
    cin >> a;
    ans.at(a-1)++;
  }
  for(int i = 0; i < n; i++) {
    cout << ans.at(i) << endl;
  }
}

Measured memory_bytes: 4052
#include <bits/stdc++.h>
#define rep(i,n) for(ll i = 0; i < (ll)(n); ++i)
#define MOD 1000000007

using namespace std;
using ll = long long;

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


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

using namespace std;

int timetom(string s){
    int h=stoi(s.substr(0,2));
    int m=stoi(s.substr(3,2));
    return h*60+m;
}

bool solve(){
    int n;
    cin>>n;
    if(n==0)return false;
    //vector<pair<pair<int,bool>,int>> d(n);//<time,io>,id
    vector<vector<int>> d;
    vector<int> tm(n);
    map<string,int> mp;
    int godind=-1;
    for (int i = 0; i < n; ++i) {
        string s,t;
        cin>>s>>t;
        tm[i]=timetom(t);
        char c;
        cin>>c;
        string id;
        cin>>id;
        if(mp.find(id)==mp.end()){
            mp[id]=d.size();
            if(id=="000")godind=d.size();
            d.emplace_back(vector<int>(n+1,0));
        }
        if(c=='I')++d[mp[id]][i];
        else --d[mp[id]][i];
    }
    for(auto &i:d){
        for (int j = 0; j < n; ++j) {
            i[j+1]+=i[j];
        }
    }
    if(godind==-1){
        cout<<0<<endl;
        return true;
    }
    int ans=0;
    for (int i = 0; i < d.size(); ++i) {
        if(i==godind)continue;
        int tans=0;
        for (int j = 0; j < n-1; ++j) {
            if(d[i][j]==1&&d[godind][j]==1){
                tans+=tm[j+1]-tm[j];
            }
        }
        ans=max(ans,tans);
    }
    cout<<ans<<endl;
    return true;
}

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


Measured memory_bytes: 4888
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++) //これでiやjを定義しなくていいらしい
using namespace std;

const int INF = 1001001001;
vector<int> to[100005];


int main(){
  int n,m;//頂点数、ノード数
  cin >> n >> m;

  int a,b;
  rep(i,m){//ノード情報記録
    cin >> a >> b;
    a--;
    b--;
    to[a].push_back(b);
    to[b].push_back(a);//繋いだ先の部屋番号を保持
  }

  queue<int> q;
  vector<int> dist(n,INF);
  vector<int> pre(n,-1);
  dist[0] = 0;
  q.push(0);
  //処理部（BFS木生成、キュー管理）
  while(!q.empty()){
    int v = q.front();//キューの最前の値をvに保持
    q.pop();//vに入れたら不要なのでキューから削除
    for(int u : to[v]){//to[v]には、部屋ｖからいける部屋がすべて入っている
      if(dist[u] != INF)//既に訪れていたら
        continue;//必ずdistは同じかそれ以上になってしまうので、スルー。
      dist[u] = dist[v]+1;//部屋０からの距離を記録
      pre[u] = v;
      q.push(u);//同じ深さの点をキューにいれる
    }
  }
  //出力部
  cout << "Yes" << endl;//今回は常にYes
  rep(i,n){
    if(i==0)
      continue;
    else{
      int ans = pre[i]+1;//頂点番号を部屋番号に戻す
      cout << ans << endl;
    }
  }


  return 0;
}


Measured memory_bytes: 10732
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    long a[n];
    for(int i=0;i<n;i++)cin >> a[i];
    long dai = 0;
    for(int i=1;i<n;i++){
        if(a[i] >= a[i-1]){
            continue;
        }else{
            dai += a[i-1] - a[i];
            a[i] = a[i-1];
        }
    }
    cout << dai << endl;
}

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

#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define pf printf
#define sc scanf
#define sf(n) scanf("%d",&n)
#define sff(n1,n2) scanf("%d %d",&n1,&n2)
#define sfff(n1,n2,n3) scanf("%d %d %d",&n1,&n2,&n3)
#define sl(n) scanf("%lld",&n)
#define sll(n1,n2) scanf("%lld %lld",&n1,&n2)
#define slll(n1,n2,n3) scanf("%lld %lld %lld",&n1,&n2,&n3)
#define rep0(i,n) for(i=0;i<n;i++)
#define rep(i,n) for(i=1;i<=n;i++)
#define reps(i,a,n) for(i=a;i<=n;i++)
#define nl puts("");
#define pb push_back
#define MOD 1000000007
#define fi first
#define se second
#define N 100005
#define mem(ara,n) memset(ara,n,sizeof(ara))
#define memb(ara) memset(ara,false,sizeof(ara))
#define all(x) (x).begin(),(x).end()
#define sq(x) ((x)*(x))
#define sz(x) x.size()
#define pi pair<int,int>
#define pii pair<pair<int,int>,pair<int,int> >
#define line puts("-------");
#define db(x) cout<<#x<<" :: "<<x<<"\n";
#define dbb(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\n";
#define fr freopen("input.txt","r",stdin);
#define fw freopen("output.txt","w",stdout);
typedef long long int ll;
using namespace std;
int main()
{
    int i,n,k;
    vector<int>vec={0};
    sf(n);
    rep0(i,n)
    {
        sf(k);
        vec.pb(vec[i]+k);
    }
    int mn=1e9;
    rep0(i,n)
    {
        int l=vec[i],r=vec[n]-l;
        mn=min(mn,abs(l-r));
    }
    cout<<mn;
}


Measured memory_bytes: 256
#include <iostream>
#include<iomanip>
#include <string>
#include<vector>
#include<algorithm>
#include<utility>
#include<queue>
#include<math.h>
#include<stack>
#include<set>
#include<map>
#define INF long long int(1e18+1)
#define rep(i,n,m) for(int i=n;i<m;i++)

using namespace std;

int a[102][102][102];

int main()
{
	int n;
	cin >> n;
	rep(i,0,101)
		rep(j,0,101)
		rep(k,0,101)
		a[i][j][k] = i * i + j * j + k * k + i * j + j * k + k * i;
	int x = 1, y = 1, z = 1,ni=1;
	while (n--) {
		int ans = 0;
		rep(i, x, 101)
			rep(j, y, 101)
			rep(k, z, 101) {
			if (a[i][j][k] > ni)break;
			if (a[i][j][k] == ni)ans++;
		}
		cout << ans << endl;
		ni++;
	}
}


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

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            var L = double.Parse(Console.ReadLine());
            Console.WriteLine(Math.Pow(L / 3.0, 3));
        }
    }
}


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

#define F first
#define S second
#define FOR(i,a,b) for (int i = (a); i <= (b); ++i)
#define NFOR(i,a,b) for(int i = (a); i >= (b); --i)
#define all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
typedef long long ll; typedef pair <int, int> ii; typedef vector <int> vi; const int inf = 1e9 + 7;
#define pr(...) dbs(#__VA_ARGS__, __VA_ARGS__)
template <class T> void dbs(string str, T t) {cout << str << " : " << t << endl;}
template <class T, class... S> void dbs(string str, T t, S... s) {int idx = str.find(','); cout << str.substr(0, idx) << " : " << t << ","; dbs(str.substr(idx + 1), s...);}
template <class S, class T>ostream& operator <<(ostream& os, const pair<S, T>& p) {return os << "(" << p.first << ", " << p.second << ")";}
template <class T>ostream& operator <<(ostream& os, const vector<T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class T>ostream& operator <<(ostream& os, const set<T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class S, class T>ostream& operator <<(ostream& os, const map<S, T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class T> void prc(T a, T b) {cout << "["; for (T i = a; i != b; ++i) {if (i != a) cout << ", "; cout << *i;} cout << "]";cout<<endl;}

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

	ll n; cin >> n; vector<ll> a(n);
	FOR (i, 0, n - 1) cin >> a[i];


	auto f = [&] (ll x) {
		ll alpha = n - 1 - x;
		ll req = 0;
		FOR (i, 0, n - 1) if (a[i] > alpha) req += (a[i] - alpha + n) / (n + 1);
		return req <= x;
	};

	ll st = 0, en = 1e18;

	// FOR (i, 0, 200) pr(i, f(i));

	while (st < en) {
		ll mid = (st + en) >> 1;
		bool can = false;
		FOR (i, 0, n*n) can |= f(mid + i);
		if (can) en = mid;
		else st = mid + 1;
	}

	FOR (i, 0, n*n) if (f(st + i)) {
		cout << st + i;
		return 0;
	}

	return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<vector>
#include<string>

using namespace std;

int main(){
  string s;
  cin >> s;
  long long cnt = 0;
  long long ans = 0;
  for(int i = 0; i < s.length() ; i++){
    if(s[i] == 'A'){
      cnt++;
    }
    else if(s[i] == 'B' && s[i+1] == 'C'){
      ans += cnt;
      i++;
    }
    else{
      cnt = 0;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 640
#include <bits/stdc++.h> 
#define F first 
#define S second 
#define MAX 10000003 
using namespace std; 

typedef long long int ll; 
const ll mod = 1000000007;
vector<ll>v,h; 

int main() 
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL); 
    ll t;
    t=1;
    while(t--){
        ll n;
        cin>>n;
        ll flag=0;
        for(ll x=0; x<n; x++){
            ll y;
            cin>>y;
            if(y%2==0){
                if(y%3!=0&&y%5!=0){
                    flag=1;
                }
            }
        }
        if(flag==1){
            cout<<"DENIED\n";
        }
        else{
            cout<<"APPROVED\n";
        }
    }
    return 0;
}


Measured memory_bytes: 256
H,W = gets.split.map &:to_i

as = []

H.times{
	as << gets.chomp.split("")
}

(as.size - 1).downto(0){ |i|
	if as[i].all?{ |x| x == "."} then
		as.delete_at(i)
	end
}

(as[0].size - 1).downto(0){ |i|
	if as.map{ |x| x[i]}.all?{ |x| x == "."} then
		as.each{ |a|
			a.delete_at(i)
		}
	end
}

as.each{|a|
	puts a.join("")
}

Measured memory_bytes: 2556
#include <iostream>
#include <vector>
#include <limits.h>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <random>
#include <functional>
#include <stack>
using namespace std;

template<class T>
void in(vector<T>& V) {
	for (auto itr = V.begin(); itr != V.end(); itr++)cin >> *itr;
	return;
}

template<class T>
void out(vector<T>& V) {
	for (T& itr : V)cout << itr << endl;
	return;
}

int N, Wmax;
vector<int> W, V;
vector<vector<long long>> DP;

int main() {
	cin >> N >> Wmax;
	W.resize(N + 1);
	V.resize(N + 1);
	for (int n = 1; n <= N; n++) {
		cin >> W[n] >> V[n];
	}
	DP.resize(N + 1, vector<long long>(Wmax+1,0));
	for (int n = 1; n <= N; n++) {
		for (int w = 0; w < W[n]; w++)DP[n][w] = DP[n - 1][w];
		for (int w = W[n]; w <= Wmax; w++) {
			DP[n][w] = max(DP[n - 1][w], DP[n - 1][w - W[n]] + V[n]);
		}
	}
	long long ans = 0;
	for (int w = 0; w <= Wmax; w++)ans = max(ans, DP[N][w]);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 80256
// abc144_d
#include <bits/stdc++.h>
#ifdef LOCAL
#include "../cxx-prettyprint/prettyprint.hpp"
#endif
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;

#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define REP_REV(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= m ; --(i))
#define ALL(x) x.begin(), x.end()

#define INF ((1 << 29)-1)
#define MOD (1000000007)

#define print2D(h, w, arr) REP(i, h) { REP(j, w) cout << arr[i][j] << " "; cout << endl; }
#define print_line(vec, n) {for(int i=0;i<(n-1);i++) cout << (vec)[i] << " "; cout << (vec)[(n)-1] << endl;}
template<class T> void print(const T& x){cout << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }
struct PreMain {PreMain(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}} premain;

#define _USE_MATH_DEFINES

int main() {
#ifdef LOCAL
    ifstream in("../arg.txt"); cin.rdbuf(in.rdbuf());
#endif
    double a, b, x;
    cin >> a >> b >> x;

    x /= a;

    double ok = M_PI_2;
    double ng = 0;
    while (ok - ng > 1e-10){
        double th = (ok + ng) / 2;

        double area;
        if (a < b * tan(th)){
            area = a * b - a * a / tan(th) / 2;
        } else {
            area = b * b * tan(th) / 2;
        }

        if (area > x){
            ok = th;
        } else {
            ng = th;
        }
    }

    print(90 - 180 * ok / M_PI);

    return 0;
}


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

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

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

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

int main() {
  string s, t;
  cin >> s >> t;
  int n = s.length(), ans(0);
  for (int i = 0; i < n; ++i) ans += (s[i] != t[i]);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3912
#include<iostream>
using namespace std;
int main() {
	int a, b;
	cin >> a >> b;
	if (a == 1) {
		a = 14;
	}
	if (b == 1) {
		b = 14;
	}
	if (a > b) {
		cout << "Alice" << endl;
	}
	else if (a == b) {
		cout << "Draw" << endl;
	}
	else cout << "Bob" << endl;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
import bisect
import numpy as np
import math
from collections import deque
from collections import defaultdict
from math import gcd


def main():
    X, N = map(int, input().split())
    P = list(map(int, input().split()))
    P = np.array(P)
    
    P = np.sort(P)
    ind = bisect.bisect_right(P, X)

    if len(P) == 0 or P[ind-1] != X:
        return X
    
    if len(P) == 1:
        if P[0] != X:
            return X
        else:
            return X-1
    
    Left = P[:ind-1] - X
    Right = P[ind:] - X

    Left = abs(Left[::-1])

    diff = 1
    Left_over = False
    Right_over = False

    if len(Left) == 0:
        Left_over = True
    if len(Right) == 0:
        Right_over = True

    while True:
        if not Left_over and Left[0] != diff:
            return X - diff
        elif Left_over:
            return P[0] - 1
        elif not Right_over and Right[0] != diff:
            return X + diff
        elif Right_over:
            return P[-1] + 1
        diff += 1
        if len(Left) >= 2:
            Left = Left[1:]
        else:
            Left_over = True
        if len(Right) >= 2:
            Right = Right[1:]
        else:
            Right_over = True

        if Left_over and Right_over:
            return P[0]-1


print(main())

Measured memory_bytes: 27208
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iomanip>
#include <numeric>
#include <queue>
#include <cmath>
using namespace std;

int main() {
    int x;
    cin >> x;
    cout << 1 - x << endl;
}




Measured memory_bytes: 3544
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <random>
#include <chrono>
#include <queue>
#include <math.h>
#include <string>
#include <sstream>
#include <stack>
#define inf 1e9+7
#define pb push_back
#define make make_pair
#define kaku(a) cout << a << endl;
 
using namespace std;
 
#define ll long long
#define rep(i,n) for(ll i=0;i<n;i++)
#define PI 3.14159265359
long long gcd(long long a,long long b){ return b==0?a:gcd(b,a%b);}
long long lcm(long long a,long long b){ return a/gcd(a,b)*b;}

typedef pair<ll,ll> Pair;
typedef set<ll> Set;

int main(){
    string s;
    cin >> s;
    if(s[2]==s[3]&&s[4]==s[5]) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
using namespace std;
typedef long long ll;
int main(int argc, char* argv[] ){
  ll N;
  cin >> N;
  vector<ll> v(N);
  for( ll i=0; i<N; ++i ){
    cin >> v[i];
  }
  vector<ll> s(N+1);
  s[0] = 0;
  for( ll i=0; i<N; ++i ){
    s[i+1] = s[i] + v[i];
  }
  //for( auto x : s ){ cerr << x << " "; } cerr << endl;
  ll c = 0;
  //for( int i=0; i<N; ++i ){
  //  for( int j=i+1; j<N+1; ++j ){
  //    if( s[j]-s[i] == 0 ) c++;
  //  }
  //}
  map<ll,ll> m;
  for( ll i=0; i<N+1; ++i ){
    m[s[i]] = m[s[i]]+1;
  }
  for( auto x : m ){
  //  cerr << x.first << " " << x.second << endl;
    c += (x.second)*(x.second-1)/2;
  }
  cout << c;
  return 0;
}

Measured memory_bytes: 15872
#include <stdio.h>
#include <set>
#include <utility>
#include <vector>
#include <algorithm>
using namespace std;
typedef pair<int,int> pi;
#define F first
#define S second
#define MP make_pair
#define PB push_back
const int INF=1<<30;
struct seg{
    int l;
    int r;
    int y;
    bool x;
};
bool cmp(seg a,seg b){
    return a.y<b.y;
}
int main(){
    int n,l,r,y1,y2,now;
    long long int ans=0,temp;
    multiset<pi> s;
    vector<seg> v;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d%d%d%d",&l,&y1,&r,&y2);
        v.PB({l,r,y1,true});
        v.PB({l,r,y2,false});
    }
    sort(v.begin(),v.end(),cmp);
    for(int i=0;i<v.size()-1;i++){
        if(v[i].x)s.insert({v[i].l,v[i].r});
        else s.erase(s.find({v[i].l,v[i].r}));
        now=-INF;
        temp=0;
        for(auto u:s){
            if(now>=u.S)continue;
            if(u.F>now)now=u.F;
            temp+=u.S-now;
            now=u.S;
        }
        ans+=temp*(v[i+1].y-v[i].y);
    }
    printf("%lld\n",ans);
}




Measured memory_bytes: 2900
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val n = sc.nextInt()
    val p = (0 until n).map { sc.next().toInt() }
    println(problem072d(n, p))
}

fun problem072d(n: Int, p: List<Int>): Int {
    var count = 0
    var isSwap = false
    var swapNum = 0
    for (i in 0 until n - 1) {
        val pi = if (isSwap) swapNum else p[i]
        val pi2 = p[i + 1]
        val pi3 = if (i != n - 2) p[i + 2] else i + 2
        val i = i + 1
        if (pi == i && pi2 == i + 1) {
            swapNum = pi
            isSwap = true
            count++
            continue
        }
        if (pi == i && pi2 != i + 1) {
            swapNum = pi
            isSwap = true
            count++
            continue
        }
        if (pi != i && pi2 == i + 1 && pi3 != i + 2) {
            swapNum = pi
            isSwap = true
            count++
            continue
        }
        isSwap = false
    }

    return count
}

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

int w, h;
string field[21];

void print_field() {
    for (int i = 0; i < h; i++) {
        cout << field[i] << endl;
    }
}

void shoot(int x, int y) {
    int dx, dy;
    switch (field[y][x]) {
        case '^': dx = 0; dy = -1; break;
        case 'v': dx = 0; dy = 1; break;
        case '<': dx = -1; dy = 0; break;
        case '>': dx = 1; dy = 0; break;
    }
    while (1) {
        x += dx;
        y += dy;
        if (x < 0 || w <= x || y < 0 || h <= y || field[y][x] == '#') {
            return;
        }
        if (field[y][x] == '*') {
            field[y][x] = '.';
            return;
        }
    }
}

void solve() {
    int x, y;
    cin >> h >> w;
    for (int i = 0; i < h; i++) {
        cin >> field[i];
        for (int j = 0; j < field[i].size(); j++) {
            char c = field[i][j];
            if (c == '<' || c == '^' || c == '>' || c == 'v') {
                x = j; y = i;
            }
        }
    }
    int n;
    string s;
    cin >> n >> s;
    for (char c : s) {
        if (c == 'S') shoot(x, y);
        else {
            int dx, dy;
            char mark;
            switch (c) {
                case 'U': dx = 0; dy = -1; mark = '^'; break;
                case 'D': dx = 0; dy = 1; mark = 'v'; break;
                case 'L': dx = -1; dy = 0; mark = '<'; break;
                case 'R': dx = 1; dy = 0; mark = '>'; break;
            }
            int nx = x + dx;
            int ny = y + dy;
            field[y][x] = mark;
            if (0 <= nx && nx < w && 0 <= ny && ny < h && field[ny][nx] == '.') {
                field[y][x] = '.';
                field[ny][nx] = mark;
                x = nx;
                y = ny;
            }
        }
    }
    print_field();
}

int main() {
    int t;
    for (cin >> t; t; t--) {
        solve();
        if (t != 1) cout << endl;
    }
    return 0;
}

Measured memory_bytes: 1204
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
int gcd(int a, int b) {
return b ? gcd(b, a%b) : a;
}

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

Measured memory_bytes: 1792
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCorder
{
    class Program
    {
        static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }
        public void Solve(ConsoleInput cin)
        {
            var N = cin.ReadInt;
            var D = cin.ReadInt;
            var ans = Math.Ceiling((double)N / (2 * D + 1));
            WriteLine(ans);
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); } }
        public int ReadInt { get { return int.Parse(Read); } }
        public long ReadLong { get { return long.Parse(Read); } }
        public double ReadDouble { get { return double.Parse(Read); } }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
    }
}


Measured memory_bytes: 13268
#include <bits/stdc++.h>
using namespace std;
int main(void) {
    int a, b, c;
    cin >> a >> b >> c;
    if (a-b == 0) cout << c << endl;
    else if (a-c == 0) cout << b << endl;
    else cout << a << endl;
     
    return 0;
}

Measured memory_bytes: 256