akhauriyash/Code-Regression huggingface dataset:
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

def main():
    s=input()
    if s=="SUN":ans=7
    if s=="MON":ans=6
    if s=="TUE":ans=5
    if s=="WED":ans=4
    if s=="THU":ans=3
    if s=="FRI":ans=2
    if s=="SAT":ans=1
    print(ans)
main()

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
	ll n,sum=0,count=0;
  cin>>n;
   ll min=LONG_MAX;
  ll arr[n];
  	for(ll i=0;i<n;i++)
    {
		ll no;
      cin>>no;
      if(no<=0)
        	count++;
      if(abs(no)<min)
        	min=abs(no);
      sum+=abs(no);
    }
  	sum-=(count%2==1)?(2*min):0;
  	cout<<sum;
}

Measured memory_bytes: 256
use std::io::Read;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    let mut iter = buf.split_whitespace();
    let n: usize = iter.next().unwrap().parse().unwrap();
    let mut v: Vec<i32> = (0..n).map(|v| iter.next().unwrap().parse().unwrap()).collect();
    let mut ans: f64 = 0.0;
    v.sort();
    ans = v[0] as f64;
    for i in 1..n {
        ans = (ans + (v[i] as f64)) / 2.0;
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll=long long;
using vi = vector<int>;
using Graph = vector<vi>;
using P = pair<int,int>;
const int MOD=(int)1e9+7;
const int INF=(int)1e9;
const ll LINF=(ll)1e18;

int main(){
    string s;
    int n;
    cin >> n >> s;
    // 右向いてる人の数
    vi a(n,0);
    if(s[0]=='E') a[0]= 1;
    else a[0] = 0;
    for(int i=1;i<n;i++){
        a[i] = a[i-1] + (s[i]=='E'? 1:0);
    }
    ll ans = INF;
    rep(i,n){
        ll t;
        if(i==0){
            t = a[n-1] - a[0];
        }else if(i==n-1){
            t = (n-1) - a[n-2];
        }else{
            t = (i - a[i-1]) + (a[n-1] - a[i]);
        }
        ans = min(ans,t);
    }
    cout << ans << endl;
}


Measured memory_bytes: 1796
# coding: utf-8
# Your code here!
A,B,N=map(int,input().split())

num=N//B
if num==0:
    n=N
else:
    n=B*num-1

#print(n)
temp1=(A*n)/B//1
temp2=A*((n/B)//1)

print(int(temp1-temp2))


Measured memory_bytes: 9192
#include <iostream>
#include <string>
#include <cstring>
#include <vector>
#include <numeric>
#include <cstdlib>
#include <map>
#include <set>
#include <algorithm>
#include <math.h>
 
using namespace std;

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

    int sum = 0;
    int k = 1;

    while(1){
        if(N >= k){
            sum++;
            k *= K;
        }else{
            break;
        }
    }

    cout << sum << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
string s;
int main() 
{
	ios_base::sync_with_stdio(0);
	cin >> s;
	for (int i=0; i<4; i++)
	cout << s[i];
	cout << ' ';
	for (int i=4; i<s.size(); i++)
	cout << s[i];
	cout << '\n';
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define ll long long
using namespace std;
//typedef vector<unsigned int>vec;
//typedef vector<ll>vec;
//typedef vector<vec> mat;
typedef pair<int, int> P;
typedef pair<ll,ll> LP;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int INF = 1000000000;
const ll LINF = 1000000000000000000;//1e18
const ll MOD = 1000000007;
//const ll MOD = 998244353;
const double PI = acos(-1.0);
const double EPS = 1e-10;


void solve(){
    ll A;
    cin >> A;
    string b;
    cin >> b;
    ll B = 0;
    ll cur = 100;
    REP(i,b.size()){
        if(b[i] == '.') continue;
        B += cur * (b[i] - '0');
        cur /= 10;
    }
    ll ans = A * B / 100;
    cout << ans << endl;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    solve();
    // int T; cin >> T; REP(t,T) solve();
}

Measured memory_bytes: 3656
n = int(input())
dic = {}
pair = 0

for i in range(n):
  line = "".join(sorted(input()))
  if line in dic:
    dic[line] += 1
  else:
    dic[line] = 1
  
for value in dic.values():
  pair += (value * (value-1)) / 2
  
print(int(pair))

Measured memory_bytes: 17852
#include<stdio.h>

int main(void)
{
	int n;
	int i,j,count;
	int check;
	int prime[123456*2+1];
	
	prime[0] = 0;
	prime[1] = 0;
	for(i=2;i<=123456*2;i++)
	{
		prime[i] = 1;
	}
	for(i=2;i<=123456;i++)
	{
		for(j=2;i*j<=123456*2;j++)
		{
			prime[i*j] = 0;
		}
	}
	
	while(scanf("%d",&n))
	{
		if(n==0)
		break;
		else
		{
			count = 0;
			for(i=n+1;i<=2*n;i++)
			{
				count+=prime[i];
			}
			printf("%d\n",count);
		}
	}
	return 0;
}

Measured memory_bytes: 1564
#include<iostream>
#include<cassert>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<limits>
#include<set>
#include<deque>
#include<queue>
using namespace std;
#define int long  long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
typedef pair<int, int>P;
const int MOD = 1e9 + 7;
const int INF = 1e10;
const long double PI = (acos(-1));


signed main() {
	int N, K;
	cin >> N >> K;
	if (K & 1) {
		int n = N / K;
		int ans = n * n * n;
		cout << ans << endl;
	}
	else {
		int a = N / K;
		int b = N % K;
		int ans = 0;
		if (b >= K / 2)ans += (a + 1) * (a + 1) * (a + 1);
		else ans += a * a * a;
		ans += a * a * a;
		cout << ans << endl;
	}
}

Measured memory_bytes: 256
import java.util.*;
import java.util.Map.Entry;
 
class Main {
//	 static int mod =  (int) (Math.pow(10,9)+7);
//	 static int mod = 998244353;
   public static void main(String[] args) {
	   
       Scanner sc = new Scanner(System.in);
       int N = sc.nextInt();
       int R = sc.nextInt();
//       int B = sc.nextInt();
//       String S = sc.next();
//       String T = sc.next();
//       char[] s = S.toCharArray();
//       char[] t = T.toCharArray();
       
       int ans=R;
       if(N<10) {
    	   ans=ans+(100*(10-N));
       }
	   System.out.println(ans);
   }
      
}

Measured memory_bytes: 21844
#include <iostream>
using namespace std;
int main()
{
	int n,a=0,temp;
	cin>>n;
	temp=n;
	for(int i=0;i<=2;i++)
	{
		if(temp!=0)
		{
			a = a*10;
			a = a+temp%10;
			temp = temp/10;
		}
	}
	if (n==a)
	{
		cout<<"Yes";
	}
	else
	{
		cout<<"No";
	}
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<list>
#include<cstdint>
#include<bits/stdc++.h>
#include<queue>
#include<set>

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep_r(i, n) for(int i = n-1; i >= 0; i--)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i++)
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((ll)(x).size())
#define bit(n) (1LL<<(n))
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define INF bit(60)
#define pb push_back
#define mod 1000000007

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; }

using namespace std;
using uif=uint_fast64_t;
using ll=long long int;

int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a%mod;a=1ll*a*a%mod;}while(b>>=1);return ans;}
int qp(int a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}

