akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define pb push_back
#define srt(a) sort(a.begin(),a.end())
#define rsrt(a) sort(a.rbegin(),a.rend())
#define lb(a,b) lower_bound(a.begin(),a.end(),b)
#define ub(a,b) upper_bound(a.begin(),a.end(),b)
#define MOD ((int)(1000000007 ))
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long
#define float long double
#define bigint __int128
#define sqrt sqrtl
#define cbrt cbrtl
#define endl '\n'
typedef vector<int> vi;
typedef vector<float> vf;
typedef pair<float,int> fi;
typedef pair<int,int> ii;
typedef pair<float,float> ff;
typedef vector<ff> vff;
typedef vector<ii> vii;
typedef vector<fi> vfi;
typedef vector<vi> vvi;
typedef vector<vf> vvf;
typedef vector<vii> vvii;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef priority_queue<int> pqi;
typedef priority_queue<ii> pqii;
typedef priority_queue<fi> pqfi;
typedef priority_queue <int, vector<int>, greater<int> > rpqi; 
typedef priority_queue <ii, vector<ii>, greater<ii> > rpqii; 
typedef priority_queue <fi, vector<fi>, greater<fi> > rpqfi;


vector<int> func(int n)
{
	vector<int>next(n);
	for(int i=0;i<n;i++)
	next[i]=(i+1)%n;
	
	vector<int>ans;
	
	int i=0;
	while( next[ next[i] ] != i )
	{
		int a=next[i];
		int b=next[ next[a] ];
		next[ next[a] ]=-1;
		next[a]=b;
		i=next[i];
	}
	for(int i=0;i<n;i++)
	{
		if(next[i]!=-1)
		{
			ans.push_back(i+1);
		}	
	}
	return ans;
}
int32_t main()
{
	IOS
	int n;cin>>n;
	char prev='\0';
	int cnt=0;
	for(int i=1;i<=n;i++)
	{
		char ch;cin>>ch;
		if(ch!=prev)
		{
			cnt++;
		}
		prev=ch;
	}
	cout<<cnt<<endl;
}
	
	
	
	
	
	
	
	

 


Measured memory_bytes: 256
import math

def dist(point1, point2):
	distance = math.sqrt((point1[0]-point2[0])**2+(point1[1]-point2[1])**2)
	return distance

n = int(input())
#print(n)
point=[] 
while True:
    try:
        point.append(list(map(int,input().split())))
    except:
        break;

#print(point)
kyori = 0
for i in range(n):
	for j in range(n):
		if(i!=j):
			kyori += dist(point[i],point[j])

print(kyori/n)



Measured memory_bytes: 3064
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

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

    static class ANickname {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            out.println(in.next().substring(0, 3));
        }

    }

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

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

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

    }
}



Measured memory_bytes: 25656
#include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>
#include <cstring>
#include <map>
#include <set>
#include <cmath>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define INF 1145141919
typedef long long int ll;
using namespace std;

ll gcd(ll m, ll n)
{
    if ((0 == m) || (0 == n))
        return 0;
    while (m != n)
    {
        if (m > n)
            m = m - n;
        else
            n = n - m;
    }
    return m;
}

ll lcm(ll m, ll n)
{
    if ((0 == m) || (0 == n))
        return 0;
    return ((m / gcd(m, n)) * n);
}

int ctoi(const char c)
{
    if ('0' <= c && c <= '9')
        return (c - '0');
    return -1;
}


int main(){
    int n,k;
    cin >> n >> k;
    vector<int> h(n);

    REP(i,n){
        cin >> h[i];
    }

    sort(h.begin(), h.end());

    vector<int> diff(n-k+1);

    //cout << "-------sort-------" << endl;

    //cout << "diff----h[i+k+1]----h[i]" << endl;
    REP(i,n-k+1){
        //cout << h[i+k-1]-h[i] << " " << h[i+k-1] << " " << h[i] << endl;
        diff[i] = h[i+k-1] - h[i];
    }

    cout << *min_element(diff.begin(),diff.end()) << endl;


    return 0;
}


Measured memory_bytes: 1024
n,k = gets.split.map &:to_i
if k > 0.5 * (n - 1) * (n - 2)
    puts -1
else
    ans = []
    (n-1).times{|e|
        ans << "1 #{e+2}"
    }
    c = 0
    f = 2
    t = 3
    loop {
        break if 0.5 * (n - 1) * (n - 2) - k - c == 0
        ans << "#{f} #{t}"
        t < n ? t += 1 : (f += 1; t = f + 1)
        c += 1
    }
    puts ans.size
    puts ans
end

Measured memory_bytes: 2300
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>

#define ll long long

void swap (int *x, int *y) {
  int temp;

  temp = *x;
  *x = *y;
  *y = temp;

  return;
}


long int gcd(long int a, long int b){
  long int c;

  while (b > 0){
    c = a % b;
    a = b;
    b = c;
  }

  return a;
}

int upll(const void*a, const void*b){
  return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;
}

int downll(const void*a, const void*b){
  return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;
}

void sortup(ll*a,int n){
  qsort(a,n,sizeof(ll),upll);
}

void sortdown(ll*a,int n){
  qsort(a,n,sizeof(ll),downll);
}

long int modpow(long int a,long int n,long int mod){
  long int ans=1;
  while(n>0){
    if(n & 1){
      ans=ans*a%mod;
    }
    a=a*a%mod;
    n/=2;
  }
  return ans;
}

long int modinv(long int a,long int mod){
  return modpow(a,mod-2,mod);
}

int max(int a,int b){
  if(a<b){
    return b;
  }
  else{
    return a;
  }
}

int min(int a,int b){
  if(a<b){
    return a;
  }
  else{
    return b;
  }
}

void chmax(int *a,int b){
  if(*a < b){
    *a = b;
  }

  return;
}

void chmin(int *a,int b){
  if(*a > b){
    *a =b;
  }

  return;
}


int main(void){
  int n,k;
  scanf("%d%d",&n,&k);
  int ans=(n%k);
  ans=(ans+(k-1))/k;
  printf("%d\n",ans);
  return 0;
}

Measured memory_bytes: 1732
#!/usr/bin/env python3

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

h,w = LI()
maze = [list(input()) for _ in range(h)]

