akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
 
#define int long long
#define pb push_back
#define ub upper_bound
#define lb upper_bound
#define mp make_pair
#define F first
#define S second
#define FOR(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define SORT(c) sort((c).begin(),(c).end())
#define ve vector
#define vi vector<int>
#define vp vector<pair<int,int>>
#define vvi vector<vector<int>>
 
using ll = long long;
const ll INF = LLONG_MAX - 100;
ll mod = 1e9 + 7;
int dx[] = {-1,0,1,0}, dy[] = {0,1,0,-1};
vector<ll> prime;

class fact {
public:
	int fmod = 1e9+7;
	vector<int> fac, inv;
	fact (int n, int Mod = 1e9+7) {
		fmod = Mod;
		fac = vector<int>(n,0);
		inv = vector<int>(n,0);
		fac[0] = 1; for (int i = 1; i < n; i++) fac[i] = fac[i-1] * i % fmod;
		for (int i = 0;i < n;i++) inv[i] = fact::POW(fac[i],fmod-2);
	}
	ll nCr(ll n, ll r) {return (fac[n] * inv[r] % fmod) * inv[n-r] % fmod;}
	ll POW(ll a, ll b) {ll c = 1; while (b > 0) {if (b & 1) {c = a * c%fmod;}a = a * a%fmod; b >>= 1;}return c;}
};
 
template <class T = ll> T in() {T x; cin >> x; return (x);}
void DEBUG(vector<int> a) {for(int i=0;i<a.size();i++)cout<<a[i]<<" ";cout<<endl;}
void EMP(int x) {cout<<"!!!"<<x<<"!!!"<<endl;}
ll GCD(ll a, ll b) {ll c; while (b != 0) {c = a % b; a = b; b = c;}return a;}
ll LCM(ll a, ll b) {return a * b / GCD(a, b);}
ll POW(ll a, ll b) {ll c = 1; while (b > 0) {if (b & 1) {c = a * c%mod;}a = a * a%mod; b >>= 1;}return c;}
void PRI(ll n) {bool a[n + 1LL]; for (int i = 0; i < n + 1LL; i++) {a[i] = 1LL;}for (int i = 2; i < n + 1LL; i++) {if (a[i]) {prime.pb(i); ll b = i; while (b <= n) {a[b] = 0; b += i;}}}}
template <typename T> T chmin(T& a, T b) {if(a>b)a=b;return a;}
template <typename T> T chmax(T& a, T b) {if(a<b)a=b;return b;}
bool isSqrt(ll a) {return pow(sqrt(a),2) == a ? 1 : 0;}
void YesNo(bool a) {if (a) cout << "Yes"; else cout << "No"; cout << endl;}
void yesno(bool a) {if (a) cout << "yes"; else cout << "no"; cout << endl;}
void YESNO(bool a) {if (a) cout << "YES"; else cout << "NO"; cout << endl;}

class UnionFind {
private:
	vector<int> par;
public:
	UnionFind(int N) { par = vector<int>(N, -1); }
	int find(int x);
	ll size(int x);
	void unite(int x, int y);
	bool same(int x, int y);
};

int UnionFind::find(int x) {
	if (par[x] < 0) return x;
	else return par[x] = find(par[x]);
}
 
ll UnionFind::size(int x) {
	return -par[find(x)];
}
 
void UnionFind::unite(int x, int y) {
	x = find(x);
	y = find(y);
 	if (x == y) return;
	//大きい方に小さい方をくっ付ける
	if (size(x) < size(y)) swap(x, y);
	par[x] += par[y];
	par[y] = x;
}
 
bool UnionFind::same(int x, int y) {
	x = find(x);
	y = find(y);
	return x == y;
}

bool solve() {
    int n,a,b; cin >> n >> a >> b;
    if (a > b || (n == 1&&a+1 < b)) {
        cout << 0 << endl;
    } else {
        cout << (n - 2) * (b - a) + 1 << endl;
    }
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	solve();
}


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

int main() {
    string s;
    
    cin>>s;
    int n=s.size();
    int ok=1;
    rep(i,0,n/2)if(s[i]!=s[n-1-i])ok=0;
    int m=n/2;
    rep(i,0,m/2)if(s[i]!=s[(n-1)/2-i-1])ok=0;
    rep(i,0,m/2)if(s[i+(n+3)/2-1]!=s[n-1-i])ok=0;
    if(ok)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef tree < int,  null_type,  less<int>,  rb_tree_tag,  tree_order_statistics_node_update > ordered_set;
typedef long long ll;
#define pb push_back
#define pi (acos(-1))
#define ull  unsigned long long
#define ld long double
#define all(v) v.begin(), v.end()
///freopen("input.txt","r",stdin);
///freopen("output.txt","w",stdout);
ll LCM(ll a, ll b)
{
    ll g = __gcd(a,b);
    return (a/g)*b ;
}
string numtostr(ll n)
{
    ostringstream str1 ;
    str1 << n ;
    return str1.str();
}
ll strtonum(string s)
{
    ll x ;
    stringstream str1(s);
    str1 >> x ;
    return x ;
}
ll pwr(ll b,ll p)
{
    if(p==0)
        return 1;
    if(p%2==0)
    {
        ll a=pwr(b,p/2);
        return a*a;
    }
    else
        return b*pwr(b,p-1);
}
#define mx 1000000
int t,n,i,j,sq;
int main(void)
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    vector<int>v(mx);
    for(i=1; i<mx; ++i)
        v[i]=0;
    for(i=1; i<mx; ++i)
    {
        sq=(int)sqrt(i);
        for(j=1; j<=sq; ++j)
        {
            if(i%j==0)
            {
                if(j==(i/j))
                    v[i]+=1;
                else
                    v[i]+=2;
            }
        }
    }
    for(i=2;i<mx;++i)
        v[i]+=v[i-1];
    cin>>n;
    cout<<v[n-1]<<'\n';
    return 0;
}


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

#define ll long long
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define uniqueV(x) sort(x.begin(), x.end()); x.erase(unique(x.begin(), x.end()), x.end());
#define rep(i, n) for (int (i) = (0); (i) < (n); ++(i))
#define repp(i, m, n) for (int (i) = (m); (i) < (n); ++(i))
#define dbg(x) cerr << #x << ": " << x << endl;
#define dbg2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define dbg3(x, y, z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = "<<"("<<x<<", "<<y<<", "<<z<<")"<<endl;
#define dbgB(value, size) cerr<<#value<<": "<<bitset<size>(value) << endl;
#define line() cerr << "---------------" << endl;

const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, -1, 1};
const double PI = 3.14159265358979323846;

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }

template<typename T>
void printA(vector<T> &printArray, char between = ' ') {
   int paSize = printArray.size();
   for (int i = 0; i < paSize; i++) { cerr << printArray[i] << between;}
   if (between != '\n') {cerr << endl;}
}

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

