akhauriyash/Code-Regression huggingface dataset:
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda:sys.stdin.readline().rstrip()
from cmath import phase
def resolve():
    n=int(input())
    C=[None]*n
    for i in range(n):
        x,y=map(int,input().split())
        C[i]=x+y*1j

    C.sort(phase)
    C*=2

    ans=0
    for i in range(n):
        for j in range(i+1,n+1):
            ans=max(ans,abs(sum(C[i:j])))
            ans=max(ans,abs(sum(C[j:n+i])))

    print(ans)
resolve()

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

char sx[100000 + 7];

map <char, int> mp;

int32_t main() {
        int n, k; cin >> n >> k;
        int r, s, p; cin >> r >> s >> p;
        mp['s'] = r;
        mp['p'] = s;
        mp['r'] = p;
        string str; cin >> str;
        int ans = 0;
        for(int i = 0; i < str.size(); i++) {
                if(sx[i % k] != str[i]) ans += mp[str[i]], sx[i % k] = str[i];
                else {
                        sx[i % k] = '*';
                }
        }
        cout << ans << endl;

}


Measured memory_bytes: 512
#include <iostream>
using namespace std;
int main(int argc, const char * argv[]) {
    int a=0;
    int b=0;
    cin >> a  >> b;
    if(a!=2&&b!=2)
    {
        cout<<"Yes";
    }else
    {
        cout<<"No";
    }
    return 0;
}

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

int main(int argc, char const* argv[]) {
	string S;
	cin >> S;
	for (int i = 0; i < S.length(); i++) {
		if (S[i] == ',') S[i] = ' ';
	}
	cout << S << "\n";

	return 0;
}


Measured memory_bytes: 3580
#include<cstdio>

using namespace std;

int h,w;
const int MAX_H = 100;
const int MAX_W = 100;
char fruit[MAX_H][MAX_W];

void dfs(char c, int i, int j){
	if(fruit[i][j] == c){
		fruit[i][j] = '.';
		if(0<=i-1)dfs(c,i-1,j);
		if(i+1<h) dfs(c,i+1,j);
		if(0<=j-1)dfs(c,i,j-1);
		if(j+1<w) dfs(c,i,j+1);
	}
}

int main(){
	char tmp;
	while(true){
		scanf("%d %d",&h,&w);
		if(h==0 && w==0)break;
		for(int i=0;i<h;i++){
			for(int j=0;j<w;j++){
				scanf(" %c",&fruit[i][j]);
			}
		}
		int ans = 0;
		for(int i=0;i<h;i++){
			for(int j=0;j<w;j++){
				if(fruit[i][j] != '.'){
					dfs(fruit[i][j],i,j);
					ans++;
				}
			}
		}
		printf("%d\n",ans);
	}
}

Measured memory_bytes: 1344
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
using namespace std;

const int N = 10;

int h, w, c;

struct Point{ int x, y; };
int dy[4] = {0,1,0,-1}, dx[4] = {1,0,-1,0};

int bfs(vector<vector<int>> &M, int color, Point p = Point{0,0}){
    int dis[N][N];
    queue<Point> q;
    rep(i,N) rep(j,N) dis[i][j] = 1e8;

    dis[p.y][p.x] = 0;
    q.push(p);

    Point u;
    int cur = M[0][0];
    int ret = 0;
    while(not q.empty()){
        u = q.front(); q.pop();
        ret++;
        M[u.y][u.x] = color;
        rep(i,4){
            Point next;
            next.x = u.x + dx[i];
            next.y = u.y + dy[i];
            if(next.x < 0 || next.x >= w || next.y < 0 || next.y >= h) continue;
            if(dis[next.y][next.x] == 1e8 && M[next.y][next.x] == cur){
                dis[next.y][next.x] = dis[u.y][u.x] + 1;
                q.push(next);
            }
        }
    }
        //cout << endl;
        //rep(i,h){ rep(j,w){ cout << M[i][j]<<' '; } cout << endl; }
    return ret;
}
int dfs(vector<vector<int>> v, int k){
    if(k == 4){
        bfs(v,c);
        return bfs(v,8);
    }

    int ret = 0;
    range(i,1,7){
        vector<vector<int>> tmp = v;
        bfs(tmp, i);
        ret = max(ret,dfs(tmp,k + 1));
    }
    return ret;
}

int main(){
    while(cin >> h >> w >> c, h){

        vector<vector<int>> v(10, vector<int>(10));
        rep(i,h){
            rep(j,w){
                cin >> v[i][j];
            }
        }

        cout << dfs(v, 0) << endl;
    }
}

Measured memory_bytes: 3176
s = input()[::-1]
l = [ 'dream', 'dreamer', 'erase', 'eraser']
for i in range(4):
	s1 = l[i][::-1]
	l[i] = s1

n = len(s)
i = 0
t = tuple(l)

while i < n:
	judge = 0
	s_l = []
	for j in (5,6,7):
		if n-i >= j:
			s1 = s[i:i+j]
			if s1 in t:
				i += j
				judge = 1
	
	if judge == 0:
		break

if i == n:
	print('YES')
else:
	print('NO')

Measured memory_bytes: 9236
#include <stdio.h>
#include <iostream>
#include <stack>
#include <string>
#include <algorithm>
#include <cmath>
#include <stdlib.h>
using namespace std;

int n, a[105], ans, c = 10005, x;

