akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define ll long long int
#define ld long double
#define pb push_back
#define ss second
#define ff first
#define INF 300000000000001
#define ll_max 9000000000000000001
#define mod 998244353
#define PI 3.14159265358979323846L
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;
typedef vector<pair<ll,ll> > vll;
typedef vector<pair<int,int> > vii ;
typedef pair<ll,ll> pll;
const ll N = 100001;
const ll M = 1;

struct point {
    ll x, y;
};

ll fast_exp(ll x, ll n)
{
    if(n == 0) return 1;
    else if(n & 1)
        return fast_exp(x, n - 1) * x % mod;
    else
    {
        ll tmp = fast_exp(x, n >> 1);
        return tmp * tmp % mod;
    }
}

int main()
{
    fast;
    int _ = 1;
    //cin >> _;
    while(_--)
    {
        ll n, m = 0, ans = 0, x, y, k;
        cin >> n >> m;
        bool a[n][m];
        ll dp[n][m];
        char c;
        for(int i = 0; i < n; i++)
        {
            for(int j = 0; j < m; j++)
            {
                cin >> c;
                if(c == '.') a[i][j] = 1;
                else a[i][j] = 0;
                dp[i][j] = INF;
            }
        }
        if(a[n - 1][m - 1] == 0)
            dp[n - 1][m - 1] = 1;
        else dp[n - 1][m - 1] = 0;
        for(int i = n - 1; i > -1; i--)
        {
            for(int j = m - 1; j > -1; j--)
            {
                if(i == n - 1 && j == m - 1) continue;
                if(i == n - 1)
                {
                    if(a[i][j + 1])
                        dp[i][j] = dp[i][j + 1] + !a[i][j];
                    else
                        dp[i][j] = dp[i][j + 1];
                }
                else if(j == m - 1)
                {
                    if(a[i + 1][j])
                        dp[i][j] = dp[i + 1][j] + !a[i][j];
                    else
                        dp[i][j] = dp[i + 1][j];
                }
                else
                {
                    if(a[i][j + 1])
                        dp[i][j] = dp[i][j + 1] + !a[i][j];
                    else
                        dp[i][j] = dp[i][j + 1];
                    if(a[i + 1][j])
                        dp[i][j] = min(dp[i + 1][j] + !a[i][j], dp[i][j]);
                    else
                        dp[i][j] = min(dp[i + 1][j], dp[i][j]);
                }
            }
        }
        cout << dp[0][0] << "\n";
    }
    return 0;
}


Measured memory_bytes: 384
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
d = LIST()
sum = 0

for i in range(N-1):
  for j in range(i+1, N):
    sum += d[i]*d[j]
    
print(sum)

Measured memory_bytes: 5148
#include<bits/stdc++.h>
using namespace std;
#define    sz    100110
#define    ll    long long int
ll n,c=0,p,q,k;
ll num[sz];
ll vis[sz];
ll dp[sz];


ll tani(ll pos)
{
    ll mn=100000000000;

    if(pos>=n )return 0;
    if(vis[pos]==1)return dp[pos];

    vis[pos]=1;

    for(ll i=1; i<=k ; i++)
    {
        mn=min(mn,abs(num[pos]-num[pos+i])+tani(pos+i));
    }
   // cout<<mn<<endl;
    return dp[pos]=mn;
}

int main()
{
    ll t,i;

    for(i=1; i<sz; i++)num[i]=10000000000;

    cin>>n>>k;

    for(i=1; i<=n; i++)
    {
        cin>>num[i];
    }
    t=tani(1);
    cout<<t<<endl;
    return 0;
}



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

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

