akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
#define REP(var, s, n) for (int var = (s); var < (n); ++var)
#define rep(var, n) for (int var = 0; var < (n); ++var)
#define ALL(c) (c).begin(), (c).end()

ll gcd(ll a, ll b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int main() {
  //
  ll a, b, c, d;
  cin >> a >> b >> c >> d;
  ll cx = b / c - (a - 1) / c;
  ll dx = b / d - (a - 1) / d;
  ll cd = c * d / gcd(c, d);
  ll cdx = b / cd - (a - 1) / cd;
  ll ans = b - (a - 1) - (cx + dx - cdx);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<bits/stdc++.h>
#include<string>
using namespace std;
int main()
{
  int n ;
  cin >>  n ;
  int ans ;
  
  for(int i=1;i<=9;i++){
    if(n<=(i*100+i*10+i)){
      ans = i*100+i*10+i ;
      break ;
    }
  }

  cout << ans << endl ;
  
  return 0 ;
}


Measured memory_bytes: 256
using System;


namespace ConsoleApplication13
{
    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {
                string[] s = Console.ReadLine().Split(' ');
                int a = int.Parse(s[0]);
                int b = int.Parse(s[1]);

                if (a < b)
                {
                    Console.WriteLine(a + " " + b);
                }
                else if (a > b)
                {
                    Console.WriteLine(b + " " + a);
                }
                else if (a == 0 && b == 0)
                {
                    break;
                }
                else
                {
                    Console.WriteLine(a + " " + b);
                }
                
            }
        }
    }
}

Measured memory_bytes: 9388
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<long long> vll;
typedef vector<pair<int,int>> vp;
typedef pair<int,int> pii;
#define INF (int)(1e9)
#define MAXX 1.1529215e+18
#define inf 999999
#define EPS (1e-7)
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define REP(i,n) for(int i=1;i<=(int)(n);i++)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define ALL(a)  a.begin(),a.end()
#define RALL(a) a.begin(),a.end(),greater<int>()
#define ROT(a) a.begin(),a.begin()+1,a.end()
#define RROT(a) a.begin(),a.end()-1,a.end()
#define PB push_back
#define MP make_pair
#define PI acos(-1.0)
#define sz(a) a.size()
const ll MOD = 1e9+7;
const int MAX = 10000000;
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
//cout << 'H' << endl;
//next_permutation(ALL(p));
//typedef priority_queue<int> pque;//これは大きい順
//typedef priority_queue<int, vector<int>, greater<int>> pque;//これは小さい順
//factorizeは、素因数分解用の関数

int main(){
	string s;
	cin >> s;
	int l_index = 1;
	int n = s.size();
	vector<int> ans(n,0);

	int ct=0;
	rep(i,n){
		if(i != n-1 && s[i]=='R' && s[i+1]=='L'){
			ct++;
			ans[i] = ct - ct/2;
			ans[i+1] = ct/2;
			ct=0;
			l_index = i+1;
		}else if(s[i] == 'R'){
			ct++;
		}else if(i == n-1 || (s[i]=='L' && s[i+1]=='R')){
			ct++;
			ans[l_index] += ct - ct/2;
			ans[l_index-1] += ct/2;
			ct=0;
		}else if(s[i]=='L'){
			ct++;
		}
	}
	rep(i,n){
		cout << ans[i] << " ";
	}
	cout << endl;

  return 0;
}


Measured memory_bytes: 1024
import java.io.*;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) throws IOException {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
//        int t = in.nextInt();
        solver.solve(1, in, out);
        out.close();
    }

    static class Task {
        public void solve(int testNumber, InputReader in, PrintWriter out) throws IOException {
            long a = in.nextLong();
            long b = in.nextLong();
            long ans = a * b / gcd(a,b);
            out.println(ans);
        }
        long gcd(long a, long b){
            if (b == 0){
                return a;
            }
            return gcd(b, a%b);
        }
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public char nextChar() {
            return next().charAt(0);
        }

        public String nextLine() throws IOException {
            return reader.readLine().trim();
        }
    }
}