int N, W;
int v[111], w[111];
int dp[111][111111];

void solve() {
   rep (i, N) {
      for (int j = 0; j <= W; j++) {
         dp[i+1][j] = max(dp[i+1][j], dp[i][j]);
         if (j + w[i] <= W) {
            dp[i+1][j+w[i]] = max(dp[i+1][j+w[i]], dp[i][j] + v[i]);
         }
      }
   }

   cout << dp[N][W] << endl;
}

int main() {
   cin >> N >> W;
   rep (i, N) { cin >> v[i] >> w[i]; }

   solve();

   return 0;
}


Measured memory_bytes: 7404
using System;

class program
{
    public static void Main()
    {
        int[] hist = new int[26];

        string str;

        while (true)
        {
            str = Console.ReadLine();

            if (str == null) break;

            str = str.ToLower();

            foreach (char s in str)
            {
                if (s >= 'a' && s <= 'z')
                {
                    hist[s - 97]++;
                }
            }
        }

        for (var i = 0; i <= 25; i++)
        {
            Console.WriteLine("{0} : {1}", (char)(i + 97), hist[i]);
        }
    }
}

Measured memory_bytes: 5672
n = int(input())
s = input()
count = 0

for i in range(1000):
    num = str(i).zfill(3)
    if num[0] in s:
        a1 = s.index(num[0])
        if num[1] in s[a1+1:]:
            a2 = a1+s[a1+1:].index(num[1])+1
            if num[2] in s[a2+1:]:
                count += 1

print(count)


Measured memory_bytes: 3188
import java.util.Scanner;

public class Main {

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

    private Scanner scan = new Scanner(System.in);
    private int n;
    private int m;

    public Main() {
	n = Integer.parseInt(scan.next());
	m = Integer.parseInt(scan.next());
	scan.close();
    }

    public final void answer() {
	System.out.println((n-1)*(m-1));
    }
}


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

char in[120];
pair<pair<string,int>,int> p[110];
int main(){
  int a;scanf("%d",&a);
  for(int i=0;i<a;i++){
    int t;scanf("%s%d",in,&t);
    string tmp=in;
    p[i]=make_pair(make_pair(in,-t),i);
  }
  std::sort(p,p+a);
  for(int i=0;i<a;i++)printf("%d\n",p[i].second+1);
}


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

int main() {
	string s;
	cin >> s;
	int q;
	cin >> q;
	int dir = 0;
	list<char> ls(s.begin(), s.end());
	for (int i = 0; i < q; ++i) {
		int t;
		cin >> t;
		if (t == 1) dir = !dir;
		else {
			int f;
			char c;
			cin >> f >> c;
			--f;
			if (dir + f == 1) ls.push_back(c);
			else ls.push_front(c);
		}
	}
	if (dir == 1) reverse(ls.begin(), ls.end());
	for (char c : ls) cout << c;
	cout << endl;
}

Measured memory_bytes: 9984
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mod 1000000007
main()
{
    ll n,a,b,ans,x;
    cin>>n>>a>>b;
    ans=(n/(a+b))*a;
    x=n%(a+b);
    ans+=min(a,x);
    cout<<ans<<endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define all(x) (x).begin(), (x).end()
#define PI 3.14159265358979323846264338327950L
using namespace std;
typedef long long ll;
typedef long double ld;
int main() {
    int n;
    cin>>n;
    ll a;
    int two=0,four=0,hoka=0;
    rep(i,n){
        cin>>a;
        if(a%2==0){
            if(a%4==0) four++;
            else two++;
        }
        else hoka++;
    }
    if((hoka-four<=0&&two!=0)||(hoka-four<=1&&two==0)) cout<<"Yes";
    else cout<<"No";
}

Measured memory_bytes: 3572
#pragma region kyomukyomupurin

/**
 *    author  : 𝒌𝒚𝒐𝒎𝒖𝒌𝒚𝒐𝒎𝒖𝒑𝒖𝒓𝒊𝒏
 *    created : 2020-04-24 14:34:50
 **/

#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <chrono>
#include <cmath>
#include <complex>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

using int64 = long long;

template <class T>
using binary_heap = std::priority_queue<T, std::vector<T>, std::greater<T>>;

template <class T, class U>
std::ostream& operator<<(std::ostream& os, const std::pair<T, U>& p) {
  return os << '(' << p.first << ", " << p.second << ')';
}

template <class T>
std::ostream& operator<<(std::ostream& os, const std::vector<T>& vec) {
  int flag = 0;
  for (auto e : vec) os << (flag++ ? ", " : "{") << e;
  return os << '}';
}

template <class T>
std::ostream& operator<<(std::ostream& os, const std::set<T>& st) {
  int flag = 0;
  for (auto e : st) os << (flag++ ? ", " : "{") << e;
  return os << '}';
}

template <class T, class U>
std::ostream& operator<<(std::ostream& os, const std::map<T, U>& mp) {
  int flag = 0;
  for (auto e : mp) os << (flag++ ? ", " : "{") << e;
  return os << '}';
}

template <class T>
std::istream& operator>>(std::istream& is, std::vector<T>& vec) {
  for (T& e : vec) is >> e;
  return is;
}

#define all(_) begin(_), end(_)
#define rall(_) rbegin(_), rend(_)

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]: ", debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

void debug_out() { std::cerr << '\n'; }

template <class Head, class... Tail>
void debug_out(Head&& head, Tail&&... tail) {
  std::cerr << head;
  if (sizeof...(Tail) != 0) std::cerr << ", ";
  debug_out(std::forward<Tail>(tail)...);
}

#pragma endregion kyomukyomupurin

int64 dp[10101];

const int64 inf = 1e18;

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

  int N, W; cin >> N >> W;
  fill(all(dp), inf);

  dp[0] = 0;

  for (int i = 0; i < N; ++i) {
    int v, w; cin >> v >> w;
    for (int j = 10000 + 5; j >= 0; --j) {
      if (j - v < 0) continue;
      dp[j] = min(dp[j], dp[j - v] + w);
    }
  }

  for (int i = 10000 + 5; i >= 0; --i) {
    if (dp[i] <= W) {
      cout << i << '\n'; return 0;
    }
  }

  return 0;
}


