akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define int ll
#define double long double
#define nn '\n'
#define YES {cout<<"YES"<<'\n';}
#define NO {cout<<"NO"<<'\n';}
#define Yes {cout<<"Yes"<<'\n';}
#define No {cout<<"No"<<'\n';}
#define yes {cout<<"yes"<<'\n';}
#define no {cout<<"no"<<'\n';}
void YN(bool flg){cout<<(flg?"YES":"NO")<<'\n';}
void Yn(bool flg){cout<<(flg?"Yes":"No")<<'\n';}
void yn(bool flg){cout<<(flg?"yes":"no")<<'\n';}
#define SORT(a) sort(a.begin(),a.end())
#define REVERSE(a) reverse(a.begin(),a.end())
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define out(n) {cout << n << '\n';}
typedef vector<int> VI;
typedef vector<VI> VVI;
const int MOD = 1000000007;
const long long INF = 10e10;
const double PI = acos(-1.0);
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; }
template<class T>auto MAX(const T& a) { return *max_element(a.begin(),a.end()); }
template<class T>auto MIN(const T& a) { return *min_element(a.begin(),a.end()); }
template<class T, class U>U SUM(const T& a, const U& v) { return accumulate(a.begin(),a.end(), v); }
template<class T, class U>int LOWER(const T& a, const U& v) { return lower_bound(a.begin(),a.end(), v) - a.begin(); }
template<class T, class U>int UPPER(const T& a, const U& v) { return upper_bound(a.begin(),a.end(), v) - a.begin(); }
int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { int g = GCD(a, b); return a / g * b; }
int POW(int a, int n) { int r = 1; while (n > 0) { if (n & 1)r *= a; a *= a; n /= 2; }return r; }
int isPrime(int n){if(n<2){return 0;}for(int i=2; i*i<=n; i++){if(n%i==0){return 0;}}return 1;}
/*素因数分解*/map< int, int >prime_factor(int n){map< int, int > ret;for(int i = 2; i * i <= n; i++) {while(n % i == 0) {ret[i]++;n /= i;}}if(n != 1) ret[n] = 1;return ret;}
/*約数列挙*/vector<int> divisor(int n){vector<int> v; for(int i=1; i*i<=n; i++){if(n%i==0){v.push_back(i);if(i!=n/i){v.push_back(n/i);}}}sort(v.begin(),v.end()); return v;}
//----------------ライブラリとか----------------

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout<<fixed<<setprecision(15);

    int n; cin >> n;
    VI p(n); REP(i,n) cin >> p[i];
    int ans = 0;
    REP(i,n-2) if((p[i]<p[i+1]&&p[i+1]<p[i+2]) || (p[i]>p[i+1]&&p[i+1]>p[i+2])) ans++;
    out(ans);

    return 0;
}

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

#define ub upper_bound
#define sum(a) accumulate(all(a),0ll)
#define lb lower_bound
#define all(v) begin(v),end(v)
#define allr(v) rbegin(v),rend(v)
#define sort_dec(v) sort(all(v),[](auto e1,auto e2){return e1>e2;})
#define For(n) for(ll i=0;i<n;i++)
#define Forj(n) for(ll j=0;j<n;j++)
typedef long long int ll;
typedef unsigned long long int ull;
#define fi first
#define se second
#define rep(i,a,n) for(ll i=a;i<n;i++)
#define rev(i,n,a) for(ll i=n;i>=a;i--)
#define vpll vector< pair<ll,ll> >
#define bug(n) {cout<<n;return;}
#define cont(n) {cout<<n<<endl;continue;}
#define pb push_back
#define print(n) cout<<n<<" ";
ll MOD=1e9+7;
 
void solve()
{
	ll n;
	cin>>n;
	double dp[n+1];
	dp[0]=1;
	rep(i,1,n+1){
		double p;
		cin>>p;
		dp[i]=dp[i-1]*p;
		rev(j,i-1,0)
		{
			dp[j]*=1-p;
			if(j>0)dp[j]+=dp[j-1]*p;
		}
	}
	double s=0;
	rep(i,n/2+1,n+1)s+=dp[i];
	printf("%.9f",s);

	For(n+1)cerr<<dp[i]<<" ";cerr<<endl;
}
 
int main()
{
	ios_base::sync_with_stdio(false);cin.tie(NULL);
	 
	// freopen("error.txt", "w", stderr);
	 
	int t=1;
	 
	while(t--)
	{
		solve();
	}

	cerr<<"time taken : "<<(float)clock()/CLOCKS_PER_SEC<<" secs"<<endl;
	 
	return 0;
}

Measured memory_bytes: 3864
#include"bits/stdc++.h"
using namespace std;
int main()
{
	priority_queue<int>a;
	int n,m;
	cin>>n>>m;
	long sum=0,l;
	while(n--)
	{
		cin>>l;
		a.push(l);
	}
	while(m--)
	{
		sum+=a.top();
		a.pop();
	}
	cout<<sum;
	return 0;
}

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

int main()
{
    char S[10];
    char S1[]="Sunny",S2[]="Cloudy",S3[]="Rainy";
    gets(S);
    if (strcmp(S,S1)==0)
        puts(S2);
    else if (strcmp(S,S2)==0)
        puts(S3);
    else if (strcmp(S,S3)==0)
        puts(S1);
    return 0;
}


Measured memory_bytes: 128
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath>
#include <iomanip>

using namespace std;
using ll = long long;

#define rep(i,N) for(int i=0;i<(int)N;++i)

ll GCD(ll x, ll y) {
	if (y == 0) return x;
	else return GCD(y, x % y);
}

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

	cout << 2*N/GCD(2,N) << endl;
}

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

int main() {
  int n,k;
  cin>>n>>k;
  vector<int>a(n);
  for(int i=0;i<n;i++) cin>>a[i];
  int posi;
  for(int i=0;i<n;i++){
    if(a[i]==1) posi=i+1;
  }
    int ans=0;
    int left=posi-1;
    int right=n-posi;
  ans+=left/(k-1)+right/(k-1);
  if(left%(k-1)!=0) ans++;
  if(right%(k-1)!=0) ans++;
  if(left%(k-1)!=0&&right%(k-1)!=0){
    ans=(left+right)/(k-1);
    if((left+right)%(k-1)!=0) ans++;
  }
  cout<<ans<<endl;
  
}



