akhauriyash/Code-Regression huggingface dataset:
#define MM_USE_COMP_MACRO

#ifdef MM_USE_COMP_MACRO
//DO NOT READ THIS SECTION:YOU'RE WASTING YOUR TIME
#ifndef MM_USE_COMP_MACRO_DEF
#define MM_USE_COMP_MACRO_DEF

#define _USE_MATH_DEFINES
#include <cstdio>
#include <utility>
#include <cmath>
#include <string>
#include <iostream>

typedef long long signed int ll;

template<class T>
using abp2 = std::pair<T, T>;
template<class T>
using abp3 =  std::pair<std::pair<T,T>, T>;
template<class T>
using abp4 = std::pair<std::pair<T, T>, std::pair<T, T>>;

typedef abp2<ll> ln2;
typedef abp3<ll> ln3;
typedef abp4<ll> ln4;

#define mlp2_t(i,j) std::pair<i,j>
#define mlp3_t(i,j,k) std::pair<std::pair<i,j>,k>
#define mlp4_t(i,j,k,l) std::pair<std::pair<i,j>,std::pair<k,l>>
#define mkp2(i,j) make_pair(i,j)
#define mkp3(i,j,k) make_pair(make_pair(i,j),k)
#define mkp4(i,j,k,l) make_pair(make_pair(i,j),make_pair(k,l))
#define gtp2_1(a) a.first
#define gtp2_2(a) a.second
#define gtp3_1(a) a.first.fisrt
#define gtp3_2(a) a.first.second
#define gtp3_3(a) a.second
#define gtp4_1(a) a.first.fisrt
#define gtp4_2(a) a.first.second
#define gtp4_3(a) a.second.first
#define gtp4_4(a) a.second.second

#define vect_d(a) printf("Dump: In \"%s\" at line %d.\n",__FILE__,__LINE__);for(auto& e:a)std::cout<<e<<" ";std::cout<<std::endl;

#define loop3(i,j,k) for(ll i = j;i < k;i++)
#define loop2(i,j) for(ll i = 0;i < j;i++)
#define loop(j) for(ll i = 0;i < j;i++)
/*
template<class T>
auto gst = []() { T a; std::cin >> a; return a; };
auto gsti = gst<int>;
auto gstll = gst<ll>;
auto gsts = gst<std::string>;
*/
template<class T>
constexpr T mpi = (T)M_PI;
constexpr auto pi_i = mpi<int>;
constexpr auto pi_ll = mpi<ll>;

#ifndef N_MOD
#pragma message( "Warning!! No N_MOD macro is defined. Falling back to 1000000007." )
#define N_MOD 1000000007
#endif

#ifdef _DEBUG
#define assert_error {printf("Error: In \"%s\" at line %d.\n",__FILE__,__LINE__);throw;}
#else
#define assert_error {throw;}
#endif

#endif
#endif

#include <string>
#include <iostream>
#include <vector>
#include <list>
#include <utility>
#include <algorithm>
#include <map>
#include <set>

using namespace std;

int main() {
	ll n, a, b, c, d;
	string s;
	cin >> n >> a >> b >> c >> d >> s;
	a--;
	b--;
	c--;
	d--;

	for (ll i = a + 1; i < c; i++) {
		if (s[i] == '#' && s[i + 1] == '#') goto res_no;
	}
	for (ll i = b + 1; i < d; i++) {
		if (s[i] == '#' && s[i + 1] == '#') goto res_no;
	}

	if (c < d) goto res_yes;

	for (ll i = b; i <= d; i++) {
		if (s[i-1]=='.' && s[i] == '.' && s[i + 1] == '.') goto res_yes;
	}

res_no:
	cout << "No" << endl;
	return 0;
res_yes:
	cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
bool h[100000];
int main(){
	int n,a[100000],cnt=0,ans=1;
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}
	while(true){
		ans=a[ans];
		if(h[ans]==true){
			cout<<-1<<endl;
			return 0;
		}
		h[ans]=true;
		cnt++;
		if(ans==2){
			cout<<cnt<<endl;
			return 0;
		}
	}
}


Measured memory_bytes: 768
#include<stdio.h>
#include<string.h>
#define ran 222222
int n;
char s[ran];
int nex[ran][26];
int d[ran];
int main(){
	scanf("%s",s+1);
	n = strlen(s+1);
	memset(nex[n+1],-1,sizeof(nex[n+1]));
	for(int i=n; i>=1; i--){
		memcpy(nex[i],nex[i+1],sizeof(int)*26);
		s[i] -= 'a';
		nex[i][s[i]] = i;
	}
	d[n+1] = 0;
	for(int i=n; i>=1; i--){
		d[i] = n+1;
		for(int j=0; j<26; j++)
			if(nex[i][j] == -1)
				d[i] = 0;
			else{
				int now = 1 + d[nex[i][j]+1];
				if(now < d[i])d[i] = now;
			}
	}
	for(int pnt=1; pnt<=n; )
		for(int j=0; j<26; j++)
			if(nex[pnt][j] == -1){
				printf("%c",j+'a');
				pnt = n+1;
				break;
			}else
			if(d[pnt] == 1 + d[nex[pnt][j]+1]){
				printf("%c",j+'a');
				pnt = nex[pnt][j] + 1;
				break;
			}
	puts("");
	return 0;
}

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

int p_or_m(char v, int flag){
 int value = int(v - '0');
 if(flag) return value;
 else return value*(-1);
}


int main(){
  string S;
  cin >> S;
  bool flag = false;
  for (int i=0; i<2; i++){
    for(int j=0; j<2; j++){
      for(int k=0; k<2; k++){
        int ans = int(S.at(0) - '0');
        ans += p_or_m(S.at(1), i);
        ans += p_or_m(S.at(2), j);
        ans += p_or_m(S.at(3), k);
        if (ans == 7){
          char op1 = (i)?'+':'-';
          char op2 = (j)?'+':'-';
          char op3 = (k)?'+':'-';
          cout << S.at(0) << op1 << S.at(1) << op2 << S.at(2) << op3 << S.at(3) <<"=7" << endl;
          flag = true;
          break;
        }
      }
      if (flag) break;
    }
    if (flag) break;
  }
}

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

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

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


int main() {
  int N,K;
  cin >> N >> K;
  vector<int> nedan(N);
  for(int i = 0; i < N; i++){
  	cin >> nedan.at(i);
  }
  sort(nedan.begin(),nedan.end());
  int sum = 0;
  for(int i = 0; i < K; i++){
  	sum += nedan.at(i);
  }
  cout << sum << endl;
}

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

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

typedef long long ll;

const int INF = 1 << 30;
const ll LLINF = 1LL << 60;

int mod = 1000000007;

