akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"

/*----------------------------------------------------------------*/

#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define rep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrep(i, a, b) for (ll i = (a); i >= (b); i--)
#define bit(i, a) for (ll i = 0; i < (1LL << (a)); i++)
#define umap unordered_map
#define uset unordered_set
#define to_str to_string

/*----------------------------------------------------------------*/

using namespace std;
using ld = long double;
using vld = vector<ld>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using str = string;
using vstr = vector<str>;
using vb = vector<bool>;
using vvb = vector<vb>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;

/*----------------------------------------------------------------*/

template<class T> bool chmin(T a, T &b) { return a < b ? b = a, true : false; }
template<class T> bool chmax(T a, T &b) { return a > b ? b = a, true : false; }
template<class T> T min(vector<T> a) { return *min_element(all(a)); }
template<class T> T max(vector<T> a) { return *max_element(all(a)); }
template<class T> T sum(vector<T> a) { return accumulate(all(a), (T)0); }

/*----------------------------------------------------------------*/

constexpr ld PI = 3.141592653589793L;

/*----------------------------------------------------------------*/

ll gcd(ll n, ll m) { return m ? gcd(m, n % m) : n; }
ll lcm(ll n, ll m) { return n / gcd(n, m) * m; }
ll ctz(ll n) { ll ans = 0; for (; ~n & 1; n >>= 1) ans++; return ans; }
bool is_prime(ll n) {
    if (n == 1) return false;
    for (ll i = 2; i * i <= n; i++)
        if (n % i == 0) return false;
    return true;
}
ll popcnt(ll n) {
    n = ((n & 0xaaaaaaaaaaaaaaaa) >> 1) + (n & 0x5555555555555555);
    n = ((n & 0xcccccccccccccccc) >> 2) + (n & 0x3333333333333333);
    n = ((n & 0xf0f0f0f0f0f0f0f0) >> 4) + (n & 0x0f0f0f0f0f0f0f0f);
    n = ((n & 0xff00ff00ff00ff00) >> 8) + (n & 0x00ff00ff00ff00ff);
    n = ((n & 0xffff0000ffff0000) >> 16) + (n & 0x0000ffff0000ffff);
    n = ((n & 0xffffffff00000000) >> 32) + (n & 0x00000000ffffffff);
    return n;
}
str zfill(str s, ll n) { return str(n - s.length(), '0') + s; }
bool is_pld(str s) { return s == str(rall(s)); }
ll to_ll(char c) { return (ll)c - '0'; }
ll to_ll(str s) {
    ll ans = 0;
    rep(i, 0, (ll)s.length())
        ans = 10 * ans + to_ll(s[i]);
    return ans;
}

/*----------------------------------------------------------------*/

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

    ll n, a, b;
    cin >> n >> a >> b;
    vll h(n);
    rep(i, 0, n)
        cin >> h[i];

    auto f = [=](ll k) {
        ll tmp = 0;
        rep(i, 0, n) {
            ll rem = h[i] - b * k;
            if (rem > 0)
                tmp += (rem + (a - b) - 1) / (a - b);
        }
        return tmp <= k;
    };

    ll ok = 1e9, ng = 0;
    while (llabs(ok - ng) > 1) {
        ll mid = (ok + ng) / 2;
        if (f(mid)) ok = mid;
        else ng = mid;
    }
    cout << ok << '\n';
}


Measured memory_bytes: 1792
object Main extends App {
    val hands = List("Rock", "Fire", "Scissors", "Snake", "Human", "Tree", "Wolf", "Sponge", "Paper", "Air", "Water", "Dragon", "Devil", "Lightning", "Gun") 
    val h = (hands ::: hands).sliding(8).take(15).map(l => (l.head, l.tail)).toMap
    val in = io.Source.stdin.getLines
    for (n <- in if n != "0") {
        val x = in.take(n.toInt).toList
        x.foldLeft(x)((a, b) => a.filterNot(h(b).contains _)) match {
            case x@(h::_) if x.size != n.toInt => println(h)
            case _ => println("Draw")
        }
    }
}

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

const int nax=3005;
int dp[nax][nax];

#undef int 
int main() {
#define int long long
    int n;
    cin >> n;

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

    for(int L=n-1; L>=0; L--)
    {
        for(int R=L;R<n;R++)
        {
            if(L==R)
            {
                dp[L][R]=a[L];
            }
            else
            {
                dp[L][R]=max(a[L]-dp[L+1][R], a[R]-dp[L][R-1]);
            }
            
        }
    }
    cout << dp[0][n-1] << endl;
}

Measured memory_bytes: 70016
N,M =  map( int ,input().split())
H_list = list(map( int , input().split()))
A_B_list = [[0] * 2  for i in range(M)]
J_list = [0]*N
for i in range(M):
    A,B = map( int ,input().split())
    A_B_list[i][0] = A
    A_B_list[i][1] = B
for j in range(M):
    if H_list[A_B_list[j][0]-1] > H_list[A_B_list[j][1]-1]:
        J_list[A_B_list[j][1]-1] =-1
    elif H_list[A_B_list[j][0]-1] < H_list[A_B_list[j][1]-1]:
        J_list[A_B_list[j][0]-1] =-1
    else:
        J_list[A_B_list[j][0]-1] =-1
        J_list[A_B_list[j][1]-1] =-1
