akhauriyash/Code-Regression huggingface dataset:
import java.util.*;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        List<Long> list = new ArrayList<>();
        for(int i = 0;i<n;i++)list.add(sc.nextLong());
        long ans = 0;
        Collections.sort(list,Collections.reverseOrder());
        for(int i = 1;i<n;i++)ans+=list.get(i/2);
        System.out.println(ans);
    }
}

Measured memory_bytes: 66000
program atcoder
    implicit none
    integer(8) :: i,j,k,wmax,n
    integer(8),allocatable,dimension(:) :: dp1,dp2
    integer(8),allocatable,dimension(:) :: w,v

    read*,n,wmax
    allocate(dp1(0:100000))
    allocate(dp2(0:100000))
    allocate(w(0:n))
    allocate(v(0:n))
    do i=1,n
        read*,w(i),v(i)
    enddo

    !dp(value) := minimum weight
    dp1 = lshift( 1_8, 50 )
    dp2 = lshift( 1_8, 50 )
    dp1(0) = 0
    dp2(0) = 0
    do i=1,n
        do j=0,100000-v(i)
            dp2(j+v(i)) = min(dp2(j+v(i)),dp1(j)+w(i))
        enddo
        dp1 = dp2
    enddo

    do i=100000,0,-1
        if(dp1(i)<=wmax)then
            write(*,'(I0)') i
            exit
        endif
    enddo
    stop 
contains
end program atcoder


Measured memory_bytes: 2176
#include <bits/stdc++.h>
#define rep(i,n) for(long long int i = 0; i < n; i++)
#define print(n) std::cout << n << std::endl
#define _print(n) std::cout << n
using namespace std;
typedef long long ll;
const int N = 1000000;

int main(){
    string a,b,c; cin >> a >> b >> c;
    _print("A"),_print(b[0]),_print("C");
}

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

int n, m, q, ans;
int v[51][4];

void dfs(int cnt = 0, vector<int> num = {})
{
  if (cnt == n) {
    int score = 0;
    for (int i = 0; i < q; ++i) if (num[v[i][1]-1] - num[v[i][0]-1] == v[i][2]) score += v[i][3];
    
    ans = max(ans, score);
    return;
  }

  int back = 1;
  if (cnt) back = num.back();

  for (int i = back; i <= m; ++i) {
    num.emplace_back(i);
    dfs(cnt+1, num);
    num.pop_back();
  }
}

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

  cin >> n >> m >> q;
  for (int i = 0; i < q; ++i) for (int j = 0; j < 4; ++j) cin >> v[i][j];

  dfs();
  cout << ans << '\n';

  return (0);
}

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

int main() {
	ll n;cin >> n;
	vector<string> s = {"AC","WA","TLE","RE"};
	vector<ll> ans(4);
	rep(i,n){
		string t;cin >> t;
		rep(j,4) if( t == s.at(j) ){
			ans.at(j)++;
			break;
		}
	}
	rep(i,4){
		cout << s.at(i) << " x " << ans.at(i) << endl;
	}
	return 0;
}


Measured memory_bytes: 3616
from collections import defaultdict
import numpy as np
import sys


sys.setrecursionlimit(10 ** 6)
INF = float("inf")
MOD = 10 ** 9 + 7


def input():
    return sys.stdin.readline().strip()


def main():
    N, C = map(int, input().split())
    MAX = 10 ** 5 + 2
    vals = [0] * MAX
    D = defaultdict(list)
    for _ in range(N):
        s, t, c = map(int, input().split())
        D[c].append((s, t))

    for k, v in D.items():
        prev = -1
        v.sort(key=lambda x: x[0])
        for s, t in v:
            if prev == s:
                vals[prev + 1] += 1
                vals[t + 1] -= 1
            else:
                vals[s] += 1
                vals[t + 1] -= 1
            prev = t

    cumsum = np.cumsum(vals)
    ans = max(cumsum)
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 28148
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <algorithm>

#define CH(N,A,B) (A<=N&&N<B)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define RREP(i,a,b) for(int i=(b-1);a<=i;i--)

using namespace std;

int main() {

  long long N;
  cin>>N;

  int ans = 1;
  long long num = 3;
  while(1){
    if(N <= num) break;
    num  *= 3;
    ans++;
  }

  cout<<ans<<endl;

  return 0;
}

Measured memory_bytes: 3088
#include <iostream>

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

using namespace std;

int main() {
    int s;
    cin>>s;
    bool yymm=false,mmyy=false;
    int b=s%100, t=(s-b)/100;
    if(t>0&&t<=12)mmyy=true;
    if(b>0&&b<=12)yymm=true;

    if (yymm){
        if(mmyy)cout<<"AMBIGUOUS"<<endl;
        else cout<<"YYMM"<<endl;
    }else if(mmyy) cout<<"MMYY"<<endl;
    else cout<<"NA"<<endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main{
  
  public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
    
    String ABCD = sc.next();
    char[] abcd = ABCD.toCharArray();
    
    int[] num =new int[4];
    for(int i = 0; i < abcd.length; i++){
      num[i] = Character.getNumericValue(abcd[i]);
    }
    
    
    if(num[0]+num[1]+num[2]+num[3]==7){
      System.out.println(num[0]+"+"+num[1]+"+"+num[2]+"+"+num[3]+"="+7);
    }else if(num[0]+num[1]+num[2]-num[3]==7){
      System.out.println(num[0]+"+"+num[1]+"+"+num[2]+"-"+num[3]+"="+7);
    }else if(num[0]+num[1]-num[2]-num[3]==7){
      System.out.println(num[0]+"+"+num[1]+"-"+num[2]+"-"+num[3]+"="+7);
    }else if(num[0]-num[1]-num[2]-num[3]==7){
      System.out.println(num[0]+"-"+num[1]+"-"+num[2]+"-"+num[3]+"="+7);
    }else if(num[0]-num[1]+num[2]-num[3]==7){
      System.out.println(num[0]+"-"+num[1]+"+"+num[2]+"-"+num[3]+"="+7);
    }else if(num[0]+num[1]-num[2]+num[3]==7){
      System.out.println(num[0]+"+"+num[1]+"-"+num[2]+"+"+num[3]+"="+7);
    }else if(num[0]-num[1]-num[2]+num[3]==7){
      System.out.println(num[0]+"-"+num[1]+"-"+num[2]+"+"+num[3]+"="+7);
    }else if(num[0]-num[1]+num[2]+num[3]==7){
      System.out.println(num[0]+"-"+num[1]+"+"+num[2]+"+"+num[3]+"="+7);
    }
      
  }  
}

