akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define PI 3.141592653589793238
int main()
{
    // #ifndef ONLINE_JUDGE
    // freopen("F:/cpp/input.txt", "r", stdin);
    // freopen("F:/cpp/output.txt", "w", stdout);
    // #endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n;
    cin >> n;
    n--;
    string ans = "";
    while (n >= 0)
    {
        ans = char(n%26 + 'a') + ans;
        n = n/26 - 1;
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 3656
#include<iostream>
using namespace std;
int main(){
  string s;
  cin>>s;
  int cnta=0,cntb=0;
  for(int i=0;i<3;i++){
    if(s[i]=='A')	cnta++;
    else	cntb++;
  }
  if(cnta==3 || cntb==3)cout<<"No"<<endl;
  else	cout<<"Yes"<<endl;
  return 0;}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<29;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-11;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

class Union_Find_Tree{
	public:
	vi p,r,s;
	Union_Find_Tree(int n){
		p=r=vi(n);
		s=vi(n,1);
		for(int i=0;i<n;i++) p[i]=i;
	}
	int Par(int x){
		if(p[x]==x) return x;
		return p[x]=Par(p[x]);
	}
	int Size(int x){return s[Par(x)];}
	bool Unite(int x,int y){
		x=Par(x);
		y=Par(y);
		if(x==y) return 0;
		if(r[x]<r[y]){
			p[x]=y;
			s[y]+=s[x];
		}
		else{
			p[y]=x;
			s[x]+=s[y];
			if(r[x]==r[y]) r[x]++;
		}
		return 1;
	}
	bool Same(int x,int y){return Par(x)==Par(y);}
};

int main(){
	while(1){
		int n;
		cin>>n;
		if(n==0) break;
		vvi a(30);
		for(int i=0;i<n;i++){
			int m;
			cin>>m;
			for(int j=0;j<m;j++){
				int x;
				cin>>x;
				a[x-1].push_back(i);
			}
		}
		bool B=1;
		for(int i=0;i<30;i++){
			vi b(n);
			for(int j=i;j>=0;j--){
				bool flag=0;
				if(j==i) flag=1;
				for(auto k:a[j]) if(b[k]) flag=1;
				if(flag){
					for(auto k:a[j]) b[k]=1;
				}
			}
			if(b==vi(n,1)){
				cout<<i+1<<endl;
				B=0;
				break;
			}
		}
		if(B) cout<<-1<<endl;
	}
}


Measured memory_bytes: 3084
#include <iostream>
#include <map>
#include <vector>

using namespace std;

int main(){
    int n,k,q;
    
    cin >> n >> k >> q;
    vector<int>v(n,k);
    vector<int>check(n,0);

    for(int i = 0;i < q;i++){
        int n;
        cin >> n;
        check[n-1]++;
    }

    for(int i = 0;i < n;i++){
        v[i] -= q - check[i];
        if(v[i] <= 0)cout << "No" << endl;
        else cout << "Yes" << endl;
    }

    

    return 0;
}

Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,r=0,b=0;
  cin >> n;
  string s;
  cin >> s;
  for(int i=0;i<n;i++){
    if(s[i]=='R'){
      r++;
    }
    else{
      b++;
    }
  }
  if(r>b){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

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

const int INF = 100000;
int N, A, B, C;
int mem[10];

int DFS(int cur, int a, int b, int c)
{
	if(cur == N)
	{
		if(min({a, b, c}) <= 0) return INF;
		else return abs(a-A) + abs(b-B) + abs(c-C) - 30;
	}
	else
	{
		int res0 = DFS(cur+1, a+mem[cur], b, c) + 10;
		int res1 = DFS(cur+1, a, b+mem[cur], c) + 10;
		int res2 = DFS(cur+1, a, b, c+mem[cur]) + 10;
		int res3 = DFS(cur+1, a, b, c);
		return min({res0, res1, res2, res3});
	}
}

int main()
{
	cin >> N >> A >> B >> C;
	for(int i = 0; i < N; i++) cin >> mem[i];
	printf("%d\n", DFS(0, 0, 0, 0));
}

Measured memory_bytes: 256
import std.stdio;

void main() {
  int k;
  readf("%s", &k);

  int x = 7 % k;
  foreach (i;0..k) {
    if (x == 0) {
      writeln(i + 1);
      return;
    }
    x = (x * 10 + 7) % k;
  }
  writeln("-1");
}


Measured memory_bytes: 2768
import java.util.*;
import java.lang.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int count = 0;
		for (int i = 0; i < s.length(); i++) {
			if (s.charAt(i) == 'o') {
				count++;
			}
		}
		if (15 - s.length() + count >= 8) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
	}
}


Measured memory_bytes: 21844
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int d = a / b;
        int r = a % b;
        double f = (double)a / b;
        System.out.println(d + " " + r + " " + String.format("%.8f", f));
    }
}


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

int main(){
    int N;
    string S;
    cin>>N>>S;
    int min=300000,now=0;
    vector<int> W(N+1);
    vector<int> E(N+1);
    for(int i=0;i<N;i++){
        if(S[i]=='W'){
            W[i+1]=W[i]+1;
            E[i+1]=E[i];
        }
        if(S[i]=='E'){
            E[i+1]=E[i]+1;
            W[i+1]=W[i];
        }
    }
    for(int i=0;i<N;i++){
        now+=W[i]-W[0];
        now+=E[N]-E[i+1];
        if(now<min){
            min=now;
        }
        now=0;
        
    }
    cout<<min<<endl;

}

Measured memory_bytes: 3076
#include "bits/stdc++.h"
using namespace std;
const int maxn = 200200;
int a[maxn], x[maxn];
int main(){
    int n;
    cin >> n;
    for(int e = 0; e < n; e++) cin >> x[e];
    map<int,int> r;
    for(int e = 0; e < n; e++){
        r[x[e]] = r[x[e]-1] + 1;
    }
    int u = 0;
    for(int e = 0; e < n; e++) u = max(u, r[x[e]]);
    cout << n - u << endl;
	return 0;
}


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

using namespace std;

typedef long long int li;
typedef long double ld;
typedef vector<li> vi;
typedef pair<li,li> pi;
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define B begin()
#define E end()
#define f(i,l,r) for(li i=l;i<=r;++i)
#define fr(i,l,r) for(li i=l;i>=r;--i)
#define u_map unordered_map
#define endl "\n"
#define debug cout<<"Reached\n";