Measured memory_bytes: 3304
#include <cstdio>
#include <algorithm>
using namespace std;
int n,m,x;
int c[15],a[15][15],b[15],d[15],len,sum=100000000,cost;
void init(){//数据读取
	int i,j;
	scanf("%d%d%d",&n,&m,&x);
	for(i=1;i<=n;i++){
		scanf("%d",&c[i]);
		for(j=1;j<=m;j++)
			scanf("%d",&a[i][j]);
	}
}
void dfs(int step){
	int i,j,k;
	if(step==len+1){//深搜结束条件
		for(k=1;k<=m;k++)d[k]=0;//d[k]表示被选择的书店，在k列位置上的和
		for(j=1;j<=len;j++)
			for(k=1;k<=m;k++)
				d[k]+=a[b[j]][k];//计算被选择的书店，在k列位置上的和
		for(k=1;k<=m;k++)
			if(d[k]<x)return;//不满足条件
		cost=0;
		for(j=1;j<=len;j++)cost+=c[b[j]];//计算花费
		sum=min(sum,cost);//找最小值
		return ;
	}
	for(i=b[step-1]+1;i<=n;i++)//找组合情况，就让后查找的位置越来越大，请注意i=b[step-1]+1
		b[step]=i,dfs(step+1);
}
int main(){
	init();
	for(len=1;len<=n;len++)//len界定选择的书店的数量
		b[0]=0,dfs(1);
	if(sum==100000000)printf("-1\n");//没找到
	else printf("%d\n",sum);
	return 0;
}


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

int main(){
    int n;
    cin >> n;
    
    vector<int> a(n);
    for(int i=0; i<n; i++){ cin >> a[i]; }
        
    int min=0, max=0;
    long long sum=0;
    min = *min_element(a.begin(), a.end());
    max = *max_element(a.begin(), a.end());
    for(int i=0; i<a.size(); i++){ sum += a[i]; }
    
    cout << min << " " << max << " " << sum << endl;
    return 0;
}

Measured memory_bytes: 1236
#include<cstdio>
#include<cstring>
int main() {
	char str[1001], cmd[8], p[1001], tmp;
	int q, i, a, b, j;
	scanf("%s%d", str, &q);
	for (i = 0; i < q; i++) {
		scanf("%s%d%d", cmd, &a, &b);
		if (strcmp(cmd, "print") == 0) {
			for (j = a; j <= b; j++) printf("%c", str[j]);
			printf("\n");
		}
		else if (strcmp(cmd, "reverse") == 0) {
			while (a < b) {
				tmp = str[a];
				str[a] = str[b];
				str[b] = tmp;
				a++;
				b--;
			}
		}
		else if (strcmp(cmd, "replace") == 0) {
			scanf("%s", p);
			for (j = a; j <= b; j++)str[j] = p[j - a];
		}
	}
	return 0;
}


Measured memory_bytes: 2620
import java.io.*;

public class Main {
    public static final int INF = -100000 * 5000 - 1;
    
    public static void main(String[] args) throws IOException {
	BufferedReader br =
		new BufferedReader(new InputStreamReader(System.in));
	
	int n = Integer.parseInt(br.readLine());
	while (n != 0) {
	    if (n == 0) break;
	    int[] a = new int[n];
	    for (int i = 0; i < n; i++) {
		a[i] = Integer.parseInt(br.readLine());
	    }
	    
	    int[][] sum = new int[n][n];
	    for (int i = 0; i < n; i++) {
		sum[i][i] = a[i];
	    }
	    for (int i = 0; i < n; i++) {
		for (int j = i; j + 1 < n; j++) {
		    sum[i][j + 1] = sum[i][j] + a[j + 1];
		}
	    }
	    
	    int ans = INF;
	    for (int i = 0; i < n; i++) {
		for (int j = i; j < n; j++) {
		    ans = Math.max(ans, sum[i][j]);
		}
	    }
	    System.out.println(ans);
	    
	    n = Integer.parseInt(br.readLine());
	}
    }
}

Measured memory_bytes: 86076
//
// Created by rknguyen on 4/29/18.
//

#include "iostream"
#include "cstdio"
#include "map"
using namespace std;

int main()
{
    int n; cin >> n;
    map <long long, int> m; m[0] = 1;
    long long res = 0, s = 0;
    for (int i = 0; i < n; ++i)
    {
        int x; cin >> x;
        s += x, res += m[s], m[s] += 1;
    }
    cout << res << "\n";
}

Measured memory_bytes: 12800
#include <iostream>
using namespace std;
using ll = long long int;
ll modpow(ll a,ll b);
ll key = 1000000007;
int main(){
    ll n;
    cin >> n;
    ll ans = modpow(10,n) - modpow(9,n) * 2 + modpow(8,n);
    if(ans >= 0){
        cout << ans % key;
    }else{
        cout << (ans + key * 2)%key;
    }
    return 0;
}

ll modpow(ll a,ll b){
    ll ans = 1;
    for(ll i = 0;i < b;i++){
        ans *= a;
        ans %= key;
    }
    return ans;
}


Measured memory_bytes: 3636
#include <stdio.h>
int main(void){
    int a,b,c,i,j=0;
    scanf("%d %d %d",&a,&b,&c);
    i=a;
    for(i=a;i<=b;i++){
        if((c/i)*i==c) j++;
    }
    printf("%d\n",j);
    return 0;
}


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

int main(){
    int N;
    long long D;
    cin >> N >> D;
    vector<long long> X(N,0);
    vector<long long> Y(N,0);
    for(int i=0; i<N; i++){
        cin >> X[i] >> Y[i];
    }

    int count = 0;
    for(int i=0; i<N; i++){
        if( (X[i]*X[i] + Y[i]*Y[i]) <= D*D){
            count += 1;
        }
    }

    cout << count << endl;
    return 0;

}

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

int main() {
  int N, K;
  cin >> N >> K;
  vector<int> l(N);
  for (int i = 0; i < N; i++) cin >> l[i];
  sort(l.begin(), l.end());
  int l_sum = 0;
  for (int i = N - 1; i > N - 1 - K; i--) {
    l_sum += l[i];
  }
  cout << l_sum << endl;
}


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

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

typedef long long ll;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素


int main(){
    int n,r,inr;
    cin>>n>>r;
    if(n>=10) inr=r;
    else inr=r+100*(10-n);
    cout<<inr<<endl;
    return 0;
}




