akhauriyash/Code-Regression huggingface dataset:
import math

MOD = 10**9+7


def xgcd(a, b):
    x0, y0, x1, y1 = 1, 0, 0, 1
    while b != 0:
        q, a, b = a // b, b, a % b
        x0, x1 = x1, x0 - q * x1
        y0, y1 = y1, y0 - q * y1
    return a, x0, y0


def modinv(a):
    g, x, y = xgcd(a, MOD)
    return x


fact = [1] * 100100
for i in range(1, 100100):
    fact[i] = fact[i-1] * i % MOD


def comb(n, r):
    if n < r or r < 0:
        return 0
    else:
        return fact[n] * modinv(fact[n - r]) * modinv(fact[r]) % MOD


n = int(input())
a = list(map(int, input().split()))
x = sum(a) - n*(n+1)//2

l = 0
while a[l] != x:
    l += 1
r = 0
while a[n - r] != x:
    r += 1
c = n + 1 - l - r - 2

for k in range(1, n + 2):
    ans = comb(n+1, k) - comb(l + r, k - 1)
    if ans < 0:
        ans += MOD
    print(ans)


Measured memory_bytes: 65900
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include<numeric>
using namespace std;
using P = pair<int, int>;
#define rep(i,n) for(int i=0; i<(n);i++)
typedef long long ll;


int main(){
    int a, b, c; cin >> a >> b >> c;
    int tmp=a;
    a = b;
    b = tmp;
    tmp = a;
    a = c;
    c = tmp;
    cout << a << ' ' << b << ' ' << c << ' '<< endl;
    return 0;
}


Measured memory_bytes: 888
#include <stdio.h>
#include <limits.h>

#define SIZE 1000

int main(void) {
  int N = 0;
  int M = 0;

  int a[SIZE] = {0};
  int b[SIZE] = {0};
  int v[SIZE] = {0};

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

  for (int i = 0; i < N; i++) {
    scanf("%d", &a[i]);
  }

  for (int i = 0; i < M; i++) {
    scanf("%d", &b[i]);
  }

  for (int i = 0; i < M; i++) {
    for (int j = 0; j < N; j++) {
      if (a[j] <= b[i]) {
	v[j]++;
	break;
      }
    }
  }

  int max = 0;

  for (int i = 1; i < N; i++) {
    if (v[i] > v[max]) {
      max = i;
    }
  }

  printf("%d\n", max + 1);

  return 0;
}

Measured memory_bytes: 1036
<?php
while(fscanf(STDIN,"%d %d %d", $m, $f, $r)){
if($m + $f + $r <= -3){
    return 1;
}
if($m == -1 or $f == -1){
    echo "F".PHP_EOL;
}elseif ($m + $f >= 80) {
    echo "A".PHP_EOL;
}elseif ($m + $f >= 65) {
    echo "B".PHP_EOL;
}elseif ($m + $f >= 50) {
    echo "C".PHP_EOL;
}elseif ($m + $f >= 30) {
    if ($r >= 50) {
        echo "C".PHP_EOL;
    }else{
        echo "D".PHP_EOL;
    }
}elseif ($m + $f < 30) {
    echo "F".PHP_EOL;
}
}//while

Measured memory_bytes: 14976
#include <bits/stdc++.h>
#define endl '\n'
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()
#define F first
#define S second

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double db;

const db inf = 1e18;
const db pi = acos(-1);
const db eps = 1e-9;
const int mod = 998244353;

