akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll llINF = 1LL << 60;
const int iINF = 1e8;

//---main---------------------------------------------
int main(){
    //main
    string N;
    cin >> N;

    int sum = 0;
    rep(i,N.size()){
        sum += int(N[i])-48;
        sum %= 9;
    }

    if(sum==0) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 3732
#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()
using namespace std;
typedef long long ll;
typedef long double ld;
int main() {
    ll n; cin>>n;
    ll a[n];
    rep(i,n){
        cin>>a[i];
        if(a[i]==0){
            cout<<0<<endl;
            return 0;
        }
    }
    ll x=1;
    rep(i,n){
        if(a[i]>1000000000000000000/x){
            printf("-1\n");
            return 0;
        }else x*=a[i];
    }
    cout<<x<<endl;
}

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

int main() {
    int A, B;
    cin >> A >> B;

    int answer=0;
    if(A > 2*B){
        answer = A - 2*B;
        cout << answer << endl;
    }
    else{
        cout << answer << endl;
    }

}


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

using namespace std;

#define INF 1000000007
#define LINF (1LL << 60)
#define PI 3.14159265358979

typedef long long i64;
typedef pair<i64,i64> P;

inline i64 mod(i64 a, i64 m) { return (a % m + m) % m; }

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; }



int n, m, x[101010], y[101010];
vector<int> v[101010];
bool used[101010];
int c[101010];
void solve(){
	cin >> n >> m;
	int cnt = 0;
	used[1] = 1;
	fill(c,c+101010,1);
	for(int i = 0; i < m; i++){
		cin >> x[i] >> y[i];
		if(used[x[i]]) used[y[i]] = 1;
		c[x[i]]--; c[y[i]]++;
		if(c[x[i]] == 0) used[x[i]] = 0;
	}
	for(int i = 1; i <= n; i++){
		if(used[i]) cnt++;
	}
	
	cout << cnt << endl;
}

int main(){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	int t = 1;
	//cin >> t;
	while(t--){
		solve();
	}
	
	return 0;
}


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

#define _p(...) (void)printf(__VA_ARGS__)
#define forr(x,arr) for(auto&& x:arr)
#define _overload3(_1,_2,_3,name,...) name
#define _rep2(i,n) _rep3(i,0,n)
#define _rep3(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,_rep3,_rep2,)(__VA_ARGS__)
#define _rrep2(i,n) _rrep3(i,0,n)
#define _rrep3(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define rrep(...) _overload3(__VA_ARGS__,_rrep3,_rrep2,)(__VA_ARGS__)
#define all(x) (x).begin(), (x).end()
#define bit(n) (1LL<<(n))
#define sz(x) ((int)(x).size())
#define fst first
#define snd second
using ll=long long;using pii=pair<int,int>;
using vb=vector<bool>;using vs=vector<string>;
using vi=vector<int>;using vvi=vector<vi>;using vvvi=vector<vvi>;
using vl=vector<ll>;using vvl=vector<vl>;using vvvl=vector<vvl>;
using vd=vector<double>;using vvd=vector<vd>;using vvvd=vector<vvd>;
using vpii=vector<pii>;using vvpii=vector<vpii>;using vvvpii=vector<vvpii>;
template<typename T>T read(){T t;cin>>t;return t;}
template<class T,class U>ostream&operator<<(ostream&o,const pair<T,U>&p){return o<<'('<<p.fst<<", "<<p.snd<<')';}
template<class T>ostream&operator<<(ostream&o,const vector<T>&t){o<<"{";rep(i,sz(t))o<<t[i]<<",";o<<"}";return o;}
#define out(args...){vector<string> a_r_g_s=__split(#args, ','); e_r_r(a_r_g_s.begin(), args); }
vector<string> __split(const string& s,char c){vector<string>v;stringstream ss(s);string x;while(getline(ss,x,c))v.emplace_back(x);return move(v);}
void e_r_r(vector<string>::iterator it) {}
template<typename T,typename... Args> void e_r_r(vector<string>::iterator it, T a, Args... args){if(*it==" 1"||*it=="1")cerr<<endl;else cerr<<it->substr((*it)[0]==' ',it->length())<<" = "<<a<<", ";e_r_r(++it, args...);}

void Main() {
  ll x = read<ll>();
  ll d = x / 11;
  ll m = x % 11;
  ll ans = d * 2;
  if (m) {
    ans++;
    if (m > 6) ans++;
  }
  cout << ans << endl;
}
int main() { cin.tie(nullptr); ios::sync_with_stdio(false); Main(); return 0; }


Measured memory_bytes: 256
import math
import itertools
import sys

x, y = [int(x) for x in input().split()]

if (x+y) % 3:
  print(0)
  sys.exit()

total_move = (x+y) // 3
move_a = 2 * total_move - x

def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = total_move
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

a = cmb(total_move,move_a,mod)

print(a)


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

int main(){
    int a,b,k,n=0,i;
    vector<int> v(100);
    cin>>a>>b>>k;
    for(i=min(a,b);i>=1;i--){
        if(a%i==0 && b%i==0){
            n++;
        }
        if(n==k){
          break;
        }
    }
    cout<<i<<endl;
}


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

int main() {
    int N, A, B;
    cin >> N >> A >> B;

    int a = 0, b = 0, t = 0;

    for (int i = 0; i < N; i++) {
        char c;
        cin >> c;
        if (c == 'a') {
            if (A + B > a + b) {
                a++;
                cout << "Yes" << endl;
            } else {
                cout << "No" << endl;
            }
        } else if (c == 'b') {
            if (A + B > a + b && B > t) {
                t++;
                b++;
                cout << "Yes" << endl;
            } else {
                cout << "No" << endl;
            }
        } else {
            cout << "No" << endl;
        }
    }

    return 0;
}


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

#define endl '\n'

void solvetask(){
    int n; cin >> n;
    cout << (1000 - n%1000)%1000 << endl;
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int t=1;// cin >> t;
    while(t--) solvetask();
}

Measured memory_bytes: 3584
#include <bits/stdc++.h>
using namespace std;
#define int long long

int N;

