akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/integer/common_factor.hpp>
#include <boost/integer/common_factor_rt.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>

using std::string;
using std::vector;
using std::set;
using std::multiset;
using std::unordered_set;
using std::map;
using std::multimap;
using std::unordered_map;
using std::pair;
using std::cin;
using std::cout;

typedef uintmax_t    ull;
typedef intmax_t     ll;
typedef uint64_t     ul;
typedef uint32_t     ui;
typedef uint8_t      uc;

typedef boost::multiprecision::number<boost::multiprecision::cpp_dec_float<1000>> cpp_dec_float_1000;

constexpr char CRLF  = '\n';
constexpr char SPACE = ' ';
constexpr char VECTOR_COUT_SEPARATOR = SPACE;
constexpr ll INF = 1000'000'007;

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; }
template<class T> std::ostream& operator<< (std::ostream& os, const std::vector<T>& vc) { for(auto it = vc.begin(); it != vc.end(); ++it) { if (std::next(it) == vc.end()) os << *it; else os << *it << VECTOR_COUT_SEPARATOR; } return os; }
template<class T1, class T2> inline std::ostream & operator<< (std::ostream & os, const std::pair<T1, T2> & p) { return os << p.first << ' ' << p.second; }

void solve(void)
{
  string s; cin >> s;
  size_t inf = s.size() / 2;

  size_t ans{};
  for (size_t len = 1; len < inf; ++len)
  {
    ui res = true;
    for (size_t i = 0; i < len; ++i)
    {
      if(s[i] != s[i + len])
        res = false;
      if(!res)
        break;
    }
    if(res)
      chmax(ans, len * 2);
  }

  cout << ans << CRLF;
  return;
}

int main(void)
{
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(0);

  solve();

  return 0;
}


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

int main(){
  int a; cin >> a;
  string s; cin >> s;
  if(a >= 3200) cout << s << endl;
  else cout << "red" << endl;
}


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

typedef pair<int, int> ii;
typedef pair<int, ii> iii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef long long ll;
typedef long double ld;
typedef vector<ll> vll;
typedef pair<ll,ll> lll;

const ll MOD = 1000000007;
const ll INF = 1e9+5;
const double eps = 1e-7;
const double PI = acos(-1.0);

#define FOR(i,a,b) for(long long i = (long long)(a); i < (long long)(b); i++)
#define RFOR(i,a,b) for(long long i = (long long)(a); i >= (long long)(b); i--)
#define ull unsigned long long
#define deb(x )     cerr << #x << " = "<< x << endl;
#define endl    "\n"
#define coud(a,d) cout << fixed << showpoint << setprecision(d) << a;
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define fill(x, y) memset(x, y, sizeof(y))
#define all(x) (x).begin(), (x).end()
#define bitcount(x) __builtin_popcount(x)
#define cps CLOCKS_PER_SEC
#define verify(x) if(x >= MOD) x -= MOD;

inline void debug_vi(vi a) {FOR(i, 0, a.size()) cout<<a[i]<<" ";}
inline void debug_vll(vll a) {FOR(i, 0, a.size()) cout<<a[i]<<" ";}
inline void print_case(int tn) {cout<<"Case #"<<tn<<": ";}

template<typename T>
using minpq = priority_queue<T, vector<T>, greater<T>>;

template<typename T>
using maxpq = priority_queue<T>;
/*----------------------------------------------------------------------*/

int main(){
    std::ios::sync_with_stdio(false);cin.tie(NULL); cout.tie(NULL);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    clock_t clk = clock();

    ll n,a,b;cin>>n>>a>>b; ll res;
    if(a > b) swap(a, b);
    if((b - a) % 2) {
        res = (a - 1) + (b - a + 1)/2; // go to 1, wait for 1 sec to flip parity and then meet again.
        ll option2 = (n - b) + (b - a + 1)/2;
        res = min(res, option2);
    } else {
        res = (b - a)/2;
    }
    cout<<res;
    cerr << endl << "Time (in ms): " << double(clock() - clk) * 1000.0 / cps << endl;
    return 0;
}

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

#define GET_MACRO(_1,_2,_3,_4,NAME,...) NAME
#define REP2(i,n) for(int i=0;i<(int)(n);i++)
#define REP3(i,m,n) for(int i=m;i<(int)(n);i++)
#define REP4(i,m,n,s) for(int i=m;(s>0 and i<(int)(n)) or (s<0 and i>(int)(n));i+=s)
#define REP(...) GET_MACRO(__VA_ARGS__, REP4, REP3, REP2)(__VA_ARGS__)
#define REPIT(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define PIS(x) printf("%d ",x)
#define PN() putchar('\n')
#define MP make_pair
#define PB push_back
#define EB emplace_back

typedef pair<int,int> PII;
typedef long long LL;
typedef unsigned long long ULL;

void RI() {}
template<typename... T>
void RI( int& head, T&... tail ) {
    scanf("%d",&head);
    RI(tail...);
}
void PI() {putchar('\n');}
template<typename... T>
void PI(const int head, T... tail ) {
    printf("%d ", head);
    PI(tail...);
}

const int MOD = 1000000007;
#define MAX_N 550
int mat[MAX_N][MAX_N];

int main()
{
    int H, W, h, w;
    RI(H, W, h, w);
    if(H % h == 0 and W % w == 0) {
        printf("No\n");
        return 0;
    }
    printf("Yes\n");

    if(H % h != 0) {
        REP(j, W) {
            REP(i, H) {
                if(i % h == 0) {
                    mat[i][j] = 999999999;
                } else if(i % h == h-1) {
                    mat[i][j] = -1000000000;
                }
            }
        }
    } else {
        REP(i, H) {
            REP(j, W) {
                if(j % w == 0) {
                    mat[i][j] = 999999999;
                } else if(j % w == w-1) {
                    mat[i][j] = -1000000000;
                }
            }
        }
    }
    REP(i, H) {
        REP(j, W) {
            printf("%d ", mat[i][j]);
        }
        PN();
    }
    return 0;
}


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

#define NREP() for(ll i = 0; i < n; i++)
#define REP(i, n) for(ll i = 0; i < n; i++)
#define ALL(x) (x).begin(), (x).end()
#define MSG(x) cout << x << endl;
#define YN(x) x ? cout << "YES" << endl : cout << "NO" << endl;
#define Yn(x) x ? cout << "Yes" << endl : cout << "No" << endl;
#define yn(x) x ? cout << "yes" << endl : cout << "no" << endl;