int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int a, b, c; cin >> a >> b >> c;
    if(b+c <= a) cout << 0 << endl;
    else cout << c - (a-b) << endl;
    return 0;
}

Measured memory_bytes: 256
n = int(input())
def so(x):
    if x%2>0 and x%3>0 and x%5>0:
        return True
    else:
        return False

# for nn in range(9,1000):
#     n=nn
m = 30000
ANS = []
for i in range(1, m+1):
    if i%2==0 or i%3==0 or i%5==0:
        ANS.append(i)
        n -= 1
    if n == 1:
        k = ANS[-1]
        while k%30!=0:
            k += 1
        ANS.append(k+60-sum(ANS)%30)
        break
if so(ANS[-1]):
    for j in range(30):
        k = 30 - j
        if so(ANS[-1]+j) == False and so(ANS[-2]+k) == False:
            ANS[-1] += j
            ANS[-2] += k
            break
print(" ".join([str(i) for i in ANS]))
# print(len(ANS))

# s = sum(ANS)
# from fractions import gcd
# def gcd_list(A):
#     if A == [0] * len(A):
#         return float("inf")
#     ans = A[0]
#     for i in range(1, len(A)):
#         if A[i] != 0:
#             ans = gcd(ans, A[i])
#     return ans
# if gcd_list(ANS)>1:
#     print(gcd_list(ANS))
# for i in range(len(ANS)):
#     if gcd(ANS[i], s-ANS[i])==1:
#         print(nn, i, ANS[i], s-ANS[i],gcd(ANS[i], s-ANS[i]))

Measured memory_bytes: 41200
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from itertools import permutations, accumulate, combinations, combinations_with_replacement, groupby
from math import sqrt, ceil, floor, factorial, gcd
from bisect import bisect_left, bisect_right, insort_left, insort_right
from copy import deepcopy
from operator import itemgetter
from functools import reduce, lru_cache  # @lru_cache(None)
import sys  # def input(): return sys.stdin.readline().rstrip() # sys.setrecursionlimit(10**6)

n, x, t = (int(x) for x in input().split())
print((ceil(n/x)*t))

Measured memory_bytes: 67984
import collections

n = int(input())
V = list(map(int, input().split()))
kisuu = []
gusuu = []
for idx, v in enumerate(V):
    if idx % 2 == 0:
        gusuu.append(v)
    else:
        kisuu.append(v)
gusuu_c = collections.Counter(gusuu)
gusuu_c_sorted = sorted(gusuu_c.items(), key=lambda x: x[1], reverse=True)
kisuu_c = collections.Counter(kisuu)
kisuu_c_sorted = sorted(kisuu_c.items(), key=lambda x: x[1], reverse=True)

if gusuu_c_sorted[0][0] != kisuu_c_sorted[0][0]:
    print(
        len(kisuu) - kisuu_c_sorted[0][1] + len(gusuu) - gusuu_c_sorted[0][1])
else:
    if len(gusuu_c_sorted) == 1 and len(kisuu_c_sorted) == 1:
        print(min(len(gusuu), len(kisuu)))
    elif len(gusuu_c_sorted) == 1:
        print(len(kisuu) - kisuu_c_sorted[1][1])
    elif len(kisuu_c_sorted) == 1:
        print(len(gusuu) - gusuu_c_sorted[1][1])
    else:
        print(min(len(kisuu) - kisuu_c_sorted[1][1] + len(gusuu) - gusuu_c_sorted[0][1],
                  len(kisuu) - kisuu_c_sorted[0][1] + len(gusuu) - gusuu_c_sorted[1][1]))


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

using namespace std;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pll;
typedef vector<pi> vpi;
typedef vector<bool> vbool;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define forall(it,s) for(auto it = s.begin(); it != s.end(); ++it)
#define F0(i,n) for(ll i = 0; i < n; i++)
#define F1(i,n) for(ll i = 1; i <= n; i++)
#define rep(i,a,b) for(int i = a; i <= b; i++)
#define per(i,a,b) for(int i = b-1; i >= a; i--)
#define FIN ios::sync_with_stdio(false);cin.tie(0);
#define db(x) cout<<#x<<" = "<<x<<"\n"
#define all(v) v.begin(),v.end()
#define modulo(a,b) ((a%b)+b)%b
#define F first
#define S second
#define INF 1000000010
#define INFLL 1000000000000000000
#define eps 0.000000000001
#define mod 1000000007
template<class C> void mini(C&a, C b){ a=min(a, b);}
template<class C> void maxi(C&a, C b){a=max(a,b);}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}

//=======================//
int K,n,m;
vi a,dp;
/*
dp[i] = quien gana cuando quedan i piedras. Si es 0 gana al que le toca, si es 1  pierde.
*/

int main () {
	//FIN

	cin >> n >> K;
	a = vi(n);
	dp = vi(K+2);
	F0(i,n) {
		cin >> a[i];
		mini(m,a[i]);
	}
	F0(i,a[0]) dp[i] = 1;
	// Las posiciones donde no se puede hacer nada son perdedoras.
	// Las posiciones donde me puedo mover hacia un 1 son ganadoras, y si no me puedo mover a ningun 1 son perdedoras.
	rep(piedras, a[0], K) {
		dp[piedras] = 1;
		for (int val : a) {
			if (piedras - val >= 0 && dp[piedras-val] == 1) {
				dp[piedras] = 0;
			}
		}
	}
	cout << (dp[K]?"Second":"First") << "\n";

	return 0;
}










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


int main() {
  int N, X, T;
  cin >> N >> X >> T;
  int res = 0;
  if (N % X){
    res = 1;
  }
  
  cout <<  (N / X + res) * T << endl;
  
  
}