Measured memory_bytes: 256
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n = int(readline())
a = list(map(int,readline().split()))
s = a[0]+a[1]
if n == 2:
  if a[0] < a[1] or s%2 == 1:
    print(-1)
  else:
    print(a[0]-s//2)
  exit()
  
c = 0
for i in a[2:]:
  c ^= i

sc = (s-c)//2
if s < c or (s-c)%2 == 1 or c&sc:
  print(-1)
  exit()

bb = a[0].bit_length()
x = ''
chk = 0
for i in range(bb-1,-1,-1):
  if not (c>>i&1)|(sc>>i&1):
    x += '0'
  elif not c>>i&1 and sc>>i&1:
    x += '1'
    chk += 2**i
  else:
    x += '?'
  
for i in range(bb):
  if x[i] == '?':
    if a[0] >= chk+2**(bb-1-i):
      chk += 2**(bb-1-i)

ans = a[0]-chk
print(ans if a[0] > ans >= 0 else -1)

Measured memory_bytes: 9276
/*
 * Click `Run` to execute the snippet below!
 */

import java.io.*;
import java.util.*;

/*
 * To execute Java, please define "static void main" on a class
 * named Solution.
 *
 * If you need more classes, simply define them inline.
 */

public class Main {
  
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt(), K = sc.nextInt();
    int arr[] = new int[N];
    for(int i = 0; i<N; i++){
      arr[i] = sc.nextInt(); 
    }
    Arrays.sort(arr);
    long sum = 0;
    for(int i = 0; i<N-K; i++){
      sum += arr[i]; 
    }
    System.out.println(sum);
  }
}


Measured memory_bytes: 61036
import math
import sys
from collections import deque
import heapq
import copy
import itertools
from itertools import permutations
from itertools import combinations
import bisect
def mi() : return map(int,sys.stdin.readline().split())
def ii() : return int(sys.stdin.readline().rstrip())
def i() : return sys.stdin.readline().rstrip()
a,b,c=mi()
h=c/(a**2)
if h>b/2:
  print(math.degrees(math.atan(2*(b-h)/a)))
else:
  print(90-math.degrees(math.atan(2*c/(a*b*b))))

Measured memory_bytes: 38384
from bisect import bisect_left
from collections import deque

N = int(input())
A = list(map(int, input().split()))
X = [list(map(int, input().split())) for _ in range(N - 1)]

graph = [[] for _ in range(N)]
for u, v in X:
    graph[u - 1].append(v - 1)
    graph[v - 1].append(u - 1)

INF = 10 ** 9 + 7
dp = [INF] * (N + 1)
dp[0] = -INF
rb = [[] for _ in range(N)]
ans = [0] * N

# DFS
q = deque([(0, 0)])  # (current, parent)
while q:
    u, p = q.pop()

    # Roll back
    if p is None:
        i, x = rb[u].pop()
        dp[i] = x
        continue

    # Update dp
    i = bisect_left(dp, A[u])
    rb[u].append((i, dp[i]))
    dp[i] = A[u]

    # Calc ans
    ans[u] = max(i, ans[p])

    # Go to next
    q.append((u, None))
    for v in graph[u]:
        if v == p:
            continue
        q.append((v, u))

print(*ans)


Measured memory_bytes: 182648
#include<bits/stdc++.h>
#define int long long
#define for1(i, n) for(int i = 1; i <= (n);i++)
#define puts(x) cout << x << "\n"
constexpr int mod = 1000000007;
using namespace std;
int input() { int r; cin >> r; return r; }
map<int, int> s;
int n, a[234567], ans;
signed main() {
	cin >> n;
	for1(i, n) {
		a[i] = input();
		s[i - a[i]]++;
	}
	for1(i, n) {
		s[i - a[i]]--;
		ans += s[a[i] + i];
	}
	puts(ans);
}

Measured memory_bytes: 27768
#include <iostream>
#define MAX 200000
using namespace std;

int *arr = new int[MAX];
int length = 0;

int main()
{
    int n;
    cin >> n;
    int flag, num = 0;
    for (int i = 0; i < n; i++)
    {
        cin >> flag;
        switch(flag)
        {
        case 0:
            cin >> num;
            arr[length] = num;
            length++;
            break;
        case 1:
            cin >> num;
            cout << arr[num] << "\n";
            break;
        case 2:
            length--;
            break;
        default:
            break;
        }
    }
    return 0;
}



Measured memory_bytes: 3864
#include<bits/stdc++.h>
using namespace std;
#define max(a,b) (a<b?b:a)
#define F(i,L,R) for (int i = L; i < R; i++)
#define FE(i,L,R) for (int i = L; i <= R; i++)
#define RF(i,L,R) for (int i = L; i > R; i--)
#define RFE(i,L,R) for (int i = L; i >= R; i--)
#define getI(a) scanf("%d", &a)
#define getII(a,b) scanf("%d%d", &a, &b)
#define getIII(a,b,c) scanf("%d%d%d", &a, &b, &c)
#define VgetI(n) int (n); scanf("%d",&(n))
#define VgetII(n,m) int (n),(m); scanf("%d %d",&(n),&(m))
#define VgetIII(n,m,k) int (n),(m),(k); scanf("%d %d %d",&(n),&(m),&(k))
#define ll long long
#define INF 2000000000
#define nINF -2000000000
#define MOD 1e9+7
#define PI 3.1415926535897932384626
ll a[100005],b[100005];
ll Mmin(ll x,ll y){
	if(x<y) return x;
	return y;
} 
int main(){
	int n;
	while(~getI(n)){
		n++;
		F(i,0,n) scanf("%lld",&b[i]);
		F(i,0,n-1) scanf("%lld",&a[i]);
		ll ans=0;
		F(i,0,n-1){
			ans+=Mmin(a[i],b[i]);
			a[i]-=Mmin(a[i],b[i]);
			b[i]-=Mmin(a[i],b[i]);
			ans+=Mmin(a[i],b[i+1]);
			b[i+1]-=Mmin(a[i],b[i+1]); 
		}
		printf("%lld\n",ans);
	}
}


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

// Shrotening
#define fst first
#define snd second
#define pb push_back

// Loop
#define FOR(i,a,b) for(auto i=(a);i<(b);++i)
#define RFOR(i,a,b) for(auto i=(a);i>=(b);--i)

#define REP(i,a) for(long i=0;i<(a);++i)
#define RREP(i,a) for(long i=(a);i>=0;--i)

#define EACH(i,a) for(auto (i)=(a).begin(),_END=(a).end();i!=_END;++i)
#define REACH(i,a) for(auto (i)=(a).rbegin(),_END=(a).rend();i!=_END;++i)

//Algorithm
#define ALL(a) (a).begin(), a.end()
#define RALL(a) (a).rbegin(), a.rend()
#define EXIST(a,x) ((a).find(x)!=(a).end())
#define SORT(a) std::sort((a).begin(), (a).end())
#define UNIQUE(a) std::sort((a).begin(), a.end()), a.erase(std::unique((a).begin(), a.end()), a.end());
#define SUM(a) std::accumulate((a).begin(), (a).end(), 0);

//Setting
#define OPT std::cin.tie(0);std::ios::sync_with_stdio(false);

//debug message
bool debug = true;
#define MSG(s)   if(debug){std::cout << s << std::endl;}
#define DEBUG(x) if(debug){std::cout << "debug(" << #x << "): " << x << std::endl;}

//alias
typedef long long LL;
typedef std::vector<char> VC;
typedef std::vector<int>  VI;
typedef std::vector<long> VL;
typedef std::vector<long long> VLL;

