akhauriyash/Code-Regression huggingface dataset:
package main

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

var scanner = bufio.NewScanner(os.Stdin)

func nextString() string {
	scanner.Scan()
	return scanner.Text()
}

func nextInt() int {
	n, err := strconv.Atoi(nextString())
	if err != nil {
		fmt.Printf("strconv.Atoi failed: %v\n", err)
	}
	return n
}

func nextFloat64() (float64, error) {
	return strconv.ParseFloat(nextString(), 64)
}

func min(x, y float64) float64 {
	if x < y {
		return x
	}
	return y
}

func max(x, y float64) float64 {
	if x > y {
		return x
	}
	return y
}

type Point struct {
	x float64
	y float64
}

func sub(l, r *Point) *Point {
	s := Point{
		x: l.x - r.x,
		y: l.y - r.y,
	}
	return &s
}

func crossProd(l, r *Point) float64 {
	return l.x*r.y - r.x*l.y
}

func direction(pi, pj, pk *Point) float64 {
	return crossProd(sub(pk, pi), sub(pj, pi))
}

func readPoint() *Point {
	x, _ := nextFloat64()
	y, _ := nextFloat64()
	point := Point{
		x: x,
		y: y,
	}
	return &point
}

func onSegment(pi, pj, pk *Point) bool {
	return min(pi.x, pj.x) <= pk.x && pk.x <= max(pi.x, pj.x) && min(pi.y, pj.y) <= pk.y && pk.y <= max(pi.y, pj.y)
}

func segmentsIntersect(p1, p2, p3, p4 *Point) bool {
	d1 := direction(p3, p4, p1)
	d2 := direction(p3, p4, p2)
	d3 := direction(p1, p2, p3)
	d4 := direction(p1, p2, p4)

	// fmt.Println(d1, d2, d3, d4)
	if ((d1 > 0 && d2 < 0) || (d1 < 0 && d2 > 0)) && ((d3 > 0 && d4 < 0) || d3 < 0 && d4 > 0) {
		return true
	} else if d1 == 0 && onSegment(p3, p4, p1) {
		return true
	} else if d2 == 0 && onSegment(p3, p4, p2) {
		return true
	} else if d3 == 0 && onSegment(p1, p2, p3) {
		return true
	} else if d4 == 0 && onSegment(p1, p2, p4) {
		return true
	}
	return false
}

func main() {
	scanner.Split(bufio.ScanWords)

	nQueries := nextInt()

	for iQuery := 0; iQuery < nQueries; iQuery++ {
		p0 := readPoint()
		p1 := readPoint()
		p2 := readPoint()
		p3 := readPoint()

		if segmentsIntersect(p0, p1, p2, p3) {
			fmt.Println(1)
		} else {
			fmt.Println(0)
		}
	}
}



Measured memory_bytes: 1212
def dfs(count,last,distance):
    if (count == r):
        if (ans[0] > distance ):ans[0] = distance
        return
    for i in range(r):
        if seen[i]:continue
        seen[i] = True
        if last == -1:dfs(count+1,i,0)
        else:dfs(count+1,i,distance+dp[R[last]-1][R[i]-1])
        seen[i] = False

n,m,r = map(int,input().split())
R = list(map(int,input().split()))
dp = [[ 0 if i == j else float("inf") for i in range(n)] for j in range(n)]
for i in range(m):
    x,y,z = map(int,input().split())
    dp[x-1][y-1] = z
    dp[y-1][x-1] = z
for k in range(n):
    for i in range(n):
        for j in range(n):
            if dp[i][j] > dp[i][k] + dp[k][j]:
                dp[i][j] = dp[i][k] + dp[k][j]
ans = [float("Inf")]
seen = [False]*r
dfs(0,-1,0)
print(*ans)

Measured memory_bytes: 56664
N=gets.strip.to_i
s = readlines.map {|x| x.strip.to_i }.sort

sum = s.reduce(:+)

if sum%10!=0
  p sum
  exit
end

without_10_times_s = s.reject {|x| x%10==0 }
smallest_no_10_times = without_10_times_s.first

if smallest_no_10_times.nil?
  p 0
  exit
end

result = sum - smallest_no_10_times
p result


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

#define rep(i, a, b) for (int i = (a); i < (int)(b); i++)
#define rrep(i, a, b) for (int i = (a); i >= (int)(b); i--)
#define all(x) (x).begin(), (x).end()
using i32 = int32_t;
using i64 = int64_t;
using f32 = float;
using f64 = double;
using P   = pair<int, int>;

template <class T>
bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    } else {
        return false;
    }
}
template <class T>
bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    } else {
        return false;
    }
}

template <class T>
void dump_vec(const vector<T>& v) {
    auto len = v.size();
    rep(i, 0, len) {
        cout << v[i] << (i == (int)len - 1 ? "\n" : " ");
    }
}

struct FastIO {
    FastIO() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(20);
    }
} FASTIO;

//---------------------------------------------------------------------------------------------------

//---------------------------------------------------------------------------------------------------

int paridx(int k) {
    return (k - 1) / 2;
}

int leftidx(int k) {
    return (k << 1) + 1;
}

int rightidx(int k) {
    return (k << 1) + 2;
}

signed main() {
    int N;
    cin >> N;
    vector<int> heap(N);
    rep(i, 0, N) cin >> heap[i];

    rep(i, 0, N) {
        cout << "node " << i + 1 << ": ";
        cout << "key = " << heap[i] << ", ";
        if (i > 0) {
            cout << "parent key = " << heap[paridx(i)] << ", ";
        }
        auto l = leftidx(i);
        if (l < N)
            cout << "left key = " << heap[l] << ", ";
        auto r = rightidx(i);
        if (r < N)
            cout << "right key = " << heap[rightidx(i)] << ", ";
        cout << "\n";
    }
}



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

int count(int n,int x){
    int cnt = 0;
    for (int i = 1; i <= n-2; i++){
        for (int j = i+1; j <= n-1; j++){
            for (int k = j+1; k <= n; k++){
                if (i+j+k == x)cnt++;
            }
        }
    }
    return cnt;
}

int main(){
    int n,x;
    while (1)
    {
        cin >> n >> x;
        if(n == 0 && x == 0)break;
        cout << count(n,x) << endl;
    }
return 0;
}


