akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <queue>
#include <vector>
#include <utility>
#include <cassert>
#include <functional>
using namespace std;
 
#define DEBUG(x) // cerr << #x << " = " << x << endl
 
struct Edge {
    int to, cost;
    Edge(int t, int c) : to(t), cost(c) {}
};
 
typedef pair<int, int> P;
 
int main() {
    int N, M; cin >> N >> M;
    vector<vector<Edge> > edges(N);
    vector<int> toMe(N, 0);
    for(int i = 0; i < M; i++) {
        int from, to, cost;
        cin >> from >> to >> cost;
        edges[from].push_back(Edge(to, cost));
        toMe[to]++;
    }
     
    int S = -1, T = -1;
    for(int i = 0; i < N; i++) {
        if(toMe[i] == 0) S = i;
        if(edges[i].empty()) T = i;
    }
    assert(S != -1);
    assert(T != -1);
     
    priority_queue<P, vector<P>, greater<P> > Q;
    Q.push(make_pair(0, S));
    toMe[S]++;
    int ans = (int)1e9;
     
     
    while(!Q.empty()) {
        P p = Q.top(); Q.pop();
        int v = p.second;
        toMe[v]--;
         
        DEBUG(v);
        DEBUG(toMe[v]);
        DEBUG(p.first);
         
        if(v == T && toMe[v] == 0) {
            ans = p.first;
            break;
        }
        if(toMe[v] == 0) {
            for(int i = 0; i < edges[v].size(); i++) {
                Edge e = edges[v][i];
                DEBUG(e.to);
                Q.push(make_pair(e.cost + p.first, e.to));
            }
        }
    }
     
    cout << ans << endl;
}

Measured memory_bytes: 1220
#include<bits/stdc++.h>
using namespace std;
int arr[112345], br[112345], cr[112345];
int main()
{
    int n;
    scanf("%d",&n);
    for(int i = 0; i < n; i++)
    {
        scanf("%d",&arr[i]);
    }
    long long ans = 0, ans1 = 0;
    long long x = 0;
    for(int i = 0; i < n; i++)
    {
        x += arr[i];
        if(i&1)
        {
            //make positive
            if(x <= 0){
            ans += (1 - x);
            x = 1;
            }

        }
        else{
            //make negative
            if(x >= 0)
            {
                ans += x + 1;
                x = -1;
            }
        }
    }
    x = 0;
    for(int i = 0; i < n; i++)
    {
        x += arr[i];
        if(i&1)
        {
            //make negative
            if(x >= 0){ ans1 += x + 1;
            x = -1;
            }

        }
        else{
            if(x <= 0)
            {
                //make positive
                ans1 += (1 - x);
                x = 1;
            }
        }
    }
    cout << min(ans, ans1) << endl;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#ifdef tabr
#include "library/debug.cpp"
#else
#define debug(...)
#endif

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, k, q;
    cin >> n >> k >> q;
    vector<int> a(n);
    vector<pair<int, int>> b(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        b[i] = {a[i], i};
    }
    sort(b.begin(), b.end());
    int ans = b[q - 1].first - b[0].first;
    set<int> st;
    st.emplace(-1);
    st.emplace(n);
    st.emplace(b[0].second);
    for (int ii = 1; ii < n; ii++) {
        if (b[ii].first == b[ii - 1].first) {
            st.emplace(b[ii].second);
            continue;
        }
        vector<int> pos;
        int i = -1;
        for (int j : st) {
            if (j == -1) continue;
            vector<int> t;
            for (int l = i + 1; l < j; l++) {
                t.emplace_back(a[l]);
            }
            if (t.size() >= k) {
                sort(t.begin(), t.end());
                for (int l = 0; l <= t.size() - k; l++) {
                    pos.emplace_back(t[l]);
                }
            }
            i = j;
        }
        if (pos.size() >= q) {
            sort(pos.begin(), pos.end());
            ans = min(ans, pos[q - 1] - pos[0]);
        }
        st.emplace(b[ii].second);
    }
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 384
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
	Scanner sc =new Scanner(System.in);
	double W=sc.nextInt();
	double H=sc.nextInt();
	double x=sc.nextInt();
	double y=sc.nextInt();
	sc.close();

	if(W/2==x&&H/2==y) {
		System.out.println(W*H/2+" "+1);
	}else {
		System.out.println(W*H/2+" "+0);
	}

}

}


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

#define ll long long
#define ld long double

#define pii pair<int, int>
#define pci pair<char, int>
#define pcc pair<char, char>

#define vi vector <int>
#define vll vector<long long>
#define vld vector<long double>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>

#define vvi vector<vi>
#define vvll vector<vll>
#define vvld vector<vld>
#define vvb vector<vb>
#define vvc vector<vc>
#define vvs vector<vs>

#define vpii vector<pii>
#define vpci vector<pci>
#define vpcc vector<pcc>

#define all(v) (v).begin(), (v).end()
#define allrev(v) (v).rbegin(), (v).rend()
#define allcomp(v) (v).begin(), (v).end(), comp
#define allrevcomp(v) (v).rbegin(), (v).rend(), comp

const int MOD = 1e9 + 7;
const ld pi = 3.1415926535897932384626433832;

#define line cout<<"\n";
#define fast ios_base::sync_with_stdio(false) ; cin.tie(0) ; cout.tie(0);



void solve(int test_case){
    int n;
    cin >> n;
    n = n%1000;
    if(n == 0) cout << 0;
    else
    cout << 1000 - n;
}

int main(){
    fast
    int test = 1;
    //cin>>test;
    for(int i = 1; i <= test; i++){
        solve(i);
    }
    return 0;
}


Measured memory_bytes: 3572
# AtCoder Beginner Contest 140
# C - Maximal Value

N=int(input())
Bfirst=[10**5+3]
B=list(map(int,input().split()))
Blast=[10**5+3]
BL=Bfirst+B+Blast

ans=0

for i in range (N):
    ans+= min(BL[i],BL[i+1])

print(ans)

Measured memory_bytes: 9056
#!/usr/bin/env python3

N = int(input().split()[0])
n_list = [int(char) for char in str(N)]

if n_list[0] == 1 and N % 10 == 0:
    ans = 9 * len(n_list[1:])
else:
    total_1 = sum(n_list)
    n_list_2 = n_list[:]
    target_idx = -1
    for i, n in enumerate(n_list):
        if n == 9:
            continue
        else:
            if n != 0:
                target_idx = i
            break
    if target_idx != -1:
        if target_idx == 0:
            n_list_2[0] = n_list[0] - 1
            if len(n_list) > 2:
                n_list_2[1:] = [9] * len(n_list_2[1:])
        else:
            n_list_2[target_idx - 1] = n_list[target_idx - 1] - 1
            n_list_2[target_idx:] = [9] * len(n_list_2[target_idx:])
    total_2 = sum(n_list_2)
    ans = max(total_2, total_1)

