akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i,a,b) for (int i = a; i <b; i++)
typedef long long ll;
#define int ll
typedef vector<int> vi;
typedef vector<long long> vl;
typedef pair<int,int> pi;
#define trace(x) cout<<#x<<"="<<x<<"\n";
#define llp 1000000007
#define mod 1000000007

template < typename F, typename S >
ostream& operator << ( ostream& os, const pair< F, S > & p ) {
    return os << "(" << p.first << ", " << p.second << ")";
}

template < typename T >
ostream &operator << ( ostream & os, const vector< T > &v ) {
    os << "{";
    typename vector< T > :: const_iterator it;
    for( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "}";
}

template < typename T >
ostream &operator << ( ostream & os, const set< T > &v ) {
    os << "[";
    typename set< T > :: const_iterator it;
    for ( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "]";
}

template < typename F, typename S >
ostream &operator << ( ostream & os, const map< F, S > &v ) {
    os << "[";
    typename map< F , S >::const_iterator it;
    for( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << it -> first << " = " << it -> second ;
    }
    return os << "]";
}

#define deb(x) cerr << #x << " = " << x << endl;

int dp[10005];
int32_t main(){
	ios::sync_with_stdio(false);
    int n;
    cin>>n;
    vi a(n);
    REP(i,0,n)cin>>a[i];
    memset(dp,0,sizeof(dp));
    dp[0]=1;
    for(int i=0;i<n;i++){
        // deb(i);
        // deb(a[i]);
        for(int j=10005;j>=a[i];j--){
            if(dp[j-a[i]]){
                // deb(j);
                dp[j]=1;
            }
        }
    }
    int ans=0;
    for(int i=0;i<10005;i++){
        if(dp[i] && i%10!=0){
            ans=max(i,ans);
        }
    }
    cout<<ans<<"\n";



	return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
#define pb push_back
using namespace std;
const int N=1e5+10;
typedef long long ll;
int gi() {
    int x=0,o=1;char ch=getchar();
    while((ch<'0'||ch>'9')&&ch!='-') ch=getchar();
    if(ch=='-') o=-1,ch=getchar();
    while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
    return x*o;
}
int n,m,a,b,s[N],dep[N],st[N],fa[N],top=0;
vector<int> E[N];
ll ans=0;
void dfs(int u,int ff,int val) {
    fa[u]=ff;dep[u]=dep[ff]+1;s[u]=val;
    for(int v:E[u]) {
        if(v==ff) continue;
        if(!dep[v]) dfs(v,u,-val),s[u]+=s[v];
        else a=u,b=v;
    }
}
int main() {
    cin>>n>>m;
    for(int i=1,u,v;i<=m;i++) u=gi(),v=gi(),E[u].pb(v),E[v].pb(u);
    dfs(1,0,1);
    if(dep[a]<dep[b]) swap(a,b);
    if(m==n-1) {
        if(s[1]) return puts("-1"),0;
        for(int i=1;i<=n;i++) ans+=abs(s[i]);
    }
    else if((dep[a]-dep[b])&1) {
        if(s[1]) return puts("-1"),0;
        for(int p=a;p!=b;p=fa[p]) st[++top]=s[p],dep[p]=-1;
        st[++top]=0;
        int mid=(top+1)>>1;nth_element(st+1,st+mid,st+top+1);
        for(int i=1;i<=n;i++) if(dep[i]!=-1) ans+=abs(s[i]);
        for(int i=1;i<=top;i++) ans+=abs(st[mid]-st[i]);
    }
    else {
        if(abs(s[1])&1) return puts("-1"),0;
        int z=s[1]/2;
        for(int p=a;p;p=fa[p]) s[p]-=z;
        for(int p=b;p;p=fa[p]) s[p]-=z;
        for(int i=1;i<=n;i++) ans+=abs(s[i]);
        ans+=abs(z);
    }
    printf("%lld\n",ans);
    return 0;
}
//orzgzy
//鸡贼明年进队超稳


Measured memory_bytes: 15104
#include <bits/stdc++.h>
using namespace std;
int main(){
  int a[21][21], b[21], c, m, n, cnt;
  cin >> n >> m >> c;
  for(int i = 0; i < m; i++){
    cin >> b[i];
  }
  cnt = 0;
  for(int i = 0; i < n; i++){
    int sum = 0;
    for(int j = 0; j < m; j++){
      cin >> a[i][j];
      sum += a[i][j]*b[j];
    }
    sum += c;
    if(sum > 0) cnt++;
  }
  cout << cnt << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.*;
 
public class Main{
	public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        long dp[] = new long[100100];
        Arrays.fill(dp,Integer.MAX_VALUE);
        int h[] = new int[n+101];
        for(int i=0; i<n; i++){
            h[i] = sc.nextInt();
        }
        dp[0] = 0;
        for(int i=0; i<n; i++){
            for(int j =1; j<=k; j++){
                dp[i+j] = Math.min(dp[i+j],dp[i] + Math.abs(h[i]-h[i+j]));
            }
        }
        System.out.println(dp[n-1]);
    }
}


Measured memory_bytes: 56804
get_number(Number) :-
    get_string(String),
    number_string(Number, String).

get_number(A, B) :-
    get_number(A),
    get_number(B).

get_number(A, B, C) :-
    get_number(A, B),
    get_number(C).

get_string(String) :-
    current_input(Input),
    read_string(Input, ' \n\r\t', '', _, String).

get_chars(Xs) :-
    get_string(S),
    string_chars(S, Xs).

get_numbers(0, []).
get_numbers(N, [X|Xs]) :- 
    get_number(X), 
    N2 is N - 1, 
    get_numbers(N2, Xs).

put_numbers([]).
put_numbers([X|Xs]) :-
    writeln(X),
    put_numbers(Xs).

/* memo
    code(int)
    string_code(1, S, C), (C: code)
    char_code(X, Y) (X: char, Y: code)
    string_chars(S, S2) (S: string, S2: [char])
    to_lower(C, C2) (C: char? C2: code?)
    length(S, L),
    sub_string

    f(0, [], []).
    f(Z, [X|Xs], [Y|Ys]) :- X = Y, f(Z1, Xs, Ys), Z is Z1 + 1.
    f(Z, [_|Xs], [_|Ys]) :- f(Z, Xs, Ys).

    match: =, \=

    numeric: <,=<, >, >= (eval)
    lexicographically: @<. @=<, @>, @>=
    value?: =:=, =\= (eval)
    identical: ==, \==

    between(L,U,X): L <= X <= U
    nth0(I, Xs, Y), nth1(I, Xs, Y): (Xs,Y) -> I, (I, Xs) -> Y 

    sort(Key, Order, List, Sorted): Keyは通常0?, Orderは=なしが重複削除，=は重複保持
    \+ P(X) : not P(X)

    sum_list(Xs, Sum)

    orは!忘れに注意(末尾再帰なら直前)
*/

f([], _, []).
f([X|Xs], K, [Y|Ys]) :-
    char_code(X, X2),
    Y2 is (X2 - "A" + K) mod 26 + "A",
    char_code(Y, Y2),
    f(Xs, K, Ys).

main :-
    get_number(K),
    get_chars(S),
    f(S, K, T),
    string_chars(T2, T),
    writeln(T2).

    % statistics(inferences, IC), writeln(IC).


Measured memory_bytes: 8488
//#pragma GCC optimize ("O3")
//#pragma GCC target ("sse4")

#include <bits/stdc++.h>

using namespace std;

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "


// CHECK THE LIMITS
typedef long long ll;

const int MOD = 1000000007;
const ll INFLL = 1e18;
const int INF = 1e9;
const int NMAX = 1000001;

int gcd(int a, int b) {
  return b ? gcd(b, a%b) : a;
} 

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
	set<int> a;
	
	int x,y,z;
	cin >> x >> y >> z;
	a.insert(x);a.insert(y);a.insert(z);

	if(a.size() == 2)
		cout << "Yes";
	else
	{
		cout << "No";
	}
	

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<utility>
#include<queue>
#include<string>
#include<cmath>
#include<tuple>
#include<algorithm>
#define INF 1111111111
using namespace std;
typedef pair<int,int> P;
typedef tuple<int,int,int> tup;
typedef long long ll;
vector<int> vec(100100);
vector<int> passed(100100);
vector<int> dx = {-1,1};
int n,k;

int main() {
  int a = 0 ,b = 0;
  cin >> n;
  if(n==1)
    cout << "Hello World" << endl;
  else if(n == 2){
    cin >> a >> b;
    cout << a+b << endl;
  }
}

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

using namespace std;

#define ll long long
#define pii pair<int, int>
#define pb push_back
#define pli pair<ll, int>
#define pil pair<int, ll>
#define clr(a, x) memset(a, x, sizeof(a))

const double pi = acos(-1.0);
const int INF = 0x3f3f3f3f;
const int MOD = 1e9 + 7;
const double EPS = 1e-9;

/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define TREE tree<pli, null_type, greater<pli>, rb_tree_tag, tree_order_statistics_node_update>
TREE T;
*/

int n, m, p[11];
vector<int> e[11];
set<int> ss;
int main() {
	scanf("%d%d", &n, &m);
	for (int i = 1; i <= m; ++i) {
		int k; scanf("%d", &k);
		while (k--) {
			int x; scanf("%d", &x);
			e[i].pb(x);
		}
	}
	for (int i = 1; i <= m; ++i) scanf("%d", &p[i]);
	int ans = 0;
	for (int mask = 0; mask < 1 << n; ++mask) {
		int to = 0;
		for (int i = 1; i <= m; ++i) {
			int cnt = 0;
			for (auto x : e[i]) {
				if (mask & 1 << x - 1) ++cnt;
			}
			if ((cnt & 1) == (p[i] & 1)) to |= 1 << i - 1;
		}
		if (to == (1 << m) - 1) ++ans;
	}
	printf("%d\n", ans);
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
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)
typedef pair<int, int> P;

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

  vector<int> x(m);
  rep(i,m) cin >> x[i];
  sort(x.begin(), x.end());
  vector<int> xdiff(m-1);
  rep(i, m-1) {
    xdiff[i] = x[i+1] - x[i];
  }
  sort(xdiff.begin(), xdiff.end(), greater<int>());
  ll sum = 0;
  rep(i, m-1) {
    if (i < n-1) {
      //      cout << i << " " << xdiff[i] << endl;
      continue;
    }
    sum += xdiff[i];
  }

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


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

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

    int n;
    cin >> n;
    vector<long long> H(n + 1, 0);
    for(int i = 1; i <= n; i++){
        cin >> H[i];
    }

    vector<long long> dp(n + 1, 1e18);
    dp[0] = 0;
    dp[1] = 0;
    dp[2] = abs(H[2] - H[1]);
    for(int i = 3; i <= n; i++){
        dp[i] = min(dp[i - 2] + abs(H[i] - H[i - 2]), dp[i - 1] + abs(H[i] - H[i - 1]));
    }

    cout << dp[n] << endl;

    /*
    cout << "------------" << endl;
    for(int i = 0; i <= n; i++){
        cout << dp[i] << ' ';
    }
    cout << endl;
    */

    return 0;
}

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

using namespace std;
int main(){
    int a,b,x;
    scanf("%d%d%d",&a,&b,&x);
    if((a+b)>=x && x>=a){
        printf("YES\n");
    }else {
        printf("NO\n");
    }
    return 0;

}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<queue>
#include<math.h>
using namespace std;
int main()
{
    int a,b,c;
    scanf("%d%d",&a,&b);
    a=a*3;
    c=a+b;
    printf("%d\n",c/2);
    /*nh*/
}


Measured memory_bytes: 128
import math
from collections import Counter,deque,defaultdict
L=lambda:list(map(int,input().split()))
M=lambda:map(int,input().split())
I=lambda:int(input())
IN=lambda:input()

def solve():
    n=I()
    if n%1000==0:
        print(0)
    else:
        print(1000-n%1000)
for _ in range(1):
    solve()


Measured memory_bytes: 9372
#include<stdio.h>
using namespace std;

int main() {
	int a,b;
	char op;
	while (true)
	{
		scanf("%d %c %d", &a, &op, &b);
		if (op == '?')break;
		switch (op)
		{
    		case'+':
    			printf("%d\n", a + b);
    			break;
    		case'-':
    			printf("%d\n", a - b);
    			break;
    		case'*':
    			printf("%d\n", a * b);
    			break;
    		case'/':
    			printf("%d\n", a / b);
    			break;
		}
	}
}


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

int main()
{
    int n;
    cin >> n;
    vector< int > p;
    for( int i = 0; i < n; i++ )
    {
        int a;
        cin >> a;
        p.push_back(a);
    }
    
    int ans = 0;
    int min = 1000000;
    
    for( int i = 0; i < n; i++ )
    {
        if( min >= p.at(i) )
        {
            min = p.at(i);
        }

        if( min == p.at(i) )
        {
            ans = ans + 1;
        }
    }
    
    cout << ans << endl;
    return 0;
}




Measured memory_bytes: 1400
#include<iostream>
using namespace std;
int min(int a,int b){
  if(a<b)return a;
  return b;
}
int main(){
  int a,b,c;
  cin>>a>>b>>c;
  int ans=min(min(a+b,b+c),c+a);
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int cnta = 0;
		int cntb = 0;
		int cntc = 0;
		for(int i = 0 ; i < 3 ; i++) {
			if(s.charAt(i) == 'a') cnta++;
			if(s.charAt(i) == 'b') cntb++;
			if(s.charAt(i) == 'c') cntc++;
		}
		if(cnta == 1 && cntb == 1 && cntc == 1) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}


Measured memory_bytes: 25044
import std.stdio;
import std.array;
import std.conv;
import std.string;
import std.algorithm;

void main()
{
    auto n = map!(to!int)(readln.strip.split);
    int[100][100] v1;
    int[100] v2;

    foreach(i;0..n[0])
      foreach(int j,string e; readln.strip.split)
        v1[i][j] = e.to!int;

    foreach(i;0..n[1])
      v2[i] = readln.strip.to!int;

    foreach(i;0..n[0]) {
        int sum = 0;
        foreach(j;0..n[1]) {
            sum += v1[i][j] * v2[j];
        }
        writeln(sum);
    }
}

Measured memory_bytes: 2612
using System;
using System.IO;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Numerics;


partial class Solver
{
    public void Run()
    {
        var S = ns();

        int ans = 0;

        for (int i = 0; i < S.Length; i++)
        {
            if (i % 2 == 0 ^ S[i] == '1') ans++;
        }

        ans = Math.Min(ans, S.Length - ans);

        cout.WriteLine(ans);
    }
}




// PREWRITEN CODE BEGINS FROM HERE
partial class Solver : Scanner
{
    public static void Main(string[] args)
    {
        new Solver(Console.In, Console.Out).Run();
    }

    TextReader cin;
    TextWriter cout;

    public Solver(TextReader reader, TextWriter writer)
        : base(reader)
    {
        this.cin = reader;
        this.cout = writer;
    }
    public Solver(string input, TextWriter writer)
        : this(new StringReader(input), writer)
    {
    }

    public int ni() { return NextInt(); }
    public int[] ni(int n) { return NextIntArray(n); }
    public long nl() { return NextLong(); }
    public long[] nl(int n) { return NextLongArray(n); }
    public double nd() { return NextDouble(); }
    public string ns() { return Next(); }
}

public class Scanner
{
    private TextReader Reader;
    private Queue<String> TokenQueue = new Queue<string>();
    private CultureInfo ci = CultureInfo.InvariantCulture;

    public Scanner()
        : this(Console.In)
    {
    }

    public Scanner(TextReader reader)
    {
        this.Reader = reader;
    }

    public int NextInt() { return Int32.Parse(Next(), ci); }
    public long NextLong() { return Int64.Parse(Next(), ci); }
    public double NextDouble() { return double.Parse(Next(), ci); }
    public string[] NextArray(int size)
    {
        var array = new string[size];
        for (int i = 0; i < size; i++) array[i] = Next();
        return array;
    }
    public int[] NextIntArray(int size)
    {
        var array = new int[size];
        for (int i = 0; i < size; i++) array[i] = NextInt();
        return array;
    }

    public long[] NextLongArray(int size)
    {
        var array = new long[size];
        for (int i = 0; i < size; i++) array[i] = NextLong();
        return array;
    }

    public String Next()
    {
        if (TokenQueue.Count == 0)
        {
            if (!StockTokens()) throw new InvalidOperationException();
        }
        return TokenQueue.Dequeue();
    }

    public bool HasNext()
    {
        if (TokenQueue.Count > 0)
            return true;
        return StockTokens();
    }

    private bool StockTokens()
    {
        while (true)
        {
            var line = Reader.ReadLine();
            if (line == null) return false;
            var tokens = line.Trim().Split(" ".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
            if (tokens.Length == 0) continue;
            foreach (var token in tokens)
                TokenQueue.Enqueue(token);
            return true;
        }
    }
}


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

int main(){
  string s;
  cin>>s;
  int cnt=0;
  for(int i=0;i<s.size();i++){
    if(s.at(i)=='o')
      cnt++;
  }
  if(cnt+15-s.size()>=8)
    cout<<"YES"<<endl;
  else
    cout<<"NO"<<endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    int n;
    cin>> n;
    int impare;

    if(n%2 == 0)
       impare = n/2;
    else
       impare = n/2+1;

    float rezultat = (float)impare / n;

    cout << rezultat << endl;

     return 0;
}



Measured memory_bytes: 256
n, k = map(int, input().split())
 
dice = list(map(int, input().split()))
 
a = sum(dice[0: k])
b = sum(dice[0: k])
 
res = 0
ll = 0
s = 0

for i in range(k, len(dice)):
    a += dice[i]
    a -= dice[i - k]
    if a > b:
        b = a
 
res = (b + k) /2.0
 
print(res)

Measured memory_bytes: 24804
#include <cstdio>
#include <cstring>
#include <map>
#include <algorithm>
using namespace std;

int main() {
	map<char, int> m;
	char str[512];
	scanf(" %s", str);
	const int n = strlen(str);
	for(int i = 0; i < n; i++) {
		m[str[i]]++;
	}
	printf("%d\n", min(min(m['K'], m['U']), min(m['P'], m['C'])));
	return 0;
}

Measured memory_bytes: 0
#include<stdio.h>
#include<stdlib.h>
int main(){
  int **G,n,u,k,v,i,j;
  scanf("%d",&n);
  G = (int**)malloc(sizeof(int) * (n + 1));
  for(i=0; i<=n; i++){
    G[i] = (int*)malloc(sizeof(int) * (n + 1));
    for(j=1; j<=n; j++) G[i][j] = 0;
  }
  for(i=1; i<=n; i++){
    scanf("%d%d",&u,&k);
    for(j=1; j<=k; j++){
      for(; k>0; k--){
        scanf("%d",&v);
        G[u][v] = 1;
      }
    }
  }
  for(i=1; i<=n; i++) for(j=1; j<=n; j++) printf((j != n ? "%d " : "%d\n"),G[i][j]);
  return 0;
}

Measured memory_bytes: 636
<?php
    $S = trim(fgets(STDIN));

	$tmp = 0; $tmp2 = 0;

        if($S>=500){
            $tmp = (int)($S/500);
            $S = $S%500;
        }

            $tmp2 = (int)($S/5);

	echo ($tmp*1000+$tmp2*5)."\n";
            


Measured memory_bytes: 4604
/*
    Author - Param Kothari
    Ah shit, here we go again
*/

#include <bits/stdc++.h>
 
using namespace std;

#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define pb push_back
#define mk make_pair
#define debug_vec(x, n) cout << (#x) << ": "; for(int i = 0; i < n; i++) cout << x[i] << (i == n - 1 ? "\n" : " ");

typedef long long ll;
typedef long double ld;

void solve(){
    ll n, k;
    cin >> n >> k;
    vector<ll> a(n + 1), adj(n + 1);
    for(int i = 1; i <= n; i++){
        cin >> a[i];
    }
    for(int i = 1; i <= n; i++){
        adj[i] = a[i];
    }
    vector<ll> cycle, vis(n + 1);
    ll v = 1;
    while(1){
        vis[v] = 1;
        cycle.pb(v);
        v = adj[v];
        if(vis[v] == 1){
            break;
        }
    }
    ll len = 0;
    while(1){
        vis[v]++;
        len++;
        v = adj[v];
        if(vis[v] == 2){
            break;
        }
    }
    ll ini = (int)cycle.size() - len;
    if(k < ini){
        cout << cycle[k] << "\n";
        return;
    }
    k -= ini;
    ll idx = k % len;    
    cout << cycle[ini + idx] << "\n";
    // debug_vec(cycle, (int)cycle.size());
    return;
}

int main(){
    IOS;
    int t = 1;
    // cin >> t;
    for(int i = 1; i <= t; i++){
        solve();
    }
    return 0;
}


Measured memory_bytes: 10024
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long LL;
typedef long double LD;

LL inf = 1000000000000;
LL mod = 1000000007;


int main()
{
	LL n, r;
	cin >> n >> r;

	if (n >= 10) {
		cout << r << "\n";
	}
	else {
		cout << r - 100*(n-10) << "\n";
	}
	
}

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

#define rep(i,n) for(long long i=0; i<(long long)(n);i++)
#define rep2(i,s,n) for(long long i=(s); i<(long long)(n);i++)
#define mod 1000000007
typedef long long ll;

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

    if(s/100>=1&&s/100<=12){
        if(s%100>=1&&s%100<=12){
            cout<<"AMBIGUOUS"<<endl;
        }
        else {
            cout<<"MMYY"<<endl;
        }
    }
    else {
        if(s%100>=1&&s%100<=12){
            cout<<"YYMM"<<endl;
        }
        else {
            cout<<"NA"<<endl;
        }
    }
}



Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int N = scanner.nextInt();
		int K = scanner.nextInt();
		int X = scanner.nextInt();
		int Y = scanner.nextInt();

		int result = K*X+(N-K)*Y;
		if(N<K) result = N*X;
		System.out.println(result);
		scanner.close();
	}

}


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

