akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>

using namespace std;

int main(){
  int a[100]={0},i,j,kaisu=0,num,mini;

  cin >>num;
  for(i=0;i<num;i++){
    cin >>a[i];
  }



  for(i=0 ; i<num-1;i++){
    mini=i;
    for(j=i+1;j<num;j++){//num-1
      
      if(a[j]<a[mini]){ mini=j;
      }
    
    

    }
    if(mini!=i){
    swap(a[i],a[mini]);
    kaisu++;
    }

  }
  





      for(i=0;i<num;i++){
	cout <<a[i];
	if(i<num-1){cout <<" ";
	}
      }


      cout<<endl;
      cout<<kaisu<<endl;
      
      return 0;
}



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

using namespace std;

const int N = 305;
const int mod = 998244353;

int n, a[N], dp[N][N * N], f[N][N * N * 2];

void add (int &x, int y) {
    x += y;
    if (x >= mod) x -= mod;
}

int binPow (int x, int y) {
    int ans = 1;
    while (y > 0) {
        if (y & 1) ans = 1LL * ans * x % mod;
        x = 1LL * x * x % mod;
        y >>= 1;
    }

    return ans;
}

void sub (int &x, int y) {
    x -= y;
    if (x < 0) x += mod;
}

int main(){
    scanf("%d", &n);
    int sum = 0;
    for (int i = 1; i <= n; i++) scanf("%d", &a[i]), sum += a[i];
    dp[0][0] = 1; f[0][90000] = 1;

    for (int i = 0; i < n; i++) {
        for (int j = 0; j <= sum; j++) {
            if (dp[i][j]) {
                add(dp[i + 1][j + a[i + 1]], dp[i][j]);
                add(dp[i + 1][j], 2LL * dp[i][j] % mod);
            }
        }
    }

    for (int i = 0; i < n; i++) {
        for (int j = 0; j < N * N * 2; j++) {
            if (f[i][j]) {
                add(f[i + 1][j + a[i + 1]], f[i][j]);
                add(f[i + 1][j - a[i + 1]], f[i][j]);
            }
        }
    }

    if (sum % 2 == 0) {
        int ans = 0;
        int res = binPow(3, n);
        for (int i = sum / 2; i <= sum; i++) add(ans, dp[n][i]);
        //cout << ans << "\n";

        ans = 3LL * ans % mod;
        sub(ans, 3LL * f[n][90000] % mod);
        //cout << ans << "\n";

        sub(res, ans);
        printf("%d", res);
    }
    else {
        int ans = 0;
        int res = binPow(3, n);
        for (int i = sum / 2 + 1; i <= sum; i++) add(ans, dp[n][i]);

        ans = 3LL * ans % mod;
        sub(res, ans);
        printf("%d", res);
    }
    return 0;
}


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

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
#define dump(val) cerr << __LINE__ << ":\t" << #val << " = " << (val) << endl

using namespace std;

typedef long long int lli;

template<typename T>
vector<T> make_v(size_t a, T b) {
    return vector<T>(a, b);
}

template<typename... Ts>
auto make_v(size_t a, Ts... ts) {
    return vector<decltype(make_v(ts...))>(a, make_v(ts...));
}

int main() {
    lli N, K;
    cin >> N >> K;
    lli ans = 0;
    vector<lli> memo(K, 0);
    REP(i, 1, N + 1) {
        memo[i % K]++;
    }
    REP(a, 1, N + 1) {
        lli b = (1000000LL * K - a) % K;
        lli c = (1000000LL * K - a) % K;
        if ((b + c) % K == 0) {
            ans += memo[b] * memo[c];
        }
        /*
        dump(a);
        dump(b);
        dump(c);
        dump(ans);
        */
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1792
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            int X = int.Parse(Console.ReadLine());
            int ans = 8 - ((X - 400) / 200);
            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 27540
import java.util.*;

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

    int N = sc.nextInt();
    TreeMap<String, Integer> h = new TreeMap<String, Integer>();
    for (int i = 0; i < N; i++) {
      String s = sc.next();
      h.put(s, h.getOrDefault(s, 0)+1);
    }

    PriorityQueue<Map.Entry<String, Integer>> q = new PriorityQueue<Map.Entry<String, Integer>>(h.size(), new Comparator<Map.Entry<String, Integer>>() {
      public int compare(Map.Entry<String, Integer> e1, Map.Entry<String, Integer> e2) {
        if(e1.getValue() > e2.getValue()) {
            return -1;
        } else if(e2.getValue() > e1.getValue()) {
            return 1;
        } else {
          return e1.getKey().compareTo(e2.getKey());
        }
      }
    });

    for (Map.Entry<String, Integer> e : h.entrySet()) {
      q.add(e);
    }

    Map.Entry<String, Integer> e = q.poll();
    int maxCount = e.getValue();
    System.out.println(e.getKey());
    while (true) {
      e = q.poll();
      if (e == null || e.getValue() != maxCount) {
        break;
      }
      System.out.println(e.getKey());
    }
  }
}


Measured memory_bytes: 81680
# -*- coding: utf-8 -*-
H, W =  map(int, input().split(' '))
table = [list(input()) for _ in range(H)]

buf = []

n = 0
for i in range(H):
    for j in range(W):
        if table[i][j] == '#':
            buf.append((i, j))
            n += 1


ans = 0
while n != H * W:
    ans += 1

    buf2 = []
    for i, j in buf:
        if i-1 >= 0 and table[i-1][j] != '#':
            table[i - 1][j] = '#'
            buf2.append((i-1, j))
            n += 1

        if i+1 < H and table[i+1][j] != '#':
            table[i + 1][j] = '#'
            buf2.append((i+1, j))
            n += 1

        if j-1 >= 0 and table[i][j-1] != '#':
            table[i][j-1] = '#'
            buf2.append((i, j-1))
            n += 1

        if j+1 < W and table[i][j+1] != '#':
            table[i][j+1] = '#'
            buf2.append((i, j+1))
            n += 1

    buf = buf2

    # print('-- -- --')
    # print(buf)
    # for row in table:
    #     print(''.join(row))


print(ans)