Measured memory_bytes: 3616
#include<bits/stdc++.h>
#define lson (o<<1)
#define rson (o<<1|1)
#define fi first
#define sc second
#define dbg(x) cout<<#x<<" = "<<(x)<<endl;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
using namespace std;
const double pi=acos(-1);
const double eps=1e-6;
inline int lowbit(int x){return x&(-x);}
inline int read(){
	int f=1,x=0;char ch;
	do{ch=getchar();if(ch=='-')f=-1;}while(ch<'0'||ch>'9');
	do{x=x*10+ch-'0';ch=getchar();}while(ch>='0'&&ch<='9');
	return f*x;
}
template<typename T> inline T max(T x,T y,T z){return max(max(x,y),z);}
template<typename T> inline T min(T x,T y,T z){return min(min(x,y),z);}
template<typename T> inline T sqr(T x){return x*x;}
template<typename T> inline void checkmax(T &x,T y){x=max(x,y);}
template<typename T> inline void checkmin(T &x,T y){x=min(x,y);}
template<typename T> inline void read(T &x){
x=0;T f=1;char ch;do{ch=getchar();if(ch=='-')f=-1;}while(ch<'0'||ch>'9');
do x=x*10+ch-'0',ch=getchar();while(ch<='9'&&ch>='0');x*=f;
}
template<typename A,typename B,typename C> inline A fpow(A x,B p,C yql){
	A ans=1;
	for(;p;p>>=1,x=1LL*x*x%yql)if(p&1)ans=1LL*x*ans%yql;
	return ans;
}
struct FastIO{
	static const int S=1310720;
	int wpos;char wbuf[S];
	FastIO():wpos(0){}
	inline int xchar(){
		static char buf[S];
		static int len=0,pos=0;
		if(pos==len)pos=0,len=fread(buf,1,S,stdin);
		if(pos==len)return -1;
		return buf[pos++];
	}
	inline int read(){
		int c=xchar(),x=0;
		while(c<=32&&~c)c=xchar();
		if(c==-1)return -1;
		for(;'0'<=c&&c<='9';c=xchar())x=x*10+c-'0';
		return x;
	}
}io;
//#define read io.read
int main()
{
	int n,m;
	cin >> n >> m;
	for(int i=1;i<=n;i++)
	{
		char x;
		cin >> x;
		if(i==m) x+=32;
		cout << x;
	}
	return 0;
}

Measured memory_bytes: 256
#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>;

int main()
{
    int n, m;
    int ans = 0;
    cin >> n >> m;
    //if (m % 2 == 1)
    //{
    //    m--;
    //}
    ans = n * (n - 1) / 2;
    ans += m * (m - 1) / 2;

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int cd,kq;
int f[5001][5001];
string s;
int main()
{
	cin >> cd;
	cin >> s;
	s = '0' + s;
	for (int i = 1 ; i <= cd ; i++)
	{
		for (int e = i ; e <= cd ; e++)
		{
			if (s[i] == s[e]) f[i][e] = max(1 , f[i-1][e-1] + 1);
			if (e - f[i][e] + 1 <= i) kq = max(kq , e - i);
			else kq = max(kq , f[i][e]);
		}
	}
	cout << kq;
}

Measured memory_bytes: 96896
#include <stdio.h>
#define EPSIRON (1.0e-10)
#define ABS(X) ((X)<0.0 ? -(X):(X))
 
int main(void){
    double x1, x2, x3, x4, dx1, dx2;
    double y1, y2, y3, y4, dy1, dy2;
    double dp; // dot product
     
     while(scanf("%lf",&x1)!=EOF){
        scanf("%lf %lf %lf", &y1, &x2, &y2);
        scanf("%lf %lf %lf %lf", &x3, &y3, &x4, &y4);
        dx1 = x2 - x1;
        dy1 = y2 - y1;
        dx2 = x4 - x3;
        dy2 = y4 - y3;
        dp = dx1 * dx2 + dy1 * dy2;
        printf("%s\n", ABS(dp) < EPSIRON ? "YES" : "NO");
     }
    return 0;
}

Measured memory_bytes: 1040
// Problem : E - Yutori
// Contest : AtCoder Beginner Contest 161
// URL : https://atcoder.jp/contests/abc161/tasks/abc161_e
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update

using namespace std;
using namespace __gnu_pbds;

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
ordered_set;	

#define FOR(i,a,b) for(int i = (a); i <= (b); ++i)
#define FORD(i,a,b) for(int i = (a); i >= (b); --i)
#define RI(i,n) FOR(i,1,(n))
#define REP(i,n) FOR(i,0,(n)-1)
#define mini(a,b) a=min(a,b)
#define maxi(a,b) a=max(a,b)
#define pb push_back
#define st first
#define nd second
#define sz(w) (int) w.size()
typedef vector<int> vi;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<pii, int> para;
const ll inf = 1e9 + 7;
const ll maxN = 1e6 + 5;
const ll MOD = 1e9 + 7;

int n, k, c;
int dp[maxN][2];
string s;
set<int> order[maxN];

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	cin >> n >> k >> c;
	cin >> s;
	order[0].insert(-inf);
	dp[0][0] = -inf;
	int mx = 0;
	REP(i, sz(s)) {
		if (s[i] == 'o') {
			if (i - *order[mx].begin() > c) {
				//dp[++mx][0] = i;
				order[++mx].insert(i);
			} else {
				order[mx].insert(i);
			}
		}
		//cout << i << " " << mx << " " << dp[mx][0] << " " << dp[mx][1] << endl;
	}
	//cout << mx << " " << k << endl;
	if (mx > k) return 0;
	assert(mx == k);
	vi ans;
	int now = *order[mx].begin();
	//cout << mx << " " << endl;
	if (sz(order[mx]) > 1) now = *order[mx].rbegin();
	else ans.pb(now + 1);
	FORD(i, k - 1, 1) {
		auto it = order[i].begin();
		it++;
		if (it == order[i].end() || *it + c >= now) {
			now = *order[i].begin();
			ans.pb(now + 1);
		} else {
			auto it2 = order[i].lower_bound(now - c);
			it2--;
			now = *it2;
		}
	}
	reverse(ans.begin(), ans.end());
	for (auto x: ans) {
		cout << x << '\n';
	}
	//cout << now << endl;
	return 0;
}
 


Measured memory_bytes: 59276
N,K,C =map(int,input().rstrip().split(" "))
S = input()
kinmu = 0
niti = 0
f = []
b = []
kinmu = 0
niti = 0
while kinmu < K and niti < N:
  if S[niti] == "o":
    f.append(niti)
    kinmu += 1
    niti += C
  niti += 1
kinmu = 0
niti = N -1
while kinmu < K and niti >= 0:
  if S[niti] == "o":
    b.append(niti)
    kinmu += 1
    niti -= C
  niti -= 1
b.reverse()
for i in range(K):
  if f[i] == b[i]:
    print(f[i] + 1)

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

