akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>

using namespace std;

using ll = long long;

ll MOD = 1e9 + 7;
ll dp[100005][13];

int main(){
	string s;

	cin >> s;
	int n = s.length();

	dp[0][0] = 1;
	for (int i = 0; i < n; ++i) {
		int c;
		if (s[i] == '?') c = -1;
		else c = s[i] - '0';

		for (int j = 0; j < 10; ++j) {
			if (c != -1 && c != j) continue; // c == -1 なら全てのjについて，c != -1なら特定のj(==c)についてのみループが回る
			for (int ki = 0; ki < 13; ++ki) { // j（今見てる桁の値）について，dpテーブル縦方向に見る
				dp[i+1][(ki * 10 + j) % 13] += dp[i][ki]; // i+1番目までの桁の数のmod = (i番目までの桁の数のmod * 10 + i+1番目の桁) の mod
			}
		}
		for (int j = 0; j < 13; ++j) {
			dp[i+1][j] %= MOD;
		}
	}
	
	ll ret = dp[n][5];

	cout << ret << endl;
	
	return 0;
}

Measured memory_bytes: 10624
import java.util.*;

public class Main{

    Scanner sc = new Scanner(System.in);

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

    void run() {

        long x = sc.nextLong();

        long ans = 0;

        long base = 100;

        while (base < x) {
            base *= 1.01;
            ans++;
        }

        System.out.println(ans);
    }
}


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

map<string,int> mp;
string s;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n;
    long long ans=0;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>s;
        sort(s.begin(),s.end());
        ans+=mp[s];
        mp[s]++;
    }
    cout<<ans;
}


Measured memory_bytes: 11264
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define mod 1000000007
#define MAX 1e15
#define all(v) v.begin(),v.end()
#define rep(i,a,b) for(i=(ll)a;i<(ll)b;i++)
#define revrep(i,a,b) for(i=(ll)a;i>=(ll)b;i--)
#define ii pair<ll,ll>
#define MP make_pair
#define pb push_back
#define f first
#define se second
#define ll int
#define vi vector<ll>
ll modexp(ll a,ll b){ ll res = 1; while(b > 0){  if(b & 1) res = (res * a)%mod;  a = (a * a)%mod;  b/=2;  }  return res; }
#define rs resize
typedef tree< ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update > OST;
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cout << name << " : " << arg1 << endl;
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
#else
#define trace(...)
#endif

const ll N = 9e4 + 2;
ll a,b,c;
int main()
{
    std::ios_base::sync_with_stdio(false); cin.tie(NULL);
    cin>>a>>b>>c;
    cout<<min(b / a,c);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n); i++)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

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

//const ll INF = 1e18L + 5;
//const int INF = 1e9 + 5;
//const double pi = 3.14159265358979323846;

int 	ans = 0;
int		A, B, C;

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

	ll A, B, a, b;
	cin >> A >> B;
	a = A;
	b = B;
	for (int i = 1, j = 1; a != b;) {
		if (a > b) {
			j++;
			b = B * j;
		}
		else {
			i++;
			a = A * i;
		}
	}
	cout << a << endl;
}


Measured memory_bytes: 256
umi=[]
yama=[]
ie=[]
A=[]
N=int(input())
for i in range(N):
  a,b,c=map(int,input().split())
  umi.append(a)
  yama.append(b)
  ie.append(c)
#print("umi",umi)
#print("yama",yama)
#print("ie",ie)
DP = [[0, 0, 0] for _ in range(N+5)]
DP[0]=[umi[0],yama[0],ie[0]]
#print(DP)
for i in range(1,N):
  DP[i][0]=max((DP[i-1][1]+umi[i]),(DP[i-1][2]+umi[i]))
  DP[i][1]=max((DP[i-1][0]+yama[i]),(DP[i-1][2]+yama[i]))
  DP[i][2]=max((DP[i-1][0]+ie[i]),(DP[i-1][1]+ie[i]))

#print(DP)
print(max(DP[N-1]))

Measured memory_bytes: 81624
import java.io.{BufferedOutputStream, BufferedReader, InputStreamReader, PrintWriter}

object Main {
  def main(args: Array[String]): Unit = {
    val in = new BufferedReader(new InputStreamReader(System.in))
    val out = new PrintWriter(new BufferedOutputStream(System.out))
    val Array(a, b) = in.readLine().split("\\s+").map(_.toInt)

    out.println(
      if (a <= 5) {
        0
      } else if (a <= 12) {
        b / 2
      } else {
        b
      }
    )

    out.flush()
  }
}


Measured memory_bytes: 25412
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <stdbool.h>
#define LL long long
#define INF 1<<31-1
#define LNF 9223372036854775807
#define PI 3.14159265358979
#define MIN(x,y) ((x)<(y)?(x):(y))
#define MAX(x,y) ((x)<(y)?(y):(x))
#define FOR(i,a,n) for(i=a;i<n;i++)
#define MOD 1000000007
//#define MOD 998244353
#define NUM 200010

void swap(int* a,int* b){int tmp=*a;*a=*b;*b=tmp;}
int abs(int a){if(a<0)return -a;return a;}
int dup(int a,int d){if(a%d==0)return a/d;else return a/d+1;}
int mod(int a,int m){if(a<0)return a%m+m;else return a%m;}
LL GCD(LL a,LL b){LL c=1,tmp=MAX(a,b);b=MIN(a,b);a=tmp;while(c!=0){c=a%b;a=b;b=c;}return a;}
LL LCM(LL a,LL b){return a*b/GCD(a,b);}
int POW(int a,int n){LL ans=1;while(n>0){if(n&1)ans=ans*a%MOD;a=a*a%MOD;n>>=1;}return (int)ans;}
int icmp(const void* a,const void* b){return *(int*)a-*(int*)b;}
int lcmp(const void* a,const void* b){if(*(LL*)a>*(LL*)b)return 1;if(*(LL*)a<*(LL*)b)return -1;return 0;}
int ccmp(const void* a,const void* b){return *(char*)a-*(char*)b;}
int scmp(const void* a,const void* b){return strcmp(*(char**)a,*(char**)b);}
LL fac[NUM],finv[NUM],inv[NUM];
void comi(){int i;fac[0]=fac[1]=1;finv[0]=finv[1]=1;inv[1]=1;FOR(i,2,NUM){fac[i]=fac[i-1]*i%MOD;inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;finv[i]=finv[i-1]*inv[i]%MOD;}}
int com(int n,int k){if(n<k||n<0||k<0)return 0;return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;}