int main(){
    int n,l;
    cin >> n >> l;
    int tastes[n];
    for(int i=0;i<n;i++){
        tastes[i] = (l)+(i+1)-1;
    }
    int best = 0;
    for(int i=0;i<n;i++) best+=tastes[i];
    int last = 99999999;
    int max_sum = 0, sum;
    for(int i=0;i<n;i++){
        sum = 0;
        for(int j=0;j<n;j++){
            if(j==i) continue;
            //cout << tastes[j] << endl;
            sum+=tastes[j];
        }
        //cout << ":: " << sum << endl;
        if(abs(best-sum)<last){
            max_sum = sum;
            last = abs(best-sum);
        }
    }

    cout << max_sum << endl;
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
using namespace std;
typedef long long LL;
const int SIZEN = 100010;
const LL mod = 1e9+7;
LL qpow(LL x,LL len){
    LL ret = 1;
    for(;len;len>>=1){
        if(len & 1)ret = ret * x % mod;
        x = x * x % mod;
    } 
    return ret;
}
LL fac[SIZEN];
LL inv[SIZEN];
int N,K;
LL A[SIZEN];
LL ans = 0;
LL C(int n,int m){
    if(m > n)return 0;
    return fac[n] * inv[m] % mod * inv[n-m] % mod;
}
int main(){
    scanf("%d%d",&N,&K);
    for(int i = 1;i <= N;i++)scanf("%lld",&A[i]);
    sort(A+1,A+1+N);
    fac[0] = 1;
    for(int i = 1;i <= N;i++)fac[i] = fac[i-1] * i % mod;
    inv[N] = qpow(fac[N],mod-2);
    for(int i = N-1;i >= 0;i--)inv[i] = inv[i+1] * (i+1) % mod;
    for(int i = 1;i <= N;i++){
        ans = (ans + (C(i-1,K-1) - C(N-i,K-1) + mod) % mod * A[i] % mod) % mod;
    }
    ans = (ans + mod) % mod;
    printf("%lld\n",ans);
    return 0;
}

Measured memory_bytes: 3952
#include"bits/stdc++.h"
#define int long long
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define itr(i,x) for(auto i=(x).begin();i!=(x).end();++i)
#define All(x) (x).begin(),(x).end()
#define gridif(a,x,b) if((a)<=(x)&&(x)<(b))

using namespace std;
using Graph = vector<vector<int>>;
typedef pair<int,int> P;
const int mod=1000000007;

int digitsum(int n,int b){
	if(b<2) return -1;
	if(n<b) return n;
	return digitsum(n/b,b)+n%b;
}
int mpow(int a,int x);
int m_inv(int n);
vector<int> split(int n,int a);
string xal_number(int n,int x);
int gcd(int x,int y){return y?gcd(y,x%y):x;}
int lcm(int x,int y){return x*y/gcd(x,y);}
class Factorial{
private:
	vector<int> fac;
public:
	Factorial(int N){
		fac.push_back(1);
		rep(i,N) fac.push_back(fac[i]*(i+1)%mod);
	}
	int fact(int a){return fac[a];}
	int ifac(int a){return m_inv(fac[a]);}
	int cmb(int n,int r);
};
struct UnionFind {
    vector<int> par; // 親ノード
    UnionFind(int n = 1) { init(n);}
    void init(int n = 1) {
        par.resize(n);
        rep(i,n) par[i] = -1;
    }
    int root(int x) {
        if (par[x] <0) return x;
        else return par[x] = root(par[x]);      
    }
    int size(int x){ return -par[root(x)];}
    bool issame(int x, int y) {return root(x)==root(y);}
    bool connect(int x, int y);
};

signed main(){
	int x,y;
	cin>>x>>y;
	UnionFind uni(13);
	uni.connect(1,3);uni.connect(1,5);uni.connect(1,7);uni.connect(1,8);uni.connect(1,10);uni.connect(1,12);
	uni.connect(4,6);uni.connect(4,9);uni.connect(4,11);
	if(uni.issame(x,y)) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}

int mpow(int a,int x){
	int ans=1;
	while(x>0){
		if(x%2==1) (ans*=a)%=mod;
		(a*=a)%=mod;
		x>>=1;
	}
	return ans;
}
int m_inv(int n){return mpow(n,mod-2);}
vector<int> split(string s,int a){
	if(a<0||a>s.length()) return {-1,-1};
	string l="0",r="0";
	if(a!=0) l=s.substr(0,a);
	if(a!=s.length()) r=s.substr(a);
	return{stoll(l),stoll(r)};
}
int Factorial::cmb(int n,int r){
		if(n<r) return 0;
		if(r==0||r==n) return 1;
		return fac[n]*ifac(r)%mod*ifac(n-r)%mod;
}
string xal_number(int n,int x){
	if(x>36) return "out of use";
	if(n==0) return "";
	string s;
	int i=n%x;
	char a = i + ( i >= 10 ? 'A'-10 : '0' );
	s=xal_number(n/x,x)+a;
	return s;
}

bool UnionFind::connect(int x,int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (size(x) < size(y)) swap(x, y);
        par[x] += par[y];
        par[y] = x;
        return true;
}

Measured memory_bytes: 256
Num = int(input())
stack =0
Min = 100000000000

for i in range(1,Num):
    Num_Array = [Num - i , i]

    for x in range(2):
        while not 0 <= Num_Array[x] < 1:
             stack +=  Num_Array[x] % 10
             Num_Array[x] = int(Num_Array[x] / 10)
    if Min > stack:
        Min = stack

    stack = 0
print(Min)

Measured memory_bytes: 3060
import qualified Data.ByteString.Char8 as BS
import Data.Char
import Data.List
import Data.Maybe

readString = map BS.unpack . BS.words
readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words

getString = readString <$> BS.getLine
getIntList = readIntList <$> BS.getLine

isIntList :: String -> Bool
isIntList = all isDigit

main = do
  [a, b] <- getIntList
  [s] <- getString
  let sa = take a s
  let remain = drop a s
  let hyphen = head remain
  let sb = tail remain
  if isIntList sa && hyphen == '-' && isIntList sb
    then putStrLn "Yes"
    else putStrLn "No"


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

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

	long long ans = 0, cnt = 0;
	if (k % 2 == 0) {
		for (int i = 1; i <= n; i++) {
			if (i % k == (k / 2))cnt++;
		}
	}
	ans += cnt * cnt * cnt;
	cnt = 0;
	for (int i = 1; i <= n; i++) {
		if (i % k == 0)cnt++;
	}
	ans += cnt * cnt * cnt;
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include "iostream"
#include "algorithm"
#include "string"
#include "vector"
#include "cmath"
using namespace std;

int main() {
	string s;
	int w;
	cin >> s >> w;
	for (int i = 0; i < s.length(); i += w)
		cout << s[i];
	cout << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
using namespace std;
int main(){
	while(1){
		int n,m,p,x;
		int sum=0;
		int memo;
		cin >>n>>m>>p;
		if(n==0&&m==0&&p==0) break;
		for(int i =1;i<=n;i++){
			cin>>x;
			sum+=x;
			if(i==m) memo =x;
		}
		if(memo !=0)sum = sum*(100-p)/memo;
		else sum =0;
		cout <<sum <<endl;
	}


	return 0;
}

Measured memory_bytes: 1160
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;

int main(){
  int N,T;
  cin >> N >> T;
  int t[N];
  for(int i=0;i<N;i++) cin >> t[i];

  ll sum = 0LL;
  for(int i=0;i<N;i++){
    if(i == N-1){
      sum += T;
    } else {
      if(t[i+1] - t[i] < T){
        sum += t[i+1] - t[i];
      } else {
        sum += T;
      }
    }
  }

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


Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cassert>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define rep(i,n) FOR(i,0,n)
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define vint vector<int>
#define vdouble vector<double>
#define vstring vector<string>
using namespace std;

#include<map>
#include<set>
#include<queue>

typedef long long ll;
typedef unsigned long long ull;

const int MAX_N = 1000000;
const int INFTY = (1 << 21); // 2097152
// const ll INFTY = (1LL << 60);
const ll MD = 1000000007LL;
// fprintf(stderr, "%d %lld \n", x, xll);


int N;
string S1, S2;

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

	vector<int> V;
	V.push_back(0);
	{
		int i = 0;
		while(i < S1.size()){
			if(S1[i] == S2[i]){
				V.push_back(1);
				i += 1;
			}
			else{
				V.push_back(2);
				i += 2;
			}
		}
	}

	ll ret = 1;
	for(int i = 0; i < V.size() - 1; i++){
		if(V[i] == 0 && V[i+1] == 1) ret *= 3;
		if(V[i] == 0 && V[i+1] == 2) ret *= 6;
		if(V[i] == 1 && V[i+1] == 1) ret *= 2;
		if(V[i] == 1 && V[i+1] == 2) ret *= 2;
		if(V[i] == 2 && V[i+1] == 1) ret *= 1;
		if(V[i] == 2 && V[i+1] == 2) ret *= 3;
		ret %= MD;
	}

	cout << ret << endl;
}

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

using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)

int main()
{
    lint x1,y1,x2,y2;
    cin >> x1 >> y1 >> x2 >> y2;
    lint x, y;
    x = x2 - x1;
    y = y2 - y1;
    lint x3 = x2 - y,y3 = y2 + x;
    lint x4 = x1 - y, y4 = y1 + x;
    lint ans=0;
    cout << x3 << " " << y3 << " " << x4 << " " << y4 << "\n";
    return 0;
}

Measured memory_bytes: 256
/*
gcc compile command
gcc a.c -o a
*/

/* Includes */
#include <stdio.h>

/* Prototypes */
void InputNum(void);
void CalcSum(void);
void OutputNum(void);

/* Valuables */
char input_num[1000][1001];
int count;
int output_num[1000];

/* Main */

int main ()
{
    InputNum();

    CalcSum();

    OutputNum();
}

/* Sub */
void InputNum(void)
{
    for (int i = 0; i < 1000; i++) {

        scanf("%s", input_num[i]);

        if (input_num[i][0] == '0') {
            count = i;
            break;
        }
        else {
            /* NOP */
        }
    }
}

void CalcSum(void)
{
    for (int i = 0; i < count; i++) {

        for (int j = 0; j < 1001; j++) {

            if ((int)input_num[i][j] == 0) {
                /* NOP */
            }
            else {

                output_num[i] += ((int)input_num[i][j] - 48);

            }
        }
    }
}

void OutputNum(void)
{
    for (int i = 0; i < count; i++) {

        printf("%d\n", output_num[i]);

    }
}


Measured memory_bytes: 2052
import sys
import math

#https://atcoder.jp/contests/agc008/submissions/15248942
sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inm = lambda: map(int, sys.stdin.readline().split())
inl = lambda: list(inm())
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw))