print(J_list.count(0))
        

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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    string S;
    cin >> S;
    if (S == "ABC") {
        cout << "ARC\n";
    } else {
        cout << "ABC\n";
    } 
    return 0;
}

Measured memory_bytes: 3648
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Darshan
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            long a, b;
            a = in.nextLong();
            b = in.nextLong();
            long tric = b - a;
            tric -= 1;
            tric = (tric * (tric + 1)) / 2;
            tric -= a;
            out.print(tric);

        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1)
                throw new InputMismatchException();

            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }

                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public long nextLong() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;

            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}



Measured memory_bytes: 23124
#include <vector>
#include <string>
#include <algorithm>
#include <iostream>
#include <cstring>
#include <sstream>
#include <map>
using namespace std;

int main()
{
	string s;
	cin >> s;
	if (s <= "2019/04/30")cout << "Heisei";
	else cout << "TBD";
}

Measured memory_bytes: 764
#include <iostream>
#include <string>

using namespace std;

int main() {
  string n;
  cin >> n;
  for(int i = 0; i < n.size(); i++) {
    if(n[i] == '1') {
      n[i] = '9';
    }else if(n[i] == '9') {
      n[i] = '1';
    }
  }
  cout << n;
}

Measured memory_bytes: 256
def is_integer(n):
	try:
		float(n)
	except ValueError:
		return False
	else:
		return float(n).is_integer()

a,b = map(int, input().split())
evenNum = (int(a) + int(b)) / 2

if(is_integer(evenNum)):
	print(int(evenNum))
else:
	print("IMPOSSIBLE")

Measured memory_bytes: 3060
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<map>
#include<iomanip>
#define int long long
#define ll getchar();getchar();return 0;
using namespace std;
bool prime(int n) {
	int cnt = 0;
	for (int i = 1; i <= sqrt(n); i++) {
		if (n%i == 0)cnt++;
	}
	if (cnt != 1)return false;
	else return n != 1;
}
int gcd(int x,int y) {
	int ans;
	for (int i = (min(x, y)); i >= 1; i--) {
		if (x%i == 0 && y%i == 0) {
			ans = i;
			break;
		}
	}
		return ans;
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
signed main() {
	int ans = 0;
	string s;
	cin >> s;
	for (int i = 0; i < s.size(); i++) {
		if (i < s.size() - 1) {
			if (s[i] != s[i + 1])ans++;
		}
	}
	cout << ans << endl;
	ll
}

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

int MAXSOFAR = -1;


int main(){
    int N;
    cin>>N;
    if(N&1)cout<<"No";
    else{
        string s;
        cin>>s;
        int f=1;
        for(int i=0;i<N/2;++i){
            if(s[i]!=s[i+N/2]){
                cout<<"No";f=0;break;
            }
        }
        if(f==1)cout<<"Yes";
    }
    return 0;
}


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

int main()
{
    long long N;
    cin >> N;
    vector<pair<long long,long long>> A(N);
    for(long long i = 0; i < N; i++)
    {
        long long a;
        cin >> a;
        A[i] = make_pair(a,i);
    }
    sort(A.begin(),A.end());
    for(long long i = 0; i < N; i++)
    {
        cout << A[i].second + 1 << " ";
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 2432
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N,U,V = map(int,readline().split())
m = map(int,read().split())
AB = zip(m,m)

graph = [[] for _ in range(N+1)]
for a,b in AB:
    graph[a].append(b)
    graph[b].append(a)

def dfs(v):
    dist = [-1] * (N+1)
    stack = [v]
    dist[v] = 0
    while stack:
        v = stack.pop()
        dw = dist[v] + 1
        for w in graph[v]:
            if dist[w] >= 0:
                continue
            dist[w] = dw
            stack.append(w)
    return dist

DU,DV = dfs(U),dfs(V)

answer = 0
for u,v in zip(DU[1:],DV[1:]):
    if u < v:
        x = v - 1
        if answer < x:
            answer = x

print(answer)

Measured memory_bytes: 30840
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        try (Scanner sc = new Scanner(System.in)) {
            while (sc.hasNext()) {
                int n = Integer.parseInt(sc.nextLine());
                String[] x_strs = sc.nextLine().split(" ");
                ArrayList<Integer> xs = new ArrayList<Integer>();
                for(int i = 0; i < n; i++){
                    xs.add( Integer.parseInt(x_strs[i]) ); 
                }
                Collections.sort(xs);
                int last = xs.get(n - 1);
                //最もlast/2に近いもの探索
                int nearest_index = 0;
                double nearest_diff = last;
                for(int i = 0; i < n; i++){
                    if(last/2.0 - xs.get(i) < nearest_diff && xs.get(i) - last/2.0 < nearest_diff){
                        nearest_diff = last/2.0 - xs.get(i);
                        nearest_index = i;
                    }
                }
                System.out.println(last + " " + xs.get(nearest_index));
            }
        }
    }
}

Measured memory_bytes: 49836
n, d = map(int,input().split())

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

cnt = 0

for i in range(n):
    for j in range(n):
        if i <= j:
            continue
        s = 0
        for k in range(d):
            s += (abs(li[i][k] - li[j][k]) ** 2)
        else:
            s = str(s**0.5)
            if s[-1] == "0" and s[-2] == ".":
                cnt += 1
        
print(cnt)

Measured memory_bytes: 3188
def d_Built(N, P):
    xs = []
    ys = []
    E = []  # 辺の情報を格納
    for i, (x, y) in enumerate(P):
        xs.append((x, i))
        ys.append((y, i))
    xs.sort()
    ys.sort()

    # 頂点をつなぐ辺の候補を得る
    x_edge = []
    y_edge = []
    for i in range(N - 1):
        # x座標、y座標でソートしたもので隣り合った2点を結ぶ
        x_edge.append((xs[i][1], xs[i + 1][1], xs[i + 1][0] - xs[i][0]))
        y_edge.append((ys[i][1], ys[i + 1][1], ys[i + 1][0] - ys[i][0]))
    x_edge.extend(y_edge)  # 頂点a,頂点b,それを結ぶ辺のコスト
    x_edge.sort(key=lambda x: x[2])  # コストの小さいものから並べる(クラスカル法のため)

    class UnionFind:
        def __init__(self, N):
            self.p = list(range(N))  # 初期状態ではi番の頂点の根(parent)はi番である
            self.rank = [0] * N  # 初期状態ではどの頂点もランクが0とする(何もつながってない)
            self.size = [1] * N  # 初期状態ではどの頂点も連結成分の大きさは1

        def find(self, x):
            # 頂点xが属する連結成分の代表(根の番号)を求める
            if self.p[x] != x:
                # 頂点xの根は他の頂点だった
                self.p[x] = self.find(self.p[x])  # 経路圧縮
            return self.p[x]

        def is_same(self, x, y):
            # 頂点x,yは同じ連結成分に属するか？
            return self.find(x) == self.find(y)

        def union(self, x, y):
            # x,yを同じ連結成分に属させる
            u = self.find(x)
            v = self.find(y)
            if u == v:
                # 同じ連結成分に既に属していた
                return
            if self.rank[u] < self.rank[v]:
                self.p[u] = v  # ランクの大きな方につなげる
                self.size[v] += self.size[u]  # つながっている要素数だけ足す
                self.size[u] = 0  # ランクが小さかった連結成分は「解散」
            else:
                # 上と同様にやる
                self.p[v] = u
                self.size[u] += self.size[v]
                self.size[v] = 0
                if self.rank[u] == self.rank[v]:
                    # 根の分だけ1個「ずれる」
                    self.rank[u] += 1

        def get_size(self, x):
            # 頂点xが属する連結成分の大きさ
            return self.size[self.find(x)]

        def show(self):
            return self.p

    uf = UnionFind(N)
    # クラスカル法を使う
    i = 0
    while len(E) != N - 1:
        x1, x2, cost = x_edge[i]
        if uf.find(x1) != uf.find(x2):
            # x1,x2が同じ木に属していた場合、注目している辺を追加するとループを作ってしまう
            uf.union(x1, x2)
            E.append(cost)
        i += 1
    return sum(E)
  
N = int(input())
P = [[int(i) for i in input().split()] for j in range(N)]
print(d_Built(N, P))

Measured memory_bytes: 68352
// #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 main() {
    int N; cin >> N;
    vector<int> A(N);
    for(int i=0; i<N; i++) cin >> A[i];

    vector<int> dp(N+1, -1);
    dp[0] = 0;
    for(int i=0; i<N; i++) {
        dp[i+1] = dp[i];
        if(A[i] == dp[i] + 1) dp[i+1] = dp[i] + 1;
    }

    if(N - dp[N] == N) cout << -1 << endl;
    else cout << N - dp[N] << endl;
    return 0;
}