Measured memory_bytes: 640
#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;

const int N=5e5+5,mo=998244353;

typedef long long LL;

int n,K,ans,Fac[N],Inv[N];

int C(int n,int m)
{
	if (m<0) return 0;
	return (LL)Fac[n]*Inv[m]%mo*Inv[n-m]%mo;
}

int main()
{
	scanf("%d%d",&n,&K);
	Fac[0]=Inv[0]=Fac[1]=Inv[1]=1;
	for (int i=2;i<=K;i++)
	{
		Fac[i]=(LL)Fac[i-1]*i%mo;
		Inv[i]=(LL)Inv[mo%i]*(mo-mo/i)%mo;
	}
	for (int i=2;i<=K;i++) Inv[i]=(LL)Inv[i]*Inv[i-1]%mo;
	for (int r=K+1>>1;r<=K;r++)
	{
		int b=K-r;
		if (r==b) b--;
		int t=r-n+1;
		if (t<=0) continue;
		ans=(ans+C(r+b,r)-C(r+b,b-t))%mo;
	}
	if (ans<0) ans+=mo;
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 4096
#include <stdio.h>

int main(void)
{
int n;
int i,j;
int a[101];
int temp;
int x=0;
scanf("%d",&n);
for(i=0;i<n;i++){
	scanf("%d",&a[i]);
	
}
for(i=0;i<n;i++){
	for(j=n-1;j>i;j--){
		if(a[j]<a[j-1]){
			temp=a[j-1];
			a[j-1]=a[j];
			a[j]=temp;
x++;
		}
		
		
		
		
		
		
		
		
		
		
		
		
	}
	
	
	
	
	
	
	
	
	
}
for(i=0;i<n;i++){
	
	printf("%d",a[i]);
	if(i!=n-1){
		
		printf(" ");
		
	}
	
	
	
}
printf("\n");
printf("%d\n",x);
	return 0;
}


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

int main(){
    string s;
    cin >> s;
    string x_out_text = "";
    for(int i = 0; i < s.size(); i++){
        if(s[i] != 'x'){
            x_out_text.push_back(s[i]);
        }
    }
    for(int i = 0; i < x_out_text.size() / 2; i++){
        if(x_out_text[i] != x_out_text[x_out_text.size() - i - 1]){
            cout << -1 << endl;
            return 0;
        }
    }
    bool odd_length = x_out_text.size() % 2;
    char center_digit;
    if(odd_length){
        center_digit = x_out_text[x_out_text.size() / 2];
    }
    vector<int> x_continuities;
    int x_continuity = 0;
    for(int i = 0; i < s.size(); i++){
        if(s[i] != 'x'){
            x_continuities.push_back(x_continuity);
            x_continuity = 0;
        }else{
            x_continuity++;
        }
    }
    x_continuities.push_back(x_continuity);
    int ans = 0;
    for(int i = 0; i < x_continuities.size() / 2; i++){
        ans += abs(x_continuities[i] - x_continuities[x_continuities.size() - i - 1]);
    }
    cout << ans << endl;
}

Measured memory_bytes: 1216
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <queue>
#include <bitset>
using namespace std;
typedef long long LL;
const int inf = 1 << 30;
const LL INF = 1LL << 60;
const int MaxN = 2005;

int n;
bitset <MaxN * MaxN> bs;

int main()
{
	while(scanf("%d", &n) != EOF)
	{
		int sum = 0;
		bs[0] = 1;
		for(int i = 1; i <= n; i++) {
			int x;
			scanf("%d", &x);
			sum += x;
			bs = bs | (bs << x);
		}
		int ans = (sum + 1) / 2;
		while(bs[ans] == false) ans++;
		printf("%d\n", ans);
	}
	return 0;
}

Measured memory_bytes: 2176
#include <bits/stdc++.h>    
//#include <ext/pb_ds/assoc_container.hpp> 
//#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
//#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//using namespace __gnu_pbds; 
#define fastio() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define pb  push_back
#define show(x) cout<<(#x)<<" : "<<x<<endl;
#define ll  long long
#define ld  long double
#define fill(a,val) memset(a,val,sizeof(a))
#define mp  make_pair
#define ff  first
#define ss  second
#define pii pair<ll,ll>
#define sq(x) ((x)*(x))
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define endl "\n"
#define int long long 
#define printclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";
const ll MOD     = 1000*1000*1000+7;
const ll INF     = 1ll*1000*1000*1000*1000*1000*1000 + 7;
const ll MOD2    = 998244353;
const ll N       = 1000 * 100 + 10;
const ll N2      = 70;
const ld PI  = 3.141592653589793;
//template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
ll gcd(ll a, ll b){if(!b)return a;return gcd(b, a % b);} 
ll power(ll x,ll y,ll p = LLONG_MAX ){ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}
ll lcm(ll a , ll b){return (a*b)/gcd(a,b);}

signed main()
{
    fastio();
    //cout<<fixed<<setprecision(20);
    //CHECK for LONG LONG and LONG DOUBLE
    //*comment for all except cc/cf    
    #ifndef ONLINE_JUDGE    
           freopen("input.txt","r",stdin);
           freopen("output.txt","w",stdout);
    #endif//*/
    int n,x,t;
    cin>>n>>x>>t;
    int tep  = ceil(n/(ld)x);
    cout<<tep*t;

    printclock;
    return 0;
}



Measured memory_bytes: 3800
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace AtCoder
{
	public class ABC
	{
		static public void Main(string[] args)
		{
			Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });
			Solve(args);
			Console.Out.Flush();
		}

		private const int mod = 1000000007;  // 10^9+7

		static public void Solve(string[] args)
		{
			//string s = Console.ReadLine();
			//int x = int.Parse(Console.ReadLine());
			long x = long.Parse(Console.ReadLine());
			//int[] vs = Console.ReadLine().Split().Select(int.Parse).ToArray();
			//long[] vs = Console.ReadLine().Split().Select(long.Parse).ToArray();
			long a = 100;
			long ans = 0;
			while (a < x) {
				a += a / 100;
				ans++;
			}
			Console.WriteLine(ans);
		}

	}
}


