akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;
const ll mod=1000000007;
const ll BIG=1e15;

ll mp[301][301];
ll ans[301][301];
int main(){
    ll N,M,L; cin>>N>>M>>L;
    for(int i=0;i<=N;i++){
        for(int j=0;j<=N;j++) if(i!=j) {mp[i][j]=BIG; ans[i][j]=BIG;}
    }

    for(int i=0;i<M;i++){
        ll A,B,C; cin>>A>>B>>C;
        mp[A][B]=C;
        mp[B][A]=C;
    }

    for(int k=1;k<=N;k++){
        for(int i=1;i<=N;i++){
            for(int j=1;j<=N;j++) mp[i][j]=min(mp[i][j],mp[i][k]+mp[k][j]);
        }
    }

    for(int i=1;i<=N;i++){
        for(int j=1;j<=N;j++) if(mp[i][j]<=L && i!=j) ans[i][j]=1;
    }

    for(int k=1;k<=N;k++){
        for(int i=1;i<=N;i++){
            for(int j=1;j<=N;j++) ans[i][j]=min(ans[i][j],ans[i][k]+ans[k][j]);
        }
    }

    ll Q; cin>>Q;
    vector<ll> ANS(Q);
    for(int i=0;i<Q;i++){
        int s,t; cin>>s>>t;
        if(ans[s][t]==BIG) ANS.at(i)=-1;
        else ANS.at(i)=ans[s][t]-1;
    }

    for(int i=0;i<Q;i++) cout<<ANS.at(i)<<endl;





}

Measured memory_bytes: 2688
import java.util.*;
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		
		double r = scan.nextDouble();
		double x = Math.PI;
		System.out.println(r*2*x);
		
	}	
	
	
	//最小公約数
	/*
	static int gcd (int a, int b) {
		int temp;
		while((temp = a%b)!=0) {
			a = b;
			b = temp;
		}
		return b;
	}
	*/
	
}

Measured memory_bytes: 37392
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> lpair;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define rREP(i,m,n) for(ll i = (m); i >= (n); i--)
#define ALL(c) (c).begin(), (c).end()
#define print(x) cout << (x) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " ";} cout<<endl;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n;
    cin >> n;
    set<string> st;
    rep(i,n)
    {
        string s;
        cin >> s;
        st.insert(s);
    }
    cout << st.size() << endl;
    
}





Measured memory_bytes: 19232
import java.util.*;
public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		sc.nextLine();
		int[] num = new int[N];
		int max = 0;
		int min = 0;
		for (int i = 0; i < N; i++) {
			num[i] = sc.nextInt();
			if ( max < num[i]) {
				max = num[i];
			}
		}
		min = num[0];
		for (int i = 0; i < N; i++) {
			if (min > num[i]) {
				min = num[i];
			}
		}
		int result = max - min;
		System.out.println(result);
	}
}


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