Measured memory_bytes: 21460
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<(n);++i)
#define alrep(i,j,n) for(int i=0;i<(n);++i)for(int j=i+1;j<(n);++j)
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
const int MOD=1e9+7;
const long long INF = 1LL << 60;
int gcd(int a,int b) { return b ? gcd(b,a%b) : a;}
int lcm(int a,int b) { return a/gcd(a,b)*b;}
/*素数判定*/int isPrime(int n){if(n<2){return 0;}for(int i=2; i*i<=n; i++){if(n%i==0){return 0;}}return 1;}
/*約数列挙*/vector<int> getDivisor(int n){vector<int> v; for(int i=1; i*i<=n; i++){if(n%i==0){v.push_back(i);if(i!=n/i){v.push_back(n/i);}}}sort(v.begin(),v.end()); return v;}
void printb(unsigned int v) {
  unsigned int mask = (int)1 << (sizeof(v) * CHAR_BIT - 1);
  do putchar(mask & v ? '1' : '0');
  while (mask >>= 1);
}
void putb(unsigned int v) {putchar('0'), putchar('b'), printb(v), putchar('\n');}
#define ALL(W) (W).begin(),(W).end()
long long modinv(long long a, long long m) {//逆元の計算
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

int bikkuri(int A){
  int tmp=1;
  for(int i=1;i<=A;i++) tmp = tmp * i % MOD;
  return tmp;
}

signed main(){
  int X,Y;
  cin >> X >> Y;
  if((X+Y)%3!=0){
    cout << 0 << endl;
    return 0;
  }
  int a=(2*Y-X)/3;
  int b=(2*X-Y)/3;
  if(a<0 || b<0){
    cout << 0 << endl;
    return 0;
  }
  cout << modinv((bikkuri(a)*bikkuri(b))%MOD,MOD)*bikkuri(a+b)%MOD << endl;;

  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdint.h>
#include <string.h>

typedef struct rgb_struct {
        uint64_t r, g, b;
} rgb_t;

void rgb_count(rgb_t *rgb, char c) {
        switch (c) {
        case 'R':
                ++rgb->r;
                break;
        case 'G':
                ++rgb->g;
                break;
        case 'B':
                ++rgb->b;
                break;
        }
}

int is_rgb(char x, char y, char z) {
        rgb_t rgb = {0, 0, 0};

        rgb_count(&rgb, x);
        rgb_count(&rgb, y);
        rgb_count(&rgb, z);

        return (rgb.r == 1 && rgb.g == 1 && rgb.b == 1);
}

uint64_t solve(int k, char *s) {
        int i, j;
        rgb_t rgb = {0, 0, 0};
        size_t size = strlen(s);
        uint64_t nr_sym = 0;

        for (i = 0; i < size; i++) {
                rgb_count(&rgb, s[i]);
        }

        for (i = 0; i < size; i++) {
                for (j = i + 2; j < size; j += 2) {
                        if (is_rgb(s[i], s[j], s[(j+i)/2]) == 1) {
                                ++nr_sym;
                        }
                }
        }

        return (rgb.r * rgb.g * rgb.b) - nr_sym;
}

int main() {
        int n;
        char s[4001];

        if (scanf("%4d %s", &n, s) == 0) {
                perror("scanf");
                return 1;
        }
        printf("%lu\n", solve(n, s));

        return 0;
}


Measured memory_bytes: 1732
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std ;
#define int                 long long
#define ull                 unsigned long long int
#define ld                  long double
#define vi                  vector<int>
#define vii                 vector<pair<int,int>>
#define vvi                 vector<vector<int>>
#define pii                 pair<int,int>
#define pb                  push_back
#define prec(x)             fixed<<setprecision(15)<<x
#define all(x)              x.begin(),x.end()
#define rall(x)             x.rbegin(),x.rend()
#define rev(x)              reverse(x.begin(),x.end())
#define mset(a,b)           memset(a,b,sizeof(a))
#define mcpy(a,b)           memcpy(a,b,sizeof(a))
#define fo0(i,n)            for(int i=0,i##end=n;i<i##end;i++)
#define fo1(i,n)            for(int i=1,i##end=n;i<=i##end;i++)
#define fo(i,a,b)           for(int i=a,i##end=b;i<=i##end;i++)
#define foe(i,x)            for(__typeof((x).end())i=(x).begin();i!=(x).end();++i)
#define fre(i,x)            for(__typeof((x).rend())i=(x).rbegin();i!=(x).rend();++i)
#define mk(arr,n,type)      type *arr=new type[n];
#define dbg(x) cerr << #x << " is " << x << endl;
#define FAST_IO ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0)
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
int gcd(int a, int b) { return b ? gcd(b, a%b) : a; }
clock_t beg = clock();
const int inf=1e18;const int mod=1e9+7;const int N=2e5+9;
const double pi = 3.1415926535897932384626433;
void FILE_IO(){
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
}

void JH(){
    int d=0,e=0,f=0,g=0,p=0,w=0,flag=0,ans=0,res=0,cnt=0,sum=0;double f1=0.0,f2=0.0,f3=0.0;
    int a;cin>>a;
    cout<<a+a*a+a*a*a;

}

int32_t main()
{
    FILE_IO();FAST_IO;int t=1;
    // cin>>t;
    while(t--){JH();}cerr<<fixed<<setprecision(3)<<(double)(clock()-beg)/1000<<"s ";
}

Measured memory_bytes: 3736
#include <iostream>
#include <bits/stdc++.h>
#include <iomanip>

using namespace std;
vector<int> rad[605];
long double bf[605],rl[605],tcnt[605];
int n,m;

long double gl(int now)
{
    //bf[now]+=g;
    if(rl[now]) return rl[now];
    long double trl = 0;
    for(int i=0;i<rad[now].size();++i)
    {
        trl+=gl(rad[now][i])+1;
    }
//    if(rad[now].size()==0) {
//        if(now==n) return rl[now] = 0;
//        return rl[now] = 1000;
//    }
    if(now==n) return 0;
    return rl[now] = trl/rad[now].size();
}

//void ggl(int now,long double g)
//{
//    bf[now]+=g;
//    if(--tcnt[now]>0) return;
//    for(int i=0;i<rad[now].size();++i)
//        ggl(rad[now][i],bf[now]/rad[now].size());
//}


int main()
{
    scanf("%d%d",&n,&m);
    int s,t;
    for(int i=0;i<m;++i)
    {
        scanf("%d%d",&s,&t);
        rad[s].push_back(t);
    }

    gl(1);
    bf[1] = 1;

    for(int i=1;i<n;++i)
    {
        long double tv = bf[i]/rad[i].size();
        for(int j=0;j<rad[i].size();++j)
            bf[rad[i][j]]+=tv;
    }

    long double ans = 0;
    for(int i=0;i<rad[1].size();++i){
        ans += (1+rl[rad[1][i]]);
    }
    ans/=rad[1].size();


    long double df = 0;
    for(int i=1;i<=n;++i){
        if(rad[i].size()==1) continue;
        long double tsm = rl[i]*rad[i].size();
        for(int j=0;j<rad[i].size();++j){
            long double sdf = ((tsm-rl[rad[i][j]]-1)/(rad[i].size()-1)-tsm/rad[i].size())*bf[i];
            if(sdf<df) df = sdf;
        }
    }
    cout << setprecision(25) <<std::fixed<<ans+df<< endl;
    return 0;
}


Measured memory_bytes: 4968
#include<bits/stdc++.h>
using namespace std;
int main(){
	char a,b;
	cin>>a>>b;
	if(a=='H'){
		if(b=='H'){
			cout<<'H'<<endl;
		}
		if(b=='D'){
			cout<<'D'<<endl;
		}
	}
	if(a=='D'){
		if(b=='H'){
			cout<<'D'<<endl;
		}
		if(b=='D'){
			cout<<'H'<<endl;
		}
	}
}		

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int D = sc.nextInt();
    String ans = "Christmas";

    if (D == 25){
      System.out.println(ans);
    }else if (D == 24){
      System.out.println(ans + " Eve");
    }else if (D == 23){
      System.out.println(ans + " Eve Eve");
    }else if (D == 22){
      System.out.println(ans + " Eve Eve Eve");
    }
  }
}