typedef std::vector< VC > VC2;
typedef std::vector< VI > VI2;
typedef std::vector< VL > VL2;
typedef std::vector< VLL > VLL2;

typedef std::pair<int,int> PII;
typedef std::pair<int, PII> PIII;

int main() {
    PIII p1, p2;
    std::cin >> p1.fst >> p1.snd.fst >> p1.snd.snd >> p2.fst >> p2.snd.fst >> p2.snd.snd;
    if(p1 < p2) std::swap(p1, p2);

    int ans = p1.fst - p2.fst + (int)(p1.snd > p2.snd);
    std::cout << ans << std::endl;
}


Measured memory_bytes: 3084
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <ctime>
#include <cstring>
#include <cstdlib>
#include <math.h>
using namespace std;
typedef long long ll;
//#define ll long long
const ll N = 2009;
const ll maxn = 1e5 + 20;
const ll mod = 1000000007;
//ll inv[maxn], vis[maxn], dis[maxn], head[maxn];
ll fac[maxn], a[maxn], q[maxn], b[maxn], c[maxn], pre[maxn];
vector<ll> vec;
//typedef pair<ll, ll> p;
//priority_queue<p, vector<p>, greater<p> > m;
ll sum[maxn];
ll max(ll a, ll b) { return a > b ? a : b; }
ll min(ll a, ll b) { return a < b ? a : b; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a * b / gcd(a, b); }
map<ll, ll> dp;
ll ksm(ll a, ll b)
{
    a %= mod;
    ll ans = 1ll;
    while (b)
    {
        if (b & 1)
            ans = (ans * a) % mod;
        a = (a * a) % mod;
        b >>= 1ll;
    }
    return ans;
}
ll lowbit(ll x)
{
    return x & (-x);
}
int vis[N][N];
int dir[4][2] = {0, 1, 1, 0, 0, -1, -1, 0};
// void dfs(int x, int y)
// {
//     cout << x << ' ' << y << endl;
//     vis[x][y] = 1;
//     for (int i = 0; i < 4; i++)
//     {
//         int xx = x + dir[i][0], yy = y + dir[i][1];
//         if (xx <= 0)
//             xx = n;
//         if (yy <= 0)
//             yy = m;
//         if (xx > n)
//             xx = 1;
//         if (yy > m)
//             yy = 1;
//         if (!vis[xx][yy])
//             dfs(xx, yy);
//     }
// }
//int n, m;
// bool check(int x)
// {
//     bool fla;
//     for (int i = 1; i <= n; i++)
//     {
//         fla = false;
//         for (int j = 1; j <= m; j++)
//         {
//             if (((a[i] & b[j]) | x) == x)
//             {
//                 fla = true;
//                 break;
//             }
//         }
//         if (!fla)
//             return false;
//     }
//     return true;
// }
//int dp[maxn], dx[maxn];
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n, ans = 1, x, res;
    cin >> n;
    for (ll i = 1; i <= n; i++)
        cin >> a[i], dp[a[i]]++;
    sort(a + 1, a + 1 + n);
    for (ll i = 1; i <= n; i++)
    {
        int fla = 0, res;
        for (ll j = 1; j <= n; j += dp[a[j]])
        {
            if (i == j && dp[a[i]] == 1)
                continue;
            if (!fla)
                fla = 1, res = a[j];
            res = gcd(res, a[j]);
           // cout << j << endl;
            if (res == 1)
                break;
        }
        //cout << "****" << endl;
        ans = max(ans, res);
    }
    cout << ans << endl;
}


Measured memory_bytes: 4472
def calc(n, k):
    if n == 0:
        return 0
    if n > k:
        a = n%k
        return min(abs(a-k), a)
    # kのほうがnより大きいとき
    if n*2 < k:
        return n
    else:
        # k = k%n+n+n
        return min(abs(n-k), k-abs(n-k))

n, k = (int(each) for each in input().split())
print(calc(n, k))

Measured memory_bytes: 3060
from math import ceil #切り上げ

def inp(): return int(input()) #一個だけ読み取り
def inpm(): return map(int,input().split()) #mapオブジェクトで呼び出し
def inpl(): return list(map(int, input().split())) #数字リストをintで
def inpls(): return list(input().split()) #数字リストをstrで


A, B, C, D = inpl()

print("Yes") if ceil(float(A)/D)>=ceil(float(C)/B) else print("No") 

Measured memory_bytes: 9188
import java.util.*;
import static java.lang.System.*;

public class Main {

	/**
	 * @param args
	 */
	
	Scanner sc = new Scanner(in);
	
	void run() {
		while (true) {
			int n = sc.nextInt();
			if (n == 0)
				break;
			int[][] t = new int[n][n+1];
			for (int i = 0; i < n; i++) {
				for (int j = 0; j < n+1; j++) {
					t[i][j] = sc.nextInt();
				}
			}
			
			int[] dp = new int[1<<n];
			Arrays.fill(dp, Integer.MAX_VALUE);
			dp[0] = 0;
			
			for (int i = 0; i < (1<<n); i++) {
				
				for (int j = 0; j < n; j++) {
					if ((i & (1<<j)) == 0) continue;
					int min = t[j][0];
					for (int k = 0; k < n; k++) {
						if (k != j && (i & (1<<k)) > 0)
							min = Math.min(min, t[j][k+1]);
					}
					dp[i] = Math.min(dp[i], dp[i^(1<<j)]+min);
				}
			}
			
			out.println(dp[(1<<n)-1]);
		}
	}
	
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		new Main().run();
	}

}

Measured memory_bytes: 35452
import java.util.*;

public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		long n = sc.nextLong();
		long a[] = new long[(int)n];
		for(int i = 0; i < n; i++) {
			a[i] = sc.nextLong();
		}
		
		long sum = a[0];
		long ans1 = 0;
		if(sum == 0) {
			sum = 1;
			ans1++;
		}
		
		for(int i = 1; i < n; i++) {
			if(sum > 0) {
				if(sum + a[i] >= 0) {
					ans1 += sum + a[i] + 1;
					sum = -1;
				} else {
					sum = sum + a[i];
				}
			} else {
				if(sum + a[i] <= 0) {
					ans1 += Math.abs(a[i] + sum) + 1;
					sum = 1;
				} else {
					sum = sum + a[i];
				}
			}
		}
		
		long ans2 = Math.abs(a[0]) + 1;
		if(a[0] >= 0) {
			sum = -1;
		} else if(a[0] < 0){
			sum = 1;
		}
		for(int i = 1; i < n; i++) {
			if(sum > 0) {
				if(sum + a[i] >= 0) {
					ans2 += sum + a[i] + 1;
					sum = -1;
				} else {
					sum = sum + a[i];
				}
			} else {
				if(sum + a[i] <= 0) {
					ans2 += Math.abs(a[i] + sum) + 1;
					sum = 1;
				} else {
					sum = sum + a[i];
				}
			}
		}
		System.out.println(Math.min(ans1, ans2));
	}
}