dx,dy = [0,1,0,-1],[1,0,-1,0]
ans = 0
for i in range(h):
    for j in range(w):
        if maze[i][j] == '#':
            continue
        que = deque()
        que.append((j,i))
        f = [[True]*w for _ in range(h)]
        d = [[0]*w for _ in range(h)]
        f[i][j] = False
        while que:
            x,y = que.popleft()
            for k in range(4):
                nx,ny = x + dx[k], y + dy[k]
                if 0 <= nx < w and 0 <= ny < h:
                    if f[ny][nx] and maze[ny][nx] == '.':
                        que.append((nx,ny))
                        d[ny][nx] = d[y][x] + 1
                        f[ny][nx] = False
        for k in range(h):
            ans = max(ans,max(d[k]))
print(ans)                          

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


int dp[110][5][5][5];

int main() {
  int N; 
  cin>>N;
  
  dp[0][0][0][0]=1;
  
  for (int n = 0; n < N; ++n) {
        for (int i = 0; i < 5; ++i) {
            for (int j = 0; j < 5; ++j) {
                 for (int k = 0; k < 5; ++k) {
                     for (int l = 1; l < 5; ++l) {
                       
                        if (i == 1 && j == 2 && l == 3) continue;
                         if (i == 1 && k == 2 && l == 3) continue;
                         if (j == 1 && k == 2 && l == 3) continue;
                         if (j == 2 && k == 1 && l == 3) continue;
                         if (j == 1 && k == 3 && l == 2) continue;
                       
            dp[n+1][j][k][l] += dp[n][i][j][k];
                         
            dp[n+1][j][k][l] %= 1000000007;
          }
        }
      }
    }
  }
  long long  ans=0;
  
  for(int i=1;i<5;i++){
    for(int j=1;j<5;j++) {
      for(int k=1;k<5;k++) {
        
        ans += dp[N][i][j][k];
        
        ans %= 1000000007;
      }
    }
    
  }
  
  cout<<ans<<endl;
 
}


Measured memory_bytes: 256
import java.util.*;

class Main{
	
	public static void main(String args[]){

		Scanner sc = new Scanner(System.in);
		
		int N = sc.nextInt();

		String st = String.valueOf(N);

		int rem = 0;
		for(int n=0;n<st.length();n++){
			rem += Character.getNumericValue(st.charAt(n));
		}

		if(N%rem == 0) System.out.println("Yes");
		else System.out.println("No");
	}
}

Measured memory_bytes: 21716
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <set>
#include <queue>
#include <map>
#include <numeric>
#include <functional>
#include <math.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

#define INF ((int)1e9)
#define INFLL ((ll)1e18)
#define MOD (1000000007LL)


int main(int argc, const char * argv[]) {
    ios_base::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<string> S(N);
    for (int n = 0; n < N; ++n) cin >> S[n];
    
    for (int n = 0; n < N; ++n) {
        sort(&S[n][0], &S[n][10]);
    }
    sort(S.begin(), S.end());
    
    ll Res = 0;
    ll Tmp = 0;
    string prev = "";
    for (int n = 0; n < N; ++n) {
        if (S[n] != prev) {
            Res += (Tmp-1)*Tmp / 2;
            prev = S[n];
            Tmp = 1;
        } else {
            ++Tmp;
        }
    }
    Res += (Tmp-1)*Tmp / 2;
    cout << Res << endl;

    return 0;
}


Measured memory_bytes: 5760
#include <iostream>
 
using namespace std;
 
int main(){
  int A, B;
  cin >> A >> B;
  int ans=1;
  if(B==1){
    printf("0\n");
  }else{
    B -= A;
    while(B>0){
      B -=(A-1);
      ans++;
    }
    printf("%d\n",ans);
  }
}


Measured memory_bytes: 3764
while True :
    num = int(input())
    if num == 0 :
        break
    A = []
    for i in range(num):
        sco = int(input())
        A.append(sco)
        A.sort()
    del A[num - 1]
    del A[0]

    B = int(sum(A)/(num-2))
    print(B)


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

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define rep2(i, a, b) for (ll i = (a); i < (b); i++)
#define chmax(x, v) do { x = max(x, v); } while (0)
#define chmin(x, v) do { x = min(x, v); } while (0)
typedef uint64_t ull;
typedef int64_t ll;
typedef std::pair<ll, ll> PLL;

using namespace std;

const ll INF = 1e18;
ll N;
ll a[500];
ll dp[500][500]; // dp[i][j]: 区間[i j)の最小コスト
ll psum[500][500]; // psum[i][j]: 区間[i j)の総和

// i           j
// 0 1 2 3 4 5
//   m m m m m
signed main() {
  cin >> N;
  rep(i, N)
    cin >> a[i];
  rep(i, 500) rep(j, 500) dp[i][j] = INF;
  rep(i, N) dp[i][i] = 0;
  rep(i, N) dp[i][i+1] = 0;
  for (ll i=0; i<N; i++) for (ll j=i; j<=N; j++) {
    ll t = 0;
    for (ll k=i; k<j; k++)
      t += a[k];
    psum[i][j] = t;
    // cout << "i=" << i << " j=" << j << " t= "<< t << endl;
  }
  for (ll len=2; len < 500; len++) {
    rep(i, N) {
      ll j = i+len;
      if (j > N)
        continue;
      ll t = INF;
      for (ll m = i; m < j;  m++) {
        chmin(t, psum[i][j] + dp[i][m] + dp[m][j]);
      }
      dp[i][j] = t;
    }
  }
  cout << dp[0][N] << endl;
  return 0;
}


Measured memory_bytes: 3712
//2018年  3月 21日 水曜日 17:38:41 JST
#include <bits/stdc++.h>
#define ADD(a, b) a = (a + ll(b)) % mod
#define MUL(a, b) a = (a * ll(b)) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define all(a) (a).begin(), (a).end()
#define sz(v) (int)(v).size()
#define pb push_back
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<int, pi> ppi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> mat;
typedef complex<double> comp;
void Debug() {cout << '\n'; }
template<class FIRST, class... REST>void Debug(FIRST arg, REST... rest){
	cout<<arg<<" ";Debug(rest...);}
template<class T>ostream& operator<<(ostream& out,const vector<T>& v) {
	out<<"[";if(!v.empty()){rep(i,0,sz(v)-1)out<<v[i]<<", ";out<<v.back();}out<<"]";return out;}
