akhauriyash/Code-Regression huggingface dataset:
// warm heart, wagging tail,and a smile just for you!
//                                                                     ███████████
//                                                                   ███╬╬╬╬╬╬╬╬╬╬███
//                                                                ███╬╬╬╬╬████╬╬╬╬╬╬███
//                                            ███████████       ██╬╬╬╬╬████╬╬████╬╬╬╬╬██
//                                      █████████╬╬╬╬╬████████████╬╬╬╬╬██╬╬╬╬╬╬███╬╬╬╬╬██
//                               ████████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████████╬╬╬╬╬╬██╬╬╬╬╬╬╬██
//                             ████╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████████╬╬╬╬╬╬╬╬╬╬╬██
//                           ███╬╬╬█╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬███╬╬╬╬╬╬╬█████
//                         ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬████████╬╬╬╬╬██
//                       ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬╬╬╬╬╬███
//                     ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬██
//                 ████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████╬╬╬╬╬████
//     █████████████╬╬╬╬╬╬╬╬██╬╬╬╬╬████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬██████
//   ████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬██████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██████╬╬╬╬╬╬╬███████████╬╬╬╬╬╬╬╬██╬╬╬██╬╬╬██
// ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████╬╬╬╬╬╬╬╬╬╬╬█╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬██
// ██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬▓▓▓▓▓▓╬╬╬████╬╬████╬╬╬╬╬╬╬▓▓▓▓▓▓▓▓██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬███
// ██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██████▓▓▓▓▓▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓▓▓▓▓▓▓██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬█████
// ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████████
//   ███╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██
//       ██████████████  ████╬╬╬╬╬╬███████████████████████████╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████
//                         ███████                           █████  ███████████████████
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
const double EPS = 1e-9;
#define INF (1LL<<60)
#define D double
#define fs first
#define sc second
#define int long long
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i = (b-1);i>=(a);i--)
#define REP(i,n)  FOR(i,0,(n))
#define RREP(i,n) RFOR(i,0,(n))
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x)  cout << #x << " = " << (x) << endl;
#define SP << " " << 
typedef pair<int,int> P;
typedef vector<vector<P> > Graph;
typedef vector<int> vec;
typedef vector<vector<int>> mat;

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

  int n,m;
  cin >> n >> m;

  vec tmp(n+1,0);

  REP(i,m){
    int x,y;
    cin >> x >> y;
    tmp[x-1]++;
    tmp[y]--;
  }

  REP(i,n) tmp[i+1] += tmp[i];

  int ans = 0;
  REP(i,n+1) if(tmp[i] == m) ans++;

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 1024
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	c := make([]int, n)
	s := make([]int, n)
	f := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&c[i], &s[i], &f[i])
	}

	for i := 0; i < n; i++ {
		a := 0
		for j := i; j < n-1; j++ {
			if a < s[j] {
				a = s[j]
			} else {
				x := a % f[j]
				if x != 0 {
					a += f[j] - x
				}
			}
			a += c[j]
		}
		fmt.Println(a)
	}
}


Measured memory_bytes: 512
import java.util.*;
 
public class Main {
	
    public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	String A = sc.next();
    	String B = sc.next();
    	String ans = "EQUAL";
    	if (A.length() < B.length()) {
    		ans = "LESS";
    	} else if (B.length() < A.length()) {
    		ans = "GREATER";
    	} else {
    		for (int i = 0; i < A.length(); i++) {
    			if (A.charAt(i) < B.charAt(i)) {
    				ans = "LESS";
    				break;
    			} else if (B.charAt(i) < A.charAt(i)) {
    				ans = "GREATER";
    				break;
    			}
    		}
    	}
    	System.out.println(ans);
    }
}

Measured memory_bytes: 21844
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 1000001;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

ll gcd(ll a, ll b) {
	if (b == 0) { return a; }
	if (a < b) { return gcd(b, a); }
	return gcd(b, a%b);
}

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

struct edge {
	ll ind;
	ll to;
	ll d;
};


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


int main() {

	ll N;
	cin >> N;

	if (N / 100 == N % 10) { cout << "Yes"; }
	else { cout << "No"; }

	system("PAUSE");

}


Measured memory_bytes: 504
#include<bits/stdc++.h>
#define ll          long long int
#define lld          long double
#define pb          push_back
#define pii         pair<ll,ll>
#define mi          map<ll,ll>
#define vec         vector<ll>
#define all(a)     (a).begin(),(a).end()
#define F           first
#define S           second
#define mod         1000000007
#define rep(i,a,b)	for(ll  i=a;i<b;i++)
#define repi(i,a,b)	for(ll  i=a;i<=b;i++)
#define per(i,a,b)  for(ll i=a;i>=b;i--)
#define mp          make_pair
#define mit         map<ll,ll>::iterator
#define sit         set<ll>::iterator
#define pit         pair<ll,ll>::iterator
#define tr(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++)
using namespace std;
ll xo(ll x, ll y) 
{ 
   return (x | y) & (~x | ~y); 
}  
ll bin_Expo(ll x,ll n)
{
		if(x==0)
		return 0;
    if(n==0)
        return 1;
    else if(n%2 == 0)        //n is even
        return bin_Expo(x*x,n/2);
    else                             //n is odd
        return x*bin_Expo(x*x,(n-1)/2);
}
ll mod_Expo(ll x,ll n,ll M)
{
		if(x==0)
		return 0;
    if(n==0)
        return 1;
    else if(n%2 == 0)        //n is even
        return mod_Expo((x*x)%M,n/2,M);
    else                             //n is odd
        return (x*mod_Expo((x*x)%M,(n-1)/2,M))%M;
 
}
ll NcR(int n, int r) 
{ 
    ll p = 1, k = 1; 
    if (n - r < r) 
        r = n - r; 
  
    if (r != 0) { 
        while (r) { 
            p *= n; 
            k *= r; 
            ll m=__gcd(p, k); 
            p /= m; 
            k /= m; 
            n--; 
            r--; 
        } 
    } 
    else
        p = 1; 
    return p;
}
bool prime_check(ll x)
{
    bool prime = (x >= 2);
    for (ll i = 2; i * i <= x; i++) 
    {
        if (x % i == 0) 
        {
            prime = false;
            break;
        }
    }
    return prime;
}
ll logg(ll base,ll x)
{
    return (ll)(log(x)/log(base));
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int TESTS=1;
//	cin>>TESTS;
    while(TESTS--)
    {
    	ll i,j,m,k,ans,x,n,sum,c;
    	cin>>n>>x;
    	ll a[n+1],b[n+1]; ans=1;
    	repi(i,1,n)
    	cin>>a[i];
    	b[0]=0;
    	repi(i,1,n)
    	{
    		b[i]=b[i-1]+a[i];
    		if(b[i]<=x)
    		ans++;
    		else
    		break;
		}
    	cout<<ans;
    } 
	return 0;
}

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

