akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<iomanip>
#include<map>
#include<vector>
#include<algorithm>
#include<cmath>
#include<climits>
#include<ctime>
#include<cstring>
#include<stack>
#include<queue>
#include<sstream>
#include<string>


#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define DUMP(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i);

using namespace std;

const int MAX_V = 31;
const int MAX_S = 31;
const double INF = 9e9;

int n,m,s,g;

struct edge{
	int to, dist, speed;
	edge(int t_to,int t_dist,int t_speed){
		to=t_to;dist=t_dist;speed=t_speed;
	}
};

struct state{
	double cost;
	int c_v,p_v,speed;
	state(int t_c_v,int t_p_v,double t_cost,int t_speed){ 
		c_v=t_c_v;p_v=t_p_v;cost=t_cost;speed=t_speed;
	}
	bool operator>(const state& s) const {
		return cost > s.cost;
	}

};

int ds[]={-1,0,1};
vector< vector<edge> > G(MAX_V);
double d[MAX_V][MAX_V][MAX_S];

void dijkstra(){
	priority_queue<state,vector<state>,greater<state> > que;
	fill_n((double *)d, sizeof(d)/sizeof(double),INF);
	rep(i,G[s].size()){
		edge t_e=G[s][i];
		que.push(state(t_e.to,s,t_e.dist,1));
		d[t_e.to][s][1]=(double)t_e.dist;
	}

	while(!que.empty()){
		state p = que.top(); que.pop();
		int c_v = p.c_v;
		int p_v = p.p_v;

		if( p.c_v == g && p.speed == 1 ){
			cout << p.cost << endl;
			return;
		}

		if(d[c_v][p_v][p.speed]<p.cost) continue;
		rep(i,G[c_v].size()){
			edge e = G[c_v][i];
			if(e.to==p_v) continue;
			rep(j,3){
				if(p.speed+ds[j]>0&&p.speed+ds[j]<=e.speed){
					double cost=p.cost+((double)e.dist/(double)(p.speed+ds[j]));
					if(d[e.to][c_v][p.speed+ds[j]] > cost + 1e-8){
						d[e.to][c_v][p.speed+ds[j]] = cost;
						que.push(state( e.to , c_v , cost , p.speed+ds[j] ));
					}
				}
			}
		}
	}

	cout << "unreachable" << endl;
}


int main(){

	cout << fixed << setprecision(6);

	while(1){
		cin >> n >> m;
		if(n==0&&m==0) break;
		cin >> s >> g;	
		s--;g--;

		G.clear();
		G.resize(MAX_V);

		rep(i,m){
			int a,b,dist,c;
			cin >> a >> b >> dist >> c;
			a--;b--;
			edge tmp1(b,dist,c);
			edge tmp2(a,dist,c);
			G[a].push_back(tmp1);
			G[b].push_back(tmp2);
		}

		dijkstra();
	}
}

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

int main()
{
    int n, x, t;
    cin >> n >> x >> t;
    if(n % x == 0)
    {
        cout << (n / x) * t << endl;
    }
    else
    {
        cout << (n / x) * t + t << endl;
    }
    return (0);
}


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

int main () {
  ios::sync_with_stdio(0);
  cin.tie(0);
  long long n;
  cin >> n;
  n--;
  long long ans = (n * (1LL + n)) / 2LL;
  cout << ans << '\n';
  return 0;
}



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

int main()
{
    ll N, D; cin >> N >> D;
    vector<ll> X(N, 0);
    vector<ll> Y(N, 0);
    rep(i,N) {
        ll x, y; cin >> x >> y;
        X[i] = x;
        Y[i] = y;
    }
    ll ans = 0;
    ll j = D * D;
    rep(i,N) {

        if (X[i] * X[i] + Y[i] * Y[i] <= j) ans++;



    }

    cout << ans << endl;

    




}


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

//def
#include <iostream>

#include <cmath>
#include <algorithm>
#include <iomanip>

//array
#include <vector>
#include <set>
#include <map>

using namespace std;

typedef pair<int,int> Paint;

bool Pairsecond(const Paint& pf,Paint&ps){//sortCompare
  return pf.second < ps.second;
}

#define anyfill(n,s) setw(n) << setfill(s)
#define pb push_back
#define MAX 1000000000
#define MOD 1000000007


/*
確認ポイント
to_string() はC++11以降の実装;
cout<< (char)数値 //数値にあった文字に置き換えられる
cout<< (double)int型/(2など)//小数になる
length(),size()に括弧をつけ忘れてないか;
sort()が使える型//vector,string...
大文字小文字間違えてないか
cout << fixed << 小数計算//正しい小数表記になる(基本6桁)(e記法回避にも使える)
cout << fixed << setprecision(n) << 小数計算//n桁の小数表記になる
sqrt(数値型)でrootが取れる
vector.unique()は隣接した同じ要素を削除するので先にソートをする
*/
int main() { 
  int n;cin>>n;
  if(n==1){
    cout << 1 << endl;
    return 0;
  }
  vector<Paint> mp;
  for(int i = 0; n > i; i++){
    int x,y;
    cin>>x>>y;
    mp.push_back(make_pair(x,y));
  }
  sort(mp.begin(),mp.end());
  vector<Paint> p;
  for(int i = 0; n > i; i++){
    for(int j = i; n > j; j++){
      if(i==j)continue;
      p.push_back(make_pair(mp[i].first-mp[j].first,mp[i].second-mp[j].second));
    }
  }
  sort(p.begin(),p.end());
  int mx = 1;
  int tmp = 1;
  //cout << p.size() << endl;
  for(int i = 1; p.size() > i; i++){
    //cout << p[i].first << " "<< p[i-1].first << " " << p[i].second << " " <<p[i-1].second << endl;
    if(p[i].first == p[i-1].first && p[i].second == p[i-1].second){
      tmp++;
    }else{
      //cout << "ret:" << mx << " " << tmp << endl;
      mx = max(mx,tmp);
      tmp = 1;
    }
  }
  mx = max(mx,tmp);
  cout << n-mx << endl;
  return 0;
}




Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define  ft  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define  ll  long long
ll a[102];
int main()
{
    ft
    ll t,i,j,n,m,l,r;
    cin>>n;
    for(i=0;i<n;i++)
    {
        cin>>a[i];
    }
    ll mn=2e15;
    for(i=-100;i<101;i++)
    {
        ll s=0;
        for(j=0;j<n;j++)
        {
            s+=(a[j]-i)*(a[j]-i);
        }
        mn=min(mn,s);
    }
    cout<<mn<<"\n";
    return 0;
}