int main() {
    string S;
    cin >> S;
    sort(S.begin(), S.end());
    char c = 'a';
    rep(i, 26) {
        rep(j, S.size()) {
            if (c == S[j]) {
                c = c + 1;
                break;
            }
        }
    }
    if (c == '{') cout << "None" << endl;
    else cout << c << endl;
    return 0;
}

Measured memory_bytes: 512
from sys import stdin
nii=lambda:map(int,stdin.readline().split())
lnii=lambda:list(map(int,stdin.readline().split()))

n,m,x=nii()
a=lnii()

ans1=0
ans2=0
for i in a:
  if i<x:
    ans1+=1
  else:
    ans2+=1

print(min(ans1,ans2))

Measured memory_bytes: 8952
#include <iostream>
#include <string>
#include <climits>

using namespace std;

int main() {
	int a, b;
	scanf("%d%d", &a, &b);
	if(a > 12) {
		printf("%d\n", b);
	} else if(a > 5) {
		printf("%d\n", b / 2);
	} else {
		printf("%d\n", 0);
	}
	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <climits>
#include <cmath>
#include <complex>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <cstdint>
using namespace std;
typedef long long ll;
#define MP make_pair
#define PB push_back
#define inf 1000000007
#define mod 1000000007
#define rep(i,n) for(int i = 0; i < (int)(n); ++i)
#define int long long
signed main(){
    int n,m;
    cin >> n >> m;
    priority_queue<int> pq;
    rep(i,n){
        int k;
        cin >> k;
        pq.push(k);
    } 
    rep(i,m){
        int x = pq.top();
        pq.pop();
        x/=2;
        pq.push(x);
    }
    int sm = 0;
    while(!pq.empty()){
        int x = pq.top();
        pq.pop();
        sm += x;
    }
    cout << sm << endl;
    return 0;
}

Measured memory_bytes: 1528
/*input
123


*/
#include <iostream>
#include <bits/stdc++.h>
#include <math.h> 

using namespace std;
#define gc getchar_unlocked
#define fo(i,n) for(ll i=0;i<n;i++)
#define Fo(i,k,n) for(ll i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define ll long long
#define si(x)	scanf("%d",&x)
#define sl(x)	scanf("%lld",&x)
#define ss(s)	scanf("%s",s)
#define pi(x)	printf("%d\n",x)
#define pl(x)	printf("%lld\n",x)
#define ps(s)	printf("%s\n",s)
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
#define ms(a,x) memset(a, x, sizeof(a));
#define endl "\n"
typedef pair<int, int>	pii;
typedef pair<ll, ll>	pl;
typedef vector<int>		vi;
typedef vector<ll>		vl;
typedef vector<pii>		vpii;
typedef vector<pl>		vpl;
typedef vector<vi>		vvi;
typedef vector<vl>		vvl;
int mpow(int base, int exp); 
void ipgraph(int m);
void dfs(int u, int par);
const ll mod = 1000000007;
const int N = 1000000001;
const int MAX = 1e5;



int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s;cin>>s;
    bool flag = false;
    for(ll i=0;i<s.size();i++){
    	if(s[i]=='7')flag=true;
    }
    if(flag)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}		