typedef long long ll;

int main(void)
{
    priority_queue<ll> pque;
    ll input;

    for (int i = 0; i < 10; i++) {
        cin >> input;
        pque.push(input);
    }

    for (int i = 0; i < 3; i++) {
        cout << pque.top() << endl;
        pque.pop();
    }

    return 0;
}

Measured memory_bytes: 1212
#include <stdio.h>
#include <assert.h>

namespace beet{
  
  template<typename T>
  void swap(T &a,T &b){
    T x=a;
    a=b;
    b=x;
  }
  
  template<typename T>
  struct Vector{
    int sz,cap;
    T *data;
    Vector():sz(0),cap(1){
      data = new T[cap];
    }    
    Vector(int sz):sz(sz),cap(sz<<1){
      data = new T[cap];
    }
    Vector(int sz,T t):sz(sz),cap(sz<<1){
      data = new T[cap];
      for(int i=0;i<sz;i++) data[i]=t;
    }
    ~Vector(){
      delete[] data;
    }
    void resolve(){
      T *tmp = new T[cap];
      for(int i=0;i<sz;i++) tmp[i]=data[i];
      delete[] data;
      data=tmp;
    }
    void resize(int nsz){
      cap=nsz<<1;
      if(sz>cap) sz=cap;
      resolve();      
    }
    void assign(int nsz,T t){
      resize(nsz);
      sz=nsz;
      for(int i=0;i<sz;i++) data[i]=t;
    }    
    void push_back(T x){
      if(sz>=cap){
        cap<<=1;
        assert(sz<cap);
        resolve();
      }      
      data[sz++]=x;
    }
    void pop_back(){
      sz--;
    }
    int size() const{
      return sz;
    }
    const T operator[](int x) const{
      return data[x];
    }
    T& operator[](int x){
      assert(0<=x&&x<sz);
      return data[x];
    }
  };
  
  template <typename T, typename F>
  struct SegmentTree{
    int n;
    F f;
    T ti;
    Vector<T> dat;
    SegmentTree(){};
    SegmentTree(F f,T ti):f(f),ti(ti){}
    void init(int n_){    
      n=1;
      while(n<n_) n<<=1;
      dat.assign(n<<1,ti);
    }
    void build(const Vector<T> &v){
      int n_=v.size();
      init(n_);
      for(int i=0;i<n_;i++) dat[n+i]=v[i];
      for(int i=n-1;i;i--)
        dat[i]=f(dat[(i<<1)|0],dat[(i<<1)|1]);
    }
    void set_val(int k,T x){
      dat[k+=n]=x;
      while(k>>=1)
        dat[k]=f(dat[(k<<1)|0],dat[(k<<1)|1]);    
    }
    T query(int a,int b){
      T vl=ti,vr=ti;
      for(int l=a+n,r=b+n;l<r;l>>=1,r>>=1) {
        if(l&1) vl=f(vl,dat[l++]);
        if(r&1) vr=f(dat[--r],vr);
      }
      return f(vl,vr);
    }
  };

}
//INSERT ABOVE HERE
using namespace beet;

int main(){
  int n,l;
  scanf("%d %d",&n,&l);
  Vector<int> as(n);
  for(int i=0;i<n;i++) scanf("%d",&as[i]);
  
  int ti=(1LL<<31)-1;
  auto f=[](int a,int b){return a<b?a:b;};
  SegmentTree<int, decltype(f)> seg(f,ti);
  seg.build(as);
  
  for(int i=0;i+l<=n;i++){
    if(i) printf(" ");
    printf("%d",seg.query(i,i+l));
  }
  puts("");
  return 0;
}



Measured memory_bytes: 14528
N,A,B=map(int,input().split())
X=list(map(int,input().split()))
Y=[0 for k in range(N-1)]
for k in range(N-1):
    Y[k]=X[k+1]-X[k]
ans=0
for k in range(N-1):
    ans+=min(A*Y[k],B)
print(ans)


Measured memory_bytes: 15020
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();

		int[] p = new int[n];
		for (int i=0;i<n;i++) {
			p[i]=sc.nextInt()-1;
		}

		int[] parent = new int[n];
		for (int i=0;i<n;i++) {
			parent[i]=i;
		}

		for (int i=0;i<m;i++) {
			int x = sc.nextInt();
			int y = sc.nextInt();
			union(parent, x-1, y-1);
		}

		int count = 0;
		for (int i=0;i<n;i++) {
			if(find(parent, i) == find(parent, p[i])) {
				count++;
			}
		}

		System.out.println(count);

	}


	static int find(int[] parent, int x) {
		if(parent[x] == x) {
			return x;
		} else {
			parent[x] = find(parent, parent[x]);
			return parent[x];
		}
	}

	static void union(int[] parent, int x, int y) {
		int xRoot = find(parent, x);
		int yRoot = find(parent, y);
		parent[xRoot]=yRoot;
	}

}


Measured memory_bytes: 90872
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define int long long
#define ld long double
#define uns unsigned
#define endl '\n'
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define vpii vector<pii>
#define gr vector<vpii>
#define str string
#define mask vector<bool>
#define vs vector<str>
#define pq priority_queue
#define ordered_set_of(T) tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>
#define fi first
#define se second
#define sz(x) (int)((x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define nub(x) x.resize(unique(all(x)) - x.begin())
#define TWO class T1, class T2
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define GAME_OVER return 0
using namespace std;
using namespace __gnu_pbds;
char _$ = ' ';
struct sep {sep(char c) {_$ = c;}};
ostream& operator<<(ostream& o, sep s) {return o;}
template<TWO> ostream& operator<<(ostream& o, pair<T1, T2> x) {return o << x.fi << ' ' << x.se;}
template<TWO> istream& operator>>(istream& i, pair<T1, T2>& x) {return i >> x.fi >> x.se;}
template<class T> ostream& operator<<(ostream& o, vector<T> x) {for (auto it : x) o << it << _$; return o;}
template<class T> istream& operator>>(istream& i, vector<T>& x) {for (auto& it : x) i >> it; return i;}
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    int k;
    cin >> k;
    int res = 0;
    for (int a = 1; a <= k; a++)
        for (int b = 1; b <= k; b++)
            for (int c = 1; c <= k; c++)
                res += __gcd(__gcd(a, b), c);
    cout << res << endl;
    GAME_OVER;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long int