int main () {
	#ifdef ernestico
		freopen ("a.in", "r", stdin );
//		freopen ("a.out", "w", stdout );
	#endif
	ios_base::sync_with_stdio(0);
	cin.tie(0);

	ll a; cin >> a;

	string s; cin >> s;
	bool ok = false;
	ll b1 = 0, b2 = 0;
	for ( auto i : s ) {
		if ( i == '.' ) {
			ok = true;
			continue;
		}

		if ( !ok )
			b1 = b1 * 10 + i - '0';
		else
			b2 = b2 * 10 + i - '0';
	}

	ll ans = a * b1 + a * b2 / 100;
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3612
#include <stdio.h>

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

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

int comp(const void * a, const void * b) {
    return ( *(int*)a - *(int*)b );
}

int main() {
    int n, m;
    scanf("%d%d", &n, &m);
    int pop[n], votes=0;
    for(int i=0; i<n; ++i) {
        scanf("%d", &pop[i]);
        votes += pop[i];
    }
    qsort(pop, n, sizeof(int), comp);
    double min_v = votes/(4.0*m);
    for(int i=n-1; i>=0; --i) {
        if(m == 0)
            break;
        if(pop[i] >= min_v)
            --m;
    }
    if(!m)
        puts("Yes\n");
    else
        puts("No\n");
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <list>
#include <numeric>
#include <stack>
#include <queue>
#include <tuple>
#include <bitset>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
typedef long long ll;
typedef pair<int,int> P;
const int inf = 1012345678;
int dx[] = {1,-1,0,0};
int dy[] = {0,0,1,-1};
#include <stdio.h>
#include <math.h>
#define PI 3.141592653
int main(){
  int N, X;
  cin >> N >> X;
  int L[N];
  rep(i,N){
    cin >> L[i];
  }
  int ans = 1;
  int dist = 0;
  rep(i,N){
    dist += L[i];
    if(dist > X) break;
    ans++;
  }
  
  cout << ans << endl;

  return 0;
}



// ./compile.sh main


Measured memory_bytes: 256
n = int(input())
a = "abcdefghijklmmopkrstuvwxyz"


def solve(s, m):
    if len(s) == n:
        print(s)
        return
    for v in a:
        if ord(v)-m <= 1:
            solve(s+v, max(m, ord(v)))


solve("a", ord("a"))


Measured memory_bytes: 4412
#include <stdio.h>

int main() {
  int n;
  int i;
  int sum;
  int in;

  while(1) {
    scanf("%d", &n);
    if(n == 0) break;
    sum = 0;
    for(i = 0; i < n/4; i++) {
      scanf("%d", &in);
      sum += in;
    }
    printf("%d\n", sum);
  }
  return 0;
}

Measured memory_bytes: 0
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vi;
typedef vector<string> vs;
typedef pair<ll,ll> P;
typedef vector<P> vp;
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define REPR(i,n) for(int i=n-1;i>=0;i--)
#define FORR(i,n,m) for(int i=n-1;i>=m;i--)
#define ARR(array) for(int i=0;i<array.size();i++)
#define all(in) in.begin(),in.end()
#define ALL(in,K) in,in+K
#define INF 1e18
#define MOD 100000007
#define SIZE 10005
#define PI 	3.14159265358979323846

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

char input(){
  char a;
  cin >> a;
  return a;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,k;
    cin >> n >> k;
    string s;
    cin >> s;
    s[k-1] += 32;
    cout << s << endl;
}

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

template <typename T> T gcd(T x, T y) {
  if (y == 0)
    return x;
  return gcd(y, x % y);
}

template <typename T> T lcm(T x, T y) {
  if (x == 0 || y == 0)
    return 0;
  return x / gcd(x, y) * y;
}

int ctoi(char c) {
  if (c >= '0' && c <= '9') {
    return c - '0';
  }
  return 0;
}

vector<int> p;
vector<int> r;

void init(int n) {
  p.reserve(n);
  r.reserve(n);
  for (int i = 0; i < n; i++) {
    p[i] = i;
    r[i] = 0;
  }
}

int root(int x) { return p[x] == x ? x : p[x] = root(p[x]); }

bool same(int x, int y) { return root(x) == root(y); }

void unite(int x, int y) {
  x = root(x);
  y = root(y);
  if (x == y)
    return;

  if (r[x] < r[y])
    p[x] = y;
  else {
    p[y] = x;
    if (r[x] == r[y])
      r[x]++;
  }
}

int main() {
  int N;
  cin >> N;
  int tmp = 0;
  int cnt = 0;
  int ans = 0;
  for (int i = 0; i < N; i++) {
    int a;
    cin >> a;
    if (a != tmp) {
      ans += cnt / 2;
      tmp = a;
      cnt = 0;
    }
    cnt++;
  }
  ans += cnt / 2;
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <map>
#include <cstring>

using namespace std;

std::map<char, int> last;
std::map<char, int> maxes;


int main()
{
    char buf[105];

    scanf("%s", buf);
    int n = strlen(buf);

    for(int i = 0; i < n; ++i)
    {
        int last_occ = -1;

        char c = buf[i];
        if(last.find(c) != last.end())
        {
            last_occ = last[c];
        }

        int odl = (i - last_occ) - 1;
        map<char, int>::iterator mi = maxes.find(c);
        if(mi == maxes.end())
        {
            maxes[c] = odl;
        }
        else
        {
            if(maxes[c] < odl)
                maxes[c] = odl;
        }

        last[c] = i;
    }

    for(map<char,int>::iterator it = last.begin(); it != last.end() ; ++it)
    {
        int odl = (n - it->second) - 1;
        char c = it->first;
        map<char, int>::iterator mi = maxes.find(c);
        if(mi == maxes.end())
        {
            maxes[c] = odl;
        }
        else
        {
            if(maxes[c] < odl)
                maxes[c] = odl;
        }
    }

    int mini = 1000;
    for(map<char,int>::iterator it = maxes.begin(); it != maxes.end(); ++it)
    {
        if(mini > it->second)
            mini = it->second;
    }

    printf("%d\n", mini);

    return 0;
}


Measured memory_bytes: 888
#include <iostream>
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
#define int long long 
int anss(int a,int b){
    return a*b/(__gcd(a,b));
}
signed main() {
   int n;
   cin>>n;
   int rr=360%n;
   
   int X=n;
   if(n==0) cout<<0<<endl;
   if(n!=0)
   cout<<(anss(360,X)/X)<<endl;
   return 0;
}

Measured memory_bytes: 3632
// failed to generate code

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
vector<pair<string,P> >vec;

bool d[81][81][25610];

int main(){	
	int H, W;
	cin >> H >> W;
	vector<vector<int>> A(H, vector<int>(W)), B(H, vector<int>(W));
	rep(i, H) {
		rep(j, W) {
			cin >> A[i][j];
		}
	}
	rep(i, H) {
		rep(j, W) {
			cin >> B[i][j];
		}
	}
	d[1][1][A[0][0]-B[0][0]+12800] = true;
	d[1][1][-A[0][0]+B[0][0]+12800] = true;
	repn(i, H) {
		repn(j, W) {
			for (int k = max(0, A[i-1][j-1]-B[i-1][j-1]); k < min(25610, 25610-A[i-1][j-1]+B[i-1][j-1]); k++) {
				d[i][j][k] = d[i][j][k] || d[i-1][j][k-A[i-1][j-1]+B[i-1][j-1]] || d[i][j-1][k-A[i-1][j-1]+B[i-1][j-1]];
			}
			for (int k = max(0, -A[i-1][j-1]+B[i-1][j-1]); k < min(25610, 25610+A[i-1][j-1]-B[i-1][j-1]); k++) {
				d[i][j][k] = d[i][j][k] || d[i-1][j][k+A[i-1][j-1]-B[i-1][j-1]] || d[i][j-1][k+A[i-1][j-1]-B[i-1][j-1]];
			}
		}
	}
	int res = 10000000;
	repn(i, 25610) {
		if (d[H][W][i]) {
			res = min(res, abs(i-12800));
			// cout << i-12800 << endl;
		}
	}
	cout << res << endl;
}


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

int main() {
  int N, num, ans;
  cin >> N;
  ans = 0;
  for (int i = 1; i < N+1; i += 2) {
    num = 0;
    for (int j = 1; j < i+1; j++) {
      if (i % j == 0) {
        num++;
      }
    }
    if (num == 8) {
      ans++;
    }
  }
  cout << ans <<endl;
}

Measured memory_bytes: 256
C = [list(map(int, input().split())) for _ in range(3)]

for b1 in range(101):
    a1 = C[0][0] - b1
    a2 = C[0][1] - b1
    a3 = C[0][2] - b1
    for b2 in range(101):
        aa1 = C[1][0] - b2
        aa2 = C[1][1] - b2
        aa3 = C[1][2] - b2
        for b3 in range(101):
            aaa1 = C[2][0] - b3
            aaa2 = C[2][1] - b3
            aaa3 = C[2][2] - b3
            if (a1, a2, a3) == (aa1, aa2, aa3) == (aaa1, aaa2, aaa3):
                print("Yes")
                exit()

print("No")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    int n,m,x,y;
    cin >> n >> m >> x >> y;
    int X[n], Y[m];
    for(int i = 0; i < n; i++){
        cin >> X[i];
    }
    for(int i = 0; i < m; i++){
        cin >> Y[i];
    }
    sort(X,X+n);
    sort(Y, Y+m);
    for(int i = x+1; i < y+1; i++){
        if(X[n-1] < i && i <= Y[0]){
            cout << "No War" << endl;
            return 0;
        }
    }
    cout << "War" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
typedef long long  ll;
#define rep(i,s,n)for(ll i=s;i<n;i++)
#define repe(i,s,n)for(ll i=s;i<=n;i++)

ll a[100001] = {};
ll b[100001] = {};
int main() {
	ll n, h; cin >> n >> h;
	ll maxA = 0;
	rep(i, 0, n) {
		cin >> a[i] >> b[i];
		maxA = max(maxA, a[i]);
	}
	sort(b, b + n);
	reverse(b, b + n);

	ll cnt = 0;
	rep(i, 0, n) {
		if (maxA <= b[i]) {
			h -= b[i];
			cnt++;
			if (h <= 0) {
				cout << cnt << endl;
				return 0;
			}
		}
		else {
			break;
		}
	}
	cnt += h / maxA + ((h % maxA) ? 1 : 0);
	cout << cnt << endl;

	return 0;
}

Measured memory_bytes: 1792
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int n = Integer.parseInt(br.readLine());

		if (n == 0) {
			System.out.println(0);
			return;
		}

		List<Integer> list = new ArrayList<>();
		while (n != 1) {
			if (n < 0) {
				list.add(-n % 2);
				n = (-n + 1) / 2;
			} else {
				list.add(n % 2);
				n = -(n / 2);
			}
		}
		System.out.print(1);
		Collections.reverse(list);
		for (int i : list) {
			System.out.print(i);
		}
		System.out.println();
	}
}


Measured memory_bytes: 25172
#include <stdio.h>

int main()
{
    char a;
    scanf("%c",&a);

    switch(a){
case 'a':
case 'i':
case 'u':
case 'e':
case 'o':
    printf("vowel");
    break;
default:
    printf("consonant");
    break;
    }

    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (ll)(n); ++i)
#define repk(i,k, n) for (int i = k; i < (ll)(n); ++i)
#define MAX 50000001
#define MOD 1000000007
typedef long long  ll;

using namespace std;

ll ans, cnt;


int main() {
	char n;
	cin >> n;
	
	cout << char(n+1) << endl;

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdlib>
#include<vector>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
int n,m,ans,pw; vector<int> cup[3];
void move(int k,int t){
	if(k>n)return;
	int pk,o;
	rep(i,3)if(!cup[i].empty()&&cup[i][cup[i].size()-1]==k)pk=i;
	rep(i,3)if(i!=pk&&i!=t)o=i;
	cup[pk].pop_back();
	if(pk==t){
		move(k+1,t);
		cup[pk].push_back(k);
		return;
	}
	ans++;
	if(abs(pk-t)==1){
		move(k+1,o);
		cup[t].push_back(k);
	}else{
		move(k+1,t);
		cup[o].push_back(k);
	}
	move(k,t);
}
int main(){
	while(cin>>n>>m,n){
		rep(i,3)cup[i].clear();
		rep(i,3){
			int k,l;cin>>k;
			rep(j,k)cin>>l,cup[i].push_back(l);
			reverse(cup[i].begin(),cup[i].end());
		}
		ans=0;pw=1;rep(i,n)pw*=3;
		move(1,0); ans=min(ans,pw-1-ans);
		cout<<(ans<0||ans>m?-1:ans)<<endl;
	}
	return 0;
}

Measured memory_bytes: 908
#include<stdio.h>
#include<string.h>
#define LEN 100005

typedef struct pp{
    char name[100];
    int t;
}P;


P Q[LEN];
int head, tail, n;

void enqueue(P);
P dequeue();
int min(int,int);

int main(){
    int elaps = 0, c;
    int i, q;
    P u;
    scanf("%d %d", &n, &q);
    
    for ( i = 1; i <= n; i++){
        scanf("%s", Q[i].name);
        scanf("%d", &Q[i].t);
    }
    head=1;
    tail=n+1;
    
    while(head!=tail){
        u=dequeue();
        c=min(q,u.t);
        u.t-=c;
        elaps+=c;
        if(u.t>0)enqueue(u);
        else{
            printf("%s %d\n",u.name,elaps);
        }
    }
    
    return 0;
}

void enqueue(P x){
    Q[tail] = x;
    tail = (tail + 1) % LEN;
}

P dequeue(){
    P x = Q[head];
    head = (head + 1) % LEN;
    return x;
}


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





Measured memory_bytes: 11852
#include<bits/stdc++.h>
#define pb push_back
#define pf push_front
#define in insert
#define ff first
#define ss second
#define mp make_pair
#define int long long
#define uint unsigned long long
#define rep(i,x,m) for(int i=x;i<m;i++)
#define repr(i,x,m) for(int i=x;i>=m;i--)
#define MOD 1000000007
#define endl "\n"
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define vi vector<int>
#define vs vector<string>
#define print(v) for(int i=0;i<v.size();i++) cout<<v[i]<<" ";cout<<endl
using namespace std;
#define noob ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
int fac[2000005]={0};
void factorial(){ fac[0]=1; fac[1]=1; for(int i=2;i<200005;i++) fac[i]=((i%MOD)*(fac[i-1]%MOD))%MOD;}
int power(int n,int m)
{int p=1;if(m==0)return 1;p=(power(n,m/2)%MOD);p=(p%MOD*p%MOD)%MOD;
return(m&1?((p%MOD*n%MOD)%MOD):(p%MOD));}
int ncr(int n,int r){return ((fac[n]*power(fac[r],MOD-2))%MOD*power(fac[n-r],MOD-2))%MOD;}

void ram5564()
{
    int n;
    cin>>n;
    int a[n+2];
    for(int i=0;i<=n;++i)
        a[i]=0;
    for(int i=1;i<n;++i)
    {
        int x;
        cin>>x;
        a[x]++;
    }
    for(int i=1;i<=n;++i)
    {
        cout<<a[i]<<endl;
    }
}

signed main()
{
        noob
        // #ifndef ONLINE_JUDGE
        //  freopen("input.txt","r",stdin);
        //  freopen("output.txt","w",stdout);
        //  #endif   
        
        int t=1;
        //cin>>t;
        while(t--)
        ram5564();
        return 0;
}

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

using namespace std;

int main() {
    int N;
    cin >> N;
    pair<string, int> playlist[N];
    string title;
    int time;
    for (int i = 0; i < N; i++) {
        cin >> title >> time;
        playlist[i] = pair<string, int>(title, time);
    }
    string X;
    cin >> X;
    int total_time = 0;
    int sleep_start = 0;

    for (int i = 0; i < N; i++) {
        total_time += playlist[i].second;
        if (X == playlist[i].first ) {
            sleep_start = total_time;
        }
    }

    cout << total_time - sleep_start << "\n";

    return 0;
}


Measured memory_bytes: 256
#include<iostream>

int main(){
    char s[3];
    for(int i=0;i<3;i++){
        scanf("%s",&s[i]);
    }
    int a=0;
    int b=0;
    int c=0;
    for(int i=0;i<3;i++){
        if(s[i]=='a'){
            a++;
        }if(s[i]=='b'){
            b++;
        }if(s[i]=='c'){
            c++;
        }
    }
    if(a==1&&b==1&&c==1){
        printf("Yes");
    }else{
        printf("No");
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
using namespace std;
int main () {
	int n;
	while (cin >> n, n) {
		char field[n + 1][n + 1];
		int dp[n + 1][n + 1];
		memset(dp, 0, sizeof(dp));
		for (int i = 1; i <= n; i++) {
			for (int j = 1; j <= n; j++) {
				cin >> field[i][j];
			}
		}
		for (int i = 0; i <= n; i++) {
			dp[i][0] = dp[0][i] = 0;
		}
		int result = 0;
		for (int i = 1; i <= n; i++) {
			for (int j = 1; j <= n; j++) {
				if (field[i][j] == '.') {
					dp[i][j] = min(dp[i - 1][j - 1], min(dp[i - 1][j], dp[i][j - 1])) + 1;
					result = max(dp[i][j], result);
				}
//				cout << '\t' << dp[i][j];
			}
//			cout << endl;
		}
		cout << result << endl;
	}
	return 0;
}

Measured memory_bytes: 6056
#include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define srep(i,s,t) for(int i=(int)(s);i<(int)(t);++i)
#define each(a,b) for(auto& (a): (b))
#define all(v) (v).begin(),(v).end()
#define len(v) (int)(v).size()
#define zip(v) sort(all(v)),v.erase(unique(all(v)),v.end())
#define cmx(x,y) x=max(x,y)
#define cmn(x,y) x=min(x,y)
#define fi first
#define se second
#define pb push_back
#define show(x) cout<<#x<<" = "<<(x)<<endl
#define spair(p) cout<<#p<<": "<<p.fi<<" "<<p.se<<endl
#define sar(a,n) cout<<#a<<":";rep(kbrni,n)cout<<" "<<a[kbrni];cout<<endl
#define svec(v) cout<<#v<<":";rep(kbrni,v.size())cout<<" "<<v[kbrni];cout<<endl
#define svecp(v) cout<<#v<<":";each(kbrni,v)cout<<" {"<<kbrni.first<<":"<<kbrni.second<<"}";cout<<endl
#define sset(s) cout<<#s<<":";each(kbrni,s)cout<<" "<<kbrni;cout<<endl
#define smap(m) cout<<#m<<":";each(kbrni,m)cout<<" {"<<kbrni.first<<":"<<kbrni.second<<"}";cout<<endl

using namespace std;

typedef pair<int,int> P;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<P> vp;
typedef vector<string> vs;

const int MAX_N = 100005;

map<ll,ll> mp[15][130];
map<ll,ll> mp2[15][130][3];

void solve(int& sm,ll& mul,string& s)
{
    sm = 0,mul = 1;
    rep(i,len(s)){
        sm += (s[i]-'0');
        mul *= (s[i]-'0')+1;
    }
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    int keta = len(s);
    int sm;
    ll mul;
    solve(sm,mul,s);
    mp2[0][0][0][1] = 1;
    rep(i,keta){
        rep(j,sm+1){
            each(it,mp2[i][j][0]){
                rep(k,min(sm+1-j,10)){
                    if(k < s[i]-'0'){
                        mp2[i+1][j+k][1][it.fi*(k+1)] += it.se;
                    }else if(k == s[i]-'0'){
                        mp2[i+1][j+k][0][it.fi*(k+1)] += it.se;
                    }else{
                        mp2[i+1][j+k][2][it.fi*(k+1)] += it.se;
                    }
                }
            }
            srep(k,1,3){
                each(it,mp2[i][j][k]){
                    rep(l,min(sm+1-j,10)){
                        mp2[i+1][j+l][k][it.fi*(l+1)] += it.se;
                    }
                }
            }
        }
    }
    ll ans = 0;
    rep(i,sm){
        rep(j,3){
            each(it,mp2[keta][i][j]){
                ans += it.se;
            }
        }
    }
    rep(i,3){
        each(it,mp2[keta][sm][i]){
            if(it.fi >= mul){
                break;
            }
            ans += it.se;
        }
    }
    ans += mp2[keta][sm][1][mul];
    cout << ans << "\n";
    return 0;
}



Measured memory_bytes: 55556
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<stack>
#include<queue>
#include<set>
#include<tuple>
#include<ctime>
#include<functional>
#include<cmath>
#include<cassert>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> p; 
#define rep(i,n) for(ll i=0;i<(n);i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define br() p("")
#define pn(s) cout << (#s) << " " << (s) << endl
#define p_yes() p("Yes")
#define p_no() p("No")
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))

int main(){
    ll A,B,H,M;
    long double ans=0;
    cin>>A>>B>>H>>M;
    ans=sqrt(A*A+B*B-2*A*B*cos(abs(30*H-5.5*M)*M_PI/180));
    printf("%.15Lf\n", ans);
}



Measured memory_bytes: 4160
H, W = map(int, input().split())
M = [list(input()) for i in range(H)]
p = 10**9 + 7

M[0][0] = 1
for h in range(H):
  for w in range(W):
    if M[h][w] == ".":
      M[h][w] = ((M[h-1][w] if h-1 >= 0 and M[h-1][w] != "#" else 0) + (M[h][w-1] if w-1 >= 0 and M[h][w-1] != "#" else 0)) % p
print(M[-1][-1])

Measured memory_bytes: 43540
# -*- coding: utf-8 -*-
a, b = map(int,input().split())

if 0 < a:
    print("Positive")
elif a * b <= 0:
    print("Zero")
elif a < 0 and (b - a + 1) % 2 == 1:
    print("Negative")
else:
    print("Positive")


Measured memory_bytes: 2940
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <tuple>
#include <stack>
#include <bitset>
#include <utility>
// #include <numeric>
using namespace std;



typedef unsigned long ul;
typedef unsigned long long ull;
typedef long long ll;
typedef vector<ll> vint;
typedef vector<vector<ll>> vvint;
typedef pair<ll,ll> pint;
typedef vector<pint> vpint;

#define rep(i,n) for(ll i=0;i<n;i++)
#define repf(i,f,n) for(ll i=f;i<n;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define INT_MAX 2147483647
#define LLONG_MAX 9223372036854775807
#define vmax(vec) *max_element(vec.begin(), vec.end())
#define vmin(vec) *min_element(vec.begin(), vec.end())
#define vsort(vec) sort(vec.begin(), vec.end())
#define vsortgr(vec) sort(vec.begin(), vec.end(), greater<ll>())


typedef struct{
  ll pos;
  ll depth;
} data;
//
// struct Node{
//
// }



int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0,};

// ll X,Y,Z,K;
// ll pmax = 30000000000;
// vint A,B,C;




// int binary_search(int key){
//  //isOKを満たす要素のうち最小のインデックスを返す。（要ソート）
//   int left = -1;
//   int right = N;
//
//   while(right - left > 1){
//     int mid = left + (right - left)/2;
//
//     if(isOK(mid, key)) right=mid;
//     else left=mid;
//   }
//
//   return right;
// }

// ll gcd(ll m, ll n){
//   if(m<n) swap(m,n);
//   if(n==0) return m;
//   return gcd(n, m%n);
// }



int main() {



  ll N;
  cin >> N;
  vvint connection(N);
  // cout << N << endl;
  vint a(N),b(N);
  rep(i,N-1){
    cin>>a[i]>>b[i];
    a[i]--;b[i]--;
    // cout << a[i] << b[i] << endl;;
    connection[a[i]].pb(b[i]);
    connection[b[i]].pb(a[i]);
  }
  // cout << "hoge";

  vector<bool> reached(N, false);
  stack<data> s;
  reached[0] = true;
  s.push(data{0ll, 1ll});

  ll u = 0;
  ll udepth = 0;

  while(!s.empty()){
    data tmp = s.top();
    if(tmp.depth>udepth){
      udepth=tmp.depth;
      u = tmp.pos;
    }
    s.pop();
    for(auto pos : connection[tmp.pos]){
      // cout << pos << endl;
      if(!reached[pos]){
        reached[pos]=true;
        s.push(data{pos, tmp.depth+1});
      }
    }
  }

  vector<bool> reached2(N, false);
  stack<data> s2;
  reached2[u] = true;
  s2.push(data{u, 1ll});

  ll diam = 1;

  while(!s2.empty()){
    data tmp = s2.top();
    diam = max(diam, tmp.depth);
    s2.pop();
    for(auto pos : connection[tmp.pos]){
      if(!reached2[pos]){
        reached2[pos]=true;
        s2.push(data{pos, tmp.depth+1});
      }
    }
  }

  // cout << diam << endl;

  if(diam==0){ cout << "Second" << endl; return 0;}

  if(diam%3==2){cout<<"Second" <<endl;}
  else cout<<"First" <<endl;


}

















//


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

typedef long long int ll;
double dp[301][301][301];
ll n;

double func(ll i,ll j,ll k)
{
	if(i==0 && j==0 && k==0)
		return 0;
	if(dp[i][j][k]!=-1)
		return dp[i][j][k];
	double res=1;
	if(i)
		res+=(((double(i))/(double(n)))*func(i-1,j,k));
	if(j)
		res+=(((double(j))/(double(n)))*func(i+1,j-1,k));
	if(k)
		res+=(((double(k))/(double(n)))*func(i,j+1,k-1));
	res/=(double(i+j+k)/double(n));
	dp[i][j][k]=res;
	return res;
}

int main()
{
	ios::sync_with_stdio(0);
	cin >> n;
	ll a[n],i,j,k,o=0,t=0,th=0;
	for(i=0;i<n;i++)
	{
		cin >> a[i];
		if(a[i]==1)
			o++;
		else if(a[i]==2)
			t++;
		else
			th++;
	}	
	for(i=0;i<=n;i++)
	{
		for(j=0;j<=n;j++)
		{
			for(k=0;k<=n;k++)
				dp[i][j][k]=-1;
		}
	}
	double ans = func(o,t,th);
	cout << fixed << setprecision(20) << ans << "\n";
	return 0;
}

Measured memory_bytes: 213376
from sys import stdin

best = 0
cnt = 0
flg = False


def main():
    while True:
        tmp = stdin.read(1)
        if tmp.strip() != "":
            calc(tmp)
        elif tmp != '\r':
            break

    print(best)


def calc(v: chr):
    global best
    global cnt
    global flg

    if v == 'A':
        flg = True
    if flg:
        cnt += 1
    if flg and v == 'Z':
        best = cnt


if __name__ == '__main__':
    main()

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define all(v) v.begin(), v.end()
#define endk '\n'
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
const ld eps = 1e-10;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n; cin >> n;
  vector<ll> L(n); rep(i, n) cin >> L[i];
  sort(all(L));
  ll ans = 0;
  rep(i, n) REP(j, i+1, n) REP(k, j+1, n) {
    if(L[i]!=L[j] && L[i]!=L[k] && L[j]!=L[k] &&
       L[i]+L[j]>L[k]) {
      ans++;
    }
  }
  cout << ans << endk;
  return 0;
}