Measured memory_bytes: 3080
#include <bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(0)
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define debug(x) cout<<"### x is: "<<x<<"###"<<endl
#define all(a) a.begin(),a.end()
#define tc int t;scanf("%d",&t);while (t--0)
#define int long long
const int MOD=1e9+7;
const int N=55;
int power(int a, int b) {int ret=1;while(b) {if(b&1) ret*=a;a*=a;if(ret>=MOD) ret%=MOD;if(a>=MOD) a%=MOD;b>>=1;}return ret;}
int invmod(int x) {return power(x,MOD-2);}
int a[N];
int n,x;
int dp[51][2501][51];
int go(int pos,int sum,int count)
{
	if(pos==n)
	{
		if(sum==x*count&&sum!=0)
		{
			return 1;
		}
		else
		{
			return 0;
		}
	}

	

	
	if(dp[pos][sum][count]!=-1)
		return dp[pos][sum][count];
	int ans=0;	
	ans+=go(pos+1,sum+a[pos],count+1);
	ans+=go(pos+1,sum,count);
	dp[pos][sum][count]=ans;
	return ans;
}
int32_t main()
{
	
	cin>>n>>x;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
	}
	memset(dp,-1,sizeof(dp));
	cout<<go(0,0,0)<<endl;




}

Measured memory_bytes: 51200
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <set>
#include <string>
using namespace std;

int main(){
    string s; cin >> s;
    int ans = 1000;
    for ( int i = 0 ; i < s.size()-2 ; i++ ){
        int x = stoi(s.substr(i,3));
        ans = min( ans, abs(x-753));
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
def bb046
    n,k = gets.chomp.split(/\s/).map{|x| x.to_i}

    if n == 1
        puts k
        exit
    end
    if k == 2
        puts 2
        exit
    end

    r = k
    for i in 2..n
        r *= (k-1)
    end

    puts r
end

bb046

Measured memory_bytes: 1788
#include<cstdio>
#include<algorithm>
#include<map>
#define pii pair<int,int>
using namespace std;
map<pii, int>Map;
int n, res;
pii w[60];
int main() {
	int i, j, k;
	scanf("%d", &n);
	res = n;
	for (i = 1; i <= n; i++) {
		scanf("%d%d", &w[i].first, &w[i].second);
		Map[w[i]] = 1;
	}
	for (i = 1; i <= n; i++) {
		for (j = 1; j <= n; j++) {
			if (i == j)continue;
			int x = w[j].first - w[i].first, y = w[j].second - w[i].second;
			int c = 0;
			for (k = 1; k <= n; k++) {
				if (Map.count({ w[k].first + x,w[k].second + y }))c++;
			}
			res = min(res, n - c);
		}
	}
	printf("%d\n", res);
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define int long long
int mod=1e9+7;

signed main(){
  int n,m,x,y;
  cin>>n>>m>>x>>y;
  int am=-1e18;
  int bm=1e18;
  for(int i=0;i<n;i++){
    int a;
    cin>>a;
    am=max(a,am);
  }
  for(int i=0;i<m;i++){
    int a;
    cin>>a;
    bm=min(a,bm);
  }
  if(bm-am>0&&x<y&&am<y&&bm>x)cout<<"No War"<<endl;
  else cout<<"War"<<endl;
}


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

using namespace std;

typedef long int li;
typedef long double ld;
typedef long long ll;
typedef pair<ll, ll> pt;

#define fi first
#define se second
#define lson (p<<1)+1
#define rson (p<<1)+2
#define dump(x) cout << #x << " = " << x << endl
#define fastIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

ll a, b;
string s, t, st;

int main () {
    fastIO;
    cin >> s >> t >> a >> b >> st;
    if(st == s) a --;
    else b --;
    cout << a << " " << b;
}


Measured memory_bytes: 256
fun main(args: Array<String>) {
    val (d, g) = readLine()!!.split(" ").map { it.toInt() }
    val pc = (1..d).map { readLine()!!.split(" ").map { it.toInt() } }

    var ans = Int.MAX_VALUE
    for (bit in 0 until (1 shl d)) {
        var count = 0
        var sum = 0L
        for (no in 0 until d) {
            val numOfproblems = pc[no][0]
            val point = (no + 1) * 100
            val bonus = pc[no][1]
            if (1 and (bit shr no) == 1) {
                count += numOfproblems
                sum += point * numOfproblems + bonus
            }
        }

        if (g <= sum) {
            ans = Math.min(ans, count)
            continue
        }

        for (no in d - 1 downTo 0) {
            var flg = false

            if (1 and (bit shr no) == 1) {
                continue
            }

            val numOfproblems = pc[no][0]
            val point = (no + 1) * 100
            for (i in 1..numOfproblems) {
                sum += point
                count++
                if (g <= sum) {
                    flg = true
                    break
                }
            }
            if (flg) {
                break
            }
        }
        ans = Math.min(ans, count)
    }
    println(ans)
}

Measured memory_bytes: 38328
#include <bits/stdc++.h>
#define ARM_NUM 31
using namespace std;

void solveOne(int x, int y, int m) {
    int u = x + y, v = x - y;
    for (int i = 1 << (ARM_NUM - 1); i > 0; i >>= 1) {
        if (u >= 0) {
            u -= i;
            if (v >= 0) {
                v -= i;
                printf("R");
            } else {
                v += i;
                printf("U");
            }
        } else {
            u += i;
            if (v >= 0) {
                v -= i;
                printf("D");
            } else {
                v += i;
                printf("L");
            }
        }
    }
    if (m > ARM_NUM) {
        if (u >= 0) {
            if (v >= 0) {
                printf("R");
            } else {
                printf("U");
            }
        } else {
            if (v >= 1) {
                printf("D");
            } else {
                printf("L");
            }
        }
    }
    printf("\n");
}

void solve(int xs[], int ys[], int m, int n) {
    printf("%d\n", m);
    printf("%d", 1 << (ARM_NUM - 1));
    for (int i = ARM_NUM - 2; i >= 0; i--) {
        printf(" %d", 1 << i);
    }
    if (m > ARM_NUM)
        printf(" 1");
    printf("\n");
    for (int i = 0; i < n; i++) {
        solveOne(xs[i], ys[i], m);
    }
}

int main() {
    int n;
    scanf("%d", &n);
    int xs[n], ys[n];
    scanf("%d %d", xs, ys);
    int m = ARM_NUM;
    int mod = abs(xs[0] + ys[0]) % 2;
    for (int i = 1; i < n; i++) {
        scanf("%d %d", xs+i, ys+i);
        if (mod != abs(xs[i] + ys[i]) % 2) {
            printf("-1\n");
            return 0;
        }
    }
    m += 1 - mod;
    solve(xs, ys, m, n);
    return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
#include <random>
#include <list>
#include <numeric>
using namespace std;
 
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<int, ll> i_ll;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
struct edge { int u, v; ll w; };
 
#define rep(i, N) for (int i = 0; i < (int)(N); i++)
#define pb push_back
 
int INF = INT_MAX / 10;
ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

int main() {
	int N, A, B; cin >> N >> A >> B;
	string s; cin >> s;
	int x = 0, y = 0;
	for (char c: s) {
		if (c == 'a') {
			if (x < A + B) {
				cout << "Yes" << endl;
				x++;
			}
			else cout << "No" << endl;
		}
		if (c == 'b') {
			if (x < A + B && y < B) {
				cout << "Yes" << endl;
				x++;
				y++;
			}
			else cout << "No" << endl;
		}
		if (c == 'c') cout << "No" << endl;
	}
}


Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pb push_back
#define fi first
#define se second
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mii map<int,int>
#define mll map<ll,ll>
#define all(x) (x).begin(),(x).end()
#define S(x) (int)(x).size()
#define L(x) (int)(x).length()
#define trace(x) cerr<<#x<<"is "<<x<<'\n';

const int mod = 1e9+7;
const ll infl = 0x3f3f3f3f3f3f3f3fLL;
const int infi = 0x3f3f3f3f;

int dp[49][409][409];
int a[49],b[49],c[49];

void solve()
{
	int n,ma,mb,i,j,k;
	cin>>n>>ma>>mb;
	for(i=1;i<=n;i++)
	{
		cin>>a[i]>>b[i]>>c[i];
	}
	memset(dp, infi , sizeof dp);
	dp[0][0][0]=0;
	for(i=1;i<=n;i++)
	{
		for(j=0;j<=400;j++)
		for(k=0;k<=400;k++)
		{
			if(dp[i-1][j][k]==infi) continue;
			dp[i][j][k]=min(dp[i][j][k],dp[i-1][j][k]);
			dp[i][j+a[i]][k+b[i]]=min(dp[i][j+a[i]][k+b[i]],dp[i-1][j][k]+c[i]);
		}
	}
	int ans=infi;
	for(j=1;j<=400;j++)
	for(k=1;k<=400;k++)
	if(j*mb==k*ma)
	ans=min(ans,dp[n][j][k]);
	if(ans==infi) cout<<-1;
	else cout<< ans;
}

int main()
{
	IOS
	int t=1;
	//cin>>t;
	while(t--)
	{
		solve();
	}
}


Measured memory_bytes: 32384
#include <iostream>

using namespace std;

int main()
{
   long n,s=0,min=0,max=0,x;
	 cin>>n;
	 for(int i=0;i<n;i++){
		cin>>x;
		if(i==0){min=x;max=x;}
		s+=x;
		if(min>x)min=x;
		if(max<x)max=x;
	}
	cout<<min<<" "<<max<<" "<<s<<endl;
    return 0;
}


Measured memory_bytes: 3116
def main():
    N, M = map(int, input().split())
    A = list(map(int, input().split()))
    A_tot = sum(A)
    A = sorted([a / A_tot for a in A], reverse=True)

    if A[M - 1] >= 1 / (4 * M):
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n;
		
		while (sc.hasNextInt()) {
			n = sc.nextInt();
			System.out.println((n * n + n + 2) / 2);
		}
	}
}

Measured memory_bytes: 12000
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Scanner;

public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		int A = sc.nextInt();
		int B = sc.nextInt();
		int T = sc.nextInt();

		int ans = ( T / A ) * B;

		out.println(ans);


		sc.close();

	}

	public static void main(String[] args) {
		new Main()._main(args);
	}

}


