akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <array>
#include <vector>
#include <string>
#include <numeric>
#include <algorithm>
#include <utility>

#include <atcoder/lazysegtree>

using namespace std;
using namespace atcoder;
#define rep(i,l,r) for(int i = l; i < r; ++i)

using S = array<long long, 3>;
using F = bool;

S op(S s1, S s2) 
    {return {s1[0] + s2[0], s1[1] + s2[1], s1[2] + s2[2] + s1[0] * s2[1]};}
S e() {return {0, 0, 0};}

S mapping(F f, S s)
    {return (f ? S{s[1], s[0], s[0] * s[1] - s[2]} : s);}
F composition(F f1, F f2)
    {return f1 ^ f2;}
F id() {return false;}

int main() {
    int n, q, x, t, l, r;
    cin >> n >> q;

    vector<S> a(n);
    rep(i, 0, n) {
        cin >> x;
        a[i] = (x == 0 ? S{0, 1, 0} : S{1, 0, 0});
    }

    lazy_segtree<S, op, e, F, mapping, composition, id> lseg(a);

    rep(i, 0, q) {
        cin >> t >> l >> r;
        if (t == 1) {
            lseg.apply(l-1, r, true);
        } else {
            cout << lseg.prod(l-1, r)[2] << endl;
        }
    }
}


Measured memory_bytes: 19656
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
ans = B[A[0]-1]
for i in range(1,N):
    if(A[i-1]+1==A[i]):
        ans+=B[A[i]-1]+C[A[i-1]-1]
    else:
        ans+=B[A[i]-1]
print(ans)

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

typedef long long ll;
typedef pair<int,int> P;
typedef map<int,int> M;
typedef vector<int> V;
typedef queue<int> Q;
typedef pair<long,long> PLL;
typedef map<long,long> MLL;
typedef vector<long long> VLL;
typedef vector<pair<int,int>> VP;
typedef vector<vector<int>> VV;
#define INF (int)(1e9)
#define MAXX 1.1529215e+18
#define inf 999999
#define EPS (1e-7)
#define MOD (1e9+7)
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define REP(i,n) for(int i=1;i<=(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n-1);i>=0;i--)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define ALL(a)  a.begin(),a.end()
#define RALL(a) a.begin(),a.end(),greater<int>()
#define PRALL(a) a.begin(),a.end(),greater<pair<int,int>>()
#define ROT(a) a.begin(),a.begin()+1,a.end()
#define RROT(a) a.begin(),a.end()-1,a.end()
#define PB push_back
#define MP make_pair
#define PI acos(-1.0)
/*--------------------------------------------*/

int main(){
    ll n;cin>>n;
    VLL a(5);rep(i,5)cin>>a[i];
    sort(ALL(a));
    ll ans=ceil(n/(double)a[0])+4;
    cout<<ans<<endl;
}


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

using namespace std;

int main()
{
    int n, q, li, ri;
    int cnt = 0;
    string inputString;
    cin >> n >> q;
    cin >> inputString;
    int cntAC[n];
    int flag = 0;
    for (int i = 0; i < n; i++)
    {
        if (inputString[i] == 'A')
        {
            flag = 1;
        }
        if (inputString[i] == 'C' && flag == 1)
        {
            cnt += 1;
        }
        if (inputString[i] != 'A')
        {
            flag = 0;
        }
        cntAC[i] = cnt;
    }

    for (int i = 0; i < q; i++)
    {
        cin >> li >> ri;
        cout << cntAC[ri - 1] - cntAC[li - 1] << endl;
    }
    return 0;
}

Measured memory_bytes: 1472
dreamer = "dreamer"
eraser = "eraser"
dream = "dream"
erase = "erase"


def main():
    S = input()
    i = len(S)
    while 0 < i:
        pre = i
        if S[i - len(dreamer):i] == dreamer:
            i -= len(dreamer)
        if S[i - len(eraser):i] == eraser:
            i -= len(eraser)
        if S[i - len(dream):i] == dream:
            i -= len(dream)
        if S[i - len(erase):i] == erase:
            i -= len(erase)
        if pre == i:
            print("NO")
            return
    print("YES")
    return


main()


Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define rep(i, a, b) for(int i=(a); i<(b); i++)
#define sz(a) (int)a.size()
#define de(a) cout<<#a<<" = "<<a<<endl
#define dd(a) cout<<#a<<" = "<<a<<" "
typedef long long ll;
typedef double db;
typedef pair<int, int> pii;
typedef vector<int> vi;
//----
const int N=505050;
int nx0[N], nx1[N];
char s[N];
void kmp(char s[], int nx[]){
	nx[0]=-1;
	for(int i=1, j=-1; s[i]; i++){
		while(j!=-1 && s[j+1]!=s[i]) j=nx[j];
		if(s[j+1]==s[i])j++;
		nx[i]=j;
	}
}
bool check(int n, int nx[]){
	return (nx[n-1]!=-1&&(n%(n-1-nx[n-1])==0));
}
int main(){
	scanf("%s", s);
	int n=strlen(s);
	kmp(s, nx0);
	reverse(s, s+n);
	kmp(s, nx1);
	if(!check(n, nx0))printf("1\n1\n");
	else if(nx0[n-1]==n-2)printf("%d\n1\n", n);
	else{
		int ans=0;
		rep(i, 1, n+1)if(!check(i, nx0)&&!check(n-i, nx1))ans++;
		printf("2\n%d\n", ans);
	}
	return 0;
}
/*
aab
1
1

bcbc
2
3

ddd
3
1
*/

Measured memory_bytes: 4608
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n); i++)
#define all(obj) obj.begin(), obj.end()
#define debug(x) cerr << #x << ":" << x << "\n"
#define vdebug(vec) cerr << #vec << ":"; for (auto e : vec) cerr << e << " "; cout << "\n"
#define vvdebug(vv) cerr << #vv << ":\n"; for (auto vec : vv) { for (auto e : vec) cerr << e << " "; cerr << endl; }
#define YN(f) cout << (f ? "YES" : "NO") << endl
#define Yn(f) cout << (f ? "Yes" : "No") << endl
#define yn(f) cout << (f ? "yes" : "no") << endl
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;

