akhauriyash/Code-Regression huggingface dataset:
#include <iostream>      // cout, endl, cin
#include <string>        // string, to_string, stoi
#include <vector>        // vector
#include <algorithm>     // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility>       // pair, make_pair
#include <tuple>         // tuple, make_tuple
#include <cstdint>       // int64_t, int*_t
#include <cstdio>        // printf
#include <map>           // map
#include <queue>         // queue, priority_queue
#include <set>           // set
#include <stack>         // stack
#include <deque>         // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset>        // bitset
#include <cmath>		
#include <stdio.h>
typedef long long ll;
using namespace std;
#define rep(i, n) for (int (i) = 0; (i) < int(n); i++)
#define mod 1000000007
#define fst first
#define pb push_back

int main()
{
	int  N;
	cin >> N;
	vector<pair<string, pair<int, int>>> p(N);
	for (int i = 1;  i <= N; i++) {
		string a;
		cin >> a;
		int b;
		cin >> b;
		b *= -1;
		p[i-1] = make_pair(a, make_pair(b, i));
	}
	sort(p.begin(), p.end());
	for (int i = 0; i < N; i++) {
		cout << p[i].second.second << endl;
	}

}

Measured memory_bytes: 256
h,w = map(int,input().split())
masu = []
for i in range(h):
    tmp = str(input())
    masu.append(tmp)

tmp_h = [int(0) for i in range(h)]
tmp_w = [int(0) for j in range(w)]
for i in range(h):
    for j in range(w):
        if masu[i][j]=='.':
            tmp_h[i] += 1
            tmp_w[j] += 1
#print(tmp_h)
#print(tmp_w)

ans = []
for i in range(len(tmp_h)):
    if tmp_h[i] != w:
        tmp = ''
        for j in range(w):
            if tmp_w[j] != h:
                tmp += masu[i][j]
        ans.append(tmp)

#for i in range(h):
#    print(masu[i])
#print('-----')
for i in range(len(ans)):
    print(ans[i])


Measured memory_bytes: 9236
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <stack>
using namespace std;
//常に心してかかれ
//簡単なことを簡単にできるように練習する
int main(){
	int n;
	int q;
	int tmp;
	int C=0;
	int num_to_check;
	int S[100001];
	int head;
	int tail;
	int mid;//中央値
	stack<int> T;

	cin >>n;

	for(int i=0;i<n;i++){
		scanf("%d",&S[i]);
	}

	/*確認
	for(int i=0;i<n;i++){
		cout <<S[i] <<" ";
	}
	cout <<endl;
	*/

	cin >>q;

	for(int i=0;i<q;i++){
		scanf("%d",&tmp);
		T.push(tmp);
	}

	/*確認
	while(!T.empty()){
		cout <<T.top() <<" ";
		T.pop();
	}
	cout <<endl;
	*/


	//高速化用コード
	int j=1;
	for(int i=1;i<n;i++){
		if(S[i] == S[i-1]){
			;
		}else{
			j++;
			S[j]=S[i];
		}
	}
	n=j+1;
	//

	while(!T.empty()){
		num_to_check = T.top();
		T.pop();
		head = 0;
		tail = n-1;

		
		//キーの探索
		while(head <= tail){

			//高速化用コード
			if(num_to_check < S[0] || num_to_check > S[n-1])
				break;
			//


			if(head == tail){
				if(num_to_check == S[head/*==tail*/]){
					C++;
					break;
				}else{
					break;
				}
			}
			mid = (head+tail)/2;
			if(num_to_check == S[mid]){//見つかった(中央の値と一致)
				C++;
				break;
			}else{//中央の値と一致しない
				if(head == tail-1){
					if(num_to_check == S[head] || num_to_check == S[tail]){
						C++;
						break;
					}
					else{
						break;
					}
				}
				if(num_to_check > S[mid]){//中央の値より大きい
					head = mid+1;
					//cout <<"head" <<head <<"tail" <<tail <<endl;
				}else{//中央の値より小さい
					tail = mid-1;
					//cout <<"head" <<head <<"tail" <<tail <<endl;
				}
			}
		}
	}
	cout <<C <<endl;
	return 0;
}

Measured memory_bytes: 1804
#include<iostream>
#include<queue>

using namespace std;
static const int N = 100;
static const int INFTY = (1 << 21);

int n, M[N][N];
int d[N];

void bfs(int s) {
  queue<int> q;
  q.push(s);
  for ( int i = 0; i < n; i++ ) d[i] = INFTY;
  d[s] = 0;
  int u;
  while( !q.empty() ) {
    u = q.front(); q.pop();
    for ( int v = 0; v < n; v++ ) {
      if ( M[u][v] == 0 ) continue;
      if ( d[v] != INFTY ) continue;
      d[v] = d[u] + 1;
      q.push(v);
    }
  }
  for ( int i = 0; i < n; i++ ) {
    cout << i+1 << " " << ( (d[i] == INFTY) ? (-1) : d[i] ) << endl;
  }
}

int main() {
  int u, k, v;

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

  for ( int i = 0; i < n; i++ ) {
    cin >> u >> k;
    u--;
    for ( int j = 0; j < k; j++ ) {
      cin >> v;
      v--;
      M[u][v] = 1;
    }
  }
  bfs(0);

  return 0;
}


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

const int MOD =1e9+7;

int main(){
  long N;
  cin >> N;
  vector<long> one(61,0);
  for(long i=0; i<N; i++){
    long a; cin >> a;
    for(long j=0; j<=60; j++){
      if(a&1) one[j]++;
      a >>= 1;
    }
  }
  long ans=0, p=1;
  for(long i=0; i<=60; i++){
    ans = (ans + (((p<<i)%MOD)*((one[i]*(N-one[i]))%MOD))%MOD)%MOD;
  }
  cout << ans << endl;
  return 0;
}

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

