akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <tuple>
#define mkp make_pair
#define mkt make_tuple
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;
template<class T> void chmin(T &a,const T &b){if(a>b) a=b;}
template<class T> void chmax(T &a,const T &b){if(a<b) a=b;}

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

  vector<int> H(2),M(2);
  cin>>H[0]>>M[0]>>H[1]>>M[1];
  int K;
  cin>>K;

  int times=(H[1]-H[0])*60;
  if(M[0]<=M[1]) times+=M[1]-M[0];
  else times-=M[0]-M[1];

  cout<<times-K<<endl;

  return 0;
}


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

int r,c,d[10][10000];

int check(int a,int data[10][10000]){
	if(a==r){
		int res=0;
		for(int i=0;i<c;i++){
			int x=0;
			for(int j=0;j<r;j++) x+=data[j][i];
			res+=min(x,r-x);
		}
		return res;
	}
	int d1[10][10000],d2[10][10000];
	for(int i=0;i<r;i++) for(int j=0;j<c;j++) d1[i][j]=d2[i][j]=data[i][j];
	for(int i=0;i<c;i++) d2[a][i]=(d2[a][i]+1)&1;
	return min(check(a+1,d1),check(a+1,d2));
}

int main(){
	while(scanf("%d%d",&r,&c),r){
		for(int i=0;i<r;i++) for(int j=0;j<c;j++) scanf("%d",&d[i][j]);
		printf("%d\n",r*c-check(0,d));
	}
}

Measured memory_bytes: 9384
package main

import (
	"bufio"
	"bytes"
	"fmt"
	"math"
	"os"
	"strconv"
	"strings"
)

type bufReader struct {
	r   *bufio.Reader
	buf []byte
	i   int
}

var reader = &bufReader{
	bufio.NewReader(os.Stdin),
	make([]byte, 0),
	0,
}

func (r *bufReader) readLine() {
	if r.i < len(r.buf) {
		return
	}
	r.buf = make([]byte, 0)
	r.i = 0
	for {
		line, isPrefix, err := r.r.ReadLine()
		if err != nil {
			panic(err)
		}
		r.buf = append(r.buf, line...)
		if !isPrefix {
			break
		}
	}
}

func (r *bufReader) next() string {
	r.readLine()
	from := r.i
	for ; r.i < len(r.buf); r.i++ {
		if r.buf[r.i] == ' ' {
			break
		}
	}
	s := string(r.buf[from:r.i])
	r.i++
	return s
}

func (r *bufReader) nextLine() string {
	r.readLine()
	s := string(r.buf[r.i:])
	r.i = len(r.buf)
	return s
}

var writer = bufio.NewWriter(os.Stdout)

func next() string {
	return reader.next()
}

func nextInt64() int64 {
	i, err := strconv.ParseInt(reader.next(), 10, 64)
	if err != nil {
		panic(err)
	}
	return i
}

func nextInt() int {
	return int(nextInt64())
}

func nextLine() string {
	return reader.nextLine()
}

func out(a ...interface{}) {
	fmt.Fprintln(writer, a...)
}

func max64(x, y int64) int64 {
	if x > y {
		return x
	}
	return y
}

func max(x, y int) int {
	return int(max64(int64(x), int64(y)))
}

func min64(x, y int64) int64 {
	if x < y {
		return x
	}
	return y
}

func min(x, y int) int {
	return int(min64(int64(x), int64(y)))
}

func abs64(x int64) int64 {
	if x < 0 {
		return -x
	}
	return x
}

func abs(x int) int {
	return int(abs64(int64(x)))
}

func joinInt64s(a []int64, sep string) string {
	b := make([]string, len(a))
	for i, v := range a {
		b[i] = strconv.FormatInt(v, 10)
	}
	return strings.Join(b, sep)
}

func joinInts(a []int, sep string) string {
	b := make([]string, len(a))
	for i, v := range a {
		b[i] = strconv.Itoa(v)
	}
	return strings.Join(b, sep)
}

func divUp64(x, y int64) int64 {
	return (x + y - 1) / y
}

func divUp(x, y int) int {
	return int(divUp64(int64(x), int64(y)))
}

func gcd64(x, y int64) int64 {
	if x < y {
		x, y = y, x
	}
	for y != 0 {
		x, y = y, x%y
	}
	return x
}

func gcd(x, y int) int {
	return int(gcd64(int64(x), int64(y)))
}

func lcm64(x, y int64) int64 {
	return x * y / gcd64(x, y)
}

func lcm(x, y int) int {
	return int(lcm64(int64(x), int64(y)))
}

func pow64(x, y int64) int64 {
	return int64(math.Pow(float64(x), float64(y)))
}

func pow(x, y int) int {
	return int(pow64(int64(x), int64(y)))
}

func main() {
	solve()
	writer.Flush()
}

func solve() {
	sx, sy, tx, ty := nextInt(), nextInt(), nextInt(), nextInt()
	sb := bytes.NewBufferString("")
	sb.WriteString(strings.Repeat("U", ty-sy))
	sb.WriteString(strings.Repeat("R", tx-sx))
	sb.WriteString(strings.Repeat("D", ty-sy))
	sb.WriteString(strings.Repeat("L", tx-sx+1))
	sb.WriteString(strings.Repeat("U", ty-sy+1))
	sb.WriteString(strings.Repeat("R", tx-sx+1))
	sb.WriteString("D")
	sb.WriteString("R")
	sb.WriteString(strings.Repeat("D", ty-sy+1))
	sb.WriteString(strings.Repeat("L", tx-sx+1))
	sb.WriteString("U")
	out(sb.String())
}


Measured memory_bytes: 768
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[])
{
  int r, c;
  int i, j;
  int **mat;

  scanf("%d %d", &r, &c);

  mat = (int **)malloc(sizeof(int *) * (r + 1));
  for (i = 0; i < r + 1; i++) mat[i] = (int *)malloc(sizeof(int) * (c + 1));

  for (i = 0; i < r + 1; i++) {
    for (j = 0; j < c + 1; j++) {
      mat[i][j] = 0;
    }
  }

  for (i = 0; i < r; i++) {
    for (j = 0; j < c; j++) {
      scanf("%d", &mat[i][j]);
      mat[i][c] += mat[i][j];
      mat[r][j] += mat[i][j];
      mat[r][c] += mat[i][j];
    }
  }

  for (i = 0; i < r + 1; i++) {
    for (j = 0; j < c + 1; j++) {
      if (j != c) printf("%d ", mat[i][j]);
      else printf("%d\n", mat[i][j]);
    }
  }

  return 0;
}

Measured memory_bytes: 640
#include<stdio.h>
int main(){
	int w,a,b;
	scanf("%d %d %d",&w,&a,&b);

	if(a+w < b) printf("%d\n",b-(a+w));
	else if(b+w < a) printf("%d\n",a-(b+w));
	else printf("0\n");
}

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