int main () {
	int A, B, C, X, Y; cin >> A >> B >> C >> X >> Y;
	int ans = 0;
	if (X > Y) ans = Y * min(A + B, 2 * C) + (X - Y) * min(A, 2 * C);
	else ans = X * min(A + B, 2 * C) + (Y - X) * min(B, 2 * C);
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int N = 100010;
typedef long long ll;
typedef long double ld;
int n, a[N], l1[N], l2[N], r1[N], r2[N];
deque<int> dq;
ll sz(int l, int r) { return r - l + 1; }
int main() {
	ios::sync_with_stdio(0); cin.tie(0);
	cin >> n; for (int i = 1; i <= n; ++i) cin >> a[i];
	a[0] = a[n + 1] = N;
	dq.push_back(0); dq.push_back(0);
	for (int i = 1; i <= n; ++i) {
		while (!dq.empty() && a[i] > a[dq.back()]) dq.pop_back();
		//int k = dq.size();
		l1[i] = dq.back();
		dq.push_back(i);
	}
	while (!dq.empty()) dq.pop_back();
	dq.push_front(n+1); dq.push_front(n+1);
	for (int i = n; i >= 1; --i) {
		while (!dq.empty() && a[i] > a[dq.front()]) dq.pop_front();
		//int k = dq.size();
		r1[i] = dq.front();
		dq.push_front(i);
	}
	for (int i = 1; i <= n; ++i) {
		int x = max(0, l1[i] - 1);
		while (a[i] > a[x]) x = l1[x];
		l2[i] = x;
	}
	for (int i = n; i >= 1; --i) {
		int x = min(n + 1, r1[i] + 1);
		while (a[i] > a[x]) x = r1[x];
		r2[i] = x;
	}

	ll ans = 0LL;
	for (int i = 1; i <= n; ++i) {
		ll L2 = sz(l2[i] + 1, l1[i]), R1 = sz(i, r1[i] - 1),
			L1 = sz(l1[i] + 1, i), R2 = sz(r1[i], r2[i] - 1);
		//cout << L2 << " " << R1 << " " << L1 << " " << R2 << endl;
		ans += L2 * R1 * a[i];
		ans += L1 * R2 * a[i];
	}
	cout << ans << endl;
}

Measured memory_bytes: 2560
from collections import deque
n,m=map(int,input().split())
swichList = [list(map(int, input().split())) for _ in range(m)]
p = list(map(int, input().split()))
ans = 0

for bit in range(1<<n):#スイッチの付き方を全探索する
    onswichlist = deque()
    for i in range(n):#こちらはnこの要素に対して参照していくため0~nで動いていく
        if bit & (1<<i):#bit(eg 011001)のi桁目が1ならばリストのi番目を処理する
            onswichlist.append(i+1)#onスイッチの番号をリスト化
    for j in range(m):
        cnt = 0
        for k in onswichlist:
            if k in swichList[j][1:m+1]:#onスイッチがj番目のライトにつながっているか
                cnt += 1
        if cnt%2 != p[j]:#onスイッチがj番目のライトを点灯させる条件がそろっていなければbreak
            break
    else:
        ans += 1
print(ans)

Measured memory_bytes: 3316
# include <iostream>
# include <stdint.h>
# include <stdio.h>
# include <math.h>
using namespace std;


int main(){
	int a, b ;

	do{
		cin >>a>>b;
		if(a!=0 ||b !=0)
		{for(int i = 1;i <b+1;i++){
					cout <<'#';
				}
				cout <<"\n";
				for(int j =1;j<a-1;j++){
					cout<<"#";
					for(int x =1 ; x <b-1; x++){
						cout <<".";
					}
					cout <<"#\n";
				}
				for(int k = 1;k <b+1;k++){
					cout <<'#';
				}
				cout << "\n";
			cout <<"\n";
			}
			else break;}while(a!=0 ||b !=0);

return 0;
}



Measured memory_bytes: 3000
#include <stdio.h>

int main(void)
{
	int n,i;
	long int f=1;
	scanf("%d",&n);
	if (n!=0&&n!=1) {
		for (i=2;i<=n;i++){
		f=f*i;
		}
	}
	printf("%ld\n",f);
	return 0;
}

Measured memory_bytes: 592
#include <bits/stdc++.h>
#define SORT(x) sort(x.begin(),x.end())
#define ALL(x) x.begin(),x.end()
#define rep(i, n) for(int i = 0; i < n; i++)
#define reps(i, m, n) for(int i = m; i < n; i++)
#define repr(i, m, n) for(int i = m; i >= n; i--)
#define INF 1000000000000000003 //1000000007
#define PI (acos(-1))
#define MOD 1000000007
using namespace std;
typedef long long ll;

ll GCD(ll a, ll b) {
  if (b == 0) return a;
  else return GCD(b, a%b);
}
ll LCM(ll a,ll b){
  return a/GCD(a, b) *b;
}

void Main(){

  int N;
  cin>>N;

  ll ans=1;

  rep(i,N){
    ll a;
    cin>>a;
    ans=LCM(ans,a);
  }

  cout<< ans<<"\n";

}

//-----------------------------------
int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  Main();
}
//-----------------------------------


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1001001001;
const int mINF = -1001001001;


int main() {
int a,b,c;
cin >> a >> b >> c;
int ans = b/a;
if(ans>c) ans = c;
cout << ans << endl;
return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(){
    int x,y,X,Y;
    scanf("%d%d",&x,&y);
    switch(x){
        case 1:
        case 3:
        case 5:
        case 7:
        case 8:
        case 10:
        case 12: X=1; break;
        case 4:
        case 6:
        case 9:
        case 11: X=2; break;
        default: X=3; break;
    }

    switch(y){
        case 1:
        case 3:
        case 5:
        case 7:
        case 8:
        case 10:
        case 12: Y=1; break;
        case 4:
        case 6:
        case 9:
        case 11: Y=2; break;
        default: Y=3; break;
    }

    if(X==Y){
        printf("Yes\n");
    }else{
        printf("No\n");
    }

    return 0;

}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,a,b) for(int i=(a),_end_=(b);i<=_end_;i++)
#define DREP(i,a,b) for(int i=(a),_end_=(b);i>=_end_;i--)
#define EREP(i,u) for(int i=start[u];i;i=e[i].next)
#define fi first
#define se second
#define mkr(a,b) make_pair(a,b)
#define SZ(A) ((int)A.size())
template<class T>inline void chkmin(T &a,T b){ if(a>b)a=b;}
template<class T>inline void chkmax(T &a,T b){ if(a<b)a=b;}
inline void myassert(bool a,string s){ if(!a)cerr<<s<<endl,exit(0);}
inline int read()
{
	int s=0,f=1;char ch=getchar();
	while(!isdigit(ch) && ch!='-')ch=getchar();
	if(ch=='-')ch=getchar(),f=-1;
	while(isdigit(ch))s=s*10+ch-'0',ch=getchar();
	return ~f?s:-s;
}

const int maxn=5e4+20;
const int maxmod=1e6+20;

struct Edge {
	int u,v,w;
};
Edge E[maxn];

int is[maxmod];

int n,m,q,mod,z,MOD;

int FI[maxn],G[maxn],vis[maxn];

inline void Insert(int u,int w)
{
	if(!FI[u])FI[u]=w;
	else G[u]=__gcd(G[u],FI[u]-w); 
}