int gcd(int a,int b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};



int main(void){

  ll n;
  cin>>n;

  vector<ll> a(n);

  rep(i,n) cin>>a[i];
  ll ans=0;
  //cout << gcd_arr(0,a) << endl;
  vector<ll> l(n+1);
  vector<ll> r(n+1);
  l[0]=0;
  r[n]=0;
  for(ll i=0;i<n;i++){
    if(l[i]==0) l[i+1]=a[i];
    else l[i+1]=gcd(l[i],a[i]);

    if(r[n-i]==0) r[n-1-i]=a[n-1-i];
    else r[n-1-i]=gcd( r[n-i] , a[n-i-1] );
    
  }

  rep(i,n+1){
    //cout << l[i] << "," << r[i] << endl;
  }
  rep(i,n){
    if(l[i]==0){
      ans=max(ans,r[i+1]);
    }
    else if( r[i+1]==0 ){
      ans=max(ans,l[i]);
    }
    else ans=max(ans, (ll)gcd( l[i] , r[i+1] ) );
  }
  cout << ans << endl;
  /*
  ans=r[1];
  for(ll i=2;i<n-1;i++){
    ans=max(ans, (ll)gcd(l[i-2],r[i]) );
  }
  ans=max(ans,l[n-2]);
  
  cout << ans << endl;
  */

  return 0;

}


Measured memory_bytes: 2560
#include<iostream>
#include<algorithm>
static const int MAX=10e5;
using namespace std;
int lcm(int a,int b){
	while(b!=0){
		int c=b;
		b=a%b;
		a=c;
	}
	return a;
}
int main(void)
{
	int N,M;
		cin >> N >> M;
	int X[MAX];
	for(int i=0;i<N;i++){
		int a;
			cin >> a;
		X[i]=a;
	}
	X[N]=M;
	sort(X,X+N+1);
	if(N==1){
		cout << X[N]-X[N-1] << endl;
		return 0;
	}
	
	int F=lcm(X[N]-X[N-1],X[N-1]-X[N-2]);
	for(int i=N-3;i>=0;i--)
		F=lcm(F,X[i+1]-X[i]);
	cout << F << endl;
	return 0;
}

Measured memory_bytes: 640
#include <cstdio>
#include <vector>
#include <algorithm>
#include <tuple>

using namespace std;

int Ans[100016];
int Now[100016];

int main() {
    int N;
    scanf("%d", &N);
    vector<pair<int, int> > A, B;
    for(int n=0; n<N; ++n) {
        int a;
        scanf("%d", &a);
        A.emplace_back(a, n);
    }
    for(int n=0; n<N; ++n) {
        int b;
        scanf("%d", &b);
        B.emplace_back(b, n);
    }
    sort(A.begin(), A.end());
    sort(B.begin(), B.end());
    for(int n=0; n<N; ++n) {
        if(B[n].first<A[n].first) {
            printf("No\n");
            return 0;
        }
    }
    for(int n=1; n<N; ++n) {
        if(A[n].first<=B[n-1].first) {
            printf("Yes\n");
            return 0;
        }
    }
    for(int n=0; n<N; ++n) {
        Now[n] = n;
        Ans[B[n].second] = A[n].second;
    }
    for(int n=0; n<N-1; ++n) {
        if(Now[n]==Ans[n]) {
            printf("Yes\n");
            return 0;
        }
        int ans = Ans[n];
        for(int i=N-1-n; i; --i) {
            if(ans==Now[i+n]) {
                Now[i+n] = Now[n];
                break;
            }
        }
    }
    printf("No\n");
    return 0;
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()

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

    // start
    int r, g, b;
    cin >> r >> g >> b;
    if ((r * 100 + g * 10 + b) % 4 == 0)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
    // end

    return 0;
}


Measured memory_bytes: 256
k = [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]
a = int(input())
print(k[a-1])

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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}


int nextInt() { int x; scanf("%d", &x); return x;}

const int MAX_N = 212345;
int a[MAX_N];
int b[20][MAX_N];

