akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <string>
#include <queue>
#include <map>
#include <stack>
#include <vector>
#include <algorithm>
#include <set>
#include <deque>
#include <utility>
#include <chrono>
#include <sstream>
#include <iomanip>
#define INF 1 << 30
#define MOD 1000000007;
#define pi 3.14159265358979
#define rep(i, n) for (int (i) = 0; (i) < (int)(n); (i)++)
#define rer(i, l, r) for (int (i) = (int)(l); (i) <= (int)(r); (i)++)
#define reu(i, l, r) for (int (i) = (int)(l); (i) < (int)(r); (i)++)
#define D(x) cout << x << endl
#define d(x) cout << x
#define all(x) (x).begin(), (x).end()
#define pub(x) push_back(x)
#define pob() pop_back()
#define puf(x) push_front(x)
#define pof() pop_front()
#define mp(x, y) make_pair((x), (y))
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long long> vll;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef pair<long, long> pll;
template<typename T, typename U> inline void amin(T &x, U y) { if (y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if (x < y) x = y; }
static const int dx[] = {0, 0, 1, -1};
static const int dy[] = {-1, 1, 0, 0};

int main() { 
  int a, b;
  char op;
  cin >> a >> op >> b;
  if (op == '+') {
    D(a + b);
  } else {
    D(a - b);
  }
  return 0;
}



Measured memory_bytes: 256
#include <stdio.h>
int main() {
    int s, h, m, sec;
    scanf("%d", &s);

    h = s / 3600;
    m = (s - h * 3600) / 60;
    sec = s - (h * 3600 + m * 60);
    printf("%d:%d:%d\n", h, m, sec);

    return 0;
}


Measured memory_bytes: 2104
#include <algorithm>
#include <iostream>
#include <utility>
using namespace std;
typedef pair<int, int> P;

int main()
{
    int n;
    cin >> n;
    int a[100002];
    P p[100002];
    for(int i = 0; i < n; i++){
        cin >> a[i];
        p[i] = P(a[i], i);
    }
    sort(p, p + n);
    int ans = 0;
    for(int i = 0; i < n; i++) if(abs(i - p[i].second) % 2) ans++;
    cout << ans / 2 << endl;
}

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

int main() {
  int S, W;
  cin >> S >> W;
  if (S <= W) cout << "unsafe" << endl;
  else cout << "safe" << endl;
  return 0;
}

Measured memory_bytes: 3572
#include <stdio.h>
#include <iostream>
#include <math.h>
#include <string>
#include <vector>
#include <algorithm>
//#include <tuple>

//#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back

int main() {
  int a, b;
  cin >> a >> b;
  if (a <= b * 2) {
    cout << 0 << endl;
  } else {
    cout << a - b * 2  << endl;
  }
  
}


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

int main(void) {
    int H, A;
    cin >> H >> A;
    int i  = 0;

    while(H > 0){
        H -= A;
        i++;
    }
    cout << i << endl;
    

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
	int a,b;
	cin >> a;
	cin >> b;
	if(a == b)
		cout<<"Draw";
	else if(a==1)
		cout<<"Alice";
	else if(b==1)
		cout<<"Bob";
	else if(a!=1 && a>b)
		cout<<"Alice";
	else if(b!=1 && a<b)
		cout<<"Bob";
	return 0;
}


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

using namespace std;

using ll = long long;

ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }

int main()
{
  ll n, m;
  cin >> n >> m;
  string s, t;
  cin >> s >> t;
  ll g = gcd(n, m);
  ll ng = n / g, mg = m / g;
  int j = 0;
  for (int i = 0; i < n; i += ng)
  {
    if (s[i] != t[j])
    {
      cout << -1 << endl;
      return 0;
    }
    j += mg;
  }
  cout << ng * mg * g << endl;
}

Measured memory_bytes: 512
import sys
sys.setrecursionlimit(10 ** 9)
# input = sys.stdin.readline    ####
def int1(x): return int(x) - 1
def II(): return int(input())
def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())
def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def MS(): return input().split()
def LS(): return list(input())
def LLS(rows_number): return [LS() for _ in range(rows_number)]
def printlist(lst, k=' '): print(k.join(list(map(str, lst))))
INF = float('inf')
# from math import ceil, floor, log2
# from collections import deque
# from itertools import combinations as comb, combinations_with_replacement as comb_w, accumulate, product, permutations
# from heapq import heapify, heappop, heappush
# import numpy as np    # cumsum
# from bisect import bisect_left, bisect_right

def solve():
    N, M = MI()
    A = LI()

    ans = N - sum(A)
    print(-1 if ans < 0 else ans)

if __name__ == '__main__':
    solve()


Measured memory_bytes: 9836
#include <bits/stdc++.h>
using namespace std;
#define ALLOF(c) begin(c), end(c)

void solve() {
    string s;
    cin >> s;
    vector<char> v;

    for (auto e : s) {
        if (e != 'B') {
            v.push_back(e);
            continue;
        }
        if (!v.empty()) {
            v.pop_back();
        }
    }

    string ans = string(ALLOF(v));
    cout << ans << endl;
}

int main() {
    ios::sync_with_stdio(false);
    solve();
}



Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#define LL long long
using namespace std;
LL read() {
    LL k = 0, f = 1; char c = getchar();
    while(c < '0' || c > '9') {
        if(c == '-') f = -1;
        c = getchar();
    }
    while(c >= '0' && c <= '9')
        k = k * 10 + c - 48, c = getchar();
    return k * f;
}
LL a[100010], b[100010], c[100010];
int main() {
    int n = read();
    for(int i = 1; i <= n+1; ++i) a[i] = read();
    for(int i = 1; i <= n; ++i) b[i] = read();
    LL tot = 0;
    for(int i = 1; i <= n+1; ++i) {
        if(a[i] <= b[i] + b[i-1]) {
            tot += a[i];
            b[i] -= max(a[i] - b[i-1], 0ll);
        }
        else {
            tot += b[i] + b[i-1];
            b[i] = b[i-1] = 0;
        }
    }
    cout << tot << endl;
    return 0;
}

Measured memory_bytes: 1792
#include <iostream>

using namespace std;

typedef long long llong;

llong gcd(llong a, llong b) {
  if (b == 0) return a;
  else return gcd(b, a % b);
}

int main() {
  int k;
  cin >> k;
  llong sum = 0;
  
  for (int a = 0; a < k; ++a) {
    for (int b = 0; b < k; ++b) {
      for (int c = 0; c < k; ++c) {
        llong g = gcd(a + 1, b + 1);
        g = gcd(c + 1, g);
        sum += g;
      }
    }
  }
  cout << sum << endl;
  return 0;
}

Measured memory_bytes: 3124
#include<iostream>
#include<vector>
#include<complex>
using namespace std;
typedef complex<int> CI;
typedef vector<CI> VCI;
#define REP(i,n) for(int i = 0;i < n;i++)
	
int dx[] = {1,-1,0,0},dy[] = {0,0,1,-1};