int main(){
  int K,X,i,ans=0;
  scanf("%d%d",&K,&X);
  if(500*K<X)printf("No\n");
  else printf("Yes\n");

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


Measured memory_bytes: 128
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include <bitset>
#include<math.h>
#include<map>
#include<set>
using namespace std;
typedef long long int ll;
#define bit(n,k) ((n>>k)&1) /*nのk bit目*/

const int MOD = 1000000007;
const int CMAX = 210000;

struct ModInt{
    ll a;
    ModInt() : a(0) {}
    ModInt(ll x) {
        x%=MOD;
        if(x<0) x+=MOD;
        a=x;
    }

    ModInt operator+=(const ModInt p){
        a+=p.a;
        if( a>=MOD ) a-=MOD;
        return *this;
    }
    ModInt operator-=(const ModInt p){
        a-=p.a;
        if(a<0) a+=MOD;
        return *this;
    }
    ModInt operator*=(const ModInt p){
        a=(a*p.a)%MOD;
        return *this;
    }

    ModInt operator+(const ModInt p){
        ModInt x(a);
        return x+=p;
    }
    ModInt operator-(const ModInt p){
        ModInt x(a);
        return x-=p;
    }
    ModInt operator*(const ModInt p){
        ModInt x(a);
        return x*=p;
    }
    ModInt operator=(ll p){
        p%=MOD;
        if(p<0) p+=MOD;
        a=p;
        return *this;
    }

    bool operator==(const ModInt p){
        return a==p.a;
    }

    bool operator!=(const ModInt p){
        return a!=p.a;
    }

    ModInt pow(ll N){
        ModInt ans(1),p(a);
        while(N>0){
            if(bit(N,0)){
                ans*=p;
            }
            p*=p;
            N>>=1;
        }
        return ans;
    }
    ModInt inverse(){
        return pow(MOD-2);
    }

};

ModInt Mr(ll p){
    p%=MOD;
    if(p<0) p+=MOD;
    ModInt x(p);
    return x;
}



ModInt fac[CMAX],finv[CMAX],inv[CMAX];

void COMinit(){
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    for(int i=2;i<CMAX;i++){
        fac[i]=fac[i-1]*Mr(i);
        inv[i]=Mr(MOD)-inv[MOD%i]*Mr(MOD/i);
        finv[i]=finv[i-1]*inv[i];
    }
}

ModInt COM(int n,int k){
    if(n<k) return Mr(0);
    if(n<0 || k<0) return Mr(0);
    return fac[n]*finv[k]*finv[n-k];
}

signed main(void){
    int H,W,A,B;
    cin>>H>>W>>A>>B;
    COMinit();
    ModInt ans(0);
    for(int i=0;i<=H-A-1;i++){
        ans+=COM(B+i-1,i)*COM(W-B-1+H-1-i,H-1-i);
        //cout<<ans.a<<endl;
    }
    cout<<ans.a<<endl;
}

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

#define ll long long
#define fi first
#define se second
#define mp make_pair

#define fastio() ios_base::sync_with_stdio(false);cin.tie(NULL);
#define endl "\n"

using namespace std;

void solve(){
	int k,a,b;
	cin>>k;
	cin>>a>>b;
	
	for(int i=a;i<=b;i++){
		if(i%k==0){
			cout<<"OK\n";
			return;
		}
	}
	cout<<"NG\n";
}

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

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

const int DIM = 2e3 + 5;

vector<int> edg[DIM];

void dfs( int x, int f, int d, int k, int &cnt ) {
    if( d > k / 2 )
        cnt ++;
    
    for( int y : edg[x] )
        if( y != f )
            dfs( y, x, d + 1, k, cnt );
    
    return;
}

int main( void ) {
    
    int n, k;
    cin >> n >> k;
    
    for( int i = 2; i <= n; i ++ ) {
        int x, y;
        cin >> x >> y;
        
        edg[x].push_back( y );
        edg[y].push_back( x );
    }
    
    int ans = 0x3f3f3f3f;
    for( int x = 1, cnt = 0; x <= n; x ++, cnt = 0 ) {
        if( k % 2 == 0 ) {
            dfs( x, 0, 0, k, cnt );
            ans = min( ans, cnt );
        }
        else {
            for( int y : edg[x] ) {
                cnt = 0;
                dfs( x, y, 0, k, cnt );
                dfs( y, x, 0, k, cnt );
            
                ans = min( ans, cnt );
            }
        }
    }
    
    cout << ans << endl;
    return 0;
}

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

using namespace std;

using ll = long long;

const int INF = 1e9;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    int n;
    cin >> n;
    vector< vector<int> > a(2, vector<int>(n));
    for (int i = 0; i < 2; ++i) {
        for (int j = 0; j < n; ++j) {
            cin >> a[i][j];
        }
    }

    int ans = INF;
    vector< vector< deque<int> > > ids2(2, vector< deque<int> >(51));
    for (int i = 0; i < (1 << n); ++i) {
        if (__builtin_popcount(i) % 2 == 1) continue;

        vector<int> v(n), ids(n);
        for (int j = 0; j < n; ++j) {
            v[j] = a[i >> j & 1][j];
            ids[j] = j;
        }

        sort(v.begin(), v.end());
 
        int rest = n;
        for (int j = 0; j < n; ++j) {
            ids2[j % 2][v[j]].push_back(j);
        }
 
        int memo = 0;
        vector<int> nex(n, -1);
        for (int j = 0; j < n; ++j) {
            int hoge = i >> j & 1;
            if (ids2[abs(j % 2 - hoge)][a[hoge][j]].empty()) {
                memo = INF;
                break;
            }
            memo += abs(j - ids2[abs(j % 2 - hoge)][a[hoge][j]].front());
            nex[j] = ids2[abs(j % 2 - hoge)][a[hoge][j]].front();
            ids2[abs(j % 2 - hoge)][a[hoge][j]].pop_front();
            rest--;
        }
 
        for (int j = 0; j < n; ++j) {
            ids2[j % 2][v[j]].clear();
        }
 
        if (memo >= INF || rest > 0) continue;
        memo = 0;
        for (int j = 0; j < n; ++j) {
            for (int k = 0; k < j; ++k) {
                if (nex[k] > nex[j]) memo++;
            }
        }
        ans = min(ans, memo);
    }
    cout << (ans >= INF ? -1 : ans) << "\n";
    return 0;
}