Measured memory_bytes: 3592
#include<bits/stdc++.h>
using namespace std;
int main () {
    int N;
    cin >> N;
    vector<int> a(N+1);
    for(int i = 0; i < N; i++) cin >> a[i+1];
    vector<int> b(N+1);


    for(int i = N; i >= 1; i--){
        int sum = 0;
        for(int j = i+i; j <= N; j += i){
            sum += b[j];
        }
        if (sum%2 == a[i]){
            b[i] = 0;
        }else{
            b[i] = 1;
        }
    }
    
    int M = 0;
    for (int i = 0; i < b.size(); i++){
        if(b[i] == 1) M++;
    }
    bool flag = true;

    for (int i = 0; i < N; i++) {
        
        if (b[i+1] == 1){
            if(flag){
                 cout << M << endl;
                 flag = false;
            }
            cout << i+1 << " ";
        }
    }

    if(flag) cout << 0;

}

Measured memory_bytes: 2432
/* Author: $%U%$
 * Time: $%Y%$-$%M%$-$%D%$ $%h%$:$%m%$:$%s%$
**/
#include <bits/stdc++.h>
using namespace std;
#define fore(i, a, b) for (int i = a, to = b; i < to; i++)
#define foref(i, a, b) for (int i = b - 1, to = a; i >= to; i--)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define SZ(v) (int)v.size()
#define pb push_back
typedef long long Long;
typedef pair<int, int> Pair;
const int MX = 5e3;
const Long INF = 1e15;
Long A[MX + 2];
Long C[MX + 2];
Long n, k;
Long maxi(vector<Long> &v, Long val) {
  if (val == 0) return 0LL;
  Long ans = -INF;
  Long cur = 0;
  fore(i, 0, val) {
    cur += v[i];
    ans = max(ans, cur);
  }
  return ans;
}
Long fun(vector<Long> &l, vector<Long> &r) {
  if (k <= SZ(l)) {
    return maxi(l, k);
  }
  Long auxk = k;
  auxk -= SZ(l);

  Long ans = -INF;
  Long tot = accumulate(all(l), 0LL);
  if (SZ(l) > 0) {
    ans = max(ans, maxi(l, SZ(l)));
  }
  Long ciclo = SZ(r);

  Long cntCiclo = auxk / ciclo;
  Long extra = auxk % ciclo;
  Long valorCiclo = accumulate(all(r), 0LL);
  //cout << cntCiclo << " " << extra << endl;
  if (cntCiclo > 0) {
    //cout << tot + maxi(r, SZ(r)) << " " << tot + cntCiclo * valorCiclo + maxi(r, extra) << endl;

    ans = max(ans, tot + maxi(r, SZ(r)));
    ans = max(ans, tot + (cntCiclo - 1) * valorCiclo + maxi(r, SZ(r)));
    ans = max(ans, tot + cntCiclo * valorCiclo + maxi(r, extra));
  } else {
    assert(extra != 0);
    ans = max(ans, tot + maxi(r, extra));
  }
  return ans;
}
Long vis[MX + 2];
Long f(Long x) {
  memset(vis, 0, sizeof vis);
  vector<Long> values;
  vector<int> index;
  x = A[x];
  while (vis[x] == 0) {
    vis[x] = 1;
    index.pb(x);
    values.pb(C[x]);
    x = A[x];
  }
  vector<Long> l, r;
  bool ok = true;
  fore(i, 0, SZ(values)) {
    if (index[i] == x) ok = false;
    if (ok)
      l.pb(values[i]);
    else
      r.pb(values[i]);
  }

  return fun(l, r);
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(NULL);
  cin >> n >> k;
  Long ans = -INF;
  fore(i, 0, n) cin >> A[i];
  fore(i, 0, n) A[i]--;
  fore(i, 0, n) cin >> C[i];
  fore(i, 0, n) {
    ans = max(ans, f(i));
  }
  cout << ans << '\n';

  return 0;
}