li fastpow(li base,li exp,li M) 
{
    li res=1;
    while(exp>0) {
        if(exp&1)
            res=(res*base)%M;

        base=(base*base)%M;
        exp>>=1;
    }
    return res;
}

int main()
{    
    

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

    li x;

    cin>>x;

    f(i,-118,119)
    {
        f(j,-119,118)
        {
            li tp1,tp2;

            tp1=(li)pow(i,5ll);
            tp2=(li)pow(j,5ll);

            if((tp1-tp2)==x)
            {
                cout<<i<<" "<<j;
                return 0;
            }
        }
    }   

    return 0;
}

Measured memory_bytes: 4080
#include<stdio.h>
int main(){
	int a,b;
	scanf("%d%d",&a,&b);
	while(a!=0||b!=0){
		printf("%d %d\n",(a<b)?a:b,(a>b)?a:b);
		scanf("%d%d",&a,&b);
	}
	return 0;
}


Measured memory_bytes: 2044
people_count = gets.chomp.split()[0].to_i
favs_count = {}
people_count.times do |c|
  gets.chop.split()[1..-1].each do |fav|
      favs_count[fav] = (favs_count[fav]||0) + 1
  end
end

p favs_count.values.count(people_count)


Measured memory_bytes: 14268
#include <stdio.h>
#include <iostream>
#include <string>
#include <stdlib.h>
#include <cmath>

using namespace std;

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

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

    string c = a + b;
    int temp = atoi(c.c_str());
    REP(1, i, 317) {
        if (temp == pow(i, 2)) {
            printf("Yes\n");
            return 0;
        }
    }

    printf("No\n");

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const ll MOD = 1e9 + 7/*998244353*/;
const ll INF = 1LL << 60;
ll mod_pow(ll, ll, ll); ll mod_fact(ll, ll); ll mod_inv(ll, ll); ll gcd(ll, ll); ll lcm(ll, ll);
//
int main(){
    int n;
    cin >> n;
    vector<vector<ll>> bits(n, vector<ll>(40));
    for(int i = 0; i < n; i++){
        ll a;
        cin >> a;
        for(int j = 0; j < 40; j++){
            bits[i][j] = ((a >> j) & 1);
        }
    }
    vector<ll> total(40);
    for(int i = 0; i < 40; i++){
        int x = 0;
        for(int j = 0; j < n; j++){
            x ^= bits[j][i];
        }
        total[i] = x;
    }
    /*for(int i = 0; i < n; i++){
        cout << "\n";
        for(int j = 0; j < 18; j++){
            cout << bits[i][j] << " ";
        }
    }*/
    //for(int i = 0; i < 18; i++) cout << total[i] << " ";
    vector<vector<ll>> ans(n, vector<ll>(40));
    for(int i = 0; i < n; i++){
        for(int j = 0; j < 40; j++){
            ans[i][j] = (bits[i][j] ^ total[j]);
        }
    }
    /*for(int i = 0; i < n; i++){
        cout << "\n";
        for(int j = 0; j < 18; j++){
            cout << ans[i][j] << " ";
        }
    }*/
    for(int i = 0; i < n; i++){
        ll out = 0;
        for(int j = 39; j >= 0; j--){
            out *= 2;
            out += ans[i][j];
        }
        if(i != n - 1) cout << out << " ";
        else cout << out;
    }
}

Measured memory_bytes: 143860
n = int(input())
ans = int(input())

def gcd(a, b):
    if a == 0:
        return b
    elif b == 0:
        return a
    else:
        return gcd(b, a%b)

for i in range(n-1):
    a = int(input())
    ans = ans*a//gcd(ans, a)

print(ans)

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

int main(){
	int N,M;
	cin >> N >> M;
	vector<int> s;
	vector<int> p;
	int ans=0;

	rep(i,M){
		int k; int sw=0;
		cin >> k;
		rep(j,k){ int t; cin >> t; sw|=(1<<(t-1));}
		s.push_back(sw);
	}

	rep(i ,M){ int t;cin >> t; p.push_back(t);}

	for(int bit=0; bit < (1<<N); bit++){
		bool f=true;
		rep(i,M){
			//cout << endl;
			//cout << "bit:  " << bitset<10>(bit) << endl; 
			//cout << "s["<<i<<"]: " << bitset<10>(s[i]) << endl;
			int b = __builtin_popcount((bit & s[i]));
			//cout << b << endl;
			//cout << "p:" << p[i] << endl;
			//if(b==0){f=false; break;}
			if(b%2!=p[i]){f=false; break;}
		}
		if(f)ans++;
	}
	cout << ans << endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define db(x) cout << #x << " = " << (x) << "\n";
using ll = long long;
using ld = long double;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    int a, b, c;
    cin >> a >> b >> c;
    cout << min(b / a, c);
    return 0;
}


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

using namespace std;
#define rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define pb push_back
// #define int long long

signed main(){
	bool flag=false;
	string s;

	cin>>s;
	char tmp1='a';
	// cout<<(int)tmp1<<endl;

	int count[26]={0};

	for(int i=0;i<s.size();i++){
		char tmp=s[i];
		// cout<<tmp<<endl;
		// cout<<(int)tmp<<endl;
		count[int(tmp)-97]++;
	}

	// for(int i=0;i<26;i++){
	// 	cout<<count[i]<<" ";
	// }cout<<endl;

	for(int i=0;i<26;i++){
		if(count[i]==0){
			flag=true;
			cout<<char(i+97)<<endl;
			return 0;
		}
	}

	cout<<"None"<<endl;


}

Measured memory_bytes: 512
#define LOCAL

#undef _GLIBCXX_DEBUG

#include <bits/stdc++.h>

using namespace std;

#define IOS ios::sync_with_stdio(false);cin.tie(0)
#define all(x) x.begin(), x.end()
#define ff first
#define ss second
#define LLINF 0x3f3f3f3f3f3f3f3f
#define INF 0x3f3f3f3f

// Copied from Gennady-Korotkevich's template

template <typename A, typename B>
string to_string(pair<A, B> p);

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);

string to_string(const string& s) {
	return '"' + s + '"';
}

string to_string(const char* s) {
	return to_string((string)s);
}

string to_string(bool b) {
	return (b ? "true" : "false");
}