int main(){

	cin >> n;
	for (int i = 0; i < n; i++){
		cin >> a[i];
		x += a[i];
	}

	for (int i = 0; i < n; i++){
		if (c > abs(n * a[i] - x)){
			c = abs(n * a[i] - x);
			ans = i;
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)

	m := 1 - (n % 2)
	es := make([][2]int, 0)
	for i := 1; i <= n-1; i++ {
		for j := i + 1; j <= n; j++ {
			if i+j == n+m {
				continue
			}
			es = append(es, [2]int{i, j})
		}
	}

	fmt.Println(len(es))
	for _, e := range es {
		fmt.Println(e[0], e[1])
	}
}


Measured memory_bytes: 1024
### main

while line = gets
  n, r = line.split.map(&:to_i)

  cards = (0...n).to_a
  rcs = gets.split.map(&:to_i)
  na = (n + 1) / 2
  nb = n / 2

  for rc in rcs
    dbs = cards[0, nb]
    das = cards[nb, na]
    cards = []

    while ! das.empty? || ! dbs.empty?
      cards += das.shift(rc) + dbs.shift(rc)
    end
  end

  puts cards.last
end

Measured memory_bytes: 6248
#include<bits/stdc++.h>
using namespace std ;
int main()
{
    int a , b , c ;
    cin >> a >> b >> c ;
    cout << a <<" "<< b <<" "<< 3*c-a-b <<" "<< endl ;
    cout << 4*c-2*a-b <<" "<< c <<" "<< 2*a+b-2*c <<" "<< endl ;
    cout << a+b-c <<" "<< 2*c-b <<" "<< 2*c-a <<" "<< endl ;
    return 0 ;
}

Measured memory_bytes: 256
import math
import functools
import operator

def prime_factorization_2(num):
    if num <= 1:
        return False
    else:
        num_sqrt = math.floor(math.sqrt(num))
        prime_list = make_prime_list_2(num_sqrt)

        dict_counter = {}
        for prime in prime_list:
            while num % prime == 0:
                if prime in dict_counter:
                    dict_counter[prime] += 1
                else:
                    dict_counter[prime] = 1
                num //= prime
        if num != 1:
            if num in dict_counter:
                dict_counter[num] += 1
            else:
                dict_counter[num] = 1

        return dict_counter

def make_prime_list_2(num):
    if num < 2:
        return []

    # 0のものは素数じゃないとする
    prime_list = [i for i in range(num + 1)]
    prime_list[1] = 0 # 1は素数ではない
    num_sqrt = math.sqrt(num)

    for prime in prime_list:
        if prime == 0:
            continue
        if prime > num_sqrt:
            break

        for non_prime in range(2 * prime, num, prime):
            prime_list[non_prime] = 0

    return [prime for prime in prime_list if prime != 0]



n,p=map(int,input().split())
if n>=p:
    print(1)
elif n==1:
    print(p)
else:
    pdic=prime_factorization_2(p)
    plist=[]
    plsit2=[]
    result=1
    for k in pdic:
        plist.append(k)

    for i in range(len(plist)):
        value=int(pdic[plist[i]])
        if value>=n:
            tmp=value//n
            plsit2.append(plist[i]**tmp)
    for i in plsit2:
        result=result*i        
 
    
    print(result)

Measured memory_bytes: 43328
#include <bits/stdc++.h>
#define FI first
#define SE second
#define EPS 1e-9
#define ALL(a) a.begin(),a.end()
#define SZ(a) int((a).size())
#define MS(s, n) memset(s, n, sizeof(s))
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORE(i,a,b) for (int i = (a); i >= (b); i--)
#define FORALL(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define WHATIS(x) cout << #x << " is " << x << endl;
#define ERROR(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
//__builtin_ffs(x) return 1 + index of least significant 1-bit of x
//__builtin_clz(x) return number of leading zeros of x
//__builtin_ctz(x) return number of trailing zeros of x

using namespace std;
using ll = long long;
using ld = double;
typedef pair<int, int> II;
typedef pair<II, ll> III;
typedef complex<ld> cd;
typedef vector<cd> vcd;

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cout << *it << " = " << a << endl;
    err(++it, args...);
}

const ll MODBASE = 1000000007LL;
const int MAXN = 2010;
const int MAXM = 35;
const int MAXK = 510;
const int MAXQ = 200010;

int n, z, w, a[MAXN];
int dp[MAXN][2];

int solve(int u, int v) {
    if (dp[u][v] != -1) return dp[u][v];
    int res = abs(a[n] - a[u-1]);
    if (v == 0) {
        FOR(i,u,n-1) res = max(res, solve(i+1, 1-v));
    }
    else if (v == 1) {
        FOR(i,u,n-1) res = min(res, solve(i+1, 1-v));
    }
    return dp[u][v] = res;
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
    cin >> n >> z >> w;
    FOR(i,1,n) cin >> a[i];
    a[0] = w;
    FOR(i,1,n)
        FOR(j,0,1) dp[i][j] = -1;
    cout << solve(1, 0);
    return 0;
}

Measured memory_bytes: 384
N,M = map(int,input().split())
S = [list(map(int,input().split())) for _ in range(M)]
if N != 1:
    for i in range(M):
        if S[i][0] == 1 and S[i][1] == 0:
            print(-1)
            exit()
h,t,o = 0,0,0
if N != 1:
    h = 1
b_h,b_o,b_t = 0,0,0
for i in range(M):
    if S[i][0] == 3:
        if b_o == 1:
            if S[i][1] != o:
                print(-1)
                exit()
        o = S[i][1]
        b_o = 1
    elif S[i][0] == 2:
        if b_t == 1:
            if S[i][1] != t:
                print(-1)
                exit()
        t = S[i][1]
        b_t = 1
    else:
        if b_h == 1:
            if S[i][1] != h:
                print(-1)
                exit()
        h = S[i][1]
        b_h = 1
if N == 3:
    print(100*h+10*t+o)
elif N == 2:
    print(10*h+t)
else:
    print(h)

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