Measured memory_bytes: 23252
// ???????????????
#include<vector>
#include<climits>
#include<cassert>
// ?????°
const int INF = INT_MAX;
// ?????????
class RangeMinimumQuery {
public:
  explicit RangeMinimumQuery(int s);
  void update(int i, int v);
  int index(int left, int right) const;
  int value(int left, int right) const;
private:
  int parent(int node) const;
  int left_child(int node) const;
  int right_child(int node) const;
  int power_of_two(int n) const;
  int query(int left, int right, int node, int node_left, int node_right) const;
  int size_, nil_, inf_;
  std::vector<int> index_, value_;
};
// ????????????
RangeMinimumQuery::RangeMinimumQuery(int s) : size_(power_of_two(s)), nil_(size_), inf_(INF), index_(2 * size_ - 1, nil_), value_(size_ + 1, inf_) {}
void RangeMinimumQuery::update(int i, int v) {
  int node = i + size_ - 1;
  index_.at(node) = i;
  value_.at(i) = v;
  while((node = parent(node)) != nil_) {
    int l = value_.at(index_.at(left_child(node)));
    int r = value_.at(index_.at(right_child(node)));
    index_.at(node) = index_.at(l <= r ? left_child(node) : right_child(node));
  }
}
int RangeMinimumQuery::index(int left, int right) const {
  return query(left, right, 0, 0, size_ - 1);
}
int RangeMinimumQuery::value(int left, int right) const {
  return value_.at(query(left, right, 0, 0, size_ - 1));
}
int RangeMinimumQuery::parent(int node) const {return node ? (node - 1) / 2 : nil_;}
int RangeMinimumQuery::left_child(int node) const {return 2 * node + 1;}
int RangeMinimumQuery::right_child(int node) const {return 2 * node + 2;}
int RangeMinimumQuery::power_of_two(int n) const {
  while(n & (n - 1)) n += n & -n;
  return n;
}
int RangeMinimumQuery::query(int left, int right, int node, int node_left, int node_right) const {
  assert(left <= right);
  assert(0 <= left);
  assert(right < size_);
  if(node_right < left || right < node_left) return nil_;
  if(left <= node_left && node_right <= right) return index_.at(node);
  int middle = (node_left + node_right) / 2;
  int l = query(left, right, left_child(node), node_left, middle);
  int r = query(left, right, right_child(node), middle + 1, node_right);
  return value_.at(l) <= value_.at(r) ? l : r;
}