string to_string(vector<bool> v) {
	bool first = true;
	string res = "{";
	for (int i = 0; i < static_cast<int>(v.size()); i++) {
		if (!first) {
			res += ", ";
		}
		first = false;
		res += to_string(v[i]);
	}
	res += "}\n";
	return res;
}

template <size_t N>
string to_string(bitset<N> v) {
	string res = "";
	for (size_t i = 0; i < N; i++) {
		res += static_cast<char>('0' + v[i]);
	}
	return res;
}

template <typename A>
string to_string(A v) {
	bool first = true;
	string res = "{";
	for (const auto& x : v) {
		if (!first) {
			res += ", ";
		}
		first = false;
		res += to_string(x);
	}
	res += "}\n";
	return res;
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
	return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
	return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
	return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}

template <typename A, typename B, typename C, typename D, typename E>
string to_string(tuple<A, B, C, D, E> p) {
	return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + "," + to_string(get<4>(p)) + ")";
}

void debug_out() {
	cerr << endl;
}

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
	cerr << " " << to_string(H);
	debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "\n[" << #__VA_ARGS__ << "]:\n", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

// End of Gennady-Korotkevich's template 

using llong = long long;
using PII = pair<int, int>;

const llong MOD = 1e9 + 7;
const double PI = acos(-1);

int main() {
	IOS;
	int n; cin >> n;
	set<string >s;
	for (int i = 0; i < n; i++) {
		string ss; cin >> ss;
		s.insert(ss);
	}
	cout << s.size();
}

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

using namespace std;

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

  int A[n];
  for (int i = 1; i <= n; i++) {
    A[i] = 0;
  }
  int correct_ans = 0;
  int penalty = 0;

  for (int i = 0; i < m; i++) {
    int p;
    string s;
    cin >> p >> s;
    if (A[p] == -1) {
      continue;
    }
    if (s == "WA") A[p]++;
    else {
      correct_ans++;
      penalty += A[p];
      A[p] = -1;
    }
  }

  cout << correct_ans << " " << penalty << endl;
  return 0;
}


Measured memory_bytes: 640
#include<iostream>
#include<algorithm>
#include<stdio.h>
using namespace std;

int main(){
    int S,top2, bottom2;
    string answer;
    cin >> S;
    top2 = S/100;
    bottom2 = S%100;
    if((top2>12||top2==0)&&(bottom2<=12&&bottom2>=1)) answer="YYMM";
    else if((bottom2>12||bottom2==0)&&(top2<=12&&top2>=1)) answer="MMYY";
    else if((bottom2<=12&&bottom2>=1)&&(top2<=12&&top2>=1)) answer="AMBIGUOUS";
    else answer = "NA";
    cout << answer << endl;
    return 0;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL)
#define endl "\n"
#define pb push_back
#define mod 1000000007
int dx[]={1,-1,0,0};
int dy[]={0,0,1,-1};
int dx8[]={1,-1,0,0,1,1,-1,-1};
int dy8[]={0,0,1,-1,1,-1,1,-1};

ll binexp(ll a, ll b, ll m) {
	a %= m;
	ll res = 1;
	while (b > 0) {
		if (b & 1)
			res = res * a % m;
		a = a * a % m;
		b >>= 1;
	}
	return res;
}
ll modinvfermat(ll a, ll m)
{
	return binexp(a, m - 2, m);
}
void task(bool flag)
{
	if (flag)
		cout << "YES\n";
	else
		cout << "NO\n";
}
ll lcm(ll a, ll b)
{
	return ((1LL * a * b) / (__gcd(a, b)));
}

 // void dfs(ll node){
 // 	vis[node]=1;
 // 	res.pb(node);
 //    vector<ll> ans;


 // 	for(auto i:v[node]){
 // 		if(!vis[i]){
 // 			ans.pb(i);

 // 		}
 // 	}
 // 	sort(ans.begin(),ans.end());

 // 	for(auto i:ans){
 // 		if(!vis[i])
 // 			dfs(i);
 // 	}




 // }

void solve(){

ll x;
cin>>x;
ll ans=x^1;
cout<<ans<<endl;


return;
}



int main()
{  
#ifndef ONLINE_JUDGE
	// for getting input from input.txt
	freopen("input.txt", "r", stdin);
	// for writing output to output.txt
	freopen("output.txt", "w", stdout);
#endif
    fast;
    

    ll t;
    t=1;
    // cin>>t;
    while(t--){
    	solve();
    }
    
   
  



#ifndef ONLINE_JUDGE
	cout << "\nTime Elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " sec\n";
#endif
return 0;
}

Measured memory_bytes: 3664
#include <iostream>
#include <vector>
#include <cmath>
#include <unordered_set>
using namespace std;
typedef long long ll;

ll A , B;

ll gcd(ll a , ll b){
  if(a == 0){
    return b;
  }
  return gcd(b % a , a);
}

int main(){
  cin >> A >> B;
  ll n = gcd(A , B);
  ll cnt = 1;
  for(ll i = 2; i * i <= n; ++i){ // find number of prime factors
    if(n % i == 0){
      ++cnt;
      while(n % i == 0)n /= i;
    }
  }
  if(n > 1)++cnt;
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	scanf("%d",&n);
	vector<int> v(n+2);
	int a,b;
	for(int i = 0; i < n; i++){
		scanf("%d %d",&a,&b);
		if(a==b)
			v[i]++;
	}
	bool sw = 0;
	for(int i = 0; i < n; i++){
		if(v[i] + v[i+1] + v[i+2]==3)
			sw= 1;
	}
	if(sw)
		printf("Yes\n");
	else
		printf("No\n");
	return 0;
}

Measured memory_bytes: 3688
s = gets.chomp.split("")

n = s.length

i = n / 2

def f(k)
	l = k.length
	for j in 0..(l/2) do
		if(k[0+j] == k[l-1-j])
		else
			return "No"
		end
	end
	return "Yes"
end

if(n % 2 == 0)
newS_1 = s[0...i]
newS_2 = s[i..n]
else
newS_1 = s[0...i]
newS_2 = s[(i+1)..n]
end

if(f(s) == "Yes" && f(newS_1) == "Yes" && f(newS_2) == "Yes")
	puts "Yes"
else
	puts "No"
end

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