Measured memory_bytes: 21204
#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<int>>
typedef long long ll;
const int INF = 1000000007;

// #include <boost/multiprecision/cpp_dec_float.hpp>
// #include <boost/multiprecision/cpp_int.hpp>
// namespace mp = boost::multiprecision;
// using Bint = mp::cpp_int;
// using Real = mp::number<mp::cpp_dec_float<1024>>;

int main(){
    int A, B, C, D, E, F;
    cin >> A >> B >> C >> D >> E >> F;
    int sugar_max = (3000 / (100 + E)) * E;

    set<int> sugar, water;
    for(int i = 0; i <= sugar_max/C; i++){
        for(int j = 0; j <= sugar_max/D; j++){
            int tmp = i * C + j * D;
            if(tmp <= sugar_max) sugar.insert(tmp); 
        }
    }

    for(int i = 0; i <= 30/A; i++){
        for(int j = 0; j <= 30/B; j++){
            int tmp = (i * A + j * B) * 100;
            if(tmp <= F && tmp >= 100) water.insert(tmp); 
        }
    }

    int ans_water = 0, ans_sugar = 0;
    double ans_c = -1;
    for(int w : water){
        for(int s : sugar){
            double tmp_c = (double)(s) / (double)(s + w);
            if(w + s <= F && s <= w / 100 * E && tmp_c > ans_c){
                ans_sugar = s;
                ans_water = w;
                ans_c = (double)(ans_sugar) / (double)(ans_water + ans_sugar);
            }
        }
    }

    cout << ans_sugar + ans_water << ' ' << ans_sugar << endl;
}

Measured memory_bytes: 256
h,w = map(int, input().split())
c = [list(map(int, input().split())) for i in range(h)]
dp = [[0 for i in range(w)] for j in range(h)]
for i in range(h):
    dp[i][0] = 1 if c[i][0] == 0 else 0
for i in range(w):
    dp[0][i] = 1 if c[0][i] == 0 else 0
for i in range(1,h):
    for j in range(1,w):
        if c[i][j] == 0:
            dp[i][j] = min(dp[i-1][j-1], dp[i-1][j], dp[i][j-1])+1
ans = 0
for i in dp:
    for j in i:
        ans = max(ans, j)
print(ans**2)


Measured memory_bytes: 55668
"use strict";

const Main = args => {
  const input = args.trim().split(" ");
  let fiveCounter = 0;
  let sevenCounter = 0;

  input.forEach(e => {
    if (e === '5') {
      fiveCounter++;
    } else if (e === '7') {
      sevenCounter++;
    }
  });

  if (fiveCounter === 2 && sevenCounter === 1) {
    console.log('YES');
  } else {
    console.log('NO');

  }
}

Main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 7372
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <set>
#include <string>
#include <cmath>
#include <map>
#include <iomanip>
#include <tuple>
#define INF 1000000009
#define LINF 1000000000000000009
#define double long double
#define all(a) a.begin(),a.end()
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> T;
//ll mod = 1000000007;
//ll mod = 998244353;

int main() {
	cout << "square1001" << endl;
}


Measured memory_bytes: 3052
using System;

public class hello
{
    public static void Main()
    {
        while (true)
        {
            string[] line = Console.ReadLine().Trim().Split(' ');
            var a= int.Parse(line[0]);
            var b = int.Parse(line[1]);
            if (a == 0 && b == 0) break;
            Console.WriteLine("{0} {1}",Math.Min(a,b), Math.Max(a, b));
        }
    }
}

Measured memory_bytes: 9340
#include <stdio.h>

int main(void) {
    int N,K;
    char str[90];
    scanf("%d%d",&N,&K);
    scanf("%s",str);
    if (str[K-1]=='A')
        str[K-1]='a';
    if (str[K-1]=='B')
        str[K-1]='b';
    if (str[K-1]=='C')
        str[K-1]='c';
    printf("%s\n",str);

  return 0;
}

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

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int h = Integer.parseInt(sc.next());
        int w = Integer.parseInt(sc.next());
        char[][] map = new char[h][w];
        int[][] array = new int[h][w];
        for(int i=0;i<h;i++){
            map[i] = sc.next().toCharArray();
            int begin = 0;
            int end = 0;
            for(int j=0;j<w;j++){
                if(j==w-1 && map[i][j] == '.'){
                    end = w;
                    int sub = end - begin;
                    for(int k=begin; k<end; k++){
                        array[i][k] = sub;
                    }
                    continue;
                }
                if(map[i][j] == '#'){
                    end = j;
                    int sub = end - begin;
                    for(int k=begin; k<end; k++){
                        array[i][k] = sub;
                    }
                    array[i][j] = 0;
                    begin = j+1;
                }
            }
        }
        sc.close();
        int max = 0;
        for(int i=0;i<w;i++){
            int begin = 0;
            int end = 0;
            for(int j=0;j<h;j++){
                if(j==h-1 && map[j][i] == '.'){
                    end = h;
                    int sub = end - begin;
                    for(int k=begin; k<end; k++){
                        array[k][i] += sub;
                        if(max < array[k][i]){
                            max = array[k][i];
                        }
                    }
                    continue;
                }
                if(map[j][i] == '#'){
                    end = j;
                    int sub = end - begin;
                    for(int k=begin; k<end; k++){
                        array[k][i] += sub;
                        if(max < array[k][i]){
                            max = array[k][i];
                        }
                    }
                    array[j][i] = 0;
                    begin = j+1;
                }
            }
        }
        System.out.println(max-1);
    }
}