Measured memory_bytes: 60048
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <list>
#include <cmath>
#include <iomanip>

using namespace std;

int main() {
    int a, b;
    cin >> a >> b;
    cout << a/b << ' ' << a%b << ' ' << fixed << setprecision(6) << double(a) / double(b) << endl;

    return 0;
}


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

int main(){
	cout << fixed << setprecision(12);
	
	double r;

	cin>>r;
	
	double PI = acos(-1);
	
	double area = r * r * PI;
	double cir = (r + r) * PI;

	cout<<area<<" "<<cir<<endl;

	return 0;
}


Measured memory_bytes: 3288
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
        new Main().run();
    }
	int[] hist;
	int four;
	int three;
	int two;
	public void run(){
		Scanner scan = new Scanner(System.in);
		while(scan.hasNext()){
			hist = new int[14];
			String[] str = scan.next().split(",");
			for(int i = 0;i < 5;i++){
				hist[Integer.parseInt(str[i])]++;
			}
			four = 0;
			three = 0;
			two = 0;
			for(int i = 1;i < 14;i++){
				switch(hist[i]){
				case 2:
					two++;
					break;
				case 3:
					three++;
					break;
				case 4:
					four++;
					break;
				default:
					break;
				}
			}
			if(four > 0){
				System.out.println("four card");
			}else if(three > 0 && two > 0){
				System.out.println("full house");
			}else if(three > 0){
				System.out.println("three card");
			}else if(two > 1){
				System.out.println("two pair");
			}else if(two > 0){
				System.out.println("one pair");
			}else{
				if(hist[1] > 0 && hist[10] > 0 && hist[11] > 0 && hist[12] > 0 && hist[13] > 0){
					System.out.println("straight");
				}else{
					boolean fl = true;
					for(int i = 1;i < 10;i++){
						if(hist[i] > 0 && hist[i+1] > 0 && hist[i+2] > 0 && hist[i+3] > 0 && hist[i+4] > 0){
							fl = false;
							break;
						}
					}
					System.out.println((fl)?"null":"straight");
				}
			}
		}
	}
}

Measured memory_bytes: 17164
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;


int main(){
  int N;
  cin >> N;
  vector<int> v;
  rep(i,N){
    int d;
    cin >> d;
    v.push_back(d);
  }

  sort(ALLOF(v));
  reverse(ALLOF(v));
  v[0] /= 2;

  int ret = 0;
  rep(i,N){
    ret += v[i];
  }
  cout << ret << endl;
  
  return 0;
}


Measured memory_bytes: 256
N,a,b = map(int,input().split())
sums = 0
for i in range(1,N+1):
    moji = list(str(i))
    moji = [int(j) for j in moji]
    ans = sum(list(moji))
    
    if a <= ans and ans <= b:
        sums += i
print(sums)

Measured memory_bytes: 42604
#include <iostream>
#include <queue>
#include <vector>
using namespace std;

struct cross{
  int i;
  int j;
};

int main(){
  queue<cross> que;
  vector<cross> con;
  vector<cross>::iterator conit;
  int a, b, n, ans = 0;

  while(1){
    con.clear();
    ans = 0;
    cin >> a >> b;
    if(a == 0 || b == 0) break;
    cin >> n;
    for(int i = 0; i < n; i++){
      cross con1;
      cin >> con1.i >> con1.j;
      con.push_back(con1);
    }

    cross cro;
    cro.i = 1;
    cro.j = 1;
    que.push(cro);
    while(!(que.empty())){
      int i1[] = {1, 0};
      int j1[] = {0, 1};
      for(int i = 0; i < 2; i++){
	cro = que.front();
	cro.i += i1[i];
	cro.j += j1[i];
	if(cro.i == a && cro.j == b){
	  ans++;
	}else if(cro.i <= a && cro.j <= b){
	  for(conit = con.begin(); conit != con.end(); conit++){
	    if(cro.i == (*conit).i && cro.j == (*conit).j) break;
	    if(conit == con.end() -1) que.push(cro);
	  }
	}
      }
      que.pop();
    } 

    cout << ans << endl;
  }

  return 0;
}

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

int main(void){
    int n, r[200000], maxv = -999999999, minr;
    cin >> n;
    for(int i = 0; i < n; i++) cin >> r[i];
    minr = r[0];
    for(int i = 1; i < n; i++){
        maxv = max(maxv, r[i] - minr);
        minr = min(minr, r[i]);
    }
    cout << maxv << endl;
    return 0;
}


Measured memory_bytes: 3892
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
 
using namespace std;
 
struct Info{
    Info(){
        good = bad = -1;
    }
    int good,bad;
};
 
int main(){
 
    int N,M,count = 0,index = 0,sum = 0;
 
    scanf("%d %d",&N,&M);
    Info info[M];
 
    int left,right;
 
    for(int loop = 0; loop < M; loop++){
        scanf("%d %d",&left,&right);
        if(left >= N){
            count++;
        }else{
            info[index].good = left;
            info[index].bad = right;
            index++;
        }
    }
 
    if(count < M-1){
        for(int i = 1; i <= index-1; i++){
            for(int k = index-1; k >= i; k--){
                if(info[k].good > info[k-1].good)swap(info[k],info[k-1]);
            }
        }
 
        for(int i = 0; i < index; i++){
            sum += (N-info[i].good);
            count++;
            if(count == M-1)break;
        }
    }
 
    printf("%d\n",sum);
 
    return 0;
}


Measured memory_bytes: 2748
N = int(input())
S = input()
Stack = ""
for s in S:
    Stack += s
    while len(Stack) >= 2:
        if Stack[-2:] == "()":
            Stack = Stack[:-2]
        else:
            break
c = Stack.count(")")
print("(" * c + S + ")" * (len(Stack) - c))


Measured memory_bytes: 3064
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
using namespace std;
int main()
{
	int a;
	string s;
	cin>>a>>s;
	if(a>=3200)
		cout<<s<<endl;
	else
		cout<<"red"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
using namespace std;
int const MOD=1000000007;
int n,ans,a[233333],sum[233333];
signed main(){
	ios::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);
	cin>>n;
	for(int i=1;i<=n;i++)cin>>a[i];
	for(int i=n;i>=1;i--)sum[i]=(sum[i+1]+a[i])%MOD;
	for(int i=1;i<=n;i++)ans=(ans+a[i]*sum[i+1]%MOD)%MOD;
	cout<<ans<<endl;
}