#include<bits/stdc++.h>
using namespace std;
int main() {
  int n, q;
  cin >> n >> q;
  RangeMinimumQuery rmq(n);
  for(int i = 0; i < q; ++i) {
    int com, x, y;
    cin >> com >> x >> y;
    if(com) cout << rmq.value(x, y) << endl;
    else    rmq.update(x, y);
  }
}

Measured memory_bytes: 2580
n, k = map(int, input().split())
r, s, p = map(int, input().split())
t = input()
points = 0
a = True
b = True
c = True
for i in range(k):
    j = i
    cnt = 1
    while j < n:
        if j + k < n and t[j] == t[j + k]:
            cnt += 1
        else:
            if cnt % 2 == 0:
                cnt = cnt // 2
            else:
                cnt = cnt // 2 +1
            if t[j] == "r":
                points += cnt * p
            elif t[j] == "s":
                points += cnt * r
            elif t[j] == "p":
                points += cnt * s
            cnt = 1
        # print(i, j, cnt, points)
        j += k


print(points)

Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9+7;

int main(void)
{
    int N,M;
    cin >> N >> M;

    vector<int> oks(N+1,true);
    for(int i=0;i<M;++i)
    {
        int a;
        cin >> a;
        oks[a] = false;
    }

    vector<long long int> dp(N+1,0);

    dp[0]=1;
    for(int i=0;i<N;++i)
    {
        for (int j=i+1;j<=min(N,i+2);++j)
        {
            if (oks[j])
            {
                dp[j]+=dp[i];
                dp[j]%=mod;
            }
        }
    }

    cout << dp[N] << endl;

    return 0;
}


Measured memory_bytes: 1408
#[allow(unused_imports)]
use std::cmp;
use std::collections::BTreeSet;

// Input macro from https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
  (source = $s:expr, $($r:tt)*) => {
    let mut iter = $s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
  ($($r:tt)*) => {
    #[allow(unused_mut)]
    let mut s = {
      use std::io::Read;
      let mut s = String::new();
      std::io::stdin().read_to_string(&mut s).unwrap();
      s
    };
    let mut iter = s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
}

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

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

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

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

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

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

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

fn main() {
  input!{
    n: usize,
    ws: [chars; n]
  }
  let mut set = BTreeSet::new();
  for w in &ws {
    set.insert(w.clone());
  }
  if set.len() != n {
    println!("No");
    return;
  }
  for i in 0..n-1 {
    if ws[i].last() != ws[i+1].first() {
      println!("No");
      return;
    }
  }
  println!("Yes");
}


Measured memory_bytes: 4352
#include <stdio.h>
#include <string.h>

int main(void)
{
	char w[101];
	int n, i, j, total;

	scanf("%s", w);

	n = strlen(w);

	total = 0;

	for (i = 0; i < n; i++){
		for (j = 0; j < n; j++){
			if (w[i] == w[j]){
				total++;
			}
		}

		if (total % 2 != 0){
			printf("No\n");
			return (0);
		}
	}

	printf("Yes\n");



	return (0);

}


Measured memory_bytes: 128
#include <iostream>

using namespace std;

 
bool isprime(int n){
	if(n<2) 
		return false;
	if(n==2)
		return true;
	if(n%2==0)
		return false;
	for (int i =3 ; i*i <= n; i=i+2) {
    	if(n%i==0)
    		return false;
	}
	return true;
}
 
 
int main() {
int n,m,count=0;
    cin>>n;
    for (int i = 0; i < n; ++i) {
    	cin>>m;
    	if(isprime(m)){
    		count++;
    	}
	}
	cout<<count<<endl;
}

Measured memory_bytes: 3024
#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main(int argc, char const* argv[]) {
	char c;
	scanf("%c", &c);
	if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u') printf("vowel\n");
	else printf("consonant\n");

	return 0;
}


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

// 小数点以下桁数
// fixed << setprecision(i)

int64_t gcd(int64_t a,int64_t b){return (a%b==0?b:gcd(b, a%b));}
int64_t lcm(int a,int b){return (int64_t)a*b/gcd(a, b);}
int factorial(int a){int b=1;while(a){b*=a--;}return b;} //13以下対応
bool is_prime(int a){if(a<=1)return false;for(int i=2;(int64_t)i*i<=a;i++){if(a%i==0)return false;}return true;}
int get_adp(double x, int n){return (int)round((x-(int)x)*pow(10,n))%10;} // 小数点以下の指定桁の値を取得
int64_t sigma(int64_t s, int64_t n){return n*(2*s+n-1)/2;}

//順列の全列挙
// vector<int> v(N);
// iota(v.begin(), v.end(), 1);       // v に 1, 2, ... N を設定
// do {
//	for(auto x : v) cout << x << " "; cout << "\n";     // v の要素を表示
// } while( next_permutation(v.begin(), v.end()) ); 

//bit全探索
// for (int tmp = 0; tmp < (1 << ビット数); tmp++) {
//	bitset<ビット数> s(tmp);
//	// (ビット列sに対する処理)
// }

int main()
{
	int n, m, inv_p, t;
	double ans, p, p0;

	cin >> n >> m;
	t = m * 1900 + (n - m) * 100;
	inv_p = pow(2, m);
	p0 = 1 - 1.0 / inv_p;
	p = p0;
	ans = 1;
	for (int i = 1; i < 1001; i++)
	{
		// if (i < 10)
		// 	cout << p << endl;
		ans += (i + 1) * p;
		p *= p0;
		// if (i % 100 == 0)
		// 	cout << ans << endl;
	}
	cout << (int)round(t * ans / inv_p) << endl;
}


Measured memory_bytes: 4028
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repe(i, n) for (int i = 0; i <= (n); ++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
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; }
typedef long long ll;
const int INF = 1e9;
const ll mod = 1000000007;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a*b / gcd(a,b);}

