akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using vec=vector<ll>;
using mat=vector<vec>;
#define For(i,a,b) for(i=a;i<b;i++)
#define rep(i,N) For(i,0,N)
#define rep1(i,N) For(i,1,N)
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define vsort(v) sort(all(v))
#define vrsort(v) sort(allr(v))
#define mod 1000000007
using data=pair<ll,ll>;

long mmid(long a,long b,long c){return a<b?(b<c?b:max(a,c)):(b>c?b:min(a,c));}

ll modinv(ll a) {
  ll b=mod,u=1,v=0,t;
  while(b){
    t=a/b;
    a-=t*b; swap(a,b);
    u-=t*v; swap(u,v);
  }
  return (u+mod)%mod;
}

ll moddevide(ll a,ll b){return (a*modinv(b))%mod;}

ll modncr(ll n,ll r){
  ll i,plus=1;
  rep(i,r){
    plus=(plus*(n-i))%mod;
    plus=moddevide(plus,i+1);
  }
  return plus;
}

ll euclidean_gcd(ll a, ll b) {
  if(a<b) return euclidean_gcd(b, a);
  ll r;
  while ((r=a%b)){a=b;b=r;}
  return b;
}

ll countdigits(ll n){
  ll ans=0;
  while(n){n/=10;ans++;}
  return ans;
}

ll sumdigits(ll n){
  ll ans=0;
  while(n){ans+=n%10;n/=10;}
  return ans;
}

void printmap(vector<ll>& a,ll H,ll W){
  ll i,j;
  For(i,0,H+2){
    For(j,0,W+2){cout<<a[i*(W+2)+j];}
    cout<<endl;
  }
}
void inputmap(vector<ll>& a,ll H,ll W){
  ll i,j;
  string ss;
  For(i,1,H+1){
    cin>>ss;
    For(j,1,W+1){
      if(ss[j-1]=='#'){
        a[i*(W+2)+j]=1;
      }else{
        a[i*(W+2)+j]=0;
      }
    }
  }
}


int main(){
  ll i,j,N,M,K,suma=0,l,r,f=0;
  cin>>N>>K;
  vector<ll> a(N),alist,sa(N);
  rep(i,N){
    cin>>a[i];
    suma+=a[i];
  }
  for(i=1;i*i<suma;i++){
    if(suma%i==0){
      alist.push_back(i);
      alist.push_back(suma/i);
    }
  }
  if(i*i==suma)alist.push_back(i);
  vrsort(alist);
  rep(i,alist.size()){
    rep(j,N){
      sa[j]=a[j]%alist[i];
    }
    vsort(sa);

    M=0;l=0;r=N-1;
    while(l<=r){
      if(l==r){
        f=1;
        break;
      }else if(sa[l]<alist[i]-sa[r]){
        M+=sa[l];
        sa[r]+=sa[l];
        l++;
      }else{
        M+=alist[i]-sa[r];
        sa[l]-=alist[i]-sa[r];
        r--;
      }
      if(M>K)break;
    }
    if(f){cout<<alist[i]<<endl;return 0;}
  }
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  while(1){
    int a,b,c,d[101],sum=0;
    cin>>a>>b>>c;
    if(a+b+c==0)break;
    for(int i=0;i<a;i++)cin>>d[i],sum+=d[i];
    if(d[b-1]==0)cout<<0<<endl;
    else cout<<(sum*100-sum*c)/d[b-1]<<endl;
  }
  return 0;
}

Measured memory_bytes: 3100
#pragma region RegionDefs
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#include "boost/multi_array.hpp"
#define rep(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define reps(i,j,n) for(int i=(j),i##_len=(n);i<i##_len;++i)
#define repr(i,n) for(int i=(n);i>=0;--i)
#define all(x) begin(x),end(x)
using namespace std;
const int INF = 1e9;
template<class T=int> using P  = pair<T, T>;
template<class T=int> using V  = vector<T>;
template<class T=int> using PQ = priority_queue<T>;
template<class T=int> using PQG = priority_queue<T, V<T>, greater<T>>;
typedef long long ll;
const ll MOD = 1000000007LL;
void in() {}
template<class Head, class... Tail>
void in(Head&& head, Tail&&... tail)
{
    cin >> head;
    in(move(tail)...);
}
#define IN(...) ll __VA_ARGS__; in(__VA_ARGS__)

//時間が厳しいとき使う
#define INI(...) int __VA_ARGS__; in(__VA_ARGS__)
#define INS(T, ...) T __VA_ARGS__; in(__VA_ARGS__)
#define VIN(T, v, n) V<T> v(n); for(auto& _elem:v)cin>>_elem
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 (a>b) {a=b; return 1;} return 0;}
#define y0 y__0
#define y1 y__1
#define j0 j__0
#define j1 j__1
#pragma endregion RegionDefs

void solve()
{
    IN(n);
    map<string, ll> m;
    rep(i, n)
    {
        string s; cin >> s;
        m[s]++;
    }
    vector<pair<ll,string>> v;
    for (auto&& a : m)
    {
        v.emplace_back(a.second, a.first);
    }
    sort(all(v), greater<pair<ll,string>>());
    vector<string> s;
    ll x = v[0].first;
    for (auto&& a : v)
    {
        if (a.first == x) s.push_back(a.second);
        else break;
    }
    sort(all(s));
    for(auto&& a : s)
    {
        cout << a << endl;
    }
}

int main()
{
    cin.tie(0); cout.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(numeric_limits<double>::max_digits10);

    solve();

    return 0;
}

Measured memory_bytes: 30572
import java.util.*;
public class Main{
  public static void main(String args[]){
    
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    
    int A;
    A = a * b;
    if(A % 2 == 1){
      System.out.println("Odd");
    }else{
       System.out.println("Even");
    }
  }
}

Measured memory_bytes: 23764
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)
#define pai 3.14159265358979323846
const int INF = 1001001001;
typedef long long ll;
int A[3][3], N;
bool punched[3][3];
bool ok[3][3];
int a[3][3],n;
using Graph = vector<vector<int>>;
vector<vector<int>> field;
vector<bool> seen;

const int MOD = 1000000007;
typedef pair<int,int> P;

int x;
bool isbeki[1010];