#define rep(i, n) for(int i = 0; i < n; i++)
#define sort(v) sort((v).begin(), (v).end())
using vi = vector<int>;
const int MOD = 1e9+7;
 
 
int main() {
    int sx, sy, tx, ty;
    cin >> sx >> sy >> tx >> ty;
    string s;
    rep(i, tx - sx) s = s + 'R';
    rep(i, ty - sy) s = s + 'U';
    rep(i, tx - sx) s = s + 'L';
    rep(i, ty - sy) s = s + 'D';
    s = s + 'D';
    rep(i, tx - sx + 1) s = s + 'R';
    rep(i, ty - sy + 1) s = s + 'U';
    s = s + 'L';
    s = s + 'U';
    rep(i, tx - sx + 1) s = s + 'L';
    rep(i, ty - sy + 1) s = s + 'D';
    s = s + 'R';
    cout << s << endl;
}

Measured memory_bytes: 384
import math

def isPrime(n):
    if n == 2:
        return True
    if n % 2 == 0:
        return False
  
  # nの平方根まで計算する
    m = math.floor(math.sqrt(n)) + 1
    for p in range(3, m, 2):
        if n % p == 0:
            return False
    return True

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

def main():
    A, B = [int(i) for i in input().split()]
    count = 0
    a = []
    prime = []
    if A > B:
        temp = A
        A = B
        B = temp
    a = make_divisors(A)
    
    for i in a:
        if isPrime(i) == True:
            prime.append(i)
    for i in prime:
        if B % i == 0:
            count += 1

    print(count)

if __name__ == "__main__":
    main()

Measured memory_bytes: 3280
/*input
1
0
*/
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

const ll MOD = (ll)1e9 + 7;
int n, a[25][25];
ll dp[(1 << 21) + 5];

ll solve(int ind, int mask){
	if(ind == n){
		return __builtin_popcount(mask) == n; //all paired 
	}
	if(dp[mask] != -1){
		return dp[mask];
	}
	ll ans = 0;
	for(int i = 0; i < n; i++){
		if(a[ind][i] && !(mask & (1 << i))){
			ans += solve(ind + 1, mask | (1 << i));
			ans %= MOD;
		}
	}
	return dp[mask] = ans % MOD;
}

int main(){
	scanf("%d", &n);
	for(int i = 0; i < n; i++){
		for(int j = 0; j < n; j++){
			scanf("%d", a[i] + j);
		}
	}
	memset(dp, -1, sizeof dp);
	printf("%lld\n", solve(0, 0));
	return 0;
}

Measured memory_bytes: 16640
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
#define REP(var, a, b) for (int var = (a); var < (b); var++)
#define rep(var, n) for (int var = 0; var < (n); ++var)
#define ALL(c) (c).begin(), (c).end()
#define rALL(c) (c).rbegin(), (c).rend()
ll MOD = 1000000007;

int main() {
  //
  int n;
  cin >> n;
  vl a(n);
  rep(i, n) { cin >> a[i]; }
  ll ans1 = 0, ans2 = 0;
  ll sum1 = 0, sum2 = 0;
  rep(i, n) {
    sum1 += a[i];
    sum2 += a[i];
    if (i & 1) {
      // plus
      if (sum1 <= 0) {
        ans1 += abs(1 - sum1);
        sum1 = 1;
      }
      // minus
      if (sum2 >= 0) {
        ans2 += abs(-1 - sum2);
        sum2 = -1;
      }
    } else {
      // minus
      if (sum1 >= 0) {
        ans1 += abs(-1 - sum1);
        sum1 = -1;
      }
      // plus
      if (sum2 <= 0) {
        ans2 += abs(1 - sum2);
        sum2 = 1;
      }
    }
  }
  cout << min(ans1, ans2) << endl;
  return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main(){
    vector<int> num(300000);
    fill(num.begin(),num.end(),1);
    for(int i=2;i<150000;i++){
        if(num[i]==0){continue;}
        //cout<<i<<endl;
        for(int j=i+i;j<300000;j+=i){
            num[j]=0;
            //cout<<j<<endl;
        }
    }
    while(1){
        int n;
        cin>>n;
        if(n==0){break;}
        int cnt=0;
        //cout<<1<<endl;
        for(int i=n+1;i<=n+n;i++){
            cnt+=num[i];
        }
        cout<<cnt<<endl;
    }
    return 0;
}



Measured memory_bytes: 3684
#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include<algorithm>
#include<string>
#include <map>
#include <queue>
#include <stack>
#include<set>
#include<tuple>

#define DIV 1000000007
using namespace std;
using ll = long long;
using ldb = long double;

int main() {
	int N; cin >> N;
	vector<ll> T(N), A(N);
	for (int i = 0; i < N; i++) {
		cin >> T[i];
	}

	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}

	vector<pair<ll, bool>> t(N), a(N);
	for (int i = 0; i < N; i++) {
		t[i].first = T[i];
		t[i].second = (i == 0 || T[i - 1] != T[i]);
	}

	for (int i = N - 1; i >= 0; i--) {
		a[i].first = A[i];
		a[i].second = (i == N - 1 || A[i] != A[i + 1]);
	}

	ll ans = 1;
	for (int i = 0; i < N && ans>0; i++) {
		if (t[i].second && a[i].second) {
			if (t[i].first != a[i].first)ans = 0;
		}
		else if (t[i].second) {
			if (t[i].first > a[i].first) {
				ans = 0;
			}
		}
		else if (a[i].second) {
			if (t[i].first < a[i].first) {
				ans = 0;
			}
		}
		else ans *= min(t[i].first, a[i].first);
		ans %= DIV;
	}

	cout << ans << endl;

}

Measured memory_bytes: 7956
#include <stdio.h>

int main(void)
{
    int a, b, c, max;
    scanf("%d%d%d", &a, &b, &c);
    max = a;
    if (max < b) max = b;
    if (max < c) max = c;
    printf ("%d", a + b + c - max);
    return (0);
}