abc = inl()

ans = sum(abc)
max_n = max(abc)

print(ans - max_n + max_n*10)



Measured memory_bytes: 9184
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("-ffloat-store") // to restrict undesirable precision
#pragma GCC optimize ("-fno-defer-pop")// to pop argument of function as soon as it returns
#define all(a) a.begin(),a.end()
#define ll long long int
#define ld long double
ll power(ll a,ll b,ll m){ if(b==0) return 1; if(b==1) return a%m; ll t=power(a,b/2,m)%m; t=(t*t)%m; if(b&1) t=((t%m)*(a%m))%m; return t;}
ll modInverse(ll a, ll m) { return power(a, m-2, m); }
#define ps push_back
#define fs first
#define sc second
#define takeline cin.ignore();
#define iactive cout.flush();
#define N 1000005
#define endl "\n"
#define mod 1000000007
#define PI 3.141592653589793
//((1.0l)*BIG MULTIPLY MAGIC?)
// string to integer stoi()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();
//-----------------------------------------------
int main(){
   
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

    ll i,j,n;
    cin>>n;
    if(n>=400&&n<=599){
    	cout<<"8"<<endl;
    }
    if(n>=600&&n<=799){
    	cout<<"7"<<endl;
    }
    if(n>=800&&n<=999){
    	cout<<"6"<<endl;
    }
    if(n>=1000&&n<=1199){
    	cout<<"5"<<endl;
    }
    if(n>=1200&&n<=1399){
    	cout<<"4"<<endl;
    }
    if(n>=1400&&n<=1599){
    	cout<<"3"<<endl;
    }
    if(n>=1600&&n<=1799){
    	cout<<"2"<<endl;
    }
    if(n>=1800&&n<=1999){
    	cout<<"1"<<endl;
    }
    return 0;   
}

Measured memory_bytes: 3652
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	void run() {
		Scanner sc = new Scanner(System.in);
		int H = sc.nextInt();
		int W = sc.nextInt();
		int[][] c = new int[10][10];
		int[][] A = new int[H][W];
		for(int i = 0; i < 10; i++) {
			for(int j = 0; j < 10; j++) {
				c[i][j] = sc.nextInt();	
			}		
		}
		for(int i = 0; i < H; i++) {
			for(int j = 0; j < W; j++) {
				A[i][j] = sc.nextInt();
			}
		}
		/*	ワーシャル フロイド 
		 *	int[] dist = new int[n][n];
		 *	dist[i][j]は頂点i→頂点jの距離を入力しておく 
		 *	ただし、i,j間がつながっていないときはdist[i][j] = ∞
		 *
		 *	処理後、dist[i][j]はij間の最短経路となる
		 *
		 *	計算量 : O(V^3)
		 */

		for (int k = 0; k < 10; k++) {
			for (int i = 0; i < 10; i++) {
				for (int j = 0; j < 10; j++) {
					c[i][j] = Math.min(c[i][j], c[i][k] + c[k][j]);
				}
			}
		}
		int sum = 0;
		for(int i = 0; i < H; i++) {
			for(int j = 0; j < W; j++) {
				if(A[i][j] == -1) continue;
				else sum += c[A[i][j]][1];
			}
		}
		System.out.println(sum);
		sc.close();
	}

	void debug(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}

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

Measured memory_bytes: 48504
a,b,k=map(int,input().split())
for i in range(k):
	if i%2==0:
		if a%2!=0:
			a-=1
		a,b=a//2,b+a//2
	else:
		if b%2!=0:
			b-=1
		a,b=a+b//2,b//2
print(a,b)

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

#ifndef LOCAL_
#define fprintf if( false ) fprintf
#endif // LOCAL_
#define dump() fprintf(stderr, "#%s.%d\n", __func__, __LINE__);
#define dumpl(x1) fprintf(stderr, "#%s.%d (%s) = (%ld)\n", __func__, __LINE__, #x1, x1);
#define dumpll(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%ld, %ld)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define dumplll(x1, x2, x3) fprintf(stderr, "#%s.%d (%s, %s, %s) = (%ld, %ld, %ld)\n", __func__, __LINE__, #x1, #x2, #x3, x1, x2, x3);
#define dumpd(x1) fprintf(stderr, "#%s.%d (%s) = (%lf)\n", __func__, __LINE__, #x1, x1);
#define dumpdd(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%lf, %lf)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define loop for(;;)
typedef int64_t Int;
typedef std::vector<Int> LI;
const double pi = 3.14159265358979323846264338;
const Int mod = 1000000007;