//n:=今見ている数
//x3,x5,x7:=順に3,5,7が使われたかどうか。使われている場合true
int rec(int n, bool x3, bool x5, bool x7) {
  if (n > N) return 0;
  int res = 0;
  //今見ている数ｎが条件を満たすかどうか。満たすならばres++;
  if (n <= N && n != 0 && x3 && x5 && x7) res++;

  //nの語尾に３を付ける操作は、ｎを１０倍して3足せば良い。以下同様。
  //また３を足した場合、３は少なくとも使われているのでtrueにして再帰呼び出しする。
  res += rec(n * 10 + 3, true, x5, x7);
  res += rec(n * 10 + 5, x3, true, x7);
  res += rec(n * 10 + 7, x3, x5, true);
  return res;
}

signed main() {
  cin >> N;
  cout << rec(0, false, false, false) << endl;
  return 0;
}


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

#define pb push_back

#define ll long long

#define ft first

#define sd second

using namespace std;

const int N = 5050 ;

bool used[N];

ll z , r , w ;

ll p = -1 ;

int main(){

    int n ;
    cin >> n ;
    int a[n];
    for(int i = 0 ; i < n ; i ++ ){
        cin >> a[i] ;
    }
    for(int i = 0 ; i < n - 1 ; i ++ ){
        for(int j = i + 1  ; j < n ; j ++ ){
            z += a[i] * a[j];
        }
    }
    cout<<z;

}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline
N,K=map(int,input().rstrip().split())
h=list(map(int,input().rstrip().split()))

inf=10**9+7
dp=[inf]*N
dp[0]=0

for i in range(1,N,1):
    for k in range(1,K+1,1):
        if(i-k<0):
            continue
        dp[i]=min(dp[i],dp[i-k]+abs(h[i]-h[i-k]))
print(dp[N-1])
  

Measured memory_bytes: 52320
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<ll> vi;
typedef vector<vi> vvi;
#define INF (1e9)

int D = 365;
vi c, ans;
vvi s;

void input() {
  cin >> D;
  c = vi(26);
  s = vvi(D, vi(26));
  for (int i = 0; i < 26; i++) {
    cin >> c[i];
  }
  for (int i = 0; i < D; i++) {
    for (int j = 0; j < 26; j++) {
      cin >> s[i][j];
    }
  }
}

void output() {
  for (int i = 0; i < D; i++) {
    cout << ans[i] + 1 << endl;
  }
}

int simulate(vi a) {
  int sum = 0;
  vi last(26, 0);
  for (int i = 0; i < D; i++) {
    sum += s[i][a[i]];
    last[a[i]] = i + 1;
    for (int j = 0; j < 26; j++) {
      sum -= c[j] * (i - last[j] + 1);
    }
  }
  return (int)1e6 + sum;
  // return max((int)1e6 + sum, 0);
}

void solve() {
  int best = simulate(ans);

  // 周期
  for (int i = 0; i < 26; i++) {
    vi a(D);
    for (int j = 0; j < D; j++) {
      a[j] = (i + j) % 26;
    }

    int x = simulate(a);
    if (x > best) {
      best = x;
      ans = a;
    }
  }

  //
  srand((unsigned)time(NULL));
  int loop = 20;
  bool lastIsNew = true;
  while (loop--) {
    vi a = ans;
    if (!lastIsNew) {
      int change = D / 2;
      while (change--) {
        a[rand() % D] = rand() % 26;
      }
    }

    for (int i = 0; i < D; i++) {
      vi b = a;
      int idx = 0, bst = simulate(b);
      for (int j = 0; j < 26; j++) {
        b[i] = j;
        int x = simulate(b);
        if (x > bst) {
          bst = x;
          idx = j;
        }
      }
      a[i] = idx;
    }

    lastIsNew = false;
    int x = simulate(a);
    if (x > best) {
      best = x;
      ans = a;
      lastIsNew = true;
    }
  }
}

int main() {
  input();
  ans = vi(D, 0);
  solve();
  output();
}


Measured memory_bytes: 3648
V, E=map(int,input().strip().split(' '))
edge=[]
for i in range(E):
    at,bt,ct=map(int,input().strip().split(' '))
    edge.append([at,bt,ct])

#edge=[[0,1,2],[0,2,5],[1,2,4],[1,3,6],[2,3,2],[1,4,10],[3,5,1],[4,5,3],[4,6,5],[5,6,9],[1,0,2],[2,0,5],[2,1,4],[3,1,6],[3,2,2],[4,1,10],[5,3,1],[5,4,3],[6,4,5],[6,5,9]]
#V=7
#E=10*2
inf=-3*10**15

def shortest_path(s):
    d=[inf]*V
    d[s]=0
    for _ in range(V+1):
        update=False
        for i in range(E):
            if d[edge[i][0]-1]!=inf and d[edge[i][1]-1]<d[edge[i][0]-1]+edge[i][2]:
                d[edge[i][1]-1]=d[edge[i][0]-1]+edge[i][2]
                update=True
        if update==False:
            break
        if _ == V-1:
            tm=d[V-1]
        if _ == V and d[V-1]!=tm:
            return False
    return d

d=shortest_path(0)
if d==False:
    print('inf')
else:
    print(d[V-1])

Measured memory_bytes: 3396
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef double db;
typedef vector <ll> vll;
typedef pair <ll, ll> pll;
#define pb push_back
#define mp make_pair
#define MAX 1000000
#define mod 1000000007
#define all(_) _.begin(), _.end()
#define F first
#define S second
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