inline void init()
{
	n=read();m=read();q=read();mod=read();
	REP(i,1,m)
	{
		int u=read(),v=read(),w=read();
		E[i]=(Edge){u,v,w};
		Insert(u,w);
		Insert(v,w);
	}
	REP(i,1,n)MOD=__gcd(MOD,G[i]);
	mod=abs(__gcd(mod,MOD*3)); MOD=abs(MOD);
	if(!MOD)MOD=mod;
}

int fa[maxn*6];

int fin(int x){ return x==fa[x]?x:fa[x]=fin(fa[x]);}
inline void merge(int x,int y){ x=fin(x); y=fin(y); fa[y]=x;}

inline void add(int x,int y,int t)
{
	merge(x,y+3*n+t*n);
	merge(x+n,y+3*n+(1*2+t)%3*n);
	merge(x+2*n,y+3*n+(2*2+t)%3*n);
}

inline void doing()
{
	z=E[1].w%MOD;
	REP(i,1,m)E[i].w%=MOD*3;
	int s=z%mod;
	REP(i,1,mod)is[s]|=i&1?2:1,s=(ll)s*2%mod;
	REP(i,1,n*6)fa[i]=i;
	REP(i,1,m)
	{
		int t=E[i].w%(MOD*3)/MOD;
		//merge(E[i].u,E[i].v+n),merge(E[i].v,E[i].u+n);
		add(E[i].u,E[i].v,t);
		add(E[i].v,E[i].u,t);
	}
	REP(i,1,q)
	{
		int u=read(),v=read(),w=read()%mod;
		//if(i==905)
		//	cerr<<u<<" "<<v<<" "<<w<<" "<<endl;
		swap(u,v);
		w=(w+z)%mod;
		if(fin(u)==fin(v) && (is[w]&2))puts("YES");
		else if(fin(u)==fin(v+3*n) && (is[w]&1))puts("YES");
		else if(fin(u)==fin(v+n) && (is[(w-MOD%mod+mod)%mod]&2))puts("YES");
		else if(fin(u)==fin(v+4*n) && (is[(w-MOD%mod+mod)%mod]&1))puts("YES");
		else if(fin(u)==fin(v+2*n) && (is[(w+MOD)%mod]&2))puts("YES");
		else if(fin(u)==fin(v+5*n) && (is[(w+MOD)%mod]&1))puts("YES");
		else puts("NO");
	}
}

int main()
{
	init();
	doing();
	return 0;
}


Measured memory_bytes: 6400
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ll long long 
#define REP(i, a, b) for (ll i = a; i < b; i++)
#define REPI(i, a, b) for (ll i = b - 1; i >= a; i--)
#define i_os ios::sync_with_stdio(0);  cin.tie(0);  cout.tie(0);
#define INF (ll)1e18 + 100
#define endl "\n"
#define p0(a) cout << a << " "
#define p1(a) cout << a << endl
#define p2(a, b) cout << a << " " << b << endl
#define p3(a, b, c) cout << a << " " << b << " " << c << endl
#define p4(a, b, c, d) cout << a << " " << b << " " << c << " " << d << endl
/*SOME BITMASK KNOWLEDGE
1)x & (x - 1):sets the last one bit of x to zero
power of two exactly when x & (x − 1) = 0.
2)x & -x:sets all the one bits to zero, except last one bit
3)x | (x - 1):inverts all the bits after the last one bit*/
#define o_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define o_setll tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>
typedef tree<pair<ll, ll>,null_type,less<pair<ll, ll>>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> indexed_set1;
typedef tree<string,null_type,less<string>,rb_tree_tag,tree_order_statistics_node_update> indexed_set2;
//1. order_of_key(k) : number of elements strictly lesser than k
//2. find_by_order(k) : k-th element in the set

int main()
{
	ll n;
	cin>>n;
	ll arr[n+1] = {0};
	REP(i,1,101){
		REP(j,1,101){
			REP(k,1,101){
				ll v = i*i + j*j + k*k + i*j + j*k + i*k;
				if(v <= n){
					arr[v]++;
				}
			}
		}
	}
	REP(i,1,n+1) cout<<arr[i]<<endl;
	return 0;
}


Measured memory_bytes: 3600
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<ll,pll> plpl;
typedef tuple<ll,ll,ll> tl;
#define rep(i,m,n) for(int i=m;i<n;i++)
#define rrep(i,n,m) for(int i=n;i>=m;i--)
int dh[4]={-1,1,0,0};
int dw[4]={0,0,1,-1};
int main(){
    int n;cin>>n;
    vector<int> v[n+1];
    rep(i,0,n-1){
        int a,b;cin>>a>>b;
        v[a].push_back(b);
        v[b].push_back(a);
    }
    queue<int> q;
    q.push(1);
    bool used[n+1];
    fill(used,used+n+1,false);
    used[1]=true;
    int d[n+1];
    d[1]=0;
    int ma=-1;
    int num;
    while(q.size()>0){
        int now=q.front();q.pop();
        if(ma<d[now]){
            ma=d[now];
            num=now;
        }
        rep(i,0,v[now].size()){
            int ne=v[now][i];
            if(used[ne])continue;
            d[ne]=d[now]+1;
            used[ne]=true;
            q.push(ne);
        }
    }
    q.push(num);
    fill(used,used+n+1,false);
    ma=-1;
    used[num]=true;
    d[num]=1;
    while(q.size()>0){
        int now=q.front();q.pop();
        ma=max(ma,d[now]);
        rep(i,0,v[now].size()){
            int ne=v[now][i];
            if(used[ne])continue;
            d[ne]=d[now]+1;
            used[ne]=true;
            q.push(ne);
        }
    }
    if(ma%3==2)cout<<"Second"<<endl;
    else cout<<"First"<<endl;
}


Measured memory_bytes: 13812
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
use std::io::{self, prelude::*};

fn gcd(a: u64, b: u64) -> u64 {
    let mut a = a;
    let mut b = b;
    if a < b {
        let temp = b;
        b = a;
        a = temp
    }
    while b != 0 {
        let r = a%b;
        a = b;
        b = r;
    }
    a
}

fn gcd3 (a: u64, b: u64, c: u64) -> u64 {
    gcd(a,gcd(b,c))
}

#[allow(unused_must_use)]
#[allow(unused_assignments)]
#[allow(unused_variables)]
fn solve<B: BufRead, W: Write>(mut scan: Scanner<B>, mut w: W) {
    let k: u64 = scan.token();
    let mut ans: u128 = 0;

    for i in 0..k {
        for j in 0..k {
            for k in 0..k {
                ans += gcd3 (i+1,j+1,k+1) as u128;
            }
        }
    }


    writeln!(w, "{}", ans);
}
 