int main(){
    int  k; 
    vector<int> a(3);
    rep(i,3) cin >> a[i];
    cin >> k;
    int maxn = *max_element(a.begin(),a.end());
    int n = maxn;

    rep(i,k) maxn *= 2;

    put(maxn + accumulate(a.begin(),a.end(),0) - n);
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#define rep2(x,from,to) for(int x=(from);(x)<(to);(x)++)
#define rep(x,to) rep2(x,0,to)
using namespace std;
int main(){
	int n, d1, d2;
	while(cin >> n, n) {
		vector<pair<int, int> > v;
		rep(i,n) {
			pair<int, int> p;
			cin >> p.second >> d1 >> d2;
			p.first = d1 + d2;
			v.push_back(p);
		}
		sort(v.begin(), v.end());
		cout << v[v.size()-1].second << " " << v[v.size()-1].first << endl;
	}
}

Measured memory_bytes: 1328
#include<stdio.h>
long long int n, a[200100],b[200100][2],sum, k,s;
int main(){
	int i, j=0;
	scanf("%lld",&n);
	b[0][0]=0;
	for(i=0;i<n;i++){
		scanf("%lld",a+i);
		s=0;
		while(a[i]<=b[j][0]){
			s=s+b[j][1];
			k=k-b[j][0]*b[j][1];
			j--;
		}
		b[++j][0]=a[i];
		b[j][1]=s+1;
		k=k+(a[i]*(s+1));
		sum=sum+k;
	}
	printf("%lld",sum);
}

Measured memory_bytes: 4864
# include <iostream>
# include <sstream>
# include <cstdio>
# include <cstdlib>
# include <algorithm>
# include <string>
# include <cstring>
# include <cmath>
# include <stack>
# include <queue>
# include <vector>
# include <list>
# include <map>
# include <set>
# include <deque>
# include <iterator>
# include <functional>
# include <bitset>
# include <climits>
# include <ctime>
using namespace std;
#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
#define odd(x) ((x)&1)
#define sqr(x) ((x)*(x))
#define mp make_pair
#define pb push_back
#define fir first
#define sec second
#define all(x) (x).begin(),(x).end()
#define rep(i,a,b) for (int i=(a); i<=(b); ++i)
#define rep_it(it,x) for (__typeof((x).begin()) it=(x).begin(); it!=(x).end(); it++)
#define ____ puts("\n_______________\n\n") 
#define debug(x) ____; cout<< #x << " => " << (x) << endl
#define debug_pair(x) cout<<"\n{ "<<(x).fir<<" , "<<(x).sec<<" }\n"
#define debug_arr(x,n) ____; cout<<#x<<":\n"; rep(i,0,n) cout<<#x<<"["<<(i)<<"] => "<<x[i]<<endl
#define debug_set(x) ____; cout<<#x<<": \n"; rep_it(it,x) cout<<(*it)<<" "; cout<<endl
#define debug_map(x) ____; cout<<#x<<": \n"; rep_it(it,x) debug_pair(*it)
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> vi;
const int oo = /*2 * 1000 * 1000 * 1000*/0x3f3f3f3f;
const int _cnt = 1000 * 1000 + 7;
const int _p = 1000 * 1000 * 1000 + 7;
const double PI=acos(-1);
const double eps=1e-9;
int o(int x) { return x%_p; }
int gcd(int a, int b) { return b ? gcd(b, a%b) : a; }
int lcm(int a, int b) { return a / gcd(a, b)*b; }

void file_put() {
    freopen("filename.in", "r", stdin);
    freopen("filename.out", "w", stdout);
}

ll k,ans[105],k0,y;
int t;

int main() {
    //file_put();
    
    cin>>k;
    t=k%50;
    k0=k/50;
    y=k0+49;
    rep(i,1,t) ans[i]=y-t+51;
    rep(i,t+1,50) ans[i]=y-t;
    printf("50\n");
    rep(i,1,49) cout<<ans[i]<<" ";
    cout<<ans[50]<<endl;
	
    return 0;
}

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

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

    ll l,r;
    cin >> l >> r;
    
    ll m = 2019;
    for(ll i=l; i<min(r, l+2019); i++){
        for(ll j=i+1; j<=min(r, l+2019); j++){
            m = min(m, (i*j)%2019);
            // if(m == 0) break;
        }
    }
    
    cout << m << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <stack>
#include <cstdlib>
#include <cstdio>
using namespace std;
stack <int> st;
int solve(string);
int main(){
  string str;
  while(cin>>str){
    if(str=="+"||str=="-"||str=="*"||str=="/")
      st.push(solve(str));
    else st.push(atoi(str.c_str()));
    if(getchar()=='\n'){
      cout << st.top() << endl;
      return 0;
    }
  }
}
int solve(string str){
  int b = st.top(); st.pop();
  int a = st.top(); st.pop();
  if(str=="+")return a+b;
  else if(str=="-")return a-b;
  else if(str=="*")return a*b;
  else if(str=="/")return a/b;
}


Measured memory_bytes: 3204
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
const ll MOD = 1000000007;
const ll INF = 10000000000000000;
vector<int> x4 = {0, 1, 0, -1}, x8 = {0, 1, 1, 1, 0, -1, -1, -1};
vector<int> y4 = {1, 0, -1, 0}, y8 = {1, 1, 0, -1, -1, -1, 0, 1};
template<class T> struct edge { int from, to; T cost;};
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;}
template<class T> inline T powerM(T a,T b){if (b==0) return 1;
T tmp = powerM(a,b/2); if (b%2==0) return tmp*tmp%MOD; else return tmp*tmp%MOD*a%MOD; }
template<class T> inline T power(T a,T b,T m){ if (b==0) return 1;
  T tmp = power(a,b/2,m); if (b%2==0) return tmp*tmp%m; else return tmp*tmp%m*a%m; }
template<class T> inline T gcd(T a, T b){if (b==0) return a; return gcd(b, a%b);}
template<class T> inline T lcm(T a, T b){return a / gcd(a,b) * b;}
// ax+by=gcd(a,b)を解く
template<class T> inline T extgcd(T a,T b,T &x,T &y){if (b==0){x=1; y=0; return a;} T d=extgcd(b,a%b,y,x); y -= a/b*x; return d;}


/*
int N;
Graph G;

int main() {
  cin >>N;
  rep(i, N-1){
    int a,b; cin >>a >>b; a--; b--;
    G[a].push_back(b); G[b].push_back(a);
  }
}
*/

int main() {
  int a,b,c; cin >>a >>b >>c;
  swap(b,c);
  cout <<((a < b && b < c) || (a > b && b > c) ? "Yes" : "No") <<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,m;
	cin>>n>>m;
	int a,b,c;
	a=n+m;
	b=n-m;
	c=n*m;
	int ma;
	ma=max(max(a,b),c);
	cout<<ma;
}

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

#define rep(i,a,b) for(long long i = a; i < b; i++)
#define dump(a) for(auto x : a) cout << x << " "; cout << "\n"
#define print(a) cout << a << "\n"
#define debug(x) std::cerr<<#x<<": "<<x<<"\n"
#define debug2(x,y) std::cerr << #x << ": " << x << ", " << #y << ": " << y << "\n"
#define debug3(x,y,z) std::cerr << #x << ": " << x << ", " << #y << ": " << y << ", " << #z << ": " << z << "\n"

typedef long long ll;
using vi   = vector<int>;
using vll  = vector<long long>;
using vs   = vector<string>;
using vvi  = vector<vector<int>>;
using vvll = vector<vector<long long>>;
using vvs  = vector<vector<string>>;