int main() {
    int a,b,c;
    cin >> a >> b >> c;
    if (a==b) {
        cout << c << "\n";
    }
    if (b==c) {
        cout << a << "\n";
    }
    if (a==c) {
        cout << b << "\n";
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define re register
#define M 998244353
inline void add(re int &x,re int y){(x+=y)>=M?x-=M:x;}
using namespace std;
inline int read(){
	re int t=0;re char v=getchar();
	while(v<'0')v=getchar();
	while(v>='0')t=(t<<3)+(t<<1)+v-48,v=getchar();
	return t;
}
int n,m,k,a[1000002],ans,b[10000002],dp[10000002],f[10000002];
char s[1000002];
signed main(){
	n=read();
	for(re int i=1;i<=n;++i)a[i]=(read()==read());
	for(re int i=3;i<=n;++i)if(a[i-2]&&a[i-1]&&a[i])m=1;
	puts(m?"Yes":"No"); 
}

Measured memory_bytes: 3640
#include<stdio.h>
//小さい順にソート
int c[200002];
void merge(int i,int j,int *s){
  if(i!=j){
    merge(i,(i+j)/2,s);
    merge((i+j)/2+1,j,s);
    int a=i,b=(i+j)/2+1;
    int d;
    for(d=i;d<=j;d++){
      if((i+j)/2<a){
        c[d]=s[b];
        b++;
      }
      else if(j<b){
        c[d]=s[a];
        a++;
      }
      else if(s[a]<s[b]){
        c[d]=s[a];
        a++;
      }
      else{
        c[d]=s[b];
        b++;
      }
    }
    for(d=i;d<=j;d++)
      s[d]=c[d];
  }
}

int main(){
  int n,i;
  scanf("%d",&n);
  int x[n+1],b[n+1];
  for(i=0;i<n;i++){
    scanf("%d",&x[i]);
    b[i]=x[i];
  }
  merge(0,n-1,x);
  for(i=0;i<n;i++){
    if(b[i]<x[n/2])
      printf("%d\n",x[n/2]);
    else
      printf("%d\n",x[n/2-1]);
  }
  return 0;
}


Measured memory_bytes: 4480
#include <stdio.h>

using lli = long long int;

// constexpr version : N が clang++ : 3e5くらいまでok,  g++ : 2e6くらいまでok
template <int N, long long int mod>
struct CombinationMod{
private:
    using lli = long long int;
public:
    lli Power[N+1], Inverse[N+1], powInverse[N+1];
    constexpr CombinationMod():Power(), Inverse(), powInverse(){
        Power[0] = 1; Inverse[0] = 1; powInverse[0] = 1;
        for(int x = 1; x <= N; ++x) Power[x] = (Power[x-1] * x) % mod;
        powInverse[N] = inverse(Power[N]);
        for(int x = N; x > 0; --x) powInverse[x-1] = (powInverse[x] * x) % mod;
        for(int x = 1; x <= N; ++x) Inverse[x] = (Power[x-1] * powInverse[x]) % mod;
    }
    constexpr void swap(lli &a, lli &b) const {
        a ^= b; b ^= a; a ^= b;
    }
    constexpr lli inverse(lli a) const noexcept{
        lli b = mod, u = 1, v = 0;
        while (b != 0) { 
            lli t = a / b; a -= t * b; swap(a, b);
            u -= t * v; swap(u, v);
        }
        u %= mod; if (u < 0) u += mod;
        return u;
    }
    // nCkを求める関数 : n < k の入力に注意せよ
    inline lli combination(int n, int k) const noexcept{
        if(n < k) return 0;
        return ((Power[n] * powInverse[k] % mod) * powInverse[n-k]) % mod;
    }
};

constexpr int SizeN = 2e5 + 1;
constexpr int mod = 1e9 + 7;
constexpr CombinationMod<SizeN, mod> Cmb;


int main(void){
    int n, m, k; scanf("%d%d%d", &n, &m, &k);
    lli T1 = m; (T1 *= m) %= mod; (T1 *= Cmb.combination(n+1, 3)) %= mod;
    lli T2 = n; (T2 *= n) %= mod; (T2 *= Cmb.combination(m+1, 3)) %= mod;
    lli res = T1 + T2;
    (res *= Cmb.combination(n*m-2, k-2)) %= mod;
    printf("%lld\n", res);
    return 0;
}


Measured memory_bytes: 888
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cstring>
#include <iterator>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <utility>
#include <memory>
#include <functional>
#include <deque>
#include <cctype>
#include <ctime>
#include <numeric>
#include <list>
#include <iomanip>

#if __cplusplus >= 201103L
#include <array>
#include <tuple>
#include <initializer_list>
#include <forward_list>

#define cauto const auto&
#else

#endif

using namespace std;


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

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll;
typedef vector<vector<long long> > vvll;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
    v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
    stringstream ss;
    ss << f;
    ss >> t;
}

#define GET_MACRO(_1, _2, _3, NAME, ...) NAME
#define _rep(i,n) _rep2((i),0,(n))
#define _rep2(i,a,b) for(int i=(a);i<(b);++i)
#define rep(...) GET_MACRO(__VA_ARGS__, _rep2, _rep)(__VA_ARGS__)
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define fi first
#define se second
#define mkp make_pair
#define DEBUG
#ifdef DEBUG
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#else
#define dump(x) 
#define debug(x) 
#endif

#define MOD 1000000007LL
#define EPS 1e-8
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
#define maxs(x,y) x=max(x,y)
#define mins(x,y) x=min(x,y)

void mainmain(){
	int n,m;
	cin>>n>>m;
	vvint vv;
	initvv(vv, n, n);
	int ans = 0;
	rep(i,m){
		int a,b,c;
		cin>>a>>b>>c;
		a--,b--;
		vv[a][b] = vv[b][a] = c;
		ans += c;
	}
	vint cost(1<<n);
	rep(i,1<<n){
		rep(j,n){
			rep(k,j){
				if((i&(1<<j))&&(i&(1<<k))){
					cost[i] += vv[j][k];
				}
			}
		}
	}
	vvint dp;
	initvv(dp, n, 1<<n, -INF);
	dp[0][1] = 0;
	rep(j,1<<n){
		rep(i,n){
			if(dp[i][j]==-INF) continue;
			rep(k,n){
				if(j&(1<<k)) continue;
				if(vv[i][k]==0) continue;
				maxs(dp[k][j+(1<<k)], dp[i][j]+vv[i][k]);
			}
			int mask = (1<<n)-1;
			mask ^= j;
			for(int k=mask; k; k=(k-1)&mask){
				// if(j&k) continue;
				maxs(dp[i][j+k], dp[i][j]+cost[k+(1<<i)]);
			}
		}
	}
	cout<<ans-dp[n-1][(1<<n)-1]<<endl;
}


signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(20);
    mainmain();
}