using namespace std;
using ll = long long;
const static ll MOD = 1e9 + 7;

int main(int argc, char *argv[]) {
    ll h;
    cin >> h;
    MSG(fixed << setprecision(0) << pow(2, floor(log2(h)) + 1) - 1)
}


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

int main(){
    //freopen("input.txt","r",stdin);    
    int n, q; cin>>n>>q;
    string s; cin>>s;
    s = ' ' + s;

    vector<int> dp(n + 1);
    dp[1] = 0;
    for(int i =2; i<=n; i++)
        dp[i] = dp[i-1] + (s[i] =='C' && s[i-1] =='A');
    
    while(q--){
        int l, r; cin>>l>>r;
        cout<<dp[r] - dp[l]<<endl;
    }
    return 0;
}


Measured memory_bytes: 1404
import sys
def 解():
    input = sys.stdin.readline
    iN = int(input())
    dS = {}
    for i in range(iN):
        s = input().rstrip()
        if s in dS:
            dS[s] += 1
        else:
            dS[s] = 1
    iM = int(input())
    dT = {}
    for i in range(iM):
        s = input().rstrip()
        if s in dT:
            dT[s] += 1
        else:
            dT[s] = 1
    iMax = 0
    for s in dS.keys():
        iMax = max(iMax, dS[s] - dT.get(s,0))
    print(iMax)
解()


Measured memory_bytes: 3064
# 2019/05/19
# AtCoder Beginner Contest 126 - B

# Input
s = input()

# Calc
mae = int(s[0]) * 10 + int(s[1])
ato = int(s[2]) * 10 + int(s[3])

if (mae < 1 or mae > 12) and (ato < 1 or ato > 12):
    ans = "NA"
elif (mae >= 1 and mae <= 12) and (ato >= 1 and ato <= 12):
    ans = "AMBIGUOUS"
else:
    if (mae >= 1 and mae <= 12):
        ans = "MMYY"
    else:
        ans = "YYMM"

# Output
print(ans)


Measured memory_bytes: 3060
import std.conv, std.stdio, std.string;
import std.algorithm, std.array, std.bigint, std.container, std.math, std.range, std.regex, std.typecons;
import core.bitop, core.thread;

class EOFException : Throwable { this() { super("EOF"); } }
string[] tokens;
string readToken() { for (; tokens.empty; ) { if (stdin.eof) throw new EOFException; tokens = readln.split; } auto token = tokens[0]; tokens.popFront; return token; }
int readInt() { return readToken().to!int; }
long readLong() { return readToken().to!long; }
real readReal() { return readToken().to!real; }

void chmin(T)(ref T t, in T f) { if (t > f) t = f; }
void chmax(T)(ref T t, in T f) { if (t < f) t = f; }

int binarySearch(T)(in T[] as, in bool delegate(T) test) { int low = -1, upp = cast(int)(as.length); for (; low + 1 < upp; ) { int mid = (low + upp) >> 1; (test(as[mid]) ? low : upp) = mid; } return upp; }
int lowerBound(T)(in T[] as, in T val) { return as.binarySearch((T a) => (a < val)); }
int upperBound(T)(in T[] as, in T val) { return as.binarySearch((T a) => (a <= val)); }


immutable MO = 10L^^9 + 7;

int N;
int[][] A;

void main() {
  try {
    for (; ; ) {
      N = readInt();
      A = new int[][](N, N);
      foreach (u; 0 .. N) foreach (v; 0 .. N) {
        A[u][v] = readInt();
      }
      auto dp = new long[1 << N];
      dp[0] = 1;
      foreach (p; 0 .. 1 << N) {
        int u;
        foreach (v; 0 .. N) {
          if ((p >> v) & 1) {
            ++u;
          }
        }
        if (u < N) {
          foreach (v; 0 .. N) {
            if (!((p >> v) & 1) && A[u][v]) {
              (dp[p | 1 << v] += dp[p]) %= MO;
            }
          }
        }
      }
      writeln(dp[$ - 1]);
    }
  } catch (EOFException e) {
  }
}


Measured memory_bytes: 18172
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define REPL(i,m,n) for(ll i=(ll)(m); i<(ll)(n); i++)
#define repl(i,n) REPL(i,0,n)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  vector<int> A(N);
  rep(i, N) cin >> A[i];
  vector<int> cnt(9);
  rep(i, N) {
    cnt[min(A[i]/400, 8)]++;
  }
  int ans = 0;
  rep(i, 8) if(cnt[i]) ans++;
  cout << max(ans, 1) << ' ' << ans+cnt[8] << endl;
  return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>

using namespace std;

typedef pair<long long int, long long int> P;

long long int INF = 1e18;
long long int MOD = 1e9 + 7;

long long int GCD(long long int a, long long int b){
	long long int dummy1, dummy2, dummy;
	dummy1 = max(a, b);
	dummy2 = min(a, b);
	while(true){
		dummy = dummy1 % dummy2;
		dummy1 = dummy2;
		dummy2 = dummy;
		if(dummy == 0){
			break;
		}
	}
	return dummy1;
}