Measured memory_bytes: 3660
/* Mere paradesiyaan ki yahi hai nishaani
   Ankhiyaan bilor ki, shishe ki jawaani
*/
#include <bits/stdc++.h>

using namespace std;

#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define LOG1(a)			  cerr<< #a << " = " << (a) << "\n"
#define LOG2(a, b)		  cerr<< #a << " = " << (a) << ", " << #b << " = " << (b) << "\n"
#define endl "\n"

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

const ll INF = 1e18;
const int inf = 1e9;
const int MOD = 1e9 + 7;
const int nax = 1000000 + 10;

int n, arr[nax];
vii graph[nax];
vi order;
int visited[nax], m;
set<int> set1[nax];
int flag = 0;
void dfs(int v)
{
    visited[v] = 1;
    for(auto x: graph[v])
    {
        if(visited[x.ff] == 1) continue;
        dfs(x.ff);
    }
    order.pb(v);
}
int main()
{
    ios::sync_with_stdio(0);
    cin >> n >> m;
    for(int i = 1; i <= m; i++)
    {
        int u, v, w;
        cin >> u >> v >> w;
        graph[u].pb({v, w});
    }
    for(int i = 1; i <= n; i++)
    {
        if(visited[i] == 1) continue;
        dfs(i);
    }
    memset(visited, 0, sizeof(visited));
        reverse(order.begin(), order.end());
        //for(auto x: order) cout << x << " ";
        //cout << endl;
        for(auto x: order)
        {
            visited[x] = 1;
            if((int)set1[x].size() > 1)
            {
                cout << "No";
                return 0;
            }
            int curdist;
            if(set1[x].empty()) curdist = 0;
            else curdist = *set1[x].begin();
            for(auto y: graph[x])
            {
                if(visited[y.ff] == 1) flag = 1;
                set1[y.ff].insert(curdist + y.ss);
            }
        }
        if(flag == 1) cout << "No";
        else cout << "Yes";
    return 0;
}