Measured memory_bytes: 2560
#include<bits/stdc++.h>
#define ll long long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
static const ll MAX = 1000000000000000;
static const int NIL = -1;
using namespace std;
const long double EPS = 0.0000000001;
const long double PI = (acos(-1));
const ll MOD = 1e9 + 7;

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

int main(){
    int H,W; cin >> H >> W;
    int count = 0, pos = 0, ans = -1;
    vector<string> s(H);
    vector<vector<int>> h(H,vector<int>(W,0)),w(H,vector<int>(W,0));
    rep(i,H) cin >> s[i];

    rep(i,H){
        count = 0;
        rep(j,W){
            if(s[i][j] == '.') {
                count ++;
                w[i][j] = count;
            }else count = 0;
        }
        for(int j = W-2; j >= 0; j --){
            if(w[i][j] != 0) w[i][j] = max(w[i][j],w[i][j+1]);
        }
    }

    rep(i,W){
        count = 0;
        rep(j,H){
            if(s[j][i] == '.') {
                count ++;
                h[j][i] = count;
            }else count = 0;
        }
        for(int j = H-2; j >= 0; j --){
            if(h[j][i] != 0) h[j][i] = max(h[j][i],h[j+1][i]);
        }
    }


    rep(i,H){
        rep(j,W){
            if(s[i][j] == '.') ans = max(ans,h[i][j] + w[i][j]);
        }
    }
    cout << ans-1;



}

Measured memory_bytes: 42612
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define p(s) cout<<(s)<<endl
#define REP(i,n,N) for(int i=n;i<N;i++)
#define RREP(i,n,N) for(int i=N-1;i>=n;i--)
#define CK(n,a,b) ((a)<=(n)&&(n)<(b))
#define F first
#define S second
typedef long long ll;
using namespace std;
const ll mod = 1e9+7;

int N;
ll sum;
int main(){
    cin>>N;
    int mx=1;
    REP(i,1,N+1) {
        sum += i;
        if (sum > N) {
            mx=i;
            break;
        }
    }
    REP(i,1,mx+1){
        if(sum-i!=N){
            p(i);
        }
    }
    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))

using namespace std;

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;}

const ll INF=1e9+7;


int main()
{
    ll n,m;
    cin >> n >> m;
    vector<ll> a(n);
    rep(i,n){
        cin >> a[i];
    }
    sort(a.rbegin(),a.rend());
    ll le=1;
    ll ri=200000+1;
    ll cnt=0;
    while(ri-le>1){
        ll mid=(le+ri)/2;
        ll sum=0;
        rep(i,n){
            ll ok=-1;
            ll ng=n;
            while(ng-ok>1){
                ll v=(ng+ok)/2;
                if(a[v]+a[i]>=mid){
                    ok=v;
                } 
                else{
                    ng=v;
                }
            }
            sum+=ok+1;
            
        }
        //cout << mid << endl;
        if(sum<=m){
            ri=mid;
            cnt=sum;
        }
        else{
            le=mid;
        }
        //cout << cnt << endl;
    }
    vector<ll> p(n+1);
    p[0]=0;
    rep(i,n){
        p[i+1]=p[i]+a[i];
    }
    ll q=0;
    rep(i,n){
        ll ok=-1;
        ll ng=n;
        while(ng-ok>1){
            ll k=(ng+ok)/2;
            if(a[i]+a[k]>=ri){
                ok=k;
            }
            else{
                ng=k;
            }
        }
        q+=(ok+1)*a[i]+p[ok+1];
        //cout << q << endl;
    }
    //cout << cnt << endl;
    cout << q+(m-cnt)*(ri-1) << endl;
    return 0;
} 

Measured memory_bytes: 1792
import java.util.*;
import java.io.*;
import java.lang.*;
import java.math.BigInteger;
import java.nio.charset.StandardCharsets;

public class Main {
public static void main(String[] args) throws IOException{
  BufferedInputStream bis = new BufferedInputStream(System.in);
  BufferedReader r = new BufferedReader(new InputStreamReader(bis, StandardCharsets.UTF_8));
  PrintStream ps = new PrintStream(System.out);
  int n=Integer.parseInt(r.readLine());
  if(n==0)
    ps.println(1);
    
  
  if(n==1)
  ps.println(0);
  

  
}
}
  

Measured memory_bytes: 32596
#include <stdio.h>

int main(void)
{
  int n;
  scanf("%d", &n);
  char s[n+1];
  scanf("%s", s);
  int sum = 1;
  char curr_color = s[0];

  for(int i = 0; i < n; i++) {
    if(curr_color != s[i]) {
      curr_color = s[i];
      sum++;
    }
  }

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


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <cassert>
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

using namespace std;
typedef long long int ll;

int nextsmallest(vector<int> &v, int sidx) {
    int l = 0, u = v.size()-1;
    if (v[0] > sidx) {
        u = 0;
    } else if (v[u] > sidx) {
        while (u - l > 1) {
            int b = (l+u+1)/2;
            ll h = v[b];
            if (h > sidx) u = b;
            else if (h < sidx) l = b;
            else u = l = b+1;
        }
    } else u = u + 1;
    
    u = u%v.size();
    return u;
}

int main(int argc, const char * argv[]) {
//    vector<int> v{1,2,4};
//    assert(nextsmallest(v, 2) == 2);
//    assert(nextsmallest(v, 4) == 0);
//    assert(nextsmallest(v, 0) == 0);
//    assert(nextsmallest(v, -1) == 0);
//    assert(nextsmallest(v, 3) == 2);
//
//    vector<int> w{1,2,4,9};
//    assert(nextsmallest(w, 2) == 2);
//    assert(nextsmallest(w, 4) == 3);
//    assert(nextsmallest(w, 0) == 0);
//    assert(nextsmallest(w, -1) == 0);
//    assert(nextsmallest(w, 9) == 0);
//
    
    string s, t;
    cin >> s >> t;
    
    map<char, vector<int>> m;
    REP(i, s.length()) {
        m[s[i]].push_back(i);
    }
    
    ll cnt = 0;
    ll sidx = -1;
    REP(i, t.length()) {
        char c = t[i];
        if (m[c].size() == 0) {
            cout << -1 << endl;
            return 0;
        }
        int u = nextsmallest(m[c], sidx);
        int next = m[c][u];
        if (next > sidx) cnt += next-sidx;
        else cnt += next-sidx+s.size();
        sidx = (next+1)%s.size()-1;
    }
    cout << cnt << endl;
}


Measured memory_bytes: 1216
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(a < 10 && a > 0 && b > 0 && b < 10) System.out.println(a*b);
		else System.out.println(-1);

		sc.close();
	}
}