Measured memory_bytes: 39584
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char) 
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}



fn main() {
    let a: u32 = read();
    let b: u32 = read();
    let c: u32 = read();

    let mut counter = 0;

    for i in a..b+1 {
        if c % i == 0{
            counter += 1
        }
    }

    println!("{}", counter);

}


Measured memory_bytes: 5024
h,w=map(int,input().split())
a=[list(map(int,input().split())) for i in range(h)]
b=[list(map(int,input().split())) for i in range(h)]

pos = 160*80
dp=[[0]*w for i in range(h)]
sub=abs(a[0][0]-b[0][0])
dp[0][0]=1<<(pos-sub)|1<<(pos+sub)

for c in range(h):
    for l in range(w):
        sub=abs(a[c][l]-b[c][l])
        if l!=0 and c!=0:
            dp[c][l]|=dp[c][l-1]<<sub|dp[c][l-1]>>sub|dp[c-1][l]<<sub|dp[c-1][l]>>sub
        elif c!=0:
            dp[c][l]|=dp[c-1][l]<<sub|dp[c-1][l]>>sub
        elif l!=0:
            dp[c][l]|=dp[c][l-1]<<sub|dp[c][l-1]>>sub
bit=dp[-1][-1]
for i in range(pos):
    if (bit&1<<(pos+i))or(bit&1<<(pos-i)):
        print(i)
        break

Measured memory_bytes: 20340
#include <bits/stdc++.h>
using namespace std;
///////////////////////////////////////////
const long long int INF = 1LL<<60;
const long long int Mod = 1000000007;
using ll = long long int; using ci = const int;
using vi = vector<int>;  using Vi = vector<long long int>;
using P = pair<int, int>;  using PLL = pair<ll, ll>;
using matrix = vector<vector<ll>>;
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define rp(i,N) for(ll i = 0; i < (ll)N; i++)
#define repi(i,a,b) for(ll i = ll(a); i < ll(b); ++i)
template<class T>bool chmax(T &former, const T &b) { if (former<b) { former=b; return true; } return false; }
template<class T>bool chmin(T &former, const T &b) { if (b<former) { former=b; return true; } return false; }
template<class T>T sqar(T x){ return x*x; }//sqrt(x)は平方根;
#define Sort(v) std::sort(v.begin(), v.end(), std::greater<decltype(v[0])>()) //降順でVをソート
#define p_queue(v) priority_queue<v, vector<v>, greater<v> >
template<class T> inline void princ(T x){cout<<x<<" ";}; 
template<class T> inline void print(T x){cout<<x<<"\n";};
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
///////////////////////////////////////////////////////////////////////////////////

void solve(){
    ll n;
    cin >> n;
    Vi c(n-1),s(n-1),f(n-1);
    rp(i,n-1) cin >> c[i] >> s[i] >> f[i];
    rp(i,n){
        ll time=0;
        repi(j,i,n-1){
            time=max(s[j]+c[j],f[j]*((time-1)/f[j]+1)+c[j]);
        }
        print(time);
    }
    return;
}
int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    std::cout<<std::fixed<<std::setprecision(30);
    solve();
    return 0;
}

Measured memory_bytes: 3660
#include <iostream>
#include <algorithm>
using namespace std;
#define lli long long int

int main() {
  int R, G, B, N;
  cin >> R >> G >> B >> N;
  lli cont=0;
  for(int i=0; i<=N; i++){
    for(int j=0; j<=N; j++){
      int A = N - i*R - j*G;
      if(A>=0){
        if(A % B == 0 && A/B <= N)
          cont++;
      }
    }
  }
  cout << cont;
}

Measured memory_bytes: 256
#include <stdio.h>
int min(int a, int b){
  return (a<b) ? a : b;
}
int main(void){
  int a, b, c, d;
  scanf("%d%d%d%d", &a,&b, &c, &d);
  printf("%d\n", min(a, b) + min(c, d));  
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <tuple>
using namespace std;

using ll = long long;

constexpr int INF = 1e9;

// dir, y, x
// dir: 0 -> north, 1->east, 2->south, 3->west
using data = tuple<int, int, int>;

int main() {
    ll H, W;
    ll L;
    while(cin >> H >> W >> L, H) {
        vector<string> v(H);
        vector<data> path;
        vector<vector<vector<int>>> res(4, vector<vector<int>>(H, vector<int>(W, INF)));
        int dir = 0, y = 0, x = 0;
        for(int i=0; i<H; ++i) {
            cin >> v[i];
            for(int j=0; j<W; ++j) {
                if(v[i][j] != '.' && v[i][j] != '#') {
                    if(v[i][j] == 'N') {
                        dir = 0;
                    } else if(v[i][j] == 'E') {
                        dir = 1;
                    } else if(v[i][j] == 'S') {
                        dir = 2;
                    } else {
                        dir = 3;
                    }
                    y = i, x = j;
                }
            }
        }
        int cnt = 0;
        int dx[4] = {0, 1, 0, -1},
            dy[4] = {-1, 0, 1, 0};
        bool f = false;
        char d[4] = {'N', 'E', 'S', 'W'};
        while(true) {
            if(cnt == L) {
                f = true;
                break;
            }
            if(res[dir][y][x] != INF) {
                break;
            }
            if(cnt != 0) {
                res[dir][y][x] = cnt;
                path.push_back(make_tuple(dir, x, y));
            }
            int ny = y + dy[dir], nx = x + dx[dir];
            int ndir = dir;
            while(ny < 0 || H <= ny || nx < 0 || W <= nx || v[ny][nx] == '#') {
                ndir = (ndir+1)%4;
                ny = y + dy[ndir];
                nx = x + dx[ndir];
            }
            if(res[ndir][ny][nx] != INF) {
                x = nx;
                y = ny;
                dir = ndir;
                break;
            }
            x = nx;
            y = ny;
            dir = ndir;
            ++cnt;
        }
        if(f) {
            cout << y+1 << " " << x+1 << ' ' << d[dir] << endl;
        } else {
            auto t = make_tuple(dir, x, y);
            int idx = 0;
            for(int i=0; i<path.size(); ++i) {
                if(path[i] == t) {
                    idx = i;
                    break;
                }
            }
            L -= cnt+1;
            L %= (path.size() - idx);
            int adir, ax, ay;
            tie(adir, ax, ay) = path[idx + L];
            cout << ay+1 << ' ' << ax+1 << ' ' << d[adir] << endl;
        }
    }
}


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

int main() {
  int a,b,c,d;cin>>a>>b>>c>>d;
  if (abs(a-c) <= d || abs(a-b) <=d && abs(b-c) <= d) {
    cout << "Yes" << "\n";
  } else {
    cout << "No" << "\n";
  }
}


Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var a, b int
	fmt.Scan(&a, &b)

	if a != 1 && b != 1 {
		fmt.Println(1)
	} else if a != 2 && b != 2 {
		fmt.Println(2)
	} else {
		fmt.Println(3)
	}
}


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