Measured memory_bytes: 127916
#include<bits/stdc++.h>
using namespace std;
int n,m,sum1,sum2,a[110];
int main()
{
    scanf("%d",&n);
    sum1=0;
    for(int i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
        sum1+=a[i];
    }
    scanf("%d",&m);
    sum2=sum1;
    while(m--)
    {
        int p,x;
        scanf("%d%d",&p,&x);
        if(x>=a[p-1]) 
        sum1+=x-a[p-1];
        else 
        sum1-=a[p-1]-x;
        printf("%d\n",sum1);
        sum1=sum2;
    }
    return 0;
}

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

using namespace std;

void Main() {
    int N;
    cin >> N;
    int ans = 0;
    if (N % 1000 != 0) {
        ans = -((N % 1000) - 1000);
    }
    cout << ans << endl;
}

int main() {
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


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

int main(){
    int n;
    cin >> n;
    vector<tuple<string, int, int>> a; 
    vector<tuple<int, string, int>> b; 
    string s;
    int p;
    rep(i, n){
        cin >> s >> p;
        a.push_back(make_tuple(s, p*(-1), i));
    }
    
    sort(a.begin(), a.end());

    int num;

    rep(j, n){
        tie(s, p, num) = a.at(j);
        cout << num+1 << endl;
    }

}


Measured memory_bytes: 256
/*
* Welcome to my code!
*--------------------
* author : lynmisakura(twitter : @andoreiji11)
*/

#include<bits/stdc++.h>

using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define repn for(int i = 0;i < n;i++)
#define ain(a) for(auto& i : a)cin >> i;
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x.size())
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define cont continue

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using pi = pair<int,int>;
using vpi = vector<pi>;
using pl = pair<ll,ll>;
using vpl = vector<pl>;

template<class T> bool chmin(T& a,T b){if(a > b){a = b;return true;}else return false;}
template<class T> bool chmax(T& a,T b){if(a < b){a = b;return true;}else return false;}
template<class T> void print(vector<T>& ans){
  int sz = ans.size();
  for(int i = 0;i < sz;i++)cout << ans[i] << (i < sz - 1 ? ' ' : '\n');
}


bool on_wall(ll x,ll y,ll l,ll r){
  return (x == 0) || (x == l) || (y == 0) || (y == r);
}
int main(void){
  ll r,l,n;
  cin >> l >> r >> n;

  vector<pair<ll,int>> p[4];

  rep(i,n){
    ll x1,y1,x2,y2;
    cin >> x1 >> y1 >> x2 >> y2;
    if(on_wall(x1,y1,l,r) && on_wall(x2,y2,l,r)){
      if(y1==0) p[0].eb(x1,i);
      else if(x1==l)p[1].eb(y1,i);
      else if(y1==r)p[2].eb(x1,i);
      else p[3].eb(y1,i);

      if(y2==0) p[0].eb(x2,i);
      else if(x2==l)p[1].eb(y2,i);
      else if(y2==r)p[2].eb(x2,i);
      else p[3].eb(y2,i);
    }
  }

  rep(i,4){
    if(p[i].size())sort(all(p[i]));
  }
  if(p[2].size())reverse(all(p[2]));
  if(p[3].size())reverse(all(p[3]));

  queue<int> proc;
  rep(i,4){
    if(p[i].size())for(auto j : p[i])proc.push(j.second);
  }
  stack<int> s;
  while(proc.size()){
    int x = proc.front();
    proc.pop();
    
    if(s.size() && x == s.top())s.pop();
    else s.push(x);
  }

  if(s.empty()){
    cout << "YES" << '\n';
  }else cout << "NO" << '\n';
}


Measured memory_bytes: 4840
f n a m x =
  let x' = (a * x) `mod` m
  in
    if x' == 1
    then n + 1
    else f (n+1) a m x'

ans (a1:m1:a2:m2:a3:m3:_) =
  let n1 = f 0 a1 m1 1
      n2 = f 0 a2 m2 1
      n3 = f 0 a3 m3 1
  in
    lcm n1 $ lcm n2 n3

main = do
  c <- getContents
  let i = takeWhile (/= [0,0,0,0,0,0]) $ map (map read) $ map words $ lines c :: [[Int]]
      o = map ans i
  mapM_ print o