Measured memory_bytes: 128
a,v = map(int,input().split())
b,w = map(int,input().split())
t = int(input())
ans = ''
if(a < b):
  pa = a + v * t
  pb = b + w * t
  if(pb <= pa):
    ans = 'YES'
  else:
    ans = 'NO'
else:
  pa = a - v * t
  pb = b - w * t
  if(pa <= pb):
    ans = 'YES'
  else:
    ans = 'NO'
print(ans)




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

int main(){
  int N;
  cin >> N;
  
  vector<int> vec(N);
  
  for (int i = 0 ; i < N; i++) {
    cin >> vec.at(i);
  }
  
  sort(vec.begin(), vec.end());
  reverse(vec.begin(), vec.end());
  
  int sumAlice = 0;
  int sumBob = 0;
  
  
  //Alice
  for (int i = 0; i < N; i += 2) {
    sumAlice += vec.at(i);
  }
  
  //Bob
  for (int i = 1; i < N; i += 2) {
    sumBob += vec.at(i);
  }
  
  int ans = sumAlice - sumBob;
  
  cout << ans << endl;
  
  
  
}

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

using namespace std;

const int maxn=1e5+5;
int a[maxn],b[maxn];
int ans,n,m,q;
int main(){
	cin >> n >> m >> q;
	int mi=1e9;
	for (int i=1;i<=n;i++){
		cin >> a[i];
		mi=min(mi,a[i]);
	}
	ans=mi;
	mi=1e9;
	for (int i=1;i<=m;i++){
		cin >> b[i];
		mi=min(mi,b[i]);
	}
	ans+=mi;
	while (q--){
		int u,v,w;
		cin >> u >> v >> w;
		ans=min(ans,a[u]+b[v]-w);
	}
	cout << ans << '\n';
} 

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

int main() {
  int H, W; cin >> H >> W;
  vector<string> G(H);
  for (int i = 0; i < H; i++) cin >> G.at(i);
  bool can = true;
  vector<int> dy = { 1, -1, 0, 0 };
  vector<int> dx = { 0, 0, -1, 1 };
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      if (G.at(i).at(j) == '.') continue;
      bool flag = false;
      for (int k = 0; k < 4; k++) {
        int ny = i + dy.at(k);
        int nx = j + dx.at(k);
        if (ny < 0 || ny >= H || nx < 0 || nx >= W) continue;
        if (G.at(ny).at(nx) == '#') flag = true;
      }
      if (!flag) can = false;
    }
  }
  if (can) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
#import numpy as np
#import math
#from fractions import gcd

def main():

    ##get int
    #first_input = list(map(lambda x:int(x), input().split(" ")))
    #second_input = list(map(lambda x:int(x), input().split(" ")))

    ##get float
    #first_input = list(map(lambda x:float(x), input().split(" ")))
    #second_input = list(map(lambda x:float(x), input().split(" ")))

    ##get string
    first_input = input().split(" ")

    S = first_input[0]

    if S=="ABC":
        print("ARC")
    else:
        print("ABC")

if __name__ == '__main__':
    main()


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

int f(int d) {
	int y;
	y = d * d;
	return y;
}


int main()
{
	int d;
	while (cin >> d) {
		int t = 600 / d;
		int S = 0;
		for (int i = 1;i < t;i++) {
			S = S + d * f(i*d);
		}
		cout << S << endl;
	}
    return 0;
}



Measured memory_bytes: 3008
#include <bits/stdc++.h>
#include <cmath>
#include <iostream>

using namespace std;

int main() {
  int N,M;
  double n,m,ans;
  cin>>N;
  n=N;
  M=(N+1)/2;
  m=M;
  ans=m/n;
  cout<<ans;
}

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

using namespace std;

const int maxn = 200500;
int a[maxn];
long long p[maxn];
map<long long, int> how;