Measured memory_bytes: 256
N=int(input());p=[[]for _ in range(N+1)]
for _ in range(N-1):u,v,w=map(int,input().split());p[u].append((v,w));p[v].append((u,w))
s=[(1,0)];l=[-1]*N
while s:
 a,w=s.pop()
 l[a-1]=w%2
 for b,c in p[a]:
  if l[b-1]==-1:s.append((b,w+c))
for i in l:print(i)


Measured memory_bytes: 38828
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
typedef vector<int> vec1;
typedef vector<string> vec2;
typedef vector<double> vec3;
#define rep(i,n) for(int i=0;i<(n);i++)
const int MOD = 1000000007;

int main() {
  string n;
  cin >> n;
  int i = n[n.length() - 1];
  if(i == '2' || i == '4' || i == '5' || i == '7' || i == '9') {
    cout << "hon" << endl;
  } else if(i == '0' || i == '1' || i == '6' || i == '8') {
    cout << "pon" << endl;
  } else {
    cout << "bon" << endl;
  }

}

Measured memory_bytes: 3624
n, k = map(int, input().split())
list_P = list(map(int, input().split()))
cnt = 0

for i in range(k):
    p = list_P[i]
    cnt += (1+p)/2

ans = cnt
for i in range(k, n):
    p, q = list_P[i-k], list_P[i]
    cnt -= (1+p)/2
    cnt += (1+q)/2
    ans = max(ans, cnt)

print(ans)

Measured memory_bytes: 32228
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//namespace mp = boost::multiprecision;

using namespace std;

const double PI = 3.14159265358979323846;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
typedef pair<ll, ll> P;
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

double equal(double a, double b) {
    return fabs(a - b) < DBL_EPSILON;
}

std::istream &operator>>(std::istream &in, set<int> &o) {
    int a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
//const ll mod = 1e10;

typedef priority_queue<ll, vector<ll>, greater<ll> > PQ_ASK;

int main() {
    ll n, m;
    cin >> n >> m;

    set<ll> st;
    for (int i = 1; i * i <= m; i++) {
        if (m % i != 0)continue;
        st.insert(i);
        st.insert(m / i);
    }

    ll ans = 0;
    for (ll i : st) {
        if (m / n >= i) cmax(ans, i);
    }
    cout << ans << endl;
}


Measured memory_bytes: 3572
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//cout << fixed << setprecision(15);
vector<int> forintinput(int n) {
	vector<int> x;
	for(int i = 0;i < n;i++){
		int ia;
		cin >> ia;
		x.push_back(ia);
	}
	return x;
}
int main(){
	int n,k;
	string s;
	cin >> n >> k;
	cin >> s;
	s[k-1] = tolower(s[k-1]);
	cout << s << endl;
}

Measured memory_bytes: 3584
A = [list(map(int, input().split())) for i in range(3)]
N = int(input())
b = []
for i in range(N):
    b.append(int(input()))
x = False
for i in range(3):
    count = 0
    for j in range(3):
        for k in range(N):
            if A[i][j] == b[k]:
                count += 1
    if count == 3:
        x = True
        break
if not x:
    for i in range(3):
        count = 0
        for j in range(3):
            for k in range(N):
                if A[j][i] == b[k]:
                    count += 1
        if count == 3:
            x = True
            break
if not x:
    count = 0
    for i in range(3):
        for k in range(N):

            if A[i][i] == b[k]:
                count += 1
    if count == 3:
        x = True
if not x:
    count = 0
    for i in range(3):
        for k in range(N):
            if A[2-i][i] == b[k]:
                count += 1
    if count == 3:
        x = True

if x:
    print("Yes")
else:
    print("No")








Measured memory_bytes: 3064
# S=list(input())
# pre_i=-1
# result="Good"
# for i in S:
#     if i==pre_i:
#         result="Bad"
#         break
#     else:
#         pre_i=i
# print(result)
temp=list(map(lambda x:int(x),input().split()))
N,L=temp[0],temp[1]

pie_aji_n=0

for i in range(1,N+1):
    pie_aji_n+=L+i-1

apples_aji=[]
for nuki in range(1,N+1):
    pie_aji_temp=0
    for i in range(1,N+1):
        if i==nuki:continue
        else:pie_aji_temp+=L+i-1
    apples_aji.append(pie_aji_temp)
best=1000000
for a in apples_aji:
    kyori=(pie_aji_n-a)**2
    if kyori<(pie_aji_n-best)**2:
        best=a

print(best)


Measured memory_bytes: 3064
#include <iostream>
#include <utility>
using namespace std;
int main(void){
    //入力
  	int ora[5];
  	for(int i=1;i<=4;i++){
      cin >> ora[i];
    }
  
  	int ans[5]={0,1,9,7,4};
  
  	int ok[5];
  	
  	for(int i=1;i<=4;i++){
      if(ora[i]==ans[i]){
        ok[i]=1;
      }else{
        for(int j=i+1;j<=4;j++){
			if(ora[j]==ans[i]){
				swap(ora[j],ora[i]);
              	ok[i]=1;
            }
        }
      }
    }
  int sum=0;
  for(int i=1;i<=4;i++){
    sum += ok[i];
  }
  if(sum==4){
	cout << "YES" << endl;
  }else{
	cout << "NO" << endl;
  }
  	
    return 0;
}

Measured memory_bytes: 256
//
//  replacing_integer.cpp
//  learningCplusplus
//
//  Created by Tran Duc Chinh on 2020/04/04.
//  Copyright © 2020 Tran Duc Chinh. All rights reserved.
//

#include <iostream>

int main(int argc, const char* argv[]) {
  long long n, k;
  std::cin >> n >> k;
  long long result = n%k;

  if(k - result < result) {
      result = k - result;
  }
  std::cout << result << std::endl;
}

Measured memory_bytes: 256
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
k=int(input())
list=[a,b,c,d,e]
ans='Yay!'

for i in list:
  for j in list:
    if j-i > k:
      ans=':('
      
print(ans)

Measured memory_bytes: 3060
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <vector>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<double, ll> state;
typedef vector<vector<ll>> matrix;

int x[100005];
int y[100005];
string d[100005];
int n;

double getArea(double t) {
  double xMax = -1e9;
  double xMin = 1e9;
  double yMax = -1e9;
  double yMin = 1e9;
  for(int i = 0; i < n; i++) {
    double xx = x[i];
    double yy = y[i];
    if(d[i] == "R") xx += t;
    if(d[i] == "L") xx -= t;
    if(d[i] == "U") yy += t;
    if(d[i] == "D") yy -= t;
    xMax = max(xMax, xx);
    xMin = min(xMin, xx);
    yMax = max(yMax, yy);
    yMin = min(yMin, yy);
  }
  return (xMax-xMin) * (yMax-yMin);
}

void solve() {
  cin >> n;
  for(int i = 0; i < n; i++) cin >> x[i] >> y[i] >> d[i];
  double lhs = 0;
  double rhs = 2e8;
  double ret = getArea(0);
  for(int qq = 0; qq < 200; qq++) {
    double a = (2*lhs+rhs)/3;
    double b = (2*rhs+lhs)/3;
    ret = min(ret, getArea(a));
    ret = min(ret, getArea(b));
    if(getArea(a) <= getArea(b)) rhs = b;
    else lhs = a;
  }
  cout << fixed << setprecision(10) << ret << "\n";
}

void casesolve() {
  /*
  int t;
  cin >> t;
  for(int i = 1; i <= t; i++) {
    cout << "Case #" << i << ": ";
    solve();
  }
  */
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL); cout.tie(NULL);
  solve();
  // casesolve();
}