template<typename T> void scan1(T& x) { fprintf(stderr, "unknown type\n"); }
template<> void scan1(Int& x) { if( scanf("%" PRId64, &x) < 0 ) exit(0); }
template<> void scan1(std::string& x) { if( not ( std::cin >> x ) ) exit(0); }
template<> void scan1(LI& xs) { for(Int &x : xs) scan1(x); }
void scan() {}
template<typename Head, typename... Tail>
void scan(Head& x, Tail&... xs) {
  scan1(x); scan(xs...);
}

template<typename T>
struct Q003 {
   Int n, offset;
   T e;
   std::function<T(T,T)> f;
   std::vector<T> xs;
   Q003(Int n_, T e_, std::function<T(T,T)> f_)
      : n(vecSize(n_)), offset(n/2), e(e_), f(f_), xs(n, e) {}
   static Int vecSize(Int x) {
      Int t = 1;
      while( t < x ) t *= 2;
      return 2 * t;
   }
   void update(Int i, T x) {
      Int k = i + offset;
      xs[k] = x;
      update(k>>1);
   }
   void update(Int i, std::function<T(T)> g) {
      Int k = i + offset;
      xs[k] = g(xs[k]);
      update(k>>1);
   }
   void update(Int k) {
      if( k == 0 ) return;
      xs[k] = f(xs[k<<1], xs[(k<<1)+1]);
      update(k>>1);
   }
   T query(Int x, Int y) {
      return query2(1, x, y, 0, offset);
   }
   T query2(Int k, Int x, Int y, Int a, Int c) {
      if( y <= a or c <= x ) return e;
      if( offset <= k ) return xs[k];
      if( x <= a and c <= y ) return xs[k];
      Int b = (a + c) / 2;
      return f(query2(k<<1, x, y, a, b), query2((k<<1)+1, x, y, b, c));
   }
};

struct Solver {
   Solver() { fprintf(stderr, "--------Solver begin--------\n"); }
   ~Solver() { fprintf(stderr, "--------Solver end--------\n"); }
   void solve() {
      Int n, q; scan(n, q);
      Q003<Int> rmq(n, (1LL<<31)-1, [](Int x, Int y){ return std::min(x, y); });
      for(Int i = 0; i < q; ++i) {
         Int c, x, y; scan(c, x, y);
         if( c == 0 ) {
            rmq.update(x, y);
         }
         if( c == 1 ) {
            Int z = rmq.query(x, y + 1);
            printf("%ld\n", z);
         }
      }
   }
};

int main() {
   loop std::unique_ptr<Solver>(new Solver())->solve();
}

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

typedef long long ll;

const int Maxn = 100005;

int n;
ll m;
int q;
int par[Maxn], siz[Maxn];
int a[Maxn], b[Maxn], c[Maxn];

int getPar(int x) { return par[x] == x? x: par[x] = getPar(par[x]); }

bool unionSet(int a, int b)
{
    a = getPar(a), b = getPar(b);
    if (a == b) return false;
    if (siz[a] < siz[b]) swap(a, b);
    siz[a] += siz[b]; par[b] = a;
    return true;
}

int main()
{
    scanf("%d %lld %d", &n, &m, &q);
    for (int i = 0; i < n; i++)
        par[i] = i, siz[i] = 1;
    bool was1 = false;
    for (int i = 0; i < q; i++) {
        scanf("%d %d %d", &a[i], &b[i], &c[i]);
        if (c[i] == 0) {
            if (unionSet(a[i], b[i])) m--;
        } else was1 = true;
    }
    for (int i = 0; i < q; i++) if (c[i] == 1)
        if (getPar(a[i]) == getPar(b[i])) { printf("No\n"); return 0; }
    int cnt = 0;
    for (int i = 0; i < n; i++)
        if (getPar(i) == i) cnt++;
    ll lef = ll(was1) + ll(cnt - 1);
    ll rig = ll(cnt) * (cnt - 1) / 2;
    if (lef <= m && m <= rig)
        printf("Yes\n");
    else printf("No\n");
    return 0;
}


Measured memory_bytes: 2176
from itertools import combinations

# 全ての部分集合の列挙
def subset_family(items, length):
    subsets = []
    for i in range(length + 1):
        for c in combinations(items, i):
            subsets.append(c)
    return subsets


N, M = map(int, input().split())

dp = [[float('inf')] * (2 ** N) for _ in range(M + 1)]
for i in range(M + 1):
    dp[i][0] = 0
"""
dp[i][j] = (i + 1 番目以降の鍵は購入せずに状態を j にする為に必要な最小費用)
部分集合族はビットで管理すれば良い(0 <= j <= 2**N-1)
"""

for i in range(1, M + 1):
    dp[i] = dp[i - 1]
    a, b = map(int, input().split())
    c = list(map(int, input().split()))
    for j in range(2 ** N):
        """
        DPは送る方向に考えるか受け取る方向に考えるかの２通りのやり方がある
        今回は受け取る方は難しいので送る方で考える
        またjは昇順に考えると偶然うまくDPの状態が順番に確定していく
        """
        """
        以下のようにcで開けられる箱の部分集合全てを考えても良いが、
        結局ほしいのはdp[M][2 ** N - 1]の右端の値なので、中間状態は吹っ飛ばして良い。
        for subset in subset_family(c, b):
            val = 0
            for num in subset:
                val += 2 ** (num - 1)

            if j | val < 2 ** N:
                dp[i][j | val] = min(dp[i - 1][j] + a, dp[i - 1][j | val])
        """
        val = 0
        for num in c:
            val += 2 ** (num - 1)
        dp[i][j | val] = min(dp[i - 1][j] + a, dp[i - 1][j | val])
    #print('dp[{}]={}'.format(i, dp[i]))

ans = dp[M][2 ** N - 1]
if ans == float('inf'):
    print(-1)
else:
    print(ans)


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

int main(){
	int n,m;
	cin>>n>>m;
	
	int a[n];
	double sum=0;
	
	for(int i=0;i<n;i++){
		cin>>a[i];
		sum+=a[i];
	}

	int cnt=0;
	
	for(int i=0;i<n;i++)
	{
		if((4*m*a[i])>=ceil(sum))
		{
			cnt++;
		}
	
	}
	if(cnt>=m)	cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	
	return 0;
} 