template<class S, class T>ostream& operator<<(ostream& out,const pair<S, T>& v){
	out<<"("<<v.first<<", "<<v.second<<")";return out;}
const int MAX_N = 200010;
const int MAX_V = 100010;
const double eps = 1e-6;
const ll mod = 1000000007;
const int inf = 1 << 29;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;
///////////////////////////////////////////////////////////////////////////////////////////////////

ll C[2010][2010];

void C_init(int n) {
	n++;
	rep(i, 0, n) C[i][0] = 1;
	rep(i, 1, n) {
		rep(j, 1, i + 1) {
			C[i][j] = C[i - 1][j] + C[i - 1][j - 1];
		}
	}
}

int N;
ll V[MAX_N];
ll F, T;
ll A, B, D;

void solve() {
	cin >> N >> F >> T;
	C_init(N);
	A = 1; B = 1;
	rep(i, 0, N) cin >> V[i];
	sort(V, V + N);

	for(int i = F; i <= T; i++) {
		ll S = accumulate(V + N - i, V + N, 0LL);
		ll a = V[N - i];
		int low = lower_bound(V, V + N, a) - V;
		int up = upper_bound(V, V + N, a) - V;
		// debug(i, S, low, up);
		// debug(N - i - up);
		ll c = C[up - low][up - (N - i)];
		if(S * B == i * A) {
			D += c;
		}
		else if(S * B > A * i) {
			D = c;
			A = S; B = i;
		}
	}
	cout << (double)A / B << "\n";
	cout << D << "\n";
}

int main() {
#ifndef LOCAL
	ios::sync_with_stdio(false);
    cin.tie(0);
#endif
    cout << fixed;
	cout.precision(20);
	srand((unsigned int)time(NULL));
#ifdef LOCAL
	//freopen("in.txt", "wt", stdout); //for tester
    freopen("in.txt", "rt", stdin);
#endif	
	solve();
#ifdef LOCAL
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}



Measured memory_bytes: 2432
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>

int main(){
  char s[100001];
  scanf("%s",s);
  int n = strlen(s);
  s[n] = 'R';
  int ans[100000] ={};
  int tmpR1;
  int tmpR2;
  int tmpL1;
  int tmpL2;
  int c = 0;
  int flag1=0;
  int flag2=0;
  while(c < n){
    for(int i=c;i<n;i++){
      tmpR1 = c;
      if(s[i] == 'R' && s[i+1] == 'L'){
        tmpR2 = i;
        tmpL1 = i+1;
        flag1 = 1;
      }
      if(s[i] == 'L' && s[i+1] == 'R'){
        tmpL2 = i;
        flag2 = 1;
      }
      if(flag1 == 1 && flag2 == 1){
        for(int j=c;j<=tmpL2;j++){
          if(j == tmpR2){
            ans[j] = (tmpR2 - tmpR1 + 2)/2 + (tmpL2 - tmpL1 + 1)/2;
          }else if(j == tmpL1){
            ans[j] = (tmpR2 - tmpR1 + 1)/2 + (tmpL2 - tmpL1 + 2)/2;
          }else{
            ans[j] = 0;
          }
        }
        c = tmpL2 + 1;
        break;
      }
    }
    flag1 = 0;
    flag2 = 0;
  }
  for(int i=0;i<n;i++){
    printf("%d ",ans[i]);
  }
  return 0;
}


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

int main(){
    string s;
    cin >> s;
    int n = s.size();
    int ze = 0, on = 0;
    for(int i = 0; i < n; i++){
        if(s[i] == '0'){
            ze++;
        }else if(s[i] == '1'){
            on++;
        }
    }
    cout << 2 * min(ze,on) << endl;
    return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
long long a,b,ans=0x3f,n;
int main()
{
    cin>>a;
    for(int s=0;s<a;s++)
    {
        cin>>b;
        n=0;
        while(b%2==0)
        {
            b=b/2;
            n++;
        }
        ans=min(ans,n);
    }
    cout<<ans<<endl;
    return 0;
}

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

int main() {
    ll a, b, k; cin >> a >> b >> k;
    b -= max(0LL,k-a);
    b = max(0LL,b);
    a = max(0LL,a-k);
    cout << a << " " << b << endl;
    return 0;
}


Measured memory_bytes: 256
list = [input(),input()]
#print (list)
#print (list[0][-1])

mojiretu = list[0]
nagasa = len(mojiretu) #nagasaで文字列の長さを取得
#print(mojiretu)
#print(nagasa)

#print("forのテスト")

counter = 0
for hantei in range(nagasa):
  if list[0][hantei] == list[1][hantei]:
    pass
    #print("OK",hantei) #1文字目判定
  else:
    #print("NG",hantei)
    counter = counter + 1
  
print(counter)

Measured memory_bytes: 9364
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long n,y;
    cin>>n>>y;
    int f=0;
    for(long long i=0;i<=n;i++)
    {
        for(long long j=0;i+j<=n;j++)
        {
            long long c=n-i-j;
            if(i*10000+j*5000+c*1000==y)
            {
                f=5;
                cout<<i<<" "<<j<<" "<<c<<endl;
                return 0;
            }

        }
    }
    if(f==0)
    {
        cout<<"-1"<<" "<<"-1"<<" "<<"-1"<<endl;
    }
return 0;
}


Measured memory_bytes: 256
(n,),a,*q=$<.map{_1.split.map &:to_i}
b=(0..n).map{_1&-_1}
d=b.map{[]}
q.map{d[_2-1]<<[_1-1,$.+=1]}
c=[u=i=0]
a.map{t=c[_1]
(b[t]-=1;t+=t&-t)until t ?t>n:u+=1
d[i].map{|x,y|s=u
(s-=b[x];x&=x-1)while x>0
$*[y]=s}
c[_1]=i+=1}
puts$*

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

using namespace std;

const int maxn = 1e5 + 5;
int H, W, n;
int a[maxn];
int mp[105][105];
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int main() {
    scanf("%d%d%d", &H, &W, &n);
    for(int i = 1; i <= n; i++) scanf("%d", &a[i]);
    int nowx = 0, nowy = 0;
    for(int i = 1; i <= n; i++) {
        while(a[i]--) {
            mp[nowx][nowy] = i;
            for(int j = 0; j < 4; j++) {
                int nx = nowx + dx[j], ny = nowy + dy[j];
                if(0 <= nx && nx < H && 0 <= ny && ny < W && !mp[nx][ny]) {
                    nowx = nx;
                    nowy = ny;
                    break;
                }
            }
        }
    }
    for(int i = 0; i < H; i++) {
        for(int j = 0; j < W; j++) {
            j == W - 1 ? printf("%d\n", mp[i][j]) : printf("%d ", mp[i][j]);
        }
    }
    return 0;
}