print(ans)


Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <vector> //動的配列
#include <string>
#include <list> //双方向リスト
#include <map> //連想配列
#include <set> //集合
#include <stack>
#include <queue>
#include <deque>
#include <cmath>
#include <bitset>
#include <numeric>
#include <tuple>




typedef long long ll;


using namespace std;

typedef pair<int, int> P;
#define FOR(i,a,b) for(int i=(int)(a) ; i < (int) (b) ; ++i )
#define rep(i,n) FOR(i,0,n)



ll fast_pow(ll x,ll n,ll mod){
    if (n==0) return 1;
    ll res=fast_pow(x*x %mod,n/2,mod);
    if (n&1) res=res*x%mod;
    return res;
}

template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

//小さい順から取り出すヒープ
//priority_queue<ll, vector<ll>, greater<ll> > pque1;



int main(){
    string s,t;
    cin>>s>>t;
    vector<vector<int>> v(26);
    int n,m;
    n=s.size();m=t.size();
    rep(i,n) v[s[i]-'a'].push_back(i);
    rep(i,n) v[s[i]-'a'].push_back(n+i);
    ll ans=0;
    int idx=0;
    rep(i,m){
        int a=t[i]-'a';
        if (!v[a].size()) {
            printf("-1");
            return 0;
        }
        auto itr=lower_bound(v[a].begin(),v[a].end(),idx);
        
        ans+=*itr-idx+1;
        //cout<<*itr<<','<<ans<<','<<idx<<endl;
        idx=*itr+1;
        if (*itr>=n) idx-=n;
        
    }
    cout<<ans<<endl;
    
    return 0;
}


Measured memory_bytes: 1724
#include <stdio.h>

int main(void){
	int w;
	char s[100];
	int st = 0;
	int i = 0;
	while(scanf("%d", &w) != EOF){
		st = i = 0;
		while(10 > i){
			if(w & 1 == 1){
				st += sprintf(s+st, "%d ", 1<<i);
			}
			w >>= 1;
			i++;
		}
		s[st - 1] = '\0';
		puts(s);
	}
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
const int INF=1145141919,MOD=1e9+7;
const long long LINF=8931145141919364364,LMOD=998244353;
// const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};

int n,k;
vector<int> a;
// dp[i][j]:=i番目まで使って和jが実現できる
bool dp[5010][5010];
bool DP(int index){
    rep(i,5010)rep(j,5010) dp[i][j]=0;
    dp[0][0]=1;
    for(int i=1;i<=n;i++){
        for(int j=0;j<=k;j++){
            dp[i][j]=dp[i-1][j];
            if(i-1==index) continue;
            if(j-a[i-1]>=0) dp[i][j]=dp[i-1][j-a[i-1]];
        }
    }
    // cout<<a[index]<<endl;
    // rep(j,k+1){
    //     printf("(%d):%d\n",j,dp[n][j]);
    // }
    for(int i=max(k-a[index],0);i<k;i++){
        if(dp[n][i]) return true;
    }
    return false;
}
int main(){
    cin>>n>>k;
    rep(i,n){
        int aa; cin>>aa;
        a.push_back(aa);
    }
    sort(all(a));
    int l=-1,r=n,ans=0;
    while(abs(r-l)>1){
        // cout<<l<<" "<<r<<endl;
        if(!DP((r+l)/2)){
            l=(r+l)/2;
            ans=l+1;
        }
        else r=(r+l)/2;
    }
    cout<<ans<<endl;
    return 0;
}


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

typedef complex<double> P;
const double EPS = 1e-10;
const double INF = 1e9;
const double PI = acos((double)(-1));

int n;
double r, s;
P p[20];
bool canmove[20][20][20];
double dp[10101][20][20] = {0};

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

	cin >> n >> r >> s;
	rep(i, 0, n)
	{
		double x, y; cin >> x >> y; p[i] = P(x, y);
	}

	rep(i, 0, n) rep(j, 0, n) rep(k, 0, n)
	{
		canmove[i][j][k] = false;
		if (i == j) continue;
		if (j == k) continue;
		if (i == k) continue;
		double rr = abs(arg((p[j] - p[i]) / (p[k] - p[j]))) / PI * 180.0;
		if (rr <= s - EPS) canmove[i][j][k] = true;
	}

	rep(i, 0, 10101) rep(j, 0, n) rep(k, 0, n) dp[i][j][k] = INF;

	rep(i, 1, n) dp[1][0][i] = abs(p[0] - p[i]);

	int ans = 0;
	rep(i, 1, 10100) rep(j, 0, n) rep(k, 0, n)
	{
		if (r < dp[i][j][k] + EPS) continue;

		//printf("dp[%d][%d][%d]=%f\n", i, j, k, dp[i][j][k]);

		ans = max(ans, i);

		rep(l, 0, n) if (canmove[j][k][l])
		{
			dp[i + 1][k][l] = min(dp[i + 1][k][l], dp[i][j][k] + abs(p[k] - p[l]));
		}
	}
	cout << ans << endl;
}

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

int main() {
    int n, m;
    cin >> n >> m;
    atcoder::dsu u(n);
    for(int i = 0; i < m; i++) {
        int a, b;
        cin >> a >> b;
        u.merge(a - 1, b - 1);
    }
    cout << u.groups().size() - 1 << endl;
    return 0;
}


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


using namespace std;

bool check(int x)
{
    int i=0;
    while(x)
    {
        i++;
        x/=10;
    }
    if(i&1)return true;
    return false;
}
int ans;
int main()
{
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);

    int n;cin >> n;
    for(int i=1;i<=n;i++)
        if(check(i))ans++;


    cout << ans;


}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include<cmath>
#include<iostream>
#include<cstdio>
#include<iomanip>
using namespace std;
int main() {
	double r;
	cin >> r;
	cout << fixed << setprecision(7);
	cout << r*r*M_PI << " " << 2 * r*M_PI << endl;
	return 0;
}

Measured memory_bytes: 1288
object Main extends App {

  import scala.io.StdIn._