Measured memory_bytes: 23252
main = getLine >>= putStrLn . solve . map (read :: String -> Int) . words

solve [w,h,x,y,r] | 0 <= bottom && 0 <= left && top <= h && right <= w = "Yes"
                   | otherwise = "No"
  where
    bottom = y - r
    top = y + r
    left = x - r
    right = x + r



Measured memory_bytes: 3684
N, *XYH = map(int, open(0).read().split())
XYH = [(x, y, h) for x, y, h in zip(*[iter(XYH)] * 3)]
pos_i = -1
for i, (_, _, h) in enumerate(XYH):
    if h > 0:
        pos_i = i
        break
for i in range(101):
    for j in range(101):
        t_x, t_y, t_h = XYH[pos_i]
        tmp_summit = t_h + abs(i - t_x) + abs(j - t_y)
        for x, y, h in XYH:
            if h > 0 and tmp_summit - h != abs(i - x) + abs(j - y):
                break
            elif h == 0 and tmp_summit > abs(i - x) + abs(j - y):
                break
        else:
            print(i, j, tmp_summit)
            exit()


Measured memory_bytes: 9120
#include<stdio.h>
int main(void)
{
	int m,f,b;
	scanf("%d %d %d",&m,&f,&b);
	if(m>=b){
		printf("0\n");
	}
	else if(m+f>=b){
		printf("%d\n",b-m);
	}
	else{
		printf("NA\n");
	}
	return 0;
}


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

using namespace std;
using ll = long long;

int main(void) {
  int n;
  cin >> n;
  vector<pair<int, int>> v(n);
  vector<int> vr(n);
  for (int i = 0; i < n; i++) {
    vr[i] = i;
  }
  for (int i = 0; i < n; i++) {
    cin >> v[i].first >> v[i].second;
  }
  double ans = 0;
  double m = 0;
  do {
    for (int i = 0; i < n - 1; i++) {
      ans += sqrt(pow((v[vr[i]].first - v[vr[i+1]].first), 2) + pow(v[vr[i]].second - v[vr[i+1]].second, 2));
    }
    m++;
  } while (next_permutation(vr.begin(), vr.end()));
  ans /= m;
  printf("%.12f\n", ans);
  return 0;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main() {
	int a, b, r;
	cin >> a >> b;
	if ((0 == a) || (0 == b)){
	r = 0;
}
r = a % b;
while (r != 0)
{
	a = b;
	b = r;
	r = a % b;

}
	cout << b << endl;
	return 0;
}


Measured memory_bytes: 3116
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <functional>
#include <stack>
#include <iomanip>
#include <limits>
using namespace std;
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
using Graph=vector<vector<int>>;
using edge= struct{int to;ll cost;};
template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}
typedef priority_queue<ll> PQ_HIGH;
typedef priority_queue<ll,VL,greater<ll>> PQ_LOW;//昇順

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

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define inf 100000000000
#define int long long int
#define hell (int)(1e9+7)

using namespace std;

void solve(){
    int n;
    cin>>n;
    while(n>0){
        if(n%10==7){
            cout<<"Yes";
            return;
        }
        n/=10;
    }
    cout<<"No";
}

signed main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int t;
	//cin>>t;
	t=1;
	while(t--){
		solve();
	}
	return 0;
}


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

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 1000000007

typedef long long ll;
typedef pair<ll,ll> P;