Measured memory_bytes: 8172
import sys
k=int(input())
a=list(map(int,input().split()))
min=2;max=2
min=((min+a[k-1]-1)//a[k-1])*a[k-1]
max=(max//a[k-1])*a[k-1]
if min>max:
  print(-1)
  sys.exit()
for i in range(k-1,0,-1):
  max=max+a[i]-1
  min=((min+a[i-1]-1)//a[i-1])*a[i-1]
  max=(max//a[i-1])*a[i-1]
  if min>max:
    print(-1)
    sys.exit()
max+=a[0]-1
print(min,max)

Measured memory_bytes: 14400
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rrep(i,n) for(ll i = 1; i <= (n); ++i)
#define drep(i,n) for(ll i = (n)-1; i >= 0; --i)
#define all(v) v.begin(),v.end()
#define len(x) (ll)(x).length()
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define pb push_back
#define sz(x) (ll)(x).size()
#define v(T) vector<T>
#define vv(T) vector<vector<T>>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
ll gcd(ll a,ll b){if(a%b==0){return b;}else{return(gcd(b,a%b));}}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
const int INF=1e9;
const ll MX = 1e18;
const int MOD=INF+7;
const int di[] = {-1,0,1,0};
const int dj[] = {0,-1,0,1};
const double PI=acos(-1);
 
int main() {
  char a,b;
  cin>>a>>b;
  int ac=a-'0';
  int bc=b-'0';
  string ab,bb;
  rep(i,ac){
    bb+=b;
  }
  rep(i,bc){
    ab+=a;
  }
  cout<<min(ab,bb)<<endl;
}

Measured memory_bytes: 3596
import java.util.Scanner;

public class Main {

	public static void main(String args[])
	{
		Scanner scan=new Scanner(System.in);
		int n=scan.nextInt();
		long sum=0;
		int min=Integer.MAX_VALUE;
		int flag=0;
		for(int i=0;i<n;i++)
		{
			int a=scan.nextInt();
			int b=scan.nextInt();
			if(a!=b)flag=1;
			sum+=b;
			if(a>b) {
			min=Math.min(min,b);
			}
		}
		if(flag==0)
		{
			System.out.println(0);
		}else {
			System.out.println(sum-min);
		}
	}

}


Measured memory_bytes: 47968
use std::cmp;
use std::io;

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

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

fn main() {
    let n: isize;
    let mut m: isize;
    input!(n, m);

    let mut ans: isize = cmp::min(n, m / 2);
    m -= ans * 2;

    ans += m / 4;
    println!("{}", ans);
}

Measured memory_bytes: 4352
N = int(input())
A = list(map(int, input().split()))
A.sort(reverse=True)
if N == 2:
    print(A[0])
    exit()
ans = 0
second_half = N // 2
first_half = N - second_half
for i in range(first_half - 1):
    ans += A[i]
if N % 2 == 1:
    for i in range(second_half):
        ans += A[i + 1]
else:
    for i in range(second_half - 1):
        ans += A[i + 1]
    ans += A[second_half - 1]
print(ans)

Measured memory_bytes: 31368
#include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < n; i++)
#define ALL(a) a.begin(), a.end()
#define MOD 1000000007
using namespace std;
typedef long long ll;

ll gcd(ll a, ll b) {
    if (a < b) swap(a, b);
    ll r = a % b;
    while (r != 0) {
        a = b;
        b = r;
        r = a % b;
    }
    return b;
}

ll lcm(ll a, ll b) {
    return a / gcd(a, b) * b;
}

int main() {
    int N, M; cin >> N >> M;
    vector<int> A(N);
    REP(i, 0, N) cin >> A[i];

    int twocount = 0;
    while (A[0] % 2 == 0) {
        twocount++;
        A[0] /= 2;
    }
    REP(i, 1, N) {
        int cnt = 0;
        while (A[i] % 2 == 0) {
            cnt++;
            A[i] /= 2;
        }
        if (cnt != twocount) {
            cout << 0 << endl;
            return 0;
        }
    }

    for (int i = 0; i < twocount - 1; i++) M /= 2;

    ll l = A[0];
    REP(i, 1, N) l = lcm(l, A[i]);
    cout << (M / l + 1) / 2 << endl;
    return 0;
}

Measured memory_bytes: 640
//04
#include<iostream>
#include<complex>
#include<algorithm>
#include<cmath>

using namespace std;

typedef complex<double> P;

double cr(P a,P b){
  return a.real()*b.imag()-a.imag()*b.real();
}

P ip(double a,double b,double c,double d){
  P ap=P(a,0),bp=P(b,1),cp=P(0,c),dp=P(1,d);
  return ap+(bp-ap)/cr(dp-cp,bp-ap)*cr(dp-cp,cp-ap);
}

int main(){
  for(int n;cin>>n,n;){
    double cp[4][30];
    for(int i=0;i<4;i++){
      for(int j=0;j<n;j++){
	cin>>cp[i][j];
      }
    }
    P p[32][32];
    p[0][0]=P(0,0);
    for(int i=1;i<=n;i++){
      p[0][i]=P(cp[0][i-1],0);
    }
    p[0][n+1]=P(1,0);
    for(int i=1;i<=n;i++){
      p[i][0]=P(0,cp[2][i-1]);
      for(int j=1;j<=n;j++){
	p[i][j]=ip(cp[0][j-1],cp[1][j-1],cp[2][i-1],cp[3][i-1]);
      }
      p[i][n+1]=P(1,cp[3][i-1]);
    }
    p[n+1][0]=P(0,1);
    for(int i=1;i<=n;i++){
      p[n+1][i]=P(cp[1][i-1],1);
    }
    p[n+1][n+1]=P(1,1);
    double m=0;
    double s=0;
    for(int i=0;i<n+1;i++){
      for(int j=0;j<n+1;j++){
	m=max(m,fabs(cr(p[i+1][j+1]-p[i][j],p[i+1][j]-p[i][j])/2)
	      +fabs(cr(p[i+1][j+1]-p[i][j],p[i][j+1]-p[i][j])/2));
      }
    }
    cout<<fixed<<m<<endl;
  }
  return 0;
}
	

Measured memory_bytes: 1304
#include<bits/stdc++.h>
#define f(i,a,b) for(i=a;i<b;i++)

using namespace std;
int  main()
{
   long long int n,k,i,sum=0;
    cin>>n>>k;
   long long int a[n];
   f(i,0,n)
   {
      cin>>a[i];
      sum+=a[i];
   }
   sort(a,a+n,greater<int>());
    int h=-1;
   if(k>=n)
   cout<<"0";
  
   else
   {
      while(k--)
      {
          
          sum-=a[++h];
      }
      cout<<sum;
   }
}

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

int main(){
	long n;
	long count = 0, tak = 0, aok = 0;
	cin >> n;
	long t,a;
	cin >> t >> a;
	tak =t; aok = a;
	count = t + a;
	for(int i = 1; i < n; i++) {
		cin >> t >> a;
		if (tak % t != 0)
		{
			count += (long)(t - (tak % t));
			tak += long(t - (tak % t));
		}
		
		if (aok % a != 0)
		{
			count += (long)a - (aok % a);
			aok += (long)a -( aok % a);
		}
		long u,v;u = tak / t; v = aok / a;
		if(u == v)
			continue;
		if (u < v) {
			count += (v - u) * t;
			tak   += (v - u) * t;
		} else { 
			count += (u - v) * a;
			aok   += (u - v) * a;
		}
		
	}
	
	cout << count << endl;
}



Measured memory_bytes: 256
import time

def is_feasible_travel(N, t, x, y):
    t_old, x_old, y_old = t[0], x[0], y[0]
    if N == 1:
        if t_old < (x_old + y_old):
            return False
        if (t_old % 2) == ((x_old + y_old) % 2):
            return True
        else:
            return False

    for ti, xi, yi in zip(t[1:], x[1:], y[1:]):
        t_diff = ti - t_old
        x_diff = abs(xi - x_old)
        y_diff = abs(yi - y_old)

        dist = x_diff + y_diff
        if dist > t_diff:
            return False
        elif dist < t_diff:
            if (dist % 2) != (t_diff % 2):
                return False

        t_old, x_old, y_old = ti, xi, yi
    return True


def main():
    N = int(input())
    t = [0] * N
    x = [0] * N
    y = [0] * N
    for i in range(N):
        t[i], x[i], y[i] = map(int, input().split())

    # start = time.time()
    if is_feasible_travel(N, t, x, y):
        print("Yes")
    else:
        print("No")
    # print(time.time() - start)


if __name__ == '__main__':
    main()


Measured memory_bytes: 14096
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(v) sort(v.begin(), v.end())
typedef long long ll;
using Graph = vector<vector<int>>;
const int mod = 1000000007;
int n;

int check(vector<int> &A)
{
  rep(i, n)
  {
    if (A.at(i) % 2 != 0)
    {
      return 0;
    }
  }
  return 1;
}

void sla(vector<int> &A)
{
  rep(i, n)
  {
    A.at(i) /= 2;
  }
}

int main()
{
  cin >> n;
  vector<int> A(n);
  rep(i, n)
  {
    int a;
    cin >> a;
    if (a % 2 != 0)
    {
      cout << 0 << endl;
      exit(0);
    }
    A.at(i) = a;
  }
  int cnt = 0;
  do
  {
    sla(A);
    cnt++;
  } while (check(A) == 1);
  cout << cnt << endl;
}


Measured memory_bytes: 3616
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#define int long long
using namespace std;
int f(int k) {
	int p = k, r = 0;
	while (p > 0) {
		r += p % 10;
		p /= 10;
	}
	return r;
}
signed main() {
	int n; cin >> n;
	int ans = 9 * 10;
	for (int i = 1; i < n; i++) {
		ans = min(ans, f(i) + f(n - i));
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
n,k = map(int,input().split())
a = [int(i) for i in input().split()]
l = 0
r = 10**9
while l+1 < r:
    m = (l+r)//2
    cnt = 0
    for i in range(n): cnt += (a[i]+m-1)//m-1
    if cnt > k: l = m
    else: r = m
print(r)

Measured memory_bytes: 30992
#include <iostream>
using namespace std;
int main(void){
	int a,b,c,x,y;
	cin>>a>>b;
	for (c=0;c<b;c++){
		cin>>x>>y;
		if(y>a/2)y=(a+1)-y;
		if(x>a/2)x=(a+1)-x;
		if(x>y)x=y;
		if(x%3==0) cout<<"3"<<endl;
		else cout<<x%3<<endl;
	}
	return 0;
}

Measured memory_bytes: 3088
from sys import stdin, stdout

input = lambda: stdin.readline()
write = stdout.write

def main():
    N = int(input())

    ans = 0
    for i in range(1, N + 1, 2):
        div = 0
        for j in range(1, N + 1):
            if not i % j:
                div += 1
        if div == 8:
            ans += 1
    print(ans)

main()


Measured memory_bytes: 3060
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
using namespace std;

#define rep(i,n) for(int i=0;i<(n);i++)
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define dbg(x) cout<<#x"="<<x<<endl

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<pii, int> ppi;

#define INF 1000000000
#define R_MAX 10
#define C_MAX 10000

bool f[R_MAX][C_MAX];
int cn[C_MAX];
int r,c;

int main(){

  while(true){
    cin >> r >> c;
    if(r==0 && c==0) break;

    rep(i,r){
      rep(j,c){
	int d;
	scanf("%d", &d);
	if(d==0) f[i][j]=true;
	else f[i][j]=false;
      }
    }

    int ans=0;

    rep(n,1<<r){
      fill(cn, cn+c, 0);
      rep(i,r){
	if((n>>i)%2){
	  rep(j,c){
	    if(f[i][j]) cn[j]++;
	  }
	}
	else {
	  rep(j,c){
	    if(!f[i][j]) cn[j]++;
	  }
	}
      }

      int tmp=0;
      rep(i,c){
	tmp += max(cn[i], r-cn[i]);
      }
      ans = max(ans, tmp);
    }

    cout << ans << endl;

  }

}

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

typedef long long ll;

const int inf = 1000000;

int main() {
    ll N, h=0;
    cin >> N;
    vector<ll> A(N+1, 0);
    for (ll i = 1; i <= N; i++) {
        ll a;
        cin >> a;
        A[a]=A[a-1]+1;
        h=max(h, A[a]);
    }
    cout << N-h << endl;
}


Measured memory_bytes: 4844
n,k,*a = map(int,open(0).read().split())
def func(b):
  c = k
  for i in a:
    c -= (i-1)//b
    if c < 0:
      return False
  return True
l = 1
r = max(a)
while(r>l):
  lr = (l+r)//2
  if func(lr):
    r = lr
  else:
    l = lr + 1
print(r)

Measured memory_bytes: 31620
#include <cstdio>

void search(int (*A)[101], int *dis, int n){
    int hoge;
    int time=0;
    for(int k=1;k<n;k++){
        hoge = 1;
        for(int i=1;i<=n;i++){
            if(dis[i]==time){
                for(int j=1;j<=n;j++){
                    if(A[i][j]&&dis[j]<0){
                        dis[j]=time+1;
                        hoge=0;
                    }
                }
            }
        }
        time++;
        if(hoge)return;
    }
}

int main(){
    int i, j, n, u, k, v;
    scanf("%d",&n);
    int dis[n+1];
    dis[1]=0;
    for(i=2;i<=n;i++){
        dis[i]=-1;
    }
    int A[101][101];
    for(i=1;i<=n;i++){
        for(j=1;j<=n;j++){
            A[i][j]=0;
        }
    }
    for(i=1;i<=n;i++){
        scanf("%d %d",&u,&k);
        for(j=0;j<k;j++){
            scanf("%d",&v);
            A[u][v]=1;
        }
    }
    search(A,dis,n);
    for(i=1;i<=n;i++)printf("%d %d\n",i,dis[i]);
    return 0;
}



Measured memory_bytes: 2744
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>
#include<complex>
#include<map>

#define f first
#define s second

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define ALL(c) (c).begin(), (c).end()
#define EPS (1e-10)
using namespace std;

typedef unsigned int uint;
typedef long long ll;
typedef complex<double> P;

int main(){
  double l = 1e20, h = 0.0;
  double t;
  while(cin>>t){
    h = max(h, t);
    l = min(l, t);
  }
  printf("%.3f\n",h-l);
  return 0;
}

Measured memory_bytes: 0
#!/usr/bin/env python3
import sys
try:
    from math import gcd
except Exception:
    from fractions import gcd

MOD = 1000000007  # type: int

def solve(N: int, S: "List[str]"):
    conv = []
    i = 0
    while i < N:
        c, o = (0, 1) if S[0][i] == S[1][i] else (1, 2)
        conv.append(c)
        i += o

    ret = 3 if conv[0] == 0 else 6
    for b, c in zip(conv, conv[1:]):
        if b == 0 and c == 0:
            ret *= 2
        elif b == 0 and c == 1:
            ret *= 2
        elif b == 1 and c == 0 :
            ret *= 1
        elif b == 1 and c == 1:
            ret *= 3
    return ret % MOD

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    S = [ next(tokens) for _ in range(2) ]  # type: "List[str]"
    result = solve(N, S)
    print(result)

if __name__ == '__main__':
    main()


Measured memory_bytes: 5076
from decimal import Decimal, ROUND_HALF_UP

N = int(input())
As = list(map(int, input().split()))

m = Decimal(sum(As)/N).quantize(Decimal('0'), rounding=ROUND_HALF_UP)

rlt = 0

for i in As:
  rlt += (i - m)**2

print(rlt)

Measured memory_bytes: 59500
/*
 *Author - Abhas Jain
 */
 
#include <bits/stdc++.h>
 
#define F first
#define S second
#define all(c) c.begin(), c.end()
#define endl '\n'
#define pb push_back
 
 
typedef long long ll;
typedef long double ld;
 
using namespace std;
mt19937 rang(chrono::high_resolution_clock::now().time_since_epoch().count());
 
const ld PI = 3.141592653589793;
const ll INF = 9223372036854775807ll;
const ll mod = 1e9 + 7;
 
void solve() 
{
    int n;
    cin >> n;
    int best = - 1, sec_best = -1;
    vector<int> lul;
    for (int i = 0; i < n; ++i) {
    	int cur;
    	cin >> cur;
    	lul.pb(cur);
    	if (cur >= best) {
    		sec_best = best;
    		best = cur;
    	} else if (cur > sec_best) {
    		sec_best = cur;
    	}
    }
    for (int i = 0; i < n; ++i) {
    	if (lul[i] == best) cout << sec_best << endl;
    	else cout << best << endl;
    }
}
 
int main( )
{   
    ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    srand(chrono::high_resolution_clock::now().time_since_epoch().count());
    solve();
    return 0;
}

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

int main() {
   
  int N;
  cin >> N;
  vector<int> L(N);
  int LMAX=0;
  int S=0;
  for(int i=0;i<N;i++){
    cin >> L.at(i);
      if(L.at(i)>LMAX){
        LMAX=L.at(i);
      }
    S=S+L.at(i);
  }
  if(S-LMAX > LMAX){
    cout<<"Yes"<<endl;
  }
    else{
      cout<<"No"<<endl;
    }
}


Measured memory_bytes: 256
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <bitset>
#include <chrono>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <utility>
using namespace std;

#if defined(_MSC_VER)
#include <intrin.h>
#define popcount __popcnt
#define popcount64 __popcnt64
#elif defined(__GNUC__)
#define popcount __builtin_popcount
#define popcount64 __builtin_popcountll
#endif

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

    int d = count(x.begin(), x.end(), '1');
    vector<int> result(n);
    if (d == 0) {
        result.assign(n, 1);
    } else if (d == 1) {
        int idx1 = find(x.begin(), x.end(), '1') - x.begin();
        if (idx1 == n - 1) {
            result.assign(n, 2);
            result[n - 1] = 0;
        } else {
            result.assign(n, 1);
            result[idx1] = 0;
            result[n - 1] = 2;
        }
    } else {
        vector<int> f(200001 + 1);
        for (int i = 1; i <= 200001; ++i) {
            f[i] = f[i % popcount(i)] + 1;
        }

        int sum_dp1 = 0;
        int sum_dm1 = 0;
        int p2_dp1 = 1;
        int p2_dm1 = 1;
        for (int i = n - 1; i >= 0; --i) {
            (sum_dp1 += p2_dp1 * (x[i] == '1')) %= d + 1;
            (sum_dm1 += p2_dm1 * (x[i] == '1')) %= d - 1;
            (p2_dp1 *= 2) %= d + 1;
            (p2_dm1 *= 2) %= d - 1;
        }

        p2_dp1 = 1;
        p2_dm1 = 1;
        for (int i = n - 1; i >= 0; --i) {
            if (x[i] == '0') {
                int rem = (sum_dp1 + p2_dp1) % (d + 1);
                result[i] = f[rem] + 1;
            } else {
                int rem = (sum_dm1 + (d - 1) - p2_dm1) % (d - 1);
                result[i] = f[rem] + 1;
            }
            (p2_dp1 *= 2) %= d + 1;
            (p2_dm1 *= 2) %= d - 1;
        }
    }

    for (int i = 0; i < n; ++i) {
        cout << result[i] << "\n";
    }
    cout << flush;
}


Measured memory_bytes: 5176
#include <bits/stdc++.h>
        using namespace std;
        #define ll long long int
        #define pb push_back
        #define mk make_pair
        #define ft first
        #define sc second
        #define ppb pop_back
        #define sz size
        #define forn(i,a,n) for(i=a;i<n;i++)
        #define M 998244353 
        #define inf 2e18
        
        int main() {
 
        ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        cout.tie(NULL);
        
        
        ll x,y,a,b,c;
        cin>>x>>y>>a>>b>>c;
        vector<ll> A(a),B(b),C(c);
        for(ll i=0;i<a;i++)cin>>A[i];
        for(ll i=0;i<b;i++)cin>>B[i];
        for(ll i=0;i<c;i++)cin>>C[i];

        sort(A.begin(),A.end());
        sort(B.begin(),B.end());
        sort(C.begin(),C.end());
        reverse(A.begin(),A.end());
        reverse(B.begin(),B.end());
        reverse(C.begin(),C.end());
        
        vector<ll> ans;
        for(ll i=0;i<x;i++){
            ans.pb(A[i]);
        }
        for(ll j=0;j<y;j++)
            ans.pb(B[j]);

        for(ll k=0;k<c;k++)
            ans.pb(C[k]);

        sort(ans.begin(),ans.end());
        reverse(ans.begin(),ans.end());
        ll sum=0;
        for(ll i=0;i<x+y;i++)
            sum+=ans[i];
        cout<<sum;

        return 0;
        }

Measured memory_bytes: 8816
#include <bits/stdc++.h>
using namespace std;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ll long long
#define ld long double
#define all(a) (a).begin(),(a).end()
#define mk make_pair
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;
ll MOD=1000000007;

int main() {
    int n,x,y;
    cin >> n >> x >> y;
    x--;
    y--;
    vector<int> e(n,0);
    rep(i,n){
        for (int j=i+1;j<n;j++){
            int t=j-i;
            t=min(t,abs(x-i)+abs(y-j)+1);
            t=min(t,abs(y-i)+abs(x-j)+1);
            e[t]++;
        }
    }
    rep(i,n-1){
        cout << e[i+1] << endl;
    }
}


Measured memory_bytes: 256
from collections import Counter

def inpl(): return list(map(int, input().split()))

N, A, B = inpl()

ans = 0
for i in range(1, N + 1):
    tmp = 0
    for a in list(str(i)):
        tmp += int(a)
    # print(i, tmp)
    if A <= tmp <= B:
        ans += i
print(ans)

Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll N=2005;
vector<ll> adj[N];
string str;
ll dp_min[N],dp_max[N],cnt[N],inf=1e15;
ll func(ll u,ll pr=-1){
    dp_min[u]=dp_max[u]=cnt[u]=0;
    for(auto &v:adj[u]){
        if(v==pr)continue;
        func(v,u);
        dp_max[u]+=dp_max[v];
        cnt[u]+=cnt[v];
    }
    dp_min[u]=dp_max[u]%2;
    for(auto &v:adj[u]){
        if(v==pr)continue;
        dp_min[u] = max(dp_min[u] , dp_min[v]+dp_max[v]-dp_max[u]);
    }

    if(pr==-1){
        if(dp_min[u]==0)return dp_max[u]/2;
        return inf;
    }

    if(str[u]=='1')cnt[u]++;
    dp_max[u]+=cnt[u];
    dp_min[u]+=cnt[u];

    return -1;
}
int main(){
    ios_base:: sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    ll n;cin>>n>>str;
    for(ll i=0;i<n-1;i++){
        ll u,v;cin>>u>>v;
        u-=1;v-=1;
        adj[u].push_back(v);
        adj[v].push_back(u);
    }
    ll ans = inf;
    for(ll i=0;i<n;i++)ans=min(ans , func(i));

    if(ans==inf)ans=-1;
    cout<<ans;

}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int main()
{  std::ios_base::sync_with_stdio(0);
   cin.tie(NULL);
    int a,b;
    char c;
    cin>>a>>c>>b;
    if(c=='+'){cout<<a+b;}
    else{cout<<a-b;}

return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define ar array
#define AC ios_base::sync_with_stdio(0); cin.tie(NULL);
using namespace std;
const int M = 1e9+7;
const int N = 2*1e5;

int A[200005], B[200005];
ll A_acc[200005], B_acc[200005];
int n, m, k;

int main(){
    AC
    cin>>n>>m>>k;
    for(int i=1; i<=n; i++){
        cin>>A[i];
        A_acc[i] = A_acc[i-1] + (ll)A[i];
    }
    for(int i=1; i<=m; i++){
        cin>>B[i];
        B_acc[i] = B_acc[i-1] + (ll)B[i];
    }

    int aid = n;
    while(A_acc[aid]>k)
        aid--;
    
    int ans = aid;
    int bid = 1;
    while(1){
        if(A_acc[aid]+B_acc[bid]<=k){
            ans = max(ans, aid+bid);
            bid++;
        }
        else
            aid--;
        if(aid<0 || bid>m)
            break;
    }
    cout<<ans<<endl;

}

Measured memory_bytes: 8348
import numpy as np

n, k = map(int, input().split())
#print(n,k)
ary = np.array([i for i in range(n+1)])
cum = np.cumsum(ary)
#print(cum)

ans = 0
for j in range(k,n+1):
    ans += (cum[-1] - cum[-j-1]) - cum[j-1] + 1
    
else:
    ans += 1
    ans %= 10**9+7

print(ans)

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

using namespace std;

typedef long long ll;

#define REP(i, n) for(int i=0; i<n; ++i)
#define FOR(i, a, b) for(int i=a; i<b; ++i)
#define FORR(i, a, b) for(int i=b-1; i>=a; --i)

int n;
ll c;
ll x[110000], v[110000], s[110000], a1[110000], a2[110000], b1[110000], b2[110000];
ll ans;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin>>n>>c;
	REP(i, n){
		cin>>x[i+1]>>v[i+1];
		s[i+1]=s[i]+v[i+1];
		a1[i+1]=max(a1[i], s[i+1]-x[i+1]);
		a2[i+1]=max(a2[i], s[i+1]-x[i+1]*2);
	}
	FORR(i, 1, n+1){
		b1[i]=max(b1[i+1], s[n]-s[i-1]-(c-x[i]));
		b2[i]=max(b2[i+1], s[n]-s[i-1]-(c-x[i])*2);
	}
	REP(i, n+1) ans=max(ans, max(a1[i]+b2[i+1], a2[i]+b1[i+1]));
	cout<<ans<<'\n';
	return 0;
}


Measured memory_bytes: 5888
#include <bits/stdc++.h>
using namespace std;
//Coding Is Shit
#define  ll long long int


ll k;
ll t[55];
ll r[55];
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin>>k;
    int n = 50;
    cout<<"50"<<endl;
    for(int i = 0 ;i<50;i+=1)
    {
        t[i]  = k/n;
    }
    for(int i = 0 ;i<k%n;i+=1)
    {
        t[i]+=1;
    }
    for(int i = 0 ;i<n;i+=1)
    {
        r[i] = t[i]*(n+1)+(n-1)-k;
    }
    for(int i = 0 ;i<n;i+=1)
    {
        cout<<r[i]<<" ";
    }
    cout<<endl;
    return 0;
    
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(void)
{
  int N;
  cin >> N;
  long long ans = 0;
  for(int i = 1 ; i <= N ; i++)
  {
    if(i % 3 == 0)continue;
    else if(i % 5 == 0)continue;
    else ans += i;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3624
import java.util.*;

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

	int a = scanner.nextInt();
	int b = scanner.nextInt();

	if (a < b) System.out.println("a < b");
        else if (a > b) System.out.println("a > b");
        else System.out.println("a == b");
    }
}

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

#define itn int
#define all(x) (x).begin(), (x).end()
#define make_unique(x) sort(all((x))); (x).resize(unique(all((x))) - (x).begin())

using namespace std;

inline int nxt() {
	int x;
	scanf("%d", &x);
	return x;
}


int main() {
	int n = nxt();
	vector<vector<int>> a(n);
	for (int i = 0; i < n; ++i) {
		string s;
		cin >> s;
		for (int j = 0; j < n; ++j) {
			if (s[j] == '1') {
				a[i].push_back(j);
			}
		}
	}

	int ans = -1;
	for (int i = 0; i < n; ++i) {
		queue<int> q;
		q.push(i);
		vector<int> d(n, -1);
		d[i] = 0;
		while (!q.empty()) {
			int v = q.front();
			q.pop();
			for (int x : a[v]) {
				if (d[x] == -1) {
					d[x] = d[v] + 1;
					q.push(x);
				} else if (d[x] == d[v]) {
					cout << "-1\n";
					return 0;
				}
			}
		}
		ans = max(ans, *max_element(all(d)) + 1);
	}

	cout << ans << "\n";

	return 0;
}


Measured memory_bytes: 512
import java.util.Scanner;
class Main{
    public static void main(String arg[]){
        Scanner scn=new Scanner(System.in);
        String n=scn.next();
        int num=Integer.parseInt(n);
        while(true){
            if(n.charAt(0)==n.charAt(1)&&n.charAt(1)==n.charAt(2)){
                break;
            }
            num++;
            n=String.valueOf(num);
        }
        System.out.println(n);
    }
}

Measured memory_bytes: 23764
#include "bits/stdc++.h"
#include "ext/pb_ds/assoc_container.hpp"
#include "ext/pb_ds/tree_policy.hpp"
#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
using namespace std;
using namespace __gnu_pbds;
#define int long long int
#define pb push_back
#define vec vector<int>
#define fo(i, n) for (int i = 0; i < n; i++)
#define foo(i, a, b) for (int i = a; i < b; i++)
#define mp make_pair
#define deb(x) cout << #x << " --> " << x << endl;
#define deb1a(v)                  \
    cout << #v << "--->" << endl; \
    for (auto it : v)             \
        cout << it << " ";        \
    cout << endl;
#define deb2a(v)                  \
    cout << #v << "--->" << endl; \
    for (auto it : v)             \
    {                             \
        for (auto it1 : it)       \
        {                         \
            cout << it1 << " ";   \
        }                         \
        cout << endl;             \
    }
#define deb3a(v)                               \
    cout << #v << "-->" << endl;               \
    for (auto it : v)                          \
    {                                          \
        cout << it.fi << " " << it.se << endl; \
    }
#define mod 1000000007
#define so(v) sort(v.begin(), v.end())
#define fi first
#define se second
#define db1(x) cout << #x << "=" << x << endl
#define db2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define db3(x, y, z) cout << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z << endl
int power(int x, unsigned int y, int p)
{
    int 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 mI(int a, int m)
{
    return power(a, m - 2, m);
}
vector<vector<int>> dir = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}, {1, 1}, {1, -1}, {-1, 1}, {-1, -1}};
#define double long double


void solve()
{
    string s;
    cin >> s;
    int n = s.size();
    if(s[n-1]=='s'){
        s += "es";
    }
    else{
        s.pb('s');
    }
    cout << s;

}


int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    srand(time(0));

    // FILE *fin = freopen("ip.txt","r",stdin);
    // FILE *fout = freopen("op.txt","w",stdout);
    int t = 1, nn = 1;
    //cin >> t;
    while (t--)
    {
        // cout << "Case #" << nn << ":"
        //      << " ";
        // nn++;

        solve();
    }
}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define erep(i,a,b) for(int i=a;i<=(int)(b);++i)
#define per(i,a,b) for(int i=(a);i>(b);--i)
#define eper(i,a,b) for(int i=(a);i>=b;--i)
#define pb push_back
#define mp make_pair
#define INF (1<<30)-1
#define MOD 1000000007
#define all(x) (x).begin(),(x).end()
#define vii vector<int>
#define vll vector<long long>
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a, b)*b;}

ll a, b;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
    cin >> a >> b;
    ll ans = 0;
    while (a <= b) {
        a *= 2;
        ans++;
    }
    cout << ans << endl;
    return 0;
}


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