fn main() {
    let stdin = io::stdin();
    let stdout = io::stdout();
    let reader = Scanner::new(stdin.lock());
    let writer = io::BufWriter::new(stdout.lock());
    solve(reader, writer);
}
#[allow(dead_code)]
fn vector_to_str<T: ToString>(vector: &Vec<T>, separator: &str) -> String { 
    use std::fmt::Write;
    let mut ans = String::new();
    for line in vector.iter() {
        write!(&mut ans, "{}{}", line.to_string(), separator).unwrap();
    }
    ans
}
#[allow(dead_code)]
fn matrix_to_str<T: ToString>(matrix: &Vec<Vec<T>>, separator: &str) -> String { 
    use std::fmt::Write;
    let mut ans = String::new();
    for line in matrix.iter() {
        for elem in line.iter() {
            write!(&mut ans, "{}{}", elem.to_string(), separator).unwrap();
        }
        write!(&mut ans, "\n").unwrap();
    }
    ans
}
pub struct Scanner<B> {
    reader: B,
    buf_str: Vec<u8>,
    buf_iter: std::str::SplitWhitespace<'static>,
}
impl<B: BufRead> Scanner<B> {
    pub fn new(reader: B) -> Self {
        Self {
            reader,
            buf_str: Vec::new(),
            buf_iter: "".split_whitespace()
        }
    }
    pub fn token<T: std::str::FromStr>(&mut self) -> T {
        loop {
            if let Some(token) = self.buf_iter.next() {
                return token.parse().ok().expect("Failed parse");
            }
            self.buf_str.clear();
            self.reader.read_until(b'\n', &mut self.buf_str).expect("Failed read");
            self.buf_iter = unsafe {
                let slice = std::str::from_utf8_unchecked(&self.buf_str);
                std::mem::transmute(slice.split_whitespace()) }
        }
    }
    pub fn get_matrix<T: std::str::FromStr>(&mut self, m: usize, n: usize) -> Vec<Vec<T>> {
        // m rows and n columns
        let mut ans: Vec<Vec<T>> = Vec::with_capacity(m);
        for i in 0..m {
            ans.push(Vec::with_capacity(n));
            for _ in 0..n {
                ans[i].push(self.token::<T>());
            }
        }
        ans
    }
    pub fn get_vector<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        let mut ans: Vec<T> = Vec::with_capacity(n);
        for _ in 0..n {
            ans.push(self.token::<T>());
        }
        ans
    }
}


Measured memory_bytes: 2104
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
    int s;
    cin>>s;
    ll c=0;
   while(s>0){
       if(s%10==7)
       {
           c=1;
           break;
       }
       s=s/10;
   }
    if(c==1)
    cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
    
}

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

using namespace std;

#define N_TIMES(i, n)     for ( uint64_t i = 0;     i <  n; ++i )
#define N_TIMES_REV(i, n) for (  int64_t i = n - 1; i >= 0; --i )

int judge(uint64_t N, uint64_t K, const vector<int64_t> &A, uint64_t P, uint64_t Q)
{
  uint64_t neg = P, pos = N - Q;

  auto f = [](uint64_t x) { return (x * (x - 1)) >> 1; };
  uint64_t mneg = neg * pos;
  uint64_t mpos = f(neg) + f(pos);
  uint64_t mzero = f(N) - (mneg + mpos);

  if (K <= mneg) {
    return -1;
  } else if (K <= (mneg + mzero)) {
    return 0;
  } else {
    return +1;
  }
}

int64_t solve_negative(uint64_t N, uint64_t K, const vector<int64_t> &A, uint64_t P, uint64_t Q)
{
  auto end = A.begin();
  advance(end, P);

  auto judge = [&](int64_t x)
  {
    uint64_t T = 0;
    for (uint64_t i = Q; i < N; ++i) {
      int64_t y = (x / A[i]) - (x % A[i] == 0 ? 0 : 1);
      uint64_t t = distance(A.begin(), upper_bound(A.begin(), end, y));
      T += t;
    }
    return T < K;
  };

  int64_t lo = A[0] * A[N - 1] - 1 , hi = A[P - 1] * A[Q] + 1;
  while (hi - lo > 1) {
    int64_t mid = (hi + lo) / 2;
    if (judge(mid)) {
      lo = mid;
    } else {
      hi = mid;
    }    
  }

  return hi;
}

int64_t solve_positive(uint64_t N, uint64_t K, const vector<int64_t> &A, uint64_t P, uint64_t Q)
{
  uint64_t neg = P, pos = N - Q;

  auto f = [](uint64_t x) { return (x * (x - 1)) >> 1; };
  uint64_t mneg = neg * pos;
  uint64_t mpos = f(neg) + f(pos);
  uint64_t mzero = f(N) - (mneg + mpos);

  uint64_t M = K - (mneg + mzero);
  
  auto n_begin = A.rbegin(), n_end = A.rend();
  auto p_begin = A.begin(),  p_end = A.end();
  advance(n_begin, N - P);
  advance(p_begin, Q);
  
  vector<int64_t> B(n_begin, n_end);
  vector<int64_t> C(p_begin, p_end);
  N_TIMES(i, P) { B[i] *= -1; }

  auto judge = [&](int64_t x) {
    uint64_t T1 = 0;
    N_TIMES(i, B.size()) {
      int64_t y = (x / B[i]) + (x % B[i] == 0 ? 0 : 1);
      
      auto itr = lower_bound(B.begin(), B.end(), y);
      int64_t t = distance(B.begin(), itr);
      if (B[i] * B[i] < x) { --t; }

      T1 += t;
    }

    uint64_t T2 = 0;
    N_TIMES(i, C.size()) {
      int64_t z = (x / C[i]) + (x % C[i] == 0 ? 0 : 1);

      auto itr = lower_bound(C.begin(), C.end(), z);
      int64_t t = distance(C.begin(), itr);
      if (C[i] * C[i] < x) { --t; }

      T2 += t;
    }

    return (T1 + T2) < (M << 1);
  };

  int64_t lo = 0, hi = 1e+18;
  while (hi - lo > 1) {
    int64_t mid = (hi + lo) >> 1;
    if (judge(mid)) {
      lo = mid;
    } else {
      hi = mid;
    }
  }

  return lo;
}

int main()
{
  uint64_t N, K;
  cin >> N >> K;
  
  vector<int64_t> A(N);
  N_TIMES(n, N) { cin >> A[n]; }
  sort(A.begin(), A.end());

  uint64_t P = distance(A.begin(), lower_bound(A.begin(), A.end(), 0));
  uint64_t Q = distance(A.begin(), lower_bound(A.begin(), A.end(), 1));

  int x = judge(N, K, A, P, Q);
  if (x == 0) {
    cout << 0 << endl;
    return 0;
  }

  if (x < 0) {
    cout << solve_negative(N, K, A, P, Q) << endl;
  } else {
    cout << solve_positive(N, K, A, P, Q) << endl;
  }

  return 0;
}