int main() {
  ll a,b,c,d;
  cin >> a >> b >> c >> d;
  
  if (0 < a) {
    if (0 < c) {
      print(b*d);
    }
    else {
      if (0 < d) {
        print(b*d);
      } 
      else {
        print(a*d);
      }
    }
  } 
  else { 
    if (0 < b) {
      if (0 < c) {
        print(b*d);
      } 
      else {
        if (0 < d) {
          print((max(a*c,b*d)));
        } else {
          print(a*c);
        }
      }
    } else {
      if (0 < c) {
        print(b*c);
      } else {
        if (0 < d) {
          print(a*c);
        } else {
          print(a*c);
        }
      }
    }
  }
  return 0;
}

Measured memory_bytes: 3620
#include <stdio.h>
#include <ctype.h>
#include <string.h>
int main(int argc, const char * argv[]) {
    char aaa[10000]={0},copy[10]={0};
    int count=0;
    int i=0,j=0;
    scanf("%s",copy);
    //printf("%s\n",copy);
    for(j=0;j<10;j++){
        copy[j] = tolower(copy[j]);
    }
    
    while(1){
        scanf("%s",aaa);
        //printf("%s\n",aaa);
        if(strcmp(aaa,"END_OF_TEXT")==0){
            break;
        }
        for(j=0;j<10000;j++){
            aaa[j]=tolower(aaa[j]);
        }
        //printf("%s\n",aaa);
        if(strcmp(aaa,copy)==0){
            count++;
        }
        i++;
    }
    printf("%d\n",count);
    return 0;
}

Measured memory_bytes: 568
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#define ms(x) memset(x, 0, sizeof(x))
#define inf 0x3f3f3f3f
using namespace std;
const int N = 200005;
vector<int >book[N];
int faf[N], fag[N];
int vis[N];
map<int, int>mp;
void init() {
    for(int i=0; i<N; i++) {
        faf[i] = fag[i] = i;
    }
}
int Find(int *f, int x){
    if(f[x] == x) return x;
    else{
        f[x] = Find(f, f[x]);
        return f[x];
    }
}
void Merge(int *f, int x, int y){
    int a = Find(f, x) , b = Find(f, y);
    if(a!=b){
        f[b] = a;
    }
}
int main() {
    int n, k, l;
    while(cin>>n>>k>>l) {
        int u, v;
        init();
        for(int i=0; i<k; i++) {
            scanf("%d%d",&u,&v);
            Merge(faf, u, v);
        }
        for(int i=0;i<l;i++){
            scanf("%d%d",&u,&v);
            Merge(fag, u, v);
        }
        for(int i=1;i<=n;i++){
            book[Find(faf, i)].push_back(i);        //将同一个连通块中的点 集合起来
        }
        for(int i=1;i<=n;i++){
            mp.clear();
            for(int j=0;j<book[i].size();j++){
                mp[Find(fag, book[i][j])]++;        //枚举当前连通块中的点， 记录这个块中的点在另一个块中的父亲的出现次数。
            }
            for(int j=0;j<book[i].size();j++){
                vis[book[i][j]] += mp[Find(fag, book[i][j])];//统计当前连通块中的点在另一个连通块中的父亲的出现次数
            }
        }
        for(int i=1;i<=n;i++){
            printf("%d%c", vis[i],i==n?'\n':' ');
        }
    }
    return 0;
}


Measured memory_bytes: 14072
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <set>
#include <map>

int N;

int main(){
  scanf("%d", &N);
  int last = 0;
  int len = 0;
  int count = 0;
  for(int i = 0; i < N; i++){
    int tmp;
    scanf(" %d", &tmp);
    if(last != tmp){
      count += len / 2;
      last = tmp;
      len = 0;
    }
    len++;
  }
  count += len / 2;
  printf("%d\n", count);
  return 0;
}

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