Measured memory_bytes: 256
package main

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

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Scan()
	input, _ := strconv.Atoi(sc.Text())

	bits := toBitSet(input)
	for i := 31; i >= 0; i-- {
		fmt.Printf("%d", bits[i])
	}
	fmt.Println("")

	for i := 31; i >= 0; i-- {
		if bits[i] == 1 {
			fmt.Printf("%d", 0)
		} else {
			fmt.Printf("%d", 1)
		}
	}
	fmt.Println("")

	for i := 30; i >= 0; i-- {
		fmt.Printf("%d", bits[i])
	}
	fmt.Println(0)

	fmt.Print(0)
	for i := 31; i > 0; i-- {
		fmt.Printf("%d", bits[i])
	}
	fmt.Println("")

}

func toBitSet(d int) [32]int {
	result := [32]int{}
	for i := 31; i >= 0; i-- {
		j := int(math.Pow(2, float64(i)))
		if d >= j {
			d = d - j
			result[i] = 1
		}
	}
	return result
}



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


#define f(i,a,b) for(int i=(int)(a);i<=(int)(b);i++)
#define char_f(i,a) for(int i=(int)(a);(char)s[i]!='\0';i++)
#define rf(i,a,b) for(int i=(int)(a);i>=(int)(b);i--)
#define llf(i,a,b) for(long long int i=(long long int)(a);i<=(long long int)(b);i++)
#define llrf(i,a,b) for(long long int i=(long long int)(a);i>=(long long int)(b);i--)



#define ll long long
#define fi first
#define se second
#define pb push_back
#define pop pop_back
#define mem(ara) memset((ara),0,sizeof(ara))
#define memn(ara) memset((ara),-1,sizeof(ara))
#define be begin()
#define en end()
#define em emplace
#define eb emplace_back





#define si set<int>
#define sd set<double>
#define sll set<long long int>
#define ss set<string>
#define sc set<char>

#define pii pair<int,int>
#define pli pair<long long int,int>
#define pil pair<int,long long int>
#define pll pair<long long int,long long int>
#define pci pair<char,int>
#define pic pair<int,char>
#define pcl pair<char,long long int>
#define plc pair<long long int,char>

#define pss pair<string,string>
#define pcc pair<char,char>

#define pis pair<int,string>
#define psi pair<string,int>
#define pls pair<long long int,string>
#define psl pair<string,long long int>
#define pdd pair<double,double>
#define pcs pair<char,string>
#define psc pair<string,char>



#define vi  vector<int>
#define vll vector<long long int>
#define vd vector<double>
#define vs vector<string>
#define vc vector<char>
#define vii vector<pii>



#define mod 1000000007
#define mx (1<<30)-1
#define llmx (1ll<<62)
#define n_size 100005
#define g_size 10000005
double PI=acos(-1);



///unsigned int uMAX=4294967295;
///unsigned ll int ullMAX=18446744073709551615;

ll int digit(ll int n)
{
    ll r=0;
    while(n)
    {
        r+=n%10;
        n/=10;
    }
    return r;
}



int arr[g_size];



int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);

	ll int n,m,T,res,a,b,c,x,y,z;

	ll int maxi=-mx,mini=mx,count=0;

	ll int i,j,k;

	bool flag;

	string s1,s2;

	char s[100000];

	int ara[n_size],ara2[n_size];

	cin>>n;
    i=1;
    while(i<=n && i<10){
        cout<<i<<endl;
        i++;
    }
        m=9;
        x=10;
        while(i<=n){

            m+=x;

            cout<<m<<endl;

            y=0;
            k=x+m;
            while(k)
            {
                y+=k%10;
                k/=10;
            }

            b=0;
            a=m+x*10;
            while(a)
            {
                b+=a%10;
                a/=10;
            }

            //cout<<(x+y)*b<<" "<<a*(y+x*10)<<endl;

            if((m+x*10)*y<=(m+x)*b){
                x=x*10;
            }

            i++;
        }



}


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

int main() {
    long long n,m,ans;cin>>n>>m;
    if(m < 2*n)ans = m/2;
    else {
        ans = n;
        m -= 2*n;
        ans+= m/4;
    }
    cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#define MAX 500001
#define NIL NULL

struct node{
  int key;
  struct node *p;
  struct node *l;
  struct node *r;
};
typedef struct node * Node;

void insert(int);
void preorder(Node);
void inorder(Node);

Node root;
int main(){
  int n, i, x;
  char com[20];
  
  scanf("%d", &n);
 
  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    }
    else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    } 
  }  
  return 0;
}

void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;
  
  z = malloc(sizeof(struct node));
  z->key = k;
  z->l = NIL;
  z->r = NIL;
  
  while(x!=NIL){
    y=x;
    if(z->key<x->key) x=x->l;
    else x=x->r;
  }
  z->p=y;
 
  if(y==NIL) root=z;
  else if(z->key<y->key) y->l=z;
  else y->r=z;
}

void inorder(Node x){
  if(x!=NIL){
    inorder(x->l);
    printf(" %d",x->key);
    inorder(x->r);
  }
}

void preorder(Node x){
  if(x!=NIL){
    printf(" %d",x->key);
    preorder(x->l);
    preorder(x->r);
  }
}

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

int gcd(int a,int b){
    int t;
    while(b>0){
        t=b;
        b=a%b;
        a=t;
    }
    return a;
}

int lcm(int a,int b){
    return a*b/gcd(a,b);
}

int main(){
    ll a,b,c,d,e,k,l,m,n,o=0,p,q,r,x,y,z,max1=0;
    string s,t,u;
    double ans=0;
    priority_queue<ll> pque;
    cin>>n;
    for(ll i=0;i<n;i++){
        cin>>a;
        ans+=1.0/a;
    }  
    ans=1.0/ans;
    
    
    cout<<ans<<setprecision(10)<<endl;
}