Measured memory_bytes: 27440
#include<bits/stdc++.h>
#define title "title"
#define ll long long
#define ull unsigned ll
#define fix(x) fixed<<setprecision(x)
#define pii pair<ll,ll>
#define vint vector<ll>
#define pb push_back
using namespace std;
void Freopen(){
	freopen(title".in","r",stdin);
	freopen(title".out","w",stdout);
}
ll read(){
	ll g=0,f=1;
	char ch=getchar();
	while(ch<'0'||'9'<ch){if(ch=='-')f=-1;ch=getchar();}
	while('0'<=ch&&ch<='9'){g=g*10+ch-'0';ch=getchar();}
	return g*f;
}
const ll N=305;
ll n,a[N],re,all,ans;
signed main(){
	n=read();
	for(ll i=1;i<=n;i++)a[i]=read();
	for(ll i=3;i<=n;i++)re^=a[i];
	all=a[1]+a[2];all-=re;if(all<0)return puts("-1"),signed();
	for(ll i=42;i>=0;i--){
		if(2*(1ll<<i)<=all){
			if((re>>i&1))return puts("-1"),signed();
			ans+=(1ll<<i);all-=2*(1ll<<i);
		}
	}if(all)return puts("-1"),signed();
	if(ans>a[1])return puts("-1"),signed();
	for(ll i=42;i>=0;i--)if((re>>i&1)&&(ans+(1ll<<i))<=a[1])ans+=(1ll<<i);
	if(ans==0)return puts("-1"),signed();
	return cout<<a[1]-ans,signed();
}

Measured memory_bytes: 3620
#include<cstdio>
#include<cmath>
#include<string>
#include<algorithm>
#include<vector>

using namespace std;

bool func(const pair<long long, long long> &a, const pair<long long, long long> &b)
{
	return a.first < b.first;
}

int main()
{
	long long n, m;
	long long i;
	long long input1, input2;
	vector<pair<long long, long long>> arr;
	long long cnt = 0;
	long long add;
	long long cost = 0;

	scanf("%lld %lld", &n, &m);

	for (i = 0; i < n; i++)
	{
		scanf("%lld %lld", &input1, &input2);

		arr.push_back(pair<long long, long long>(input1, input2));
	}

	sort(arr.begin(), arr.end(), func);

	for (i = 0; i < n&&cnt < m; i++)
	{
		add = (m - cnt < arr[i].second) ? m - cnt : arr[i].second;

		cnt += add;

		cost += add*arr[i].first;
	}

	printf("%lld\n", cost);

	return 0;
}

Measured memory_bytes: 2420
import sys
from collections import deque
import copy
import math
def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline



def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [S] = [(input_raw[0])]
    N = len(S)
    opt1 = "1"
    opt2 = "0"
    for i in range(1, N):
        opt1 += "1" if opt1[i - 1] == "0" else "0"
        opt2 += "1" if opt2[i - 1] == "0" else "0"
    count1 = 0
    count2 = 0
    for i in range(N):
        if S[i] != opt1[i]:
            count1 += 1
        if S[i] != opt2[i]:
            count2 += 1
    print min(count1, count2)


if __name__ == '__main__':
    main()


Measured memory_bytes: 6384
#define scanf_s scanf
#include <string>
#include <stdio.h>
#include <math.h>
#include <stack>
#include <queue>
#include <list>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
using namespace std;

#define MAX 500000
//#define MAX_ 1000
static int H;
void maxHeapify(long long int A[], int i)
{
	int l = i * 2, r = i * 2 + 1, largest;
	long long int x;
	if (l <= H && A[l] > A[i])
		largest = l;
	else
		largest = i;
	if (r <= H && A[r] > A[largest])
		largest = r;
	if (largest != i) {
		x = A[i]; A[i] = A[largest]; A[largest] = x;
		maxHeapify(A, largest);
	}
}
void buildMaxHeap(long long int A[]) {
	for (int i = H / 2; i >= 1; --i) {
		maxHeapify(A, i);
	}
}

int main(void)
{
	long long int Heaps[MAX + 1];
	scanf_s("%d", &H);
	for (int i = 1; i <= H; ++i) {
		scanf_s("%lld", &Heaps[i]);
	}
	buildMaxHeap(Heaps);
	for (int i = 1; i <= H; ++i) {
		printf(" %lld", Heaps[i]);
	}
	printf("\n");
}

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

#define rep(i,n) for(int i = 0;i<n;i++)
#define vv(Type, n,m,d)vector<vector<Type>> vv(n, vector<Type>(m, d));

using namespace std;
using ll = long long;

const ll mod = 1e9 + 7;

int main(void) {

	ios::sync_with_stdio(false);
	cin.tie(0);

	int n; cin >> n;
	vector<int> a(n);
	rep(i, n) cin >> a[i];
	int min = a[0];
	int cnt = 1;
	for (int i = 1; i < n; i++) {
		if (min > a[i]) {
			cnt++;
			min = a[i];
		}
	}

	cout << cnt << endl;


}


Measured memory_bytes: 3972
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n; cin >> n;
	vector<long long> a(n);
	for(int i = 0; i < n; i++) cin >> a[i];
	long long l = 2, r = 2;
	for(int i = n - 1; i >= 0; i--){
		l += (a[i] - (l % a[i]))%a[i];
		r -= r % a[i];
		if(l > r) return !printf("-1\n");
		r += a[i] - 1;
	}
	cout << l << " " << r << endl;
	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define ft first
#define sc second
#define pt(sth) cout << sth << "\n"
#define moca(a, s, b) a=((a)s(b)+MOD)%MOD
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
template<class T>bool chmax(T &a, const T &b) {if(a<b) {a=b; return 1;} return 0;}
template<class T>bool chmin(T &a, const T &b) {if(b<a) {a=b; return 1;} return 0;}
static const ll IF=1e18;
static const ll MX=101010;
static const ll MD=1e9+7;


/*
 for(i=0; i<N; i++)
   cin >> a[i];
*/





int main(void) {
  ll i, j, k;
  
  ll N;
  cin >> N;
  ll a[MX*2];
  
  for(i=0; i<N; i++) cin >> a[i];
  sort(a, a+N);
  reverse(a, a+N);
  
  ll ans=0;
  ans+=a[0];
  for(i=1; i<N/2; i++) ans+=a[i]*2;
  if(N&1) ans+=a[N/2];
  pt(ans);
}


