akhauriyash/Code-Regression huggingface dataset:
# http://tutuz.hateblo.jp/entry/2018/12/09/220715

inf = float('inf')

n = int(input())
coordinates = [tuple(map(int, input().split())) for _ in range(n)]

parity = None
can_make = True
for coordinate in coordinates:
    if parity is None:
        parity = sum(coordinate) % 2
    else:
        if parity != sum(coordinate) % 2:
            can_make = False
            break

if not can_make:
    print(-1)
    exit()
    # 到達可能な頂点はxy座標の和のパリティが一致している必要がある

if parity == 0:
    d = [pow(2, i) for i in range(31 + 1)] + [1]
    # 奇数は1だけなので、1を追加して、全ての腕の合計が偶数になるようにする
else:
    d = [pow(2, i) for i in range(31 + 1)]
    # 奇数は1だけなので、全ての腕の合計は奇数になる
d.sort(reverse=True)

ans = []
for x, y in coordinates:
    u = x + y
    v = x - y
    # 45度回転する
    # u,vの最大値はx,yの2倍=2*10**9
    # 2 ** 31 > 2 * (10 ** 9) なので、2**31までの二冪で大丈夫そう
    # [1, 2, ..., 2 ** 31]
    # L(-d,-d)R(+d,+d)U(+d,-d)D(-d,+d)
    # なので、一つのdで、uでは加算、vでは減算などでき、二冪一セットで足りる
    curu, curv = 0, 0
    ops = ''
    for dd in d:
        dist = inf
        op = ''
        det_du, det_dv = 0, 0
        for c, (du, dv) in zip('LRDU', [(-1, -1), (1, 1), (-1, 1), (1, -1)]):
            t = abs(curu + du * dd - u) + abs(curv + dv * dd - v)
            if dist > t:
                op = c
                dist = t
                det_du = du
                det_dv = dv
        ops += op
        curu += det_du * dd
        curv += det_dv * dd
    if (curu, curv) == (u, v):
        ans.append(ops)
    else:
        print(-1)
        # print('不一致', curx, cury, x, y)

print(len(d))
print(*d)
print(*ans, sep='\n')


Measured memory_bytes: 3472
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
//const long long MOD = 998244353;

using namespace std;


void solve()
{
    char str[15];
    scanf("%s", str);
    vector<char> z;
    int i;
    for (i = 0; i < 12; i++) {
        z.push_back(str[i]);
        if (i == 3) z.push_back(' ');
    }
    z.push_back('\0');
    printf("%s\n", &z[0]);

    return;
}

int main(int argc, char* argv[])
{
#if 1
    solve();
#else
    int T; scanf("%d", &T);
    while(T--) {
        solve();
    }
#endif
    return 0;
}


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

int main() {
  int N, i;
  cin>>N;
  for(i=1;i<=10;i++){
    if(i==10){
      printf("No");
      break;
    }
    if((N%i==0)&&(N/i<=9)){
      printf("Yes");
      break;
    }
  }
  
}


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

typedef long long ll;
typedef long double ld;

#define pb push_back
#define sort(s) sort(s.begin(),s.end())
#define reverse(s) reverse(s.begin(),s.end())
#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++)

const ll mod = 1e9+7;

//最大公約数
ll gcd(ll a, ll b) {
    return b ? gcd(b, a%b) : a;
}

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

//素数判定
bool isPrime(ll x){
    ll i;
    if(x < 2)return 0;
    else if(x == 2) return 1;
    if(x%2 == 0) return 0;
    for(i = 3; i*i <= x; i += 2) if(x%i == 0) return 0;
    return 1;
}

//桁和
int digsum(ll n) {
    int res = 0;
    while(n > 0) {
        res += n%10;
        n /= 10;
    }
    return res;
}

//桁数
int dignum(ll n) {
    int res = 0;
    while(n > 0) {
        res++;
        n /= 10;
    }
    return res;
}

//文字列中の特定の文字カウント
ll stringcount(string s,char c){
    return count(s.cbegin(),s.cend(),c);
}

//階乗
ll ka(ll i){
    ll res=1;
    while(i>0){
        res=res*i;
        i--;
    }
    return res;
}
 
//ncr
ll ncr(ll x,ll y){
    ll a = x;
    ll b = 1;
    if(y>(x/2)){
        y=x-y;
    }
    for(ll i=1;i<y;i++){
        a*=x-i;
        b*=i+1;
    }
    return a/b;
}

//フィボナッチ数列 -92
ll f(ll x){
    ll dp[x+1];
    dp[1]=1;
    dp[2]=1;
    for(ll i=3;i<=x;i++){
        dp[i]=dp[i-1]+dp[i-2];
    }
    return dp[x];
}



int main(){
    double l;
    cin >> l;
    ld ans = l*l*l;
    cout << setprecision(10) << ans/27 << endl;
}

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

#define REP(i, n, N) for(ll i=(n); i<(N); i++)
#define RREP(i, n, N) for(ll i=(N-1); i>=n; i--)
#define CK(n, a, b) ((a)<=(n)&&(n)<(b))
#define ALL(v) (v).begin(),(v).end()
#define MCP(a, b) memcpy(b,a,sizeof(b))
#define p(s) cout<<(s)<<endl
#define p2(a, b) cout<<(a)<<" "<<(b)<<endl
#define v2(T) vector<vector<T>>
typedef long long ll;
using namespace std;
const ll mod = 1e9 + 7;
const ll inf = 1e18;

string s;
ll ans;
ll wcnt;
int main() {
    cin>>s;
    RREP(i,0,s.size()){
        if(s[i]=='B'){
            ans+=wcnt;
        }else{
            wcnt++;
        }
    }
    p(ans);
    return 0;
}


Measured memory_bytes: 640
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <chrono>
#define _USE_MATH_DEFINES
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;

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

const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-8;
const int MOD = 1000000007; // 998244353;
const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};
/*-------------------------------------------------*/
int main() {
  cin.tie(0); ios::sync_with_stdio(false);
  // freopen("input.txt", "r", stdin);

  int n; cin >> n;
  vector<int> v(n); REP(i, n) cin >> v[i];
  sort(ALL(v));
  double ans = v[0];
  FOR(i, 1, n) ans = (ans + v[i]) / 2;
  printf("%.7f\n", ans);
  return 0;
}


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