Measured memory_bytes: 256
/*
               ██████  ██████
               ██   ██ ██   ██
 Author ->     ██████  ██   ██
               ██      ██   ██
               ██      ██████
 
        nik is love.
        nik is motivation.
        Ek modulus aapki jindagi barbaad kar sakti hai
        Watch for integer overflows.
        A dream doesn't become reality through magic; it takes sweat, determination and hard work" — Colin Powell
 */
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//#include <functional>
#define mp                    make_pair
#define pb                    push_back
#define ll                    long long
#define ss                       second
#define ff                        first
#define fr(i,a,b)   for(ll i=a;i<b;i++)
#define f(i,n)                fr(i,0,n)
#define rf(i,b,a) for(ll i=b-1;i>=a;i--)
#define r(i,n)                rf(i,n,0)
#define eps                   0.000000001
#define sz(a)                int((a).size())
#define all(c)               (c).begin(),(c).end()
#define tr(c,i)              for(typeof(c).begin() i = (c).begin(); i != (c).end(); i++)
#define present(c,x)         ((c).find(x) != (c).end())
#define cpresent(c,x)        (find(all(c),x) != (c).end())
#define pi                   pair<int,int>
#define pll                  pair < ll , ll >
#define endl                 '\n'
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef vector< int > vi;
typedef vector< vi > vvi;
int dx[8]={1,-1,0,0,-1,-1,1,1};
int dy[8]={0,0,-1,1,-1,1,-1,1};
const ll inf=1000000007;
vector<int> adj[200010],val(200010,0),vis(200010,0);
int myrandom (int i) { return std::rand()%i;}
//using namespace __gnu_pbds;
//typedef tree<pair<int,int>, null_type, less<pair<int,int>>, rb_tree_tag,tree_order_statistics_node_update> special_map;
ll gcd(ll a,ll b)
{
    if(b==0)
        return a;
    else
        return gcd(b,a%b);
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //ifstream fin;
    //ofstream fout;
    //fin.open("input.txt");
    //fout.open("output.txt");
    //clock_t launch=clock();
    int a,b,m;
    cin>>a>>b>>m;
    vector<int> p1(a+1),p2(b+1);
    int min1=inf,min2=inf;
    for(int i=1;i<=a;i++)
    {
        cin>>p1[i];
        min1=min(min1,p1[i]);
    }
    int mini=inf;
    for(int i=1;i<=b;i++)
    {
        cin>>p2[i];
        min2=min(min2,p2[i]);
    }
    mini=min1+min2;
    for(int i=1;i<=m;i++)
    {
        int a,b,c;
        cin>>a>>b>>c;
        mini=min(mini,p1[a]+p2[b]-c);
    }
    cout<<mini<<endl;
    //clog<<((long double)(clock()-launch)/CLOCKS_PER_SEC)<<"\n";
}


Measured memory_bytes: 7296
#include <iostream>
#include <string>
#include <vector>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <sstream>
#include <stack>
#include <map>
#include <set>
#include <ios>
#include <cctype>
#include <cstdio>
#include <functional>
#include <cassert>

#define REP(i,a) for(int i = 0;i < (a);++i)
#define FOR(i,a,b) for(int i = (a);i < (b); ++i)
#define FORR(i,a,b) for(int i = (a) - 1;i >=(b);--i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SIZE(obj) (int)(obj).size()
#define YESNO(cond,yes,no){cout <<((cond)?(yes):(no))<<endl; }
#define SORT(list) sort(ALL((list)));
#define RSORT(list) sort((list).rbegin(),(list).rend())
#define ASSERT(cond,mes) assert(cond && mes)

using namespace std;
using ll = long long;

constexpr int mod = 1'000'000'007;
constexpr int INF = 1'050'000'000;

template<typename T>
T round_up(const T& a, const T& b) {
    return (a + (b - 1)) / b;
}

template <typename T1, typename T2>
istream& operator>>(istream& is, pair<T1, T2>& p) {
    is >> p.first >> p.second;
    return is;
}

template <typename T1, typename T2>
ostream& operator<<(ostream& os, pair<T1, T2>& p) {
    os << p.first << p.second;
    return os;
}

template <typename T>
istream& operator>>(istream& is, vector<T>& v) {
    REP(i, (int)v.size())is >> v[i];
    return is;
}

template <typename T>
ostream& operator<<(ostream& os, vector<T>& v) {
    REP(i, (int)v.size())os << v[i] << endl;
    return os;
}

template <typename T>
T clamp(T& n, T a, T b) {
    if (n < a)n = a;
    if (n > b)n = b;
    return n;
}

template <typename T>
static T GCD(T u, T v) {
    T r;
    while (v != 0) {
        r = u % v;
        u = v;
        v = r;
    }
    return u;
}

template <typename T>
static T LCM(T u, T v) {
    return u * v / gcd(u, v);
}

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

    int N;
    cin >> N;
    vector<int> C(N - 1), S(N - 1), F(N - 1);
    REP(i, N - 1) {
        cin >> C[i] >> S[i] >> F[i];
    }

    vector<int> ans(N);
    ans[N - 1] = 0;
    FORR(i, N - 1, 0) {
        //次の駅に向かうのにかかる時間
        ans[i] = S[i] + C[i];
        FOR(j, i + 1, N - 1) {
            //次の駅の始発より早ければその時の結果を利用する
            if (ans[i] <= S[j]) {
                ans[i] = ans[j];
                break;
            }
            else {
                if (ans[i] % F[j] != 0) {
                    //始発より遅ければ次の出発タイミングまで待機する
                    ans[i] += F[j] - ans[i] % F[j];

                }
            }
            ans[i] += C[j];
        }
    }
    ans[N - 1] = 0;
    cout << ans << endl;
    return 0;
}

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


int H,W;
vector<vector<int>> field;

void dfs(int h, int w){
	field[h][w] = 0;
	for(int dh=-1;dh<=1;dh++){
		for(int dw=-1;dw<=1;dw++){
			int nh=h+dh, nw=w+dw;
			if(nh<0||nw<0||H-1<nh||W-1<nw) continue;
			if(field[nh][nw] == 0) continue;
			
			dfs(nh, nw);
		}
	}	
}

int main()
{
	while(1){
		cin>>W>>H;
		if(W==0&&H==0) break;
		field.assign(H, vector<int>(W, 0));
		for(int i=0;i<H;i++){
			for(int j=0;j<W;j++){
				cin>>field[i][j];
			}
		}
		
		int cnt = 0;
		for(int i=0;i<H;i++){
			for(int j=0;j<W;j++){
				if(field[i][j] == 0) continue;
				dfs(i, j);
				cnt++;
			}
		}
		cout<<cnt<<endl;
	}
}



Measured memory_bytes: 3256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <tuple>
#include <cmath>
#include <iomanip>
#include <map>
#include <stdio.h>
#include <cstring> //memset(dp,0,sizeof(dp))
#include <functional> //operator[]
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
#define ALL(a) (a).begin(),(a).end()
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;



signed main(){
    int k,n; cin >> k >> n;
    int a[n];
    rep(i,n) cin >> a[i];
    int res=0;
    rep(i,n-1){
        chmax(res,a[i+1]-a[i]);
    }
    chmax(res,k-a[n-1]+a[0]);
    cout << k-res << endl;
}


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