Measured memory_bytes: 5188
import bisect
import cmath
import heapq
import itertools
import math
import operator
import os
import random
import re
import string
import sys
from collections import Counter, defaultdict, deque
from copy import deepcopy
from decimal import Decimal
from functools import lru_cache, reduce
from math import gcd
from operator import add, itemgetter, mul, xor

import numpy as np

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

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353


x = int(sys.stdin.buffer.readline())
if x >= 30:
    print('Yes')
else:
    print('No')




Measured memory_bytes: 27152
#include <stdio.h>

int main(void)
{
  int w,n;
  scanf("%d", &w);
  scanf("%d", &n);
  int num[31];
  int i;
  for(i=1; i<=w; ++i){
    num[i] = i;
  }
  for(i=0; i<n; ++i){
    int a,b;
    scanf("%d,%d", &a, &b);
    int tmp = num[a];
    num[a] = num[b];
    num[b] = tmp;
  }
  for(i=1; i<=w; ++i){
    printf("%d\n", num[i]);
  }

  return 0;
}

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

using namespace std;

const int MAX_N = 100000;

long long int spot[MAX_N+2];
int abs(int p){return p>0?p:-p;}

int main() {
	int n;
	long long int sum=0;
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%lld",&spot[i]);
		sum+=(long long int)abs(spot[i]-spot[i-1]);
	}
	sum+=(long long int)abs(spot[n+1]-spot[n]);
	for(int i=1;i<=n;i++){
		long long int tmp1 = (long long int)abs(spot[i]-spot[i-1])+abs(spot[i+1]-spot[i]);
		long long int tmp2 = (long long int)abs(spot[i+1]-spot[i-1]);
		printf("%lld\n",sum-tmp1+tmp2);
	}
	
	return 0;
}

Measured memory_bytes: 2048
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int[] num = new int[4];
        for (int i = 0; i < 4; i++){
            num[i] = input.nextInt();
        }
        Arrays.sort(num);
        if (num[0] == 1 &&
            num[1] == 4 &&
            num[2] == 7 &&
            num[3] == 9){
                System.out.println("YES");
            } else {
                System.out.println("NO");
            }
    }
}

Measured memory_bytes: 23764
#include <bits/stdc++.h> 
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vl;
typedef pair<ll,ll> pll;
#define vbi vector<bool> 
#define mod 1000000007
#define INF 1000000000
#define all(x) x.begin(),x.end()
#define mp make_pair
#define pb push_back
#define sd second
#define ft first
#define ms(x,v) memset(x,v,sizeof x)
#define endl '\n'
#define cnl cout<<endl;
#define frr(i,b) for(ll i=0; i<b;i++)
#define fb(i,b) for(ll i=b-1; i>=0; i--)
#define pi  3.141592653589793238
ll i,j,k;
long long dp[1000000][4];
void solve(){
      ll n; cin>>n;
      for(i=1;i<=n;i++){
        ll a,b,c; cin>>a>>b>>c;
        dp[i][1]=max(dp[i-1][2],dp[i-1][3])+a;
        dp[i][2]=max(dp[i-1][1],dp[i-1][3])+b;
        dp[i][3]=max(dp[i-1][1],dp[i-1][2])+c;
      }
      ll ans=max(max(dp[n][1],dp[n][2]),dp[n][3]);
      cout<<ans<<endl;
}
 signed main(){
    solve();
    return 0;
  }

Measured memory_bytes: 4352
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
    long long a,b,k;
    cin>>a>>b>>k;
    if(k<=a)
    {
        cout<<(a-k)<<" "<<b<<endl;
    }
    else
    {
        if((k-a)>=b)
        {
            b=0;
        }
        else
        {
            b=b-(k-a);
        }
        cout<<"0 "<<b<<endl;
    }
    return 0;
}

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

def main():
    N = int(input())
    A = [int(x) for x in input().split()]

    if 0 in A:
        print(0)
    else:
        out = 1
        for n in A:
            out = n * out
            if out > 1000000000000000000:
                break
            else:
                continue
    
        if out > 1000000000000000000:
            print(-1)
        else:
            print(out)


main()

Measured memory_bytes: 21468
#include <iostream>
#include <algorithm>
#include <queue>
#include <vector>
#include <map>
#include <string>

using namespace std;

void solve();

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

void solve() {
    string s;
    cin >> s;
    for(int i = 0; i < s.length() - 8; i++) {
        cout << s[i];
    }
    cout << endl;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log,gcd
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
mod = 10 ** 9 + 7
inf = float('inf')
ninf = -float('inf')

#Pythonを用いる場合
#numpy 1.18.0, scipy 1.4.1, scikit-learn 0.22, numba 0.47.0, networkx 2.4
 
import numpy as np
from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson
from scipy.sparse import csr_matrix

 
#整数input
def ii(): return int(sys.stdin.readline().rstrip()) #int(input())
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) #list(map(int,input().split()))
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]
#文字列input
def ss(): return sys.stdin.readline().rstrip() #input()
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) #list(input().split())
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]

#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？

n,m,k=mii()
arra=[0]+limii()
arrb=[0]+limii()

cuma=np.cumsum(arra)
cumb=np.cumsum(arrb)
ans=0
cnt=0
tmp=0
placea=0
for i in cuma:
    if i<=k:
        tmp=i
        placea+=1
        ans+=1
        cnt+=1
    else:
        continue
#print(cnt,tmp,ans,placea)
sumb=0
for i in arrb:
    #print(cnt,sumb+i,cuma[placea-1],cuma[placea-1],k,i)
    #print(i)
    if tmp+sumb+i<=k:
        tmp+=i
        sumb+=i
        cnt+=1
        #print(1111111)
    else:

        while sumb+i+cuma[placea-1]>k:
            placea-=1
            cnt-=1
            
            if placea<1:
                break
        if sumb+i<=k:
            tmp+=i
            sumb+=i
            cnt+=1
        #print(1111)
    ans=max(ans,cnt)
    if placea<1:
        break
print(ans-2)

 




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

#define step(i, s, n, d) for(int i=s; i<n; i+=d)
#define FOR(i,s,n) step(i,s,n,1)
#define rep(i,n) FOR(i,0,n)
#define list_input(x, n) x[n]; rep(i,n){ cin >> x[i];}
#define ll long long