int main() {
    int x;
    cin >> x;
    int ans_a=0,ans_b=0;
    for(int i=-200;i<200;i++){
        for(int j=-200;j<200;j++){
            if(pow(i,5)-pow(j,5)==x){
                ans_a=i;
                ans_b=j;
                break;
            }
        }
        if(ans_a!=0||ans_b!=0){
            break;
        }
    }
    cout << ans_a << " " << ans_b << endl;
}

Measured memory_bytes: 4028
def bfs_graph(G, start):
    from collections import deque
    # 隣接リストを食わせる
    prev = [None] * N
    dist = [-1] * N
    que = deque([start])
    dist[start] = 0
    while que:
        v = que.popleft()
        d = dist[v]
        for w in G[v]:
            if dist[w] > -1:
                continue
            dist[w] = d + 1
            prev[w] = v
            que.append(w)
    return dist, prev
N, M = map(int, input().split())
graph = [[] for _ in range(N)]
def int_(num_str):
    return int(num_str) - 1


for _ in range(M):
    a, b = map(int_, input().split())
    graph[a].append(b)
    graph[b].append(a)
_, prev = bfs_graph(graph, 0)
print("Yes")
for i in range(1, N):
    print(prev[i]+1)

Measured memory_bytes: 94760
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i < b; i++)
#define rrep(i, a, b) for (int i = a; i >= b; i--)
#define fore(i, a) for (auto& i : a)
#define all(x) (x).begin(), (x).end()
//#pragma GCC optimize ("-O3")
using namespace std;
void _main();
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  _main();
}
typedef long long ll;
const int inf = INT_MAX / 2;
const ll infl = 1LL << 60;
template <class T>
bool chmax(T& a, const T& b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T& a, const T& b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     @hamayanhamayan0
　　　　／　　　＼　 　  |　|
　　　 /　　 /￣￣￣￣/　　|
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿
　 　　　＼/＿＿＿＿/　（u　⊃
---------------------------------------------------------------------------------------------------*/

void _main() {
  int N;
  string S;
  cin >> N >> S;
  // unordered_set<string> res;
  int res = 0;
  rep(i, 0, 10) {
    rep(j, 0, 10) {
      rep(k, 0, 10) {
        int l, m, n;
        bool flag = false;
        for (l = 0; l < N; l++) {
          if (S[l] - '0' == i) {
            flag = true;
            break;
          }
        }
        if (!flag) continue;
        flag = false;
        for (m = l+1; m < N; m++) {
          if (S[m] - '0' == j) {
            flag = true;
            break;
          }
        }
        if (!flag) continue;
        flag = false;
        for (n = m+1; n < N; n++) {
          if (S[n] - '0' == k) {
            ++res;
            break;
          }
        }
      }
    }
  }

  cout << res << endl;
}

Measured memory_bytes: 384
using System;

namespace Atcoder
{
    class Program
    //M-SOLUTIONS C - Best-of-(2n-1)
    {
        private static void Main(string[] args)
        {
            var s = Console.ReadLine();
            var ans = s.Length <= Counto(s) + 7 ? "YES" : "NO";
            Console.WriteLine(ans);
        }

        private static int Counto(string s)
        {
            return s.Length - s.Replace("o", "").Length;
        }
    }
}


Measured memory_bytes: 11092
#include <stdio.h>
#include <string.h>
int main(void){
  int i,l;
  int s=0;
  char N[200001];
  setbuf(stdout,NULL);
  scanf("%s",N);
  l=strlen(N);
  l--;
  for(i=0;i<=l;i++){
    s+= N[i]-'0';
  }
  if(s%9==0){
    printf("Yes");
  }else{
    printf("No");
  }
  return 0;
}


Measured memory_bytes: 1892
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1000000007;
#define INF 1LL<<30
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()


int main(){
    ll d,t,s;
    cin>>d>>t>>s;
    if(t*s>=d) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


Measured memory_bytes: 3552
#include <bits/stdc++.h>
#define cinf(n,x) for(int i=0;i<(n);i++) cin >> x[i];
typedef long long int ll;
using namespace std;

int main(){
  string s; cin >> s;
  string ans;
  for(int i=0;i<s.size();i++){
  	if(s[i]=='B'&&ans.size()>0)ans.pop_back();
  	else if(s[i]!='B')ans.push_back(s[i]);
  }
  cout << ans << endl;
} 


Measured memory_bytes: 256
def make_divisors(n):
    divisors = []
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n // i)
    # divisors.sort()
    return divisors

n = int(input())
res = 100
for x in make_divisors(n):
    y = n // x
    res = min(res, max(len(str(x)), len(str(y))))
print(res)


Measured memory_bytes: 39280
#include <stdio.h>
#include <float.h> 
int main(void){	
  int n;	
  long long a[10000];	
  long long i,max,min,sum; 
  scanf("%d",&	n);
  for(i=0 ; i<n ;i++){
    scanf("%lld",&a[i]);
  }
  max = a[0];
  min = a[0];
  sum = 0;
  for(i=0 ; i<n ; i++){
    if(a[i] >= max){
      max = a[i];
    }
    if(a[i] <= min){
      min = a[i];
    }
    sum += a[i];
  }
  printf("%lld %lld %lld\n",min,max,sum);
  return 0;
}

Measured memory_bytes: 1104
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,k,s;
	cin>>n>>k>>s;
	for(int i =0;i<k;i++)
		cout<<s<<' ';
	int val = s+1;
	if(s==1e9)
		val = s-1;
	for(int i =0;i<n-k;i++)
		cout<<val<<' ';
	cout<<'\n';
}


Measured memory_bytes: 1280
number=list(map(int,input().split()))
X,K,D=number[0],number[1],number[2]
res=0
t=0
ans=0
if X<0:
    X=X*(-1)
if X>K*D:
    print(X-K*D)
elif X<=K*D:
    key=int(X/D)
    key+=1
    res=X-(D*key)
    t=K-key
    t=int(t%2)
    if t==0:
        ans=res*(-1)
    else:
        ans=res+D
        
    print(ans)

Measured memory_bytes: 61696
#include <iostream>
using namespace std;
int n,q,bit[10000001];
void add(int a,int b){
    bit[a]+=b;
    while(a<=n){
        a+=a&-a;
        bit[a]+=b;
    }
}
int sum(int i){
    if(i==0)return 0;
    
    return bit[i]+sum(i-(i&-i));
}
int main(void){
    cin>>n>>q;
    for(int i=0;i<q;i++){
        int c,x,y;
        cin>>c>>x>>y;
        if(c==0){
            add(x,y);
        }else{
            cout<<sum(y)-sum(x-1)<<endl;
        }
    }
}

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

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

    for(int i = 0; i < 3; i++) {
        if(s[i + 1] == s[i]) {
            cout << "Bad" << endl;
            return 0;
        }
    }
    cout << "Good" << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <stack>
#include <iomanip>
#include <numeric>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <map>
#include <set>
#include <vector>
#include <utility>
#include <queue>
#include <cmath>

#define BEGIN(x) x.begin()
#define END(x) x.end()
#define ALL(x) BEGIN(x), END(x)
#define PAIR make_pair
#define VEC(type) vector<type >
#define endl '\n'

#define FOR(i, A, B) for(auto i = (A);i != (B); i++)
#define FORD(i, A, B) for(auto i = (A);i != (B); i--)

#define READRANGE(begin, end) FOR(it, begin, end) cin >> *it
#define READVEC(V) READRANGE(BEGIN(V), END(V))

using namespace std;

typedef long long lint;
typedef pair<int, int> Pii;
typedef pair<int, lint> Pil;
typedef pair<lint, lint> Pll;
typedef pair<lint, int> Pli;

// ---- BEGIN LIBRARY CODE ----
// ---- END LIBRARY CODE ----
void io_init()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
};