using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define REP(NAME, NUM) for (int NAME = 0; NAME < (NUM); ++NAME)
#define BREP(NAME, NUM) for (int NAME = (NUM)-1; NAME >= 0; --NAME)
#define ALL(NAME) (NAME).begin(), (NAME).end()

#define cMOD 1000000007ULL
#define cINF ((1ull<<62)-1)
#define cINFINT ((1<<30)-1)


int main()
{
	ull n;cin>>n;
	cout << n*180-360 << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
import java.util.Arrays;
class Main{
public static void main(String[] args){
 Scanner scan = new Scanner(System.in);
 
 int K = scan.nextInt();
 int N = scan.nextInt();
 int[] lake = new int[N];
 int[] distance = new int[N];
 int sum = 0;
 	for(int i = 0; i < N; i++){
      lake[i] = scan.nextInt();
    }
	for(int i = 0; i < N-1; i++){
      distance[i] = lake[i+1] - lake[i];
    }
  	  distance[N-1] = lake[0] + K - lake[N-1];
    Arrays.sort(distance);
  	for(int i = 0; i < N-1; i++){
      sum = sum + distance[i];
    }  
  System.out.println(sum);
 }
}

Measured memory_bytes: 65664
#include <bits/stdc++.h> 
#define ll long long
#define M 1000000007
using namespace std;
int main() 
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); 
	int n,m,a,b;
    cin>>n;
    vector<vector<double>>dp(n, vector<double>(n+1)); 
    vector<double>jp(n); 
    for(int i=0;i<n;i++)
    {
         cin>>jp[i];
    }
    dp[0][0]=(1.0000-jp[0]),dp[0][1]=jp[0];
    for(int i=1;i<n;i++)
    {
        dp[i][0]=dp[i-1][0]*(1.0-jp[i]);
    }
    for(int i=1;i<n;i++)
    {  // cout<<"i: ";
        for(int j=1;j<=i+1;j++)
        {
            dp[i][j]=dp[i-1][j-1]*(jp[i])+dp[i-1][j]*(1.00-jp[i]);
            //cout<<dp[i][j]<<" ";
        }
       // cout<<endl;
    }
    double sum=0.00;
    for(int i=n/2+1;i<=n;i++)
    {
        sum+=dp[n-1][i];

    }
    
   
  
    cout<<setprecision(10)<<sum;
	return 0; 
} 


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

int main() {
	
	int angka1=0,angka2=0;
	scanf("%d %d",&angka1,&angka2);
	int hitung = 0;
	hitung = angka1*angka2;
	printf("%d\n",hitung);
	
	return 0;
}


Measured memory_bytes: 3228
#include <iostream>
using namespace std;
int main() {
    string S, T, U;
    int A, B;
    cin >> S >> T;
    cin >> A >> B;
    cin >> U;
    if(U.compare(S)==0) {
        A--;
    } else if (U.compare(T)==0){
        B--;
    }
    cout << A << " " << B << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
//----***やべーやつら***----
using namespace std;
#define int long long

//----***型定義***----
using ll = long long;
using pll = pair<ll, ll>;
using pdd = pair<double, double>;
typedef long double lb;
typedef vector<int,vector<int>> vvec;
typedef long double ld;

//----***Like a Pythonista***----
#define REP(i,j,n) for (ll i=j;i<(n);i++)
#define RREP(i,n,j) for (ll i = n; j<i;i--)
#define each(i,...) for (auto&& i:__VA_ARGS__)
#define ALL(vec) (vec).begin(),(vec).end()
#define sum(...) accumulate(all(__VA_ARGS__),0LL)
#define dsum(...) accumulate(all(__VA_ARGS__),0.0L)
#define vec(type,name,...) vector<type> name(__VA_ARGS__)
template<class T> inline auto max(const T& a){ return *max_element(all(a)); }
template<class T> inline auto min(const T& a){ return *min_element(all(a)); }
inline ll gcd(ll a, ll b){ while(b){ ll c = b; b = a % b; a = c; } return a; }
inline ll lcm(ll a, ll b){ if(!a || !b) return 0; return a * b / gcd(a, b); }

//----***定数***----
const int MOD=1000000007;
#define INF 1e9;
#define EPS 1e-9;

//----***入出力***----
#define print(out) cout<< out  << "\n";
#define debug(var)  do{std::cerr << #var << " ↓ "<<"\n";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }
#define HERE  cout<<"Here"<<endl;

//----***初期時読み込み***----
struct initial{initial(){cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);};}initial_;

int N,M;
string S;
signed main(){
  cin>>S;
  if(S.at(2)==S.at(3)&&S.at(4)==S.at(5)){
    print("Yes")
  }
  else{
    print("No")
  }
  
}


Measured memory_bytes: 256
import math
a, b, x = map(int, input().split())
if x*2 <= a**2*b:
    ans = math.degrees(math.atan(2*x/a/b**2))
    print(90 - ans)
else:
    ans = math.degrees(math.atan(2*b/a - 2*x/a**3))
    print(ans)

Measured memory_bytes: 62308
#![allow(non_snake_case)]

use std::io::{stdin, Read};
use std::str::FromStr;
fn read_option<T: FromStr>() -> Option<T> {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok()
}
fn read<T: FromStr>() -> T {
    let opt = read_option();
    opt.expect("failed to parse token")
}

fn main() {
    let A: i64 = read();
    let B: String = read();
    let vec: Vec<_> = B.split('.').collect();
    let b: usize = vec[0].parse::<usize>().unwrap() * 100 + vec[1].parse::<usize>().unwrap();
    println!("{}", A * b as i64 / 100);
}


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