int main()
{
	ios_base :: sync_with_stdio(false);
	cin.tie(NULL), cout.tie(NULL);
	ll a, b, x;
	cin >> a >> b >> x;
	db ans = atan(((a * a * b - x) * 2) / pow(a, 3));
	ans *= 180 / acos(-1);
	if(2 * x < a * a * b)
		ans = atan((db)a * b * b / (2 * x)) * 180 / acos(-1);
	printf("%.12lf\n", ans);
	return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<vector>
using namespace std;
using ll=long long;
int main(){

  int N;
  cin>>N;
  vector<int>A(N);
  ll p=1;
  for(int i=0;i<=N-1;i++){
  
    cin>>A[i];
    p*=3;
  }
  ll subnum=1;
  for(int i=0;i<=N-1;i++){
  
    if(A[i]%2==0){
    
      subnum*=2;
    }
    else subnum*=1;
  }
  cout<<p-subnum;
}

Measured memory_bytes: 3580
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <queue> //priority_queue
#include <map>
#include <set> //multiset set<int,greater<int>>大到小
#include <vector>// vector<int>().swap(v);清空释放内存
#include <stack>
#include <cmath> // auto &Name : STLName  Name.
#include <utility>
#include <sstream>
#include <string>//__builtin_popcount(ans);//获取某个数二进制位1的个数
#define mod 1000000007
#define mod9 998244353
typedef unsigned long long ull;
typedef long long ll;
typedef double db;
typedef long double ld;
const db eps=1e-10;
const int INF = 0x3f3f3f3f;
const ll inf=0x3f3f3f3f3f3f3f3f;
#define rep(i,be,en) for (int i=be;i<=en;i++)
#define per(i,be,en) for (int i=en;i>=be;i--)
//ll ksm(ll a,ll b,ll c){ll ans=1;a=a%c;while(b>0){if(b%2) ans=(ans*a)%c;b=b/2;a=(a*a)%c;}return ans;}
using namespace std;

const int N=2e5+7;
int t,n,m,fl=0;
int prime[N]={0};//记录素数
int vis[N]={0};//记录除本身最大因子
int cnt=0;//素数个数
void Euler_prime(int x){
    for(int i=2;i<=x;++i){
        if(vis[i]==0){
            prime[cnt++]=i;
            vis[i]=1;
        }
        for(int j=0;j<cnt;++j){
            if(i*prime[j]>x)//判断是否越界
                break;
            vis[i*prime[j]]=i;//筛数
            if(i%prime[j]==0)//时间复杂度为O(n)的关键！
                break;
        }
    }
}
int main(){
    Euler_prime(55556);
    scanf("%d",&n);
    rep(i,0,cnt-1){
        if(prime[i]%10==1){
            printf("%d%c",prime[i],n==1?'\n':' ');
            n--;
        }
        if(n<=0) break;
    }
    return 0;
}

Measured memory_bytes: 512
/* ---------- STL Libraries ---------- */
// IO library
#include <cstdio>

#include <fstream>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm library
#include <algorithm>

#include <cmath>
#include <numeric>
#include <random>
#include <cstring>
#include <cassert>

// container library
#include <array>
#include <bitset>
#include <deque>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>
#include <stack>

// type
#include <cstdint>
#include <functional>

/* ---------- Namespace ---------- */
using namespace std;

/* ---------- Type ---------- */
using ll = long long;
#define int ll
template <class T> using MaxHeap = priority_queue<T>;
template <class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;
#define P pair<ll, ll>

/* ---------- Constants  */
const double PI = 3.141592653589793238462643383279;
const ll MOD = 1e9 + 7;
const int INF = 1LL << 55;

/* ---------- Functions */
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }

/* v-v-v-v-v-v-v-v-v Main Part v-v-v-v-v-v-v-v-v */
signed main() {
    cin.sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int L;
    cin >> L;
    double x = 1.0 * L / 3.0;
    cout << setprecision(10) << fixed << x * x * x << endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.*;
class Main{
    public static void main(String argv[]) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        int[][] table = new int[M][N];
        int[] onoff = new int[M];
        for(int i=0;i<M;i++){
            int k=sc.nextInt();
            for(int j=0;j<k;j++){
                int num = sc.nextInt();
                table[i][num-1] = 1;
            }
        }
        for(int i=0;i<M;i++){
            onoff[i]=sc.nextInt();
        }

        final int dec = (int)Math.pow(2.0, N);
        int count_full_light = 0;
        for(int i=0;i<dec;i++){
            String[] tmp = Integer.toBinaryString(i).split("");
            String[] sw = new String[N];
            for(int j=0;j<N;j++){
                if(j<N-tmp.length){
                    sw[j]="0";
                }
                else{
                    sw[j]=tmp[j-(N-tmp.length)];
                }
            }
            boolean light = true;
            for(int k=0;k<M;k++){
                int count = 0;
                for(int j=0;j<N;j++){
                    if(table[k][j]==1){
                        if(sw[j].equals("1"))count++;
                    }
                }
                if((count%2!=onoff[k])){
                    light=false;
                    break;
                }
            }
            if(light)count_full_light++;
        }

        System.out.println(count_full_light);
    }
    public static void dump(int[][] a ) {
        for(int i=0;i<a.length;i++){
            for(int j=0;j<a[i].length;j++){
                System.out.print(a[i][j]);
            }
            System.out.println();
        }
    }
}

Measured memory_bytes: 27476
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>

using namespace std;

void func(int A,int B){
	int coin[3] = {0},tmp = B-A;

	coin[2] += (tmp/1000);
	tmp %= 1000;
	coin[1] += (tmp/500);
	tmp %= 500;
	coin[0] += (tmp/100);

	printf("%d %d %d\n",coin[0],coin[1],coin[2]);
}

int main(){

	int A,B;

	while(true){
		scanf("%d %d",&A,&B);
		if(A == 0 && B == 0)break;

		func(A,B);
	}

	return 0;
}

Measured memory_bytes: 2656
#include <iostream>

using namespace std;

bool isCapital(char c) {
    if ('A' <= c && c <= 'Z') {
        return true;
    }
    return false;
}