Measured memory_bytes: 3864
#include<bits/stdc++.h>
using namespace std;
int main()
{
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(NULL);
    double sum;
    cin>>sum;
    cout<<fixed<<setprecision(12)<<(sum/3)*(sum/3)*(sum/3)<<endl;
    return 0;
}


Measured memory_bytes: 256
# ABC 075: B – Minesweeper
h, w = [int(s) for s in input().split()]
s = [input() for _ in range(h)]

for i in range(h):
    for j in range(w):
        if s[i][j] == '.':
            bombs = 0

            if i - 1 >= 0 and s[i - 1][j] == '#':
                bombs += 1
            if i - 1 >= 0 and j - 1 >= 0 and s[i - 1][j - 1] == '#':
                bombs += 1
            if j - 1 >= 0 and s[i][j - 1] == '#':
                bombs += 1
            if i + 1 < h and j - 1 >= 0 and s[i + 1][j - 1] == '#':
                bombs += 1
            if i + 1 < h and s[i + 1][j] == '#':
                bombs += 1
            if i + 1 < h and j + 1 < w and s[i + 1][j + 1] == '#':
                bombs += 1
            if j + 1 < w and s[i][j + 1] == '#':
                bombs += 1
            if i - 1 >= 0 and j + 1 < w and s[i - 1][j + 1] == '#':
                bombs += 1
        
            s[i] = s[i][:j] + str(bombs) + s[i][j + 1:]