Measured memory_bytes: 384
using System;

public class Test{
    public static void Main(){
        var line1 = System.Console.ReadLine();
      	string[] str1 = line1.Split(' ');
      	//元の数
      	long n = long.Parse(str1[0]);
      	//引く数
      	long k = long.Parse(str1[1]);
      	//正の最小値
      	long plus = n % k;
      	//負の最小値
      	long minus = Math.Abs(plus-k);
        if(plus < minus){
       	  System.Console.WriteLine(plus);
        } else {
          System.Console.WriteLine(minus);
        }
    } 
}


Measured memory_bytes: 13140
#include<iostream>
using namespace std;
int main(){
    int a;
    int b;
    int c;
    
    cin >> a >> b >> c;
    
    if(a < b){
        if(b < c){
            cout << a << " " << b << " " << c <<endl;
        }else if(a < c){
            cout << a << " " << c << " " << b <<endl;
        }else{
            cout << c << " " << a << " " << b <<endl;
        }
    }
    
    else if(a < c){
        cout << b << " " << a << " " << c <<endl;
    }else if(b < c){
        cout << b << " " << c << " " << a <<endl;
    }else{
        cout << c << " " << b << " " << a <<endl;
    }
            
}


Measured memory_bytes: 3116
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<vector>
#include<functional>
#include<algorithm>
#include<stdlib.h>
#include<string>
#include<string.h>
#define _USE_MATH_DEFINES
#include<math.h>
#include<deque>
#include<set>
#include<map>
#include<queue>
#include<list>
#include<iostream>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for(auto i=a;i<b;i++)
#define all(_x) _x.begin(), _x.end()
#define r_sort(_x) sort(_x.begin(), _x.end(), std::greater<int>())
#define vec_cnt(_a, _n) (upper_bound(all(_a), _n) - lower_bound(all(_a), _n))
ll gcd(ll a, ll b) { return a % b == 0 ? b : gcd(b, a % b); }
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }
ll power(ll x, ll p) { ll a = 1; while (p > 0) { if (p % 2 == 0) { x *= x; p /= 2; } else { a *= x; p--; } }return a; }

#define INF 1 << 30
int main() {
	ll N, A, B;
	cin >> N >> A >> B;
	if (A > B)puts("0");
	else if (N == 1 && A != B)puts("0");
	else if (N == 1)puts("1");
	else printf("%lld\n", (B - A) * (N - 2) + 1);
	return 0;
}


Measured memory_bytes: 256
import math
import numpy as np

N = int(input())
A = list(map(int,input().split()))
ans = 1
A_log = A
try:
    A_log = list(map(math.log10,A))
except ValueError:
    print(0)
else:
    if sum(A_log) > 18:
        print(-1)
    else:
        for i in A:
            ans *= i
        if ans <= 1e18:
            print(ans)
        else:
            print(-1)

Measured memory_bytes: 40148
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();
		int c = sc.nextInt();
		
		if(a < b && b < c) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
	}
}



Measured memory_bytes: 26204
#include<iostream>