Measured memory_bytes: 88696
import Foundation
let N = Int(readLine()!)!

var grid: [[Int]] = .init(repeating: [], count: N)

for i in 0..<N {
  grid[i] = readLine()!.split(separator: " ").map { Int($0)! }
}

let n = Int(pow(2.0, Double(N)))
var dp: [Int] = .init(repeating: -1, count: n)
let mod = 1000000007
func dfs(_ i: Int, _ grid: [[Int]], _ current: Int) -> Int {
  if i == grid.count {
    return current == n - 1 ? 1 : 0
  }
  if dp[current] != -1 {
    return dp[current]
  }
  var sum = 0
  for j in 0..<grid[i].count {
    if grid[i][j] == 0 {
      continue
    }
    if current & 1 << j == 0 {
      sum = (sum + dfs(i+1, grid, current | 1 << j)) % mod
    }
  }
  dp[current] = sum
  return sum
}

print(dfs(0, grid, 0))

Measured memory_bytes: 30096
import sys
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for i2 in range(j)] for i3 in range(k)]

X = ii()

print((X//500)*1000 + ((X%500)//5)*5)

Measured memory_bytes: 3316
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
	int n;
	cin>>n;
	int t[100010]={0};
	int x[100010]={0};
	int y[100010]={0};
	for(int i=1;i<=n;i++){
		cin>>t[i]>>x[i]>>y[i];
	}
	
	for(int i=0;i<n;i++){
		int dx=abs(x[i+1]-x[i]);
		int dy=abs(y[i+1]-y[i]);
		if(dx+dy>abs(t[i+1]-t[i])){
			cout<<"No"<<endl;
			return 0;
		}
		if((dx+dy)%2!=(t[i+1]-t[i])%2){
			cout<<"No"<<endl;
			return 0;
		}
	}
	cout<<"Yes"<<endl;
}

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

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef pair<int, int> pii;
typedef pair<char, char> pcc;

#define FOR(i, begin, end) for(int i = (begin); i < (end); i++)
#define rep(i, n) FOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define ZP(a, len) cout << setfill('0') << setw(len) << right << a << endl;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};

signed main() {
    int x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    
    int x3, y3, x4, y4;
    x3 = x2 - y2 + y1;
    y3 = y2 + x2 - x1;
    x4 = x3 - y3 + y2;
    y4 = y3 + x3 - x2;
    cout << x3 << " " << y3 << " " << x4 << " " << y4 << endl;

    return 0;
}

Measured memory_bytes: 256
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
using namespace std;
typedef long long int llint;
typedef long double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
//cout<<setprecision(20)
const llint mod=1000000007;
const llint big=2.19e15+1;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-15;
template <class T,class U>void mineq(T& a,U b){if(a>b){a=b;}}
template <class T,class U>void maxeq(T& a,U b){if(a<b){a=b;}}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){return a/gcd(a,b)*b;}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
int LBI(vector<llint>&ar,llint in){return lower_bound(ar.begin(),ar.end(),in)-ar.begin();}
int UBI(vector<llint>&ar,llint in){return upper_bound(ar.begin(),ar.end(),in)-ar.begin();}
int main(void){
	llint n,m,i;cin>>n>>m;
	//包除
	lldo ans=0;
	llint aa[20]={0};
	lldo pp[20]={0};
	for(i=0;i<n;i++){cin>>aa[i];}
	for(i=0;i<n;i++){cin>>pp[i];pp[i]/=100;}
	for(int bi=1;bi<(1<<n);bi++){
		llint gen=1;
		lldo per=1;
		bool ok=true;
		int guki=0;
		for(i=0;i<n;i++){
			if(!(bi&(1<<i))){continue;}
			guki++;
			per*=pp[i];
			llint gc=gcd(gen,aa[i]);
			if(((lldo)gen/gc *aa[i])>2e18){ok=false;break;}
			gen=gen/gc *aa[i];
		}
		if(!ok){continue;}
		llint num=m/gen;
		if(guki%2==1){ans+=per*num;}
		else{ans-=per*num;}
	}
	cout<<setprecision(20)<<ans<<endl;
	return 0;
}


