akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#include<stdbool.h>
typedef long long ll;
typedef long double ld;
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define rrep(i,l,r)for(ll i=(l);i>=(r);i--)
#define INF (1LL<<60)
#define MOD1 1000000007
#define MOD2 998244353
#define MAX_N (1 << 17)
#define YES printf("Yes\n")
#define NO printf("No\n")
#define PN printf("\n")

void swap(ll *a, ll *b){ll c;c=*b;*b=*a;*a=c;}
ll max2(ll a,ll b){return a>=b?a:b;}
ll min2(ll a,ll b){return a>=b?b:a;}
ll min3(ll a, ll b, ll c){return (a<=b && a<=c) ? a : b<=c ? b : c;}
ll max3(ll a, ll b, ll c){return (a>=b && a>=c) ? a : b>=c ? b : c;}
ll minn(ll n, ll a[n]){ll b=INF;rep(i,0,n) b=min2(b,a[i]);return b;}
ll maxn(ll n, ll a[n]){ll b=-INF;rep(i,0,n) b=max2(b,a[i]);return b;}
ll ABS(ll a){return a>=0?a:(-a);}
ll POW(ll a, ll b){ll c=1;rep(i,0,b) c*=a;return c;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
ll mod(ll n){return n%=MOD1;}
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);}

typedef struct{ ll aa , bb;}fr;
int cmp1( const void *p, const void *q ) { return ((fr*)p) ->aa - ((fr*)q)->aa;}

int main(void){
    // char ;
    ll sx,sy,tx,ty;
    scanf("%lld%lld%lld%lld",&sx,&sy,&tx,&ty);
    rep(i,0,ty-sy) printf("U");    
    rep(i,0,tx-sx) printf("R");    
    rep(i,0,ty-sy) printf("D");    
    rep(i,0,tx-sx+1) printf("L");    
    rep(i,0,ty-sy+1) printf("U");    
    rep(i,0,tx-sx+1) printf("R");
    printf("DR");    
    rep(i,0,ty-sy+1) printf("D");    
    rep(i,0,tx-sx+1) printf("L");
    printf("U");    
    printf("\n");
    return 0;
}


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

namespace contest10
{
    class Program
    {
        static void Main(string[] args)
        {
            var read_line_origin = Console.ReadLine();

            if (string.IsNullOrEmpty(read_line_origin))
            {
                return;
            }

            //三角形の数
            int all_num = int.Parse(read_line_origin);

            
            //空白で分割する

            for (int i = 0; i < all_num; i++)
            {
                read_line_origin = Console.ReadLine();
                string[] words = read_line_origin.Split();

                //配列の要素、すべてに処理を行う
                var num_array = Array.ConvertAll(words, len => double.Parse(len));

                //三角形の座標
                double x1 = num_array[0];
                double y1 = num_array[1];
                double x2 = num_array[2];
                double y2 = num_array[3];
                double x3 = num_array[4];
                double y3 = num_array[5];

                //辺の長さ
                double r1 = Math.Sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
                double r2 = Math.Sqrt((x2 - x3) * (x2 - x3) + (y2 - y3) * (y2 - y3));
                double r3 = Math.Sqrt((x3 - x1) * (x3 - x1) + (y3 - y1) * (y3 - y1));

                //計算用
//                double tmp_1 = (r1 * r1) * (r2 * r2 + r3 * r3 - r1 * r1);
//                double tmp_2 = (r2 * r2) * (r3 * r3 + r1 * r1 - r2 * r2);
//                double tmp_3 = (r3 * r3) * (r1 * r1 + r2 * r2 - r3 * r3);

//                double tri_tmp = tmp_1 + tmp_2 + tmp_3;

  //              double center_x = (tmp_1 * x1 + tmp_2 * x2 + tmp_3 * x3) / tri_tmp;
  //              double center_y = (tmp_1 * y1 + tmp_2 * y2 + tmp_3 * y3) / tri_tmp;

                double x = (((x1 * x1 + y1 * y1) * (y2 - y3)) +
                            ((x2 * x2 + y2 * y2) * (y3 - y1)) +
                            ((x3 * x3 + y3 * y3) * (y1 - y2)))
                            /
                            ((x1 * (y2 - y3)) +
                             (x2 * (y3 - y1)) +
                             (x3 * (y1 - y2))
                            ) * 0.5;
                double y = (((x1 * x1 + y1 * y1) * (x2 - x3)) + ((x2 * x2 + y2 * y2) * (x3 - x1)) + ((x3 * x3 + y3 * y3) * (x1 - x2))) / ((y1 * (x2 - x3)) + (y2 * (x3 - x1)) + (y3 * (x1 - x2))) * 0.5;


                double radius = (r1 * r2 * r3) /
                                Math.Sqrt(
                                    (r1 + r2 + r3) * (-r1 + r2 + r3) * (r1 - r2 + r3) * (r1 + r2 - r3)

                                );

                Console.WriteLine("{0:f3} {1:f3} {2:f3}", x, y, radius);
            }




        }
    }
}

Measured memory_bytes: 5752
package main

import (
	"fmt"
)

func main() {
	var N, M int
	fmt.Scan(&N, &M)
	WA := make([]int, N)
	AC := make([]int, N)
	var num int
	var result string
	for i := 0; i < M; i++ {
		fmt.Scan(&num, &result)
		if result == "WA" && AC[num-1] == 0 {
			WA[num-1] = WA[num-1] + 1
		} else {
			AC[num-1] = 1
		}
	}
	var ac, wa int
	for i := 0; i < N; i++ {
		if AC[i] > 0 {
			ac++
			wa += WA[i]

		}
	}
	fmt.Println(ac, wa)
}


Measured memory_bytes: 5504
#include <stdio.h>

int main()
{
	int n;
	scanf("%d", &n);
	char str[n + 1];
	scanf("%s", str); 
	
	if (n % 2 == 1){
		puts("No");
	}
	else{
		int flag = 1;
		for (int i = 0; i < n / 2; i++){
			if(str[i] !=str[i + n / 2]){
				flag = 0;
			}
		}
		if(flag){
			puts("Yes");
		}
		else{
			puts("No");
		}
	}
	
	return 0;
}

Measured memory_bytes: 1640
while True:
    num,ans = [int(x) for x in input().split()]
    i = 1
    j = 1
    k = 1
    count = 0
    if  (num,ans)==(0,0): 
        break
    for i in range(1,num-1):
        for j in range(i + 1, num):
            for k in range(j + 1,num + 1):
                if i + j + k == ans:
                    count += 1
    print(count)