using namespace std;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int N, Q;
    cin >> N;
    int a;
    unordered_map<long long,long long> nums;
    long long sum = 0;
    for (int i = 0; i < N; i++) {
        cin >> a;
        nums[a] += 1;
        sum += a;
    }
    cin >> Q;
    long long b, c;
    for (long long i = 0; i < Q; i++) {
        cin >> b >> c;
        if (nums.find(b) != nums.end()) { 
            if (b > c) {
                sum -= (b-c)*nums[b];
            } else {
                sum += (c-b)*nums[b];
            }
            nums[c] += nums[b];
            nums[b] = 0;
        }
        cout << sum << "\n";
    }
}


Measured memory_bytes: 6704
n = int(input())
height = list(map(int, input().split()))

ans = 0
cnt = 0
for i in range(n-1):
    if height[i] >= height[i+1]:
        cnt += 1
    else:
        if cnt > ans:
            ans = cnt
        cnt = 0

if cnt > ans:
    ans = cnt

print(ans)

Measured memory_bytes: 14224
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double db;
typedef pair<int,int> pii;
typedef vector<int> vi;
#define de(x) cout << #x << "=" << x << endl
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define lb(x) (x&-(x))
const int N = 101010;
map<int,int> m;
int cnt[200005];
int cmp(int a,int b)
{
	return a>b;
}
int main(){
	int n,k;
	int tmp;
	cin>>n>>k;
	for(int i=0;i<n;i++)
	{
		scanf("%d",&tmp);
		m[tmp]++;
	}
	map<int,int>::iterator it;
	int j=0;
	for( it=m.begin();it!=m.end();it++)	cnt[j++]=it->second;
	sort(cnt,cnt+j,cmp);
	
	//2 2 1   2
	int ans=0;
	if(k>j) {
		cout<<"0"<<endl;return 0;
	}
	for(int i=k;i<j;i++) ans+=cnt[i];
	cout<<ans<<endl;
    return 0;
}
//2 2

Measured memory_bytes: 10368
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <tuple>
#define mkp make_pair
#define mkt make_tuple
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;

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

  if(A>B) swap(A,B);
  bool ok=false;
  for(ll i=0;i<=N-1;i++){
    ll rest=B-(A+C*i-C*(N-1-i));
    if(rest>=0){
      if(rest<=(D-C)*i) ok=true;
    }else{
      if(-rest<=(D-C)*(N-1-i)) ok=true;
    }
  }

  if(ok) cout<<"YES"<<endl;
  else cout<<"NO"<<endl;

  return 0;
}


Measured memory_bytes: 256
N=int(input())
S=[input() for i in range(N)]
m,a,r,c,h = 0,0,0,0,0
for s in S:
  if 'M' == s[0]:
    m+=1
  elif 'A' == s[0]:
    a+=1
  elif 'R' == s[0]:
    r+=1
  elif 'C' == s[0]:
    c+=1
  elif 'H' == s[0]:
    h+=1

print(m*a*r + m*a*c + m*a*h + m*r*c + m*r*h + m*c*h + a*r*c + a*r*h + a*c*h + r*c*h)

Measured memory_bytes: 9772
let n = Scanf.scanf " %d" (+) 0
let rec f n = if n mod 2 <> 0 then 0 else 1 + f (n / 2)
let a_s = Array.init n @@ fun _ -> Scanf.scanf " %d" f
let z, o, t = Array.fold_left (fun (z, o, t) -> function 0 -> z + 1, o, t | 1 -> z, o + 1, t | _ -> z, o, t + 1) (0, 0, 0) a_s
let g b = print_endline @@ if b then "Yes" else "No"
let _ = g @@ if o > 0 || n = 2 then z <= t else z - 1 <= t

Measured memory_bytes: 5376
#include<map>
#include<iostream>
#include<deque>
#include<algorithm>
#include<string>
#include<cctype>
#include<iomanip>
#include<vector>
#include<queue>
#include<math.h>
#include<bitset>
#include<random>
 
using namespace std;
#define REP(i,b,e) for(ll i=(ll)b;i<(ll)e;i++)
#define rep0(i,n) REP(i,0ll,n)
#define rep1(i,n) REP(i,1ll,n+1)
 
#define shosu setprecision(17)
 
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<char,P> Q;
//ll longinf=1ll<<60;
int inf=1<<29;
ll longinf=(1ll<<60);

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

signed main(){
    ll n;
    cin>>n;
    ll h[n];
    rep0(i,n) cin>>h[i];
    ll dp[n+1];
    fill(dp,dp+n+1,0ll);
    dp[0]=0;
    dp[1]=abs(h[1]-h[0]);
    for(int i=2;i<n;i++){
        dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]));
    }
    cout<<dp[n-1]<<endl;

    return 0;
}