int main(){
    //input
    /*
    int A = 5;
    int B = 4;
    */
    string S;
    cin >> S;
    int ans = 0;
    for (int i = 0; i < S.size(); i++){
        if (i%2 == 0){
            if (S[i] == '1'){
                ans++;
            }
        }
        else{
            if (S[i] == '0'){
                ans++;
            }
        }

    }
    cout << min(ans,int(S.size())-ans) << endl;

    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mod 1000000007
using namespace std;
 
int main()
{
    ll k, n;
  cin>>k>>n;
  if(k*500>=n)
  cout<<"Yes";
  else cout<<"No";
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const ll MOD = 1e9 + 7/*998244353*/;
const ll INF = 1LL << 60;
ll mod_pow(ll, ll, ll); ll mod_fact(ll, ll); ll mod_inv(ll, ll); ll gcd(ll, ll); ll lcm(ll, ll);
//
int main(){
    int x, n;
    cin >> x >> n;
    int ans = 0;
    vector<bool> nums(102, true);
    for(int i = 0; i < n; i++) {int b; cin >> b; nums[b] = false;}
    for(int i = 0; i <= 101; i++){
        if(nums[i]){
            if(abs(x - ans) > abs(x - i)) ans = i;
            else if(abs(x - ans) == abs(x - i) && ans >= i) ans = i;
        }
    }
    cout << ans;
}

Measured memory_bytes: 3624
N = int(input())
S = input()

M = 10**9 + 7
cnt = [0] * 26

for i in range(N):
    cnt[ord(S[i]) - ord('a')] += 1

ans = 1
for i in range(26):
    ans *= (cnt[i] + 1)
    ans %= M

print(ans - 1)

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

typedef long long ll;
//const int INF = 2e9;
//const ll INF = 9e18;


int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N, M;
    cin >> N >> M;
    vector<string> A(N), B(M);
    for (int i=0;i<N;i++){
        cin >> A[i];
    }
    for (int i=0;i<M;i++){
        cin >> B[i];
    }
    bool ans = false;
    for (int i=0;i<N;i++){
        for (int j=0;j<N;j++){
            bool flag = true;
            for (int h=0;h<M;h++){
                for (int w=0;w<M;w++){
                    if (i+h>=N || j+w>=N) {
                        flag = false;
                        break;
                    }
                    if (A[i+h][j+w] != B[h][w]) {
                        flag = false;
                        break;
                    }
                }
                if (!flag) break;
            }
            if (flag) {
                ans = true;
                break;
            }
        }
        if (ans) break;
    }

    if (ans) cout << "Yes" << "\n";
    else cout << "No" << "\n";
}

Measured memory_bytes: 256
A, V = map(int, input().split(" "))
B, W = map(int, input().split(" "))
T = int(input())

if W > V:
  print("NO")
else:

  if abs(A - B) <= T * (V - W):
    print("YES")
  else:
    print("NO")

# if A - B > 0:
#   # 負の方向に逃げる
#   if (B + 10**9) / W <= T:
#     # print("left reach")
#     # T立つよりも先に端に到達してしまう場合
#     Bdist = (B + 10**9)
#   else:
#     # print("run left")
#     Bdist = W * T
# else:
#   # 正の方向に逃げる
#   if (10**9 - B) / W <= T:
#     # print("right reach")
#     Bdist = (10**9 - B)
#   else:
#     # print("run right")
#     Bdist = W * T

# Adist = V * T
# if Bdist + abs(A - B) <= Adist:
#   print("YES")
# else:
#   print("NO")


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

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

long long a[310][310];
bool used[310][310];

int main(void){
    long long N,ans=0;
    cin >> N;
    REP(i,N) REP(j,N)
        cin >> a[i][j];
    REP(k,N) REP(i,N) REP(j,N)
        if(k!=j && k!=i && i!=j) {
            if(a[i][j] == a[i][k]+a[k][j])
                used[i][j] = true;
            if(a[i][j] > a[i][k]+a[k][j]) {
                cout << "-1" << endl;
                return 0;
            }
        }
    REP(i,N) REP(j,N)
        if(used[i][j] == false) ans += a[i][j];
    cout << ans/2 << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<string> vs;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define all(a) (a).begin(),(a).end()
#define UNIQUE(v) v.erase(unique(all(v)),v.end());
#define fill(a,x) memset(a,x,sizeof(a))
#define zero(a) fill(a,0)
#define minus(a) fill(a,-1)
#define dbg(x) cout << #x"=" << x << endl

int main() {
  vi array;
  ll n;
  ll k;
  ll l;
  int count = 0;
  int t = 0;
  cin >> n;
  cin >> k;
  while(count < n){
    cin >> l;
    array.pb(l);
    count++;
  }
  sort(all(array));

  while (t < k) {
    array.pop_back();
    t++;
    if(t >= n) break;
  }

  ll sum=0;
  rep(i, n-k) sum += array[i];
  cout << sum << endl;
  return 0;

}


Measured memory_bytes: 1400
#include <iostream>
#include <string>
typedef long long LL;
using namespace std;

LL gcd(LL a, LL b){
    LL tmp; 
    if(a<b){
        tmp = a;
        a = b;
        b = tmp;
    }
    tmp = a%b;
    while(tmp!=0){
        a = b;
        b = tmp;
        tmp = a%b;
    }

    return b;
}

int main(){
    LL a;
    LL b;
    LL c;
    LL d;
    LL e;
    LL tmp;
    LL diff;
    LL sum = 0;   
    cin >> a >> b >> c >> d;
    if(a%c==0){
        diff = b - a;
    }else{
        diff = b - ((a/c) + 1) * c;
    }
    if(diff>=0){
        sum += (diff/c) + 1;
    }

    if(a%d==0){
        diff = b - a;
    }else{
        diff = b - ((a/d) + 1) * d;
    }
    if(diff>=0){
        sum += (diff/d) + 1;
    }

    e =  (c * d) / gcd(c, d);

    if(a%e==0){
        diff = b - a;
    }else{
        diff = b - ((a/e) + 1) * e;
    }
    if(diff>=0){
        sum -= (diff/e) + 1;
    }
    sum = b - a + 1 - sum;    
    cout << sum << endl;
}

Measured memory_bytes: 256
def solve(arr, target):
	memo = {}
	return solve_rec(0, arr, target, memo)

def solve_rec(i, arr, target, memo):

	res = False

	key = str(i) + '-' + str(target)
	if key in memo:
		res = memo[key]
	elif target == 0:
		res = True
	elif i >= len(arr):
		res = False
	else:
		res1 = solve_rec(i + 1, arr, target, memo)
		res2 = solve_rec(i + 1, arr, target - arr[i], memo)
		res = res1 or res2

	memo[key] = res		
	return res

n = int(input())
arr = list(map(int, input().split()))
q = int(input())
targets = list(map(int, input().split()))
for i in range(q):
	res = solve(arr, targets[i])
	if res == True:
		print('yes')
	else:
		print('no')


Measured memory_bytes: 6424