akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <stdlib.h>

int main (void) {
    int i, j, k;
    int a[3][3];
    int n;
    int b;

    for ( i=0; i<3; i++ ) {
        for ( j=0; j<3; j++ )
            scanf("%d", &a[i][j]);
    }
    scanf("%d", &n);
    for ( i=0; i<n; i++ ) {
        scanf("%d", &b);
        for ( j=0; j<3; j++ ) {
            for ( k=0; k<3; k++ ) {
                if ( a[j][k] == b )
                    a[j][k] = -1;
            }
        }
    }

    char ans='n';
    /* horizontal */
    for ( i=0; i<3; i++ ) {
        if ( a[i][0] == -1 && a[i][1] == -1 && a[i][2] == -1 )
            ans = 'y';
    }
    /* vertical */
    for ( i=0; i<3; i++ ) {
        if ( a[0][i] == -1 && a[1][i] == -1 && a[2][i] == -1 )
            ans = 'y';
    }
    /* cross */
    if ( (a[0][0] == -1 && a[1][1] == -1 && a[2][2] == -1) ||
         (a[0][2] == -1 && a[1][1] == -1 && a[2][0] == -1) )
        ans = 'y';

    printf("%s\n", ans == 'y' ? "Yes" : "No");
    return EXIT_SUCCESS;
}


Measured memory_bytes: 128
#include <stdio.h>

void candy(int a, int b, int c) {
  if (a + b == c || a + c == b || b + c == a)
    printf("Yes\n");
  else
    printf("No\n");
}

int main(void) {
  int a, b, c;
  scanf("%d", &a);
  scanf("%d", &b);
  scanf("%d", &c);
  candy(a, b, c);
  return 0;
}

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

int v[1100]={0}, w[1100]={0}, dp[1100][11000]={{0}};

int main(){
    int n,W;
	cin >> n >> W;
	
	for(int i =0;i <n;i++) cin >> v[i] >> w[i];
	 
	for(int i = 0; i < n; i++)
		for(int j = 0; j <= W; j++)
		    dp[i+1][j] = (j-w[i]>=0) ? max(dp[i][j], dp[i][j-w[i]]+v[i]) : dp[i+1][j]=dp[i][j];
		
	cout << dp[n][W] << endl;
	return 0;
}


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

int main()
{
  int n, red = 0, white = 0, cnt = 0, i;
  string st;
  cin >> n >> st;
  for (i = 0; i < n; i++)
  {
    if (st.at(i) == 'R')
    {
      red++;
    }
  }
  cnt = red;
  for (i = 0; i < n; i++)
  {
    if (st.at(i) == 'R')
    {
      red--;
    }
    else
    {
      white++;
    }
    cnt = min(cnt, max(red, white));
  }
  cout << cnt << endl;
}


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

int main()
{
    long long x,n,w,z;
    cin>>x>>n;
    set<long long> st;
    for(int i=0;i<n;i++)
    {
        cin>>w;
        st.insert(w);
    }
    z=0;
    while(1)
    {
        if(st.find(x-z)==st.end())
        {
            cout<<x-z<<endl;
            return 0;
        }
        if(st.find(x+z)==st.end())
        {
            cout<<x+z<<endl;
            return 0;
        }
        z++;
    }
    return 0;
}


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

typedef long long ll;
typedef long double ld;

void solve()
{
    ll d, t, s;
    cin >> d >> t >> s;

    ll curD = t * s;

    cout << (curD >= d ? "Yes" : "No") << endl;
}

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

#ifdef _DEBUG
    freopen("a-input-1.txt", "r", stdin);
    //freopen("a-output-1.txt", "w", stdout);