int main2() {
  int N = nextInt();
  REP(i, N) a[i] = nextInt();
  CLR(b, 0);
  REP(k, 20) {
    REP(i, N) {
      b[k][i+1] = b[k][i] + (a[i] >> k & 1);
    }
  }
  ll ans = 0;
  for (int i = 0; i < N; i++) {
    vector<int> rs;
    REP(k, 20) {
      int idx = distance(b[k]+i, upper_bound(b[k]+i, b[k]+N+1, b[k][i]+1));
      rs.push_back(idx-1);
    }
    ans += (*min_element(ALL(rs)));
  }
  cout << ans << endl;
  return 0;
}

int main() {
  for (;!cin.eof();cin>>ws)
    main2();
  return 0;
}


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

#define IOS ios::sync_with_stdio(0); cin.tie(nullptr); cout.tie(0)
#define endl "\n"
#define int long long
typedef vector<int> vi;
#define all(x) x.begin(),x.end()
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define FORD(i,a,b) for(int i=(a);i>=(b);i--)
#define OO 1e9
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
typedef long long ll;
#define in_range(x, y, r, c) ((x >= 0 && x < r && y >= 0 && y < c))


const double eps=1e-9;
const int MOD=998244353;
const int N=(int)3*1e5+9;
const int inf = 1<<30;


template< class T > T gcd(T a, T b) { return (b != 0 ? gcd<T>(b, a%b) : a); }
template< class T > T lcm(T a, T b) { return (a / gcd<T>(a, b) * b); }
template <typename T> T exp(T b, T p){T x = 1;while(p){if(p&1)x=(x*b);b=(b*b);p=p>>1;}return x;}
inline int ones(int n) { int res = 0; while(n && ++res) n-=n&(-n); return res; }
inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }
int est[N],west[N];
int n;
int32_t main() {
IOS;
int a,b,c,x,y,ans=0;

cin>>a>>b>>c>>x>>y;
while(x>0 || y>0){ 
    if(x>0 and y>0){ 
        ans+=min(a+b,2*c);

    }else if(x>0) ans+=min(a,2*c);
    else ans+=min(b,2*c);
    x--,y--;
}
    cout<<ans<<endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

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

	int a =sc.nextInt();int b =sc.nextInt();int c =sc.nextInt();
	int i, j, tmp;
	int[] data={a,b,c};

	for(i=0; i<2; i++)
	for(j=i+1; j<3; j++)
	if(data[i] > data[j]){
	tmp=data[i];
	data[i]=data[j];
	data[j]=tmp;
	}

	for(i=0; i<3; i++){
		System.out.print(data[i]);
	if(i==2)
		break;
	System.out.print(" ");
	}
	System.out.println();
	}
}




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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
using ll = long long;
string char_to_string(char val) {
  return string(1, val);
}
int char_to_int(char val) {
  return val - '0';
}
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

int main() {
  int N, K; cin >> N >> K;
  vector<int> d(K);
  vector<vector<int>> A(K);
  REP(i, K) {
    cin >> d[i];
    REP(k, d[i]) {
      int tmp;
      cin >> tmp;
      A[i].push_back(tmp);
    }
  }

  vector<int> m(100);
  REP(i, 100) m[i] = 0;
  REP(i, K) {
    REP(k, d[i]) {
      m[A[i][k]]++;
    }
  }

  int cnt = 0;
  REP(i, N + 1) {
    if(i == 0) continue;
    if(m[i] == 0) cnt++;
  }

  cout << cnt << endl;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define FOR(i,start,end) for(int i=start;i<=end;i++)
const int INF = 1001001001;
typedef long long ll;
const ll MOD=1000000007;
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
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>U COUNT(const T& a, const U& v) { return count(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 main(void){
    // Your code here!
    ll a,v; cin >> a >> v;
    ll b,w; cin >> b >> w;
    ll t; cin >> t;
    if ( b < a) {
        if (a-v*t <= b-w*t) {
            cout << "YES";
        } else {
            cout << "NO";
        }
    } else if (a == b) {
        cout << "YES";
    } else {
        if (a+v*t - (b + w*t) >= 0) {
        cout << "YES";
        } else {
            cout << "NO";
        }
    }
}


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

#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL); 

#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define mp make_pair
#define pu push
#define pp pop_back
#define in insert
#define ld long double
#define endl '\n'
#define debug cout << "Hold right there sparky.....\n";
#define forn(low,high,i) for(i=low;i<high;i++)
#define forrev(high,low,i) for(i = high; i>= low;i--)
#define trace(x) cerr << #x << ": " << x << " " << endl;

typedef long long int ll;
typedef unordered_map<int,int> umi;
typedef unordered_map<ll,ll> uml;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
int main()
{IOS
ll mod=1e9+7;
string s1,s2;
cin>>s1>>s2;
int dp[s1.length()+1][s2.length()+1];
for(int i=0;i<=s1.length();++i)
{
    for(int j=0;j<=s2.length();++j)
    {
        if(i==0 || j==0) dp[i][j]=0;
        else if(s1[i-1]==s2[j-1])
            dp[i][j]=dp[i-1][j-1]+1;
        else dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
    }
}
 int index = dp[s1.length()][s2.length()]; 
  
   // Create a character array to store the lcs string 
   char lcs[index+1]; 
   lcs[index] ='\0';
   int i=s1.length();
   int j=s2.length();
while(i>0 && j>0)
{
    if(s1[i-1]==s2[j-1])
    {
        lcs[index-1]=s1[i-1];
        i--;j--;index--;
    }
    else if(dp[i-1][j]>dp[i][j-1])
        i--;
        else j--;
}
cout<<lcs;

}

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

using namespace std;

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

    vector<int> P(N);
    vector<int> Q(N);

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

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

    vector<int> pat(N);

    for (int i = 1; i <= N; ++i ) {
        pat[i-1] = i;
    }

    int count = 0;
    int a = -1;
    int b = -1;
    do {
        /*cout << "[";
        for ( int i = 0; i < N; ++i ) {
            cout << pat[i];
        }
        cout << "]" << endl;*/

        count++;

        if (a == -1) {
            int ac = 0;
            for ( int i = 0; i < N; ++i ) {
                /*if ( pat[i] != P[i] ) break;
                else {
                    ++ac;
                    if ( ac == N ) a = count;
                }*/
                if ( pat[i] == P[i] ) {
                    //cout << count;
                    ++ac;
                    if ( ac == N ) {
                        //cout << count;
                        a = count;
                    }
                }
            }
        }

        if (b == -1) {
            int bc = 0;
            for ( int i = 0; i < N; ++i ) {
                /*if ( pat[i] != Q[i] ) break;
                else {
                    ++bc;
                    if ( bc == N ) b = count;
                }*/
                if ( pat[i] == Q[i] ) {
                    ++bc;
                    if ( bc == N ) b = count;
                }
            }
        }

    } while ( next_permutation(pat.begin(), pat.end()) );

    cout << abs((a-b)) << endl;

    return 0;
}

Measured memory_bytes: 256
n = int(input())

l = [3, 5, 7, 11, 13]
ans = []
for i in range(len(l)):
    for j in range(len(l)):
        if j <= i:
            continue
        ans.append(l[i]**3 * l[j])
        ans.append(l[j]**3 * l[i])
        for k in range(len(l)):   
            if k <= j:
                continue 
            ans.append(l[i]*l[j]*l[k])
a = sum([1 if tmp <= n else 0 for tmp in ans])
print(a)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll n, d, x, y;
	cin >> n >> d;
	ll ans = 0;
	while (n--) {
		cin >> x >> y;
		if (x * x + y * y <= d * d) {
			ans++;
		}
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
#define all(x) (x).begin(), (x).end()
#define endl '\n'
const ll inf = LLONG_MAX;
const long double pi = M_PI;
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}

int main() {
  ll n, l;
  cin >> n >> l;
  vector<string> s(n);
  for (ll i = 0; i < n; i++) cin >> s[i];
  sort(all(s));
  for (ll i = 0; i < n; i++) cout << s[i];
  cout << endl;
}

Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;

public class Main {
	static FastScanner sc;
	public static void main(String[] args){
		sc = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);
		out.println(solve());
		out.flush();
	}

	static String solve(){
		if(sc.nextInt()%2!=0&&sc.nextInt()%2!=0) return "Yes";
		else return "No";
	}
}

class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() { return Double.parseDouble(next());}
}