Measured memory_bytes: 3284
N , Q = map(int,input().split())
S = list(input())
slice_list = []
for _ in range(Q):
    l , r =map(int,input().split())
    slice_list.append([l - 1,r - 1])
cnt_list = [0] * (N + 1)

for i in range(N - 1):
    if S[i] == "A" and S[i + 1] == "C":
        cnt_list[i + 1] = cnt_list[i] + 1
    else:
        cnt_list[i + 1] = cnt_list[i]

for i in range(Q):

    print(cnt_list[slice_list[i][1]] - cnt_list[slice_list[i][0]])

Measured memory_bytes: 23724
#include <bits/stdc++.h>
using namespace std;
#define int long long

signed main(){
	int N, A, B;
	scanf("%lld%lld%lld", &N, &A, &B);
	printf("%lld\n", (N / (A + B)) * A + min(N % (A + B), A));
	return 0;
}

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

int main() {
	int m,n;cin>>n>>m;
	vector<int> o,e;
	for(int i=1;i<=m;i++){
		if(i%2){
			o.push_back(i);
		}else{
			e.push_back(i);
		}
	}
	reverse(o.begin(),o.end());
	reverse(e.begin(),e.end());
	for(int i=0;i<o.size();i++){
		cout<<i+1<<' '<<i+1+o[i]<<endl;
	}
	for(int i=0;i<e.size();i++){
		cout<<n-i<<' '<<n-i-e[i]<<endl;
	}
	return 0;
}