#endif

    solve();
    //int t; cin >> t; while(t--) solve();

    return 0;
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
typedef  long long ll;
ll a,b,q,ans;
int main()
{
    cin>>q;
    while(q--)
    {
        cin>>a>>b;
        if(a==b)
        {
            ans=(a-1)*2;
            cout<<ans<<endl;
            continue;
        }
        if(a>b) swap(a,b);
        if(a==1 && b==2)
        {
            cout<<0<<endl;
            continue;
        }
        ll t=(ll)sqrt(a*b-1);
      //  cout<<"t="<<t<<endl;
        ll k=t;
        while(k*t<a*b) k++;
        k--;
        if(k-t>=2) k=t+1;
        //cout<<"k="<<k<<endl;
        ans=k+t-1;
        int tmp=ans;
        if(a<tmp) ans--;
        if(b<tmp) ans--;
       // cout<<"ans="<<ans<<" "<<ans-a<<" "<<ans-b<<" ";
      //  cout<<(ans-a)*(ans-b)<<" "<<a*b<<endl;
        if(tmp-a>0 && tmp-b>0 && (tmp-a)*(tmp-b)<a*b)
            ans++;
        cout<<ans<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<algorithm>
#include<math.h>
#include<string>
#include<iostream>
#include<vector>
#include<cstdlib>
using namespace std;
 
template <class T> using V = vector<T>;
 
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
 
const long long INF = 1LL << 60;
 
using ll = long long;
using db = double;
using st = string;
using ch = char;
using bl = bool;
using vll = V<ll>;
using vpll =V<pair<ll,ll>>;
using vst = V<st>;
using vdb = V<db>;
using vch = V<ch>;
using vbl = V<bl>;
 
 
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define rFOR(i,a,b) for(ll i=(a);i>(b);i--)
#define oFOR(i,a,b) for(ll i=(a);i<(b);i+=2)
#define bgn begin()
#define en end()
#define SORT(a) sort((a).bgn,(a).en)
#define REV(a) reverse((a).bgn,(a).en)
#define M(a,b) max(a,b)
#define rM(a,b) min(a,b)
#define fi first
#define se second
#define sz size()
#define gcd(a,b) __gcd(a,b)
#define co(a) cout<<a<<endl;
#define ci(a) cin>>a;
 
 
ll sum(ll n) {
  ll m=0;
  FOR(i,0,20){
    m+=n%10;
    n/=10;
    if(n==0){
      break;
    }
  }
  return m;
}
 
 
const int MAX = 510000;
const int MOD = 1000000007;
 
long long fac[MAX], finv[MAX], inv[MAX];
 
void Comuse() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
 
#define comuse Comuse()
 
ll combi(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
 
 
 
 
ll lcm(ll a,ll b){
  ll n;
  n=a/gcd(a,b)*b;
  return n;
}
 
 
/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/
 
 
signed main() {
  ll q;
  	ci(q);
  vll A(100100);
  vll B(100100);
  FOR(i,1,100100){
    bl b=true;
    FOR(j,2,sqrt(i)+1){
      if(i%j==0){
        b=false;
        break;
      }
    }
    if(b){
      B[i]++;
    }
  }
  B[2]=1;
  oFOR(i,3,100000){
    A[i]+=A[i-2];
    if(B[i]==1&&B[(i+1)/2]==1){
      A[i]++;
    }
  }
  
  FOR(i,0,q){
    ll l,r;
    	ci(l>>r);
    if(l==1){
      co(A[r])
    }
    else{
    co(A[r]-A[l-2])
    }
  }
}

Measured memory_bytes: 2176
#include<bits/stdc++.h>
using namespace std;
#define maxn 100005
int a[maxn],n,k,b[maxn];
bool check(int x){
	for(int i=0;i<n;i++){
		b[i]=a[i]%x;
	}
	sort(b,b+n);
	int w=0,i;
	for(i=0;i<n;i++){
		w+=b[i];
		if(w>k)break;
	}
	for(w=0;i<n;i++){
		w+=x-b[i];
		if(w>k)return 0;
	}
	return 1;
}
int main(){
	int sum=0,x;scanf("%d%d",&n,&k);
	for(int i=0;i<n;i++)scanf("%d",a+i),sum+=a[i];x=sqrt(sum);
	for(int i=1;i<=x;i++){
		if(sum%i==0){
			if(check(sum/i)){
				printf("%d\n",sum/i);return 0;
			}
		}
	}
	for(int i=sqrt(sum);i>=1;i--){
		if(sum%i==0){
			if(check(i)){
				printf("%d\n",i);return 0;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define F first
#define S second
#define int long long
#define ll long long
//#define int  unsigned long long
#define pb push_back
//#define double long double

using namespace std;
using namespace __gnu_pbds;
typedef  tree< int , null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int N = 700;
const int K = 30;
const int mod = 1e9 + 7;
int dp[N][N], cost[N][N];
string s[N];
main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) cin >> s[i];
    int ans = 0;
    int c = 0;
    for (int i = 0; i < n; i++){
        int q = 0;
        for (int j = 0; j < n; j++) if (s[j][i] == '.') q = 1; else c++;
        ans += q;
    }
    if (c == 0){
        cout << -1;
        return 0;
    }
    if (ans == 0){
        cout << 0;
        return 0;
    }
    int z = 1e9;
    for (int i = 0; i < n; i++){
        int x = 0;
        for (int j = 0; j < n; j++){
            if (s[i][j] == '.') x++;
        }
        int q = 1;
        for (int j = 0; j < n; j++){
            if (s[j][i] == '#') q = 0;
        }
        x += q;
        z = min(z, x);
    }
    cout << ans + z;
}


Measured memory_bytes: 3932
import java.util.Scanner;
class Main{
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);

        short[][] st = new short[50][3];
        short counter=0;
        short mid, last, add;
        while(true){
            mid = scanner.nextShort();
            last = scanner.nextShort();
            add = scanner.nextShort();
            if(mid == -1&&last == -1&&add == -1)break;
            st[counter][0] = mid;
            st[counter][1] = last;
            st[counter][2] = add;
            counter++;
        }
        int sum;
        for(int i = 0; i < counter; i++){
            sum = st[i][0]+st[i][1];
            if(st[i][0] == -1 || st[i][1] == -1){
                System.out.println("F");
                continue;
            }
            if(sum >= 80)System.out.println("A");
            else if(sum >= 65)System.out.println("B");
            else if(sum >= 50)System.out.println("C");
            else if(sum >= 30){
                if(st[i][2] >= 50)System.out.println("C");
                else System.out.println("D");
            }
            else System.out.println("F");
        }
    }
}



Measured memory_bytes: 26224
#include <stdio.h>

int main(void){
  int i, l[10], v1, v2;
  double x, k;

  while(scanf("%d", &l[0]) != EOF){
    k = l[0];
    for(i = 1; i < 10; i++){
      scanf(",%d", &l[i]);
      k += l[i];
    }
    scanf(",%d,%d", &v1, &v2);
    x = k*v1 / (v1+v2);
    k = 0;
    for(i = 0; i < 10; i++){
      k += l[i];
      if(x <= k){
	printf("%d\n", i+1);
	break;
      }
    }
  }
  return 0;
}

Measured memory_bytes: 596
n = gets.to_i

# 隣接行列の作成
INF = 100_001 * n
graph = Array.new(n) { [INF] * n }
n.times do
  i, j, *vcs = gets.split.map(&:to_i)
  j.times do
    k = vcs.shift
    c = vcs.shift
    graph[i][k] = c
  end
end

# ダイクストラ
vs = [false] * n # <- verified
ws = [INF] * n   # <- weights

# 開始点を0とする
ws[0] = 0
mv  = -1

# 検証済のノードが無くなるまで実施
while vs.include? false
  min = INF
  mv  = -1

  # もっともコストが低く未検証のノード(minimum vertex)を探す
  ws.each_with_index do |w, i|
    if w < min && vs[i] == false
      min = w
      mv  = i
    end
  end

  # 見つけたらそれは最短経路に含めるので検証済みにする
  vs[mv] = true

  # 見つけたノードから到達可能なネイバーへのコストを調べる
  graph[mv].each_with_index do |costs, i|
    # ネイバーまでの現在のコストの方が大きいようなら更新する
    ws[i] = min + costs if ws[i] > min + costs && vs[i] == false
  end
end

ws.each_with_index { |cost, i| puts "#{i} #{cost}" }


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

int main()
{
    int a, b;

    cin >> a >> b;

    cout << a / b << " " << a % b << " ";
    cout << fixed;
    cout << setprecision(5) << (double)a / b << endl;

    return 0;
}


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

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

	int dp[n + 1][n + 1];
	memset(dp, 0, sizeof(dp));
	int ans = 0;
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= n; j++) {
			if (s[i - 1] == s[j - 1] && (j - i) > dp[i - 1][j - 1]) {
				dp[i][j] = 1 + dp[i - 1][j - 1];
				ans = max(ans, dp[i][j]);
			}
			else
				dp[i][j] = 0;
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 97920
#include <bits/stdc++.h>
using namespace std;
#include "string"
#define endl '\n'
#define PI pair<int,int>
#define ff first
#define ss second
#define int long long 
#define boost ios_base::sync_with_stdio(false);cin.tie(nullptr)


vector<int> divisor(int n){
    vector<int>ans;
    for(int i=2;i*i<=n;i++){
        if(n%i==0){
            ans.push_back(i);
            if(n/i != i)
                ans.push_back(n/i);
        }
    }
    return ans;
}

void brute_force(int n){
    for(int k=2;k<=n;k++){
        int tt = n;
        while(tt>1){
            if(tt%k==0)
                tt/=k;
            else if(tt>k)
                tt%=k;
            else
                break;
        }
        if(tt==1)
            cout<<k<<" ";
    }    
    cout<<endl;
}

int32_t main() { 
    boost;
    int n;
    cin>>n;
    if(n==2){
        cout<<1<<endl;
        return 0;
    }
    vector<int> d = divisor(n-1);
    set<int>ans;
    for(int i:d)
        ans.insert(i);
    d = divisor(n);

    for(int k:d){
        int tt = n;
        while(tt>1){
            if(tt%k==0)
                tt/=k;
            else if(tt>k)
                tt%=k;
            else
                break;
        }
        if(tt==1)
            ans.insert(k);
    }
    //print(ans);
    //brute_force(n); 
    cout<<ans.size()+2<<endl; 
}           

Measured memory_bytes: 384
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int l = sc.nextInt();
        int total = 0, min = 100;
        for (int i = 0; i < n; i++) {
            int a = l + i;
            total += a;
            if (Math.abs(a) < Math.abs(min)) min = a;
        }
        System.out.println(total-min);
    }
}

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

int main()
{
	int R, G, B, N;
	cin >> R >> G >> B >> N;

	int r,g,b;
	r = g = b = 0;

	int cr, cg, cb;
	cr = cg = cb = 0;

	int ret = 0;
	while (cr <= N) {
		while (cr + cg <= N) {
			if ((N - cr - cg) % B == 0) {
				++ret;
			}
			cg = (++g) * G;
		}
		cg = g = 0;
		cr = (++r) * R;
	}

	cout << ret << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
long long maximum;
long long mod = 1000000007;
const int INF = 1001001001;
vector<vector<int>> dp;

int main(){
  string s;
  cin >> s;
  if(s=="SUN"){
    cout << 7 << endl;
  }else if(s=="MON"){
    cout << 6 << endl;
  }else if(s=="TUE"){
    cout << 5 << endl;
  }else if(s=="WED"){
    cout << 4 << endl;
  }else if(s=="THU"){
    cout << 3 << endl;
  }else if(s=="FRI"){
    cout << 2 << endl;
  }else if(s=="SAT"){
    cout << 1 << endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <utility>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
using namespace std;
#define INF 1000000007
#define LINF 1000000000000000007
#define MOD 1000000007
#define int long long
#define rep(i, n) for (int i = 0; i < n; i++)
#define repb(i, n) for (int i = n - 1; i >= 0; i--)
#define MODE 1
#ifdef MODE
#define DEB(X) cout << #X << ": " << X << " ";
#define ARDEB(i, X) cout << #X << "[" << i << "]: " << X[i] << " ";
#define END cout << endl;
#else
#define DEB(X) \
    {          \
    }
#define ARDEB(i, X) \
    {               \
    }
#define END \
    {       \
    }
#endif
typedef pair<int, int> P;
struct edge{int to,cost;};
typedef long long ll;


signed main()
{
    pair<pair<string,int>,int> p[11111];
    vector<vector<pair<int,int>>> v(111);
    int n;
    cin>>n;
    rep(i,n){
        cin>>p[i].first.first>>p[i].first.second;
        p[i].second=i+1;
    }
    sort(p,p+n);
    //cout<<endl;
    int j=0;
    rep(i,n){
        v[j].push_back(make_pair(p[i].first.second,p[i].second));
        if(i!=n-1 && p[i].first.first!=p[i+1].first.first)j++;
    }
    
    for(auto x:v){
        sort(x.begin(),x.end(),greater<>());
        for(auto y:x){
            cout<<y.second<<endl;
        }
    }

 
}


Measured memory_bytes: 512
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<queue>
#include<deque>
#include<set>
#include<functional>
#include<iomanip>

#define LLI long long int

using namespace std;

int main(){
	LLI N;cin>>N;
	LLI ans=N*(N-1)/2;
	cout<<ans<<endl;

	return 0;
}



Measured memory_bytes: 256
#include <iostream>

using namespace std;

int min(int a, int b)
{
  return (a > b) ? b : a;
}

int max(int a, int b)
{
  return (a > b) ? a : b;
}

int main()
{
  int A, B, K;
  int a, b;
  cin >> A >> B >> K;

  a = min(A, B);
  b = max(A, B);

  for(int i=0; i<K; i++)
  {
    int num = a+i;
    if(a <= num && num <=b)
      cout << num << endl;
  }

  for(int i=K-1; i>=0; i--)
  {
    if(b-i >= a+K)
    {
      int num = b-i;
      if(a <= num && num <=b)
        cout << num << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 256
import sys

input = sys.stdin.readline

def main():
    x, n = map(int, input().rstrip().split())
    if n == 0:
        print(x)
        sys.exit()
    else:
        p = list(map(int, input().rstrip().split()))
        if x > max(p):
            print(x)
            sys.exit()
        else:
            p_x = set(range(102))
            p_temp = set(p)
            p_diff = p_x - p_temp
            p_temp = list(p_diff)
            p_temp = sorted(p_temp)
            p_dir = []

        for i in range(len(p_temp)):
            p_dir.append(abs(p_temp[i] - x))
        print(p_temp[p_dir.index(min(p_dir))])
  
if __name__ == "__main__":
    main()

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

class Main {
    static Scanner sc;

    private static void nextArr(int[] h) {
        for(int i = 0; i < h.length; i++) h[i] = sc.nextInt();
    }

    private static int nextInt() {
        return sc.nextInt();
    }

    private static void print(Object... vals) {
        for(int i = 0; i < vals.length; i++) {
            if (i != vals.length - 1) {
                System.out.print(vals[i] + ",");
            } else {
                System.out.print(vals[i]);
            }
        }
        System.out.println();
    }

    public static void main(String[] args) {
        sc = new Scanner(System.in);
        int n = sc.nextInt();
        int w = sc.nextInt();
        int[][] item = new int[n][2];
        for(int i = 0; i < n; i++) nextArr(item[i]);
        int v = 0;
        for(int i = 0; i < n; i++) v += item[i][1];

        long[][] dp = new long[n][v + 1];
        for(int i = 0; i < n; i++) Arrays.fill(dp[i], Long.MAX_VALUE);
        for(int i = 0; i < n; i++) dp[i][0] = 0;
        dp[0][item[0][1]] = item[0][0];
        for(int i = 1; i < n; i++) {
            for(int j = 0; j <= v; j++) {
                dp[i][j] = Math.min(dp[i][j], dp[i - 1][j]);
                if (j - item[i][1] >= 0 && dp[i - 1][j - item[i][1]] != Long.MAX_VALUE) {
                    dp[i][j] = Math.min(dp[i][j], dp[i - 1][j - item[i][1]] + item[i][0]);
                }
            }
        }
        int max = 0;
        for(int i = 0; i <= v; i++) {
            if (dp[n - 1][i] <= w) {
                max = Math.max(max, i);
            }
        }
        print(max);

    }
}


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

int main() {
  int A, B, C, K, cnt=0;
  cin >> A >> B >> C >> K;
  while(B<=A){
    B*=2;
    cnt++;
  }
  while(C<=B){
    C*=2;
    cnt++;
  }
  if(cnt<=K) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 3628
import java.util.*;import java.io.*;import java.math.*;
public class Main
{
    public static void process()throws IOException
    {
        double r=ni();
        pn(44*r/7);
    }
 
    static AnotherReader sc;
    static PrintWriter out;
    public static void main(String[]args)throws IOException
    {
        boolean oj = true;
        if(oj){sc=new AnotherReader();out=new PrintWriter(System.out);}
        else{sc=new AnotherReader(100);out=new PrintWriter("output.txt");}
        int t=1;
        // t=ni();
        while(t-->0) {process();}
        out.flush();out.close();  
    }
 
    static void pn(Object o){out.println(o);}
    static void p(Object o){out.print(o);}
    static void pni(Object o){out.println(o);out.flush();}
    static int ni()throws IOException{return sc.nextInt();}
    static long nl()throws IOException{return sc.nextLong();}
    static double nd()throws IOException{return sc.nextDouble();}
    static String nln()throws IOException{return sc.nextLine();}
    static int[] nai(int N)throws IOException{int[]A=new int[N];for(int i=0;i!=N;i++){A[i]=ni();}return A;}
    static long[] nal(int N)throws IOException{long[]A=new long[N];for(int i=0;i!=N;i++){A[i]=nl();}return A;}
    static long gcd(long a, long b)throws IOException{return (b==0)?a:gcd(b,a%b);}
    static int gcd(int a, int b)throws IOException{return (b==0)?a:gcd(b,a%b);}
    static int bit(long n)throws IOException{return (n==0)?0:(1+bit(n&(n-1)));}
 
/////////////////////////////////////////////////////////////////////////////////////////////////////////
 
    static class AnotherReader{BufferedReader br; StringTokenizer st;
    AnotherReader()throws FileNotFoundException{
    br=new BufferedReader(new InputStreamReader(System.in));}
    AnotherReader(int a)throws FileNotFoundException{
    br = new BufferedReader(new FileReader("input.txt"));}
    String next()throws IOException{
    while (st == null || !st.hasMoreElements()) {try{
    st = new StringTokenizer(br.readLine());}
    catch (IOException  e){ e.printStackTrace(); }}
    return st.nextToken(); } int nextInt() throws IOException{
    return Integer.parseInt(next());}
    long nextLong() throws IOException
    {return Long.parseLong(next());}
    double nextDouble()throws IOException { return Double.parseDouble(next()); }
    String nextLine() throws IOException{ String str = ""; try{
    str = br.readLine();} catch (IOException e){
    e.printStackTrace();} return str;}}
   
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
}

Measured memory_bytes: 33280
#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <math.h>
#include <vector>
#include <cstring>
#include <ctime>
#include <set>
#include <bitset>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <ctime>
#include <climits>
#include <cassert>
#define fr first
#define sc second
#define MP make_pair
#define ad push_back
#define PB push_back
#define fastio ios_base::sync_with_stdio(false); cin.tie(0);
#define lli long long int
#define y1 arayikhalatyan
#define j1 jiglypuff
#define ld long double
#define itn int
#define pir pair<int, int> 
#define all(x) (x).begin(), (x).end()
#define str string
using namespace std;

lli gcd(lli a, lli b) { return (b == 0LL ? a : gcd(b, a % b)); }
ld dist(ld x1, ld y1, ld x2, ld y2)
{
	return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
}
lli S(lli a)
{
	return (a * (a + 1LL)) / 2;
}
char vow[] = { 'a', 'e', 'i', 'o', 'u' };
int dx[] = { 1, -1, 0, 0, -1, -1, 1, 1 };
int dy[] = { 0, 0, 1, -1, -1, 1, -1, 1 };


const int N = 8080;
const lli mod = 1e9 + 7;
const ld pi = acos(-1);
const int T = 238;
const ld e = 1e-6;

lli bp(lli a, lli b = mod - 2LL)
{
	lli ret = 1;
	while (b)
	{
		if (b & 1) ret *= a, ret %= mod;
		a *= a;
		a %= mod;
		b >>= 1;
	}
	return ret;
}
ostream& operator<<(ostream& c, pir a)
{
	c << a.fr << " " << a.sc;
	return c;
}



int a, b, c, k, pat;
int main()
{
	fastio;
	cin >> a >> b >> c >> k;
	pat = min(a, k);
	k -= min(a, k);
	k -= min(b, k);
	pat -= min(c, k);
	cout << pat << endl;
	return 0;
}


/*


  __
*(><)*
  \/ /
  ||/
--||
  ||
  /\
 /  \
/    \
*/



Measured memory_bytes: 3696
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define printVec(v) printf("{"); for (const auto& i : v) { std::cout << i << ", "; } printf("}\n");
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; }
using namespace std;
using P = pair<int,int>;
using ll = long long;
const ll INF = 1LL<<60;
const double PI = 3.1415926535897932;
const int MOD = 1e9 + 7;

const long long MAX = 1e18;
//cin.tie(0);ios::sync_with_stdio(false);
int main() {
  int n;
  cin >> n;
  bool ng = false;
  bool zero = false;

  ll res = 1;
  rep (i, n) {
    ll a;
    cin >> a;

    if (a == 0) {
      cout << 0 << endl;
      return 0;
    }

    if ( (MAX / res) >= a) {
      //printf("%lld, %lld\n", res, a);
      res *= a;
    } else {
      ng = true;
    }
  }

  if (ng) cout << -1 << endl;
  else cout << res << endl;

  return 0;
}


Measured memory_bytes: 3632
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<numeric>
#include<cmath>
#include<queue>
#include<stack>
#include<list>
#include<unordered_map>
#include<unordered_set>
#include<cctype>
#include<iomanip>
#include<limits>
#include<bitset>

using namespace std;
typedef long long int ll; typedef pair<int, int> P; typedef unsigned long long int ull;
const ll mod = 1000000007;
const int inf = 1e9 + 7;
const ll linf = 1LL << 60;
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define REP(i,m,n) for(int i=(m);i<(int)n;i++)
#define all(a) (a).begin(),(a).end()
#define allg(a) (a).begin(),(a).end(),greater<>()
#define SUM(a) accumulate((a).begin(),(a).end(),0)
#define d10 std::setprecision(10)
#define d20 std::setprecision(20)
#define vec vector<int>
#define vecb vector<bool>
#define vecd vector<double>
using str = string;
const double PI = 3.14159265359;
ll len(ll tmp){
	ll res = 0;
	while(tmp>0){
		res++;
		tmp /= 10;
	}
	return res;
}
int len(int tmp){
	int res = 0;
	while(tmp>0){
		tmp /= 10;
		res++;
	}
	return res;
}
ll gcd(ll a, ll b) { ll t; while (b != 0) { t = a % b; a = b; b = t; }return a; }
int gcd(int a, int b) { int t; while (b != 0) { t = a % b; a = b; b = t; }return a; }
ll recfact(ll start, ll n) {
	ll i;
	if (n <= 16) {
		ll r = start;
		for (i = start + 1; i < start + n; i++) r = r * i % mod;
		return r % mod;
	}
	i = n / 2;
	return recfact(start, i) % mod * recfact(start + i, n - i) % mod;
}
ll lcm(ll a, ll b) {
	return a * b / gcd(a, b);
}
ll fct(ll n) { return recfact(1, n); }
ll ncm(ll n, ll m) {
	if (n < m)return 0;
	ll x = (fct(n) % mod / (fct(m) * fct(n - m)) % mod) % mod;
	return x;
}
std::string sreverse(string str, int firstItr, int secondItr) {
	if (firstItr < 0 || secondItr>int(str.size() - 1))return str;
	while (firstItr < secondItr) {
		swap(str[firstItr], str[secondItr]);
		firstItr++; secondItr--;
	}
	return str;
}
std::string RunLengthEncoding(std::string str) {
	int itr = 0; std::string res;
	while (itr < int(str.size())) {
		char tmp = str[itr++];
		int length = 1;
		while (itr <int(str.size()) && str[itr] == tmp) { ++itr; ++length; }
		res.push_back(tmp);
		res += to_string(length);
	}
	return res;
}
std::string split(std::string str, size_t first_itr, size_t second_itr) {
	std::string tmp;
	for (size_t i = first_itr; i < second_itr + 1; i++) {
		tmp.push_back(str.at(i));
	}
	return tmp;
}



int main(void)
{
	int n, ans = 0;
	cin >> n;
	for (int i = 1; i < n + 1; i++){
		if(len(i)%2){
			ans++;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
         
        int main(){
         
            int a;
            int b;
         
            
            int n[101];
            int data[101];
         
            scanf("%d", &a);
            scanf("%d", &b);
         
            for (int i = 0; i <= 100; i++){
                data[i] = 0;
            }
         
            for (int i = 0; i < b; i++){
                scanf("%d", &n[i]);
                data[n[i]] = 1;
            }
         
            for (int i = 0; i <= 100; i++){
                if(a-i>=0){//0よりでかい
                if(data[a-i]==0){
                    printf("%d", a - i);
                    break;
                }
                }
                if(a+i==101){
                    printf("%d", 101);
                    break;
                }
                if (a + i <= 100){ 
                    if (data[a + i] == 0){
                        printf("%d", a + i);
                        break;
                    }
                }
            }
         
            printf("\n");
        }

Measured memory_bytes: 2032
#include <iostream>
#include <algorithm>
#include <vector>
typedef long long ll;
using namespace std;
int main()
{
  int n;
  cin>>n;
  vector<ll>a(n);
  for(int i=0;i<n;i++)
    cin>>a[i];
  sort(a.begin(),a.end());
  reverse(a.begin(),a.end());
  ll s=0;
  for(int i=1;i<n;i++)
    s+=a[i/2];
  cout<<s;
  return 0;
}

  

Measured memory_bytes: 4824
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int64_t i = 0; i < (int64_t)(n); i++)
using vi = vector<int64_t>;
using vvi = vector<vi>;
using ll = int64_t;
using P = pair<ll,ll>;
ll INF = 1000000007;
// ll INF = 9223372036854775807;
// ll INF = 998244353;

int main() {
    // fasten cin
    cin.tie(0);
    ios::sync_with_stdio(false);
    // implement
    vi x(5);
    rep(i,5) cin >> x.at(i);
    rep(i,5){
        if(x.at(i) == 0) cout << (i+1) << endl;
    }
}


Measured memory_bytes: 3616
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <deque>
long long mod = 1e9+7;

int main(){
  int N;
  scanf("%d", &N);
  std::vector<int > A(N);
  std::vector<int > counter(N, 0);
  for (int i=0; i<N; i++){
    scanf("%d", &A[i]);
    counter[A[i]]++;
  }
  
  bool result = true;
  long long ans = 1;
  if (N%2==1){
    if (counter[0]!=1){
      result = false;
    }
    for (int i=2; i<N; i=i+2){
      if (counter[i]!=2){
        result = false;
      } else {
        ans *= 2;
        ans %= mod;
      }
    }
  } else {
    for (int i=1; i<N; i=i+2){
      if (counter[i]!=2){
        result = false;
      } else {
        ans *= 2;
        ans %= mod;
      }
    }    
  }
  if (!result){
    printf("0\n");
  } else {
    printf("%lld\n", ans);    
  }
  return 0;
}


Measured memory_bytes: 1024
#include <stdio.h>

//挿入ソート
void insertionSort(int A[], const int N)
{
    int i, j;

    for( i = 0; i < N; ++i ){
        int tmp = A[i];
        for( j = i-1; -1 < j && tmp < A[j]; --j ){
            A[j+1] = A[j];
        }
        A[j+1] = tmp;

        //出力
        for( j = 0; j < N; ++j ){
            printf("%d", A[j]);
            if( j != N-1 ) printf(" ");
        }
        printf("\n");
    }
}

int main()
{
    int i;

    //入力
    int N;
    scanf("%d", &N);
    int A[N];
    for( i = 0; i < N; ++i )
        scanf("%d", &A[i]);

    insertionSort(A, N);

    return 0;
}



Measured memory_bytes: 1992
#include<bits/stdc++.h>
using namespace std;
const int N=2e5+5;
typedef long long ll;
ll n,x,d;
ll ans=0,f[N],sum[N];
int main()
{
    scanf("%lld%lld%lld",&n,&x,&d);
    if(x==0&&d==0)
    {
        cout<<1<<endl;return 0;
    }
    if(x<0&&d<0)
        x*=-1,d*=-1;
    for(int i=1;i<=n;i++)
        sum[i]=sum[i-1]+i-1;
    ll k=__gcd(x,d),xx=x/k,dd=d/k;
    if(xx>=0&&dd>=0)
    {
        for(int i=0;i<=n;i++)
        {
            ll l=sum[i],r=sum[n]-sum[n-i];
            if(l>r) swap(l,r);
            ans+=r-l+1;
            if(i+dd<=n)
            {
                l=max(l,sum[i+dd]+xx);
                ans-=max(0ll,r-l+1);
            }
        }
    }
    else
    {
        if(xx<0) xx*=-1;
        if(dd<0) dd*=-1;
        for(int i=0;i<=n;i++)
        {
            ll l=sum[i],r=sum[n]-sum[n-i];
            if(l>r) swap(l,r);
            ans+=r-l+1;
            if(i+dd<=n)
            {
                r=min(r,sum[n]-sum[n-i-dd]-xx);
                l=max(l,sum[i+dd]-xx);
                ans-=max(0ll,r-l+1);
            }
        }
    }
    printf("%lld\n",ans);
}

Measured memory_bytes: 1792
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {

    public static void main(String[] args) throws Exception {

        ModScanner ms = new ModScanner();
        OutputStream outputStream = System.out;
        PrintWriter out = new PrintWriter(outputStream);
        int n = ms.nextInt();
        int w = ms.nextInt();
        int[] wt = new int[n];
        int[] val = new int[n];
        int totVal = 0;
        for (int i = 0; i < n; i++) {
            wt[i] = ms.nextInt();
            val[i] = ms.nextInt();
            totVal += val[i];
        }

        long[] dp = new long[totVal + 1];

        for (int i = 1; i <= totVal; i++) {
            dp[i] = Integer.MAX_VALUE;
        }

        long maxProfit = 0;

        for (int i = 1; i <= n; i++) {
            for (int j = totVal; j >= val[i - 1]; j--) {
                dp[j] = Math.min(dp[j], dp[j - val[i - 1]] + wt[i - 1]);
            }
        }
        for (int i = totVal; i >= 0; i--) {
            if (dp[i] <= w) {
                maxProfit = Math.max(maxProfit, i);
                break;
            }
        }

        out.println(maxProfit);
        out.close();
    }
}

class ModScanner {

    BufferedReader br;
    StringTokenizer st;

    public ModScanner() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String nextToken() throws Exception {
        while (st == null || !st.hasMoreElements()) {
            st = new StringTokenizer(br.readLine());

        }
        return st.nextToken();
    }

    String nextString() throws Exception {
        return br.readLine();
    }


    int nextInt() throws Exception, Exception {
        return Integer.parseInt(nextToken());
    }

    long nextLong() throws Exception {
        return Long.parseLong(nextToken());
    }

    double nextDouble() throws Exception {
        return Double.parseDouble(nextToken());
    }

}


Measured memory_bytes: 34288
#include <bits/stdc++.h>
     
#define pll pair <long long,long long>
#define pb push_back
#define ll long long
#define ff first
#define ss second
#define vll vector <ll>
#define NFS ios_base::sync_with_stdio(0); cin.tie(NULL);
#define endl '\n'
#define M 1000000007   
using namespace std;

void solve()
{
	int l;
	cin>>l;
	 long double dim=(long double)l/3;
	cout<<setprecision(18)<<dim*dim*dim;
}
 
int main()
{
    NFS
 	int t=1;
 	//cin>>t;
 	while(t--)
 	{
 		solve();
 	}
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define rep(X,N) for(ll X = 0; X < (N); X++)
#define bitrep(X,N) for(ll X = 0; X < (1 << (N)); X++)
#define PI (acos(-1.0))
#define sorta(V) sort(V.begin(), V.end())
#define pback push_back
#define mpair make_pair
#define MODN 1000000007
#define ALL(V) (V).begin(),(V).end() 


using namespace std;

int main(){

    int a,b,q;
    cin >> a >> b >> q;

    vector<ll> s;
    vector<ll> t;
    ll tmp;

    rep(i,a){
        cin >> tmp;
        s.pback(tmp);
    }

    rep(i,b){
        cin >> tmp;
        t.pback(tmp);
    }

    function<ll(bool, ll)> near = [=](bool nextshrine, ll start) -> ll{

        ll result;

        if(nextshrine){
            auto itr = lower_bound(s.begin(),s.end(), start);
            int rpos = distance(s.begin(), itr);

            int lpos;

            if(rpos == 0){
                lpos = s.size() - 1;
            }else lpos = rpos - 1;

            result = min(abs(start - s[lpos]), abs(start - s[rpos]));

        }else{
            auto itr = lower_bound(t.begin(),t.end(), start);
            int rpos = distance(t.begin(), itr);

            int lpos;

            if(rpos == 0){
                lpos = t.size() - 1;
            }else lpos = rpos - 1;

            result = min(abs(start - t[lpos]), abs(start - t[rpos]));

        }

        return result;
    };

    rep(i,q){

        ll start;
        cin >> start;

        ll result = LLONG_MAX;

        auto itrs = lower_bound(s.begin(), s.end(), start);
        int rpos = distance(s.begin(), itrs);
        int lpos;

        if(rpos == 0){
            lpos = s.size() - 1;
        }else lpos = rpos - 1;

        result = min(result, abs(start - s[lpos]) + near(false, s[lpos]));
        result = min(result, abs(start - s[rpos]) + near(false, s[rpos]));

        auto itrt = lower_bound(t.begin(), t.end(), start);
        rpos = distance(t.begin(), itrt);

        if(rpos == 0){
            lpos = t.size() - 1;
        }else lpos = rpos - 1;

        result = min(result, abs(start - t[lpos]) + near(true, t[lpos]));
        result = min(result, abs(start - t[rpos]) + near(true, t[rpos]));

        cout << result << endl;
    }
    
    return 0;
}

Measured memory_bytes: 4596
#include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define each(a,b) for(auto (a): (b))
#define all(v) (v).begin(),(v).end()
#define zip(v) sort(all(v)),v.erase(unique(all(v)),v.end())
#define fi first
#define se second
#define pb push_back
#define show(x) cout<<#x<<" = "<<(x)<<endl
#define spair(p) cout<<#p<<": "<<p.fi<<" "<<p.se<<endl
#define svec(v) cout<<#v<<":";rep(kbrni,v.size())cout<<" "<<v[kbrni];cout<<endl
#define sset(s) cout<<#s<<":";each(kbrni,s)cout<<" "<<kbrni;cout<<endl
#define smap(m) cout<<#m<<":";each(kbrni,m)cout<<" {"<<kbrni.first<<":"<<kbrni.second<<"}";cout<<endl

using namespace std;

typedef pair<int,int>P;

const int MAX_N = 100005;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<int> vec(2*n);
    rep(i,2*n){
        cin >> vec[i];
    }
    sort(all(vec));
    int sm = 0;
    rep(i,2*n){
        if(i % 2 == 0){
            sm += vec[i];
        }
    }
    cout << sm << endl;
    return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#include <cmath>
#include <iomanip>
using namespace std;
typedef int64_t Int;
typedef uint64_t uInt;
const double pi = M_PI;

int main() {
    Int a, b, c, x, y;
    cin >> a >> b >> c >> x >> y;

    Int ans = INT64_MAX, count = max(x, y);

    for (Int i = 0; i < count + 1; i++) {
        ans = min(ans, 2 * c * i + a * max((Int)0, x - i) + b * max((Int)0, y - i));
    }

    cout << ans << endl;
}


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

Measured memory_bytes: 62336
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1e16;
const ll mod = 1000000007;
const ll MAX = 2*(ll)pow(10, 5);
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  string s; cin >> s;
  bool flag = 1;
  rep(i, s.size()-1) {
    if (s.at(i) == s.at(i+1)) {
      cout << i+1 << ' ' << i+2 << endl;
      flag = 0;
      break;
    }
  }
  if (flag) {
    rep(i, s.size()-2) {
      if (s.at(i) == s.at(i+2)) {
        cout << i+1 << ' ' << i+3 << endl;
        flag = 0;
        break;
      }
    }
  }
  if (flag) cout << -1 << ' ' << -1 << endl;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int main(){
  long long int n,p,q;
  long long int x[100],y[100],h[100];
  long long int xx,yy,hh;
  long long int ans,ansx,ansy;
  bool b=true;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>x[i]>>y[i]>>h[i];
  }
  for(int i=0;i<n;i++){
    if(h[i]!=0){
      xx=x[i];yy=y[i];hh=h[i];
      break;
    }
  }
  for(int i=0;i<=100;i++){
    for(int j=0;j<=100;j++){
      p=abs(xx-i)+abs(yy-j)+hh;
      for(int k=0;k<n;k++){
	q=max(p-abs(x[k]-i)-abs(y[k]-j),(long long int)0);
	if(h[k]!=q) break;
	else if(k==n-1){
	  ansx=i;
	  ansy=j;
	  ans=p;	    
	}
		}
      }
    }
    cout<<ansx<<" "<<ansy<<" "<<ans<<endl;
    return 0;
}
     
	
      


Measured memory_bytes: 256
gets
a=gets.split.map(&:to_i).sort
if a[0]==0 then
  puts 0
else
  p=1
  a.each do |x|
    if p<=1000000000000000000 then
      p*=x
    end
  end
  puts (p<=1000000000000000000) ? p : -1
end
    

Measured memory_bytes: 23028
#include <iostream>
#include <float.h>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <iomanip>
#include <sstream>
#include <bitset>
#include <fstream>
#include <queue>
#include <math.h>
#include <set>
#include <stdlib.h>
#include <time.h>
#include <list>
#include <stack>
#include <queue>

#define For(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  For(i,0,n)

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
#define SORT(c) sort((c).begin(),(c).end())
#define vi(m,a) vector<int> m(a)
#define vti(m,a,i) vector<vector<int>> m(a,vector<int>(i))
#define ALL(it,a) for(auto it = a.begin(); it!=a.end(); it++)
#define Fe(it,a) for(auto &it : a)
#define all(a) begin(a),end(a)

using namespace std;
typedef pair<int, int> pii;
typedef long long ll;
typedef pair<ll, ll> pll;
#define WARU 1000000007;

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

ll solve(vector<int> v, bool upper) {
	ll result = 0;
	ll goukei = 0;
	rep(i, v.size()) {
		goukei += v[i];
		if (upper) {
			if (goukei <= 0) {
				result += (1 - goukei);
				goukei = 1;
			}
		}
		else {
			if (goukei >= 0) {
				result += abs(-1 - goukei);
				goukei = -1;
			}
		}
		upper = !upper;
	}
	return result;

}

int main() {
	int n;
	cin >> n;
	vector<int> v(n);
	rep(i, n)
		cin >> v[i];
	cout << min(solve(v, true), solve(v, false));
	cout << endl;

}

Measured memory_bytes: 1408
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <iomanip>
#include <algorithm>
#include <sstream>
using namespace std;
int main()
{
	int n;
	cin >> n;
	n = (180 * (n - 2));
	cout << n << endl;
	return(0);
}


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

dp=[[0]*(n+1) for i in range(n)]

for i in range(n):
    for j in range(n+1):

        if i==0:
            dp[0][0]=1-p[i]
            dp[0][1]=p[i]
        else:
            #表が出る
            if dp[i-1][j-1]!=0:
                dp[i][j]+=dp[i-1][j-1]*p[i]
            #裏
                dp[i][j-1]+=dp[i-1][j-1]*(1-p[i])

print(sum(dp[-1][int(n/2)+1:]))
#print(dp)


Measured memory_bytes: 269320
using System;
using System.Linq;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{      
        var input1 = Console.ReadLine();
        var N = int.Parse(input1.Split(' ')[0]);
        var M = int.Parse(input1.Split(' ')[1]);
       
        var input2 = Console.ReadLine().Split(' ');
        var prices = new List<Int64>();
        input2.ToList().ForEach(x=>prices.Add(Int64.Parse(x)));
 
        prices.Sort();
        prices.Reverse();
 
      	while(M > 0)
        {
          prices[0] = prices[0] / 2;
          M--;
          if(M > 0)
          {
            for(int i = 1; i < N; i++)
            {
              if (prices[0] > prices[i])
              {
                prices.Sort();
                prices.Reverse();
                break;
              }

              prices[i] = prices[i]/2;
              M--;
              if (M <= 0) break;
            }     
          }
        }
      
     	Console.WriteLine(prices.Sum());
	}
}

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

typedef long long ll;
typedef long double ld;
typedef vector<vector<int>> Graph;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
#define pi 3.14159265359
#define inf 2147483647
#define INF 9223372036854775807
#define mod 1000000007
#define mod2 998244353

int main() {
    int N; cin >> N;
    vector<int> A(N), cnt(1000000);
    ll ans = 0;
    for(int i = 0; i < N; i++) {
        cin >> A[i];
        ans += A[i];
        A[i]--;
        cnt[A[i]]++;
    }
    int Q; cin >> Q;
    int B, C;
    for(int i = 0; i < Q; i++) {
        cin >> B >> C;
        B--; C--;
        ans += cnt[B] * (C - B);
        cnt[C] += cnt[B]; cnt[B] = 0;
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 7488
using System;
using System.Linq;

// https://atcoder.jp/contests/abc125/tasks/abc125_a
namespace ABiscuitGenerator
{
    class Program
    {
        static void Main(string[] args)
        {
            // 入力の取得
            var inputs = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var a = inputs[0];
            var b = inputs[1];
            var t = inputs[2];

            var count = b * (t / a);

            // 解答の出力
            Console.WriteLine(count);
        }
    }
}


Measured memory_bytes: 13268
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
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; }
#define all(x) (x).begin(),(x).end()
#define pll pair<ll,ll>
#define pii pair<int,int>
#define rep(i,n) for(int i=0;i<n;i++)
#define sz(x) ((ll)(x).size())
#define pb push_back
#define mp make_pair
#define bit(n) (1LL<<(n))
#define F first
#define S second
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
const ll INF = 1LL<<60;
const ll mod = (int)1e9 + 7;

int main() {
    ll d,g;
    cin >> d >> g;
    ll p[d];
    ll c[d];
    ll mn=mod;
    rep(i,d){
        ll x,y;
        cin >> x >> y;
        p[i]=x;
        c[i]=x*(i+1)*100+y;
    }
    rep(i,bit(d)){
        vector<int> lis;
        vector<int> sc;
        rep(j,d){
            if(i&bit(j))lis.pb(j);
            else sc.pb(j);
        }
        ll sum=0;
        ll num=0;
        for(auto x:lis){
            sum+=c[x];
            num+=p[x];
        }
        if(sum>=g){
            chmin(mn,num);
            continue;
        }
        int mx=sc.back();
        int las=p[mx]-1;
        while(sum<g && las){
            sum+=(mx+1)*100;
            las--;
            num++;
        }
        if(sum>=g)chmin(mn,num);
    }
    cout << mn;
    


}

/*



 */




Measured memory_bytes: 256
s = input().split()
stack = []
for op in s:
    if op == "+":
        i1 = stack.pop()
        i2 = stack.pop()
        stack.append(i1+i2)
    elif op == "-":
        i1 = stack.pop()
        i2 = stack.pop()
        stack.append(i2-i1)
    elif op == "*":
        i1 = stack.pop()
        i2 = stack.pop()
        stack.append(i2*i1)
    else:
        stack.append(int(op))
print(*stack)


Measured memory_bytes: 5592
program abc163b
   implicit none
   integer :: N, M
   integer, allocatable :: A(:)
   integer :: sum_A

   read(*,*) N, M
   allocate(A(M))
   read(*,*) A(:)

   sum_A = sum(A(:))

   if (N >= sum_A) then
      print *, N - sum_A
   else
      print *, -1
   endif

   deallocate(A)

end program abc163b


Measured memory_bytes: 2884
// C++ 14
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)

/*
 * 0 1 2 3 4 5 6 7 8
 * o   o   o   o   o
 * x   x
 * 
 */
int main() {
  ll a, b, x; cin >> a >> b >> x;
  ll n = b/x + 1;
  if (a==0) {
    cout << n << endl;
    return 0;
  }
  a--;
  n -= a/x + 1;
  cout << n << endl;
  return 0;
}


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

int main() {
    int n, d;
    cin >> n >> d;
    if (n % (2 * d + 1) == 0) cout << n / (2 * d + 1) << endl;
    else cout << n / (2 * d + 1) + 1 << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

  private static int loop_num;

  static String rightTriangle(int a, int b, int c){
    String judge = "NO";
    if ((a*a)+(b*b) == (c*c) || (c*c) + (a*a) == (b*b) || (c*c) + (b*b) == (a*a)) {
      judge = "YES";
    }
    return judge;
  }

  public static void main(String[] args) {
    Scanner stdIn = new Scanner(System.in);
    loop_num = stdIn.nextInt();
    String[] result_triangle = new String[loop_num];

    for (int i = 0;i < loop_num; i++) {
      result_triangle[i] = rightTriangle(stdIn.nextInt(), stdIn.nextInt(), stdIn.nextInt());
    }

    for (String result: result_triangle) {
      System.out.println(result);
    }
  }
}

Measured memory_bytes: 33956