for i in range(h):
    print(s[i])

Measured memory_bytes: 3064
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <cstring>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <stack>
#include <cmath>
#include <time.h>
#include <unordered_set>
#include <unordered_map>
#define ll long long
#define LINF 0x3f3f3f3f3f3f3f3f
#define INF 0x3f3f3f3f
#define PI 3.14159265
#define RAND (rand()*rand())
#define MAX(x, y) ((x) > (y) ? (x):(y)) 
#define MIN(x, y) ((x) > (y) ? (y):(x))
#define ABS(x) ((x) > 0 ? (x) : -(x))
#define CEIL(x, y) (((x) + (y) - 1)/(y))
using namespace std;
const int MAXN = 1e5 + 5;
const ll MOD = 1e9 + 7;
int N, M, K, Q, T;
map<pair<int, int>, ll> mp;

int main()
{
	int i, j;
	scanf("%d", &N);
	for (i = 1; i <= N; ++i) {
		int b = i % 10;
		int temp = i;
		int a = i;
		while (1) {
			if (temp == 0) break;
			a = temp;
			temp /= 10;
		}
		if (b == 0) continue;
		mp[{a, b}]++;
	}
	ll ans = 0ll;
	for (auto it = mp.begin(); it != mp.end(); ++it) {
		int a = it->first.first;
		int b = it->first.second;
		ll cnt = mp[{b, a}];
		ans += cnt * it->second;
	}
	printf("%lld", ans);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (lli i = 0; i < (n); i++)
#define rrep(i, n) for (lli i = (n)-1; i >= 0; i--)
using namespace std;
using lli = long long int;
lli calc(lli u, lli c){
    return u / c;
}
int main() {
    lli a,b,c,d;cin >> a >> b >> c >> d;
    lli g = c / __gcd(c,d) * d;
    lli c1 = calc(b,c) - calc(a-1,c);
    lli d1 = calc(b,d) - calc(a-1,d);
    lli e1 = calc(b,g) - calc(a-1,g);
    cout << (b-a+1) - (c1 + d1 - e1) << endl;

}


Measured memory_bytes: 256
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int T = sc.nextInt();
		long ans = 0;
		sc.nextInt();
		int t, lastt = 0;
		for(int i = 1; i < N; i++) {
			t = sc.nextInt();
			if(lastt+T <= t)
				ans += T;
			else
				ans += t-lastt;
			lastt = t;
		}
		System.out.println(ans+T);
	}

}