int main() {
  char s;
  cin >> s;
      if(s== 'a'||s=='i'||s=='u'||s=='e'||s=='o')cout<<"vowel"<<endl;

      else  { cout <<"consonant"<<endl;}
      
  // ここにプログラムを追記
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

int main() {
    string s;
    cin >> s;
    bool ans = s[2] == s[3] && s[4] == s[5];
    cout << (ans ? "Yes" : "No") << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define lol long long
using namespace std;
int main(){
  lol n,ans=0;
  string s[1010];
  size_t size[1010];
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>s[i];
    size[i]=s[i].length();
  }
  for(int i=0;i<n-1;i++){
    if(s[i][size[i]-1]!=s[i+1][0]){
      ans=1;
      break;
    }
    for(int j=i+1;j<n;j++){
      if(s[i]==s[j]){
	ans=1;
	break;
      }
    }
  }
  if(ans==0) cout<<"Yes\n";
  else cout<<"No\n";
  return(0);
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
#define sync ios_base::sync_with_stdio(false); cin.tie(NULL) 
#define input(arr,n) for(ll i1=0;i1<n;i1++ )cin>>arr[i1]
#define rep(n) for(ll i2=0;i2<n;i2++)
#define vmp(v,a,b) v.push_back(make_pair(a,b))
#define si(a) scanf("%lld",&a)
#define pi(a) printf("%lld",a)
#define aset(a,n,k) for(ll i3=0;i3<n;i3++)a[i3]=k; 	
#define mod 1000000007
#define mp(a,b) make_pair(a,b)
#define f first
#define s second 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<ll, null_type,greater_equal<ll>, rb_tree_tag,tree_order_statistics_node_update>//s.order_of_key(val) *s.find_by_orde(ind)
using namespace std;
int main()
{
	sync;
	ll a,b;
	cin>>a>>b;
	cout<<max(2*a-1,max(2*b-1,a+b));
}

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

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

using namespace std;

int main(){
    int n,m; cin>> n >> m;
    vector<int> l(m);
    vector<int> r(m);
    int lmax = 0;
    int rmin = n;
    rep(i, m) {
        cin >> l[i] >> r[i];
        if(l[i] > lmax)
            lmax = l[i];
        if(r[i] < rmin)
            rmin = r[i];
    }
    if(rmin >= lmax)
        cout << rmin -lmax + 1 << endl;
    else
        cout << 0 << endl;
}





Measured memory_bytes: 1024
#include <bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
using namespace std;

#define dump(x)  cout << #x << " = " << (x) << endl;
#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 possible(n) cout << ((n) ? "possible" : "impossible"  ) << endl

#define SANKOU(n,a,b) cout << ((n) ? (#a) : (#b) ) << endl

#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define REP(i,n) for(ll i=0;i<(n);++i)
#define REPR(i,n) for(ll i=n;i>=0;i--)

#define FOREACH(x,a) for(auto&& (x) : (a) )

#define WFA(d,v) REP(k,v)REP(i,v)REP(j,v)d[i][j]=min(d[i][j],d[i][k]+d[k][j])

#define SCOUT(x) cout<<(x)<<" "
#define ENDL cout<<endl

#define VECCIN(x) for(auto&youso_: (x) )cin>>youso_
#define VECIN2(x,y) REP(i,x.size())cin>>x[i]>>y[i]
#define VECCOUT(x) if(1){for(auto tt=x.begin();tt!=x.end();tt++){if(tt!=x.begin())cout<<" ";cout<<(*tt);}cout<<endl;}

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

#define EXIST(n,x) (find(ALL(n),x)!=n.end())
#define UNIQUE(obj) sort(ALL( obj )); obj.erase(unique(ALL(obj)),obj.end())
#define EN(x) if(1){cout<<#x<<endl;return 0;}
#define COUT(x) cout<<(x)<<endl
void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail){
    cin>>head;
    CINT(move(tail)...);
}
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)