Measured memory_bytes: 3200
#include<bits/stdc++.h>
using namespace std;
 
int main(){
 
  int h1,m1,h2,m2,k;
  cin>>h1>>m1>>h2>>m2>>k;
  
  if(h2 == 0)
	h2=24;
//  if(m1 == 59)
//	m1=60;
  cout<<abs(h2-h1)*60-m1+m2-k;
  return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define alpha_size 26
const int N = 1e5 + 5;

int red[N], green[N], colorless[N];

struct node{
  int id, aux;
  bool operator < (const node &other) const{
    return id > other.id;
  }
};

int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr); 
    int x, y, a, b, c;
    cin >> x >> y >> a >> b >> c;
    for (int i = 0; i < a; i++) 
        cin >> red[i];
    for (int i = 0; i < b; i++)
        cin >> green[i];
    for (int i = 0; i < c; i++)
        cin >> colorless[i];
    sort(red, red + a, greater<int> ());
    sort(green, green + b, greater<int> ());
    sort(colorless, colorless + c, greater<int> ());
    priority_queue<node> pq;
    for (int i = 0; i < x; i++)
        pq.push({red[i], i});
    for (int i = 0; i < y; i++)
        pq.push({green[i], i});
    for (int i = 0; i < c; i++){
        if (pq.top().id < colorless[i])
            pq.pop(), pq.push({colorless[i], i});
    }
    int sum = 0;
    while (!pq.empty()){
        sum += pq.top().id;
        pq.pop();
    }
    cout << sum << endl;
}


Measured memory_bytes: 8688
#!/usr/bin/env python3
import sys


def solve(N: int, a: "List[int]", b: "List[int]", c: "List[int]"):
    dpa=[]
    dpb=[]
    dpc=[]
    dpa.append(a[0])
    dpb.append(b[0])
    dpc.append(c[0])
    for i in range(1,N):
        dpa.append(max(dpb[i-1], dpc[i-1])+a[i])
        dpb.append(max(dpa[i-1], dpc[i-1])+b[i])
        dpc.append(max(dpa[i-1], dpb[i-1])+c[i])
    print(max(dpa[N-1], dpb[N-1], dpc[N-1]))
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    a = [int()] * (N)  # type: "List[int]"
    b = [int()] * (N)  # type: "List[int]"
    c = [int()] * (N)  # type: "List[int]"
    for i in range(N):
        a[i] = int(next(tokens))
        b[i] = int(next(tokens))
        c[i] = int(next(tokens))
    solve(N, a, b, c)

if __name__ == '__main__':
    main()


Measured memory_bytes: 26860
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int h = sc.nextInt();
        int w = sc.nextInt();

        char[][] c = new char[h*2][w];
        for (int i = 0; i < h; i++) {
            char[] s = sc.next().toCharArray();
            c[i*2] = s;
            c[i*2+1] = s;
        }

        for (char[] s : c) {
            for (char s1 : s)
                System.out.print(s1);
            System.out.println();
        }
    }
}


Measured memory_bytes: 27152
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<map>
#include<iomanip>
#include<queue>
#include<stack>
#include<time.h>
#define rep(i,n)for(ll i=0;i<n;i++)
#define ll long long
#define double long double
using namespace std;
bool prime(ll n) {
	for (int i = 2; i*i <= n; i++) {
		if (n%i == 0)return false;
	}
	return true;
}
signed main() {
	ll n, cnt = 0;
	cin >> n;
	cout << 2 << " ";
	for (int i = 3; i <= 55555; i++) {
		if (prime(i) && i % 5 == 1) {
			cout << i << " ";
			cnt++;
		}
		if (cnt >= n - 1)break;
	}
	getchar(); getchar(); return 0;
}


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

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

    int n, m;
    cin >> n >> m;
    if (n == m) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<utility>
#include<set>
typedef long long int ll;
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define REP(i,n) for (int i=0;i<signed(n);i++)
#define EREP(i,n) for (int i=1;i<=(n);i++)
#define ALL(a) (a).begin(),(a).end()
//#define EVEL 1

#ifdef EVEL
#define DEB(X) cout << #X << ":" <<X<<" " ;
#define TF(f) f ? cout<<"true  " : cout<<"false ";
#define END cout<<"\n";
#else
#define DEB(X) {}
#define TF(f) {}
#define END {}
#endif
const int MOD = 1000000007;
const ll INF = 20000000000;
struct edge {int to,cost;};
#define VMAX 50+10
//typedef std::pair<int,int> P;


    ll N,ans;
    ll S[6];
int main(){
    ios_base::sync_with_stdio(false);
    cin>>N;
    REP(i,N){
        string s;
        cin>>s;
        if(s[0]=='M')S[0]++;
        if(s[0]=='A')S[1]++;
        if(s[0]=='R')S[2]++;
        if(s[0]=='C')S[3]++;
        if(s[0]=='H')S[4]++;
    }
    REP(i,5)DEB(S[i])
    REP(Bit,1<<5){
        if(__builtin_popcount(Bit)!=3)continue;
        ll res=1;
        REP(i,5){
            if(1<<i&Bit)res*=S[i];
        }
        DEB(Bit)DEB(res)END
        ans+=res;
    }
    std::cout << ans << '\n';
    return 0;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())
#define endl "\n"

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());
    ll s, w;
    cin >> s >> w;
    if (s <= w) cout << "unsafe" << endl;
    else cout << "safe" << endl;
    return 0;
}


Measured memory_bytes: 3644
n = int(input())
a = list(map(int,input().split()))
b = []
for i in range(n):
  tmp = bin(a[i])[2:]
  tmp = '0' * (64-len(tmp)) + tmp
  b.append(tmp)
ans = 0
bit = 1
mod = 10 ** 9 + 7
for k in range(64):
  z1 = 0
  for i in range(n):
    if b[i][-k-1] == '1':
      z1 += 1
  add = z1 * (n-z1) * bit
  add %= mod
  ans += add
  ans %= mod
  bit *= 2
  bit %= mod
  #print(z1,add,ans)
print(ans)

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

const int INF = 1001001001;