int main(){
    long long int n;
    vector<long long int> can;
    int ans = 1000000000;
    
    cin >> n;

    for(long long int i = 1; i * i <= n; i++){
        if(n % i == 0){
            can.push_back(i);
            can.push_back(n / i);
        }
    }
    sort(can.begin(), can.end());
    /*
    for(int i = 0; i < can.size() / 2; i++){
        cout << can[i] << endl;
    }
    */
    for(int i = 0; i < can.size() / 2; i++){
        int f;
        int a = 0, b = 0;
        long long int tmp1 = can[i], tmp2 = can[can.size() - 1 - i];
        while(1){
            if(tmp1 < 10){
                a++;
                break;
            }
            tmp1 /= 10;
            a++;
        }
        while(1){
            if(tmp2 < 10){
                b++;
                break;
            }
            tmp2 /= 10;
            b++;
        }
        if(a > b){
            f = a;
        }
        else{
            f = b;
        }
        if(ans > f){
            ans = f;
        }
    }

    cout << ans <<endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;

using namespace std;

int main() {
	int N;
	string a, b, c;
	cin >> N >> a >> b >> c;

	int res = 0;
	for (int i = 0; i < N; ++i) {
		if (a[i] != b[i]) { ++res; }
		if ((a[i] != c[i]) && (b[i] != c[i])) { ++res; }
	}

	cout << res << endl;

	return 0;
}


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

int main() {
  int  N, M;
  cin >> N >> M;
  vector<int> A(N);
  for (int i=0; i<N; i++)
    cin >> A.at(i);
  
  int sum = 0;
  for(int i=0;i<N;i++)
    sum += A.at(i);
  
  int count = 0;
  double st = ((double)1 / (double)(4 * M))*(double)sum;
  for (int i=0; i<N; i++){
    if (A.at(i) >= st)
      count++;
    else
      continue;
  }
  if(count >= M)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

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

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


Measured memory_bytes: 9012
#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <math.h>
#include <numeric>
#include <iomanip>
#include <map>
#include <queue>
#include <list>

#define REP(i, n ,N) for(ll i = (n); i < (N); i++)
//#define RREP(i, n ,N) for(ll i = (N-1); i >= (n); i--)
#define p(s) cout<<(s)<<endl
#define p2(a, b) cout<<(a)<<" "<<(b)<<endl
#define INF 1e9

using namespace std;
typedef long long  ll;

const long long MOD = 1e9+7;

int main(){
    ll n, k;
    cin >> n >> k;
    n = n % k;
    if(abs(k-n) < n){n = abs(k-n);}
//    n = max(n, k) % min(n, k);
    p(n);
}

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

namespace AtCoder
{

    static class Program
    {
        static void Main()
        {
            var ans = GetStr().Count(c => c == '1');

            Console.WriteLine(ans);
            Console.ReadKey();
        }

        static void Solve()
        {

        }


        static public string GetStr() { return Console.ReadLine().Trim(); }
        static public int GetInt() { return int.Parse(Console.ReadLine()); }
        static public long GetLong() { return long.Parse(Console.ReadLine()); }
        static public string[] GetStrArray() { return Console.ReadLine().Split(' '); }
        static public int[] GetIntArray() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
        static public long[] GetLongArray() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
        static public char[] GetCharArray() { return Console.ReadLine().Split(' ').Select(char.Parse).ToArray(); }
        static public List<double> GetDoubleList() { return Console.ReadLine().Split(' ').Select(double.Parse).ToList(); }
        static public void WriteObjects<T>(IEnumerable<T> values) { foreach (var o in values) { Console.Write(o + " "); } }
        static string yesno(this bool b) { return b ? "yes" : "no"; }
        static string YesNo(this bool b) { return b ? "Yes" : "No"; }
        static string YESNO(this bool b) { return b ? "YES" : "NO"; }

        static bool eq<T, U>() => typeof(T).Equals(typeof(U));
        static T ct<T, U>(U a) => (T)Convert.ChangeType(a, typeof(T));
        static T cv<T>(string s) => eq<T, int>() ? ct<T, int>(int.Parse(s))
                           : eq<T, long>() ? ct<T, long>(long.Parse(s))
                           : eq<T, double>() ? ct<T, double>(double.Parse(s))
                           : eq<T, char>() ? ct<T, char>(s[0])
                                             : ct<T, string>(s);
        static void Multi<T>(out T a) => a = cv<T>(GetStr());
        static void Multi<T, U>(out T a, out U b)
        {
            var ar = GetStrArray(); a = cv<T>(ar[0]); b = cv<U>(ar[1]);
        }
        static void Multi<T, U, V>(out T a, out U b, out V c)
        {
            var ar = GetStrArray(); a = cv<T>(ar[0]); b = cv<U>(ar[1]); c = cv<V>(ar[2]);
        }
    }
}

Measured memory_bytes: 13268
#include<bits/stdc++.h>
using namespace std;
 
#define ll long long int
#define pb push_back
 
 
ll max(ll a,ll b)
{
    if(a>=b)
    return a;
    
    else
    return b;
}
 
int main(){
ll h;
cin>>h;
int i = 0; 
vector<ll>binaryNum(50,0);
while (h > 0){ 
binaryNum[i++] = h % 2; 
h = h / 2; 
}
  
  ll val=pow(2,i)-1;
  cout<<val;
}


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

using namespace std;

int main() {

	int a, b, c;
	cin >> a >> b >> c;

	if(a > b) 
		swap(a, b);
	if(b > c) 
		swap(b, c) ;
	if(a > b) 
		swap(a, b) ;

cout << a << " " << b << " " << c << endl;
	return 0;
} 


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

int main(){
	int n;
	cin >> n;
	while(n != 0){
		int a[n];
		

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

		int maximum = -100000;
		for(int i = 0; i < n; i++){
			int sum = 0;
			for(int j = i; j < n; j++){
				sum += a[j];
				maximum = max(maximum, sum);
			}
		}

		cout << maximum << endl;
		cin >> n;
	}

	return 0;
}

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

int main(){
 	int a,b,ans=0;
	 cin >> a >> b ;
	 if(a==1){
		 ans+=300000;
	 }
	 if(a==2){
		 ans+=200000;
	 }
	 if(a==3){
		 ans+=100000;
	 }
	 if(b==1){
		 ans+=300000;
	 }
	 if(b==2){
		 ans+=200000;
	 }
	 if(b==3){
		 ans+=100000;
	 }
	 if(a==1&&b==1){
		 ans+=400000;
	 }
	 cout <<ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
 	int n,k;
 	cin>>n>>k;

 	std::map<int, int > m;

 	for(int i=0;i<k;i++){
 		int x;
 		cin>>x;
 		while(x--){
 			int z;
 			cin>>z;
 			m[z] = 1;
 		}
 	}
 	int c = 0;
 	for(int i=1;i<=n;i++){
 		if(m[i]==0)c++;
 	}
 	cout<<c<<endl;

}



Measured memory_bytes: 3632
#include<iostream>
#include<string>
#include<typeinfo>
#include<vector>
#include<algorithm>
#include<map>
#include<iomanip>
using namespace std;
int main()
{
	int N, L;
	cin >> N >> L;

	vector<string> S(N);
	for(int i=0; i<N; i++){
		cin >> S.at(i);
	}

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

	for(int i=0; i<N; i++){
		cout << S.at(i);
	}

	cout << endl;
	return 0;
}

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

const double eps = 1e-8;

bool equals(double a, double b) {
  return abs(a - b) < eps;
}

double dot(P a, P b) {
  return a.real()*b.real() + a.imag()*b.imag();
}

P project(P s1, P s2, P p) {
  P base = s2 - s1;
  double t = dot(p - s1, base) / norm(base);
  return s1 + base * t;
}

P reflect(P s1, P s2, P p) {
  return p + (project(s1, s2, p) - p) * 2.0;
}

P getRotateP(P p, double rad, P o = P(0, 0)) {
  P q = p - o;
  return o + P(q.real()*cos(rad) - q.imag()*sin(rad),
	       q.real()*sin(rad) + q.imag()*cos(rad));
}

double degToRad(double deg) {
  return deg * M_PI / 180.0;
}


int main() {
  int N; double D;
  while(cin >> N >> D && !(N == 0 && D == 0)) {
    P pos(0, 0);
    double rad = M_PI / 2.0;
    for(int i = 0; i < N; ++i) {
      double dl, dr, t;
      cin >> dl >> dr >> t;
      double L = degToRad(dl);
      double R = degToRad(dr);
      if(equals(L, R)) {
	pos += P(cos(rad), sin(rad)) * L * t;
      } else if(equals(-L, R)) {
	rad += R * t / D;
      } else {
	bool f1 = false, f2 = false;
	if(abs(L) > abs(R)) {
	  swap(L, R); f2 = true;
	}
	if(R < 0) {
	  L *= -1; R *= -1; f1 = true;
	}
	double r;
	r = (R + L) * D / (R - L);
	double th = R / (r + D);
	P base1(cos(rad), sin(rad));
	P base2 = getRotateP(base1, M_PI/2.0);
	P p;
	p = pos + base2 * r;
	P npos = getRotateP(pos, th * t, p);
	double add = th * t;
	if(f1) {
	  npos = reflect(p, p + base2, npos);
	  add = -add;
	}
	if(f2) {
	  npos = reflect(pos, pos + base1, npos);
	  add = -add;
	}
	pos = npos;
	rad += add;
      }
    }
    printf("%.5f\n%.5f\n", pos.real(), pos.imag());
  }
  return 0;
}

Measured memory_bytes: 1328
p=print
r=range
def a(i,j,k,l=0):p("+<"[l],i,j,k)
def b(i):a(i,i,i+1)
def d(x,i):
	for t in r(30):b(p:=i+t+30);a(q:=p+1,n,q);[*map(b,r(q,i+60))];a(i+60,x,i+t,1);b(p);a(q,i+t,q)
p(n:=3934)
a(0,1,n)
a(2,n,n,1)
a(0,n,3)
a(1,n,4)
d(3,9)
d(4,50)
for t in r(60):a(2,2,2);[t-31<s<30!=(a(8+t-s,50+s,5),a(n,5,6,1),a(2,6,2))for s in r(t)]

Measured memory_bytes: 9212
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll , ll> P;
typedef pair<ll, ll> PL;
const ll INT_INF = 2147483646;
const ll ll_INF = 9223372036854775807;
ll mod = 1e9+7;

bool SecondCompare(const pair<ll,ll> &a,const pair<ll,ll> &b)
{
       return a.second<b.second;
}
 
bool SecondCompareDes(const pair<ll,ll> &a,const pair<ll,ll> &b)
{
       return a.second>b.second;
}


ll f[200005],rf[200005];
ll pw(ll a, ll b){
	ll res = 1;
	while(b){
		if(b%2) res = (res*a)%mod;
		a = (a*a)%mod;
		b/=2;
	}
	return res;
}

ll ncr(ll a, ll b){
	return (((f[a]*rf[b])%mod)*rf[a-b])%mod;
}
 
ll a[200005],b[200005],cou,c[200005];
ll n,m;
int main(){
    cin >> n >> m;
    if(n == 1){
        cout << 1 << endl;
        return 0;
    }
/*
    cou = 0;
    for(ll i = 2; i <= 200000; i++){
        if(a[i] == 0){
            b[cou] = i;
            ++cou;
            for(ll j = i; j <= 200000; j += i){
                ++a[j];
            }
        }
    }
*/
 ll cou1 = -1;
 ll mem = m;
for(int i = 2; i*i <= m; i++){
    if(mem%i == 0)  ++cou1;
    while(mem%i==0){
        mem /= i;
        ++c[cou1];
    }
}
if(mem != 1){
    ++cou1;
    ++c[cou1];
}
   
/*
    for(ll i = 0; m != 1; i++){
        if(m%b[i] == 0) ++cou1;
        while(m % b[i] == 0){
            m/= b[i];
            ++c[cou1];
        }
    }
*/
    ll ans = 1;

    f[0] = 1;
	for(ll i=1;i<=200000;i++) f[i] = (f[i-1]*i)%mod;
	for(ll i=0;i<=200000;i++) rf[i] = pw(f[i], mod-2);

    for(ll i = 0; i <= cou1; i++){
        ans = (ans * ncr(c[i]+n-1,c[i]))%mod;
    }

    cout << ans << endl;
}

Measured memory_bytes: 3968
#include <iostream>
#include <algorithm>

using namespace std;

//大きい方から数えて2番目に注意
//小さい方からではない
int main(void){
  int A, B, K;
  cin >> A; cin >> B; cin >> K;
  int i = max(A, B);
  int count = 0;
  while(1){
    //AもBも割り切れるときカウントしていく
    if(A%i == 0 && B%i == 0){
      //cout << "約数:" << i << endl;
      count++;
      //AもBも割り切る数字がK個になればwhileを抜ける
      if(count == K)
	break;
    }
    i--;
  }

  cout << i << endl;

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<limits>
#include<sstream> 
#include<unordered_map>      

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;
typedef vector<int> vi;
typedef vector<ll> vl;

const int inf = numeric_limits<int>::max() >> 2;
const ll linf = numeric_limits<ll>::max() >> 2;
const ull ulinf = numeric_limits<ull>::max() >> 2;
const double pi = acos(-1);
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int dx8[8]={-1,0,1,-1,1,-1,0,1};
const int dy8[8]={-1,-1,-1,0,0,1,1,1};

#define p_queue(i) priority_queue<i> 
#define rp_queue(i) priority_queue<i, vector<i>, greater<i>> 
#define umap(i,j) unordered_map<i,j>
#define P(p) cout<<(p)<<endl
#define PS(p) cout<<(p)<< " "
#define IN cin >> 
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i = (m-1); i >= (int)(n); i--)
#define inrep(n,a) for(int i = 0; i < (int)(n); i++)cin >> a[i];
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define rsort(a,b,c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end())
#define rvsort(v,c) sort(v.begin(), v.end(), greater<c>()) 
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a,n,k) (lower_bound(a,a+n,k) - a) 
#define vlb(a,k)  (lower_bound(a.begin(),a.end(),k) - a.begin())
#define ub(a,n,k) (upper_bound(a,a+n,k) - a) 
#define vub(a,k)  (upper_bound(a.begin(),a.end(),k) - a.begin())
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return

ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

vector<string> split(const string &str, char sep){
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.push_back(buffer);
    }
    return v;
}