int main(){
	
	ll a,b,c;cin >> a >> b >> c;
	
	ll ans = b;
	ans += min(b,c);
	c -= b;
	
	if(c > 0){
		ans += min(a + 1,c);
	}
	
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(){
  int n,m,c,i,j,count;
  int a[21][201],b[201],A[21];
  scanf("%d %d %d",&n,&m,&c);
  for(j=1;j<=m;j++){
    scanf("%d",&b[j]);
  }
  for(i=1;i<=n;i++){
    for(j=1;j<=m;j++){
      scanf("%d",&a[i][j]);
  }
}
count=0;
for(i=1;i<=n;i++){
  for(j=1;j<=m;j++){
      A[i]+=a[i][j]*b[j];
    }
  if(A[i]+c>0) count++;
 }
printf("%d\n",count);
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
const int INF=1e9;
const int MOD=1e9+7;
//const int MOD=998244353;
const long long LINF=1e18;
using namespace std;
#define int long long
//template
//main
signed main(){
  int S;cin>>S;
  if(S%INF==0){
    int a=S/INF;
    cout<<0<<" "<<0<<" "<<INF<<" "<<0<<" "<<1<<" "<<a<<endl;
  }
  else{
    int a=S/INF+1;
    int b=a*INF-S;
    cout<<0<<" "<<0<<" "<<INF<<" "<<b<<" "<<1<<" "<<a<<endl;
  }
}


Measured memory_bytes: 256
import numpy as np

N, M, C = map(int, input().split())
B = np.array(list(map(int, input().split())))
ans = 0
for _ in range(N):
  A = np.array(list(map(int, input().split())))
  ABC = sum(A*B) + C
  if ABC > 0:
    ans += 1
print(ans)    
    

Measured memory_bytes: 12488
#include <iostream>

using namespace std;

int main(){
    int S;
    cin >> S;
    int a = S/100;
    int b = S-a*100;
    if((a > 12 || a == 0) && (b > 12 || b == 0)){
        cout << "NA" << endl;
    }else if((a <= 12 && a > 0) && (b > 12 || b == 0)){
        cout << "MMYY" << endl;
    }
    else if((b <= 12 && b > 0) && (a > 12 || a == 0)){
        cout << "YYMM" << endl;
    }else{
        cout << "AMBIGUOUS" << endl;
    }
}

Measured memory_bytes: 256
#pragma warning(disable:4996)

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <float.h>

#pragma region 定義
typedef long long  ll;
typedef unsigned long long  ull;


#define _itoa(A,N) sprintf(A, "%d", N);

int i_dsort(const void* a, const void* b);
int i_asort(const void* a, const void* b);

int  _gcd(int a, int b);
int  _swp(int* a, int* b);
int _cknum(char* a, int n);
int _atoi(char* s, int len);

int s_asort(const void* a, const void* b);
int s_dsort(const void* a, const void* b);

//昇順
int s_asort(const void* a, const void* b) {
	return(strcmp((char*)a, (char*)b));
}
int s_dsort(const void* a, const void* b) {
	return(strcmp((char*)b, (char*)a));
}

int i_dsort(const void* a, const void* b) {
	return(*(int*)b - *(int*)a);
}
int i_asort(const void* a, const void* b) {
	return(*(int*)a - *(int*)b);
}

int _gcd(int a, int b) {
	int r, tmp;
	if (a < b) { tmp = a; a = b; b = tmp; }
	r = a % b;
	while (r) {
		if (!r) break;
		a = b; b = r;
		r = a % b;
	}
	return(b);
}
// puts("Yes\n") puts("No\n")
// scanf("%d.%d") 浮動小数点入力を整数２つで得る


//#define pai  3.1415926535 
//#define  _USE_MATH_DEFINES でM_PIが使える

#define deg_rad(X)  (X*(M_PI/180))


int _swp(int* a, int* b)
{
	int tmp;
	tmp = *b; *b = *a; *a = tmp;
	return 0;
}
#define _abs(x) ((x)>0?(x):-(x))
#define _min(x,y) ((x)<(y)?(x):(y))
#define _max(x,y) ((x)<(y)?(y):(x))

int _cknum(char* a, int n) {
	int i;
	char t = '0';

	for (i = 0; i < n; i++) {
		if (a[i] < '0' || a[i]>'9') return 1;
	}
	return 0;
}


int _atoi(char* s, int len) {
	char tmp[20];
	memcpy(tmp, s, len);
	tmp[len] = 0x00;
	return (atoi(tmp));
}

//素因数分解　pf素数が入る　pc 素数の数
ll _pfact(ll a);
static ll pf[100000000];
static ll pc;

ll _pfact(ll a) {
	long i, r;
	if (a % 2 == 0) {
		pf[pc] = 2; pc++;
		return(_pfact(a / 2));
	}
	r = sqrt(a);
	for (i = 3; i <= r; i += 2) {
		if (a % i == 0) {
			pf[pc] = i; pc++;
			return(_pfact(a / i));
		}
	}
	if (a != 1) {
		pf[pc] = a; pc++;
	}
	return 0;

}


#pragma endregion
//ABC-064 Colorful Leader bord
int main(void) {
	int c[8], n, a;

	memset(c, 0, sizeof(c));
	scanf("%d", &n);

	int i, x = 0;
	for (i = 0; i < n; i++) {
		scanf("%d", &a);
		if (a >= 3200) { x++; continue; }
		//  printf("%d\n", a/400);
		c[a / 400] = 1;
	}

	int r = 0;
	for (i = 0; i < 8; i++)
		if (c[i])r++;

	printf("%d %d\n", (r)?r:1, x+r);
	return 0;
}


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

using namespace std;

int n;
long long arr[100005];
vector<pair<int,int> > v;

int main()
{
	cin >> n;
	int mn=0,mx=0;
	for(int i=0;i<n;i++)
	{
		cin >> arr[i];
		if(arr[i]<arr[mn]) mn=i;
		if(arr[i]>arr[mx]) mx=i;
	}
	if(mn==mx)
	{
		cout << 0 << endl;
		return 0;
	}
	int cur=(abs(arr[mn])>abs(arr[mx])?mn:mx);
	cur++; // wut?
	cout << (n-1)*2 << endl;
	for(int i=1;i<=n;i++)
	{
		if(i!=cur)
			cout << cur << " " << i << endl;
	}
	if(arr[cur-1]>0) // wut?
		for(int i=1;i<n;i++)
		{
				cout << i << " " << i+1 << endl;
		}
	else
		for(int i=n;i>1;i--)
			cout << i << " " << i-1 << endl;
}

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

using namespace std;

#define MAX 500000
#define INF 2000000000

int L[MAX/2 + 2], R[MAX/2 + 2];
int cnt = 0;

void merge(int A[],int left,int mid,int right)
{
	int n1 = mid - left;
	int n2 = right - mid;
	for(int i = 0; i < n1; i++)
	{
		L[i] = A[left + i];
	}
	for(int i = 0; i < n2; i++)
	{
		R[i] = A[mid + i];
	}
	L[n1] = INF;
	R[n2] = INF;
	int i = 0;
	int j = 0;
	for(int k = left; k < right; k++)
	{
		if(L[i] < R[j])
		{
			A[k] = L[i++];
		}
		else
		{
			A[k] = R[j++];
		}
		cnt++;
	}
}

void mergesort(int A[],int left,int right)
{
	if(left + 1 < right)
	{
		int mid = (left + right) / 2;
		mergesort(A,left,mid);
		mergesort(A,mid,right);
		merge(A,left,mid,right);
	}
}

int main()
{
	int A[MAX];
	int n, i;
	scanf("%d", &n);
	for(i = 0; i < n; i++)
	{
		scanf("%d", A + i);
	}
	mergesort(A,0,n);
	for(i = 0; i < n; i++)
	{
		if(i)
		{
			printf(" ");
		}
		printf("%d", A[i]);
	}
	printf("\n%d\n", cnt);
	
	return 0;
}


Measured memory_bytes: 7020
#include <iostream>
#include <cctype>

using namespace std;

int main() {
	string str;

	cin >> str;

	if (str[0] != 'A') {
		cout << "WA" << endl;
	}
	else {
		int count = 0;
		int i = 1;
		while (i < str.length()) {
			if (i >= 2 && i < str.length() - 1 && str[i] == 'C') {
				count++;
			}
			else if (islower(str[i]) == 0) {
				break;
			}
			i++;
		}

		if (count != 1 || i != str.length())
			cout << "WA" << endl;
		else
			cout << "AC" << endl;

	}

	return 0;
}

Measured memory_bytes: 256