int main()
{
    typedef int ll;
    ll a,b,c,d,e;
    cin>>a>>b>>c>>d>>e;

    if(a==0){
        cout<<"1"<<endl;
    }
    if(b==0){
        cout<<"2"<<endl;
    }
    if(c==0){
        cout<<"3"<<endl;
    }
    if(d==0){
        cout<<"4"<<endl;
    }
    if(e==0){
        cout<<"5"<<endl;
    }
}


Measured memory_bytes: 3680
#include<iostream>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<string>
#include<iomanip>
using namespace std;
typedef long long LL;
int main(){
	int pack[3],temp;
	cin >> pack[0] >> pack[1] >> pack[2];
	for(int i = 0;i < 3;i++){
		for(int j = i+1;j < 3;j++){
			if(pack[j] > pack[i]){
				temp = pack[i];
				pack[i] = pack[j];
				pack[j] = temp;
			}
		}
	}
	if(pack[0] == pack[1]+pack[2])
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
		return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(c) (c).begin(), (c).end()
#define pb push_back
#define eb emplace_back
const long long INF = 1LL<<60; // 仮想的な無限大の値;
using namespace std;
using ll = long long;
using P  = pair<int, int>;
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; }

int main()
{
    ll N, M, K;
    cin >> N >> M >> K;
    vector<ll> A, B;
    rep(i, N)
    {
        ll x;
        cin >> x;
        A.pb(x);
    }
    rep(i, M)
    {
        ll x;
        cin >> x;
        B.pb(x);
    }
    vector<ll> SB(M);
    rep(i, M)
    {
        if(i==0) SB[i] = B[i];
        else
        {
            SB[i] = SB[i-1] + B[i];
        }      
    }
    ll ans = 0;
    ll s=0;
    auto pos = lower_bound(ALL(SB), K+1);
    ll x = pos - SB.begin();
    chmax(ans, x);
    rep(i, N)
    {
        s += A[i];
        ll k = K-s;
        if(k < 0) break;
        auto pos = lower_bound(ALL(SB), k+1);
        ll x = pos - SB.begin();
        chmax(ans, x+i+1);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 7996
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define rep(i,n) for(ll i=0;i<n;++i)
#define ocut cout
#define ouct cout
#define itn int
ll gcd(int a, int b)
{
   if (a%b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a%b));
   }
}