using namespace std;
int main() {
	int n, m;
	bool used[10][10] = {};
	bool b[10];
	cin >> n >> m;
	for (int i = 0; i < m; i++) {
		int k;
		cin >> k;
		for (int j = 0; j < k; j++) {
			int a;
			cin >> a, a--;
			used[i][a] = true;
		}

	}
	for (int i = 0; i < m; i++)cin >> b[i];
	
	int ans = 0;
	for (int i = 0; i < (1 << n); i++) {
		int cnt2 = 0;
		for (int j = 0; j < m; j++) {
			int cnt = 0;
			for (int k = 0; k < n; k++) {
				if (used[j][k] && (i & (1 << k)))cnt++;
			}
			if (cnt % 2 == b[j])cnt2++;		}
		if (cnt2 == m)ans++;

	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <bitset>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<pair<int,int>> vpii;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvc;
typedef vector<vector<string>> vvs;
#define rep(i,n) for(int i=0;i<n;i++)
#define fin(ans) cout<<(ans)<<endl
#define P 1000000007
#define STI(s) atoi(s.c_str())//string to int
#define mp(p,q) make_pair(p,q)
#define Sort(a) sort(a.begin(),a.end())
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 int INF = INT_MAX;
const long long LLINF = 1LL<<60;
//g++ -std=c++1z temp.cpp
//./a.exe
    
int main(void){ios::sync_with_stdio(false);cin.tie(0);
//////////////////////////////////////////////////////
    
  string s;

  cin >> s;

  if (s[0]=='9'||s[1]=='9')
  {
      cout << "Yes" << endl;
  }else
  {
      cout << "No" << endl;
  }
  
    


//////////////////////////////////////////////////////
return 0;}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <queue>
#include <functional>
#include <string>
#include <stack>
#include <set>
#include <sstream>
#include <iomanip>
#include <limits>
#include <cstring>

using namespace std;
using ll = long long;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, pair<ll, ll>> PP;

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll INF = 1 << 30;
const ll INF2 = 9e18;
const double INF3 = 9e14;
const int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
const int tx[8] = { -1,0,1,-1,1,-1,0,1 }, ty[8] = { -1,-1,-1,0,0,1,1,1 };
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define pb push_back
#define eb emplace_back
#define fr first
#define sc second


int main() {
	int n, a[100010], ans = 0;
	cin >> n;
	for (int i = 0;i < n;i++)cin >> a[i];
	for (int i = 0;i < n;i++) {
		if (a[i] == a[i + 1])a[i + 1] = 10000, ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
#define MOD 1000000007
#define ll long long int
#define ld long double
#define pb push_back
#define mkp make_pair
#define pii pair<int, int> 
#define pll pair<long long int, long long int>
#define sci(x) scanf("%d", &x)
#define scl(x) scanf("%lld", &x)
#define fi first
#define sc second
#define eps 1e-9
 
ll A[10001], B[10001];
multiset<ll> se, se1;

int main()
{
	ios_base::sync_with_stdio(false);cout.tie(0);cin.tie(0);
 
	ll x, y, z, i, j, n, k, q, a, b, ans = 1e18;
	cin >> n >> k >> q;
	for (i = 1; i <= n; ++i) {
		cin >> A[i];
		B[i] = A[i];
	}
	sort(B+1, B+n+1);
	
	for (i = 1; i+q-1 <= n; ++i) {
		x = B[i];
		ll cur = 0;
		ll moves = 0;
		for (j = 1; j <= n; ++j) {
			if (A[j] >= x) {
					cur += 1;
					se.insert(A[j]);
			} else {
				while (se.size() >= k) {
					se1.insert(*se.begin());
					se.erase(se.begin());
				}
				if (cur >= k) moves = moves + cur - k + 1;
				cur = 0;
				se.clear();
			}
		}
		while (se.size() >= k) {
			se1.insert(*se.begin());
			se.erase(se.begin());
		}
		if (cur >= k) moves = moves + cur - k + 1;
		se.clear();
		if (moves < q) break;
		a = *se1.begin();
		for (j = 1; j < q && !se1.empty(); ++j) {
				se1.erase(se1.begin());
		}
		b = *se1.begin();
		ans = min(ans, b-a);
		se1.clear();
	}
	cout << ans << endl;
 
	return 0;
}

Measured memory_bytes: 384
#include<stdio.h>
int main()
{
	int n;
	scanf("%d", &n);
	int i, j;
	double p[3003];
	for (i = 0; i < n; i++)
		scanf("%lf", &p[i]);
	double dp[3003][3003];
	dp[0][0] = 1;
	for (i = 1; i <= n; i++)
		dp[0][i] = 0;
	for (i = 0; i < n; i++)
	{
		dp[i + 1][0] = dp[i][0] * (1.0 - p[i]);
		for (j = 1; j <= n; j++)
			dp[i + 1][j] = dp[i][j] * (1.0 - p[i]) + dp[i][j - 1] * p[i];
	}
	double ans = 0;
	for (i = n / 2 + 1; i <= n; i++)
		ans += dp[n][i];
	printf("%.20lf\n", ans);
	return 0;
}

Measured memory_bytes: 70528
#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <functional>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <deque>
#include <ctime>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define pb push_back
#define mp make_pair
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second
#define println(X) cout<<X<<endl;
#define DBG(X) cout<<#X<<" : "<<X<<endl;
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<ll> vl;
typedef vector<vl> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll LINF = 1e18;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;
const double PI = acos(-1);


int main(){
	int n;
	cin>>n;
	vi l(2*n);
	rep(i, 2*n) cin>>l[i];
	sort(all(l));
	int ans = 0;
	rep(i, n){
		ans += min(l[2*i], l[2*i+1]);
	}
	cout<<ans<<endl;
}

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

#define For(i,x,y) for (int i=x;i<y;i++)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define lf else if

#define dprintf(...) fprintf(stderr,__VA_ARGS__)
using namespace std;

typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
typedef vector<int> Vi;

int IN(){
	int c,f,x;
	while (!isdigit(c=getchar())&&c!='-');c=='-'?(f=1,x=0):(f=0,x=c-'0');
	while (isdigit(c=getchar())) x=(x<<1)+(x<<3)+c-'0';return !f?x:-x;
}

map<ll,int> M;
ll s,ans;
int n;

int main(){
	M[0]=1;
	n=IN();
	For(i,1,n+1){
		s+=IN();
		ans+=M[s];
		M[s]++;
	}
	cout<<ans<<endl;
}

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

#define pb push_back
#define mp make_pair
#define size(n) ( int( n.size() ) )
#define sqr(n) ( (n) * (n) )
#define fi first
#define se second

using namespace std;

typedef long long ll;
typedef long double ld;

const int N = 1e5 + 5;
int a[N], cnt[N], sz = 1, tll[N*4], trr[N*4];
ll t[N*4], tcnt[N*4];

void push( int v, int tl, int tr ){
    t[v<<1] += t[v];
    t[(v<<1)+1] += t[v];
    tcnt[(v<<1)] += tcnt[v];
    int len = ( tr - tl + 1 ) >> 1;
    t[(v<<1)+1] += tcnt[v] * 1ll * len;
    tcnt[(v<<1)+1] += tcnt[v];
    t[v] = 0;
    tcnt[v] = 0;
}

void add( int v, int tl, int tr, int l, int r, int beg ){
    if ( l > r ){
        return;
    }
    if ( ( l == tl ) && ( r == tr ) ){
        t[v] += beg;
        tcnt[v]++;
        return;
    }
    push( v, tl, tr );
    int tm = ( tl + tr ) >> 1;
    if ( r <= tm ){
        add( (v<<1), tl, tm, l, r, beg );
    }
    else
    if ( l >= tm + 1 ){
        add( (v<<1) + 1, tm + 1, tr, l, r, beg );
    }
    else{
        add( (v<<1), tl, tm, l, tm, beg );
        add( (v<<1) + 1, tm + 1, tr, tm + 1, r, beg + tm + 1 - l );
    }
}

ll get( int v, int tl, int tr, int idx ){
    if ( tl == tr ){
        return t[v];
    }
    push(v,tl,tr);
    int tm = ( tl + tr ) >> 1;
    if ( idx <= tm ){
        return get( (v<<1), tl, tm, idx );
    }
    return get( (v<<1) + 1, tm + 1, tr, idx );
}

ll ans = 0;

void build( int v, int tl, int tr ){
    if ( tl == tr ){
        tll[v] = tl;
        trr[v] = tr;
        return;
    }
    tll[v] = tl;
    trr[v] = tr;
    int tm = ( tl + tr ) >> 1;
    build( (v<<1), tl, tm );
    build( (v<<1) + 1, tm + 1, tr );
}

int main(){
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    int n, m;
    scanf("%d %d",&n,&m);
    while( sz < m ){
        sz *= 2;
    }
    build( 1, 1, sz );
    for ( int i = 1; i <= n; i++ ){
        scanf("%d",&a[i]);
    }
    for ( int i = 1; i <= n - 1; i++ ){
        if ( a[i+1] >= a[i] ){
            add( 1, 1, sz, a[i] + 1, a[i+1], 0 );
        }
        else{
            add( 1, 1, sz, a[i] + 1, m, 0 );
            add( 1, 1, sz, 1, a[i+1], m - a[i] );
        }
    }
    int mxp = 0;
    ll mxv = 0, curv = 0;
    for ( int i = 1; i <= m; i++ ){
        curv = get(1,1,sz,i);
        if ( !mxp || ( mxv < curv ) ){
            mxp = i;
            mxv = curv;
        }
    }
    int x = mxp;
    for ( int i = 1; i <= n - 1; i++ ){
        if ( a[i+1] >= a[i] ){
            if ( ( x > a[i] ) && ( x <= a[i+1] ) ){
                ans += a[i+1] - x + 1;
            }
            else{
                ans += a[i+1] - a[i];
            }
        }
        else{
            if ( ( x > a[i] ) && ( x <= m ) ){
                ans += m - x + a[i+1] + 1;
            }
            else
            if ( ( x >= 1 ) && ( x <= a[i+1] ) ){
                ans += a[i+1] - x + 1;
            }
            else{
                ans += m - a[i] + a[i+1];
            }
        }
    }
    cout << ans << endl;
    return 0;
}


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

using namespace std;

using lo = long long int;
#define pb push_back
#define st first
#define nd second
#define inf (int)1e9
#define N (int)1e5 * 5
#define mod (int)1e9 + 7
#define all(x) (x).begin(), (x).end()
#define watch(x) cout << #x << " = " << x << endl
int in(){
	int a;
	cin >> a;
	return a;
}

void solve(){
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i = 0 ; i < n ; i++){
    	cin >> a[i];
    }
    vector<int> dp(1e6 + 10);
    for(int x : a){
    	if(dp[x] != 0){
    		dp[x] = 2;
    		continue;
    	}
    	for(int i = x ; i < 1e6 + 10 ; i += x){
    		dp[i]++;
    	}
    }
    int ans = 0;
    for(int x : a){
    	if(dp[x] == 1) ans++;
    }
    cout << ans << endl;
}

int main(){
    ios_base::sync_with_stdio(0); cin.tie(nullptr); cout.tie(0); cerr.tie(0);
    mt19937 rng(5);
    // freopen("gir.gir", "r", stdin);
    // freopen("cik.cik", "w", stdout);
    int t = 1;
    // cin >> t;
    while(t--){
        solve();
    }
    return 0;
}
/*

*/


Measured memory_bytes: 7928
#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <climits>
#include <iomanip>
#include <algorithm>
#include <queue>
#include <map>
#include <tuple>
#include <iostream>
#include <deque>
#include <array>
#include <set>
#include <functional>
#include <memory>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <numeric>


int main() {
	long long int s; std::cin >> s;
	constexpr long long int max = 1e9;
	if (max >= s) {
		std::cout << 0 << ' ' << 0 << ' ' << s << ' ' << 0 << ' ' << 0 << ' ' << 1 << std::endl;
	}
	else {
		auto height = (s + max - 1) / max;
		auto diff = height * max - s;
		std::cout << 0 << ' ' << 0 << ' ' << max << ' ' << 1 << ' ' << diff << ' ' << height << std::endl;
	}
}

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

int dp[1007][1007];

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

    if (n > m) for (int i = 0; i < n; i++) cout << m;
    else for (int i = 0; i < m; i++) cout << n;
}


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

int main() {
  int H, W;
  cin >> H >> W;
  vector <string> a(H);
  
  for (int i=0; i<(W+2); i++){
  cout << "#";
  }
  cout << endl;
  
  for (int i=0; i<H; i++){
    cin >> a.at(i); 
    cout << "#" << a.at(i) << "#" << endl;
  }
  
   for (int i=0; i<(W+2); i++){
  cout << "#";
  }
  cout << endl;
  
}


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
using namespace std;
long long N,M;
int main() {
	#ifdef LOACL
	freopen("in.txt","r",stdin);
	freopen("out.txt","w",stdout);
	#endif
	scanf("%lld %lld",&N,&M);
	if(N==1&&M==1) {
		printf("1\n");
	} else if(N==1) {
		printf("%lld\n",M-2);
	} else if(M==1) {
		printf("%lld\n",N-2);
	} else {
		long long ans=(N-2)*(M-2);
		printf("%lld\n",ans);
	}
	return 0;
}

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

int N; pair<int, int> S[100010];

int main() {
  cin >> N;
  for (int i = 0; i < N; i++) {
    int a, b;
    cin >> a >> b;
    S[i] = make_pair(a, b);
  }
  sort(S, S+N, [](auto a, auto b) {
    return a.first + a.second > b.first + b.second;
  });
  long tak=0, aok=0;
  for (int i = 0; i < N; i++) {
    if (i % 2 == 0) tak += S[i].first;
    else aok += S[i].second;
  }
  cout << tak - aok << endl;
}

Measured memory_bytes: 4328
#include<iostream>
#include<iomanip>
#include<string>
#include<vector>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define INF (1<<30)
#define INFLL (1LL << 60)
#define rep(i, n) for(int i=0; i<(n); ++i)

int main()
{
	int N; cin >> N;
	vector<pair<int,int>> rb(N);
	rep(i, N) {
		int x, l; cin >> x >> l;
		rb[i].first = x + l;
		rb[i].second = x - l;
	}
	auto cmpr = [](pair<int, int> a, pair<int, int> b)
	{
		if (a.first != b.first) return a.first < b.first;
		return a.second > b.second;
	};
	sort(rb.begin(), rb.end(), cmpr);
	int now = 0 - INF;
	int cnt = 0;
	rep(i, N) {
		if (rb[i].second >= now) {
			++cnt;
			now = rb[i].first;
		}
	}
	cout << cnt << endl;
	return 0;
}


Measured memory_bytes: 3672
n,m = map(int,input().split())
# 受け取った文字をスペースで分けてリスト化
a = list(input().split())
# 文字列のリストの値を整数化
a_int = [int(i) for i in a]
# 夏休みの日数がリスト内の日数の合計より多ければ残日数を表示 
if n >= sum(a_int):
    print(n - sum(a_int))
# リスト内の日数の合計が夏休みの日数より多ければ-1を表示
else:
    print("-1")

Measured memory_bytes: 10112
#include <stdio.h>

int N, K;
int R, S, P;
char T[114514];

int sumipe[114514][2];

int ayaneru(int idx, int katta) {
	int answer;
	if (idx >= N) return 0;
	if (sumipe[idx][katta]) return ~sumipe[idx][katta];

	/* 勝たない */
	answer = ayaneru(idx + K, 0);

	/* 勝つ */
	if (!katta || idx < K || T[idx - K] != T[idx]) {
		int candidate = ayaneru(idx + K, 1);
		switch (T[idx]) {
			case 'r': candidate += P; break;
			case 's': candidate += R; break;
			case 'p': candidate += S; break;
		}
		if (candidate > answer) answer = candidate;
	}

	return ~(sumipe[idx][katta] = ~answer);
}

int main(void) {
	int i;
	int inorinn = 0;
	if (scanf("%d%d", &N, &K) != 2) return 1;
	if (scanf("%d%d%d", &R, &S, &P) != 3) return 1;
	if (scanf("%114513s", T) != 1) return 1;
	for (i = 0; i < K; i++) {
		inorinn += ayaneru(i, 0);
	}
	printf("%d\n", inorinn);
	return 0;
}

/*

K周期で制限が来る
前回勝つ→次回勝てないことがある(勝てることもある)
前回勝たない→次回勝てる(勝たない場合の選択肢は2個あるので詰まない)

*/


Measured memory_bytes: 5632
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <queue>
#include <array>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <cassert>
#include <utility>
#include <functional>

using namespace std;
using lli = long long int;
template<class T, class U> void init_n(vector<T>& v, size_t n, U x) 
{ v = vector<T>(n, x); }
template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }
template<class T> void read_n(vector<T>& v, size_t n, size_t o = 0) 
{ v = vector<T>(n+o); for (lli i=o; i<n+o; ++i) cin >> v[i]; }
template<class T> void read_n(T a[], size_t n, size_t o = 0)
{ for (lli i=o; i<n+o; ++i) cin >> a[i]; }
template<class T> T gabs(const T& x) { return max(x, -x); }
#define abs gabs

lli sv, se, r;
using E = pair<lli, lli>;
vector<E> e[100001];
lli d[100001];
bool fix[100001];
int main() {
  cin >> sv >> se >> r;
  for (lli i=0; i<se; ++i) {
    lli u, v, d; cin >> u >> v >> d;
    e[u].emplace_back(d, v);
  }

  fill(begin(d), end(d), 1e15);
  d[r] = 0;
  using V = pair<lli, lli>;
  priority_queue<V, vector<V>, greater<V>> pq;
  pq.emplace(0, r);
  while (!pq.empty()) {
    V p = pq.top(); pq.pop();
    lli c = p.first, u = p.second;
    if (fix[u]) continue;
    fix[u] = true;

    for (const E& q : e[u]) {
      lli a = q.first, v = q.second;
      if (!fix[v] && c + a < d[v]) {
        d[v] = c + a;
        pq.emplace(c + a, v);
      }
    }
  }

  for (lli i=0; i<sv; ++i) {
    if (fix[i]) cout << d[i] << '\n';
    else cout << "INF\n";
  }
  return 0;
}



Measured memory_bytes: 19508
N=int(input())
A=int(input())
B=int(input())
C=int(input())
D=int(input())
E=int(input())
m=min(A,B,C,D,E)
x=N//m
if N>m*x:
  print(x+5)
else:
  print((x-1)+5)

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

int main() {
    // 標準入力から先頭の入力を受け取る
    int Apple, Piece_of_apple;
    cin >> Apple >> Piece_of_apple;

    // かけらの数の合計とそこからつくれるアップルパイの数
    int sum_of_piece, num_of_ApplePie;
    sum_of_piece = Apple * 3 + Piece_of_apple;
    num_of_ApplePie = sum_of_piece / 2;

    // 結果を出力 
    cout << num_of_ApplePie << endl;

    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1000000000LL;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


int main() {
    int n;
    cin >> n;
    vector<ll> T(n);
    rep(i, n) cin >> T[i];

    ll ans = T[0];
    for(int i=1; i<n; i++){
        ans = ans / __gcd(ans, T[i]) * T[i];
    }
    cout << ans << ln;
}
    

Measured memory_bytes: 256
//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)*) => {
        let 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 run() {
    input! {
        n: usize,
        a: [[i64; n]; n],
    }
    let mut dp = vec![0; 1 << n];
    for i in 1..(1 << n) {
        let mut sum = 0;
        for j in 0..n {
            if (i >> j) & 1 == 0 {
                continue;
            }
            for k in (j + 1)..n {
                if (i >> k) & 1 == 1 {
                    sum += a[j][k];
                }
            }
        }
        let mut x = (i - 1) & i;
        while x > (x ^ i) {
            sum = std::cmp::max(sum, dp[x] + dp[x ^ i]);
            x = (x - 1) & i;
        }
        dp[i] = sum;
    }
    println!("{}", dp[(1 << n) - 1]);
}

fn main() {
    run();
}


Measured memory_bytes: 4352
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        HashSet<String> color = new HashSet<>();
        ArrayList<Integer> list = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            int tmp = sc.nextInt();
            if(tmp < 400) color.add("gray");
            else if(tmp < 800) color.add("brown");
            else if(tmp < 1200) color.add("green");
            else if(tmp < 1600) color.add("lightbrue");
            else if(tmp < 2000) color.add("brue");
            else if(tmp < 2400) color.add("yellow");
            else if(tmp < 2800) color.add("orange");
            else if(tmp < 3200) color.add("red");
            else list.add(tmp);
        }
        int min = color.size();
        if(color.size() == 0 && list.size() > 0) min = 1;
        int max = color.size() + list.size();
        //if(max > 8) max = 8;
        System.out.println(min + " " + max);
    }
}