Measured memory_bytes: 70724
#include <bits/stdc++.h>
using namespace std;
int main()
{
  int N;
  cin >> N;
  int A[200];
  for (int i = 0; i < N; i++)
  {
    cin >> A[i];
  }
  int ans = 0;
  bool possible = true;
  while (possible)
  {
    for (int i = 0; i < N; i++)
    {
      if (A[i] % 2)
      {
        possible = false;
        break;
      }
    }
    if (possible)
    {
      for (int i = 0; i < N; i++)
      {
        A[i] /= 2;
      }
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/integer/common_factor.hpp>
#include <boost/integer/common_factor_rt.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>

using std::string;
using std::vector;
using std::set;
using std::multiset;
using std::unordered_set;
using std::map;
using std::multimap;
using std::unordered_map;
using std::pair;
using std::cin;
using std::cout;

using boost::multiprecision::cpp_int;
using cpp_dec_float_1000 = boost::multiprecision::number<boost::multiprecision::cpp_dec_float<1000, boost::int128_type>>;

typedef uintmax_t    ull;
typedef intmax_t     ll;
typedef uint64_t     ul;
typedef uint32_t     ui;
typedef uint8_t      uc;

constexpr char CRLF  = '\n';
constexpr char SPACE = ' ';
constexpr char VECTOR_COUT_SEPARATOR = SPACE;
constexpr ll INF = 1000'000'007;
constexpr int MOD = 1000'000'007;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> std::ostream& operator<< (std::ostream& os, const std::vector<T>& vc) { for(auto it = vc.begin(); it != vc.end(); ++it) { if (std::next(it) == vc.end()) os << *it; else os << *it << VECTOR_COUT_SEPARATOR; } return os; }
template<class T1, class T2> inline std::ostream & operator<< (std::ostream & os, const std::pair<T1, T2> & p) { return os << p.first << ' ' << p.second; }
template<class T> T modinv(T a, T m) { T b = m, u = 1, v = 0; while (b) { T t = a / b; a -= t * b; boost::swap(a, b); u -= t * v; boost::swap(u, v); } u %= m; if (u < 0) u += m; return u; }
template<class T> inline bool isSosuu(const T& n) { if (n == T(1)) { return false; } for (T i = 2; i*i <= n; ++i) { if (n % i == 0) { return false; } } return true; }
template<class T> vector<vector<T>> split (const vector<T>& S, T delim) { vector<vector<T>> ret{}; vector<T> buff{}; for (auto c : S) { if (c == delim) { if (!buff.empty()) ret.push_back(buff); buff.clear(); } else { buff.push_back(c); } } if (!buff.empty()) ret.push_back(buff); return ret; }
template<class T> inline void printYesNo(const T& t) { cout << (t ? "Yes" : "No") << CRLF; }
template<class T = int64_t> T modpow(T N, T P, T M) { T ret{1}; N %= M; while (P) { if (P & 0x01) { ret *= N; ret %= M; } P >>= 1; N *= N; N %= M; } return ret; }

/** code for assert debug begin */
int gErr = 0;
#define ASSERT(p) if(!(p)){ gErr = 1; }else{ ; }
/** code for assert debug end */

struct Tmp
{
public:
  int N;
  Tmp(int N)
  : N(N)
  {}
};

void solve(void)
{
  int N, K, S; cin >> N >> K >> S;
  int inf = S == 1000'000'000 ? S - 1 : 1000'000'000;
  for (int i = 0; i < K; ++i) {
    cout << S << SPACE;
  }
  for (int i = K; i < N; ++i) {
    cout << inf << (i == N-1 ? CRLF : SPACE);
  }
  return;
}

int main(void)
{
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(0);

  solve();

  return 0;
}


Measured memory_bytes: 1280
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

#define EPS 1e-9

typedef struct {
	double x,y;
} xy_t;

double eq(double a, double b) {
	return fabs(a-b)<EPS;
}

double lt(double a, double b) {
	return a+EPS<b;
}

double leq(double a, double b) {
	return a<b+EPS;
}

double gt(double a, double b) {
	return a>b+EPS;
}

double geq(double a, double b) {
	return a+EPS>b;
}

int inrange(double r1, double r2, double c) {
	if(lt(r1,r2)) {
		return leq(r1,c) && leq(c,r2);
	} else if(gt(r1,r2)) {
		return leq(r2,c) && leq(c,r1);
	} else {
		return eq(r1,c) && eq(r2,c);
	}
}

xy_t kouten(int *e, xy_t s1, xy_t t1, xy_t s2, xy_t t2) {
	/* (x,y) = (x1,y1)+t(x2-x1,y2-y1)
	 * t = (x-x1)/(x2-x1) = (y-y1)/(y2-y1)
	 * (x-x1)*(y2-y1) = (y-y1)*(x2-x1)
	 * (y2-y1)*x + (x1-x2)*y = x1*y2 - x2*y1
	 */
	xy_t ret={0,0};
	double a = t1.y-s1.y;
	double b = s1.x-t1.x;
	double c = t2.y-s2.y;
	double d = s2.x-t2.x;
	double v1 = s1.x*t1.y - t1.x*s1.y;
	double v2 = s2.x*t2.y - t2.x*s2.y;
	double delta = a*d-b*c;
	if(eq(delta,0)) {
		if(e!=NULL)*e=0;
		return ret;
	}
	ret.x=(d*v1-b*v2)/delta;
	ret.y=(-c*v1+a*v2)/delta;
	if(e!=NULL) {
		*e=inrange(s1.x,t1.x,ret.x) && inrange(s1.y,t1.y,ret.y) &&
			inrange(s2.x,t2.x,ret.x) && inrange(s2.y,t2.y,ret.y);
	}
	return ret;
}

typedef struct {
	xy_t zahyo;
	int is_kouka;
} kouten_t;

int cmp_x(const void *x, const void *y) {
	double a = ((const kouten_t*)x)->zahyo.x;
	double b = ((const kouten_t*)y)->zahyo.x;
	if(gt(a,b))return 1;
	if(lt(a,b))return -1;
	return 0;
}

int cmp_y(const void *x, const void *y) {
	double a = ((const kouten_t*)x)->zahyo.y;
	double b = ((const kouten_t*)y)->zahyo.y;
	if(gt(a,b))return 1;
	if(lt(a,b))return -1;
	return 0;
}

int solve(void) {
	xy_t a,b;
	int n;
	int i;
	kouten_t kouten_list[110];
	int kouten_num=0;
	int ans;
	if(scanf("%lf%lf%lf%lf",&a.x,&a.y,&b.x,&b.y)!=4)return 0;
	if(scanf("%d",&n)!=1)return 0;
	for(i=0;i<n;i++) {
		xy_t s,t;
		int o,l;
		xy_t k;
		int e=0;
		if(scanf("%lf%lf%lf%lf%d%d",&s.x,&s.y,&t.x,&t.y,&o,&l)!=6)return 0;
		k=kouten(&e,a,b,s,t);
		if(e) {
			kouten_list[kouten_num].zahyo=k;
			kouten_list[kouten_num].is_kouka = (1-o)^l;
			kouten_num++;
		}
	}
	qsort(kouten_list,kouten_num,sizeof(kouten_list[0]),
		  eq(kouten_list[0].zahyo.x,kouten_list[kouten_num-1].zahyo.x)?cmp_y:cmp_x);
	ans=0;
	for(i=1;i<kouten_num;i++) {
		if(kouten_list[i].is_kouka!=kouten_list[i-1].is_kouka)ans++;
	}
	printf("%d\n",ans);
	return 1;
}

int main(void) {
	int n,i;
	if(scanf("%d",&n)!=1)return 1;
	for(i=0;i<n;i++) {
		if(!solve())return 1;
	}
	return 0;
}

Measured memory_bytes: 684
#include "bits/stdc++.h"
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a),i##_len=(b);i<i##_len;++i)
#define MSVC_UNKO(x) x
#define rep(...) MSVC_UNKO(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define all(c) c.begin(),c.end()
#define mp make_pair
#define write(x) cout<<(x)<<"\n"
using namespace std; typedef long long ll; template<class T>using vv = vector<vector<T>>;
template<class T>auto vvec(int n, int m, T v) { return vv<T>(n, vector<T>(m, v)); }
template<class T1, class T2>bool chmax(T1& a, const T2& b) { return a < b ? a = b, 1 : 0; }
template<class T1, class T2>bool chmin(T1& a, const T2& b) { return b < a ? a = b, 1 : 0; }
constexpr int INF = 1 << 29, MOD = int(1e9) + 7; constexpr ll LINF = 1LL << 60;
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(10); }; }aaaa;

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

    write(c - min(c, a - b));
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_ll.hpp>
//typedef boost::multiprecision::cpp_ll ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
string alp="abcdefghijklmnopqrstuvwxyz";
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);