int main(int argc, char* argv[])
{
    string S; cin >> S;

    bool ans = true;
    if (S[0] != 'A') {
        ans = false;
    } else {
        bool cap = false;
        if (!isCapital(S[1])) {
            for (int i = 2; i < S.size()-1; i++) {
                if (S[i] == 'C') {
                    if (cap) {
                        ans = false;
                        break;
                    } else {
                        cap = true;
                    }
                } else if (isCapital(S[i])) {
                    ans = false;
                    break;
                }
            }
            if (isCapital(S[S.size()-1]) || !cap) {
                ans = false;
            }
        } else {
            ans = false;
        }
        
    }

    cout << (ans ? "AC" : "WA") << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

//#include <string.h>
#include <string>
using namespace std;

int main()
{
	string str,result;
	cin >> str;

	for (char c : str) {
		if (c == 'B') {
			if (!result.empty()) { result.pop_back(); }
		}
		else {
			result.push_back(c);
		}
	}
	printf("%s\n", result.c_str());

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<unordered_map>
#include<bitset>
#include<math.h>
#include<vector>
#include<set>
#include<algorithm>
#include<ctype.h>
#include<unordered_set>
#include<string>
#include<iomanip>
#include<queue>
#include<limits>
#include<map>
#include<stack>
#include<iterator>
#include<cstring>
 
#include<deque>
#define pi 3.141592653589793238
#include<chrono>
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#define MOD 1000000007
#define INF 999999999999999999 
#define pb push_back
#define ff first
#define ss second
 
#define mt make_tuple
#define ll long long
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>

using namespace __gnu_pbds;
 
 
typedef tree<ll, null_type, less_equal<ll>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
 
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    fast;
    ll T = 1, i, j;
    
    //cin >> T;
    while (T--) {
        ll n;
        cin >> n;
        vector<ll> c(26, INF);
        for(j = 0; j < n; j++){
            string s;
            map<ll,ll> cnt;
            cin >> s;
            for(auto u : s){
                cnt[u - 'a']++;
            }
            for(i = 0; i < 26; i++){
                c[i] = min(c[i], cnt[i]);
            }
        }
        vector<ll> ans;
        for(i = 0; i < 26; i++){
            for(j = 0; j < c[i]; j++){
                ans.pb(i);
            }
        }
        for(auto u : ans){
            cout << char('a' + u);
        }
    }
    return 0;
}

Measured memory_bytes: 3544
#include<bits/stdc++.h>
#define ll long long int
const ll mod=1e9+7;
const int maxn=2e5+50;
using namespace std;
int main()
//int found; found=chaine.find(cara); if (found!=std::string::npos) how to verify if a caracter exists in a chaine
// toupper(caractere) ==> return the majuscule of a caractere
//floor(x) Returns the largest integer smaller than x
//ceil(x) returns  Returns the smallest integer greater
{
	int a,b;
	cin>>a>>b;
	if(2*b>=a)
	{
		cout<<0;
	}
	else
	{
		cout<<a-2*b;
	}
}


Measured memory_bytes: 256
from statistics import mean, median,variance,stdev
import numpy as np
import sys
import math
import fractions
import itertools
import copy

def j(q):
    if q==1: print("YES")
    else:print("NO")
    exit(0)


def ct(x,y):
    if (x>y):print("GREATER")
    elif (x<y): print("LESS")
    else: print("EQUAL")

def ip():
    return int(input())


def calculate(a):
    s = 0
    for i in range(len(a)):
        for k in range(i+1,len(a)):
            s+=(a[i]*a[k])
    return s

n = ip()                              #入力整数1つ
#n,m= (int(i) for i in input().split())      #入力整数横2つ
#n,a,b = (int(i) for i in input().split())    #入力整数横3つ
#n,a,b,c= (int(i) for i in input().split())  #入力整数横4つ
#s = [int(i) for i in input().split()]        #入力整数配列
#a = input()                                  #入力文字列
#a = input().split()                          #入力文字配列
#n = ip()                      #入力セット(整数改行あり)(1/2)
#a=[ip() for i in range(n)]    #入力セット(整数改行あり)(2/2)
#a=[input() for i in range(h)]
#jの変数はしようできないので注意
#全足しにsum変数使用はsum関数使用できないので注意
if n == 1:
    print(1)
elif n==2:
    print(2)
else:
    l = [0]* ( n + 1 )

    for i in range(n+1):
        s = []
        value = i
        search = 1
        while value != 1 and search <= math.sqrt(value):
            search+=1
            if value%search == 0:
                s.append(search)
                value = value//search
                search = 1
        if search > math.sqrt(value) and value > 1:
            s.append(value)

        for p in range(len(s)):
            l[s[p]]+=1
    ans = 1
    for i in range(2,n+1):
        if l[i]:ans*=(l[i]+1)
    print(ans%(pow(10,9)+7))

Measured memory_bytes: 13644
import std.algorithm, std.conv, std.range, std.stdio, std.string;

void main()
{
  auto n = readln.chomp.to!ptrdiff_t;
  auto ai = readln.split.to!(int[]);

  writeln(ai.to!(string[]).join(" "));

  foreach (i; 1..n) {
    auto v = ai[i];
    auto j = i - 1;
    for (; j >= 0 && ai[j] > v; --j)
      ai[j + 1] = ai[j];
    ai[j + 1] = v;
    writeln(ai.to!(string[]).join(" "));
  }
}

Measured memory_bytes: 2504
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
int main(){
  int h,n,a;
  cin>>h>>n;
  rep(i,n) cin>>a,h-=a;
  if(h<=0) cout<<"Yes";
  else cout<<"No";
}


Measured memory_bytes: 256
#include <iostream>
#include <string>

using namespace std;

int main() {
  string s1, s2;
  int hit, blow;

  while(1) {
    cin >> s1 >> s2;
    if(s1 == "0" && s2 == "0") break;
    hit = blow = 0;
    for(int i = 0; i < 4; i++) {
      if(s1[i] == s2[i]) hit++;
      for(int j = 0; j < 4; j++) {
	if(s1[i] == s2[j]) blow++;
      }
    }
    blow -= hit;
    cout << hit << ' ' << blow << endl;
  }
  return 0;
}

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

//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
//template <typename T> using orderMSet =
//tree <T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;

typedef long long ll;
typedef unsigned long long llu;
#define filein freopen("input.txt", "r", stdin)
#define fileout freopen("output.txt", "w", stdout)
#define inf 1000000000000000018
#define mod 998244353
#define ff first
#define ss second
#define pb push_back
#define mk make_pair
#define pii pair<int, int>
#define pll pair<ll, ll>

#define MX 3003
ll dp[MX][MX], arr[MX], ans, n, s;

ll f(ll pos, ll rem)
{
	if(rem < 0) return 0;
	if(rem == 0) return n-pos+1;
	if(pos == n) return 0;

	ll &ret = dp[pos][rem];
	if(ret != -1) return ret;

	ll x = f(pos+1, rem);
	ll y = f(pos+1, rem-arr[pos]);

	if(rem == s) ans += ((pos+1)*y)%mod; ans %= mod;
	return ret = (x+y)%mod;
}

int main()
{
	scanf("%lld %lld", &n, &s);

	for(ll i = 0; i < n; i++) {
		scanf("%lld", &arr[i]);
	}

	memset(dp, -1, sizeof dp);
	f(0, s);

	printf("%lld\n", ans);
}


Measured memory_bytes: 70912
package main

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

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getInts(N int) []int {
	ret := make([]int, N)
	for i := 0; i < N; i++ {
		ret[i] = getInt()
	}
	return ret
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

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

func asub(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

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

func lowerBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] >= x
	})
	return idx
}

func upperBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] > x
	})
	return idx
}

func main() {
	sc.Split(bufio.ScanWords)
	N := getInt()
	L := make([]int, 87)
	L[0] = 2
	L[1] = 1
	for i := 2; i <= 86; i++ {
		L[i] = L[i-1] + L[i-2]
	}
	out(L[N])
}


Measured memory_bytes: 1772
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>

using namespace std;
typedef long long ll;

