akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define INF 9223372036854775807LL
#define inf 1000000007
#define SYOU(x) setprecision(x+1)
#define lol long long
#define mp make_pair
#define fi first
#define se second
using namespace std;
using pii = pair<int, int>;
lol abs(lol x,lol y){return(x>y?x-y:y-x);}
lol max(lol x,lol y){if(x>y)return x;return y;}
lol min(lol x,lol y){if(x<y)return x;return y;}
int han[100010];
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  string ans="";
  int h,w;
  cin >>h>>w;
  for(int i=1;i<=h;i++){
    for(int j=0;j<w;j++){
      string q;
      cin >>q;
      if(q=="snuke"){
	ans=(char)(j+'A');
	if(i<10) ans+=(char)i+'0';
	else ans+=(char)i/10+'0',ans+=(char)i%10+'0';
      }
    }
  }
  cout <<ans<<'\n';
    
  return (0);
}


Measured memory_bytes: 256
n = int(input())
A = list(sorted(list(map(int,input().split()))))

D=set()
S=set()
for i in range(n):
    if A[i] in S:
        D.add(A[i])
    else:
        S.add(A[i])

biggest = max(S)
dp = [1 for i in range(biggest+1)]
for i in S:
  if i in D:
    dp[i] = 0
  for j in range(2*i,biggest+1,i):
    dp[j] = 0

ans = 0
for i in A:
  ans += dp[i]
print(ans)

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

using ll = long long;
#define int long long

// [a -> b-1]
#define reps(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
// [0 -> a-1]
#define rep(i, a) reps(i, 0, (a))
// [a-1 -> b]
#define rreps(i, a, b) for (int i = (int)((a)-1); i >= (int)(b); i--)
// [a-1 -> 0]
#define rrep(i, a) rreps(i, a, 0)
#define all(v) (v).begin(), (v).end()
// next_permutation(all(v))
#define PERM(v) next_permutation(all(v))
/*sort(all(v));
 * (v).erase(unique(all(v)), v.end())*/
#define UNIQUE(v)\
	sort(all(v));\
	(v).erase(unique(all(v)), v.end())
#define MINV(v) min_element(all(v))
#define MAXV(v) max_element(all(v))
#define MIN3(a, b, c) min(min(a, b), c)
#define MIN4(a, b, c, d) min(MIN3(a, b, c), d)
#define MIN5(a, b, c, d, e) min(MIN4(a, b, c, d), e)
#define MIN6(a, b, c, d, e, f) min(MIN5(a, b, c, d, e), f)
#define MAX3(a, b, c) max(max(a, b), c)
#define MAX4(a, b, c, d) max(MAX3(a, b, c), d)
#define MAX5(a, b, c, d, e) max(MAX4(a, b, c, d), e)
#define MAX6(a, b, c, d, e, f) max(MAX5(a, b, c, d, e), f)
// b is [a, c)
#define RANGE(a, b, c) ((a) <= (b) && (b) < (c))
// c is [a, e) && d is [b, f)
#define RANGE2D(a, b, c, d, e, f) (RANGE((a), (c), (e)) && RANGE((b), (d), (f)))
#define chmin(a, b) a = min(a, (b))
#define chmin3(a, b, c) a = MIN3(a, (b), (c))
#define chmin4(a, b, c, d) a = MIN4(a, (b), (c), (d))
#define chmin5(a, b, c, d, e) a = MIN5(a, (b), (c), (d), (e))
#define chmin6(a, b, c, d, e, f) a = MIN6(a, (b), (c), (d), (e), (f))
#define chmax(a, b) a = max(a, (b))
#define chmax3(a, b, c) a = MAX3(a, (b), (c))
#define chmax4(a, b, c, d) a = MAX4(a, (b), (c), (d))
#define chmax5(a, b, c, d, e) a = MAX5(a, (b), (c), (d), (e))
#define chmax6(a, b, c, d, e, f) a = MAX6(a, (b), (c), (d), (e), (f))
#define fcout cout << fixed << setprecision(15)
#define YES(f) cout << ((f) ? YES_STR : NO_STR) << endl;


void solve(long long N, std::vector<long long> A, std::vector<long long> B, std::vector<long long> C) {
	int res = 0;
	rep(i, N) {
		res += B[i];
	}
	rep(i, N-1) {
		if (A[i] + 1 == A[i+1]) {
			res += C[A[i]-1];
		}
	}
	cout << res << endl;
}

signed main() {
	long long N;
	scanf("%lld",&N);
	std::vector<long long> A(N);
	for(int i = 0 ; i < N ; i++){
		scanf("%lld",&A[i]);
	}
	std::vector<long long> B(N);
	for(int i = 0 ; i < N ; i++){
		scanf("%lld",&B[i]);
	}
	std::vector<long long> C(N-1);
	for(int i = 0 ; i < N-1 ; i++){
		scanf("%lld",&C[i]);
	}
	solve(N, std::move(A), std::move(B), std::move(C));
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<map>
#include<queue>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main(){
    deque<char> deq;
    string s;
    cin>>s;
    rep(i,s.size()) deq.push_back(s.at(i));
    int q;
    cin>>q;
    int t1sum=0;
    rep(i,q){
        int t;
        cin>>t;
        if(t==1) t1sum++;
        else{
            int f;
            cin>>f;
            char c;
            cin>>c;
            if(f==1){
                if(t1sum%2==0) deq.push_front(c);
                else deq.push_back(c);
            }
            else{
                if(t1sum%2==0) deq.push_back(c);
                else deq.push_front(c);
            }
        }
    }
    if(t1sum%2==1) reverse(deq.begin(),deq.end());
    while(!deq.empty()){
        cout<<deq.front();
        deq.pop_front();
    }
    cout<<endl;
}


Measured memory_bytes: 896
#include<iostream>
#include<cstdio>
#include<cmath>
#include <string> 
using namespace std;

int main(){
	string num;
	int t;
	while( getline(cin,num)){
		while(1){
			for(int i=0;num[i]!='\0';i++){
				if(num[i]=='a'){
					num[i]='z';
				}
				else if(num[i]>'a'&& num[i]<='z'){
					num[i]--;
				}
			}
			t=0;
			for(int i=0;num[i]!='\0';i++){
				if(num[i]=='t' && num[i+1]=='h'){
					if(num[i+2]=='e')t=1;
					if(num[i+2]=='i'&&num[i+3]=='s')t=1;
					if(num[i+2]=='a'&&num[i+3]=='t')t=1;
				}
			}
			if(t==1)break;
		}
		cout << num << "\n";
	}
	return 0;
}