Measured memory_bytes: 1792
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,ceil,sqrt,factorial,hypot,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    N=I()
    if N&1:
        print(0)
        return
    ans = 0
    for ex in range(1,26):
        ans += (N//(5**ex))//2
    print(ans)
if __name__ == '__main__':
    main()

Measured memory_bytes: 38256
{-# LANGUAGE TypeApplications #-}

import           Control.Monad
import           Control.Applicative
import           Data.List
import           Data.Char
import           Control.Arrow
import           Data.Bits

main = do
  getLine
  a <- sort . map (read @Integer) . words <$> getLine
  print
    $ case
        foldM (((\x -> if x > 10 ^ 18 then Nothing else Just x) .) . (*)) 1 a
      of
        Nothing -> -1
        Just x  -> x


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

//define-----------------------------------------------------------------------------------------------------------------------
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define FOR(i, s, n) for(int i = s; i < (int)n; i++)
#define per(i, n) for(int i = n; i >= 0; i--)
#define ROF(i, s, n) for(int i = s; i >= (int)n; i--)
#define FORIT(i, A) for (auto i : A)
#define PRINT(x) cout << (x) << "\n"
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define EACH(i, n) for (__typeof((n).begin()) i = (n).begin(); i != (n).end(); ++i)
#define SZ(a) int((a).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define CLR(a) memset((a), 0 ,sizeof(a))
#define dump(x) cout << #x << " = " << (x) << "\n";
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << "\n";
#define sq(n) (n) * (n)

//typedef----------------------------------------------------------------------------------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef priority_queue<int> maxpq;
typedef priority_queue< int, vector<int>, greater<int> > minpq;
//const------------------------------------------------------------------------------------------------------------------------
static const double EPS = 1e-10;
static const double PI = acos( -1.0 );
static const int mod = 1000000007;
static const int INF = 1 << 25;

//global-----------------------------------------------------------------------------------------------------------------------
LL a = INF, b = -INF, c, n, ans = 0;

//function--------------------------------------------------------------------------------------------------------------------
int main() {
	scanf( "%lld", &n );
	rep( i, n ) {
		scanf( "%lld", &c );
		a = min( a, c );
		b = max( b, c );
		ans += c;
	}
	printf( "%lld %lld %lld\n", a, b, ans );
	return 0;
}

Measured memory_bytes: 1188
import java.io.*;
import java.util.*;
public class Main{
    private static void solver(InputReader sc, PrintWriter out) throws Exception {
          long a = sc.nextLong();
           long b = sc.nextLong();
          long n = sc.nextLong();
          long x = Math.min(b - 1, n);
          long val = a * x/ b;
          out.println(val);
    }
    private static int gcd(int a, int b){
        if(b==0)
            return a;
        return gcd(b, a%b);
    }
    public static void main(String[] args) throws Exception {
        // long start =  System.nanoTime();
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        solver(in,out);
        out.close();


    }
    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }
        public long nextLong() {
            return Long.parseLong(next());
        }
        public int[] readIntArray(int n){
            int arr[] = new int[n];
            for(int i=0;i<n;i++) arr[i] = nextInt();
            return arr;
        }
    }
}
class Pair{
    int x;
    int y;
    Pair(int x, int y) {
        this.x = x;
        this.y = y;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Pair pair = (Pair) o;
        return x == pair.x &&
                y == pair.y;
    }