int main() {
    int n, x, y;
    cin >> n >> x >> y;
    x--; y--;
    vector<int> ans(n);
    rep(sv,n) {
        vector<int> dist(n, INF);
        queue<int> q;
        auto push = [&](int v, int d) {
            if (dist[v] != INF) return;
            dist[v] = d;
            q.push(v);
        };
        push(sv,0);
        while (!q.empty()) {
            int v = q.front(); q.pop();
            int d = dist[v];
            if (v-1 >= 0) push(v-1, d+1);
            if (v+1 < n) push(v+1, d+1);
            if (v == x) push(y, d+1);
            if (v == y) push(x, d+1);
        }
        rep(i,n) ans[dist[i]]++;
    }
    rep(i,n) ans[i] /= 2;
    for (int i = 1; i < n; i++) cout << ans[i] << endl;
    return 0;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  long long A, B;
  cin >> N >> A >> B;
  vector<int> X(N);
  for (int i = 0; i < N; i++){
    cin >> X[i];
  }
  long long ans = 0;
  for (int i = 0; i < N - 1; i++){
    ans += min(B, A * (X[i + 1] - X[i]));
  }
  cout << ans << endl;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int nax=17;
ll a[nax][nax];
ll dp[1<<nax];
ll pref[1<<nax];
void solve(int i,int mask,vector<int>&not_taken,ll score_so_far,int group)
{
    if(i==not_taken.size()) {
        dp[mask]=max(dp[mask],score_so_far+pref[group]);
        return;
    };
    solve(i+1,mask,not_taken,score_so_far,group);
    solve(i+1,mask|1<<not_taken[i],not_taken,score_so_far, group^(1<<not_taken[i]));


}
int main()
{
    int n;
    cin>>n;
    //int a[n][n];
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<n;j++)
        {
            cin>>a[i][j];
        }
    }
    //dp[mask] total score obtained after grouping mask rabit
    for(int i=0;i<(1<<n);i++)
    {
        for(int j=0;j<n-1;j++)
        {
            for(int k=j+1;k<n;k++)
            {
                if((i&1<<j)&&(i&1<<k))
                {
                    pref[i]+=a[j][k];
                }

            }
        }

    }
    for(int mask=0;mask<(1<<n);mask++)
    {
        vector<int> not_taken;
        for(int i=0;i<n;i++)
        {
            if(!(mask&1<<i))
            {
                not_taken.push_back(i);

            }
        }
        solve(0,mask,not_taken,dp[mask],0);


    }
    cout<<dp[(1<<n)-1]<<endl;
}

Measured memory_bytes: 1280
package main

import (
	"fmt"
)

func main() {
	var a, b, c, k int
	fmt.Scan(&a, &b, &c)
	fmt.Scan(&k)

	isYes := false

	for i := 0; i < k; i++ {
		if b <= a {
			b = b * 2
		} else if c <= b {
			c = c * 2
		}

		if a < b && b < c {
			isYes = true
			break
		}
	}

	if isYes {
		fmt.Printf("Yes")
	} else {
		fmt.Printf("No")
	}
}

Measured memory_bytes: 1832
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define all(obj) (obj).begin(),(obj).end()
#define debug(x) cerr << #x << ": " << endl
#define rep(i,n) for(int i=0; (i)<(n); ++(i))
#define rrep(i,n) for(int i=(n); (i)>=0; --(i))
#define reps(i,s,n) for(int i=(s); (i)<(n); ++(i))
#define maxi(v) distance(v.begin(), max_element(v.begin(), v.end()))
#define mini(v) distance(v.begin(), min_element(v.begin(), v.end()))
#define maxemt(v) *max_element(v.begin(), v.end())
#define minemt(v) *min_element(v.begin(), v.end())
#define lb(v,x) v[lower_bound(v.begin(), v.end(), x) - v.begin()]
#define ub(v,x) v[upper_bound(v.begin(), v.end(), x) - v.begin()]
template<class T> inline bool print(T& x){ cout << x << endl; return true; }
template<class T> inline bool print_(T& x){ cout << x << " "; return true; }
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; }
ll gcd(ll x, ll y){
  if(y==0) return x;
  else return gcd(y, x%y);
  }
ll lcm(ll x, ll y){
  return x / gcd(x,y) * y;
}
const int INF = 1e9;
const ll llINF = 1LL<<60;
const int MOD = 1e9+7;
const double EPS = 1e-9;
int main(){
  int n; cin >> n;
  vector<int> a(n); rep(i,n) cin >> a[i];
  vector<ll> sum(n,0), rsum(n,0);
  sum[0]=a[0]; rsum[n-1]=a[n-1];
  reps(i,1,n){
    sum[i] += sum[i-1] + a[i];
    rsum[n-1-i] += rsum[n-i] + a[n-1-i];
  }
  ll ans = llINF;
  rep(i,n-1) chmin(ans, abs(sum[i]-rsum[i+1]));
  
  cout << ans;
  
return 0;
}


Measured memory_bytes: 4096
#include <bits/stdc++.h>
#define GET_MACRO(_1,_2,_3,_4,_5,_6,_7,_8,NAME,...) NAME
#define pr(...) cerr<< GET_MACRO(__VA_ARGS__,pr8,pr7,pr6,pr5,pr4,pr3,pr2,pr1)(__VA_ARGS__) <<endl
#define pr1(a) (#a)<<"="<<(a)<<" "
#define pr2(a,b) pr1(a)<<pr1(b)
#define pr3(a,b,c) pr1(a)<<pr2(b,c)
#define pr4(a,b,c,d) pr1(a)<<pr3(b,c,d)
#define pr5(a,b,c,d,e) pr1(a)<<pr4(b,c,d,e)
#define pr6(a,b,c,d,e,f) pr1(a)<<pr5(b,c,d,e,f)
#define pr7(a,b,c,d,e,f,g) pr1(a)<<pr6(b,c,d,e,f,g)
#define pr8(a,b,c,d,e,f,g,h) pr1(a)<<pr7(b,c,d,e,f,g,h)
#define prArr(a) {cerr<<(#a)<<"={";int i=0;for(auto t:(a))cerr<<(i++?", ":"")<<t;cerr<<"}"<<endl;}
using namespace std;
using Int = long long;
using _int = int;
using ll = long long;
using Double = long double;
const Int INF = (1LL<<60)+1e9; // ~ 1.15 * 1e18
const Int mod = (1e9)+7;
const Double EPS = 1e-8;
const Double PI = 6.0 * asin((Double)0.5);
using P = pair<Int,Int>;
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}
template<class T1, class T2> ostream& operator<<(ostream& o,pair<T1,T2> p){return o<<"("<<p.first<<","<<p.second<<")";}
template<class T1, class T2, class T3> ostream& operator<<(ostream& o,tuple<T1,T2,T3> t){
  return o<<"("<<get<0>(t)<<","<<get<1>(t)<<","<<get<2>(t)<<")";}
template<class T1, class T2> istream& operator>>(istream& i,pair<T1,T2> &p){return i>>p.first>>p.second;}
template<class T> ostream& operator<<(ostream& o,vector<T> a){Int i=0;for(T t:a)o<<(i++?" ":"")<<t;return o;}
template<class T> istream& operator>>(istream& i,vector<T> &a){for(T &t:a)i>>t;return i;}
//INSERT ABOVE HERE