Measured memory_bytes: 1792
#include<iostream>
#include<iomanip>
#include<math.h>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<string>
#define INF 1000000000ll
#define MOD 1000000007ll
#define EPS 1e-8
#define REP(i, m) for(long long i=0; i<m; ++i)
#define FOR(i, n, m) for(long long i=n; i<m; ++i)
#define ALL(v) v.begin(), v.end()
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef long double ld;

int main() {
	ios::sync_with_stdio(false);
	map<vector<int>, int> d;
	vector<int> perm={0,1,2,3,4,5,6,7};
	do {
		d[perm]=INF;
	} while(next_permutation(ALL(perm)));
	queue<vector<int> > q;
	vector<int> res={0,1,2,3,4,5,6,7};
	d[res]=0;
	q.push(res);
	while(!q.empty()) {
		vector<int> p=q.front();
		q.pop();
		REP(i,8) {
			int buf=d[p];
			if(p[i]==0) {
				vector<int> np=p;
				if(i>0&&i/4==(i-1)/4) {
					swap(np[i],np[i-1]);
					if(d[np]==INF) {
						d[np]=buf+1;
						q.push(np);
					}
				}
				if(i<7&&i/4==(i+1)/4) {
					vector<int> np=p;
					swap(np[i],np[i+1]);
					if(d[np]==INF) {
						d[np]=buf+1;
						q.push(np);
					}
				}
				if(i+4<8) {
					vector<int> np=p;
					swap(np[i],np[i+4]);
					if(d[np]==INF) {
						d[np]=buf+1;
						q.push(np);
					}
				}
				if(i-4>=0) {
					vector<int> np=p;
					swap(np[i],np[i-4]);
					if(d[np]==INF) {
						d[np]=buf+1;
						q.push(np);
					}
				}
			}
		}
		;;}
	while(1) {
		vector<int> s(8);
		cin>>s[0];
		if(cin.eof()) break;
		FOR(i,1,8) cin>>s[i];
		cout<<d[s]<<endl;
	}
}

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

int un[101000];
int get(int i)
{
    if (un[i] == i)
        return i;
    return un[i] = get(un[i]);
}

void mrg(int i, int j)
{
    un[get(i)] = get(j);
}

int n;
int x[100100];
int y[100100];
vector<pair<int,int>> xs, ys;

vector<pair<int,pair<int,int>>> e;

int main()
{
    scanf("%d",&n);
    for(int i = 0; i < n; i++)
    {
        scanf("%d %d",&x[i],&y[i]);
        xs.push_back({x[i],i});
        ys.push_back({y[i],i});
        un[i] = i;
    }
    sort(xs.begin(),xs.end());
    sort(ys.begin(),ys.end());
    for(int i = 0; i < n-1; i++)
        e.push_back({xs[i+1].first-xs[i].first,{xs[i+1].second,xs[i].second}});
    for(int i = 0; i < n-1; i++)
        e.push_back({ys[i+1].first-ys[i].first,{ys[i+1].second,ys[i].second}});
    sort(e.begin(),e.end());
    long long sum = 0;
    for(auto w : e)
    {
        int u = w.second.first;
        int v = w.second.second;
        int c = w.first;
        if (get(u) == get(v))
            continue;
        mrg(u,v);
        sum += c;
    }
    printf("%lld\n",sum);
    return 0;
}


Measured memory_bytes: 8296
#include <bits/stdc++.h>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstring>
#include <chrono>
#include <complex>
#define endl "\n"
#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define vvi vector < vi >
#define pii pair<int,int>
#define pll pair<long long, long long>
#define mod 1000000007
#define inf 1000000000000000001;
#define all(c) c.begin(),c.end()
#define mp(x,y) make_pair(x,y)
#define mem(a,val) memset(a,val,sizeof(a))
#define eb emplace_back
#define f first
#define s second

using namespace std;
int main()
{
	std::ios::sync_with_stdio(false);
	int x;
	cin >> x;

	string ans = "No";
	if (x >= 30) {
		ans = "Yes";
	}

	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 3612
h, w, m = map(int, input().split())
h_l = [[] for i in range(h + 1)]
w_l = [[] for i in range(w + 1)]
max_h = 0
max_h_l = []
max_w = 0
max_w_l = []
inputs = {}
for _ in range(m):
    h, w = map(int, input().split())
    inputs.setdefault(h, set([w]))
    inputs[h].add(w)

    if h_l[h] :
        h_l[h][1].add(w)
        h_l[h][0] += 1
    else:
        h_l[h] = [1, set([w])]
        
    if h_l[h][0] > max_h:
        max_h_l = [h]
        max_h = h_l[h][0]
    elif h_l[h][0] == max_h:
        max_h_l.append(h)
 
        
    if w_l[w]:
        w_l[w][1].add(h)
        w_l[w][0] += 1
    else:
        w_l[w] = [1, set([h])]
    if w_l[w][0] > max_w:
        max_w_l = [w]
        max_w = w_l[w][0]
    elif w_l[w][0] == max_w:
        max_w_l.append(w)

ans = max_h + max_w -1
flag = 0
for i in max_h_l:
    if flag == 1:
        break
    for j in max_w_l:
        if j not in inputs[i]:
            ans = max_h + max_w
            flag = 1
            break
        
print(ans)

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

from scipy.sparse.csgraph import floyd_warshall
h,w=map(int,input().split())
table=[]
for i in range(10):
  table.append([int(i) for i in input().split()])
d=floyd_warshall(csgraph=table, directed=True, return_predecessors=False)

ans=0
for i in range(h):
  A=[int(i) for i in input().split()]
  for a in A:
    if a==-1:
      continue
    else:
      ans+=d[a][1]
print(int(ans))

Measured memory_bytes: 13728
import java.util.Scanner;

public class Main {

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

        int[] a = new int[n];

        for(int i=0; i<n; i++) {
            a[i] = scanner.nextInt();
        }

        if(n==1)
            System.out.println(0);

        int dp[] = new int[n];

        dp[0] = 0;
        dp[1] = Math.abs(a[0]-a[1]);

        for(int i=2; i<n; i++) {
            dp[i] = Math.min(Math.abs(a[i]-a[i-1]) + dp[i-1],Math.abs(a[i]-a[i-2]) + dp[i-2]);
        }
        System.out.println(dp[n-1]);
    }

}