int main () {
  long long N , S; 
  cin >> N ;
  S = 0 ; 
  
  for (int i = 0  ; i <= N ; i++){
    if ((i % 5) == 0 || (i % 3) == 0 || (i % 15) == 0){
      S = S  ; 
    }
    else {
      S = S + i  ; 
    }
    
  }
  cout << S << endl ; 
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(int (i) = (s);(i) <= (e);(i)++)
#define all(x) x.begin(),x.end()

int main() {
  i64 a, b;
  cin >> a >> b;
  if((a * b) % 2 == 0) {
    cout << "No" << endl;
  }
  else {
    cout << "Yes" << endl;
  }
}


Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#include<tuple>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-15
#define mp(a1,a2) make_pair(a1,a2)
typedef long long ll;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=1e+18+1;
int INF=1e+9+1;
int main(){
	string S;
	scan(S);
	rep(i,S.size()){
		if(S[i]=='1') printf("9");
		else if(S[i]=='9') printf("1");
		else printf("%c",S[i]);
	}
	kaigyo;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <cassert>

using namespace std;
typedef long long LL;
template <typename F, typename S> std::ostream& operator<<(ostream& os, const pair<F,S>& p) {
    os << "(" << p.first << "," << p.second << ")"; return os; }
template <typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
    os << "["; for(const T& a: v){ os << a << ", "; } os << "]"; return os; }
template <typename K, typename V> ostream& operator<<(ostream& os, const map<K,V>& m) {
    os << "{"; for(const auto& p: m){ os << p.first <<":"<< p.second << ", "; } os << "}"; return os; }


bool check(string s){
    for(LL i = 0; i < s.size(); ++i){
        char c = s[i];
        if(i % 2 == 1){
            if(c == 'R') return false;
        }else{
            if(c == 'L') return false;
        }
    }
    return true;
}

int main(){
    string s;
    cin >> s;
    if(check(s)){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define all(v) v.begin(),v.end()
#define mem(arr) memset(arr, 0, sizeof(arr))
#define ff first
#define ss second
#define int long long int
const int MOD = 1e9 + 7;
const int INF = 1e18;
const int N = 1e6 + 20;
vector<int> g[N];
vector<int> vis(N);
int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int tc = 1;
    while(tc--){
        int k, a, b;
        cin >> k >> a >> b;
        for(int i = a; i <= b; i++){
            if(i % k == 0){
                cout << "OK\n";
                return 0;
            }
        }
        cout << "NG\n";
    }
}

Measured memory_bytes: 34176
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=1000000007;
const double PI=3.14159265358979;
const ll INF= pow(10,18);
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";

int main() {
  ll x;
  cin >> x;
  if(x>=2100){
    cout << 1 << endl;
  }
  else{
    ll y=x/100*100;
    if(y>=20*(x-y)){
      cout << 1 << endl;
    }
    else{
      cout << 0 << endl;
    }
  }
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**7)

readline = sys.stdin.buffer.readline
def readstr():return readline().rstrip().decode()
def readstrs():return list(readline().decode().split())
def readint():return int(readline())
def readints():return list(map(int,readline().split()))
def printrows(x):print('\n'.join(map(str,x)))
def printline(x):print(' '.join(map(str,x)))

x,k,d = readints()
x = abs(x)

a = x//d
if k<=a:
    x -= k*d
else:
    x -= a*d
    k -= a
    if k%2!=0:
        x = abs(x-d)

print(x)

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

int main() {
  int m, d;
  cin >> m >> d;

  int ans = 0;
  for (int i=1; i<=m; i++) {
    for (int j=1; j<=d; j++) {
      int d1 = j % 10;
      int d10 = j / 10;
      if (d1 >= 2 && d10 >= 2 && d1 * d10 == i) {
        ans++;
      }
    }
  }

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


Measured memory_bytes: 256
#include<iostream>
#include <algorithm>
#include <vector>
#include <string>
using namespace std;
typedef long long ll;
int beki(ll n){
  int count = 0;
  while(n%2==0){
    n /= 2;
    count++;
  }
  return count;
}
int main(){
  
  int N;
  cin >> N;
  int ans = 0;
  for(int i=0;i<N;i++){
    int l;
    cin >> l;
    ans += beki(l);
  }
  cout << ans <<endl;
  
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define all(v) v.begin(),v.end()
#define P pair<int,int>
#define len(s) (int)s.size()
#define pb push_back

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;
}
constexpr int mod = 1e9+7;
constexpr int inf = 3e18;

map<string,int>mp;
//mp[a]=aの出てくる回数
signed main(){
	int N;
	cin>>N;
	rep(i,N){
		string s;cin>>s;
		mp[s]++;
	}
	int mx=0;
	for(auto p:mp)mx=max(mx,p.second);
	for(auto p:mp){
		if(mx==p.second)cout<<p.first<<endl;
	}
}


Measured memory_bytes: 19220
N = int(input())
mod = 10**9+7

lis = []

for i in range(N):

    a = int(input())
    lis.append([a,1])

for i in range(N):

    b = int(input())
    lis.append([b,-1])

ans = 1

lis.sort()

now = 0
for i in range(2*N):

    nex = lis[i][1]

    if nex == 1:

        if now >= 0:
            now += 1
        else:
            ans *= abs(now)
            now += 1

    else:

        if now <= 0:
            now -= 1
        else:
            ans *= abs(now)
            now -= 1

    ans %= mod

print (ans)

Measured memory_bytes: 79576
def bisect_right(a, x, lo=0, hi=None):
    if lo < 0:
        raise ValueError('lo must be non-negative')
    if hi is None:
        hi = len(a)
    while lo < hi:
        mid = (lo + hi) // 2
        if x > a[mid]:
            hi = mid
        else:
            lo = mid + 1
    return lo

import collections
n = int(input())
dat = []
for i in range(n):
    dat.append(int(input()))
res = collections.deque([])

res.append(dat[0])
import bisect

for i in range(1, n):
    a = bisect_right(res, dat[i])
    #print("2 : {0}".format(a))

    if a == len(res):
        res.append(dat[i])
    else:
        res[a] = dat[i]
print(len(res))
#print(res)

Measured memory_bytes: 53336
#if !defined(__clang__) && defined(__GNUC__)
#include <bits/stdc++.h>
#else
#include <cstdlib>
#include <climits>
#include <iostream>
#include <cstdint>
#include <vector>
#include <string>
#include <complex>
#include <bitset>
#include <queue>
#include <deque>
#include <stack>
#include <utility>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <regex>
#endif //  !defined(__clang__) && defined(__GNUG__)
#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/multi_array.hpp>

using namespace std;

int main()
{
    int64_t N;
    std::cin >> N;

    struct E {
        int64_t a;
        int64_t b;
    };

    std::vector<E> e;
    for (size_t i = 0; i < N; ++i) {
        E t;
        std::cin >> t.a >> t.b;
        e.push_back(t);
    }

    int64_t count = 0;
    for (int64_t i = N-1; i >= 0; --i) {
        auto m = (e[i].a+count) % e[i].b;
        if (m != 0) {
            count += e[i].b - m;
        }
    }

    std::cout << count << std::endl;

    return 0;
}


Measured memory_bytes: 3444
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
typedef long long ll;

int main(){
    double t,x; cin >> t >> x;
    cout << fixed << setprecision(10) << t/x << endl;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
 
int main() {
	int N,K,x,R=0;
	cin >> N >> K;
	
	for (int i = 0 ; i < N ; i++){
		cin >> x;
		if (K-x >= x) {
			R += x * 2;
		}
		else {
			R += (K-x) * 2;
		}
	}
	
	cout << R << endl;
}

	

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

int main() {
  int N;
  cin >> N;
  vector<pair<int, int>> V(N);
  for (int i = 0, x, l; i < N && cin >> x >> l; i++) V.at(i) = {x + l, x - l};
  sort(V.begin(), V.end());
  V.push_back({0, INT_MAX});
  int ans = 0, tmp = -1e9;
  for (int i = 0; i < N; i++) if (V.at(i).second >= tmp) tmp = V.at(i).first, ans++;
  cout << ans << "\n";
}

Measured memory_bytes: 1792
import java.util.Scanner;

public class Main {

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

		int num = Math.min(a, b);
		int loop = Math.max(a, b);

		String ans = "";

		for (int i = 0; i < loop; i++) {
			ans = ans + String.valueOf(num);
		}

		print(ans);

		sc.close();
	}

	public static void print(Object obj) {
		System.out.println(obj);
	}

}


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

#define FILE
#define fr first
#define se second

using namespace std;

const long long N = 2e5 + 7;
const long long inf = 1e9 + 7;
const long long mod = 1e9 + 7;

int main()
{
    ios_base::sync_with_stdio(false);

    int n, m;
    cin >> n >> m;
    if(m >= n){
        cout << "unsafe\n";
    }
    else{
        cout << "safe\n";
    }
}



Measured memory_bytes: 3652
#include "bits/stdc++.h"

#define MOD 1000000007
#define rep(i, n) for(ll i=0; i < (n); i++)
#define rrep(i, n) for(ll i=(n)-1; i >=0; i--)
#define ALL(v) v.begin(),v.end()
#define rALL(v) v.rbegin(),v.rend()
#define FOR(i, j, k) for(ll i=j;i<k;i++)
#define debug_print(var) cerr << #var << "=" << var <<endl;
#define DUMP(i, v)for(ll i=0;i<v.size();i++)cerr<<v[i]<<" "
#define fi first
#define se second

using namespace std;
typedef long long int ll;
typedef vector<ll> llvec;
typedef vector<double> dvec;
typedef pair<ll, ll> P;
typedef long double ld;
struct edge{ll x, c;};

ll mod(ll a, ll mod){
  ll res = a%mod;
  if(res<0)res=res + mod;
  return res;
}

ll modpow(ll a, ll n, ll mod){
  ll res=1;
  while(n>0){
    if(n&1) res=res*a%mod;
    a=a*a%mod;
    n>>=1;
  }
  return res;
}

ll modinv(ll a, ll mod){
  ll b=mod, u=1, v=0;
  while(b){
    ll t=a/b;
    a-=t*b; swap(a, b);
    u-=t*v; swap(u, v);
  }
  u%=mod;
  if(u<0)u+=mod;
  return u;
}

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

bool is_prime(ll n){
  ll i = 2;
  if(n==1)return false;
  if(n==2)return true;
  bool res = true;
  while(i*i <n){
    if(n%i==0){
      res = false;
    }
    i = i+1;
  }

  //if(i==1)res = false;
  if(n%i==0)res=false;
  return res;
}

struct UnionFind{
  ll N;
  llvec p;
  llvec cnt;
  UnionFind(ll n){
    N = n;
    p=llvec(N);
    cnt=llvec(N, 0);
    rep(i, N){
      p[i] = i;
      cnt[i] = 1;
    }
  }

  void con(ll a, ll b){
    P at = root(a);
    P bt = root(b);
    if(at.second!=bt.second){
      if(at.first>bt.first){
        swap(at, bt);
        swap(a, b);
      }
      p[at.second] = bt.second;
      cnt[bt.second]+=cnt[at.second];
      p[a]=bt.second;
    }
  }

  P root(ll a){
    ll atmp = a;
    ll c=0;
    while(atmp!=p[atmp]){
      atmp = p[atmp];
      c++;
    }
    p[a] = atmp;
    return {c, atmp};
  }

  bool is_con(ll a, ll b){
    P at=root(a);
    P bt=root(b);
    return at.second == bt.second;
  }
  
};

struct dijkstra{
  ll N;
  llvec d;
  vector<vector<edge>> e;
  dijkstra(ll n){
    N = n;
    //d = llvec(N, 1e18);
    e = vector<vector<edge>>(N);
  }

  void add_edge(ll from, ll to, ll cost){
    e[from].push_back({to, cost});
  }

  void run(ll start){
    priority_queue<P, vector<P>, greater<P>> que;
    que.push({0, start});
    d = llvec(N, 1e18);
    d[start]=0;
    while(!que.empty()){
      P q = que.top();que.pop();
      ll dc = q.first;
      ll x = q.second;
      if(dc>d[x]){
        continue;
      }else{
        for(auto ip: e[x]){
          if(d[ip.x]<=d[x]+ip.c){
            continue;
          }else{
            d[ip.x]= d[x]+ip.c;
            que.push({d[ip.x], ip.x});
          }
        }
      }
    }
  }  
};


/**************************************
** A main function starts from here  **
***************************************/
int main(){
  ll N, X, T;
  cin >> N >> X >> T;
  cout << (N+X-1)/X * T;
  return 0;
}


Measured memory_bytes: 3636
n,k=map(int,input().split())
X=list(map(int,input().split()))
ans=float('inf')
for i in range(n-k+1):
    a,b=X[i],X[i+k-1]
    if b<0:
        ans=min(ans,-a)
    elif a>0:
        ans=min(ans,b)
    else:
        tmp=min(-a,b)*2+max(-a,b)
        ans=min(ans,tmp)
print(ans)

Measured memory_bytes: 14380
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctype.h>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>

using namespace std;

//4方向ベクトル→↑←↓
int dx[] ={1,0,-1,0};
int dy[] ={0,-1,0,1};
int X1,X2;
int Y1,Y2;
int a1,b1,c1,d1;
int n;//町の総数
int m;//街道の総数
int cost[21][21];//町iから町jへの交通費
const int INF = 1000000;
void warshall_floyd(){
  for(int i = 1;i <=n;i++){
    for(int j = 1;j <=n;j++){
      for(int k = 1;k <=n;k++){
	cost[j][k] =min(cost[j][k],cost[j][i]+cost[i][k]);
      }
    }
  }
}

int main()
{
  cin >>n;
  cin>>m;
  for(int i = 1;i <=n;i++){
    for(int j =1;j <=n;j++){
      if(i!=j)
	cost[i][j] =INF;
      else
	cost[i][j] = 0;
    }
  }
  for(int i = 0;i < m;i++){
    scanf("%d,%d,%d,%d\n",&a1,&b1,&c1,&d1);
    cost[a1][b1] =c1;
    cost[b1][a1] =d1;
  }
  warshall_floyd();
  scanf("%d,%d,%d,%d",&X1,&X2,&Y1,&Y2);
  cout<<Y1-(Y2+cost[X1][X2]+cost[X2][X1])<<endl;
  return 0;
}

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

int main()
{
        long long N;
        cin >> N;
        long long A[N];

        for (int i = 0; i < N; ++i) {
                A[i] = 0;
        }
        for(int i = 0; i < N-1; ++i) {
                int tmp;
                cin >> tmp;
                A[tmp-1] += 1;
        }
        for (int i = 0; i < N; ++i) {
                cout << A[i] << endl;
        }



}


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

int main(){
    int a,b;
    cin>>a>>b;
    if(a==b){
        cout<<"Draw"<<endl;
    }else if(a==1){
        cout<<"Alice"<<endl;
    }else if(b==1){
        cout<<"Bob"<<endl;
    }else if(a>b){
        cout<<"Alice"<<endl;
    }else{
        cout<<"Bob"<<endl;
    }
    
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, m, n) for(int i = m; i < N; i++)
#define INF (INT64_MAX /2)


























int main() {
    int N;
    cin >> N;
    int count = 0;
    bool a = false;
    rep(i, 0, N) {
        int d, e;
        cin >> d >> e;
        if (d == e) count++;
        else count = 0;
        if (count == 3) a = true;
    }

    if (a) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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

using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

ll GCD(ll A, ll B){
  if (A < B) swap(A, B);
  while (A % B != 0){
    A %= B; swap(A, B);
  }
  return B;
}

int N;
ll A[int(1e5+5)];
ll L[int(1e5+5)], R[int(1e5+5)];

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

  L[0] = A[0];
  for (int i = 1; i < N; i++){
    L[i] = GCD(L[i-1], A[i]);
  }

  R[N-1] = A[N-1];
  for (int i = N - 2; i >= 0; i--){
    R[i] = GCD(R[i+1], A[i]);
  }

  ll ans = max(R[1], L[N - 2]);

  for (int i = 1; i < N - 1; i++){
    ans = max(ans, GCD(L[i-1], R[i+1]));
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 5984
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<iomanip>
using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
#define LINF (long long)4e18

using ll = long long;


int main(){
  int N; cin >> N;
  vector<int> s(N);
  rep(i,N) cin >> s[i];
  sort(s.begin(),s.end());

  int sum = 0;
  rep(i,N){
     sum += s[i];
  }
  int ans = 0;
  if(sum % 10 != 0) ans = sum;
  else{
     rep(i,N){
        if(s[i] % 10 != 0) {
           sum -= s[i];
           ans = sum;
           break;
        }
     }
  }
  cout << ans << endl;
}



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

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

Measured memory_bytes: 256
import std.stdio;
import std.c.stdio;
import std.range;
import std.array;
import std.functional;
import std.algorithm;
import std.conv;
import std.container;
import std.math;
import std.numeric;
import std.string;
import std.c.string;
import std.regex;
import std.typecons;

struct Edge {
    int s, t, c;
}

class UnionFind {
    int[] parent;
    this(int size) {
        parent = new int[size];
        parent[] = -1;
    }
    int root(int x) {
        if (parent[x] < 0) return x;
        return parent[x] = root(parent[x]);
    }
    int query(int x, int y) {
        return root(x) == root(y);
    }
    void merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return;
        parent[y] = x;
    }
}
 
void main() {
    int N, M;
    Edge[] es;

    bool input() {
        scanf("%d %d\n", &N, &M);
        if (N == 0 && M == 0) return false;
        es = [];
        foreach (i; 0 .. M) {
            int s, t, c;
            scanf("%d %d %d", &s, &t, &c);
            s--; t--;
            es ~= Edge(s, t, c);
        }
        return true;
    }

    void solve() {
        auto uf = new UnionFind(N);
        int[] cs;
        es.sort!"a.c < b.c";
        foreach (e; es) {
            if (uf.query(e.s, e.t)) continue;
            uf.merge(e.s, e.t);
            cs ~= e.c;
        }
        writeln(cs[$ / 2]);
    }

    while (input) solve;
}

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

#define rp(i, k, n) for (int i = k; i < n; i++)
typedef long long ll;

ll mod = 1e9 + 7;
int inf = 1e9 + 7;
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 main() {
    int n, k;
    scanf("%d%d", &n, &k);
    vector<int> H(n);
    rp(i, 0, n) scanf("%d", &H.at(i));
    vector<int> dp(n, inf);
    dp.at(0) = 0;
    rp(i, 1, n) {
        for (int j = 1; j <= k and j <= i; j++) {
            chmin(dp.at(i), dp.at(i-j) + abs(H.at(i) - H.at(i-j)));
        }
    }
    printf("%d", dp.back());
    return 0;
} 

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include<set>
#include<algorithm>
#include <queue>

using ll =  long long;
#define rep(i,n) for(int i= 0; i< (n); i++)
using namespace std;
using Graph = vector<vector<int>>;

int main(){

    string s;
    cin >> s;
    int n=s.size();

    string a = s.substr(0, (n-1)/2);  
    string b = s.substr((n-1)/2+1, n);
    if(a==b) cout << "Yes" << endl; 
    else cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    long long int a,b;
    char op;
    cin>>a>>op>>b;
    if(op=='+')
    {
        cout<<a+b;
    }
    if(op=='-')
    {
        cout<<a-b;
    }
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <stdlib.h>
#include <stdio.h>
using namespace std;
int main(){
    int A,B; cin >> A >> B;
    if(B % A){
        cout << B - A << endl;
    }else{
        cout << A + B << endl;
    }
    return 0;

}

Measured memory_bytes: 256
#include<stdio.h>
int n,x[100010],d[50][100010],i,j,a,b;
int main(){
  long long s,l;
  scanf("%d",&n);
  for(i=0;i<n;i++)scanf("%d",&x[i]);
  scanf("%lld",&l);
  for(i=j=s=0;i<n;i++){
    for(;j<n;j++){
      if(x[j]-x[i]>l)break;
    }
    d[0][i]=j-1;
  }
  //for(i=0;i<n;i++)printf("%d ",d[0][i]);printf("\n");
  for(i=0;i<40;i++){
    for(j=0;j<n;j++)d[i+1][j]=d[i][d[i][j]];
  }
  scanf("%d",&n);
  while(n--){
    scanf("%d %d",&a,&b);
    s=0;
    a--;
    b--;
    if(a>b){
      i=a;
      a=b;
      b=i;
    }
    for(j=40;j--;){//printf("%d %d\n",j,d[j][a]);
      if(d[j][a]<b){
	a=d[j][a];//printf("%d ",j);
	s+=1<<j;
      }
    }
    printf("%lld\n",s+1);
  }
  return 0;
}


Measured memory_bytes: 17536
#include <bits/stdc++.h>
 
#define f(i,a,b) for( ll i = a; i < (ll) b ; i++ ) 
#define af(i,a,b) for( ll i = a; i >= (ll) b ; i--)
#define rep(i,a,b,k) for(ll i = a; i < b ; i+= k )
#define arep(i,a,b,k) for( ll i = a; i >= b ; i-= k)
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define sz(a) (ll) a.size()
#define all(a) a.begin(), a.end()
#define sor(a) sort( a.begin(), a.end() )
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define inter ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr)
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> ii ;
typedef vector<ll>  vi ;
typedef vector<ii> vii ;
 
const int MAX= 1e6+100;


ll a[MAX];
int main(){
	fastio;
	ll tc,n,x,k,q,l,r,m;
	cin>>n>>m;
	ll s=0;
	f(i,0,n) cin>>a[i],s+=a[i];
	sort(a,a+n),reverse(a,a+n);
	bool go=true;
	f(i,0,m) {
		if(a[i]<=((s-1)/(4*m))) go=false;
	}
	cout<< (go?"Yes\n":"No\n"); 
  	return 0;
}

Measured memory_bytes: 256
let f n =
  let rec g n' sum =
    if n' = 0 then sum
    else
      let v = Scanf.scanf "%d %d\n" (fun l r -> r - l + 1) in
      g (n' - 1) (sum + v)
  in
  g n 0

let () = Scanf.scanf "%d\n" f |> Printf.printf "%d\n"

Measured memory_bytes: 768
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)  
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 999999999
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

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

int gcd(int a,int b){return b?gcd(b,a%b):a;}

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

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

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

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

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

ll modpow(ll n,ll k){
  if(k == 1){
    return n;
  }else if(k == 0){
    return 1;
  }else if(k%2==0){
    ll memo = modpow(n,k/2)%MOD;
    return memo*memo%MOD;
  }else{
    return n * modpow(n,k-1)%MOD;
  }
}

int main(){

  int n,m;cin>>n>>m;
  UnionFind UF(n);

  REP(i,m){
    int x,y,z;cin>>x>>y>>z;
    x--;
    y--;
    UF.unite(x,y);
  }

  bool b[n];
  REP(i,n){
    b[i] = false;
  }
  REP(i,n){
    int x = UF.root(i);
    b[x] = true;
  }

  int ans = 0;
  REP(i,n){
    if(b[i])ans++;
  }

  cout<<ans<<endl;

 

  return 0;
}

Measured memory_bytes: 1024
import std.stdio, std.array, std.conv, std.container;

void main() {
    int[] tmp = readln.split.to!(int[]);
    int n = tmp[0], q = tmp[1];
    int[][] tree = new int[][](n);
    int[] cnt = new int[n];
    foreach (i; 0 .. n-1) {
        tmp = readln.split.to!(int[]);
        int a = tmp[0] - 1, b = tmp[1] - 1;
        tree[a] ~= b;
        tree[b] ~= a;
    }
    foreach (i; 0 .. q) {
        tmp = readln.split.to!(int[]);
        int p = tmp[0] - 1, x = tmp[1];
        cnt[p] += x;
    }
    bool[] flag = new bool[n];
    auto d = DList!int(0);
    while (!d.empty) {
        int v = d.front;
        d.removeFront;
        flag[v] = true;
        foreach (y; tree[v]) {
            if (flag[y]) continue;
            cnt[y] += cnt[v];
            d.insertBack(y);
        }
    }
    foreach (i, y; cnt) {
        y.write;
        if (i != n - 1) " ".write;
        else writeln;
    }
}

Measured memory_bytes: 39036
#include <stdio.h>

typedef struct{
  char name[10];
  int time;
}process;

int n;
int head=0, tail=0;
process p[100000];

void enqueue(process x){
  if(tail == n) tail = 0;
  p[tail++] = x;
}

process dequeue(){
  if(head == n) head = 0;
  return p[head++];
}

int main(){
  int q, i, timer=0, flag=0;
  scanf("%d%d", &n, &q);
  for(i=0; i<n; i++) scanf("%s%d", p[i].name, &p[i].time);
  while(flag != n){
    process x;
    x = dequeue();
    if(x.time <= q){
      flag++;
      timer += x.time;
      printf("%s %d\n", x.name, timer);
    }else{
      timer += q;
      x.time -= q;
      enqueue(x);
    }
  }
  return 0;
}

Measured memory_bytes: 2452
import sys
readline = sys.stdin.readline

N = int(readline())
D = [len(set(map(int, readline().split()))) == 1 for _ in range(N)]
ans = 'No'
for i in range(1, N-1):
    if D[i-1] and D[i] and D[i+1]:
        ans = 'Yes'
print(ans)

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

int main(){

  int n, tmp;
  ll ans = 0;
  vector<int> a, b, c;
  cin >> n;
  a.resize(n); b.resize(n); c.resize(n);
  rep(i,n) cin >> a[i];
  rep(i,n) cin >> b[i];
  rep(i,n) cin >> c[i];
  sort(a.begin(),a.end());
  sort(c.begin(),c.end());
  
  for(auto itr = b.begin(); itr != b.end(); itr++){
    ll d1 = lower_bound(a.begin(),a.end(), *itr) - a.begin();
    ll d2 = c.end() - upper_bound(c.begin(),c.end(),*itr);
    ans += d1*d2;
  }

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

Measured memory_bytes: 1536
#include <iostream>
#include <string>
#include <set>
#include <vector>
#include <algorithm>
using namespace std;

struct Restaurant {
    int count;
    string name;
    int score;
};

bool cmp_name(const Restaurant&a ,const Restaurant& b) {
    return a.name < b.name;
}

bool cmp_score(const Restaurant&a ,const Restaurant& b) {
    return a.score > b.score;
}

void disp(vector<Restaurant> arg) {
    cout << "-----------------------------------------" << endl;
    for (auto res : arg) {
        cout << res.name << ":" << res.score << ":" << res.count << endl;
    }
    cout << "-----------------------------------------" << endl;
}

int main(void) {
    int n;
    vector<Restaurant> ress;

    cin >> n;

    for (int i = 0; i < n; ++i) {
        Restaurant res;
        cin >> res.name >> res.score;
        res.count = i+1;
        ress.push_back(res);
    }

    //disp(ress);
    stable_sort(ress.begin(), ress.end(), cmp_score);
    //disp(ress);
    stable_sort(ress.begin(), ress.end(), cmp_name);
    //disp(ress);

    for (auto res : ress) {
        cout << res.count << endl;
    }
    
    return 0;
}

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

int main() {
  ll n;
  string s;
  cin >> n >> s;
  
  ll cnt = 0;
  
  rep(i, n-2){
    if(s.at(i)=='A' && s.at(i+1)=='B' && s.at(i+2)=='C')
      cnt++;
  }
  cout << cnt << endl;
}

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

#define rep(i, n) for(long long i=0;i<(long long)(n);i++)
#define rep2(i, s, n) for(long long i=(s);i<(long long)(n);i++)
#define repi(i, n) for(int i=0;i<(int)(n);i++)
#define rep2i(i, s, n) for(int i=(s);i<(int)(n);i++)
#define all(v) v.begin(), v.end()

#define deg2rad(deg) (((deg)/360)*2*M_PI)
#define rad2deg(rad) (((rad)/2/M_PI)*360)

using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vvll = vector<vll>;
using P = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;

const ll INF = (1LL<<60);
const int INFi = (1<<29);

/*素数判定*/
bool is_prime(ll n){
    if(n==1) return false;
    for(ll i=2;i*i<=n;i++){
        if(n%i==0) return false;
    }
    return true;
}

/*約数列挙*/
vll enum_divisors(ll n){
    vll l;
    for(ll i=1;i*i<=n;i++){
        if(n%i==0){
            l.push_back(i);
            if(n/i != i) l.push_back(n/i);
        }
    }
   sort(all(l));
   return l;
}

/*素因数分解*/
vector<P> prime_factorize(ll n){
    vector<P> l;
    for(ll i=2;i*i<=n;i++){
        if(n%i!=0) continue;
        ll e = 0;
        while(n%i==0){
            e++;
            n /= i;
        }
        l.push_back({i, e});
    }
    if(n!=1) l.push_back({n, 1});
    return l;
}

int main(){

    double a, b, x; cin >> a >> b >> x;

    double ans;
    if(x>a*a*b/2){
        ans = rad2deg(atan((b-x/(a*a))/(a/2)));
    }
    else{
        ans = rad2deg(atan(b/(2*x/(a*b))));
    }
    cout << fixed << setprecision(10) << ans << endl;

    return 0;
}

Measured memory_bytes: 4096
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int A = sc.nextInt();
        int B = sc.nextInt();
        long result = 0;
        for(int i = 1; i <= N; i++){
            String S = String.valueOf(i);
            long T = 0;
            for(int j = 0; j < S.length(); j++){
                T += Character.getNumericValue(S.charAt(j));
            }
            if(T >= A && T <= B){
                result += i;
            }
        }
        System.out.println(result);
    }
}


Measured memory_bytes: 23124
#include <iostream>
#include <cstdio>
 
 
using namespace std;
 
const long int INF = 5000000000;
const int MAX_E = 500000;
const int MAX_V = 100000;
 
struct edge
{
    int from;
    int to;
    int cost;
 
    edge()
    {
        from = 0;
        to = 0;
        cost = 0;
    }
};
 
//edge es[MAX_E];
 
int V,E,r;
long int d[MAX_V];
edge es[MAX_E];
 
void shortest_path(int r)
{
    for(int i = 0; i < V; i++)
    {
        d[i] = INF;
    }
 
    d[r] = 0;
 
    while(true)
    {
        bool update = false;
 
        for(int i = 0; i < E; i++)
        {
            edge e = es[i];
 
            if (d[e.from] != INF && d[e.to] > d[e.from] + e.cost)
            {
                d[e.to] = d[e.from] + e.cost;
                update = true;
            }
        }
 
        if (!update) break;
    }
}
 
 
int main()
{
    int a[10];
 
    scanf(" %d %d %d", &V,&E,&r);
 
    for(int i = 0; i < E; i++)
    {
        scanf(" %d %d %d", &es[i].from, &es[i].to, &es[i].cost);
    }

    shortest_path(r);
 
    for(int i = 0; i < V; i++)
    {
        if (d[i] == INF)
        {
            printf("INF\n");
        }else
        {
            printf("%ld\n", d[i]);
        }
    }
 
    return 0;
}

Measured memory_bytes: 9840
'use strict';
function main(input) {
  const args = input.split(' '),
        A = parseInt(args[0]),
        B = parseInt(args[1]);
  var min = Math.min(A, B);
  var GCD = 1;
  for (let i = 2; i <= min; ++i) {
    if (A % i === 0 && B % i === 0) {
      GCD = i;
    }
  }
  console.log(A * B / GCD);
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));

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

// {U}{INT,LONG,LLONG}_{MAX,MIN}
#define ALPHABET    (26)
#define INF         INT_MAX
#define MOD         (1000000007LL)
#define EPS         (1e-10)
#define EQ(a, b)    (abs((a)-(b)) < EPS)

using LL  = long long;

int di[] = {0, -1, 0, 1};
int dj[] = {1, 0, -1, 0};
// }}}

int main() {
    std::ios::sync_with_stdio(false);
    int a, b, c;cin >> a >> b >> c;
    int ans = a;
    if(a == b) ans = c;
    if(b == c) ans = a;
    if(c == a) ans = b;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
import java.io.*
import java.util.*

fun solve(N: Int, M: Int, p: IntArray, S: Array<String>) {
    val problemToSubmits = Array(N + 1) { mutableListOf<Int>() }
    for (i in 0 until M) {
        problemToSubmits[p[i]].add(if (S[i] == "AC") 1 else 0)
    }
    fun score(submits: List<Int>): Pair<Int, Int>{
        val idx = submits.indexOfFirst { it == 1 }
        if (idx == -1) return 0 to 0
        else return 1 to idx
    }
    var ac = 0
    var wa = 0
    for (i in 1..N) {
        val submits = problemToSubmits[i]
        val (a, w) = score(submits)
        ac += a
        wa += w
    }
    println("$ac $wa")
    return
}

fun main(args: Array<String>) {
    fun StringArray(size: Int, init: (Int) -> String = { "\u0000" }): Array<String> {
        return Array<String>(size, init)
    }
    class Scanner(stream: InputStream) {
        private val reader = BufferedInputStream(stream).bufferedReader()
        private var st: StringTokenizer? = null
        fun next(): String {
            while (!(st?.hasMoreTokens() ?: false)) st = StringTokenizer(reader.readLine())
            return st!!.nextToken()
        }
    }
    val sc = Scanner(System.`in`)
    val N = sc.next().toInt()
    val M = sc.next().toInt()
    val p = IntArray(M.toInt())
    val S = StringArray(M.toInt())
    for (i in 0 until M.toInt()) {
        p[i] = sc.next().toInt()
        S[i] = sc.next()
    }
    solve(N, M, p, S)
}


Measured memory_bytes: 73604
#include<stdio.h>
int main(void){
	int n,m,i,cnt=0;
	float sum=0,a[100];
	scanf("%d%d",&n,&m);
	for(i=0;i<n;i++){
		scanf("%f",&a[i]);
		sum+=a[i];
	}
	for(i=0;i<n;i++){
		cnt+=sum/4/m<=a[i];
	}
	printf(m<=cnt?"Yes":"No");
	return 0;
}


Measured memory_bytes: 1744
#include <stdio.h>

 int main(void){

    int a;
    int b;
    int c;
   
    scanf("%d %d %d",&a,&b,&c);

    if(a < b && b < c){
     printf("Yes\n");
   }else{
     printf("No\n");
   }
    return 0;
}
   
 

Measured memory_bytes: 580
using System;

class main
{
    static void Main(string[] args)
    {
        string s1, s2, s7, a4;
        s7 = Console.ReadLine();
        int c = int.Parse(s7);
        for (int m = 0; m < c; m++)
        {
            s1 = Console.ReadLine();
            s2 = Console.ReadLine();
            a4 = string.Empty;
            int a1 = 0, a2 = 0;
            string[] s3 = new string[10];
            string[] s4 = new string[10];
            string[] s5 = new string[10];
            int[] a3 = new int[10];
            if (s1.Length > 80 || s2.Length > 80)
            {
                Console.WriteLine("overflow");
                goto end;
            }
            s1 = s1.PadLeft(80, '0');
            s2 = s2.PadLeft(80, '0');
            for (int i = 0; i < 10; i++)
            {
                s3[i] = s1.Substring(8 * i, 8);
                s4[i] = s2.Substring(8 * i, 8);
            }
            for (int j = 9; j >= 0; j--)
            {
                a1 = int.Parse(s3[j]);
                a2 = int.Parse(s4[j]);
                a3[j] += a1 + a2;
                if (a3[j].ToString().Length == 9)
                {
                    if (j == 0)
                    {
                        Console.WriteLine("overflow");
                        goto end;
                    }
                    a3[j] -= 100000000;
                    a3[j - 1] += 1;
                }
                s5[j] = a3[j].ToString().PadLeft(8, '0');
            }
            a4 = string.Join("", s5);
            while (a4.StartsWith("0"))
            {
                a4 = a4.TrimStart('0');
            }
            if (a4 == "")
            {
                Console.WriteLine(0);
                goto end;
            }
            Console.WriteLine(a4);
        end: ;
        }
        Console.ReadKey();
    }
}

Measured memory_bytes: 6356
from collections import Counter
n=int(input())
l=list(map(int,input().split()))
c=Counter(l)
l=list(set(l))
if n<=2:
    print(0)
    exit()
else:
    t=len(l)
    ans=0
    for i in range(t-2):
        for j in range(i+1,t-1):
            for k in range(j+1,t):
                if l[i]+l[j]>l[k] and l[i]+l[k]>l[j] and l[j]+l[k]>l[i]:
                    ans=ans+c[l[i]]*c[l[j]]*c[l[k]]
    print(ans)

Measured memory_bytes: 9464