int main(int argc, char **argv)
{
    io_init();

    // Actual program code starts here.
    int A, B;
    cin >> A >> B;
    cout << max(0, A - 2 * B) << endl;
    return 0;
};


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
# !/usr/bin/env python
# vim: set fileencoding=utf-8 :

"""
#
# Author:   Noname
# URL:      https://github.com/pettan0818
# License:  MIT License
# Created: 日  9/23 21:17:33 2018

# Usage
#
"""
def get_input():
    first = [int(i) for i in input().split(" ")]
    second = list(sorted([int(i) for i in input().split(" ")]))
    third = list(sorted([int(i) for i in input().split(" ")]))

    return first[2], first[3], second, third

def judge(x, y, x_list, y_list):
    """
    >>> judge(10,20,[8,15], [16,22])
    >>> judge(-48, -1, [-20,-35,-91,-23], [-22, 66])
    >>> judge(6,8, [-10,3,1,5,-100], [100,6,14])
    """
    x_max = max(x_list)
    y_min = min(y_list)

    if x >= y:
        return False
    if x_max >= y_min:
        return False
    if y <= x_max:
        return False
    if y_min <= x:
        return False
    return True



if __name__ == '__main__':
    # import doctest
    # doctest.testmod()
    res = judge(*get_input())
    if res:
        print("No War")
    else:
        print("War")


Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
//#include <set>

int n, m; //テヲツ、ツ?・ツュツ? テ、ツコツコ

int main() {
    while(std::cin >> n >> m, n + m) {
        std::string str(n, '#');

        char q;
        for(int a = 0; a < m; ++a) {
            std::cin >> q;

            bool ok;
            switch(q) {
            case 'A':
                str[str.find("#")] = 'A';
                break;
            case 'B':
                ok = false;
                for(int i = n - 1; i >= 0; --i) {
                    if((i == 0 || str[i - 1] != 'A') && (i == n - 1 || str[i + 1] != 'A') && str[i] == '#') {
                        ok = true;
                        str[i] = 'B';
                        break;
                    }
                }
                if(!ok) {
                    str[str.find("#")] = 'B';
                }
                break;
            case 'C':
                ok = false;
                for(int i = 0; i < n; ++i) {
                    if(str[i] != '#') {
                        if(i != n - 1 && str[i + 1] == '#') {
                            str[i + 1] = 'C';
                            ok = true; break;
                        }
                        if(i != 0 && str[i - 1] == '#') {
                            str[i - 1] = 'C';
                            ok = true; break;
                        }
                    }
                }

                if(!ok) {
                    str[n / 2] = 'C';
                }
                break;
            case 'D':
                int dist[101];
                for(int i = 0; i < n; ++i) {
                    int d = 1e+9;
                    if(str[i] == '#') {
                        for(int j = 0; j < n; ++j) {
                            if(str[j] != '#') {
                                d = std::min(d, std::abs(i - j));
                            }
                        }
                    }else {
                        d = 0;
                    }
                    
                    dist[i] = d;
                }

                int maxIdx = 0;
                for(int i = 1; i < n; ++i) {
                    if(dist[i] > dist[maxIdx]) {
                        maxIdx = i;
                    }
                }

                str[maxIdx] = 'D';

                break;
            }
//            std::cout << str << std::endl;
        }

        std::cout << str << std::endl;
    }
}

Measured memory_bytes: 1204
(n,k),*a=$<.map{|s|s.split.map &:to_i}
a.sort_by!{|t,d|[-d,t]}
h=[]
v=[9e9]*n
a[x=s=0,k].map{|t,d|h[t]?v<<d:x+=1;h[t]=1;s+=d}
p [s+=x**2,*a[k,n].map{|t,d|h[t]||=s+=d-v.pop+x+x+=1}].max

Measured memory_bytes: 16656
#pragma warning(disable:4996)
#pragma comment(linker, "/STACK:336777216")
#pragma GCC optimize("Ofast")

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
#define int long long int
typedef complex<long double> cd;
const long double pi=acos(-1);
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <db, db> pdd;
typedef vector<int> vi;
typedef vector<vector<int> > matrix;

#define m1 make_pair
#define pb push_back
#define flush fflush(stdout)
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);
#define reset(x,v) memset(x,v,sizeof(x))

#define fi first
#define se second
#define endl "\n"
#define debug(x) (cerr << #x << ": " << x << "\n")
#define setbits(x) __builtin_popcount(x)
#define setbitsll(x) __builtin_popcountll(x)
#define all(x) x.begin(),x.end()
#define pii pair<int,int>

inline ll gcd(ll a,ll b){if(a==0) return b;return gcd(b%a,a);}
inline ll power(ll a,ll n,ll m){if(n==0)return 1;ll p=power(a,n/2,m);p=(p%m*p%m)%m;if(n%2) return (p%m*a%m)%m;else return p;}
const double EPS = 1e-9;
const ll MOD =998244353;
const ll hell=1000000007;
const int INF = 1e16;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
template<typename T>
using ordered_set=tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

auto seed = chrono::high_resolution_clock::now().time_since_epoch().count();
std::mt19937 rng(seed);

double startTime;
double getCurrentTime() {
    return ((double)clock() - startTime) / CLOCKS_PER_SEC;
}
const int dx[] = { -1, 0, 1, 0 };
const int dy[] = { 0, 1, 0, -1 };