int main(){
    int x;
    cin >> x;
    int fx=0, tmp=x;
    while(tmp!=0){
        fx+=tmp%10;
        tmp/=10;
    }
    if(x%fx==0){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#define ll long long
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#include <bits/stdc++.h>
 
using namespace std;
 
int main(void) {
    ll a, b, c, k, ans;
    cin >> a >> b >> c >> k;
    if(k < a){
        ans = k;
    }else if(k <= a + b){
        ans = a;
    }else{
        ans = a - (k - (a + b));
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
typedef vector<int> VI;
typedef vector<VI> VVI;
const ll MOD = 1000000007;
const ll INF = 1000000007;
#define REP(i, n) for(int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()

int main() {
	int a,b;
	cin >> a >> b;
	if (a <= 9 && b <= 9)
		cout << a * b;
	else
		cout << -1;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	int m, f, r;
	while(true) {
		cin>>m>>f>>r;
		if(m==-1&&f==-1&&r==-1) break;
		if(m==-1||f==-1) cout<<"F\n";
		else if(m+f>=80) cout<<"A\n";
		else if(m+f>=65) cout<<"B\n";
		else if(m+f>=50) cout<<"C\n";
		else if(m+f>=30&&r>=50) cout<<"C\n";
		else if(m+f>=30) cout<<"D\n";
		else cout<<"F\n";
	}
	return 0;
}



Measured memory_bytes: 3132
from collections import deque

def dfs(si, ei):
  q = deque()
  q.append([si,0])
  done = set([si])
  ds = [0 for _ in range(N)]
  while len(q) > 0:
    prvi, d = q.pop()
    for i in g[prvi]:
      if i in done: continue
      ds[i] = d+1
      q.append([i,d+1])
      done.add(i)
  return ds

N = int(input())
g = {i:[] for i in range(N)}
for _ in range(N-1):
  a,b = map(int,input().split())
  g[a-1].append(b-1)
  g[b-1].append(a-1)

dslist = dfs(0,N-1)
delist = dfs(N-1,0)

cntb, cntw = 0, 0
for ds, de in zip(dslist[1:N-1], delist[1:N-1]):
  if ds <= de: cntb += 1
  else: cntw += 1
print('Fennec' if cntb>cntw else 'Snuke')


Measured memory_bytes: 44772
#!/usr/bin/env python3
import sys
INF = float("inf")


def solve(N: int, h: "List[int]"):
    DP = [0]*N
    DP[1] = abs(h[1]-h[0])
    for i in range(2, N):
        DP[i] = min(DP[i-1]+abs(h[i]-h[i-1]),
                    DP[i-2]+abs(h[i]-h[i-2]))
    print(DP[N-1])

    return


def main():

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


if __name__ == '__main__':
    main()


Measured memory_bytes: 17944
#include<iostream>
#include<cstdio>
using namespace std;
int tab[12]={1,6,9,36,81,216,729,1296,6561,7776,46656,59049};
int limit[12]={0,6,9,6,9,6,9,6,9,6,6,9};
int f[100001][12];
int main()
{
	int n;
	scanf("%d",&n);
//	for(int i=1;i<=n;i++)
//		for(int j=1;j<12;j++)
//			f[i][j]=0x7fffffff;
	for(int i=1;i<=n;i++)
		f[i][0]=i;
	for(int i=1;i<=n;i++)
		for(int j=1;j<12;j++)
		{
			f[i][j]=f[i][j-1];
//			int k=i/tab[j];
//			if(f[i][j]>f[i-tab[j]*k][j-1]+k)
//				f[i][j]=f[i-tab[j]*k][j-1]+k;
			for(int k=0;tab[j]*k<=i&&k<limit[j];k++)
				if(f[i][j]>f[i-tab[j]*k][j-1]+k)
					f[i][j]=f[i-tab[j]*k][j-1]+k;
		}
	printf("%d",f[n][11]);
	return 0;
}

Measured memory_bytes: 4864
// AOJ 0239: Calorie Counting
// 2017.8.7 bal4u@uu
// 2017.10.29 retry

#include <stdio.h>

int s[1002], p[1002], q[1002], r[1002];

char buf[45], *bp;
int getint()
{
	int n = 0;
	while (*bp >= '0') n = (n<<3) + (n<<1) + (*bp++ & 0xf);
	return n;
}
int main()
{
	int n, P, Q, R, C;
	int i, f, c;

	while (fgets(bp=buf, 10, stdin) && *buf != '0') {
		n = getint();
		for (i = 0; i < n; i++) {
			fgets(bp=buf, 40, stdin);
			s[i] = getint(), bp++, p[i] = getint(), bp++;
			q[i] = getint(), bp++, r[i] = getint();
		}
		fgets(bp=buf, 40, stdin);
		P = getint(), bp++, Q = getint(), bp++;
		R = getint(), bp++, C = getint();		
		for (f = i = 0; i < n; i++) {
			c = ((p[i]+r[i]) << 2) + (q[i] << 3) + q[i];
			if (p[i] > P || q[i] > Q || r[i] > R || c > C) ;
			else printf("%d\n", s[i]), f = 1;
		}
		if (!f) puts("NA");
	}
	return 0;
}

Measured memory_bytes: 1792
import java.io.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // 入力
        MyScanner sc = new MyScanner(System.in);
        // N K
        int[] line1 = sc.nextIntArray();
        int N = line1[0];
        int K = line1[1];
        // h
        int[] h = sc.nextIntArray();

        // 初期化
        int ans = 0;

        // 主処理
        for (int i = 0; i < N; i++) {
            if (h[i] >= K) {
                ans++;
            }
        }

        // 出力
        System.out.println(ans);
    }

    static class MyScanner {
        BufferedReader br;
        // 標準入力から入力値を取得
        MyScanner(InputStream in) {
            br = new BufferedReader(new InputStreamReader(in));
        }
        // 標準入力を文字列で取得
        public String nextString() throws IOException {
            return br.readLine();
        }
        // 標準入力を文字列の配列で取得
        public String[] nextStringArray() throws IOException {
            return nextString().split(" ");
        }
        // 標準入力を数値で取得
        public int nextInt() throws IOException {
            return Integer.parseInt(nextString());
        }
        // 標準入力を数値の配列で取得
        public int[] nextIntArray() throws IOException {
            String[] strArr = nextStringArray();
            int[] intArr = new int[strArr.length];
            for(int i = 0; i < strArr.length; i++) {
                intArr[i] = Integer.parseInt(strArr[i]);
            }
            return intArr;
        }
        // 標準入力を数値で取得
        public long nextLong() throws IOException {
            return Long.parseLong(nextString());
        }
        // 標準入力を数値の配列で取得
        public long[] nextLongArray() throws IOException {
            String[] strArr = nextStringArray();
            long[] intArr = new long[strArr.length];
            for(int i = 0; i < strArr.length; i++) {
                intArr[i] = Long.parseLong(strArr[i]);
            }
            return intArr;
        }
    }

}


Measured memory_bytes: 33492
# -*- coding: utf-8 -*-
# abc127/abc127_a
import sys

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [i2s() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    a,b = i2nn()
    if a >= 13:
        print(b)
    elif a >= 6:
        print(int(b / 2))
    else:
        print(0)

main()


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

using namespace std;

typedef long long ll;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    int X, Y, Z;
    cin >> X >> Y >> Z;
    swap(X,Y);
    swap(X,Z);
    cout << X << ' ' << Y << ' ' << Z;

    

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,s,n) for(int i = s;i<n;i++)
#define repe(i,s,n) for(int i = s;i<=n;i++)
#define pb push_back
#define fi first
#define se second
typedef long long ll;
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
static const ll maxLL = (ll)1 << 62;
const int MOD=1000000007,INF=1001001001;
int dy[]={-1,0,1,0};
int dx[]={0,1,0,-1};

#define int ll

int n,cnt=0;
int a[100010],b[100010];

signed main(){
    cin>>n;
    rep(i,0,n){
        cin>>a[i];
    }
    
    cnt+=a[0]/2;
    a[0]%=2;
    rep(i,1,n){
        if(a[i-1]==1){
            if(a[i]!=0)a[i]++;
            cnt+=(a[i])/2;
            a[i]%=2;
        }
        else {
            cnt+=a[i]/2;
            a[i]%=2;
        }
    }
    
    cout<<cnt<<endl;
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>

using namespace std;

void solve()
{
	int m;
	cin >> m;
	while(m--)
	{
		long long money;
		int year;
		int n;
		cin >> money >> year >> n;
		long long max_result = 0;
		for(int i = 0; i < n; ++i)
		{
			int method;
			double profit;
			int charge;
			cin >> method >> profit >> charge;
			long long fortune = money;
			if(method == 0)
			{
				int sum = 0;
				for(int j = 0; j < year; ++j)
				{
					sum += fortune * profit;
					fortune -= charge; 
				}
				if(max_result < sum + fortune)
				{
					max_result = sum + fortune;
				}
			}
			else if(method == 1)
			{
				for(int j = 0; j < year; ++j)
				{
					fortune += fortune * profit;
					fortune -= charge;
				}
				if(max_result < fortune)
				{
					max_result = fortune;
				}
			}
		}
		cout << max_result << endl;
	}
}

int main()
{
	solve();
	return(0);
}

Measured memory_bytes: 1228
#include <bits/stdc++.h>
#define ll long long
#define MAX 500
using namespace std;

int main()
{
    ll n;
    cin>>n;
     char str[MAX]; // To store result (Excel column name) 
    int i = 0; // To store current index in str which is result 
  
    while (n > 0) { 
        // Find remainder 
        int rem = n % 26; 
  
        // If remainder is 0, then a 'Z' must be there in output 
        if (rem == 0) { 
            str[i++] = 'z'; 
            n = (n / 26) - 1; 
        } 
        else // If remainder is non-zero 
        { 
            str[i++] = (rem - 1) + 'a'; 
            n = n / 26; 
        } 
    } 
    str[i] = '\0'; 
  
    // Reverse the string and print result 
    reverse(str, str + strlen(str)); 
    cout << str << endl; 
  
    return 0;
}


Measured memory_bytes: 3616
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n, x int
	fmt.Scan(&n, &x)
	as := make([]int, n)
	for i, _ := range as {
		fmt.Scan(&as[i])
	}

	sort.Ints(as)

	var sum, ans int
	for i, a := range as {
		sum += a
		if sum > x {
			break
		}
		ans = i + 1
	}
	if sum != x && ans == n {
		ans = n - 1
	}

	fmt.Println(ans)
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
//#pragma GCC optimize(2)

using namespace std;

#define LL long long
#define Re register
#define U unsigned
#define forn(i,a,b) for(int i = a;i <= b;++i)
#define nfor(i,a,b) for(int i = a;i >= b;--i)
#define CLR(i,a) memset(i,a,sizeof(i))
#define BR printf("--------------------\n")
#define pb push_back
#define Rep(i,a,b) for(int i=a;i<=b;i++)
#define DEBUG(x) std::cerr << #x << '=' << x << std::endl
const double PI=atan(1.)*4.;
const int maxn=1e6+5;
const int inf = 0x3f3f3f3f;
const int mod=1e9+7;
const double e=2.71828182845904523536;
int dir[4][2]={1,0,0,1,-1,0,0,-1};
int a[maxn];
int main()
{
	ios::sync_with_stdio(false);
    cin.tie(0);
   	cout.tie(0);
    int n;
    cin>>n;
    int mx1=-1,mx2=-1;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        if(mx1<a[i])
        {
            mx2=max(mx1,mx2);
            mx1=a[i];
        }
        else
        {
            mx2=max(mx2,a[i]);
        }
    }
    for(int i=0;i<n;i++)
    {
        if(a[i]==mx1)
            cout<<mx2<<"\n";
        else
            cout<<mx1<<"\n";
    }
	return 0;
}


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

int main(int argc, char const *argv[]) {
    int n;
    cin >> n;
    
    if (n == 1) {
        cout << "Hello World" << endl;
    } else {
        int a, b;
        cin >> a >> b;
        cout << a + b << endl;
    }

    return 0;
}


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

int main() {
  int n;
  cin >> n;
  map<int, int> cnt;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    cnt[x]++;
  }

  if (cnt[0] > 0 || cnt[12] > 1) {
    cout << 0 << endl;
    exit(0);
  }

  for (auto&& w : cnt) {
    if (w.second >= 3) {
      cout << 0 << endl;
      exit(0);
    }
  }

  int ans = 0;
  for (int bit = 0; bit < 1 << 11; bit++) {
    vector<int> v;
    v.push_back(0);
    for (int i = 0; i < 11; i++) {
      if (cnt[i + 1] == 1) {
        if ((bit >> i & 1) == 0)
          v.push_back(i + 1);
        else
          v.push_back(24 - i - 1);
      } else if (cnt[i + 1] == 2) {
        v.push_back(i + 1);
        v.push_back(24 - i - 1);
      }
    }
    if (cnt[12] == 1) v.push_back(12);
    sort(begin(v), end(v));
    int tmp = 24 - v.back();
    for (int i = 0; i < v.size() - 1; i++) {
      tmp = min(tmp, v[i + 1] - v[i]);
    }
    ans = max(ans, tmp);
  }
  cout << ans << endl;
}

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

int main() {
    vector<int64_t> v = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    int64_t K;
    cin >> K;
    cout << v[K - 1] << endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using static System.Math;

namespace CSharpSpiral {
    class Program {
        static void Main(string[] args) {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            new Program().Solve(new ConsoleInput(Console.In, ' '));
            Console.Out.Flush();
        }
		public void Solve(ConsoleInput cin) {
			while(true) {
				var mentz = cin.ReadLine;
				if(mentz == null || mentz.Length == 0) break;
				var bucket = new int[9];
				foreach(var c in mentz)
					bucket[c - '1']++;
				var Nine = Enumerable.Range(0, 9);
				var noMore = Nine.Where(x => bucket[x] >= 4);
				var candidate = Nine.Except(noMore);
				var Res = new List<int>();
				foreach(var cand in candidate) {
					bucket[cand]++;
					for(int k = 0; k <= 0xFFFF; k++) {
						var B = new int[9];
						Array.Copy(bucket, B, 9);
						for(int shift = 0; shift < 4; shift++) {
							var j = (k >> (4 * shift)) & 15;
							if(j < 9) B[j] -= 3;
							else {
								j -= 9;
								B[j]--; B[j + 1]--; B[j + 2]--;
							}
						}
						if(B.Any(s => s < 0)) continue;
						if(B.Count(x => x > 0) == 1) {
							Res.Add(cand + 1); break;
						}
					}
					bucket[cand]--;
				}
				Console.WriteLine(Res.Any() ? Res.Join() : "0");
			}
		}

	}
	static class ExtendClass {
		public static string Join<T>(this IEnumerable<T> X, string separator = " ") => string.Join(separator, X);
	}
	class ConsoleInput {
		private readonly TextReader _stream;
		private readonly char _separator = ' ';
		private readonly Queue<string> inputStream;
		public ConsoleInput(TextReader stream, char separator = ' ') {
			this._separator = separator;
			this._stream = stream;
			inputStream = new Queue<string>();
		}
		public string Read {
			get {
				if(inputStream.Count != 0) return inputStream.Dequeue();
				string[] tmp = _stream.ReadLine().Split(_separator);
				for(int i = 0; i < tmp.Length; ++i)
					inputStream.Enqueue(tmp[i]);
				return inputStream.Dequeue();
			}
		}
		public string ReadLine { get { return _stream.ReadLine(); } }
		public int ReadInt { get { return int.Parse(Read); } }
		public long ReadLong { get { return long.Parse(Read); } }
		public double ReadDouble { get { return double.Parse(Read); } }
		public string[] ReadStrArray(long N) {
			var ret = new string[N];
			for(long i = 0; i < N; ++i)
				ret[i] = Read;
			return ret;
		}
		public int[] ReadIntArray(long N) { var ret = new int[N]; for(long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
		public long[] ReadLongArray(long N) { var ret = new long[N]; for(long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
		public double[] ReadDoubleArray(long N) { var ret = new double[N]; for(long i = 0; i < N; ++i) ret[i] = ReadDouble; return ret; }
	}

}



Measured memory_bytes: 22800
H, W = gets.split(' ').map(&:to_i)

ans = H * W
(H / 4).upto(H / 2) do |i|
	a = W * i
	if (H - i) % 2 == 0 || W % 2 == 0
		b, c = (H - i) * W / 2
		ans = [ans, (a - b).abs].min
	else
		b = (H - i) * (W + 1) / 2
		c = (H - i) * (W - 1) / 2
		ans = [ans, [a, b, c].max - [a, b, c].min].min
		b = (H - i + 1) / 2 * W 
		c = (H - i - 1) / 2 * W
		ans = [ans, [a, b, c].max - [a, b, c].min].min
	end
end
H, W = W, H
(H / 4).upto(H / 2) do |i|
	a = W * i
	if (H - i) % 2 == 0 || W % 2 == 0
		b, c = (H - i) * W / 2
		ans = [ans, (a - b).abs].min
	else
		b = (H - i) * (W + 1) / 2
		c = (H - i) * (W - 1) / 2
		ans = [ans, [a, b, c].max - [a, b, c].min].min
		b = (H - i + 1) / 2 * W 
		c = (H - i - 1) / 2 * W
		ans = [ans, [a, b, c].max - [a, b, c].min].min
	end
end
puts ans

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

using namespace std;

#define FOR(i,a,b) for(int i=(a); i<(b); i++)
#define REP(i,n) FOR(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second

template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }

typedef long long ll;
typedef pair<int, int> pii;
const ll INF = 1ll<<29;
const bool debug = 0;

int main() {
	int h,r,ans = 1;
	cin >> h >> r;
		
	if(h < 0){
		if(abs(h) > r)ans = -1;
		else if(abs(h) == r)ans = 0;
		else ans = 1;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3100
#include <iostream>
using namespace std;
void dfs(int,int);
int data[52][52];
int main(){
  int w,h,i,j,cnt;
  while(1){
    cnt=0;
    cin >> w >> h;
    if(w==0&&h==0) break;
    for(i=0;i<=h+1;i++){
      for(j=0;j<=w+1;j++){
    data[i][j]=0;
      }
    }
    for(i=1;i<=h;i++){
      for(j=1;j<=w;j++){
    cin >> data[i][j];
      }
    }
    for(i=1;i<=h;i++){
      for(j=1;j<=w;j++){
        if(data[i][j]==1){
      dfs(i,j);
      cnt++;
    }
      }
    }
    cout << cnt << endl;
  }
  return 0;
}
void dfs(int i,int j){
  if(data[i][j]==0) return ;
  data[i][j]=0;
  dfs(i-1,j);
  dfs(i+1,j);
  dfs(i,j-1);
  dfs(i,j+1);
  dfs(i-1,j-1);
  dfs(i-1,j+1);
  dfs(i+1,j-1);
  dfs(i+1,j+1);
}

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

using namespace std;

int r, g, b, n;
int k;

int main(){
	scanf("%d%d%d%d", &r, &g, &b, &n);

	for(int i = 0; i*r <= n; i++){
		for(int j = 0; j*g <= n; j++){
			if(n - i*r - j*g < 0) break;

			if((n - i*r - j*g) % b == 0) k++;
		}
	}

	printf("%d\n", k);
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repf(i,a,b) for (int i = (a); i < (b); i++)
#define repi(i,a,b) for (int i = (a); i <= (b); i++)
#define repr(i,a,b) for (int i = (a); i >= (b); i--)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define debug(x)  cout << #x << " = " << (x) << endl;
using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using vc = vector<char>;
using vvc = vector<vc>;
using vs = vector<string>;
using tiii = tuple<int, int, int>;

int main() {
  string w; cin >> w;
  
  for (char c = 'a'; c <= 'z'; c++) {
    if (count(all(w),c)%2 != 0) {
      cout << "No" << endl;
      return 0;
    }
  }
  
  cout << "Yes" << endl;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
    public static Scanner sc = new Scanner(System.in);
    public static void main(String[] args) throws Exception {
    	int i, j;
    	int sum = 0, sum2 = 0;
    	int r = sc.nextInt();
    	int c = sc.nextInt();
    	int rc[][] = new int[r][c];
    		
    	for(i = 0; i < r; i++) {
    		for(j = 0; j < c; j++) {
    			rc[i][j] = sc.nextInt();
    			sum += rc[i][j];
    			System.out.print(rc[i][j] + " ");
    		}
    		System.out.println(sum);
    		sum = 0;
    	}
    	for(j = 0; j < c; j++) {
    		for(i = 0; i < r; i++) {
    			sum += rc[i][j];
    		}
    		System.out.print(sum + " ");
    		sum2 += sum;
    		sum = 0;
    	}
    	System.out.println(sum2);
    }
}


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

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

  int A[2][110];
  for (int i = 0; i < 2; ++i) {
    for (int j = 0; j < N; ++j) {
      cin >> A[i][j];
    }
  }

  int total = A[0][0] + A[1][N-1];
  for (int i = 0; i < N-1; ++i) {
    total += A[1][i];
  }

  int ans = total;
  for (int i = 1; i < N; ++i) {
    total += -A[1][i-1] + A[0][i];
    ans = max(ans, total);
  }

  cout << ans << endl;

  return 0;
}


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































int main () {
double t1 = clock();

    long long N;
    cin >> N;
    
    vector<long long> A(N), B(N), C(N);

    for (long long i = 0; i < N; i++) {
        cin >> A[i];
    }
    for (long long i = 0; i < N; i++) {
        cin >> B[i];
    }
    for (long long i = 0; i < N; i++) {
        cin >> C[i];
    }
    
    sort(A.begin(), A.end());
    sort(B.begin(), B.end());
    sort(C.begin(), C.end());

    int64_t count = 0;

    for (long long i = 0; i < N; i++) {
        auto C_low = lower_bound(C.begin(), C.end(), B[i] + 1); // >= B[i] + 1 になる最小のインデックス
        auto A_upp = upper_bound(A.begin(), A.end(), B[i] - 1); // > B[i] - 1 になる最小のインデックス
        count += distance(C_low, C.end()) * distance(A.begin(), A_upp);
        // cout << distance(A.begin(), A_upp) << " ";
        // cout << distance(C_low, C.end()) << " ";
        // cout << count << endl;
    }

    cout << count << endl;
    double t2 = clock();
    // cout << ((t2 - t1) / CLOCKS_PER_SEC) << endl;
}

Measured memory_bytes: 5668
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;

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

	cout << (n % k ? 1 : 0) << endl;
}


Measured memory_bytes: 384
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;


public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		// TODO Auto-generated method stub
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		while(true){
			int s = Integer.parseInt(in.readLine());
			if(s == 0){
				break;
			}
			else{
				int[] is = new int[s];
				for(int i = 0;i<s;i++){
					is[i] = Integer.parseInt(in.readLine());
				}
				Arrays.sort(is);
				int as = 0;
				long a = 0;
				for(int i = 0 ;i < s-1;i++){
					as = as + is[i];
					a = a +as;
				}
				System.out.println(a);
			}
			
			
		}

	}

}

Measured memory_bytes: 24848
from time import time
from random import random

limit_secs = 2
start_time = time()

D = int(input())
c = list(map(int, input().split()))
s = [list(map(int, input().split())) for _ in range(D)]

def calc_score(t):
    score = 0
    S = 0
    last = [-1] * 26
    for d in range(len(t)):
        S += s[d][t[d]]
        last[t[d]] = d
        for i in range(26):
            S -= c[i] * (d - last[i])
        score += max(10 ** 6 + S, 0)
    return score

def solution1():
    return [i % 26 for i in range(D)]

def solution2():
    t = None
    score = -1
    for i in range(26):
        nt = [(i + j) % 26 for j in range(D)]
        if calc_score(nt) > score:
            t = nt
    return t

def solution3():
    t = []
    for _ in range(D):
        score = -1
        best = -1
        t.append(0)
        for i in range(26):
            t[-1] = i
            new_score = calc_score(t)
            if new_score > score:
                best = i
                score = new_score
        t[-1] = best
    return t

def optimize0(t):
    return t

def optimize1(t):
    score = calc_score(t)
    while time() - start_time + 0.15 < limit_secs:
        d = int(random() * D)
        q = int(random() * 26)
        old = t[d]
        t[d] = q
        new_score = calc_score(t)
        if new_score < score:
            t[d] = old
        else:
            score = new_score
    return t

def optimize2(t):
    score = calc_score(t)
    while time() - start_time + 0.15 < limit_secs:
        d1 = int(random() * D)
        q1 = int(random() * 26)
        d2 = int(random() * D)
        q2 = int(random() * 26)
        old1 = t[d1]
        old2 = t[d2]
        t[d1] = q1
        t[d2] = q2
        new_score = calc_score(t)
        if new_score < score:
            t[d1] = old1
            t[d2] = old2
        else:
            score = new_score
    return t


t = solution3()
t = optimize2(t)
print('\n'.join(str(e + 1) for e in t))


Measured memory_bytes: 84908
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

int main(){
  int h, w, a, b; cin >> h >> w >> a >> b; int s[h][w];
  fill(s[0], s[h], 0);
  for(int i=0; i<b; i++) {
    for(int j=a; j<w; j++) {
      s[i][j] = 1;
    }
  }
  for(int i=b; i<h; i++) {
    for(int j=0; j<a; j++) {
      s[i][j] = 1;
    }
  }
  for(int i=0; i<h; i++) {
for(int j=0; j<w; j++) {
  cout << s[i][j];
} cout << endl;
  }
}


Measured memory_bytes: 5120
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bits/stdc++.h>
#include<cmath>
#include<bitset>
#include<queue>
#define ll long long
#define itn int
#define co(ans) cout<<ans<<endl;
#define COYE cout<<"YES"<<endl;
#define COYe cout<<"Yes"<<endl;
#define COye cout<<"yes"<<endl;
#define CONO cout<<"NO"<<endl;
#define CONo cout<<"No"<<endl;
#define COno cout<<"no"<<endl;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define INF ((1LL<<62)-(1LL<<31))
#define MOD 1000000007
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
using namespace std;


int main(){
  ll N,T,ans=0;
  cin>>N>>T;
  
  ll DP[N+1][T][2];
  // DP[i][j][t] i番目までの食品で時間jまでに食べた時の最大値
  // t==0 特になし  t==1 もう一つ食べる
  
  REP(i,N+1){
    REP(j,T){
      REP(t,2){
        DP[i][j][t]=0;
      }
    }
  }
  
  REP(i,N){
    ll a,b;
    cin>>a>>b;
    REP(j,T){
      DP[i+1][j][0]=DP[i][j][0];
      DP[i+1][j][1]=max(DP[i][j][1],DP[i][j][0]+b);
      if(j>=a){
        chmax(DP[i+1][j][0],DP[i][j-a][0]+b);
        chmax(DP[i+1][j][1],DP[i][j-a][1]+b);
      }
    }
  }
  
  
  co(max(DP[N][T-1][0],DP[N][T-1][1]));
}

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

string s, s2;

void solve() {
  s2 += s[0];
  for (int i = 1; i < s.size(); i++) {
    if (s[i] == s[i - 1]) {
      continue;
    }
    else {
      s2 += s[i];
    }
  }
  cout << s2.size() - 1 << "\n";
  return;
}

int main() {
  cin >> s;
  solve();
  return 0;
}

Measured memory_bytes: 512
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
//問題文および制約はちゃんと確認しよう！
//サイズは10^5じゃなくて2×10^5とかかもしれないし、重要な制約・条件を見落としているかも
//とりあえずサンプルを読んでから解法を考えよう？
string cal(){
	string s;cin>>s;
	rep(i,3){
		if(s[i]=='7') return "Yes";
	}
	return "No";
}
int main()
{
	cout<<cal()<<endl;
}


Measured memory_bytes: 3632
#include<cstdio>
#define pritnf printf
#define scnaf scanf
#define retrun return
#define sizoef sizeof
#define inl inline
#define br break
#define con continue
#define mst(mst_a,mst_b) memset(mst_a,mst_b,sizeof(mst_a))
#define fora(fora_x,fora_a,fora_b) for(re nti (fora_x)=(fora_a);(fora_x)<=(fora_b);++(fora_x))
#define forb(forb_x,forb_a,forb_b) for(re nit (forb_x)=(forb_a);(forb_x)>=(forb_b);--(forb_x))
#define foral(foral_x,foral_a,foral_b) for(re ll (foral_x)=(foral_a);(foral_x)<=(foral_b);++(foral_x))
#define forbl(forbl_x,forbl_a,forbl_b) for(re ll (forbl_x)=(forbl_a);(forbl_x)>=(forbl_b);--(forbl_x))
#define re register
#define stt struct
#define nms namespace
#define gc getchar
#define sl(sl_a) strlen(sl_a)
#define gt(gt_a) goto gt_a
#define rt return
#define infa (0x3f3f3f3f)
#define infb (0x7fffffff)
#define infd (0x7f)
#define abss(abss_x) ((abss_x)>(0)?(abss_x):(-1)*(abss_x))
#define maxx(maxx_a,maxx_b) ((maxx_a)>(maxx_b)?(maxx_a):(maxx_b))
#define minn(a,b) ((a)<(b)?(a):(b))
#define in(in_a) freopen("D:/""/in"in_a".in","r",stdin)
#define out(out_a) freopen("D:/""/out"out_a".out","w",stdout)
#define filein(a) freopen(a,"r",stdin)
typedef long long ll;
typedef int itn,nti,tin,tni,nit;
using namespace std;
const nit maxa=14;
const nit maxb=12;
const nit maxc=4;
const tni maxd=10004;
#include<algorithm>

tni n,c[maxa]={0},sum=0;

tin main()
{
	scanf("%d",&n);
	fora(i,1,n)
	{
		scanf("%d",&c[i]);
		sum+=c[i];
	}
	//
	sort(c+1,c+1+n);
	sum-=(c[n]>>1);
	//
	printf("%d\n",sum);
	rt 0;
}

Measured memory_bytes: 128
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
using namespace std;

//
#define int long long
#define pb(x) push_back(x)
#define m0(x) memset((x), 0, sizeof(x))
#define mm(x) memset((x), -1, sizeof(x))

//container
#define ALL(x) (x).begin(), (x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define EACH(i, c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
#define PERM(c) \
  sort(ALL(c)); \
  for (bool c##p = 1; c##p; c##p = next_permutation(ALL(c)))

// debug
#define GET_VAR_NAME(variable) #variable
#define test(x) cout << GET_VAR_NAME(x) << " = " << x << endl;

// bit_macro
#define bit(n) (1LL << (n))
#define bitset(a, b) (a) |= (1 << (b))
#define bitunset(a, b) (a) |= ~(1 << (b))
#define bitcheck(a, b) ((((a) >> (b)) & 1) == 1)
#define bitcount(a) __builtin_popcountll((a))

//typedef
typedef long long lint;
typedef unsigned long long ull;
typedef complex<long double> Complex;
typedef pair<int, int> P;
typedef tuple<int, int, int> TP;
typedef vector<int> vec;
typedef vector<vec> mat;

//constant
const int INF = (int)1e18;
const int MOD = (int)1e9 + 7;
const double EPS = (double)1e-10;
const int dx[] = {-1, 0, 0, 1, 0, -1, -1, 1, 1};
const int dy[] = {0, -1, 1, 0, 0, 1, -1, 1, -1};

//
template <typename T>
void chmax(T &a, T b) { a = max(a, b); }
template <typename T>
void chmin(T &a, T b) { a = min(a, b); }
//
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T>
inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}

//
struct Accelerate_Cin {
  Accelerate_Cin() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(20);
  };
};

signed main() {
  string x;
  cin >> x;

  int cs = 0, ans = x.size();
  for (int i = 0; i < x.size(); i++) {
    if (x[i] == 'S')
      cs++;
    else {
      if (cs > 0) {
        cs--;
        ans -= 2;
      }
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 640
// #define DEBUGGING
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ALL(V) (V).begin(), (V).end()
#define ALLR(V) (V).rbegin(), (V).rend()
template <typename T> using V = std::vector<T>;
template <typename T> using VV = V<V<T>>;
using ll = std::int64_t;
using ull = std::uint64_t;
using PLL = std::pair<ll, ll>;
using TLL = std::tuple<ll, ll, ll>;
template <typename T> const T& var_min(const T &t) { return t; }
template <typename T> const T& var_max(const T &t) { return t; }
template <typename T, typename... Tail> const T& var_min(const T &t, const Tail&... tail) { return std::min(t, var_min(tail...)); }
template <typename T, typename... Tail> const T& var_max(const T &t, const Tail&... tail) { return std::max(t, var_max(tail...)); }
template <typename T, typename... Tail> void chmin(T &t, const Tail&... tail) { t = var_min(t, tail...); }
template <typename T, typename... Tail> void chmax(T &t, const Tail&... tail) { t = var_max(t, tail...); }
template <typename T> const T& clamp(const T &t, const T &low, const T &high) { return std::max(low, std::min(high, t)); }
template <typename T> void chclamp(T &t, const T &low, const T &high) { return t = clamp(t, low, high); }
namespace init__ { struct InitIO { InitIO() { std::cin.tie(nullptr); std::ios_base::sync_with_stdio(false); std::cout << std::fixed << std::setprecision(30); } } init_io; }
#define mv_rec make_v(init, tail...)
template <typename T> T make_v(T init) { return init; }
template <typename T, typename... Tail> auto make_v(T init, size_t s, Tail... tail) { return V<decltype(mv_rec)>(s, mv_rec); }
#undef mv_rec
#ifdef DEBUGGING
#include "../../debug/debug.cpp"
#else
#define DEBUG(...) 0
#define DEBUG_SEPARATOR_LINE 0
#endif

template <ll MOD>
class Combination {
private:
    ll N;
    V<ll> factv, ifactv;

public:
    Combination<MOD>(ll N) : N(N), factv(N + 1, 1), ifactv(N + 1) {
        for(ll i = 1; i <= N; i++) factv[i] = factv[i - 1] * i % MOD;
        ifactv.back() = inv(factv.back());
        for(ll i = N - 1; 0 <= i; i--) ifactv[i] = (i + 1) * ifactv[i + 1] % MOD;
    }

    ll fact(ll n) { return factv[n]; }

    ll ifact(ll n) { return ifactv[n]; }

    ll pow(ll a, ll b) { return b ? (b & 1 ? a : 1) * pow(a * a % MOD, b / 2) % MOD : 1; }

    ll inv(ll a) { return pow(a, MOD - 2); }

    ll comb(ll n, ll k) { return factv[n] * ifactv[n - k] % MOD * ifactv[k] % MOD; }
};

const ll mod = 998244353;
Combination<mod> C(1e6);

int main() {
    ll N, A, B, K;
    cin >> N >> A >> B >> K;
    ll ans = 0;
    for(ll red = 0; red <= N; red++) {
        ll rest = K - red * A;
        if(rest < 0) break;
        if(rest % B) continue;
        ll blue = rest / B;
        if(N < blue) continue;
        (ans += C.comb(N, red) * C.comb(N, blue) % mod) %= mod;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 15872
N = int(input())
a = input()
a=a.split()
a=[int(s) for s in a]
list.sort(a, reverse=True)
alice = 0
bob = 0

for i in range(N):
  if (i%2 == 0):
    alice=alice+a[i]
  else:
    bob=bob+a[i]
print(alice-bob)


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

using namespace std;

int main(void) {
  string s;
  cin >> s;

  int n = s.size();
  int l = 0, r = 0, nl, nr;
  int ans = 0;
  while (l < n) {
    while (l < n && s[l] != 'O') l++, r++;
    while (r + 1 < n && s[r + 1] == 'O') r++;
    if (s[l] != 'O' || s[r] != 'O') break;
    nl = l, nr = r;
    while (nl - 1 >= 0 && s[nl - 1] == 'J') nl--;
    while (nr + 1 <  n && s[nr + 1] == 'I') nr++;
    int t = min(l - nl, nr - r);
    if (t >= r - l + 1) ans = max(ans, r - l + 1);
    l = ++r;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3908
import java.util.Arrays;
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int N = sc.nextInt();
		int[] array = new int[N];
		int[] buff = new int[N];
		for(int i=0;i<N;i++) {
			array[i] = sc.nextInt();
		}
		buff = array.clone();
		Arrays.sort(buff);
		int flg=0;
		for(int i=0;i<N;i++) {
			if(array[i]!=buff[i]) {
				flg++;
			}
		}
		if(flg<=2) {
			System.out.println("YES");
		}else {
			System.out.println("NO");
		}
	}
}


Measured memory_bytes: 21716
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
using namespace std;
int main() {
	vector<int>mind,maxd;
	int t;
	cin >> t;
	for (int i = 0; i < t; i++){
		int n;
		cin >> n;
		int mins = 0, maxs = 0;
		int a, b;
		cin >> a;
		for (int i = 0; i < n - 1; i++){
			cin >> b;
			mins = min(mins, b - a);
			maxs = max(maxs, b - a);
			a = b;
		}
		mind.push_back(mins);
		maxd.push_back(maxs);
	}
	for (int i = 0; i < t; i++){
		cout << maxd[i] << ' ' << mind[i] * -1 << endl;
	}
	char c;
	cin >> c;
	return 0;
}

Measured memory_bytes: 3008
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;
import java.util.function.Consumer;
import java.util.stream.IntStream;

import static java.util.stream.Collectors.toList;

public class Main {
    private static final Scanner scanner = new Scanner(System.in);
    private static final Consumer<List<String>> consumer = solve();

    public static void main(String[] args) {
        consumer.accept(readInput());
    }

    private static List<String> readInput() {
        final List<String> lineList = new ArrayList<>();
        while (scanner.hasNextLine()) {
            lineList.add(scanner.nextLine());
        }
        return lineList;
    }

    private static Consumer<List<String>> solve() {
        return args -> {
            final char[] first = args.get(1).toCharArray();
            final char[] second = args.get(2).toCharArray();

            Long ans = 1L;
            Boolean isPrevVertical = null;
            Integer index = 0;
            while (index < first.length) {
                if (first[index] == second[index]) {
                    if (isPrevVertical == null) {
                        ans = (ans * 3) % 1000000007;
                    } else if (isPrevVertical) {
                        ans = (ans * 2) % 1000000007;
                    }
                    isPrevVertical = true;
                    index++;
                } else {
                    if (isPrevVertical == null) {
                        ans = (ans * 6) % 1000000007;
                    } else if (isPrevVertical) {
                        ans = (ans * 2) % 1000000007;
                    } else {
                        ans = (ans * 3) % 1000000007;
                    }
                    isPrevVertical = false;
                    index += 2;
                }
            }

            System.out.println(ans);
        };
    }

}


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

using namespace std; 
#define REP(i, n) for (int i = 0; i < (n); i++)

typedef long long ll;

int main(int argc, char const *argv[])
{
    int K; cin >> K;
    int even = K/2;
    int odd = K/2 + (K%2);
    cout << even * odd << endl;
    return 0;
}


Measured memory_bytes: 256
n = int(input())
a = 0
b = 0
d1 = 0
d2 = 0
for i in range(n):
  d1,d2 = map(int,input().split())
  if(a==0 and d1 ==d2):
    a+=1
  elif(a==1 and d1 ==d2):
    a+=1
  elif(a==2 and d1 ==d2):
    b +=1
    break
  else:
    a =0
if(b>=1):
  print("Yes")
else:
  print("No")

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

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

using namespace std;

int main(){
    vector<int> vc;
    int n;
    while(cin >> n){
        if(n == 0) break;
        int tmp;
        vc.clear();
        REP(i,n){
            cin >> tmp;
            vc.push_back(tmp);
        }
        sort(vc.begin(), vc.end());
        vc.erase(vc.begin());
        vc.erase(--vc.end());
        int sum = 0;
        vector<int>::iterator it = vc.begin();
        while(it != vc.end()){
            sum += (*it);
            it++;
        }
        cout << sum/(n-2) << endl;
    }
    return 0;
}

Measured memory_bytes: 1224
#include <iostream>
using namespace std;
int main(void)
{
    string a,b;
    cin >> a >> b;
    if(a[0]==b[2]&&a[1]==b[1]&&a[2]==b[0]){
        cout << "YES" << endl;
    }
    else{
        cout << "NO" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
	int i, k;
	int h[10], l[3]={0, 0, 0};
	for(i=0; i<10; i++)
		scanf("%d",&h[i]);
	for(i=0; i<10; i++){
		if(h[i] > l[0]){
			l[2] = l[1];
			l[1] = l[0];
			l[0] = h[i];
		}
		else if(h[i] > l[1]){
			l[2] = l[1];
			l[1] = h[i];
		}
		else if(h[i] > l[2])
			l[2] = h[i];
	}
	for(i=0; i<3; i++)
		printf("%d\n",l[i]);
	return 0;
}

Measured memory_bytes: 600
#include <iostream>
#include <stdio.h>

using namespace std;

int main() {
	double L;
	
	cin >> L;
	//正方形が最も体積が大きい

	double ans = (L / 3) * (L / 3) * (L / 3);
	
	printf("%16lf\n",ans);

	return 0;
}

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

int main()
{
  	int pos=0;
	string s;
  	char t[100];
  	cin>>s;
  	for(int i=0;i<s.length();i++)
    {
      	if(pos>0)
        {
          	if(s[i]=='B')
          		pos--;
          	else
            {
              	t[pos]=s[i];
             	pos++;
            }
        }
      	else
        {
           	if(s[i]!='B')
            {
          		t[pos]=s[i];
              	pos++;
            }
        }
    }
  	for(int i=0;i<pos;i++)
  		cout<<t[i];
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        if (12 < A) {
            System.out.println(B);
        } else if (A < 6) {
            System.out.println(0);
        } else {
            System.out.println(B/2);
        }
    }

}

Measured memory_bytes: 35804
n = int(input())
a, b = map(int, input().split())
p = list(map(int, input().split()))
cnt1 = 0
cnt2 = 0
cnt3 = 0
for i in p:
    if i <= a:
        cnt1 += 1
    elif i <= b:
        cnt2 += 1
    else:
        cnt3 += 1
ans = min(cnt1, cnt2, cnt3)
print(ans)

Measured memory_bytes: 61736
#include <iostream>
#include <vector>
#include <map>
#include <queue>
#include <utility>
#include <set>
using namespace std;

#define MP make_pair

bool flag[53][53][4];

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

int main(){
	int n,x0,y0,t;
	cin >> n >> x0 >> y0 >> t;
	x0++;
	y0++;
	for(int k=0;k<n;k++){
		int a,b,c,d;
		cin >> a >> b >> c >> d;
		a++;b++;c++;d++;
		if(a==c){
			if(b>d)swap(b,d);
			for(int i=b;i<d;i++){
				flag[a][i][0] = 1;
			}
			for(int i=d;i>b;i--){
				flag[a][i][2] = 1;
			}
		}
		if(b==d){
			if(a>c)swap(a,c);
			for(int i=a;i<c;i++){
				flag[i][b][1] = 1;
			}
			for(int i=c;i>a;i--){
				flag[i][b][3] = 1;
			}
		}
	}
	map<int,int> mp;
	int s = 0;
	for(int i=0;i<t;i++){
		int a;
		cin >> a;
		char b;
		cin >> b;
		s += a;
		if(b=='N'){
			mp[s] = 0;
		}else if(b=='E'){
			mp[s] = 1;
		}else if(b=='S'){
			mp[s] = 2;
		}else{
			mp[s] = 3;
		}
	}
	queue<pair<pair<int,int>,pair<int,int> > >q;
	map<pair<pair<int,int>,pair<int,int> >,bool> m;
	if(flag[x0][y0][0]==1){
		q.push(MP(MP(x0,y0),MP(0,0)));
	}
	if(flag[x0][y0][1]==1){
		q.push(MP(MP(x0,y0),MP(0,1)));
	}
	if(flag[x0][y0][2]==1){
		q.push(MP(MP(x0,y0),MP(0,2)));
	}
	if(flag[x0][y0][3]==1){
		q.push(MP(MP(x0,y0),MP(0,3)));
	}
	set<pair<int,int> > ans;
	while(1){
		auto x = q.front();
		q.pop();
		int a,b,c,d;
		a = x.first.first;
		b = x.first.second;
		c = x.second.first;
		d = x.second.second;
		//cout << a <<" " << b << " " <<c << " " << d << endl;
		if(c>s)break;
		if(c==s){
			ans.insert(MP(a-1,b-1));
		}
		if(mp.find(c+1)!=mp.end()){
			if(d==mp[c+1]){
				for(int i=0;i<4;i++){
					if(i!=d&&(i+4-d)%2==0)continue;
					if(flag[a+dx[d]][b+dy[d]][i]==1&&m[MP(MP(a+dx[d],b+dy[d]),MP(c+1,i))]==0){
						m[MP(MP(a+dx[d],b+dy[d]),MP(c+1,i))]=1;
						q.push(MP(MP(a+dx[d],b+dy[d]),MP(c+1,i)));
					}
				}
			}else{
				if((d+4-mp[c+1])%2!=0&&flag[a+dx[d]][b+dy[d]][mp[c+1]]==1&&m[MP(MP(a+dx[d],b+dy[d]),MP(c+1,mp[c+1]))]==0){
					m[MP(MP(a+dx[d],b+dy[d]),MP(c+1,mp[c+1]))]=1;
					q.push(MP(MP(a+dx[d],b+dy[d]),MP(c+1,mp[c+1])));
				}
			}
		}else{
			for(int i=0;i<4;i++){
				if(i!=d&&(i+4-d)%2==0)continue;
				if(flag[a+dx[d]][b+dy[d]][i]==1&&m[MP(MP(a+dx[d],b+dy[d]),MP(c+1,i))]==0){
					m[MP(MP(a+dx[d],b+dy[d]),MP(c+1,i))]=1;
					q.push(MP(MP(a+dx[d],b+dy[d]),MP(c+1,i)));
				}
			}
		}
	}
	for(auto x:ans){
		cout << x.first << " " << x.second << endl;
	}
	return 0;
}


Measured memory_bytes: 52976
#include <bits/stdc++.h>
  using namespace std;
#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) int ab;cin>>ab;(p).push_back(ab);
#define vecpl2(p) long long ab;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define set0(k,n) for(int nn=0;nn<(n);nn++){ (k).push_back(0); }
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define vecsize(b,size) vector<int> (b)((size));
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsl(s) vector<pair<ll,ll>> (s);
#define pairss(s) vector<pair<string,string>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairspl(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsps(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsREV(s) (s).push_back(make_pair(bb,aa));
#define pairslREV(s) (s).push_back(make_pair(bb,aa));
#define pairssREV(s) (s).push_back(make_pair(bb,aa));
#define MOD 1000000007

int main() {
	
	int N,A,B;
	cin>>N>>A>>B;
	ce(min(N*A,B))
}

Measured memory_bytes: 256