int main()
{
	int n;
	while(cin >> n,n)
	{
		VCI v;
		int x=10,y=10,cx,cy;
		REP(i,n)
		{
			cin >> cx >> cy;
			if(!(x == cx && y == cy))
			{
				v.push_back(CI(cx,cy));
			}
		}
		int l;
		cin >> l ;
		char word;
		int len;
		REP(i,l)
		{
			cin >> word >> len;
			int der;
			switch(word)
			{
				case 'N':der = 2;break;
				case 'E':der = 0;break;
				case 'S':der = 3;break;
				case 'W':der = 1;break;
			}
			REP(j,len)
			{
				x+=dx[der];y+=dy[der];
				REP(k,v.size())
				{
					if(x == v[k].real() && y == v[k].imag())
					{
						v.erase(v.begin()+k);
					}
				}
			}
		}
		if(v.size() == 0)cout << "Yes" << endl;
		else cout << "No" << endl;
	}
	
	return 0;
}

Measured memory_bytes: 3076
#include <stdio.h>
#include <algorithm>
#include <vector>
#define max(x, y) (((x)>(y))?(x):(y))

using namespace std;

int N, A, B;
vector<int> h;

bool check(int x)
{
	long long int sum = 0;
	for(int i = 0; i < N; i++){
		sum += (max(0, ((long long int)h[i] - (long long int)x * B) ) + (A - B - 1)) / (A - B);
		
	}
	//printf("%d, %d\n", x, sum);
	if(sum <= x) return true;
	else return false;
}


int main(void)
{
	
	int tmp;
	
	scanf("%d %d %d", &N, &A, &B);
	for(int i = 0; i < N; i++){
		scanf("%d", &tmp);
		h.push_back(tmp);
	}
	
	int lx = 0, ly = 1000000001;
	int m, ans;
	
	while(lx != ly){
		m = (lx + ly) / 2;
		if(check(m)) ly = m;
		else lx = m+1;
		//printf("lx = %d, ly = %d\n", lx, ly);
	}
	if(check(lx)) ans = lx;
	else ans = lx + 1;
	
	end:
	printf("%d", ans);
	return 0;
}

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

int b[52][52] = { 0 };
char s[52][52] = {};

int CntBomb(int y, int x) {
	int cnt = 0;
	const int dir[8][2] = {
	{0,-1}, {1,-1}, {1,0}, {1,1}, {0,1}, {-1,1}, {-1,0}, {-1,-1} };
	rep(i, 8) {
		if (s[y][x] == '.')
			if (s[y + dir[i][1]][x + dir[i][0]] == '#') cnt++;
	}
	return cnt;
}

int main() {
	int h, w;
	cin >> h >> w;
	rep(i, h + 2) {
		rep(j, w + 2) {
			s[i][j] = ' ';
		}
	}
	for (int i = 1; i <= h; i++) {
		for (int j = 1; j <= w; j++) {
			cin >> s[i][j];
		}
	}
	for (int i = 1; i <= h; i++) {
		for (int j = 1; j <= w; j++) {
			b[i][j] = CntBomb(i, j);
			if (s[i][j] == '#') cout << '#';
			else cout << b[i][j];
		}
		cout << endl;
	}
	return 0;
}

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