int main(){
  int N, M;
  cin >> N >> M;
  ll x[N], y[N], z[N], sum[N], result = 0, ans = 0;
  rep(i, N){
    cin >> x[i] >> y[i] >> z[i]; //入力受け取り
  }
  int d[2] = {1, -1};
  rep(j, 2){
    rep(k, 2){
      rep(l, 2){
        rep(i, N){
          sum[i] = x[i]*d[j] + y[i]*d[k] + z[i]*d[l];
        }
        sort(sum, sum+N, greater<ll>());
        rep(i, M){
          ans += sum[i];
        }
        result = max(result, ans);
        ans = 0;
      }
    }
  }
  cout << result << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>
#include <random>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define RREP(i,m,n) for(int i=int(n)-1;i>=int(m);--i)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
//#define int long long

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

constexpr double EPS = 1e-10;
//constexpr double PI  = acos(-1.0);
//constexpr int INF = INT_MAX;
constexpr int MOD = 1'000'000'007;
//inline void modAdd(LL &l, LL &r) {l = (l + r) % MOD;}

template<class T> inline T sqr(T x) {return x*x;}

void solve() {
    int k;
    cin >> k;
    LL ans = 0;
    REP(i,1,k+1) REP(j,1,k+1) REP(l,1,k+1) {
        ans += gcd(gcd(i,j), l);
    }
    cout << ans << endl;
}

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

Measured memory_bytes: 3652
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <climits>

using namespace std;


int main() {
  long L, R;
  cin >> L >> R;
  
  long divL=L/2019, divR=R/2019;
  if(divR-divL>0) {
    cout << 0 << endl;
    return 0;
  }
  
  int ans = 2019;  
  for (int i = L%2019; i <= R%2019 -1; i++) {
    for (int j = i +1; j <= R%2019; j++) {
      ans = min(ans,(i*j)%2019);
      if(ans==0) break;
    }
    if(ans==0) break;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void){
    
    
    int H,W;
    
    while(1){
        
        scanf("%d %d",&H,&W);
        
        
        for(int i=0;i<H;i++){
            for(int j=0;j<W;j++){
                
                if((i%2==0)&&(j%2==0)){
                    printf("#");
                }else if((i%2==0)&&(j%2==1)){
                    printf(".");
                }else if((i%2==1)&&(j%2==0)){
                    printf(".");
                }else{
                    printf("#");
                }
            }
            printf("\n");
        }
        
        
        if(H==0&&W==0){
            break;
        }
        printf("\n");
    }
    
    
    return 0;
}


Measured memory_bytes: 2108
solve :: Float -> String
solve w
  | w <= 48.0 = "light fly"
  | w <= 51.0 = "fly"
  | w <= 54.0 = "bantam"
  | w <= 57.0 = "feather"
  | w <= 60.0 = "light"
  | w <= 64.0 = "light welter"
  | w <= 69.0 = "welter"
  | w <= 75.0 = "light middle"
  | w <= 81.0 = "middle"
  | w <= 91.0 = "light heavy"
  | otherwise = "heavy"

main :: IO ()
main = getContents >>= mapM_ (putStrLn . solve . read) . lines

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

vector<int>  dp(220000,INF);
int ans[220000];
int n;
vector<ll> a;
vector<int> ki[2200000];
void dfs(int now,int last = -1){
    int lind = lower_bound(dp.begin(),dp.end(),a[now]) - dp.begin();
    int lval = dp[lind];
    dp[lind] = a[now];
    ans[now] = lower_bound(dp.begin(),dp.end(),INF) - dp.begin();
    for(int next:ki[now]){
        if(next == last)continue;
        dfs(next,now);
    }
    dp[lind] = lval;
}int main()
{
    
    cin >>n;
    a.resize(n);
    rep(i,n)cin >> a[i];
    rep(i,n-1){
        int a,b;
        cin >> a >> b;
        a--;b--;
        ki[a].push_back(b);
        ki[b].push_back(a);

    }
    dfs(0);
    rep(i,n)cout <<ans[i] << endl;



    return 0;
}

Measured memory_bytes: 75624
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
typedef pair<ll, ll> P;
using VP = vector<P>;
using VVP = vector<VP>;
using VI = vector<ll>;
using VVI = vector<VI>;
using VVVI = vector<VVI>;
const int inf = 1e9 + 7;
const ll INF = 1LL << 61;
const ll mod = 998244353;

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

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

vector<ll> inv, fact, invfact;
void Mod_build(int n = 101010) {
    fact.resize(n + 1);
    inv.resize(n + 1);
    invfact.resize(n + 1);
    fact[0] = inv[0] = invfact[0] = 1;
    inv[1] = 1;
    for (ll i = 0; i < n; i++) {
        fact[i + 1] = fact[i] * (i + 1) % mod;
        if (i > 0) inv[i + 1] = mod - inv[mod % (i + 1)] * (mod / (i + 1)) % mod;
        invfact[i + 1] = invfact[i] * inv[i + 1] % mod;
    }
}
ll perm(int n, int k) {
    if (n < 0 || k < 0 || k > n) return 0;
    return fact[n] * invfact[n - k] % mod;
}
ll comb(int n, int k) {
    if (n < 0 || k < 0 || k > n) return 0;
    return (fact[n] * invfact[n - k] % mod) * invfact[k] % mod;
}
ll powmod(ll n, ll k) {
    k %= mod - 1;
    if (k < 0) k += mod - 1;
    ll ret = 1;
    while (k) {
        if (k & 1) ret = ret * n % mod;
        n = n * n % mod;
        k >>= 1;
    }
    return ret;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int i, j;
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    VVI dp(3030, VI(3030, 0));
    dp[a][b] = 1;
    VI v(3030, 0);
    for (i = a; i <= c; i++) {
        for (j = b; j <= d; j++) {
            if (i == a && j == b)
                continue;
            else if (i == a)
                dp[i][j] = dp[i][j - 1] * a;
            else if (j == b)
                dp[i][j] = dp[i - 1][j] * b;
            else {
                dp[i][j] = j * dp[i - 1][j];
                dp[i][j] %= mod;
                // dp[i][j] += powmod(i - 1, j - k - 1) * dp[i][k];
                // dp[i][j] %= mod;
                v[i] = v[i] * (i - 1) + dp[i][j - 1];
                v[i] %= mod;
                dp[i][j] += v[i];
                dp[i][j] %= mod;
            }
            dp[i][j] %= mod;
        }
    }
    cout << dp[c][d] << endl;
}

Measured memory_bytes: 75004
#include<iostream>
#include<cstring>
using namespace std;
int main()
{
    string s;
    cin>>s;
    if(s=="SAT")
    cout<<"1";
    else if(s=="SUN")
    cout<<"7";
    else if(s=="MON")
    cout<<"6";
    else if(s=="TUE")
    cout<<"5";
    else if(s=="WED")
    cout<<"4";
    else if(s=="THU")
    cout<<"3";
    else if(s=="FRI")
    cout<<"2";
    return 0;
}

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

int n,l,a[100100];

inline bool drop(int i){
  if(i==0)return a[i]>a[i+1];
  if(i==n-1)return a[i]>a[i-1];
  return a[i]>a[i-1] && a[i]>a[i+1];
}

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

  priority_queue< pair<int,int> > q;

  for(int i=0;i<n;i++){
    if(drop(i))q.push(make_pair(a[i],i));
  }

  int now = 0;
  while(q.size()){
    int t = q.top().first, i = q.top().second;
    q.pop();

    now += l - t - now;
    a[i] = 0;

    if(i!=0 && drop(i-1))q.push(make_pair(a[i-1]-now,i-1));
    if(i!=n-1 && drop(i+1))q.push(make_pair(a[i+1]-now,i+1));
  }
  cout << now << endl;
}

Measured memory_bytes: 2048
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#define pb push_back
#define fastio ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
#define ll long long
#define REP(i,a,b) for(int i=a;i<b;i++)
using namespace std;
int main()
{
    ll h,n;
    cin>>h>>n;
    vector<pair<ll,ll>> v(n);
    REP(i,0,n)
        cin>>v[i].first>>v[i].second;
    sort(v.begin(),v.end());
    vector<vector<ll>> knapsack(n+1,vector<ll>(h+1));
    REP(i,0,n+1)
    {
        REP(j,0,h+1)
        {
            if(i==0)
                knapsack[i][j]=1e14;
            else if(j==0)
                knapsack[i][j]=0;
            else
            {
                if(v[i-1].first<=j)
                {
                    knapsack[i][j]=min(v[i-1].second+knapsack[i][j-v[i-1].first],knapsack[i-1][j]);
                }
                else
                {
                    knapsack[i][j]=min(v[i-1].second,knapsack[i-1][j]);
                }
            }
        }
    }
    // REP(i,0,n+1)
    // {
    //     REP(j,0,h+1)
    //         cout<<knapsack[i][j]<<" ";
    //     cout<<"\n";
    // }
    cout<<knapsack[n][h]<<"\n";
}

Measured memory_bytes: 78592
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
#define Priq priority_queue<int,vi,greater<int>>
#define pb push_back
#define mp make_pair
#define INF (1ll<<60)
signed main(){
  int N; cin>>N;
  set<int> S;
  rep(i,0,N){
    int X; cin>>X;
    if(S.count(X)) S.erase(X);
    else S.insert(X);
  }
  cout<<S.size()<<endl;
  }


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

using namespace std;

using ll = long long;
constexpr int mo = 1e9+7;
constexpr int inf = 1<<30;
constexpr ll infl = 1ll<<60;
constexpr ll mo2 = 998244353;
vector<tuple<int,int,int,int>> vec(51);
vector<int> v(11);
int ma;
int n,m,q;
void dfs(int id,int value){
    if(id == n+1){
        int ret = 0;
        for(int i=0;i<q;++i)if(v[get<1>(vec[i])] - v[get<0>(vec[i])] == get<2>(vec[i]))ret+= get<3>(vec[i]);
        ma = max(ma,ret);
        return;
    }
    for(int i=value;i<=m;++i){
        v[id] = i;
        dfs(id+1,i);
    }
}
int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    cin>>n>>m>>q;
    for(int i=0;i<q;++i){
        int a,b,c,d;
        cin>>a>>b>>c>>d;
        vec[i]=make_tuple(a,b,c,d);
    }
    dfs(1,1);
    cout << ma << endl;
    return 0;
}