Measured memory_bytes: 5600
N, T = [int(v) for v in input().split()]
a = [int(v) for v in input().split()]

max_profit = 0
ans = 1
left = 0
right = 1

while right < N:
    if a[left] < a[right]:
        profit = a[right] - a[left]
        if profit == max_profit:
            ans += 1
        else:
            max_profit = max(max_profit, profit)
    else:
        left = right
    right += 1

print(ans)


Measured memory_bytes: 14244
#include <iostream>

using namespace std;

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

	int sum = 0;
	for (int i = 0; i < N; ++i)
	{
		int a;
		cin >> a;
		int ct = 0;
		while (a != 0 && a % 2 == 0)
		{
			a >>= 1;
			++ct;
		}
		sum += ct;
	}

	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <cstdio>
#include <queue>
#include <set>
using namespace std;

int main(){
  
  int X, Y;
  /* read input */
  scanf("%d", &X);
  scanf("%d", &Y);
  
  printf("%d", X+Y/2);
  return 0;
}


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


int compare_int(const void *a, const void *b){return (int)(*(char*)a - *(char*)b);}
int compare_int_re(const void *a, const void *b){return (int)(-*(char*)a + *(char*)b);}

int main(void){
	char s[101],t[101];
	scanf("%s",&s);
	scanf("%s",&t);
	int x=strlen(s),y=strlen(t);
	qsort(s, x, sizeof(char), compare_int);
	qsort(t, y, sizeof(char), compare_int_re);
	
	if(strcmp(s,t)<0)	printf("Yes");
	else printf("No");
	return 0;
}

Measured memory_bytes: 128
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>


using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define REP(i, n) for(ll i = 0; i < n; i++)





















int main() {
	ll n;
	string x;
	cin >> n >> x;
	ll x_popcnt = 0;
	REP(i, n) {
		if (x[i] == '1') x_popcnt++;
	}
	vector<ll> ans(n);
	if (x_popcnt == 0) {
		REP(i, n) {
			ans[i] = 1;
		}
	}
	else if (x_popcnt == 1) {
		ll x1 = 0;
		REP(i, n) {
			x1 <<= 1;
			x1 += x[i] - '0';
			x1 %= x_popcnt + 1;
		}
		ll k = 1;
		for (ll i = n - 1; i >= 0; i--) {
			ll x3 = 0;
			if (x[i] == '0') {
				x3 = (x1 + k) % (x_popcnt + 1);
			}
			else {
				ans[i] = 0;
				continue;
			}
			ans[i]++;
			while (x3) {
				ll cnt = 0, t = x3;
				while (t) {
					if (t & 1) cnt++;
					t >>= 1;
				}
				x3 %= cnt;
				ans[i]++;
			}
			k <<= 1;
			k %= x_popcnt + 1;
		}
	}
	else {
		ll x1 = 0, x2 = 0;
		REP(i, n) {
			x1 <<= 1;
			x1 += x[i] - '0';
			x1 %= x_popcnt + 1;
			x2 <<= 1;
			x2 += x[i] - '0';
			x2 %= x_popcnt - 1;
		}
		ll k1 = 1, k2 = 1;
		for(ll i = n - 1; i >= 0; i--) {
			ll x3 = 0;
			if (x[i] == '0') {
				x3 = (x1 + k1) % (x_popcnt + 1);
			}
			else {
				x3 = (x2 - k2 + x_popcnt - 1) % (x_popcnt - 1);
			}
			ans[i]++;
			while (x3) {
				ll cnt = 0, t = x3;
				while (t) {
					if (t & 1) cnt++;
					t >>= 1;
				}
				x3 %= cnt;
				ans[i]++;
			}
			k1 <<= 1;
			k1 %= x_popcnt + 1;
			k2 <<= 1;
			k2 %= x_popcnt - 1;
		}
	}
	REP(i, n) {
		cout << ans[i] << endl;
	}
}

Measured memory_bytes: 5116
import java.util.Scanner;
//import java.util.Arrays; 
public class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    String a = sc.next();
    char[] b = a.toCharArray();
    String c = "Yes";
    //System.out.println(Arrays.toString(b));
    for(int i = 0;i < b.length;i++){
      if(i % 2 == 1 && b[i]== 'R'){
        c = "No"; 
      }else if(i % 2 == 0 && b[i] == 'L'){
        c = "No"; 
      }
    }
      System.out.println(c);
  }
}

Measured memory_bytes: 24916
import sys
input=sys.stdin.readline
n=int(input())
Edge=[[] for i in range(n)]
for i in range(n-1):
  a,b=map(int,input().split())
  Edge[a-1].append((b-1,i))
  Edge[b-1].append((a-1,i))
m=int(input())
M=[]
for i in range(m):
  M.append(tuple(map(int,input().split())))

inf=float("inf")
path=[-1]*n #根から各点までのパスが通過する辺をbitで管理したもの
path[0]=0
stack=[0]
while stack:
  cur=stack.pop()
  for next,num in Edge[cur]:
    if path[next]==-1:
      path[next]=path[cur]|(1<<num)
      stack.append(next)

def popcount(x):
  x=x-((x>>1)&0x5555555555555555)
  x=(x&0x3333333333333333)+((x>>2)&0x3333333333333333)

  x=(x+(x>>4))&0x0f0f0f0f0f0f0f0f
  x=x+(x>>8)
  x=x+(x>>16)
  x=x+(x>>32)
  return x&0x0000007f

passing=[] #Mの各u,vについて、通過する辺をbitで持ったもの
for u,v in M:
  passing.append((path[u-1]^path[v-1]))

ans=2**(n-1)
Cond=[0]*(2**m)
#Mのすべての部分集合について符号付で足し合わせる
for i in range(1,2**m):
  i_ct=popcount(i)#満たすべき条件の数、これで符号を決める
  Cond[i]=Cond[i^(i&(-i))]|passing[len(bin(i&(-i)))-3]
  cond_ct=popcount(Cond[i]) #iが表すMの部分集合の条件をすべて満たす場合にすべて白になる辺集合の要素数

  ans+=pow((-1),i_ct)*pow(2,n-1-cond_ct)
print(ans)