Measured memory_bytes: 2988
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <cmath>
#include <map>
#include <climits>
#include <cassert>
#include <algorithm>
#include <utility>

using namespace std;
using Int = long long int;
using UInt = unsigned long long int;
using VI = vector<long long int>;
using VVI = vector<vector<long long int> >;


int main(void) {
    string s;
    cin >> s;
    string t = "CODEFESTIVAL2016";
    Int count = 0;
    for (Int i = 0; i < (Int)s.length(); ++i) {
        if (s[i] != t[i]) {
            count++;
        }
    }
    cout << count << endl;
    return 0;
}


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

using namespace std;

using ll = long long;
constexpr ll MOD = 1e9 + 7;
constexpr ll INF = 1e18;

int main() {
    ll n, m, i, j, k;
    string s;
    cin >> s;
    if(s=="ABC"){
        cout << "ARC" << endl;
    }else{
        cout << "ABC" << endl;
    }
    return 0;
}

Measured memory_bytes: 3600
use std::io;


fn main() {
    let n = read_one::<usize>();
    println!("{}", n * 800 - (n / 15) * 200);
}


#[allow(dead_code)]
fn read<T>() -> Vec<T>
where T:
    std::str::FromStr,
    T::Err: std::fmt::Debug {

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.split_whitespace()
        .map(|s| s.trim().parse().unwrap())
        .collect()
}

#[allow(dead_code)]
fn read_one<T>() -> T
where T:
    std::str::FromStr,
    T::Err: std::fmt::Debug {

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.trim().parse().unwrap()
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n); i >= 0; i--)
#define REP(i, m, n) for (int i = (int)(m); i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
typedef long long ll;

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

const long long INF = 1LL << 60;

int main(){
  double a, b, h, m;
  cin >> a >> b >> h >> m;
  double c = (h*60+m) / 2;
  double t = m * 6; 
  double w = min(abs(c-t), 360-abs(c-t));

  double tmp = a*a + b*b - 2*a*b*cos(M_PI * (w/180));

  cout << fixed << setprecision(20);
  cout << sqrt(tmp) << endl;

  return 0;
}


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