int main() {

	ll A, B, C, K, sum = 0;
	cin >> A >> B >> C >> K;

	sum += min(K, A);
	K -= sum;
	K -= min(K, B);
	sum -= min(K, C);
	cout << sum << endl;
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define FORR(i,a,b) for (int i=(a);i>=(b);i--)
#define pb push_back

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef set<int> si;
const int inf = 1e9;
const int mod = 1e9+7;

int N, M, Q, a, b, v, d, c;

vi m[100000 + 5];
int vr[100000 + 5][3], q[100000 + 5][3];

si y, tmp, tmp2;
si::iterator sir;

main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> N >> M;
  FOR(i, 0, M){
    cin >> a >> b;
    m[a].pb(b);
    m[b].pb(a);
  }
  cin >> Q;
  FOR(i, 0, Q){
    cin >> v >> d >> c;
    q[i][0] = v;
    q[i][1] = d;
    q[i][2] = c;
  }
  FOR(i, 1, N + 1){
    vr[i][0] = 0;
    vr[i][1] = -1;
    vr[i][2] = -1;
  }
  int idx, dist;
  FORR(i, Q - 1, 0){
    v = q[i][0];
    d = q[i][1];
    c = q[i][2];
    //cout << "v:" << v << ",d:" << d << ",c:" << c << endl;
    tmp.clear();
    tmp.insert(v);
    y.clear();
    y.insert(v);
    dist = d;
    while(dist >= 0){
      tmp2.clear();
      //cout << "dist:" << dist << "  ";
      //for(sir = tmp.begin(); sir != tmp.end(); sir++){ cout << (*sir) << ",";}
      //cout << endl;
      for(sir = tmp.begin(); sir != tmp.end(); sir++){
        idx = *sir;
        if(! vr[idx][0]){
          vr[idx][0] = c;
          vr[idx][1] = dist;
        }
        if(vr[idx][2] < dist){
          vr[idx][2] = dist;
          if(dist > 0)FOR(j, 0, m[idx].size()){
            if(y.find(m[idx][j]) == y.end()){
              y.insert(m[idx][j]);
              tmp2.insert(m[idx][j]);
            }
          }
        }
      }
      tmp.swap(tmp2);
      dist--;
    }
    //for(sir = y.begin(); sir != y.end(); sir++){
    //  cout << (*sir) << ",";
    //}
    //cout << endl;
  }
  FOR(i, 1, N + 1) cout << vr[i][0] << endl;
}


Measured memory_bytes: 18296
X, N = map(int, input().split())
p = [i for i in map(int, input().split())]

for i in range(0,101):
    if (X-i in p) == False: # pの中にX-iは無い場合
        print(X-i)
        break
    elif (X+i in p) == False: # pの中にX+iは無い場合
        print(X+i)
        break


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

int main(){
  int d,n;
  cin >> d >> n;
  if(n == 100)n = 101;
  int res = n;
  for(int i = 0 ; i < d ; i++){
    res *= 100;
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 256
import math

A, B, H, M = map(int, input().split())

tm = M / 60.0 * 2 * math.pi
mx = B * math.cos(tm)
my = B * math.sin(tm)

th = (H * 60.0 + M) / 720 * 2 * math.pi
hx = A * math.cos(th)
hy = A * math.sin(th)

dx = hx - mx
dy = hy - my

print(math.sqrt(dx * dx + dy * dy))


Measured memory_bytes: 62504
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		try {
			int N = sc.nextInt();
			double M = sc.nextInt();
			int[] A = new int[N];

			for (int i = 0; i < N; i++) {
				A[i] = sc.nextInt();
			}

			double soutokuhyo = 0;
			for (int i = 0; i < N; i++) {
				soutokuhyo += A[i];
			}
			double yuukouper = soutokuhyo * (1 / (4 * M));
			double ninki = 0;
			for (int i = 0; i < N; i++) {
				if (A[i] >= yuukouper) {
					ninki++;
				}
			}

			String ans;
			if (ninki >= M) {
				ans = "Yes";
			} else {
				ans = "No";
			}
			System.out.println(ans);

		} finally

		{
			sc.close();
		}
	}

}


Measured memory_bytes: 22868
#include<bits/stdc++.h>
#define For(i,a,b) for(int i=(a);i<=(b);++i)
#define Ford(i,a,b) for(int i=(a);i>=(b);--i)
#define fio(s) freopen(s".inp","r",stdin)
#define foo(s) freopen(s".out","w",stdout)
#define task "test"
using namespace std;
typedef long long LL;
const LL N=100009,OO=1e9+7;
LL n,ans,dp[N][2];
vector<LL> ke[N],child[N];
LL dps(LL u,LL c){
    if(dp[u][c]!=-1) return dp[u][c];
    dp[u][c]=1;
    if(c){
        for(auto v:child[u])
            dp[u][c]=(dp[u][c]*(dps(v,0)%OO))%OO;
    }else
        for(auto v:child[u])
            dp[u][c]=(dp[u][c]*(dps(v,0)%OO+dps(v,1)%OO))%OO;
   return dp[u][c]%OO;
}
void dfs(LL u,LL p){
    for(auto v:ke[u])
    if(v!=p) {child[u].push_back(v); dfs(v,u);}
}
int main(){
    //fio(task); foo(task);
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin>>n;
    LL u,v;
    For(i,1,n-1){
        cin>>u>>v; ke[u].push_back(v);ke[v].push_back(u);
    }
    memset(dp,255,sizeof(dp));
    dfs(1,0);
    ans=(dps(1,0)+dps(1,1))%OO;
    cout<<ans;
    return 0;
}


Measured memory_bytes: 19712
#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll n, ans[100005], a[100005], temp,f = 1;
int main()
{
    //ios::sync_with_stdio(false);
    cin >> n;
    for(int i = 1; i <= n; ++i) cin >> a[i], temp += 2 * f * a[i], f *= -1;
    ans[1] = temp / 2;
    cout << ans[1] <<' ';
    for(int i = 2; i <= n; ++i){
        ans[i] = 2 * a[i - 1] - ans[i - 1];
        cout << ans[i] << ' ';
    }

    return 0;
}

Measured memory_bytes: 5192
<?php
fscanf(STDIN, '%d %d', $a1, $b1);
fscanf(STDIN, '%d %d', $a2, $b2);
fscanf(STDIN, '%d %d', $a3, $b3);

$nums = [
    $a1, $b1,
    $a2, $b2,
    $a3, $b3,
];