Measured memory_bytes: 384
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
      Scanner sc = new Scanner(System.in);  
      String b = sc.next();
        switch(b) {
            case "A":
                System.out.println("T");
                break;
            case "T":
                System.out.println("A");
                break;
            case "G":
                System.out.println("C");
                break;
            case "C":
                System.out.println("G");
                break;
        }
    }
}
      

Measured memory_bytes: 21972
#include <bits/stdc++.h>
#pragma GCC optimize ("Ofast", "unroll-loops")
using namespace std;
#define ll long long
#define int ll
#define FOR(i,a,b) for (int i = (a); i<(b); i++)
#define REP(i,n) FOR(i,0,n)
#define REP1(i,n) FOR(i,1,n+1)
#define RREP(i,n) for (int i=(n)-1; i>=0; i--)
#define f first
#define s second
#define pb push_back
#define ALL(x) x.begin(),x.end()
#define SZ(x) (int)(x.size())
#define SQ(x) (x)*(x)
#define pii pair<int, int>
#define endl '\n'
//#define TOAD
#ifdef TOAD
#define bug(x) cerr<<__LINE__<<": "<<#x<<" is "<<x<<endl
#define IOS()
#else
#define bug(...)
#define IOS() ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#endif
const ll inf = 1ll<<60;
const int iinf=2147483647;
const ll mod = 1e9+7;
const ll maxn=5e3;
ll pw(ll x, ll p){
    ll ret=1;
    while (p>0){
        if (p&1){
            ret*=x;
            ret%=mod;
        }
        x*=x;
        x%=mod;
        p>>=1;
    }
    return ret;
}
ll inv(ll x){
    return pw(x, mod-2);
}
signed main(){
    IOS();
    int n,m; cin>>n>>m;
    if (n==1){
        cout<<1<<endl;
    }
    else if (m==1){
        cout<<1<<endl;
    }
    else if ((n*m)%2){
        cout<<(n*m)/2+1<<endl;
    }
    else cout<<(n*m)/2<<endl;

}

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

using namespace std;
typedef long long ll;
//typedef unsigned long long ll;

#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define sz(x) ll(x.size())
//typedef pair<ll, int> P;
typedef pair<ll, ll> P;
//const double INF = 1e10;
const ll INF = LONG_LONG_MAX / 10;
//const ll INF = (1ll << 31) - 1;
//const ll INF = 1e15;
const ll MINF = LONG_LONG_MIN;
//const int INF = INT_MAX / 10;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
//typedef pair<int, int> P;
//typedef pair<double, double> P;

bool contain(set<P> &s, P a) { return s.find(a) != s.end(); }

//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
const int mod = 1000000007;


void print_line(vector<ll> &line) {
    if (line.size() == 0ll) {
        cout << endl;
        return;
    }
    for (ll i = 0; i < line.size(); i++) {
        cout << line[i];
        if (i == line.size() - 1) cout << endl;
        else cout << ' ';
    }
}

typedef priority_queue<long long, vector<long long>, greater<long long>> PQ_ASK;

typedef pair<int, int> Point;

int main() {
    int h, w;
    cin >> h >> w;

    vector<vector<int>> area(h, vector<int>(w));;
    vector<vector<int>> dp(h, vector<int>(w, 0));

    auto get = [&](int y, int x) {
        if (y < 0) return 0;
        if (x < 0) return 0;
        return dp[y][x];
    };

    rep(y, h)rep(x, w) cin >> area[y][x];

    dp[0][0] = area[0][0] == 0 ? 1 : 0;


    rep(y, h)rep(x, w) {
            if (y == 0 && x == 0) continue;
            if (area[y][x] == 1) {
                dp[y][x] = 0;
            } else {
                int left = get(y, x - 1);
                int up = get(y - 1, x);
                int left_up = get(y - 1, x - 1);
                int now = min(left, min(left_up, up));


                dp[y][x] = now + 1;
            }
        }


    int ans = 0;
    rep(y, h)rep(x, w) cmax(ans, dp[y][x]);
    cout << ans * ans << endl;

}





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

int main(){
    int n;
    cin >> n;
    vector<vector<pair<int,int>>> evi(n);
    for(int i=0; i<n; i++){
        int a,x,y;
        cin >> a;
        for(int j=0; j<a; j++){
            cin >> x >> y;
            evi[i].emplace_back(make_pair(x,y));
        }
    }

    int _max=0;
    for(int bit=0; bit<(1<<n); bit++){
        int num=0;
        bool check = true;
        for(int i=0; i<n && check; i++){
            if(bit & (1<<i)){
                num++;
                for(int j=0; j<evi[i].size(); j++){
                    int x = evi[i][j].first;
                    int y = evi[i][j].second;
                    x--;
                    if(((bit & (1<<x)) != (y<<x))){
                        check = false;
                    }
                }
            }
        }
        if(check){
            _max = max(_max, num);
        }
    }
    cout << _max << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,o,n) for(long long i = o;i<n;i++)
#define oneforall ios::sync_with_stdio(false);cin.tie(0);
#define all(v) (v).begin(),(v).end()
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) long long __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
const long long INF=1e18;
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
typedef vector<int> vi;
typedef vector<long long> vl;
typedef long long ll;
typedef vector<pair<long,long>> vpll;
typedef vector<pair<int,int>> vpii;
int main() {
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	ini(n);
	vi a(n);
	FOR(i,0,n){in(a[i]);}
	sort(all(a));
	int total = 0;
	FOR(i,0,n-2){
		FOR(i1, i + 1, n - 1) {
			auto it = upper_bound(a.begin() + i1+1, a.end(), abs(a[i] - a[i1]));
			if (it == a.end())continue;
			while(it!=a.end()){
				if (*it < a[i] + a[i1])total++;
				it++;
			}
		}
	}
	out(total);
	return 0;
}

Measured memory_bytes: 256
import Control.Monad
import Data.Maybe
import Data.List
import qualified Data.ByteString.Char8 as BS