    @Override
    public int hashCode() {
        return Objects.hash(x, y);
    }
}


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

using ll = long long;
using P = pair<int, int>;
using PP = pair<int, P>;
#define rep1(i,n) for (int i=1; i<=(n); i++)
#define rep0(i,n) for (int i=0; i<(n); i++)
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; }
#ifdef _DEBUG
string _format(string args) { string r = "", t; istringstream s(args); while (getline(s, t, ',')) r += t+":%d "; return r + "\n"; }
#define debug(...) do{printf(_format(#__VA_ARGS__).c_str(), __VA_ARGS__);}while(0)
#define FAST_IOSTREAM() do{}while(0);
#else
#define debug(...) do{}while(0)
#define FAST_IOSTREAM() do{std::ios::sync_with_stdio(false); std::cin.tie(nullptr);}while(0)
#endif

int main() {
    FAST_IOSTREAM();

    int n, m;
    cin >> n >> m;
    int a[n];
    int sum = 0;
    rep0(i,n) {
        cin >> a[i];
        sum += a[i];
    }
    int selected = 0;
    rep0(i,n) {
        if (a[i]*m*4 >= sum) selected++;
    }
 
    cout << (selected >= m ? "Yes" : "No") << endl;
}


Measured memory_bytes: 3632
n,m,x,y=map(int, input().split())

n=list(map(int, input().split()))
m=list(map(int, input().split()))
n.append(x)
m.append(y)
n=sorted(n)
m=sorted(m)

if n[len(n)-1] < m[0]:
  print('No War')
else:
  print('War')

Measured memory_bytes: 3064
#include <stdlib.h>
#define N 100009
i,n,m,P[N],X[N],co[N]={0};
#define r for(i=0;i<m;i++)
typedef struct data{int n,p,y;}ID;ID id[N];
up(const void*a,const void*b) {return((ID*)a)->y-((ID*)b)->y;}
main(){
scanf("%d%d",&n,&m);
r{id[i].n=i;scanf("%d%d",&id[i].p,&id[i].y);P[i]=id[i].p;}
qsort(id,m,sizeof(ID),up);
r X[id[i].n]=++co[id[i].p];
r printf("%06d%06d\n",P[i],X[i]);
}

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

using namespace std;
#define taskname "A"
#define pb  push_back
#define mp  make_pair
#ifndef LOCAL
#define cerr if(0)cout
#endif

typedef long double ld;
typedef long long ll;
typedef pair<int,int> ii;
const int maxn = 705;
const int maxm = 1e4 + 5;

int n , m ,  have[maxn][maxn];
bitset<maxn> dp;
int vis[maxn];

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    if(fopen(taskname".INP","r")){
        freopen(taskname".INP", "r",stdin);
        freopen(taskname".OUT", "w",stdout);
    }
    cin >> n >> m;
    for(int i = 1 ; i <= m ; ++i){
        int u , v;cin >> u >> v;
        have[u][v] = have[v][u] = 1;
    }
    dp[0] = 1;
    for(int i = 1 ; i <= n ; ++i){
        if(vis[i] != 0)continue;
        int cnt[2] = {0,0};
        function<void(int,int)> DFS = [&](int u , int col){
            vis[u] = col;
//            cout << u << " " << col << endl;
            if(col < 0)cnt[0]++;
            else cnt[1]++;
            for(int c = 1 ; c <= n ; ++c)if(!have[u][c] && u != c){
                if(vis[c] == 0)DFS(c , -col);
                else if(vis[c] == col){
                    cout << -1;
                    exit(0);
                }
            }
        };
        DFS(i , 1);
        dp = (dp << cnt[0]) | (dp << cnt[1]);
    }
    for(int i = n / 2 ; ;--i){
        if(dp[i]){
            return cout << i * (i - 1) / 2 + (n - i) * (n - i - 1) / 2 , 0;
        }
    }
}