template <class T = ll>
T IN(){T x;cin>>x;return (x);}

template <class Head>
void VT(Head head){}
template <class Head,class Seco,class... Tail>
void VT(Head&& head,Seco&& seco,Tail&&... tail){
    seco.resize(head);
    VT(head,move(tail)...);
}
void VT2(){}
template <class Head,class... Tail>
void VT2(Head&& head,Tail&&... tail){
  VECCIN(head);
  VT2(move(tail)...);
}

template <class Head>
void VT3(Head&& head){}
template <class Head,class Seco,class... Tail>
void VT3(Head&& head,Seco&& seco,Tail&&... tail){
  seco[head]=IN();
  VT3(head,move(tail)...);
}

#define VC1(n,...) V __VA_ARGS__;VT(n,__VA_ARGS__);VT2(__VA_ARGS__); //aaabbbccc
#define VC2(n,...) V __VA_ARGS__;VT(n,__VA_ARGS__);REP(i,n)VT3(i,__VA_ARGS__); //abcabcabc

// #include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision; // cpp_int

#define P pair<ll,ll>
#define V vector<ll>
#define M map<ll,ll>
#define S set<ll>

#define pb(a) push_back(a)
#define mp make_pair


int main(){
    SCIN(s);
    int n = s.size();
    if(s.back() == '1' || s[0] == '0')
        EN(-1);
    REP(i,(n-1)/2)
        if(s[i] != s[n-i-2])
            EN(-1);

    int now = 1;
    REP(i,n-1){
        bool flag = (s[i] == '1');
        SCOUT(now);
        COUT(i + 2);
        if(flag)
            now = i + 2;
    }

}