Measured memory_bytes: 49384
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main() {
	int n; cin >> n;
	int ans = 0;
	long long a[114514];
	for (int i = 0; i < n; i++){
		cin >> a[i];
	}
	sort(a, a + n);
	long long sum = 0;
	for (int i = 0; i < n; i++){
		if (sum * 2 < a[i])ans = 1;
		else ans++;
		sum += a[i];
	}
	cout << ans << endl;
}

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

int main(){
    int n,W; 
    cin >> n >> W;
    int w[n]; 
    int v[n];
    for(int i=0; i<n; i++){
        cin >> v[i] >> w[i];
    }

    // DP テーブル
    int DP[n+1][W+1];

    for(int j=0; j<=W; j++)
        DP[n][j] = 0;

    for(int i=n-1; i>=0; i--)
        for(int j=0; j<=W; j++)
            if(j<w[i])
                DP[i][j] = DP[i+1][j];
            else{
                if(DP[i+1][j]>DP[i+1][j-w[i]]+v[i])
                    DP[i][j] = DP[i+1][j];
                else
                    DP[i][j] = DP[i+1][j-w[i]]+v[i];
            }

    cout << DP[0][W] << endl;
    return 0;

}
  


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

# define x first    
# define y second
# define mp make_pair
// everything go according to my plan      
# define pb push_back
# define sz(a) (int)(a.size())
# define vec vector         
// shimkenttin kyzdary, dzyn, dzyn, dzyn...
# define y1    Y_U_NO_y1
# define left  Y_U_NO_left
# define right Y_U_NO_right  

using namespace std;

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

const int Mod = (int)1e9 + 7;
const int MX = 1073741822;
const ll MXLL = 4e18;
const int Sz = 1110111;
// a pinch of soul
inline void Read_rap () {
  ios_base :: sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
}
inline void randomizer3000 () {
  unsigned int seed;
  asm ("rdtsc" : "=A"(seed));
  srand (seed);
}
void files (string problem) {   
  if (fopen ((problem + ".in").c_str(),"r")) {
    freopen ((problem + ".in").c_str(),"r",stdin);
    freopen ((problem + ".out").c_str(),"w",stdout);
  }
}
void localInput(const char in[] = "s") { 
  if (fopen (in, "r")) {
    freopen (in, "r", stdin);
  }
  else
    cerr << "Warning: Input file not found" << endl;
}
int n;

int ans = MX;

int calc (int x) {
  int res = 0;    
  while (x) {
    res += x%10;
    x /= 10;
  }
  return res;
}
            
int main()
{                                  
  # ifdef Local
    //localInput();
  # endif
  Read_rap();
  cin >> n;
  for (int a = 1; a < n; a++)
    ans = min (ans, calc (a) + calc (n - a));

  cout << ans;

  return 0;
}






// Coded by Z..



Measured memory_bytes: 256
//khodaya khodet komak kon
#include <bits/stdc++.h>

#define F first
#define S second
#define pb push_back
#define all(x) x.begin(), x.end()
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")


using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

const int N = 200000 + 10;
const ll MOD = 1000000000 + 7;
const ll INF = 1000000010;
const ll LOG = 25;

int n;
string s;

int32_t main(){
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> s;
	n = s.size();
	int sm = 15 - n;
	for (auto u:s) if (u == 'o') sm++;
	cout << (sm >= 8?"YES":"NO");












	return 0;
}


Measured memory_bytes: 3652
import collections
q=collections.deque()
n,m=map(int,input().split())
for i in range(n):
  a,b=input().split()
  b=int(b)
  q.append([a,b])
t=0
while len(q)!=0:
  n=q.popleft()
  if n[1]<=m:
    t+=n[1]
    print(n[0],str(t))
  else:
    t+=m
    n[1]-=m
    q.append(n)


Measured memory_bytes: 13300
//  cout << char(i+48) << endl;//なぜかaは47と得る時がある。+48で出力もaにできる。
//  cout << char(97) << endl;//アスキーコードでaを出力
// sort(b.begin(), b.end());//bという配列を小さい方からソート
// reverse(b.begin(), b.end());//bという配列をリターン
// 10桁でdouble出力するパターン１ 
// printf("%.10f\n", ma);
// 10桁でdouble出力するパターン２
//cout << fixed << setprecision(10);
//  cout << ma << endl;

/*01 02 03 12 13 23　と６回見ていくパターン 
for(int i=0;i<n-1;i++){
  for(int j=i+1;j<n;j++){
    }
  }
*///vector<vector<int>> data(3, vector<int>(4));//int型の2次元配列(3×4要素の)の宣言
//int64_t a;
//10のi乗pow(10, i);
/*string s; stringでの文字列を数字型に変える方法
  cin >> s;
  rep(i,s.size()-2) {
  int a= (s.at(i)-'0')*100 + (s.at(i+1)-'0')*10+ s.at(i+2) -'0';
    */
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
  int n;
  cin >> n;
  vector<ll> a(n);
  rep(i,n) cin >> a.at(i);
  ll cnt=0;
  rep(i,n) if(a.at(i)%2 == 1)cnt++;
  if(cnt%2==0)cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
//  cout << cnt << endl;
}

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

typedef long long   signed int LL;
typedef long long unsigned int LU;

#define incID(i, l, r) for(int i = (l)    ; i <  (r); i++)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define  inc(i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define  dec(i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)

#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))

#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define UB upper_bound
#define LB lower_bound
#define PQ priority_queue

#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
#define  FOR(it, v) for(auto it =  v.begin(); it !=  v.end(); ++it)
#define RFOR(it, v) for(auto it = v.rbegin(); it != v.rend(); ++it)

