akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using VI = vector<int>;
using VL = vector<ll>;
using loop = int;
template<class T> using PQ = priority_queue<T, vector<T>, greater<T>>;
#define FOR(i,a,n) for(loop (i)=(a);(i)<(n);++(i))
#define eFOR(i,a,n) for(loop (i)=(a);(i)<=(n);++(i))
#define rFOR(i,a,n) for(loop (i)=(n)-1;(i)>=(a);--(i))
#define erFOR(i,a,n) for(loop (i)=(n);(i)>=(a);--(i))
#define each(i, a) for(auto &i : a)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
#define out(y,x) ((y) < 0 || h <= (y) || (x) < 0 || w <= (x))
#define line cout << "------------------------\n" 
#define ENDL(i,n) ((i) == (n) - 1 ? "\n" : " ")
#define stop system("pause") //comment out this on AOJ.
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
constexpr ld eps = 1e-10;
constexpr ld pi = 3.1415926535897932;
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; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& is, vector<T>& v) { for (auto& elemnt : v)is >> elemnt; return is; }
template<class T, class U>inline istream& operator>>(istream& is, pair<T, U>& p) { is >> p.first >> p.second; return is; }
template<class T>inline vector<T> vec(size_t a) { return vector<T>(a); }
template<class T>inline vector<T> defvec(T def, size_t a) { return vector<T>(a, def); }
template<class T, class... Ts>inline auto vec(size_t a, Ts... ts) { return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...)); }
template<class T, class... Ts>inline auto defvec(T def, size_t a, Ts... ts) { return vector<decltype(defvec<T>(def, ts...))>(a, defvec<T>(def, ts...)); }

int main() {
    init();

    string s, t; cin >> s >> t;
    if (s == t)cout << "EQUAL\n";
    else if (s.length() > t.length())cout << "GREATER\n";
    else if (s.length() < t.length())cout << "LESS\n";
    else {
        FOR(i, 0, s.length()) {
            if (s[i] == t[i])continue;
            if (s[i] > t[i])cout << "GREATER\n";
            else cout << "LESS\n";
            return 0;
        }
        cout << "EQUAL\n";
    }
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline

def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a%b)

def main():
    N = int(input())
    T = [int(input()) for i in range(N)]

    ans = T[0]
    for i in range(1, N):
        gcd_ = gcd(ans, T[i])
        ans = (ans * T[i]) // gcd_
    print(ans)
    # print(gcd_)


if __name__ == "__main__":
    main()

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

using namespace std;

#define li long long int 
#define FOR(i,l,r) for( int i = l; i < r; i++ )
#define REP(i,l,r) for( int i = l; i >= r; i-- )

li mod = 1e9+7;
li n,k;
vector<vector<li>> a;
vector<vector<li>> t;

void addMod( li & a, li b ) {
    a = (a+b)%mod;
}

li matMod( li a, li b ) {
    return (a*b)%mod;
}

void matmul( vector<vector<li>> & m ) {
    vector<vector<li>> temp(n,vector<li>(n,0));
    FOR(i,0,n) {
        FOR(j,0,n) {
            FOR(k,0,n) addMod(temp[i][j],matMod(a[i][k],m[k][j]));
        }
    }
    FOR(i,0,n) FOR(j,0,n) a[i][j] = temp[i][j];
}

void matPow( li p ) {
    if( p <= 1 ) return;
    matPow(p/2);
    matmul(a);
    if( p%2 ) matmul(t);
}

int main() {
    cin>>n>>k;
    a.assign(n,vector<li>(n,0));
    t.assign(n,vector<li>(n,0));
    FOR(i,0,n) FOR(j,0,n) {cin>>a[j][i];t[j][i] = a[j][i];}
    matPow(k);
    li ans = 0;
    FOR(i,0,n) FOR(j,0,n) addMod(ans,a[i][j]);
    cout<<ans<<"\n";
    return 0;
}

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

const int MAX = 1000000;

int main(){
  long long n, x, sum = 0, maxi = -MAX, mini = MAX;
  cin >> n;
  //  assert(n <= 10000);
  for(int i=0;i<n;i++){
    cin >> x;
    maxi = max(maxi, x);
    mini = min(mini, x);
    //assert((long long)sum + (long long)x < INT_MAX);
    sum += x;
  }
  cout << mini << ' ' << maxi << ' ' << sum << endl;
}

Measured memory_bytes: 1156
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define double long double
using namespace std;
signed main(){
  int a,b,c,f;
  cin>>a>>b>>c;
  cin>>f;
  int d=max(a,b);
    int e=max(d,c);
  int g=e;
  rep(i,f)
    e*=2;
    cout<<a+b+c-g+e;
}

Measured memory_bytes: 256
import java.util.*;
public class Main{
        public static void main(String[] args){
                Scanner sc = new Scanner(System.in);
                int n = sc.nextInt();
                int k = sc.nextInt();
                int[] a = new int[n];
                int sai = 0;
                for(int i = 0 ; i < n ; i++){
                        a[i] = sc.nextInt();
                        if(a[sai] > a[i]) sai = i;
                }
                System.out.println((int)(Math.ceil((n - 1) * 1.0 / (k - 1))));
        }
}
//条件間違えていました

Measured memory_bytes: 59172
#include <iostream>
#include <cmath>

using namespace std;

bool prime(unsigned long long x) {
	if (x < 2) {
		return false;
	} else if (x == 2) {
		return true;
	} else {
		for (unsigned long long i = 2; i <= (unsigned long long)(sqrt(x)); ++i) {
			if (x % i == 0) {
				return false;
			}
		}

		return true;
	}
}

int main() {
	unsigned long long n;
	cin >> n;

	unsigned long long x, y;
	if (prime(n)) {
		x = 1;
		y = n;
	} else {
		for (int i = (int)(sqrt(n)); i >= 1; --i) {
			if (n % i == 0) {
				x = i;
				y = n/i;
				break;
			}
		}
	}

	cout << (x+y-2) << endl;
	return 0;
}


Measured memory_bytes: 256
#![allow(unused_imports)]

use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::iter::once;
#[cfg(debug_assertions)]
include! {"./debug.rs"}

#[cfg(not(debug_assertions))]
macro_rules! debug {
    ($($arg:expr),*) => {};
}