Measured memory_bytes: 1664
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include<iomanip>
#include <cstdint>
#include <sstream>
#include <map>
#include<vector>

using namespace std;
typedef long long ll;

ll mx,sum,mn=1e8,cnt;

int main(){
	ll w,h,x,y;
	cin>>w>>h>>x>>y;
	double ans=(w*h)/2.0;
	if(w-x==x && h-y==y){
		cout<<fixed<<setprecision(6)<<(double)x*h;
		cout<<" 1"<<endl;
	}
	else {
		cout<<fixed<<setprecision(6)<<(double)ans;
		cout<<" 0";
	}
	
}



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

using u32 = uint32_t;
using u64 = uint64_t;
using i32 = int32_t;
using i64 = int64_t;

int main()
{
	std::ios_base::sync_with_stdio(0);
	
	u32 n;

	std::cin >> n;

	std::cout << n*n << "\n";
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <functional>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
using namespace std;
template<class T, class Compare = less<T> >
using MaxHeap = priority_queue<T, vector<T>, Compare>;
template<class T, class Compare = greater<T> >
using MinHeap = priority_queue<T, vector<T>, Compare>;
using llong = long long;

llong n;
llong a[1005][1005];
llong len[1001005];
bool visit[1001005];
vector<llong> g[1001005];

llong dfs(llong pos) {
    if (len[pos] != 0) return len[pos];
    if (visit[pos]) { cout << -1 << endl; exit(0); }

    llong res = 0;
    visit[pos] = true;
    for (int i = 0; i < g[pos].size(); i++) {
        llong npos = g[pos][i];

        res = max(res, dfs(npos));
    }
    visit[pos] = false;

    return len[pos] = res + 1;
}

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

    for (llong i = 0; i < n; i++) {
        for (llong j = 0; j < n - 2; j++) {
            llong pos = min(i, a[i][j]) * n + max(i, a[i][j]);
            llong npos = min(i, a[i][j + 1]) * n + max(i, a[i][j + 1]);
            g[pos].push_back(npos);
        }
    }

    llong mv = 0;
    for (int i = 0; i < n * n + n; i++) {
        mv = max(dfs(i), mv);
    }

    cout << mv << endl;

    return 0;
}


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

int main(){
  int n;
  int cnt = 0;
  cin >> n;
  for(int i = 1; i < n; i++){
    for(int j = 1; j <= (n / i); j++){
      if(n - i * j > 0){
        cnt++;
      }
    }
  }
  cout << cnt << endl;
}

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

int main (){
    int a;
    cin>>a;
    cout<<a/3600<<":"<<(a%3600)/60<<":"<<(a%3600)%60<<endl;
}


Measured memory_bytes: 3100
import std.stdio,std.conv,std.string,std.algorithm;
void main(){
	for( int i;;++i ){
		auto arg = readln().chomp().split;
		auto a = arg[0].to!int , b = arg[1].to!int;
		if( !a && !b ) break;
		if( a<b ){
			writeln( a," ",b );
		}else{
			writeln( b," ",a );
		}
	}
}

Measured memory_bytes: 1244
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		var sc = new Scanner(System.in);
		var t = sc.next();
		sc.close();

		var sb = new StringBuilder();
		for (var i = 0; i < t.length(); i++) {
			var s = t.substring(i, i + 1);
			if (s.equals("?")) {
				s = "D";
			}
			sb.append(s);
		}
		System.out.println(sb.toString());
	}
}


Measured memory_bytes: 50288