int main() {
    int n,ans=0;
	cin >> n;
	for (int i = 0;i <= n;i++){
		if (int(i*1.08) == n){
			ans = i;
		}
	}
	if(ans) cout << ans << endl;
	else cout << ":(" << endl;

}

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

const int N=1e6+30;
typedef long long ll;
int n,d;
int main()
{
    cin>>n>>d;
    if(n>=10){
        cout<<d<<endl;
    }
    else{
        int tmp=100*(10-n);
        cout<<d+tmp<<endl;
    }
}


Measured memory_bytes: 256
#include <stdio.h>
int main(){
int a,b,c,d;
scanf("%d %d %d %d",&a,&b,&c,&d);
int e,f;
e=a+b;
f=c+d;

if(e>f) puts("Left");
else
if(e==f) puts("Balanced");
else
if(e<f) puts("Right");

return 0;
}

Measured memory_bytes: 128
//#include <tourist>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = 1e9;
const ll LINF = ll(1e18) + 1;
const int MOD = 1000000007;
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define rep(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define debug(v)          \
    cout << #v << ":";    \
    for (auto x : v)      \
    {                     \
        cout << x << ' '; \
    }                     \
    cout << endl;
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;
}
//cout<<fixed<<setprecision(15);有効数字15桁
//-std=c++14
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
string s;
vector<int> a;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> s;
    map<char,int> m;
    for (int i = 0; i < s.size(); i++)
    {
        m[s[i]]++;
    }
    if(abs(m['a']-m['b'])<=1&&abs(m['c']-m['b'])<=1&&abs(m['c']-m['a'])<=1)YES;
    else NO;
}


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