  val mod: Long = 1000000007l
  val Array(h, w) = readLine.trim.split(' ').map(_.toInt)
  val state = Array.tabulate(h){_ ⇒ readLine.trim.map(_ == '.').toArray}
  val counts = Array.tabulate(h){_ ⇒ Array.tabulate(w){_ ⇒ 0L}}.also{arr ⇒ arr(0)(0) = 1L}
  for {i ← 0 until h
       j ← 0 until w}{
      if (i + 1 < h && state(i + 1)(j)){
        counts(i + 1)(j) = (counts(i + 1)(j) + counts(i)(j)) % mod
      }
      if (j + 1 < w && state(i)(j + 1)){
        counts(i)(j + 1) = (counts(i)(j + 1) + counts(i)(j)) % mod
      }
  }
  println(counts.last.last)

  implicit class Extend[T](value: T){
    def also(func: T ⇒ Unit): T = {func(value); value}
    def let[A](func: T ⇒ A): A = func(value)
  }
}

Measured memory_bytes: 45360
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#include <functional>
#include <stack>
#include <numeric>
typedef long long ll;
using namespace std;
const int MOD = (int)1e9 + 7;
const ll INF = (ll)1e18 + 7;
#define int long long
#define vint vector<int>
#define pint pair<int,int>
#define pb(a) push_back(a)
#define all(v) v.begin(),v.end()
#define dbg(x) cerr << #x << " = " << (x) << endl
#define yn(b) cout << ((b) ? "Yes" : "No") << endl
#define YN(b) cout << ((b) ? "YES" : "NO") << endl

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

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

	int A, B;
	cin>>A>>B;

	if(B%A==0){
		cout << A + B << endl;
	}else{
		cout << B - A << endl;
	}

	return 0;
}

Measured memory_bytes: 256
import sys
from bisect import bisect_left
def bin(a, x):
    i = bisect_left(a, x) 
    if i != len(a) and a[i] == x: 
        return True
    else: 
        return False

input = sys.stdin.readline

x, n = list(map(int, input().split()))
lst = list(map(int, input().split()))

lst = sorted(lst)
i = 0
while True:
    if not(bin(lst, x - i)):
        print(x - i)
        break
    elif not(bin(lst, x + i)):
        print(x + i)
        break
    i += 1


Measured memory_bytes: 9180
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
#define mod 1000000007
#define F first
#define S second
#define eb emplace_back
vector<lli>edges[100001];
lli n,m;
lli dp[100001]={},visited[100001]={},maxi=-1,inDegree[100001]={};
void dfs(lli i)
{
    visited[i]=1;
    for(auto j:edges[i])
    {
        dp[j]=max(dp[j],dp[i]+1);
        maxi=max(maxi,dp[j]);
        --inDegree[j];
        if(inDegree[j]==0)
            dfs(j);
    }
}
int main()
{
    //freopen("input.txt","r",stdin);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    lli i,j,flag,a,b;
    cin>>n>>m;
    for(i=0;i<m;i++)
    {
        cin>>a>>b;
        edges[a].eb(b);
        ++inDegree[b];
    }
    for(i=1;i<=n;i++)
    {
        if(visited[i]==0 && inDegree[i]==0)
            dfs(i);
    }
    cout<<maxi;
    return 0;
}


Measured memory_bytes: 11136
import sys
input = sys.stdin.readline
n,a,b=map(int,input().split())
ans=0
for i in range(1,n+1):
    cnt=0
    for j in range(len(str(i))):
        e=str(i)
        cnt+=int(e[j])
    if a<=cnt<=b:
        #print(i)
        ans+=i
print(ans)


Measured memory_bytes: 40684
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <array>


using namespace std;

#define int long long

signed main()
{
    string a, s, d;

    cin >> a >> s >> d;

    cout << a[0] << s[1] << d[2] << endl;

    return 0;
}


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

long long L[100];
int main(){
	int N;
	cin >> N;
	L[0] = 2;
	L[1] = 1;
	for(int i = 2; i <= N; i++){
		L[i] = L[i-1] + L[i-2];
	}
	cout << L[N] <<endl;
	return 0;
}



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

int main() {
  int a,b,i,j,e;
  char d;
  cin>>a>>b;
  vector<string>c(a);
  for(i=0;i<a;i++){
    cin>>c.at(i);
  }
  for(i=-1;i<a+1;i++){
    for(j=-1;j<b+1;j++){
      if(i==-1||j==-1||i==a||j==b)
        cout<<'#';
      else{
        cout<<(c.at(i)).at(j);
      }
  	}
    cout<<endl;
  }
}


Measured memory_bytes: 256
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)
INF = float('inf')

S = list(input())

ans = 0
w_count = 0
for i, s in enumerate(S):
    if s == "W":
        ans += i - w_count
        w_count += 1

print(ans)

Measured memory_bytes: 4968
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(),v.end()
#define INF INT_MAX;
typedef long long ll;
using namespace std;

int main(){
  int x1,y1,x2,y2;
  cin >> x1 >> y1 >> x2 >> y2;
  int x3,y3,x4,y4;
  x3 = x2 + (y1 - y2);
  y3 = y2 - (x1 - x2);
  x4 = x1 + (y1 - y2);
  y4 = y1 - (x1 - x2);

  printf("%d %d %d %d",x3,y3,x4,y4);

}

Measured memory_bytes: 256
a1 = (1, 3, 5, 7, 8, 10, 12)
a2 = (4, 6, 9, 11)
a, b = map(int, input().split())
if a == 2 or b == 2:
    print("No")
    exit()
f = 1
if a in a1 and b in a1:
    f = 0
if a in a2 and b in a2:
    f = 0
print("YNeos"[f::2])

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

typedef long long ll;
typedef pair<int, int> pii;

const int MN = 5010;

int N, M;
int A[MN], B[MN][222];
ll psum[MN];

struct BIT {
    vector<ll> tree, lazy;
    void init() {
        tree = vector<ll>(4 * N, 0);
        lazy = vector<ll>(4 * N, 0);
    }
    void prop(int l, int r, int n) {
        if(l != r) {
            tree[2*n] += lazy[n];
            lazy[2*n] += lazy[n];
            tree[2*n + 1] += lazy[n];
            lazy[2*n + 1] += lazy[n];
            lazy[n] = 0;
        }
    }
    void upd(int a, int b, ll d, int l, int r, int n) {
        if(b < l || r < a) return;
        if(a <= l && r <= b) {
            tree[n] += d;
            lazy[n] += d;
            return;
        }
        prop(l, r, n);
        int m = (l + r)>>1;
        upd(a, b, d, l, m, 2*n);
        upd(a, b, d, m + 1, r, 2*n + 1);
        tree[n] = max(tree[2*n], tree[2*n + 1]);
    }
    ll quer(int a, int b, int l, int r, int n) {
        if(b < l || r < a) return -1e18;
        if(a <= l && r <= b) return tree[n];
        prop(l, r, n);
        int m = (l + r)>>1;
        ll L = quer(a, b, l, m, 2*n);
        ll R = quer(a, b, m + 1, r, 2*n + 1);
        return max(L, R);
    }
} bit;