Measured memory_bytes: 38732
#include <bits/stdc++.h>
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    int n, m, k; cin >> n >> m >> k;
    vector<vector<char>> G(n, vector<char>(m));
    for (auto &vv : G)
        for (auto &v : vv)
            cin >> v;
    int cnt = 0;
    for (int S = 0 ; S < (1 << (n + m)) ; S++) {
        int sum = 0;
        for (int i = 0 ; i < n ; i++) {
            for (int j = 0 ; j < m ; j++) {
                if (G[i][j] == '.')
                    continue;
                if ((S >> i) & 1)
                    continue;
                if ((S >> (j + n)) & 1)
                    continue;
                sum++;
            }
        }
        if (sum == k)
            cnt++;
    }
    cout << cnt << '\n';
}

Measured memory_bytes: 3652
/*
これを入れて実行
g++ code.cpp
./a.out
 */
 
#include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>
#include <bitset>
 
using namespace std;
typedef long long ll;
typedef long double ld;
 
int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
 
const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;
 
bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}
 
ll gcd(ll a, ll b){
	if (b == 0)return a;
	return gcd(b, a % b);
}
 
ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}
 
ll nCr(ll n, ll r){
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return (nCr(n - 1, r) + nCr(n - 1, r - 1));
}
 
ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}
 