int main() {
  int s1,flag;
  cin >> s1;
  flag = s1 % 3;
  
  if(flag == 0 && s1 != 000){
    cout << 3;
  }else if(flag == 1){
    cout << 1;
  }else if(flag == 2 ){
    cout << 2;
  }else if(s1 == 000){
    cout << 0;
  }
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main
{
    public static void main(String args[])
    {
        Scanner scan = new Scanner(System.in);
        
        int a = scan.nextInt();
        int b = scan.nextInt();
        
        if(a<b){
        System.out.println("a < b");
        }
        if(a>b){
        System.out.println("a > b");
        }
        if(a==b){
        System.out.println("a == b");
        }
    }
}


Measured memory_bytes: 26128
#include <iostream>
#include <algorithm>
#include <climits>
#include <numeric>
#include <iomanip>
#include <cmath>
#include <vector>
#include <set>
#include <unordered_set>
#include <string>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <unordered_map>
#include <tuple>
 
using namespace std;
 
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define cina(s, n, a) for(int i = s; i < n; i++) cin >> a[i]
#define couta(n, a) for(int i = 0; i < n; i++) cout << a[i] << ' '
#define copy(s, n, a, b) for(int i = s; i < n; i++) b[i] = a[i]
#define yesno(ok) cout << (ok ? "YES" : "NO")
#define mod(a, b) (b + (a % b)) % b
#define MOD (int)1e9 + 7
 
typedef long long ll;
typedef unsigned long long ull;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;

void add_self (int& a, int b){ a += b; if(a >= MOD) a -= MOD; }
//-------------------------------------------------------------------------------------------------------//

void solve(){
    int a[3];
    cin >> a[0] >> a[1] >> a[2];
    sort(a, a + 3);
    if(a[0] != a[2] && (a[1] == a[0] || a[1] == a[2])) cout << "Yes";
    else cout << "No";
}
 
int main(){
    ios::sync_with_stdio(false);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int q = 1;
    //cin >> q;
    for(int i = 1; i <= q; i++){
        solve();
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <functional>
#include <numeric>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>
#include <limits>
#include <iomanip>
#include <bitset>
#include <queue>

using namespace std;
typedef long long ll;

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
#define rep(i, n) for(int i = 0;i < n;i++)
const long long INF = 1LL << 60;

int MOD = 1000000007;


int main(){
    std::ios_base::sync_with_stdio(false);
    
    int n; cin >> n;
    int cnt=0;

    string s; cin >> s;

    rep(i,s.size()){
        if(s[i]=='R') cnt++;
    }

    if(cnt > n-cnt){
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    
    return 0;
}


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

using namespace std;

#define fread freopen("in.txt", "r", stdin)
#define fwrite freopen("out.txt", "w", stdout)
#define MOD 1000000007
#define MAX 1e+9
#define PI acos(-1)

typedef long long ll;

int main ()
{
    int a, b, c;

    scanf("%d %d %d", &a, &b, &c);
    double val = (double) a / c;
    if (b >= val) puts("Yes");
    else puts("No");

    return 0;
}

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

using namespace std;
typedef long long ll;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()

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

	int ans = k;
	rep(i, n - 1) ans *= (k - 1);
	cout << ans << '\n';
	return 0;
}


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

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split(' ');
            int s1, s2;
            s1 = int.Parse(s[0]) * int.Parse(s[1]);
            s2 = int.Parse(s[2]) * int.Parse(s[3]);

            if (s1 >= s2)
            {
                Console.WriteLine(s1);
            }
            else
            {
                Console.WriteLine(s2);
            }
            Console.ReadLine();
        }
    }
}


Measured memory_bytes: 2648
#include <iostream>
#include <queue>
#include <stack>
#include <map>
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <string.h>
#include <vector>
#include <set>
#define sf(n) scanf("%d",&n)
#define sff(n,m) scanf("%d%d",&n,&m)
#define ll long long
#define MAXL 1000000
#define eps 1e-6
#define MAXV 10005
#define INF 1000000005
#define mod 1000000007
using namespace std;
/*
int a[500005];
int k[6]={4,8,15,16,23,42};
*/
int main()
{
    ll k,a,b;scanf("%lld%lld%lld",&k,&a,&b);
    if(b==1){
        printf("%lld\n",1+k);
        return 0;
    }
    if(b-a<=2){
        printf("%lld\n",1+k);
        return 0;
    }
    if(k<=a-1){
        printf("%lld\n",1+k);
        return 0;
    }
    k-=(a-1);
    if(k%2==0){
        printf("%lld\n",a+(k/2)*(b-a));
    }
    else{
        printf("%lld\n",a+(k/2)*(b-a)+1);
    }


}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    int n;
    cin >> n;
    int a[n];
    for(int i=0;i<n;i++){
        cin >> a[i];
    }
    int cnt=0;
    for(int i=1;i<n-1;i++){
        if(a[i-1]< a[i] && a[i]<a[i+1])cnt++;
        if(a[i-1]>a[i] && a[i]>a[i+1])cnt++;
    }
    cout << cnt << endl;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    N=I()
    P=[-1]*N#親から来た辺の色だけ持っておく
    C=[0]*(N-1)
    adj=[[]for _ in range(N)]
    
    from collections import defaultdict
    dd = defaultdict(lambda : -1)
    dd2 = defaultdict(lambda : -1)
    
    for i in range(N-1):
        a,b=MI()
        a-=1
        b-=1
        adj[a].append(b)
        adj[b].append(a)
        
        dd[(a,b)] = i
        dd2[i]=(a,b)
        
    
    import queue
    q=queue.Queue()
    q.put((0,-1))
    
    while not q.empty():
        v,p=q.get()
        
        col=0
        for i in range(len(adj[v])):
            nv=adj[v][i]
            
            if nv==p:
                continue
            
            if col==P[v]:
                col+=1
            
            a=min(v,nv)
            b=max(v,nv)
            ii=dd[(a,b)]
            C[ii]=col
            P[nv]=col
            col+=1
            
            q.put((nv,v))
            
    K=0
    for i in range(N):
        K=max(K,len(adj[i]))
    
    print(K)
    for i in range(N-1):
        print(C[i]+1)

            
    
    
    

main()


Measured memory_bytes: 116296
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int M, D;
    cin >> M >> D;
    int t, o;
    t = D / 10;
    o = D % 10;
    int count = 0;

    for (int i = 2; i <= t; i++)
    {
        if (i > t)
        {
            break;
        }
        else
        {
            for (int j = 2; j < 10; j++)
            {
                if (i == t && j > o)
                {
                    break;
                }
                else if (i * j <= M && i * j > 0)
                {

                    count++;
                }

                else
                {
                    continue;
                }
            }
        }
    }
    cout << count << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const long long INF = 1LL<<60;