using namespace std;
int main()
{
    int n, digit;
    cin>>n;
    while(n>0)
    {
        digit=n%10;
        if(digit==9)
        {
            cout<<"Yes"<<endl;
            return 0;
        }
        n/=10;
    }
    cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 256
// AOJ 0606: Tower of JOIOI
// 2018.1.10 bal4u@uu

#include <stdio.h>
#include <stdlib.h>

char s[1000005], *p;

int check(char *p, int m)
{
	int i, si, oi, soi, n;

	i = si = oi = soi = n = 0;
	while (*p) {
		if (*p == 'J') {
			if (soi > oi) { oi++; if (++n == m) return 1; }
		} else if (*p == 'O') {
			if (si > i && soi < m) soi++, i++;
		} else {						// *p == 'I'
			if (si < m) si++;
			else if (soi > oi) { oi++; if (++n == m) return 1; }
		}
		p--;
	}
	return 0;
}

int main()
{
	int n, i, oi, ans;
	int lo, hi, m;

	fgets(s+1, 10, stdin), n = atoi(s+1);
	fgets(s+1, 1000005, stdin);
	ans = i = oi = 0;	// i:'I'の数, oi:"OI"ペア数
	p = s+n; while (*p) {
		if (*p == 'J') {
			if (oi) ans++, oi--;
		} else if (*p == 'I') {
			i++;
		} else /* if (*p == 'O') */ {
			if (i) oi++, i--;
		}
		p--;
	}
	if (!oi) goto done;

	m = ans + (i + oi)/2;
	if (check(s+n, m)) { ans = m; goto done; }

	if (i > oi && ans + oi < m) {
		m = ans + oi;
		if (check(s+n, m)) { ans = m; goto done; }
	}

	lo = ans, hi = m;
	while (lo + 1 < hi) {
		m = (lo + hi) >> 1;
		if (check(s+n, m)) lo = m; else hi = m;
	}
	ans = lo;

done:
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 2736
# 全て1食800円のレストラン
# 15食食べるごとにその場で200円もらえる
# 合計N食たべた。払った金額=x円、もらった金額をy円としてx-yを求める

# 入力されたNを数値に変換
N = int(input())

# 払った金額=x円を求める
x = 800 * N

# もらった金額=y円を求める
# 200円 * 回数Nを15で割った時の整数の商
y = 200 * (N // 15)

print(x-y)

Measured memory_bytes: 9160
#include<iostream>

using namespace std;
int p[22];
int main() {
  
  int n;
  cin >> n;
for(int i = 0; i < n; i++) {
cin >> p[i];
}
int ans = 0;
  
  for(int i = 0; i < n - 2; i++) {
if(p[i] < p[i+1] && p[i+2] > p[i+1]) ans++;
if(p[i+2] < p[i+1] && p[i] > p[i+1]) ans++;
}
cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
int main(){
    int n,i,tmp,tmp1,tmp2,res=0;
    vector<int> p;
    cin >> n;
    res = 0;
    for(i=0;i<n;i++){
        cin >> tmp;
        p.push_back(tmp);
    }
    for(i=0;i<n;i++){
        if(p[i] != i+1) res++;
    }
    cout << (res==2 || res==0 ? "YES": "NO") << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define pi 3.141592653589793238
#define int long long
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

map<int,int>mm[100005];
int tot[100005];


signed main()
{

ios_base::sync_with_stdio(false);
cin.tie(NULL);  
cout.tie(0);   

#ifndef ONLINE_JUDGE
    if(fopen("INPUT.txt","r"))
    {
    freopen ("INPUT.txt" , "r" , stdin);
    freopen ("OUTPUT.txt" , "w" , stdout);
    }
#endif  


    int n,m;
    cin>>n>>m;
    int a[n+1];
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
        tot[a[i]%m]++;
        mm[a[i]%m][a[i]]++;
    }
    int ans=0;

        for(int j=1;j<=(m-1)/2;j++)
        {
            int z=m-j;
            ans+=min(tot[j],tot[z]);
            if(tot[j]>tot[z])
            {
                int tt=tot[j]-tot[z];
                for(auto i:mm[j])
                {
                    int k=i.second/2;
                    k*=2;
                    ans+=min(tt,k)/2;
                    tt-=min(tt,k);
                }
            }
            else
            {
                int tt=tot[z]-tot[j];
                for(auto i:mm[z])
                {
                    int k=i.second/2;
                    k*=2;
                    ans+=min(tt,k)/2;
                    tt-=min(tt,k);
                }                
            }            
        }
    ans+=tot[0]/2;
    if(m%2==0)
        ans+=tot[m/2]/2;
    cout<<ans;
} 



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

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

#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

ll A[100005];

int main()
{
    int N;
    cin >> N;
    REP(i, N)
    {
        cin >> A[i];
    }
    sort(A, A + N);
    int f = 1, e = N - 1;
    ll sum = 0;
    ll left = A[0], right = A[0];
    while (f <= e)
    {
        ll mf = std::max(abs(left - A[f]), abs(right - A[f]));
        ll me = std::max(abs(left - A[e]), abs(right - A[e]));
        if (mf > me)
        {
            if (abs(left - A[f]) > abs(right - A[f]))
                left = A[f];
            else
                right = A[f];
            f++;
        }
        else
        {
            if (abs(left - A[e]) > abs(right - A[e]))
                left = A[e];
            else
                right = A[e];
            e--;
        }
        sum += std::max(mf, me);
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <queue>
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <map>
#include <stdio.h>
using namespace std;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for(int i = (a); i < (int)(b); i++)
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vint;
typedef vector<string> vstr;
typedef pair<ll, ll> pint;
unsigned long long inf = (1LL << 62);
ll mod = 1000000007;
pint dx[4] = { {1, 0}, {-1, 0}, {0, 1}, {0, -1}};

ll min(ll a, ll b){
	if (a < b)
		return a;


		return b;
}

ll max(ll a, ll b) {
	if (a < b)
		return b;
	
	return a;
}



ll N, K;

vector<ll> A;
ll dp[51][2];
ll cnt[50][2];
int main() {
	cin >> N >> K;

	A.resize(N);

	rep(i, N) {
		cin >> A[i];
		rep(j, 50) {

			cnt[j][((A[i] >> j) & 1LL)] += 1;
		}
	}
	
	for (int i = 49; i >= 0; i--) {

		dp[i][0] = dp[i + 1][0] + (1LL << i) * cnt[i][!((K >> i) & 1LL)];

		if ((1LL << (i+1)) < K) {
			dp[i][1] = dp[i + 1][1] + (1LL << i) * max(cnt[i][0], cnt[i][1]);

			

		}

		if (((K >> i) & 1LL))
			dp[i][1] = max(dp[i][1], dp[i + 1][0] + (1LL << i) * cnt[i][1]);



	}
	

	cout << max(dp[0][1], dp[0][0]) << endl;
	
	return 0;
}

Measured memory_bytes: 1024
#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 db(x) cout<<#x<<"="<<x<<endl
template<class T>bool maxi(T &a,const T &b){if(a<b){ a=b; return 1;} return 0;}
template<class T>bool mini(T &a,const T &b){if(b<a){ a=b; return 1;} return 0;}
#define y0 y3487465 //j0
#define y1 y1347829 //j1
#define INF2 4000000000000000037
#define INF 1000000007
#define PI (acos(-1))
#define MOD 1000000007
#define EPS 1e(-9);
using namespace std;
typedef long long ll;

void Main(){

  ll A,B; cin>>A>>B; --A;

  ll a,b;

  if(A%2==0) a= A bitor ((A+1)/2%2);
  else a= ((A+1)/2%2);

  if(B%2==0) b= B bitor ((B+1)/2%2);
  else b= ((B+1)/2%2);

  cout<< (a xor b) <<"\n";

}

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


Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
	int a, b;

	scanf("%d", &a);
	scanf("%d", &b);

	if (a > b) {
		printf("a > b\n");
	} else if (a < b) {
		printf("a < b\n");
	} else if (a == b) {
		printf("a == b\n");
	}

	return 0;
}

Measured memory_bytes: 580
#include<iostream>
#include<queue>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>

using namespace std;

inline int read()
{
	int x=0;char ch=getchar();
	while(ch<'0' || '9'<ch)ch=getchar();
	while('0'<=ch && ch<='9')x=x*10+(ch^48),ch=getchar();
	return x;
}	

inline int maxx(int a,int b){if(a>b)return a;return b;}
inline int minn(int a,int b){if(a<b)return a;return b;}
inline bool chkmax(int &a,int b){if(a<b){a=b;return 1;}return 0;}

const int N=1e5+9;

int a[N];
queue<int> q;

int main()
{
	int n=read();
	for(int i=1;i<=n;i++)
		if((a[i]=read())==i)
			q.push(i);

	int cnt=0;
	while(!q.empty())
	{
		int u=q.front();
		q.pop();
		if(a[u]!=u)continue;
		cnt++;
		if(u>1 && a[u-1]==u-1)
			swap(a[u-1],a[u]);
		else if(u<n && a[u+1]==u+1)
			swap(a[u+1],a[u]);
		else if(u>1 && a[u-1]!=u)
			swap(a[u-1],a[u]);
		else if(u<n && a[u+1]!=u)
			swap(a[u+1],a[u]);
	}
	printf("%d\n",cnt);
	return 0;
}


Measured memory_bytes: 1024
'''
ITP-1_9-D
 ???????????????
????????? strstr ?????????????????????????????????????????????????????????????????°???????????????????????????????????????????????\?????????????????????????????§??????
print a b: strstr ??? a ??????????????? b ??????????????§??????????????????
reverse a b: strstr ??? a ??????????????? b ??????????????§?????????????????????
replace a b p: strstr ??? a ??????????????? b ??????????????§??? p ?????????????????????
????????§??????????????? strstr ????????????????????? 0 ???????????¨????????????
???Input
1 ?????????????????? strstr ????????????????????????strstr ?????±?°????????????????????????????2 ????????????????????° qq ????????????????????????
?¶???? qq ??????????????????????¨??????¢?????§?????????????????????
???Output
??? print ???????????¨???????????????????????????????????????????????????
'''
# inputData
string = input()
exeCnt = int(input())

for cnt0 in range(exeCnt):
    exeData = input().split()
    exe00 = exeData[0]
    exe01 = int(exeData[1])
    exe02 = int(exeData[2])
#    exe03 = exeData[3]

    if exe00 == 'print':
        print(string[exe01:exe02 + 1])

    elif exe00 == 'reverse':
        string = string[0:exe01] + string[exe01:exe02 + 1][::-1] + string[exe02 + 1:]

    elif exe00 == 'replace':
        exe03 = exeData[3]
        string = string[0:exe01] + exe03 + string[exe02 + 1:]

Measured memory_bytes: 7704
#define _USE_MATH_DEFINES
#include <iostream>
#include <numeric>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <iterator>
#include <math.h>
#include <cmath>
#include <set>   

using namespace std;

int main() {
	int w, h, n;
	cin >> w >> h >> n;

	int minX = 0;
	int maxX = w;
	int minY = 0;
	int maxY = h;

	for (int i = 0; i < n; i++)
	{
		int x, y, a;
		cin >> x >> y >> a;

		if (a == 1) {
			if (minX <= x) {
				w -= x - minX;
				minX = x;
			}
		}

		if (a == 2) {
			if (x <= maxX) {
				w -= maxX - x;
				maxX = x;
			}
		}

		if (a == 3) {
			if (minY <= y) {
				h -= y - minY;
				minY = y;
			}
		}

		if (a == 4) {
			if (y <= maxY) {
				h -= maxY - y;
				maxY = y;
			}
		}

	}

	if (h <= 0 || w <= 0) {
		cout << 0 << endl;

	}
	else {
		cout << h * w << endl;
	}

}

Measured memory_bytes: 256
from operator import mul
from functools import reduce
def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

n = int(input())
k = int(input())

result = 0
for i in range(101):
    if n < 10 ** i:
        if i < k:
            break
        if i > k:
            result += cmb(i-1, k) * 9**k
        s = str(n)
        result += (int(s[0])-1) * cmb(i-1, k-1) * (9 **(k-1))
        if k > 1:
            ind = -1
            for j in range(1, i):
                if s[j] != '0':
                    ind = j
                    break
            if ind == -1:
                break
            if i - ind >= k:
                result += cmb(i-ind-1, k-1) * (9**(k-1))
            result += (int(s[ind])-1) * cmb(i-ind-1, k-2) * (9**(k-2))
            if k > 2:
                ind2 = -1
                for j in range(ind+1, i):
                    if s[j] != '0':
                        ind2 = j
                        break
                if ind2 == -1:
                    break
                result += (i-ind2-1) * 9 + int(s[ind2])
            else:
                result+=1
        else:
            result+=1
        break
print(result)

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

#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 all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using pi = pair<int, int>;
const ll INF = 1LL << 60;


int main() {
    int n, d,x,cnt=0;
    double nn = 0.0;
    cin >> n >> d;
    vector<vector<int>>arr(n, vector<int>(d));
    rep(i, n)rep(j, d) {
        cin >> x;
        arr[i][j] = x;
    }

    rep(i, n) {
        for (int j = i + 1; j < n; j++) {
            nn = 0;
            rep(k, d) {
                nn += abs(arr[i][k] - arr[j][k]) * abs(arr[i][k] - arr[j][k]);
            }
            nn = sqrt(nn);
            if (fmod(nn,1)== 0)cnt++;
        }
    }
    cout << cnt << endl;
    return 0;
}


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

using namespace std;

int main()
{
    long long n;
    cin >> n;

    list<long long> b;

    long long tmp;
    for (long long i = 0; i < n; i++)
    {
        cin >> tmp;

        if (i % 2)
        {
            b.push_front(tmp);
        }
        else
        {
            b.push_back(tmp);
        }
    }

    if (n % 2)
    {
        b.reverse();
    }

    for (long long i = 0; i < n; i++)
    {
        if (i > 0)
        {
            cout << " ";
        }
        cout << b.front();
        b.pop_front();
    }

    cout << endl;
    return 0;
}

Measured memory_bytes: 8448
// Aizu 3014: Hating Crowd
// 2017.9.25 bal4u@uu

#include <stdio.h>
#include <string.h>

#define MIN(a,b) ((a)<=(b)?(a):(b))
#define MAX(a,b) ((a)>=(b)?(a):(b))
#define ABS(a)   ((a)>=0?(a):-(a))

typedef struct { int d, e, s; } T;
T tbl[102];

int main()
{
	int n, i, m, d, v, x, k, max, ans;

	scanf("%d", &n);
	for (i = 0; i < n; i++) {
		scanf("%d%d%d%d", &m, &d, &v, &tbl[i].s);
		tbl[i].d = (m-1)*30 + d;
		tbl[i].e = tbl[i].d + v-1;
	}
	ans = 0x7ffffff;
	for (x = 1; x <= 360; x++) {
		max = 0;
		for (i = 0; i < n; i++) {
			if (tbl[i].e > 360) {
				if (tbl[i].d <= x && x <= 360) k = tbl[i].s;
				else if (1 <= x && x <= tbl[i].e - 360) k = tbl[i].s;
				else k = MAX(0, tbl[i].s - MIN(ABS(tbl[i].d - x), ABS(x - (tbl[i].e-360))));
			} else {
				if (tbl[i].d <= x && x <= tbl[i].e) k = tbl[i].s;
				else {
					int min = 0x7ffffff, a;
					a = ABS(tbl[i].d - x);  if (a < min) min = a;
					a = ABS(tbl[i].e - x);  if (a < min) min = a;
					a = tbl[i].d + 360 - x; if (a < min) min = a;
					a = x + 360 - tbl[i].e; if (a < min) min = a;
					k = MAX(0, tbl[i].s - min);
				}
			}
			if (k > max) max = k;
		}
		if (max < ans) ans = max;
	}
	printf("%d\n", ans);
	return 0;
}

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


Measured memory_bytes: 3636
#include <string>
#include <vector>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <map>
#include <list>
#include <set>
#include <numeric>
#include <queue>
#include <stack>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <climits>
#include <cfloat>
#include <ctime>
#include <complex>
#include <cassert>
#include <array>
#include <bitset> 
#include <unordered_map>
#include <random>

using namespace std;
typedef long long LL;
typedef pair<int,int> P;

const int L=1e5+1;
LL depth[L];
vector<P> path[L];
void dfs(int r,int p){
	for(P i:path[r]){
		if(i.first!=p){
			depth[i.first]=depth[r]+i.second;
			dfs(i.first,r);
		}
	}
}
int main() {
	int N;
	cin >> N;
	for(int i=0;i<N-1;i++){
		int a,b,c;
		cin >> a >> b >> c;
		path[a].push_back(P(b,c));
		path[b].push_back(P(a,c));
	}
	int Q,K;
	cin >> Q >> K;
	dfs(K,-1);
	for(int i=0;i<Q;i++){
		int x,y;
		cin >> x >> y;
		cout << depth[x]+depth[y] << endl;
	}


	return 0;
}



Measured memory_bytes: 12800
import java.io.*;
import java.util.*;
import java.math.BigInteger;
public class Main {

static long[] list=new long[87];

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

   String nyuA=sc.nextLine();
  String nyuB=sc.nextLine(); 
   String nyuC=sc.nextLine();
  String nyuX=sc.nextLine();


//   String[] s=sc.nextLine().split(" ");
 //    String[] t=sc.nextLine().split("");

int A=Integer.parseInt(nyuA);
int B=Integer.parseInt(nyuB);
int C=Integer.parseInt(nyuC);
int X=Integer.parseInt(nyuX);
int count=0;
for(int i=0;i<=A;i++){
for(int j=0;j<=B;j++){
for(int k=0;k<=C;k++){
if(500*i+100*j+50*k==X){
count++;
}
}
}
}

System.out.println(count);



}

}



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

using ll = long long;
const ll MOD = 1e9 + 7;

// 組合せを素数で割った値を求める
const int MAX = 510000;
long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < MAX; i++) {
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}

// 二項係数計算
long long COM(int n, int k) {
  if (n < k || n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int n, k;
  cin >> n >> k;
  
  COMinit();
  
  /*if (k >= n - 1) {
    cout << COM(2 * n - 1, n) << '\n';
    return 0;
  }*/
  
  ll ans = 0;
  for (int empty = 0; empty <= min(k, n); empty++) {
    ll keep;
    keep = COM(n, empty);
    keep *= COM(empty + (n - empty - 1), empty);
    ans += (keep % MOD);
    ans %= MOD;
  }
  
  cout << ans << '\n';
}

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

int main(){
	string s,t;
	cin >> s >> t;
	vector<vector<int>> dp(t.size()+1,vector<int>(s.size()+1));

	for(int i=1; i<=(int)t.size(); i++){
		for(int j=1; j<=(int)s.size(); j++){
			if(s[j-1] == t[i-1]){ dp[i][j] = dp[i-1][j-1]+1; }
			else dp[i][j] = max(dp[i][j-1], dp[i-1][j]);
		}
	}
	string ans;
	int i = t.size(); 
	int j = s.size();
	int len = dp[i][j];
	while(len>0){
		if(s[j-1] == t[i-1]){
			ans.push_back(s[j-1]); len--;
			i--; j--;
		}else if(dp[i][j] == dp[i-1][j]){
			i--;
		}else{
			j--;
		}
	}
	reverse(ans.begin(),ans.end());
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 38552
L = [[[0 for i in range(10)]for j in range(3)]for k in range(4)]
n = int(input())
for i in range(n):
    b,f,r,v=map(int,input().split())
    L[b-1][f-1][r-1]+=v
for k in range(4):
    for j in range(3):
        for i in range(10):
            print(" "+str(L[k][j][i]),end="")
        print("")
    if k==3:
        break
    print("####################")



Measured memory_bytes: 5624
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define rush() int T;scanf("%d",&T);while(T--)
#define mm(a,b) memset(a,b,sizeof(a))
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define sc(a) scanf("%d",&a)
#define sc2(a,b) scanf("%d%d",&a,&b)
#define pf(a) printf("%d\n",a)
#define pf2(a,b) printf("%d %d\n",a,b)
#define p_f(a) printf("%d ",a)
#define fi first
#define se second
#define db double
#define ll long long
using namespace std;
const int inf=0x3f3f3f3f;
const ll INF=0x3f3f3f3f3f3f3f3f;
const db eps=1e-9;
const int N=2e5+5;
ll n,d,a;
pair<ll,ll>dots[N];
queue<pair<ll,ll> >q;
int main()
{
    cin>>n>>d>>a;
	rep(i,1,n)cin>>dots[i].fi>>dots[i].se;
	sort(dots+1,dots+n+1);
	ll sum=0,ans=0;
	rep(i,1,n){
		int lim=dots[i].fi-d;
		while(!q.empty()){
			pair<ll,ll> u=q.front();
			if(u.fi<lim){
				sum-=u.se;
				q.pop();
			}else break;
		}
		dots[i].se-=min(dots[i].se,sum*a);
		if(dots[i].se){
			q.push({dots[i].fi+d,ceil(dots[i].se*1.0/a)});
			ans+=ceil(dots[i].se*1.0/a);
			sum+=ceil(dots[i].se*1.0/a);
			dots[i].se=0;
		}
	}
	cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 4992
#include <stdio.h>
#include <iostream>
#include <vector>
#include <math.h>
#include <algorithm>

int main(int argc, char** argv)
{
		int N;
		std::vector<int> A;
		scanf("%d", &N);
		int tmp;
		int even_num = 0;
		for(int i=0; i<N; i++) {
			scanf("%d", &tmp);
			A.push_back(tmp);
			if(0 == tmp%2){
				even_num++;
			}
		}

		double base1 = 3;
		double base2 = 2;
		double n1 = N;
		double n2 = even_num;

		double result = pow(base1, n1) - pow(base2, n2);
		printf("%d\n", int(result));
		return 0;
}


Measured memory_bytes: 384
import collections

while 1:
    try:
        hand = list(map(int, input().split(",")))
    except:
        break

    chand = collections.Counter(hand)
    count = chand.most_common()

    straight = [1, 10, 11, 12, 13]

    if count[0][1] == 4:
        print("four card")
        continue
    elif count[0][1] == 3 and count[1][1] == 2:
        print("full house")
        continue
    else:
        hand.sort()
        if hand == straight:
            print("straight")
            continue
        else:
            check = True
            for i in range(len(hand)-1):
                if hand[i+1] - hand[i] != 1:
                    check = False
            if check:
                print("straight")
                continue
    if count[0][1] == 3:
        print("three card")
        continue
    elif count[0][1] == count[1][1] == 2:
        print("two pair")
        continue
    elif count[0][1] == 2:
        print("one pair")
        continue
    else:
        print("null")


Measured memory_bytes: 6008
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
using namespace std;

int main(){
    long long x;
    cin >> x;

    long long happy=0;
     happy += 1000*(x/500);
     x %= 500;
     happy += 5*(x/5);

     cout << happy << endl;
}

Measured memory_bytes: 256
def c_ColorfulLeaderboard(N, A):
    from collections import defaultdict
    color = defaultdict(int)
    other = 0  # レート3200以上の選手の数
    for a in A:
        if 1 <= a <= 399:
            color['gray'] += 1
        elif 400 <= a <= 799:
            color['brown'] += 1
        elif 800 <= a <= 1199:
            color['green'] += 1
        elif 1200 <= a <= 1599:
            color['skyblue'] += 1
        elif 1600 <= a <= 1999:
            color['blue'] += 1
        elif 2000 <= a <= 2399:
            color['yellow'] += 1
        elif 2400 <= a <= 2799:
            color['orange'] += 1
        elif 2800 <= a <= 3199:
            color['red'] += 1
        elif 3200 <= a:
            other += 1
    # => 2 2,3 5,1 1
    return '{} {}'.format(max(1, len(color)), len(color) + other)

N=int(input())
A=[int(i) for i in input().split()]
print(c_ColorfulLeaderboard(N, A))

Measured memory_bytes: 3316
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define YES cout<<"YES"<<endl
#define NO cout<<"NO"<<endl
using namespace std;

int main(){
  int n;
  cin >> n;
  cout << (1+n)*n/2 << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 

using namespace __gnu_pbds; 
using namespace std;
using   ll=long long;
using   ld=long double;

#define fast        	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ordered_set 	tree<pll, null_type,less<pll>, rb_tree_tag,tree_order_statistics_node_update>

#define endl        	"\n"
#define pb          	push_back
#define mp          	make_pair
#define F           	first
#define S           	second
#define int             long long int

#define ALL(v)      	v.begin(),v.end()
#define ALLR(v)     	v.rbegin(),v.rend()
#define pii         	3.14159265358979323
#define inf     		LLONG_MAX
#define ones(x)     	__builtin_popcount(x)
#define fill(a,b)   	memset(a,b,sizeof(a))
#define mod 			1000000007

ll mod_pow(ll a,ll b) 
{
    ll res = 1;
    while(b)	
    {
        if(b&1) 	
        {
        	res=(res*a)%mod;
        }
        a=(a*a)%mod;
        b>>=1;
    }
    return res;
}

ll mod_inverse(ll a) 
{
	return mod_pow(a , mod-2);
}

void solve()
{
	int a , b , n;
	
	cin >> a >> b >> n;
	
	int tm = min(n , b-1);
	
	cout << (a*tm)/b - a*(tm/b);
}

signed main() {
    fast;
    
    int t = 1;
    
    //cin >> t;
    
    while(t--) {
        solve();
    }
 
    return 0;
}


Measured memory_bytes: 3512
#pragma GCC optimize("O3")
    #pragma comment(linker, "/stack:200000000")
    #pragma GCC optimize("unroll-loops")
     
    #include <algorithm>
    #include <bitset>
    #include <cassert>
    #include <chrono>
    #include <cmath>
    #include <complex>
    #include <cstdio>
    #include <cstdlib>
    #include <cstring>
    #include <ctime>
    #include <deque>
    #include <functional>
    #include <iomanip>
    #include <iostream>
    #include <iterator>
    #include <limits>
    #include <climits>
    #include <list>
    #include <map>
    #include <numeric>
    #include <queue>
    #include <random>
    #include <ratio>
    #include <set>
    #include <sstream>
    #include <stack>
    #include <string>
    #include <unordered_map>
    #include <unordered_set>
    #include <utility>
    #include <vector>
    using namespace std;
     
    typedef long long ll;
    typedef long double LD;
    #define int ll
    #define double LD
    #define pb push_back
    #define mp make_pair
    #define REP(i,n) for (int i = 0; i < n; i++)
    #define loop(i,n) for (int i = 0; i < n; i++)
    #define FOR(i,a,b) for (int i = a; i < b; i++)
    #define REPD(i,n) for (int i = n-1; i >= 0; i--)
    #define FORD(i,a,b) for (int i = a; i >= b; i--)
    #define remax(a,b) a = max(a,b)
    #define remin(a,b) a = min(a,b)
    #define mem(a, b) memset(a, b, sizeof a)
    #define append push_back
    #define all(v) v.begin(),v.end()
    #define F first
    #define S second
    #define print(x) cout << (x) << endl
    #define PRECISION(x) cout << fixed << setprecision(x)
    #define FAST_IO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
     
    const double PI=acos(-1);
    const int MOD = 1000000007;
    const int FMOD = 998244353;
    const double eps = 1e-9;
     
    mt19937 RNG(chrono::steady_clock::now().time_since_epoch().count()); 
    
    bool isSafe(int mid,vector<int> neg,vector<int> pos,int k)
    {
    	int p=neg.size()-1;
    	int pairs=0;
    	for(int i=0;i<neg.size();i++)
    	{
    		while(p>=0 && neg[i]*neg[p]<=mid)
    		{
    			p--;
			}
			pairs+=min(neg.size()-p-1,neg.size()-i-1);
		}
		p=0;
		for(int i=pos.size()-1;i>=0;i--)
		{
			while(p<pos.size() && pos[i]*pos[p]<=mid)
			{
				p++;
			}
			pairs+=min(p,i);
		}
		p=pos.size()-1;
		for(int i=neg.size()-1;i>=0;i--)
		{
			while(p>=0 && pos[p]*neg[i]<=mid)
			{
				p--;
			}
			pairs+=(pos.size()-p-1);
		}
		return pairs>=k;
	}
    
    signed main()
    {
    	int n,k;
    	cin>>n>>k;
    	int a[n];
    	loop(i,n)
    	cin>>a[i];
    	
    	sort(a,a+n);
    	vector<int> neg,pos;
    	loop(i,n)
    	{
    		if(a[i]<0)
    		neg.push_back(a[i]);
    		else
    		pos.push_back(a[i]);
		}
		sort(neg.begin(),neg.end());
		sort(pos.begin(),pos.end());
		
		int s=-1e18,e=1e18,ans=0;
		while(s<=e)
		{
			int mid=(s+e)/2;
			if(isSafe(mid,neg,pos,k))
			{
				ans=mid;
				e=mid-1;
			}
			else
			{
				s=mid+1;
			}
		}
		cout<<ans<<endl;
	}

Measured memory_bytes: 5108
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define cinf(n,x) for(int i=0;i<(n);i++)cin>>x[i];
#define ft first
#define sc second
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define mod 1000000007
#define FS fixed<<setprecision(15)
using namespace std;
typedef long long ll;
template<class T> using V=vector<T>;
using Graph = vector<vector<int>>;
using P=pair<ll,ll>;
typedef unsigned long long ull;
typedef long double ldouble;
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; }

const ll INF=1e18;

ll mod_pow(ll x,ll n,ll m){
    if(n==0) return 1;
    ll res=mod_pow(x*x%m,n/2,m);
    if(n&1) res=res*x%m;
    return res;
}

int main(){
    ll n,m;
    cin>>m>>n;
    cout<<mod_pow(m,n,mod)<<endl;
}


Measured memory_bytes: 3100
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main()
{
	int n = 0;
	unsigned long h = 0;
	unsigned long w = 0;

	unsigned long long count = 0;

	cin >> n >> h >> w;

	for (int i = 0; i < n; i++) {
		unsigned long a, b;
		cin >> a >> b;
		if ((a / h) * (b / w) != 0) {
			count++;
		}
	}

	cout << count << endl;
}


Measured memory_bytes: 256
/* Bismillahirrahmanirrahim */
/* Author : Jehian Norman Saviero (@Reiva5) */
#include <bits/stdc++.h>

/* MACROS SAMPAH */
#define Jehian using
#define Norman namespace
#define Saviero std
#define cepet {ios_base::sync_with_stdio(0);cin.tie(0);}

Jehian Norman Saviero;

/* MACROS FOR TYPE */
typedef long l;
typedef long double ld;
typedef long long ll;
typedef unsigned long ul;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<l> vl;
typedef vector<ll> vll;
typedef pair<int, int> pi;
typedef pair<l,l> pl;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pld;

/* MACROS FOR PRINT */
#define nl printf("\n")
#define sp printf(" ")

/* MACROS FOR FUNCTION AND METHOD */
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define mp make_pair
#define eb emplace_back
#define RESET(x) memset((x), 0, sizeof(x))
#define SET(x,y) for(int _je = sizeof(x)/sizeof(x[0]); _je--;) x[_je] = y
#define SQR(x) (x)*(x)
#define CUBE(x) SQR(x)*(x)
#define ALL(x) (x).begin(), (x).end()
#define ALLSIZE(x,n) (x), (x)+(n)

/* MACROS FOR ATTRIBUTE */
#define fi first
#define se second

/* MACROS FOR SCAN */
#define scc(x) scanf("%c", &x)
#define scd(x) scanf("%Lf", &x)
#define scf(x) scanf("%f", &x)
#define sci(x) scanf("%d", &x)
#define scl(x) scanf("%ld", &x)
#define scll(x) scanf("%lld", &x)
#define scld(x) scanf("%Lf", &x)
#define scui(x) sci(x)
#define scul(x) scl(x)
#define scull(x) scll(x)

string HASH[2];
int main(){
	ll T;
	scll(T);
	ll cnt;
	ll LEFT, RIGHT;
	LEFT = 0;
	RIGHT = T-1;
	string A;
	bool benar;
	cout << 0 << endl;
	cin >> A;
	if (A != "Vacant"){
		HASH[0] = A;
		cout << 1 << endl;
		cin >> A;
		if (A != "Vacant"){
			HASH[1] = A;
			bool valid = false;
			cnt = 18;
			while (cnt-- && LEFT <= RIGHT && !valid){
				ll MID = (LEFT+RIGHT)/2;
				cout << MID << endl;
				cin >> A;
				if (A == "Vacant"){
					valid = true;
					break;
				}
				benar = HASH[(MID & 1)] == A;
				if (benar){
					LEFT = MID+1;
				} else {
					RIGHT = MID-1;
				}
			}
			if (!valid){
				cout << LEFT << endl;
				cin >> A;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 852
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;
typedef long long ll;

#define REP(i, n) for(ll i=0;i<(ll)(n);i++)
#define RREP(i, n) for(ll i=(ll)(n-1);i>=0;i--)
#define FOR(i, a, b) for(ll i=(ll)(a); i<=(ll)(b); i++)
#define RFOR(i, a, b) for(ll i=(ll)(a);i>=(ll)(b); i--)
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((ll)(x).size())
#define INF 1000000000000
#define MOD 10000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

signed main()
{
	int N;
	cin >> N;
	map<string, int> mp;
	REP(i, N){
		string str;
		cin >> str;
		mp[str]++;
	}
	cout << "AC x " << mp["AC"] << endl;
	cout << "WA x " << mp["WA"] << endl;
	cout << "TLE x " << mp["TLE"] << endl;
	cout << "RE x " << mp["RE"] << endl;
}


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

#define lint long long
#define P pair<int, int>
#define LLP pair<long long, long long>
#define REP(i, x, n) for(int i = (x), i##_len = (int)(n) ; i < i##_len ; ++i)
#define rep(i, n) for(int i = 0, i##_len = (int)(n) ; i < i##_len ; ++i)
#define repr(i, n) for(int i = (int)(n) - 1 ; i >= 0 ; --i)
#define SORT(x) sort((x).begin(), (x).end())
#define SORT_INV(x) sort((x).rbegin(), (x).rend())

const int IINF = 1e9 + 100;
const long long LLINF = 2e18 + 129;
const long long MOD = 1e9 + 7;
const int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
const int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};
const double EPS = 1e-8;

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

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

    string s;
    cin >> s;

    int ans = 0;
    rep(i, s.size()){
        if(s[i] == 'A' || s[i] == 'T' || s[i] == 'G' || s[i] == 'C'){
            int j = i;
            while(j < i_len && s[j] == 'A' || s[j] == 'T' || s[j] == 'G' || s[j] == 'C'){
                ++j;
            }
            chmax(ans, j - i);
            i = j;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define LF '\n'
#define ALL(x) x.begin(), x.end()
#define iostreamBooster() { cin.tie(nullptr); ios_base::sync_with_stdio(false); }
using namespace std;
typedef int64_t i64;
typedef pair<int,int> pii;
template<class A, class B>inline bool chmax(A &a, const B &b){return b>a ? a=b,1 : 0;}
template<class A, class B>inline bool chmin(A &a, const B &b){return b<a ? a=b,1 : 0;}
constexpr int INF = 0x3f3f3f3f;
template<class Itr> void dump(Itr begin, Itr end) { for (;begin != end; ++begin) clog << *begin << LF; }

signed main()
{
  int M;
  cin >> M;
  cout << 24-M + 24 << LF;

  return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
    int n,i;
    cin>>n;
    map<ll,ll> cnt;
    ll A[n];
    for(i=0;i<n;i++)
    {
        cin>>A[i];
    }
    ll ok=1;
    for(i=0;i<n;i++)
    {
        if(cnt[A[i]]!=0)
        {
            ok=0;
            break;
        }
        cnt[A[i]]=1;
    }
    if(ok==1)
        cout<<"YES";
    else
        cout<<"NO";
}


Measured memory_bytes: 14336
//↓template↓

#include "bits/stdc++.h"
using namespace std;
#define Would
#define you
#define all(n)  n.begin(),n.end()
const long long INF = 1e18;
const long long MOD = 1e9 + 7;
const double pi = acos(-1);
const int SIZE = 1 << 17;
int dx[] = { 1,0,-1,0 }, dy[] = { 0,1,0,-1 }, alp[30];
long long fac[200005], finv[200005], inv[200005];
vector<long long>dij;
struct edge { long long to, cost; };
vector<vector<edge> >G;

long long mod_pow(long long a, long long b) {
	long long res = 1, mul = a;
	for (int i = 0; i < 31; ++i) {
		if (b >> i & 1) {
			res *= mul;
			res %= MOD;
		}
		mul = (mul * mul) % MOD;
	}

	return res;
}

void addedge(int from, int to, int cost) {
	G[from].push_back({ to,cost });
	G[to].push_back({ from,cost });
}

//↑template↑


int main() {
	vector<int>v;
	for (int i = 0; i < 10; ++i) {
		int n;
		cin >> n;
		v.push_back(n);
	}
	sort(all(v));
	reverse(all(v));
	cout << v[0] << endl << v[1] << endl << v[2] << endl;
}


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

score = {}

for i, a in enumerate(A):
  if i ==0:
    continue
  
  s = i-a
  if s not in score:
    score[s] = 0
  score[s]+=1

from bisect import bisect_left
ans = 0
for i, a in enumerate(A):
  if i+a in score:
    ans += score[i+a]
print(ans)

Measured memory_bytes: 111244
a,b = map(int,input().split())

S  = (a-1)*(a-2)//2
def solve(x,y,s):
    print(a+s-y-1)
    for i in range(1,a):
        print(1,1+i)
    c = s-b
    for i in range(1,a):
        for I in range(i+1,a):
            if c > 0:
                print(i+1,I+1)
                c-=1
            else:exit()
# print(b,S)
if not 0<= b <= S:
    print(-1)
    exit()
else:
    solve(a,b,S)


Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef vector<ll> vel;
typedef vector<int> vei;
typedef vector<string> ves;
typedef vector<vector<int>> ve_vei;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define fs first
#define sc second
#define all(a) a.begin(),a.end()
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
 
int main() {
	//cout.precision(10);
	cin.tie(0);
	ios::sync_with_stdio(false);

    int N; cin >> N;
    int i = 1;
    while(i * 2 <= N){
        i *= 2;
    }
    cout << i << endl;
    return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
from collections import deque
from fractions import gcd
from functools import lru_cache


#############
# Constants #
#############

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

#############
# Functions #
#############

######INPUT######
def inputI(): return int(input().strip())
def inputS(): return input().strip()
def inputIL(): return list(map(int,input().split()))
def inputSL(): return list(map(str,input().split()))
def inputILs(n): return list(int(input()) for _ in range(n))
def inputSLs(n): return list(input().strip() for _ in range(n))
def inputILL(n): return [list(map(int, input().split())) for _ in range(n)]
def inputSLL(n): return [list(map(str, input().split())) for _ in range(n)]

#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)

######Combination######
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

######Factorization######
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])
    return arr

#####LCM#####
def lcm(a, b):
    return a * b // gcd (a, b)

#############
# Main Code #
#############

a,b = inputIL()

if  a<10 and b<10:
  print(a*b)
else:
  print(-1)

Measured memory_bytes: 64492
fun main() {
    val (n, m, x) = readLine()?.split(" ")?.map(String::toInt) ?: return

    val books = mutableListOf<List<Int>>()
    repeat(n) {
        val book = readLine()?.split(" ")?.map(String::toInt) ?: return
        books.add(book)
    }
    val range = 0.until(n)

    fun gen(remain: List<Int>): List<List<Int>> {
        if (remain.size == 2) {
            return listOf(
                listOf(remain[0]), listOf(remain[1]), remain
            )
        } else {
            val v = remain.first()
            val r = gen(remain.drop(1))
            return mutableListOf(
                listOf(v)
            ).apply {
                addAll(r.map {
                    listOf(v) + it
                })
                addAll(r)
            }
        }
    }

    val list = if (n >= 2) {
        gen(range.toList())
    } else {
        listOf(listOf(0))
    }
    list.mapNotNull { candidate ->
        val t = Array(m) { 0 }
        var tp = 0L
        candidate.forEach {
            val book = books[it]
            tp += book[0]
            1.until(m + 1).forEach {
                t[it - 1] += book[it]
            }
        }
        if (t.all { it >= x }) {
            tp
        } else {
            null
        }
    }.min()?.let {
        println(it.toString())
        return
    }
    println("-1")
}

Measured memory_bytes: 49568
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace mondai0058
{
	class Program
	{
		static void Main(string[] args)
		{
			var	s	= "";
			while( (s = Console.ReadLine()) != null ) {
				var	p	= Array.ConvertAll( s.Split(), ss => double.Parse( ss ) );
				var	dot	= ((p[ 2 ] - p[ 0 ]) * (p[ 6 ] - p[ 4 ])) + ((p[ 3 ] - p[ 1 ]) * (p[ 7 ] - p[ 5 ]));
				if( dot == 0.0 ) {
					Console.WriteLine( "YES" );
				} else {
					Console.WriteLine( "NO" );
				}
			}
		}
	}
}

Measured memory_bytes: 5728