Measured memory_bytes: 8576
#include<bits/stdc++.h>
using namespace std;
#define ll long long
typedef pair<ll, ll> pii;
const int maxn = 2e5 + 10;
const int INF = 0x3f3f3f3f;
const ll inf = 1e18;
const ll mod = 1000000007;
int n;
map<int, int>vis;
bool flg = 1;
int main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		int x;
		cin >> x;
		if (vis[x])flg = 0;
		vis[x] = 1;
	}
	puts(flg ? "YES" : "NO");
	return 0;
};

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

int main(){
  int N,M,X,Y;
  cin>>N>>M>>X>>Y;
  int k=X,l=Y;
  for(int i=0;i<N;i++){
    int j=0;
    cin>>j;
    k=max(k,j);
  }
  for(int i=0;i<M;i++){
    int j=0;
    cin>>j;
    l=min(l,j);
  }
  if(k<l)
    cout<<"No War"<<endl;
  else
    cout<<"War"<<endl;
}

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

int nums[2000005];

int main() {
#ifdef TEST
    freopen("input", "r", stdin);
#endif

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

    int minn = nums[0];
    int maxProfit = INT_MIN;
    for (int j = 1; j < num; ++j) {
        int tmp = nums[j];
        nums[j] -= minn;
        minn = minn < tmp ? minn : tmp;
        if (nums[j] > maxProfit) {
            maxProfit = nums[j];
        }
    }
    printf("%d\n", maxProfit);


    return 0;
}



Measured memory_bytes: 2504
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    string S; cin >> S;
    string K = S;
    int L = 0, R = 0;
    rep(i, S.length()) {
        if(S[i] == '(') L++;
        else R++;
        while(L > 0 && R > 0) {L--; R--;}
        while(R > 0) {
            K = "(" + K;
            R--;
        }
    }
    while(L > 0) {
        K += ')';
        L--;
    }
    cout << K << endl;
    
    return 0;
}
// )))())

Measured memory_bytes: 3656
import bisect
import os
from collections import Counter, deque
from fractions import gcd
from functools import lru_cache
from functools import reduce
import functools
import heapq
import itertools
import math
import numpy as np
import re
import sys
import string

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")


import bisect
import os
from collections import Counter, deque
from fractions import gcd
from functools import lru_cache
from functools import reduce
import functools
import heapq
import itertools
import math
import numpy as np
import re
import sys
import string

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")

#
# A, B, C = list(map(int, sys.stdin.readline().split()))
# a = A
# ok = False
# for _ in range(1000):
#     ok |= a % B == C
#     a += A
# if ok:
#     print('YES')
# else:
#     print('NO')
#
#
# A, B = [int(sys.stdin.readline()) for _ in range(2)]
# if A>B:
#     print('GREATER')
# elif A<B:
#     print('LESS')
# else:
#     print('EQUAL')


O, E = [sys.stdin.readline().rstrip() for _ in range(2)]
ans = ''
for i in range(len(O)):
    ans += O[i]
    if i < len(E):
        ans += E[i]

print(ans)



#
# N, M = list(map(int, sys.stdin.readline().split()))
# A, B = list(zip(*[map(int, sys.stdin.readline().split()) for _ in range(N)]))
# C, D = list(zip(*[map(int, sys.stdin.readline().split()) for _ in range(M)]))
#
# O, E = [sys.stdin.readline().rstrip() for _ in range(2)]
# ans = ''
# for i in range(len(O)):
#     ans += O[i]
#     ans += E[i]
#
# print(ans)


Measured memory_bytes: 13624
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;
using System.Text.RegularExpressions;

namespace Yuzuki
{
    class Yukari
    {
        public static void Main(string[] args)
        {
            string s, t;
            s = Console.ReadLine();
            t = Console.ReadLine();
            Console.WriteLine(s.Length + 1 == t.Length && t.Substring(0, t.Length-1) == s ? "Yes" : "No");
        }
    }
}

Measured memory_bytes: 25780
S = input()