int main() {
  vector<int> v(3);
  rep(i,3) cin>>v[i];
  sort(v.begin(),v.end());
  cout<<v[0]+v[1]<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <bits/stdc++.h>
#include <iomanip>
#include <numeric>
#include <map>
#include <algorithm>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (ll i = a; i < (ll)b; ++i)

#define rep(i, a, b) for (ll i = a; i < (ll)b; ++i)
#define INF 10e12
#define MAX 51000
#define all(x) (x).begin(), (x).end()
#define MX(x) *max_element(all(x))
#define MN(x) *min_element(all(x))

int main(void)
{
    int n;
    string s;
    cin >> n >> s;
    int len = s.size();
    int ans = 0;
    rep(i, 0, n - 3 + 1)
    {
        if (s[i] == 'A' && s[i + 1] == 'B' && s[i + 2] == 'C')
            ++ans;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
  map<char,ll> m;
  ll N;
  cin>>N;
  ll num1,num2;
  num1=N;
  while(num1){
  	num2+=num1%10;
    num1/=10;
  }
  if(N%num2) cout<<"No"<<endl;
  else cout<<"Yes"<<endl;
}


Measured memory_bytes: 256
a = [[0 for j in range(10)] for i in range(3)]
b = [[0 for j in range(10)] for i in range(3)]
c = [[0 for j in range(10)] for i in range(3)]
d = [[0 for j in range(10)] for i in range(3)]

n = int(input())

efrv = [map(int, input().split()) for _ in range(n)]
e, f, r, v = [list(i) for i in zip(*efrv)]

for num in range(n):
    if e[num] == 1:
        a[f[num]-1][r[num]-1] += v[num]
    elif e[num] == 2:
        b[f[num]-1][r[num]-1] += v[num]
    elif e[num] == 3:
        c[f[num]-1][r[num]-1] += v[num]
    elif e[num] == 4:
        d[f[num]-1][r[num]-1] += v[num]


for fl in a:
    print(" ",end="")
    print(*fl)
print("#" * 20)
for fl in b:
    print(" ",end="")
    print(*fl)
print("#" * 20)
for fl in c:
    print(" ",end="")
    print(*fl)
print("#" * 20)
for fl in d:
    print(" ",end="")
    print(*fl)



Measured memory_bytes: 5636
import java.util.*;
public class Main
{
  public static void main(String args[])
  {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int cnt = 0;
    for(int i = 1;i<=n;i++)
    {
      if((""+i).length()%2!=0){cnt++;}
    }
    System.out.println(cnt);
  }
}

Measured memory_bytes: 34900
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int min = Integer.MAX_VALUE;
        int max = Integer.MIN_VALUE;
        for (int i = 0; i < n; ++i) {
            int r = sc.nextInt();
            max = Math.max(max, r - min);
            min = Math.min(min, r);
        }
        System.out.println(max);
    }
}


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

int main(){
    int N, K;
    std::cin >> N >> K;
    std::vector< int > A;
    std::vector< int > B;
    
    int max = 0;
    
    for(int i=2; i<=N; i++){
        A.push_back(1);
        B.push_back(i);
        max += i - 2;
    }
    
    if(max < K){
        std::cout << -1 << std::endl;
        return 0;
    }else if(max > K){
        for(int i=2; i<=N; i++){
            for(int j=i+1; j<=N; j++){
                A.push_back(i);
                B.push_back(j);
                max--;
                if(max == K){
                    break;
                }
            }
            if(max == K){
                break;
            }
        }
    }
    
    std::cout << A.size() << std::endl;
    for(int i=0; i<A.size(); i++){
        std::cout << A[i] << " " << B[i] << std::endl;
    }
    
    return 0;
}



Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#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 repr(i, a, b) for (int i = a; i >= (b); --i)
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;

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

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

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

  int ans = 9 * max(A, max(B, C)) + A + B + C;
  cout << ans << endl;
}

Measured memory_bytes: 256
//AOJ 0514: QUality Checking
#include <iostream>
using namespace std;
int a, b, c, n, test[1000][4], part[301], jud, jud2;
int main() {
	while (cin >> a >> b >> c){
		cin >> n;
		for (int i = 1; i < a + b + c; i++){
			part[i] = 2;
		}
		for (int i = 0; i < n; i++){
			for (int j = 0; j < 4; j++){
				cin >> test[i][j];
			}
			if (test[i][3] == 1){
				for (int j = 0; j < 3; j++){
					part[test[i][j]] = 1;
				}
			}
		}
		for (int i = 0; i < n; i++){
			if (test[i][3] == 0){
				jud = 0;
				jud2 = 0;
				for (int j = 0; j < 3; j++){
					if (part[test[i][j]] == 1)
						jud++;
					else
						jud2 = j;
				}
				if (jud == 2)
					part[test[i][jud2]] = 0;
			}
		}
		for (int i = 1; i <= a + b + c; i++){
			cout << part[i] << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 1176
#include "iostream"
#include "cmath"
#include "iomanip"
using namespace std;

int main()
{
	double PI = acos(-1);
	double s, l, h;
	double a, b, C, Crad ,c;
	cin >> a >> b >> C;
	Crad = C * PI / 180;
	c = sqrt(a*a + b * b - 2 * a*b*cos(Crad));
	l = a + b + c;
	s = a * b*sin(Crad) / 2;
	h = 2 * s / a;
	cout << fixed << setprecision(4) << s << endl << l << endl << h << endl;
}


Measured memory_bytes: 3444
/*
  AUTHOR:SOURABH
  CREATED:29:11:19
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define ordered_set tree<pll , null_type, less< pll >, rb_tree_tag, tree_order_statistics_node_update>
#define ll long long int
#define ld long double
#define fi first
#define se second
#define pb push_back
#define pob pop_back
#define W while
#define fn(i,x) for(i=0;i<x;i++)
#define fs(i,s,x) for(i=s;i<x;i++)
#define fr(i,x) for(i=x;i>=0;i--)
#define fit(it,s) for(it=s.begin();it!=s.end();it++)
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define mii map<int,int>
#define mll map<ll,ll>
#define mod 1000000007
#define MAX 100005
#define M 32

using namespace std;
using namespace __gnu_pbds;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);

    ll n,x,i,r;
    cin>>x;
    r=x%100;
    if(r==0)
    {cout<<1;return 0;}
    ll dp[100];
    dp[1]=dp[2]=dp[3]=dp[4]=dp[5]=1;
    fs(i,6,100)
    dp[i]=min(dp[i-1],min(dp[i-2],min(dp[i-3],min(dp[i-4],dp[i-5]))))+1;
    if(x>=dp[r]*100)
        cout<<1;
    else
        cout<<0;
    return 0;
}
















Measured memory_bytes: 256
// C++ 14
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <algorithm>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <unordered_map>
#include <math.h>
#include <sstream>
#include <unistd.h>

#define ll long long
#define Int ll
#define loop(x, start, end) for(Int x = start; x < end; x++)
#define loopdown(x, start, end) for(int x = start; x > end; x--)
#define rep(n) for(int __x = 0; __x < n; __x++)
#define span(a,x,y) a.begin()+x,a.begin()+y
#define span_all(a) a.begin(),a.end()
#define len(x) (x.size())
#define last(x) (x.at(x.size()-1))

using namespace std;

#define EPS 0.0000000001
#define MOD 1000000007

class Vector2 {
public:
  double x, y;
  
  Vector2(double x = 0, double y = 0): x(x), y(y) {}
  
  Vector2 operator + (Vector2 v) { return Vector2(x + v.x, y + v.y); }
  Vector2 operator - (Vector2 v) { return Vector2(x - v.x, y - v.y); }
  Vector2 operator * (double k) { return Vector2(x * k, y * k); }
  Vector2 operator / (double k) { return Vector2(x / k, y / k); }
  
  double length() { return sqrt(norm()); }
  double norm() { return x * x + y * y; }
  double dot (Vector2 v) { return x * v.x + y * v.y; }
  double cross (Vector2 v) { return x * v.y - y * v.x; }
  
  bool operator < (const Vector2 &v) const {
    return x != v.x ? x < v.x : y < v.y;
  }
  
  bool operator == (const Vector2 &v) const {
    return fabs(x - v.x) < EPS && fabs(y - v.y) < EPS;
  }
};

ostream & operator << (ostream & out, Vector2 const & v) { 
  out<< "Vector2(" << v.x << ", " << v.y << ')';
  return out;
}

istream & operator >> (istream & in, Vector2 & v) { 
  double x, y;
  in >> x;
  in >> y;
  v.x = x;
  v.y = y;
  return in;
}

Int N;
string S;

void input() {
  cin >> N >> S;
}

void solve() {
  char c_;
  for (auto c: S) {
    c_ = (((c - 'A') + N) % 26) + 'A';
    cout << c_;
  }
  cout << endl;
}

int main(void) {
  input();
  solve();
  return 0;
}



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

int main(void){
    int H, W;
    char g[102][102];
    
    cin >> H >> W;
    
    for(int i = 0; i < H; i++){
        cin >> g[i];
    }
    
    for(int j = 0; j < W; j++){
        int i = 0;
        int delete_flag = 1;
        while(g[i][j]){
            if(g[i][j] == '#'){
                delete_flag = 0;
                break;
            }
            i++;
        }
        if(delete_flag == 1){
            W--;
            for(int k = j; k < W; k++){
                for(i = 0; i < H; i++){
                    g[i][k] = g[i][k + 1];
                }
            }
            j--;
        }
    }
    
    
    for(int i = 0; i < H; i++){
        int delete_flag = 1;
        for(int j = 0; j < W; j++){
            if(g[i][j] == '#'){
                delete_flag = 0;
                break;
            }
        }
        if(delete_flag == 0){
            for(int j = 0; j < W; j++){
                cout << g[i][j];
            }
            cout << endl;
        }
    }
    
    return 0;
}


Measured memory_bytes: 256
/*
これを入れて実行
g++ code.cpp
./a.out
 */
 
#include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>
#include <bitset>
#include <functional>

#define all(x) (x).begin(),(x).end()
 
using namespace std;
typedef long long ll;
typedef long double ld;
 
int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
 
const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;
 
bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}
 
ll gcd(ll a, ll b){
	if (b == 0)return a;
	return gcd(b, a % b);
}
 
ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}
 
ll nCr(ll n, ll r){
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return (nCr(n - 1, r) + nCr(n - 1, r - 1));
}
 
ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}
 