Measured memory_bytes: 63076
import sys
from collections import defaultdict
import copy

def is_connect(adj):
    is_already = defaultdict(bool)
    is_already[list(adj.keys())[0]] = True;

    queue = []
    queue.append(1)
    while len(queue) > 0:
        v = queue.pop()
        for node in adj[v]:
            if not is_already[node]:
                is_already[node] = True
                queue.append(node)

    return all([is_already[node] for node in adj.keys()])

def solve(n,m,adj,edges):
    ans = 0
    for (v1, v2) in edges:
        tmp_adj = copy.deepcopy(adj)
        tmp_adj[v1].remove(v2)
        tmp_adj[v2].remove(v1)
        if not is_connect(tmp_adj):
            ans += 1

    return ans

def main():
    s = sys.stdin.readline().rstrip()
    lst = s.split(' ')
    n = int(lst[0])
    m = int(lst[1])

    adj = defaultdict(list)
    edges = []

    for i in range(m):
        s = sys.stdin.readline().rstrip()
        lst = s.split(' ')
        a = int(lst[0])
        b = int(lst[1])
        edges.append((a,b))
        if not b in adj[a]:
            adj[a].append(b)

        if not a in adj[b]:
            adj[b].append(a)

    ans = solve(n,m,adj,edges)
    print(ans)
    return 0

if __name__ == '__main__':
    sys.exit(main())


Measured memory_bytes: 3436
#include<bits/stdc++.h>
#define For(i,x,y) for (register int i=(x);i<=(y);i++)
#define FOR(i,x,y) for (register int i=(x);i<(y);i++)
#define Dow(i,x,y) for (register int i=(x);i>=(y);i--)
#define Debug(v) for (auto i:v) printf("%lld ",i);puts("")
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define ep emplace_back
#define siz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define fil(a,b) memset((a),(b),sizeof(a))
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pa;
typedef pair<ll,ll> PA;
typedef vector<int> poly;
inline ll read(){
    ll x=0,f=1;char c=getchar();
    while ((c<'0'||c>'9')&&(c!='-')) c=getchar();
    if (c=='-') f=-1,c=getchar();
    while (c>='0'&&c<='9') x=x*10+c-'0',c=getchar();
    return x*f;
}

int main(){
	int n=read(),m=read(),k=read();
	printf("%d\n",k/max(n,m)+(k%max(n,m)>0));
}

Measured memory_bytes: 3768
#include <bits/stdc++.h>
using namespace std;
#define array_input int n;cin>>n;int a[n+1],i;for(i=1;i<=n;i++){cin>>a[i];}
#define array_output for(i=1;i<=n;i++){cout<<a[i]<<" ";}cout<<endl;
#define INF 2147483647
#define long_INF 18446744073709551615
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef long double ld;
const double pi=acos(-1);
const double eps=1e-6;

void read(int &x)
{
    x=0;
	char c=getchar();
    while(c<'0' || c>'9')c=getchar();
    while(c>='0' && c<='9')
	{
        x=x*10+c-'0';
        c=getchar();
    }
}

void write(int x)
{
    if(x==0)
	{
		putchar(48);
		return;
	}
    int len=0,dg[20];
    while(x>0)
	{
		dg[++len]=x%10;
		x/=10;
	}
    for(int i=len;i>=1;i--)
	{
		putchar(dg[i]+48);
	}
}