macro_rules! read {
    ([$t:ident] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ([$t:ident]) =>
        (rl().split_whitespace().map(|w| read_type!(w, $t)).collect::<Vec<_>>());
    (_, [$t:ident] ; $n:expr) =>
        ((0..$n).map(|_| read!(_, [$t])).collect::<Vec<_>>());
    (_, [$t:ident]) =>
        (rl().split_whitespace().skip(1).map(|w| read_type!(w, $t)).collect::<Vec<_>>());
    ($($t:ident),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ($t:ident) => (read_type!(rl(), $t));
    ($($t:ident),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(read_type!(w.next().unwrap(), $t)),*)
    }};
}

macro_rules! read_type {
    ($s:expr, chars) => {
        $s.chars().collect::<Vec<char>>()
    };
    ($s:expr, usize1) => {
        read_type!($s, usize) - 1
    };
    ($s:expr, $t:ty) => {
        $s.parse::<$t>().unwrap()
    };
}

fn rl() -> String {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    buf.trim_right().to_owned()
}

trait IteratorExt: Iterator + Sized {
    fn vec(self) -> Vec<Self::Item> {
        self.collect()
    }
}

impl<T: Iterator> IteratorExt for T {}

////////////////////////////////////////////////////////////////////////////////

fn main() {
    let (l, r) = read!(i64, i64);

    let l2 = r / 2019 * 2019;
    debug!(l2);
    let ans = if l2 >= l {
        0
    } else {
        let l3 = r / 673 * 673;
        let l4 = r / 3 * 3;
        if l3 >= l && l4 >= l {
            0
        } else {
            let mut minans = 2019;
            for i in l..r {
                for j in i + 1..r + 1 {
                    minans = min(minans, i * j % 2019);
                }
            }
            minans
        }
    };

    println!("{}", ans);
}


Measured memory_bytes: 4352
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.PrintStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.FileNotFoundException;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastScanner in = new FastScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BLRUDGame solver = new BLRUDGame();
        solver.solve(1, in, out);
        out.close();
    }

    static class BLRUDGame {
        public void solve(int testNumber, FastScanner in, PrintWriter out) {
            int h = in.nextInt(), w = in.nextInt();
            int n = in.nextInt();
            int sr = in.nextInt(), sc = in.nextInt();
            String s = in.next(), t = in.next();
            boolean ans = false;
            ans |= solve(sr, h, s, t, 'U', 'D');
            ans |= solve(sc, w, s, t, 'L', 'R');
            out.println(ans ? "NO" : "YES");
        }

        private boolean solve(int sr, int h, String s, String t, char u, char d) {
            int minWin = 0, maxWin = h + 1;
            for (int i = t.length() - 1; i >= 0; i--) {
                if (t.charAt(i) == d) {
                    if (minWin + 1 <= maxWin - 1) {
                        minWin = Math.max(0, minWin - 1);
                    }
                }
                if (t.charAt(i) == u) {
                    if (minWin + 1 <= maxWin - 1) {
                        maxWin = Math.min(h + 1, maxWin + 1);
                    }
                }
                if (s.charAt(i) == d) {
                    maxWin--;
                }
                if (s.charAt(i) == u) {
                    minWin++;
                }
            }
            System.err.println(u + " " + d + " " + minWin + " " + maxWin);
            return sr <= minWin || sr >= maxWin;
        }

    }

    static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner(InputStream in) {
            br = new BufferedReader(new InputStreamReader(in));
        }

        public FastScanner(String fileName) {
            try {
                br = new BufferedReader(new FileReader(fileName));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public String next() {
            while (st == null || !st.hasMoreElements()) {
                String line = null;
                try {
                    line = br.readLine();
                } catch (IOException e) {
                }
                st = new StringTokenizer(line);
            }
            return st.nextToken();
        }

    }
}



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

int main() {
  map<string, int> m;
  int n, mx = 0;
  cin >> n;
  rep(i, n){
    string s;
    cin >> s;
    ++m[s];
  }
  for(auto mp: m){
    mx = max(mx, mp.second);
  }
  for(auto mp: m){
    if(mp.second == mx) cout << mp.first << endl;
  }
}


Measured memory_bytes: 25216
//
//  main.c
//  aoj_06
//
//  Created by k16031kk on 2018/05/17.
//  Copyright © 2018年 AIT. All rights reserved.
//

#include <stdio.h>

int main(int argc, const char * argv[]) {
    // insert code here...
    int a,b,c;
    scanf("%d %d %d",&a, &b, &c);
    if(a < b && b < c) {
        printf("Yes\n");
    } else {
        printf("No\n");
    }
    return 0;
}



Measured memory_bytes: 2048
def main(A,B,p):
    mina = min(A)
    minb = min(B)
    res = mina + minb
    for i in range(len(p)):
        x = A[p[i][0]-1]
        y = B[p[i][1]-1]
        val = x+y-p[i][2]
        if val < res:
            res = val
    return res

a,b,m = map(int,input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
p = [list(map(int, input().split())) for _ in range(m)]
print(main(A,B,p))

Measured memory_bytes: 38560
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i=0;i < (int)(n);i++)
const int INF = 1 << 30;
int main(){
   int a,b,m;
   string s;
   cin >> a >> b >> m;
   vector<int> v(a);
   vector<int> u(b);
   int rmin,mmin;
   rmin=INF;
   mmin=INF;
   rep(i,a) {
      cin >> v[i];
      rmin=min(rmin,v[i]);
   }
   rep(j,b) {
      cin >> u[j];
      mmin=min(mmin,u[j]);
   }
   int ans;
   ans=mmin+rmin;
   for (int i=0;i < m;i++){
      int x,y,c;
      cin >> x >> y >> c;
      x--;y--;
      ans=min(ans,v[x]+u[y]-c);
   }
   cout << ans << endl;
   return 0;
}


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

int main() {
  string s;
  cin>>s;
  int kotae=0;
  for(int i=s.size()-1;i>=2;i=i-2){
    string a=s.substr(0,i/2);
    string b=s.substr(i/2,i/2);
    if(a==b){
      kotae=a.size()*2;
      break;
    }
  }
  cout<<kotae<<endl;
  return 0;
}

  