Measured memory_bytes: 6744
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		final int mod=1000000007;

		char[][] field = new char [2][n];
		for(int i=0;i<2;i++) {
			String str = sc.next();
			field[i]=str.toCharArray();
		}
		int state = 0;
		long ans = 1;
		for (int j=0;j<n;j++) {
			if(state == 0) {
				if(field[0][j]==field[1][j]) {
					ans=ans*3%mod;
					state=1;
				} else {
					ans=ans*6%mod;
					state=2;
				}
			} else if (state == 1) {
				if(field[0][j]==field[1][j]) {
					ans=ans*2%mod;
					state=1;
				} else {
					ans=ans*2%mod;
					state=2;
				}
			} else if (state == 2) {
				state=3;
			} else if (state == 3) {
				if(field[0][j]==field[1][j]) {
					state=1;
				} else {
					ans=ans*3%mod;
					state=2;
				}
			}
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 23636
char r[99],g[99],d[99];main(c,i,j,k){
	for(;scanf("%s%s%s",r,g,d)>2;puts(""))
		for(i=j=k=0,c=g[j++];i+j<=strlen(r)+strlen(g);)
			if(c==d[k])k++,c=r[i++];else putchar(c),c=g[j++];exit(0);}

Measured memory_bytes: 524
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<iomanip>



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

using namespace std;
int a,b,c,d;
int k1,k2;
string s;

int main(){
  cin >> s;
  int ans = 700;
  REP(i,3){
    if(s[i]=='o') ans += 100;
  }
  cout << ans << endl;
  
  return 0;
}



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

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

    long long int ans = 0;

    for(int a=1; a<=k; a++){
        for(int b=1; b<=k; b++){
            for(int c=1; c<=k; c++){
                ans += __gcd(__gcd(a,b),c);
            }
        }
    }

    cout << ans << endl;
}

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

using Int = long long;
const char newl = '\n';

template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
template<typename T> void drop(const T &x){cout<<x<<endl;exit(0);}
template<typename T=Int>
vector<T> read(size_t n){
  vector<T> ts(n);
  for(size_t i=0;i<n;i++) cin>>ts[i];
  return ts;
}


template <typename E>
struct SegmentTree{
  using H = function<E(E,E)>;
  Int n,height;
  H h;
  E ei;
  vector<E> laz;

  SegmentTree(H h,E ei):h(h),ei(ei){}

  void init(Int n_){
    n=1;height=0;
    while(n<n_) n<<=1,height++;
    laz.assign(2*n,ei);
  }

  inline void propagate(Int k){
    if(laz[k]==ei) return;
    laz[(k<<1)|0]=h(laz[(k<<1)|0],laz[k]);
    laz[(k<<1)|1]=h(laz[(k<<1)|1],laz[k]);
    laz[k]=ei;
  }

  inline void thrust(Int k){
    for(Int i=height;i;i--) propagate(k>>i);
  }

  void update(Int a,Int b,E x){
    if(a>=b) return;
    thrust(a+=n);
    thrust(b+=n-1);
    for(Int l=a,r=b+1;l<r;l>>=1,r>>=1){
      if(l&1) laz[l]=h(laz[l],x),l++;
      if(r&1) --r,laz[r]=h(laz[r],x);
    }
  }

  E get_val(Int a){
    thrust(a+=n);
    return laz[a];
  }

  void set_val(Int a,E x){
    thrust(a+=n);
    laz[a]=x;
  }
};

//INSERT ABOVE HERE
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(0);

  Int n,q;
  cin>>n>>q;

  auto h=[&](Int a,Int b){return min(a,b);};
  SegmentTree<Int> sy(h,n-2);
  SegmentTree<Int> sx(h,n-2);
  sy.init(n);
  sx.init(n);

  Int ans=(n-2)*(n-2);
  Int lx=n,ly=n;
  for(Int i=0;i<q;i++){
    Int t;
    cin>>t;
    if(t==1){
      Int y;
      cin>>y;
      ans-=sy.get_val(y);
      sx.update(0,lx,y-2);
      chmin(ly,y);
    }
    if(t==2){
      Int x;
      cin>>x;
      ans-=sx.get_val(x);
      sy.update(0,ly,x-2);
      chmin(lx,x);
    }
  }
  cout<<ans<<newl;
  return 0;
}


Measured memory_bytes: 11356
package main

import (
	"fmt"
	"math"
	"strconv"
)

func main() {
	var A,B,H,M int
	fmt.Scan(&A,&B,&H,&M)

	s := float64(60 * H + M) / 2
	l := float64(6*M)
	angle := math.Abs(l - s)
	if angle > float64(180){
		angle = float64(360) - angle
	}

	lh := A
	sh := B
	if B > A{
		lh = B
		sh = A
	}

	cos := math.Cos((angle * math.Pi) /180)
	sin := math.Sin((angle * math.Pi) /180)
	a := float64(sh) * sin
	b := float64(lh) - float64(sh) * cos
	res := math.Sqrt(a*a + b*b)

	
	x := fmt.Sprintf("%g",res)
	y, _ := strconv.ParseFloat(x, 64)
	fmt.Println(y)

	
}


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

int main(){
    int N,X,Y;
    cin >> N >> X >> Y;
    vector<int> k(N);
    for(int i=1; i<= N ;i++){
        for(int jj = i+1; jj<=N;jj++){
            int kyori = min(jj-i,abs(X-i)+1+abs(Y-jj));
            k.at(kyori)++;
        }
    }
    for(int i=1;i<N;i++) cout << k.at(i) << endl;
}   

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

using namespace std;
#define ll long long int
int main()
{
    ll n,m,k,count=0;
    cin>>n>>m>>k;
    ll a[n+1]={0},b[m+1]={0};
    for(int i=1;i<=n;i++){
            cin>>a[i];
            a[i]=a[i-1]+a[i];
    }
    for(int i=1;i<=m;i++){
            cin>>b[i];
        b[i]=b[i-1]+b[i];
    }
    ll j=m;
    for(int i=0;i<=n;i++){
        if(a[i]>k)break;
        while(a[i]+b[j]>k)j--;
        count=max(count,i+j);
    }

    cout<<count<<endl;

}


Measured memory_bytes: 6724
int main(void)
{
    int i=0,j=0,a=1000,b1,b2,c;
    char s[1000],t[1000];
    scanf("%s",s);
    scanf("%s",t);
    b1=strlen(s);
    b2=strlen(t);
    c=b2;
    for(i=0;i<(b1-b2)+1;i++)
    {
        a=b2;
        for(j=0;j<b2;j++)
        {
            if(s[i+j]==t[j])a--;
        }
        if(c>a)c=a;
    }
    printf("%d",c);

    return 0;
}

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


typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef long double ld;

typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;