const int N=200001;

void solve()
{
    string s;
    cin>>s;
    if(s.length()<6)
    {
        cout<<"No"<<endl;
        return;
    }
    if(s[2]==s[3]&&s[4]==s[5])
    {
        cout<<"Yes"<<endl;
    }
    else
        cout<<"No"<<endl;
    
}



int32_t main()
{
    IOS;
    //FILE *fin = freopen("in","r",stdin);
    //FILE *fout = freopen("out","w",stdout);
    int t;
    t=1;
   // cin>>t;
    
    while(t--)
    {
        solve();
    }
    return 0;
}


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

int main()
{
  while (1)
  {
    int H, W;
    cin >> H >> W;
    if (H == 0 && W == 0)
    {
      break;
    }
    for (int i = 0; i < H; i++)
    {
      for (int j = 0; j < W; j++)
      {
        if ((i + j) % 2 == 0)
        {
          cout << "#";
        }
        else
        {
          cout << ".";
        }
      }
      cout << endl;
    }
    cout << endl;
  }
}


Measured memory_bytes: 3096
import java.util.*;


public class Main {
  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    String T = sc.next();
    int A = sc.nextInt();
    int B = sc.nextInt();
    String U = sc.next();

    if (U.equals(S)) {
      A--;
    } else{
      B--;
    }
    System.out.println(A + " " + B);
  }
}

Measured memory_bytes: 21844
#include<stdio.h>
main()
{
	int n, m, x, y, a, b, p, q;
	scanf("%d%d%d%d", &n, &m, &x, &y);
	p=-300;
	while (n--)
	{
		scanf("%d", &a);
		if (a>p)
		{
			p=a;
		}
	}
	q=300;
	while (m--)
	{
		scanf("%d", &b);
		if (b<q)
		{
			q=b;
		}
	}
	if (q>p && p>x && q<=y)
	{
		printf("No War\n");
	}
	else
	{
		printf("War\n");
	}
	return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
#include <string.h>
 
unsigned str_length(const char str[])
{
    unsigned len = 0;
    while (str[len])
        len++;
    return (len);
}
 
void rev_string(char str[])
{
    int i;
    int len = str_length(str);
    for (i = 0; i < len / 2; i++) {
        char temp = str[i];
        str[i] = str[len-i-1];
        str[len-i-1] = temp;
    }
}
 
int substr( char *t, const char *s, int pos, int len )
{
    if( pos < 0 || len < 0 || len > strlen(s) )
        return -1;
    for( s += pos; *s != '\0' && len > 0; len-- )
        *t++ = *s++;
    *t = '\0';
    return 0;
}
 
 
int main(void)
{
    int len,i,count;
    char str[100];
    char s[100];
    char t[100];
 
    scanf("%s", str);
 
    len = str_length(str);
 
    if(len % 2==0){
        substr(s, str, 0, len/2);
        substr(t, str, len/2, len/2);
        rev_string(s);
 
        count = 0;
 
        for(i=0; i <= len/2 ; i++){
            if(s[i] != t[i]){
                count += 1;
            }
        }
    }
 
    if(len % 2==1){
        substr(s, str, 0, (len-1)/2);
        substr(t, str, (len-1)/2 + 1, (len-1)/2);
        rev_string(s);
 
        count = 0;
 
        for(i=0; i <= (len-1)/2; i++){
            if(s[i] != t[i]){
                count += 1;
            }
        }
    }
 
    printf("%d",count);
 
 
    return (0);
}

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

//#include <ext/pb_ds/assoc_container.hpp> // Common file
//#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update

#define rep(i,n) for(i=1;i<=n;i++)
#define Rep(i,n) for(i=0;i<n;i++)
#define For(i,a,b) for(i=a;i<=b;i++)

#define pb(x) push_back(x)
#define sz(x) (int)x.size()

#define mem(ara,val) memset(ara,val,sizeof(ara))
#define eps 1e-7

#define si(x) scanf("%d",&x)
#define sii(x,y) scanf("%d %d",&x,&y)
#define siii(x,y,z) scanf("%d %d %d",&x,&y,&z)
#define sl(x) scanf("%lld",&x)
#define sll(x,y) scanf("%lld %lld",&x,&y)
#define slll(x,y,z) scanf("%lld %lld %lld",&x,&y,&z)
#define ss(str) scanf("%s",str)
#define pi(x) printf("%d",x)
//#define pii(x,y) printf("%d %d",x,y)
#define piii(x,y,z) printf("%d %d %d",x,y,z)
#define pl(x) printf("%lld",x)
#define pll(x,y) printf("%lld %lld",x,y)
#define plll(x,y,z) printf("%lld %lld %lld",x,y,z)
#define NL printf("\n")
#define Max 1000005
#define INF 1e18
#define un(x) x.erase(unique( x.begin() , x.end() ), x.end())
#define mod 1000000007

#define FI freopen("z.txt","r",stdin)

#define D(x) cout << #x << " = " << x << endl
#define DD(x,y) cout << #x << " = " << x << "   " << #y << " = " << y << endl
#define DDD(x,y,z) cout << #x << " = " << x << "   " << #y << " = " << y << "   " << #z << " = " << z << endl
#define all(x) x.begin(),x.end()
#define prntvctr(x) for(int i = 0; i < x.size(); i++) printf("%d%c", x[i], i + 1 == x.size() ? '\n' : ' ' );
#define pc(x) __builtin_popcount(x)

typedef long long LL;
typedef unsigned long long ULL;

const double PI = acos(-1.0);

using namespace std;

int setb(int n,int pos)
{
    return n=n | (1 << pos);
}
int resb(int n,int pos)
{
    return n=n & ~(1 << pos);
}
bool checkb(LL n,LL pos)
{
    return (bool)(n & (1ll << pos));
}

LL bigmod(LL b,LL p,LL m)
{
    if( p == 0 ) return 1;
    LL ret = bigmod(b,p/2,m);
    ret = ( ret * ret ) % m;
    if( p & 1 ) ret = ( ret * b ) % m;
    return ret;
}

int n, ara[Max], ans[Max];

int solve(int x)
{
	int ret = 0;
	int mask = x & (x - 1);
	int mx[2];
	mx[0] = ara[x]; mx[1] = 0;
	while( 1 )
	{
        if( ara[mask] > mx[1] )
        {
			mx[1] = ara[mask];
			if( mx[0] < mx[1] ) swap( mx[0] , mx[1] );
        }
		if( mask == 0 ) break;
		mask = ( (mask - 1) & x );
	}
	return mx[0] + mx[1];
}

int brute(int k)
{
	int ret = 0;
	for(int i = 0; i <= k; i++)
	{
		for(int j = i + 1; j <= k; j++)
		{
			if( (i | j) <= k ) ret = max( ret , ara[i] + ara[j] );
		}
	}
	return ret;
}

int main()
{
	//FI;
	int i;
    si(n);
    for(int i = 0; i < (1 << n); i++) si( ara[i] );
    for(int i = 1; i < (1 << n); i++)
    {
        ans[i] = max( ans[i-1] , solve(i) );
        printf("%d\n", ans[i]);
        //assert( ans[i] == brute(i) );
    }
	return 0;
}


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

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

   int mn=1,mx=N;
   for(int i=1;i<N;i++){
      if(a[i]<=a[i-1]) mn++;
   }
   cout<<mn<<endl<<mx<<endl;
   return 0;
}