Measured memory_bytes: 21076
#include <iostream>
#include <math.h>
#include <algorithm>
#include <queue>
#include <vector>
#include <map>
#include <iomanip>
using namespace std;

typedef long long ll;
#define rep(i, n) for(long long i = 0; i < (long long)(n); i++)
#define memset(v, h) memset((v), h, sizeof(v))
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
using P = pair<ll, ll>;

ll m[20][20];

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; }

struct node
{
    public: ll x;
    public: ll y;

    node(ll xx, ll yy)
    {
        x = xx;
        y = yy;
    }
};

ll comb(int n, int r) {
  std::vector<std::vector<long long>> v(n + 1,std::vector<long long>(n + 1, 0));
  for (int i = 0; i < v.size(); i++) {
    v[i][0] = 1;
    v[i][i] = 1;
  }
  for (int j = 1; j < v.size(); j++) {
    for (int k = 1; k < j; k++) {
      v[j][k] = (v[j - 1][k - 1] + v[j - 1][k]);
    }
  }
  return v[n][r];
}

ll digit(ll num)
{
    if(num < 10)
    {
        return 1;
    }

    ll d = 1;
    ll k = 10;
    while(num >= k)
    {
        d++;
        k *= 10;
    }

    return d;
}

ll digitNum(ll num, ll count)
{
    ll a = (num % (ll) pow((double) 10, (double) count));
    return a / pow(10, count - 1);
}

int main(){
    ll n;
    ll c = 0;
    cin >> n;
    map<string, ll> dict;
    vector<string> d;

    rep(i,n)
    {
        string s;
        cin >> s;
        dict[s]++;
        if(c < dict[s])
        {
            c = dict[s];
        }
    }

    for( auto i = dict.begin(); i != dict.end() ; ++i ) {
      if(i->second == c)
      {
          d.push_back(i->first);
      }
    }

    sort(d.begin(), d.end());
    rep(i, d.size())
    {
        cout << d.at(i) << endl;
    }
    return 0;
}

Measured memory_bytes: 26868
#include<iostream>
#include <list>
#include<stack>
#include<queue>
#include <vector>
#include <set>
#include<algorithm>
#include<math.h>
#include<stdlib.h>
#include<string>
#include <functional>
#include<fstream>

#define FOR(k,m,n) for(int (k)=(m);(k)<(n);(k)++)
#define REP(i,n) FOR((i),0,(n))
#define LL long long
#define CLR(a) memset((a),0,sizeof(a))
#define SZ(x) (int((x).size()))
#define WAITING(str) int str;std::cin>>str;
#define DEBUGING(str) cout<<str<<endl
using namespace std;

const LL MOD = 1000000007;// 10^9+7
const int INF = (1 << 30);


//変数
int N;
vector<LL> a, b;






//サブ関数
//入力
void input()
{
	cin >> N;
	a.resize(N); REP(i, N)cin >> a[i];
	b.resize(N); REP(i, N)cin >> b[i];
}

bool bit(vector<LL> a, vector<LL> b, int level)
{
	LL res = 0;
	level++;
	for (auto& num : a)num %= (1ll << (level));
	for (auto& num : b)num %= (1ll << (level));
	sort(b.begin(), b.end());
	level--;


	for (auto num : a) {
		//[T,2T)
		LL l = (1ll << level) - num;
		LL r = 2 * (1ll << level) - num;
		res += distance(lower_bound(b.begin(), b.end(), l), lower_bound(b.begin(), b.end(), r));
		//cerr << res << "  ";
		l = 3 * (1ll << level) - num;
	    r = 4 * (1ll << level) - num;
		res += distance(lower_bound(b.begin(), b.end(), l), lower_bound(b.begin(), b.end(), r));
		//cerr << res << endl;
	}
	//cerr << endl;
	return res % 2;
}