int main(){
	
	int N;
	cin >> N;
	
	long long int ans;
	cin >> ans;
	
	for(int i = 0; i < N - 1; i++){
		int A;
		cin >> A;
		ans = GCD(ans, A);
	}
	
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 256
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    import math
    #from math import gcd

    #inf = 10**17
    #mod = 10**9 + 7

    n = int(input())
    h = list(map(int, input().split()))
    res = 0
    m = 0
    for i in h:
        if i >= m:
            res += 1
            m = max(m, i)
    print(res)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3316
from sys import stdin
def main():
    #入力
    readline=stdin.readline
    n,c=map(int,readline().split())
    x=[0]*n
    v=[0]*n
    for i in range(n):
        x[i],v[i]=map(int,readline().split())

    x_rev=list(map(lambda x:c-x,reversed(x)))
    v_rev=list(reversed(v))

    dp=[0]*(n+1)
    dp_rev=[0]*(n+1)
    now=0
    tmp=0
    for i in range(n):
        dp[i+1]=max(dp[i],tmp+v[i]-x[i]+now)
        tmp+=v[i]-x[i]+now
        now=x[i]
    now=0
    tmp=0
    for i in range(n):
        dp_rev[i+1]=max(dp_rev[i],tmp+v_rev[i]-x_rev[i]+now)
        tmp+=v_rev[i]-x_rev[i]+now
        now=x_rev[i]

    ans=0
    #時計、反時計
    for i in range(n):
        tmp1=dp[i+1]
        tmp2=dp[i+1]-x[i]+dp_rev[n-i-1]
        ans=max(ans,tmp1,tmp2)

    #反時計、時計
    for i in range(n):
        tmp1=dp_rev[i+1]
        tmp2=dp_rev[i+1]-x_rev[i]+dp[n-i-1]
        ans=max(ans,tmp1,tmp2)

    print(ans)

if __name__=="__main__":
    main()

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

typedef unsigned long long ull;
typedef unsigned __int128  ui128;

signed main(){
	ui128 ans = 0, b = 0;
	ull N, k;
	cin>>N>>k;
	
	for(ui128 i = 1; i < N; i++){
		ans = (k*b+k-1)/(k-1);
		// cout<<i<<" "<<ans<<endl;
		b = ans;
	}
	cout<<(ull)ans<<endl;
	
	return 0;
}


Measured memory_bytes: 3116
from __future__ import (division, absolute_import, print_function,
                        unicode_literals)
import sys

for line in sys.stdin:
    a, b, c, d, e, f = (float(n) for n in line.split())
    x = round((e * c - b * f) / (a * e - b * d), 4)
    y = round((a * f - c * d) / (a * e - b * d), 4)
    if x == -0.0:
        x  = 0.0
    if y == -0.0:
        y = 0.0
    print('{:.3f} {:.3f}'.format(-(-x), -(-y)))

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

int main() {
    int h, w; cin >> h >> w;
    vector<string> s(h);
    for (auto &si: s) cin >> si;
    vector<bool> need_row(h), need_col(w);
    for (int i = 0; i < h; i++) for (int j = 0; j < w; j++) {
        if (s[i][j] == '#') need_row[i] = need_col[j] = true;
    }
    for (int i = 0; i < h; i++) if (need_row[i]) {
        for (int j = 0; j < w; j++) if (need_col[j]) cout << s[i][j];
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){int n,c,t,f,i;for(;;){cin>>n;if(!n){break;}c=0;t=0;f=0;for(i=1;i<=n;i++){int m=i;while(m%2==0){t++;m/=2;}m=i;while(m%5==0){f++;m/=5;}}cout<<(t<f?t:f)<<endl;}return 0;}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, x, y;
  cin >> n >> m >> x >> y;
  int xmax = -300;
  int yarr[100] = {0};
  for (int i = 0; i < n; i++) {
    int inpt; cin >> inpt;
    if (xmax < inpt) xmax = inpt;
  }
  xmax++;
  bool flag = true;
  for (int i = 0; i < m; i++) {
    int inpt; cin >> inpt;
    if (xmax > inpt) flag = false;
  }
  if (flag && xmax > x && xmax <= y) puts("No War");
  else puts("War");
}

Measured memory_bytes: 256
X,N=map(int,input().split())
P=list(int(x) for x in input().split())
if X not in P:
	print(X)
	exit()
i=0
while True:
	i+=1
	j=X-i*1
	k=X+i*1
	if j not in P:
		print(j)
		exit()
	elif k not in P:
		print(k)
		exit()

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

int main(){
    string s,t,u;
    int a,b;
    cin >> s >> t >> a >> b >> u;
    if(u==s)cout << a-1 <<" "<< b << endl;
    else cout << a << " " << b-1 << endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main{
        public static void main(String[] args){
                try(Scanner sc = new Scanner(System.in)){
                        int N = sc.nextInt();
                        int[] a = new int[3];
                        for(int i = 0; i < N; i++){
                                a[sc.nextInt()%3]++;
                        }
                        if(a[1]==0&&a[2]==0){
                                System.out.println(1);
                        }else{
                                int ans = a[0];
                                ans+=Math.min(a[1],a[2])*2;
                                ans+=Math.min(3,Math.max(a[1],a[2])-Math.min(a[1],a[2]));
                                System.out.println(ans);
                        }
                }
        }
}

Measured memory_bytes: 165960
//https://atcoder.jp/contests/abc157/tasks/abc157_a
#include <bits/stdc++.h>
#if LOCAL
#include "dump.hpp"
#else
#define dump(...)
#endif
using namespace std;
using ll=long long;
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
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 main() {
    ll N; cin>>N;
    ll ans=(N+1)/2;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;
typedef long long ll;
typedef pair<ll, int> P;
 
int N, Q, K;
vector<vector<P>> root(100001);  //pair<辺の距離, 行先の頂点>
vector<ll> dist(100001, LLONG_MAX); //distance[i]はstartから頂点iへの最短距離が入る
bitset<100001> used;

void Dijkstra(ll start){ //start = 始点
    priority_queue<P, vector<P>, greater<P>> que;
    que.push(make_pair(0, start));
    while(!que.empty()){
        ll d, t; //d:startからの距離, t:行先
        tie(d, t) = que.top(); que.pop();
        if(used[t]) continue;   //探索済み
        used[t] = true, dist[t] = d;
        for(auto e : root[t]){
            if(dist[e.second] <= d + e.first) continue;
            que.push(make_pair(d + e.first, e.second));
        }
    }
    return;
}

int main(void){
    
    cin >> N;
    for(int i = 0; i < N - 1; ++i){
        int a, b, c; cin >> a >> b >> c;
        root[a].push_back(make_pair(c, b)), root[b].push_back(make_pair(c, a));
    }
    
    cin >> Q >> K;
    Dijkstra(K);
    for(int i = 0; i < Q; ++i){
        ll x, y; cin >> x >> y;
        cout << dist[x] + dist[y] << endl;
    }
    
    return 0;
}

Measured memory_bytes: 11120
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <functional>
using namespace std;

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

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

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

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

int main(void){
    int x;
    cin >> x;
    cout << 10 - x / 200 << endl;
    return 0;
}


Measured memory_bytes: 3616
import queue

H,W = map(int,input().split())
C = [int(i)+1 for i in input().split()]
D = [int(i)+1 for i in input().split()]

l = []
l.append([-1]*(W+4))
l.append([-1]*(W+4))
for _ in range(H):
    l.append([-1,-1]+ [0 if i=="." else -1 for i in input()] + [-1,-1])
l.append([-1]*(W+4))
l.append([-1]*(W+4))

l[C[0]][C[1]] = 1 

def p():
    for i in l[2:2+H]:
        print(",".join([str(j) for j in i[2:2+W]]))

q = queue.Queue()
q.put(C)
now = 1
q2 = queue.Queue()
while True:
    while not q.empty():
        x,y = q.get()
        q2.put([x,y])
        for i,j in [[1,0],[0,1],[-1,0],[0,-1]]:
            if l[x+i][y+j] ==0:
                q.put([x+i,y+j])
                l[x+i][y+j] = now
    if l[D[0]][D[1]] > 0:
        print(l[D[0]][D[1]]-1)
        break
    now += 1
    if q2.empty():
        print(-1)
        break
    while not q2.empty():
        x,y = q2.get()
        for i in range(-2,3):
            for j in range(-2,3):
                if l[x+i][y+j] ==0:
                    q.put([x+i,y+j])
                    l[x+i][y+j] = now
    if l[D[0]][D[1]] > 0:
        print(l[D[0]][D[1]]-1) 
        break
    

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

namespace AtCoder
{
    static class Program
    {
        static void Main()
        {
            //ここから

            int N = IO.ReadLineToInt();
            var A = IO.ReadLineToIntList();
            var B = IO.ReadLineToIntList();

            long sum = 0;

            for(int i = 0; i < N; i++)
            {
                var num = Math.Min(A[i], B[i]);
                sum += num;
                B[i] -= num;
                num = Math.Min(A[i + 1], B[i]);
                sum += num;
                A[i + 1] -= num;
            }


            //ここまで
            Console.WriteLine(sum);
            Console.ReadKey();
        }
    }

    static class Func
    {
        static long mod = 1000000007;
        static public void Swap<T>(ref T a, ref T b) { T temp = a; a = b; b = temp; }
        static public long GCD(long a, long b) { return b != 0 ? GCD(b, a % b) : a; }
        static public long LCM(long a, long b) { return (long)a * b / GCD(a, b); }
        static public int Factorial(int a) { return a == 1 ? a : a * Factorial(a - 1); }


        public static double ToAngle(this double radian)
        {
            return (double)(radian * 180 / Math.PI);
        }

        public static double ToRadian(this double angle)
        {
            return (double)(angle * Math.PI / 180);
        }

        static public long Conbination(int n,int m)
        {
            if (m == 0) return 1;
            if (n == 0) return 0;
            return n * Conbination(n - 1, m - 1) / m;
        }

        static public void Factoring(long num, ref long[] vs)
        {
            if (num == 1)
            {
                vs[1]++;
            }
            for (long i = 2; i < Math.Sqrt(num); i++)
            {
                if (num % i == 0)
                {
                    vs[i]++;
                    Factoring(num / i, ref vs);
                }
            }
            vs[1]++;
        }
    }

    static class IO
    {
        static public string ReadLineToString() { return Console.ReadLine(); }
        static public int ReadLineToInt() { return int.Parse(Console.ReadLine()); }
        static public long ReadLineToLong() { return long.Parse(Console.ReadLine()); }
        static public List<string> ReadLineToStringList() { return Console.ReadLine().Split(' ').ToList(); }
        static public List<int> ReadLineToIntList() { return Console.ReadLine().Split(' ').Select(int.Parse).ToList(); }
        static public List<long> ReadLineToLongList() { return Console.ReadLine().Split(' ').Select(long.Parse).ToList(); }

        static public List<double> ReadLineToDoubleList() { return Console.ReadLine().Split(' ').Select(double.Parse).ToList(); }

        static public void WriteStrings(object[] strings) { foreach (var o in strings) { Console.Write(o + " "); } }
    }
}

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

int main()
{
    int x,y;
    cin>>x>>y;
    if(x*4<y || x*2>y)
    {
        cout<<"No"<<endl;
    }
    else
    {
        int k=y%2;
        if(k%2==0)
        {
            cout<<"Yes"<<endl;
        }
        else
        {
            cout<<"No"<<endl;
        }

    }
    return 0;
}


Measured memory_bytes: 3636
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)

	gd := make(map[string]bool)
	var good string

	for i := 0; i < n; i++ {
		fmt.Scan(&good)
		gd[good] = true
	}

	fmt.Println(len(gd))
}

Measured memory_bytes: 18896
#include<bits/stdc++.h>
using namespace std;
int main(){
	int h,n;
    cin >>h>>n;
    vector<int>a(n);
    for(int i=0;i<n;i++)cin>>a[i];
    int sum=0;
    for(int i=0;i<n;i++)sum += a[i];
    if(sum < h)cout<<"No"<<endl;
    else{
    cout<<"Yes"<<endl;
    }
}

Measured memory_bytes: 640
#pragma GCC optimize ("O3")
#pragma GCC target ("tune=native")
#pragma GCC target ("avx")

#include <bits/stdc++.h>

// 汎用マクロ
#define ALL_OF(x) (x).begin(), (x).end()
#define REP(i,n) for (long long i=0, i##_len=(n); i<i##_len; i++)
#define RANGE(i,is,ie) for (long long i=(is), i##_end=(ie); i<=i##_end; i++)
#define DSRNG(i,is,ie) for (long long i=(is), i##_end=(ie); i>=i##_end; i--)
#define UNIQUE(v) { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); }
template<class T> bool chmax(T &a, const T &b) {if (a < b) {a = b; return true;} return false; }
template<class T> bool chmin(T &a, const T &b) {if (a > b) {a = b; return true;} return false; }
#define INF 0x7FFFFFFF
#define LINF 0x7FFFFFFFFFFFFFFFLL
#define Yes(q) (q ? "Yes" : "No")
#define YES(q) (q ? "YES" : "NO")
#define DUMP(q) cerr << "[DEBUG] " #q ": " << (q) << " at " __FILE__ ":" << __LINE__ << endl
#define DUMPALL(q) { cerr << "[DEBUG] " #q ": ["; REP(dumpall_i, (q).size()) { cerr << q[dumpall_i] << (dumpall_i == (q).size() - 1 ? "" : ", "); } cerr << "] at " __FILE__ ":" << __LINE__ << endl; }
template<class T> T gcd(const T &a, const T &b) { return a < b ? gcd(b, a) : b ? gcd(b, a % b) : a; }
template<class T> T lcm(const T &a, const T &b) { return a / gcd(a, b) * b; }

// gcc拡張マクロ
#define popcount __builtin_popcount
#define popcountll __builtin_popcountll

// エイリアス
using  ll = long long;
using ull = unsigned long long;
using  ld = long double;
using namespace std;

// モジュール


// 処理内容
int main() {
    
    string s; cin >> s;
    ll n = s.size();
    vector<ll> rimos(n, 0);
    vector<ll> limos(n, 0);
    RANGE(i, 0, n-1) {
        if (s[i] == 'R') {
            rimos[i] = 1LL + (i ? rimos[i-1] : 0);
        }
    }
    DSRNG(i, n-1, 0) {
        if (s[i] == 'L') {
            limos[i] = 1LL + (i != n-1 ? limos[i+1] : 0);
        }
    }
    
    vector<ll> ans(n, 0);
    REP(i, n-1) {
        if (s[i] == 'R' && s[i+1] == 'L') {
            ll rs = rimos[i], ls = limos[i+1];
            ans[i]   = (rs + 1) / 2 + ls / 2;
            ans[i+1] = rs / 2 + (ls + 1) / 2;
        }
    }
    REP(i, n) {
        cout << ans[i] << " \n"[i == n-1];
    }
}

Measured memory_bytes: 3072
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <numeric>

using namespace std;


int main(){
    int n;
    string s;
    cin>>n>>s;
    int ans=3000000;
    vector<int> e(n),w(n);
    w[0]=0;e[n-1]=0;
    for(int i=1;i<n;i++){
        if(s[i-1]=='W')w[i]=w[i-1]+1;
        else w[i]=w[i-1];
    }
    for(int i=n-1;i>=0;i--){
        if(s[i+1]=='E')e[i]=e[i+1]+1;
        else e[i]=e[i+1];
    }
    for(int i=0;i<n;i++){
        ans=min(ans,e[i]+w[i]);
    }
    cout<<ans<<endl;
}

   


Measured memory_bytes: 3068
X, K, D = [int(i) for i in input().split()]

if X > 0:
    c = X // D
    if c >= K:
        print(abs(X - D * K))
    else:
        rest = K-c
        if rest%2 == 0:
            print(abs(X-D*c))
        else:
            print(abs(X-D*(c+1)))
else:
    c = (-X) // D
    if c >= K:
        print(abs(X + D * K))
    else:
        rest = K-c
        if rest%2 == 0:
            print(abs(X+D*c))
        else:
            print(abs(X+D*(c+1)))

Measured memory_bytes: 61760
#include <iostream>
using namespace std;
int cnt[27];

int main()
{
  string S;
  cin>>S;
  for (int i=0;i<S.length();i++){
    if (i+1<S.length() && S[i]==S[i+1]){
      cout<<i+1<<' '<<i+2<<endl;
      return 0;
    }
    if (i+2<S.length() && S[i]==S[i+2]){
      cout<<i+1<<' '<<i+3<<endl;
      return 0;
    }
  }
  cout<<"-1 -1"<<endl;
  return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <list>
#include <string>

using namespace std;

int main(){

    int n;
    cin >> n;
    string str;
    int num;
    list<int> L;

    for(int i=0; i<n; ++i){
        cin >> str;
        if( str == "insert"){
            cin >> num;
            L.push_front(num);
        }else if( str == "delete" ){
            cin >> num;
            for(auto itr=L.begin(); itr!=L.end(); ++itr){
                if(*itr == num){
                    L.erase(itr);
                    break;
                }
            }
        }else if(str == "deleteFirst"){
            L.pop_front();
        }else if( str == "deleteLast"){
            L.pop_back();
        }
    }


    for(auto itr = L.begin(); itr!=L.end(); ++itr){
        if(itr != L.begin()){
            cout << ' ';
        }
        cout << *itr;
    }
    cout << endl;

    return 0;
}



Measured memory_bytes: 34308
#include <stdio.h>
#include <string.h>

static long long adder(long long base, const char *str)
{
	char tmp[11] = {0};
	long long val;
	int len = strlen(str);
	int i;
	
	if (len == 10) {
		val = (*str - '0') * 1000000000L + strtol(str + 1, NULL, 10);
	} else {
		val = strtol(str, NULL, 10);
	}
	if (len > 1) {
		for (i = 1; i < len; i++) {
			memcpy(tmp, str, i);
			val += adder(base + strtol(tmp, NULL, 10), str + i);
		}
	}
	base += val;
	return base;
}

int main()
{
	char s[12] = {0};
	long long int sum;
	scanf("%s", s);
 		
	sum = adder(0, s);

	printf("%lld\n", sum);
}


Measured memory_bytes: 128
// atcoder/caddi2018/C/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/

#include <bits/stdc++.h>

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; for (auto& i: v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { for (auto& i: v) is >> i; return is; }
template<typename T> ostream& operator << (ostream& os, set<T> s) { os << "#{"; for (auto& i: s) os << i << ","; os << "}"; return os; }
template<typename K, typename V> ostream& operator << (ostream& os, map<K, V> m) { os << "{"; for (auto& i: m) os << i << ","; os << "}"; return os; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

using lli = long long int;
using ull = unsigned long long;
using point = complex<double>;
using str = string;
template<typename T> using vec = vector<T>;

constexpr array<int, 8> di({0, 1, -1, 0, 1, -1, 1, -1});
constexpr array<int, 8> dj({1, 0, 0, -1, 1, -1, -1, 1});
constexpr lli mod = 1e9 + 7;

int main(int argc, char *argv[])
{
  std::ios_base::sync_with_stdio(0);
  std::cin.tie(0);
  std::cout.setf(std::ios_base::fixed);
  std::cout.precision(15);

  lli n, p;
  while (cin >> n >> p) {
    if (n == 1) {
      cout << p << endl;
      continue;
    }
    lli x = 1;
    for (lli i = 2; i * i <= p; ++i) {
      int cnt = 0;
      while (p % i == 0) {
        p /= i;
        ++cnt;
      }
      for (int j = 0; j < cnt / n; ++j) {
        x *= i;
      }
    }
    cout << x << endl;
  }

  return 0;
}


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

int istack[200]={}, l = 0;
void in(int a){istack[l++] = a;}
int out(void){return istack[--l];}

int main(){
  string a;
  while(cin>>a){
    if(a[0] == '+') in(out() + out());
    else if(a[0] == '-') {int a=out();int b=out();in(b-a);}
    else if(a[0] == '*') in(out() * out());
    else in(atoi(a.c_str()));
  }
  printf("%d\n",out());
  return 0;
}



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

int main(void) {

  long n,k;
  scanf("%ld %ld", &n, &k);
  long mod_0 = n/k;
  long mod_half = mod_0;
  if ((n%k)*2 >= k) {
    mod_half++;
  }
  if (k%2 != 0) {
    mod_half = 0;
  }
  long answer = pow(mod_0,3)+pow(mod_half,3);
  printf("%ld\n", answer);

  return 0;
}

Measured memory_bytes: 128
# -*- coding: utf-8 -*-
from queue import Queue
h,w = map(int, input().split())
d = []
for _ in range(h):
    d.append(input())
cost = [[0]*w for _ in range(h)]

q = Queue()
q.put((0,0))
while not q.empty():
    hi,wi = q.get()
    if hi==h-1 and wi==w-1:
        break

    for dh,dw in [[0,1],[1,0],[0,-1],[-1,0]]:
        if h>dh+hi>=0 and w>dw+wi>=0 and d[dh+hi][dw+wi]==".":
            if cost[dh+hi][dw+wi]==0 or cost[dh+hi][dw+wi]>cost[hi][wi]+1:
                cost[dh+hi][dw+wi] = cost[hi][wi]+1
                q.put((dh+hi, dw+wi))

if cost[h-1][w-1]==0:
    print(-1)
    exit()

res = 0
for hi in range(h):
    for wi in range(w):
        if (hi==0 and wi==0) or (hi==h-1 and wi==-1):
            continue
        if d[hi][wi]==".":
            res += 1

print(res - cost[h-1][w-1])


Measured memory_bytes: 4080
N = int(input())

idx_1st=1
val_1st=1
idx_2nd=0
val_2nd=0

for i in range(N):
  Ai = int(input())
  if Ai>=val_1st:
    idx_2nd=idx_1st
    val_2nd=val_1st
    
    idx_1st=i
    val_1st=Ai
    
  elif Ai<val_1st:
    if Ai>val_2nd:
      idx_2nd=i
      val_2nd=Ai
  else:
    raise ValueError

for i in range(N):
  if i!=idx_1st:
    print(val_1st)
  elif i==idx_1st:
    print(val_2nd)
  else:
    raise ValueError

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

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

	int as[n + 1][n - 1];
	int index[n + 1]{n + 1, 0};

	for(int i = 1; i <= n; i++) {
		for(int j = 0; j < n - 1; j++) {
			cin >> as[i][j];
		}
	}

	int max = n * (n - 1) / 2;

	int deleted_count = 0;
	int count = 0;

	while(true) {
		set<int> keys = {};

		bool is_delete = false;
		for (int i = 1; i <= n; i++) {
			if (n > index[i] + 1) {
				int target = as[i][index[i]];
				if (i == as[target][index[target]]) {
					keys.insert(i);
					deleted_count++;
					is_delete = true;
				}
			}
		}

		for (auto const& k : keys) {
			index[k] ++;
		}

		if (! is_delete) {
			bool is_all = true;
			for (int i = 1; i <= n; i++) {
				is_all = is_all && (index[i] >= n - 1);
			}
			if (is_all) {
				cout << count;
				return 0;
			} else {
				cout << -1;
				return 0;
			}
		}
		
		count ++;
	}
}

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

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

	string s;
	while (n)
	{
		if (n % 26 == 0) s.push_back('z'), n--;
		else s.push_back('a' + (n-1) % 26);
		n /= 26;	
	}
	reverse(s.begin(), s.end());
	cout << s << '\n';
	return 0;
}

Measured memory_bytes: 3632
import * as fs from 'fs';

const input = fs.readFileSync('/dev/stdin', 'utf8');
const args: string[][] = input.split('\n').map(l => l.split(' '));

const [a, b, n] = args[0].map(x => parseInt(x));

const max = Math.floor(a * Math.min(b - 1, n) / b);

console.log(max);

Measured memory_bytes: 29588
#C
sx, sy, tx, ty = map(int, input().split())
dx = tx - sx
dy = ty - sy

ans1 = ""
ans2 = ""

for i in range(dx):
    ans1 += "R"
    ans2 += "L"

for i in range(dy):
    ans1 += "U"
    ans2 += "D"

ans = ans1 + ans2
ans1 = "D"
ans2 = "U"

for i in range(dx + 1):
    ans1 += "R"
    ans2 += "L"

for i in range(dy + 1):
    ans1 += "U"
    ans2 += "D"

ans1 += "L"
ans2 += "R"

print(ans + ans1 + ans2)

Measured memory_bytes: 41180
#include<bits/stdc++.h>
#define mp(x,y) make_pair(x,y)
#define pa pair<int,int>
using namespace std;
const int N=1010;
const int dx[4]={0,0,1,-1};
const int dy[4]={1,-1,0,0};
int n,m;
queue<pa>q;
char s[N][N];
int ans,b[N][N];
void dfs()
{
	while (!q.empty())
	{
		pa t=q.front(); q.pop();
		for (int k=0;k<4;k++) {
			int i=t.first+dx[k];
			int j=t.second+dy[k];
			if (i>0&&i<=n&&j>0&&j<=m) {
				if (s[i][j]=='.') {
					s[i][j]='#';
					q.push(mp(i,j)); b[i][j]=b[t.first][t.second]+1;
					ans=max(ans,b[i][j]);
				}
			}
		}	
	}
}
int main()
{
	scanf("%d%d",&n,&m);
	for (int i=1;i<=n;i++)
	{
		scanf("%s",s[i]+1);
	}
	for (int i=1;i<=n;i++) 
	{
		for (int j=1;j<=m;j++) if (s[i][j]=='#') {
			q.push(mp(i,j));
		}
	}
	dfs();
	printf("%d\n",ans);
}

Measured memory_bytes: 11408
#include<bits/stdc++.h>
using namespace std;
int main() {
  int x, a, b;
  cin >> x >> a >> b;
  if (b-a > x) cout << "dangerous" << endl;
  else if (b-a <= 0) cout << "delicious" << endl;
  else cout << "safe" << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.util.stream.*;

public class Main {

  public static void main(String[] args) {
    Scanner in = new Scanner(System.in);
    int N = in.nextInt();
    int[] A = new int[N];
    for (int i = 0; i < N; i++) {
      A[i] = in.nextInt();
    }
    boolean[] box = new boolean[N];
    for (int i = N; i > 0; i--) {
      int cnt = 0, val = i * 2;
      while(val <= N) {
        if(box[val - 1]) {
          cnt++;
        }
        val += i;
      }
      if(cnt % 2 != A[i - 1]) {
        box[i - 1] = true;
      }
    }
    List<Integer> list = IntStream.range(0, N)
      .filter(val -> box[val])
      .mapToObj(val -> val + 1)
      .collect(Collectors.toList());
    System.out.println(list.size());
    if(list.size() > 0) {
      System.out.println(list.stream().map(String::valueOf).collect(Collectors.joining(" ")));
    }
  }
}


Measured memory_bytes: 93172
#include <cstdio>
int main()
{
	// freopen("AGC030-C.in", "r", stdin);
	int k;
	scanf("%d", &k);
	if (k == 1)
	{
		puts("1\n1");
		return 0;
	}
	int n = (k + 3) / 4 * 2;
	printf("%d\n", n);
	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < n; j++)
		{
			int x = (i + j) % n + (i & 1) * n;
			printf("%d%c", x - (x >= k) * n + 1, " \n"[j + 1 == n]);
		}
	}
	return 0;
}


Measured memory_bytes: 1152
S=input()

while True:
    if len(S)==0:
        print("YES")
        break
    elif len(S)<5:
        print("NO")
        break
    else:
        if S[-5:]=="dream" or S[-5:]=="erase":
            S=S[:-5]
        elif S[-7:]=="dreamer":
            S=S[:-7]
        elif S[-6:]=="eraser":
            S=S[:-6]
        else:
            print("NO")
            break

Measured memory_bytes: 133880
#include <bits/stdc++.h>
#include <iomanip>
#include<algorithm>
#define ll long long
using namespace std;

int main() {
  ll A, B, N, max = 0;
  cin >> A >> B >> N;
  if(B <= N) cout << int(A * (B - 1) / B) - A * int((B - 1) / B) << endl;
  else cout << int(A * N / B) - A * int(N / B) << endl;
}

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

using namespace std;

const int N=1e5+10;
long long int a[N];

int main()
{
    long long int n,i,m,sum=0;
    scanf("%lld%lld",&n,&m);
    for(i=0;i<n;i++)
    {
        scanf("%lld",&a[i]);
        if(i>0)
        {
            if(a[i]+a[i-1]>m)
            {
                sum+=a[i]+a[i-1]-m;
                a[i]=m-a[i-1];
            }
        }
        else if(a[i]>m)
            {
                sum+=a[i]-m;
                a[i]=m;
            }

    }
    printf("%lld",sum);
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(var,cnt) for(int (var)=0; (var)<(int)(cnt); ++(var))
#define Rep(var,init,cnt) for(int (var)=(init); (var)<(cnt); ++(var))
#define ran(var,vec) for(auto &(var):(vec))
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define SORT(v) sort(all(v))
#define RSORT(v) sort(rall(v))
#define SUM(v) accumulate(all(v),0)
#define tget(tp,idx) get<idx>(tp)
#define TF(flag) (flag)?1:0
#define yn(f) cout<<(f?"yes":"no")<<endl
#define Yn(f) cout<<(f?"Yes":"No")<<endl
#define YN(f) cout<<(f?"YES":"NO")<<endl
#define COUT(x) cout<<(x)<<endl
using namespace std;

using ll = long long;
using ull = unsigned long long;
using pi = pair<int,int>;
using pl = pair<ll,ll>;
using ti = tuple<int,int,int>;
using tl = tuple<ll,ll,ll>;

template<typename T>
using vec = vector<T>;
template<typename T>
using mat = vector<vec<T>>;
template<typename T>
using cub = vector<mat<T>>;
template<typename T>
using val = valarray<T>;

template<typename T>
using pq = priority_queue<T>;
template<typename T>
using rpq = priority_queue<T,vec<T>,greater<T>>;

template<typename T1,typename T2>
ostream &operator<<(ostream &os, const pair<T1,T2> &p){
  os<<"P("<<p.first<<", "<<p.second<<") ";
  return os;
}

template<typename T1,typename T2>
istream &operator>>(istream &is, pair<T1,T2> &p){
  is>>p.first>>p.second;
  return is;
}

template<typename T>
ostream &operator<<(ostream &os, const vector<T> &v){
  cout<<"V{";
  for(int i=0; i<(int)v.size(); ++i){
    os<<v[i]<<(i+1!=v.size()?" ":"");
  }
  cout<<"}";
  return os;
}

template<typename T>
istream &operator>>(istream &is, vector<T> &v){
  for(T &in:v) is>>in;
  return is;
}

template<typename T>
ostream &operator<<(ostream &os, const valarray<T> &v){
  cout<<"V{";
  for(int i=0; i<(int)v.size(); ++i){
    os<<v[i]<<(i+1!=v.size()?" ":"");
  }
  cout<<"}";
  return os;
}

template<typename T>
istream &operator>>(istream &is, valarray<T> &v){
  for(T &in:v) is>>in;
  return is;
}

// Usual Template End ================================================

// Template End ======================================================

constexpr int MOD=1e9+7;

int main(void){
  string s; cin>>s; SORT(s); Yn(s=="abc");
}













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

#define CEIL(a,b) ((a) / (b) + ((a) % (b) == 0 ? 0 : 1))
#define X first
#define Y second

using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vl = vector<ll>;
using vs = vector<string>;

constexpr int MOD = int(1e9 + 7);
constexpr int INF = int(1e9 + 1);
constexpr ll LLINF = ll(4 * 1e18 + 1);
// constexpr int INF = 2147483647; // 2 * 1e9
// constexpr ll LLINF = 9223372036854775807; // 9 * 1e18

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

int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout << fixed << setprecision(10);
	int a, b, c;
	cin >> a >> b >> c;
	if(a + b >= c - 1) cout << b + c << "\n";
	else cout << a + b + 1 + b << "\n";
	return 0;
}


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

int main()
{
	int N = 0;
	std::cin >> N;
	std::string ans = "YES";
 
	std::vector<int>A(N);
	for (int i = 0; i < N; i++)
	{		
		std::cin >> A[i];	
	}
  	std::sort(A.begin(), A.end());  
  
  	for (int i = 1; i < N; i++)
	{
    	if (A[i] == A[i-1]){
    		ans = "NO";
        	break;
    	}
    }
 
	std::cout << ans << std::endl;
 
	return 0;
}

Measured memory_bytes: 1152
N = int(input())
A = str(input())
B = str(input())
C = str(input())

count = 0
sum = 0

for i in range(N):
    
    ilist = list([A[i], B[i], C[i]])
    iuniq = list(set(ilist))
    sum = sum + len(iuniq)-1

print(sum)

Measured memory_bytes: 3064
n, m = map(int, input().split())
a = [input() for i in range(n)]
b = [input() for i in range(m)]

for i in range(n-m+1):
    for j in range(n-m+1):
        ans = 0
        for ii in range(m):
            for jj in range(m):
                if b[ii][jj] == a[i+ii][j+jj]:
                    ans += 1
        if ans == m*m:
            print("Yes")
            exit()

print("No")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define show(x) for(auto i: x){cout << i << " ";}
#define showm(m) for(auto i: m){cout << m.x << " ";}
typedef long long ll;
typedef pair<int, int> P;


int main()
{
    int n;
    cin >> n;
    vector<int> s;
    rep(i, n-1){ int tmp; cin >> tmp; s.push_back(tmp);}

    // c-1
    ll max_score = 0;
    for (int c = 1; c < n; c++)
    {
        ll score = 0;
        set<int> hasu;
        for (int x = 1; c*x < n; x++)
        {
            if ((n-1-(x*c)) <= c) break;
            int first = c*x;
            int second = n-1-first;
            if (hasu.find(first) != hasu.end()) break;
            score += s[first];       
            hasu.insert(first);
            if (hasu.find(second) != hasu.end()) break;
            score += s[second];
            hasu.insert(second);
            max_score = max(max_score, score);
        }
        
    }
    
    cout << max_score << endl;
}



Measured memory_bytes: 7416
W, H, N = map(int, input().split())
a1, a2, a3, a4 = 0, W, 0, H
for i in range(N):
    x, y, a = map(int, input().split())
    if a == 1:
        a1 = max(a1,x)
    elif a == 2:
        a2 = min(a2,x)
    elif a == 3:
        a3 = max(a3, y)
    else:
        a4 = min(a4, y)
if a1>=a2 or a3>=a4:
    print(0)
else:
    print((a2-a1)*(a4-a3))



Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define ull unsigned long long
#define vi vector<ll>
#define vvi vector<vi>
#define DBG_N(hoge) cerr<<" "<<(hoge)<<endl;
#define DBG cerr<<"!"<<endl;
#define BITLE(n) (1LL<<((ll)n))
#define BITCNT(n) (__builtin_popcountll(n))
#define SUBS(s,f,t) ((s).substr((f)-1,(t)-(f)+1))
#define ALL(a) (a).begin(),(a).end()
using namespace std;
struct edge{
  ll from,to,cost;
  bool operator < (const edge &HOGE)const{return cost<HOGE.cost;};
};
struct UF
{
  vector<int> par;
  vector<int> sz;
  vector<int> rank;
  UF(int n):par(n),sz(n),rank(n){
    for(int i = 0; i < n; i++){
      par[i] = i;sz[i] = 1;rank[i] = 0;
    }
  }
  int find(int x) {
    if (par[x] == x) return x;
    else return par[x] = find(par[x]);
  }
  void merge(int x, int y) {
    x = find(x); y = find(y);
    if (x == y) return;
    if(rank[x] < rank[y]){
      par[x] = y;
      sz[y] += sz[x];
    }
    else{
      par[y] = x;
      sz[x] += sz[y];
      if(rank[x] == rank[y])rank[x]++;
    }
  }
  bool same(int x, int y) { return find(x) == find(y); }
  int size(int n){return sz[find(n)];}
};

ll n,m;
vector<edge>E;
vi po;
ll kruskal(int hoge){
  UF uf(n);
  ll ret = 0;
  ll cnt=0;
  for(int i=0;i<m;i++){
    if(hoge == i)continue;
    if(uf.same(E[i].from,E[i].to))continue;
    uf.merge(E[i].from,E[i].to);
    if(hoge == -1)
      po.pb(i);
    ret+=E[i].cost;
    cnt++;
  }

  if(cnt != n-1)return llINF;
  return ret;
}
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin>>n>>m;
  for(int i=0;i<m;i++){
    ll from,to,cost;
    cin>>from>>to>>cost;
    E.pb({from-1,to-1,cost});
  }
  sort(ALL(E));
  ll c = kruskal(-1);
  ll ans=0;
  ll anscnt=0;
  for(int i=0;i<po.size();i++){
    if(c!=kruskal(po[i])){anscnt++;ans+=E[po[i]].cost;}
  }
  cout<<anscnt<<" "<<ans<<endl;
  return 0;
}



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

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