main = abc164b

abc164b = do
    [a,b,c,d] <- getIntList
    putStrLn $ let aoki = divMod c b
                   taka = divMod a d
                in if fst aoki + (if snd aoki > 0 then 1 else 0) > fst taka + (if snd taka > 0 then 1 else 0)
                   then "No"
                   else "Yes"

readInt = fst . fromJust . BS.readInteger
readIntList = map readInt . BS.words
getIntList = readIntList <$> BS.getLine

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

int main(){
    int n, m;
    cin >> n >> m;
    int count = 0;
    count = n * (n-1) / 2 + m * (m-1) / 2;
    cout << count << endl;
    return 0;
} 

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#define MAX 2000001
#define VMAX 10000

int main(){
  unsigned short *A, *B;

  int C[VMAX+1];
  int n, i, j;
  scanf("%d", &n);

  A = malloc(sizeof(short)*n+1);
  B = malloc(sizeof(short)*n+1);

  for ( i = 0; i <= VMAX; i++ ) C[i] = 0;

  for ( i = 0; i < n; i++ ){
    scanf("%hu", &A[i + 1]);
    C[A[i + 1]]++;
  }

  for ( i = 1; i <= VMAX; i++ ) C[i] = C[i] + C[i - 1];

  for ( j = 1; j <= n; j++ ){
    B[C[A[j]]] = A[j];
    C[A[j]]--;
  }

  for ( i = 1; i <= n; i++ ){
    if ( i > 1 ) printf(" ");
    printf("%d", B[i]);
  }
  printf("\n");

  return 0;
}


Measured memory_bytes: 9708
import sys
from collections import Counter

n, *a = map(int, sys.stdin.read().split())

def main():
    b = [a[i] + i for i in range(n)]
    c = [i - a[i] for i in range(n)]
    cb = Counter(b)
    cc = Counter(c)
    tot = 0
    for v, c in cb.items():
        tot += c * cc[v]
    print(tot)
    
if __name__ == '__main__':
    main()