$counts = array_count_values($nums);

echo $counts[2] == 2 && $counts[3] == 2 ? 'YES' : 'NO' . "\n";

Measured memory_bytes: 4604
//in the name of GOD//

#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie();
#define sz(s) s.size()

int main(){
  int n;
  cin >> n;
  int a[n],b[n];
  for(int i = 0; i < n; i++){
    cin >> a[i];
    b[a[i] - 1] = i + 1;
  }
  for(int i = 0; i < n; i++){
    cout << b[i] << ' ';
  }
}


Measured memory_bytes: 1536
#include <stdio.h>

int main(void){
    int M,N;
    int len[50] = {};
    
    scanf("%d%d",&N,&M);
    
    for(int i = 0; i < M; i++){
        int a,b;
        scanf("%d%d",&a,&b);
        len[a-1]++;
        len[b-1]++;
    }
    
    for(int i = 0; i < N; i++){
        printf("%d\n",len[i]);
    }
}

Measured memory_bytes: 128
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>//sort,reverse
#include<utility>//pair
#include<queue>//queue,priority_queue
#include<deque>//double_ended queue
using namespace std;
typedef pair<int,int> P;//Pでpair<-,->を表す。
typedef long long LL; 
LL MOD=1000000007;

int main()
{ 
    LL n,a,b;
    cin>>n>>a>>b;
    LL ans=0;
    ans=n/(a+b)*a;
    n=n%(a+b);
    if(n<=a){ans=ans+n;}
    else{ans=ans+a;}

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

Measured memory_bytes: 256
/*
START BY THE NAME OF ALMIGHTY ALLAH
THIS WONT BE ACCEPTED
STOP_GIVING_UP

██╗███████╗████████╗██╗ █████╗ ██╗  ██╗
██║██╔════╝╚══██╔══╝██║██╔══██╗██║ ██╔╝
██║███████╗   ██║   ██║███████║█████╔╝
██║╚════██║   ██║   ██║██╔══██║██╔═██╗
██║███████║   ██║   ██║██║  ██║██║  ██╗
╚═╝╚══════╝   ╚═╝   ╚═╝╚═╝  ╚═╝╚═╝  ╚═╝




*/
#include<bits/stdc++.h>
#define l(i,a,n)for(int i=a;i<n;i++)
#define pb push_back
#define in insert
#define mp make_pair
#define lw(v) sort(v.begin(),v.end());
#define hi(v) sort(v.begin(),v.end(),greater<long long>());
#define all(v) v.begin(),v.end()
#define filein freopen ("input.txt", "r", stdin)
#define fileout freopen ("output.txt", "w", stdout)
using namespace std;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    long long t,r=1,r1=0,r2=0,k=0,a,b,c=1,m,d=0,n,e,f,x=0,g,p=0,q=0,y=0,z=0;
    vector<long long>v;
    vector<long long>u;
    set<long long>s;
    std::vector<int>::iterator it;
    string  s1,s2,s3,s4;
    cin>>n>>m>>k;
    d=k/(n);
    d=d*m;
    cout<<d<<endl;

}


Measured memory_bytes: 3576
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cctype>
#include<algorithm>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<cstring>
//#include<windows.h>
//#include<time.h>
#define pb push_back
#define ppb pop_back
#define fi first
#define se second
#define mer make_pair
#define mme memset
using namespace std;

const double pie1=3.1415926;//π1
const double pie2=3.14159265358979;//π2
const double pie3=3.14159265358979323846;//π3
const int vbi=999999999;
const int vli=-vbi;
const long long vbl=999999999999999999;
const long long vll=-vbl;

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<pii,int> piii;
typedef pair<pii,pii> pi4;
typedef pair<pll,ll> plll;
typedef pair<int,pii> ipii;
typedef pair<ll,pll> lpll;
typedef pair<pll,pll> pl4;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vpi;
typedef vector<pll> vpl;
typedef set<int> sti;
typedef set<ll> stl;
typedef set<pii> spi;
typedef set<pll> spl;
priority_queue<int> pqi;
priority_queue<ll> pql;
queue<int> qi;
queue<ll> ql;

/*void bin_v(){
	char bin[1000];
	gets(bin);
}*/

bool pss(int a){
	for(int i=2;i<=sqrt(a);i++)
		if(a%i==0)
			return false;
	return true;
}
/////////////////////////////////////////////////////////////////////////////////////////
int n,a,b;
ll h[100010];

bool ok(ll x){
	ll v=0;
	for(int i=1;i<=n;i++)
		if(h[i]>x*b){
			v+=ceil((h[i]-x*b)*1.0/a);
//			cout<<ll(ceil((h[i]-x*b)*1.0/a))<<' '<<h[i]-x*b<<endl;
		}
	return v<=x;
}

int main(){
	//my name is Veex_WCY
	ios::sync_with_stdio(false);
	cin>>n>>a>>b;
	a=a-b;
	ll mosth=0;
	for(int i=1;i<=n;i++){
		cin>>h[i];
		mosth=max(mosth,h[i]);
	}
	ll l=1,r=mosth,m;
	while(l<=r){
		m=(l+r)/2;
//		cout<<endl<<m<<endl;
		if(ok(m))
			r=m-1;
		else
			l=m+1;
	}
	cout<<l;
	return 0;
}
/*
900000000
900000000
1000000000
1000000000
1000000000
*/

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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> Pi;
typedef vector<ll> Vec;
typedef vector<int> Vi;
typedef vector<string> Vs;
typedef vector<vector<ll>> VV;
typedef vector<vector<int>> VVi;

#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define PER(i, a, b) for(ll i=(a); i>=(b); i--)
#define rep(i, n) REP(i, 0, n)
#define per(i, n) PER(i, n, 0)
const ll INF=1e18+18;
const ll MAX=100005;
const ll MOD=1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
#define ALL(v) v.begin(), v.end()
#define rALL(v) v.rbegin(), v.rend()
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a,b)
#define Each(a,b) for(auto &a :b)
#define REPM(i, mp) for (auto i = mp.begin(); i != mp.end(); ++i)
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbgmap(mp) cerr << #mp << ":"<<endl; for (auto i = mp.begin(); i != mp.end(); ++i) { cerr << i->first <<":"<<i->second << endl;}
#define dbgarr(n,m,arr) rep(i,n){rep(j,m){cerr<<arr[i][j]<<" ";}cerr<<endl;}
#define dbgdp(n,arr) rep(i,n){cerr<<arr[i]<<" ";}cerr<<endl;
#define sum(v) accumulate(ALL(v),0)
#define fi first
#define se second

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

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