Measured memory_bytes: 2176
X,K,D = map(int,input().split())
X = abs(X)
least = X // D

if least>=K:
    ans = X - K*D
elif (K-least)%2==0:
    ans = X - least*D
elif (K-least)%2==1:
    ans = -1*(X-(least+1)*D)

print(ans)

Measured memory_bytes: 61700
n = int(input())
s = [input() for _ in range(n)]

ab, a, b, b_a = 0, 0, 0, 0
for i in s:
  ab += i.count('AB')
  if i[-1] == 'A':
    a += 1
  if i[0] == 'B':
    b += 1
  if i[0] == 'B' and i[-1] == 'A':
    b_a +=1

a -= b_a
b -= b_a
if a == 0 and b == 0:
  print(ab + max(b_a-1, 0))
else:
  print(ab + min(a, b) + b_a)

Measured memory_bytes: 9644
#include<cstdio>
#include<algorithm>
#include<map>
using namespace std;
#define MAXN 200010
int Adj[MAXN],V[MAXN],nxt[MAXN],c;
void AddEdge(int u,int v)
{
	c++;V[c]=v,nxt[c]=Adj[u];Adj[u]=c;
}
int a[MAXN],b[MAXN],n,cnt,in[MAXN],out[MAXN],x,ans,pcnt;
map<int,int>G;
int vis[MAXN];
void dfs(int u)
{
	vis[u]=1;
	for(int i=Adj[u];i;i=nxt[i])
		if(!vis[V[i]])
			dfs(V[i]);
}
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
		x^=a[i];
		if(G[a[i]]==0) G[a[i]]=++cnt;
		a[i]=G[a[i]];
	}
	if(G[x]==0) G[x]=++cnt;
	x=G[x];
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&b[i]);
		if(G[b[i]]==0) G[b[i]]=++cnt;
		b[i]=G[b[i]];
	}
	for(int i=1;i<=n;i++)
	{
		if(a[i]==b[i]) continue;
		AddEdge(b[i],a[i]);
		in[a[i]]++,out[b[i]]++;
		ans++;
	}
	for(int i=1;i<=cnt;i++)
		if(in[i]!=out[i])
		{
			if(in[i]<out[i])
			{
				if(out[i]!=in[i]+1||i!=x)
				{
					printf("-1\n");
					return 0;
				}
			}
			else
			{
				if(in[i]!=out[i]+1||pcnt)
				{
					printf("-1\n");
					return 0;
				}
				pcnt++;
			}
		}
	dfs(x);
	for(int i=1;i<=cnt;i++)
		if(out[i]&&!vis[i])
		{
			dfs(i);
			ans++;
		}
	printf("%d\n",ans);
}

Measured memory_bytes: 11776
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;
ll const INF = 1LL << 60;

int main() {
  ll N;
  cin >> N;
  vector<double> v(N);
  for (int i = 0; i < N; i++) {
    cin >> v[i];
  }
  sort(v.begin(), v.end());
  long double prev = v[0];
  for (int i = 1; i < N; i++) {
    prev = (prev + v[i]) / 2;
  }
  cout << fixed << setprecision(10) << prev << endl;
  return 0;
}

Measured memory_bytes: 3828
macro_rules! get {
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
                    get!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
                    get!($($t),*)
        ).collect::<Vec<_>>()
    };
    ($t:ty |) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
    ($t:ty | $n:expr) => {
        (0..$n).map(|_| get!($t |)).collect::<Vec<_>>()
    };
}
macro_rules! tern {
    ($condition: expr, $_true: expr, $_false: expr) => {
        if $condition {
            $_true
        } else {
            $_false
        }
    };
}

fn main() {
    let N = get!(usize);
    let As = get!(isize | );
    let Bs = get!(isize | );

    let mut sum = tern!(Bs[0] < As[0], Bs[0], As[0]);
    let mut prev_b = Bs[0] - sum;
    for n in (2..(N+1)) {
        let cur_b = Bs[n-1];
        let mut cur_a = As[n-1];
        cur_a -= prev_b;
        if cur_a <= 0 {
            prev_b = Bs[n-1];
            sum += As[n-1];
            continue;
        }
        sum += tern!(Bs[n-1] < cur_a, Bs[n-1] + prev_b, As[n-1]);
        prev_b = tern!(Bs[n-1] > cur_a, Bs[n-1] - cur_a, 0);
    }
    sum += tern!(prev_b > As[N], As[N], prev_b);
    println!("{}", sum);
}


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

typedef long long ll;
typedef vector<ll> vint;
typedef vector< vector<ll> > vvint;

#define rep(i,n) for(ll i=0;i<n;i++)
#define repf(i,f,n) for(ll i=f;i<n;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define mp make_pair
#define mt make_tuple
#define ALL(obj) (obj).begin(), (obj).end()
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; }

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


int main() {
    cout<<fixed<<setprecision(10);

    ll n; cin>>n;
    vint x(n),y(n); rep(i,n) cin>>x[i]>>y[i];

    vint a(n),b(n);
    rep(i,n){
        a[i] = x[i] - y[i];
        b[i] = x[i] + y[i];
    }

    ll ans = max(*max_element(ALL(a)) - *min_element(ALL(a)), *max_element(ALL(b)) - *min_element(ALL(b)));
    cout<<ans<<endl;

    return 0;

}

Measured memory_bytes: 9592
import java.util.Scanner;