class Zalgorithm{
public:
  Int n;            // 文字列の長さ
  string S;         // 対象の文字列
  vector<Int> A;    //
  Int ok;           //build可能かどうか？buildしたかどうか
  Zalgorithm ():ok(false){}
  Zalgorithm (string S):n(S.size()), S(S), A(n), ok(true){build();}
  void build(string S){n = S.size(); this->S = S; A.clear(); A.resize(n); ok = true; build();}
  void build(){
    assert(ok);

    A[0] = S.size();
    Int i = 1, cnt = 0;
    while(i < n){
      while(i + cnt < n && S[cnt] == S[i + cnt]) cnt++;
      A[i] = cnt;
      if(cnt == 0) { i++; continue;}
      Int k = 1;
      while(i + k < n && k + A[k] < cnt) A[i + k] = A[k], k++;
      i += k; cnt -= k;
    }
  }
  Int get(Int i){assert(ok); return A[i];}
};

signed main(){
  srand((unsigned)time(NULL));
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  Int N;
  cin>>N;
  string S;
  cin>>S;

  Int ans = 0;
  for(Int i=0;i<N;i++){
    Zalgorithm za(S.substr(i));
    for(Int j=i;j<N;j++){
      Max(ans, min(j - i, za.get(j - i)));
    }
  }
  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n,x,max;
  string s;
  cin >> n >> s;
  x = 0;
  max = 0;
  for(int i = 0;i < n;i++){
    if(s[i] == 'I') x++;
    else x--;
    if(x > max) max = x;
  }
  cout << max << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int mx = 1e9;
int check(string a, string b)
{
    int cnt = 0;
    for (size_t i = 0; i<a.size(); i++)
    {
        if(a[i]!=b[i])
        {
            cnt++;
        }
    }
    return cnt;
}           
int main ()
{
    string s,t;
    cin>>s>>t;
    int n = s.size(), m =t.size();
    for (int i = 0; i<n-m+1; i++)
    {
        mx = min(mx,check(s.substr(i,m),t));
    }
    cout<<mx<<endl;
    return 0;
}
 

Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0;i<static_cast<int>(n);++i)
#define per(i, n) for(int i=static_cast<int>(n)-1;i>=0;--i)
#define eee(a) (cerr<<"[@"<<__LINE__<<"] "<<(#a)<<": "<<(a)<<'\n');
#define ppp(a) (cout<<(a)<<'\n'); 
#define cop(a) for(auto x:(a)){cerr<<(x)<<'\n';}
using ll = long long;
constexpr int dx[4]={1,0,-1,0};
constexpr int dy[4]={0,1,0,-1};
constexpr ll MOD = 1e9+7;
constexpr ll Mod = 998244353;
constexpr int INF = 1e9;
constexpr ll LINF = 1e18;
constexpr double phi = (1+sqrt(5))/2;
constexpr double pi = 3.14159265358979323846264338327950288;
inline ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
inline ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
inline ll inverse(ll n,ll m=MOD){ll a=n,b=m,x=1,y=0;while(b){ll t=a/b;a-=t*b;swap(a,b);x-=t*y;swap(x,y);}return (a%m+m)%m;}
inline void Yes(){puts("Yes");}
inline void No(){puts("No");}
inline void Judge(bool b){b?Yes():No();}
inline void YES(){puts("YES");}
inline void NO(){puts("NO");}
inline void JUDGE(bool b){b?YES():NO();}
inline ll powmod(ll b, ll e, ll m=MOD){ll r=1;while(e>0){if(e&1)r=(r%m)*(b%m)%m;b=(b%m)*(b%m)%m;e>>=1;}return r;}
inline double distance(ll x1, ll y1, ll x2, ll y2){return sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));}
inline double d2r(double d){return d*pi/180;}
inline double r2d(double r){return r*180/pi;}
template<class T>inline bool chmax(T &a, const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>inline bool chmin(T &a, const T &b){if(b<a){a=b;return 1;}return 0;}
template<typename T>inline int bs(int g,int k,T c){while(abs(k-g)>1){int m=(g+k)/2;(c(m)?k:g)=m;}return k;}
template<typename T1,typename T2>ostream& operator<<(ostream& s,const pair<T1, T2>& p){return s <<"("<<p.first<<", "<<p.second<<")";}
template<typename T> ostream& operator<<(ostream& s,const vector<T>& v){s<<'[';for(size_t i=0;i<v.size();++i){s<<v[i];if(i<v.size()-1)s<<", ";}s<<']';return s;}
template<typename T> istream& operator>>(istream& s,vector<T>& v){for(T& x:v)s>>x;return s;}

int main(){
    cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(15);
    
    int k;
    cin >> k;
    int a, b;
    cin >> a >> b;
    for(int i = a; i <= b; ++i){
        if(i%k == 0){
            cout << "OK" << '\n';
            return 0;
        }
    }
    cout << "NG" << '\n';
    return 0;
}


Measured memory_bytes: 3624
#import <Foundation/Foundation.h>
#include <stdio.h>

NSString* input(void){
    NSData *stdinData = [[NSFileHandle fileHandleWithStandardInput] availableData];
    return [[NSString alloc] initWithData:stdinData encoding:NSUTF8StringEncoding];
}
void output(NSString *s,NSString *sep){
    NSFileHandle *fileHandle = [NSFileHandle fileHandleWithStandardOutput];
    [fileHandle writeData:[s dataUsingEncoding:NSUTF8StringEncoding]];
    [fileHandle writeData:[sep dataUsingEncoding:NSUTF8StringEncoding]];
    [fileHandle closeFile];
}

NSMutableArray* to_numarray(NSString *s){
    NSMutableArray *l = [NSMutableArray arrayWithArray:[s componentsSeparatedByString:@" "]];
    NSInteger buf = 0;
    for(int i=0;i<[l count];i++){
        buf = [[l objectAtIndex:i] integerValue];
        [l replaceObjectAtIndex:i withObject:[NSNumber numberWithInteger:buf]];
    }
    return l;
}

int main(int argc, const char * argv[]) {
    int a,b,h;
    scanf("%d %d %d",&a,&b,&h);
    output([NSString stringWithFormat:@"%d",((a+b)*h)/2],@"\n");
    return 0;
}


Measured memory_bytes: 3376
import sys
from itertools import accumulate

# functions used
r = lambda: sys.stdin.readline().strip() #single: int(r()), line: map(int, r().split())
R = lambda: list(map(int, r().split())) # line: R(), lines: [R() for _ in range(n)]
Rmap = lambda: map(int, r().split())
# set inputs
N, C = R()
STC = [R() for _ in range(N)]
#  0.5sec as one unit
tbl = [[0]*(2*(10**5)+5) for _ in range(C)]

for s, t, c in STC:
    c -= 1
    # if we can record the programms continuously (ver1)
    if tbl[c][2*s] != 0:
        tbl[c][2*s] += 1
        tbl[c][2*t] -= 1
    # if we can record the programms continuously (ver2)
    elif tbl[c][2*t-1] != 0:
        tbl[c][2*t-1] -= 1
        tbl[c][2*s-1] += 1
    # else:
    else:
        tbl[c][2*s-1] = 1
        tbl[c][2*t] = -1

tbl2 = [list(accumulate(a)) for a in tbl]

# ans = max([sum(x) for x in zip(*tbl2)])
# print(ans)

res = 0
for i in range(200002):
    cc = 0
    for j in range(C):
        if tbl2[j][i]:
            cc += 1
    res = max(res, cc)
print(res)

Measured memory_bytes: 123460
//#define NDEBUG
#include <cstddef>
#include <cstdint>
#include <vector>

namespace n91 {

using i8 = std::int_fast8_t;
using i32 = std::int_fast32_t;
using i64 = std::int_fast64_t;
using u8 = std::uint_fast8_t;
using u32 = std::uint_fast32_t;
using u64 = std::uint_fast64_t;
using isize = std::ptrdiff_t;
using usize = std::size_t;

constexpr usize operator"" _z(unsigned long long x) noexcept {
  return static_cast<usize>(x);
}

class rep {
  const usize f, l;

public:
  class itr {
    friend rep;
    usize i;
    constexpr itr(const usize x) noexcept : i(x) {}

  public:
    void operator++() noexcept { ++i; }
    constexpr usize operator*() const noexcept { return i; }
    constexpr bool operator!=(const itr x) const noexcept { return i != x.i; }
  };
  constexpr rep(const usize first, const usize last) noexcept
      : f(first), l(last) {}
  constexpr itr begin() const noexcept { return itr(f); }
  constexpr itr end() const noexcept { return itr(l); }
};
class revrep {
  const usize f, l;

public:
  class itr {
    friend revrep;
    usize i;
    constexpr itr(usize x) noexcept : i(x) {}

  public:
    void operator++() noexcept { --i; }
    constexpr usize operator*() const noexcept { return i; }
    constexpr bool operator!=(const itr x) const noexcept { return i != x.i; }
  };
  constexpr revrep(usize first, usize last) noexcept : f(--first), l(--last) {}
  constexpr itr begin() const noexcept { return itr(l); }
  constexpr itr end() const noexcept { return itr(f); }
};
template <class T> using vec_alias = std::vector<T>;
template <class T> auto md_vec(const usize n, const T &value) {
  return std::vector<T>(n, value);
}
template <class... Args> auto md_vec(const usize n, Args... args) {
  return std::vector<decltype(md_vec(args...))>(n, md_vec(args...));
}
template <class T> constexpr T difference(const T &a, const T &b) {
  return a < b ? b - a : a - b;
}

} // namespace n91

#include <algorithm>
#include <iostream>
#include <string>
#include <utility>


namespace n91 {

void main_() {
  std::string s;
  std::cin >> s;
  std::cout << (s[0_z] == s[1_z] || s[1_z] == s[2_z] || s[2_z] == s[3_z]
                    ? "Bad"
                    : "Good")
            << std::endl;
}

} // namespace n91

int main() {
  n91::main_();
  return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <queue> //C++
#include <string> //C++
#include <iostream> //C++
#include <vector> //C++
#include <algorithm> //C++
using namespace std; //C++
#define rep(i, a, n) for (i = (a); i < (n); i++)


int main()
{
	int n;
	cin >> n;
	int Ans = n * 800 - (n / 15) * 200;

	cout << Ans;
}


Measured memory_bytes: 256
//{{{
#include<algorithm>
#include<cmath>
#include<fstream>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<random>
#include<set>
#include<sstream>
#include<sys/time.h>
#include<unordered_map>
#include<unordered_set>
#include<vector>
using ll = long long;
enum : int { M = (int)1e9 + 7 };
enum : ll { MLL = (ll)1e18L + 9 };
using namespace std;
#ifdef LOCAL
#include"rprint2.hpp"
#else
#define FUNC(name) template <ostream& out = cout, class... T> void name(T&&...){ }
FUNC(prints) FUNC(printw) FUNC(printwe) FUNC(printb) FUNC(printbe) FUNC(printd) FUNC(printde) FUNC(printdu);
#endif
template <class S, class T>
istream& operator >> (istream& in, pair<S, T>& p){ return in >> p.first >> p.second; }
template <class T>
istream& operator >> (istream& in, deque<T>& v){ for(auto& e : v){ in >> e; } return in; }
//}}}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, b, q;
    cin >> a >> b >> q;
    deque<ll> ss(a), ts(b);
    cin >> ss >> ts;
    ss.push_front(-MLL / 4);
    ts.push_front(-MLL / 4);
    ss.push_back(MLL / 4);
    ts.push_back(MLL / 4);
    for(int i = 0; i < q; i++){
        ll x; cin >> x;
        auto ite1 = upper_bound(ss.begin(), ss.end(), x);
        auto ite2 = upper_bound(ts.begin(), ts.end(), x);
        auto ite3 = ite1 - 1;
        auto ite4 = ite2 - 1;
        ll d1 = *ite1 - x, d2 = *ite2 - x,
           d3 = x - *ite3, d4 = x - *ite4;
        printde(*ite1, x);
        printde(d1, d2, d3, d4);
        cout << min({max(d1, d2),
            max(d3, d4),
            2 * d1 + d4,
            d1 + 2 * d4,
            2 * d3 + d2,
            d3 + 2 * d2,
        }) << '\n';
    }
}


Measured memory_bytes: 2944
#include<iostream>
#define ll long long
using namespace std;
int main()
{
	ll n,sum;
	cin>>n;ll x=n/3,y=n/5,z=n/15;
	sum=(1+n)*n/2-(x+1)*x/2*3-(1+y)*y/2*5+(z+1)*z/2*15;
	cout<<sum;
 } 

Measured memory_bytes: 3636
import java.io.*;
import java.util.*;

public class Main {

    public static void main(final String[] args) throws Exception {
        final Scanner sc = new Scanner(System.in);
        String S;
        S = sc.next();

        final Solver solver = new Solver();
        solver.solve(S);
    }
}

class Solver {
    final String[] days = {"SUN","MON","TUE","WED","THU","FRI","SAT"};
    public void solve(String S) {
        for (int i = 0; i < 7; i++) {
            if (days[i].equals(S)) {
                System.out.println(7 - i);
                return;
            }
        }
    }
}



Measured memory_bytes: 23636
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        s: chars
    }
    let ans =
        s.into_iter()
         .enumerate()
         .filter(|&(i, _)| (i + 1) % 2 == 1)
         .map(|(_, c)| c)
         .collect::<String>();
    println!("{}", ans);
}


Measured memory_bytes: 4352