ll lcm(int a, int b)
{
   return a * b / gcd(a, b);
}
struct Union{
  vector<ll> par;
  Union(ll a){
  par=vector<ll>(a,-1);
  }
  ll find(ll a){
    if(par[a]<0){
      return a;
    }
    else{
      return par[a]=find(par[a]);
    }
  }
  bool same(ll a,ll b){
    return (find(a)==find(b));
  }
  ll size(ll a){
    return -par[find(a)];
  }
  void unite(ll a,ll b){
    ll c=find(a),d=find(b);
    if(c==d)
      return;
    if(size(c)<size(d)){
      swap(c,d);
    }
    par[c]+=par[d];
    par[d]=c;
  }
};
int main(){
  ll n,x,y;
  cin >> n >> x >> y;
  ll ans[n];
  rep(i,n){
    ans[i]=0;
  }
  ll tm,a,b,c;
  for(ll i=1;i<=n;i++){
    for(ll j=i+1;j<=n;j++){
      tm=999999;
      a=j-i-1;
      b=abs(j-y)+abs(i-x);
      c=abs(j-x)+abs(i-y);
      if(tm>a)tm=a;
      if(tm>b)tm=b;
      if(tm>c)tm=c;
      ans[tm]++;
    }
  }
  rep(i,n-1){
    cout << ans[i] << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <map>

using namespace std;

int main()
{
    int n, r,l;
    cin>>n>>r;
    if(n>=10){
        cout<<r;
    }
    else{
        l = 10-n;
        l = l * 100;
        cout<<r+l;
    }
}


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

//store test cases here
/*


*/
int w[100];
int v[100];
long long dp[101][100001];
long long ans = 0;
//least weight by taking the ith item with value j/ or not
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N,W;
    cin >> N >> W;
    for (int i = 0; i < N; i++) {
        cin >> w[i] >> v[i];
    }
    for (int i = 0; i <= N; i++) {
        for (int j = 0; j <= 100000; j++) {
            dp[i][j] = 100000000000000;
        }
    }
    dp[0][0] = 0;
    for (int i = 1; i <= N; i++) {
        for (int j = 0; j <= 100000; j++) {
            dp[i][j] = dp[i-1][j];
            if (j - v[i-1] >= 0) {
                dp[i][j] = min(dp[i][j], dp[i-1][j - v[i-1]]+w[i-1]);
            }
            if (dp[i][j] <= W) {
                ans = max(ans, (long long)j);
            }
        }
    }
    cout << ans << "\n";
}
/* REMINDERS
 * CHECK ARRAY BOUNDS, HOW BIG ARRAY HAS TO BE
 * PLANNING!!!!!!!! Concrete plan before code
 * IF CAN'T FIGURE ANYTHING OUT, MAKE TEN TEST CASES TO EVALUATE ALL TYPES OF SCENARIOS, THEN CONSTRUCT SOLUTION TO FIT IT
 * IF CAN'T FIGURE ANYTHING OUT, MAKE TEN TEST CASES TO EVALUATE ALL TYPES OF SCENARIOS, THEN CONSTRUCT SOLUTION TO FIT IT
 * IF CAN'T FIGURE ANYTHING OUT, MAKE TEN TEST CASES TO EVALUATE ALL TYPES OF SCENARIOS, THEN CONSTRUCT SOLUTION TO FIT IT
 * NAIVE SOL FIRST TO CHECK AGAINST OPTIMIZED SOL
 * DON'T MAKE ASSUMPTIONS
 * DON'T OVERCOMPLICATE
 * CHECK INT VS LONG, IF YOU NEED TO STORE LARGE NUMBERS
 * CHECK CONSTRAINTS, C <= N <= F...
 * CHECK SPECIAL CASES, N = 1...
 * TO TEST TLE/MLE, PLUG IN MAX VALS ALLOWED AND SEE WHAT HAPPENS
 * ALSO CALCULATE BIG-O, OVERALL TIME COMPLEXITY
 * compile with "g++ -std=c++11 filename.cpp" if using auto keyword
 */



Measured memory_bytes: 82536
N = int(input())
S = input()

def f(n):
    m = n + N
    if m > 90:
        m -= 26
    return chr(m)

dic = {chr(n):f(n) for n in range(65,91)}
ans = []
for char in S:
    ans.append(dic[char])
print(''.join(ans))

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

using namespace std;

const int MAXN = 1005;
const int MAXM = 2005;
const int MOD = 1e9 + 7;

typedef long long ll;

typedef pair<int, int> pii;
#define fi first
#define se second

template<typename T> inline bool updmax(T &a, T b) { return (b > a ? a = b, 1 : 0); } 

int n, m;

ll X, D, T = 0;

vector<pii> G[MAXN];

struct Road
{
	int u, v, w;	
}road[MAXM];
int use[MAXM];

bool operator <(const Road &a, const Road &b)
{
	return a.w < b.w;	
}

int dsu[MAXN];

int find(int x)
{
	return (dsu[x] == x ? x : dsu[x] = find(dsu[x]));	
}

void uni(int x, int y)
{
	x = find(x), y = find(y);
	if (x != y)
		dsu[y] = x;
}
	
void init(int n)
{
	for (int i = 1; i <= n; i++)
		dsu[i] = i;	
}

int dep[MAXN], fa[MAXN];

ll val[MAXN];

void dfs(int u, int p = 0)
{
	fa[u] = p, dep[u] = dep[p] + 1;
	for (auto e : G[u])
	{
		int v = e.fi, w = e.se;
		if (v != p)
		{
			val[v] = w;
			dfs(v, u);	
		}
	}
}

ll qpow(ll a, ll b)
{
	ll ret;
	for (ret = 1; b; (a *= a) %= MOD, b >>= 1)
		if (b & 1)
			(ret *= a) %= MOD;
	return ret;
}

ll calc(int u, int v)
{
	if (dep[u] < dep[v])
		swap(u, v);
	ll ret = -1;
	while (dep[u] > dep[v])
		updmax(ret, val[u]), u = fa[u];
	if (u == v)
		return ret;
	while (u != v)
	{
		updmax(ret, val[u]), u = fa[u];
		updmax(ret, val[v]), v = fa[v];	
	}
	return ret;
}

int main()
{
	ios::sync_with_stdio(false); cin.tie(0);
	cin >> n >> m >> X;
	for (int i = 1; i <= m; i++)
		cin >> road[i].u >> road[i].v >> road[i].w;	
	sort(road + 1, road + m + 1);
	init(n);
	for (int i = 1; i <= m; i++)
	{
		int u = road[i].u, v = road[i].v, w = road[i].w;
		if (find(u) != find(v))
		{
			G[u].push_back({v, w});
			G[v].push_back({u, w});
			uni(u, v);
			use[i] = 1, T += w;
		}
	}
	ll D = X - T;
	dfs(1);
	int cnt[] = {0, 0, 0}; // lower, equal, upper
	for (int i = 1; i <= m; i++)
	{
		if (!use[i])
		{
			ll w = calc(road[i].u, road[i].v);
			ll diff = road[i].w - w;
			if (diff < D)
				cnt[0]++;
			else if (diff == D)
				cnt[1]++;
			else
				cnt[2]++;
		}
	}
	if (D < 0)
		cout << 0 << endl;
	else if (D == 0)
	{
		ll res = 0;
		(res += (qpow(2, n - 1) + MOD - 2) % MOD * qpow(2, m - n + 1)) %= MOD;
		(res += 2 * (qpow(2, cnt[1]) + MOD - 1) % MOD * qpow(2, cnt[2]) % MOD) %= MOD;
		cout << res << endl;
	}
	else
	{
		ll res = 0;
		(res += 2 * (qpow(2, cnt[1]) + MOD - 1) % MOD * qpow(2, cnt[2]) % MOD) %= MOD;
		cout << res << endl;
	}
	return 0;
}


Measured memory_bytes: 384
import java.util.*;

public class Main {
   public static void main(String[] args) {
       Scanner sc = new Scanner(System.in);
  while(sc.hasNext()){
  double a=sc.nextInt();
  double b=sc.nextInt();
  double c=sc.nextInt();
  double d=sc.nextInt();
  double e=sc.nextInt();
  double f=sc.nextInt();
  double y=(c*d-a*f)/(b*d-a*e);
  double x=(c-b*y)/a;
  System.out.printf("%.3f %.3f\n",x,y);
   }
   }
}

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

int N, M, Q;
int res = 0;
vector<int> a, b, c, d;
vector<int> A(15, 0);

int dsf(int lower, int num){
  if(lower == M || num == N){
    int sum = 0;
    for(int i = num; i <= N; i++) A[i] = lower;
    for(int i = 0; i < Q; i++){
      if(A[b[i]] - A[a[i]] == c[i]) sum += d[i];
    }
    return sum;
  }
  int MAX = 0;
  A[num] = lower;
  for(int k = lower; k <= M; k++) MAX = max(MAX, dsf(k, num+1));
  return MAX;
}

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

  int ta, tb, tc, td;
  for(int i = 0; i < Q; i++){
    cin >> ta >> tb >> tc >> td;
    a.push_back(ta); b.push_back(tb);
    c.push_back(tc); d.push_back(td);
  }

  for(int k = 1; k <= M; k++){
    A[1] = k;
    res = max(res, dsf(k, 1));
  }

  cout << res << endl;
  return 0;
  
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int INF = 1000000000;
const int MOD = (int)1e9 + 7;
template <class T>
inline T in()
{
    T x;
    cin >> x;
    return x;
}

int dfs(int n, int x)
{
    if (x > n)
        return 0;
    int a[3] = {3, 5, 7};
    string xs = to_string(x);
    int ret = 1;
    for (auto&& b : a)
    {
        char c = '0' + b;
        if (count(xs.begin(), xs.end(), c) == 0)
        {
            ret = 0;
            break;
        }
    }
    for (auto&& b : a)
    {
        ret += dfs(n, x * 10 + b);
    }
    return ret;
}

signed main()
{
    int n = in<int>();
    int sum = dfs(n, 0);
    cout << sum << "\n";
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
typedef long long int ll;

vector<int>a,dp;
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0); 
    ll n;cin>>n;
    a.resize(n);
    dp.resize(n,1e9);
    for (int i=0;i<n;i++){
        cin>>a[i];
    }
    dp[0]= 0;
    dp[1]= abs(a[0]-a[1]);
    //dp[2]= min(abs((a[0]-a[2])),abs(a[1]-a[2]));
    for (int i=2;i<n;i++){
        dp[i]=min(abs(a[i]-a[i-1])+dp[i-1],abs(a[i]-a[i-2])+dp[i-2]);
    }
    cout<<dp[n-1]<<endl;
    return 0;
}