Measured memory_bytes: 3636
#include <cstring>
#define REP(i,n) for(int i=0; i<(int)(n); i++)
 
#include <queue>
#include <cstdio>
inline int getInt(){ int s; scanf("%d", &s); return s; }
 
#include <set>
 
using namespace std;
 
const int MAX = 128;
int tdp[MAX][MAX];
int tdp2[MAX];
int ndp[MAX * MAX];
int dp[MAX][MAX];
 
int main(){
  const int s = getInt();
  const int t = getInt();
  const int u = getInt();
  const int n = getInt();
  const int o = getInt();
  const int d = getInt();
 
  vector<int> e(t);
  vector<int> c(t);
 
  vector<int> h(n);
  vector<int> a(n);
 
  REP(i,t){ e[i] = getInt(); c[i] = getInt(); }
  REP(i,n){ h[i] = getInt(); a[i] = getInt(); }
 
  memset(tdp, -1, sizeof(tdp));
  tdp[0][0] = 0;
 
  REP(i,t){
    for(int j = u - 1; j >= 0; j--)
      for(int k = 0; k <= s; k++){
    if(k + e[i] > s) break;
    if(tdp[j][k] >= 0)
      tdp[j + 1][k + e[i]] = max(tdp[j + 1][k + e[i]], tdp[j][k] + c[i]);
      }
  }
 
  memset(tdp2, -1, sizeof(tdp2));
  REP(i,s){
    tdp2[i + 1] = max(tdp2[i], tdp[u][i + 1]);
  }
 
  memset(ndp, -1, sizeof(ndp));
  ndp[0] = 0;
  REP(i,n){
    REP(j,MAX*MAX) if(ndp[j] >= 0){
      if(j + a[i] >= MAX * MAX) continue;
      ndp[j + a[i]] = max(ndp[j + a[i]], ndp[j] + h[i]);
    }
  }
 
  REP(i,MAX*MAX-1){
    ndp[i + 1] = max(ndp[i + 1], ndp[i]);
  }
 
  memset(dp, -1, sizeof(dp));
  dp[0][s] = 0;
 
  REP(i,d){
    REP(j,s+1) if(dp[i][j] >= 0){
      REP(k,j+1) if(tdp2[k] >= 0){
    dp[i + 1][min(s, j - k + o)] = max(dp[i + 1][min(s, j - k + o)], dp[i][j] + ndp[tdp2[k]]);
      }
    }
  }
 
  // for(int i = 0; tdp2[i] != -1; i++) printf("%d ", tdp2[i]); puts("");
  // for(int i = 0; ndp[i] != -1; i++) printf("%d ", ndp[i]); puts("");
 
  int ans = -1;
  REP(i,s+1) ans = max(ans, dp[d][i]);
  printf("%d\n", ans);
 
  return 0;
}

Measured memory_bytes: 1228
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<vector>
#include<unordered_map>
#include<unordered_set>
#include<list>
#include<queue>
#include<stack>
#include<string.h>
#include<functional>
#include<limits.h>
#define int long long
using namespace std;

int a[200001];
int r[200001];
int BIT[500000];
void add(int a) {
	while (a < 500000) {
		BIT[a]++;
		a += a&-a;
	}
}
int Sum(int a) {
	int n = 0;
	while (a > 0) {
		n += BIT[a];
		a -= a&-a;
	}
	return n;
}
signed main() {
	set<int>S;
	S.insert(0);
	int b, c; cin >> b >> c;
	for (int d = 0; d < b; d++) {
		int e; scanf("%lld", &e);
		a[d + 1] = a[d] + e;
		r[d] = a[d + 1] - (d + 1)*c;
		S.insert(r[d]);
		S.insert(-r[d]);
	}
	unordered_map<int, int>U;
	int sum = 1;
	for (int i : S) {
		U[i] = sum++;
	}
	int ans = 0;
	add(U[0]);
	for (int d = 0; d < b; d++) {
		ans += Sum(U[r[d]]);
		add(U[r[d]]);
	}
	cout << ans << endl;
}

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

int main(){
	int x, i;
	int a[10];
	cin>>x;
	for(i=3; i>=0; i--){
		a[i]=x%10;
		x/=10;
	}
	if(a[0]+a[1]+a[2]+a[3]==7) cout<<a[0]<<'+'<<a[1]<<'+'<<a[2]<<'+'<<a[3]<<"=7"<<endl;
	else if(a[0]-a[1]+a[2]+a[3]==7) cout<<a[0]<<'-'<<a[1]<<'+'<<a[2]<<'+'<<a[3]<<"=7"<<endl;
	else if(a[0]+a[1]-a[2]+a[3]==7) cout<<a[0]<<'+'<<a[1]<<'-'<<a[2]<<'+'<<a[3]<<"=7"<<endl;
	else if(a[0]+a[1]+a[2]-a[3]==7) cout<<a[0]<<'+'<<a[1]<<'+'<<a[2]<<'-'<<a[3]<<"=7"<<endl;
	else if(a[0]-a[1]-a[2]+a[3]==7) cout<<a[0]<<'-'<<a[1]<<'-'<<a[2]<<'+'<<a[3]<<"=7"<<endl;
	else if(a[0]-a[1]+a[2]-a[3]==7) cout<<a[0]<<'-'<<a[1]<<'+'<<a[2]<<'-'<<a[3]<<"=7"<<endl;
	else if(a[0]+a[1]-a[2]-a[3]==7) cout<<a[0]<<'+'<<a[1]<<'-'<<a[2]<<'-'<<a[3]<<"=7"<<endl;
	else if(a[0]-a[1]-a[2]-a[3]==7) cout<<a[0]<<'-'<<a[1]<<'-'<<a[2]<<'-'<<a[3]<<"=7"<<endl;
	return 0;
}


Measured memory_bytes: 256
import sys
input = lambda: sys.stdin.readline().rstrip()

def calc(s):
    if "." not in s:
        n = int(s) * 10 ** 9
    else:
        s1, s2 = s.split(".")
        n = int(s1) * 10 ** 9 + int(s2) * 10 ** (9 - len(s2))
    
    a = 0
    b = 0
    while n % 2 == 0:
        n //= 2
        a += 1
    while n % 5 == 0:
        n //= 5
        b += 1
    return (min(a, 18), min(b, 18))