// vector
template<typename T>
ostream &operator<<(ostream &s, const vector<T> &v) {
    int len=v.size();
    for(int i=0; i<len; ++i) {
        s<<v[i];
        if(i<len-1) s<<"	";
    }
    return s;
}

// 2 dimentional vector
template<typename T>
ostream &operator<<(ostream &s, const vector<vector<T> > &vv) {
    int len=vv.size();
    for(int i=0; i<len; ++i) {
        s<<vv[i]<<endl;
    }
    return s;
}

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

    ll n,m,x;
    cin>>n>>m>>x;
    Vec a(m);
    rep(i,m)cin>>a[i];
    Vec s(n+1);
    REP(i,1,n+1){
        if(binary_search(ALL(a),i)){
            s[i] = s[i-1]+1;
        }else{
            s[i]  = s[i-1];
        }
    }
    ll ans= min(s[n]-s[x],s[x]);
    cout<<ans<<endl;
    return  0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second

const int mx=200010;
const ll mod=1e9+7;

int main() {
  int n;
  cin >> n;
  deque<int> c;
  rep(i,n){
    int a; cin >> a;
    int pos = lower_bound(c.begin(),c.end(),a) - c.begin();
    if(pos==0){
      c.push_front(a);
    } else {
      c[pos-1] = a;
    }
  }

  int ans = c.size();
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <string>

using namespace std;
int main(void){
    // Your code here!
    int bNum[6];
    int aNum[6];
    aNum[6] = 1;
    
    int leng = 0;
    string str1, str2;
    
    for(int i=0; i<6; i++){
        cin >> bNum[i];
        aNum[i] =bNum[i];
    }
    
    cin >> str1;
    leng = str1.length();
    
    for(int i=0; i<leng; i++){
        if(str1[i]=='S'){
            aNum[0] = bNum[4];
            aNum[1] = bNum[0];
            aNum[5] = bNum[1];
            aNum[4] = bNum[5];
            
            bNum[4] = aNum[4];
            bNum[0] = aNum[0];
            bNum[5] = aNum[5];
            bNum[1] = aNum[1];
        }else if(str1[i]=='N'){
            aNum[0] = bNum[1];
            aNum[1] = bNum[5];
            aNum[5] = bNum[4];
            aNum[4] = bNum[0];
            
            bNum[0] = aNum[0];
            bNum[1] = aNum[1];
            bNum[4] = aNum[4];
            bNum[5] = aNum[5];
        }else if(str1[i]=='W'){
            aNum[0] = bNum[2];
            aNum[3] = bNum[0];
            aNum[2] = bNum[5];
            aNum[5] = bNum[3];
            
            bNum[0] = aNum[0];
            bNum[3] = aNum[3];
            bNum[2] = aNum[2];
            bNum[5] = aNum[5];
        }else if(str1[i]=='E'){
            aNum[2] = bNum[0];
            aNum[0] = bNum[3];
            aNum[5] = bNum[2];
            aNum[3] = bNum[5];
            
            bNum[2] = aNum[2];
            bNum[0] = aNum[0];
            bNum[5] = aNum[5];
            bNum[3] = aNum[3];
        }
    }
    
    cout << bNum[0] << endl;
    
}



Measured memory_bytes: 3212
#include <stdio.h>
#include <string.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define INF ((1LL<<62)-(1LL<<31))
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define bit(n,m)((n>>m)&1)
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}

ll n,w,h;
ll xx[100010],yy[100010];
int main(){
	scanf("%lld%lld%lld",&n,&w,&h);
	rep(i,0,n){
		ll x,y,z;
		scanf("%lld%lld%lld",&x,&y,&z);
		xx[max(x-z,0)]++;xx[min(x+z,w)]--;
		yy[max(y-z,0)]++;yy[min(y+z,h)]--;
	}
	rep(i,1,w+5)xx[i]+=xx[i-1];
	rep(j,1,h+5)yy[j]+=yy[j-1];
	ll xflag=1,yflag=1;
	rep(i,0,w)xflag&=!!xx[i];
	rep(j,0,h)yflag&=!!yy[j];
	puts(xflag|yflag?"Yes":"No");
	return 0;
}


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

using namespace std;
typedef long long ll;
#define rrep1(i,n) for(ll i=n;i>=1;i--)

int main(){
	ll N; cin>>N;
	ll i=0;
	while((1+i)*i<2*N){
		i++;
	}
	ll W=((i+1)*i)/2-N;//削る点数
	rrep1(k,i){
		if(W<k) cout<<k<<endl;
		else W-=k;
	}
}

Measured memory_bytes: 256
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;

void main()
{
    auto abx = readln.split.to!(double[]);
    auto a = abx[0];
    auto b = abx[1];
    auto x = abx[2]/a;

    double th;
    if (x > a*b/2) {
        th = atan((a*b-x)*2/(a^^2)) * (180.0)/PI;
    } else {
        th = 90.0 - atan(x*2/(b^^2)) * (180.0)/PI;
    }
    writefln("%.10f", th);
}

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

int main() {
  int N, K;
  string S;
  cin >> N >> K >> S;
  if (S[K-1] == 'A') {
    S[K-1] = 'a';
  } else if (S[K-1] == 'B') {
    S[K-1] = 'b';
  } else {
    S[K-1] = 'c';
  }
  cout << S << endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int k = sc.nextInt(), n = sc.nextInt();
		int a[] = new int[n];
		int max = 0;
		for(int i = 0; i < n; ++i){
			a[i] = sc.nextInt();
			if(i > 0){
				max = Math.max(max, Math.abs(a[i] - a[i - 1]));
			}
		}
		max = Math.max(max, Math.abs(a[n - 1] - a[0] - k));
		sc.close();
		int ans = k - max;
		System.out.println(ans);
	}
}


Measured memory_bytes: 66460
#include <iostream>

using namespace std;

int main(){
    int a, b, l;
    cin >> a >> b;
    int c[a][b]={{0}}, d[b]={0}, e[a]={0};
    for(int i=0;i<a;i++){
        for(int j=0;j<b;j++){
            cin >> l;
            c[i][j] = l;
        }
    }
    for(int s=0;s<b;s++){
        cin >> l;
        d[s] = l;
    }
    for(int t1=0;t1<a;t1++){
        for(int t2=0;t2<b;t2++){
            e[t1] += d[t2]*c[t1][t2];
        }
        cout << e[t1] << endl;
    }
}