//-----------------------ここから-----------
ll memo[3300][3300];
string s, t;
ll dp(int i, int j){
    if(i <= 0 || j <= 0) return memo[i][j] = 0;
    if(memo[i][j] != -1) return memo[i][j];


    ll res = 0;
    if(s[i - 1] == t[j - 1]){
        res = max(res, dp(i - 1, j - 1) + 1);
    }
    res = max(res, dp(i - 1, j));
    res = max(res, dp(i, j - 1));

    return memo[i][j] = res;
}

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

    for(int i = 0; i <= s.size(); i++){
        for(int j = 0; j <= t.size(); j++){
            memo[i][j] = -1;
        }
    }

    dp(s.size(), t.size());

    int i = s.size();
    int j = t.size();

    string ans = "";
 
    while(i > 0 && j > 0){
        if(memo[i][j] == memo[i - 1][j]){
            i--;
        } else if(memo[i][j] == memo[i][j - 1]){
            j--;
        } else {
            ans = s[i - 1] + ans;
            i--;
            j--;
        }
    }
 
    cout << ans << endl;
}

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

typedef unsigned long long ull;

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

    if (n == 1 && m == 1)
    {
        cout << 1 << endl;
    }
    else if (n == 1)
    {
        cout << m-2 << endl;
    }
    else if (m == 1)
    {
        cout << n-2 << endl;
    }
    else
    {
        cout << (n-2)*(m-2) << endl;
    }
    
}