ans = 0
N = int(input())
X = [[0] * 19 for _ in range(19)]
for _ in range(N):
    a, b = calc(input())
    if a >= 9 and b >= 9:
        ans -= 1
    X[a][b] += 1

Y = [x[:] for x in X]

for i in range(18)[::-1]:
    for j in range(19):
        Y[i][j] += Y[i+1][j]
for i in range(19):
    for j in range(18)[::-1]:
        Y[i][j] += Y[i][j+1]

for i in range(19):
    for j in range(19):
        ans += X[i][j] * Y[18-i][18-j]
print(ans // 2)

Measured memory_bytes: 68688
#include <iostream>
#include <vector>
#include <math.h>
#include <string>
#include <set>
#include <algorithm>
using namespace std;
int main(void){
    long long int h;
    cin >> h;
    long long int ans = 0;
    long long int roop = 0;
    while(true){
        if(h==1){
            ans += pow(2, roop);
            break;
        }
        
        h/=2;

        ans += pow(2, roop);
        roop++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <math.h>
#include <queue>
#include <vector>
#include <set>


using namespace std;
struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

template<class T> inline bool chmin(T& a, T b) {
  //aの方が大きければ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;
}
bool compare_a_big(pair<int,int> l,pair<int,int> r){
  //firstが大きい方からソート、firstが同じならbが小さい方から
  if(l.first != r.first){
    return l.first>r.first;
  }
  else{
    return l.second < r.second;
  }
}
bool compare_a_b_big(pair<int,int> l,pair<int,int> r){
  //firstが大きい方からソート、firstが同じならbが大きい方から
  if(l.first != r.first){
    return l.first>r.first;
  }
  else{
    return l.second > r.second;
  }
}
bool compare_b_small(pair<int,int> l,pair<int,int> r){
  //secondが小さい方からソート、firstが同じならfirstが小さい方から
  if(l.second != r.second){
    return l.second<r.second;
  }
  else{
    return l.first < r.first;
  }
}
const int INF = 1e9;


double pi = 3.14159265;

int main(){
  double a,b,x;
  cin >> a >> b>> x;
  double volume = a * a * b;
  double ans;
  if(x * 2 <= volume){
    ans = atan((x*2/(a*b))/b);
    ans = 90- 180*(ans/pi);
  }
  else{
    ans = atan(((volume-x)*2/(a*a))/a);
    ans = 180*(ans/pi);
  }

  printf("%.8f\n",ans);



}


Measured memory_bytes: 256
//↓見なくていいよ！ここから--------------------------------------------------
var read = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});
var obj;
var inLine = [];
read.on('line', function(input){inLine.push(input);});
read.on('close', function(){
  obj = init(inLine);
  myerr("-----start-----");
  var start = new Date();
  Main();
  var end = new Date() - start;
  myerr("----- end -----");
  myerr("time : " + (end) + "ms");
  myerr("memory : " + Math.round(process.memoryUsage().heapTotal / 1024) + "KB");
});
function nextInt(){return myconv(next(),1);} function nextStrArray(){return myconv(next(),2);}
function nextIntArray(){return myconv(next(),4);} function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();}
function init(input){  
  var returnObj = {
    list : input, index : 0, max : input.length,
    hasNext : function(){return (this.index < this.max);},
    next : function(){if(!this.hasNext()){throw "ArrayIndexOutOfBoundsException これ以上ないよ";}else{var returnInput = this.list[this.index];this.index++;return returnInput;}}
  };
  return returnObj;
}
function myout(s){console.log(s);}
function myerr(s){console.error("debug:" + require("util").inspect(s,false,null));}
//[no]要素の扱い。数値型
//不明値、異常時:引数そのまま返す 1:数値へ変換
//2:半角SPで分割 4:半角SPで分割し、数値配列へ
//6:1文字で分割  7:1文字で分割し、数値配列へ
//8:半角SPで結合 9:改行で結合 0:文字なしで結合
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 4:return i.split(" ").map(Number);case 6:return i.split("");case 7:return i.split("").map(Number);case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}catch(e){return i;}}

//↑見なくていいよ！ここまで--------------------------------------------------
function Main(){
	var N = nextInt();
	var list = nextIntArray();
	var map = {};
	for(var i = 0; i < N; i++){
		if(map[list[i]] == null){
			map[list[i]] = 1;
		}else{
			map[list[i]]++;
		}
	}
	var Q = nextInt();
	var output = new Array(Q);
	var keys = Object.keys(map);
	var sum = 0;
	for(var i = 0; i < keys.length; i++){
		sum += keys[i] * map[keys[i]];
	}
	for(var i = 0; i < Q; i++){
		var tmp = nextIntArray();
		var B = tmp[0];
		var C = tmp[1];
		if(map[B] != null){
			sum -= B * map[B];
			sum += C * map[B];
			if(map[C] != null){
				map[C] += map[B];
			}else{
				map[C] = map[B];
			}
			map[B] = 0;
		}
		output[i] = sum;
	}
	
	myout(myconv(output,9));
}