//ll ncr[100][100];
//ll nCr(int n, int r){if(n==r) ret ncr[n][r] = 1; if(r==0) ret ncr[n][r] = 1; if(r==1) ret ncr[n][r] = n;if(ncr[n][r]) ret ncr[n][r]; ret ncr[n][r] = nCr(n-1,r) + nCr(n-1,r-1);}

//ll npr[100][100]={};
//ll nPr(int n,int r){if(npr[n][r])ret npr[n][r];if(r==0)ret npr[n][r] = 1;if(r==1)ret npr[n][r] = n;ret npr[n][r] = n * nPr(n-1,r-1);}

//ll nHr(int n,int r){ret nCr(n+r-1,r);}

///////////////////////////////////////////////////////////////////////////


int main(){
    int n,t,a;
    cin >> n >> t >> a;
    double h[n];
    inrep(n,h);

    int ans = 0;
    rep(i,1,n){
        if(abs(a - (t - h[ans] * 0.006 )) > abs(a - (t - h[i] * 0.006 )))ans = i;
    }
    P(ans + 1);
    
	return  0;
}

Measured memory_bytes: 256
def main():
	N, K = [int(x) for x in input().split(" ")]
	P = [int(p) for p in input().split(" ")]
	E = [sum(P[:K])]
	for i in range(N - K):
		E.append(E[-1] - P[i] + P[i + K])
	print((max(E) + K)/2)

main()

Measured memory_bytes: 31996
A,B,M=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
L=[list(map(int,input().split())) for i in range(M)]
MA=min(a)
MB=min(b)
MC=MA+MB
for i in range(M):
  if a[L[i][0]-1]+b[L[i][1]-1]-L[i][2]<MC:
    MC=a[L[i][0]-1]+b[L[i][1]-1]-L[i][2]
print(MC)

Measured memory_bytes: 38568
#pragma region include
#include <stdio.h>
#include <string>
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <map>
#pragma endregion
using namespace std;