f = int(S[0]+S[1])
s = int(S[2]+S[3])

if f >= 1 and f <= 12 and s >= 1 and s <= 12:
  print('AMBIGUOUS')
elif f >= 1 and f <=12 and (s >= 13 or s == 0):
  print('MMYY')
elif (f >= 13 or f == 0) and s >= 1 and s <= 12:
  print('YYMM')
else:
  print('NA')

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

int main(){
    int n;
    cin >> n;
    vector<int> v;
    for(int i=0; i<n; i++){
        int a;
        cin >> a;
        if(i%2 == 0) v.push_back(a);
        else v.insert(v.begin(), a);
    }
    if(n%2 == 1) reverse(v.begin(), v.end());
    for(int i=0; i<n; i++){
        if(i == n-1) cout << v[i] << endl;
        else cout << v[i] << " ";
    }
    return 0;
}

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

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

int MOD = 1e9 + 7;
ll INF = 1e18;

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

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

    int sum1=0, sum2=0;
    for(int i=0; i<n; i++){
        if(s[i] == '('){
            sum1++;
        }
        else{
            if(sum1 > 0){
                sum1--;
            }
        }
    }
    
    for(int i=n-1; i>=0; i--){
        if(s[i] == ')'){
            sum2++;
        }
        else{
            if(sum2 > 0){
                sum2--;
            }
        }
    }
    cout << string(sum2, '(') << s << string(sum1, ')') << endl;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void){
  int n,i,flag,cnt=0;
  scanf("%d",&n);
  int a[n];
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
  }
  while(1){
    flag=0;
    for(i=0;i<n;i++){
      if(a[i]%2==0){
        a[i] = a[i]/2;
        cnt++;
        flag=1;
      }
    }
    if(flag==0){
      break;
    }
  }
  
  printf("%d\n",cnt);
  
  return 0;
}
        

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

using namespace std;
#define ll long long int

int main()
{
    int N, X;
    cin >> N >> X;

    int m[N];
    int min = INT_MAX;
    int sum = 0;
    for (int i = 0; i < N; i++)
    {
        cin >> m[i];
        sum += m[i];
        if (min > m[i])
            min = m[i];
    }

    int remainder = X - sum;
    if (remainder <= 0)
        cout << N;
    else
    {
        int rest = remainder / min;
        cout << N + rest;
    }
    
    return 0;
}


Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll gcd(ll a,ll b){
    if(b==0){
        return a;
    }else{
        return gcd(b,a%b);
    }
}