//-----------------------ここから-----------
int main(void){
    int n;
    cin >> n;
    vector<ll> a(n);
    for(int i = 0; i < n; i++) cin >> a[i];
    map<ll,ll> mp;
    for(int i = 0; i < n; i++){
        mp[a[i]]++;
    }
    ll ma1 = 0;
    ll ma1num = 0;
    ll ans = 0;
    for(auto &i : mp){
        if(i.second > 1){
            if(ma1 < i.first){
                ma1 = i.first;
                ma1num = i.second;
            }
        }
    }
    if(ma1num > 3){
       ans = max(ans, ma1 * ma1);
    }
    ll ma2 = 0;
    ll ma2num = 0;
    for(auto &i : mp){
        if(i.second > 1 && i.first != ma1){
            if(ma2 < i.first){
                ma2 = i.first;
                ma2num = i.second;
            }
        }
    }
    if(ma2num > 3){
        ans = max(ans, ma2 * ma2);
    }

    cout << max(ans, ma2 * ma1) << endl;
}   

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

int main(){
  int N;
  cin >> N;
  
  vector<int> d(N);
  for(int i=0; i<N; i++)
    cin >> d.at(i);

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

  if(d.at(N/2) != d.at(N/2-1))
    cout << d.at(N/2) - d.at(N/2-1) << endl;
  else
    cout << 0 << endl;

  
}

Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <set>
#include <cmath>
#include <map>
#include <cstring>
#include <stack>
#include <cstdio>
#include <complex>
#include <iomanip>
#include <cctype>
#include <cassert>
#include <numeric>
#include <climits>
#include <deque>
#include <random>
#include <functional>
#include <unordered_map>
#define rep(i,n) for(int i=0;i < (n); ++i)
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define show(x) cout << #x << " = " << x << endl;
int main(){
    int n,m;
    cin >> n >> m;
    cout << (1900*m+100*(n-m))*(1<<m) << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main(){
  int a,b;
  cin>>a>>b;
  int truee[a];
  int truea[b];
  for(int i=0;i<a;i++) truee[i] = 0;
  for(int i=0;i<b;i++) truea[i] = 0;
  string g[a];
  for(int y=0;y<a;y++){
      cin>>g[y];
  }
  for(int i=0;i<a;i++){
    for(int h=0;h<b;h++){
      if(g[i][h]=='#') {
        truee[i]=1;
        truea[h]=1;
      }
    }
  }
    for(int i=0;i<a;i++){
      if(truee[i]){
        for(int h=0;h<b;h++){
        if(truea[h]) cout<<g[i][h];
        }
                      cout<<endl;
      }
    }
}
  

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

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

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()

const int maxn = 2010;
const int SZ = 2e5;

int N;
vi prs;

int A[maxn];
bool us[maxn], vis[SZ];
vi g[SZ];

void dfs(int v, vi &vec, vi &cmp) {
	vis[v] = 1;
	if (v < N) {
		cmp.pb(v);
	}

	for (int to : g[v]) {
		if (!vis[to]) {
			dfs(to, vec, cmp);
		}
	}
}

vi merge(vi va, vi vb) {
	vi res;
	int tm = va.size() + vb.size();
	va.pb(-1);
	vb.pb(-1);

	int i1 = 0, i2 = 0;

	rep(i, tm) {
		if (va[i1] > vb[i2]) {
			res.pb(va[i1++]);
		} else {
			res.pb(vb[i2++]);
		}
	}

	return res;
}

vi decide(int ban, vi cand) {
	vi res;
	if (cand.size() == 0) {
		return res;
	}

	int mini = 1e9;
	int piv = -1;

	for (int t : cand) {
		if (ban == 0 || __gcd(A[t], ban) != 1) {
			if (mini > A[t]) {
				mini = A[t];
				piv = t;
			}
		}
	}

	vi nx;
	for (int t : cand) if (t != piv) {
		nx.pb(t);
	}

	vi cmp(N);

	for (int v : nx) {
		vis[v] = 0;
		for (int to : g[v]) {
			vis[to] = 0;
		}
	}

	for (int t : nx) if (!cmp[t]) {
		vi vec;
		dfs(t, nx, vec);
		for (int i : vec) {
			cmp[i] = 1;
		}
		vi sub = decide(mini, vec);
		res = merge(res, sub);
	}

	res.insert(res.begin(), mini);

	return res;
}

int main() {
	cin >> N;
	for (int i = 2; i <= 10000; ++i) {
		bool f = 1;
		for (int j = 2; j * j <= i; ++j) {
			if (i % j == 0) {
				f = 0;
			}
		}
		if (f) {
			prs.pb(i);
		}
	}

	vi np;

	rep(i, N) {
		cin >> A[i];
		int x = A[i];
		for (int v : prs) {
			while (x % v == 0) {
				x /= v;
			}
		}
		if (x != 1) {
			np.pb(x);
		}
	}

	sort(ALL(np));
	np.erase(unique(ALL(np)), np.end());
	for (int p : np) {
		prs.pb(p);
	}

	rep(i, N) {
		rep(j, prs.size()) if (A[i] % prs[j] == 0) {
			g[i].pb(j + N);
			g[j + N].pb(i);
		}
	}

	vector<vi> vec;
	vi vx, ans;
	rep(i, N) vx.pb(i);

	rep(i, N) {
		if (!us[i]) {
			vi v;
			dfs(i, vx, v);
			for (int a : v) {
				us[a] = 1;
			}
			auto res = decide(0, v);
			ans = merge(ans, res);
		}
	}

	rep(i, N) printf("%d%c", ans[i], i == N - 1 ? '\n' : ' ');

	return 0;
}

Measured memory_bytes: 50432
#include <bits/stdc++.h>
using namespace std;
 
/* compress
    (X1,Y1),(X2,Y2)という二点で表されるもの（長方形や直線など）について、行か列の片方（X1とX2 or Y1とY2）を座標圧縮する（副作用）
    返り値: ソートされ重複要素を除いた値
    計算量: O(n log n)
*/
template <typename T>
vector<T> compress(vector<T> &C1, vector<T> &C2) {
    vector<T> vals;
    int N = (int)C1.size();
    for (int i = 0; i < N; i++) {
        for (T d = 0; d <= 1; d++) {  // for (T d = 0; d <= 0; d++) でも良い
            T tc1 = C1[i] + d;
            T tc2 = C2[i] + d;
            vals.push_back(tc1);
            vals.push_back(tc2);
        }
    }
    // ソート
    sort(vals.begin(), vals.end());
    // 隣り合う重複を削除(unique), 末端のゴミを削除(erase)
    vals.erase(unique(vals.begin(), vals.end()), vals.end());
    for (int i = 0; i < N; i++) {
        C1[i] = lower_bound(vals.begin(), vals.end(), C1[i]) - vals.begin();
        C2[i] = lower_bound(vals.begin(), vals.end(), C2[i]) - vals.begin();
    }
    return vals;
}
 
int main() {
    // 入力
    int N;
    cin >> N;
    vector<long long> X1(N), Y1(N), X2(N), Y2(N);
    for (int i = 0; i < N; i++) {
        cin >> X1.at(i) >> Y1.at(i) >> X2.at(i) >> Y2.at(i);
    }
 
    // 座標圧縮
    vector<long long> X = compress(X1, X2);
    vector<long long> Y = compress(Y1, Y2);
 
    // imos法で塗りつぶし
    int w = (int)X.size();
    int h = (int)Y.size();
    vector<vector<int>> G(w, vector<int>(h));
    for (int i = 0; i < N; i++) {
        G[X1[i]][Y1[i]]++;
        G[X2[i]][Y2[i]]++;
        G[X1[i]][Y2[i]]--;
        G[X2[i]][Y1[i]]--;
    }
    for (int x = 1; x < w; x++) {
        for (int y = 0; y < h; y++) {
            G[x][y] += G[x - 1][y];
        }
    }
    for (int x = 0; x < w; x++) {
        for (int y = 1; y < h; y++) {
            G[x][y] += G[x][y - 1];
        }
    }
 
    // 塗りつぶしたマスの面積を全て足し合わせる
    long long ans = 0;
    for (int x = 0; x < w - 1; x++) {
        for (int y = 0; y < h - 1; y++) {
            if (G[x][y]) {
                ans += (X[x + 1] - X[x]) * (Y[y + 1] - Y[y]);
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 253340
#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define ll long long int
int main(){
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif 
    ll n,m,ans=0,i;
    cin>>n>>m;
    n+=1;
    ll pre[n+2];
    pre[0] = 0;
    for(i=1;i<=n+1;i++)
        pre[i]=pre[i-1]+i;
    // for(i=0;i<n;i++)
    //     cout<<pre[i]<<" ";
    // cout<<"\n";
    if(m==0){
        ans=(ans+n)%mod;
        m+=1;
    }
    for(i=m;i<n;i++)
        ans=(ans+(pre[n-1]-pre[n-i-1])-(pre[i-1]-pre[0])+1)%mod;
    ans = (ans+1)%mod;
    cout<<ans;
}

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

int main(){

  int H, W, num;
  cin >> H >> W;
  char S[H+2][W+2];
  for(int i=1; i<H+1; i++){
    S[i][0] = '.';
    for(int j=1; j<W+1; j++){
      cin >> S[i][j];
    }
    S[i][W+1] = '.';
  }

  for(int i=1; i<H+1; i++){
    for(int j=1; j<W+1; j++){
      if(S[i][j]=='.'){
        num=0;
        for(int l=i-1; l<i+2; l++){
          for(int p=j-1; p<j+2; p++){
            if(S[l][p]=='#') num++;
          }
        }
        S[i][j] = num+'0';
      }
    }
  }

  for(int i=1; i<H+1; i++){
    for(int j=1; j<W+1; j++){
      cout << S[i][j] << flush;
    }
    cout << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<iomanip>
#include<cmath>
#include<cstring>
#include<functional>
#include<cstdio>
#include<cstdlib>
using namespace std;
 
#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
//#define MOD 998244353
#define LINF (long long)4e18
#define jck 3.141592
 
const double EPS = 1e-10;
 
using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;


 
int main(){
    cout << fixed << setprecision(8);
    int N,K; cin >> N >> K;
    vector<int> p(N);
    rep(i,N) cin >> p[i];
    vector<double> f(N);
    rep(i,N){
        f[i] = (p[i]+1)/2.0;
    }
    vector<double> sum(N+1);
    rep(i,N) sum[i+1] = sum[i]+f[i];
    double ans = 0;
    rep(i,N-K+1){
        ans = max(ans,sum[i+K]-sum[i]);
    }
    cout << ans << endl;
}

Measured memory_bytes: 4096
#include <bits/stdc++.h>
using namespace std;
#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 fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<pll, int> plp;
const ll INF = 1e9+100;
const ll MOD = 1e9+7;
const double EPS = 1e-10;
const bool debug = 0;
//--------------------------------//

int main() {
	int r, g;
	cin >> r >> g;
	
	cout << 2 * g - r << endl;
	return 0;
}

Measured memory_bytes: 256
n = int(input())
t, a = map(int,input().split())
result = 0
min_dif = 9999999

for i, x in enumerate(map(int, input().split())):
    if min_dif > abs(a - (t - x * 0.006)):
        result = i+1
        min_dif = abs(a - (t - x * 0.006))

print(result)

Measured memory_bytes: 3060
# include <bits/stdc++.h>
# define rr register
const int N=1010,INF=0x3f3f3f3f;
int a[N][N];
int H,W,mx;
int sum[N][N];
int ans=1e9;
int r[N],cnt;
int tot[15];
inline int read(void){
	int res,f=1;
	char c;
	while((c=getchar())<'0'||c>'9')
		if(c=='-')f=-1;
	res=c-48;
	while((c=getchar())>='0'&&c<='9')
		res=res*10+c-48;
	return res*f;
}
inline int query(int lx,int ly,int rx,int ry){
	if(lx<0)
		lx=1;
	if(ly<0)
		ly=1;
	return sum[rx][ry]-sum[lx-1][ry]-sum[rx][ly-1]+sum[lx-1][ly-1];
}
int main(void){
	H=read(),W=read(),mx=read();
	for(rr int i=1;i<=H;++i){
		for(rr int j=1;j<=W;++j){
			scanf("%1d",&a[i][j]);
			sum[i][j]=sum[i-1][j]+sum[i][j-1]-sum[i-1][j-1]+a[i][j];
		}
	}
	int maxstate=(1<<(H-1))-1;
	for(rr int i=0;i<=maxstate;++i){
		cnt=0;
		memset(tot,0,sizeof(tot));
		for(rr int j=1;j<H;++j){
			if(i&(1<<(j-1))){
				r[++cnt]=j;
			}
		}
		r[++cnt]=H;
//		for(rr int j=1;j<=cnt;++j){
//			printf("%d ",r[j]);
//		}
//		puts("");
		int ned=0;
		for(rr int k=1;k<=W;++k){
			pre:;
			for(rr int j=1;j<=cnt;++j){
				int L=r[j-1]+1,R=r[j];
				int state=query(L,k,R,k);
				if(state>mx){
					goto End;
				}
				tot[j]+=state;
//				printf("qwq j = %d tot = %d\n",j,tot[j]);
				if(tot[j]>mx){
//					puts("clear!");
					memset(tot,0,sizeof(tot));
					++ned;
					goto pre;
				}
			}	
		}
//		printf("qwq %d answer is %d,%d\n",ans,cnt,ned);
		ans=std::min(ans,cnt+ned-1);
		End:;
	}
	printf("%d",ans);
	return 0;
}


Measured memory_bytes: 2304
N=int(input())
h=list(map(int,input().split()))

ans=0
while sum(h)>0:
  for i in range(N):
    if i<N-1 and h[i]>0 and h[i+1]==0:
      ans+=1
    else:
      if i==N-1 and h[i]>0:
        ans+=1
    if h[i]>0:
      h[i]-=1
  #print(h)
print(ans)


Measured memory_bytes: 3060
#include <stdio.h>
#include<string.h>
#include<stdlib.h>
int main()
{
    int n,k,d;
    scanf("%d %d",&n,&k);
    int snack[n+1],snuck,count=0;
    memset(snack,0,(n+1)*sizeof(snack[0]));
    for(int i=0;i<k;i++)
    {
        scanf("%d",&d);
        for(int i=0;i<d;i++)
        {
            scanf("%d",&snuck);
            snack[snuck]++;
        }
    }
    for(int i=1;i<=n;i++)
    {
        if(!snack[i])
        count++;
    }
    printf("%d",count);
}


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

#define pb push_back
#define fr first
#define sc second
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<int,pii> pip; 
const int INF = (1<<25);
const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};

struct DATA{
  string s;
  int score;
};
int main(){
  int n;
  int cnt=0;
  while(cin>> n,n){
    if(cnt!=0){
      cout<< endl;
    }
    cnt++;
    DATA data[10],temp;
    for(int i=0;i<n;i++){
      int a,b,c;
      cin>> data[i].s>> a>> b>> c;
      data[i].score=a*3+c;
    }

    for(int i=0;i<n;i++){
      for(int j=n-1;j>i;j--){
	if(data[j].score>data[j-1].score){
	  temp=data[j];
	  data[j]=data[j-1];
	  data[j-1]=temp;
	}
      }
    }

    for(int i=0;i<n;i++){
      cout<< data[i].s<< ","<< data[i].score<< endl;
    }
  }
}

Measured memory_bytes: 1212
#include <bits/stdc++.h>
#define ll long long

using namespace std;
const int MAXN = 500005;
const int MOD = 1000000007;

ll arr[MAXN],ans;

int main(){
	ios_base::sync_with_stdio(false); cin.tie(0);
	int n; cin >> n;
	for(int i=1;i<=3*n;i++) cin >> arr[i];
	sort(arr+1,arr+1+3*n);
	for(int i=3*n-1,j=0;j<n;j++,i-=2) ans += arr[i];
	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 2560
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif

#include <bits/stdc++.h>

using namespace std;

typedef long double ld;

#ifdef DEBUG
#define eprintf(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#else
#define eprintf(...) ;
#endif

#define sz(x) ((int) (x).size())
#define TASK "text"

const int inf = (int) 1.01e9;
const long long infll = (long long) 1.01e18;
const ld eps = 1e-9;
const ld pi = acos((ld) -1);

#ifdef DEBUG
mt19937 mrand(300); 
#else
mt19937 mrand(chrono::steady_clock::now().time_since_epoch().count()); 
#endif

int rnd(int x) {
  return mrand() % x;
}

void precalc() {
}

int n;

bool read() {
  if (scanf("%d", &n) < 1) {
    return false;
  }
  return true;
}

vector<pair<int, int>> es;

void solveOdd(int n, int sh) {
  assert(n & 1);
  assert(n >= 3);
  es.push_back(make_pair(sh + n, sh + n - 1));
  es.push_back(make_pair(sh + n - 1, sh + 1));
  es.push_back(make_pair(sh + 1, n));
  es.push_back(make_pair(n, n - 1));
  es.push_back(make_pair(n - 1, 1));
  for (int i = 2; i < n - 1; i += 2) {
    es.push_back(make_pair(i + 1, i));
    es.push_back(make_pair(i, n - 1));
    es.push_back(make_pair(n, sh + i + 1));
    es.push_back(make_pair(sh + i + 1, sh + i));
  }
}

void solve() {
  es.clear();
  if (!(n & (n - 1))) {
    printf("No\n");
    return;
  }
  printf("Yes\n");
  solveOdd(n - ((n & 1) ? 0 : 1), n);
  if (!(n & 1)) {
    int x = 1;
    while (!(n & x)) {
      x <<= 1;
    }
    if (x == 2) {
      es.push_back(make_pair(n, x));
      es.push_back(make_pair(n - x, n + n));
    } else {
      es.push_back(make_pair(n, n - x));
      es.push_back(make_pair(n + x + 1, n + n));
    }
  }
  for (int i = 0; i < sz(es); i++) {
    printf("%d %d\n", es[i].first, es[i].second);
  }
}

int main() {
  precalc();
#ifdef DEBUG
  assert(freopen(TASK ".in", "r", stdin));
  assert(freopen(TASK ".out", "w", stdout));
#endif
  while (read()) {
    solve();
#ifdef DEBUG
    eprintf("Time %.2f\n", (double) clock() / CLOCKS_PER_SEC);
#endif
  }
  return 0;
}


Measured memory_bytes: 4464
#include <bits/stdc++.h>
using namespace std;
#define printArr(harry, tam) range(tam) cout << harry[i] << " \n"[i == tam -1];
#define range(n) for(int i = 0; i < n; i++)
#define maxn 100000
#define mod 1000000007
#define md(x) ((((x) % mod) + mod) % mod)
#define sc scanf
#define pr printf
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define EPS 1e-9
#define INF INT_MAX
#define INFd 1e9

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

//Trace dinamico
template<typename T>
void trace(T a) { cout << a << "\n"; }
template<typename T, typename... Args>
void trace(T a, Args... args) { cout << a << " "; trace(args...); }

//DP debug
int recNum = 0;
void prTabs() { range(recNum) cout << "    "; }
template<typename... Args>
void recInit(Args... args) { prTabs(); trace("rec(", args..., ")"); recNum++; }
template<typename T>
void recEnd(T a) { prTabs(); trace("->", a); recNum--;}
int n, m, a, b, c, k;

int li[100010];

int main(){
	sc("%d %d\n", &n, &k);
	int seq = 0;
	priority_queue<int, vector<int>, greater<int> > pq;

	int restam = k;
	vector<int> inicia1;
	vector<int> fim1;
	int seq0inicio = 0;
	int seq0fim = 0;
	for(int i = 0; i < n; i++) {
		char ch = getchar();
		if (ch == '0') {
			if(inicia1.empty()) {
				seq0inicio++;
			}
			seq0fim++;
			if(seq != 0) {
				fim1.pb(i-1);
			}
			seq = 0;
		} else {
			if (inicia1.empty() && seq0inicio) {
				inicia1.pb(0);
				fim1.pb(i-1);
			}
			seq0inicio = 0;
			seq0fim = 0;
			if (seq == 0) {
				inicia1.pb(i);
			}
			seq++;
		}
	}
	if (seq) {
		fim1.pb(n-1);
	} else {
		inicia1.pb(n-seq0fim);
		fim1.pb(n-1);
	}
	int l = 0;
	int resp = 0;
	int i = 0;
	while(i < inicia1.size()) {
		resp = max(resp, fim1[i] - inicia1[l] + 1);
		if (!restam) l++;
		else restam--;
		i++;
	}
	pr("%d\n", resp);
 	return 0;
}


Measured memory_bytes: 892
#include <bits/stdc++.h>
using namespace std;
#define finish(x) return cout << x << endl, 0;
#define ll long long
#define f first
#define s second
 
int n, m, k;
string s;
vector <string> a;
deque <pair <int, int> > ready;
vector <vector <int> > ans;
int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};
 
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
    cin >> n >> m >> k;
    int x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    ans.assign(n, vector <int>(m, 0));
    for(int i = 0 ; i < n ; i++)
        for(int j = 0 ; j < m ; j++)
            ans[i][j] = 1e9;
    for(int i = 0 ; i < n && cin >> s ; i++)
        a.push_back(s);
    x1--; y1--;
    x2--; y2--;
    ready.push_back(make_pair(x1, y1));
    ans[x1][y1] = 0;
    while(ready.size()){
        auto top = ready.front();
        ready.pop_front();
        for(int i = 0 ; i < 4 ; i++){
            int curx = top.f, cury = top.s;
            for(int j = 1 ; j <= k ; j++){
                curx += dx[i];
                cury += dy[i];
                if(curx >= n || curx < 0 || cury >= m || cury < 0) break;
                if(a[curx][cury] == '@') break;
                if(ans[top.f][top.s] + 1 > ans[curx][cury]) break;
                if(ans[top.f][top.s] + 1 == ans[curx][cury]) continue;
                ans[curx][cury] = ans[top.f][top.s] + 1;
                ready.push_back(make_pair(curx, cury));
            }
        }
    }
    if(ans[x2][y2] == 1e9) cout << -1 << endl;
    else cout << ans[x2][y2] << endl;
    return 0;
}


Measured memory_bytes: 11088
MOD = 10**9 + 7
N = int(input())
X = list(map(int, input().split()))
D = [dj - di for di, dj in zip(X, X[1:])]

def power(n, r, mod=10**9+7):
    if r == 0: return 1
    if r%2 == 0:
        return power(n*n % mod, r//2, mod) % mod
    if r%2 == 1:
        return n * power(n, r-1, mod) % mod

def framod(n, a=1, mod=10**9+7):
    for i in range(1,n+1):
        a = a * i % mod
    return a

count_d = []
frac_Nm1 = framod(N-1)
for i in range(1, N):
  count_d.append(frac_Nm1 * power(i, MOD-2) % MOD)

for i in range(1, N-1):
  count_d[i] += count_d[i-1]


ans = sum([d*c % MOD for d, c in zip(D, count_d)]) % MOD
print(ans)

Measured memory_bytes: 19896
#include <bits/stdc++.h>
using namespace std;
 
int main()
{
    int n;
    cin>>n;
    double ar[n];
    for(int i=0;i<n;i++)
    {
        cin>>ar[i];
    }
    double b[n+1][n+1];
    b[1][0]=1-ar[0];
    for(int i=2;i<=n;i++)
    {
        b[i][0]=b[i-1][0]*(1-ar[i-1]);
    }
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=i;j++)
        {
            if(i==1&&j==1)
            {
                b[i][j]=ar[i-1];
                continue;
            }
            if(j<i)
            {
                //cout<<b[i-1][j]<<" "<<(1-ar[i-1])<<" "<<b[i][j-1]<<" "<<ar[i-1]<<endl;
                b[i][j]=(b[i-1][j]*(1-ar[i-1]))+(b[i-1][j-1]*ar[i-1]);
            }
            if(j==i)
            {
                //cout<<b[i-1][j-1]<<" "<<ar[i-1]<<endl;
                b[i][j]=b[i-1][j-1]*ar[i-1];
            }

        }
    }
    
    double s=0;
    for(int j=(n/2)+1;j<=n;j++)
    {   
        //cout<<fixed<<setprecision(9)<<s<<endl;
        s=s+b[n][j];
    }
    cout<<fixed<<setprecision(9)<<s;
    return 0;
}

Measured memory_bytes: 70272
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define pi 3.141592653589793238
#define int long long
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;


signed main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);  
cout.tie(0);   

#ifndef ONLINE_JUDGE
    if(fopen("INPUT.txt","r"))
    {
    freopen ("INPUT.txt" , "r" , stdin);
    freopen ("OUTPUT.txt" , "w" , stdout);
    }
#endif  

    int n;
    cin>>n;
    int a[n+1];
    for(int i=1;i<=n;i++)
            cin>>a[i];
    if(a[n]>2)
    {
        cout<<-1;
        return 0;
    }
    int l=2,r=3;
    int x,y;
    x=2;
    y=3;
    for(int i=n-1;i>=1;i--)
    {
        r-=r%a[i];
        if(r<x)
        {
            cout<<-1;
            return 0;
        }        
        r+=a[i]-1;
        l=l+(a[i]-l%a[i])%a[i];
        if(l>y)
        {
            cout<<-1;
            return 0;
        }
        if(l>r)
        {
            cout<<-1;
            return 0;
        }
        x=l;
        y=r;
    }
    cout<<l<<" "<<r;
} 


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

using namespace std;
using ll = long long;
using pii = pair<int, int>;

#define in(v) v; cin >> v;
#define rep(i,n) for(int i=0,_i=(n);i<_i;++i)
#define all(f,c,...) (([&](decltype((c)) cccc) { return (f)(begin(cccc), end(cccc), ## __VA_ARGS__); })(c))
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}

int main() {
  int in(N);

  set<string> s;
  rep(i, N) {
    string in(S);
    s.insert(S);
  }
  cout << s.size() << endl;

  return 0;
}


Measured memory_bytes: 19252
#include <cstdio>
using namespace std;

int main() {
	int a, b;
	char op;
	while (1) {
		(void)scanf("%d %c %d", &a, &op, &b);
		if (op == '?') break;
		switch (op) {
		case '+':
			printf("%d\n", a + b);
			break;
		case '-':
			printf("%d\n", a - b);
			break;
		case '*':
			printf("%d\n", a * b);
			break;
		case '/':
			printf("%d\n", a / b);
			break;
		}
	}	
	return 0;
}


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

bool compare(int a, int b) { return abs(a) > abs(b); }

int main() {
  int N, L;
  int W[N];
  int sum = 0;

  cin >> N >> L;

  for (int i = 0; i < N; i++) {
    W[i] = L + i;
  }

  sort(W, W + N, compare);

  for (int i = 0; i < N - 1; i++) {
    sum += W[i];
  }

  cout << sum << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long ll;
const int N=50;
const int M=1<<17;
const int mod=1e9+7;
ll d[N][M+5];
int n,x,y,z;
ll ksm(ll x,int y){
	ll res=1;
	while(y){
		if(y&1)
			res=res*x%mod;
		x=x*x%mod;
		y>>=1;
	}
	return res;
}
bool check(int t){
	if((t&(1<<(x+y+z-1)))!=0&&(t&(1<<(y+z-1)))!=0&&(t&(1<<(z-1)))!=0)
		return 1;
	return 0;
}
int main()
{
	scanf("%d%d%d%d",&n,&x,&y,&z);
	d[0][0]=1;
	ll ans=0;
	for(int i=0;i<n;i++)
		for(int j=0;j<M;j++)
			if(d[i][j]!=0){
				for(int k=1;k<=10;k++){
					int j1=((j<<k)+(1<<(k-1)))%M;
					if(check(j1)){
						ans+=(d[i][j]*ksm(10,n-i-1))%mod;
						ans%=mod;
					}
					else{
						d[i+1][j1]=(d[i+1][j1]+d[i][j])%mod;
					}
				}
			}
	printf("%lld\n",ans);
}


Measured memory_bytes: 41088
L = [[[ 0 for i in range(10)] for j in range(3)] for k in range(4)]
n = int(input())
for i in range(n):
         b,f,r,v = map(int,input().split())
         L[b-1][f-1][r-1] += v
for i in range(4):
         for j in range(3):
                  for k in range(10):
                           print(" {}".format(L[i][j][k]), end = "")
                  print()
         if i + 1 != 4:
                  print("#" * 20)



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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> P;

#define EACH(i,a) for (auto& i : a)
#define FOR(i,a,b) for (ll i=(a);i<(b);i++)
#define RFOR(i,a,b) for (ll i=(b)-1;i>=(a);i--)
#define REP(i,n) for (ll i=0;i<(n);i++)
#define RREP(i,n) for (ll i=(n)-1;i>=0;i--)
#define debug(x) cout<<#x<<": "<<x<<endl
#define pb push_back
#define ALL(a) (a).begin(),(a).end()

const ll linf = 1e18;
const int inf = 1e9;
const double eps = 1e-12;
const double pi = acos(-1);

template<typename T>
istream& operator>>(istream& is, vector<T>& vec) {
    EACH(x,vec) is >> x;
    return is;
}
template<typename T>
ostream& operator<<(ostream& os, vector<T>& vec) {
    REP(i,vec.size()) {
        if (i) os << " ";
        os << vec[i];
    }
    return os;
}
template<typename T>
ostream& operator<<(ostream& os, vector< vector<T> >& vec) {
    REP(i,vec.size()) {
        if (i) os << endl;
        os << vec[i];
    }
    return os;
}

int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    int h, w; cin >> h >> w;
    REP(y, h) REP(x, w) {
        string s; cin >> s;
        if ( s == "snuke" ) {
            cout << (char)('A'+x) << y+1 << endl;
        }
    }
}


Measured memory_bytes: 764
#include<bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define ll long long
#define rep(i,n) for(int i = 0; i < int(n); i++)
#define vi vector<int>
#define INF (1<<30)-1
using namespace std;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
template<class T> inline bool chmax(T &a, const T &b){ if(a<b) { a=b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b){ if(b<a) { a=b; return 1; } return 0; }

int main(){
  cin.tie(0), ios::sync_with_stdio(false);
  int n;  cin >> n;
  vector<pair<int,int>> len(n);
  rep(i,n){
    int x,l; cin >> x >> l;
    len[i].first = x+l;
    len[i].second = x-l;
  }
  sort(all(len));
  int ans = 0, mn = -INF;
  rep(i,n){
    if(mn <= len[i].second){
      ans++;
      mn = len[i].first;
    }
  }
  cout << ans;
  cout << "\n";
  return 0;
}


Measured memory_bytes: 4000
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <iostream>
#include <queue>
#include <unordered_map>
#include <cmath>
#include <queue>
#include <string>
#include <random>
#include <stack>
#include <set>
#include <unordered_set>

#define bug(x) cout<<"zdongdebug: "<<x<<endl;
#define bug2(x, y) cout<<"zdongdebug: "<<x<<" "<<y<<endl;
using namespace std;
typedef unsigned long long ll;
const int maxn = 305;


int main() {
#ifdef suiyuan2009
  freopen("/Users/suiyuan2009/CLionProjects/icpc/input.txt", "r", stdin);
  //freopen("/Users/suiyuan2009/CLionProjects/icpc/output.txt", "w", stdout);
#endif
int n,k;
cin>>n>>k;
if(k==1)printf("0\n");
else
cout<<n-k<<endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define full(a) a.begin(),a.end()
#define rfull(a) a.rbegin(),a.rend()

using namespace std;
const double pi=acos(-1.0);
const double pii=2*pi;
const double eps=1e-6;
const long long MOD=1e9+7;

void solve(){
	int n,l,r,mid;
	cin>>n;
	for(int i=1;i<=n;i++){
		if(int(floor(i*1.08)) == n){
			cout << i << "\n";
			return;
		}
	}
	cout << ":(\n";
}

int main(){
	std::ios::sync_with_stdio(false);
	std::cin.tie(NULL);
	std::cout.tie(NULL);
	
	solve();
	
	return 0;
}

Measured memory_bytes: 256
s = str(input())
s = s[::-1]
t = str(input())
t = t[::-1]

found = False
for i in range(len(s) - len(t) + 1):
    ok = True
    for j in range(len(t)):
        if s[i + j] != "?" and s[i + j] != t[j]:
            ok = False
            break
    if ok:
        found = True
        s = s[:i] + t + s[i + len(t):]
        break

s = s[::-1]
if found:
    print(s.replace("?", "a"))
else:
    print("UNRESTORABLE")

Measured memory_bytes: 38256
using System.Collections.Generic;
using System.Linq;
using System;
class Program
{
    static void Main()
    {
        int count = int.Parse(Console.ReadLine());
        bool[] seats = new bool[100001]; 
        for (int i = 0; i < count; i++){
            string line = Console.ReadLine();
            string[] strs = line.Split(' ');
            int start = int.Parse(strs[0]);
            int end = int.Parse(strs[1]);
            for (int y = start; y <= end; y++){
                seats[y] = true;
            }
        }

        int sitCount = 0;
        for (int i = 0; i < 100001; i++){
            if(seats[i]){
                sitCount++;
            }
        }
        Console.WriteLine(sitCount.ToString());

    }
}

Measured memory_bytes: 13160
using System;
using System.Collections.Generic;
using System.Text;

namespace AtCoder
{
	public class Program
	{
		// ABC104-B
		static void Main(string[] args)
		{
			string S = Console.ReadLine();
			bool result = true;
			int c = 0;
			for (int i = 0; i < S.Length; i++) {
				if (i == 0) {
					if (S[i] != 'A') {
						result = false;
						break;
					}
				} else if ((2 <= i && i <= S.Length - 2) && S[i] == 'C') {
					c++;
				} else if (S[i] < 'a' || 'z' < S[i]) {
					result = false;
					break;
				}
			}
			if (c != 1) {
				result = false;
			}
			if (result) {
				Console.WriteLine("AC");
			} else {
				Console.WriteLine("WA");
			}
		}
	}
}


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

using namespace std;

int main(void){
	long long int i;

	long long int res = 1;

	cin >> i;

	for (long long int j = 1; j <=i; j++){
		res *= j;
		res %= 1000000007;
	}


	cout << res << endl;
}

Measured memory_bytes: 256
object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val N: Int = sc.nextInt
  val monsters :List[Int] = List.fill(N + 1)(sc.nextInt)
  val savers :List[Int] = List.fill(N)(sc.nextInt)

  def go(monster: Int, monsters: List[Int], savers :List[Int], sum: Long): Long = savers match {
    case Nil => sum
    case h::t if h < monster => go(monsters.head, monsters.tail, t, sum + h)
    case h::t => go(math.max(0, monsters.head - (h - monster)), monsters.tail, t, sum + math.min(h, monster + monsters.head))
  }
  println(go(monsters.head, monsters.tail, savers, 0))
}

Measured memory_bytes: 78968
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Main {
	public static Scanner sc = new Scanner(System.in);
	public static void main(String[] args){
		ArrayList<Integer> A = new ArrayList<>();
		for(int i = 0 ; i < 3 ; i++){
			A.add(sc.nextInt());
		}
		Collections.sort(A);
		int tmp=0;
		int cost= 0 ;
		for(int j = 0 ; j < 3 ; j++){
			if(j == 0)
				tmp = A.get(j);
			else {
				cost += Math.abs(A.get(j)-tmp);
				tmp = A.get(j);
			}
		}
		System.out.println(cost);
	}
}


Measured memory_bytes: 21844
#include "bits/stdc++.h"
using namespace std;

#define fi first
#define se second
#define pb push_back
#define int long long
#define all(x) (x).begin(), (x).end()

using LL = long long;
using LD = long double;
using pii = pair<int, int>;
using vii = vector<pii>;

const int INF = 1e18;
const int MOD = 1e9 + 7;
const int N = 1e5 + 5;

int a[N];
int dp[N];

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

    int n;
    cin >> n;

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

    dp[0] = 0;
    for (int i = 0; i < n; i++) {
        dp[i + 1] = min(dp[i + 1], dp[i] + abs(a[i] - a[i + 1]));
        dp[i + 2] = min(dp[i + 2], dp[i] + abs(a[i] - a[i + 2]));
    }

    cout << dp[n - 1] << "\n";
    return 0;
}


Measured memory_bytes: 1792