const int INF = 1e9 + 7;
const int MOD = 1e9 + 7;
const int MAXN = 1e6 + 3;

#define _  %  MOD
#define __ %= MOD

#define      each(it,s)        for(auto it = s.begin(); it != s.end(); ++it)
#define      sortA(v)          sort(v.begin(), v.end())
#define      sortD(v)          sort(v.begin(), v.end(), greater<auto>())
#define      fill(a)           memset(a, 0, sizeof (a))

#define      swap(a,b)        {a=a+b;b=a-b;a=a-b;}
#define      rep(i, n)         for(ll i = 0; i < (n); ++i)
#define      repA(i, a, n)     for(ll i = a; i <= (n); ++i)
#define      repD(i, a, n)     for(ll i = a; i >= (n); --i)
#define watch(x) cout << (#x) << " is " << (x) <<endl

#define fi first
#define se second
#define mp make_pair
#define pb push_back

#define fbo find_by_order
#define ook order_of_key

ll gcd(ll a,ll b){if(b==0) return a; else return gcd(b,a%b);}
ll power(ll x,ll y){ll res=1; while(y>0){if(y&1) res=res*x;y=y>>1;x=x*x;}return res;} // modular exponent

int main()
{
    ios_base::sync_with_stdio(false); // don't use printf and scanf
    cin.tie(NULL); // cout<<fixed<<setprecision
    int n,m;
    cin>>n>>m;
    vi a(n);
    rep(i,n) cin>>a[i];
    int sum=0;
    rep(i,n) sum+=a[i];
    // double cmp=sum/(1.00*4*m);
    int cnt=0;
    // sortA(a);
    repD(i,n-1,0)
    {
        if(a[i] * 4*m>=sum) cnt++;
    }
    if(cnt>=m) cout<<"Yes\n";
    else cout<<"No\n";
    return 0;
}


Measured memory_bytes: 256
import java.text.ParseException;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws ParseException {
		Scanner sc = new Scanner(System.in);
		char[] c=sc.next().toCharArray();
		int cnt=0,ans=0;
		for (char d : c) {
			if(d!='A' && d!='C' && d!='G' && d!='T') {
				cnt=0;
				continue;
			}
			cnt++;
			ans=Math.max(ans, cnt);
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 23764
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons;
 
void main()
{
    auto na = readln.split.to!(int[]);
    auto N = na[0];
    auto A = na[1];
 
    auto XS = readln.split.to!(int[]);
 
    auto MEMO = new long[50*50+1][50+1][50+1];
    foreach (ref a; MEMO) {
        foreach (ref b; a) {
            foreach (ref c; b) c = -1;
        }
    }
    long solve(int i, int n, int s) {
        if (i == N) return n && s == n * A ? 1 : 0;
        if (MEMO[i][n][s] != -1) return MEMO[i][n][s];
        return MEMO[i][n][s] = solve(i+1, n+1, s+XS[i]) + solve(i+1, n, s);
    }
    writeln(solve(0, 0, 0));
}

Measured memory_bytes: 53244
#include <stdio.h>
#include <math.h>

int main(void){
  int i, n;
  double x, debt = 100000;

  scanf("%d", &n);
  for(i = 0; i < n; i++){
    debt *= 1.05;
    if((x = fmod(debt, 1000)) != 0){
      debt = debt - x + 1000;
    }
  }
  printf("%d\n", (int)debt);
  return 0;
}

Measured memory_bytes: 592
S = input()

S = S[::-1]

cand = {'maerd', 'remaerd', 'esare', 'resare'}

can = True

while S not in cand:
    ok = False
    for x in cand:
        if S[:len(x)] == x:
            S = S[len(x):]
            ok = True
            break
    if ok == False:
        can = False
        break

if can == True:
    print('YES')
else:
    print('NO')

Measured memory_bytes: 9236
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <fstream>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <stack>
#include <vector>
#include <set>
#include <tuple>
#include <utility>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
const int INF = 1000000000;
const int MOD = 1000000007;
int main(){
	int n,m;
	cin >> n >> m;
	vector<vector<int>> e(n);
	for(int i = 0;i < m;i++){
		int a,b;
		cin >> a >> b;
		a--,b--;
		e[a].push_back(b);
		e[b].push_back(a);
	}

	vector<int> d(n,INF);

	d[0] = 0;
	queue<int> que;
	que.push(0);

	vector<int> par(n);
	while(que.size()){
		int now = que.front();
		que.pop();

		for(int next:e[now]){
			if(next != now){
				if(d[next] > d[now] + 1){
					d[next] = d[now] + 1;
					par[next] = now;
					que.push(next);
				}
			}
		}
	}

	cout << "Yes" << endl;
	for(int i = 1;i < n;i++){
		cout << par[i] + 1 << endl;
	}
}


Measured memory_bytes: 10576
import java.util.*;
import java.lang.Object;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] num = new int[n];
        int cnt = 0;
        
        for(int i = 0;i<n;i++){
            num[i] = sc.nextInt();
        }

        for(int i = 0;i<n-2;i++){
            if(num[i]<num[i+1] && num[i+1]<num[i+2]){
                cnt++;
            }else if(num[i]>num[i+1] && num[i+1]>num[i+2]){
                cnt++;
            }
        }
System.out.println(cnt);

    }
}


Measured memory_bytes: 22612
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <iomanip>
#include <deque>
#include <climits> 

int main()
{
    long N,M;
    std::cin >> N >> M;
    std::vector<std::string> A,B;
    for(long i=0; i<N; i++){
        std::string temp;
        std::cin >> temp;
        A.push_back(temp);
    }
    for(long i=0; i<M; i++){
        std::string temp;
        std::cin >> temp;
        B.push_back(temp);
    }

    bool flag=false;
    long count=0;
    for(long i=0; i<N-M+1; i++){
        for(long j=0; j<N-M+1; j++){
            count=0;
            for(long k=0; k<M; k++){
                for(long l=0; l<M; l++){
                    if(A[i+k][j+l]==B[k][l]){
                        count++;
                    }
                    if(count==M*M){
                        flag=true;
                    }
                }
            }
        }
    }
    if(flag){
        std::cout << "Yes" << std::endl;
    }else{
        std::cout << "No" << std::endl;
    }
    return 0;
}

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

#define ll long long
#define pb push_back
#define mp make_pair


int main() 
{
	 ios_base::sync_with_stdio(false);
     cin.tie(NULL);
     cin.tie(NULL);
     
		 int x,y;
		 cin>>x>>y;
		 int cranes=2*x-y/2;
		 int turtles=y/2 -x;
		 if(y%2==0 && cranes>=0 && turtles>=0)
		 cout<<"Yes"<<endl;
		 else
		 cout<<"No"<<endl;
		 
	   
   }
		 
    
            


Measured memory_bytes: 3648