int main(){
    ll N; cin>>N;
    vector<ll> A(N);
    ll m=1000000007;
    for (int i = 0; i < N; i++){
        cin>>A[i];
        m=min(A[i],m);
    }
    ll ans=1000000007;
    for (int i = 0; i < N-1; i++){
        ll x=gcd(A[i],A[i+1]);
        ans=min(ans,x);
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 1024
fun main(args: Array<String>) {
    val a = readLine()?.toInt() ?: return
    val b = readLine()?.toInt() ?: return
    val c = readLine()?.toInt() ?: return
    val x = readLine()?.toInt() ?: return

    val count = 0.until(a + 1).map { it * 500 }.map { i ->
        0.until(b + 1).map { it * 100 }.map { j ->
            0.until(c + 1).map { it * 50 }.map { k ->
                i + j + k == x
            }
        }.flatten()
    }.flatten().count { it }

    println(count.toString())
}


Measured memory_bytes: 40316
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
#include <map>

#define ll long long
#define REP(i,n) for(int i = 0; i < n; i++)
#define PI 3.141592653589
#define MOD 1000000007

using namespace std;

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

void solve_A(){
    string s;
    string t;
    cin >> s;
    cin >> t;

    int n = s.size();
    bool flag = true;
    REP(i,n){
        if(s[i] != t[i]) flag = false;
    }

    int m = t.size();
    if((m == n + 1) && flag){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

int main(void){
    solve_A();
    
    return 0;
}

Measured memory_bytes: 3628
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 競プロ_Csharp {
    class Program {
        static void Main(string[] args) {

            while (true) {

                int[] ar = NextInts();
                if (ar[0] == 0 && ar[1] == 0) return;

                int h = ar[0], w = ar[1];

                //print flame
                for (int i = 0; i < h; i++) {
                    string s = "";
                    for (int j = 0; j < w; j++) {
                        
                        if ((i % 2 == 0 && j % 2 == 0) || (i % 2 == 1 && j % 2 == 1)) {
                            s += "#";
                        }
                        else {
                            s += ".";
                        }

                    }
                    Println(s);
                }


                Println("");

            }

        }

        public static void Println (Object o) {
            Console.WriteLine(o);
        }

        public static string NextString() {
            return Console.ReadLine();
        }

        public static string[] NextStrings () {
            return Console.ReadLine().Split();
        }

        public static int NextInt () {
            return int.Parse(Console.ReadLine());
        }

        public static int[] NextInts () {
            string[] a = Console.ReadLine().Split();
            int[] b = new int[a.Length];
            for (int i = 0; i < a.Length; i++) {
                b[i] = int.Parse(a[i]);
            }
            return b;
        }

        public static double NextDouble () {
            return double.Parse(Console.ReadLine());
        }

    }
}



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

using namespace std;

typedef long long ll;

int main(){
    int x,y,z;
    cin >> x >> y >> z;
    double h[1005];
    int ans;
    double anst = 999999;
    for(int a = 0; a < x; a++){
        cin >> h[a];
        if(anst > abs(z-y+h[a]*0.006)){
            ans = a+1;
            anst = abs(z-y+h[a]*0.006);
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ADD(a, b) a = (a + ll(b)) % mod
#define MUL(a, b) a = (a * ll(b)) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define all(a) (a).begin(), (a).end()
#define sz(v) (int)(v).size()
#define pb push_back
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<int, pi> ppi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> mat;
typedef complex<double> comp;
void Debug() {cerr << '\n'; }
template<class FIRST, class... REST>void Debug(FIRST arg, REST... rest){
	cerr<<arg<<" ";Debug(rest...);}
template<class T>ostream& operator<<(ostream& out,const vector<T>& v) {
	out<<"[";if(!v.empty()){rep(i,0,sz(v)-1)out<<v[i]<<", ";out<<v.back();}out<<"]";return out;}
template<class S, class T>ostream& operator<<(ostream& out,const pair<S, T>& v){
	out<<"("<<v.first<<", "<<v.second<<")";return out;}
const int MAX_N = 500010;
const int MAX_V = 100010;
const double eps = 1e-6;
const ll mod = 1000000007;
const int inf = (1 << 30) - 1;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;
mt19937 rng; //use it by rng() % mod, shuffle(all(vec), rng)
///////////////////////////////////////////////////////////////////////////////////////////////////

int N;
string S;
int A[MAX_N];

bool C(int m) {
	rer(i, N, 0) {
		if(S[i] == 'g') {
			if(m) {
				A[i] = 1;
				m--;
			}
			else A[i] = 0;
		}
		else {
			A[i] = 1;
		}
	}
	if(m) return false;
	int a = 0, b = 0;
	rep(i, 0, N) {
		a += A[i] == 0;
		b += A[i] == 1;
		if(a < b) return false;
	}
	return true;
}

void solve() {
	cin >> S;
	N = sz(S);
	int ok = 0, ng = N;
	while(abs(ok - ng) > 1) {
		int m = (ok + ng) / 2;
		if(C(m)) ok = m;
		else ng = m;
	}
	cout << ok << "\n";
}

uint32_t rd() {
	uint32_t res;
#ifdef __MINGW32__
	asm volatile("rdrand %0" :"=a"(res) ::"cc");
#else
	res = std::random_device()();
#endif
	return res;
}

int main() {
#ifndef LOCAL
	ios::sync_with_stdio(false);
    cin.tie(0);
#endif
    cout << fixed;
	cout.precision(20);
    cerr << fixed;
	cerr.precision(6);
	rng.seed(rd());
#ifdef LOCAL
	//freopen("in.txt", "wt", stdout); //for tester
	if(!freopen("in.txt", "rt", stdin)) return 1;
#endif	
	solve();
    cerr << "Time: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
	return 0;
}



Measured memory_bytes: 848
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int[] num = new int[n];
		for (int i = 0; i < n; i++) {
			num[i] = scan.nextInt();
		}
		int max = num[0], min = num[0];
		long sum = num[0];
		for (int i = 1; i < n; i++) {
			if (max < num[i]) {
				max = num[i];
			}
			if (min > num[i]) {
				min = num[i];
			}
			sum += num[i];
		}
		System.out.println(min + " " + max + " " + sum);

	}

}

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

void solve() {
    int x, y, z;
    cin >> x >> y >> z;
    cout << z << " " << x << " " << y << endl;
}

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


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

using namespace std;

#define pb push_back
#define nl '\n'
#define pi 2.0*acos(0.0)
#define mod maxm+7
#define FOR(i,j,n)    for(ll i=j;i<n;i++)
#define RFOR(i,j,n)    for(ll i=j;i>=n;i--)
#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
typedef long long int ll;
typedef unsigned long long ull;
typedef long double ld;

int main(){
    ll n;
    cin>>n;
    cout<<setprecision(20)<<fixed<< pi * n * 2 << nl;
}


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

#define xin() main()
#define ru(a) if(a)
#define ruguo(a) else if(a)
#define baai(a) while(a)
#define sai(j,n) for(sei j=0;j<sei(n);++j)
#define gsai(j,n) for(sei j=sei(n)-1;j>=0;--j)
#define kan(j,m,n) for(sei j=m;j<sei(n);++j)
#define gkan(j,m,n) for(sei j=sei(n)-1;j>=sei(m);--j)
#define ta else
#define datu break
#define zi continue;
#define hen return
#define zen(h) (h).begin(),(h).end()
#define seiri(h) sort(zen(h))
#define yu(h) h.erase(unique(zen(h)), h.end())
#define gyaku(a) reverse(zen(a))
#define katu &&
#define mata ||
#define nyu(a) cin >> a
#define syutu(a) cout << a << endl
#define tuika(a,b) a.push(b)
#define huka(a,b) a.push_back(b)
#define tou(a) a.top()
#define kuu(a) a.empty()
#define xya(a) a.pop()
#define cyou(a) a.size()
#define tyou(a) a.length()
#define sen first
#define go second
#define sosei(a,b) make_pair(a,b)
#define kouzoutai struct
#define kigou operator
#define sin true
#define gi false
#define tei const
#define mugen 10000000111
#define yo 10000000711
#define kyou 1e-9

using namespace std;

typedef int seisu;
typedef void mu;
typedef long long sei;
typedef long double xyo;
typedef string moji;
typedef pair<sei, sei> so;
typedef pair<xyo, xyo> sox;
typedef vector<sox> hsox;
typedef vector<sei> hs;
typedef vector<hs> hhs;
typedef vector<xyo> hx;
typedef vector<hx> hhx;
typedef vector<moji> hm;
typedef vector<so> hso;
typedef vector<hso> hhso;
typedef bool singi;
typedef vector<singi>  hsi;
typedef vector<hsi> hhsi;
typedef priority_queue<sei> nibungi;
typedef map<int, int> zisyos;

const seisu h1[8] = {1,1,0,-1,-1,-1,0,1};
const seisu h2[8] = {0,1,1,1,0,-1,-1,-1};

sei dai(sei a, sei b){return max(a,b);}
sei syou(sei a, sei b){return min(a,b);}

sei a,b;

mu kai(){
    ru(a%2 == 1 & b%2 == 1){
        syutu("Yes");
    }
    ta{
        syutu("No");
    }
}

seisu xin(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    nyu(a);
    nyu(b);
    kai();
    hen 0;
}

Measured memory_bytes: 256
#include <stack>
#include <iostream>
#include <algorithm>
#include <sstream>
#define ll long long

using namespace std;

int main(){
  string s;
  stack<ll> st;
  while(cin >> s){
    if(s == "+"){
      ll a = st.top();
      st.pop();
      ll b = st.top();
      st.pop();
      st.push(a + b);
    }else if(s == "-"){
      ll a = st.top();
      st.pop();
      ll b = st.top();
      st.pop();
      st.push(b - a);
    }else if(s == "*"){
      ll a = st.top();
      st.pop();
      ll b = st.top();
      st.pop();
      st.push(a * b);
    }else{
      stringstream mystream;
      mystream << s;
      ll a;
      mystream >> a;
      st.push(a);
    }
     

  }
  cout << st.top() << endl;
}

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

using namespace std;

#define endl '\n'
#define Opy ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0)

typedef long long ll;

int main()
{
    map< char, int > A;
    A.clear();

    char B[110];

    cin>> B;

    for(int i = 0; i < strlen(B); i++)
    {
        A[B[i]]++;
    }

    int flag = 0;

    auto it = A.begin();

    while(it != A.end())
    {
        if(it->second % 2 != 0)
        {
            flag = 1;
            break;
        }
        it++;
    }

    if(flag == 0) cout<< "Yes\n";

    else cout<< "No\n";

	return 0;
}


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

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a.at(i);
    sort(a.begin(),a.end());
    vector<int> fls(n);
    int maxval = a.at(n-1);
    rep(i,n) fls.at(i) = 0;
    rep(i,n){
        if(fls.at(i) == 1) continue;
        for(int x=a.at(i);x<=maxval;x+=a.at(i))
        {
            int l=i,r=n;
            while(l+1<r) {
                int y = (l+r)/2;
                if(a.at(y) <= x) l=y;
                else r=y;
            }
            if(l!=i){
                if(x == a.at(l)) fls.at(l) = 1;
                // cout << x << " " << a.at(l) << endl;
            }
        }
        // for(int j=i+1;j<n;j++){
        //     if(a.at(j) % a.at(i) == 0) fls.at(j) = 1;
        // }
        if(i < n-1){
            if(a.at(i) == a.at(i+1)) fls.at(i) = 1;
        }
    }
    int ans = 0;
    rep(i,n) if(fls.at(i) != 1) ans++;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4848
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
using namespace std;
 
typedef int ll;
 
#define int long long
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz(x) ((int)x.size())
#define all(x) x.begin(),x.end()
#define endl '\n'
 
typedef pair<int,int>pii;
typedef pair<int,pair<int,int> > piii;
 
const int mod=1e9+7;
 
int POWER[65];
int power(int a, int b) {int ret=1;while(b) {if(b&1) ret*=a;a*=a;if(ret>=mod) ret%=mod;if(a>=mod) a%=mod;b>>=1;}return ret;}
int inv(int x) {return power(x,mod-2);}
 
void precompute() {
	POWER[0]=1;
	for(int i=1;i<63;i++) POWER[i]=POWER[i-1]<<1LL;
}
 
int gcd(int a, int b) {
   if (b == 0)
   return a;
   return gcd(b, a % b);
}

vector<int>p, c, v[5005];
int tree=1;
bool vis[5005];

void dfs(int curr) {
	if(vis[curr])	return;
	vis[curr]=1;
	v[tree].pb(curr);
	dfs(p[curr]);
}

 
ll main() {
	// freopen("Task.in", "r", stdin);freopen("Task.out", "w", stdout);

	int n, k;
	cin>>n>>k;

	p.pb(0);
	c.pb(0);
	for (int i=0; i<n; i++) {
		int x;
		cin>>x;

		p.pb(x);
	}
	for (int i=0; i<n; i++) {
		int x;
		cin>>x;

		c.pb(x);
	}

	for (int i=1; i<=n; i++) {
		if(vis[i])	continue;
		dfs(i);
		tree++;
	}	

	int ret=0, isRetSet=0;

	for (int i=1; i<tree; i++) {
		// cout<<i<<endl;
		int cost=0;
		for (int j=0; j<sz(v[i]); j++) {
			// cout<<v[i][j]<<" ";
			cost+=c[v[i][j]];
		}
		// cout<<endl;
		// for (int j=0; j<sz(v[i]); j++) {
		// 	cout<<c[v[i][j]]<<" ";
		// }
		// cout<<endl;

		int lef=k%sz(v[i]);
		int num=k/sz(v[i]);

		// cout<<cost<<" "<<num*cost<<endl;

		int extMax=0, isSet=0;
		for (int j=0; j<sz(v[i]); j++) {
			int cst=0;
			for (int m=0; m<lef; m++) {
				int id=(j+m)%sz(v[i]);
				cst+=(c[v[i][id]]);
				if(extMax<cst || isSet==0) {
					isSet=1;
					extMax = cst;
				}
			}
		}

		// cout<<extMax<<endl;

		int maxSub=0, lenMax=0, lasMax=-1;
		isSet=0;
		for (int j=0; j<sz(v[i]); j++) {
			int cst=0;
			for (int m=0; m<sz(v[i]); m++) {
				int id=(j+m)%sz(v[i]);
				cst+=(c[v[i][id]]);
				if(maxSub<cst || isSet==0) {
					maxSub = cst;
					lasMax=id;
					lenMax=m+1;
					isSet=1;
				}
			}
		}

		int val=0;

		val=num*cost+extMax;
		if(lenMax<=k) {
			val=max(val, maxSub);
		}
		if(num>1) {
			val=max(val, (num-1)*cost+maxSub);
		}

		// cout<<val<<endl;
		if(ret<val || isRetSet==0) {
			isRetSet=1;
			ret=val;
		}
	}
	cout<<ret<<endl;
}

Measured memory_bytes: 3996
#include<bits/stdc++.h>
using namespace std;
int n;
long long f[87];
int main(){
    cin>>n;
    f[0]=2;
    f[1]=1;
    for(int i=2;i<=n;i++) f[i]=f[i-1]+f[i-2];
    cout<<f[n];
    return 0;
    //SPFA是数据结构
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n-1); i >= 0; i--)
#define all(v) (v).begin(),(v).end()
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; }
template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template <class T> T lcm(T a, T b) { return a/gcd(a,b)*b; }
typedef pair<int, int> P;
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;
const ll MOD = 1e9+7;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
	ll n, k;
	cin >> n >> k;
    ll ans = 0;
    ll minSum, maxSum, cnt;
    for (ll i = k; i <= n+1; i++) {
        minSum = (i-1)*i/2;
        maxSum = (2*n+1-i)*i/2;
        cnt = maxSum - minSum + 1;
        ans += cnt;
        ans %= MOD;
    }
    cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3636
import math
tmp = input().split()
A = int(tmp[0])
B = int(tmp[1])
N = int(tmp[2])
Mmax = 0

if N%B == 0:
    ANS = math.floor(A*(B-1)/B)
elif N > B:
    ANS = math.floor(A*(B-1)/B)
else:
    ANS = math.floor(A*N/B)

print(int(ANS))

Measured memory_bytes: 9188
#include <bits/stdc++.h>
#define REP(i,n) for(LL i=0;i<(LL)(n);i++)
#define ALL(x) (x).begin(),(x).end()
#define LL long long
#define pii pair<LL,LL>
#define pll pair<LL,LL>

using namespace std;

int main(){

    string s;cin>>s;
    LL n=s.size();
    LL isOdd[n+1];
    fill_n(isOdd,n+1,0);

    LL dp[n+1];
    fill_n(dp,n+1,1000000);
    dp[0]=0;

    map<LL,LL> btoi;
    btoi[0]=0;

    REP(i,n){
        LL c = s[i]-'a';
        isOdd[i+1]=(isOdd[i]^(1<<c));
        REP(j,26){
            LL k = isOdd[i+1]^(1<<j);
            if(btoi.find(k)==btoi.end())continue;
            dp[i+1]=min(dp[i+1],dp[btoi[k]]+1);
        }
        if(btoi.find(isOdd[i+1])!=btoi.end()){
            if(dp[i+1]<dp[btoi[isOdd[i+1]]]+1){
                btoi[isOdd[i+1]]=i+1;
            }else{
                dp[i+1]=dp[btoi[isOdd[i+1]]]+1;
            }
        }else{
            btoi[isOdd[i+1]]=i+1;
        }
    }

    cout<<dp[n]<<endl;
    return 0;
}

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

using namespace std;

int64_t INF = 1'000'000'000'000'000;

int64_t N, ans;

void dfs(int depth, int end, vector<int> num){
    vector<int> cnt(8, 0);
    int a=0;
    for(int i : num){
        cnt[i]++;
        if( i!=0 )  a = a * 10 + i;
    }
    if( 0<cnt[3] && 0<cnt[5] && 0<cnt[7] && a<=N )    ans++;

    if( depth == end )  return;

    vector<int> num753 = {7, 5, 3};
    for(int i=0;i<3;i++){
        num[depth] = num753[i];
        dfs(depth+1, end, num);
    }
}

int main() {
    cin >> N;

    int digits = 0;
    for(int i=1;i<N;i*=10)  digits++;

    ans=0;
    vector<int> v(digits, 0);
    dfs(0, digits, v);

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);    cout.tie(NULL);
#define forf(i,n) for(int i=0;i<n;i++)
#define foro(i,n) for(int i=1;i<n;i++)
#define ll long long
using namespace std;



void check(int a[],int n){
	ll s;
	s=0;
	foro(i,n){
		if (a[i]-a[i-1]<0){
			
			s+=a[i-1]-a[i];
			a[i]=a[i-1];

		}
	}
	cout<<s;
}

int main(){
	int n;
	 cin>>n;
	 int a[n];
	 forf(i,n) cin>>a[i];
	 check(a,n);
}

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

using namespace std;

int main(){

    int n,a,b,count=0,t=0;
    cin>>n;
    while(n--){
        cin>>a>>b;
        if(a==b){
            count++;
        }
        else{
            count=0;
        }
        if(count==3){
            t=1;
            count=0;
        }
    }
    if(t){
        cout<<"Yes";
    }else{
        cout<<"No";
    }
    return 0;

}

Measured memory_bytes: 3628
using System;
using System.Linq;
using System.Collections.Generic;
class c
{
    static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        var ans = new int[n];
        ans[0] = -1;
        var list = new List<Tuple<int, int, int>>();
        var tree = new List<Tuple<int, bool>>[n];
        for (int i = 0; i < n; i++) tree[i] = new List<Tuple<int, bool>>();
        for (int i = 0; i < n - 1; i++)
        {
            var line = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
            int u = line[0] - 1;
            int v = line[1] - 1;
            int w = line[2];
            bool b = (w % 2 == 0) ? true : false;
            tree[u].Add(new Tuple<int, bool>(v, b));
            tree[v].Add(new Tuple<int, bool>(u, b));
        }
        var next = new List<int>();
        next.Add(0);
        var searched = new bool[n];
        while (next.Count() != 0)
        {
            if (!searched[next[0]])
            {
                searched[next[0]] = true;
                for (int i = 0; i < tree[next[0]].Count(); i++)
                {
                    if (!searched[tree[next[0]][i].Item1]) next.Add(tree[next[0]][i].Item1);
                }
            }
            for (int j = 0; j < tree[next[0]].Count(); j++)
            {
                if (ans[tree[next[0]][j].Item1] != 0) continue;
                else
                {
                    if (tree[next[0]][j].Item2) ans[tree[next[0]][j].Item1] = ans[next[0]];
                    else if (ans[next[0]] == -1) ans[tree[next[0]][j].Item1] = -2;
                    else ans[tree[next[0]][j].Item1] = -1;
                }
            }
            next.RemoveAt(0);
        }
        foreach (var x in ans)
        {
            if (x == -1) Console.WriteLine(0);
            else Console.WriteLine(1);
        }
    }
}

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

#define null				""
#define all(dat)			dat.begin(), dat.end()
#define over(msg)			cout << msg << endl, exit(0);
#define loop(i, to)			for (int i = 0; i < to; ++i)
#define cont(i, to)			for (int i = 1; i <= to; ++i)
#define foreach(i, dat)		for (__typeof(dat.begin()) i = dat.begin(); i != dat.end(); ++i)

typedef long long			num;

using namespace std;

int n, mx, m, w[105], v[105];
num dp[105][100005], ans;

int main() {
	ios_base::sync_with_stdio(0);
	cin >> n >> m;
	cont (i, n) {
		cin >> w[i] >> v[i];
		mx = max(mx, v[i]);
	}
	loop (i, n + 1) {
		loop (j, mx * n + 2) {
			dp[i][j] = 2e9;
		}
	}
	loop (i, n + 1) {
		dp[i][0] = 0;
	}
	cont (i, n) {
		loop (j, mx * n + 1) {
			dp[i][j] = min(dp[i][j], dp[i - 1][j]);
			if (j >= v[i]) {
				dp[i][j] = min(dp[i][j], dp[i - 1][j - v[i]] + w[i]);
			}
		}
	}
	cont (i, n) {
		cont (j, mx * n + 1) {
			if (dp[i][j] <= m) {
				ans = max(ans, (num) j);
			}
		}
	}
	cout << ans << endl;
}


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

///******************************** C o n t a i n e r ********************************///

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;

///*********************************** C o n s t ***********************************///

const int       N=1e6+3;
const double    PI = acos(-1);
const ll        MOD=1000000007;                 ///1e9+7
ll dx[] = {+1, 0, -1, 0, +1, +1, -1, -1};
ll dy[] = {0, +1, 0, -1, +1, -1, +1, -1};



#define pb push_back
#define F first
#define S second
#define forn(i,n) for(i=0;i<n;i++)
#define rforn(i,n) for(i=n-1;i>=0;i--)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define sz(x) x.size()
#define el <<'\n'
#define gap ' '
#define print(a) {for(auto x:a)cout<<x<<" ";cout<<endl;}
#define mem(a,b) memset(a, b, sizeof(a))
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define sqr(a) (a)*(a)

#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define fraction() cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);

///*********************************** F u n c t i o n ***********************************///

ll powmod(ll a,ll b){ll p=MOD;a%=p;if(!a) return 0;ll pr=1;while(b>0){if(b&1){pr*=a;pr%=p;--b;}a*=a;a%=p;b/=2;}return pr;}
bool isPrime(ll n){ if(n<=1)return false;if(n<=3)return true;if(n%2==0 or n%3==0)return false;for(ll i=5;i*i<=n;i+=6){if(n%i==0 or n%(i+2)==0)return false;}return true;}
void seive(bool a[]){ll mx=sqrt(N),ii,jj;for(ii=3;ii<=mx;ii+=2)if(!a[ii])for(jj=ii*ii;jj<=N;jj+=2*ii)a[jj]=true;}
void numofdiv(ll a[]){ll mx=sqrt(N),ii,jj;for(ii=1;ii<=mx;ii++){for(jj=ii*ii;jj<=N;jj+=ii){if(jj==ii*ii) a[jj]++; else a[jj]+=2;}}}
void sumofdiv(ll a[]){ll mx=sqrt(N),ii,jj;for(ii=1;ii<=mx;ii++){for(jj=ii*ii;jj<=N;jj+=ii){if(jj==ii*ii) a[jj]+=ii; else a[jj]+=ii+jj/ii;}}}

///**************************************************** C o d e ****************************************************///
///-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=///

 int main()
 { ll n,i,j,coun=0;
 cin>>n;
 for(i=1;i<=(n-1);i++)
 {for(j=1;i*j<n;j++)coun++;
 }
 cout<<coun<<endl;

 return 0;


}


///Thanking you by Roxy






Measured memory_bytes: 3628
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<string>
 
using namespace std;
#define ll long long 
#define mod 1000000007
#define N 30
int main()
{
  ll n; cin>>n;
  ll a[n];
  ll ans=0;
  for(int i=0;i<n;++i){
  	int x; cin>>x;
  	ans=(ans^x);
  	a[i]=x;
  }
  for(int i=0;i<n;++i){
  	cout<<(ans^a[i])<<" ";
  }

  return 0;
}

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

typedef pair <int, int> ii;

const int Maxn = 100005;

int n, m;
ii seq[Maxn];

int main()
{
	scanf("%d %d", &n, &m);
	for (int i = 0; i < m; i++)
		scanf("%d %d", &seq[i].first, &seq[i].second);
	sort(seq, seq + m);
	int b = 0;
	int res = 0;
	for (int i = 0; i < m; i++)
		if (seq[i].first < b) b = min(b, seq[i].second);
		else {
			res++;
			b = seq[i].second;
		}
	printf("%d\n", res);
	return 0;
}

Measured memory_bytes: 1024
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <cmath>
#include <complex>
using std::cerr;
using std::cin;
using std::cout;
using std::endl;



int main(void) {
  cout << std::fixed << std::setprecision(10);
  cin.tie(0);
  std::ios::sync_with_stdio(false);

  int n;
  cin>>n;
  std::vector<std::complex<int>> engine;
  for(int i=0;i<n;i++){
    int x,y;
    cin>>x>>y;
    engine.push_back(std::complex<int64_t>(x,y));
  }
  std::sort(engine.begin(), engine.end(),[](const std::complex<int64_t>& a,const std::complex<int64_t>& b)->bool{
    std::complex<double> ca(a.real(),a.imag()),cb(b.real(),b.imag());
    return std::arg(ca)<std::arg(cb);
  });
  for(int i=0;i<n;i++){
    engine.push_back(engine[i]);
  }

  // for(auto e:engine){
  //   std::complex<double> ca(e.real(),e.imag());
  //   cerr<<std::arg(ca)<<endl;
  // }

  double result=0;
  for(int front=0;front<n;front++){
    for(int back=front;back-front<n;back++){
      double tmp=0;
      int64_t x=0,y=0;
      for(int i=front;i<=back;i++){
        x+=engine[i].real();
        y+=engine[i].imag();
      }
      tmp=sqrt(x*x+y*y);
      result=std::max(result,tmp);
    }
  }
  cout<<result<<endl;

  return 0;
}


Measured memory_bytes: 256