//ll GCD(ll x,ll y){
//    if(y == 0) return x;
//    else return GCD(y,x%y);
//}

ll GCD(ll x,ll y){
    if(y == 0) return x;
    else return GCD(y,x%y);
}

ll LCM(ll a,ll b){
    return a / GCD(a,b) * b;
}

const int MOD = 1000000007;



int main() {
    int n; cin >> n;
    vector<int> v;
    ll a=0,b,total = LLONG_MAX;
    for(int i = 0;i < n;i++){
        int x; cin >> x;
        a += x;
        v.push_back(x);
    }
    
    a -= v[0];
    b = v[0];
    for(int i = 1;i < n-1;i++){
        total = min(total,abs(a-b));
        a -= v[i];
        b += v[i];
    }
    
    total = min(total,abs(a-b));
    cout << total;
   
}



Measured memory_bytes: 1400
#include <bits/stdc++.h>
#define ss second
#define ff first
#define all(x) x.begin(), x.end()

using namespace std;
using ll = unsigned long long;
using pii = pair<int, int>;

const int oo = 1e9 + 7;
const ll mod = 1e9 + 7,maxn = 100000000;
const double PI = acos(-1);


int main (){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    char a;
    cin >> a ;
    cout << char(a+1) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define IOS ios_base::sync_with_stdio(false); cin.tie(0);
#define pb push_back
#define PI acos(-1)
#define EPS 1e-5
#define sz(v) ((int)(v).size())
#define all(v) v.begin(),v.end()
#define forn(i, n) for(ll i=0;i<(ll)n;i++)
#define fi first
#define se second
 

int main() {
	int n;
	cin >> n;
	string s;
	cin >> s;
	int r=0, g=0, b=0;
	for(int i = 0; i < n; i++){
		if(s[i] == 'R') r++;
		else if(s[i] == 'G') g++;
		else b++;
	}
	ll tot = 1ll*r*g*b;
	for(int i = 0; i < n; i++) {
		for(int j = i+1; j < n; j++) {
			int k = 2*j-i;
			if(k < n && s[i]!=s[j]&&s[j]!=s[k]&&s[i]!=s[k]) tot--;
		}
	}
	cout << tot << endl;

	return 0;
}



Measured memory_bytes: 3632
/* 
	Author: ankrypt
*/


#include <bits/stdc++.h>

using namespace std;

#define MOD 1000000007
#define ll long long int
#define u64 unsigned long long int

ll N, K;
ll dp[100005];
ll arr[100005];

ll rec(int ind) {
	if(ind > N - 1) {
		return 1e9;
	}
	if(ind == N - 1) {
		return 0;
	}
	ll &ans = dp[ind];
	if(ans != -1) {
		return ans;
	}
	ans = 1e9;
	for(int i = 1; i <= K; i++) {
		ans = min(abs(arr[ind] - arr[ind + i]) + rec(ind + i), ans);
	}
	return ans;
}

int main() {
	scanf("%lld %lld", &N, &K);
	for(int i = 0; i < N; i++) {
		scanf("%lld", &arr[i]);
	}
	memset(dp, -1, sizeof(dp));
	cout << rec(0);
	return 0;
}
/*
	Powered by Buggy Plugin
*/


Measured memory_bytes: 6528
a,b,c = gets.chomp.split.map(&:to_f)
s = a * b * Math.sin(c * Math::PI / 180) / 2
l = a + b + Math.sqrt(a**2 + b**2 - 2 * a * b * Math.cos(c * Math::PI / 180))
h = b * Math.sin(c * Math::PI / 180)
puts s,l,h

Measured memory_bytes: 6192
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<set>
#include<bitset>
#include<map>

#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,a,b) for(int i=a;i>=b;i--)

using namespace std;

typedef long long LL;
typedef double db;

int get(){
	char ch;
	while(ch=getchar(),(ch<'0'||ch>'9')&&ch!='-');
	if (ch=='-'){
		int s=0;
		while(ch=getchar(),ch>='0'&&ch<='9')s=s*10+ch-'0';
		return -s;
	}
	int s=ch-'0';
	while(ch=getchar(),ch>='0'&&ch<='9')s=s*10+ch-'0';
	return s;
}

const int N = 5005;
const int mo = 1e9+7;

int n;
LL f[N][N];
int siz[N];
struct edge{
	int x,nxt;
}e[N*2];
int h[N],tot;

void inse(int x,int y){e[++tot].x=y;e[tot].nxt=h[x];h[x]=tot;}

LL add(LL x,LL y){return x+y>=mo?x+y-mo:x+y;}
LL dec(LL x,LL y){return x<y?x-y+mo:x-y;}

int fa[N];

void dfs1(int x){
	siz[x]=1;
	for(int p=h[x];p;p=e[p].nxt)
	if (!siz[e[p].x]){
		fa[e[p].x]=x;
		dfs1(e[p].x);
		siz[x]+=siz[e[p].x];
	}
}

LL g[N];
LL val[N];

void dfs2(int x){
	for(int p=h[x];p;p=e[p].nxt)
	if (fa[e[p].x]==x){
		int y=e[p].x;
		dfs2(y);
	}
	f[x][1]=1;
	int pre=1;
	for(int p=h[x];p;p=e[p].nxt)
	if (fa[e[p].x]==x){
		int y=e[p].x;
		fo(i,1,pre){
			g[i]=f[x][i];
			f[x][i]=0;
		}
		fo(i,1,pre)
			fo(j,1,siz[y]){
				f[x][i+j]=(f[x][i+j]+g[i]*f[y][j])%mo;
				if (j%2==0)f[x][i]=(f[x][i]+mo-g[i]*f[y][j]%mo*val[j/2]%mo)%mo;
			}
		pre+=siz[y];
	}
}

int main(){
	n=get();
	fo(i,2,n){
		int x=get(),y=get();
		inse(x,y);
		inse(y,x);
	}
	val[0]=1;
	fo(i,1,n)val[i]=val[i-1]*(2*i-1)%mo;
	dfs1(1);
	dfs2(1);
	LL ans=0;
	fo(i,1,n)
	if (i%2==0)ans=(ans+f[1][i]*val[i/2]%mo)%mo;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 194944
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include<set>
#include<map>
using namespace std;


int main() {
    vector<int> v {1, 3, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1};
    int a, b;
    cin >> a >> b;
    if(v[a-1] == v[b-1]){
        cout << "Yes";
    }
    else
    {
        cout << "No";
    }
    cout << endl;
}


Measured memory_bytes: 256
//#include "pch.h"
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>

#include <vector>
#include <set>
#include <map>
#include <iostream>
#include <utility>
#include <queue>
#include <algorithm>
#include <functional>
#include <string>
#include <bitset>

#define ll long long
#define fri(n) for(i=0;i<(n);i++)
#define frj(n) for(j=0;j<(n);i++)
#define min(p,q) ((p)<(q)?(p):(q))
#define max(p,q) ((p)>(q)?(p):(q))
#define INF 1000000000000000000//10^18
#define INFINT 2000000001//2*10^9+1
#define MOD 1000000007
#define MODANOTHER 998244353
#define PI acos(-1)

using namespace std;



int main(void)
{
	//変数の宣言
	int n,m;
	int a,b;
	char s[20];

	//よく使う変数
	int i,j,k,l;
	int flag=0;
	int ans=0;
	int count=0;
	int temp=0;
	int temp1=0;
	int temp2=0;
	int temp3=0;
	int max=0;
	int min=INFINT;
	int len=0;
	int sum=0;
	int ok=0;
	int ng=0;
	char dummy;
	char stemp[11];
	
	//データの読み込み


	scanf("%d %d %d",&n,&a,&b);
//	scanf_s("%d %d %d",&n,&a,&b);

//	scanf("%s",&s);
//	scanf_s("%s",&s,20);


/*	for(i=0;i<n;i++){
//		scanf("%d",&b[i]);
		scanf_s("%d",&b[i]);
	}*/


/*	for(i=0;i<3;i++){
//		scanf("%s",&s);
		scanf_s("%s",&s[i],10);
	}*/


	//	printf("nは%dです\n", n);
	//	printf("データの読み込み終了\n");
	//実際の処理

//	clock_t start=clock();


	printf("%d",min(n*a,b));

//	clock_t end=clock();

	//	printf("計算部分終了\n");

	//出力
	//printf("%d",min(sum+2*m,n-1));

//	printf("time=%lf",(double)(end-start)/CLOCKS_PER_SEC);
	//	printf("結果の出力終了\n");

	return 0;
}



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

vector<int> pos[26], pos_cnt[26]={};
int main(){
    string A;
    cin >> A;
    unordered_set<char> st;
    int ks[200000];
    int k = 0;

    for(int i = A.length() - 1; i >= 0; i--){
        st.insert(A[i]);
        ks[i] = k;
        if(st.size() == 26){
            k++;
            st.clear();
        }
     }
    for(int i = 0; i < A.length(); i++){
        pos[A[i]-'a'].push_back(i);
    }

    /*
    cout << k << endl;
    for(int i = 0; i < A.length(); i++){
        cout << ks[i] << " ";
    }
    cout << endl;
    */
    /*
    for(int i = 0; i < 26; i++){
        for(int j = 0; j < pos[i].size(); j++){
            cout << pos[i][j] << " ";
        }
        cout << endl;
    }
    */


    string ans;
    int start = 0;
    for(int i = 0; i < k + 1; i++){
        for(char c = 'a'; c <= 'z'; c++){
            auto itr = lower_bound(pos[c-'a'].begin(), pos[c-'a'].end(), start);
            //cout << *itr  << ", " << ks[*itr] << endl;
            //cout << (itr == pos[c-'a'].end())  << endl;
            //cout << itr - pos[c-'a'].begin() << endl;
            if((itr == pos[c-'a'].end()) || (ks[*itr] == k - i - 1)){
                //cout << "in" << endl;
                ans.push_back(c);
                //cout << "pushed" << endl;
                if(itr != pos[c-'a'].end()){
                    start = *itr + 1;
                }
                break;
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 2180
package main

import (
	"bufio"
	"fmt"
	"os"
	"reflect"
	"strconv"
)

const (
	maxBufSize = 1024 * 1024
)

var (
	sc = func() *bufio.Scanner {
		sc := bufio.NewScanner(os.Stdin)
		buf := make([]byte, 1)
		sc.Buffer(buf, maxBufSize)
		sc.Split(bufio.ScanWords)
		return sc
	}()
	out = bufio.NewWriter(os.Stdout)
)

func subSolve(n int64, l int) []byte {
	ret := make([]byte, l)
	l --
	for ;l >= 0; l -- {
		ret[l] = byte(n % 26 + 97)
		n /= 26
	}
	return ret
}

func solve(n int64) string {
	n --;
	t := int64(26)
	l := 1
	for ;; {
		if n < t {
			return string(subSolve(n, l))
		}
		n -= t
		l += 1
		t *= int64(26)
	}
	return ""
}

func main() {
	defer out.Flush()

	n := nextInt()
	res := solve(n)
	fmt.Fprintln(out, res)
}

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextStringAsBytes() []byte {
	sc.Scan()
	return []byte(sc.Text())
}

func nextInt() int64 {
	a, _ := strconv.ParseInt(next(), 10, 64)
	return a
}

func nextFloat() float64 {
	a, _ := strconv.ParseFloat(next(), 64)
	return a
}

func nextInts(n int64) []int64 {
	ret := make([]int64, n)
	for i := int64(0); i < n; i++ {
		ret[i] = nextInt()
	}
	return ret
}

func nextFloats(n int64) []float64 {
	ret := make([]float64, n)
	for i := int64(0); i < n; i++ {
		ret[i] = nextFloat()
	}
	return ret
}
func nextStrings(n int64) []string {
	ret := make([]string, n)
	for i := int64(0); i < n; i++ {
		ret[i] = next()
	}
	return ret
}

func containStr(arr []string, target string) bool {
	for _, v := range arr {
		if v == target {
			return true
		}
	}
	return false
}

func PrintOut(src interface{}, joinner string) {
	switch reflect.TypeOf(src).Kind() {
	case reflect.Slice:
		s := reflect.ValueOf(src)
		for idx := 0; idx < s.Len(); idx++ {
			fmt.Fprintf(out, "%v", s.Index(idx))
			if idx < s.Len()-1 {
				fmt.Fprintf(out, "%s", joinner)
			} else {
				fmt.Fprintln(out)
			}
		}
	default:
		fmt.Fprintln(out, "orz")
	}
}

// mapからkeysとvaluesを返す
func splitKeyValue(m map[interface{}]interface{}) (keys, values []interface{}) {
	switch reflect.TypeOf(m).Kind() {
	case reflect.Map:
		s := reflect.ValueOf(m)
		for _, v := range s.MapKeys() {
			keys = append(keys, v)
			values = append(values, s.MapIndex(v))
		}
	default:
		fmt.Fprintln(out, "orz")
	}
	return
}


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

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

const int N = 200 * 1000 + 10;

ll a[N], n, b[N];

bool ok(int k)	{
	for (int i = 1; i < n + n; i++)
	{
		b[i] = (a[i] >= k);
	}
	for (int i = 0; i < n; i++)
	{
		if(b[n + i] == b[n + i + 1])
			return b[n + i];
		if(b[n - i] == b[n - i - 1])
			return b[n - i];
	}
	return b[1];
}

int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	cin >> n;
	for (int i = 1; i <= 2 * n - 1; i++)
		cin >> a[i];
	ll low = 0, high = 2 * n - 1;
	while(high - low > 1)
	{
		ll mid = (low + high) >> 1;
		if(ok(mid))
			low = mid;
		else
			high = mid;
	}
	cout << low << "\n";
}

Measured memory_bytes: 3328
use proconio::input;

// nCk の組み合わせを列挙する
pub fn combination(n: usize, k: usize) -> Vec<Vec<usize>> {
    let mut ans = Vec::new();
    if k == 1 {
        for i in 1..n+1 {
            let mut tmp = Vec::new();
            tmp.push(i);
            ans.push(tmp);
        }
    }
    else {
        for iter in combination(n-1, k-1) {
            let max = iter.iter().max().unwrap();
            for j in *max+1..n+1 {
                let mut tmp = iter.clone();
                tmp.push(j);
                ans.push(tmp);
            }
        }
    }
    ans
}

fn main() {
    input!{
        n: usize,
        l: [usize; n],
    }
    let mut ans = 0;
    for iter in combination(n, 3) {
        if l[iter[0]-1] + l[iter[1]-1] > l[iter[2]-1] &&
            l[iter[0]-1] + l[iter[2]-1] > l[iter[1]-1] &&
            l[iter[1]-1] + l[iter[2]-1] > l[iter[0]-1] &&
            l[iter[0]-1] != l[iter[1]-1] &&
            l[iter[1]-1] != l[iter[2]-1] &&
            l[iter[2]-1] != l[iter[0]-1] {
                ans += 1;
            }
    }
    println!("{}", ans);
}


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

int main()
{
	char str[21] = { 0 };
	char sc[21] = { 0 };
	int i, j, k, h;
	cin >> str;
	h=k=strlen(str);
	for(i=0; i < k; i++)
	{
		sc[k-i-1] = str[i];
	}
	cout << sc << endl;
}

Measured memory_bytes: 1136
N = int(input())
X = list(map(int, input().split()))
A = []
for P in range(1,max(X)+1):
    for i in range(N):
        A.append((X[i]-P)**2)
    if sum(A[0:N]) <= sum(A[N:2*N]) or len(A) == N:
        A = A[0:N]
    else:
        A = A[N:2*N]
print(sum(A))

Measured memory_bytes: 3064
s = input()
s1, s2 = int(s[:2]), int(s[2:])
s1_bool = 1 <= s1 <= 12
s2_bool = 1 <= s2 <= 12

if s1_bool and s2_bool:
  print("AMBIGUOUS")
elif s1_bool and not s2_bool:
  print("MMYY")
elif not s1_bool and s2_bool:
  print("YYMM")
else:
  print("NA")

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

typedef long long LL;

int n,m,sk;

void into(){
  scanf("%d%d%d",&n,&m,&sk);
}

int ans;

void Get_ans(){
  if (n>m) swap(n,m);
  for (int i=0;i<=n;++i)
	if (i*m>=sk) {ans=i;return;}
}

void work(){
  Get_ans();
}

void outo(){
  printf("%d\n",ans);
}

int main(){
  into();
  work();
  outo();
  return 0;
}

Measured memory_bytes: 3824
n = int(input())
p = list(map(int, input().split()))

a = [1+i*n for i in range(n)]
b = [0]*n
for i, pi in enumerate(p):
    b[pi-1] = i - a[pi-1]
min_b = abs(min(b))+1
for i in range(n):
    b[i] += min_b
print(*a)
print(*b)

Measured memory_bytes: 6296
import java.util.Scanner;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int[] arg = new int[n];
        for(int i=0;i<n;i++){
            arg[i] = Integer.parseInt(sc.next());
        }
        _sortInt(arg, 0, n-1);
        int asum=0, bsum=0;
        for(int i=0;i<n;i++){
            if(i%2==0){
                asum += arg[i];
            }else{
                bsum += arg[i];
            }
        }
        System.out.println(asum - bsum);
    }

    // 降順クイックソート
    private static void _sortInt(int[] d, int left, int right){
        if(left>=right){return;}
        int p = d[(left+right)/2];
        int l=left, r=right, tmp;
        while(l<r){
            while(d[l]>p){l++;}
            while(d[r]<p){r--;}
            if(l<=r){
                tmp = d[l];
                d[l] = d[r];
                d[r] = tmp;
                l++; r--;
            }
            _sortInt(d, left, r);
            _sortInt(d, l, right);
        }
    }
}

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

int main(){
  long long h, w;
  cin >> h >> w;
  if(h==1 || w==1){
    cout << 1 << endl;
    return 0;
  }
  long long ans = h*w;
  cout << (ans+1)/2 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std ;
#define ll long long
void FastInputOutput(){
    ios_base :: sync_with_stdio( 0 ) ;
    cin.tie( 0 ) ;
    cout.tie( 0 ) ;
}

inline int D(){
    int t ;
    scanf( "%d" , &t ) ;
    return t ;
}
inline ll LLD(){
    ll t ;
    scanf( "%lld" , &t ) ;
    return t ;
}
inline ll power(ll x, ll p, ll m){
    ll res = 1;
    while(p){
        if(p & 1)
            res = ((res % m) * (x % m)) % m;
        x = ((x % m) * (x % m)) % m;
        p >>= 1;
    }
    return res % m;
}
long double ModLog(long double base, long double x) {
    return (logl(x) / logl(base));
}
int gcd (int a, int b) {
    while (b) {
        a %= b;
        swap(a, b);
    }
    return a;
}
int lcm(int a, int b){
    return a / gcd(a, b) * b;
}
ll phi(ll x){
    ll res = x;
    for(ll i = 2 ; i <= x/i ; i += 1 + (i&1)){
        if(x%i)    continue;
        while(x%i == 0)            x /= i;
        res -= res/i;
    }
    if(x!=1)    res -= res/x;
    return res;
}
const int N = 2e7 + 5;

int main() {
    int a = D(), b = D();
    int turn = 1;
    for(int i = 1; i <= 16; ++i){
        if(turn && a)
            a-= 1;
        if(!turn && b)
            b-= 1;
        turn ^= 1;
    }
    puts(!a && !b ? "Yay!": ":(");
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		List<Integer> list = new ArrayList<>();
		int count = 0;
		for(int i=1;i<=n;i++) {
			if(i==in.nextInt()) count++;
			else {
				if(count>0) {
					list.add(count);
					count=0;
				}
			}
		}
		if(count>0) list.add(count);
		int ans = 0;
		for(int num:list) {
			ans += (num+1)/2;
		}
		System.out.println(ans);
		in.close();
	}

}


Measured memory_bytes: 51768
// first second push_back unordered return continue break vector visited check flag bool while iterator begin end lower_bound upper_bound temp true false ll_MAX ll_MIN insert erase clear pop push compare ll64_MAX ll64_MIN  reverse replace stringstream string::npos length substr front
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define all(x) x.begin(),x.end()
const ll mod = 1e9 + 7 ;
void add_self(ll& a , ll b){a =  (a + b)%mod;}
//#define (x)  get<0>(x) 
//#define (x)  get<1>(x)
//#define (x)  get<2>(x)
signed main(){
ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
ll n ; 
cin>>n;
vector<ll> h(n) , dp(n);
for(ll i = 0 ; i<n ; i++)cin>>h[i] ; 

// dp[i] min(dp[i-1] +abs(h[i] - h[i-1]),dp[i-2] +abs(h[i] - h[i-2]))
dp[0] = 0 ;
dp[1] = abs(h[0] - h [1]);
for(ll i =2 ; i<n ; i++){
	dp[i] = min(dp[i-1] +abs(h[i] - h[i-1]),dp[i-2] +abs(h[i] - h[i-2]));
}
	
cout<<dp[n-1];
	
}

Measured memory_bytes: 1792
# -*-coding: utf-8 -*-
def check(A, h, w):
    cnt = 0
    if A[h-1][w] == "#":
        cnt += 1
    if A[h][w-1] == "#":
        cnt += 1
    if A[h][w+1] == "#":
        cnt += 1
    if A[h+1][w] == "#":
        cnt += 1
    return cnt

def main():
    H, W = map(int, input().split())
    A = ["." * (W+2)]
    for i in range(H):
        A.append("." + input() + ".")
    A.append("." * (W + 2))
    #print(A)
    ans = "Possible"
    for w in range(1, W+1):
        for h in range(1, H+1):
            if A[h][w] == "#":
                if w == h == 1:
                    if check(A, h, w) != 1:
                        ans = "Impossible"
                elif h == H and w == W:
                    if check(A, h, w) != 1:
                        ans = "Impossible"
                elif check(A, h, w) == 2:
                    if A[h-1][w] == A[h+1][w] == "#" and A[h][w-1] == A[h][w+1] == ".":     # 直線(縦)
                        pass
                    elif A[h-1][w] == A[h+1][w] == "." and A[h][w-1] == A[h][w+1] == "#":   # 直線(横)
                        pass
                    elif A[h-1][w] == A[h][w+1] == "#" and A[h+1][w] == A[h][w-1] == ".":   # L字
                        pass
                    elif A[h+1][w] == A[h][w-1] == "#" and A[h-1][w] == A[h][w+1] == ".":   # L時
                        pass
                    else:
                        ans = "Impossible"
                else:
                    ans = "Impossible"
    print(ans)
if __name__ == '__main__':
    main()

Measured memory_bytes: 3188
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <functional>

using namespace std; 

typedef unsigned long long ull;

bool tri(ull a, ull b, ull c, ull d, ull e, ull f){

	ull p[6]={a,b,c,d,e,f};

	if((((p[0]+p[1])>p[2])&&((p[2]+p[0])>p[1])&&((p[1]+p[2])>p[0]))&& (((p[3]+p[4])>p[5])&&((p[4]+p[5])>p[3])&&((p[3]+p[5])>p[4] )) ){return true;}

	if((((p[0]+p[1])>p[3])&&((p[3]+p[0])>p[1])&&((p[1]+p[3])>p[0]))&& (((p[2]+p[4])>p[5])&&((p[4]+p[5])>p[2])&&((p[2]+p[5])>p[4] )) ){return true;}

	if((((p[0]+p[1])>p[4])&&((p[4]+p[0])>p[1])&&((p[1]+p[4])>p[0]))&& (((p[3]+p[2])>p[5])&&((p[2]+p[5])>p[3])&&((p[3]+p[5])>p[2] )) ){return true;}

	if((((p[0]+p[1])>p[5])&&((p[5]+p[0])>p[1])&&((p[1]+p[5])>p[0]))&& (((p[3]+p[4])>p[2])&&((p[4]+p[2])>p[3])&&((p[3]+p[2])>p[4] )) ){return true;}

	if((((p[0]+p[3])>p[2])&&((p[2]+p[0])>p[3])&&((p[3]+p[2])>p[0]))&& (((p[1]+p[4])>p[5])&&((p[4]+p[5])>p[1])&&((p[1]+p[5])>p[4] )) ){return true;}

	if((((p[0]+p[4])>p[2])&&((p[2]+p[0])>p[4])&&((p[4]+p[2])>p[0]))&& (((p[3]+p[1])>p[5])&&((p[1]+p[5])>p[3])&&((p[3]+p[5])>p[1] )) ){return true;}

	if((((p[0]+p[5])>p[2])&&((p[2]+p[0])>p[5])&&((p[5]+p[2])>p[0]))&& (((p[3]+p[4])>p[1])&&((p[4]+p[1])>p[3])&&((p[3]+p[1])>p[4] )) ){return true;}

	if((((p[0]+p[3])>p[4])&&((p[4]+p[0])>p[3])&&((p[3]+p[4])>p[0]))&& (((p[1]+p[2])>p[5])&&((p[1]+p[5])>p[2])&&((p[2]+p[5])>p[1] )) ){return true;}

	if((((p[0]+p[3])>p[5])&&((p[5]+p[0])>p[3])&&((p[3]+p[5])>p[0]))&& (((p[1]+p[2])>p[4])&&((p[1]+p[4])>p[2])&&((p[2]+p[4])>p[1] )) ){return true;}

	if((((p[0]+p[4])>p[5])&&((p[5]+p[0])>p[4])&&((p[4]+p[5])>p[0]))&& (((p[1]+p[2])>p[3])&&((p[1]+p[3])>p[2])&&((p[2]+p[3])>p[1] )) ){return true;}

	return false;
}

int main()
{
	int N;

	cin >> N;
	ull* bar = new ull[N];

	bool count = false;
	ull ans=0;

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

	sort(bar, bar+N, greater<ull>());

	for(int i=0; i<N-5; i++){
		for(int j=i+3; j<N-2; j++){
			if( tri(bar[i],bar[i+1],bar[i+2],bar[j],bar[j+1],bar[j+2]) ){
				ans = ans + bar[i]+bar[i+1]+bar[i+2]+ bar[j]+bar[j+1]+bar[j+2];
				cout << ans << endl;
				delete[] bar;
				return 0;
			}
		}
	}

	delete[] bar;	
	cout << "0" << endl;

	return 0;
}

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

int main (){
  string S,T,U;
  int A,B;
  cin >>S>>T;
  cin >>A>>B;
  cin >>U;
  if(U== S){
    cout <<A-1<<" "<<B<<endl;
  }
  else if(U == T){
    cout <<A<<" "<<B-1<<endl;
  }
  else{
    cout <<A<<" "<<B<<endl;
  }
}

    


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <vector>
#include <regex>
#include <map>
#include <set>
using namespace std;
int main(){
    int N;
    cin >> N;
    int V[50],C[50];

    for(int i=0;i<N;i++){
        cin >> V[i];
    }
    for(int i=0;i<N;i++){
        cin >> C[i];
    }
    int ans = 0;
    for(int i=0;i<N;i++){
        if(V[i]-C[i]>=0){
            ans += V[i]-C[i];
            
        }
    }
    cout << ans << endl;
return 0;
}




Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int dp[10020][10020];
int main()
{
    int a,b,c,i,j;
    string s,ss;
    cin>>s>>ss;
    a=s.size();
    b=ss.size();
    for(i=0; i<a; i++)
    {
        for(j=0; j<b; j++)
        {
            if(s[i]==ss[j])
                dp[i+1][j+1]=dp[i][j]+1;
            else
                dp[i+1][j+1]=max(dp[i][j+1],dp[i+1][j]);
        }
    }
    int aa=dp[a][b];
    string sss;
    while(aa>0)
    {
        if(s[a-1]==ss[b-1])
        {
            sss=s[a-1]+sss;
            a--;
            b--;
            aa--;
        }
        else if(dp[a][b]==dp[a-1][b])
            a--;
        else
            b--;
    }
    cout<<sss<<endl;
    return 0;
}


Measured memory_bytes: 117760
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

#define debug(...) fprintf(stderr, __VA_ARGS__)
#define int long long int
 
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);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
typedef pair<int, int> pii;
typedef long long ll;
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1001001001001001LL;
const ll MOD = 1000000007LL;

int rec[26];
signed main() {
    int N; cin >> N;
    string s, t; cin >> s >> t;

    rec[ s[0] - 'a' ]++;
    for(int i=1; i<N; i++) {
        if(i == N-1) cout << rec[ t[i] - 'a' ] << endl;
        (rec[ s[i] - 'a' ] += rec[ t[i] - 'a' ]) %= MOD;
        // fprintf(stderr, "rec[%c] = %lld\n", s[i], rec[ s[i] - 'a' ]);
    }
    return 0;
}



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

using namespace std;
#define IOS ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define ll long long
#define ld long double
#define MOD 1000000007
#define endl "\n"

int main()
{
	IOS;
	double n;
	cin >>n;
	double l=n/3;
	double w=(n-l)/2;
	double h=n-l-w;
	double v= l*w*h;
	cout <<fixed<<setprecision(12)<<v<<endl;
	return 0;
}

Measured memory_bytes: 256
var
 n,i,j,t,k,min:longint;
 a:array[0..100005] of longint;
procedure qsort(l,r:longint);
var
 i,j,t,m:longint;
begin
 i:=l;j:=r;m:=a[(l+r) div 2];
 repeat
  while a[i]<m do inc(i);
  while a[j]>m do dec(j);
  if i<=j then
   begin
    t:=a[i];a[i]:=a[j];a[j]:=t;
    inc(i);dec(j);
   end;
 until i>j;
 if i<r then qsort(i,r);
 if l<j then qsort(l,j);
end;
begin
 readln(n,k);
 for i:=1 to n do readln(a[i]);
 qsort(1,n);
 min:=maxlongint;
 for i:=1 to n-k+1 do if a[i+k-1]-a[i]<min then min:=a[i+k-1]-a[i]; 
 writeln(min);
end.

Measured memory_bytes: 512
import itertools

N = int(input())

l = []

for i in itertools.permutations(list(range(1,N+1))):
    l.append(i)

P = tuple(map(int,input().split()))
Q = tuple(map(int,input().split()))

a = 1
b = 1

for i in l:
    if i < P:
        a += 1

for i in l:
    if i < Q:
        b += 1

print(abs(a-b))

Measured memory_bytes: 13744
#include <iostream>
#include <string>

using namespace std;

int main(){

  string a, b, c;

  cin >> a >> b >> c;

  int c5 = 0, c7 = 0;

  if (a == "5"){
    c5 += 1;
  }
  else if (a == "7"){
    c7 += 1;
  }
  else {
  }

  if (b == "5"){
    c5 += 1;
  }
  else if (b == "7"){
    c7 += 1;
  }
  else {
  }

  if (c == "5"){
    c5 += 1;
  }
  else if (c == "7"){
    c7 += 1;
  }
  else {
  }


  if ((c5 == 2) && (c7 == 1)){
    cout << "YES" << endl;
  }
  else {
    cout << "NO" << endl;
  }



  return 0;
}


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

n, k = map(int, input().split())
a = list(map(int, input().split()))

d = {}
for i in a:
    if i not in d:
        d[i] = 1 
    else:
        d[i] += 1

ans = 0 
d = sorted(d.items(), key=lambda x:x[1])
for i in range(len(d)-k):
   ans += d[i][1] 

print(ans)


Measured memory_bytes: 42740
n = int(input())

t = list(map(int, input().split()))

m = int(input())

p=[]
x=[]
for _ in range(m):
    pp, xx= map(int, input().split())
    p.append(pp)
    x.append(xx)

for i in range(m):
    count=x[i]
    for j in range(n):
        if j==p[i]-1:
            pass
        else:
            count+=t[j]
    print(count)

Measured memory_bytes: 3064
from collections import defaultdict
mod = 10**9+7
n = int(input())
a = list(map(int,input().split()))
dic = defaultdict(int)
for i in range(n):
    dic[a[i]] += 1
if n % 2 == 0:
    for i in range(n//2):
        if dic[2*i+1] != 2:
            print(0)
            exit()
else:
    for i in range(n//2):
        if dic[2*i+2] != 2:
            print(0)
            exit()
        if dic[0] != 1:
            print(0)
            exit()
print(pow(2,(n//2),mod))


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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()

using namespace std;
using ll = long long;

const double PI = 3.14159265358979;

void solve()
{
  string x;
  cin >> x;
  cout << x;
  if (x.back() == 's') cout << "es";
  else cout << 's';
}

int main()
{
  fastio;
  solve();

  return 0;
}

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

#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) rep2(i, 0, n)
#define all(a) a.begin(), a.end()
using ll = long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vvvi = vector<vector<vector<int>>>;
using mii = map<int, int>;
using msi = map<string, int>;
using pii = pair<int, int>;

int perm(int n)
{
    if (n == 0)
        return 1;
    return perm(n - 1) * n;
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << std::fixed << std::setprecision(15);

    int n;
    cin >> n;
    vi x(n), y(n), p(n);
    rep(i, n) cin >> x[i] >> y[i];
    rep(i, n) p[i] = i;
    double ans = 0;
    do
    {
        rep2(i, 1, n)
        {
            ans += sqrt((x[p[i]] - x[p[i - 1]]) * (x[p[i]] - x[p[i - 1]]) + (y[p[i]] - y[p[i - 1]]) * (y[p[i]] - y[p[i - 1]]));
        }
    } while(next_permutation(all(p)));

    ans /= perm(n);

    cout << ans << endl;

    return 0;
}

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

int main() {
  int N;
  cin >> N;
  vector<int> a(N);

  for (int i = 0; i < N; i++) cin >> a.at(i);

  int button = 1, count = 0;

  for (int i = 0; i < N; i++) {
    if (button == 2) {
      cout << count << endl;
      break;
    }
    button = a.at(button - 1);
    count++;
  }

  if (button != 2) cout << -1 << endl;
}

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

int n, a[200005], ans[200005], tot, cnt;

int main() {
    cin >> n;
    for (int i = 0; i < n; i++){
        cin >> a[i];
        tot ^= a[i];
    }
    for (int i = 0; i < 32; i++){
        if (tot & (1<<i)){
            for (int j = 0; j < n; j++){
                if (!(a[j] & (1<<i))) ans[j] |= (1<<i);
            }
        }
        else{
            for (int j = 0; j < n; j++){
                if (a[j] & (1<<i)) ans[j] |= (1<<i);
            }
        }
    }
    for (int i = 0; i < n; i++){
        cout << ans[i] << " ";
    }
}


Measured memory_bytes: 5136
from itertools import permutations
N, M, R = map(int, input().split())
r = [int(i)-1 for i in input().split()]
inf = float("inf")
mat = [[inf]*N for _ in range(N)]
for i in range(M):
    a, b, c = map(int, input().split())
    if mat[a-1][b-1] > c:
        mat[a-1][b-1] = mat[b-1][a-1] = c

for k in range(N):
    for i in range(N):
        for j in range(N):
            mat[i][j] = min(mat[i][j], mat[i][k]+mat[k][j])


ans = inf
for p in list(permutations(r)):
    dist = 0
    for i in range(1, len(p)):
        dist += mat[p[i]][p[i-1]]
    ans = min(ans, dist)

print(ans)


Measured memory_bytes: 77268
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(k,i,n) for(ll i=k;i<n;++i)
ll f(ll a,ll x){
    if(a>=0)return 1+a/x;
    else return 0;
}
int main(void){
    // Your code here!
    ll a,b,x;
    cin>>a>>b>>x;
    cout<<f(b,x)-f(a-1,x);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define MAX_N 1002
#define i197 1000000007

using namespace std;

typedef long long ll;
typedef pair<ll,ll> P1;
typedef pair<int,int> Pi;
typedef pair<double,Pi> Pdi;
typedef pair<ll,int>Pli;
typedef pair<P1,ll> P2;
const ll INF=1000000000000000001;
struct edge{int to,cost;};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
struct Road{double cost;int a,b;};

int main() {

	int n,a,b;
	int p[101];
	int total=101;
	int x=0,y=0,z=0;

	cin>>n;
	cin>>a>>b;

	rep(i,n){
		cin>>p[i];
		if(a>=p[i])x++;
		if(a+1<=p[i]&&b>=p[i])y++;
		if(b+1<=p[i])z++;
	}
	total=min(x,y);
	total=min(total,z);
	cout<<total<<endl;

	return 0;
}


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

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)

#define LB(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define UB(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef unsigned long long ull;
typedef long double ld; 

ll mod = 1e9 + 7;

#define each(a,x) for( auto &a:(x))
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n) - 1; i >= 0; i--)
#define rep2(i, l, r) for (ll i = (l); i < (r); i++)
#define rep2r(i, l, r) for (ll i = (r) - 1; i >= (l); i--)
#define range(a) a.begin(), a.end()
// cout<<endl;


int main()
{
	fastio();
	int n, m;
	cin>>n>>m;
	map<int , ll> v;
	rep(i, m)
	{
		int a;
		string s;
		cin>>a>>s;
		if(a > n) continue;
		if(s == "AC" and v[a] == 0)
		{
			v[a] = 1000000;
		}
		else if(s == "AC" and v[a] < 0)
		{
			v[a] = v[a]*(-1);
		}
		else if(s == "WA" and v[a] <= 0){
			v[a]--;
		}
	}
	int ac=0, wc=0;
	rep(i, n)
	{
		// cout<<v[i+1]<<endl;
		if(v[i+1] == 1000000) ac++;
		else if(v[i+1] > 0) ac++, wc+=v[i+1];
	}
	cout<<ac<<" "<<wc<<endl;
}

Measured memory_bytes: 6528
s=input()
n=len(s)
if(n>9):
  print("NO")
  exit()
ak="AKIHABARA"
rem=9-n
for i in range(9):
  if(i>=len(s)):
    if(ak[i]=="A"):
      s=s+"A"
      rem-=1
    else:
      print("NO")
      exit()
  elif(s[i]!=ak[i]):
    if(ak[i]!="A"):
      print("NO")
      exit()
    else:
      if(rem==0):
        print("NO")
        exit()
      else:
        rem-=1
        s=s[:i]+"A"+s[i:]
if(s==ak):print("YES")
else:print("NO")

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

int main() {
   int a[3];
   cin >> a[0] >> a[1] >> a[2];
   
   int temp;
   int min = 300;
   int j, k;
   for (int i = 0; i < 3; i++) {
      j = (i+1)%3;
      k = (i+2)%3;
      temp = std::abs(a[j]-a[i]) + std::abs(a[k]-a[j]);
      if (temp < min) min = temp;
      temp = std::abs(a[k]-a[i]) + std::abs(a[k]-a[j]);
      if (temp < min) min = temp;
   }
   cout << min << endl;
   return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define FOR(e, c) for (auto &e : c)
#define SORT(v, n) sort(v, v + n);
#define vsort(v) sort(v.begin(), v.end());
#define rvisort(v) sort(v.begin(), v.end(), greater<int>());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
 
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using ul = unsigned long;
 
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
 
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
 
int main(){
  int h,w,a,b;
  cin>>h>>w>>a>>b;
  
  rep(i,h){
    rep(j,w){
      if(i<b&&j>=a) cout<<1;
      else if(i>=b&&j<a) cout<<1;
      else cout<<0;
    }
    cout<<endl;
  }
  
}

Measured memory_bytes: 1280