int main() {
  int N,K,ans=0;
  cin>>N>>K;
  for(int i=0;i<N;i++){
    int a;
    cin>>a;
    ans+=min(a,K-a);
  }
  cout<<ans*2;
  
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#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()
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using Graph = vector<vi>;  // vi <=> vl
using vb = vector<bool>;
using boolGraph = vector<vb>;
using P = pair<int, int>;  // int <=> ll
const int MOD = 1e9+7;
const int MOD2 = 998244353;
const double EPS = 1e-9;

int main() {
  int N; cin >> N;
  vi arr(N);
  rep(i,N) cin >> arr[i];
  int ans = 0;
  rep(i,N) {
    rep(j,i) {
      ans += arr[i] * arr[j];
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h> 

int main() {
	int x,i,n;
	
	scanf("%d",&n);
	
	for(i=1; i<=n; i++) {
		x = i;
		if(x %3 == 0) {
			printf(" %d",i);
		}else if(x % 10 == 3){
			printf(" %d",i);
		} else { 
			while(x != 0){
				x /=10;
				if(x % 10 == 3) {
					printf(" %d",i);
					break;
				}
			}
		}
	}
	printf("\n");
	return 0;
}


Measured memory_bytes: 2108
/// Updated! https://www.youtube.com/watch?v=U07_n9xGIlM
#include<bits/stdc++.h>

using namespace std;
#define ll long long
#define dbug printf("I am here\n");
#define fast ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
const int maxn = 2e5+100;

const ll inf = 1e18;

int main()
{
    ll n;

    cin >> n;
    ll cnt = 0;
    while(n>0){
        cnt++;
        n /= 2;
    }

    cout << ((1ll<<cnt)-1) << endl;
    return 0;
}
/*



*/



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

// A - Sharing Cookies

int main()
{
  int A, B;

  cin >> A >> B;

  // A,B,A+Bのいずれかが3で割り切れれば、3匹のヤギは同じ枚数食べられる
  if (A % 3 == 0 || B % 3 == 0 || (A + B) % 3 == 0) cout << "Possible" << endl;
  else cout << "Impossible" << endl;

  return 0;
}


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

int main() {
	double W, H, x, y, r;
	cin >> W >> H >> x >> y >> r;

	if (x - r<0 || x + r>W) {
		cout << "No" << endl;
		return 0;
	}
	if (y - r<0 || y + r>H) {
		cout << "No" << endl;
	}
	else cout << "Yes" << endl;

	return 0;
}

Measured memory_bytes: 1220
#include <stdio.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <string.h>


int L_in;

int main(int argc, char* argv[]){
    int i,j,now,ten,flag,temp;
    //long int tenal;
    scanf("%d",&L_in);
    now = 7;
    ten = 7;
    flag=0;
    int small10,start;
    //for(i=0;i<=6;i++){
    //    if(ten>=L_in){
    //        small10 = ten;
    //        start = i;
    //        break;
    //    }
    //    ten *=10;
    //}

    //for(i=start;i<=10000;i++){
    for(i=1;i<=100000000;i++){
        temp = now % L_in;
        if(temp == 0){
            printf("%d",i);
            flag=1;
            break;
        }
        ten *= 10;
        ten = ten % L_in;
        now = temp + ten;
    }

    if(flag==0){
        printf("-1");
    }
    return 0;
}

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

void fnInput(int64_t& rnNum)
{
  cin >> rnNum;
}

int fnDigitsCheck(int64_t nDivisor)
{
  int nDigitCnt = 0;
  while (nDivisor)
  {
    nDigitCnt++;
    nDivisor /= 10;
  }

  return nDigitCnt;
}

int fnMultiplCheck(int64_t nNum)
{
  int nMinDigit = fnDigitsCheck(nNum);

  int64_t nSqrt = sqrt(nNum);
  for (int64_t n = 2; n <= nSqrt; n++)
  {
    if (nNum % n != 0)  continue;
    int nOtr = nNum / n;
    nMinDigit = min(nMinDigit, fnDigitsCheck(nOtr));
  }
//while (nSqrt < nNum)
//{
//  if (nNum % nSqrt == 0)
//    nMinDigit = min(nMinDigit, fnDigitsCheck(nSqrt));
//  nSqrt++;
//}

  return nMinDigit;
}

int main()
{
  int64_t nNum;
  
  fnInput(nNum);
  cout << fnMultiplCheck(nNum) << endl;

  return 0;
}

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

int main() {
    int n;
    cin>>n;
    map<int,int> m;
    rep(i,n){
        int a;
        cin>>a;
        m[a]++;
    }

    int cnt1=0,cnte=0,cnto=0;
    for(auto e : m){
        int x=e.second;
        if(x==1) cnt1++;
        else if(x%2==0) cnte++;
        else cnto++;
    }
    if(cnte%2==0) cout<<m.size()<<endl;
    else cout<<m.size()-1<<endl;
}




Measured memory_bytes: 4992
#include <stdio.h>

int main(void)
{
	int a,b,c,d,p;
	int X,Y;
	
	scanf("%d",&a);	
	scanf("%d",&b);
	scanf("%d",&c);
	scanf("%d",&d);
	scanf("%d",&p);
	
	while(b > 0 || c > 0){
		a--;
		b -= d;
		c -= p;
	}
	
	printf("%d\n",a);
	
	return(0);
}

Measured memory_bytes: 1824
#include<stdio.h>
int main(){
  int a,b,c,s;
  scanf("%d%d%d",&a,&b,&c);
  if(a>b&&a>c) s=b*c/2;
  else if(b>a&&b>c) s=c*a/2;
  else s=a*b/2;
  printf("%d",s);
}

Measured memory_bytes: 128
<?php
$n = (int) trim(fgets(STDIN));

for ($i = 3; $i <= $n; $i++) {
    if ($i % 3 == 0) echo ' ' . $i;
    else {
        $x = $i;
        while ($x >= 3) {
            if ($x % 10 == 3) {
                echo ' ' . $i;
                break;
            }
            $x = intval($x / 10);
        }
    }
}
echo "\n";
?>


Measured memory_bytes: 9212
#include <algorithm>
#include <cstdio>
#include <iostream>

using namespace std;

int main() {

	int INF = 50001;

	int n, m;
	scanf("%d %d", &n, &m);

	int T[n + 1];
	int C[m];
	for (int i = 0; i < m; ++i) {
		int coin;
		scanf("%d", &coin);
		C[i] = coin;
	}
//15 6
//1 2 7 8 12 50
	for (int i = 1; i <= n; ++i) {
		T[i] = INF;
	}
	T[0] = 0;

	for (int i = 0; i < m; ++i) {
		for (int j = C[i]; j <= n; ++j) {
			T[j] = min(T[j], T[j - C[i]] + 1);
		}
	}

	cout << T[n] << endl;

	return 0;
}

Measured memory_bytes: 3404
#include<bits/stdc++.h>
using namespace std;
int n;
long long ans;
int gcd(int x,int y) {
	return y == 0 ? x :gcd(y,x % y);
}
int main() {
	cin >>n;
	for(int i = 1;i <= n;++i)
		for(int j = 1;j <= n;++j)
			for(int k = 1;k <= n;++k)
				ans += gcd(i,gcd(j,k));
		cout <<ans << endl;
	return 0;
}


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

int main() {
  vector<vector<char>> x(3, vector<char> (3));
  for(int i = 0; i < 3; i++){
    for(int j = 0; j < 3; j++){
      cin >> x.at(i).at(j);
    }
  }
  cout << x.at(0).at(0) << x.at(1).at(1) << x.at(2).at(2) << endl;
}


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


int main() {
    string s;
    cin>>s;
    int ans=0;
    rep(i,s.size()/2)if(s[i]!=s[s.size()-1-i])ans++;
    cout << ans <<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<vector>
#define maxn 1005
#define _ 0
using namespace std;
struct nod
{
	int nex,id;
	nod(int a,int b)
	{
		nex=a;
		id=b;
	}
	nod(){}
};
int n,m,tim;
int vis[maxn];
int bel[maxn][maxn][2];
int u[maxn*maxn],v[maxn*maxn];
vector<nod> edge[maxn];
void dfs(int now,int fa,int b,int f)
{
//	cerr<<now<<" "<<fa<<" "<<b<<" "<<f<<endl;
	vis[now]=tim; bel[fa][now][f]=b;
	int len=edge[now].size();
	for(int i=0;i<len;i++)
		if(vis[edge[now][i].nex]!=tim)
			dfs(edge[now][i].nex,fa,b,f);
}
void solve(int now)
{
	tim++; vis[now]=tim;
	int len=edge[now].size();
	for(int i=0;i<len;i++)
		if(vis[edge[now][i].nex]!=tim)
			dfs(edge[now][i].nex,now,edge[now][i].id,0);

	reverse(edge[now].begin(),edge[now].end());

	tim++; vis[now]=tim;
	for(int i=0;i<len;i++)
		if(vis[edge[now][i].nex]!=tim)
			dfs(edge[now][i].nex,now,edge[now][i].id,1);
}
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=m;i++)
	{
		scanf("%d%d",&u[i],&v[i]);
		edge[u[i]].push_back(nod(v[i],i));
	}
	for(int i=1;i<=n;i++)
		solve(i);
	for(int i=1;i<=m;i++)
	{
		if( (bel[v[i]][u[i]][0]!=0) ^ _ ^ (bel[u[i]][v[i]][0]!=i || bel[u[i]][v[i]][1]!=i) )
			printf("diff\n");
		else
			printf("same\n");
	}
}


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

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

    int a = n % 10;
    if (a == 2 || a == 4 || a == 5 || a == 7 || a == 9) {
        cout << "hon" << endl;
    } else if (a == 0 || a == 1 || a == 6 || a == 8) {
        cout << "pon" << endl;
    } else if (a == 3) {
        cout << "bon" << endl;
    }
}

Measured memory_bytes: 3624
time=input()

aok=1
tak=1

for i in range(time):
	l=map(int, raw_input().split())
	if aok<tak:
		if tak%l[1]!=0:
			tak=(tak/l[1]+1)*l[1]
		if aok>tak/l[1]*l[0]:
			if aok%l[0]!=0:
				aok=(aok/l[0]+1)*l[0]
			tak=aok/l[0]*l[1]
		else:
			aok=tak/l[1]*l[0]
	elif aok==tak:
		if l[0]<=l[1]:
			if aok%l[0]!=0:
				aok=(aok/l[0]+1)*l[0]
			tak=aok/l[0]*l[1]
		else:
			if tak%l[1]!=0:
				tak=(tak/l[1]+1)*l[1]
			aok=tak/l[1]*l[0]
	else:
		if aok%l[0]!=0:
			aok=(aok/l[0]+1)*l[0]
		if tak>aok/l[0]*l[1]:
			if tak%l[1]!=0:
				tak=(tak/l[1]+1)*l[1]
			aok=tak/l[1]*l[0]
		else:
			tak=aok/l[0]*l[1]
print aok+tak


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

int main() {
	ll n;
	string s;
	bool f=1;
	cin>>n>>s;
	if(n%2)f=0;
	else {
		for(int i=0;i<(n/2);i++){
			if(s[i]!=s[i+n/2])f=0;
		}
	}
	cout<<(f?"Yes":"No");
	return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.*;
import java.util.*;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Collections;
import java.util.Arrays;

public class Main {
	public static void main(final String[] args){
    
    final Scanner sc = new Scanner(System.in);
    final List<Integer> list = new ArrayList<>();
    //final List<Long> list2 = new ArrayList<>();

    String s = sc.next();
    StringBuilder result = new StringBuilder();
    //インデックスは0からスタートするので，奇数番目の文字は偶数のインデックスになる
    for(int i = 0; i < s.length(); i += 2){
        result.append(s.charAt(i));
    }
    System.out.println(result);

   
    





}
}

Measured memory_bytes: 38540
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<algorithm>
//deque/functional/iterator/list/map/memory/numeric/queue/set/stack/utility/vector
//#include<bits/stdc++.h>
#define ll long long
using namespace std;


int main() {
	ios::sync_with_stdio(false);
	ll a,b,c,d;
	cin>>a;
	string s;
	cin>>s;
	ll sum=0;
	ll max1=0;
	for(int i=0; i<a; i++) {
		if(s[i]=='I') {
			sum++;
		} else {
			sum--;
		}
		max1=max(sum,max1);
	}
	cout<<max1<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <string.h>
#include <math.h>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <utility>
#include <deque>
#include <queue>
#include <functional>
//#include <boost/multiprecision/cpp_int.hpp>

#define rep(i, n) for(int i = 0; i < n; ++i)
#define REP(i, m, n) for(int i = m; i < n; ++i)
#define rrep(i,n) for(int i = n; i >= 0; --i)
#define RREP(i, m, n) for(int i = n; i >= m; --i)
#define llrep(i, n) for(ll i = 0; i < n; ++i)
#define llREP(i, m, n) for(ll i = m; i < n; ++i)
#define llrrep(i,n) for(ll i = n; i >= 0; --i)
#define llRREP(i, m, n) for(ll i = n; i >= m; --i)

using ll = long long;
using ull = unsigned long long;
using pii = std::pair<int, int>;
using pll = std::pair<long long, long long>;
using pil = std::pair<int, long long>;
using pli = std::pair<long long, int>;
using plpii = std::pair<long long, std::pair<int, int>>;
using pdd = std::pair<double, double>;

const long long INF = 1000000000000000001;
const long long _MOD = 1000000007;
const long long MOD = 998244353;
const int ALPHABET = 27;
const double pi = 3.14159265358979;

using namespace std;
//namespace mp = boost::multiprecision;

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

	int n, x, t;
	cin >> n >> x >> t;
	cout << (n / x + (n%x == 0 ? 0 : 1))*t << "\n";

	return 0;
}


Measured memory_bytes: 3644
#include<bits/stdc++.h>
using namespace std;
main()
{
    int x,a,b;
    bool c=0;
    cin>>x>>a>>b;
    for(int i=a;i<=b;i++)
    {
        if(i%x==0)
        {c=1;
        break;}
    }
    if(c) cout<<"OK";
    else cout<<"NG";
}


Measured memory_bytes: 3632
n=int(input())
a=[int(input()) for _ in range(n)]

q=[]

def bisect_desc(a,x):
    r = len(a)
    if r == 0:
        return 0
    l = 0
    while l != r:
        f = (l+r)//2
        if a[f] >= x:
            l = f+1
        else:
            r = f
    return l

for sa in a:
    t = bisect_desc(q,sa)
    if t ==len(q):
        q.append(sa)
    else:
        q[t] = sa

print(len(q))


Measured memory_bytes: 7808
package main

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

var (
	read  = bufio.NewReader(os.Stdin)
	write = bufio.NewWriter(os.Stdout)
)

func yesno(result bool) {
	if result {
		fmt.Fprintln(write, "Yes")
	} else {
		fmt.Fprintln(write, "No")
	}
}

func main() {
	defer write.Flush()

	var n int
	var t string
	fmt.Fscan(read, &n, &t)
	s := []byte(t)

	for i := 0; i < len(s); i++ {
		s[i] -= 'A'
		s[i] += byte(n)
		s[i] %= 26
		s[i] += 'A'
	}
	fmt.Println(string(s))

}


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

int main(){
	
  int n,l;
  cin >> n >> l;
  string a[n];
  
  for (int i=0; i<n; i++) {
  	cin >> a[i];
  }
  
  sort(a,a+n);
  for (int i = 0; i < n; i++){
    cout << a[i];
  }

}

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

int main() {
//	cout<<"GfG!";
    int a,b,c;
    cin>>a>>b>>c;
    if(a+b+c>=22)
    {
        cout<<"bust"<<endl;
    }
    else
    {
        cout<<"win"<<endl;
    }
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void)
{
  int a,b,c;
  scanf("%d%d%d",&a,&b,&c);
  if(b-a==c-b)
  {
    printf("YES\n");
  }
  else
  {
    printf("NO\n");
  }
  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <cstdio>
#define REP(i,m) for(long long i=0; i<m; i++)
#define FOR(i,n,m) for(long long i=n; i<m; i++)
using namespace std;

int main() {
	int a, b;
	cin >> a >> b;
	printf("%d %d %.8f\n", a/b, a%b, (double)a/(double)b);
	return 0;
}


Measured memory_bytes: 3212
#include <bits/stdc++.h>
using namespace std;
/*{{{*/  //template
#define rep(i,n) for(int i=0;i<(int)(n);i++)
constexpr int INF = numeric_limits<int>::max()/2;
constexpr long long LINF = numeric_limits<long long>::max()/3;
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define sz(x) (int)(x).size()
#define debug(x) cerr<<#x<<":"<<x<<endl
#define debug2(x,y) cerr<<#x<<","<<#y":"<<x<<","<<y<<endl
//struct fin{ fin(){ cin.tie(0); ios::sync_with_stdio(false); } } fin_;
struct Double{ double d; explicit Double(double x) : d(x){} };
ostream& operator<<(ostream& os,const Double x){ os << fixed << setprecision(20) << x.d; return os; }
template<typename T> ostream& operator<<(ostream& os,const vector<T>& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os,const pair<T,U>& p){ os << "(" << p.first << ","<< p.second <<")"; return os; }
template<typename T> ostream& operator<<(ostream& os,const set<T>& st){ os<<"{"; for(T v:st) os<<v<<","; os <<"}"; return os; }
template<typename T,typename U> inline void chmax(T &x,U y){ if(y>x) x = y; }
template<typename T,typename U> inline void chmin(T &x,U y){ if(y<x) x = y; }
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
ll gcd(ll a,ll b){ if(b==0) return a; else return gcd(b,a%b); }
//constexpr double eps = 1e-14; 
constexpr double eps = 1e-10; 
constexpr ll mod = 1e9+7;
const int dx[]={1,0,-1,0} ,dy[] = {0,1,0,-1};
/*}}}*/

constexpr int maxt=4096;
double up[maxt];
double down[maxt];
int lim[maxt];


int main(){
    int N; cin >> N;
    vector<int> t(N),v(N);
    rep(i,N) cin >> t[i];
    rep(i,N) cin >> v[i];

    rep(i,N) t[i] *= 2;
    int lt =  accumulate(all(t),0);

    vector<int> lim(lt+1,10000);
    for(int i=0;i<N-1;i++) t[i+1] += t[i];

    int b = 0;
    for(int i=0;i<N;i++){
        for(int j=b;j<=t[i];j++){
            lim[j] = min(lim[j],v[i]);
        }
        b = t[i];
    }

    vector<double> left(lt+1,0),right(lt+1,0);
    for(int i=1;i<=lt;i++){
        left[i] = min<double>(lim[i],left[i-1]+0.5);
    }
    right[lt] = 0;
    for(int i=lt-1;i>=0;i--){
        right[i] = min<double>(lim[i],right[i+1]+0.5);
    }

    vector<double> res(lt+1);
    for(int i=0;i<=lt;i++) res[i] = min<double>(left[i],right[i]);

    double ans = 0;
    for(int i=0;i<=lt;i++) ans += res[i];

    cout << Double(ans/2.0) << endl;
}


Measured memory_bytes: 1408
# https://atcoder.jp/contests/abc133/tasks/abc133_d

n = int(input())

nums = [int(i) for i in input().split()]
total = sum(nums)
ans = [0] * n
t = 0
for i in range(1, n, 2):
    t += nums[i] * 2
ans[0] = total - t
for i in range(1, n):
    ans[i] = nums[i - 1] * 2 - ans[i - 1]
print(*ans)

Measured memory_bytes: 64484
import sys
def 解():
    input = sys.stdin.readline

    N,W=[int(_) for _ in input().split()]
    dp = [0]*(W+1)
    for i in range(N):
        w,v=[int(_) for _ in input().split()]
        for j in range(W,w-1,-1):
            dp[j] = max(dp[j] ,dp[j-w]+v)
    print(dp[W])
解()


Measured memory_bytes: 40432
n,m = map(int,input().split())
student = []
check = []
for i in range(n):
    ab = [int(i) for i in input().split()]
    student.append(ab)
for j in range(m):
    cd = [int(i) for i in input().split()]
    check.append(cd)
mn = 10**13
for ax,by in student:
    for i in range(m):
        dist = abs(ax-check[i][0]) + abs(by-check[i][1])
        if mn > dist:
            ans = i+1
            mn = dist
    print(ans)
    mn = 10**13

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

bool isprime(int in){
	int max=sqrt(in)+1;
	bool ret=true;
	if(in==2){
	}else if(in%2==0){
		ret=false;
	}else for (int i=3;i<max;i+=2){
		if(in%i==0){
			ret=false;
			break;
		}
	}
	return ret;
}

int main(){
	int in,sum,max;
	while(1){
		cin>>in;
		if(in==0)break;
		max=in*2;
		sum=0;
		for(int i=in+1;i<max+1;i++){
			if(isprime(i))sum++;
		}
		cout<<sum<<endl;
	}
	return 0;
}

Measured memory_bytes: 1160
const int isDebugMode = 1;
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<long long, long long> P;
struct edge{long long to,cost;};
const int inf = 1 << 27;
const long long INF = 1LL << 60;
const int COMBMAX = 1001001;
const long long MOD = 1000000007;
const long long dy[] = {-1, 0, 0, 1};
const long long dx[] = {0, -1, 1, 0};
string abc = "abcdefghijklmnopqrstuvwxyz";
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define eachdo(v, e) for (const auto &e : (v))
#define all(v) (v).begin(), (v).end()
#define lower_index(v, e) (long long)distance((v).begin(), lower_bound((v).begin(), (v).end(), e))
#define upper_index(v, e) (long long)distance((v).begin(), upper_bound((v).begin(), (v).end(), e))
long long mpow(long long a, long long n, long long mod = MOD){long long res = 1; while(n > 0){if(n & 1)res = res * a % mod; a = a * a % mod; n >>= 1;} return res;}
void pt(){cout << endl; return;}
template<class Head> void pt(Head&& head){cout << head; pt(); return;}
template<class Head, class... Tail> void pt(Head&& head, Tail&&... tail){cout << head << " "; pt(forward<Tail>(tail)...);}
void dpt(){if(!isDebugMode) return; cout << endl; return;}
template<class Head> void dpt(Head&& head){if(!isDebugMode) return; cout << head; pt(); return;}
template<class Head, class... Tail> void dpt(Head&& head, Tail&&... tail){if(!isDebugMode) return; cout << head << " "; pt(forward<Tail>(tail)...);}
template<class T> void debug(T v){if(!isDebugMode) return; rep(i, v.size()) cout << v[i] << " " ; cout << endl;}
template<class T> void debug2(T v){if(!isDebugMode) return; rep(i, v.size()){rep(j, v[i].size()) cout << v[i][j] << " " ; cout << endl;}}
template<class T1, class T2> inline bool chmin(T1 &a, T2 b){if(a > b){a = b; return true;} return false;}
template<class T1, class T2> inline bool chmax(T1 &a, T2 b){if(a < b){a = b; return true;} return false;}
template<class T1, class T2> long long recgcd(T1 a, T2 b){return a % b ? recgcd(b , a % b) : b;}
bool valid(long long H, long long W, long long h, long long w) { return 0 <= h && h < H && 0 <= w && w < W; }

ll MAX_I = 1001001;

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    ll N, K; cin >> N >> K;
    vector<double> a(N);
    rep(i, N) cin >> a[i];
    double l = 0.1, r = *max_element(all(a));
    double mid;
    rep(i, 100){
        mid = (l + r) / 2;
        ll cnt = 0;
        rep(j, N){
            cnt += (ll)(a[j] / mid);
        }
        if(cnt <= K) r = mid;
        else l = mid;
    }
    pt((ll)ceil(mid));
}

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

using namespace std;

typedef long long int big;

int main(){
    big nl;
    cin>>nl;
    big fiveh = nl/500;  
    big rem = nl%500;
    big five = rem/5;
    big happ = fiveh*1000+five*5;
    cout<<happ<<"\n";
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <tuple>
#include <queue>
#include <bitset>
#include <unordered_map>
#include <tuple>
#include <utility>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <sys/time.h>

using namespace std;

void solve(long long N, long long K){
  if (K == 1) {
    std::cout << 0 << std::endl;
  } else {
    std::cout << N-(K-1) - 1 << std::endl;
  }
}

int main(){
  long long N;
  long long K;
  scanf("%lld",&N);
  scanf("%lld",&K);
  solve(N, K);
  return 0;
}


Measured memory_bytes: 256
a,b,c = map(int,input().split())

if a == 5 and b == 5 and c == 7:
    print("YES")
elif a == 5 and b == 7 and c ==5:
    print("YES")
elif a == 7 and b == 5 and c ==5:
    print("YES")
else:
    print("NO")

Measured memory_bytes: 2940
#include <iostream>
#include <vector>
#define N 100002
#define p push_back
#define m make_pair
#define s second
#define f first
using namespace std;
typedef pair<int,int> P;
 
int main(){
  int n,w,h,x,y,ra,flag[2],k[2][N],t[2][N];
  vector<P> r[2];
  cin>>n>>w>>h;
  while(n--){
    cin>>x>>y>>ra;
    int xmax=x+ra,xmin=x-ra,ymax=y+ra,ymin=y-ra;
    if(xmax>w) xmax=w;
    if(xmin<0) xmin=0;
    if(ymax>h) ymax=h;
    if(ymin<0) ymin=0;
    r[0].p(m(xmin,xmax));
    r[1].p(m(ymin,ymax));
  }
  for(int i=0;i<2;i++){
    for(int j=0;j<N;j++) k[i][j]=0;
    for(int j=0;j<r[i].size();j++) k[i][r[i][j].f]++,k[i][r[i][j].s]--;
    t[i][0]=k[i][0];
    for(int j=1;j<N;j++) t[i][j]=t[i][j-1]+k[i][j];
  }
  flag[0]=flag[1]=1;
  for(int i=0;i<w;i++)
    if(!t[0][i]) flag[0]=0;
  for(int i=0;i<h;i++)
    if(!t[1][i]) flag[1]=0;
  if(flag[0]||flag[1]) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}

Measured memory_bytes: 4500
h,w=map(int,input().split())
g=[input() for _ in range(h)]
for x in range(h):
  for y in range(w):
    if g[x][y]=='.': continue
    ok=0
    for dx,dy in [(1,0),(0,1),(-1,0),(0,-1)]:
      nx,ny=x+dx,y+dy
      if 0<=nx<h and 0<=ny<w:
        if g[nx][ny]=='#': ok=1
    if ok<1:
      print('No')
      exit()
print('Yes')

Measured memory_bytes: 9240
#include<cstdio>
#include <iostream>
#include<algorithm>
#include<string>
#include<queue>
#include<vector>
#include<functional>
#include<cmath>
#include<map>
#include<stack>
#include<set>
#include<numeric>

using namespace std;
typedef long long ll;
typedef pair<int, int> Pr;

int main()
{
	ll a, b, c;
	bool flag = true;
	cin >> a >> b >> c;

	ll ans = 0;
	while (a % 2 == 0 && b % 2 == 0 && c % 2 == 0) {
		ans++;
		int A = a / 2;
		int B = b / 2;
		int C = c / 2;
		a /= 2; a = B + C;
		b /= 2; b = A + C;
		c /= 2; c = A + B;
		if (ans >= 100000) {
			flag = false;
			break;
		}
	}

	if (flag)cout << ans << endl;
	else cout << -1 << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<math.h>
#include<set>
#include<vector>
#include<map>
using namespace std;
int main(){
int a,b;
cin>>a>>b;
if(a==b)
cout<<"Draw"<<endl;
else if(a==1)
cout<<"Alice"<<endl;
else if(b==1)
cout<<"Bob"<<endl;
else if(a!=1&&b!=1&&a>b)
cout<<"Alice"<<endl;
else if(a!=1&&b!=1&&b>a)
cout<<"Bob"<<endl;
}

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

#define LOCAL 0

#define lli long long int
#define llu unsigned long long int
#define ld long double
#define all(v) v.begin(),v.end()
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define si(n) scanf("%d",&n)
#define slli(n) scanf("%lld",&n);
#define ss(n) scanf("%s",n);

const long double EPS = 1e-10;
const int MOD = 1000000007ll;
const int mod1 = 1000000009ll;
const int mod2 = 1100000009ll;
int INF = (int)1e9;
lli INFINF = (lli)1e18;
int debug = 0;
long double PI = acos(-1.0);

using namespace std;

int bit_count(lli _x){lli _ret=0;while(_x){if(_x%2==1)_ret++;_x/=2;}return _ret;}
int bit(lli _mask,int _i){return (_mask&(1ll<<_i))==0?0:1;}
int add(int a,int b,int m=MOD){int x=a+b;while(x>=m)x-=m;while(x<0)x+=m;return x;}
int sub(int a,int b,int m=MOD){int x=a-b;while(x<0)x+=m;while(x>=m)x-=m;return x;}
int mul(int a,int b,int m=MOD){lli x=a*1ll*b;x%=m;while(x<0)x+=m;return (int)x;}
int ldtoint(ld x){return (int)(x+0.5);}lli ldtolli(ld x){return (lli)(x+0.5);}
int powermod(lli _a,lli _b,int _m=MOD){lli _r=1;while(_b){if(_b%2==1)_r=mul(_r,_a,_m);_b>>=1;_a=mul(_a,_a,_m);}return _r;}

template<class T1,class T2>ostream&operator<<(ostream& os,const pair<T1,T2>&p){os<<"["<<p.first<<","<<p.second<<"]";return os;}
template<class T>ostream&operator<<(ostream& os,const vector<T>&v){os << "[";bool first=true;for (T it:v){if (!first)os<<", ";first = false;os<<it;}os<<"]";return os;}
template<class T>ostream&operator<<(ostream& os,set<T>&v){os<<"[";bool first=true;for (T it:v){if(!first)os<<", ";first=false;os<<it;}os<<"]";return os;}
template<class T1,class T2>ostream&operator<<(ostream& os,map<T1,T2>&v){os<<"[";bool first=true;for(pair<T1,T2> it:v){if(!first)os<<", ";first=false;os<<"("<<it.F<<","<<it.S<<")";}os<<"]";return os;}
template<class T>void parr(T a[],int s,int e){cout<<"[";for(int i=s;i<e;i++)cout<<a[i]<<", ";cout<<a[e]<<"]\n";}

int N;
string s;

char opp(char c){
    if(c == 'S')
        return 'W';
    else
        return 'S';
}

bool check(string &t){
    for(int i=1;i<=N+N-2;i++){
        if(s[i] == 'o'){
            if(t[i]=='S')
                t += t[i-1];
            else
                t += opp(t[i-1]);
        }
        else{
            if(t[i]=='W')
                t += t[i-1];
            else
                t += opp(t[i-1]);
        }
    }
    for(int i=N;i<N+N;i++)
        if(t[i] != t[i-N])
            return false;
    return true;
}

int main()
{
if(LOCAL){
    freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    debug = 1;
}
    srand (time(NULL));

    cin>>N;
    cin>>s;
    s += s;

    string t;

    t = "SS";
    if(check(t)){
        cout<<t.substr(0,N);
        return 0;
    }

    t = "SW";
    if(check(t)){
        cout<<t.substr(0,N);
        return 0;
    }

    t = "WW";
    if(check(t)){
        cout<<t.substr(0,N);
        return 0;
    }

    t = "WS";
    if(check(t)){
        cout<<t.substr(0,N);
        return 0;
    }

    cout<<-1;


    return 0;
}


Measured memory_bytes: 812
#include <stdio.h>
#include <algorithm>
#include <vector>
using namespace std;
int main(void) {
	int n, l; scanf("%d %d", &n, &l);
	int orig = n * (2 * l + n - 1) / 2;
	int b = l + (n - 1);
	int a = l;
	if (b < 0) return !printf("%d\n", orig - b);
	else if (a <= 0) return !printf("%d\n", orig);
	else return !printf("%d\n", orig - a);
}

Measured memory_bytes: 128
#include<stdio.h>
int main()
{
	int n,k,a,count = 0;
	scanf("%d %d",&n,&k);
	
	while(n)
	{
		a = n%k;
		n /= k;
		if(a<0)
		{
			a = a-k;
			n+=1;
			count++;
		}
		else count++;
	}
	printf("%d",count);
	return 0;
}

Measured memory_bytes: 128
#include <stdio.h>

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

        if ((0 <= x - r && x + r <= W) && (0 <= y - r && y + r <= H)) {
                printf("Yes\n");
        } else {
                printf("No\n");
        }

}


Measured memory_bytes: 2104
#if defined(__GNUC__)
#include <bits/stdc++.h>
#define __int32 __int32_t
// __GNUC__
#else
#include "bits/stdc++.h"
#endif
using namespace std;

#define int long long

#define itn __int32
#define REP(i, n) for(itn (i) = 0; (i) < (n); ++(i))
#define REP2(i, x, n) for(itn (i) = x; (i) < (n); ++(i))
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define SORT(x) sort(ALL(x))
#define RSORT(x) sort(ALL(x), greater<decltype(x)::value_type>())
#define RSORT2(x, T) sort(ALL(x), greater<T>())
#define REVERSE(x) reverse(ALL(x))
#define ACM(x, y) accumulate(ALL(x), y)

#define INT_POW(x, y) [](int a, int b) -> int {int c = a; REP(i, b - 1){c *= a;} return c;}(x, y)
#define INT_POWM(x, y, m) [](int a, int b, int m) -> int {int c = a; REP(i, b - 1){c *= a; c %= m;} return c;}(x, y, m)
#define FCT(x) [](int a) -> int {int r = 1; REP(i, a){r *= i;} return r;}(x)

// デバッグ用
#define PUT_LIST(x, y) std::copy(ALL(x), ostream_iterator<decltype(x)::value_type>(cout, y))

const int kMod = 1e9 + 7;

itn main() {
	ios::sync_with_stdio(false);

	int n, k;

	cin >> n >> k;

	int a = n % k;

	cout << min(a, abs(a - k));

	return 0;
}


Measured memory_bytes: 256
#include "iostream"
using namespace std;
int main(){
  int a; int b;
  cin>>a>>b;
  if(a==b){
    cout<<2*a<<endl;

  }
  else if(a>b){
    cout<<a+(a-1)<<endl;
  }
  else{
    cout<<b+(b-1)<<endl;
  }
}


Measured memory_bytes: 3612
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<set>
#include<unordered_set>
#include<map>
typedef long long int ll;
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define REP(i,n) for (int i=0;i<(n);i++)
#define EREP(i,n) for (int i=1;i<=(n);i++)
#define ALL(a) (a).begin(),(a).end()
//#define EVEL 1

#ifdef EVEL
#define DEB(X) cout << #X << ":" <<X<<" " ;
#define TF(f) f ? cout<<"true  " : cout<<"false ";
#define END cout<<"\n";
#else
#define DEB(X) {}
#define TF(f) {}
#define END {}
#endif
const ll MOD = 1000000007;
const int INF = 2000000000;
std::pair<string,pair<int,int>> Q[101];
    ll N,M;
    ll A,B,C;
    bool F[5][5];
    bool ad=false;
    ll ans=0;
int main(){
    ios_base::sync_with_stdio(false);
    cin>>N>>A>>B;
    ans+=(N/(A+B))*A;
    if(N%(A+B)<=A)ans+=N%(A+B);
    else ans+=A;

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


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
//int a[6]= {100,101,102,103,104,105},n,dp[1000002];
int main()
{
    int n;
    scanf("%d",&n);
    for(int i=0;i<=n;i++)
    {
        double a=i*1.08;
        int tmp=a;
        if(tmp==n)
        {
            printf("%d",i);
            return 0;
        }
    }
    printf(":(");
    return 0;
}


Measured memory_bytes: 256
import math
N,D = map(int,input().split())
X = [ list(map(int,input().split())) for _ in range(N)]
count = 0
for i in range(N-1):
    i_point = X[i]
    for j in range(i+1,N):
        j_point = X[j]
        sum = 0
        for k in range(D):
            sum += (i_point[k]-j_point[k])**2
        if math.sqrt(sum).is_integer() :
            count += 1

print(count)

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

long long H, W, K;
long long xstart, ystart, xend, yend;
string ban[1000005];

map<pair<long long, long long>, long long> ans;

bool valid(long long x, long long y) {
	if(x < 0 || x >= H || y < 0 || y >= W) {
		return false;
	}

	return ban[x][y] == '.';
}

int main(){
	cin >> H >> W >> K;
	cin >> xstart >> ystart >> xend >> yend;
	xstart--;ystart--;xend--;yend--;

	for(long long i = 0; i < H; i++) {
		cin >> ban[i];
	}

	// cost, (x, y)
	//priority_queue< pair<long long, pair<long long, long long> >,
	//	vector<pair<long long, pair<long long, long long> > >,
	//	greater<pair<long long, pair<long long, long long> > > > Q;
	queue<pair<long long, pair<long long, long long> > > Q;

	Q.push(make_pair(0, make_pair(xstart, ystart)));

	while(!Q.empty()) {
		long long cost = Q.front().first;
		long long x = Q.front().second.first;
		long long y = Q.front().second.second;

		if(x == xend && y == yend) {
			cout << cost << endl;
			return 0;
		}

		Q.pop();


		//下
		for(long long i = 1; i <= K; i++) {
			if(!valid(x + i, y)) {
				break;
			}
			if(ans.count(make_pair(x + i, y)) == 0) {
				ans[make_pair(x + i, y)] = cost+1;
				Q.push(make_pair(cost + 1, make_pair(x + i, y)));
			} else if(ans[make_pair(x + i, y)] <= cost) {
				break;
			}
		}
		//上
		for(long long i = 1; i <= K; i++) {
			if(!valid(x - i, y)) {
				break;
			}
			if(ans.count(make_pair(x - i, y)) == 0) {
				ans[make_pair(x - i, y)] = cost+1;
				Q.push(make_pair(cost + 1, make_pair(x - i, y)));
			} else if(ans[make_pair(x - i, y)] <= cost) {
				break;
			}
		}

		//右
		for(long long i = 1; i <= K; i++) {
			if(!valid(x, y + i)) {
				break;
			}
			if(ans.count(make_pair(x, y + i)) == 0) {
				ans[make_pair(x, y+i)] = cost+1;
				Q.push(make_pair(cost + 1, make_pair(x, y + i)));
			} else if(ans[make_pair(x, y+i)] <= cost) {
				break;
			}
		}

		//右
		for(long long i = 1; i <= K; i++) {
			if(!valid(x, y - i)) {
				break;
			}
			if(ans.count(make_pair(x, y - i)) == 0) {
				ans[make_pair(x, y-i)] = cost+1;
				Q.push(make_pair(cost + 1, make_pair(x, y - i)));
			} else if(ans[make_pair(x, y-i)] <= cost) {
				break;
			}
		}
	}
	cout << -1 << endl;
}


Measured memory_bytes: 72728
#include<iostream>
#include <numeric>
using namespace std;
// https://atcoder.jp/contests/abc143/tasks/abc143_b
// 問題文
// たこ焼きフェスティバル (たこフェス) の季節がやってきました！

// 今年のたこフェスでは N 個のたこ焼きがふるまわれる予定です。このうち i 個目のたこ焼きのおいしさは di です。
// ところで、おいしさが x と y であるたこ焼きを一緒に食べると、体力が x × y 回復することが一般に知られています。
// たこフェスでふるまわれる N 個のたこ焼きから、2 個を選ぶ方法はN×(N−1) / 2通り考えられます。そのそれぞれについて、一緒に食べたときの体力の回復量を求めて、その総和を出力してください。

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

    int sum = 0;
    for (int i = 0; i < N; i++) {
        for (int j = i + 1; j < N; j++) {
            sum += d[i] * d[j];
        }
    }

    cout << sum << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int i,x,n,z,j;
    int d[2],ans[2];
    cin>>x>>n;
    //int a[n];
    vector<int>a;
    for(i=0;i<n;i++){
        cin>>z;
        a.push_back(z);
    }
    sort(a.begin(),a.end());
    i=x;
    while(1){
        if(binary_search(a.begin(),a.end(),i)==0){
            ans[0]=i;
            d[0]=i-x;
            break;
        }
        i++;
    }
    j=x-1;
    while(1){
        if(binary_search(a.begin(),a.end(),j)==0){
            ans[1]=j;
            d[1]=x-j;
            break;
        }
        j--;
    }
    if(d[0]<d[1]){
        cout<<ans[0] ;
        return 0;
    }
    else if(d[1]<d[0]){
        cout<<ans[1] ;
        return 0;
    }
    else{
        cout<<min(ans[0],ans[1]);
        return 0;
    }
    return 0;
}


Measured memory_bytes: 3616
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <map>
#include <iomanip>	
#include <deque>
#include <set>
#define rep(i,a,b) for(int i=a;i<b;++i)
#define rrep(i,a,b) for(int i=a;i>=b;--i)
#define fore(i,a) for(auto &i:a)
#define INF INT_MAX/2;
typedef long long ll;
using namespace std;
using vi = vector<int>;
using vll = vector<ll>;
ll mod = 1e9 + 7;
//ll llmax = 10000000000000000000ll;
using namespace std;
using Graph = vector<vector<int>>;


int cnt_digit(ll N)
{
	int digit = 0;

	while (N > 0)
	{
		N /= 10;
		digit++;
	}
	return digit;
}


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

ll lcm(ll a, ll b)
{
	ll g = gcd(a, b);

	return a / g * b;
}

struct union_find
{
	vector<int> par, r;
	union_find(int n)
	{
		par.resize(n);
		r.resize(n);
		init(n);
	}


	void init(int n)
	{
		for (int i = 0; i < n; i++) par[i] = i;
		for (int i = 0; i < n; i++) r[i] = 0;
	}

	int find(int x)
	{
		if (par[x] == x)return x;
		else return find(par[x]);
	}

	void unite(int x, int y)
	{
		x = find(x);
		y = find(y);

		if (r[x] < r[y])
		{
			par[x] = y;
		}
		else
		{
			par[y] = x;
			if (r[x] == r[y])
			{
				r[x]++;
			}
		}
	}
};



int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	int a,b,c,k;

	cin >> a >> b >> c >> k;

	cout << a + b + c + max(max(a, b), c) * (pow(2,k) - 1) << endl;
	

}
	

Measured memory_bytes: 256
h,w=map(int,input().split())
s=[]
s.append("."*w)
s=[input() for _ in range(h)]
s.append("."*w)
for i in range(h):
    l=[]
    for k in range(w):
        if s[i][k]=="#":
            p="#"
        elif k==0:
            p=0
            p+=(s[i-1]+"..")[:k+2].count("#")
            p+=(s[i]+"..")[:k+2].count("#")
            p+=(s[i+1]+"..")[:k+2].count("#")
        else:
            p=0
            p+=(s[i-1]+"..")[k-1:k+2].count("#")
            p+=(s[i]+"..")[k-1:k+2].count("#")
            p+=(s[i+1]+"..")[k-1:k+2].count("#")
        l.append(str(p))
    print("".join(l))

Measured memory_bytes: 3064
N = input()
N = int(N)
W = input().split()

for i in range(N):
  W[i] = int(W[i])
  
total = sum(W)
prefix = []
delta = []
for i in range(N):
  prefix.append(sum(W[:i+1]))
  
for i in range(N):
  delta.append(abs(prefix[N-1] /2 - prefix[i]))
  
answer = min(delta) * 2
print(int(answer))

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=1e5+10;
int n,m,u,v;
int fa[maxn];
set<int> st;
struct Node{
	ll val;
	int id;
} node[maxn];
bool cmp(Node a,Node b){return a.val<b.val;}
int find(int x){return x==fa[x]? x:fa[x]=find(fa[x]);}
void merge(int x,int y)
{
	int fx=find(x),fy=find(y);
	if(fx!=fy) fa[fx]=fy;
}

int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;++i) scanf("%lld",&node[i].val),node[i].id=fa[i]=i;
	for(int i=1;i<=m;++i) scanf("%d%d",&u,&v),merge(u+1,v+1);
	for(int i=1;i<=n;++i) st.insert(find(i));
	sort(node+1,node+1+n,cmp);
	int len=st.size(),cnt=0;
	ll ans=0;
	if(n==1 || m==n-1) { puts("0"); return 0;}
	if(2*(len-1)>n) puts("Impossible");
	else
	{
		for(int i=1;i<=n;++i)
		{
			if(st.find(fa[node[i].id]) != st.end()) ans+=1ll*node[i].val,st.erase(fa[node[i].id]);
			else
			{
				if(++cnt<len-1) ans+=1ll*node[i].val;
			}
		}
		printf("%lld\n",ans);
	}

	return 0;
 } 

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

using namespace std;
typedef long long ll;

#define rep(i, N) for (int i = 0; i < (int)N; i++)
#define p_ll pair<ll, ll>
const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const int INF = pow(2,30)-1;


int main() {
  string S; cin >> S;
  int w; cin >> w;
  string result;
  for (int i=0; i<S.length(); i+=w) result += S[i];
  cout << result << endl;
  return 0;
}

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



int main()
{
        long long q, h, s, d;
        cin >> q >> h >> s >> d;

        if( q * 2LL < h ) {
                h = q * 2LL;
        }
        if( h * 2LL < s ) {
                s = h * 2LL;
        }

        if(s * 2LL < d) {
                d = s * 2LL;
        }

        long n;
        cin >> n;

        long long tot = 0;
        tot +=  ( n / 2 ) * d;
        if(n & 1LL) tot += s;
        cout << tot << endl;



        return 0;
}



Measured memory_bytes: 256