Measured memory_bytes: 3124
A,B,C,X = [int(input()) for _ in range(4)]

ans = 0

for i in range(A+1):
  for j in range(B+1):
    for k in range(C+1):
      x = i*500 + j*100 + k*50
      if x == X:
        ans += 1
print(ans)

Measured memory_bytes: 3060
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cassert>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
#include <list>
#include <limits>
#include <numeric>
#include <utility>
#include <deque>
#include <valarray>
#include <unordered_set>
#include <unordered_map>
#include <regex>
#include <array>
#include <bitset>
#include <complex>
#include <tuple>

using namespace std;
using ll = long long;
const int INF = 1e9;
const int MOD = 1e9 + 7;

int main()
{
  string s;
  cin >> s;
  int nmax = 0;
  int len = 0;
  for (int i = 0; i < s.size(); ++i)
  {
    if (s[i] == 'A' || s[i] == 'T' || s[i] == 'G' || s[i] == 'C')
      len++;
    else
    {
      nmax = max(nmax, len);
      len = 0;
    }
  }
  nmax = max(nmax, len);
  cout << nmax << endl;

  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
 
	public static void main(String[] args) {
		Scanner sc = new Scanner (System.in);
		int n = sc.nextInt();
		int x = sc.nextInt();
		int m[] = new int[n];
		int total = n;
		int remain = x;
		for(int i = 0; i < n; i++) {
			m[i] = sc.nextInt();
			remain-=m[i];
		}
		int greatest = 0;
		if(remain > 0) {
			for(int i = 0; i < n; i++) {
				if((remain-remain%m[i])/m[i] > greatest) {
					greatest = (remain-remain%m[i])/m[i];
				}
			}
		}
		total+=greatest;
		
		System.out.println(total);
	}
}

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

using namespace std;

#ifdef DGC
#include "debug.h"
#else
#define debug(...) 9715
#endif
typedef long long ll;
typedef long double ld;
typedef complex<ld> point;
#define F first
#define S second



int main()
{
	#ifdef DGC
		//freopen("a.in", "r", stdin);
		//freopen("b.out", "w", stdout);
	#endif

	ios_base::sync_with_stdio(0), cin.tie(0);

	int n, mod;
	cin >> n >> mod;
	vector<int> a(n);
	for (auto &i : a) cin >> i;

	ll ans = 0;
	map<int, int> mp;
	mp[0] = 1;
	a.insert(a.begin(), 0);
	for (int i = 1; i <= n; ++i)
	{
		a[i] += a[i-1];
		a[i] %= mod;

		if (i-mod >= 0) --mp[i-mod - a[i-mod]];
		if (mp.count(i-a[i])) ans += mp[i-a[i]];
		if (mp.count(i-mod-a[i])) ans += mp[i-mod-a[i]];
		++mp[i-a[i]];
	}
	cout << ans << "\n";

	return 0;
}


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

int main() {
    long long n, a, b;
    cin >> n >> a >> b;

    long long d = abs(a - b);

    if(d % 2 == 0) cout << setprecision(18) << d / 2 << endl;
    else {
        long long a1 = a - 1;
        long long b1 = b - 1;
        long long an = n - a;
        long long bn = n - b;

        // 端で待ってる場合
        /*
        long long Max1 = max(a1, b1);
        long long Maxn = max(an, bn);
        long long MachiMin = min(Max1, Maxn);
        */

        // 跳ね返ってくる場合
        long long bound1 = (a1 + b1 + 1) / 2;
        long long boundn = (an + bn + 1) / 2;
        long long ans = min(bound1, boundn);

        cout << setprecision(18) << ans << endl;
    }

    return 0;
}

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

vector<pair<string,bool>> parse(string s){
    bool isConstString = false;
    string tmp = "";
    vector<pair<string,bool>> res;
    for(int i = 0;i < s.size();i++){
        if(s[i] == '\"'){
            res.push_back(make_pair(tmp,isConstString));
            tmp = "";
            isConstString = !isConstString;
        }else{
            tmp += s[i];
        }
    }
    if(tmp.size())res.push_back(make_pair(tmp,isConstString));
    return res;
}

string solve(string s1,string s2){
    auto p1 = parse(s1);
    auto p2 = parse(s2);
    if(p1 == p2)return "IDENTICAL";
    if(p1.size() != p2.size())return "DIFFERENT";
    int cnt = 0;
    for(int i = 0;i < p1.size();i++){
        if(p1[i].second != p2[i].second)return "DIFFERENT";
        if(p1[i].first != p2[i].first){
            if(p1[i].second){
                cnt += 1;
            }else{
                return "DIFFERENT";
            }
        }
    }
    return (cnt > 1 ? "DIFFERENT" : "CLOSE");
}

int main(){
    string s1,s2;
    while(true){
        cin >> s1;
        if(s1 == "."){
            return 0;
        }
        cin >> s2;
        cout << solve(s1,s2) << endl;
    }
}


Measured memory_bytes: 3172
#include<stdio.h>
int main()
{
int n,i,sw;
  sw=0;
  scanf("%d",&n);
  char a[n];
  
  for(i=0;i<n;++i)
  {
  scanf("%c",&a[i]);
  if(a[i]=='Y') sw++;
  }
if(sw>0) printf("Four");
else printf("Three");

return 0;}

Measured memory_bytes: 1712
#include <stdio.h>
int main(){
  int i,N,j,A[100],flag,tmp,count=0;
  scanf("%d",&N);
  for(i = 0; i < N; i++){
    scanf("%d",&A[i]);
  }
  for(j = 0; j < N-1; j++){
    for(i = N-1; i >= 1+j; i--){
      if(A[i] < A[i-1]){
	tmp = A[i];
	A[i] = A[i-1];
	A[i-1] = tmp;
	count++;
      }
    }
  }
  for(i = 0; i < N-1; i++){
    printf("%d ",A[i]);
  }
  printf("%d\n",A[i]);
  printf("%d\n",count);
  return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n,y;
  int a = -1,m = -1,s = -1;
  cin >> n >> y;
  for(int i=0;i<=n;i++){
    for(int j=0;j<=n-i;j++){
      int k = n-i-j;
      if(10000*i+5000*j+1000*k==y){
        a=i;m=j;s=k;
      }
    }
  }
  printf("%d %d %d\n",a,m,s);
}
        

Measured memory_bytes: 256