Measured memory_bytes: 3892
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<vector>
#include<deque>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<algorithm>
#include<functional>
#include<utility>
#include<bitset>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<cstdio>

using namespace std;

#define REP(i,n) for(int i=0;i<int(n);i++)
#define foreach(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
typedef long long ll;
typedef pair<ll,ll> P;

int c[60];

int main(void){
	          int i;

	          int N,M;
	          cin >> N >> M;

	          for(i=1;i<=M;i++){
	        	  int a,b;
	        	  cin >> a >> b;
	        	  c[a]++;
	        	  c[b]++;
	          }

	          for(i=1;i<=N;i++){
	        	  cout << c[i] << endl;
	          }

	          return 0;
}


Measured memory_bytes: 256
using System;

class main{
	static void Main(string[] args){
		var kwd = Console.ReadLine();
		var n = int.Parse(Console.ReadLine());
		int count=0;
		for(int i=0;i<n;++i){
			var input = Console.ReadLine();
			var str = input+input;
			if(str.Contains(kwd))count++;
		}
		Console.WriteLine(count);
	}
}

Measured memory_bytes: 6236
#include<bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define pll pair<ll,ll>
#define sll set<ll>
#define msll multiset<ll>
#define mll map<ll,ll>
#define vll vector<ll>
#define vpl vector<pll>
#define gll greater<ll>
#define gpl greater<pll>
#define spl set<pll>
#define mspl multiset<pll>
#define lb lower_bound
#define bp __builtin_popcount
#define ub upper_bound
#define prq priority_queue
#define mp make_pair
#define pb push_back
#define mem(x,y) memset(x, y, sizeof x)
#define endl "\n"
#define sz(x) (ll)x.size()
#define sqr(x) x*x
#define rapido ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
typedef long long ll;
typedef long double ld;
ll mx = INT_MAX;
ll mn = INT_MIN;
ll INF = 1e18+10;
ll MOD = 1e9+7;
const ll maxs = 3e5+5;
const ll lg = 22; 
ll fast(ll base , ll expo){ ll res = 1; while(expo>=1){ if(expo%2) res *= base; base *= base; expo /= 2; } return res; }