Measured memory_bytes: 256
package main

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

var (
	readString func() string
	readBytes  func() []byte
	stdout     *bufio.Writer
)

func init() {
	readString, readBytes = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) (func() string, func() []byte) {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	f1 := func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
	f2 := func() []byte {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Bytes()
	}
	return f1, f2
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(readString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(stdout, f, args...)
}

func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(stdout, args...)
}

func eprintln(args ...interface{}) (int, error) {
	return fmt.Fprintln(os.Stderr, args...)
}

func eprintf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(os.Stderr, f, args...)
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func min64(a, b int64) int64 {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a < b {
		return b
	}
	return a
}

func max64(a, b int64) int64 {
	if a < b {
		return b
	}
	return a
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

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

func gcd(a, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}

func gcd64(a, b int64) int64 {
	if b == 0 {
		return a
	}
	return gcd64(b, a%b)
}

// readString() string
// readInt() int
// readInt64() int64
// readFloat64() float64

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

func main() {
	defer stdout.Flush()
	P:=readInt()
	Q:=readInt()
	R:=readInt()

	println(min(P+Q, min(Q+R, R+P)))

}

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


Measured memory_bytes: 640
import math

a,b,C = map(int, input().split(' '))
S = a * b * math.sin(math.radians(C)) / 2
H = (2 * S) / a
L = (a**2 + b**2 - (2*a*b*math.cos(math.radians(C))))**(1/2) + a + b
print(S)
print(L)
print(H)


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

using namespace std;

#define REP(i, N) for (int i = 0; i < (int)N; i++)
#define RREP(i, N) for (int i =(int)N-1; i >= 0; i--)
#define FOR(i, a, b) for (int i = a; i < (int)b; i++)
#define ALL(x) (x).begin(), (x).end()
#define INF (1 << 30)
#define LLINF (1LL << 62)
#define DEBUG(...) debug(__LINE__, ":" __VA_ARGS__)

typedef long long ll;
typedef pair<int, int> Pii;
typedef pair<ll, ll> Pll;

int main(){
  int a,p;
  cin>>a>>p;
  int sum=3*a+p;
  cout<<sum/2<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <cmath>
#include <deque>
#include <iterator>
#include <map>
#include <queue>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
using namespace std;

#define EPS (1e-10)
using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
#define equals(a, b) (fabs((a) - (b)) < EPS)
template<class T> inline bool chmax(T& a, T b) {if (a<b) {a=b; return true;} return false;}
template<class T> inline bool chmin(T& a, T b) {if (a>b) {a=b; return true;} return false;}

const ll MOD = 1000000007;
const ll HIGHINF = 1e18;

// 点を表すクラス
class Point{
public:
  double x, y;
  Point(double x=0, double y=0): x(x), y(y) {}

  Point operator + (Point p) {return Point(x+p.x, y+p.y);}
  Point operator - (Point p) {return Point(x-p.x, y-p.y);}
  Point operator * (double a) {return Point(a*x, a*y);}
  Point operator / (double a) {return Point(x/a, y/a);}

  double abs() {return sqrt(norm());}
  double norm() {return x*x + y*y;}

  bool operator < (const Point &p) const {
    return x != p.x ? x < p.x: y < p.y;
  }

  bool operator == (const Point &p) const {
    return fabs(x - p.x) < EPS && fabs(y - p.y) < EPS;
  }
};
typedef Point Vector;  // ベクトルを表す構造体（成分表示）

double dot(Vector a, Vector b) {  // ベクトルの内積
  return a.x*b.x + a.y*b.y;
}
double cross(Vector a, Vector b) {  // ベクトルの外積
  return a.x*b.y - a.y*b.x;
}

struct Segment {Point p1, p2;};  // 線分を表す構造体(p1:始点、p2:終点)
typedef Segment Line;  // 直線を表す構造体（直線は無限長にする必要あり）

// 直交判定
bool isOrthogonal(Vector a, Vector b) {  // ベクトル同士の直交判定
  return equals(dot(a, b), 0.0);
}
bool isOrthogonal(Point a1, Point a2, Point b1, Point b2) {  // a1とa2、b1とb2をそれぞれ端点にもつ線分の直交判定
  return isOrthogonal(a1-a2, b1-b2);
}
bool isOrthogonal(Segment s1, Segment s2) {  // 線分s1、s2の直交判定
  return equals(dot(s1.p2-s1.p1, s2.p2-s2.p1), 0.0);
}

// 平行判定
bool isParallel(Vector a, Vector b) {  // ベクトル同士の平行判定
  return equals(cross(a, b), 0.0);
}
bool isParallel(Point a1, Point a2, Point b1, Point b2) {  // a1とa2、b1とb2をそれぞれ端点にもつ線分の平行判定
  return isParallel(a1-a2, b1-b2);
}
bool isParallel(Segment s1, Segment s2) {  // 線分s1、s2の平行判定
  return equals(cross(s1.p2-s1.p1, s2.p2-s2.p1), 0.0);
}

class Circle {  // 円を表す構造体
public:
  Point c;  // 中心
  double r;  // 半径
  Circle(Point c=Point(), double r=0.0): c(c), r(r) {}
};

typedef V<Point> Polygon;  // 多角形を表す構造体（頂点座標の配列）

int main() {
  ll n; cin >> n;
  REP(i, n) {
    ll x0, y0, x1, y1, x2, y2, x3, y3;
    cin >> x0 >> y0 >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
    if (isOrthogonal(Point(x0, y0), Point(x1, y1), Point(x2, y2), Point(x3, y3)))
      cout << 1 << endl;
    else if (isParallel(Point(x0, y0), Point(x1, y1), Point(x2, y2), Point(x3, y3)))
      cout << 2 << endl;
    else cout << 0 << endl;
  }
  return 0;
}



Measured memory_bytes: 3108
import numpy as np

def slove(c):
    diff1_1 = c[0,0] - c[0,1]
    diff1_2 = c[0,1] - c[0,2]
    diff2_1 = c[1,0] - c[1,1]
    diff2_2 = c[1,1] - c[1,2]
    diff3_1 = c[2,0] - c[2,1]
    diff3_2 = c[2,1] - c[2,2]

    if not(diff1_1 == diff2_1 == diff3_1):
        return "No"

    if not(diff1_2 == diff2_2 == diff3_2):
        return "No"

    return "Yes"


if __name__ == "__main__":
    c_lst = []
    for i in range(3):
        c_lst.append(input().split(" "))
    c = np.array(c_lst, dtype=int)
    print(slove(c))

Measured memory_bytes: 21708
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long int   ll;
#define INF             1e14
#define dd              double
#define MOD             1000000007
#define my_sizeof(type) ((char *)(&type+1)-(char*)(&type)) 
#define nl              cout<<endl
#define fill(a,val)     memset(a,val,sizeof(a))
#define mp              make_pair
#define endl            "\n"
#define pb              push_back
#define ff              first    
#define ss              second
#define SIZE            200005
#define all(v)          v.begin(),v.end()
#define s(ar,n)         sort(ar,ar+n)
#define rs(ar,n)        sort(ar, ar+n, greater<ll>()) 
#define oa(a,n)         for(ll i=0;i<n;i++)cout<<a[i]<<" ";nl
#define cn(a,n)         for(ll i=0;i<n;i++)cin>>a[i];
#define maxa(ar,N)      *max_element(ar,ar+N)
#define mina(ar,N)      *min_element(ar,ar+N)
#define fastio()        ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define printclock      cerr<<"Time : "<<1000*(long double)clock()/(long double)CLOCKS_PER_SEC<<"ms\n";
typedef tree<pair<ll,ll>, null_type, less<pair<ll,ll>>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
ll power(ll x, ll y){
    ll res=1;x=x;
    while(y>0){
        if(y&1)
            res = (res*x);
        y = y>>1;
        x = (x*x);
    }
    return res;
}  
ll logtwo(ll n){
    if(n==1)
        return 0;
    return logtwo(n/2)+1;
}
signed main()
{
    fastio();   
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif
    int t=1;
    //cin>>t;
    while(t--)
    {
        ll N,K;
        cin>>N>>K;
        ll ar[N];
        for(ll i=0;i<N;i++)
        {
            cin>>ar[i];
            ar[i]--;
        }
        vector<ll> pos;
        pos.pb(0);
        map<ll,ll> ma;
        ma[0]=1;
        ll cur=0;
        ll pk=0;
        for(ll i=0;i<K;i++)
        {
            cur=ar[cur];
            if(ma[cur]==0)
            {
                ma[cur]=pos.size()+1;
                pos.pb(cur);
            }
            else
            {
                pk=ma[cur];
                break;
            }
        }   
        if(pk==0)
        {
            cout<<pos[K]+1<<endl;
            return 0;
        }
        ll M=pos.size();
        K-=M;
        M-=(pk-1);
        K=K%M;
        cout<<pos[K+pk-1]+1<<endl;
    }
}

Measured memory_bytes: 15968