Measured memory_bytes: 1024
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define endl '\n'
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))

using namespace std;

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

const ll INF=1e18;
const ll mod=1e9+7;


int main(){
    ll n;
    cin >> n;
    vector<ll> a(n),b(n);
    ll sum_a=0,sum_b=0;
    rep(i,n){
        cin >> a[i];
        sum_a+=a[i];
    }
    rep(i,n){
        cin >> b[i];
        sum_b+=b[i];
    }
    ll cnt=sum_b-sum_a;
    ll tot=0;
    ll odd=0;
    rep(i,n){
        ll diff=b[i]-a[i];
        if(diff<0) tot+=a[i]-b[i];
        else{
            if(diff%2==1) odd++;
        }
    }
    if(tot+odd>cnt) cout << "No" << endl;
    else cout << "Yes" << endl;
    return 0;
}


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

typedef long long ll;
typedef long long LL;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;

#ifdef DEBUG
    #define cek(x) cout<<x
#else
    #define cek(x) if(false){}
#endif // DEBUG

#define fi first
#define se second
#define INF 1000000000
#define INFLL 1000000000000000000LL
#define EPS 1e-9
#define PI acos(-1.0)
#define pb push_back
#define TC() while(tc--)
#define FOR(i,n) for(int i=0;i<n;i++)
#define FORN(i,n) for(int i=0;i<=n;i++)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define REPN(i,a,b) for(int i=a;i<=b;i++)
#define reset(a,b) memset(a,b,sizeof(a))
#define ALL(v) v.begin(), v.end()
#define SORT(v) sort(ALL(v))
#define SORTA(v,n) sort(v, v + n)
#define SZ(v) (int) v.size()
#define sc(x) scanf("%d",&x)

void open(){
	freopen("D:/Code/in.txt","r",stdin);
	freopen("D:/Code/out.txt", "w", stdout);
}

int main(void){
	ll n,t;
	cin >> n >> t;
	ll st, en;
	st = -1;
	en = 0;
	ll tot = t;

	cin >> st;
	FOR(i,n - 1){
		ll x;
		cin >> x;
		en = min(st + t, x);
		tot += en - st;
		st = x;
	}

	cout << tot << endl;
    return 0;
}

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 d = a+b+c;
		if (d==17) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
	}		
}

Measured memory_bytes: 21844
#include<iostream>
using namespace std;
int main(){
    int N,i=0;
    string S;
    cin >> N;
    cin >> S;
    while(S[i] != '\0'){
        S[i] += N;
        if(S[i] > 'Z'){
            S[i] -= 26;
        }
        i++;
    }
    cout << S << endl; 
    return 0;

}

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

using namespace std;
int main(void)
{
    int n, a[10000];
    while (1) {
        cin >> n;
        if (n == 0)
            break;
        for (int i = 1; i <= n; i++)
            cin >> a[i];
        int goukei = 0, led = -10000000;
        for (int i = 1; i <= n; i++)
        {
            goukei = 0;
            for (int j = i; j <= n; j++)
            {
                goukei = goukei + a[j];
                led = max(goukei, led);
            }
        }
        cout << led << endl;
    }
    return 0;
}

Measured memory_bytes: 3068
#include "stdio.h"

int color[10000] = {};
int num;
int start;
int end;
int now;
int right;
int left;
int ans = 10000;

int max(int a, int b) {
	if (a > b)return a;
	return b;
}

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

int main() {
	ans = num;
	scanf("%d", &num);
	while (num != 0) {
		ans = num;
		for (int i = 0; i < num; i++) {
			scanf("%d", &color[i]);
		}
		for (int i = 0; i < num; i++) {
			for (int j = 1; j < 4; j++) {
			//	printf("%d?????????%d????????§??????\n", i, j);
				start = i;
				end = i;
				now = j;
				while (1) {
					left = 0;
					right = 0;
					//printf("%d???????????¨%d?????????????????????\n", start, end);
					for (int k = end; k < num; k++) {
						if (color[k] != now&&i!=k)break;
					//	printf("%d ", k);
						right++;
					}
				//	printf("\n");
					for (int k = start; k >= 0; k--) {
						if (color[k] != now&&i!=k)break;
					//	printf("%d ", k);
						left++;
					}
				//	printf("\n");
					if (left + right < 4&&end!=start)break;
					if (left + right < 5 && end == start)break;
					if(start-(left)>=0)	start -=(left);
					else start = -1;
					if (end + (right) < num)end += right;
					else end = num;
					if (start < 0)break;
					if (end >= num)break;
					if (color[start] != color[end])break;
					now = color[start];
				}
				if (ans > num - end + start+1)ans = num - end + start+1;
			}
		}
		printf("%d\r\n", ans);
		scanf("%d", &num);		
	}

	return 0;
}

Measured memory_bytes: 1064
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;
int main()
{
  string s;
  cin >> s;
  int duplication;
  int length = s.length();
  for (int i = 0; i < length; i++) {
    duplication = 0;
    for (int j = 0; j < length; j++) {
      if(s[i]==s[j]) ++duplication;
    }
    if(duplication>=2){
      cout << "no" << endl;
      return 0;
    }
  }
  cout << "yes" << endl; 
  
  return 0;
}


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

// 総数を1000000007で割った余り
const long long mod = 1e9 + 7;

using ll  = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

void func(long long n, std::vector<long long> h) {
    ios::sync_with_stdio(false);
    cin.tie(0);
    // cout << fixed << setprecision(5);

    int cnt  = 0;
    int temp = 0;
    rep(i, n - 1) {
        if (h[i] >= h[i + 1]) {
            cnt++;
        } else {
            cnt = 0;
        }
        temp = max(temp, cnt);
    }
    cout << temp << endl;
}

int main() {
    long long N;
    scanf("%lld", &N);
    std::vector<long long> H(N);
    for (int i = 0; i < N; i++) {
        scanf("%lld", &H[i]);
    }

    func(N, std::move(H));

    return 0;
}


Measured memory_bytes: 1024
from sys import stdin
input = stdin.readline