//計算
void calc()
{
	const int siz = 30;
	vector<bool> res;
	REP(i, siz) {
		res.push_back(bit(a, b, i));
	}

	LL ans = 0;
	while (!res.empty()) {
		ans <<= 1;
		ans += res.back();
		res.pop_back();
	}
	cout << ans << endl;
}


//出力
void output()
{

}


//デバッグ
void debug()
{
	int N;
	cin>>N;
}


//メイン関数
int main()
{
	input();
	calc();
	output();
	debug();
	
	return 0;
}


Measured memory_bytes: 6568
#include <bits/stdc++.h>
#define PI 3.1415926535897
using namespace std;
typedef long long ll;
const int INF = 1000000000;
const ll LINF = 1000000000000000000; //1e18
const double EPS = 1e-10;

const ll divide = 1e9 + 7;

ll factorial(ll num)
{
    ll sum = 1;
    for (int i = 1; i <= num; i++)
    {
        sum *= i;
        sum %= divide;
    }
    return (sum);
}

int main(void)
{
    int N, M;
    cin >> N >> M;

    ll ans = 0;
    ll temp;
    if (N == M)
    {
        temp = factorial(N);
        temp *= temp * 2;
        temp %= divide;
        ans = temp;
    }
    else if (abs(N - M) == 1)
    {
        ans = (factorial(N) * factorial(M) % divide);
    }
    else
    {
        ans = 0;
    }
    cout << ans << "\n";
    return (0);
}

Measured memory_bytes: 256
def slove():
    import sys
    input = sys.stdin.readline
    s = str(input().rstrip('\n'))
    t = str(input().rstrip('\n'))
    cnt = 0
    for i in range(3):
        if s[i] == t[i]:
            cnt += 1
    print(cnt)


if __name__ == '__main__':
    slove()


Measured memory_bytes: 38384
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
int main() {
 int N;
  cin>>N;
  for(int i=0;i<pow(10,5);i++){
    if(i*i>N){
      cout<<(i-1)*(i-1)<<endl;
      break;
    }
  }
}	


Measured memory_bytes: 256
#include<algorithm>
#include<chrono>
#include<ctime>  
#include<climits>
#include<functional>
#include<numeric>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<random>
#include<set>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<vector>
#include<cassert>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<string>
// #include<bits/stdc++.h>
using namespace std;
 
struct Debug{
    int cnt = 0;
    bool on = false;
    char debug[10] = "debug";
    template<class T>
    Debug & operator<<(const T & v) {
        if(on && cnt++ == 0) cerr << "debug: ";
        if(on) cerr << v << ' ';
        return *this;
    }
    Debug & operator<<(ostream&(*pManip)(ostream&)) {
        if(on) cerr << (*pManip);
        cnt = 0;
        return *this;
    }
} debug;
#define rep(i, a, b) for(auto i = (a); i < (b); i++)
#define rrep(i, a, b) for(auto i = (a); i > (b); i--)
#define all(v) (v).begin(), (v).end()
#define print(v) {if(debug.on){for(auto x : v) debug << x; debug << endl;}}
#define printn(v, n) {if(debug.on){for(int _i = 0; _i < n; _i++) debug << *(v + _i); debug << endl;}}
 
typedef unsigned long long ull;
typedef long long ll;
 
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
 
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<pii> vpii;

const int MAXN = 1e6 + 10;

int main(int argc, char * argv[]) {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    // cout.tie(nullptr);
    if(argc > 1 && !strcmp(argv[1], debug.debug)) debug.on = true;

    int n;
    int a;
    cin >> n;
    long long s1 = 0, s2 = 0;
    for(int i = 0; i < n; i++) {
    	cin >> a;
    	s1 += a;
    	s2 += a * a;
    }
    cout << (s1 * s1 - s2) / 2 << endl;
    return 0;
 
}























Measured memory_bytes: 256
#include<queue>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
int N,ans,e,w;
char b;
int we[300010],ww[300010],ew[300010];
bool ifw[300010];
int main()
{
	scanf("%d\n",&N);
	for(int i=1;i<=N;i++)
	{
		scanf("%c",&b);
		we[i]=e;
		ww[i]=w;
		if (b=='W')
		{
			w++;
			ifw[i]=true;
		}
		if (b=='E') e++;
	}
	for(int i=1;i<=N;i++)
	{
		ew[i]=w-ww[i];
		if (ifw[i]) ew[i]--;
		if (ew[i]+we[i]>ans) ans=ew[i]+we[i];
	}
	printf("%d",N-ans-1);
//	system("pause");
	return 0;
}


Measured memory_bytes: 4096
#include <stdio.h>
#include <stdbool.h>

typedef struct {
	char mark;
	int value;
} card;

card C[40], D[40];

void swap(card *a, card *b) {
	card tmp = *a;
	*a = *b;
	*b = tmp;
}

void bubbleSort(card *C, int N) {
	for (int i = 0; i < N; ++i) {
		for (int j = N-1; j > i; --j) {
			if (C[j].value < C[j-1].value) swap(&C[j], &C[j-1]);
		}
	}
}

void selectionSort(card *C, int N) {
	for (int i = 0; i < N; ++i) {
		int minj = i;
		for (int j = i; j < N; ++j) {
			if (C[j].value < C[minj].value) minj = j;
		}
		swap(&C[i], &C[minj]);
	}
}