public class Main {
	final static char[] r = "yuiophjklnm".toCharArray();

	public static void main(String[] arg) {
		Scanner in = new Scanner(System.in);
		while (in.hasNext()) {
			char[] moji = in.next().toCharArray();
			if (moji[0] == '#') {
				break;
			}
			boolean preHand = isR(moji[0]);
			int count = 0;
			for (int i = 1; i < moji.length; i++) {
				boolean hand = isR(moji[i]);
				if (preHand != hand) {
					preHand = hand;
					count++;
				}
			}
			System.out.println(count);
		}
		in.close();
	}

	static boolean isR(char c) {
		for (char rc : r) {
			if (c == rc)
				return true;
		}
		return false;
	}
}

Measured memory_bytes: 20548
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

    public static void main(String[] args) {
        try {
            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
            String inData;
            while ((inData = br.readLine()) != null) {
                String[] abcdefList = inData.split(" ");
                double[] in = new double[6];
                for (int i = 0; i < 6; i++) {
                    in[i] = Double.parseDouble(abcdefList[i]);
                }
                double deno = (in[1] * in[3] - in[0] * in[4]);
                double x = (in[1] * in[5] - in[2] * in[4]) / deno;
                double y = (in[0] * in[5] - in[2] * in[3]) / (deno * -1);
                x = (x == -0.0) ? 0.0 : x;
                y = (y == -0.0) ? 0.0 : y;
                System.out.printf("%4.3f %4.3f\n", x, y);
            }
        } catch (Exception e) {
            System.exit(0);
        }
    }
}

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

constexpr ll INF = ll(1e+18) + 1;

ll dist(ll a, ll b, ll c, ll d) {
    return abs(a-c) + abs(b-d);
}

int main() {
    int L, R;
    int ans = 0;
    int d;

    cin >> L >> R >> d;

    for (int i = L; i <= R; i++) {
        if (i%d == 0) {ans++;}
    }

    cout << ans <<endl;
}


Measured memory_bytes: 3528
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>

#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define repi(i,a,b) for(int i = (a); i < (b); i++)

using namespace std;

typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;

const int INF=1<<29;
const double EPS=1e-9;

const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};
vector<int> G[120];
int V,E;
int visit[120];//0ならまだ辿ってない1なら辿ってる途中２なら既に辿った
bool flag =false;
bool dfs_visit(int);
void find_cycle(){
	memset(visit, 0, sizeof(visit));
	for(int i =0;i <V;i++){
		if(!visit[i]){
			dfs_visit(i);
		}
	}
	return;
}
//閉路発見ならtrue
bool dfs_visit(int s){
	visit[s]=1;
	for(int i = 0;i <G[s].size();i++){
		if(!visit[G[s][i]]){
			dfs_visit(G[s][i]);
		}else if(visit[G[s][i]]==1){
			return flag =true;
		}
	}
	visit[s]=2;
	return false;
}


int main(){
	cin>>V>>E;
	for(int i =0;i <E;i++){
		int s,t;
		cin>>s>>t;
		G[s].push_back(t);
	}
	find_cycle();
	cout <<flag<<endl;
	return 0;
}

Measured memory_bytes: 1224
#include <sstream>
#include <iostream>

using namespace std;

int main() {

	int a, b, x, y;

	while (!cin.eof()) {

		cin >> a >> b;

		if (a == 0 & b == 0) {
			break;
		}

        if (a > b) {
            x = b;
            y = a;
        } else {
            x = a;
            y = b;
        }

		cout << x << " " << y << "\n";

	}

	return 0;
}


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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	int64_t a,b,x;
	cin>>a>>b>>x;
	if(a%x==0)cout<<b/x-a/x+1<<"\n"s;
	else cout<<b/x-a/x<<"\n"s;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fin ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ii pair<int,int>
#define F first
#define S second
#define pb push_back
#define pf push_front
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define fore(i,a,b) for(int i = a;i < b; i+= 1)
#define forr(i,a) for(int i = a; i >= 0; i--)
#define fori(i,m) for(auto i = m.begin(); i != m.end(); i++) 
#define w(t) while(t--)
#define sz(s) int(s.size())
#define cls(a,car) memset(a,car,sizeof (a))
#define what_is(x) cerr << #x << " is " << x << endl;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ii> vii;
const int N = 1 * 1e5 + 5;
const ll mod = 1e9 + 7;
const int INF = INT_MAX;
const ll INFCAD  = ll(INT_MAX) * 2 + 1;
const double E = 1e-9;
// fflush(stdout)
// cout << flush
// a + b = a ^ b + 2 * (a & b)
int main(){
    //freopen("in","r",stdin);
    //freopen("out","w",stdout);
    fin;
    int  s, w;
    cin >> s >> w;
    cout << (w >= s?"unsafe" : "safe") << '\n';
    //cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
    return 0;
}   

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

#define rep(i,s,n) for (int i = (int)s; i < (int)n; i++)
#define ll long long
#define pb push_back
#define eb emplace_back
#define All(x) x.begin(), x.end()
#define Range(x, i, j) x.begin() + i, x.begin() + j
#define lbidx(x, y) lower_bound(x.begin(), x.end(), y) - x.begin()
#define ubidx(x, y) upper_bound(x.begin(), x.end(), y) - x.begin()
#define llbidx(x, y, z) lower_bound(x.begin(), x.end(), z) - lower_bound(x.begin(), x.end(), y) // 二要素間の距離
#define deg2rad(deg) ((((double)deg)/((double)360)*2*M_PI))
#define rad2deg(rad) ((((double)rad)/(double)2/M_PI)*(double)360)
#define Find(set, element) set.find(element) != set.end()
#define Decimal(x) printf("%.10f\n", x) // 小数点を10桁まで表示
// debug用
#define PrintVec(x) for (auto elementPrintVec: x) { cout << elementPrintVec << " "; } cout << endl;