Measured memory_bytes: 3548
#define _GLIBCXX_DEBUG //エラーを出すためのおまじない
#include <bits/stdc++.h>
#include <algorithm>
//#include <cstdlib>  // abs() for integer
#include <cmath>    // abs() for float, and fabs()
#include <math.h>
using namespace std;
#define coYES cout << "YES" << endl
#define coNO cout << "NO" << endl
#define coYes cout << "Yes" << endl
#define coNo cout << "No" << endl
#define coyes cout << "yes" << endl
#define cono cout << "no" << endl
//#define cocount cout << count << endl;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i < (int)(n); i++)
#define Cinint(n) int n;\
cin >> n;
#define Cinvecint(a, n) vector<int> a(n);\
for (int i = 0; i < (int)(n); i++) {\
  int num;\
  cin >> num;\
  a.at(i) = num;\
}
#define Cinstring(s) string s;\
cin >>s;

  

int main() {
  long double a, b, h, m;
  cin >> a >> b >> h >> m;
  long double pi = 3.14159265358979323846264338327950288419716939937510;
  long double s = sqrtl(a*a + b*b - 2.0*a*b*cosl(h*pi/6.0+m*pi/360.0-m*pi/30.0));
   printf("%20.20Lf\n", s);
}



Measured memory_bytes: 4148
#include<stdio.h>
#include<math.h>
 
int n[100010];
int main()
{
  int N;
  scanf("%d",&N);
  int temp;
 
  for(int x=1;x<104;x++){
    for(int y=1;y<104;y++){
      for(int z=1;z<104;z++){
        temp = x*x + y*y + z*z + x*y + y*z + z*x;
        n[temp]++;
      }
    }
  }
  
  for(int i=1;i<=N;i++){printf("%d\n",n[i]);}
}

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

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

    bool isPoor = false;

    if (!(a != b && b != c && c != a))
    {
        if (a == b)
        {
            if (c != a && b != c)
            {
                isPoor = true;
            }
        }
        else if (b == c)
        {
            if (a != b && a != c)
            {
                isPoor = true;
            }
        }
        else if (c == a)
        {
            if (b != a && b != c)
            {
                isPoor = true;
            }
        }
    }

    if (isPoor)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
//#include <algorithm>
// #include <iomanip>
#define ll long long
#define map unordered_map
#define set unordered_set