#define roop(i, n) for(int i = 0;i < n;i++)

int main(void){

    int n;
    cin >> n;
    printf("%.10lf", 2*n*acos(-1));

    return 0;
}


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

typedef double du ;
typedef string st ;
typedef long long ll ;
typedef long double ld ;
typedef long long int lli ;

#define vi vector <lli>
#define loop(num) for (lli i = 0 ; i < num ; i ++ )
#define loopcin(num , ar ) for (lli i = 0 ; i < num ; i ++ ) {cin >> ar [i] ;}
#define loopcout(num , ar) for (lli i = 0 ; i < num ; i ++ ) {cout << ar [i] << ' '; }

#define forr(num1 , num2) for (lli i = num1 ; i < num2 ; i ++ )
#define forrcin(num1 , num2 , ar ) for (lli i = num1 ; i < num2 ; i ++ ) {cin >> ar [i] ;}
#define forrcout(num1 , num2 , ar) for (lli i = num1 ; i < num2 ; i ++ ) {cout << ar [i] << ' '; }

#define D2forrcin(num1_1 , num1_2 , num2_1 , num2_2 , A ) for (lli i = num1_1 ; i < num1_2 ; i ++){ for (lli j = num2_1 ; j < num2_2 ; j++){cin >> A[i][j] ;}}
#define D2forrcout(num1_1 , num1_2 , num2_1 , num2_2 , A ) for (lli i = num1_1 ; i < num1_2 ; i ++){ for (lli j = num2_1 ; j < num2_2 ; j++){cout << A[i][j] << ' ' ;}cout << endl ;}

#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl

#define F first
#define S second

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

int main ()
{
    fastio
    lli num1 , num2 , num3 , d ;
    cin >> num1 >> num2 >> num3 >> d ;
    (abs(num3 - num1) <= d || ( abs(num1 - num2) <= d && abs (num2 - num3) <= d) ? Yes : No) ;
    return 0 ;
}

/*___________________________________________________________________functions___________________________________________________________________________*/



Measured memory_bytes: 256