typedef pair<int, int> PI;
typedef pair<ll, ll> PLL;

int POWINT(int x, int n) {
  int ret = 1;
  rep(i, 0, n) ret *= x;
  return ret;
};

ll POWLL(int x, int n) {
  ll ret = 1;
  rep(i, 0, n) ret *= x;
  return ret;
};

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;
};

static const int INF = 1e9+7;

struct state {
  int s, ship;
};

int main() {
  int N, M;
  while (cin >> N >> M, N+M) {
    vector<vector<int>> l_g(N, vector<int> (N, INF));
    vector<vector<int>> s_g(N, vector<int> (N, INF));

    vector<vector<int>> l_dist(N, vector<int> (N, INF));
    vector<vector<int>> s_dist(N, vector<int> (N, INF));
    rep(i, 0, N) {
      l_dist[i][i] = s_dist[i][i] = 0;
    }


    int x, y, t;
    char sl;
    rep(i, 0, M) {
      cin >> x >> y >> t >> sl;
      x--;
      y--;
      if (sl == 'L') {
        l_g[x][y] = min(l_g[x][y], t);
        l_g[y][x] = min(l_g[y][x], t);
        l_dist[x][y] = min(l_dist[x][y], t);
        l_dist[y][x] = min(l_dist[y][x], t);
      } else {
        s_g[x][y] = min(s_g[x][y], t);
        s_g[y][x] = min(s_g[y][x], t);
        s_dist[x][y] = min(s_dist[x][y], t);
        s_dist[y][x] = min(s_dist[y][x], t);
      }
    }

    rep(k, 0, N) {
      rep(i, 0, N) {
        rep(j, 0, N) {
          l_dist[i][j] = min(l_dist[i][j], l_dist[i][k] + l_dist[k][j]);
          s_dist[i][j] = min(s_dist[i][j], s_dist[i][k] + s_dist[k][j]);
        }
      }
    }

    int r;
    cin >> r;
    vector<int> z(r);
    rep(i, 0, r) {
      cin >> z[i];
      z[i]--;
    }

    vector<int> dp(N, INF);
    dp[z[0]] = 0;

    rep(i, 1, r) {
      vector<int> next(N, INF);
      rep (from, 0, N) { // ship from
        if (dp[from] == INF) continue;
        next[from] = min(next[from], dp[from] + l_dist[z[i - 1]][z[i]]); // not use ship
        rep (to , 0, N) { // ship to
          next[to] = min(next[to], dp[from] + l_dist[z[i - 1]][from] + s_dist[from][to] + l_dist[to][z[i]]);
        }
      }
      dp = next;
    }


    cout << *min_element(begin(dp), end(dp)) << endl;
  }

  return 0;
};



Measured memory_bytes: 3648
#include <iostream>
#include <climits>
#include <stack>
#include <queue>
#include <string>
#include <random>
#include <utility>
#include <cmath>
#include <string.h>
#include <iomanip>
#include <stdlib.h>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
long long int INF = 1e18;
double Pi = 3.141592653589;
const int mod = 1000000007;
// memset(a,0,sizeof(a)); →全部０にする
 
struct edge{int to,cost;};
vector<int> G[100005];
 
long long int n,m,i,j=1,t;
int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,-1,1,};
 
std::vector<P> tree[100010];
long long int dp[100005];
bool used[100005];
char s[100005];





int main(){
	cin>>s;
	m=0;
	n=strlen(s);
	if(s[0]==s[n-1])m++;
	if(n%2==0)m++;
	if(m%2==0)cout<<"First";
	else cout<<"Second";
	cout<<endl;
	return 0;
}

Measured memory_bytes: 4992
def merge(A, left, mid, right):
    count = 0
    L = A[left:mid]
    R = A[mid:right]
    L.append(1000000001)
    R.append(1000000001)
    i, j = 0, 0
    for k in range(left, right):
        count += 1
        if L[i] <= R[j]:
            A[k] = L[i]
            i += 1
        else:
            A[k] = R[j]
            j += 1
    return count


def mergesort(A, left, right):
    if left + 1 < right:
        mid = (left + right) // 2
        countL = mergesort(A, left, mid)
        countR = mergesort(A, mid, right)
        return merge(A, left, mid, right) + countL + countR
    return 0


def main():
    n = int(input())
    s = list(map(int, input().split()))
    count = mergesort(s, 0, n)
    print(*s)
    print(count)


if __name__ == '__main__':
    main()



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

using namespace std;