Measured memory_bytes: 77296
#include <bits/stdc++.h>
using namespace std;
#define ll = long long int
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
#define REP3(i,x,n) for(int i=x; i>(n); i--)
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();
int main(){

    stack<int>S1;
    stack<pair<int,int> >S2;
    char ch;
    int sum = 0;
    for(int i = 0;cin>>ch;i++){
        if(ch == '\\')S1.push(i);
        else if(ch == '/' && S1.size()>0){
            int j = S1.top();
            S1.pop();
            sum += i- j;
            int a= i - j;
            while(S2.size()>0&&S2.top().first>j){
                a += S2.top().second; S2.pop();
            }
            S2.push(make_pair(j,a));
        }
    }
    vector<int> ans;
    while(S2.size()>0){
        ans.push_back(S2.top().second);S2.pop();
    }
    reverse(ans.begin(),ans.end());
    cout << sum << endl;
    cout << ans.size();
    REP(i,ans.size()){
        cout << " ";
        cout << ans[i];
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 3268
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <inttypes.h>
#include <string.h>
#include <math.h>

int main (int argc, char const *argv[])
{
    int64_t T, X;

    scanf("%"PRId64"%"PRId64, &T, &X);

    printf("%f\n", (double)T / (double)X);

    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
    string s1,s2;
    cin>>s1>>s2;
    int i,c=0;
    for(i=0;i<3;i++)
    {
        if(s1[i]==s2[i])
        c++;
    }
    cout<<c<<endl;
   return 0;
}

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

int main() {
	char s;
	cin >> s;
	if (isupper(s)) {
		cout << 'A';
	}
	else {
		cout << 'a';
	}
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
int a, b;

int main()
{
    cin >> a >> b;
    if(a % 2 != 0 && b & 2 != 0)
    {
        cout << "Odd" << endl;
    }
    else
    {
        cout << "Even" << endl;
    }
}

Measured memory_bytes: 764
#include <bits/stdc++.h>
using namespace std;
const int N = 210;
int d[N][N], G[N][N], col[N], n; char s[N];
void dfs(int u) {
	for (int i = 1; i <= n; i++) if (G[u][i]) {
		if (!col[i]) col[i] = 3 - col[u], dfs(i);
		else if (col[u] != 3 - col[i]) {
			puts("-1"), exit(0);
		}
	}
}
int main() {
	scanf("%d", &n), memset(d, 0x3f, sizeof(d));
	for (int i = 1; i <= n; i++) {
		scanf("%s", s + 1);
		for (int j = 1; j <= n; j++) {
			G[i][j] = s[j] - '0';
			if (G[i][j] == 1) d[i][j] = 1;
		}
	}	
	col[1] = 1, dfs(1); int res = 0;
	for (int k = 1; k <= n; k++)
		for (int i = 1; i <= n; i++)
			for (int j = 1; j <= n; j++)
				d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
	for (int i = 1; i <= n; i++)
		for (int j = 1; j <= n; j++) if (d[i][j] < n) res = max(res, d[i][j] + 1);
	printf("%d\n", res);
	
} 

Measured memory_bytes: 640
#define REP(i, n) for(int i = 0; i < (int)(n); i++)

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

int gcd(int a, int b) {
	
	int c;

	while (a != 0) {
		c = a;
		a = b % a;
		b = c;
	}
	
	return b;

}

int gcd_N(vector<int> x) {
	int N = x.size();

	if (N <= 1) {
		return -1;
	}

	int g = gcd(x[0], x[1]);
	
	REP(i, N - 2) {
		g = gcd(g, x[i + 2]);
	}

	return g;

}

int main() {

	int N;
	int X;
	cin >> N >> X;

	vector<int> x(N);

	REP(i, N) {
		int a;
		cin >> a;
		x[i] = abs(X - a);
	}
 
	int D = 0;

	if (N == 1) {
		cout << x[0] <<endl;
	}
	else {
		int D = gcd_N(x);
		cout << D << endl;
		//REP(i, N - 1) {
		//	//D = min(D, gcd(x[i + 1] - x[i], x[i + 2] - x[i + 1]));
		//	D = max(D, gcd(abs(x[i] - X), abs(x[i + 1] - X)));
		//}
		//cout << D << endl;
	}

	return 0;
}

Measured memory_bytes: 1024
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace C
{
    public class Program
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var n = int.Parse(Console.ReadLine());
            var s = Console.ReadLine();
            var count = 1;
            for (var i = 1; i < s.Length; i++)
            {
                if (s[i] != s[i - 1])
                {
                    count++;
                }
            }
            Console.WriteLine(count);
        }
    }
}


Measured memory_bytes: 13116
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <sstream>
#include <algorithm>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <climits>
#include <bitset>
#include <functional>
#include <numeric>
#include <ctime>
#include <cassert>
#include <cstring>
#include <fstream>

#define rep(i, n) for(int (i)=0;(i)<(n);(i)++)
using ll = long long;

using namespace std;

int main() {
    int h, w;
    cin >> h >> w;
    vector<string> board(h);
    rep(i, h) {
        cin >> board[i];
    }
    vector<vector<int>> left(h, vector<int>(w, 0));
    auto right(left), top(left), bottom(left);

    rep(i, h) {
        int l = 0, r = 0;
        rep(j, w) {
            if(board[i][j] == '.') l++;
            else l = 0;
            left[i][j] = l;
            if(board[i][w-j-1] == '.') r++;
            else r = 0;
            right[i][w-j-1] = r;
        }
    }
    rep(j, w) {
        int t = 0, b = 0;
        rep(i, h) {
            if(board[i][j] == '.') t++;
            else t = 0;
            top[i][j] = t;
            if(board[h-i-1][j] == '.') b++;
            else b = 0;
            bottom[h-i-1][j] = b;

        }
    }

    int maxx = 0;
    rep(i, h) {
        rep(j, w) {
            if(board[i][j] == '.'){
                maxx = max(maxx, left[i][j] + right[i][j] + top[i][j] + bottom[i][j] - 3);
            }
        }
    }
    cout << maxx << endl;
    return 0;
}

Measured memory_bytes: 69120
N, K = map(int, input().split())
H = list(map(int, input().split()))
H = [H[0]] * K + H

# dp[i] := 足場iに来るのにかかる最小のコスト
INF = 10**18
dp = [INF] * (K + N)
dp[0] = 0
for i in range(K, N + K):
    h = H[i]
    dp[i] = min(x + abs(y - h) for x, y in zip(dp[i - K:i], H[i - K:i]))
#     for j in range(1, K + 1):
#         v = dp[i - j] + abs(H[i] - H[i - j])
#         dp[i] = min(dp[i], v)
# print('dp', dp)
ans = dp[-1]
print(ans)


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

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

template<class T> bool umin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool umax(T &a, T b) { return a < b ? (a = b, true) : false; }

using namespace std;

int main(int argc, char** argv) 
{
#ifdef HOME
	if(IsDebuggerPresent())
	{
		freopen("../in.txt", "rb", stdin);
		freopen("../out.txt", "wb", stdout);
	}
#endif
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.precision(10);
	cout << fixed;
	int N, K;
	cin >> N >> K;
	vector<int> p(N);
	for (auto& pi : p)
		cin >> pi;
	sort(all(p));
	p.resize(K);
	cout << accumulate(all(p), 0) << endl;
	return 0;
}


Measured memory_bytes: 3616
// created on : Sun Jun 14 2020
 
import java.io.*;
import java.util.*;

public class Main {

    public static void main(String[] args) throws IOException {
        int a[] = new int[5];
        int ans = 0;
        for(int i = 0; i < 5; i++){
            a[i] = in.nextInt();
            if(a[i] == 0){
                ans = i + 1;
            }
        }
        println(ans);
        in.close();
        out.close();
    }

    static int MIN = Integer.MIN_VALUE;
    static int MAX = Integer.MAX_VALUE;
    static Reader in = new Reader();
    static PrintWriter out = new PrintWriter(System.out);

    static int[] readInt(int N) throws IOException { 
    	int arr[] = new int[N];
    	for(int i = 0; i < N; i++){ 
    		arr[i] = in.nextInt(); 
    	} 
    	return arr;
    }
    
    static long[] readLong(int N) throws IOException { 
    	long arr[] = new long[N];
    	for(int i = 0; i < N; i++){ 
    		arr[i] = in.nextLong(); 
    	} 
    	return arr;
    }
    
    static void print(Object O) {  
    	out.print(O); 
    }
    
    static void println(Object O) { 
    	out.println(O); 
    }
    
    static void println(int arr[]) { 
    	for(int i = 0; i < arr.length; i++){ 
    		print(arr[i] + " "); 
    	} 
    	println(""); 
    }
    
    static void displayRuntime(long startTime){
        long stopTime = System.currentTimeMillis();
        long elapsedTime = stopTime - startTime;
        System.out.println("Runtime: " + elapsedTime / 1000D);
    }
}

class Reader {
    BufferedReader reader;
    StringTokenizer tokenizer;

    Reader() {
        reader = new BufferedReader(new InputStreamReader(System.in));
        tokenizer = new StringTokenizer("");
    }

    String next() throws IOException {
        while (!tokenizer.hasMoreTokens() ) { 
            tokenizer = new StringTokenizer(reader.readLine()); 
        }
        return tokenizer.nextToken();
    }

    int nextInt() throws IOException { 
        return Integer.parseInt(next()); 
    }
    
    double nextDouble() throws IOException { 
        return Double.parseDouble(next());
    }
    
    long nextLong() throws IOException { 
        return Long.parseLong(next()); 
    }
    
    String nextLine() throws IOException { 
        return reader.readLine(); 
    }
    
    void close() throws IOException { 
        reader.close(); 
    }
}


Measured memory_bytes: 25360
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using static System.Math;

class Program
{
    static long mod = (long)1e6 + 3;
    static long[] f = new long[mod]; //階乗
    static long[] invf = new long[mod]; //階乗の逆元

    static void Main()
    {
        f[0] = 1;
        invf[0] = 1;
        for (int i = 1; i < mod; i++)
        {
            f[i] = f[i - 1] * i % mod;
            invf[i] = inv(f[i]);
        }
        int q = int.Parse(Console.ReadLine());
        for (int i = 0; i < q; i++)
        {
            long[] input = Console.ReadLine().Split().Select(long.Parse).ToArray();
            Console.WriteLine(Ans(input[0], input[1], input[2]));
        }
    }

    static long Ans(long x, long d, long n)
    {
        x %= mod;
        if (x == 0) return 0;
        if (n == 1) return x;
        if (d == 0) return pow(x, n);
        long y = x * inv(d) % mod;
        long r = (y + n - 1 + mod) % mod;
        long l = (y - 1 + mod) % mod;
        if (n >= mod || l > r) return 0;
        long ans = pow(d, n);
        return ans * f[r] % mod * invf[l] % mod;
    }

    static long pow(long a, long k)
    {
        if (k == 0) return 1;
        if (k == 1) return a % mod;
        long t = pow(a, k / 2);
        if (k % 2 == 0) return t * t % mod;
        return t * t % mod * a % mod;
    }

    static long inv(long k)
    {
        return pow(k, mod - 2);
    }
}

Measured memory_bytes: 33440
pub fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

pub fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

pub fn read_vec2<T: std::str::FromStr>(n: usize) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

pub fn read_col<T: std::str::FromStr>(n: usize) -> Vec<T> {
    (0..n).map(|_| read()).collect()
}

fn f(u: usize, p: usize, c: u64, edges: &Vec<Vec<(usize, u64)>>, depth: &mut Vec<u64>) {
    depth[u as usize] = c;
    for v in &edges[u] {
        if v.0 == p {
            continue;
        }
        f(v.0, u, c + v.1, edges, depth);
    }
}

fn dist(a: u32, b: u32) -> u32 {
    if a > b {
        a - b
    } else {
        b - a
    }
}

fn main() {
    let _: usize = read();
    let mut avec: Vec<u32> = read_vec();
    avec.sort();
    let big = avec.pop().unwrap();
    let mid = (big + 1) / 2;

    let mut small = 2000000000;
    let mut tmp = 2000000000;
    for a in avec {
        let dst = dist(a, mid);
        if dst < tmp {
            tmp = dst;
            small = a;
        }
    }

    println!("{} {}", big, small);
}


Measured memory_bytes: 6396
//matrix.cpp
#include<iostream>
using namespace std;

int main()
{
    int n,m,i,j,c;
    cin>>n>>m;
    int matrix[n][m],b[m];
    for ( i = 0; i < n; i++)
    {
        for ( j = 0; j < m; j++) cin>>matrix[i][j];
    }
    for ( i = 0; i < m; i++) cin>>b[i];
    for ( i = 0; i < n; i++)
    {
        c=0;
        for ( j = 0; j < m; j++) c+=matrix[i][j]*b[j];
        cout<<c<<endl;
    }
}


Measured memory_bytes: 3124
N, A, B, K = map(int, input().split())
mod = 998244353
m = N

fac = [1] * (m + 1)
inv = [1] * (m + 1)
for i in range(1, m + 1):
	fac[i] = fac[i - 1] * i % mod
inv[-1] = pow(fac[-1], mod - 2, mod)
for i in range(m - 1, -1, -1):
	inv[i] = inv[i + 1] * (i + 1) % mod

def cmb(n, r):
	assert n >= r >= 0
	return fac[n] * inv[n - r] * inv[r] % mod

ans = 0
for r in range(N + 1):
	if (K - A * r) % B == 0:
		b = (K - A * r) // B
		if 0 <= b <= N:
			ans += cmb(N, r) * cmb(N, (K - A * r) // B)
			ans %= mod
print(ans)

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

int main() {
  int A, B, C, K, x, y, z;
  cin >> A >> B >> C >> K;
  
  int ans = 0;
  x = 0; y = 0; z = 0;
  for (int i = 0; i < A && i < K; i++ ){
    ans++;
    x++;
  }
  
  for (int i = 0; i < B && i + x < K; i++ ){
    y++;
  }
  
  for (int i = 0; i < C && i + x + y < K; i++ ){
    ans--;
    z++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3572
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define repr(i,j,n) for(int i=(j),i##_len=(n);i<i##_len;++i)
#define all(x) (x).begin(),(x).end()
using namespace std;

struct UnionFind
{
    vector<int> par;

    UnionFind(int n) : par(n)
    {
        rep(i, n) par[i] = i;
    }

    int root(int x)
    {
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y)
    {
        int rx = root(x);
        int ry = root(y);
        if (rx == ry) return;
        par[rx] = ry;
    }

    int same(int x, int y)
    {
        return root(x) == root(y);
    }
};

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

    int n; cin >> n;
    int sum = -n;
    rep(i, n)
    {
        int a; cin >> a;
        sum += a;
    }
    cout << sum << endl;

    return 0;
}

Measured memory_bytes: 256
// 2014/06/16 Tazoe

#include <iostream>
using namespace std;

const int INF = 1000000000;

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

		if(n==0 && m==0)
			break;

		int C[100][100];
		int T[100][100];
		for(int i=0; i<m; i++){
			for(int j=0; j<m; j++){
				if(i==j){
					C[i][j] = T[i][j] = 0;
				}
				else{
					C[i][j] = T[i][j] = INF;
				}
			}
		}

		for(int i=0; i<n; i++){
			int a, b, c, t;
			cin >> a >> b >> c >> t;

			C[a-1][b-1] = C[b-1][a-1] = c;
			T[a-1][b-1] = T[b-1][a-1] = t;
		}
//???????????§????????£?????????
//????????????
		for(int k=0;k<m;k++){
			for(int i=0;i<m;i++){
				for(int j=0;j<m;j++){
					if(C[i][j]>C[i][k]+C[k][j]){
						C[i][j]=C[i][k]+C[k][j];
					}
				}
			}
		}
//????????????
		for(int k=0;k<m;k++){
			for(int i=0;i<m;i++){
				for(int j=0;j<m;j++){
					if(T[i][j]>T[i][k]+T[k][j]){
						T[i][j]=T[i][k]+T[k][j];
					}
				}
			}
		}
//???????????????
		int k;
		cin>>k;
		for(int i=0;i<k;i++){
			int p,q,r;
			cin>>p>>q>>r;
			if(r==0)cout<<C[p-1][q-1]<<endl;
			if(r==1)cout<<T[p-1][q-1]<<endl;
		
		}
	}

	return 0;
}

Measured memory_bytes: 3168
#include <stdio.h>
int main(){
  int n,k,x,y,r;
  scanf("%d%d%d%d",&n,&k,&x,&y);
  if(n>=k)r=k*x+(n-k)*y;
  else r=n*x;
  printf("%d",r);
  return 0;
}

Measured memory_bytes: 128
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;

class Solution {
public:
    vector<int> solve(vector<int>& A) {
        int N = A.size();
        const long long MOD = N;

        vector<long long> invs(N + 1, 1);
        for (int i = 2; i <= N; ++i) {
            invs[i] = (MOD - MOD / i) * invs[MOD % i] % MOD;
        }
        vector<long long> dp(N + 1, 0);
        vector<long long> ndp(dp);
        dp[0] = 1;

        for (int x = 0; x < N; ++x) {
            fill(ndp.begin(), ndp.end(), 0);
            for (int i = 0; i < N; ++i) {
                ndp[i + 1] = dp[i];
            }
            for (int i = 0; i < N; ++i) {
                (ndp[i] += MOD - dp[i] * x % MOD) %= MOD;
                // ndp[i] -= dp[i] * x;
            }
            swap(ndp, dp);
        }

        vector<int> res(N, 0);
        for (int x = 0; x < N; ++x){
            if (A[x] != 0) {
                ndp = dp;
                long long Q = 1;
                for (int y = 0; y < N; ++y) {
                    if (y != x) {
                        int z = x - y;
                        if (z < 0) {
                            z += MOD;
                        }
                        (Q *= invs[z]) %= MOD;
                    }
                }
                for (int i = N; i > 0; --i) {
                    (res[i - 1] += ndp[i] * Q % MOD) %= MOD;
                    (ndp[i - 1] += ndp[i] * x % MOD) %= MOD;
                }
            }
        }
        return res;
    }
};

int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int p;
    cin >> p;
    vector<int> A(p);
    for (int i = 0; i < p; ++i) {
        cin >> A[i];
    }
    Solution sol;
    auto res = sol.solve(A);
    for (int i = 0; i < p; ++i) {
        cout << res[i] << (i == p - 1 ? '\n' : ' ');
    }
    return 0;
}

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

int main(){
  int a,b;
  cin >> a >> b;
  int ans = -1;
  for ( int i = 0; i < 1e9 + 1; ++i ) {
    if(abs(a - i) == abs(b - i)){
      ans = i;
      break;
    }
  }
  if(ans == -1)cout << "IMPOSSIBLE" << endl;
  else cout << ans << endl;
  return 0;
}


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

int main()
{
  int N;
  cin >> N;
  int ans;
  for (int i = N; i >= 0; i--)
  {
    double root = sqrt(i);
    if (floor(root) == ceil(root))
    {
      ans = i;
      break;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))
A.sort()
S = [0 for _ in range(N)]
cnt = 1
S[0] = A[0]
for i in range(N-1):
  S[i+1] = A[i+1] + S[i]
for i in range(N-1, 0, -1):
  if A[i] <= 2 * S[i-1]:
    cnt += 1
  else:
    break
print(cnt)

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

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

using namespace std;

template <class T>
using vec = std::vector<T>;
typedef long long ll;
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;

const double PI = acos(-1.0);

// long long積のオーバーフロー検出
bool detect_mul_overflow(ll a, ll b)
{
    return a >= LONG_MAX / b;
}

int lcm(int a, int b)
{
    //最小公倍数
    return a / __gcd(a, b) * b;
}

struct edge
{
    int from, to, cost;
};

// int型の2次元配列(3×4要素の)の宣言
// vector<vector<int>> data(3, vector<int>(4));

int H,W,K;


int main()
{
    cin>>H>>W>>K;
    vec<vec<char>> bd(H , vec<char> (W,'.'));
    rep(i,H){
        rep(j,W){
            cin>>bd[i][j];
        }
    }
    int ans=0;

    for (int bit_h = 0; bit_h < (1<<H); ++bit_h) {
        for (int bit_w = 0; bit_w < (1<<W); ++bit_w) {
            int count=0;
            rep(i,H){
                rep(j,W){
                    if(bit_h & (1<<i)){
                        if(bit_w & (1<<j)){
                            if(bd[i][j]=='#') count++;
                        }
                    }
                }
            }
            if(count==K) ans++;
        }
    }

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


Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
int64_t MOD = 1e9 + 7;
int main(){
    int64_t n, k, ans = 0;
    cin >> n >> k;
    while(k <= n + 1){
        int64_t MAX, MIN;
        MAX = (2 * n - k + 1) * k / 2;
        MIN = (k - 1) * k / 2;
        ans += MAX - MIN + 1;
        ans %= MOD;
        k++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3636
#include <iostream>
//#include <iomanip>
//#include <algorithm>
//#include <numeric>
//#include <queue>
//#include <math.h>
#include <vector>
//#include <string>
//typedef long long LL;
using namespace std;

int main(){
    int n;
    vector<int> v;
    vector<int> c;
    int tmp_v;
    int tmp_c;
    int ans=0;

    cin >> n;
    for(int i=0; i<n; i++){
        cin >> tmp_v;
        v.push_back(tmp_v);
    }

    for(int i=0; i<n; i++){
        cin >> tmp_c;
        c.push_back(tmp_c);
    }
    for(int i=0; i<n; i++){
        if(v[i]>c[i]){
            ans += v[i] - c[i];
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 764
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
int n,m,C,S,T,p[21],q[21][51],r[21][51];
int G[20][101][101];

void init(){
  for(int i=0;i<20;i++)
    for(int j=0;j<100;j++)
      for(int k=0;k<100;k++)G[i][j][k]=1e9;
}

int calc(int c,int D){
  int res=0;
  for(int i=1;i<p[c]&&D;i++){
    int d=min(D,q[c][i]-q[c][i-1]);
    D-=d;
    res+=d*r[c][i-1];
  }
  if(D) res+=D*r[c][p[c]-1];
  return res;
}

int dijkstra(){
  int D[101];
  for(int i=0;i<101;i++) D[i]=1e9;
  priority_queue<P,vector<P>,greater<P> > Q;
  Q.push(P(0,S));
  D[S]=0;
  while(!Q.empty()){
    P t=Q.top();Q.pop();
    int pos=t.second,cost=t.first;
    if(pos==T)return cost;
    if(D[pos]<cost)continue;
    
    for(int c=0;c<C;c++)
      for(int i=0;i<n;i++){
	if(G[c][pos][i]==1e9)continue;
	int ncost=cost+calc(c,G[c][pos][i]);
	if(D[i]>ncost)D[i]=ncost,Q.push(P(ncost,i));
      }
  }
  return -1;
}

void WF(){
  for(int c=0;c<C;c++)
    for(int k=0;k<n;k++)
      for(int i=0;i<n;i++)
	for(int j=0;j<n;j++)
	  G[c][i][j]=min(G[c][i][j],G[c][i][k]+G[c][k][j]);
}

int main(){
  while(1){
  cin>>n>>m>>C>>S>>T;
  S--,T--;
  if(!n)break;
  
  init();
  for(int i=0,a,b,d,c;i<m;i++){
    cin>>a>>b>>d>>c; a--,b--,c--;
    G[c][a][b]=G[c][b][a]=min(G[c][a][b],d);
  }

  for(int i=0;i<C;i++) cin>>p[i];
  for(int i=0;i<C;i++){
    for(int j=1;j<p[i];j++)cin>>q[i][j];    
    for(int j=0;j<p[i];j++)cin>>r[i][j];
  }

  WF();
  cout<<dijkstra()<<endl;
  }
  return 0;
}

Measured memory_bytes: 3996
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <functional>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <tuple>
#include <complex>
#include <cassert>
#include <exception>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<P> vp;
#define rep(i,a,n) for(ll i = (a);i < (n);i++)
#define per(i,a,n) for(ll i = (a);i > (n);i--)
#define lep(i,a,n) for(ll i = (a);i <= (n);i++)
#define pel(i,a,n) for(ll i = (a);i >= (n);i--)
#define clr(a,b) memset((a),(b),sizeof(a))
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define sz size()
#define print(X) cout << (X) << "\n"
static const int INF = 1e+9+7;
ll n,m,l;
string s,t;
ll d[200010],dp[300][300];
char field[200][200];

int main(){
  cin >> n >> m >> l;
  if(n + m < l)puts("NO");
  else if(n > l)puts("NO");
  else puts("YES");
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll lcm(int a,int b)
{
  ll g=__gcd(a,b);
  return (a/g)*b;
}
int main()
{
  int n,m;
  cin>>n>>m;
  string s,t;
  cin>>s>>t;
  ll l=lcm(n,m);
  ll l2=lcm(l/n,l/m);
  if(s[0]!=t[0])
  {
    cout<<-1<<endl;
    return 0;
  }
  for(int i=1;i<=(l/l2);i++)
  {
    if(((i*l2)/(l/n))>=n || ((i*l2)/(l/m))>=m)break;
    if(s[(i*l2)/(l/n)]!=t[(i*l2)/(l/m)])
    {
      cout<<-1<<endl;
      return 0;
    }
  }
  cout<<l<<endl;
  return 0;
}
    
    

Measured memory_bytes: 512