int main(){
    ll n;cin>>n;
    ll a[n],b[n];
    ll suma=0,sumb=0;
    rep(i,0,n-1){
        cin>>a[i];
        suma+=a[i];
    }
    rep(i,0,n-1){
        cin>>b[i];
        sumb+=b[i];
    }
    if(sumb>suma){
        cout<<-1<<endl;
        return 0;
    }
    priority_queue<ll> q;
    ll sum=0;
    ll ans=0;
    rep(i,0,n-1){
        if(a[i]<b[i]){
            sum+=(b[i]-a[i]);
            ans++;
        }else if(a[i]>b[i]){
            q.push(a[i]-b[i]);
        }
    }
    while(sum>0){
        ans++;
        sum-=q.top();
        q.pop();
    }
    cout<<ans<<endl;
    
    
    return 0;
}



Measured memory_bytes: 2428
/*{{{*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<bitset>
#include<vector>
#include<limits.h>
#include<assert.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(LL &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const LL &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
#ifdef HOME
 #define DEBUG(...) {printf("# ");printf(__VA_ARGS__);puts("");}
#else
 #define DEBUG(...)
#endif
int MOD = 1e9+7;
void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
/*}}}*/
const int SIZE = 1e6+10;
int main(){
    int M,K; R(M,K);
    VI an;
    if(!K){
        REP(i,1<<M){
            an.PB(i);
            an.PB(i);
        }
    }
    else{
        if(M<2||K>=(1<<M)){
            W(-1);
            return 0;
        }
        else{
            REP(i,1<<M){
                if(i!=K)an.PB(i);
            }
            an.PB(K);
            for(int i=(1<<M)-1;i>=0;i--){
                if(i!=K)an.PB(i);
            }
            an.PB(K);
        }
    }
    W(an);
    return 0;
}


Measured memory_bytes: 2932
S=input()
Q=int(input())
Q=[input().split() for i in range(Q)]
Forward=[]
Backward=[]
count=0
for i in Q:
    if i[0]=='1':
        count+=1
    else:
        if (int(i[1])+count)%2==1:
            Forward.append(i[2])
        else:
            Backward.append(i[2])  
if count%2==0:
    ans = (''.join(Forward))[::-1]+S+(''.join(Backward))
else:
    ans = (''.join(Backward)[::-1]+S[::-1]+(''.join(Forward)))
print(ans)

Measured memory_bytes: 44700
#include <iostream>
#include <vector>
#include <cmath>
typedef long long L;
using namespace std;

#define N 100005
vector<pair<int, L> > path[N];
int par[N];
int dep[N];
int siz[N];
L cst[N];
int hev[N];
void dfs(int a){
    siz[a]=1;
    for(int i=0; i<path[a].size(); i++){
        int d=path[a][i].first;
        if(d==par[a]) continue;
        par[d]=a;
        dep[d]=dep[a]+1;
        cst[d]=path[a][i].second;
        dfs(d);
        siz[a]+=siz[d];
        if(!hev[a] || siz[hev[a]]<siz[d])
            hev[a]=d;
    }
}
  