int main() {
    string O, E;
    cin >> O >> E;
    string pass;

    for(int i = 0; i < E.size(); i++){
        pass += O.at(i);
        pass += E.at(i);
    }
    if(O.size() > E.size()){
        pass += O.back();
    }

    cout << pass << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cstring>
#include <algorithm>
using namespace std;
void dfs(bool vis[], int node, vector<int> adj[], int dp[]){
    vis[node]=true;
    for (int i=0;i<adj[node].size();i++){
        if (!vis[adj[node][i]]){
            dfs(vis,adj[node][i],adj,dp);
        }
        dp[node]=max(dp[node],1+dp[adj[node][i]]);
    }
}
void addEdge(vector <int> adj[],int u,int v){
    adj[u].push_back(v);
}
int longestPath(vector <int> adj[],int n){
    int dp[n+1];
    memset(dp,0,sizeof(dp));
    bool vis[n+1];
    memset(vis,false,sizeof(vis));
    for (int i=1;i<n+1;i++){
        if (!vis[i]){
            dfs(vis,i,adj,dp);
        }
    }
    int m=0;
    for (int i=1;i<n+1;i++){
        m=max(m,dp[i]);
    }
    return m;
}
int main(){
    int n,m;
    cin>>n>>m;
    vector <int> adj[n+1];
    for (int i=0;i<m;i++){
        int u,v;
        cin>>u>>v;
        addEdge(adj, u, v);
    }
    cout<<longestPath(adj,n)<<endl;
}


Measured memory_bytes: 9600
#include<iostream>
#include<stdlib.h>
#include<vector>
#include<algorithm>
#include<stdio.h>
#include<string>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<limits.h>
#include<cmath>
#define rep(i,n) for(ll i = 0; i < (ll)n; i++)
#define swap(a,b) a^=b;b^=a;a^=b;
#define chmax(a,b) {if(a < b) a = b;}
#define chmin(a,b) {if(a > b) a = b;}
using namespace std;
typedef long long ll;
ll gcd(ll, ll);
vector<bool> to_binary(int);
int sum(vector<int>);
int min(vector<int>);
int max(vector<int>);
ll nCr(ll n, ll r);

const ll INF = 1LL << 60;

typedef tuple<ll, ll> mtupl;

bool mycomp(mtupl x, mtupl y) {
	return get<1>(x) < get<1>(y);
}

vector<vector<ll>> memo;

ll get(int x, int y) {
	if (memo[x][y] != -1)
		return memo[x][y];

	if (x == 0) return 1;
	if (y < x) return 0;

	memo[x][y] = get(x, y - 1) + get(x - 1, y - 1);
	return memo[x][y];
}

ll mpow(ll a, ll b) {
	ll ans = 1;
	for (ll i = 0; i < b; i++) {
		ans *= a;
		ans %= 1000000007;
	}
	return ans;
}

ll nCr(ll n, ll r) {
	ll res = 1;
	for (int i = 0; i < r; i++) {
		res *= (n - i);
	}
	for (int i = 1; i <= r; i++) {
		res /= i;
	}
	return res;
}

int vsum(vector<int> v) {
	int res = 0;
	for (auto it = v.begin(); it != v.end(); it++)
		res += *it;
	return res;
}
int vmin(vector<int> v) {
	int min = INT32_MAX;
	for (auto it = v.begin(); it != v.end(); it++)
		min = std::min(min, *it);
	return min;
}
int vmax(vector<int> v) {
	int max = INT32_MIN;
	for (auto it = v.begin(); it != v.end(); it++)
		max = std::max(max, *it);
	return max;
}

ll gcd(ll A, ll B) {
	if (A == 0 || B == 0) return max(A, B);
	int r = A % B;
	while (r != 0) {
		A = B;
		B = r;
		r = A % B;
	}

	return B;
}

vector<bool> to_binary(int x) {
	vector<bool> res;
	while (x != 0) {
		res.push_back(x % 2);
		x /= 2;
	}
	return res;
}

template<int index>
bool comp(tuple<ll, ll, ll, ll> a, tuple<ll, ll, ll, ll> b) {
	return get<index>(a) < get<index>(b);
}

int vector_finder(std::vector<ll> vec, ll number) {
	auto itr = std::find(vec.begin(), vec.end(), number);
	size_t index = std::distance(vec.begin(), itr);
	if (index != vec.size()) { // 発見できたとき
		return index;
	}
	else { // 発見できなかったとき
		return 0;
	}
}


int len(int x) {
	return (int)log10(x) + 1;
}


int main(void) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	//Program Start	

	int A, B, C;
	cin >> A >> B >> C;

	cout << max(0,(C - (A - B))) << endl;


ProgramEndPointLabel:;

	//Program End
	system("pause");

	return 0;
}
/*

*/




Measured memory_bytes: 504
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#define  boost ios_base::sync_with_stdio(false);cin.tie(NULL);
#define ull unsigned long long
#define deb(x) cout<<#x<<" "<<x<<endl;
#define deb2(x,y) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<endl;
#define deb2l(x,y,i) cout<<#x<<i<<" "<<x<<" "<<#y<<i<<" "<<y<<endl;

#define fr(i,l,r) for(ll i=l;i<r;i++)
#define mems(a,x) memset(a,x,sizeof(a))
#define mod 1000000007
#define ff first
#define ss second
#define pb(x) push_back(x)
#define vll vector<ll>
#define pbp(x,y) push_back(make_pair(x,y))
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

void solve(){

string str1,str2;
cin>>str1>>str2;
cout<<str2<<str1;
//cout<<ans;

}

int main(){
    ll t=1;
//cin>>t;
    while(t--){
     solve();
     cout<<endl;
    }
    return 0;
}


Measured memory_bytes: 256