N, M, C = map(int, input().split())
B = list(map(int, input().split()))

ans = 0

for _ in range(N):
    A = list(map(int, input().split()))
    s = 0

    for i in range(M):
        s += A[i] * B[i]

    if s > -C:
        ans += 1

print(ans)


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

typedef long long ll;

int main(){
    int N;
    cin >> N;
    vector<int> a(N), b(N+1,0);
    int cnt=0;
    for(int i=0; i<N; i++){
        cin >> a[i];
        if(a[i]<=N)
            b[a[i]]++;
        else
            cnt++;
    }
    
    for(int i=0; i<=N; i++){
        if(b[i] != i){
            if(b[i] > i){
                cnt += b[i]-i;
            }
            else {
                cnt += b[i];
            }
        }
    }
    
    cout << cnt << endl;
}


Measured memory_bytes: 1024
from itertools import combinations

import sys
input = sys.stdin.readline

H, W, K = [int(_) for _ in input().split()]

M = []

for h in range(H):
    row = input()
    M.append(row)

L1 = list(range(H))
L2 = list(range(W))
answer = 0

for l1 in range(H+1):
    for s1 in combinations(L1, l1):
        for l2 in range(W+1):
            for s2 in combinations(L2, l2):
                s = 0
                for h in range(H):
                    if h in s1:
                        continue
                    for w in range(W):
                        if w in s2:
                            continue
                        if M[h][w] == '#':
                            s += 1
                if s == K:
                    answer += 1
print(answer)


Measured memory_bytes: 69016
from itertools import permutations
import math
n = int(input())
x = []
y = []
for i in range(n):
    xi, yi = map(int, input().split(' '))
    x.append(xi)
    y.append(yi)

l = [i for i in range(n)]
route = list(permutations(l))
length = 0
for ls in route:
    for i in range(n-1):
        length += math.sqrt((x[ls[i+1]]-x[ls[i]])**2+(y[ls[i+1]]-y[ls[i]])**2)
ans = length/math.factorial(n)
print(ans)

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

#define PI 
#define ll long long

int matriz[8][2];
double sum = 0;

ll fat(int n) {
	return (n <= 1) ? 1 : n * fat(n-1);
}
int main() {
	int n;
	cin >> n;
	for(int i = 0; i < n; i++) {
		for(int j = 0; j < 2; j++) {
			cin >> matriz[i][j];
		}
	}
	for(int i = 0; i < n; i++) {
		for(int j = 0; j < n; j++) {
			if(j != i) {
				sum += sqrt(pow((matriz[i][0] - matriz[j][0]),2) + pow((matriz[i][1] - matriz[j][1]), 2));
			}
		}
	}
	printf("%.10lf\n", sum / n);
	return (0);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define ll long long
#define pb push_back
#define mp make_pair
bool isPrime(ll n) 
{ 
    
    if (n <= 1)  return false; 
    if (n <= 3)  return true; 
   
    if (n%2 == 0 || n%3 == 0) return false; 
  
    for (ll i=5; i*i<=n; i=i+6) 
        if (n%i == 0 || n%(i+2) == 0) 
           return false; 
  
    return true; 
} 
ll minthis(ll a, ll b){
if(a < b){
return a;
}
return b;
}
ll maxthis(ll a, ll b){
if(a > b){
return a;
}
return b;
}
int gcd(int a, int b){
    if( a<0 ) a = -a;
    if( b<0 ) b = -b;
    while( b!=0 ){
        a %= b;
        if( a==0 ) return b;
        b %= a;
    }
    return a;
}
ll lcm(ll a, ll b) {  
    return (a*b)/gcd(a, b);  
 }  
ll largestDivisor(ll n){
	int max = 1;
for(int i = 2 ; i*i <= n ; i++){
			if(n%i == 0) {
				max = n/i;break;
			}
		}
	return max;
}
 
 
ll power(ll x, ll y)  
{  
    ll temp;  
    if(y == 0)  
        return 1;  
    temp = power(x, y / 2);  
    if (y % 2 == 0)  
        return temp * temp;  
    else
    {  
        if(y > 0)  
            return x * temp * temp;  
        else
            return (temp * temp) / x;  
    }  
}  
bool sortbysec(const pair<int, int>& a, 
               const pair<int, int>& b) 
{ 
    return (a.second < b.second); 
} 
 
 
 
void solve(){	
	
	int n;
	cin >> n;
	int arr[n+1] = {};
	for(int i = 1; i < 101 ; i++){
		for(int j =1 ; j < 101 ; j++){
			for(int k = 1 ; k <101 ; k++){
				int val = i*i+j*j+k*k+i*j+j*k+k*i;
				if(val > n) continue;
				arr[val]++;
			}
		}
	}
	for(int i = 1 ; i <= n ; i++){
		cout << arr[i] << "\n";
	}
}
  
int main(){ 
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int t = 1;    
    //cin >> t;
    while(t--){
		solve();
	}
    return 0; 
}


Measured memory_bytes: 3588
n,k=map(int,input().split())
if k > (n-1)*(n-2)//2 :
    print(-1)
else:
    print((n-1)*(n-2)//2 - k+n-1)
    for i in range(2,n+1):
        print("1 "+str(i))
    res = []
    for i in range(2,n):
        for j in range(i+1,n+1):
            res.append(str(i)+" "+str(j))
    print("\n".join(res[:((n-1)*(n-2)//2) - k]))

Measured memory_bytes: 39024
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <string>
#include <cmath>
using namespace std;
#define MOD 1000000007
#define INF 1<<30
#define LINF (ll)1<<62
#define MAX 510000
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(), (x).rend()
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll, ll> P;
typedef vector<pair<ll, ll>> vpl;

ll G[20][20];
ll n;
vvl dp(1<<15, vl(20,-1));

ll rec(ll S, ll v){
    if(dp[S][v] != -1) return dp[S][v];
    if(S==(1<<n)-1 && v==0) return dp[S][v] = 0;
    ll res = INF;
    rep(i,n){
        if(S & (1<<i)) continue; 
        res = min(res, rec(S | (1<<i), i) + G[v][i]);
    }
    return dp[S][v] = res;
}

int main(){
    ll m; cin >> n >> m;
    rep(i,n) rep(j,n) G[i][j] = i==j ? 0 : INF;
    rep(i,m){
        ll a,b,c; cin >> a >> b >> c;
        G[a][b] = c;
    }
    ll ans = rec(0,0);
    if(ans != INF) cout << ans << endl;
    else puts("-1");
}


Measured memory_bytes: 9060
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
int main(){
    string tar, l, r, t1, l1, r1;
    getline (cin, tar);
    l=tar.substr(0, tar.length()/2);
    r=tar.substr(tar.length()/2+1, tar.length()/2);
    t1=tar, l1=l, r1=r;
    reverse (t1.begin(), t1.end());
    reverse (l1.begin(), l1.end());
    reverse (r1.begin(), r1.end());
    if (t1==tar && r1==r && l1==l) cout<<"Yes\n";
    else cout<<"No\n";
}

Measured memory_bytes: 256
#define HAVE_STRUCT_TIMESPEC
#include<bits/stdc++.h>
using namespace std;
int a[100007];
const long long mod = 1e9+7;
long long inv[100007];
long long qpow(int p,int q){
    long long s=1;
    for(;q;q>>=1,p=1ll*p*p%mod)
        if(q&1)
            s=1ll*s*p%mod;
    return s;
}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n,k;
    cin>>n>>k;
    for(int i=1;i<=n;++i)
        cin>>a[i];
    sort(a+1,a+1+n);
    for(int i=1;i<=n;++i)
        inv[i]=qpow(i,mod-2);
    long long sum=0;
    long long temp=1;
    for(int i=k;i<=n;++i){
        sum=(sum+a[i]*temp%mod)%mod;
        temp=temp*i%mod;
        temp=temp*inv[i+1-k]%mod;
    }
    temp=1;
    for(int i=n-k+1;i;--i){
        sum=(sum+mod-a[i]*temp%mod)%mod;
        temp=temp*(n-i+1)%mod;
        temp=temp*inv[n-i+2-k]%mod;
    }
    cout<<sum;
    return 0;
}


Measured memory_bytes: 1408
#include<iostream>
using namespace std;
int n;

bool isP(int x){
  if(x==0||x==1)return false;
  for(int i=2;i*i<=x;i++){
    if(x%i==0)return false;
  }
  return true;
}

int main(){
  while(cin>>n&&n){
    for(int i=n;i-2>=1;i--){
      if(isP(i)&&isP(i-2)){
	cout<<i-2<<' '<<i<<endl;
	break;
      }
    }
  }
  return 0;
}

Measured memory_bytes: 1156
// Template from https://techracho.bpsinc.jp/jhonda/2019_08_05/78537

// input macro for competive-programming from https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        input_inner!{$s, $($r)*}
    };
}

#[allow(unused_macros)]
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)*}
    };

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