template<typename T> bool   setmin(T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool   setmax(T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

// ---- ----

LL n, m, x[100002];
const LL MOD = 1000000007;

void mat_prod(LL a[3][3], LL b[3][3], LL c[3][3]) { // a = b * c;
	LL d[3][3];
	inc(i, 3) {
	inc(j, 3) {
		d[i][j] = 0;
	}
	}
	
	inc(i, 3) {
	inc(j, 3) {
	inc(k, 3) {
		(d[i][j] += b[i][k] * c[k][j]) %= MOD;
	}
	}
	}
	
	inc(i, 3) {
	inc(j, 3) {
		a[i][j] = d[i][j];
	}
	}
	
	return;
}

void mat_exp(LL a[3][3], LL b[3][3], LL c) { // a = b ^ c;
	static bool flag = true;
	static LL t[30][3][3];
	if(flag) {
		inc(i, 3) {
		inc(j, 3) {
			t[0][i][j] = b[i][j];
		}
		}
		inc(i, 30 - 1) {
			mat_prod(t[i + 1], t[i], t[i]);
		}
		flag = false;
	}
	
	inc(i, 3) {
	inc(j, 3) {
		a[i][j] = 0;
	}
	}
	inc(i, 3) { a[i][i] = 1; }
	inc(i, 30) {
		if(c & (1 << i)) {
			mat_prod(a, a, t[i]);
		}
	}
	
	return;
}

int main() {
	cin >> n >> m;
	inc1(i, m) { cin >> x[i]; }
	x[0] = 0;
	x[m + 1] = n;
	
	LL a[3][3] = { { 1, 1, 0 }, { 4, 0, 1 }, { 10, MOD - 3, 3 } };
	LL b[3][3] = { { 0, 1, 0 }, { 0, 0, 1 }, {  1, MOD - 3, 3 } };
	LL c[3][3] = { { 1, 0, 0 }, { 0, 1, 0 }, {  0,       0, 1 } };
	LL d[3][3];
	
	inc(i, m + 1) {
		mat_prod(c, b, c);
		mat_exp(d, a, x[i + 1] - x[i] - 1);
		mat_prod(c, d, c);
	}
	
	cout << (c[0][1] + c[0][2] * 4) % MOD << endl;
	
	return 0;
}


Measured memory_bytes: 1024
//ALDS1_2_A_19140837_Ojima_Yukiya.cpp
//
//提出日 2020/07/01 wednesday
//
//プログラミング基礎演習2 CS 第8回課題 ALDS1_2_A
//
//学修番号 19140837　小島優希也

#include <iostream>
#include <vector>
using namespace std;

void display(vector<int> v) {
    for (int i = 0; i < v.size() - 1; i++) {
        cout << v.at(i) << " ";
    }
    cout << v.at(v.size() - 1) << endl;
}

void swap(int& a, int& b) {
    int temp = a;
    a = b;
    b = temp;
}

void bubblesort(vector<int> a) {
    bool flag = true;
    int counta = 0;
    while (flag) {
        flag = false;
        for (int j = a.size() - 1; j >= 1; j--) {
            if (a.at(j) < a.at(j - 1)) {
                swap(a.at(j), a.at(j-1));
                counta++;
                flag = true;
            }
        }
    }
    display(a);
    cout << counta << endl;
}

int main(void) {
    vector<int> vec;
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
        int value;
        cin >> value;
        vec.push_back(value);
    }
    bubblesort(vec);
    return 0;
}


Measured memory_bytes: 3160
A, B, M = map(int, input().split())
Ax = list(map(int, input().split()))
Bx = list(map(int, input().split()))
listM = []
for i in range(M):
    listM.append(list(map(int, input().split())))

Min = Ax[listM[i][0] - 1] + Bx[listM[i][1] - 1] - listM[i][2]
min0 = min(Ax) + min(Bx)

for i in range(M):
    if Ax[listM[i][0] - 1] + Bx[listM[i][1] - 1] - listM[i][2] < Min:
        Min = Ax[listM[i][0] - 1] + Bx[listM[i][1] - 1] - listM[i][2]
if min0 < Min:
    print(min0)
else:
    print(Min)


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

int main(){
    int H, W; cin >> H >> W;
    vector<vector<char>> map(H, vector<char>(W));
 
    rep(i, H) rep(j, W) cin >> map[i][j];

    vector<bool> raw(H,true), column(W,true);
    rep(i,H) rep(j,W) {
        if(map.at(i).at(j) == '#'){
            raw.at(i) = false;
            column.at(j) = false;
        }
    }
    rep(i,H) {
        bool f = false;
        rep(j,W) {
            if(!raw.at(i) && !column.at(j)){
                cout << map.at(i).at(j);
                f = true;
            }
        }
        if(f) cout << endl;
    }
}


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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int n;
  cin >> n;
  
  vector<int> a(n);
  for(int i = 0; i < n; i++) cin >> a.at(i);
  
  sort(a.begin(), a.end());
  
  vector<pair<int, int>> b;
  int now = a.at(0), count = 1;
  for(int i = 1; i < n; i++){
    if(a.at(i - 1) == a.at(i)){
      count++;
    }
    else{
      b.push_back(make_pair(now, count));
      now = a.at(i);
      count = 1;
    }
  }
  b.push_back(make_pair(now, count));
  
  int ans = 0;
  for(int i = 0; i < b.size(); i++){
    if(b.at(i).first <= b.at(i).second) ans += b.at(i).second - b.at(i).first;
    else ans += b.at(i).second;
  }
  
  cout << ans << '\n';
}

Measured memory_bytes: 1784
#include <bits/stdc++.h>
using namespace std;
// typedef __uint128_t u128;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef pair<ll, ll> ii;
typedef vector<pair<ll, ll>> vii;
typedef vector<vector<pair<ll, ll>>> vvii;
typedef long double ld;
typedef vector<long double> vld;
typedef vector<vector<long double>> vvld;
typedef vector<bool> vbl;
typedef vector<vector<bool>> vvbl;
#define ff first
#define ss second
#define pb push_back
#define all(c) (c).begin(), (c).end()
const long long MOD = 1e9 + 7;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    int x = c / b + (c % b != 0);
    int y = a / d + (a % d != 0);
    // cout << x << ' ' << y << endl;
    if (x > y)
        cout << "No\n";
    else
    {
        cout << "Yes\n";

    }
    
    return 0;
}

Measured memory_bytes: 3652
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <map>
#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)

using namespace std;

typedef long long ll;

int n;
char buf[310][610];

bool isOK(int t) {
  REP(i, n) {
    REP(j, n) {
      if(buf[i][t+j] != buf[j][t+i]) {
        return false;
      }
    }
  }
  return true;
}

int main(void) {
  scanf("%d", &n);
  REP(i, n) {
    scanf("%s", buf[i]);
    REP(j, n) {
      buf[i][n+j] = buf[i][j];
    }
  }
  
  int res = 0;
  REP(t, n) {
    if(isOK(t)) {
      res += n;
    }
  }
  cout << res << endl;
  
  return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  lint k, a, b; cin >> k >> a >> b;
  if (a >= k) {
    return cout << 1 << '\n', 0;
  }
  if (a <= b) {
    return cout << -1 << '\n', 0;
  }
  lint d = a - b;
  lint res = (max(k - a, 0LL) + d - 1) / d;
  res = 2 * res + 1;
  cout << res << '\n';
}