int main()
{
    #ifdef DEBUG
    //freopen("input.txt", "r", stdin);
    #endif
    ios_base::sync_with_stdio(0), cin.tie(0);
    int n;
    cin >> n;
    p[0] = 0;
    how[0] = 1;
    long long ans = 0;
    for (int i = 0; i < n; i++){
        cin >> a[i];
        p[i + 1] = p[i] + a[i];
        ans += how[p[i + 1]];
        how[p[i + 1]]++;
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 15104
import sys
def main():
    H,W = map(int, input().split())
    S = [input() for i in range(H)]
    
    cnt = 0
    for i in range(H):
            #W=x=j
        for j in range(W):
            if S[i][j] == ".":
                continue
            else:
                #y増分
                cnt = 0
                for k in range(2):
                    if 0 <= i + (k*2 - 1) < H and S[i+(k*2-1)][j] == '#':
                        cnt = 1
                        break
                    elif 0 <= j + (k*2 -1) < W and S[i][j+(k*2-1)] == '#':
                        cnt = 1
                        break
                if cnt == 0:
                    print("No")
                    exit()
        #S.insert(0,"." * W)
        #S.append("." * W)
    print("Yes")
    
main()


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

long long int knapsack(vector<vector<long long int>> &items, int weight, int n, vector<vector<long long int>> &dp){
        if(n == 0 || weight == 0){
        return 0;
    }
    if(dp[n][weight] != -1 ){
        return dp[n][weight];
    }
    long long int item_weight = items[n-1][0];
    long long int item_value = items[n-1][1];

    if(weight >= item_weight){
        dp[n][weight] =  max(knapsack(items, weight - item_weight, n-1, dp) + item_value ,  
 knapsack(items,weight, n-1, dp));
}
else{
    dp[n][weight] = knapsack(items,weight, n-1, dp);
}
return dp[n][weight];
} 
int main(){
    int num_items, weight;
    cin>>num_items>>weight;
    vector<vector<long long int>> items(num_items, vector<long long int>(2));
    vector<vector<long long int>> dp(num_items + 1,vector<long long int>(weight+1, -1));
    for(int i=0;i<num_items ; i++){
        for(int j=0;j<2;j++){
            cin>>items[i][j];
        }
    }
    cout<<knapsack(items, weight, num_items, dp);
    return 0;
}


Measured memory_bytes: 83176
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {
    private static final long MOD = 1_000_000_007L;
    private static int TARGET = 2000002;
    private static long[] mod = new long[TARGET];
    private static Map<Long, Long> pre = new HashMap<>();

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        initmod();
        int r1,r2,c1,c2;
        r1=sc.nextInt();
        c1=sc.nextInt();
        r2=sc.nextInt();
        c2=sc.nextInt();
        assert(com(5,2) % MOD == 10);
        assert(com(4,2) % MOD == 6);
        long res;
        res = calc(r2, c2) - calc(r1-1, c2) - calc(r2, c1-1) + calc(r1-1, c1-1);
        res += MOD;
        res %= MOD;
        System.out.println(res);

    }

    private static long calc(int r, int c){
        if(r < 0 || c < 0){
            return 0;
        }
        long sum = 0;
        for(int i=1;i<=r+1;i++){
            sum += com(i+c, c);
            sum %= MOD;
        }
        return sum;
    }



    private static long com(int n, int k){
        long res = mod[n] * modinv(mod[n-k]) % MOD;
        res *= modinv(mod[k]);
        res %= MOD;
        return res;
    }


    private static void initmod(){
        mod[0]=1;
        mod[1]=1;
        for(int i=2;i<TARGET;i++){
            mod[i] = (mod[i-1] * i) % MOD;
        }
    }

    private static long modpow(long n, long k){
        if(k==0){
            return 1;
        }
        if(k==1){
            return n % MOD;
        }
        long res = modpow( n , k/2);
        res = (res * res) % MOD;
        if(k % 2 == 1){
            return (res * n) % MOD;
        }else{
            return res;
        }
    }


    public static long modinv(long n){
        if(pre.containsKey(n)){
            return pre.get(n);
        }else{
            pre.put(n, modpow(n, MOD-2));
            return pre.get(n);
        }
    }
}


Measured memory_bytes: 212652
#include <bits/stdc++.h>
using namespace std;
#define fastIO ios::sync_with_stdio(0), cin.tie(0)
#define endl '\n'
#define ft first
#define sd second
#define pb push_back
#define pob pop_back()
#define pf push_front
#define pof pop_front()
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin, (x).rend()
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<char,char> pcc;
typedef pair<double,double> pdd;
typedef pair<long long,long long> pll;
// scanf("%d %d %d %d",&w,&b,&d,&s); %lld
// printf("%d\n" ,points);
// const double PI=acos(-1);

const int MAX=1e5+5;
vector<int> g[MAX];
int dp[MAX];
int n,m;

int dfs(int u){
    if(dp[u]!=-1) return dp[u];
    dp[u]=0;
    for(auto v:g[u]){
        dp[u]=max(dp[u],dfs(v)+1);
    }
    return dp[u];
}

int main(){
    int x,y,rta=0;
    memset(dp,-1,sizeof(dp));
    cin >> n >> m;
    for(int i=0;i<m;i++){
        cin >> x >> y;
        g[x].pb(y);
    }
    for(int i=1;i<=n;i++){
        rta=max(rta,dfs(i));
    }
    cout << rta << endl;
    return 0;
}


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

using namespace std;

const int MAX_N = 2e5 + 5;

int N;
char s[MAX_N];
int nxt[MAX_N][26], pos[26];
int dp[MAX_N];
int a[MAX_N];

int main()
{
  scanf("%s", s);
  N = strlen(s);
  for (int i = 0; i < 26; ++i) pos[i] = N;
  for (int i = N - 1; i >= 0; --i) {
    for (int j = 0; j < 26; ++j) {
      nxt[i][j] = pos[j];
    }
    pos[s[i] - 'a'] = i;
  }
  dp[N] = 0;
  memset(a, -1, sizeof a);
  for (int i = N - 1; i >= 0; --i) {
    int mi = INT_MAX;
    for (int j = 0; j < 26; ++j) {
      int to = nxt[i][j];
      if (mi > dp[to]) {
        mi = dp[to];
        a[i] = j;
      }
    }
    dp[i] = mi + 1;
  }
  int cur;
  int mi = INT_MAX;
  for (int i = 0; i < 26; ++i) {
    int to = pos[i];
    if (mi > dp[to]) {
      mi = dp[to];
      cur = i;
    }
  }
  int cnt = 0, p;
  while (cur != -1) {
    printf("%c", cur + 'a');
    if (cnt == 0) {
      p = pos[cur];
      cur = a[p];
    } else {
      p = nxt[p][cur];
      cur = a[p];
    }
    ++cnt;
  }
  printf("\n");
  return 0;
}


Measured memory_bytes: 22272
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<string>
#include<queue>
#include<set>
#include<map>
using namespace std;
typedef long long int ll;
typedef vector<pair<ll,ll> > Q;
typedef pair<int,int> P;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
const ll inf=1e9+7;

int n;
int main(){

  cin>>n;
  vector<pair<string,pair<int,int> > > rest(n);
  rep(i,n){
    cin>>rest[i].first>>rest[i].second.first;
    rest[i].second.second=i+1;
  }

  sort(rest.begin(),rest.end());

  int cnt=0;
  string tmp=rest[0].first;
  rep(i,n){
    if(rest[i].first==tmp) cnt++;
    else{
      int cnt2=0;
      while(cnt2!=cnt){
        cout<<rest[i-1-cnt2].second.second<<endl;
        cnt2++;
      }
      cnt=1;
      tmp=rest[i].first;
    }

    if(i==n-1){
      int cnt2=0;
      while(cnt2!=cnt){
        cout<<rest[n-1-cnt2].second.second<<endl;
        cnt2++;
      }
    }
  }
}

Measured memory_bytes: 256
#include <cmath>
#include <iomanip>
#include <ios>
#include <iostream>

const double PI = 3.14159265358979323846;

using namespace std;

int main(int argc, const char *argv[]) {
  double a, b, x;
  cin >> a >> b >> x;
  x /= a;

  double ans;
  if (a * b > 2 * x) {
    double c = 2 * (x / b);
    ans = 90 - atan(c / b) * 180 / PI;
  } else {
    double c = (2 * x) / a - b;
    ans = 90 - atan(a / (b - c)) * 180 / PI;
  }
  cout << fixed << setprecision(9) << ans << '\n';
  return 0;
}

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

typedef long long 			ll;
typedef unsigned long long 	ull;

int main() {
	ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
	ll n, k, cnt = 0;
	cin >> n >> k;
	while (n > 0) {
		cnt++;
		n -= k;
	}
	cout << cnt << endl;
	return 0;
}


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

int main()
{
  string s;
  bool pre_len2 = false;
  int ans = 1;
  cin>>s;
  int i;
  for(i=1; i<s.length()-1; i++)
  {
    ans++;
    if(!pre_len2 && s[i]==s[i-1])
    {
      pre_len2 = true;
      i++;
    }
    else
    {
      pre_len2 = false;
    }
  }
  if(s.length()>1 && i<s.length())
  {
    if(pre_len2 || s[s.length()-1]!= s[s.length()-2]) ans++;
  }
  cout<<ans<<endl;
  return 0;
}

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

using namespace std;

using ll = long long;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, k;
  cin >> n >> k;
  double ans = 0;
  for (int i = 1; i <= n; i++) {
    int score = i;
    double a = 1.;
    while (score < k) {
      score *= 2;
      a /= 2.;
    }
    ans += a / n;
  }
  cout << fixed << setprecision(17);
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 3712
#include<bits/stdc++.h>
#define boost ios::sync_with_stdio(false); cin.tie(0)
#define ll              long long int
#define ld              long double
#define mk              make_pair
#define pb              push_back
#define f               first
#define s               second
#define fo(i,a,b)       for(i=a;i<b;i++)
#define foe(i,a,b)      for(i=a;i<=b;i++)
#define all(x)          x.begin(),x.end()
#define vi              vector<int>
#define vl              vector <long long int>
#define pii             pair <int,int>
#define pll             pair <long long int, long long int>
#define vpii            vector< pair<int,int> >
#define vpll            vector < pair <long long int,long long int> >
#define MOD             1000000007
using namespace std;
const int inf = INT_MAX;
const ll inf64 = LLONG_MAX;


int main()
{
    boost;
    string s;
    string t;
    ll i;
    cin >> s >> t;
    bool ans = true;
    fo(i,0,s.length())
    {
    	if(s[i]!=t[i])
    	{
    		ans = false;
    		break;
    	}
    }
    if(ans)cout << "Yes";
    else cout << "No";
    
    return 0;
}

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

int main(){
  int n;
  cin >> n;
  vector<int> l(n);
  rep(i, n) cin >> l[i];
  int ans = 0;
  rep(i, n) for (int j = i+1; j<(n); ++j){
    ans += l[i]*l[j];
  }
  cout << ans << endl;
}
  

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<numeric>
#include<cmath>

using namespace std;

unsigned long long gcd(unsigned long long x, unsigned long long y) {
    return x ? gcd(y % x, x) : y;
}

int main(){
    int n;
    cin >> n;
    unsigned long long t[n];
    for(int i=0;i<n;i++)cin >> t[i];

    unsigned long long ans = 1;
    sort(t, t+n, greater<unsigned long long>());
    for(int i=0;i<n;i++){
        //while(ans%t[i]!=0)ans *= t[i];
        ans = ans/gcd(ans, t[i])*t[i];
        //cout << ans << endl;
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define mk make_pair
#define fr first
#define sc second
#define ll long long
#define mp make_pair
#define ii pair<ll,ll>
using namespace std;
int main()
{
    ll a,b;
    cin>>a>>b;
    cout<<max(a+b,max(a-b,a*b));
}


Measured memory_bytes: 256
//   _/                _/                 _/_/_/   _/
//_/_/_/_/   _/_/   _/_/_/_/   _/_/    _/       _/_/
// _/     _/    _/   _/     _/    _/  _/_/_/     _/
//_/     _/    _/   _/     _/    _/  _/    _/   _/
// _/_/   _/_/       _/_/   _/_/      _/_/     _/
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<set>
#include<map>
#include<queue>
#include<vector>
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const double pi=acos(-1);
const int inf=1e9;
const ll INF=1e18;
int main() {
  cin.tie(0),cout.tie(0);
  ios::sync_with_stdio(false);
  int sx,sy,tx,ty;
  cin >> sx >> sy >> tx >> ty;
  for(int i=0; i<abs(ty-sy); i++) {
    cout << 'U';
  }
  for(int i=0; i<abs(tx-sx); i++) {
    cout << 'R';
  }
  for(int i=0; i<abs(ty-sy); i++) {
    cout << 'D';
  }
  for(int i=0; i<abs(tx-sx); i++) {
    cout << 'L';
  }
  cout << 'L';
  for(int i=0; i<abs(ty-sy)+1; i++) {
    cout << 'U';
  }
  for(int i=0; i<abs(tx-sx)+1; i++) {
    cout << 'R';
  }
  cout << 'D';
  cout << 'R';
  for(int i=0; i<abs(ty-sy)+1; i++) {
    cout << 'D';
  }
  for(int i=0; i<abs(tx-sx)+1; i++) {
    cout << 'L';
  }
  cout << 'U' << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#define MAX_heap 100000

typedef struct _cell{
  int a;
  int b;
}cell;

typedef struct _heap{
  cell cells[MAX_heap+1];
  int length;
}heap;

heap H;

typedef char boolean;
typedef long long int  lli;
void init_heap_univ();
boolean compare_cell(cell x, cell y);
void put_heap_univ(cell x);
cell pull_heap_univ();
int flag_heap_univ(int itr,cell temp);
void sort_heap_univ(cell *array);





int main(void){
  int n,m;
  scanf("%d",&n);
  scanf("%d",&m);
  cell c;
  int x,y,i;
  for(i=0;i<n;i++){
    scanf("%d%d",&x,&y);
    c.a=x;c.b=y;
    put_heap_univ(c);
  }
  cell store[n];
  sort_heap_univ(store);

  //  for(i=0;i<n;i++) printf("a%d b%d\n",store[i].a,store[i].b);


  i=0;
  int w=m;
  lli ans=0;
  while(w>0){
    if(w<store[i].b)store[i].b=w;
    ans+=(lli)store[i].a*store[i].b;
    w-=store[i].b;
    i++;
  }
  printf("%lld",ans);
}

void init_heap_univ(){
  H.length=0;
}

boolean compare_cell(cell x, cell y){
  if(x.a<y.a)return 1;
  return 0;
}

void put_heap_univ(cell x){
  H.length++;
  int i=H.length;
  while(i>1 && compare_cell(x,H.cells[i/2])){
    H.cells[i]=H.cells[i/2];
    i/=2;
  }
  H.cells[i]=x;
  //  for(i=0; i<=heap[0];i++)
  //    printf("%lu ",heap[i]);
  //  printf("\n",heap[i]);

}

cell pull_heap_univ(){
  cell x=H.cells[1],temp=H.cells[H.length];
  int itr=1,itr2,flag;
  H.length--;
  flag=flag_heap_univ(itr,temp);
  while(flag){
    itr2=2*itr+flag-1;
    H.cells[itr]=H.cells[itr2];
    itr=itr2;
    flag=flag_heap_univ(itr,temp);
  }
  H.cells[itr]=temp;
  return x;
}

int flag_heap_univ(int itr,cell temp){
  int flag;
  if(H.length<itr*2) flag=0;
  else if(H.length==itr*2)
    flag=(compare_cell(temp,H.cells[itr*2])?0:1);
  else if(compare_cell(H.cells[itr*2],H.cells[itr*2+1]))
    flag=(compare_cell(temp,H.cells[itr*2])?0:1);
  else flag=(compare_cell(temp,H.cells[itr*2+1])?0:2);

  //  printf("%d ",flag);
  return flag;
}

void sort_heap_univ(cell *array){

  
  int i,length=H.length;


  for(i=0; i<length; i++)
    array[i]=pull_heap_univ();
}


Measured memory_bytes: 1664
#include<cstdio>
#include<queue>
#include<utility>
#include<cstring>
#include<stack>
#include<algorithm>
#include<cmath>
#include<iostream>
#include<map>
#define MAX_N 100001
#define INF_INT 2147483647
#define INF_LL 9223372036854775807
#define REP(i,n) for(int i=0;i<(int)(n);i++)
void init(int n);
int find(int n);
void unite(int x,int y);
bool same(int x, int y);
int dx[4] = {1,0,0,-1};
int dy[4] = {0,1,-1,0};
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> P;
bool cmp_P(const P &a,const P &b){
  return a.second < b.second;
}


int main()
{
  ll dsum=0,N,l=0,r=1,A[100001],sum[100001],z[100001],M=0,res=0;
  map<int,int> mp;
  cin >> N >> M;
  REP(i,N)cin >> A[i];
  sum[0] = 0;
  REP(i,N){
    A[i] %= M;
    sum[i+1] = (sum[i] + A[i]) %M;
  }
  REP(i,N+1){
    res += mp[sum[i]];
    mp[sum[i]]++;
  }
  cout << res << endl;
  return 0;
}

int par[MAX_N];
int ranks[MAX_N];

//n要素で初期化
void init(int n){
  REP(i,n){
    par[i] = i;
    ranks[i] = 0;
  }

}

//木の根を求める
int find(int x){
  if(par[x] == x){
    return x;
  }else{
    return par[x] = find(par[x]);
  }
}

void unite(int x,int y){
  x = find(x);
  y = find(y);
  if(x == y) return ;
  if(ranks[x] < ranks[y]){
    par[x] = y;
  }else{
    par[y] = x;
    if(ranks[x] == ranks[y]) ranks[x]++;
  }
}

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



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

int main()
{
  int a, b, x;
  cin >> a >> b >> x;
  int jdg = a * a * b;
  ld ans;
  if (jdg == 2 * x) ans = 45.0;
  else if (jdg < 2 * x) {
    ans = atan(((2.0 * a * a * b) - 2 * x) / (a * a * a)) * 180 / acos(-1);
  } else {
    ans = atan(a * b * b / (2.0 * x)) * 180 / acos(-1);
  }

  cout << fixed << setprecision(10) << ans << endl;

  return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
using ll = long long;
using ld = long double;
#define vl vector<long long>
#define vvl vector<vector<long long>>
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
using pll = pair<long long,long long>;
#define cY cout<<"Yes"<<endl
#define cN cout<<"No"<<endl
const long long INF = 1LL << 60;
const long long MOD = 1000000007;
const long double pi = (acos(-1));
#define pb push_back
#define vs vector<string>

//最大最小の入れ替え
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

//約数列挙
vector<long long> divisor(long long n) {
    vector<long long> ret;
    for (long long i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n) ret.push_back(n / i);
        }
    }
    sort(ret.begin(), ret.end()); // 昇順に並べる
    return ret;
}
//コンビネーション
ll nCr(ll n, ll r) {
    ll ans = 1;
    for (ll i = n; i > n - r; --i) {
        ans = ans*i;
    }
    for (ll i = 1 ; i < r + 1; ++i) {
        ans = ans / i;
    }
    return ans;
}
//素因数分解
map< ll, ll > prime_factor(ll n) {
  map< ll, ll > ret;
  for(ll i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if(n != 1) ret[n] = 1;
  return ret;
}

//切り上げの割り算は(a + b - 1) / bでできる

//ここから
int main(){
    ll K;
    cin>>K;
    vl D(32);
    D={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    cout<<D[K-1]<<endl;
}


Measured memory_bytes: 3640
#include <iostream>
#include<string>
#include<iomanip>


using namespace std;
int main(void) {
	char b;

	cin >> b;

	if (b == 'A')
		cout << "T";
	else if (b == 'T')
		cout << "A";
	else if (b == 'C')
		cout << "G";
	else if (b == 'G')
		cout << "C";

	return 0;


}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
 
////////////// Prewritten code follows. Look down for solution. ////////////////

#define fs first
#define sc second
#define pb push_back
#define mp(a, b) make_pair(a, b)
#define len(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define fastio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long long ll;
typedef pair<ll, ll> pll;

template<typename T>
const T INF = (is_same<T, int>::value ? 1e9 : 1e18);
template<typename T>
inline T mod(T n, T mod){ T res = n%mod; if(res < 0) res += mod; return res; }

/// command for char arrays with spaces -> scanf(" %[^\n]", text);
 
////////////////////////// Solution starts below. //////////////////////////////

int main(){
	fastio;
	string s, t, u;
	cin >> s >> t;
	int a, b;
	cin >> a >> b;
	map<string, int> mp;
	mp[s] = a, mp[t] = b;
	cin >> u;
	mp[u]--;
	cout << mp[s] << ' ' << mp[t] << '\n';
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr long long INFL = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;
using Graph = vector<vector<int>>;



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

    long long A,B,C,D;
    cin >> A >> B >> C >> D;
    long long x=C*D/__gcd(C,D);
    long long xa=(A-1)/C+(A-1)/D-(A-1)/x;
    long long xb=B/C+B/D-B/x;
    cout << (B-xb)-(A-1-xa) << endl;
    



}


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

static const int MAX = 200000;

int main(){
    int R[MAX], n;

    cin >> n;
    for (int i=0; i<n; i++) cin >> R[i];

    int maxv = -2000000000;
    int minv = R[0];

    for (int i=1; i<n; i++){
        maxv = max(maxv, R[i]-minv);
        minv = min(minv, R[i]);
    }

    cout << maxv << endl;

    return 0;
}



Measured memory_bytes: 3780
#include <iostream>
 
using namespace std;
int main()
{
    int n;
    cin >> n;
    int p[n];
    for(int i=0; i<n; i++) {
        cin >> p[i];
    }
    
    int min = p[0];
    int ans = 0;
    for(int i=0; i<n; i++) {
        bool ok = true;
        if(min > p[i]) min = p[i];
        if(p[i]<=min) ans++;
    }
 
    cout << ans << endl; 
    return 0;
}

Measured memory_bytes: 1024
s = input()[::-1]
mod = 13
p = 10 ** 9 + 7
dp = [[0] * 13 for _ in range(len(s) + 1)]
dp[0][0] = 1

for i in range(len(s)):
    if s[i] == "?":
        for j in range(10):
            d = j * pow(10, i, mod)
            for k in range(13):
                dp[i + 1][(k + d) % mod] += dp[i][k]
                dp[i + 1][(k + d) % mod] %= p
    else:
        d = int(s[i]) * pow(10, i, mod)
        for k in range(13):
            dp[i + 1][(k + d) % mod] += dp[i][k]
print(dp[-1][5])


Measured memory_bytes: 61532
#include<iostream>
#include<cmath>
#include<cstdio>
using namespace std;
int a, b, n;
double d, e, f;
int main() {
	cin >> n;
	for (int i = 0; i < n;i++) {
		scanf("%d:%d", &a, &b);
		f = abs(a * 30 - b * 11.0 / 2.0);
		if (f > 180) { f = 360 - f; }
		if (f < 30) { cout << "alert" << endl; }
		else if (f < 90) { cout << "warning" << endl; }
		else { cout << "safe" << endl; }
	}
}

Measured memory_bytes: 1232
#include<bits/stdc++.h>
using namespace std;
#define SZ(v) ((int)(v).size())
#define zero(v) memset(v,0,sizeof(v))
#define rep(i,n) for(int i=0;i<(n);i++)
#define foreach(it,c) for(__typeof(c.begin()) it=c.begin();it!=c.end();it++)
#define all(v) (v).begin(),(v).end()
template<typename T>inline bool chkmin(T &a,const T &b){return a>b?a=b,1:0;}
template<typename T>inline bool chkmax(T &a,const T &b){return a<b?a=b,1:0;}
typedef long long ll;
typedef unsigned uint;
const int INF=0x3f3f3f3f;
const double EPS=1e-10;
typedef pair<int,int> pii;
int inline in(){int x=0,c;for(;(uint)((c=getchar())-'0')>=10;)
{if(c=='-')return -in();if(!~c)throw ~0;}do{x=(x<<3)+(x<<1)+(c-'0');}
while((uint)((c=getchar())-'0')<10);return x;}
int n,k;
int a[1005];
int main(){
	cin>>n>>k;
	rep(i,n)cin>>a[i];
	sort(a,a+n);
	int sum=0;
	rep(i,k){
		sum+=a[i];
	}
	cout<<sum<<endl;
	return 0;
}


Measured memory_bytes: 3624
import java.util.*;
class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int K = sc.nextInt();
        int[] h = new int[N];
        for(int i = 0; i < N; i++) {
            h[i] = sc.nextInt();
        }
        Arrays.sort(h);
        int ans = h[K-1] - h[0];
        for(int i = 0; i < N - (K - 1); i++) {
            if(ans > h[i+K-1] - h[i]) ans = h[i+K-1] - h[i];
        }
        System.out.println(ans);
    }
}

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

const string YES = "Yes";
const string NO = "No";

void solve(std::string S){
    if (S[0]=='A'&& S[1]=='A' && S[2]=='A') printf("No\n");
    else if (S[0]=='B'&& S[1]=='B' && S[2]=='B') printf("No\n");
    else printf("Yes\n");

}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    std::string S;
    std::cin >> S;
    solve(S);
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.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 pom(ll a,ll n,int m){ll x=1;for(a%=m;n;n/=2)n&1?x=x*a%m:0,a=a*a%m;return x;}
//#define MOD 998244353
#define MOD 1000000007
#define invp(a,p)pom(a,p-2,p)

char s[3010],t[3010];
ll sn,tn;
ll dp[3010][3010];
int main(){
	scanf("%s %s",s,t);
	sn=strlen(s);
	tn=strlen(t);
	rep(i,0,sn+1)rep(j,0,tn+1){
		if(s[i]==t[j])dp[i+1][j+1]=max(dp[i+1][j+1],dp[i][j]+1);
		dp[i+1][j  ]=max(dp[i+1][j  ],dp[i][j]);
		dp[i  ][j+1]=max(dp[i  ][j+1],dp[i][j]);
//		printf("%lld ",dp[i][j]);if(j==tn)puts("");
	}
	
	char ans[3010]="";
	int len=dp[sn][tn];
	while(len){
		if(dp[sn][tn]==dp[sn-1][tn])sn--;
		else if(dp[sn][tn]==dp[sn][tn-1])tn--;
		else{
			ans[--len]=s[sn-1];
			sn--;
			tn--;
		}
//		printf("%lld %lld\n",sn,tn);
	}
	puts(ans);
	return 0;
}

Measured memory_bytes: 70784
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
  int A,B,K; cin>>A>>B>>K;
  vector<int> p;
  
  int N=max(A,B);

  for(int i=1;i<=N;i++){
    if((A%i==0)&&(B%i==0)){
      p.push_back(i);
    }
  }

  cout<<p[p.size()-K]<<endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#define REP(i,n) for(int i=0;i<(n);++i)
#define MOD 1000000007 
using namespace std;
typedef long long LL;

LL modpow(LL x, LL n) {
  LL ret = 1;
  while(n != 0) {
    if(n & 1) {
      ret = ret * x % MOD;
    }
    x = x * x % MOD;
    n >>= 1;
  }
  return ret;
}

LL comb(int a, int b) {
  LL ret = 1, div = 1;
  REP(i, b) {
    ret = ret * (a - i) % MOD;
    div = div * (i + 1) % MOD;
  }
  return ret * modpow(div, MOD-2) % MOD;
}

int main(){
  int N, A, B;
  cin >> N >> A >> B;
  LL ret = modpow(2, N) - 1 - comb(N, A) - comb(N, B);
  while(ret < 0) {
    ret += MOD;
  }
  cout << ret << endl;
}

Measured memory_bytes: 256