stack<pii> stk[222];

int main() {
    scanf("%d %d", &N, &M);

    for(int i = 0; i < N - 1; i++) {
        scanf("%d", &A[i]);
    }
    for(int i = 0; i < N; i++) {
        for(int j = 0; j < M; j++) {
            scanf("%d", &B[i][j]);
        }
    }

    for(int i = 1; i < N; i++) {
        psum[i] = A[i - 1];
        psum[i] += psum[i - 1];
    }

    bit.init();
    for(int i = 0; i < N; i++) {
        bit.upd(i, i, -psum[i], 0, N - 1, 1);
    }
    for(int i = 0; i < M; i++) {
        stk[i].push({ 2e9, N });
    }
    ll ans = 0;
    for(int i = N - 1; i >= 0; i--) {
        for(int j = 0; j < M; j++) {
            bit.upd(i, i, B[i][j], 0, N - 1, 1);
            while(!stk[j].empty() && stk[j].top().first <= B[i][j]) {
                pii t = stk[j].top(); stk[j].pop();
                bit.upd(t.second, stk[j].top().second - 1, B[i][j] - t.first, 0, N - 1, 1);
            }
            stk[j].push({ B[i][j], i });
        }
        ans = max(ans, bit.quer(i, N - 1, 0, N - 1, 1) + psum[i]);
    }
    printf("%lld", ans);
}


Measured memory_bytes: 5120
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const int INT_INF = 2147483647;
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; }
typedef pair<int,int> P;