Measured memory_bytes: 49504
#include<iostream>
#include<algorithm>
#include<math.h>
#include<string>
#include<vector>
#include<queue>
#include<deque>
using namespace std;
typedef pair<int, int>P;
typedef pair<int, pair < int, int > > PP;
typedef long long ll;
ll inf = -1;
ll mod = pow(10, 9) + 7;

int main() {
	int n;cin>>n;
	int d[100010];
	for(int i=0;i<n;i++){
		cin>>d[i];
	}
	sort(d,d+n);
	int abc,arc;
	abc=d[n/2-1];
	arc=d[n/2];
	cout<<arc-abc<<endl;
	return 0;
}

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

int main() {
  int K, A, B;
  cin >> K >> A >> B;
  
  bool result = false;
  
  for (int i = A; i <= B; i++) {
    if (i % K == 0) {
      result = true;
    }
  }
  
  if (result) cout << "OK" << endl;
  else cout << "NG" << endl;
}

Measured memory_bytes: 3596
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] get = br.readLine().split(" ");

		int N = Integer.parseInt(get[0]);
		int K = Integer.parseInt(get[1]);

		List<Integer> A = new ArrayList<Integer>();
		get = br.readLine().split(" ");
		for(int i = 0;i<N;i++){
			A.add(Integer.parseInt(get[i]));
		}

		A.sort(null);

		List<Integer> countList = new ArrayList<Integer>();

		int now;
		int prev = A.get(0);
		int count = 0;
		for(int i = 0;i<N;i++){
			now = A.get(i);
			if(prev == now){
				count++;
			}else{
				countList.add(count);
				count = 1;
			}
			prev = now;
		}

		countList.add(count);

		countList.sort(null);

		int reWrite = 0;

		for(int i = 0;i<countList.size()-K;i++)reWrite += countList.get(i);

		System.out.println(reWrite);
	}
}

Measured memory_bytes: 60552
// #pragma GCC target("avx2")
#pragma GCC optimize("O3", "unroll-loops")

// #include <bits/extc++.h>
// using namespace __gnu_pbds;

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

#define int long long
#define double long double
// template <typename T>
// using pbds_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
using pii = pair<int, int>;
template<typename T>
using prior = priority_queue<T, vector<T>, greater<T>>;
template<typename T>
using Prior = priority_queue<T>;

#define X first
#define Y second
#define ALL(x) (x).begin(), (x).end()
#define eb emplace_back
#define pb push_back

#define fastIO() ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define RANDOM() random_device __rd; \
                 mt19937 __gen = mt19937(__rd()); \
                 uniform_int_distribution<int> __dis(0, 1); \
                 auto rnd = bind(__dis, __gen);

const int INF = 1E18;
const int mod = 1E9 + 7;

int32_t main() {
    fastIO();
    
    int a, b;
    cin >> a >> b;
    cout << a-1 + (b >= a) << "\n";
    
    return 0;
}

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

using namespace std;

int main(){
	int n;
	string str;
	cin >> n;
	cin.ignore();
	
	while(n--){
		getline(cin, str);
		for(int i = 0; i + 6 < str.length();i++){
			if(str.substr(i, 7) == "Hoshino"){
				str.replace(i, 7, "Hoshina");
			}
		}
		cout << str << endl;
	}
	
	return 0;
} 

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

int main(){
    int n;
    cin>>n;
    int arr[n];
    for (int i=0;i<n;++i){
        cin>>arr[i];
    }
    int count = 0;
    
    for (int i=1;i<n-1;++i){
        if (arr[i]<arr[i+1] && arr[i]>arr[i-1]){
            count++;
        }
        else if (arr[i]>arr[i+1] && arr[i]<arr[i-1]){
            count++;
        }
    }
    cout<<count;
}

Measured memory_bytes: 3548
#pragma gcc optimize("Ofast")
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort(ALL(V)) //小さい方からソート
#define REV(V) reverse(ALL(V)) //リバース
#define RSORT(V) SORT(V);REV(V) //大きい方からソート
#define NPN(V) next_permutation(ALL(V)) //順列
#define pb(n) push_back(n)
#define endl '\n'
#define Endl '\n'
#define DUMP(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define Yay(n) cout << ((n) ? "Yay!": ":(") << endl
#define RAPID cin.tie(0);ios::sync_with_stdio(false)
#define VSUM(V) accumulate(ALL(V), 0) 
#define IN(n) cin >> n
#define IN2(a,b) cin >> a >> b
#define IN3(a,b,c) cin >> a >> b >> c 
#define IN4(a,b,c,d) cin >> a >> b >> c >> d
#define VIN(V) for(int i = 0; i < (V).size(); i++) {cin >> (V).at(i);}
#define OUT(n) cout << n << endl
#define VOUT(V) REP(i, (V).size()) {cout << (V)[i] << endl;}
#define VOUT2(V) REP(i, (V).size()) {cout << (V)[i] << " ";} cout<<endl;

// 型マクロ定義
#define int long long
#define P pair<ll,ll>
#define Vi vector<ll>
#define Vd vector<double>
#define Vs vector<string>
#define Vc vector<char>
#define M map<ll,ll>
#define S set<ll>
#define PQ priority_queue<ll>
#define PQG priority_queue<ll,V,greater<ll>
//

const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);

int gcd(int a,int b){return b != 0 ? gcd(b, a % b) : a;} //最大公約数
int lcm(int a, int b){return a * b / gcd(a, b);}
string toStrUp(string str){char diff = 'A'-'a';REP(i,str.size()) str[i] += diff;return str;}
string gCh(string str, int key){return str.substr(key,1);}

signed main() {
  RAPID;
  // デフォルト変数定義
  int n,m,a,b,c=0,d,x,y,z;
  string s,t;
  //

  // ここから
  IN(n);
  Vi V(n);
  Vi C(n);
  VIN(V)
  VIN(C)
  REP(i,n) {
    if(V[i] > C[i]) c+=(V[i]-C[i]);
  }
  OUT(c);
}

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