Measured memory_bytes: 256
def rec(result, i, dest, step):
    if i > dest:
        return result
    if i % result[-1] == 0:
        result.append(i)
        rec(result, i+result[-1], dest, result[-1])
    else:
        rec(result, i+step, dest, result[-1])
        
x, y = [int(i) for i in input().split()]
l = [x]
ans = rec(l, 2*x, y, x)
print(len(l))


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define ll long long int
#define yorn(f) cout<<((f)?"Yes":"No")<<endl;
#define YORN(f) cout<<((f)?"YES":"NO")<<endl;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define put(x) cout << x << endl;
#define println(x) cout << x << endl;
using namespace std;
signed main()
{
    int n;
    cin >> n;
    
    int d3 = n/100;
    int x = 100 * d3 + 10 * d3 + d3;
    if (x >= n) {
        put(x);
    }
    else {
        put(100 * (d3 + 1) + 10 * (d3 + 1) + d3 + 1)
    }
    return 0;
}

Measured memory_bytes: 3604
import sys, os, math, bisect, itertools, collections, heapq, queue, copy, array

# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
# from decimal import Decimal
# from collections import defaultdict, deque

sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)

MOD = 10 ** 9 + 7
INF = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = ii()
    T = il()
    M = ii()
    sm = sum(T)

    for m in range(M):
        P, X = il()
        print(sm-(T[P-1]-X))


if __name__ == '__main__':
    main()


Measured memory_bytes: 9780
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#define x first
#define y second

namespace gwlthll
{
	typedef long long ll;
	typedef std::pair<int,int> pii;
	const int N=101000,INF=1000000007;
	ll sa[N],sb[N];
	pii s[N];
	int n,L,T,na,nb;

	bool cmp(pii A,pii B){return A.x==B.x?A.y<B.y:A.x<B.x;}

	void initialize()
	{
		scanf("%d%d%d",&n,&L,&T),na=nb=0;
		for(int i=1;i<=n;i++)
		{
			scanf("%d%d",&s[i].x,&s[i].y);s[i].y=3-s[i].y*2;
			if(s[i].y==1)sa[++na]=s[i].x;
			else sb[++nb]=s[i].x;
		}
	}
	inline int adj(int x){return (x%L+L)%L;}
	pii GetTheFirstPosition()
	{
		if(!na || !nb)return pii(adj(s[1].x+s[1].y*T),s[1].y);
		int ia,ib,k=s[1].y,rt=T*2;
		if(k>0)
		{
			ia=1,ib=1,k*=-1;
			rt-=sb[1]-sa[1];
		}
		else
		{
			ia=na,ib=1,k*=-1;
			rt-=adj(sb[1]-sa[na]);
		}
		if(rt<0)return pii(adj(s[1].x+s[1].y*T),s[1].y);
		while(1)
		{
			ll nt=L,tmp=na%nb;
			int tb=(ib-1+tmp)%nb+1,fk;
			nt+=(ll)L*(na/nb);
			fk=sb[tb]-sb[ib];if(fk<0)fk+=L;
			nt+=fk;
			
			if(rt>=nt)rt-=nt,ib=tb;
			else break;
		}

		while(1)
		{
//			printf("%d %d %d %d\n",ia,ib,k,rt);
			if(k>0)
			{
				int tb=ib%nb+1,nt=(sb[tb]-sb[ib]);
				if(nt<=0)nt+=L;
				if(rt<nt)break;
				rt-=nt,ib=tb;
			}
			else 
			{
				int ta=((ia-2+na*2)%na)+1,nt=(sa[ia]-sa[ta]);
				if(nt<=0)nt+=L;
				if(rt<nt)break;
				rt-=nt,ia=ta;
			}
//			printf("?\n");
			k*=-1;
		}

//		printf("%d %d %d %d\n",ia,ib,k,rt);
		
		int pos;
		
		if(k>0)pos=sa[ia];
		else pos=sb[ib];
		pos=adj(pos+k*T);

		return pii(pos,k);
	}
	void solve()
	{
		initialize();
		pii A=GetTheFirstPosition();

		for(int i=1;i<=n;i++)
			s[i].x=((s[i].x+T*s[i].y)%L+L)%L;
		std::sort(s+1,s+n+1,cmp);

		int pos=0;
		for(int i=1;i<=n;i++)
			if(s[i]==A){pos=i;break;}

		for(int cnt=n;cnt--;)
		{
			printf("%d\n",s[pos].x);
			pos=pos%n+1;
		}
	}
}

int main()
{
//	freopen("C.in","r",stdin);
//	freopen("C.out","w",stdout);
	gwlthll::solve();
	return 0;
}


Measured memory_bytes: 2816
#include <bits/stdc++.h>
#include <iostream>
#include<math.h> 
using namespace std;
int main(){
	long long int n,d;;
	cin>>n;
	cin>>d;
	long long int a[n+5][2];
	long long int c=0;
	for(int i=0;i<n;i++){
		for(int j=0;j<2;j++){
			scanf("%lld",&a[i][j]);
		}
	}
	for(int i=0;i<n;i++){
		long long int p=0,sum=0;
		for(int j=0;j<2;j++){
			p=a[i][j]*a[i][j];
			sum+=p;
		}
		double x=sqrt(sum);
		if(x<=d){
			c++;
		}
	}
	printf("%lld\n",c);
}

Measured memory_bytes: 6840
#include<bits/stdc++.h>
using namespace std;
inline int read(){
	int x;
	char c;
	int f=1;
	while((c=getchar())!='-' && (c>'9' || c<'0'));
	if(c=='-') c=getchar(),f=-1;
	x=c^'0';
	while((c=getchar())>='0' && c<='9') x=(x<<1)+(x<<3)+(c^'0');
	return x*f;
}
int a[5],e;
int main(){
	int x=read();
	while(x){
		a[++e]=x%10;
		x/=10;
	}
	if(a[1]==a[2] && a[2]==a[3]) printf("Yes\n");
	else if(a[2]==a[3] && a[3]==a[4]) printf("Yes\n");
	else printf("No\n");
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ALL(a) (a).begin(), (a).end()
#define rep(i, n) REP(i, 0, (n))
#define repc(i, n) REPC(i, 0, (n))
#define REP(i, n, m) for (int i = (int)(n); i < (int)(m); i++)
#define REPC(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define REPCM(i, n, m) for (int i = (int)(n); i >= (int)(m); i--)
using namespace std;
using ll = int_fast64_t;
using pr = pair<ll, ll>;
using vll = vector<ll>;
using vpr = vector<pr>;
template<class T> inline bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } else return false; }
template<class T> inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } else return false; }