#pragma region 定数
#define INF_VAL (2147483647 - 1)
#define INF_VAL_MINUS -INFVAL
#pragma endregion

#pragma region マクロ
// 配列の長さを取得する(ただし関数内ではポインタサイズに注意)
#define SIZE_OF_ARRAY(array) sizeof(array) / sizeof(*array)

// ソート
#define Sort(array, length) sort(array, array + length)
#define SortDESC(array, length) sort(array, array + length, greater<>())

// 配列の最大値、最小値取得
#define MAX_OF_ARRAY(array, length) *max_element(array, array + length)
#define MIN_OF_ARRAY(array, length) *min_element(array, array + length)

// 結果出力系
#define YES                    \
    {                          \
        cout << "YES" << endl; \
        return 0;              \
    }
#define NO                    \
    {                         \
        cout << "NO" << endl; \
        return 0;             \
    }
#define Yes                    \
    {                          \
        cout << "Yes" << endl; \
        return 0;              \
    }
#define No                    \
    {                         \
        cout << "No" << endl; \
        return 0;             \
    }
#pragma endregion

#pragma region Utility
#pragma region 配列要素の合計値を取得
template <typename T>
T getSum(T array[], int length)
{
    T sum = 0;
    for (int i = 0; i < length; i++)
    {
        sum += array[i];
    }
    return sum;
}
#pragma endregion

#pragma region ToString(int)
string ToString(int i)
{
    char buffer[1000];
    sprintf(buffer, "%d", i);
    return string(buffer);
}
#pragma endregion

#pragma region 10進数からN進数(<= 10) へ変換
string convertToN(long n, int base)
{
    string ans = "";
    while (n != 0)
    {
        int temp = n % base; // 1桁取得
        ans = ToString(temp) + ans;
        n /= base;
    }
    return ans;
}
#pragma endregion
#pragma endregion

int main()
{
    // 標準入力から値を取得
    int n;
    cin >> n;

    // 入力数がN個の場合
    string array[n];
    for (int i = 0; i < n; i++)
    {
        cin >> array[i];
    }

    // 連想配列を作成し、出現文字列の数をカウントする
    map<string, int> str_count;
    for (int i = 0; i < n; i++)
    {
        str_count[array[i]] += 1;
    }

    // 最大カウント回数を求める
    int max_val = -1;
    map<string, int>::iterator begin = str_count.begin(), end = str_count.end();
    for (map<string, int>::iterator iter = begin; iter != end; iter++)
    {
        max_val = max(max_val, iter->second);
    }

    for (map<string, int>::iterator iter = begin; iter != end; iter++)
    {
        if (iter->second == max_val)
        {
            printf("%s\n", iter->first.c_str());
        }
    }
}


Measured memory_bytes: 26752
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<queue>
#include<stack>
#include<map>
#include<set>

using namespace std;

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

#define reps(i,f,n) for(int i = int(f); i <= int(n); i++)
#define rep(i,n) reps(i,0,int(n)-1)
#define rrep(i,n) for(int i = n-1; i >= 0; i--)

#define all(x) (x).begin(),(x).end()
#define X first
#define Y second

#define sz size()
#define eb emplace_back

int s[1024];

int main(void){
  int n;
  reps(i,1,999){
    int sum = i;
    reps(j,i+1,1000){
      sum += j;
      if( sum > 1000)break;
      s[sum]++;
    }
  }

  while(cin >> n,n){
    cout << s[n] << endl;
  }


  return 0;
}

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

const long long MOD = 1e9 + 7;

long long inv(long long n){
    long long t=1;
    while (n > 1) {
        t = t * (MOD - MOD / n) % MOD;
        n = MOD % n;
    }

    return t;
}

long long comb(long long n,long long k){
    if (k > n - k) k = n - k;
    long long numerator = 1, denominator = 1;
    for (int i = 1; i < k + 1; i++) {
        numerator = numerator * (n + 1 - i) % MOD;
        denominator = denominator * i % MOD;
    }

    return numerator * inv(denominator) % MOD;
}


int main() {
    int X, Y; cin >> X >> Y;
    if (X < Y) {
        int prevY = Y;
        Y = X;
        X = prevY;
    }

    if (X > Y * 2 || (X + Y) % 3 != 0) {
        cout << 0 << endl;
        return 0;
    }

    int n = (2 * Y - X) / 3;
    int m = (2 * X - Y) / 3;

    long long ans = 0;
    cout << comb(n + m, m) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
ifstream in("file.in");
ofstream out("file.out");
#define MAXN 100005
#define INF 1000000005
#define LINF 1000000000000000005

///________CODE_STARTS_HERE________\\\

long long n,d[100005],a,b,cnt;

int main(){
    ios_base :: sync_with_stdio(0);
    cin >> n >> a >> b;
    for(int i=1;i<=n;i++){
        cin >> d[i];
    }
    for(int i=1;i<n;i++){
        cnt+=min(b,a*(d[i+1]-d[i]));
    }
    cout << cnt;
}


Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>

using namespace std;
typedef long long LL;
LL m,n,t;
LL a[100005];
bool judge(LL mid)
{
    LL ans=mid;
    for(int i=0;i<t;i++)
    {
        int flag=1;
        LL c=a[i]-mid*m;
        if(c>0)
        {
            if(c%(n-m)==0)
                flag=0;
            ans-=c/(n-m)+flag;
            if(ans<0)
                return false;
        }
    }
    return true;
}
int main()
{
    cin>>t>>n>>m;
    LL maxn=0;
    for(int i=0;i<t;i++)
    {
        cin>>a[i];
        maxn=max(maxn,a[i]);
    }
    LL st=0,en=maxn;
    while(st<en)
    {
        LL mid=en+st>>1;
        if(judge(mid))
            en=mid;
        else
            st=mid+1;
    }
    cout<<en;
    return 0;
}

Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {

  static int upLimit;
  static int count = 0;

  static void counter(String number, String add) {
    number += add;
    if (Long.parseLong(number) > upLimit) {
      return;
    }
    if (is753(number)) {
      count++;
    }
    counter(number, "3");
    counter(number, "5");
    counter(number, "7");
  }

  static boolean is753(String number) {
    boolean is7 = false, is5 = false, is3 = false;
    for (int i = 1; i < number.length(); i++) {
      if (number.charAt(i) == '7') {
        is7 = true;
      } else if (number.charAt(i) == '5') {
        is5 = true;
      } else if (number.charAt(i) == '3') {
        is3 = true;
      }
    }
    if (is7 && is5 && is3) {
      return true;
    } else {
      return false;
    }
  }

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    upLimit = sc.nextInt();
    counter("0", "3");
    counter("0", "5");
    counter("0", "7");
    System.out.println(count);
  }

}


Measured memory_bytes: 36796