int main() {
  int N, K, total = 1;
  cin >> N >> K;

  for (int i = 0; i < N; i++) {
    int a = total * 2;
    int b = total + K;
    if (a > b) {
      total = b;
    } else {
      total = a;
    }
  }
  cout << total << endl;
}

Measured memory_bytes: 256
// -----------------------------------------------
// Framework <https://github.com/vain0x/procon>
//
// See the bottom of file for solution.
// -----------------------------------------------

#![allow(unused_imports)]
#![allow(non_snake_case)]

use std::cell::RefCell;
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Display, Formatter, Write as FmtWrite};
use std::io::{stderr, stdin, BufRead, Write};
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), stderr());
            writeln!(err, "\x1B[33m{}\x1B[0m = {:?}", e, $e).unwrap()
        })*
    };
}

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

#[allow(dead_code)]
fn rl() -> String {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    buf.trim_right().to_owned()
}

// -----------------------------------------------
// Solution
// -----------------------------------------------

fn main() {
    let (N, M) = read!(usize, usize);
    let T = read![[i64]; N];

    let mut t = (1 << M) - 1;
    for row in T {
        let A = &row[1..];
        let mut s = 0;
        for a in A {
            s = s | (1 << (a - 1));
        }
        t = t & s;
    }

    println!("{}", (0..M).filter(|&i| (t & (1 << i)) != 0).count())
}


Measured memory_bytes: 4352
#include <iostream>
#include <algorithm>
#include <set>
#include <stdlib.h>
#include <cmath>
using namespace std;

int d, c[29], s[409][29], p[409], cp[29], rs;
set<int> st[29];

int cc()
{
	for (int i = 0; i < 26; i++)
		cp[i] = 0;
	int ans = 0;
	for (int i = 1; i <= d; i++) {
		for (int j = 0; j < 26; j++) {
			if (p[i] == j) {
				cp[j] = i;
				ans += s[i][j];
			}
			else
				ans -= (i - cp[j]) * c[j];
		}
	}
	return ans;
}

void rm(int n, int k)
{
	auto pi = st[k].find(n);
	auto l = pi; l--;
	auto r = pi; r++;
	int pl = (n - (*l) - 1), pr = ((*r) - n - 1), plr = ((*r) - (*l) - 1);
	st[k].erase(n);
	rs -= s[n][k];
	rs += pl * (pl + 1) / 2 * c[k]; rs += pr * (pr + 1) / 2 * c[k];
	rs -= plr * (plr + 1) / 2 * c[k];
}

void ins(int n, int k)
{
	auto r = st[k].lower_bound(n);
	auto l = r; l--;
	int pl = (n - (*l) - 1), pr = ((*r) - n - 1), plr = ((*r) - (*l) - 1);
	st[k].insert(n);
	rs += s[n][k];
	rs -= pl * (pl + 1) / 2 * c[k]; rs -= pr * (pr + 1) / 2 * c[k];
	rs += plr * (plr + 1) / 2 * c[k];
}

void up(int n, int k)
{
	rm(n, p[n]);
	p[n] = k;
	ins(n, p[n]);
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin >> d;
	for (int i = 0; i < 26; i++) {
		cin >> c[i];
		st[i].insert(0); st[i].insert(d + 1);
	}
	for (int i = 1; i <= d; i++) {
		for (int j = 0; j < 26; j++)
			cin >> s[i][j];
		p[i] = rand() % 26;
		st[p[i]].insert(i);
	}
	rs = cc();
	double k = 1, sc = 700, kt = 0.99945;
	for (int i = 0; i < 4000000; i++) {
		double e1 = rs;
		int n = (rand() % d) + 1, kp = (rand() % 25) + 1;
		int hk = p[n], tk = (hk + kp) % 26;
		up(n, tk);
		int e2 = rs;
		double pb = exp((e2 - e1) / (k * sc));
		if (pb < rand() / (double)RAND_MAX)
			up(n, hk);
		k *= kt;
	}
	for (int i = 1; i <= d; i++)
		cout << p[i] + 1 << '\n';
	return 0;
}

Measured memory_bytes: 4336
#pragma GCC optimize("O3")
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
typedef  unsigned long long int ull;
typedef pair<ll,ll> P;
template<class T> using V=vector<T>; 
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
const ll inf=(1e18);
//const ll mod=998244353;
const ll mod=1000000007;
//ios_base::sync_with_stdio(false);
//cin.tie(NULL);
ll gcd(ll a,ll b) {return b ? gcd(b,a%b):a;}
ll lcm(ll c,ll d){return c/gcd(c,d)*d;}
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
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 (a>b) { a=b; return 1; } return 0; }
struct mint{
    using ull=unsigned long long int;
    ull v;
    mint(ll vv=0){s(vv%mod+mod);}
    mint& s(ull vv){
        v=vv<mod?vv:vv-mod;
        return *this;
    }
    //オーバーロード
    mint operator-()const{return mint()-*this;}//符号反転
    mint&operator+=(const mint&val){return s(v+val.v);}
    mint&operator-=(const mint&val){return s(v+mod-val.v);}
    mint&operator*=(const mint&val){
        v=ull(v)*val.v%mod;
        return *this;
    }
    mint&operator/=(const mint&val){return *this*=val.inv();}
    mint operator+(const mint&val){return mint(*this)+=val;}
    mint operator-(const mint&val){return mint(*this)-=val;}
    mint operator*(const mint&val){return mint(*this)*=val;}
    mint operator/(const mint&val){return mint(*this)/=val;}
    mint pow(int n)const{
        mint res(1),x(*this);
        while(n){
            if(n&1)res*=x;
            x*=x;
            n>>=1;
        }
        return res;
    }
    mint inv()const{return pow(mod-2);}
    //拡張ユークリッドの互除法
    /* mint inv()const{
        int x,y;
        int g=extgcd(v,mod,x,y);
        assert(g==1);
        if(x<0)x+=mod;
        return mint(x);
    }*/
    friend ostream& operator<<(ostream&os,const mint&val){
        return os<<val.v;
    }//出力
    bool operator<(const mint&val)const{return v<val.v;}
    bool operator==(const mint&val)const{return v==val.v;}
    bool operator>(const mint&val)const{return v>val.v;}
};
const ll MAX = 2000010;//設定
mint fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void init(){
    fac[0] = fac[1] = 1;
    for(int i=1;i<MAX;i++)fac[i]=fac[i-1]*i;
    finv[MAX-1]=fac[MAX-1].inv();
    for(int i=MAX-2;i>=0;i--)finv[i]=finv[i+1]*(i+1);
    for(int i=MAX-2;i>=1;i--)inv[i]=finv[i]+fac[i-1];
}
//階乗
mint factor(ll n,ll k){
  if (n<k) return 0;
  if (n<0 || k<0) return 0;
  return fac[n]*finv[k];
}
// 二項係数計算
mint COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * finv[k] * finv[n - k];
}
int main(){
 int n,k;
 cin>>n>>k;
 mint ans=0;
 init();
 V<ll> d(n); 
 for(int i=0;i<n;i++)cin>>d[i];
 sort(all(d));
 mint cnt=0;
 for(int i=0;i<n-k+1;i++){
        ans-=mint(d[i])*COM(n-i-1,k-1);
 }
reverse(all(d));
mint sum=0;
for(int i=0;i<n-k+1;i++){
        ans+=mint(d[i])*COM(n-i-1,k-1);
 }
cout<<ans<<endl;
}