void answer() {
  ll n; cin>>n;
  vpr a(n);
  rep(i,n) {
    ll a_; cin>>a_;
    a[i] = make_pair(a_, i);
  }
  sort(ALL(a), greater<pr>());
  vector<vll> dp(n+1, vector<ll>(n+1, -1));
  dp[0][0] = 0;
  rep(tot,n) {
    pr cur = a[tot];
    repc(x,tot) {
      int y = tot - x;
      chmax(dp[x+1][y], dp[x][y] + cur.first * abs(cur.second - x));
      chmax(dp[x][y+1], dp[x][y] + cur.first * abs(cur.second - (n - 1 - y)));
    }
  }
  ll ans = -1;
  rep(i,n) chmax(ans, dp[i][n-i]);
  cout << ans << "\n";
}
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  answer();
  return 0;
}

Measured memory_bytes: 34572
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;cin>>N;vector<int>A(26,100);
  for(int i=0;i<N;i++){string S;cin>>S;vector<int>B(26);for(int j=0;j<S.size();j++)B[S.at(j)-'a']++;for(int j=0;j<26;j++)A[j]=min(A[j],B[j]);}
  for(int i=0;i<26;i++)for(int j=0;j<A[i];j++)cout<<char(i+'a');
  cout<<endl;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for (int i = x, i##_len = (n); i < i##_len; ++i)
#define ALL(n) begin(n), end(n)

int main()
{
  long long A, B, r, tmp, a, b;
  cin >> A >> B;
  a = A;
  b = B;
  if (A < B)
  {
    tmp = A;
    A = B;
    B = tmp;
  }
  r = A % B;
  while (r != 0)
  {
    A = B;
    B = r;
    r = A % B;
  }
  cout << a * b / B << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define ll          long long
#define pb          push_back
#define eb 			emplace_back
#define mp 			make_pair
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define vii         vector<pii>
#define mi          map<ll,ll>
#define mii         map<pii,ll>
#define all(a)      (a).begin(),(a).end()
#define fi          first
#define si          second
#define sz(x)       (ll)x.size()
#define endl        '\n'
#define checkbit(n, b) ((n >> b) & 1)
#define mod        1000000007
#define inf        1000000000000000000
#define puts(n)		cout<<n;
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define setbits(x) __builtin_popcount(x)
#define mset(m,v) memset(m,v,sizeof(m))
using namespace std;
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	string s;
	cin>>s;
	if(s[2]==s[3] && s[4]==s[5]) cout<<"Yes";
	else cout<<"No";
	
	return 0;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10 ** 9)
input = sys.stdin.readline
from itertools import permutations,  combinations, accumulate
from functools import *
from collections import deque, defaultdict, Counter
from heapq import heapify, heappop, heappush, heappushpop

INF = float('inf')
NIL = - 1

""" Input
S = input().rstrip()
N = int(input())
A = list(map(int, input().split()))
A = np.array(input().split(), dtype=np.float64)
D = [int(input()) for _ in range(N)]
AB = [[int(x) for x in input().split()] for _ in range(N)]
PX = [[int(x) for x in input().split()] for _ in range(Q)]
"""

N, A, B = map(int, input().split())
train = N * A
print(B if B < train else train)



# def main():

# if __name__ == '__main__':
#     main()


Measured memory_bytes: 3568
#include <bits/stdc++.h>
#define LLI long long int
#define FOR(v, a, b) for(LLI v = (a); v < (b); ++v)
#define FORE(v, a, b) for(LLI v = (a); v <= (b); ++v)
#define REP(v, n) FOR(v, 0, n)
#define REPE(v, n) FORE(v, 0, n)
#define REV(v, a, b) for(LLI v = (a); v >= (b); --v)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define ITR(it, c) for(auto it = (c).begin(); it != (c).end(); ++it)
#define RITR(it, c) for(auto it = (c).rbegin(); it != (c).rend(); ++it)
#define EXIST(c,x) ((c).find(x) != (c).end())
#define fst first
#define snd second
#define popcount __builtin_popcount
#define UNIQ(v) (v).erase(unique(ALL(v)), (v).end())
#define bit(i) (1LL<<(i))

#ifdef DEBUG
#include <misc/C++/Debug.cpp>
#else
#define dump(...) ((void)0)
#endif

#define gcd __gcd

using namespace std;
template <class T> constexpr T lcm(T m, T n){return m/gcd(m,n)*n;}

template <typename I> void join(ostream &ost, I s, I t, string d=" "){for(auto i=s; i!=t; ++i){if(i!=s)ost<<d; ost<<*i;}ost<<endl;}
template <typename T> istream& operator>>(istream &is, vector<T> &v){for(auto &a : v) is >> a; return is;}

template <typename T, typename U> bool chmin(T &a, const U &b){return (a>b ? a=b, true : false);}
template <typename T, typename U> bool chmax(T &a, const U &b){return (a<b ? a=b, true : false);}
template <typename T, size_t N, typename U> void fill_array(T (&a)[N], const U &v){fill((U*)a, (U*)(a+N), v);}

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

  string s,t;
  while(cin >> s >> t){
    set<char> s_char;
    for(auto c : s){
      s_char.insert(c);
    }

    bool no = false;
    for(auto c : t){
      if(not EXIST(s_char,c)){
        no = true;
      }
    }

    int n = s.size();
    int m = t.size();

    s += s;
    
    vector<vector<int>> next(2*n+1, vector<int>(26, 2*n));
    REV(i,2*n-1,0){
      REP(j,26){
        next[i][j] = next[i+1][j];
      }
      next[i][s[i]-'a'] = i;
    }
    
    LLI ans = 0;
    int cur = 0;
    for(auto c : t){
      int nc = next[cur][c-'a'];
      //cerr << nc << endl;
      ans += (LLI)(nc-cur+1);

      cur = (nc+1)%n;
    }
    

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


Measured memory_bytes: 27116
#include <algorithm>
#include<iostream>
#include<vector>
#include<list>
#include<map>
#include<set>
#include<string>
#include <sstream>

#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<limits.h>
using lll = long long;
using ull = unsigned long long;
using namespace std;
int dp[1001][1001];
int lcs(string x,string y){
  int m,n;
  lll ii,jj,kk;
  
  m = x.size();
  n = y.size();
  memset(dp,0,sizeof(dp));
  int maxl = 0;

  for(ii=0;ii<m;ii++){
    for(jj=0;jj<n;jj++){
      if(x[ii] == y[jj]){
        dp[ii+1][jj+1] = dp[ii][jj] + 1;
      }
      else{
        dp[ii+1][jj+1] = max(dp[ii][jj+1],dp[ii+1][jj]);
      }

      maxl = max(maxl,dp[ii+1][jj+1]);
      
    }
  }
  return maxl;
}

int main(){
  lll ii,jj,kk;
  vector<int> ret;
  int q;
  string x,y;

  cin >> q;

  for(ii=0;ii<q;ii++){
    cin >> x >> y;
    cout << lcs(x,y) << endl;
  }

  return 0;
}



Measured memory_bytes: 7088
#include <bits/stdc++.h>
#define SORT(x) sort((x).begin(),(x).end())
#define ALL(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < n; i++)
#define reps(i, m, n) for(int i = m; i < n; i++)
#define repr(i, m, n) for(int i = m; i >= n; i--)
template<class T>bool maxi(T &a,const T &b){if(a<b){ a=b; return 1;} return 0;}
template<class T>bool mini(T &a,const T &b){if(b<a){ a=b; return 1;} return 0;}
#define y0 y3487465 //j0
#define y1 y1347829 //j1
#define INF2 4000000000000000037
#define INF 1000000007
#define PI (acos(-1))
#define MOD 1000000007
using namespace std;
typedef long long ll;


void Main(){

  int A,B,C; cin>>A>>B>>C;

  cout<< ( A+B>=C ? "Yes" : "No" )<<"\n";

}

//-----------------------------------
int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  Main();
}
//-----------------------------------


Measured memory_bytes: 256
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        n: usize,
    }
    let mut ans = 0;
    if n / 1000 == 2 {
        ans += 1;
    }
    if n % 1000 / 100 == 2 {
        ans += 1;
    }
    if n % 100 / 10 == 2 {
        ans += 1;
    }
    if n % 10 == 2 {
        ans += 1;
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include<stdio.h>
int main(void){
    long i,r,k = 0,n,x,a[100000];
    scanf("%ld%ld",&n,&x);
    for(i = 0;i < n;i++){
        scanf("%ld",&a[i]);
    }
    for(i = 0;i < n - 1;i++){
        r = a[i] + a[i + 1] - x;
        if(r > 0){
            if(a[i + 1] >= r){
                a[i + 1] -= r;
            }else{
                a[i + 1] = 0;
            }
            k += r;
        }
    }
    printf("%ld\n",k);
    return 0;
}

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

string s;

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


Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <vector>
#include <cstdio>
#include <algorithm>
#include <array>
#include <cmath>

using namespace std;

using ll = long long int;

int main() {
    int N;
    vector<int> Hi;

    cin >> N;
    for (int i = 0; i < N; i++) {
        int h;
        cin >> h;
        Hi.push_back(h);
    }

    int highest = Hi.front();
    int cnt = 0;
    for (const auto h : Hi) {
        if (h >= highest) {
            highest = h;
            cnt++;
        }
    }
    
    cout << cnt;

    return 0;
}



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

int main()
{
    int A, B, C;
    cin >> A >> B >> C;
    int K;
    cin >> K;
    cout << A + B + C + max({A, B, C}) * ((1 << K) - 1) << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,c,i,ans=0,d;
	cin>>a>>b>>c;
	for(i=1;i<=a;i++)
	{
		cin>>d;
		if(d<b||d>=c)
		ans++;
		else
		ans==ans;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
using namespace std;

const double INF = 1e8;

class Edge{
    public:
        int to;
        double cost,limit;
        Edge(int to, double cost, double limit) : to(to) ,cost(cost) ,limit(limit) {}
};

class Node{
    public:
        double dis;
        bool isUsed;
        Node(){
            this->dis = INF;
            this->isUsed = 0;
        }
};

typedef vector<vector<Edge>> AdjList;

double dijkstra(AdjList g, int n,int s, int t){
    vector<vector<vector<Node>>> node(35,vector<vector<Node>>(35,vector<Node>(35)));
    //??????????????????????????????????????????
    typedef pair<pair<double,double>,pair<int,int>> p;

    priority_queue<p, vector<p>, greater<p>> q;

    q.push(make_pair(make_pair(0.0, 0.0), make_pair(s,34)));
    node[s][0][34].dis = 0.0;

    p u;
    while(not q.empty()){
        u = q.top(); q.pop();
        int current = u.second.first;
        int prev = u.second.second;
        double speed = u.first.second;
        node[current][speed][prev].isUsed = 1;

        rep(i,g[current].size()){
            int next = g[current][i].to;
            //if(node[next][speed][current].isUsed) continue;
            if(next == prev) continue;

            for(double j = -1; j <= 1; j++){
                int ns = speed + j;
                if(ns > 0){
                    if(ns > g[current][i].limit) continue;
                    if(node[next][ns][current].dis > node[current][static_cast<int>(speed)][prev].dis + g[current][i].cost / static_cast<double>(ns)){
                        node[next][ns][current].dis = node[current][static_cast<int>(speed)][prev].dis + g[current][i].cost / static_cast<double>(ns);
                        q.push(make_pair(
                                    make_pair(node[next][ns][current].dis, ns),
                                    make_pair(next,current)
                                    )
                              );
                    }
                }
            }
        }
    }
///    cout << endl;
///    rep(i,n){
///        rep(j,30){
///            cout << node[i][j].dis << ' ';
///        }
///        cout << endl;
///    show("------------")
///    }
    double mini = INF;
    rep(i,n){
        mini = min(mini, node[t][1][i].dis);
    }
    return mini;
}

int main(){
    int n, m;
    while(cin >> n >> m, n||m){
        int s, t;
        cin >> s >> t;
        s--; t--;
        AdjList g(n);
        rep(i,m){
            int a, b;
            double c, d;
            cin >> a >> b >> c >> d;
            a--; b--;
            g[a].emplace_back(Edge{b,c,d});
            g[b].emplace_back(Edge{a,c,d});
        }
        double tmp = dijkstra(g,n,s,t);
        if(tmp == INF) cout << "unreachable" << endl;
        else cout <<fixed << setprecision(12) <<  tmp << endl;
    }
}

Measured memory_bytes: 4380
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> VI;
typedef long long ll;
#define REP(i, n) for(int i = 0;i < n;i++)
#define ALL(a) a, a+sizeof(a)/sizeof(a[0])
#define all(a) a.begin(),a.end()
#define MOD 1000000007

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

int main(void) {
	int a, b, c;
	cin >> a >> b >> c;
	int ans = 0;
	for (int i = a; i <= b; i++) {
		if (c % i == 0) ans++;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3116
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}void pr(){ln;}
template<class A,class...B>void pr(const A &a,const B&...b){cout<<a<<(sizeof...(b)?" ":"");pr(b...);}
template<class A>void PR(A a,ll n){rep(i,n)cout<<(i?" ":"")<<a[i];ln;}
const ll MAX=1e9+7,MAXL=1LL<<61,dx[8]={-1,0,1,0,-1,-1,1,1},dy[8]={0,1,0,-1,-1,1,1,-1};
typedef pair<ll,ll> P;
typedef pair<P,ll> PP;

void Main() {
  ll n;
  R n;
  PP a[n];
  rep(i,n) cin >> a[i].F.F >> a[i].F.S >> a[i].S;
  ll ans[n+1];
  rep(i,n+1)ans[i]=MAXL;
  vector<P> v;
  rep(i,n) {
    v.pb(P(a[i].F.F,0));
    v.pb(P(a[i].F.S,1));
  }
  v.pb(P(0,0));
  v.pb(P(0,1));
  ll d[n][v.size()];
  vector<P> b[n];
  rep(i,n) {
    rep(j,v.size()) {
      if(v[j].S==0) d[i][j]=abs(a[i].F.F-v[j].F)*a[i].S;
      else d[i][j]=abs(a[i].F.S-v[j].F)*a[i].S;
    }
    rep(j,v.size()) b[i].pb(P(d[i][j],j));
    sort(all(b[i]));
  }
  rrep(t,pow(3,n)) {
    bitset<33> e;
    ll r=t,c=0;
    rep(i,n) {
      if(r%3==1) e.set(i*2),c++;
      else if(r%3==2) e.set(i*2+1),c++;
      r/=3;
    }
    e.set(n*2);
    e.set(n*2+1);
    ll sum=0;
    rep(i,n) {
      ll M=MAXL;
      rep(j,b[i].size()) {
        if(e.test(b[i][j].S)) {
          M=d[i][b[i][j].S];
          break;
        }
      }
      sum+=M;
      if(sum>ans[c]) goto next;
    }
    ans[c]=min(ans[c],sum);
  next:;
  }
  rep(i,n+1) pr(ans[i]);
}

int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}


Measured memory_bytes: 4084
#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;

template <class T>
T gcd(T a, T b)
{
	if (b == 0)
		return a;
	return gcd(b, a%b);
}

int main()
{
	long a, b;
	while (scanf("%ld %ld", &a, &b) != EOF)
	{
		long g = gcd(a, b);
		long l = a/g * b;
		printf("%d %d\n", g, l);
	}

	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <iomanip>
#include <map>
using namespace std;

int main() {
    int a, b;
    cin >> a >> b;
    int ans;
    bool tf = true;
    if (a == b) {
        ans = a;
    }
    if ((a + b) % 2 == 0) {
        ans = (a + b) / 2;
    }
    else tf = false;
    if (tf) cout << ans << endl;
    else cout << "IMPOSSIBLE" << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#define N 500000
#define I 1000000000

int count=0;

void merge(int *,int,int,int);

void mergeSort(int *S,int left,int right){
  if(left+1<right){
    int mid=(left+right)/2;
    mergeSort(S,left,mid);
    mergeSort(S,mid,right);
    merge(S,left,mid,right);
  }
}


int main(){
  int n,i,*S,left=0;

  scanf("%d",&n);
  S=(int *)malloc(n*sizeof(int));

  for(i=0;i<n;i++) scanf("%d",&S[i]);

  mergeSort(S,left,n);

  printf("%d",S[0]);
  for(i=1;i<n;i++) printf(" %d",S[i]);
  printf("\n");
  printf("%d\n",count);

  free(S);
  return 0;
}

void merge(int *S,int left,int mid,int right){
  int n1 = mid - left;
  int n2 = right - mid;
  int i,j,k,L[n1],R[n2];
  /* L[0...n1], R[0...n2] を生成*/
  for(i=0;i<n1;i++) L[i] = S[left + i];
  for(i=0;i<n2;i++) R[i] = S[mid + i];
  L[n1] = I;
  R[n2] = I;
  i = 0;
  j = 0;
    for(k=left;k<right;k++){
      count++;
      if(L[i]<=R[j]){
	S[k] = L[i];
	i = i + 1;
      }else{ 
	S[k] = R[j];
	j = j + 1;
      }
    }
}



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

// zero-based numbering
template<class T> struct Fenwick {
    vector<T> bit; int N;
    Fenwick(int n) : N(n) { bit.assign(n+1, 0); }
    // add w to a
    void add(int a, T w) {
        for (int x = ++a; x <= N; x += x & -x) bit[x] += w;
    }
    // sum [0, a)
    T sum(int a) {
        T ret = 0;
        for (int x = a; x > 0; x -= x & -x) ret += bit[x];
        return ret;
    }
    // sum [a, b)
    T sum(int a, int b) { return sum(b) - sum(a); }
};

int ng() {
    cout << -1 << "\n";
    return 0;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    string s; cin >> s;
    int n = s.size();
    vector<int> v(26, 0), w(26), p(n, -1);
    for (auto &x: s) v[x-'a']++;
    int cnt = 0;
    for (int i = 0; i < 26; i++) {
        cnt += v[i] & 1;
        w[i] = v[i] / 2;
    }
    if (cnt > 1) return ng();
    queue<int> d[26];
    int curr = 0;
    for (int i = 0; i < n; i++) {
        if (w[s[i]-'a']) {
            w[s[i]-'a']--;
            d[s[i]-'a'].push(curr);
            p[i] = curr++;
        }
    }
    for (int i = n-1; i >= 0; i--) {
        if (!d[s[i]-'a'].empty()) {
            p[i] = n-1-d[s[i]-'a'].front();
            d[s[i]-'a'].pop();
        }
    }
    for (int i = 0; i < n; i++) {
        if (p[i] == -1) p[i] = n / 2;
    }
    Fenwick<int> fw(n);
    long long ans = 0;
    for (int i = 0; i < n; i++) {
        ans += fw.sum(p[i], n);
        fw.add(p[i], 1);
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 2452