int main(){
  int n,d,a;
  cin >> n >> d >> a;
  P m[n];
  rep(i,n){
    int x,h;
    cin >> x >> h;
    m[i]=P(x,h);
  }
  sort(m,m+n);
  ll totd = 0;
  ll ans = 0;
  queue<pair<ll,ll>> q;
  rep(i,n){
    while(q.size()>0&&q.front().first<m[i].first){
      //calculate totd to apply
      auto p = q.front();
      q.pop();
      totd -= p.second*a;
    }
    ll remain = m[i].second - totd;
    if(remain>0){
      ll c = (remain+a-1)/a;
      ans += c;
      totd += c*a;
      q.push(make_pair(m[i].first+2*d,c));
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 3456
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
using namespace std;
const int mod = 1000000007;
#define ll long long

int main()
{
	string O, E;
	cin >> O >> E;
	for (int i = 0; i < E.size(); i++) {
		cout << O[i] << E[i];
	}
	if (O.size() - E.size() == 1) cout << O[O.size() - 1];
	cout << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <string>
#include <cmath>
using namespace std;
#define MOD 1000000007
#define INF 1<<30
#define LINF (ll)1<<62
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll, ll> P;
typedef vector<pair<ll, ll>> vpl;



int main(){
    ll n,x; cin >> n >> x;
    vl a(n+1,0);
    rep(i,n) cin >> a[i];
    ll ans = 0;
    if(a[0] > x){
        ans += a[0] - x;
        a[0] = x;
    }
    for(ll i=1; i<n; i++){
        ll t = a[i] + a[i-1] - x;
        if(t > 0){
            ans += t;
            a[i] -= t;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <vector>
#include <utility>
#include <complex>

using namespace std;
using LL = long long;
using Arrow = complex<LL>;

class Solution {
public:
	/* time: O(n*log(n)), space: O(1) */
	double engines(vector<Arrow>& arrows) {
		const int n = arrows.size();
		auto compareAngle = [](const auto& a, const auto& b) {
			return atan2(imag(a), real(a)) < atan2(imag(b), real(b));
		};
		make_heap(arrows.begin(), arrows.end(), compareAngle);
		sort_heap(arrows.begin(), arrows.end(), compareAngle);

		Arrow window(0, 0);
		LL ans = 0;
		int R = 0;
		for (int L = 0; L < n; ++L) {
			if (R < L)
				R = L, window = Arrow(0, 0);
			while (R - L < n && norm(window + arrows[R % n]) >= norm(window))
				window += arrows[R % n], ++R;
			ans = max(ans, norm(window)), window -= arrows[L % n];
		}
		return sqrt(ans);
	}
};

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

	vector<Arrow> arrows(n);
	for (int i = 0; i < n; ++i) {
		int x, y;
		cin >> x >> y;
		arrows[i] = Arrow(x, y);
	}

	Solution sol;
	double ans = sol.engines(arrows);
	cout << fixed << setprecision(10) << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int pow(int m,int n){
     int ret=1;
     for(int i=0;i<n;i++)ret*=m;
     return ret;
}
int main(){
     int N,flag=0;
     cin >> N;
     for(int i=0;i<4;i++){
          if (N/pow(10,2-i)==7)flag++;
          N -= N/pow(10,2-i)*pow(10,2-i);
     }
     if (flag !=0){
          cout << "Yes" <<endl;
     }else{
          cout << "No" <<endl;
     }
}


Measured memory_bytes: 3600
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <cmath>
#include <cstring>
#include <ctime>
#include <unordered_map>
#include <iomanip>
using namespace std;

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

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

ll N,a[60];

ll ceil(ll x, ll y){
    if (x<0) return x/y-(x%y!=0);
    else return x/y;
}

bool check(ll t){
    int i;
    ll cnt=0;
    for (i=1; i<=N; i++){
        cnt+=ceil(a[i]+t+1,N+1);
        if (cnt>t) return 0;
    }

    return 1;
}

bool isgood(ll t){
    ll i;
    for (i=t-N; i<=t+N; i++)
        if (i>=0 && check(i)) return 1;
    return 0;
}

int main(){

    cin >> N;

    ll i,sum=0;
    for (i=1; i<=N; i++){
        cin >> a[i];
        sum+=a[i];
    }



    ll l=0,r=2*sum,mid;
    while (l<r){
        mid=(l+r)/2;
        if (isgood(mid)) r=mid;
        else l=mid+1;
    }

    ll res;
    for (i=r-N; i<=r+N; i++)
        if (i>=0 && check(i)){
            res=i;
            break;
        }

    cout << res << "\n";
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
#include<iostream>
#include<string>
#include<vector>
using namespace std;
int main() {
	int K;
	cin >> K;
	int sum = 7;
	bool key = false;
	for (int i = 1; i <= K;i++) {
		if (sum % K == 0) {
			cout << i << endl;
			key = true;
			break;
		}
		sum *= 10;
		sum %= K;
		sum += 7;
		sum %= K;
	}
	if (key == 0)
		cout << -1 << endl;
}

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

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

    if (A+B>=C) {
      cout << "Yes" << endl;
    }else{
      cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>

int dice1[6],dice2[6];
int i,t,clear=0;

int ue=1;
int hid=4;
int mig=3;
int mae=2;
int usi=5;
int sit=6;

void Move2();
void eMove();
void nMove();
void sMove();
void wMove();

int main(){
	for(i=0;i<6;i++)scanf("%d",&dice1[i]);
	for(i=0;i<6;i++)scanf("%d",&dice2[i]);
	
	Move2();
	
	if(clear==1)printf("Yes\n");
	else printf("No\n");
	
	return 0;
}

void Move2(){
	for(i=0;i<5000;i++){
		int rnd=rand()%4;
		
		if(rnd==0)eMove();
		else if(rnd==1)nMove();
		else if(rnd==2)sMove();
		else wMove();
		
		if((dice1[0]==dice2[ue-1])&&(dice1[1]==dice2[mae-1])&&
			(dice1[2]==dice2[mig-1])&&(dice1[3]==dice2[hid-1])&&
			(dice1[4]==dice2[usi-1])&&(dice1[5]==dice2[sit-1])){
			clear=1;
			break;
		}
	}
	return;
}

void eMove(){
	t=ue;
	ue=hid;
	hid=sit;
	sit=mig;
	mig=t;
	return;
}

void nMove(){
	t=ue;
	ue=mae;
	mae=sit;
	sit=usi;
	usi=t;
	return;
}

void sMove(){
	t=ue;
	ue=usi;
	usi=sit;
	sit=mae;
	mae=t;
	return;
}

void wMove(){
	t=ue;
	ue=mig;
	mig=sit;
	sit=hid;
	hid=t;
	return;
}


Measured memory_bytes: 2096
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  char c;
  cin >> c;
 
  if(c=='a'||c=='e'||c=='i'||c=='o'||c=='u'){
    cout << "vowel"<<endl;
}
else{
cout << "consonant" << endl ;
}
}

Measured memory_bytes: 256
##175
##A - Rainy Season
S = str(input())
if "R" in S:
    if S[1] == "S":
        print(1)
    else:
        if S[0] == "R" and S[2] == "R":
            print(3)
        else:
            if S[0] == "S" and S[2] == "S":
                print(1)
            else:
                print(2)
    
else:
    print(0)

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

using namespace std;

#define _for(i,j,N) for(int i = (j); i <(N);i++)

const int maxn = 505;
int bt[maxn][maxn];
int del[maxn];
int dp[2][1<<23];

int n,m;
int ans;

bool is_safe(int d){
    int cnt = 0;
    _for(i,0,n){
        if(!del[i] && bt[i][d] == 1)cnt++;
    }
    return !(cnt%2);
}

bool all_safe(){
    _for(i,0,m){
        if(!is_safe(i)) return false;
    }
    return true;
}


void solver(int d,int res){
    if(d == n){
        if(all_safe()){
            ans = max(ans,res);
        }
        return;
    }

    solver(d+1,res);
    del[d] = 1;
    solver(d+1,res-1);
    del[d] = 0;
}

int get_stat(int d){
    int ret_val = 0;
    int j = 0;
    for(int i = m-1;i>=0;i--){
        ret_val |= (1&bt[d][i])<<j;
        j++;
    }

    return ret_val;
}

void solvedp(){
    memset(dp,-1,sizeof(dp));
    dp[0][0] = 0;

    _for(i,0,n){
        int stat = get_stat(i);
        //printf("%d\n",stat);
        _for(j,0,1<<m){
            int nex = stat^j;
            if(dp[0][j] != -1){
                int n1 = dp[0][j]+1;
                int n2 = dp[0][nex];
                dp[1][nex] = max(n1,n2);
            }
            dp[1][j] = max(dp[1][j],dp[0][j]);
        }

        _for(j,0,1<<m){
            dp[0][j] = dp[1][j];
            dp[1][j] = -1;
        }
    }

    ans = dp[0][0];
}

int main()
{
    while(scanf("%d %d",&n,&m)&&n){
        getchar();
        _for(i,0,n){
            _for(j,0,m) bt[i][j] = getchar()-'0';
            getchar();
        }

        ans = 0;
        memset(del,0,sizeof(del));

        if(n <= 22){
            solver(0,n);
        }
        else{
            solvedp();
        }

        printf("%d\n",ans);
    }
    return 0;
}


Measured memory_bytes: 69732
#include <stdio.h>

int main(void)
{
	int x,y;
	while(1){
		scanf("%d %d",&x,&y);
		if(x==0&&y==0){
			break;
		}
		if(x>y){
			printf("%d %d\n",y,x);
		}
		else{
			printf("%d %d\n",x,y);
		}
	}
	return 0;
}


Measured memory_bytes: 2020
#include <cstdio>
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <tuple>
#include <assert.h>
#include <deque>
#include <bitset>
#include <iomanip>
#include <limits>
#include <chrono>
#include <random>
#include <array>
#include <unordered_map>
#include <functional>
#include <complex>

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

constexpr long long MAX = 5100000;
constexpr long long INF = 1LL << 60;
constexpr int inf = 1 << 28;
constexpr long long mod = 1000000007LL;
//constexpr long long mod = 998244353LL;

using namespace std;
typedef unsigned long long ull;
typedef long long ll;

int a[100001];
int main()
{
	/*
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	*/

	int n, L; scanf("%d %d", &n, &L);
	for (int i = 0; i < n; i++) scanf("%d", &a[i]);
	priority_queue<pair<int, int>> pq;
	for (int i = 0; i < n; i++) pq.emplace(a[i], i);
	vector<int> res(n);
	while (!pq.empty()) {
		int b, id; 
		tie(b, id) = pq.top();
		pq.pop();
		int d = 0;
		for (int i = -1; i <= 1; i++) {
			if (i == 0) continue;
			if (id + i < 0 || id + i >= n) continue;
			chmax(d, res[id + i]);
		}
		res[id] = d + L - b;
	}
	cout << *max_element(res.begin(), res.end()) << endl;
	return 0;
	/*
		おまじないを使ったらscanfとprintf関連注意！！！！！！！！！！！！
	*/
}



Measured memory_bytes: 4532
function main(input) {
  var input=input.trim().split(/\n/);
  var N = Number(input[0].split(" ")[0]);
  var M = Number(input[0].split(" ")[1]);

  var pairs = [];
  for(var i=0;i<M;i++){
    var A = input[i+1].split(" ")[0]-1;
    var B = input[i+1].split(" ")[1]-1;
    pairs.push([A,B]);
  }

  var ans = [];
  var unionFind = new UnionFind(N);
  var tmp = N*(N-1)/2;
  var v, w;
  for(var i=pairs.length-1;i>=0;i--){
    v = pairs[i];
    w = unionFind.getSize(v[0])*unionFind.getSize(v[1]);
    ans.push(tmp);
    if(unionFind.marge(v[0], v[1])==1){
      tmp-=w;
    }
  }
  for(var i=ans.length-1;i>=0;i--){
    console.log(ans[i]);
  }
}
function UnionFind(n){
  this.nodes = [];
  for(var i=0;i<n;i++){
    this.nodes[i] = {
      parent: i,
      size: 1,
      no: i,
    };
  }
};
UnionFind.prototype.getSize = function(x){
  var parentNode = this.root(x);
  return parentNode.size;
}
UnionFind.prototype.root = function(x){
  if(this.nodes[x].parent != x){
    var parentNode = this.root(this.nodes[x].parent);
    this.nodes[x].parent = parentNode.parent;
    return parentNode;
  }
  return this.nodes[x];
};
UnionFind.prototype.marge = function(ax,bx){
  var base = this.root(ax);
  var child = this.root(bx);
  if(base.parent==child.parent) return 0;
  var baseSize = this.getSize(base.no);
  var childSize = this.getSize(child.no);
  if(baseSize > childSize){
    child.parent = base.no;
    base.size += childSize;
  }else{
    base.parent = child.no;
    child.size += baseSize;
  }
  return 1;
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'))


Measured memory_bytes: 64204
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(long long i=0;i<(n);i++)
#define REP1(i,n) for(long long i=1;i<=(n);i++)

typedef long long ll;
#define MAXN 100000
typedef pair<ll,ll> P;
ll n,m,a[MAXN],b[MAXN],c[MAXN];

vector<P> vec;

bool mysort(P a,P b){
	return a.second<b.second;
}

ll curid=0;

int main(){
	cin>>n>>m;
	REP(i,n) cin>>a[i];
	REP(i,m) {cin>>b[i]>>c[i];vec.push_back(P(b[i],c[i]));}
	
	
	sort(a,a+n);
	sort(vec.begin(),vec.end(),mysort);
	REP(i,m){
		ll revid=m-i-1;
		ll bnum=vec[revid].first,cnum=vec[revid].second;
		while(bnum>0&&curid<n&&a[curid]<cnum){
			a[curid++]=cnum;
			
			bnum--;
		}	
	}
	ll res=0;
	REP(i,n)  res+=a[i];
	
	cout<<res<<endl;

  return 0;

}


Measured memory_bytes: 4336
#include <iostream>

using namespace std;

int main()
{
	char a, b;
	
	cin >> a >> b;
	
	if (a > b) {
		cout << ">" << endl;
	}
	else if (a < b) {
		cout << "<" << endl;
	}
	else {
		cout << "=" << endl;
	}
	
	return (0);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1LL << 60;
const ll MOD = 1e9+7;
 
int main(){
  int a, b;
  cin >> a >> b;
  cout << max({a+b, a-b, a*b}) << endl;
  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <chrono>
#include <numeric>



using namespace std;



int main(){
  char s[52][52];
  char r[50][50];
  const char *tmp;
  int h, w;
  string str;
  cin >> h >> w;
  
  for (int i =0;i<=h+1;i++){
    s[i][0] = '.';
    s[i][w+1] = '.';
  }

  for (int j =0;j<=w+1;j++){
    s[0][j] = '.';
    s[h+1][j] = '.';
  }

  for (int i=1;i<h+1;i++) {
    cin >> str;
    tmp = str.c_str();
    strncpy(s[i]+1, tmp, w);
  }
  for (int i=1;i<=h;i++) {
    for (int j=1;j<=w;j++) {
      int score = 0;
      char score_ch[2];
      if (s[i][j]=='.') {
	if (s[i-1][j-1] == '#')
	  score++;
	if (s[i-1][j] == '#')
	  score++;
	if (s[i-1][j+1] == '#')
	  score++;
	if (s[i][j-1] == '#')
	  score++;
	if (s[i][j+1] == '#')
	  score++;
	if (s[i+1][j-1] == '#')
	  score++;
	if (s[i+1][j] == '#')
	  score++;
	if (s[i+1][j+1] == '#')
	  score++;
	sprintf(score_ch, "%d", score);
	r[i-1][j-1] = score_ch[0];
      } else {
	r[i-1][j-1] = '#';
      }
    }
  }
  for (int i=0;i<h;i++) {
    for (int j=0;j<w;j++) {
      cout << r[i][j];
    }
    cout << endl;
  }

}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <stack>
#include <cstdio>
#include <cstdlib>
using namespace std;
int main(){
	string s;
	while(getline(cin,s)){
		stringstream ss;
		stack<double> st;
		string tmp;
		ss<<s;
		while(ss>>tmp){
			if(tmp=="+"){
				double b=st.top();
				st.pop();
				double a=st.top();
				st.pop();
				st.push(a+b);
			}else if(tmp=="-"){
				double b=st.top();
				st.pop();
				double a=st.top();
				st.pop();
				st.push(a-b);
			}else if(tmp=="*"){
				double b=st.top();
				st.pop();
				double a=st.top();
				st.pop();
				st.push(a*b);
			}else if(tmp=="/"){
				double b=st.top();
				st.pop();
				double a=st.top();
				st.pop();
				st.push(a/b);
			}else{
				st.push(atof(tmp.c_str()));
			}
		}
		printf("%.6f\n",st.top());
	}
	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <cctype>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <string>
#include <functional>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#define pb push_back 
#define YES cout<<"YES"<<endl
#define Yes cout<<"Yes"<<endl
#define NO cout<<"NO"<<endl
#define No cout<<"No"<<endl
typedef long long ll;
const int INF = 100000000, mod = 1000000007;
const ll LLINF = 1LL << 50;
using namespace std;


int main() {
    int n, a[100010], dist[100010], sum = 0;
    cin >> n;
    a[0] = 0;
    a[n + 1] = 0;
    for (int i = 1; i <= n; i++)cin >> a[i];
    for (int i = 0; i <= n; i++) {
        dist[i] = abs(a[i] - a[i + 1]);
        sum += dist[i];
    }
    for (int i = 0; i < n; i++) cout << sum - (dist[i] + dist[i + 1]) + abs(a[i + 2] - a[i]) << endl;
    return 0;
}


Measured memory_bytes: 2048
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define floatprec(dig) fixed << setprecision(dig)
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template <class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;} return 0;}
template <class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;} return 0;}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;
const double EPS = 1e-9;

signed main(void) {
  cin.tie(0); ios::sync_with_stdio(false);
  
  int N;
  cin >> N;
  ll prev = LLINF;
  int sec = -1;
  int secmax = 0;
  rep(i, N) {
    ll H;
    cin >> H;
    if(prev >= H) {
      sec++;
      chmax(secmax, sec);
      prev = H;
    } else {
      sec = 0;
      prev = H;
    }
  }
  fin(secmax);
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  N %= 10;
  if (N == 3){
    cout << "bon";
  }
  else if (N == 0 || N == 1 || N == 6 || N == 8){
    cout << "pon";
  }
  else {
    cout << "hon";
  }
}


Measured memory_bytes: 3640
/*
Author: CNYALI_LK
LANG: C++
PROG: E.cpp
*/
#include<bits/stdc++.h>
#define debug(...) fprintf(stderr,__VA_ARGS__)
#define all(x) x.begin(),x.end()
using namespace std;
const double eps=1e-8;
const double PI=acos(-1.0);
typedef long long ll;
template<class T>void chkmin(T &a,T b){a=a<b?a:b;}
template<class T>void chkmax(T &a,T b){a=a>b?a:b;}
template<class T>T sqr(T a){return a*a;}
template<class T>T mmin(T a,T b){return a<b?a:b;}
template<class T>T mmax(T a,T b){return a>b?a:b;}
template<class T>T aabs(T a){return a<0?-a:a;}
#define min mmin
#define max mmax
#define abs aabs
const ll mod=998244353;
ll p[233];
struct zb{
	ll x,y;
};
zb a[233];
ll cmp(zb a,zb b){return a.x<b.x||a.x==b.x&&a.y<b.y;}
int main(){
#ifdef cnyali_lk
	freopen("in.txt","r",stdin);
	freopen("out.txt","w",stdout);
#endif
	ll n,ans;
	scanf("%lld",&n);
	p[0]=1;
	for(ll i=1;i<=n;++i){p[i]=p[i-1]<<1;if(p[i]>=mod)p[i]-=mod;scanf("%lld%lld",&a[i].x,&a[i].y);}
	sort(a+1,a+n+1,cmp);
	ans=p[n]-n-1;
	for(ll i=1;i<=n;++i)for(ll j=i+1;j<=n;++j){
		ll no=0;
		for(ll k=1;k<j;++k)if(k!=i&&(a[j].x-a[i].x)*(a[i].y-a[k].y)==(a[j].y-a[i].y)*(a[i].x-a[k].x)){no=1;break;}
		if(!no){
///			debug("(%lld,%lld) (%lld,%lld)",a[i].x,a[i].y,a[j].x,a[j].y);
			ll tot=2;
			for(ll k=j+1;k<=n;++k){
				if((a[j].x-a[i].x)*(a[i].y-a[k].y)==(a[j].y-a[i].y)*(a[i].x-a[k].x)){++tot;/*debug(" (%lld,%lld)",a[k].x,a[k].y);*/}
			}
//			debug("\n");
			ans-=p[tot]-tot-1;
		}
	}	
	printf("%lld\n",(ans%mod+mod)%mod);
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<utility>
#define MP make_pair
#define F first
#define S second
using namespace std;
long long n, a[100005], b[100005], c[100005], dpa, dpb, dpc, pa, pb, pc;
pair<int,int> Max;
int main(){
	cin >> n;
	for (int i=0;i<n;i++)
		cin >> a[i] >> b[i] >> c[i];
	dpa=a[0], dpb=b[0], dpc=c[0];
	for (int i=1;i<n;i++){
		if (dpa>=dpb&&dpa>=dpc) Max=MP(dpa, 1);
		else if (dpb>=dpa&&dpb>=dpc) Max={dpb, 2};
		else if (dpc>=dpb&&dpc>=dpa) Max={dpc, 3};
		if(Max.S==1) pb=b[i]+Max.F, pc=c[i]+Max.F, pa=a[i]+max(dpb, dpc);
		else if(Max.S==2) pa=a[i]+Max.F, pc=c[i]+Max.F, pb=b[i]+max(dpa, dpc);
		else if(Max.S==3) pa=a[i]+Max.F, pb=b[i]+Max.F, pc=c[i]+max(dpb, dpa);
		dpa=pa, dpb=pb, dpc=pc;
	}
	cout << max({dpa, dpb, dpc});
}

Measured memory_bytes: 2560
i = list(map(int,input().split()))

purasu = i[0] + i[1]
mainasu = i[0] - i[1]
kakeru = i[0] * i[1]

if max(purasu, mainasu, kakeru) == purasu:
    print(purasu)
elif max(purasu, mainasu, kakeru) == mainasu:
    print(mainasu)
elif max(purasu, mainasu, kakeru) == kakeru:
    print(kakeru)

Measured memory_bytes: 3064
n = gets.chomp.to_i
b_arr = [10**5] + gets.chomp.split(" ").map(&:to_i) + [10**5]

a_arr = []
b_arr.each_cons(2).with_index do |(b1, b2), i|
  if b1 >= b2 then
    a_arr[i+1] = b2
  else
    a_arr[i+1] = b1
  end
end

sum = 0
a_arr.each do |a|
  sum += a.to_i
end
puts sum


Measured memory_bytes: 3836
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;
const int inf = 1e9;
const ll INF = 1e18;
const double pi = 3.14159265358979323846;

int main(){
	int n,sw;cin>>n>>sw;
	int w[n],v[n];
	for(int i=0;i<n;i++) cin>>v[i]>>w[i];


	ll dp[n+1][sw+1];for(int i=0;i<=sw;i++) dp[0][i]=0;
	for(int i=0;i<n;i++){
		for(int sum=0;sum<=sw;sum++){
			if(sum>=w[i]) dp[i+1][sum]=max(dp[i][sum],dp[i][sum-w[i]]+v[i]);
			else dp[i+1][sum]=dp[i][sum];
		}
	}

/*	for(int i=0;i<=n;i++){
		for(int sum=0;sum<=sw;sum++){
			cout<<dp[i][sum]<<" ";
		}
		cout<<"\n";
	}
*/
	cout<<dp[n][sw]<<"\n";
}


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

using namespace std;

/*  テンプレここから */
typedef long long ll;

#define rep(i, n) for(int i = 0; i < n; ++i)
#define repi(i, start, end) for(int i = start; i < end; ++i)
#define all(x) (x).begin(), (x).end()
#define INF (1e9)
#define add_mod(a, b, x) ( (ll)(a) + (ll)(b) ) % (ll)(x)
#define mul_mod(a, b, x) ( ((ll)(a) % (ll)(x)) * ((ll)(b) % (ll)(x)) ) % (ll)(x)
#define out(x) cout << (x) << endl;
#define outyes(bool_val) cout << (bool_val ? "yes" : "no") << endl;
#define outYes(bool_val) cout << (bool_val ? "Yes" : "No") << endl;
#define outYES(bool_val) cout << (bool_val ? "YES" : "NO") << endl;
#define outPossible(bool_val) cout << (bool_val ? "Possible" : "Impossible") << endl;
#define outPOSSIBLE(bool_val) cout << (bool_val ? "POSSIBLE" : "IMPOSSIBLE") << endl;

ll sub_mod(ll a, ll b, ll x){
    ll tmp = (a - b) % x;
    if(tmp < 0) tmp += x;
    return tmp;
}
ll gcd(ll a, ll b){
    if(b == 0) return a;
    else return gcd(b, a % b);
}

int dx[] = {0, 1, 0, -1};
int dy[] = {-1, 0, 1, 0};
/*  テンプレここまで */

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

    int a, b, k;
    cin >> a >> b >> k;

    vector<int> num;
    repi(i, 1, max(a, b) + 1){
        if(a % i == 0 && b % i == 0){
            num.emplace_back(i);
        }
    }

    sort(all(num));
    reverse(all(num));
    cout << num[k - 1] << endl;
}

Measured memory_bytes: 256
/*  
    tanuj_johal :: gla_clg_sync_with_CSE(true);
    bonding.tie(true);
    hardwork.tie(true);
    
    ::::::::--------------------::::::::
*/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define ll          long long
#define fio         ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb          push_back
#define vi          vector<ll>
#define pp          push_pop
#define pll         pair<ll,ll>
#define in          insert
#define ff          first
#define ss          second
#define inf         10000000000000000
#define all(p)      p.begin(), p.end()
#define que_max     priority_queue <int>
#define que_min     priority_queue <int, vi, greater<int>>
#define print(a)    for(auto i:a){cout<<i<<" ";}
#define print1(a)   for(auto i:a){cout<<i.ff<<" "<<i.ss<<endl;}

typedef tree<pll, null_type, less<pll>, rb_tree_tag, tree_order_statistics_node_update> Set;


const ll mod = 1e9+7;

ll power(ll x,ll y,ll p){ll r=1;x=x%p;while(y>0){if(y&1)r=(r*x)%p;y=y>>1;x=(x*x)%p;}return r;}

void solve()
{
    unordered_map<ll,ll> mp;          set<ll> st; 
    ll n,m,k;
    string s;
    cin>>n;
    double pi = 6.28318530717958623200;
    pi = pi*(double)n;
    cout<<pi<<endl;




}

int main()
{
    fio
    // int t;cin>>t;while(t--)
    {
        solve();
    }
    
}


Measured memory_bytes: 3772
#define _DEBUG
#include "bits/stdc++.h"
#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0,a1,a2,a3,a4,x,...) x
#define debug_1(x1) cout<<#x1<<": "<<x1<<endl
#define debug_2(x1,x2) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<endl
#define debug_3(x1,x2,x3) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<endl
#define debug_4(x1,x2,x3,x4) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<", "#x4<<": "<<x4<<endl
#define debug_5(x1,x2,x3,x4,x5) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<", "#x4<<": "<<x4<<", "#x5<<": "<<x5<<endl
#ifdef _DEBUG
#define debug(...) CHOOSE((__VA_ARGS__,debug_5,debug_4,debug_3,debug_2,debug_1,~))(__VA_ARGS__)
#else
#define debug(...)
#endif
#define rep(index,num) for(int index=0;index<(int)num;index++)
#define rep1(index,num) for(int index=1;index<=(int)num;index++)
#define brep(index,num) for(int index=(int)num-1;index>=0;index--)
#define brep1(index,num) for(int index=(int)num;index>0;index--)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-7
#define mp(a1,a2) make_pair(a1,a2)
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef long long ll;
typedef long double ld;
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=(ll)1e+18+1;
int INF=1e+9+1;
int main(){
	int N,X,T;
	scan(N>>X>>T);
	prin((N/X+(N%X!=0))*T);
	return 0;
}


Measured memory_bytes: 3568
#include <iostream>
#include <iomanip>
#include <string>
#include <string.h>
#include <math.h>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <utility>
#include <deque>
#include <queue>

#define rep(i, n) for(int i = 0; i < n; ++i)
#define REP(i, m, n) for(int i = m; i < n; ++i)
#define rrep(i,n) for(int i = n; i >= 0; --i)
#define RREP(i, m, n) for(int i = n; i >= m; --i)

using ll = long long;
using ull = unsigned long long;
using pii = std::pair<int, int>;
using pll = std::pair<long long, long long>;

using namespace std;

const long long MOD = 1000000007;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	string s;
	cin >> s;
	deque<char> que;
	rep(i, s.length()) que.push_back(s[i]);

	int q;
	cin >> q;
	int t, f;
	char c;
	bool flag = true;
	rep(i, q) {
		cin >> t;
		if (t == 1) {
			flag = !flag;
		}
		else {
			cin >> f >> c;
			if (flag) {
				if (f == 1) que.push_front(c);
				else que.push_back(c);
			}
			else {
				if (f == 1) que.push_back(c);
				else que.push_front(c);
			}
		}
	}

	if (flag) {
		for (auto i = que.begin(); i != que.end(); ++i) cout << *i;
	}
	else {
		for (auto i = que.rbegin(); i != que.rend(); ++i) cout << *i;
	}

	cout << "\n";

	return 0;
}


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

int main(){
    int n,m,l;
    cin >> n >> m >> l;
    
    int a[n][m],b[m][l];
    long long c[n][l];
    
    for(int i = 0; i < n; i++){
        for(int j = 0; j < l; j++){
            c[i][j] = 0LL;
            }
    }
    
    for(int i = 0; i < n; i++){
        for(int j = 0; j < m; j++){
            cin >> a[i][j];
        }
    }
    
    for(int i = 0; i < m; i++){
        for(int j = 0; j < l; j++){
            cin >> b[i][j];
        }
    }
    
    for(int i = 0; i < n; i++){
        for(int j = 0; j < l; j++){
            for(int k = 0; k < m; k++){
                c[i][j] += a[i][k]*b[k][j]; 
            }
        }
    }
    
    for(int i = 0; i < n; i++){
        for(int j = 0; j < l; j++){
            cout << c[i][j];
            if(j != l-1) cout << " ";
            else cout << endl;
        }
    }
    return 0;
}


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

int main()
{
  vector<int> vec = { 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51 };

  int K;

  cin >> K;

  cout << vec.at(K - 1) << endl;
}

Measured memory_bytes: 256