ll DP[maxs];

void pre() {
    mem(DP , 0);
    for(ll i=1; i<=100; i++)
        for(ll j=1; j<=100; j++)
            for(ll k=1; k<=100; k++) {
                ll tmp = sqr(i) + sqr(j) + sqr(k) + i*j + j*k + i*k;
                DP[tmp]++;
            }
}

void code_idhr_h() {
    ll N; cin>>N;
    for(ll i=1; i<=N; i++) cout<<DP[i]<<endl;
}

int main(){
    rapido;
    ll T=1; //cin>>T;
    pre();
    while(T--){
        code_idhr_h();
    }
    return 0;
}

Measured memory_bytes: 5884
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long lli;

int main() {
  int N;
  int C[100][100];
  cin >> N;
  for(int i = 0; i < N; ++i) {
    for(int j = 0; j < N; ++j) {
      cin >> C[i][j];
    }
  }
  lli sum = 0;
  for(int i = 0; i < N; ++i) {
    for(int j = i+1; j < N; ++j) {
      sum += min(C[i][j], C[j][i]);
    }
  }
  cout << sum << endl;
  return 0;
}

Measured memory_bytes: 1196
r,g,b,n=map(int,input().split())
ans=0
for i in range(n//r+1):
    if r*i==n:
        ans+=1
        break
    else:
        for j in range((n-r*i)//g+1):
            if r*i+g*j==n:
                ans+=1
                continue
            else:
                if n-(r*i+g*j)>0 and (n-(r*i+g*j))%b==0:
                    ans+=1

print(ans)

Measured memory_bytes: 40668
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <utility>
#include <iomanip>
#include <cmath>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);++i)
#define rep(i,a,b) for(int i=a;i<(b);++i)
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;}
using ll = long long;
constexpr ll INF = 1LL << 60;
constexpr ll MOD = 1e9 + 7;


int main() {
    cin.tie(0); ios_base::sync_with_stdio(false);
    int N;cin >> N;
    int ans = 0;
    int mx  = -100;
    for(int i=1;i<=N;++i){
        int cnt = 0;
        int tmp = i;
        while(tmp%2==0){
            tmp >>= 1;
            ++cnt;
        }
        if(chmax(mx,cnt)) ans = i;
    }
    cout << ans << endl;
            
    return 0;
}

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

#define mp make_pair
#define ull unsigned long long
#define M 1000000007
#define F first



int main(){
    // string s;cin>>s;
    // int sum=0;
    // for(int i=0;i<s.length();i++){
    //     int x=stoi(s[i]);
    //     sum+=x;
    // }
    // cout<<sum<<endl;
    // if(sum%9==0) cout<<"Yes"<<endl;
    // else cout<<"No"<<endl;
    int n;cin>>n;
    vector <ll> v(n);
    for(int i=0;i<n;i++){
        cin>>v[i];
    }
    int l=0;
    int r=1;
    ll sum=0;
    while(l<n-1){
        if(v[r]<v[l]){
            sum+=v[l]-v[r];
            v[r]=v[l];
            
        }
        l++;r++;

    }
    cout<<sum<<endl;
}
    

Measured memory_bytes: 4784
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int hight = sc.nextInt();
		int wide = sc.nextInt();
		for (int i = 0; i < hight; i++) {
			String output = sc.next();
			System.out.print("\n" + output);
			System.out.print("\n" + output);
		}
		sc.close();
	}
}