int main(void){
	const int SIZE = 10005;
	long long int a[SIZE];
	int N;
	cin >> N;
	for(int i = 0; i < N; ++i){
		cin >> a[i];
		//cout << a[i] << endl;
	}
	int num_even_elem = 0;
	for(int i = 0; i < N; ++i){
		while(a[i] >= 1){
			if(a[i] % 2 == 0){
				a[i] = a[i] / 2;
				//cout << a[i] << endl;
				num_even_elem++;
			} else {
				break;
			}
		}
	}
	cout << num_even_elem << endl;
	return 0;	
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define inp "inp"
#define out "out"
using namespace std;
bool cmp (pair <long long ,long long > a,pair <long long ,long long > b){
return a.second<b.second;
}
long long  n;
pair <long long ,long long > ans[200005],v[2000005];
void Input ()
{
    std::ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin>>n;
    for (long long  i=1;i<=n;i++){
        cin>>v[i].first;
        v[i].second=i;
    }
    sort(v+1,v+1+n);
    for (long long  i=1;i<=n;i++){
        ans[i].first=v[n].first;
        ans[i].second=v[i].second;
    }
    ans[n].first=v[n-1].first;
    sort (ans+1,ans+1+n,cmp);
    for (long long  i=1;i<=n;i++){
        cout<<ans[i].first<<endl;
    }
}
 main()
{
    Input();
    return 0;
}


Measured memory_bytes: 9344
#include <iostream>

using namespace std;

struct aaa
{
	int x;
	int y;
};

int main()
{
	int n, m;
	cin >> n >> m;
	
	aaa student[n];
	for(int i = 0; i < n; i++)
	{
		cin >> student[i].x >> student[i].y;
	}

	aaa check[m];
	for(int i = 0; i < m; i++)
	{
		cin >> check[i].x >> check[i].y;
	}
	
	for(int i = 0; i < n; i++)
	{
		long long min = 0;
		int dx = 0;
		for(int j = 0; j < m; j++)
		{
			long long distance = (student[i].x - check[j].x > 0 ? student[i].x - check[j].x : check[j].x - student[i].x) + (student[i].y - check[j].y > 0 ? student[i].y - check[j].y : -(student[i].y - check[j].y));
			
			if(j == 0)
			{
				min = distance;
				dx = j + 1;
			}
			else if(min > distance)
			{
				min = distance;
				dx = j + 1;
			}
		}
		cout << dx << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define X first
#define Y second

map<pair<ll,ll>,ll> lol;
int main() {
ll n;
cin>>n;
vector<pair<ll,ll>> a(n);
for(int i=0;i<n;i++)
    cin>>a[i].X>>a[i].Y;
ll ansx=-1,ansy=-1;
for(int i=0;i<n;i++)
    for(int j=i+1;j<n;j++)
        {lol[{a[i].X-a[j].X,a[i].Y-a[j].Y}]++,lol[{-a[i].X+a[j].X,-a[i].Y+a[j].Y}]++;
        if(lol[{ansx,ansy}]<lol[{a[i].X-a[j].X,a[i].Y-a[j].Y}]) ansx=a[i].X-a[j].X,ansy=a[i].Y-a[j].Y;
        if(lol[{ansx,ansy}]<lol[{-a[i].X+a[j].X,-a[i].Y+a[j].Y}]) ansx=-a[i].X+a[j].X,ansy=-a[i].Y+a[j].Y;
        }
    cout<<n-lol[{ansx,ansy}];
return 0;
}


Measured memory_bytes: 384
n=int(input())
a=list(map(int,input().split()))

ans=0
mn=0
mi=abs(a[0])
for i in range(n):
    if a[i]<=0:
        mn += 1
    s=abs(a[i])
    ans += s
    mi=min(s,mi)
if mn%2==1:
    ans -= mi*2
print(ans)

Measured memory_bytes: 14412
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> PI;
ll a[200010],sum[200010];
int main(){
	int N;
	scanf("%d",&N);
	for(int i=1;i<=N;i++){
		scanf("%lld",a+i);
		sum[i]=sum[i-1]+a[i];
	}
	ll ans=1LL<<62;
	for(int i=1;i<N;i++){
		ans=min(ans,abs(sum[N]-2*sum[i]));
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 3328
s = input()
mae = int(s[:2])
usiro = int(s[-2:])
if 1 <= mae <= 12 and 1 <= usiro <=12:
    print('AMBIGUOUS')
elif 1 <= mae <= 12:
    print('MMYY')
elif 1 <= usiro <=12:
    print('YYMM')
else:
    print('NA')


Measured memory_bytes: 2940
from sys import stdin, exit

N, G = map(int, stdin.readline().split())
left, right = 1, N
for i in range(G):
    l, r = map(int, stdin.readline().split())
    if l > left:
        left = l
    if r < right:
        right = r
    if right < left:
        print(0)
        exit()

print(right - left + 1)

Measured memory_bytes: 3060
#include"bits/stdc++.h"
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 10000000009
#define MX 200005
#define MOD 1000000007

using namespace std;
int n;
char men(char a[],char r,int i){
    if(r=='o'){
        if(a[i]=='S'){
            if(a[(i+1)%n]=='S')a[(i+2)%n]='S';
            else a[(i+2)%n]='W';
        }else{
            if(a[(i+1)%n]=='S')a[(i+2)%n]='W';
            else a[(i+2)%n]='S';
        }
    }else{
        if(a[i]=='S'){
            if(a[(i+1)%n]=='S')a[(i+2)%n]='W';
            else a[(i+2)%n]='S';
        }else{
            if(a[(i+1)%n]=='S')a[(i+2)%n]='S';
            else a[(i+2)%n]='W';
        }
    }
    return a[(i+2)%n];
}

int main(){
    cin>>n;
    char a[MX],b[MX],c[MX],d[MX];
    a[0]='S';a[1]='S';
    b[0]='S';b[1]='W';
    c[0]='W';c[1]='S';
    d[0]='W';d[1]='W';
    char r0;
    cin>>r0;
    rep(i,n-2){
        char r;
        cin>>r;
        men(a,r,i);
        men(b,r,i);
        men(c,r,i);
        men(d,r,i);
    }
    char r1;
    cin>>r1;
    if('S'==men(a,r1,n-2)&&'S'==men(a,r0,n-1))cout<<a;
    else if('S'==men(b,r1,n-2)&&'W'==men(b,r0,n-1))cout<<b;
    else if('W'==men(c,r1,n-2)&&'S'==men(c,r0,n-1))cout<<c;
    else if('W'==men(d,r1,n-2)&&'W'==men(d,r0,n-1))cout<<d;
    else cout<<-1<<endl;
    return 0;
}

Measured memory_bytes: 768
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<unordered_map>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())





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

	char c;
	cin >> c;
	cout << (char)(c + 1) << endl;



	return 0;
}

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


int main(){
	int N;
	int array[100010]={};
	int input=0;
	cin >> N;
	for(int i=0;i<N;i++){
		cin >> input;
		array[input-1]++;
		array[input]++;
		array[input+1]++;
	}
	
	int answer=0;
	for(int i=0;i<100001;i++){
		answer = max(answer,array[i]);
	}
	
	cout << answer << endl;
	
	return 0;
}

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

int main()
{
	ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long a;
	float b; 
	cin>>a>>b;

	int B = b*100 + 0.01;
	long long ans = (a * B) / 100;

	cout << ans;


  return 0;
}


Measured memory_bytes: 3744
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
constexpr int MOD=1000000007;
#define INF (1<<30)
#define LINF (lint)(1LL<<56)
#define endl "\n"
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcount(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
#define plint pair<lint,lint>
#define fi first
#define se second
typedef long long lint;
int dx[8]={1,1,0,-1,-1,-1,0,1};
int dy[8]={0,1,1,1,0,-1,-1,-1};
const int MAX_N=2e5+5;

int main(void){
    double R;
    cin >> R;
    cout << R*2*M_PI << endl;
}


Measured memory_bytes: 3800
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define debug(x)      cerr << "L" << __LINE__ << ": " << #x << " = " << (x) << endl
#define YN(x)         cout << ((x) ? "YES" : "NO") << endl
#define Yn(x)         cout << ((x) ? "Yes" : "No") << endl
#define yn(x)         cout << ((x) ? "yes" : "no") << endl
#define absi(x)       ( ((x) >= 0) ? (x) : (-(x)) )
#define debugvec(v)   rep(i, v.size()) cerr << "L" << __LINE__ << ": " << #v << "[" << i << "] = " << v[i] << endl;
#define debugvec2(v)  cerr << "L" << __LINE__ << ": " << #v << " = { "; rep(i, v.size()) cerr << v[i] << (i + 1 == v.size() ? "" : ", "); cerr << " }" << endl;
typedef long long ll;  // 10^18 くらいまでいける

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

const ll INF = 1LL << 60;

int main(){

  int a, b, c;

  cin >> a >> b >> c;

  string ans = "No";
  if (a!=b && b==c && c!=a)
    ans = "Yes";
  else if (a==b && b!=c && c!=a)
    ans = "Yes";
  else if (a!=b && b!=c && c==a)
    ans = "Yes";
  
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 20;
const int MAXS = 65536 + 5;
const int P = 1e9 + 7;
template <typename T> void chkmax(T &x, T y) {x = max(x, y); }
template <typename T> void chkmin(T &x, T y) {x = min(x, y); } 
template <typename T> void read(T &x) {
	x = 0; int f = 1;
	char c = getchar();
	for (; !isdigit(c); c = getchar()) if (c == '-') f = -f;
	for (; isdigit(c); c = getchar()) x = x * 10 + c - '0';
	x *= f;
}
template <typename T> void write(T x) {
	if (x < 0) x = -x, putchar('-');
	if (x > 9) write(x / 10);
	putchar(x % 10 + '0');
}
template <typename T> void writeln(T x) {
	write(x);
	puts("");
}
int n, m, a[MAXN], bit[MAXN], c[MAXS];
int fac[MAXS], inv[MAXS], dp[MAXN][MAXS];
int power(int x, int y) {
	if (y == 0) return 1;
	int tmp = power(x, y / 2);
	if (y % 2 == 0) return 1ll * tmp * tmp % P;
	else return 1ll * tmp * tmp % P * x % P;
}
void update(int &x, int y) {
	x = (x + y) % P;
}
int getc(int x, int y) {
	return 1ll * fac[x] * inv[y] % P * inv[x - y] % P;
}
int main() {
	read(n), read(m);
	for (int i = 1; i <= m; i++)
		read(a[i]);
	for (int i = 0; i <= n - 1; i++)
		bit[i] = 1 << i;
	reverse(a + 1, a + m + 1);
	int cnt = 1 << n; fac[0] = 1;
	for (int i = 1; i <= cnt; i++)
		fac[i] = 1ll * fac[i - 1] * i % P;
	inv[cnt] = power(fac[cnt], P - 2);
	for (int i = cnt - 1; i >= 0; i--)
		inv[i] = inv[i + 1] * (i + 1ll) % P;
	int u = (1 << n) - 1; dp[0][0] = 1;
	for (int i = 1; i <= m; i++)
	for (int s = 0; s <= u; s++) {
		int lft = cnt - a[i] + 1 - s;
		update(dp[i][s], dp[i - 1][s]);
		for (int j = 0; j <= n - 1; j++) {
			if (lft < bit[j]) break;
			if (bit[j] & s) continue;
			update(dp[i][s ^ bit[j]], 1ll * dp[i - 1][s] * getc(lft - 1, bit[j] - 1) % P * fac[bit[j]] % P);
		}
	}
	int ans = fac[cnt - 1]; c[0] = 1;
	for (int s = 1; s <= u; s++) {
		c[s] = -c[s - (s & -s)];
		update(ans, 1ll * c[s] * dp[m][s] * fac[cnt - 1 - s] % P);
	}
	ans = (1ll * ans * cnt % P + P) % P;
	writeln(ans);
	return 0;
}

Measured memory_bytes: 5120
#include <iostream>

using namespace std;

int main(int argc, char** argv)
{
	int w;
	int fare;

	while( 1 )
	{
		cin >> w;
		if(w==-1) break;
		
		fare = 1150;
		if(w > 10) w -= 10;
		else w = 0;
		
		if(w > 10) fare += 1250, w -= 10;
		else fare += w * 125, w = 0;

		if(w > 10) fare += 1400, w -= 10;
		else fare += w * 140, w = 0;

		fare += w * 160;

		cout << 4280 - fare << endl;		
	}
}

Measured memory_bytes: 0
#gcdは3.4.3だとfractionsにある
from fractions import gcd
import math

from math import factorial as f

from math import ceil,floor,sqrt


import bisect
import re
import heapq


from copy import deepcopy
import itertools

from sys import exit

ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))


def main():
    n = ii()
    a = li()
    a = list(sorted(a))
    tmp = -1
    for i in a:
        if tmp == i:
            print("NO")
            exit()
        else:
            tmp = i

    print("YES")

main()


Measured memory_bytes: 27176
N,x=map(int,input().split())
A=sorted(list(map(int,input().split())))
cnt=0
for i in range(N-1):
    if x-A[i]>=0:
        cnt+=1
        x-=A[i]
    else:
        break
if x-A[N-1]==0:
    cnt+=1

print(cnt)

Measured memory_bytes: 3060
#ifndef _TEMPLATE_ROOT
#define _TEMPLATE_ROOT
#include "bits/stdc++.h"
using namespace std;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define repl(i, a, b) for(ll i = a; i < (b); ++i)
#define repd(i, a, b) for(int i = b; i >= (a); --i)
#define repdl(i, a, b) for(ll i = b; i >= (a); --i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
template<typename H> bool chmin(H& v1, const H v2) { if (v1 > v2) { v1 = v2; return true; } return false; }
template<typename H> bool chmax(H& v1, const H v2) { if (v1 < v2) { v1 = v2; return true; } return false; }
#endif
#ifndef _TEMPLATE_IO
#define _TEMPLATE_IO

template<typename H> void read(H& head) { cin >> head; }
template<typename H, typename ...T> void read(H& head, T& ...tail) { cin >> head; read(tail...); }
template<typename H> void write(H head) { cout << head << '\n'; }
template<typename H, typename ...T> void write(H head, T ...tail) { cout << head << " "; write(tail...); }
template<typename ...T> void die(T ...tok) { write(tok...); exit(0); }
#endif
#ifndef _TEMPLATE_OPT
#define _TEMPLATE_OPT
#pragma GCC optimize("Ofast")
#pragma GCC target("avx2")
#endif
using namespace std;

int a[500005];

struct Query {
  int l, r, id, ans;
};

// freqcnt
int freq[500005];
int distinct = 0;
void freqadd(int x) { 
//write("FA", x, freq[x], "->", freq[x]+1);
  if (!freq[x]) distinct++; freq[x]++; }
void freqrem(int x) { 
  
//write("FR", x, freq[x], "->", freq[x]-1);
  freq[x]--; if (!freq[x]) distinct--; }
Query query[500005];

int main() {
	cin.tie(0)->sync_with_stdio(0);
	cin.exceptions(cin.failbit);

  int n, q; read(n, q);
  rep(i, 1, n + 1) read(a[i]);
  rep(i, 0, q) read(query[i].l, query[i].r), query[i].id = i;
  
  const int BS = 2000;
  sort(query, query + q, [](const Query& a, const Query& b) {
    if (a.l / BS != b.l / BS) return a.l / BS < b.l / BS;
    else return a.r < b.r;
    });

  // inclusive [cl, cr]
  int cl = 1, cr = 0;
  rep(i, 0, q) {
    int nl = query[i].l, nr = query[i].r;
    while (cl > nl) freqadd(a[--cl]);
    while (cr < nr) freqadd(a[++cr]);
    while (cl < nl) freqrem(a[cl++]);
    while (cr > nr) freqrem(a[cr--]);
    query[i].ans = distinct;
  }

  sort(query, query + q, [](const Query& a, const Query& b) { return a.id < b.id; });
  rep(i, 0, q) write(query[i].ans);
}



Measured memory_bytes: 15456
program abc
	implicit none
	integer :: n,m,l,k,a,b,z
	integer :: si(5)=0,ci(5)=0,x(3)=0   
	read(*,*) n,m
	a = min(10**(n-1),1000*(n-1))
	b = (10**n) - 1
	z = -1
	do k = 1, m
		read(*,*) si(k),ci(k)
	enddo
	do l = a, b
		if(n == 1) then
			x(1) = l
		else if(n == 2) then
			x(2) = mod(l,10)
			x(1) = (l - x(2)) / 10
		else
			x(3) = mod(l,10)
			x(2) = (mod(l,100) - x(3)) / 10
			x(1) = (l - (x(2) * 10 + x(3))) / 100
		endif
		do k = 1, m
			if(x(si(k)) /= ci(k)) goto 999
		enddo		
		z = l
		goto 888
		
999	continue 
	enddo
 
888	continue
	
	if(z == -1) then
		write(*,*) '-1'
	else
		write(*,*) z
	endif
    
end program abc

Measured memory_bytes: 384
#include <iostream>
#include <vector>
using namespace std;
int main(){
  long long int n, K, mod = 1e9 + 7;
  cin >> n >> K;
  vector<int> A(n);
  for(int i = 0; i < n; ++i) cin >> A[i];
  vector< vector< vector<int> > > DP(n+1,vector< vector<int> >(n+1,vector<int>(256,0)));
  DP[0][0][0] = 1;
  for(int i = 0; i < n; ++i){
    for(int j = 0; j < n; ++j){
      for(int k = 0; k < 256; ++k){
        DP[i+1][j][k] += DP[i][j][k];
        DP[i+1][j][k] %= mod;
        DP[i+1][j+1][k^A[i]] += DP[i][j][k];
        DP[i+1][j+1][k^A[i]] %= mod;
      }
    }
  }

  long long int ans = 0ll;
  vector<long long int> factorial(n+1);
  factorial[0] = 1ll;
  for(int i = 1; i <= n; ++i) factorial[i] = (factorial[i-1]*i)%mod;

  for(int i = 1; i <= n; ++i){
    ans += (DP[n][i][K]*factorial[i])%mod;
    ans %= mod;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 11008
#include <iostream>
#include <vector>

using namespace std;

int main() {
	int n, k; cin >> n >> k;
	vector<long long> a(n);
	for (long long& e : a) cin >> e;
	for (int i = k; i < n; ++i)
		cout << (a[i - k] < a[i] ? "Yes" : "No") << endl;

	return 0;
}

Measured memory_bytes: 4836
#include <stdio.h>

int main(void)
{
   int a,b,c,d,s;

   scanf("%d%d%d%d",&a,&b,&c,&d);
    
   if ((a <= b) && (c <= d))
    s = a + c;
   else if ((a >= b) && (c <= d))
    s = b + c;
   else if ((a >= b) && (c >= d))
    s = b + d;
   else if ((a <= b) && (c >= d))
    s = a + d;

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


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

#define INF (1<<30)

int main(){
	int n;	cin>>n;
	int a[n];
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	sort(a,a+n);
	//for(int i=0;i<=n;i++)cout<<a[i]<<endl;

	string ans="Yes";
	int x=a[0];
	for(int i=1;i<n;i++){
		x=x^a[i];
	}

	if(x^0)ans="No";

	cout<<ans<<endl;


	return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

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

#define MOD 1000000007
#define REP(i, N) for (int i = 0; i < N; ++i)
#define REP1(i, N) for (int i = 1; i <= N; ++i)
#define RREP(i, N) for (int i = N - 1; i >= 0; --i)
#define ALL(a) a.begin(), a.end()

int N, Q;
string s;
vector<char> t(200010), d(200010);

bool vanish(int pos, bool left)
{
  bool flag = false;
  REP(i, Q)
  {
    if (t[i] == s[pos - 1])
    {
      if (d[i] == 'R')
        pos++;
      else
        pos--;
      if ((pos == 0 && left) || (pos == N + 1 && !left))
      {
        flag = true;
        break;
      }
    }
  }
  return flag;
}

int meguru(int ok, int ng, bool left)
{
  while (1 < abs(ok - ng))
  {
    int mid = (ok + ng) / 2;
    if (vanish(mid, left))
      ok = mid;
    else
      ng = mid;
  }
  return ok;
}

int main()
{
  cin >> N >> Q;
  cin >> s;
  REP(i, Q)
  cin >> t[i] >> d[i];
  int left = meguru(0, N + 1, true);
  int right = meguru(N + 1, 0, false);
  cout << (right - 1) - left << endl;
  return 0;
}

Measured memory_bytes: 1024
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

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

fn main() {
    let n = read::<usize>();
    let p = read_vec::<i64>();
    let mut ans = 0;
    for i in 1..n - 1 {
        if p[i - 1] < p[i] && p[i] < p[i + 1] {
            ans += 1;
        } else if p[i - 1] > p[i] && p[i] > p[i + 1] {
            ans += 1;
        }
    }
    println!("{}", ans);
    /*
    let s = read::<String>().chars().collect::<Vec<_>>();
    let mut map = HashMap::new();
    for i in 0..s.len() {
        *map.entry(s[i]).or_insert(0) += 1;
    }
    for &key in map.keys() {
        if map[&key] != 2 {
            println!("No");
            return;
        }
    }
    println!("Yes");
    */
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


Measured memory_bytes: 4352
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int X = sc.nextInt();
		int ans = 0;
		int tmpRest = 0;
		int tmpMax = 0;
		int num1;
		int num2;

		for (int c = 1; c <= X; c++) {
			for (int d = 1; d <= X; d++) {
				for (int e = 1; e <= X; e++) {
					if (c >= d) {
						num1 = c;
						num2 = d;
					} else {
						num1 = d;
						num2 = c;
					}
					while ((tmpRest = num1 % num2) != 0) {
						num1 = num2;
						num2 = tmpRest;
					}
					tmpMax = num2;

					if (tmpMax >= e) {
						num1 = tmpMax;
						num2 = e;
					} else {
						num1 = e;
						num2 = tmpMax;
					}
					while ((tmpRest = num1 % num2) != 0) {
						num1 = num2;
						num2 = tmpRest;
					}
					ans = ans + num2;

				}
			}
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 35652
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
 
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=(n)-1;i>=0;i--)
#define VSORT(v) sort(v.begin(), v.end())
#define DVSORT(v) sort(v.begin(), v.end(),greater<int>())
#define SORT(v, n) sort(v, v+n)
#define DSORT(v,n) sort(v, v+n,greater<int>())
#define vi vector<int>
#define pb push_back
#define P pair<int,int>
#define Pll pair<ll,ll>

template <class T> void chmin(T&a,const T&b) { a = min(a,b); }
template <class T> void chmax(T&a,const T&b) { a = max(a,b); }
 
void print(){cout<<endl;}
template <class Head, class... Tail>
void print(Head&& h,Tail&&... t){ 
	if(sizeof...(t)==0)
		cout<<h;
	else
		cout<<h<<' ';
	print(move(t)...);
}
 
const double EPS =1e-9;
const int INF =2e+9;
const ll INFL =9e+18;
const long MOD =1e+9+7;
#define PI 3.14159265258979

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

int main(void){
	int K,T,tem,maxA=0;
	cin>>K>>T;
	REP(i,T){
		cin>>tem;
		chmax(maxA,tem);
	}
	print(max(maxA-1-(K-maxA),0));


	return 0;
}




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

#define rep(i,n) for(i = 0;i < n;++i)
#define all(v) v.begin(), v.end()
using ll = long long;

int main()
{
    ll i,j;
    while(true){
        ll n;
        cin >> n;
        if(n == 0) return 0;
        vector<ll> times(1e5,0);
        for(i = 0;i < n;++i){
            string hatsu,tyaku;
            cin >> hatsu >> tyaku;
            ll h1 = (hatsu.at(0) - '0')*10 + (hatsu.at(1) - '0');
            ll m1 = (hatsu.at(3) - '0')*10 + (hatsu.at(4) - '0');
            ll s1 = (hatsu.at(6) - '0')*10 + (hatsu.at(7) - '0');
            ll tmp1 = h1*60*60 + m1*60 + s1;

            ll h2 = (tyaku.at(0) - '0')*10 + (tyaku.at(1) - '0');
            ll m2 = (tyaku.at(3) - '0')*10 + (tyaku.at(4) - '0');
            ll s2 = (tyaku.at(6) - '0')*10 + (tyaku.at(7) - '0');
            ll tmp2 = h2*60*60 + m2*60 + s2;
            ++times.at(tmp1); --times.at(tmp2);
        }
        for(i = 0;i < times.size()-1;++i){
            times.at(i+1) += times.at(i);
        }
        sort(all(times));
        cout << times.back() << endl;
    }
    return 0;
}


Measured memory_bytes: 3856
#include<bits/stdc++.h>
// Begin Header {{{
#define lli long long int
#define rep(i,n) for(lli i=0; i<n; i++)
#define loop(i, j, n) for(lli i=j; i<n; i++)
#define all(x) (x).begin(), (x).end()
constexpr int INF  = 0x3f3f3f3f;
const long long mod=1e9+7;
const double PI = acos(-1);
using namespace std;
using Graph = vector<vector<lli>>;
using P = pair<int, int>;
// }}} End Header

int main(){
	int a, b;
	cin >> a >> b;
	cout << a*b << endl;
	return 0;
}

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

typedef long long int ll;
typedef vector<int> vi; 
typedef pair<int,int> pi; 
typedef vector<ll> vll; 


#define F first;
#define S second;
#define PB push_back;
#define MP make_pair;
#define rep(i, a, b) for (int i=a; i<b; i++)

int main(){
	ll n,m;
	cin >>n>>m;
	for(ll i= m/n ;i>0;i--){
		if(m%i==0){
			cout<<i;
			break;
		}
	}


	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
using namespace std;
#define rep(i,x) for(ll i = 0; i < (ll)(x); i++)
#define pb push_back
#define eb emplace_back
#define debug(x) cerr << #x << ": " << (x) << "\n";
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<ll>>> vvvl;
const ll INF = numeric_limits<ll>::max()/4;
const ll MOD = 1e9+7;
const int n_max = 1e5+10;

int main(){
    ll n; cin >> n;
    vector<ll> t(n+1,0), x(n+1,0), y(n+1,0);
    rep(i,n)cin >> t[i+1] >> x[i+1] >> y[i+1];
    bool ok = true;
    rep(i,n){
        ll dis = abs(x[i+1] - x[i]) + abs(y[i+1] - y[i]);
        ll time = t[i+1] - t[i];
        ok &= (dis <= time && dis%2 == time%2);
    }

    cout << (ok ? "Yes" : "No") << endl;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
 
using namespace std;
int main()
{
    int n;
    cin>>n;
    string arr[n];
    int c0=0,c1=0,c2=0,c3=0;
    for(int i=0;i<n;i++)
    {
        cin>>arr[i];
        if(arr[i]=="AC")
            c0++;
        if(arr[i]=="WA")
           c1++;
        if(arr[i]=="TLE")
            c2++;
        if(arr[i]=="RE")
           c3++;
    }
    cout<<"AC x "<<c0<<endl;
    cout<<"WA x "<<c1<<endl;
    cout<<"TLE x "<<c2<<endl;
    cout<<"RE x "<<c3<<endl;
    return 0;
}

Measured memory_bytes: 6648
#include<stdio.h>
int main(void){

	int n,i,j,k,an[200];
	int no[3][200],m;

	scanf("%d",&n);
	for(i=0;i<n;i++){
		an[i]=0;
		scanf("%d%d%d",&no[0][i],&no[1][i],&no[2][i]);
	}
	for(i=0;i<3;i++){
		for(j=0;j<n;j++){
			m=no[i][j];
			for(k=0;k<n;k++){
				if(j!=k && no[i][j]==no[i][k]){
					m=0; break;
				}
			}
			an[j]+=m;
		}
	}
	for(i=0;i<n;i++){
		printf("%d\n",an[i]);
	}

	return 0;
}

Measured memory_bytes: 600
import Control.Monad
import Control.Applicative
import Data.List

-- String, Int, Char, IO

-- e.g.
-- 1
-- [a] <- map read . words <$> getline => [1] -> a == 1
-- 1
-- a <- readlLn
-- 1 2 3
-- lst <- map read . words <$> getLine => [1, 2, 3]
-- 1 2 3
-- [l, m, n] <- map read . words <$. getLine :: IO [Int] => [1, 2, 3]
-- 'a'
-- c <- getChar => c == 'a'

main :: IO()
main = do
  n <- readLn :: IO Int
  a <- readLn :: IO Int
  print $ solve n a

solve :: Int -> Int -> Int
solve n a = n*n - a


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

#define N 55

using namespace std;

int n,m;
char t[N][N];

template<typename Drake>
void read(Drake &x){
	x=0;char ch=getchar();bool f=1;
	while(!isdigit(ch)){
		if(ch=='-')f^=1;
		ch=getchar();
	}
	while(isdigit(ch)){
		x=(x<<1)+(x<<3)+(ch^48);
		ch=getchar();
	}
	x*=(2*f-1);
}

template<typename Drake>
void write(Drake x){
	if(x<0){x=-x;putchar('-');}
	if(x>9)write(x/10);
	putchar(x%10+'0');
}

template<typename Drake>
void writeln(Drake x){
	write(x);
	puts("");
}

void init(){
	char a,b,c;
	int aa,bb,cc;
	aa=bb=cc=0;
	cin>>a>>b>>c;
	aa=(a=='a')+(b=='a')+(c=='a');
	bb=(a=='b')+(b=='b')+(c=='b');
	cc=(a=='c')+(b=='c')+(c=='c');
	if(aa==1&&bb==1&&cc==1)
	puts("Yes");
	else puts("No");
}
 
int main(){
	init();
	
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <tuple>
#include <assert.h>
#include <deque>
#include <bitset>
#include <iomanip>
#include <limits>
#include <chrono>
#include <random>
#include <array>
#include <unordered_map>
#include <functional>
#include <complex>
#include <numeric>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
constexpr long long MAX = 5100000;
constexpr long long INF = 1LL << 60;
constexpr int inf = 1000000007;
constexpr long long mod = 1000000007LL;
//constexpr long long mod = 998244353LL;
const long double PI = acos((long double)(-1));

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

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

    int H, W, K; cin >> H >> W >> K;
    int sh, sw, th, tw; cin >> sh >> sw >> th >> tw; sh--; sw--; th--; tw--;
    vector<string> vs(H); for (int i = 0; i < H; i++) cin >> vs[i];

    vector<vector<int>> d(H, vector<int>(W, inf)); d[sh][sw] = 0;
    queue<pair<int, int>> q; q.emplace(sh, sw);
    while (!q.empty()) {
        int h, w; tie(h, w) = q.front();
        q.pop();
        for (int i = h + 1; i < H and i <= h + K; i++) {
            if (vs[i][w] != '.') break;
            if (d[i][w] <= d[h][w]) break;
            if (chmin(d[i][w], d[h][w] + 1)) {
                q.emplace(i, w);
            }
        }
        for (int i = h - 1; i >= 0 and i >= h - K; i--) {
            if (vs[i][w] != '.') break;
            if (d[i][w] <= d[h][w]) break;
            if (chmin(d[i][w], d[h][w] + 1)) {
                q.emplace(i, w);
            }
        }
        for (int i = w + 1; i < W and i <= w + K; i++) {
            if (vs[h][i] != '.') break;
            if (d[h][i] <= d[h][w]) break;
            if (chmin(d[h][i], d[h][w] + 1)) {
                q.emplace(h, i);
            }
        }
        for (int i = w - 1; i >= 0 and i >= w - K; i--) {
            if (vs[h][i] != '.') break;
            if (d[h][i] <= d[h][w]) break;
            if (chmin(d[h][i], d[h][w] + 1)) {
                q.emplace(h, i);
            }
        }
    }
    if (d[th][tw] == inf) d[th][tw] = -1;
    cout << d[th][tw] << endl;
    return 0;
}


Measured memory_bytes: 12124
#[allow(unused_imports)]
use std::cmp::max;
#[allow(unused_imports)]
use std::fmt;
#[allow(unused_imports)]
use std::fmt::Debug;
#[allow(unused_imports)]
use std::io;
#[allow(unused_imports)]
use std::str::FromStr;

fn main() {
    let n: i64 = get_vec_input()[0];
    let mut list: Vec<i64> = Vec::new();

    for i in 1..10 {
        for j in 1..10 {
            list.push(i * j);
        }
    }

    if list.contains(&n) {
        println!("Yes");
    } else {
        println!("No");
    }
}

#[allow(dead_code)]
fn sum_digit2(value: String) -> u32 {
    return value.chars().fold(0u32, |a, b| a + b.to_digit(10).unwrap());
}

#[allow(dead_code)]
fn sum_digit(value: i64) -> i64 {
    if value < 10 {
        return value;
    }
    return sum_digit(value / 10) + value % 10;
}

#[allow(dead_code)]
fn update_max<T>(left: &mut T, right: T)
where
    T: std::cmp::Ord + std::clone::Clone,
{
    if *left < right {
        *left = right.clone();
    }
}

#[allow(dead_code)]
fn update_min<T>(left: &mut T, right: T)
where
    T: std::cmp::Ord + std::clone::Clone,
{
    if *left > right {
        *left = right.clone();
    }
}

#[allow(dead_code)]
fn get_vec_input<T>() -> Vec<T>
where
    T: FromStr,
    T::Err: Debug,
{
    let mut input = String::new();
    io::stdin()
        .read_line(&mut input)
        .expect("Failed to read line");
    let vec: Vec<T> = input
        .split_whitespace()
        .map(|x| x.parse().unwrap())
        .collect();
    vec
}

#[allow(dead_code)]
fn get_tuple_input() -> (u64, f32) {
    let mut s = String::new();
    io::stdin().read_line(&mut s).expect("");
    let mut iter = s.trim().split_whitespace();
    let c: u64 = iter.next().unwrap().parse().unwrap();
    let n: f32 = iter.next().unwrap().parse().unwrap();
    (c, n)
}

#[allow(dead_code)]
fn get_string_input() -> String {
    let mut s = String::new();
    io::stdin().read_line(&mut s).expect("");
    s.trim().to_string()
}


Measured memory_bytes: 4352
s = int(input())
a = [s]
m = 1
while True:
    m += 1
    if a[-1]%2 == 0:
        ai = a[-1]//2  
    else:
        ai = a[-1]*3 + 1
    if ai in a:
        break
    else:
        a.append(ai)
    
print(m)
    

Measured memory_bytes: 3188
import           Control.Monad
import           Data.Foldable
import qualified Data.Sequence as S
import           Data.Sequence ( Seq(..), (<|), (|>) )

data Direction = L | R

data Query = Reverse | InsertHead !Char | AppentLast !Char

main :: IO ()
main = do
  s <- S.fromList <$> getLine
  q <- readLn
  qs <- replicateM q readQuery
  putStrLn $ toList $ solve s L qs

solve :: Seq Char -> Direction -> [Query] -> Seq Char
solve s L []                  = s
solve s R []                  = S.reverse s
solve s L (Reverse      : qs) = solve s R qs
solve s R (Reverse      : qs) = solve s L qs
solve s L (InsertHead c : qs) = solve (c <| s) L qs
solve s R (InsertHead c : qs) = solve (s |> c) R qs
solve s L (AppentLast c : qs) = solve (s |> c) L qs
solve s R (AppentLast c : qs) = solve (c <| s) R qs

readQuery :: IO Query
readQuery = do
  q <- getLine
  case map head (words q) of
    ['1']         -> return $ Reverse
    ['2', '1', c] -> return $ InsertHead c
    ['2', '2', c] -> return $ AppentLast c

Measured memory_bytes: 51836
#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;
  cin >> n;
  vector<int> c;
  rep(i, n) {
    int a;
    cin >> a;
    int sz = c.size();
    int j = lower_bound(c.begin(), c.end(), a) - c.begin() - 1;
    if (j < 0 || a == c[j]) {
      c.insert(c.begin(), a);
    } else {
      c[j] = a;
    }
  }
  cout << c.size() << endl;
  return 0;
}

Measured memory_bytes: 892
n,*l=map(int,open(0).read().split())
d={1:0,2:0,4:0}
for i in l:
  if i%2: d[1]+=1
  elif i%4: d[2]+=1
  else: d[4]+=1
if d[2]: print('YNeos'[d[1]>d[4]::2])
else: print('YNeos'[d[1]-1>d[4]::2])

Measured memory_bytes: 20132
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <cmath> 
using namespace std;

int main(){
    int N, K;
    cin >> N >> K;
    int A[100000];
    for(int i=0;i<N;i++)
        cin >> A[i];

    int answer = 0, num = 0;

    num = K;
    answer++;
    if(N <= K){
        cout << answer << endl;
        return 0;
    }

    for(int i=0;num<N;i++){
        num = num + (K - 1);
        answer++;
    }
    
    cout << answer << endl;
    return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <unordered_map>
#include <map>
#include <algorithm>
#include <set>
#include <unordered_set>
#include <deque>
#include <cmath>
#include <stack>
#include <queue>

using namespace std;

int d;

int main(){
    cin >> d;
    int x = 25 - d;
    cout << "Christmas";
    for(int i = 0; i < x; i++){
        cout << " " << "Eve";
    }

}

Measured memory_bytes: 256
n = int(input())
h = list(map(int, input().split()))
h = h[::-1]
ans = []
x = 0
if n > 1:
    for i in range(1,n):
        if h[i-1] <= h[i]:
            x += 1
        else:
            ans.append(x)
            x = 0
    ans.append(x)
else:
    ans.append(0)
print(max(ans))

Measured memory_bytes: 14252
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int max_n=100005;
int n,l[max_n],r[max_n];
int main(){
    scanf("%d",&n);
    for(int i=1;i<=n;i++)scanf("%d%d",l+i,r+i);
    multiset<ll> L,R;
    ll ans=0;
    L.insert(l[1]),R.insert(l[1]);
    ll sl=0,sr=0;
    for(int i=2;i<=n;i++){
        sl-=r[i]-l[i];
        sr+=r[i-1]-l[i-1];
        ll xl=sl+*L.rbegin(),xr=sr+*R.begin();
        if(l[i]<=xl){
            ans+=xl-l[i];
            L.erase(L.find(xl-sl));
            R.insert(xl-sr);
            L.insert(l[i]-sl);
            L.insert(l[i]-sl);
        }
        else if(l[i]>=xr){
            ans+=l[i]-xr;
            R.erase(R.find(xr-sr));
            L.insert(xr-sl);
            R.insert(l[i]-sr);
            R.insert(l[i]-sr);
        }
        else{
            L.insert(l[i]-sl);
            R.insert(l[i]-sr);
        }
    }
    printf("%lld\n",ans);
    return 0;
}

Measured memory_bytes: 10368
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>

using namespace std;

class BResistorsInParallel {
public:
void solve(std::istream& cin, std::ostream& cout) {
    int n;
    cin >> n;
    vector<double> A(n);

    for (auto &a: A) cin >> a;
    double S = 0;

    for (const auto &a: A)
        S += 1 / a;

    cout << setprecision(10) << 1 / S << endl;
}
};

int main() {
	BResistorsInParallel solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<bitset>
const int N=10000001;
std::bitset<N>p;
int main()
{
	p.set();
	int i,j;
	for(i=2;i*i<N;++i)if(p[i])for(j=i*i;j<N;j+=i)p[j]=0;
	while(scanf("%d",&i),i)
	{
		i-=(i-1)%6;
		while(!(p[i]&&p[i-2]&&p[i-6]&&p[i-8]))i-=6;
		printf("%d\n",i);
	}
	return 0;
}

Measured memory_bytes: 0
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

a,b,c,k = mi()

if a > k:
    print(k)
elif a + b > k:
    print(a)
else:
    ans = a - (k-(a+b))
    print(ans)

Measured memory_bytes: 80124
#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;

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

  int ans = INF;
  for (int k = -100; k <= 100; ++k) {
    int sum = 0;
    for (int i = 0; i < n; ++i) {
      sum += (a[i] - k) * (a[i] - k);
    }
    ans = min(ans, sum);
  }

  cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
int main()
{
	while (true)
	{
		int a, b, n;
		std::cin >> a >> b >> n;
		if (std::cin.eof())
		{
			break;
		}
		std::vector<int>digit(n);
		a %= b;
		int quotient = 0, remainder = a;
		for (int i = 0; i < n; i++)
		{
			remainder *= 10;
			quotient = remainder / b;
			remainder -= quotient * b;
			digit[i] = quotient;
		}
		int sum = 0;
		for (auto i : digit)
		{
			sum += i;
		}
		std::cout << sum << std::endl;
	}
	return 0;
}


Measured memory_bytes: 2972
import sys


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


def dfs(c, n, G, ans):
    count = c
    for i, flag in enumerate(G[n]):
        if flag == 1 and ans[i][0] == 0:
            count += 1
            ans[i][0] = i + 1
            ans[i][1] = count
            ans[i][2] = dfs(count, i, G, ans)
            count = ans[i][2]
    else:
        return count + 1


def main():
    n = int(input())
    G = [[0] * n for _ in range(n)]
    ans = [[0] * 3 for _ in range(n)]
    for i in range(n):
        u, k, *v = map(int, input().split())
        for j in range(k):
            G[u-1][v[j]-1] = 1

    count = 1
    for i in range(n):
        if ans[i][0] == 0:
            ans[i][0] = i + 1
            ans[i][1] = count
            ans[i][2] = dfs(count, i, G, ans)
            count = ans[i][2] + 1

    for i in range(n):
        print(*ans[i])


if __name__ == '__main__':
    main()


Measured memory_bytes: 5692
#include <bits/stdc++.h>
#define ll long long
#define f first
#define s second
#define mod 1000000007
#define N 500043
#define mp(a,b) make_pair(a,b)
#define loop(a,b) for(int i=a;i<b;i++)
#define test int t; cin >> t; while(t--)
using namespace std;

bool solve(ll x,vector<int>&vec,int k)
{
    //cout << x << endl;
    int coun=0;
    for(int i=0;i<vec.size();i++)
    {
        if(vec[i]<=x) continue;
        coun+=vec[i]/x;
        if(coun>k)
            return false;
    }
    return true;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int n,k;
    cin >> n >> k;
    vector<int>vec(n);
    for(int i=0;i<n;i++) cin >> vec[i];
    ll low=1,high=10000000000,ans;
    while(low<=high)
    {
        ll mid=(low+high)/2;
        if(solve(mid,vec,k))
        {
            ans=mid;
            high=mid-1;
        }
        else
            low=mid+1;
    }
    cout << ans;
}


Measured memory_bytes: 3972