int main()
{
	int n,m,x;
	cin>>n>>m>>x;
	int a[m+1],i;
	for (i=1;i<=m;i++)
	{
		cin>>a[i];
	}
	int ans1,ans2;
	ans1=0;
	ans2=0;
	for (i=1;i<x;i++)
	{
		for (int j=1;j<=m;j++)
		{
			if (i==a[j])
			{
				ans1++;
			}
		}
	}
	for (i=x+1;i<=n;i++)
	{
		for (int j=1;j<=m;j++)
		{
			if (i==a[j])
			{
				ans2++;
			}
		}
	}
	if (ans1<ans2)
	{
		cout<<ans1;
	}
	else
	{
		cout<<ans2;
	}
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;
using System.Text;

namespace Tree
{
    class Binary_Trees
    {
        struct Node
        {
            public int id;
            public int parent;
            public int depth;
            public int height;
            public int left, right;
            public int sibling;
            public int degree;
            public string type;
        }

        static void Main(string[] args)
        {
            int size = int.Parse(Console.ReadLine());
            var nodes = new Node[size];

            for (int i = 0; i < size; i++)
                nodes[i].parent = -1;

            for (int i = 0; i < size; i++)
            {
                var token = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
                var id = token[0];
                var l = token[1];
                var r = token[2];
                nodes[id].id = id;
                nodes[id].left = l;
                nodes[id].right = r;
                nodes[id].type = "leaf";
                if (l != -1)
                {
                    nodes[id].type = "internal node";
                    nodes[id].degree++;
                    nodes[l].parent = id;
                    nodes[l].sibling = r;
                }
                if (r != -1)
                {
                    nodes[id].type = "internal node";
                    nodes[id].degree++;
                    nodes[r].sibling = l;
                    nodes[r].parent = id;
                }
            }

            for (int i = 0; i < size; i++)
                if (nodes[i].parent == -1)
                {
                    nodes[i].type = "root";
                    nodes[i].sibling = -1;
                    SetDepth(nodes, i, 0);
                    break;
                }

            var str = new StringBuilder();
            for (int i = 0; i < size; i++)
            {
                str.Append("node ").Append(nodes[i].id)
                    .Append(": parent = ").Append(nodes[i].parent)
                    .Append(", sibling = ").Append(nodes[i].sibling)
                    .Append(", degree = ").Append(nodes[i].degree)
                    .Append(", depth = ").Append(nodes[i].depth)
                    .Append(", height = ").Append(nodes[i].height)
                    .Append(", ").Append(nodes[i].type).Append("\n");
            }
            Console.Write(str.ToString());
        }

        static int SetDepth(Node[] nodes, int id, int depth)
        {
            if (id == -1) return depth - 1;
            nodes[id].depth = depth;
            var lh = SetDepth(nodes, nodes[id].left, depth + 1);
            var rh = SetDepth(nodes, nodes[id].right, depth + 1);
            var h = Math.Max(lh, rh);
            nodes[id].height = h - depth;
            return h;
        }
    }
}

Measured memory_bytes: 9524
#include <iostream>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <random>
#include <string>
#include <bitset>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <cstring>
#include <cstdlib>
#include <cctype>

#define REP(i, n) for(int i = 0; i < n; ++i)
#define REPR(i, n) for(int i = n; i >= 0; --i)
#define FOR(i, m, n) for(int i = m; i < n; ++i)
#define FORR(i, m, n) for(int i = m; i >= n; --i)
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define INF 999999999

using namespace std;

typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

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

llong pow(int x, int n) {
    llong ans = x;
    if (n == 0) return 1;

    for(int i = 0; i < n - 1; i++) {
        ans *= x;
    }

    return ans;
}

void swap(int *X, int *Y){
    int t = *X; *X = *Y; *Y = t;
}

int main() {
    int n, k, d;
    bool use[10] = {false};
    cin >> n >> k;
    for (int i = 0; i < k; ++i) {
        cin >> d;
        use[d] = true;
    }

    string tmp;
    bool flag;
    for (int i = n; i <= 10 * n; ++i) {
        tmp = to_string(i);
        flag = true;
        for (int j = 0; j < tmp.size(); ++j) {
            if (use[tmp[j] - 48]) {
                flag = false;
                break;
            }
        }
        if (flag) {
            cout << i << endl;
            break;
        }
    }

    return 0;
}

Measured memory_bytes: 256
//
//  main.cpp
//  C - Traveling Salesman around Lake
//
//  Created by 李远铄 on 2020/7/15.
//  Copyright © 2020 李远铄. All rights reserved.
//

#include <iostream>
#include <cstdlib>
using namespace std;
long K;
long N;
long* A;
long* ans;
int main(int argc, const char * argv[]) {
    scanf("%ld %ld",&K,&N);
    A=(long*)calloc(N, sizeof(long));
    ans=(long*)calloc(N, sizeof(long));
    scanf("%ld",A+0);
    for (long i=1; i<N; i++) {
        scanf("%ld",A+i);
        ans[i-1]=A[i]-A[i-1];
    }
    ans[N-1]=K-A[N-1]+A[0];
    long max=0;
    for (int i=0; i<N; i++) {
        if (max<ans[i]) {
            max=ans[i];
        }
    }
    printf("%ld",K-max);
    return 0;
}


Measured memory_bytes: 6376
#define _DEBUG
#include "bits/stdc++.h"
#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0,a1,a2,a3,a4,x,...) x
#define debug_1(x1) cout<<#x1<<": "<<x1<<endl
#define debug_2(x1,x2) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<endl
#define debug_3(x1,x2,x3) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<endl
#define debug_4(x1,x2,x3,x4) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<", "#x4<<": "<<x4<<endl
#define debug_5(x1,x2,x3,x4,x5) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<", "#x4<<": "<<x4<<", "#x5<<": "<<x5<<endl
#ifdef _DEBUG
#define debug(...) CHOOSE((__VA_ARGS__,debug_5,debug_4,debug_3,debug_2,debug_1,~))(__VA_ARGS__)
#else
#define debug(...)
#endif
#define rep(index,num) for(int index=0;index<(int)num;index++)
#define rep1(index,num) for(int index=1;index<=(int)num;index++)
#define brep(index,num) for(int index=(int)num-1;index>=0;index--)
#define brep1(index,num) for(int index=(int)num;index>0;index--)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-7
#define mp(a1,a2) make_pair(a1,a2)
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef long long ll;
typedef long double ld;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=(ll)1e+18+1;
int INF=1e+9+1;
int main(){
	srand(time(NULL));
	std::chrono::system_clock::time_point start = std::chrono::system_clock::now();
	int nowtime=0;
	int TIMEMAX=2950;
	nowtime = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now() - start).count();
	int D,c[27],s[366][27];
	int t[27];
	scan(D);
	rep(i,26) scan(c[i]);
	rep(i,D){
		int smax=0,smaxj=0;
		rep(j,26){
			scan(s[i][j]);
			if(smax<s[i][j]){
				smax=s[i][j];
				smaxj=j;
			}
		}
		t[i]=smaxj;
	}
	rep(i,D){
		prin(t[i]+1);
	}
	return 0;
}