Measured memory_bytes: 63332
#include<bits/stdc++.h>
using namespace std;
int s(int a)
{
	int sum=0;
	while(a>=10)
	{
		sum+=a%10;
		a=a/10;
	}
	sum+=a;
	return sum;
}
int main()
{
	int n,a,b;
	cin>>n>>a>>b;
	int sum=0;
	for(int i=0;i<=n;i++)
	{
		if(s(i)>=a&&s(i)<=b)
		{
			sum+=i;
		}
	}
	cout<<sum;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <bitset>
#include <cmath>
#include <string>
#include <fstream>
#define FI first
#define SE second
#define VE vector<int>
#define PB push_back
#define PA pair<int,int>
#define MA make_pair
#define LL long long
#define LI long int
#define LLI long long int
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ROF(i,a,b) for(int i=b-1;i>=a;i--)
#define YES(i) cout<<(i?"YES":"NO")<<endl
#define Yes(i) cout<<(i?"Yes":"No")<<endl
#define POS(i) cout<<(i?"POSSIBLE":"IMPOSSIBLE")<<endl
using namespace std;
//
const int INF=1e9+7;
const int MOD=1e9+7;
//
LLI lcm(LLI x,LLI y);
LLI gcd(LLI x,LLI y);

int main(){
    int n; cin>>n;
    if(n==1){
        LLI x; cin>>x;
        cout<<x;
        exit(0);
    }
    LLI x,y; cin>>x>>y;
    LLI l=lcm(x,y);
    FOR(i,2,n){
        LLI z; cin>>z;
        l=lcm(l,z);
    }
    cout<<l;
    return 0;
}

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

LLI gcd(LLI x,LLI y){
    if(x>=y){
        if(y==0) return x;
        else return gcd(x%y,y);
    }else{
        if(x==0) return y;
        else return gcd(x,y%x);        
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <deque>

using namespace std;

deque<int> seq(long long n) {
	if (n == 1) return {};
	if (n % 2 == 0) {
		auto s = seq(n / 2);
		s.push_back(s.size() + 1);
		return s;
	} else {
		auto s = seq(n - 1);
		s.push_front(s.size() + 1);
		return s;
	}
}

int main() {
	long long n;

	cin >> n;

	auto s = seq(n + 1);
	cout << s.size() * 2 << endl;
	for (int x: s) cout << x << ' ';
	for (int i = 1; i <= s.size(); ++i) cout << i << ' ';
	cout << endl;

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <string>
#include <vector>
#include <tuple>

using namespace std;

int arr[10010];
int res[110][110];

int main()
{
    //freopen("in", "r", stdin);
    //freopen("out", "w", stdout);

    int h, w, n, p, c, i, j;
    scanf("%d%d%d", &h, &w, &n);
    for(i = 1; i<=n; i++)
        scanf("%d", &arr[i]);

    p = 1;
    c = 0;
    for(i = 0; i<h; i++)
    {
        if(i%2 == 0)
        {
            for(j = 0; j<w; j++)
            {
                res[i][j] = p;
                c++;
                if(c == arr[p])
                {
                    p++;
                    c = 0;
                }
            }
        }
        else
        {
            for(j = w-1; j>=0; j--)
            {
                res[i][j] = p;
                c++;
                if(c == arr[p])
                {
                    p++;
                    c = 0;
                }
            }
        }
    }

    for(i = 0; i<h; i++)
    {
        for(j = 0; j<w; j++)
            printf("%d ", res[i][j]);
        printf("\n");
    }

    return 0;
}

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

using namespace std;
vector<int> g;
int m;
long long cnt = 0;
void insertionSort(long long* a, int n, int g) {
	int v,j;
	
	for (int i = g; i < n ; i++) {
		v = a[i];
		j = i - g; 
		while (j >= 0 && a[j] > v) {
			a[j + g] = a[j];
			j = j - g;
			cnt++;
		}
		a[j + g] = v;
	}
}

void shellSort(long long* a, int n) {
	cnt = 0;
	
	for (int i = 0; i < m ; i++) {
		insertionSort(a, n, g[i]);
	}

	//ans
	cout << m<<endl;
	for (int i = 0; i < m; i++) {
		cout << g[i];
		if (i != m - 1) {
			cout << " ";
		}
	}cout << endl;
	cout << cnt << endl;
	for (int i = 0; i < n; i++) {
		cout << a[i]<<endl;
	}

}


int main() {
	int n;
	long long* a;

	cin >> n;
	a = new long long[n];
	
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	for (int i = 0; i<=n; i=i*3+1) {
		g.push_back(i);
	}
	reverse(g.begin(), g.end());
	m = g.size();
	shellSort(a, n);
	return 0;
}



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

int main(){
	string s;
	char r[12]="yuiophjklnm";
	
	while(cin >> s){
		if(s=="#") break;
		
		int ans=0;
		bool right=false;
		
		for(int i=0; i<12; ++i){
			if(s[0]==r[i]){	
		   		right=true;
				break;
			}
		}
		
		for(int i=1; i<s.size(); ++i){
			bool before = right;
			
			for(int j=0; j<12; ++j){
				if(s[i]==r[j]){	
		   			right=true;
					break;
				}
				
				if(j==11) right=false;
			}	
			
			if(before != right) ++ans;
		}
		printf("%d\n", ans);
	}		
	return 0;
}

Measured memory_bytes: 1188
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <list>
#include <utility>
#include <tuple>
#include <cstdio>
#include <set>
#include <queue>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <cmath>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;
const long long INF = 1LL << 60;
typedef long long ll;
int main() {
    string S;
    cin >> S;
    ll K;
    cin >> K;
    string ans;
    if(K <= (ll)S.size()){
        for(int i=0;i<(int)K;i++){
            if(S[i]!='1'){
                ans = S[i];
                break;
            }
            if(i==K-1){
                ans = S[i];
            }
        }
    }
    else{
        for(int i=0;i<(int)S.size();i++){
            if(S[i]!='1'){
                ans = S[i];
                break;
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3588
#include<iostream>
#include<algorithm>
#include<vector>
#include<stdio.h>
#include<complex>
#include<map>
using namespace std;

struct Dice{
  int n[6];
  void roll(char c){
    int nn;
    if(c == 'E'){
      nn = n[0]; n[0] = n[3]; n[3] = n[5]; n[5] = n[2]; n[2] = nn;
    }else if(c == 'W'){
      nn = n[0]; n[0] = n[2]; n[2] = n[5]; n[5] = n[3]; n[3] = nn;
    }else if(c == 'N'){
      nn = n[0]; n[0] = n[1]; n[1] = n[5]; n[5] = n[4]; n[4] = nn;
    }else if(c == 'S'){
      nn = n[0]; n[0] = n[4]; n[4] = n[5]; n[5] = n[1]; n[1] = nn;
    }else if(c == '!'){
      nn = n[1]; n[1] = n[3]; n[3] = n[4]; n[4] = n[2]; n[2] = nn;
    }
  }
  int top(){
    return n[0];
  }
  int right(){
    return n[2];
  }
  int left(){
    return n[3];
  }
  int front(){
    return n[1];
  }
  int back(){
    return n[4];
  }
  int under(){
    return n[5];
  }
};

int main(){
  int n; cin >> n;
  Dice d[n];
  for(int i = 0; i < n; i++){
    for(int j = 0; j < 6; j++){
      cin >> d[i].n[j];
    }
  }
  vector<int> aa(6),ab(6);

  string ans = "Yes";
  for(int i = 0; i < n; i++){
    for(int j = 0; j < 6; j++) aa[j] = d[i].n[j];
    sort(aa.begin(), aa.end());
    for(int j = i+1; j < n; j++){
      for(int k = 0; k < 6; k++) ab[k] = d[j].n[k];
      sort(ab.begin(), ab.end());

      bool flg = false;

      for(int k = 0; k < 6; k++){
        if(aa[k] != ab[k]) flg = true;
      }
      if(flg) break;

      for(int ii = 0; ii < 4; ii++){
        d[j].roll('E');
        if(d[i].top() != d[j].top()) continue;
        if(d[i].under() != d[j].under()) continue;
        for(int jj = 0; jj < 4; jj++){
          d[j].roll('!');
          if(d[i].right() != d[j].right()) continue;
          if(d[i].left() != d[j].left()) continue;
          if(d[i].front() != d[j].front()) continue;
          if(d[i].back() != d[j].back()) continue;
          flg = true;
        }
      }
      for(int ii = 0; ii < 4; ii++){
        d[j].roll('N');
        if(d[i].top() != d[j].top()) continue;
        if(d[i].under() != d[j].under()) continue;
        for(int jj = 0; jj < 4; jj++){
          d[j].roll('!');
          if(d[i].right() != d[j].right()) continue;
          if(d[i].left() != d[j].left()) continue;
          if(d[i].front() != d[j].front()) continue;
          if(d[i].back() != d[j].back()) continue;
          flg = true;
        }
      }
      if(flg) ans = "No";
    }
  }
  cout << ans << endl;
  return 0;
}



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

typedef long long ll;
#define rep(i, n) for(ll i=0; i<n; i++)
#define FOR(i, a, b) for(ll i=a; i<b; i++)
#define sz(v) ll(v.size)


void solve(long long N, long long K, std::string S){
    S[K-1] = tolower(S[K-1]);
    cout << S << endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    long long K;
    scanf("%lld",&K);
    std::string S;
    std::cin >> S;
    solve(N, K, S);
    return 0;
}


Measured memory_bytes: 256
H,N = map(int,input().split())
A = []
B = []
for i in range(N):
    a,b = map(int,input().split())
    A.append(a)
    B.append(b)
x = max(A)
dp = [10**9 for i in range(H+x+1)]
dp[0] = 0
for i in range(N):
    a = A[i]
    b = B[i]
    for j in range(H+x+1):
        if j < a:
            continue
        dp[j] = min(dp[j-a]+b,dp[j])
ans = 10**9
for i in range(H,H+x+1):
    ans = min(ans,dp[i])
print(ans)

Measured memory_bytes: 43228
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#define vll vector<ll>
#define vvvl vector<vvl>
#define vvl vector<vector<ll>>
#define VV(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define VVV(a, b, c, d) vector<vvl>(a, vvl(b, vll (c, d)));
#define re(c, b) for(ll c=0;c<b;c++)
#define all(obj) (obj).begin(), (obj).end()
typedef long long int ll;
typedef long double ld;
using namespace std;

//-------------------------------------------------------------------
#define P 1000000007
#define N_MAX 10000000
typedef long long int ll;
ll fac[N_MAX+1];
ll inv[N_MAX+1];
ll finv[N_MAX+1];

ll comb(ll n, ll k){
  if(n<0||k<0||n<k) return 0;
  return (((fac[n]*finv[n-k])%P)*finv[k])%P;
}

void init(){
  fac[0] = finv[0] = fac[1] = finv[1] = inv[1] = 1;
  for(int i = 2; i <= N_MAX; i++){
    fac[i] = (fac[i-1]*i)%P;
    inv[i] = ((-(P/i)*inv[P%i])%P+P)%P;
    finv[i] = (finv[i-1]*inv[i])%P;
  }
}
//-------------------------------------------------------------------
int main(int argc, char const *argv[]) {
  ll n, k;std::cin >> n >> k;
  init();
  ll ans = 0;
  for(ll i=k;i<=n+1;i++){
    ll m = ((i*(i-1))/2)%P;
    ll x = n - i;
    ll M = ((n*(n+1))/2%P - (x<0?0:(x*(x+1))/2)%P + P)%P;
    ll num = (M-m+1+P)%P;
    ans = (ans + num)%P;
  }
  std::cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 237572
#include <bits/stdc++.h>
using namespace std;
int main() {
    string s;
    cin>>s;

    vector<bool>judge(26,false);
    for(int i=0;i<s.size();i++){
        judge[s[i]-'a']=true;
    }

    bool stop=false;

    for(int i=0;i<26;i++){
        if(judge[i]==false){
            char answer='a'+i;
            cout<<answer<<endl;
            stop=true;
            break;
        }
    }

    if(stop==false){
        cout<<"None"<<endl;
    }

}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int h[100010],f[100010];
int main()
{
	int n,k;
	cin>>n>>k;
	for(int i=1;i<=n;i++)  cin>>h[i];
	f[1]=0,f[2]=abs(h[2]-h[1]);
	for(int i=3;i<=n;i++)
	{
		f[i]=f[i-1]+abs(h[i]-h[i-1]);
		for(int j=1;j<=k;j++)
		{
			if(i-j>=1){
				f[i]=min(f[i],f[i-j]+abs(h[i]-h[i-j]));
			}
		}
	}
	cout<<f[n]<<endl;
	return 0;
}


Measured memory_bytes: 1024
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<string>
#include<vector>
#include<stack>
#include<bitset>
#include<cstdlib>
#include<cmath>
#include<set>
#include<list>
#include<deque>
#include<map>
#include<queue>
#define LL long long
using namespace std;
bool binarysearch(int a[],int n,int q){
int left=0,right=n,mid;
while(left<right){
mid=(left+right)/2;
if (q==a[mid]){return true;}
else if (q>a[mid]){left=mid+1;}
else if (q<a[mid]){right=mid;}
}
return false;
}
int main(){
int i,n1,n2,q,a[100009],sum=0;
cin>>n1;
for (i=0;i<n1;i++){cin>>a[i];}
cin>>n2;
for (i=0;i<n2;i++){cin>>q;
if (binarysearch(a,n1,q)){sum++;}
}
cout<<sum<<endl;
return 0;
}


Measured memory_bytes: 3468
#include<iostream>

int main(){
  int n;
  float sans = 0;
  int x[100];
  /*入力*/
  std::cin >> n;
  for(int i = 0;i < n;i++){
    std::cin >> x[i];
    sans += x[i];
  }
  /*計算*/
  sans  = sans/n;
  int ians = sans;
  int ans,damage = 0;
  if((sans - ians) < 0.5){
    ans = ians;
  }
  else{
    ans = ians + 1;
  }
  /*結果*/
  for(int i = 0;i < n;i++){
    damage += (ans - x[i])*(ans - x[i]);
  }
  std::cout << damage << std::endl;
  
  return 0;
}
  


Measured memory_bytes: 256
#pragma gcc optimize("Ofast")
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort(ALL(V)) //小さい方からソート
#define REV(V) reverse(ALL(V)) //リバース
#define RSORT(V) SORT(V);REV(V) //大きい方からソート
#define NPN(V) next_permutation(ALL(V)) //順列
#define pb(n) push_back(n)
#define endl '\n'
#define Endl '\n'
#define DUMP(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define Yay(n) cout << ((n) ? "Yay!": ":(") << endl
#define RAPID cin.tie(0);ios::sync_with_stdio(false)
#define VSUM(V) accumulate(ALL(V), 0)
#define MID(a,b,c) (a) < (b) && (b) < (c)
#define MIDe(a,b,c) (a) <= (b) && (b) <= (c)
#define IN(n) cin >> n
#define IN2(a,b) cin >> a >> b
#define IN3(a,b,c) cin >> a >> b >> c 
#define IN4(a,b,c,d) cin >> a >> b >> c >> d
#define VIN(V) for(int i = 0; i < (V).size(); i++) {cin >> (V).at(i);}
#define OUT(n) cout << n << endl
#define VOUT(V) REP(i, (V).size()) {cout << (V)[i] << endl;}
#define VOUT2(V) REP(i, (V).size()) {cout << (V)[i] << " ";} cout<<endl;

// 型マクロ定義
#define int long long
#define P pair<ll,ll>
#define Vi vector<ll>
#define Vd vector<double>
#define Vs vector<string>
#define Vc vector<char>
#define M map<ll,ll>
#define S set<ll>
#define PQ priority_queue<ll>
#define PQG priority_queue<ll,V,greater<ll>
//

const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);

int gcd(int a,int b){return b != 0 ? gcd(b, a % b) : a;} //最大公約数
int lcm(int a, int b){return a * b / gcd(a, b);}
string toStrUp(string str){char diff = 'A'-'a';REP(i,str.size()) str[i] += diff;return str;}
string gCh(string str, int key){return str.substr(key,1);}

signed main() {
  RAPID;
  // デフォルト変数定義
  int n=0,m=0,a=0,b=0,c=0,d=0,x=0,y=0,z=0;
  string s="",t="";
  //

  // ここから
  IN(n);
  Vi L(n);
  VIN(L)
  SORT(L);
  REP(i,(n-1)){
    x += L[i];
  }
  Yes(x > L[n-1]);
}

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

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

	if(N >= 30) cout << "Yes" << endl;
	else  cout << "No" << endl;
}



Measured memory_bytes: 3628
#https://atcoder.jp/contests/abc124/tasks/abc124_a

def main():
    a, b = map(int, input().split())

    max = a
    if a < b:
        max = b
    
    if a == b:
        print (2 * a)
    else:
        print (2 * max - 1)

if __name__ == "__main__":
    main()

Measured memory_bytes: 2940
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n = ni()

ct = 0
for i in range(100):
    if n-4*i >= 0 and (n-4*i) % 7 == 0:
        ct += 1
print("Yes" if ct > 0 else "No")



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

using ll = long long;

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

    ll X; cin >>X;

    ll XX = 2*X;
    ll s = 0;
    for (int i = 1;; i++) {
        s += 2*i;
        if (s >= XX) {
            cout << i << endl;
            return 0;
        }
    }
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    while(true){
      int a=sc.nextInt();
      int b=sc.nextInt();
      int c=0;
      if(a==0 && b==0) break;
      if(a>b){
        c=a;
        a=b;
        b=c;
      }
      System.out.println(a+" "+b);
    }
  }
}



Measured memory_bytes: 36052
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sstream>
#include <iostream>
#include <math.h>
#include <time.h>
#include <unistd.h>
#include <algorithm>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <set>
#include <string>

#ifndef ONLINE_JUDGE
	#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#else
	#define DEBUG(x) do {} while(0);
#endif

#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define FOR(i, A, N) for(int (i) = (A); (i) < (N); (i)++)
#define REP(i, N) for(int (i) = 0; (i) < (N); (i)++)

using namespace std;
typedef long long ll;
inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }

int n,m;
int A[111111];
int main() {
	scanf("%d", &n);
	REP(i, n) {
		int x;
		scanf("%d", &x);
		A[x-1] = i+1;
	}
	REP(i, n) printf("%d ", A[i]);
	printf("\n");
	return 0;
}


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

int main()
{
    int n; cin >> n;
    
	string p = "";
	string q = "";
		
	for (int i = 0; i < n; i++) {
		string tmp; cin >> tmp;
		p += tmp;
	}
	for (int i = 0; i < n; i++) {
		string tmp; cin >> tmp;
		q += tmp;
	}
	
	vector<int> vec(n); for (int i = 0; i < n; i++) vec[i] = i + 1;

	int p_cnt = 0;
	int q_cnt = 0;
	
	do {
		string tmp_vec = "";
		for (int i = 0; i < n; i++) {
			tmp_vec += to_string(vec[i]);
		}
		if (tmp_vec < p) p_cnt++;
		if (tmp_vec < q) q_cnt++;

	} while (next_permutation(vec.begin(), vec.end()));

	cout << abs(p_cnt - q_cnt) << endl;
    return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <map>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#define speed ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ll long long
#define eps 1e-7
#define inf 0x3f3f3f3f
#define mod 1000000007
using namespace std;

int main() {
	speed;
	int n;
	cin >> n;
	vector<pair<int, int>>v(n);
	for (int i = 0; i < n; ++i)
		cin >> v[i].second >> v[i].first;
	sort(v.begin(), v.end());
	int t = 0;
	for (int i = 0; i < n; ++i) {
		t += v[i].second;
		if (t > v[i].first)
			return cout << "No", 0;
	}
	cout << "Yes";
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
// Macros for easier access
#define ll long long
#define endl '\n'
#define umap unordered_map
#define uset unordered_set
#define test ll cases; cin>>cases; for(ll testCase = 1; testCase <= cases; testCase++)   //test cases
#define fill(name, val) memset(name, val, sizeof(name));
#define mop(a, op, b)    (a%mod op b%mod)%mod
#define error(x) fixed<<setprecision(x) //cout<<error(5)<<someDouble    -> example - 3.14159
#define vll vector<ll>
#define vvll vector<vll>
#define pll pair<ll, ll>
#define get(a, n)    for(ll i = 0; i < n; i++)    cin>>a[i];
#define boost ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define debug(x) cerr << #x << " : " << (x) << endl
// Constants
#define MX 100001
#define mod 1000000007LL
#define inf 1000000000000000000LL
void init(){
    boost;
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
}

/*
    Author: 
                                                _/                      
       _/_/_/_/    _/_/    _/_/_/      _/_/    _/  _/    _/    _/_/_/   
          _/    _/_/_/_/  _/    _/  _/    _/  _/  _/    _/  _/_/        
       _/      _/        _/    _/  _/    _/  _/  _/    _/      _/_/     
    _/_/_/_/    _/_/_/  _/    _/    _/_/    _/    _/_/_/  _/_/_/        
                                                           
    National Institute of Technology, Rourkela (2018-2022, EE)
*/

ll n, a[MX];
ll dp[3001][3001];
ll solve(ll l, ll r, bool taro){
    if(l > r)   return 0;
    if(dp[l][r] != -1)  return dp[l][r];
    ll op1 = a[l] * (taro?1:-1) + solve(l+1, r, !taro);
    ll op2 = a[r] * (taro?1:-1) + solve(l, r-1, !taro);
    return dp[l][r] = taro?max(op1, op2):min(op1, op2);
}
int main(){
    cin>>n; get(a, n);
    fill(dp, -1);
    cout<<solve(0, n-1, 1);
    // ll dp[n+1][n+1];    fill(dp, 0);
    // for(ll l = 0; l < n; l++){
    //     for(ll r = 0; r < n; r++){
    //         if(l > r)  continue;
    //         bool taro = (r-l+1)&1 == n&1;
    //         if(l == r)  dp[l][r] = a[l] * (taro?1:-1);

    //     }
    // }
}

Measured memory_bytes: 70784
#include<iostream>
#include<cmath>
#include<complex>
#include<cstdlib>
#include<algorithm>
#include<functional>
using namespace std;
int main() {
    int a,b,cnt;
    cin>>a>>b;
    if(a>b){
        cout<<a-1<<endl;
    }else{
        cout<<a<<endl;
    }
    
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a[10],x;
char c;
int main(void)
{
	while(cin>>c&&c!='\0')
	{
		if(c=='0') a[x++]=0;
		else if(c=='1') a[x++]=1;
		else
		{
			if(x) x--;
		}
	}
	if(x)
	{
		for(int i=0;i<x;i++) printf("%d",a[i]);
		printf("\n"); 
	}
}

Measured memory_bytes: 256