Measured memory_bytes: 47872
#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>

using namespace std;

#define FOR(i,k,n) for(int i=(k); i<(int)n; ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

template<class T> void debug(T begin, T end){ for(T i = begin; i != end; ++i) cout<<*i<<" "; cout<<endl; }

typedef long long ll;
const int INF = 100000000;
const double EPS = 1e-8;
const int MOD = 1000000007;

int main(){
  int A,B;
  while(cin>>A>>B && A){
    vector<int> x(A);
    vector<int> y(B);
    vector<bool> used(B);
    REP(i,A)cin>>x[i];
    REP(i,B)cin>>y[i];
    int ans = 0;
    REP(i,A)ans += x[i];
    REP(i,B)ans += y[i];
    REP(i,A){
      REP(j,B)if(x[i]==y[j] && !used[j]){
        used[j] = true;
        ans -= y[j];
        break;
      }
    }
    cout<<ans<<endl;
  }
  return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include<vector>
#include<map>
#include<algorithm>
#include <numeric>
#include<cmath>
 
using namespace std;

int main(){
    int N;
    cin >> N;
    int a[N+1];
    int b[N+1];
    vector<int> v;
    a[0]=0;
    b[0]=0;
    int count=0;
    int tmp=0;
    for(int i=0;i<N;i++){
        a[i+1]=0;
        b[i+1]=0;
        cin >> a[i+1];
        if(i>=N/2){
            b[i+1] = a[i+1];
            if(b[i+1]==1){count++;
            v.push_back(i+1);}
        }
    }

    for(int i=N/2;i>0;i--){
        //cout << a[i];
        int total=0;
        int base=1;
        while(base*i<=N){
            total += b[base*i];
            base++;
        }
        b[i] = (total+a[i])%2;
        if(b[i]==1){count++;
        v.push_back(i);}
    }

    cout << count <<endl;
    //for(int i=0;i<N;i++){
    //    cout << b[i+1];
    //}
    if(count>0){
        for(int i=0;i<count;i++){
            cout << v[i] << " ";
        }
    }
}


Measured memory_bytes: 3064
N = int(input())
CSF = [list(map(int, input().split())) for i in range(N-1)]

import math

for i in range(N):
    time = 0
    for csf in CSF[i:]:
        if time <= csf[1]:
            time = csf[1] + csf[0]
        else:
            time = math.ceil((time - csf[1]) / csf[2])*csf[2] + csf[1] + csf[0]
    print(time)

Measured memory_bytes: 42604
#include <bits/stdc++.h>
using namespace std;
long long ans=0;
long long a[200010];
int n,k;
int main()
{
    cin>>n>>k;
    for(int i=1;i<=n;i++)cin>>a[i];
    sort(a+1,a+1+n);
    for(int i=1;i<=n-k;i++)ans+=a[i];
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 1792
def chk(i,j):
    if (j-i+1)%4==0: return 0
    else: return 1

A,B=map(int,input().split())
a,b=A%2,B%2
if a==0 and b==0: print(chk(A,B-1)^B)
elif a==0 and b==1: print(chk(A,B))
elif a==1 and b==0: print(A^chk(A+1,B-1)^B)
elif a==1 and b==1: print(A^chk(A+1,B))

Measured memory_bytes: 3064
N=int(input())
A=list(map(int,input().split()))

LIST=[0]*(10**6+1)

for a in A:
    LIST[a]+=1
ANS=0
for i in range(10**6+1):
    if LIST[i]==1:
        ANS+=1
    if LIST[i]!=0:
        for j in range(2*i,10**6+1,i):
            if LIST[j]!=0:
                LIST[j]+=1
print(ANS)


Measured memory_bytes: 32376
#include<bits/stdc++.h>
using namespace std;
#define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> p2;
#define sz(a) ll(a.size())
ll a[300005],t[1200105],hell=300005;
void change(ll v,ll tl,ll tr,ll pos,ll val){
	if(tl==tr){
		t[v]=max(t[v],val);
		return;
	}
	ll tm=(tl+tr)/2;
	if(pos<=tm)
		change(2*v,tl,tm,pos,val);
	else
		change(2*v+1,tm+1,tr,pos,val);
	t[v]=max(t[2*v],t[2*v+1]);
}
ll get(ll v,ll tl,ll tr,ll l,ll r){
	if(l>r)
		return 0;
	if(l==tl&&r==tr)
		return t[v];
	ll tm=(tl+tr)/2;
	return max(get(2*v,tl,tm,l,min(r,tm)),get(2*v+1,tm+1,tr,max(l,tm+1),r));
}
void solve(){
	ll n,k;
	cin>>n>>k;
	for(ll i=1;i<=n;i++){
		cin>>a[i];
		a[i]++;
	}
	for(ll i=1;i<=n;i++){
		ll x=max(ll(1),a[i]-k),y=min(hell,a[i]+k);
		ll val=get(1,1,hell,x,y)+1;
		change(1,1,hell,a[i],val);
		//cout<<i<<" "<<a[i]<<" "<<get(1,1,hell,a[i],a[i])<<endl;
	}
	cout<<get(1,1,hell,1,hell);
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r" , stdin);
    freopen("output.txt", "w", stdout);
    #endif
    clock_t z=clock();
    ll qc=1;
    //cin>>qc;
    for(ll i=1;i<=qc;i++){
        solve();
    }
    debug("Total Time:%.4Lf\n",(ld)(clock()-z)/CLOCKS_PER_SEC);
}

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

int main(){
  double a, b, h, m; cin >> a >> b >> h >> m;
  double degree_s = h * 30 + m * 0.5;
  double degree_l = m * 6; 
  double diff = abs(degree_l - degree_s);
  diff = min(diff, 360 - diff);
  double PI = 3.141592653589793238;
  double ans = a * a + b * b - 2 * a * b * cos(PI / 180 * diff);
  printf("%.20f\n", sqrt(ans));
}

Measured memory_bytes: 4160
#include<bits/stdc++.h>
#include<algorithm>
#include<math.h>
using namespace std;
long long int lcm(long long int a,long long int b){
  long long int n;
  n=a*b/__gcd(a,b);
  return n;
}
using ll =long long int;
#define ci(a) cin>>a
#define co(a) cout<<a<<endl
#define gcd(a,b) __gcd(a,b)
#define vec vector<ll>
#define for(i,a,b) for(int i=a;i<b;i++)
#define all(a) a.begin(),a.end()
//gcd 最大公約数
//lcm 最小公倍数
//double 少数（変数）
//string 文字列（変数）
//sqrt 平方根
//ceil 天井関数
//floor 床関数
//abs 絶対値
//pow 累乗
//cbrt  立方根
//hypot 平方和の平方根
//sort 降順
//reverse 逆順
 
int main() {
  ll a,b;
  ci(a>>b);
  for(i,b-a+1,b+a)
    co(i);
}

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

using namespace std;

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

    vector<long> a(n+1);
    for(int i=1; i<=n; i++)
        cin >> a[i], a[i] += a[i-1];

    map<long,long> m;
    for(auto &x: a)
        m[x]++;

    long r = 0;
    for(auto &t: m)
        r += t.second * (t.second - 1) / 2;

    cout << r << endl;

}


Measured memory_bytes: 14336
A,B,C=map(int,input().split())
if A==1:
    print('YES')
elif A%2==0 and C%2==1:
    print('NO')
else:
    for b in range(B):
        if ((A%B)*(b+1))%B==C:
            print('YES')
            exit()
    print('NO')


Measured memory_bytes: 3060
/*{{{*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<bitset>
#include<vector>
#include<limits.h>
#include<assert.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(LL &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const LL &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
#ifdef HOME
 #define DEBUG(...) {printf("# ");printf(__VA_ARGS__);puts("");}
#else
 #define DEBUG(...)
#endif
int MOD = 1e9+7;
void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
/*}}}*/
const int SIZE = 1e6+10;
int main(){
    int n; R(n);
    int x=0;
    REP(i,n){
        int v; R(v);
        if(!x)x=v;
        else x=__gcd(x,v);
    }
    W(x);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <sstream>
#include <utility>
#include <iomanip>
#define ll long long int
#define rep(i,x,y) for(int i=x;i<y;i++)
#define rel(i,x,y) for(int i=x-1;i>=y;i--)
#define all(x) x.begin(),x.end()

using namespace std;

int main(){
	int n;
	cin >> n;
	float a[n];
	rep(i,0,n) cin >> a[i];
	float ans=0;
	rep(i,0,n) ans += (1.0/a[i]);
	cout << fixed << setprecision(6) << 1.0/ans << endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void) {                                                                                                                                                                                  
        int n = 0;                                                                                                                                                                                
        scanf("%d", &n);                                                                                                                                                                          
        long ret = 1;                                                                                                                                                                             
        for (; n > 0; n--) {                                                                                                                                                                      
                ret *= n;                                                                                                                                                                         
        }                                                                                                                                                                                         
        printf("%ld\n", ret);                                                                                                                                                                     
                                                                                                                                                                                                  
        return 0;                                                                                                                                                                                 
}

Measured memory_bytes: 2556
#include <iostream>
using namespace std;
int F[100];
int Fibonacci(int N) {
  F[0] = 1;
  F[1] = 1;

  for (int i = 2; i <= N; ++i) {
    F[i] = F[i-2] + F[i-1];
  }
  return F[N];
}
int main() {


  int N;
  cin >> N;
  cout << Fibonacci(N)<<endl;
}

Measured memory_bytes: 3068
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <string>
using namespace std;

typedef long long ll;

int main()
{
	int n, d;
	cin >> n >> d;
	int p = 2 * d + 1;
	int ans = n / p;
	if (n%p != 0)ans += 1;
	cout << ans;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
 
using namespace std;
 
int main() {
  int H, W;
  cin >> H >> W;
  vector<vector<int>> A(H, vector<int>(W));
  for(int i = 0; i < H; i++) {
    for(int j = 0; j < W; j++) {
      cin >> A[i][j];
    }
  }
  vector<pair<pair<int,int>, pair<int,int>>> ans;
  for(int i = 0; i < H; i++) {
    for(int j = 0; j < W - 1; j++) {
      if (A[i][j] % 2 == 1) {
        ans.push_back({{i, j}, {i, j + 1}});
        A[i][j]--;
        A[i][j + 1]++;
      }
    }
  }
  for(int i = 0; i < H - 1; i++) {
    if (A[i].back() % 2 == 1) {
      ans.push_back({{i, W - 1}, {i + 1, W - 1}});
      A[i].back()--;
      A[i + 1].back()++;
    }
  }
  cout << ans.size() << endl;
  for(int i = 0; i < ans.size(); i++) {
    cout << ans[i].first.first + 1 << " " << ans[i].first.second + 1 << " " << ans[i].second.first + 1 << " " << ans[i].second.second + 1 << endl;
  }
  return 0;
}

Measured memory_bytes: 5232