Measured memory_bytes: 22996
#include<iostream>
#include<cstdio>
#include<math.h>
#include<string>
#include<algorithm>
#include<functional>
#include<vector>
#include<set>
#include<map>
#define INF 999999
#define EPS 1.0e-6

using namespace std;

typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<int, P> PP;

int n;
int p[105000];

int main()
{
	cin >> n;
	vector<int>change;
	
	for (int i = 0; i < n; i++) {
		cin >> p[i];
		p[i]--;
	}
	for (int i = 0; i < n; i++) {
		if (p[i] == i)change.push_back(i);
	}
	int ans = 0;
	if (!change.empty())ans++;
	for (int i = 1; i < change.size(); i++) {
		if (change[i] != change[i - 1] + 1) {
			ans++;
		}
		else change[i]--;
	}
	cout << ans << endl;

	return 0;
}

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

namespace abc119d
{
    class Program
    {
        static void Main(string[] args)
        {
            var S = ReadInt();
            bool YYMM = false;
            bool MMYY = false;

            int u = S / 100;
            int d = S % 100;

            // YYMM 
            if (u >= 0 && u <= 99)
                if (d >= 1 && d <= 12)
                    YYMM = true;
            //MMYY
            if (u >= 1 && u <= 12)
                if (d >= 0 && d <= 99)
                    MMYY = true;
            if (YYMM && MMYY)
                Console.WriteLine("AMBIGUOUS");
            else if (YYMM)
                Console.WriteLine("YYMM");
            else if (MMYY)
                Console.WriteLine("MMYY");
            else
                Console.WriteLine("NA");

#if DEBUG
            Console.ReadKey();
#endif
        }

        private static bool IsRange(int a, int from, int to) => (from <= a && a <= to);
        private static int ReadInt() => int.Parse(Console.ReadLine());
        private static List<int> ReadIntList() => Console.ReadLine().Split().Select(int.Parse).ToList();
        private static double ReadDouble() => double.Parse(Console.ReadLine());
        private static List<double> ReadDoubleList() => Console.ReadLine().Split().Select(double.Parse).ToList();
        private static long ReadLong() => long.Parse(Console.ReadLine());
        private static List<long> ReadLongList() => Console.ReadLine().Split().Select(long.Parse).ToList();
        private static List<int> Int2Digits(int a) => a.ToString().ToCharArray().Select(_ => int.Parse(_.ToString())).ToList();
        private static int BinarySearch<Type>(IReadOnlyList<Type> s, Type target) // target 以下の最大要素のインデックスを返す
            where Type : IComparable
        {
            var lower = 0;
            var upper = s.Count - 1;
            while (upper - lower > 1)
            {
                var mid = lower + (upper - lower) / 2;
                if (s[mid].CompareTo(target) <= 0)
                {
                    lower = mid;
                }
                else
                {
                    upper = mid;
                }

            }
            return lower;
        }
    }
}


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

int A[20];
int n;

bool Saiki(int k,int m){
    //??????????±???§A[k]?????\???????????\???????????????????????????
    if (m == 0) return true;
    if (k >= n) return false;//?????????????????§?????¢?????????????????????k?????????
    
    return Saiki(k+1,m-A[k])||Saiki(k+1,m);
}

int main(){
    
    int M;
    
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> A[i];
    }
    cin >> M;
    for (int i = 0; i < M; i++) {
        int m;
        cin >> m;
        if (Saiki(0,m)) {
            cout << "yes" << endl;
        }else{
            cout << "no" << endl;
        }
    }
    
    
    return 0;
}

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

typedef long long ll;

const int MOD = 1e9 + 7 ;
const double PI = 2 * acos(0.0);

int main()
{
  ll n, x, flag = 0, cnt = 0 ;
  cin >> n ;
  vector<ll> v1, v2 ;
  for(int i = 0; i < n; i++) {
    cin >> x ;
    v1.push_back(x) ;
  }
  for(int i = 0; i < n; i++) {
    cin >> x ;
    v2.push_back(x) ;
  }

  for(int i = 0; i < n; i++) {
    if(v1[i] < v2[i]) {
      flag = 1 ;
      break ;
    }
    else if(v2[i] < v1[i]) {
      flag = 2 ;
      break ;
    }
  }
  if(flag == 0) cout << 0 << endl ;
  else {
    if(flag == 1) {
      while(v1 != v2) {
        next_permutation(v1.begin(), v1.end()) ;
        cnt++ ;
      }
    }
    else {
      while(v1 != v2) {
        next_permutation(v2.begin(), v2.end()) ;
        cnt++ ;
      }
    }
    cout << cnt << endl ;
  }


}


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

void solve(void)
{
    ll a, b, c;
    cin >> a >> b >> c;
    if (a % 2 == 0 || b % 2 == 0 || c % 2 == 0)
        cout << 0 << endl;
    else
    {
        ll x = min(a * b, min(a * c, b * c));
        cout << x << endl;
    }
}
int main(void)
{
    solve();
}

Measured memory_bytes: 3576
using System;
using System.Linq;
using System.Collections.Generic;

using E = System.Linq.Enumerable;

public class Program
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine());
        var seqA = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();

        Array.Sort(seqA);

        var count = n;
        var dp = new bool[seqA.Last() + 1];
        for (int j = 0; j < seqA.Length; ++j)
        {
            if (dp[seqA[j]])
            {
                --count;
                continue;
            }

            var spanA = seqA.AsSpan().Slice(j + 1);
            if (spanA.Length > 0 && seqA[j] == spanA[0])
            {
                --count;
            }
            for (var aj = seqA[j]; aj <= seqA.Last(); aj += seqA[j])
            {
                int i = spanA.BinarySearch(aj);
                if (0 <= i && i < spanA.Length)
                {
                    dp[spanA[i]] = true;
                }
            }
        }

        Console.WriteLine(count);
    }
}


Measured memory_bytes: 44508