Measured memory_bytes: 3660
import numpy as np
n=int(input())
x=[]
for i in range(n):
	X=list(map(int,input().split()))
	x.append(X)
x=np.array(x)
ans=0
for i in range(n):
	for j in range(i+1,n):
		d=np.linalg.norm(x[i]-x[j]) #ベクトルの距離を計算
		ans+=d
#nc2=n*(n-1)/2
print('{:.8f}'.format(ans*2/n)) #桁数設定

Measured memory_bytes: 22156
N = int(input())
p_s = list(map(int,input().split()))
cnt = 0
for i,p in enumerate(p_s):
  if i == 0 or i == len(p_s)-1:
    continue
  else:
    if (p_s[i] < p_s[i+1] and p_s[i] > p_s[i-1]) or (p_s[i] < p_s[i-1] and p_s[i] > p_s[i+1]):
      cnt += 1
print(cnt)


Measured memory_bytes: 3060
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    n=int(input())
    s=input()
    k=int(input())
    ans=""
    sx=s[k-1]
    for ss in s:
        if ss!=sx:
            ans+='*'
        else:
            ans+=sx 
    print(ans)

if __name__=='__main__':
    main()

Measured memory_bytes: 38256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;

#define Avec vec[0] >> vec[1] >> vec[2]
#define Lrule pow(vec[0], 2) + pow(vec[1], 2)
#define Rrule pow(vec[2], 2)

int main() {
	int tri = 0; int rig = 0;
	int acu = 0; int obt = 0;
	vector<int> vec(3);
	while (cin >> Avec) {
		sort(vec.begin(), vec.end());
		if (vec[0] + vec[1] > vec[2]) {
			tri++;
			if (Lrule == Rrule) rig++;
			else if (Lrule > Rrule) acu++;
			else if (Lrule < Rrule) obt++;
		}
		else break;
	}
	cout << tri << " " << rig << " " << acu << " " << obt << endl;
	return 0;
}


Measured memory_bytes: 3132
#include <iostream>
#include <algorithm>
#include <utility>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <math.h>
#include <string.h>
#include <iomanip>
#include <numeric>
#include <cstdlib>
#include <cstdint>
#include <cmath>
#include <functional>
#include <limits>
#include <cassert>

using namespace std;


/* template */
int main (){
 string Atcoder, s , Contest ;
 cin >> Atcoder >> s >> Contest;
 cout << 'A'<< s.at(0) <<'C';
}




Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define DB long double 
DB N, K;
DB ans;

int mul(int t, int n){
    if(n >= K) return t;
    else return mul(t + 1, n * 2);
}


int main(){
    cin >> N >> K;
    for(DB i = 1; i <= N; i++){
        int t = mul(0, i);
        DB add = 1 / N;
        for(int j = 0; j < t; j++){
            add /= 2;
        }
        ans += add;
    }
    cout << fixed << setprecision(15) << ans << endl;
    return 0;
}


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

int main() {
  ll a, b, k;
  cin >> a >> b >> k;
  if (a >= k) {
    cout << a - k << " " << b << endl;
  } else if ((a < k) && ((b - (k - a)) > 0)) {
    cout << 0 << " " << b - (k - a) << endl;
  } else {
    cout << 0 << " " << 0 << endl;
  }
}

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

using namespace std;

int ans;

int main() {
	int N;
	cin >> N;
	int A[500],B[500],C[500];
	rep(i, N) {
		cin >> A[i];
	}
	rep(i, N) {
		cin >> B[i];
		ans += B[i];
	}
	rep(i, N - 1) {
		cin >> C[i];
	}

	rep(i, N - 1) {
		if (A[i] + 1 == A[i + 1]) {
			ans += C[A[i] -1];
		}
	}

	cout << ans << endl;

	return 0;
}

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

bool	issmall(char c)
{
	return (c >= 'a' && c <= 'z');
}

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

	string	s;
	cin >> s;

	if (s.at(0) != 'A' || !issmall(s.at(1)) || !issmall(s.at(s.size() - 1)))
	{
		cout << "WA" << endl;
		return (0);
	}
	bool	flag;
	flag = false;
	for (int i = 2; i < s.size() - 1; i++)
	{
		if (s.at(i) == 'C')
		{
			if (flag == false)
				flag = true;
			else
			{
				cout << "WA" << endl;
				return (0);
			}
		}
		else if (!issmall(s.at(i)))
		{
			cout << "WA" << endl;
			return (0);
		}
	}
	if (!flag)
	{
		cout << "WA" << endl;
		return (0);
	}
	cout << "AC" << endl;
}


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

int main(void){

        int k;
        char s[110];
        scanf("%d%s",&k,s);

        int len;
        len=strlen(s);

        if(len<=k){
                printf("%s\n",s);
        }else{
                //s[len] = "...";
                //s[len+1] = '\0';
                for(int i=0;i<k;i++){
                        printf("%c",s[i]);
                }   
                printf("...\n");
        }   
return 0;
}


Measured memory_bytes: 1660
import java.util.*;
 
public class Main{
	public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
      String weth = sc.nextLine();
      String out = null;
      if(weth.equals("Sunny")){
        out = "Cloudy";
      }else if(weth.equals("Cloudy")){
        out = "Rainy";
      }else{
        out = "Sunny";
      }
      System.out.println(out);
    }
}

Measured memory_bytes: 21844