int main() {
	int N;
	scanf("%d", &N);
	char s[N][3];
	for (int i = 0; i < N; ++i) {
		scanf("%s", s[i]);
		C[i].mark = s[i][0];
		C[i].value = s[i][1] - '0';
		D[i] = C[i];
	}
	bubbleSort(C, N);
	for (int i = 0; i < N; ++i) {
		if (i != N-1) printf("%c%d ", C[i].mark, C[i].value);
		else printf("%c%d\n", C[i].mark, C[i].value);
	}
	printf("Stable\n");

	selectionSort(D, N);
	bool flag = true;
	for (int i = 0; i < N; ++i) {
		if (C[i].mark != D[i].mark) flag = false;
		if (i != N-1) printf("%c%d ", D[i].mark, D[i].value);
		else printf("%c%d\n", D[i].mark, D[i].value);
	}
	if (flag) printf("Stable\n");
	else printf("Not stable\n");
}



Measured memory_bytes: 2048
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;


int main(void) {
	int n, m, q, i, j, l, r, sp, sq, im[503][503] = {};

	cin >> n >> m >> q;
	for (i = 0; i < m; i++) {
		cin >> l >> r;
		im[l - 1][r]++;
	}

	for (i = 0; i < n; i++) {
		for (j = i + 1; j <= n; j++) {
			im[i][j] += im[i][j - 1];
		}
	}

	for (j = 1; j <= n; j++) {
		for (i = j - 1; i >= 0; i--) {
			im[i][j] += im[i + 1][j];
		}
	}

	for (i = 0; i < q; i++) {
		cin >> sp >> sq;
		cout << im[sp - 1][sq] << endl;
	}

	return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

#define INF 1<<30
#define LINF 1ll<<60ll
#define MOD 1000000007
#define pb(a) push_back(a)

#define _overload3(_1,_2,_3,_4,name,...) name
#define _rep(i,n) _repi(i,0,n)
#define _repi(i,a,b) for(int i=a, i##_len=(b); i<i##_len; ++i)
#define _repis(i,a,b,s) for(int i=a, i##_len(b); i<i##_len; i+=s)
#define REP(...) _overload3(__VA_ARGS__,_repis,_repi,_rep,)(__VA_ARGS__)

#define REPR(i, n) for(int i = n;i >= 0;--i)
#define REPARR(i, v) for(int i = 0;i < sz(v);++i)

#define all(vec) (vec.begin()),(vec.end())
#define sz(x) ((int)(x).size())
#define bit(n) (1ll<<(n))

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

#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define yes(n) cout<<((n)?"yes":"no")<<endl
#define poss(n) cout<<((n)?"possible":"impossible")<<endl
#define Poss(n) cout<<((n)?"Possible":"Impossible")<<endl
#define POSS(n) cout<<((n)?"POSSIBLE":"IMPOSSIBLE")<<endl



int main(){
    int a,b;
    cin>>a>>b;
    char s[6];
    int ans=0;
    REP(i,a,b+1){
        sprintf(s,"%d",i);
        if(s[0]==s[4]&&s[1]==s[3]){
            ans++;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

#define MOD 2019

int main(void) {
  	int L, R, A;
    int c = 2018;
  	scanf("%d %d", &L, &R);
    if((R - L) >= 2019) {
        printf("0\n");
        return 0;
    }
    for (int i = L; i < R; i++) {
        for(int j = i + 1; j <= R; j++) {
            A = (i % MOD) * (j % MOD) % MOD;
            if (A < c) {
                c = A;
            }
            if(c == 0) {
                break;
            }
        }
    }
    printf("%d", c);
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <functional>
#include <set>
#include <map>
#include <unordered_map>
#include <queue>
#include <deque>
#include <cmath>
#include <cstdio>

using namespace std;

typedef long long ll;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)

int main(int argc, char **argv)
{
    int N;
    cin >> N;
    if (N % 10 == 3) cout << "bon" << endl;
    else if (N % 10 == 0 || N % 10 == 1 ||N % 10 == 6 ||N % 10 == 8) cout << "pon" << endl;
    else cout << "hon" << endl;
    return 0;
}


Measured memory_bytes: 3636
// reference: 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 mut 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")
    };
}

use std::cmp::Ordering;
#[derive(Eq, PartialEq, Clone, Debug)]
pub struct Rev<T>(pub T);

impl<T: PartialOrd> PartialOrd for Rev<T> {
    fn partial_cmp(&self, other: &Rev<T>) -> Option<Ordering> {
        other.0.partial_cmp(&self.0)
    }
}

impl<T: Ord> Ord for Rev<T> {
    fn cmp(&self, other: &Rev<T>) -> Ordering {
        other.0.cmp(&self.0)
    }
}

impl<T: Copy> Copy for Rev<T> {}

use std::collections::BinaryHeap;

fn main() {
    input! {
        n: usize,
        a: usize,
        x: [usize; n]
    }

    let max_sum = n * 50;
    let mut dp = vec![vec![vec![0_usize; max_sum + 1]; n + 1]; n + 1];
    // [[0,p]枚までに][q枚使って][rになる選び方]は何通りあるか

    for p in 0..n + 1 {
        dp[p][0][0] = 1;
    }

    for p in 1..n + 1 {
        for q in 1..n + 1 {
            for r in 0..max_sum + 1 {
                dp[p][q][r] = dp[p - 1][q][r]
                    + if r >= x[p - 1] {
                        dp[p - 1][q - 1][r - x[p - 1]]
                    } else {
                        0
                    };
            }
        }
    }

    let mut ans = 0;
    for q in 1..n + 1 {
        ans += dp[n][q][a * q];
    }

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


Measured memory_bytes: 67836
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>

using namespace std;


int main(){

	int N,M,tmp;
	scanf("%d %d",&N,&M);

	int* table = new int[N+M+100];
	int* locationTable = new int[N+1];

	for(int i = N-1; i >= 0; i--){
		table[i] = N-i;
		locationTable[table[i]] = i;
	}

	int index = N;

	for(int i = 0; i < M; i++){
		scanf("%d",&tmp);
		table[locationTable[tmp]] = -1;
		locationTable[tmp] = index;
		table[index++] = tmp;
	}

	for(int i = index-1; i >= 0; i--){
		if(table[i] != -1)printf("%d\n",table[i]);
	}

	return 0;
}

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

using namespace std;
using ll = long long;

constexpr ll MOD = 1000000007LL;

string k;
int d;
int n;

ll dp[10005][105][2];

ll solve(int index, int total, bool skip) {
  if (index == n) {
    return (total == 0) ? 1LL : 0LL;
  }
  ll& res = dp[index][total][skip];
  if (res != -1LL) {
    return res;
  }
  int cur = k[index] - '0';
  res = 0;
  for (int i = 0; i < 10; i++) {
    bool stop = (skip || index == 0) && (i > cur);
    if (stop) {
      break;
    }
    bool keepSkip = (skip || index == 0) && (i == cur);
    res = (res + solve(index + 1, (total + i) % d, keepSkip)) % MOD;
  }
  // cout << index << ' ' << total << ' ' << skip << '\n';
  return res;
}

int main() {
  fill(&dp[0][0][0], &dp[0][0][0] + 10005 * 105 * 2, -1LL);
  cin >> k >> d;
  n = k.size();
  cout << (solve(0, 0, false) + MOD - 1) % MOD << '\n';
  return 0;
}


Measured memory_bytes: 17664
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func readInt() int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}

func readInt64() int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}

const INF = int(1e4) + 1

func main() {
	sc.Split(bufio.ScanWords)
	n := readInt()
	h := make([]int, n)
	for i := 0; i < n; i++ {
		h[i] = readInt()
	}

	dp := make([]int, n)
	dp[0] = 0
	dp[1] = abs(h[0] - h[1])

	for i := 2; i < n; i++ {
		dp[i] = min(dp[i-2]+abs(h[i]-h[i-2]), dp[i-1]+abs(h[i]-h[i-1]))
	}
	fmt.Println(dp[n-1])
}

func min(a int, b int) int {
	if a < b {
		return a
	}
	return b
}

func abs(a int) int {
	if a < 0 {
		return -1 * a
	}
	return a
}


Measured memory_bytes: 3788
#pragma GCC optimize "-O3"
#pragma GCC target ("avx")
#define _USE_MATH_DEFINES
#include<bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define inf (1ll<<60)
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v),greater<int>())
#define SPEED ios::sync_with_stdio(false);cin.tie(0);cout<<fixed<<setprecision(12)
#define erase(i) erase(i, 1)
signed gcd(int a, int b){return b?gcd(b,a%b):a;}
signed lcm(int a, int b){return a*b/gcd(a,b);}
template<typename T> void remove(std::vector<T>& vector, unsigned int index){vector.erase(vector.begin() + index);}
//priority_queue<int, vi, greater<int> > que;//昇順
//priority_queue<int> que; // 降順