Measured memory_bytes: 3136
N = int(input())
se = [[]] * N
for i in range(N):
	x, l = map(int, input().split())
	se[i] = [x-l, x+l]
se = sorted(se, key=lambda x: x[1])
ans = N
for i in range(1, N):
	if se[i-1][1] > se[i][0]:
		se[i][1] = se[i-1][1]
		ans -= 1
print(ans)

Measured memory_bytes: 26220
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

n=int(input())
#print(make_divisors(n))
s=0
for i in range(1,n+1,2):
    if len(make_divisors(i))==8:
        s+=1
print(s)

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

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll n, m;
	cin>>n>>m;
	for(ll i=m/n; i>=1; --i){
		if(m%i==0){
			cout<<i<<'\n';
			return 0;
		}
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
#define N 100100
int main()
{
  int n,q,data;
  cin >> n;
  vector<int> a(N);
  for(int i=0; i<N; i++)
    a[i]=0;
  for(int i=0; i<n; i++){
    cin >> data;
    a[data]++;
  }
  cin >> q;
  vector<int> b(q),c(q);
  vector<long> s(q+1);
  for(int i=0; i<q; i++){
    cin >> b[i];
    cin >> c[i];  
  }
  
  for(int i=0; i<N; i++)
    s[0]+=a[i]*i;

  for(int i=0; i<q; i++){
    s[i+1]=s[i]+a[b[i]]*(c[i]-b[i]);
    a[c[i]]+=a[b[i]];
    a[b[i]]=0;
    cout << s[i+1] << endl;
  }

  return 0;
}

Measured memory_bytes: 5088
using System;
using System.Collections.Generic;
using System.Linq;
class Program{
	const int mod=1000000007;
	static void Main(){
		int[] s=Array.ConvertAll(Console.ReadLine().Split(),int.Parse);
		long[] a=Array.ConvertAll(Console.ReadLine().Split(),long.Parse);
		long[] b=Array.ConvertAll(Console.ReadLine().Split(),long.Parse);
		long[,] h=new long[s[0]+1,s[1]+1];
		bool[,] dp=new bool[s[0]*s[1]+1,2];
		for(int i=0;i<s[0];i++){dp[a[i],0]=true;}
		for(int i=0;i<s[1];i++){dp[b[i],1]=true;}
		long ans=1,c=0,d=0,p=0;

		for(int i=s[0]*s[1];i>0;i--){
			//Console.WriteLine("{0} {1} {2} {3} {4} {5}",i,dp[i,0],dp[i,1],p,c,d);
			if((dp[i,0])&&(dp[i,1])){
				c++;d++;
			}
			else if((!dp[i,0])&&(!dp[i,1])){
				ans*=c*d-p;
				ans%=mod;
			}
			else if(dp[i,0]){
				ans*=d;
				ans%=mod;
				c++;
			}
			else if(dp[i,1]){
				ans*=c;
				ans%=mod;
				d++;
			}
			//Console.WriteLine("{0}",ans);
			p++;
		}

		
		Console.WriteLine("{0}",ans);
		
	}
}

Measured memory_bytes: 15200
package main

import "fmt"

func group(a int) int {
	switch a {
	case 1, 3, 5, 7, 8, 10, 12:
		return 1
	case 4, 6, 9, 11:
		return 2
	case 2:
		return 3
	}
	return -1
}

func main() {
	var a, b int
	fmt.Scan(&a, &b)

	if group(a) == group(b) {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 512
import java.util.Scanner;

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

		int N = scan.nextInt();
		int K = scan.nextInt();
		int Q = scan.nextInt();
		
		Integer[] score = new Integer[N];
		
        for(int i = 0; i < N; ++i) {
        	score[i] = K - Q;
        }
		
        for(int j = 0; j < Q; ++j) {
        	
        	int ans = scan.nextInt();
        	
        	score[ans - 1] += 1;
        }
		
        for(int i = 0; i < N; ++i) {
        	if(score[i] > 0) {
        		System.out.println("Yes");
        	} else {
        		System.out.println("No");
        	}
        }
		
		scan.close();
	}

}


Measured memory_bytes: 63444
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <math.h>
#include <iomanip>
#include <bitset>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <utility>
#include <set>
using namespace std;
typedef long long int ll;
typedef long double ld;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
 
typedef pair<ll,ll> pairs;
vector<pairs> p;
bool pairCompare(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.first < secondElof.first;
}
#define MAX_N 1000100
bool x[MAX_N];
ll num[MAX_N];
ll fibl[MAX_N]={0};
 
ll fib(ll a){
    if (fibl[a]!=0)return fibl[a];
    if (a==0){
        return 0;
    }else if (a==1){
        return 1;
    }
    return fibl[a]=fib(a-1)+fib(a-2);
}
 
ll eratosthenes(ll n) {
    int p = 0;
    for (ll i=0; i<=n; ++i) x[i] = true;
    x[0] = x[1] = false;
    for(int i=2; i<=n; ++i) {
        if(x[i]) {
            p++;
            for(int j=2*i; j<=n; j+=i) x[j] = false;
        }
        
        num[i] = p;
    }
    return p;
}
 
ll gcd(ll a,ll b){
    if (a%b==0)return(b);
    else return(gcd(b,a%b));
}
 
ll keta(ll N){
    int tmp{};
    while( N > 0 ){
        tmp += ( N % 10 );
        N /= 10;
    }
    N = tmp;
    return N;
}

int main(){
    ll d,g,ans=INF;
    cin >> d >> g;
    ll p[d],c[d];
    for (ll i=0;i<d;i++){
        cin >> p[i] >> c[i];
    }
    for (ll bit=0;bit<(1LL<<d);bit++){
        ll s=0,num=0,rest=-1;
        for (ll i=0;i<d;i++){
            if ((bit>>i&1)){
                s+=p[i]*(100*(i+1))+c[i];
                num+=p[i];
            }else{
                rest=i;
            }
        }
        if (s<g){
            ll need=(g-s+(rest+1)*100-1)/((rest+1)*100);
            if (need>=p[rest]){
                continue;
            }
            num+=need;
        }
        ans=min(ans,num);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<string>

using namespace std;
int main()
{
  
    int n,t2 = 0,t1 = 0;
    scanf("%d",&n);
    int a[10][10];

    for(int i=0; i<n; ++i)
        a[0][i] = i+1;  //以0开头的存的是 这个最基本的哪一个数字 

    for(int j=1; j<=2;++j)
        for(int i=0; i<n; ++i)
            scanf("%d",&a[j][i]);//每一个i表示一位数字
			//两次存储 

    do{
        t1++;
        int flag = 0;
        for(int i=0; i<n; ++i){
            if(a[0][i]!=a[1][i]){ //对比基本数字和存储的
			//如果不相等就是1 
			//退出循环开始演算基础的 继续拍
			//直到找到相等的 也就是位置 记录位置是第t个 
                flag = 1;
                break;
            }
        }
        if(!flag)
            break;
    }while(next_permutation(a[0],a[0]+n));

    for(int i=0; i<n; ++i)
        a[0][i] = i+1;


    do{
        t2++;
        int flag = 0;
        for(int i=0; i<n; ++i){
            if(a[0][i]!=a[2][i]){
                flag = 1;
                break;
            }
        }
        if(!flag){
            break;
        }
    }while(next_permutation(a[0],a[0]+n));

    printf("%d",abs(t1-t2));
    return 0;
}


Measured memory_bytes: 3792
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
using namespace std;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
typedef long long ll;
typedef pair<int,int> P;
int main() {
    int N;
    cin >> N;
    int cnt = 0;
    set<int> v;
    rep(i, 0, N){
        int tmp;
        cin >> tmp;
        if(tmp>=3200) {cnt++;
            
        }else{
            int colorN = tmp/400;
            v.insert(colorN);
        }
    }
    int minv = v.size();
    int maxv = minv+cnt;
    minv = max(minv,1);
    cout << minv << " " << maxv << endl;
    return 0;
}

Measured memory_bytes: 3600
#include <cctype>
#include <cfloat>
#include <climits>
#include <cmath>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <ios>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <forward_list>
#include <random>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <unordered_map>
#include <unordered_set>
#endif

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define lcm( a, b ) (a)/__gcd((a),(b))*(b)
#define endl '\n'

using namespace std;

typedef long long LL;
typedef pair< int, int > P;
typedef pair< LL, LL > LP;
typedef pair< int, P > iP;
typedef pair< P, P > PP;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1000000007;
static const int SIZE = 100005;

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

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

    int n;
    cin >> n;
    int a[n];
    for( int i = 0; i < n; ++i ) cin >> a[i];

    bool fl = true;
    for( int i = 1; i < n; ++i ) {
        if( a[i - 1] > a[i] ) fl = false;

    }
    if( fl ) {
        cout << "YES" << endl;
        return 0;
    }
    for( int i = 0; i < n; ++i ) {
        for( int j = i + 1; j < n; ++j ) {
            swap( a[i], a[j] );
            bool flg = true;
            for( int k = 1; k < n; ++k ) {
                if( a[k - 1] > a[k] ) flg = false;

            }
            swap( a[i], a[j] );
            if( flg ) {
                cout << "YES" << endl;
                return 0;

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


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


int main() {
    int n,k;
    cin >> n >> k;
    vector<int> l(n,0);
    rep(i,n)cin >> l.at(i);
    sort(l.begin(),l.end(),greater<int>());
    int ans = 0;
    rep(i,k){
        ans += l.at(i);
    }
    cout << ans << endl;
    return 0;
}
/*
やっほい！
　　　　　　　やほほい！
　　　　+　　 　*
　　　 ∧∧　　. ∧∞∧　*
*　ヽ(=´ω｀)人(´ω｀*)ﾉ
　.～（ O x.） （ 　 O)～　+
。*　 　∪　　　　∪
*/

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>

typedef struct{
  double x;
  double y;
} Point;

void kock(int,Point,Point);

int main(){

  int n;
  Point p1;
  Point p2;

  p1.x = 0.0;
  p1.y = 0.0;
  p2.x = 100.0;
  p2.y = 0.0;

  scanf("%d",&n);
  printf("%f %f\n",p1.x,p1.y);
  kock(n,p1,p2);
  printf("%f %f\n",p2.x,p2.y);

  return 0;

}

void kock(int n,Point p1,Point p2){

  Point s = {0.0,0.0};
  Point t = {0.0,0.0};
  Point u = {0.0,0.0};
  
  if(n == 0){
    return;
  }

  s.x = (2*p1.x + 1*p2.x)/3.0;
  s.y = (2*p1.y + 1*p2.y)/3.0;
  t.x = (1*p1.x + 2*p2.x)/3.0;
  t.y = (1*p1.y + 2*p2.y)/3.0;
  u.x = (t.x - s.x)*cos(M_PI/3.0) - (t.y - s.y)*sin(M_PI/3.0) + s.x;
  u.y = (t.x - s.x)*sin(M_PI/3.0) + (t.y - s.y)*cos(M_PI/3.0) + s.y;

  kock(n-1,p1,s);
  printf("%f %f\n",s.x,s.y);
  kock(n-1,s,u);
  printf("%f %f\n",u.x,u.y);
  kock(n-1,u,t);
  printf("%f %f\n",t.x,t.y);
  kock(n-1,t,p2);
}
    

Measured memory_bytes: 636
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define dunk(a) cout << (a) << endl
#define rall(a) (a).rbegin(),(a).rend()
const int INF = 2e9;
using namespace std;
using Graph = vector<vector<int>>;
typedef pair<int,int> P;
typedef long long ll;

vector<ll> a;

void dfs(ll cntup, ll x, ll s, ll f, ll t){
    if(cntup == 11) return;
    if(s >0 && f >0 && t >0){
        a.push_back(x);
    }

    dfs(cntup+1, 10*x+3, s, f, t+1);
    dfs(cntup+1, 10*x+5, s, f+1, t);
    dfs(cntup+1, 10*x+7, s+1, f, t);

}

int main(){
    ll n; cin >> n;
    ll ans = 0;

    dfs(1, 3, 0, 0, 1);
    dfs(1, 5, 0, 1, 0);
    dfs(1, 7, 1, 0, 0);

    sort(all(a));

    rep(i,a.size()){
        if(a[i] > n) break;
        ans++;
    }

    cout << ans << endl;

}

Measured memory_bytes: 1400
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <queue>
#include <tuple>
#include <cstring>

#define INF 100000000

using namespace std;

int main()
{

    vector<int> a(3);
    for (int i = 0; i < 3; i++)
        cin >> a[i];
    sort(a.begin(), a.end());
    cout << a[0] + a[1] << endl;

    return 0;
}


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

using namespace std;

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

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

    sort(d.begin(), d.end(), greater<int>());
    d.erase(unique(d.begin(), d.end()),d.end());
    
    cout << d.size() << endl;
    return 0;
}

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

using namespace std;

const int NMAX = 100000;

int main()
{
    string s;

    int mid = -1, cnt = 0, hyp = 0;
    int aa = 0, bb = 0;
    cin >> aa >> bb;cin >> s;
    int bad = 0;
    if( s[aa] != '-' ) bad = 1;
    for( int i = 0;  i < s.size();  ++i ) {
        if( i == aa ) continue;
        if( !std::isdigit(s[i])  ) bad = 1;
    }
    if( bad  ) cout << "No\n";
    else cout << "Yes\n";
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int maxn = 1e6 + 1;
signed main() {
  ios::sync_with_stdio(0); cin.tie(0);
  const int mod = 1e9 + 7;
  int maxLen = 667;
  int s;
  cin >> s;
  //dp[maxLen][sum];
  vector<vector<int>> dp(maxLen+200, vector<int>(2007));
  vector<vector<int>> p(maxLen + 200, vector<int>(2007));
  dp[0][0] = 1;
  p[0][0] = 1;
  for (int i = 1; i <= s; ++i)
    p[0][i] = p[0][i - 1] + dp[0][i];
  for (int pos = 1; pos <= maxLen; ++pos) {
    for (int sum = 0; sum <= s; ++sum) {
      if (sum >= 3)
       dp[pos][sum] = (dp[pos][sum] + p[pos - 1][sum - 3]) % mod;
    }
    p[pos][0] = dp[pos][0];
    for (int sum = 1; sum <= s; ++sum)
      p[pos][sum] = (p[pos][sum - 1] + dp[pos][sum]) % mod;
  }
  int ans = 0;
  for (int len = 1; len <= maxLen; ++len)
    ans = (ans + dp[len][s]) % mod;
  cout << ans;
}

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

int main() {
  int a,b,c;
  cin>>a>>b>>c;
  
  if (a==b){
    cout << c << endl;
  }
  else if (b==c){
    cout << a << endl;
  }
  else {
    cout << b << endl;
  }

  return 0;
}


Measured memory_bytes: 256
// https://atcoder.jp/contests/abc160/tasks/abc160_d
#include <bits/stdc++.h>
using namespace std;
// #define int long long
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()
#define DIV(a, b) ((a - 1) / b + 1)

int d[2001][2001];
void warshall_floyd(int n, int x, int y) {
    int v[] = {x, y};
    for (auto k : v) {         // 経由する頂点
        REP(i, n) {            // 始点
            FOR(j, i + 1, n) { // 終点
                d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
            }
        }
    }
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N, X, Y;
    cin >> N >> X >> Y;
    REP(i, N) REP(j, N) { d[i][j] = abs(i - j); }
    X--, Y--;
    d[X][Y] = 1;
    d[Y][X] = 1;
    warshall_floyd(N, X, Y);
    vector<int> ans(N);
    REP(i, N) FOR(j, i + 1, N) {
        int t = d[i][j];
        if (t < N)
            ans[t]++;
    }
    FOR(i, 1, N) { cout << ans[i] << "\n"; }

    return 0;
}


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

using namespace std;

int main() {
	int x, y;
	scanf("%d%d", &x, &y);

	int ans = 2e9;
	if(x <= y) {
		ans = min(ans, abs(x-y));
		ans = min(ans, abs(x+y)+1);
	}
	else {
		ans = min(ans, abs(x+y)+1);	
		ans = min(ans, abs(x-y)+2);	
	}
	printf("%d\n", ans);
}

Measured memory_bytes: 256
#include <assert.h>
#include <ctype.h>
#include <errno.h>
#include <float.h>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <set>
#include <queue>
#include <limits>
#include <deque>
#include <locale>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <wchar.h>
#include <wctype.h>
#include <algorithm>
#include <bitset>
#include <map>
#include <iomanip>
#include <ios>
#include <iostream>
#include <vector>
#include <cwchar>
#include <cwctype>
#define mp make_pair
#define fs first
#define se second
#define memset(a,t) memset(a,t,sizeof(a))
#define all(v) v.begin(),v.end()
#define MN 0LL
#define Mx 200000005
#define Mn -Mx
#define MX 20000000000000005
using namespace std;
int readint(){
	char c;
	while(c=getchar(),(c<'0'||c>'9')&&c!='-');
	bool flag=(c=='-');
	if(flag)c=getchar();
	int x=0;
	while(c>='0'&&c<='9'){
		x=x*10+c-48;
		c=getchar();
	}
	return flag?-x:x;
}
inline string tos(int x){
	string s;
	while(x) s=(char)(x%10+'0')+s,x/=10;
	return s;
}
inline int toi(string s){
	int rt=0;
	for(int i=0;i<s.size();i++) rt=rt*10+(int)(s[i]-'0');
	return rt;
}
int main(){
	int i,j;
	long long n,m;
	long long ans=0;
	cin>>n>>m;
	if(m==0){
		cout<<(long long)((long long)(n)*(long long)(n))<<endl;
		return 0;
	}
	for(i=m+1;i<=n;i++){
		ans+=(long long)(((long long)(n/i)*(long long)(i-m)));
	}
	for(i=m;i<=n;i++){
		long long t=n%i;
		t=max(t-m+1,0LL);
		ans+=t;
	}
	cout<<ans<<endl;
	return 0;
}



Measured memory_bytes: 256
/***************************************** 
****       Solution by SlavicG        ****
*****************************************/
 
#include <bits/stdc++.h>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm> 
#include <set>
#include <utility>
#include <queue>
#include <map>
#include <assert.h>
#include <stack>
using namespace std;
#define ll long long
#define forn(i,n) for(int i=0;i<n;++i)
#define MX 10000000001
#define pow2(a) ((a)*(a))
#define pb push_back
#define vair <vector<pair<int,int>>
#define vi vector<int>
#define mp make_pair
#define pf push_front
#define all(v) v.begin(), v.end()
#define endl "\n"
#define FAST std::ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define PI   3.14159265
#define _Yes printf("YES\n");
#define _No printf("NO\n");
#define scanline; scanf(" %[^\n]s\n",s);
#define print3(x,y,z); cout << x << " " << y << " " << z << endl;
const ll MOD = 1000000007;
 int longestIncreasingSubsequenceLenghtDP(int a[],int n){
    int dp[n],ans=0;
    for(int k = 0;k<n;k++){
        dp[k] = 1;
        for(int i = 0;i<k;i++){
            if(a[i] <= a[k]){
                dp[k] = max(dp[k],dp[i] + 1);
                ans = max(dp[k],ans);
            }
        }
    }
    return ans;
 }
int result[1000] = {0};
int factDP(int n) {
   if (n >= 0) {
      result[0] = 1;
      for (int i = 1; i <= n; ++i) {
         result[i] = i * result[i - 1];
      }
      return result[n];
   }
}
bool isPrime(ll n){
    if(n<2) return false;
    for(ll x = 2;x*x <=n;x++){
        if(n%x == 0)return false;
    }
    return true;
}
vector<int> primeFactors(int n){
    vector<int> f;
    for(int x = 2;x*x<=n;x++){
        while(n%x==0){
            f.push_back(x);
            n/=x;
        }
    }
    if(n>1)f.push_back(n);
    return f;
}
bool isPerfectSquare(long double x) {   
  long double sr = sqrt(x); 
  return ((sr - floor(sr)) == 0); 
} 
int isSubstring(string s1, string s2) { 
    int M = s1.length(); 
    int N = s2.length(); 
    for (int i = 0; i <= N - M; i++) { 
        int j; 
        for (j = 0; j < M; j++) 
            if (s2[i + j] != s1[j]) 
                break; 
        if (j == M) 
            return true; 
    } 
    return false; 
} 
vector<int> primes;
void SieveOfEratosthenes(int n) { 
    bool prime[n+1]; 
    memset(prime, true, sizeof(prime)); 
    for (int p=2; p*p<=n; p++) {  
        if (prime[p] == true) { 
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    } 
    for (int p=2; p<=n; p++) 
       if (prime[p]) 
          primes.pb(p);
}
bool isSubSequence(string str1,string str2, int m, int n) 
{ 
    if (m == 0) return true; 
    if (n == 0) return false; 
    if (str1[m-1] == str2[n-1]) 
        return isSubSequence(str1, str2, m-1, n-1); 
		
    return isSubSequence(str1, str2, m, n-1); 
}
ll fastExpo(ll a,ll n, ll MOD)
{
	ll ans = 1;
	while(n>=1)
	{
		if(n%2==0)
		{
			n/=2LL;
			a = (a * a) % MOD;
		}else
		{
			--n;
			ans = (ans*a) % MOD;
		}
	}
	return ans;
}
int main()
{
	ll k,x;
	cin >> k >> x;
	if(k * 500LL >= x)
	{
		cout << "Yes\n";
		return 0;
	}
	cout << "No\n";
}

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

int dp[100005][3];
int n;
int abc[100005][3];
int main () {
  cin >> n;

  for(int i = 0; i < n; i++) {
    cin >> abc[i][0] >> abc[i][1] >> abc[i][2];
  }

  dp[0][0] = abc[0][0];
  dp[0][1] = abc[0][1];
  dp[0][2] = abc[0][2];

  for(int i = 1; i < n; i++) {
    for(int j = 0; j < 3; j++) {
      dp[i][j] = abc[i][j] + max(dp[i-1][(j+1) % 3],dp[i-1][(j+2) % 3]);
    }
  }

  cout << max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2])) << endl;
}
  


Measured memory_bytes: 2560
#[macro_use]
mod input {

use std;
use std::io;

const SPLIT_DELIMITER: char = ' ';

#[macro_export]
#[allow(unused_macros)]
macro_rules! input {
    ( $($x:expr ),*) => {
        {
            let temp_str = input_line_str();
            let mut split_result_iter = temp_str.split_whitespace();
                $(
                let buf_split_result = split_result_iter.next();
                let buf_split_result = buf_split_result.unwrap();
                    ($x) = buf_split_result.parse().unwrap();
                )*
        }
    };
}

#[allow(dead_code)]
pub fn input_line_str() -> String {
    let mut s = String::new();
    io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

#[allow(dead_code)]
pub fn p<T>(t: T)
where
    T: std::fmt::Display,
{
    println!("{}", t);
}

#[allow(dead_code)]
pub fn input_vector2d<T>(line: usize) -> Vec<Vec<T>>
where
    T: std::str::FromStr,
{
    let mut v: Vec<Vec<T>> = Vec::new();

    for _ in 0..line {
        let vec_line = input_vector();
        v.push(vec_line);
    }
    v
}

#[allow(dead_code)]
pub fn input_vector<T>() -> Vec<T>
where
    T: std::str::FromStr,
{
    let mut v: Vec<T> = Vec::new();

    let s = input_line_str();
    let split_result = s.split(SPLIT_DELIMITER);
    for z in split_result {
        let buf = match z.parse() {
            Ok(r) => r,
            Err(_) => panic!("Parse Error"),
        };
        v.push(buf);
    }
    v
}

#[allow(dead_code)]
pub fn str2vec(s: &str) -> Vec<char> {
    let mut v: Vec<char> = Vec::new();
    for c in s.chars() {
        v.push(c);
    }
    v
}

}

use input::*;

fn main() {
    let n: usize;
    input!(n);
    let mut a = input_vector::<usize>();
    let b = input_vector::<usize>();
    let mut ans = 0;
    for z in 0..n {
        if a[z] >= b[z] {
            ans += b[z];
        } else {
            ans += a[z];
            if a[z + 1] < b[z] - a[z] {
                ans += a[z + 1];
                a[z + 1] = 0;
            } else {
                a[z + 1] -= b[z] - a[z];
                ans += b[z] - a[z];
            }
        }
    }
    p(ans);
}

Measured memory_bytes: 9972