using namespace std;

const ll MOD = 1000000007;

ll lcm(ll a, ll b) { return a * b / __gcd(a, b); }

ll div2num(ll v) {
  ll a = 0;
  for (;;) {
    if (v == 0 || v % 2 == 1) {
      break;
    }
    v /= 2;
    a++;
  }
  return a;
}

int main() {
  ll n, m;
  scanf("%lld %lld", &n, &m);

  vector<ll> list(n);
  for (ll i = 0; i < n; i++) {
    ll v;
    scanf("%lld", &v);
    if (v % 2 == 1) {
      cout << 0 << endl;
      return 0;
    }

    list[i] = v / 2;
  }

  ll divnum = -1;
  for (ll i = 0; i < n; i++) {
    ll v = list[i];
    ll d = div2num(v);

    if (divnum >= 0 && divnum != d) {
      cout << 0 << endl;
      return 0;
    }
    divnum = d;
  }

  ll c = 1;

  for (ll i = 0; i < n; i++) {
    ll v = list[i] >> divnum;
    c = lcm(c, v);
  }

  m >>= divnum;

  if (m < c) {
    cout << 0 << endl;
    return 0;
  }

  ll a = (m / c + 1) / 2;

  cout << a << endl;
}


Measured memory_bytes: 1024
use std::str::FromStr;
use std::fmt::Debug;
use std::cmp;

#[allow(dead_code)]
fn read_as_vec<T>() -> Vec<T>
where T: FromStr, <T as FromStr>::Err : Debug{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().split_whitespace().map(|c| T::from_str(c).unwrap()).collect()

}

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

fn calc_time(first: &Vec<i64>, second: &Vec<i64>, k: usize, num_from_first: usize) -> i64{
    let num_from_second = k - num_from_first;
    let res = first[num_from_first-1]*2;

    if num_from_second == 0{
        return res/2;
    }else{
        return res +  second[num_from_second-1];
    }

}


//01:45
fn main(){
    let line = read_as_vec::<usize>();
    let (n, k) = (line[0], line[1]);

    let mut x = read_as_vec::<i64>();
    let mut left: Vec<i64> = vec![];
    let mut right: Vec<i64> = vec![];


    for &elem in &x{
        if elem > 0{
            right.push(elem.abs());
        }else{
            left.push(elem.abs());
        }
    }
    left.sort();
    right.sort();
    //println!("left = {:?}\nright={:?}",left, right);

    let mut ans = std::i64::MAX;
    //go right first
    for i in 0..k{
        let num_take_right = i+1;
        let num_take_left = k - num_take_right;
        //println!("right:{}, left:{}", num_take_right, num_take_left);
        if right.len() < num_take_right || left.len() < num_take_left{
            //println!("cannnot serch this range");
            continue;
        }
        ans = cmp::min(calc_time(&right, &left, k, i+1), ans);
        //println!("{}", ans);
    }

    for i in 0..k{
        let num_take_left = i+1;
        let num_take_right = k - num_take_left;
        if right.len() < num_take_right || left.len() < num_take_left{
            continue;
        }

        ans = cmp::min(calc_time(&left, &right, k, i+1), ans);
    }

    println!("{}", ans);
}


Measured memory_bytes: 8444
#include <bits/stdc++.h>
using namespace std;
#define X first
#define Y second
#define PB push_back
#define ll long long
#define pii pair<ll,ll>
#define MEM(x,y) memset(x,y,sizeof(x))
#define bug(x) cout<<"debug "#x" is "<<x<<endl;
#define FIO ios::sync_with_stdio(false);
#define ALL(x) x.begin(),x.end()
#define LOG 20
#define lson(x) ((x)<<1)
#define rson(x) ((x)<<1|1)
const int maxn=1e6+10;
using namespace std;
int a[32] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
int main(){
    int n;
    cin>>n;
    cout<<a[n-1]<<endl;
}



Measured memory_bytes: 256
import java.util.*;

 
class Main {
 
    private static Scanner sc = new Scanner(System.in);
 
    public static void main(String[] args) {
        int a = sc.nextInt();
        int b = sc.nextInt();
        int ans = 0;
        double t =sc.nextDouble();
        double nowTime = a;
        while(nowTime < t + 0.5){
            ans += b;
            nowTime += a;
        }
        System.out.println(ans);
    }

}


Measured memory_bytes: 21844
#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <map>
#include <queue>
#include <numeric>
#include <algorithm>

using namespace std;
using lint = long long;
constexpr int MOD = 1000000007, INF = 1111111111;
constexpr lint LINF = 1LL << 60;

template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
	for (const auto &e : vec) os << e << (&e == &vec.back() ? "" : " ");
	return os;
}

#ifdef _DEBUG
template <class T>
void dump(const char* str, T &&h) { cerr << str << " = " << h << "\n"; };
template <class Head, class... Tail>
void dump(const char* str, Head &&h, Tail &&... t) {
	while (*str != ',') cerr << *str++; cerr << " = " << h << "\n";
	dump(str + (*(str + 1) == ' ' ? 2 : 1), t...);
}
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else 
#define DMP(...) ((void)0)
#endif

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int N;
	cin >> N;

	vector<int> H(N);
	for (int i = 0; i < N; i++) cin >> H[i];

	H.emplace_back(INF); //番兵
	int ans = 0, cnt = 0;;
	for (int i = 0; i < N; i++) {
		if (H[i] >= H[i + 1]) cnt++;
		else {
			ans = max(ans, cnt);
			cnt = 0;
		}
	}

	cout << ans << "\n";

	return 0;
}

Measured memory_bytes: 1024
// void merge(int fromP,int toP)
// {
// 	fromP = find_set(fromP);
// 	toP = find_set(toP);

// 	//UNION by RANK
// 	if(nodes[fromP].rank > nodes[toP].rank)	//fromP has higher rank
// 		nodes[toP].parent = fromP;
// 	else if(nodes[fromP].rank < nodes[toP].rank)	//toP has higher rank
// 		nodes[fromP].parent = toP;
// 	else
// 	{
// 		//Both have same rank and so anyone can be made as parent
// 		nodes[fromP].parent = toP;
// 		nodes[toP].rank +=1;		//Increase rank of parent
// 	}
// }


#include <iostream>
#include <vector>
#include <unordered_map>

using namespace std;