using namespace std;

const int mod=1e9+7;

signed main()
{
    SPEED;
    char c;
    cin >> c;
    c++;
    cout << c << endl;
    return 0;
}


Measured memory_bytes: 256
import sys
import os
import math
import string

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: x * y / math.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')

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

    N = ii()
    A = il()
    ret = {}
    for i, v in enumerate(A):
        ret[i] = v - (i + 1)

    ret = sorted(ret.items(), key=lambda x:x[1])
    md = ret[len(ret)//2][1]

    ans = 0
    for r in ret:
        ans += abs(r[1] - md)
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 55392
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0;i<n;i++)
int main() {
    int n,ans=1000000000;
    cin>>n;
    rep(i,n){
        int a,tmp=0;
        cin>>a;
        while(a%2==0){
            a=a/2;
            tmp+=1;
        }
        ans=min(ans,tmp);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <random>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using Pt = pair<int, int>;

namespace
{
	int fn(int N, int ct, vi& C)
	{
		if (N == 0)
		{
			return ct;
		}
		if (C[N] > 0)
			return ct + C[N];
		++ct;
		int M = N;
		int c = 0;
		while (M > 0)
		{
			c += (M & 1);
			M >>= 1;
		}
		int d = N % c;
		return fn(d, ct, C);
	}
}
int main()
{
	int N;
	cin >> N;
	vi C(N+2);
	for (int i = 0; i <= N+1; ++i)
	{
		int c = fn(i, 0, C);
		C[i] = c;
	}

	string X;
	cin >> X;
	vi XX(N);
	for (int i = 0; i < N; ++i)
		XX[i] = X[i] == '1' ? 1 : 0;

	int M = 0;
	for (int i = 0; i < N; ++i)
	{
		if (XX[i] == 1)
			++M;
	}
	vi ans(N);


	if (M <= 1)
	{
		int r2 = 0;
		for (int i = 0; i < N; ++i)
		{
			r2 *= 2;
			r2 += XX[i];
			r2 %= (M + 1);
		}

		int rr2 = 1;
		for (int i = N - 1; i > -1; --i)
		{
			if (XX[i] == 1)
			{
				ans[i] = 0;
			}
			else
			{
				int q = r2 + rr2;
				q %= M + 1;
				while (q < 0)
					q += XX[i] == 1 ? M - 1 : M + 1;
				q %= XX[i] == 1 ? M - 1 : M + 1;

				ans[i] = C[q] + 1;
			}

			rr2 *= 2;
			rr2 %= M + 1;
		}
		for (int i = 0; i < N; ++i)
			cout << ans[i] << endl;
		return 0;

	}


	int r1 = 0;
	int r2 = 0;
	for (int i = 0; i < N; ++i)
	{
		r1 *= 2;
		r1 += XX[i];
		r1 %= (M - 1);

		r2 *= 2;
		r2 += XX[i];
		r2 %= (M + 1);
	}

	int rr1 = 1;
	int rr2 = 1;
	for (int i = N-1; i > -1; --i)
	{
		int q = XX[i] == 1 ? r1 - rr1 : r2 + rr2;
		q %= XX[i] == 1 ? M - 1 : M + 1;
		while (q < 0)
			q += XX[i] == 1 ? M - 1 : M + 1;
		q %= XX[i] == 1 ? M - 1 : M + 1;

		ans[i] = C[q] + 1;

		rr1 *= 2;
		rr1 %= M - 1;
		rr2 *= 2;
		rr2 %= M + 1;
	}
	for (int i = 0; i < N; ++i)
		cout << ans[i] << endl;
	return 0;
}


Measured memory_bytes: 6020
#include <stdio.h>

int main(void) {
	
int a,b,c,x;
int count;
scanf("%d %d %d\n",&a,&b,&c);
for(x=a,count=0;x<=b;x++){
if(c%x==0) count ++;
}
printf("%d\n",count);

	return 0;
}

Measured memory_bytes: 600
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)

using namespace std;

typedef long long int lli;

int main() {
    int N;
    cin >> N;
    map<int, int> D;
    REP (i, 0, N) {
        int Di;
        cin >> Di;
        D[Di]++;
    }
    int M;
    cin >> M;
    map<int, int> T;
    REP (i, 0, M) {
        int Ti;
        cin >> Ti;
        T[Ti]++;
    }
    bool OK = true;
    for (auto &it : T) {
        int num = it.first;
        OK &= (D[num] >= T[num]);
    }
    cout << (OK ? "YES" : "NO") << endl;
    return 0;
}

Measured memory_bytes: 18944
#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;
int main(){
	int n;
	cin>>n;
	while(n!=0){
		int t=n%10;
		n/=10;
		if(t==9){
			cout<<"Yes";
			return 0;
		}
	}
	cout<<"No";
}

Measured memory_bytes: 256
class HeapTree
	def initialize
		@node = []
	end

	private

	def swap(key)
		if  key < 0 
			return nil
		end
		if !left(key) && !right(key)
			return nil
		elsif left(key) && !right(key)
			if left(key) > @node[key]
				@node[key], @node[left_key(key)] =  @node[left_key(key)], @node[key]
				swap(left_key(key))
			end
		elsif right(key) && !left(key)
			if right(key) > @node[key]
				@node[key], @node[right_key(key)] =  @node[right_key(key)], @node[key]
					swap(right_key(key))
			end
		elsif @node[key] < left(key) && left(key) > right(key)
			@node[key], @node[left_key(key)] =  @node[left_key(key)], @node[key]
				swap(left_key(key))
		elsif @node[key] < right(key) && right(key) > left(key)
			@node[key], @node[right_key(key)] =  @node[right_key(key)], @node[key]
				swap(right_key(key))
		end
	end

	def extract!
		num = @node[0]
		@node[0] = @node.pop
		swap(@node[@node.length-1])
		return num
	end

	def insert!(num)
		@node << num
		swap(@node.length.to_i - 1)
	end

	def left(key)
		@node[2*key+1]
	end

	def right(key)
		@node[2*key+2]
	end

	def left_key(key)
		2*key+1
	end

	def right_key(key)
		2*key+2
	end

	# ???????????¢?´¢
	def precedingOrderSearch(key, &func)
		if @node[key]
			func.call(key, @node[key])
			precedingOrderSearch(left(key), &func)
			precedingOrderSearch(right(key), &func)
		end
	end
	# ???????????¢?´¢
	def afterLineOrderSearch(key, &func)
		if @node[key]
			afterLineOrderSearch(left(key), &func)
			afterLineOrderSearch(right(key), &func)
			func.call(key, @node[key])
		end
	end
	#???????????¢?´¢
	def centerOrderSearch(node, &func)
		if @node[key]
			centerOrderSearch(left(key), &func)
			func.call(key, @node[key])
			centerOrderSearch(right(key), &func)
		end
	end

	public

	def insert(num)
		insert!(num)
	end

	def preceding_crawl(&func) #???hoge.precedingCrawl do |key, value| ??????????????????
		precedingOrderSearch(0, &func)
	end

 # ????????????
 def after_line_crawl(&func)
 	afterLineOrderSearch(0, &func)
 end

# ????????????
def center_crawl(&func)
	centerOrderSearch(0, &func)
end

def extract
	extract!
end

def priority_create
	i = 0
loop{
	key = (@node.size.to_i-1)/2-i
	break if key < 0
	swap(key)
	i += 1
}
end

def list
	return @node
end
end


head = HeapTree.new
n = gets.to_i
 gets.split.map(&:to_i).each do |v|
 	head.insert v
 end
head.priority_create
head.list.each do |v|
	print " #{v}"
end
print "\n"

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

int main() {
  int  n, c0 = 0, c1 = 0, c2 = 0, c3 = 0;
  cin >> n;
  
  vector<string> vec(n);
  for (int i = 0; i < n; i++) {
    cin >> vec.at(i);
  }
  
  c0 = count(vec.begin(), vec.end(), "AC");
  c1 = count(vec.begin(), vec.end(), "WA");
  c2 = count (vec.begin(), vec.end(), "TLE");
  c3 = count (vec.begin(), vec.end(), "RE"); 

  printf("AC x %d \n", c0);
  printf("WA x %d \n", c1);
  printf("TLE x %d \n", c2);
  printf("RE x %d \n", c3);

  return 0;
}

Measured memory_bytes: 6428
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define rep2(i,s,n) for (int i = s; i < n; ++i)
#define all(a) a.begin(),a.end()
using namespace std;

int main() {
    string a,b,c;
    cin >> a >> b >> c;
    cout << "A" << b[0] << "C" << endl;
}

Measured memory_bytes: 256