L k;
L add[N];
L edgecost(int a){
    L ret=add[a]+add[par[a]]+cst[a];
    return ret%k ? ret : 0;
}
  
int pos[N];
int hl_par[N];
  
L bit[N];
L sum(int i){
    L ret=0;
    while(i){
        ret+=bit[i];
        i-=i&-i;
    }
    return ret;
}
void set(int i, L x){
    x-=sum(i+1)-sum(i);
    i++;
    while(i<N){
        bit[i]+=x;
        i+=i&-i;
    }
}
  
L cost(int a, int b){
    int p=hl_par[a], q=hl_par[b];
    if(p==q) return abs(sum(pos[a])-sum(pos[b]));
    if(dep[p]<dep[q]){
        swap(p, q);
        swap(a, b);
    }
    return sum(pos[a]) - sum(pos[p])
        + edgecost(p) + cost(par[p], b);
}
  
int main(){
    int n;
    cin >> n >> k;
    for(int i=0; i<n-1; i++){
        int a, b;
        L c;
        cin >> a >> b >> c;
        path[a].push_back(make_pair(b, c));
        path[b].push_back(make_pair(a, c));
    }
    for(int i=0; i<n; i++) hev[i]=0;
    par[0]=dep[0]=cst[0]=0;
    dfs(0);
  
    for(int i=0; i<n; i++) add[i]=0;
  
    int cnt=0;
    for(int i=0; i<n; i++){
        if(i && hev[par[i]]==i) continue;
        int j=i;
        do{
            pos[j]=cnt++;
            hl_par[j]=i;
        }while(j=hev[j]);
    }
 
    for(int i=0; i<N; i++) bit[i]=0;
    for(int i=0; i<n; i++)
        set(pos[i], edgecost(hev[i]));
      
    int q;
    cin >> q;
    for(int i=0; i<q; i++){
        string s;
        L a, b;
        cin >> s >> a >> b;
        if(s[0]=='a'){
            add[a]+=b;
            set(pos[a], edgecost(hev[a]));
            if(a) set(pos[a]-1, edgecost(a));
        }else{
            cout << cost(a, b) << endl;
        }
    }
}

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

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

using namespace std;
using ll = long long;

void solve();

int main(void){
    ll N;
    cin >> N;
    cout << N*(N-1)/2 << endl;
    return 0;
}

void solve(){}

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