struct node{
    int parent = -1;
    int rank = 0;
};

vector<node> nodes;

void make_set(int x){
    nodes[x].parent = x;
    nodes[x].rank = 1;
}

int find_set(int v)
{
	if(nodes[v].parent==v)
		return v;
	return nodes[v].parent=find_set(nodes[v].parent);
}

void merge_set(int a, int b){
    a = find_set(a);
    b = find_set(b);
    if(a!=b){
        if(nodes[a].rank<nodes[b].rank){
            nodes[a].parent = b;
        }
        else if(nodes[a].rank<nodes[b].rank){
            nodes[b].parent = a;
            
        }
        else{
            nodes[b].parent = a;
            nodes[a].rank+=1;
        }
    }
}

// void merge_set(int a, int b){
//     a = find_set(a);
//     b = find_set(b);
//     if(a!=b){
//         if(nodes[a].rank<nodes[b].rank)swap(a,b);
//         nodes[b].parent = a;
//         if(nodes[a].rank==nodes[b].rank)nodes[a].rank+=1;
//     }
// }

int main() {
    
    int N,M,a,b;
    cin>>N>>M;
    nodes.resize(N+1);
    
    for(int i=1;i<=N;++i){
        make_set(i);
    }
    
    for(int i=0;i<M;++i){
        cin>>a>>b;
        merge_set(a,b);
    }
    
    unordered_map<int,int> uomap;
    
    for(int i=1;i<=N;++i){
        ++uomap[find_set(nodes[i].parent)];
    }
    
    cout<<uomap.size()-1;
    
  	return 0;
}



Measured memory_bytes: 7264
// D - Multiple of 2019

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// const int INF = 2147483647;
// const ll INF = 9223372036854775807;
// const ll MOD = 1e9 + 7;

int main(){
	string S;
	cin >> S;
	int n = S.size();

	unordered_map<int, ll> rem_cnt; // 余りをカウント

	int rem = 0; // 余りの初期値
	rem_cnt[0] = 1;
	int p = 1; // 右からi桁目に10^(i-1)を掛ける（ただしmod 2019）
	for (int i=1; i<=n; i++) {
		int d = S[n-i] - '0';
		rem = (rem + (d * p)) % 2019;
		rem_cnt[rem]++;
		p = (p * 10) % 2019;
	}

	ll ans = 0;
	for (auto& itr : rem_cnt) {
		ll cnt = itr.second;
		ans += cnt * (cnt - 1) / 2;
	}

	cout << ans << endl;

	return 0;
}

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

int main()
{
    int a,b,m;
    cin>>a>>b;
    if(b-1>=a)
        m=b+b-1;
    else if(b==a)
        m=a+b;
    else if(a-1>=b)
        m=a+a-1;
    cout<<m<<endl;
    return 0;
}


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

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	ll n;
	cin>>n;
	n = n%10;
	if (n==0 or n==1 or n==6 or n==8)
		cout<<"pon";
	else if (n==3)
		cout<<"bon";
	else
		cout<<"hon";
}

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

int main() {
  string S, ans;
  cin >> S;

  if (S == "Sunny") ans = "Cloudy";
  if (S == "Cloudy") ans = "Rainy";
  if (S == "Rainy") ans = "Sunny";

  cout << ans << endl;
}


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

using ll = int64_t;
#define int ll

#define FOR(i, a, b) for (int i = int(a); i < int(b); i++)
#define REP(i, b) FOR(i, 0, b)
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define ALL(x) x.begin(), x.end()

using pi = pair<int, int>;
using vi = vector<int>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  REP(i, (int)v.size()) {
    if (i)
      os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}

ll read() {
  ll i;
  scanf("%" SCNd64, &i);
  return i;
}

void printSpace() { printf(" "); }

void printEoln() { printf("\n"); }

void print(ll x, int suc = 1) {
  printf("%" PRId64, x);
  if (suc == 1)
    printEoln();
  if (suc == 2)
    printSpace();
}

string readString() {
  static char buf[3341000];
  scanf("%s", buf);
  return string(buf);
}

char *readCharArray() {
  static char buf[3341000];
  static int bufUsed = 0;
  char *ret = buf + bufUsed;
  scanf("%s", ret);
  bufUsed += strlen(ret) + 1;
  return ret;
}

template <class T, class U> void chmax(T &a, U b) {
  if (a < b)
    a = b;
}

template <class T, class U> void chmin(T &a, U b) {
  if (b < a)
    a = b;
}

template <class T> T Sq(const T &t) { return t * t; }

const int mod = 1e9 + 7;

signed main() {
  int n = read();
  int t[n + 1], x[n + 1], y[n + 1];
  bool isImpossible = false;
  t[0] = 0;
  x[0] = 0;
  y[0] = 0;
  FOR(i, 1, n + 1) {
    t[i] = read();
    x[i] = read();
    y[i] = read();
    int dt, dx, dy;
    dt = t[i] - t[i - 1];
    dx = abs(x[i] - x[i - 1]);
    dy = abs(y[i] - y[i - 1]);
    if (!(dt >= dx + dy && (dt & 1) == ((dx + dy) & 1)))
      isImpossible = true;
  }
  if (isImpossible)
    std::cout << "No" << std::endl;
  else
    std::cout << "Yes" << std::endl;
}


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

int k[11];
int p[11];
int s[11][11];

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

    for (int i = 0; i < m; ++i) {
        cin >> k[i];
        for (int j = 0; j < k[i]; ++j) {
            cin >> s[i][j];
            s[i][j]--;
        }
    }

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

    int ans = 0;
    for (int bit = 0; bit < (1 << n); ++bit) {
        int counter = 0;
        for (int i = 0; i < m; ++i) {
            int lightning_count = 0;
            for (int j = 0; j < k[i]; ++j) {
                if (bit & (1 << s[i][j])) {
                    ++lightning_count;
                }
            }
            if (lightning_count % 2 == p[i]) {
                ++counter;
            }
        }
        if (counter == m) {
            ++ans;
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <numeric>
typedef long long Int;
#define rep(i,a,b) for(Int i=a;i<b;++i)
#define rrep(i,a,b) for(Int i=a;i>=b;--i)
using namespace std;

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

    Int H, W, h, w;
    cin >> H >> W >> h >> w;
    cout << (H-h)*(W-w) << endl;
}


Measured memory_bytes: 256