akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <cmath>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <cassert>
#include <functional>

using namespace std;

#define LOG(...) printf(__VA_ARGS__)
//#define LOG(...)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())
#define CLR(a) memset((a), 0 ,sizeof(a))

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

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

struct UnionFind {
	vector<int> v;
	UnionFind(int n) : v(n)  { for (int i = 0; i < n; i++) v[i] = i; }
	int  find(int x)         { return v[x] == x ? x : v[x] = find(v[x]); }
	void unite(int x, int y) { v[find(x)] = find(y); }
};

int main() {
	bool pb[50001] = { false };
	vi prime;
	FOR(i, 2, 50001) {
		if (!pb[i]) {
			prime.push_back(i);
			for (int j = i * 2;j < 50001;j += i) {
				pb[j] = true;
			}
		}
	}
	int n, a, b;
	while (cin >> n >> a >> b,n) {
		int p=2, q=2;
		REP(i,prime.size()) {
			if(prime[i]* prime[i] <=n)
			FOR(j,i, prime.size()) {
				if (prime[i] * prime[j] <= n && p*q<prime[i] * prime[j] && a*prime[j] <= prime[i] * b) {
					p = prime[i];
					q = prime[j];
				}
				if (prime[i] * prime[j] > n)
					break;
			}
		}
		cout << p << " " << q << endl;
	}
}

Measured memory_bytes: 3184
//I have to work harder than anyone else to make it! I’ll never catch up otherwise…
//Don’t worry about what other people think. Hold your head up high and plunge forward.

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

#define P pair<int,int>
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define str std::string 
#define pb push_back
#define itrt(yo) for(auto x:yo){std::cout<<x<<nl;} 
#define vec(x) std::vector<x> 
#define nl '\n'
#define F first
#define S second
#define ll long long int
#define ALL(x) x.begin(),x.end() 
#define BN(x) x.begin()
#define ED(x) x.end()
#define MAP_traverse(it,x)  for(auto it = BN(x); it!= ED(x); it++)
#define PI 3.14159265358979323846264338327950L
const unsigned int M = 1000000007;




int main()
{
	str a,b;
	cin>>a>>b;

	ll ans=0;
	for (int i = 0; i < a.length(); i++)
	{
		if (a[i]!=b[i])
		{
			ans++;
		}
		
	}
	cout<<ans;
	
	
}



Measured memory_bytes: 3900
#include<cstdio>
#include<cmath>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<vector>
#define ll long long
#define mt(a) memset(a,0,sizeof(a))
#define MAXI 2000000000
#define PAI pair<int,int>

using namespace std;

ll  f[200009],w[200009],v[200009];
int main()
{
	int n, m;
	scanf("%d%d", &n, &m);
	for (int i = 1; i <= n; i++)
		scanf("%lld%lld", &w[i],&v[i]);

	for (int i = 1; i <= n; i++)
	{
		for (int c = m; c >= 0; c--)
		{
			if (c >= w[i])
				f[c] = max(f[c], f[c - w[i]] + v[i]);
		}
	}
	ll maxx = -MAXI;
	for (int i = 0; i <= m; i++)
		if (f[i] > maxx) maxx = f[i];
	printf("%lld\n", maxx);
	return 0;
}

Measured memory_bytes: 2304
#include <cstdlib>
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define MAX 100005
#define pb push_back
const double PI  =3.141592653589793238463;
long long MOD = 1000000007;

int main()
{
  int n;
  cin>>n;
  int arr[n-1];
  int brr[n];
  for(int i=0;i<n-1;i++) cin>>arr[i];
  brr[0]=brr[1]=arr[0];
  for(int i=1;i<n-1;i++) {
      brr[i]=min(arr[i],brr[i]);
      brr[i+1]=arr[i];
  }
  long long ans=0;
  for(int i:brr) ans+=i;
  cout<<ans<<endl;
  
}

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

#define ll long long
#define mod 1000000007
#define ffor(i,a,b) for(int i=a;i<b;i++)
#define bfor(i,a,b) for(int i=a-1;i>=b;i--)
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define mem(x,y) memset(x,y,sizeof(x))
#define all(x) x.begin(),x.end()
#define SP(x) setprecision(x)
#define sz(x) (int)x.size()
#define fast  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define PI 3.14159265358979323846
#define lb lower_bound
#define ub upper_bound
#define bs binary_search
#define endl '\n'

ll power(ll x,ll y,int p) 
{ 
    ll res=1;   
    x=x%p;  
    while (y > 0) 
    { 
        if (y & 1)  res = (res*x) % p;   
        y = y>>1; 
        x = (x*x) % p;   
    } 
    return res; 
}

int main()
{
    

    ll n,k;
    cin>>n>>k;
    ll dp[k+1];
    ll ans=0;
    bfor(i,k+1,1)
    {
        dp[i]=power(k/i,n,mod);
        for(int j=2*i;j<=k;j+=i)
        {
            dp[i]=(dp[i]-dp[j]+mod)%mod;
        }
        ans=(ans+dp[i]*i%mod)%mod;
    }    
    cout<<ans;
    
    return 0;
}