int main(){
  string a,b;
  cin >> a >> b;
  string s=a+b;
  int n;
  n=stoi(s);
  double x;
  int y;
  x=sqrt(n);
  y=sqrt(n);
  if(y==x){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  
}

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

#define pb push_back
#define sz(X) ((int)(X).size())
#define all(X) (X).begin(),(X).end()
#define ll long long
#define pi pair<int,int>
const int N=3e5+5,MOD=1e9+7;

using namespace std;

string a;
int main()
{
	//freopen("tst.txt","r",stdin);
	ios::sync_with_stdio(0);
	cin.tie(0);

	cin>>a;

	int last = a[0]-'0';
	int ans = 0;
	for(int i=1;i<sz(a);i++){
		if((a[i]-'0')==last){
			ans++;
		}
		last=!last;
	}

	last = !(a[0]-'0');
	int curr = 1;

	for(int i=1;i<sz(a);i++){
		if((a[i]-'0')==last){
			curr++;
		}
		last=!last;
	}

	cout<<min(ans,curr)<<"\n";

 
}

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

int n, s, a[2005];
int main() {
	int i, j, k;
	cin >> n;
	for(i=0; i<n; i++) cin >> a[i];
	sort(a, a+n);
	for(i=0; i<n; i++) for(j=i+1, k=j+1; j<n; j++) {
		for(; k<n && a[i] + a[j] > a[k]; k++);
		s += k-1-j;
	}
	cout << s;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long mod = 1e9 + 7;
long long bigmod(long long a, long long p){
    if(p == 0){
        return 1;
    }
    long long ans = bigmod(a, p/2);
    ans = (ans * ans) % mod;
    if(p % 2 == 1){
        ans = (ans * a) % mod;
    }
    return ans;
}
int main(){
    long long n, k;
    cin >> n >> k;
    vector<long long>gcd(k + 3);
    long long ans = 0;
    for(long long i = k; i >= 1; i--){
        gcd[i] = bigmod(k / i, n);
        for(int j = 2 * i; j <= k; j = j + i){
            gcd[i] = (gcd[i] - gcd[j] + mod) % mod;
        }
        ans = (ans + i * gcd[i]) % mod;
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 4036
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    int N;
    cin >> N;
    
    for(int i=1;i<=9;i++){
        for(int j=1;j<=9;j++){
            if(i*j == N){
                cout << "Yes" << endl;
                return 0;
            }
        }
    }

    cout << "No" << endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
// header {{{
#define all(x) std::begin(x), std::end(x)
#define rall(x) std::rbegin(x), std::rend(x)
#define rep(i, begin, end) for (std::make_signed_t<std::remove_cv_t<decltype(end)>> i = (begin), i##_end = (end); i < i##_end; ++i)
#define repc(i, begin, last) for (std::make_signed_t<std::remove_cv_t<decltype(end)>> i = (begin), i##_last = (last); i <= i##_last; ++i)
#define repr(i, begin, last) for (std::make_signed_t<std::remove_cv_t<decltype(end)>> i = (begin), i##_last = (last); i >= i##_last; --i)
#define let const auto
using i64 = std::int64_t;
using u64 = std::uint64_t;
constexpr std::int32_t INF = 0x3f3f3f3f;
constexpr std::int64_t LINF = 0x3f3f3f3f3f3f3f3fLL;

template <class Container, class = typename Container::value_type, std::enable_if_t<!std::is_same_v<Container, std::string>, std::nullptr_t> = nullptr>
std::istream& operator>>(std::istream& is, Container& v) {
    for (auto& e : v) is >> e;
    return is;
}

template <class Container, class = typename Container::value_type, std::enable_if_t<!std::is_same_v<Container, std::string>, std::nullptr_t> = nullptr>
std::ostream& operator<<(std::ostream& os, const Container& v) {
    for (auto it = std::begin(v); it != std::end(v); ++it) os << &" "[it == std::begin(v)] << *it;
    return os;
}

template <class T>
std::istream& operator,(std::istream& is, T& rhs) {
    return is >> rhs;
}

#define var(type, ...) \
    type __VA_ARGS__;  \
    std::cin >> __VA_ARGS__

inline void println() {
    std::cout << '\n';
}
template <class Head, class... Tail>
inline void println(Head&& head, Tail&&... tail) {
    std::cout << head << &" "[!sizeof...(tail)];
    println(std::forward<Tail>(tail)...);
}

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

template <class T, class U>
inline bool chmax(T& a, const U& b) {
    return b > a && (a = b, true);
}
// }}}

using namespace std;

int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << std::fixed << std::setprecision(12);

    var(i64, N);

    i64 ans = 0;
    for (i64 a = 1; a <= N; ++a) {
        for (i64 b = 1; b <= N; ++b) {
            if (N - a * b < 1) break;
            ++ans;
        }
    }

    println(ans);

    return 0;
}



Measured memory_bytes: 3476
n,d = map(int, input().split())
X = []
for _ in range(n):
    _x = list(map(int, input().split()))
    X.append(_x)

from itertools import combinations
import numpy as np

ans = 0
for (x1, x2) in combinations(X, 2):
    a = 0
    for i in range(d):
        a += (x1[i]-x2[i])**2 
    a = np.sqrt(a)
    if a.is_integer():
        ans += 1

print(ans)


Measured memory_bytes: 13244
class UnionFind
    def initialize(n)
        @have_node_num = Array.new(n, -1)
    end
    def findSet(x)
        return x if @have_node_num[x] < 0
        @have_node_num[x] = findSet(@have_node_num[x])
        return @have_node_num[x]
    end
    def link(x, y)
        return if x == y
        x, y = y, x if @have_node_num[x] > @have_node_num[y]
        @have_node_num[x] += @have_node_num[y]
        @have_node_num[y] = x
    end
    def unite(x, y)
        link(findSet(x), findSet(y))
    end
    def size(idx)
        return -@have_node_num[findSet(idx)]
    end
    def get_node()
        return @have_node_num
    end
end
 
n, m = gets.chomp.split.map(&:to_i)
uf = UnionFind.new(n)
ans = 0
m.times do
    a, b = gets.chomp.split.map(&:to_i)
    uf.unite(a-1, b-1)
end
n.times do |i|
    tmp = uf.size(i)
    ans = tmp > ans ? tmp : ans
end
puts ans

Measured memory_bytes: 15872
n,q = map(int,input().split())
s = list(input())

#a[i]:s[0]~s[i]までに何個ACがあったか
a = [0]*n
#end[i]:s[i]がACの'C'か
end = [False]*n
for i in range(1,n):
    if s[i] == 'C' and s[i-1] == 'A':
        a[i] = a[i-1]+1
        end[i] = True
    else:
        a[i] = a[i-1]
for i in range(q):
    L,R = map(int,input().split())
    L,R = L-1,R-1
    if L == 0:
        print(a[R])
    else:
        if end[L]:
            print(a[R]-a[L-1]-1)
        else:
            print(a[R]-a[L-1])

Measured memory_bytes: 7644
#include<stdio.h>
#include<string.h>

int main(void){
	int i,j,hit,blow;
	char r[5],a[5];
	
	while(scanf("%s %s",r,a)){
		if(r[0]=='0'&&a[0]=='0')
		break;
		hit = 0;
		blow = 0;
		for(i=0;i<4;i++){
			if(r[i]==a[i])
			hit++;
			else{
				for(j=0;j<4;j++){
					if(i!=j&&r[i]==a[j])
					blow++;
				}
			}
		}
		printf("%d %d\n",hit,blow);
	}
	return 0;
}

Measured memory_bytes: 540
#include<bits/stdc++.h>
typedef long long int ll;
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define p push
#define p1 pop
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define pi pair<ll,ll>
#define e 1000000007
using namespace std;
int main(){
    ll n,k;cin>>n>>k;
    ll dp[k+1],a[n];
    for(int i=0;i<n;++i)
        cin>>a[i];
    memset(dp,0,sizeof(dp));
    for(int i=1;i<=k;++i)
    {
        for(int j=0;j<n;++j)
        {
            if((i-a[j])>=0)
                dp[i]=(dp[i]||(!dp[i-a[j]]));
        }
    }
    if(dp[k])
        cout<<"First";
    else
        cout<<"Second";
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long
 

int32_t main()
{
    IOS;

    int m1,d1,m2,d2;
    cin >> m1 >> d1 >> m2 >> d2;
    if(d2 - d1 < 0)
    	cout << 1;
    else
    	cout << 0;
    return 0;
}

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

int main()
{
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	ll n,a,b;
	cin>>n>>a>>b;
	ll x=n/(a+b);
	ll y=n%(a+b);
	cout<<x*a+min(a,y)<<"\n";
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
 
using namespace std;
 
int main(){
char c;
cin >> c;
if(c=='a' || c=='i' || c== 'u' || c== 'e' || c== 'o'){
cout << "vowel" << endl;
}else{
cout << "consonant" << endl;
}
return 0;
}

Measured memory_bytes: 256
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
//                       _oo0oo_                         //
//                      o8888888o                        //
//                      88" . "88      ------ hzt1       //
//                      (| -_- |)                        //
//                      0\  =  /0                        //
//                    ___/`---'\___                      //
//                  .' \|     |// '.                     //
//                 / \|||  :  |||// \                    //
//                / _||||| -:- |||||- \                  //
//               |   | \  -  /// |     |                 //
//               | \_|  ''\---/''  |_/ |                 //
//               \  .-\__  '-'  ___/-. /                 //
//             ___'. .'  /--.--\  `. .'___               //
//          ."" '<  `.___\_<|>_/___.' >' "".             //
//         | | :  `- \`.;`\ _ /`;.`/ - ` : | |           //
//         \  \ `_.   \_ __\ /__ _/   .-` /  /           //
//     =====`-.____`.___ \_____/___.-`___.-'=====        //
//                       `=---='                         //
//                                                       //
//                                                       //
//     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~       //
//                                                       //
//                 God-He Bless All.                     //
//           This Code Will Never Explode.               //
//                                                       //
//                                                       //
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
#include<cstdio>
#include<cstring>
#include<cctype>
#include<algorithm>
#include<vector>
#define pb push_back
#define mp make_pair
#define xx first
#define yy second
#define rep(i,a,b) for(int i=(a),i##_end_=(b);i<=i##_end_;i++)
#define dwn(i,a,b) for(int i=(a),i##_end_=(b);i>=i##_end_;i--)
using namespace std;
const int Size=1<<16;
char buffer[Size],*head,*tail;
inline char Getchar() {
    if(head==tail) {
        int l=fread(buffer,1,Size,stdin);
        tail=(head=buffer)+l;
    }
    if(head==tail) return -1;
    return *head++;
}
inline int read() {
    int x=0,f=1;char c=Getchar();
    for(;!isdigit(c);c=Getchar()) if(c=='-') f=-1;
    for(;isdigit(c);c=Getchar()) x=x*10+c-'0';
    return x*f;
}
typedef long long ll;
typedef pair<int,int> pii;
const int maxn=100010;
int n,e,first[maxn],to[maxn<<1],nxt[maxn<<1];
void AddEdge(int u,int v) {
	to[++e]=v;nxt[e]=first[u];first[u]=e;
	to[++e]=u;nxt[e]=first[v];first[v]=e;
}
int f[maxn],ans;
void dp(int x,int fa) {
	int g=0;
	for(int i=first[x];i;i=nxt[i]) if(to[i]!=fa) {
		dp(to[i],x);
		g|=f[x]&f[to[i]];
		f[x]|=f[to[i]];
	}
	int j=0;
	while((1<<j)<g||(f[x]>>j&1)) j++;
	ans=max(ans,j);
	f[x]=((f[x]>>j)<<j)|(1<<j);
}
int main() {
	n=read();
	rep(i,2,n) AddEdge(read(),read());
	dp(1,0);
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 6016
n = int(input())
abc = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
res = []
ans = ''
while n:
    res.append((n-1)%26)
    n = (n-1)//26

#print(res[::-1])


for i in range(len(res)):
    ans += abc[res[i]]

print(ans[::-1])

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

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ll n; cin >> n;
  ll ans = 0;
  for (ll i = 2; i <= n; i++) {
    ll count = 0;
    bool sd = 0;
    while (n%i == 0) {
      n/=i;
      count++;
      sd=1;
    }
    ll tmp=0;
    for (int j = 1; count >= j; j++) {
      count -= j;
      tmp++;
    }
    ans += tmp;
    if (!sd && i > (ll)sqrt(n)) {
      ans++;
      break;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 3700
#include <cstdio>
#include <vector>
#include <queue>
using namespace std;

int main()
{
  int n, m, v1, v2;
  scanf("%d%d", &n, &m);
  vector<int> v[100000];

  for (int i = 0; i < m; i++)
  {
    scanf("%d%d", &v1, &v2);
    v[v1].push_back(v2);
    v[v2].push_back(v1);
  }

  int group[n];
  for (int i = 0; i < n; i++)
    group[i] = -1;

  for (int i = 0, id = 0; i < n; i++, id++)
  {
    queue<int> que;
    if (group[i] == -1)
      que.push(i);
    while (!que.empty())
    {
      int x = que.front();
      que.pop();
      group[x] = id;
      for (int j = 0; j < v[x].size(); j++)
        if (group[v[x][j]] == -1)
          que.push(v[x][j]);
    }
  }

  int q;
  scanf("%d", &q);

  for (int i = 0; i < q; i++)
  {
    scanf("%d%d", &v1, &v2);
    if (group[v1] != -1 && group[v1] == group[v2])
      printf("yes\n");
    else
      printf("no\n");
  }

  return 0;
}

Measured memory_bytes: 8472
# https://atcoder.jp/contests/abc149/submissions/9213312

N, K = map(int, input().split())
R, S, P = map(int, input().split())
T = input()

win_pt = {"r": P, "s": R, "p": S}
pt = [0] * N

for i, t in enumerate(T):
    if i < K:
        pt[i] = win_pt[t]
    elif i >= K and (T[i - K] != T[i] or pt[i - K] == 0):
        pt[i] = win_pt[t]
print(sum(pt))


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

using namespace std;

int n, k, check[111];

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	
	cin >> n >> k;
	for (int i = 0; i < k; i++) {
		int d;
		cin >> d;
		for (int i = 0; i < d; i++) {
			int temp;
			cin >> temp;
			check[temp]++;
		}
	}
	int answer = 0;
	for (int i = 1; i <= n; i++) {
		if (!check[i]) answer++;
	}
	cout << answer;
	return 0;
}

Measured memory_bytes: 3604
import itertools
n, m, k = map(int, input().split())
a = [0] + list(map(int, input().split()))
b = [0] + list(map(int, input().split()))

sa = list(itertools.accumulate(a))
sb = list(itertools.accumulate(b))

output = 0
j = m
for i in range(n + 1):
    if sa[i] > k:
        break
    while sa[i] + sb[j] > k:
        j -= 1
    if output < i + j:
        output = i + j
print(output)

Measured memory_bytes: 135720