#[allow(unused_macros)]
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, bytes) => {
        read_value!($iter, String).into_bytes()
    };

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

fn main() {
    use std::io::Read;
    let mut s = String::new();
    std::io::stdin().read_to_string(&mut s).unwrap();

    println!("{}", solve(&s));
}

macro_rules! test {
    ($($exp_input:expr => $output:expr),* $(,)*) => {
        #[test]
        fn solve_test() {
            $(
                let start = std::time::Instant::now();
                let input = solve($exp_input);
                let end = start.elapsed();
                assert_eq!(input, $output, "{}.{:03}", end.as_secs(), end.subsec_millis());
                assert!(end.as_secs() <= 2, "expected_sec: {}sec, actual_sec: {}sec", 2, end.as_secs());
                assert!(end.as_secs() <= 1, "expected_sec: {}sec, actual_sec: {}sec", 1, end.as_secs());
                assert!(end.subsec_millis() <= 10, "expected_ms: {}ms, actual_ms: {}ms", 10, end.subsec_millis());
                assert!(end.subsec_millis() <= 2, "expected_ms: {}ms, actual_ms: {}ms", 2, end.subsec_millis());
            )*
        }
    };
}

test! {
r#"2"# => r#"4"#,
r#"100"# => r#"10000"#,
}

fn solve(src: &str) -> String {
    let mut src_iter = src.split_whitespace();
    input! {
        source = src_iter,
        r: usize,
    }

    r.pow(2).to_string()
}

Measured memory_bytes: 4352
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace A_Kth_Term
{
    class Program
    {
        static void Main(string[] args)
        {
            var Si = new int[] { 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 };
            var K = int.Parse(Console.ReadLine());

            Console.WriteLine(Si[K - 1]);
        }
    }
}


Measured memory_bytes: 11092
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define Graph vector<vector<ll>>
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1000000007;

int main(){
    string S;
    cin >> S;
    int N = S.size();
    S += ' ';
    reverse(all(S));
    Graph dp(13, vector<ll>(N + 1, 0));
    dp[0][0] = 1;

    int dig = 1;
    for(int i = 1; i <= N; i++){
        if(S[i] == '?'){
            for(int j = 0; j < 10; j++){
                int tmp = j * dig % 13;
                for(int k = 0; k < 13; k++){
                    dp[(k + tmp) % 13][i] += dp[k][i - 1];
                    dp[(k + tmp) % 13][i] %= INF;
                }
            }
        }
        else {
            for(int k = 0; k < 13; k++){
                int j = (S[i] - '0');
                int tmp = j * dig % 13;
                dp[(k + tmp) % 13][i] += dp[k][i - 1];
                dp[(k + tmp) % 13][i] %= INF;
            }
        }

        dig *= 10;
        dig %= 13;
    }

    cout << dp[5][N] << endl;
}

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

using namespace std;

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

int digit_sum(int x){
    int sum = 0;
    while(x > 0){
        sum += x % 10;
        x /= 10;
    }
    return sum;
}

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

    int min_sum = 9*5;
    rep(i, N){
        if(i==0) continue;
        int A = i;
        int B = N - A;

        int sum_A = digit_sum(A);
        int sum_B = digit_sum(B);

        int tmp = sum_A + sum_B;
        min_sum = min(tmp, min_sum);
    }
    cout << min_sum << endl;
}

Measured memory_bytes: 256
MOD = 10**9 + 7


def main():
    S = int(input())
    if S < 3:
        print(0)
        return
    dp = [0] * (S + 1)
    dp[3] = 1
    for i in range(4, S + 1):
        dp[i] = dp[i - 1] + dp[i - 3]
        dp[i] %= MOD
    print(dp[S])
    # print(*dp)


if __name__ == '__main__':
    main()


Measured memory_bytes: 63348