Measured memory_bytes: 4400
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		var di = new Dictionary<String, long>();
		for(int i=0;i<N;i++){
			var ca = S[i].ToCharArray();
			Array.Sort(ca);
			var s0 = new String(ca);
			if(di.ContainsKey(s0) == false) di.Add(s0, 0);
			di[s0]++;
		}
		
		long ans = 0;
		foreach(var s in di.Keys){
			ans += di[s] * (di[s] - 1) / 2;
		}
		Console.WriteLine(ans);
		
		
		
	}
	int N;
	String[] S;
	public Sol(){
		N = ri();
		S = new String[N];
		for(int i=0;i<N;i++) S[i] = rs();
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


Measured memory_bytes: 31700
program shiritori
  implicit none
  integer :: n, i, j
  character(10) :: w(100)
  read(*,*) n
  do i = 1, n
    read(*,*) w(i)
    do j = 1, i-1
      if (w(j) == w(i)) then
        write(*,'(a)') "No"
        stop
      end if
    end do
  end do
  do i = 2, n
    if (w(i)(1:1) == w(i-1)(len_trim(w(i-1)):len_trim(w(i-1)))) cycle
    write(*,'(a)') "No"
    stop
  end do
  write(*,'(a)') "Yes"
end program shiritori

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

typedef long long ll;
typedef long double ld;

typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<ld, ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define F0R(i, a) for (int i = 0; i < (a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= (a); i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define trav(a, x) for (auto& a : x)
#define deb(x)     cout << #x << " = "<<x<<endl

#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound

#define sz(x) (int)x.size()
#define beg(x) x.begin()
#define en(x) x.end()
#define all(x) beg(x), en(x)

int MOD = 1000000007; // 998244353
const ll INF = 1e18;
const int MX = 200005;


ll gcd(ll  a , ll b) {
	return (b == 0) ? a : gcd(b, a % b);
}
ll binpow(ll a, ll b) {
	ll res = 1;
	while (b > 0) {
		if (b & 1)
			res = res * a;
		a = a * a;
		b >>= 1;
	}
	return res;
}
ll powmod(ll a, ll b, ll m) {
	a %= m;
	ll res = 1;
	while (b > 0) {
		if (b & 1)
			res = res * a % m;
		a = a * a % m;
		b >>= 1;
	}
	return res;
}
ll modinv(ll n, ll p)
{
	return powmod(n, MOD - 2, MOD);
}
void max_self(ll &a, ll b) {
	a = max(a, b);
}
bool is_ap(vl v, int n) {
	ll d = v[1] - v[0];
	F0R(i, n) {
		if (v[i] != v[0] + i * d)
			return false;
	}
	return true;
}


int main(int argc, char const *argv[])
{
	// two magical lines to speed up IO
	cin.tie(0);
	ios_base::sync_with_stdio(false);
#ifndef ONLINE_JUDGE
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
#endif
	ll N, K;
	cin >> N >> K;
	ll ans = N % K;
	cout << min(ans, abs(ans - K)) << endl;

}




Measured memory_bytes: 3612
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

s = readline().rstrip().decode()
t = readline().rstrip().decode()
s_size = len(s)
t_size = len(t)
dp = [[0] * (t_size + 1) for _ in range(s_size + 1)]
ans = ''
for i in range(s_size):
    for j in range(t_size):
        if s[i] == t[j]:
            if dp[i + 1][j + 1] < dp[i][j] + 1:
                dp[i + 1][j + 1] = dp[i][j] + 1
        dp[i + 1][j + 1] = max(dp[i + 1][j + 1], dp[i + 1][j], dp[i][j + 1])
while s_size > 0 and t_size > 0:
    if dp[s_size][t_size] == dp[s_size - 1][t_size]:
        s_size -= 1
    elif dp[s_size][t_size] == dp[s_size][t_size - 1]:
        t_size -= 1
    else:
        ans = s[s_size - 1] + ans
        s_size -= 1
        t_size -= 1
print(ans)


Measured memory_bytes: 112988
import sys
input=lambda: sys.stdin.readline().rstrip()
n=int(input())
A=[int(i) for i in input().split()]
import collections
D=collections.defaultdict(int)
for a in A:
  D[a]+=1
tot=0
for d in D.keys():
  if D[d]>=2:
    tot+=D[d]*(D[d]-1)//2
for a in A:
  ans=tot-D[a]*(D[a]-1)//2+(D[a]-1)*(D[a]-2)//2
  print(ans)

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

int main() {
	string n;
	int num=0;
	cin >> n;
	for(int i=0;i<n.size();i++){
		num = num + n[i] - 39;
		num %= 9;
		//cout << "i=" << i << ",n[i]=" << n[i] <<",num" << num << endl;
	}
	if(num==0){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
}

Measured memory_bytes: 3712
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define downque(que) priority_queue<ll> que;
#define upque(que) priority_queue<ll, vector<int>, greater<int>> que;
typedef long long ll;
typedef vector<vector<int>> Matrix;
const int MOD = 1e9 + 7;
const int MAX = 1e7;
const int INF = numeric_limits<int>::max();



int main(){

  int n; cin>>n;
  int res = 0;
  int a = 0, b = 0;
  downque(que);
  REP(i,n){
    int q;
    cin >> q;
    que.push(q);
    
  }
  
  while(!que.empty())
  {
    a+=que.top();
    que.pop();
    if(que.empty())
      break;
    b += que.top();
    que.pop();
  }

  res = a - b;
  cout << res << endl;
}


Measured memory_bytes: 256
#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>
using namespace std;

#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define all(v) begin(v), end(v)
#define pb(a) push_back(a)
#define fr first
#define sc second
#define INF 2000000000
#define int long long int

#define X real()
#define Y imag()
#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) ( EQ((a).X, (b).X) && EQ((a).Y, (b).Y) )
#define LE(n, m) ((n) < (m) + EPS)
#define LEQ(n, m) ((n) <= (m) + EPS)
#define GE(n, m) ((n) + EPS > (m))
#define GEQ(n, m) ((n) + EPS >= (m))

typedef vector<int> VI;
typedef vector<VI> MAT;
typedef pair<int, int> pii;
typedef long long ll;

typedef complex<double> P;
typedef pair<P, P> L;
typedef pair<P, double> C;

int dx[]={1, -1, 0, 0};
int dy[]={0, 0, 1, -1};
int const MOD = 1000000007;
ll mod_pow(ll x, ll n) {return (!n)?1:(mod_pow((x*x)%MOD,n/2)*((n&1)?x:1))%MOD;}
int madd(int a, int b) {return (a + b) % MOD;}
int msub(int a, int b) {return (a - b + MOD) % MOD;}
int mmul(int a, int b) {return (a * b) % MOD;}
int minv(int a) {return mod_pow(a, MOD-2);}
int mdiv(int a, int b) {return mmul(a, minv(b));}

namespace std {
    bool operator<(const P& a, const P& b) {
        return a.X != b.X ? a.X < b.X : a.Y < b.Y;
    }
}

int calc(int a, int b) {
    int d = a - b;
    return d * d;
}

int n, m;
int c[20], x[20010], y[20010];
int dp[20010][300];
signed main() {
    while(cin >> n >> m, n || m) {
        repq(i,1,m) cin >> c[i];
        repq(i,1,n) cin >> x[i];
        rep(i,0,20010) rep(j,0,300) dp[i][j] = INF;
        dp[0][128] = 0;

        int ans = INF;
        repq(i,1,n) repq(j,0,255) {
            repq(k,1,m) {
                int y = min((ll)255, max((ll)0, j + c[k]));
                dp[i][y] = min(dp[i][y], dp[i-1][j] + calc(x[i], y));
                if(i == n) ans = min(ans, dp[i][y]);
            }
        }
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 50044
#include <bits/stdc++.h>
#define rep(i, a) for(int i = 0; i < a; i++)
#define all(v) v.begin(), v.end()
#define dcout cout << fixed << setprecision(15)
#define arep(i, a) for(auto i : a)
#define F first
#define S second
#define VE vector<int>
#define pb(x) push_back(x)
#define MOD 1000000007
#define INF 10000000000
#define int long long
#define KETA(n) floor(log10(n) + 1)
using namespace std;
signed main() {
    int a, b;
    cin >> a >> b;
    cout << (a - 1) * (b - 1) << endl;
    return 0;
}

Measured memory_bytes: 256
function Main(input) {
  input = input.split("\n")[0].split(" ");
  var a = parseInt(input[0]);
  var b = parseInt(input[1]);
  var c = parseInt(input[2]);
  var arr = [];
  for(var i = parseInt(Math.max(a, b)); i >= 1;  i--) {
    if(a % i === 0 && b % i === 0) {
      arr.push(i);
    }
  }
  console.log(arr[c - 1]);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 21192
s = gets.chomp
ans = 0
len = s.length
modCount = Array.new(2019,0)
bit = 1
sum = 0
len.times do |i|
  sum += s[len-1-i].to_i * bit
  sum %= 2019
  bit = bit * 10 % 2019
  modCount[sum] += 1
end
2019.times do |i|
  ans += modCount[i] * (modCount[i]-1) / 2
end
puts ans + modCount[0]

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

int main() {
	int a[5], wait, temp, max;
	for (int i = 0; i < 5; i++) scanf("%d", &a[i]);
	max = 0;
	wait = 0;
	for (int i = 0; i < 5; i++) {
		temp = a[i] % 10;
		if (temp != 0) temp = 10 - temp;
		if (max < temp) max = temp;
		wait += a[i] + temp;
	}
	printf("%d", wait - max);
	return 0;
}

Measured memory_bytes: 128
function isprime(x)
    if x<=1
        return false
    elseif x==2
        return true
    end

    rootx = ceil(sqrt(x))
    for i =2:rootx
        if x%i==0
            return false
        end
    end
    return true
end

x1 = parse(Int64, readline())
# println(x1)
p = x1
# println(p)

while (!isprime(p))
    global p += 1
end
println(p)


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


int main(void)
{
  int num;
  cin >> num;
  string cards[2][num];
  int totala = 0;
  int totalb = 0;
  for(int i = 0; i < num; i++)
  {
    cin >> cards[0][i] >>cards[1][i];
    if(cards[0][i] == cards[1][i])
    {
      totala++;
      totalb++;
    }else if (cards[0][i] > cards[1][i])
    {
      totala += 3;
    }else if (cards[0][i] < cards[1][i])
    {
      totalb += 3;
    }
  }
  cout << totala << " " << totalb << endl;
}


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

int main() {
    string abc = "abcdefghijklmnopqrstuvwxyz";
    char x;
    cin >> x;
    int pos = 0;
    if (x != 'z') {
        while (x != abc[pos]) {
            ++pos;
        }
        cout << abc[pos+1];
    }
    return 0;
}


Measured memory_bytes: 256
/*
A
https://atcoder.jp/contests/abc137/tasks/abc137_a
*/
#include<bits/stdc++.h>
#include<iostream>
using namespace std;
int main(){
int A,B;
cin>>A>>B;
int result = max(A+B,max(A-B,A*B));
cout<<result<<endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define x first
#define y second
#define ll long long
#define pi pair<int,int>
#define pl pair<ll,ll>
#define pd pair<double,double>
#define ld long double
#define pld pair<ld,ld>
#define lg length()
#define sz size()
#define vi vector<int>
#define vl vector<ll>
#define vp vector<pi>
#define vpl vector<pl>
#define pb push_back
#define INF 1000000005
#define LINF 1000000000000000005

int h,w,v[405][405];

ll ans,x,y;

char a[405][405];

void DFS(int i, int j){
	if(v[i][j]) return;
	v[i][j]=1;
	//cout << i << ' ' << j << '\n';
	if(a[i][j]=='.') x++;
	else y++;
	if(i>1 && a[i-1][j]!=a[i][j]) DFS(i-1,j);
	if(j>1 && a[i][j-1]!=a[i][j]) DFS(i,j-1);
	if(i<h && a[i+1][j]!=a[i][j]) DFS(i+1,j);
	if(j<w && a[i][j+1]!=a[i][j]) DFS(i,j+1);
}

int32_t main(){
	ios_base :: sync_with_stdio(0); cin.tie(); cout.tie();
#ifdef LOCAL_DEFINE
	ifstream cin("input.in");
#endif
	
	cin >> h >> w;
	for(int i=1;i<=h;i++){
		for(int j=1;j<=w;j++){
			cin >> a[i][j];
		}
	}
	for(int i=1;i<=h;i++){
		for(int j=1;j<=w;j++){
			if(!v[i][j]){
				x=0;y=0;
				DFS(i,j);
				ans+=x*y;
			//	cout << '\n';
			}
		}
	}
	cout << ans;
	
#ifdef LOCAL_DEFINE
	cerr << "\nTime elapsed: " << 1.0*clock()/CLOCKS_PER_SEC << " \n";
#endif
}


Measured memory_bytes: 11008
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author champon
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define inf 9e18
#define ceill(a, b) (a+b-1)/b
#define ok cout << "ok" << endl;
#define sp << " " <<
ll mod = 1e9+7;
void ans(bool b, ostream& out=cout){ out << (b ? "Yes" : "No") << endl; }
void ans2(bool b, ostream& out=cout){ out << (b ? "YES" : "NO") << endl; }
template<typename T> inline bool chmax(T &a, T b){ if(a<b){a=b; return true;} return false; }
template<typename T> inline bool chmin(T &a, T b){ if(b<a){a=b; return true;} return false; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val){fill((T*)array, (T*)(array+N), val);}
int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy[] = {0, 1, 0, -1, 1, -1, -1, 1};

#ifndef INCLUDE_DEBUG_HPP
#define INCLUDE_DEBUG_HPP

class debug
{
public:
    template<typename T> void vdeb(T vec);
    template<typename T1, typename T2> void adeb(T1 *arr, T2 n);
    template<typename T> void mdeb(T mp);
};

#endif //INCLUDE_DEBUG_HPP

template<typename T> void debug::vdeb(T vec)
{
    cout << "#vector set debug" << endl;
    for(auto vv : vec) cout << vv << " ";
    cout << endl;
}

template<typename T1, typename T2> void debug::adeb(T1 *arr, T2 n)
{
    cout << "#adebug" << endl;
    for(int i=0; i<=n; i++) cout << arr[i] << " ";
    cout << endl;
}

template<typename T> void debug::mdeb(T mp)
{
    cout << "#map pair debug" << endl;
    for(auto const& m : mp) cout << m.first sp m.second << endl;
}
debug dbg;

class ANChildrenAndCandiesABCEdit {
public:
	void solve(std::istream& in, std::ostream& out)
	{
	    int n;
	    in >> n;
	    out << n*(n+1) / 2 << endl;
	}
};


int main() {
	ANChildrenAndCandiesABCEdit solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


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

#define st first
#define nd second
#define mp make_pair
#define pb push_back
#define cl(x, v) memset((x), (v), sizeof(x))
#define db(x) cerr << #x << " == " << x << endl
#define dbs(x) cerr << x << endl
#define _ << ", " <<
#define gcd(x, y) __gcd((x), (y))

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<int, pii> piii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<vi> vii;

const ld EPS = 1e-9, PI = acos(-1.);
const ll LINF = 0x3f3f3f3f3f3f3f3f, LMOD = 1011112131415161719ll;
const int INF = 0x3f3f3f3f, MOD = 1e9+7;
const int N = 1e5+5;

ll n, a[N][3], dp[N][3];

int main () {
    scanf("%lld", &n);
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= 3; j++) scanf("%lld", &a[i][j]);
        dp[i][1] = a[i][1] + max(dp[i-1][2], dp[i-1][3]);
        dp[i][2] = a[i][2] + max(dp[i-1][1], dp[i-1][3]);
        dp[i][3] = a[i][3] + max(dp[i-1][1], dp[i-1][2]);
    }
    printf("%lld\n", max(dp[n][1], max(dp[n][2], dp[n][3])));
    return 0;
}


Measured memory_bytes: 4992
#include<bits/stdc++.h>
#define ll long long
#define fi first
#define se second
using namespace std;
typedef pair<ll,ll> pll;
const int inf=0x3f3f3f3f;
const int mod=1e9+7;
void A() {
    int n;
    cin>>n;
    int res=max(0,(n+999)/1000*1000-n);
    cout<<res<<endl;
}
void B() {
    int n;
    cin>>n;
    unordered_map<string,int>cnt;
    cnt["AC"]=0;
    cnt["WA"]=0;
    cnt["RE"]=0;
    cnt["TLE"]=0;
    for(int i=0;i<n;i++){
        string s;
        cin>>s;
        cnt[s]++;
    }
    cout<<"AC x "<<cnt["AC"]<<endl;
    cout<<"WA x "<<cnt["WA"]<<endl;
    cout<<"TLE x "<<cnt["TLE"]<<endl;
    cout<<"RE x "<<cnt["RE"]<<endl;
}
void C() {

}
void D() {

}
void E(){

}
void F()
{

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


Measured memory_bytes: 3668
#include<cstdio>
#include<iostream>

using namespace std;

long long a, b;
int gcd, lcm;

void GCD(){

	int big, small;

	big = a;
	small = b;

	while (big) {
		if (small > big) swap(big, small);
		big = big % small;
	}
	gcd = small;

}

void LCM() {
	lcm = a * b / gcd;
}




int main(){
	while (cin >> a >> b) {

		GCD();
		LCM();
		cout << gcd << " " << lcm << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#include "bits/stdc++.h"
using namespace std;

typedef long long ll;

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

    string s;cin>>s;
    int res=0;
    int gu=0,pa=0;
    for(int i=0;i<(int)s.length();i++){
        if(s[i]=='g'){
            if(gu>pa){
                pa++;
                res++;
            }
            else{
                gu++;
            }
        }
        else{
            if(gu>pa){
                pa++;
            }
            else{
                gu++;
                res--;
            }
        }
    }
    cout<<res<<endl;
}


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

int a[110];
int num[110] = {0};

int main() {
    int n, count = 0;
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        num[a[i]]++;
    }
    for (int i = 0; i < 110; i++)
        if (num[i] > 0) count++;
    cout << count << endl;
}


Measured memory_bytes: 256
n = int(input())

def prime(n):
    ret = True
    for i in range(1, int(n**0.5) + 1):
        if i != 1 and n % i == 0:
            ret = False
            break
    return ret

def factors(p, n):
    a = p
    ret = 0
    while p <= n:
        ret += n // p
        p *= a
    return ret

ans = 1
for i in range(2, n+1):
    if prime(i):
        ans = ans * (factors(i, n) + 1) % (10**9 + 7)
print(ans)



Measured memory_bytes: 3188
import java.util.*;
import java.lang.*;
import java.io.*;

public class Main {
    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

    public static void main(String args[]) throws IOException {
        FastReader s = new FastReader();
        int x = s.nextInt();
        int a = s.nextInt();
        int b = s.nextInt();
        System.out.println((x - a)%b);
    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
}


Measured memory_bytes: 21076
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        int ans = A - B * 2;
        if (ans < 0) ans = 0;
        System.out.println(ans);
    }
}


Measured memory_bytes: 21844
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int K = sc.nextInt();

		if (N < K) {
			System.out.println(1);
		} else if (N % K != 0) {
			System.out.println(1);
		} else {
			System.out.println(0);
		}
	}
}


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

int main(){
  int n; cin>>n;
  vector<ll> a(n),b(n);
  rep(i,n){
    cin>>a[i];
  }
  rep(i,n){
    cin>>b[i];
  }
  ll a_cnt=0, b_cnt=0;
  rep(i,n){
    if(a[i]<b[i]){
      a_cnt+=((b[i]-a[i]+1)/2);
      if((b[i]-a[i])%2!=0) b_cnt++;
    }
    if(a[i]>b[i]) b_cnt+=a[i]-b[i];
  } 
  if(a_cnt>=b_cnt) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}



Measured memory_bytes: 3784
from collections import defaultdict
def solve():
    N, M = map(int,input().split())
    H = list(map(int,input().split()))
    g = defaultdict(list)
    for i in range(M):
        a, b = map(lambda x:int(x)-1, input().split())
        g[a].append(b)
        g[b].append(a)
    
    ans = 0
    for i in range(N):
        nowH = H[i]
        connectedPlace = g[i]
        connectedH = []
        for p in connectedPlace:
            connectedH.append(H[p])
        
        if len(connectedH) == 0 or nowH > max(connectedH):
            ans += 1
    
    print(ans)

if __name__ == '__main__':
    solve()

Measured memory_bytes: 106164
#include <iostream>
#include <vector>
#include <cstring>
#include <algorithm>
#include <cassert>
#include <deque>
#include <map>
#include <queue>
#include <climits>
#include <set>
#include <stack>
#include <cmath>
#include <unordered_map>

using namespace std;

#define ll long long
#define MAX 100000
#define MAX1 10000
#define MAX2 100000
#define inf 1000000000
#define eps 1e-12
#define MOD 1000000007

int main() {

    ios_base::sync_with_stdio(0);
    cin.tie(0);
#ifndef ONLINE_JUDGE
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#endif

    int n, k, i, j;
    ll god = LLONG_MIN;
    cin >> n >> k;
    int p[n + 5], c[n + 5];
    for (i = 1; i <= n; ++i) {
        cin >> p[i];
    }
    for (i = 1; i <= n; ++i) {
        cin >> c[i];
    }
    for (i = 1; i <= n; ++i) {
        vector<int> a;
        vector<bool> vis(n + 5, false);
        int curr = i;
        while (!vis[curr]) {
            vis[curr] = true;
            a.push_back(c[curr]);
            curr = p[curr];
        }
        ll sum = 0, ans = LLONG_MIN;
        int m = a.size();
        for (j = 0; j < min(k, m); ++j) {
            sum += a[j];
            ans = max(ans, sum);
        }
        if (sum >= 0 and k > m) {
            int kk = k / m;
            sum = sum * (kk - 1);
            ans = max(ans, sum);
            kk = k % m;
            for (j = 0; j < m + kk; ++j) {
                sum += a[j % m];
                ans = max(ans, sum);
            }
        }
        god = max(god, ans);
    }
    cout << god;

    return 0;
}


Measured memory_bytes: 3748
import sys
input = sys.stdin.buffer.readline
H, N = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(N)]
dp = [10**9] * (H + 1)
dp[0] = 0
for i in range(H + 1):
    for a, b in ab:
        if i - a < 0:
            dp[i] = min(dp[i], b)
        else:
            dp[i] = min(dp[i], dp[i - a] + b)
print(dp[H])


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

int main(){
string A,B,C;
  cin >> A >> B >> C;
  int D = A.size() - 1;
  int E = B.size() - 1;
  int F = C.size() - 1;
  if(A[D] == B[0] && B[E] == C[0]){
cout << "YES" << endl;
  }
else{
cout << "NO" << endl;
}
}


Measured memory_bytes: 3628
#include<iostream>
#include<cstring>
#include<queue>
#include<map>
using namespace std;
int I,J,x,y,mas[110][110]={{0}};
int dy[6]={-1,-1, 0, 0, 1, 1};
int dx_k[6]={ 0, 1,-1, 1, 0, 1};
int dx_g[6]={-1, 0,-1, 1,-1, 0};
int d[110][110];
int wall=0;
long long int wall_len=0;
typedef pair<int,int>P;
int bfs();
int wall_reck(int,int);
int main(){
  cin >> x >> y;

  for(int i=0;i<y+2;i++){
    for(int j=0;j<x+2;j++){
      mas[i][j]=0;
    }
  }

  for(int i=1;i<y+1;i++){
    for(int j=1;j<x+1;j++){
      cin >> mas[i][j];
    }
  }
 
  for(int i=0;i<y+2;i++){
    for(int j=0;j<x+2;j++){
      if(mas[i][j]==0){
    if(i==0 || j==0 || i==y+1 || j==x+1){
      wall_reck(i,j);
    }
    else{
      I=i;
      J=j;
      bfs();
      //帰ってきた値が1（つまり、抜けられた）、または範囲外（必ず１）なら、周り(六方)の壁の数を計算。
      if(wall == 1){
        wall=0;
        wall_reck(i,j);
      }
    }
      }
    }
  }
  cout << wall_len << endl;
}
 
int bfs(){
  queue<P>que;
  memset(d,-1,sizeof(d));
  que.push(P(I,J));
  d[I][J] = 0;
  while(!que.empty()){
    P p = que.front();
    que.pop();
    //外につながったか。
    if(p.first==0 || p.second==0 || p.first==y+1 || p.second==x+1){
      wall=1;
      break;
    }
    for(int i=0;i<6;i++){
      int ny,nx;
    ny=p.first+dy[i];
      if(!(p.first&1)){
    nx=p.second+dx_g[i];
      }
      else{
    nx=p.second+dx_k[i];
      }
      if(mas[ny][nx]==0 && d[ny][nx]==-1){
    que.push(P(ny,nx));
    d[ny][nx]=d[p.first][p.second]+1;
      }
    }
 
  }
}
 
int wall_reck(int i,int j){
  for(int k=0;k<6;k++){
    if(!(i&1)){
      if(mas[i+dy[k]][j+dx_g[k]]==1){
    wall_len++;
      }
    }
    else{
      if(mas[i+dy[k]][j+dx_k[k]]==1){
    wall_len++;
      }
    }
 
  }
}

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

int f(int n){
  int ans = 0;
  while(n > 0){
    ans++;
    n -= 10;
  }
  return ans;
}

int main(void){
  int a[5];
  int b[5];
  for(int i = 0; i < 5; i++) cin >> a[i];
  for(int i = 0; i < 5; i++) b[i] = i;
  int ans = 100000;
  do{
    int temp = 0;
    for(int i = 0; i < 4; i++){
      if(a[b[i]] % 10 == 0){
	temp += a[b[i]];
      }else{
	int t = f(a[b[i]]);
	temp += t * 10;
      }
    }
    temp += a[b[4]];
    ans = min(ans, temp);
  }while(next_permutation(b, b + 5));
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define EPS (1e-10)
#define equals(a,b) (fabs((a)-(b)) < EPS)
#define PI 3.141592653589793238
using namespace std;
#define int long long
struct Point{
  double x,y;
  Point(){}
  Point(double x,double y) :x(x),y(y){}
  Point operator + (Point p) {return Point(x+p.x,y+p.y);}
  Point operator - (Point p) {return Point(x-p.x,y-p.y);}
  Point operator * (double k) {return Point(x*k,y*k);}
  Point operator / (double k) {return Point(x/k,y/k);}
  double norm(){return x*x+y*y;}
  double abs(){return sqrt(norm());}

  bool operator < (const Point &p) const{
    return x!=p.x ? x < p.x : y < p.y;
  }

  bool operator == (const Point &p) const{
    return fabs(x-p.x) < EPS && fabs(y-p.y) < EPS;
  }
};

typedef Point Vector;
typedef vector<Point> Polygon;

istream &operator >> (istream &is,Point &p){
  is>>p.x>>p.y;
  return is;
}

Vector spin(Vector v,double theta){
  Vector res;
  res.x=cos(theta)*v.x-sin(theta)*v.y;
  res.y=sin(theta)*v.x+cos(theta)*v.y;
  return res;
}
void koch(int n,Point p1,Point p2,Polygon&p){
  if(n==0){
    p.push_back(p1);
    return;
  }
  Vector v=(p2-p1)/3;
  Point p3=p1+v;
  Point p4=p3+spin(v,60*PI/180);
  Point p5=p1+v*2;
  koch(n-1,p1,p3,p);
  koch(n-1,p3,p4,p);
  koch(n-1,p4,p5,p);
  koch(n-1,p5,p2,p);
}
signed main(){
  int n;
  cin>>n;
  Polygon p;
  koch(n,Point(0,0),Point(100,0),p);
  p.push_back(Point(100,0));
  for(int i=0;i<(int)p.size();i++)
    printf("%.12f %.12f\n",p[i].x,p[i].y);
  return 0;
}



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

#define all(v) (v).begin(), (v).end()
using namespace std;

struct store
{
    long long price, cans;

    store(){}

    const int operator<(const store &S)
    {
        return (price < S.price);
    }
};

int main()
{
    int no_of_stores, no_of_cans;
    cin >> no_of_stores >> no_of_cans;

    vector <store> S(no_of_stores);
    for(int i = 0; i < no_of_stores; i++)
        cin >> S[i].price >> S[i].cans;

    sort(all(S));

    long long total_price = 0, remaining_cans = no_of_cans;
    for(int i = 0; i < no_of_stores; i++)
    {
        long long cans_here = min(S[i].cans, remaining_cans);

        total_price += cans_here*S[i].price;

        remaining_cans -= cans_here; 
    }

    cout << total_price;
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
/*RMQ  update:O(logN)  query:O(lonN)*/
const int MAX_N = 1<<17;
int n,dat[2*MAX_N-1];

//?????????
void init(int n_){
  //????´???°n???2???????????????
  n=1;
  while(n<n_)n*=2;
  for(int i=0;i<2*n-1;i++)dat[i]=INT_MAX;
}

//[a,b)???????°????????±???????
//query(a,b,0,0,n)
void update(int a,int b,int x=-1,int k=0,int l=0,int r=n){
  if(r<=a||b<=l)return ;
  if(a<=l&&r<=b){
    if(x>=0)dat[k]=x;
    return;
  }
  
  if(dat[k]!=INT_MAX)dat[k*2+1]=dat[k*2+2]=dat[k];
  dat[k]=INT_MAX;
  update(a,b,x,k*2+1,l,(l+r)/2);
  update(a,b,x,k*2+2,(l+r)/2,r);
}
int main(){
  int q;
  cin>>n>>q;
  init(n);

  while(q--){
    int cmd;
    cin>>cmd;
    if(cmd==0){
      int s,t,x;
      cin>>s>>t>>x;
      update(s,t+1,x);
    }
    else {
      int idx;
      cin>>idx;
      update(idx,idx+1);
      cout <<dat[idx+n-1]<<endl;
    }
  }
  return 0;
}


Measured memory_bytes: 4124
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<set>
#include<map>

#define INF 1000000007
#define LINF 1000000000000000007

using namespace std;

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

Int gcd(Int x, Int y){
	if(y == 0)
		return x;
	return gcd(y, x % y);
}

Int lcm(Int x, Int y){
	return x * y / gcd(x, y);
}

int n, a[101];

int main(){
	cin >> n;
	int c = 0;
	bool b[8] = {0};
	for(int i = 0; i < n; i++){
		cin >> a[i];
		if(a[i] >= 3200) c++;
		else if(a[i] >= 2800) b[7] = 1;
		else if(a[i] >= 2400) b[6] = 1;
		else if(a[i] >= 2000) b[5] = 1;
		else if(a[i] >= 1600) b[4] = 1;
		else if(a[i] >= 1200) b[3] = 1;
		else if(a[i] >= 800) b[2] = 1;
		else if(a[i] >= 400) b[1] = 1;
		else b[0] = 1;
	}
	int ans = 0;
	for(int i = 0; i < 8; i++){
		if(b[i]) ans++;
	}
	if(ans == 0)
		cout << 1 << " " << n << endl;
	else
		cout << ans << " " << ans+c << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
const int INF = 1e9;
using LL = long long;
const LL LINF = 1e18;
const double EPS = 1e-10;
using namespace std;

#define SCIN(n) string(n);cin >> (n)
#define YES(n) cout<<((n)? "YES" : "NO")<<endl
#define Yes(n) cout<<((n)? "Yes" : "No")<<endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) <<endl

#define ALL(obj) (obj).begin(),(obj).end()

#define rt return
#define ENDL cout<<endl
#define s second
#define f first

typedef string::const_iterator State;
class PalseError {};
class Edge{
public:
    LL from,to,value;
    Edge(LL a,LL b,LL c){
        from = a;
        to = b;
        value = c;
    }
    Edge(LL a,LL b){
        from = a;
        to = b;
    }
};

int main(){
    LL N,W;
    cin >> N>> W;
    vector<vector<int>> vec(4);
    LL w,p;
    cin >> w >> p;
    vec.at(0).push_back(p);
    for(int a = 0;a < N-1;a++){
        LL b,c;cin >> b >> c;
        vec.at(b-w).push_back(c);
    }
    sort(vec.at(0).begin(),vec.at(0).end(), greater<LL>());
    sort(vec.at(1).begin(),vec.at(1).end(), greater<LL>());
    sort(vec.at(2).begin(),vec.at(2).end(), greater<LL>());
    sort(vec.at(3).begin(),vec.at(3).end(), greater<LL>());

    vector<vector<LL>> ruiseki(4, vector<LL>(1, 0));
    for(int a = 0;a < 4;a++){
      //  cout<<ruiseki.at(a).size()<<endl;
        for(int b = 0;b < vec.at(a).size();b++){
            ruiseki.at(a).push_back(ruiseki.at(a).back() + vec.at(a).at(b));
        }
        //cout<<"A"<<endl;
    }
    LL ans = 0;
    for(int a = 0;a < ruiseki.at(0).size();a++){
        for(int b = 0;b < ruiseki.at(1).size();b++){
            for(int c = 0;c < ruiseki.at(2).size();c++){
                LL uku = a*(w) + b*(w+1) + c*(w+2);
                if(uku > W){
                    continue;
                }
                LL q = W - uku;
                LL d = q/(w+3);
              //  cout<<a<<" "<<b<<" "<<c<<" "<<d<<endl;
                ans = max(ans, ruiseki.at(0).at(a)+ruiseki.at(1).at(b)+ruiseki.at(2).at(c)+ruiseki.at(3).at(min(d,(LL)ruiseki.at(3).size()-1)));
                //cout<<"A"<<endl;
            }
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#include <string.h>
int main(void){
  int n,i,j,one=0,zero=0;
  char s[101000];
  scanf("%s",s);
  n=strlen(s);
  for(i=0;i<n;i++){
    if(s[i]=='0') zero++;
    else one++;
  }
  int d=fmin(zero,one);
  if(n<3&&zero!=1) d=0;
  else if(n<3&&one!=1) d=0;
  printf("%d",d*2);
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N, K;
  cin >> N >> K;
  int arr[1000];
  for (int i = 0; i < N; ++i){
    scanf("%d", &arr[i]);
  }
  sort(arr, arr+N);
  int c = 0, ans = 0;
  while (c < K){
    ans += arr[c];
    c++;
  }
  cout << ans;
}


Measured memory_bytes: 3688
#include <iostream>
#include <vector>
#include <string>
#include <cstdlib>
using namespace std;
int n,m,a[16],b[16],p[16];

int main()
{
	cin>>n>>m;
	for (int i = 0; i < n; i++)
		cin>>a[i];
	for (int i = 0; i < m; i++)
		cin>>b[i];
	p[0]=b[0];
	for (int i = 1; i < m; i++)
		p[i]=p[i-1]+b[i];
	int ret=1<<10;
	for (int u = 0; u < 2; u++){
		int count=0;
		for (int i = 0; i < m; i+=2){
			count+=b[i];
		}
		for (int i = 0; i < n; i++){
			if(a[i]==u)count--;
		}
		if(count!=0)continue;

		int t=0,k=0;
		int score=0;
		for (int i = 0; i < m; i+=2){
			for (; k < n; k++){
				if(a[k]==u){
					score+=abs(k-t);
					t++;
					if(t==p[i]){
						k++;
						break;
					}
				}
			}
			if(t!=p[i])
			{
				score = 1<<10;
				break;
			}
			else t+=b[i+1];
		}
		if(t==p[m-1])
			ret=min(score,ret);
	}
	cout<<ret<<endl;

	return 0;
}


Measured memory_bytes: 1164
// Undone
using System;
using System.Linq;
using System.Collections.Generic;
using System.Collections;
public class Program {
  public static void Main() {
    int A = cin(), B = cin();
    int ans = Math.Max(A,B) + Math.Max(Math.Min(A,B), Math.Max(A,B)-1);
    Console.WriteLine(ans);
  }

  private static List<int> _var;
  public static int cin() { if (_var == null || _var.Count() == 0) { _var = Console.ReadLine().Split(' ').Select(int.Parse).ToList<int>(); } int ans = _var[0]; _var.RemoveAt(0); return ans; }
  public static void Swap<T>(ref T a, ref T b) {T temp = a;a = b;b = temp;}
  public static string ReadStr() { return Console.ReadLine(); }
  public static int ReadInt() { return int.Parse(Console.ReadLine()); }
  public static double ReadDouble() { return double.Parse(Console.ReadLine()); }
  public static long ReadLong() { return long.Parse(Console.ReadLine()); }
  public static char ReadChar() { return Console.ReadLine()[0]; }
  public static string[] ReadStringArray() { return Console.ReadLine().Split(' '); }
  public static int[] ReadIntArray() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
  public static double[] ReadDoubleArray() { return Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); }
  public static long[] ReadLongArray() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
  public static char[] ReadCharArray() { return Console.ReadLine().ToArray(); }
  public static string[] ReadCharStringArray() { return Console.ReadLine().ToCharArray().Select(c => c.ToString()).ToArray(); }
}


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

int main() {
	int n;
	bool p = false;
	
	cin>>n;
	for(int i=0; i<3; ++i){
		if(n%10 == 7)
			p = true;
		
		n /= 10;
	}
	
	if(p)
		cout<<"Yes\n";
	else
		cout<<"No\n";
		
	return 0;
}


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

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

const ll MOD = 1e9 + 7;
const ll inf = 1LL<<60;
const double eps = 1e-9;

const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
 
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; }

int main()
{
    ll n, a, b;
    cin >> n >> a >> b;

    ll ans = n/(a+b)*a + min(n - n/(a+b)*(a+b), a);

    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define INIT std::ios::sync_with_stdio(false);std::cin.tie(0);
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

using namespace std;

int main() {
  INIT;
  
  int x;
  cin >> x;// >>  b >> c >> d;

  if(x<1200){
    cout << "ABC" << endl;
  }else{
    cout << "ARC" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define err(args...) {}
#ifdef DEBUG
#include "_debug.cpp"
#endif
using namespace std;
using ll = long long;
using ld = long double;
template <typename T> using lim = numeric_limits<T>;
template <typename T> istream& operator>>(istream& is, vector<T>& a) { for(T& x : a) { is >> x; } return is; }
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n;
    while(cin >> n and n) {
        vector<int> x(n), y(n);
        set<pair<int, int>> pts;
        for(int i = 0; i < n; i++) {
            cin >> x[i] >> y[i];
            pts.insert({x[i], y[i]});        
        }
        int ans = 0;
        for(int i = 0; i < n; i++) {
            for(int j = i + 1; j < n; j++) {
                int dx = x[j] - x[i];
                int dy = y[j] - y[i];
                if(pts.count({x[i] - dy, y[i] + dx}) and pts.count({x[j] - dy, y[j] + dx})) {
                    ans = max(ans, dx * dx + dy * dy);
                }
            }
        }
        cout << ans << endl;
    }
    return 0;
}



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

l = [map(int, input().split()) for _ in range(N)]
di , dj = [list(u) for u in zip(*l)]

k = 3
for i in range(N):
  if di[i] == dj[i]:
    k -= 1
    if k == 0:
      print('Yes')
      break
  else:
    k = 3

if k != 0:
  print('No')
  

Measured memory_bytes: 9204
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <tuple>
#include <cassert>
using namespace std;

#define all(c) (c).begin(), (c).end()
#define iter(c) __typeof((c).begin())
#define cpresent(c, e) (find(all(c), (e)) != (c).end())
#define tr(c, i) for (iter(c) i = (c).begin(); i != (c).end(); ++i)
#define pb(e) push_back(e)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define mp(a,b) make_pair((a), (b))
#define mt(a,b,c) make_tuple((a),(b),(c))
#define DEBUGM(d,n,m,i,j) printf("DEBUGM :\n"); rep(i,n){ rep(j,m) if(inf==d[i][j]) printf("inf "); else printf("%d ", d[i][j]); printf("\n");} printf("DEBUGM END LINE\n")

typedef long long ll;

const ll INF =1LL << 62;
const int inf =1 << 29;

ll s[1005];

ll dfs(int cur,ll sc,vector<vector<pair<int,int> > > &g,vector<bool> &c){
    if(s[cur-1] >= sc){return -INF;} 
    else if(sc >= INF){s[cur-1]=INF;return INF;}
    else if(sc > s[cur-1]&&s[cur-1]!=-INF){return INF;}
    else{
    s[cur-1] = sc;
    rep(i,g[cur-1].size()){
        if(c[g[cur-1][i].first-1]){
            if(INF==dfs(g[cur-1][i].first, sc+g[cur-1][i].second,g,c)) return INF;
        }
    }
    }
    return 0;
}

void check(int cur, vector<vector<int> > &h,vector<bool> &c){
    if(!c[cur-1]){
        c[cur-1] = true;
        rep(i,h[cur-1].size()){
            check(h[cur-1][i],h,c);
        }
    }
}


int main(){
    int n,m;
    cin >> n >> m;
    vector<vector<pair<int,int> > > g(n);
    vector<vector<int>> h(n);
    rep(i,m){
        int a,b,c;
        cin >> a >> b >> c;
        g[a-1].push_back(mp(b,c));
        h[b-1].push_back(a);
    }
    vector<bool> c(n, (bool)false);
    check(n,h,c);
    rep(i,n+1) s[i]=-INF;
    if(INF==dfs(1,0,g,c)){printf("inf\n"); return 0;}
    ll ans = s[n-1];
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 384
def solve():
    N = int(input())
    A = list(map(int,input().split()))
    for B in A:
        if B % 2 == 0:
            if B % 3 != 0 and B % 5 != 0:
                print('DENIED')
                exit()
    print('APPROVED')


if __name__ == '__main__':
    solve()


Measured memory_bytes: 2940
import java.util.*;

class Main{
	public static void main(String[] $){
		System.err.println();
		Scanner s=new Scanner(System.in);

		ArrayList<ArrayList<Integer>> graph=new ArrayList<>();
		int n=s.nextInt(),m=s.nextInt();

		for(int i=0;i<n;++i)
			graph.add(new ArrayList<>(0));

		for(int i=0;i<m;++i){
			int f=s.nextInt()-1;
			int t=s.nextInt()-1;
			graph.get(f).add(t);
		}
		//graph.forEach(System.err::println);

		int f=s.nextInt()-1,t=s.nextInt()-1;

		boolean[][] used=new boolean[3][n];

		ArrayList<Integer> next=new ArrayList<>();
		ArrayList<Integer> nextnext=new ArrayList<>();
		next.add(f);
		for(int i=1;!next.isEmpty();++i){
			for(int kenken=0;kenken<3;++kenken){
				for(int p:next){
					for(int q:graph.get(p)){
						if(!used[kenken][q]){
							used[kenken][q]=true;
							nextnext.add(q);
						}
					}
				}
				next.clear();
				next.addAll(nextnext);
				nextnext.clear();
			}

			if(used[2][t]){
				System.out.println(i);
				return;
			}
		}
		System.out.println(-1);
	}
}

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

int main() {
    int a,b,c,x;
    cin>>a>>b>>c;
    x=a+b+c;
    if(a>=1 && a<=13 && b>=1 && b<=13 && c>=1 && c<=13){
        if(x>=22){
            cout<<"bust";
        }
        else{
            cout<<"win";
        }
    }
    return 0;
}



Measured memory_bytes: 256
n=int(input())
s=[input() for i in range(n)]
l=[0]*4
for i in range(n):
    if s[i]=="AC":
        l[0]+=1
    elif s[i]=="WA":
        l[1]+=1
    elif s[i]=="TLE":
        l[2]+=1
    elif s[i]=="RE":
        l[3]+=1
print("AC x",l[0])
print("WA x",l[1])
print("TLE x",l[2])
print("RE x",l[3])

Measured memory_bytes: 16240
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <iomanip>

using namespace std;

#ifdef DEBUG_MODE
	#define DBG(n) n;
#else
	#define DBG(n) ;
#endif

#define REP(i,n) for(ll (i) = (0); (i) < (n); ++i)
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define ALL(v) v.begin(),v.end()
#define INF 1100000000
#define LLINF 1000000000000000000LL
#define MOD 1000000007

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


int main()
{
  int A, B;
  cin >> A >> B;
  cout << A + (B / 2) << endl;
	return 0;
}



Measured memory_bytes: 256
use proconio::{input, fastout};

macro_rules! debug {
      ($($a:expr),*) => {
          eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
      }
  }

#[fastout]
fn main() {
    input!{
        a: usize,
        b: usize,
        c: usize,
    }

    println!("{}", a*b/2);

}


Measured memory_bytes: 2168