akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
//using System.Text;
//using System.Text.RegularExpressions;
//using System.Globalization;
//using System.Diagnostics;
using static System.Console;
//using System.Numerics;
//using static System.Math;
//using pair = Pair<int, int>;

class Program
{
    static void Main()
    {
        //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
        new Program().solve();
        Out.Flush();
    }
    Scanner cin = new Scanner();
    readonly int[] dd = { 0, 1, 0, -1, 0 }; //→↓←↑
    readonly int mod = 1000000007;
    void chmax<T>(ref T a, T b) where T : IComparable<T> { a = a.CompareTo(b) < 0 ? b : a; }
    void chmin<T>(ref T a, T b) where T : IComparable<T> { a = a.CompareTo(b) < 0 ? a : b; }

    void solve()
    {
        eratos(55555);
        //var B = new int[5];
        //foreach (var item in prime)
        //{
        //    B[item % 5]++;
        //}

        int N = cin.nextint;
        WriteLine(string.Join(" ", prime.Where(i => i % 5 == 2).Take(N)));
    }

    List<int> prime;
    bool[] is_prime;
    void eratos(int n)
    {
        prime = new List<int>();
        is_prime = new bool[n + 1];
        for (int i = 0; i <= n; i++) is_prime[i] = true;
        is_prime[0] = is_prime[1] = false;
        for (int i = 0; i <= n; i++)
        {
            if (is_prime[i])
            {
                prime.Add(i);
                for (int j = 2 * i; j <= n; j += i) is_prime[j] = false;
            }
        }
    }
    int[] P;
    void phi(int n)
    {
        P = new int[n + 1];
        for (int i = 0; i <= n; i++) P[i] = i;
        for (int i = 2; i <= n; i++)
        {
            if (is_prime[i])
            {
                P[i] -= P[i] / i;
                for (int j = 2 * i; j <= n; j += i) P[j] -= P[j] / i;
            }
        }
    }
}

class Scanner
{
    string[] s; int i;
    char[] cs = new char[] { ' ' };
    public Scanner() { s = new string[0]; i = 0; }
    public string[] scan { get { return ReadLine().Split(); } }
    public int[] scanint { get { return Array.ConvertAll(scan, int.Parse); } }
    public long[] scanlong { get { return Array.ConvertAll(scan, long.Parse); } }
    public double[] scandouble { get { return Array.ConvertAll(scan, double.Parse); } }
    public string next
    {
        get
        {
            if (i < s.Length) return s[i++];
            string st = ReadLine();
            while (st == "") st = ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return next;
        }
    }
    public int nextint { get { return int.Parse(next); } }
    public long nextlong { get { return long.Parse(next); } }
    public double nextdouble { get { return double.Parse(next); } }
}

Measured memory_bytes: 13392
#include<iostream>
using namespace std;
long long x[100012001];
int main()
{
    long long sum=0;
    int n,a,b;
    cin>>n>>a>>b;
    for(int i=1;i<=n;i++)
        cin>>x[i];
    for(int i=2;i<=n;i++)
    {
        long long y=a*(x[i]-x[i-1]);
        if(y<b)
            sum+=y;
        else
            sum+=b;
    }
    cout<<sum;
    return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<utility>
#include<tuple>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>

using namespace std;

using ll = long long;
using pii = pair<int, int>;

#define bil ((ll)1e9)
#define mod ((ll)1e9+7)

int main(int argc,char* argv[]){
    int x,n;
    cin >> x >> n;
    
    vector<bool> checked(102,false);
    vector<int> p(n);
    for(auto i:p){
        cin >> i;
        checked.at(i)=true;
    }
    
    pii ans(999,-1);
    for(int i = 0; i < 102; i++){
        pii a(abs(x-i),i);
        if(checked.at(i)){
            continue;
        }
        ans=min(a,ans);
    }

    cout << ans.second << endl;

    return 0;
}


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

#define int long long
#define rep(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define reps(i, n) for (int (i) = 1; (i) <= (n); (i)++)
#define rrep(i, n) for (int (i) = (n - 1); (i) >= 0; (i)--)
#define rreps(i, n) for (int (i) = (n); (i) > 0; (i)--)
typedef vector<int> vint;
typedef pair<int, int> pint;
const double PI = 3.141592653589793238462643383279;
const int DY[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int DX[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
template<typename T, typename U> inline bool chmax(T &a, const U &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> inline bool chmin(T &a, const U &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
struct Init {
    Init() {
        cout << fixed << setprecision(20);
    };
} init;

int N, M;
int balls[110000];
bool red[110000];
signed main() {
    cin >> N >> M;
    fill(balls, balls + N + 1, 1);
    red[1] = 1;
    rep(i, M) {
        int x, y;
        cin >> x >> y;
        red[y] |= red[x];
        balls[x]--, balls[y]++;
        if (balls[x] == 0) { red[x] = 0; }
    }
    int ans = 0;
    reps(i, N) {
        ans += red[i];
    }
    cout << ans << endl;
}

Measured memory_bytes: 1152
#include "bits/stdc++.h"
#include "ext/pb_ds/assoc_container.hpp"
#include "ext/pb_ds/tree_policy.hpp"

using namespace std;
using namespace __gnu_pbds;


#define ll long long int
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(a) a.begin(),a.end()

typedef tree <ll, null_type, less <ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
// order_of_key(val): returns the number of values less than val
// find_by_order(k): returns an iterator to the kth largest element (0-based)

int main(void)
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n, i, ans = 1e18, req;
    cin>>n;
    req = n / 2;
    vector<ll> v(n);
    vector<pair<ll, ll>> v1, v2;
    vector<ll> freq1(100001, 0), freq2(100001, 0);
    for(i = 0; i < n; i++) {
    	cin>>v[i];
    	if(i & 1) {
    		freq1[v[i]]++;
    	} else {
    		freq2[v[i]]++;
    	}
    }
    for(i = 0; i < 100001; i++) {
    	if(freq1[i]) {
    		v1.pb(mp(freq1[i], i));
    	}
    	if(freq2[i]) {
    		v2.pb(mp(freq2[i], i));
    	}
    }
    sort(v1.rbegin(), v1.rend());
    sort(v2.rbegin(), v2.rend());
    // cout<<v1.size()<<" "<<v2.size()<<endl;
    if(v1.size() == 1 && v2.size() == 1) {
    	if(v1[0].ss == v2[0].ss) {
    		ans = req + min(req - v1[0].ff, req - v2[0].ff);
    	} else {
    		ans = req - v1[0].ff + req - v2[0].ff;
    	}
    } else if(v1.size() == 1) {
    	if(v1[0].ss == v2[0].ss) {
    		ans = min(req - v1[0].ff + req - v2[1].ff, req + req - v2[0].ff);
    	} else {
    		ans = req - v1[0].ff + req - v2[0].ff;
    	}
    } else if(v2.size() == 1) {
    	if(v1[0].ss == v2[0].ss) {
    		ans = min(req - v2[0].ff + req - v1[1].ff, req + req - v1[0].ff);
    	} else {
    		ans = req - v1[0].ff + req - v2[0].ff;
    	}
    } else {
    	if(v1[0].ss == v2[0].ss) {
    		ans = min(req - v1[0].ff + req - v2[1].ff, req - v1[1].ff + req - v2[0].ff);
    	} else {
    		ans = req - v1[0].ff + req - v2[0].ff;
    	}
    }
    cout<<ans<<"\n";

}

Measured memory_bytes: 4340
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define bit(x) (1L << (x))
using ll = long long;
using namespace std;

template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
 
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}

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

  function<ll(ll)> f = [](ll x){
    if(x < 0) return 0LL;

    switch (x % 4){
      case 0: return x;
      case 1: return x ^ (x-1);
      case 2: return x ^ 1;
      case 3: return 0LL;
    }  
  };

  cout << (f(a-1) ^ f(b)) << endl;

  return 0;
}


Measured memory_bytes: 256
import java.util.*;
import java.io.*;
import java.math.*;
 
 
import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
 
public class Main{
    static final long mod=1000000007;
    
    public  static void main(String[] args)   throws Exception, IOException{
        Reader sc = new Reader(System.in);
        PrintWriter out=new PrintWriter(System.out);
        // int n=sc.nextInt();
        // char c[][] = new char[h][w];
        // char c[]=sc.nextString().toCharArray();
        // for(int i=0; i<n; i++) {d[i]=sc.nextInt();}
        int n=sc.nextInt();
        int time = 0,x=0,y=0,s=0;
        String ans="Yes";
        for(int i=0; i<n; i++) {
            int t=sc.nextInt();
            int xx=sc.nextInt();
            int yy=sc.nextInt();
            s = abs(x-xx)+abs(y-yy);
            if(s<=t-time && (t-time-s)%2==0) continue;
            else {ans="No";}
        }


        out.println(ans);
        out.flush();
    }
    
    static void db(Object... os){
        System.err.println(Arrays.deepToString(os));
    }
     
    static boolean validpos(int x,int y,int r, int c){
        return x<r && 0<=x && y<c && 0<=y;
    }
    
    static boolean bit(long x,int k){
        // weather k-th bit (from right) be one or zero
        return  ( 0 < ( (x>>k) & 1 )  )  ? true:false;
    }    
}

class P implements Comparable<P>{
        int id, d;
        P(int  id, int d) {
            this.id=id;
            this.d=d;
        } 
          
        public int compareTo(P p){
            return d-p.d; //descend
        }
    }

class Reader
{ 
    private BufferedReader x;
    private StringTokenizer st;
    
    public Reader(InputStream in)
    {
        x = new BufferedReader(new InputStreamReader(in));
        st = null;
    }
    public String nextString() throws IOException
    {
        while( st==null || !st.hasMoreTokens() )
            st = new StringTokenizer(x.readLine());
        return st.nextToken();
    }
    public int nextInt() throws IOException
    {
        return Integer.parseInt(nextString());
    }
    public long nextLong() throws IOException
    {
        return Long.parseLong(nextString());
    }
    public double nextDouble() throws IOException
    {
        return Double.parseDouble(nextString());
    }
}

Measured memory_bytes: 41296
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <set>
#include <algorithm>
// #include <cmath>
// #include <math.h>
using namespace std;

int main(){
    int W, H, N;
    cin >> W >> H >> N;
    int x, y, a;
    int maxx = W;
    int minx = 0;
    int maxy = H;
    int miny = 0;
    for (int i=0; i<N; ++i){
        cin >> x >> y >> a;
        if (a == 1){
            if (minx < x) minx = x;
        } else if (a == 2){
            if (maxx > x) maxx = x;
        } else if (a == 3){
            if (miny < y) miny = y;
        } else if (a == 4){
            if (maxy > y) maxy = y;
        }
    }
    int dx = (maxx - minx);
    if (dx < 0) dx = 0;
    int dy = (maxy - miny);
    if (dy < 0) dy = 0;
    cout << dx * dy << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int H,W;
  cin>>H>>W;
  vector<vector<char>> a(H,vector<char>(W));
  vector<char> b(W+2,'#');
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++)
      cin>>a.at(i).at(j);
  }
  for(int i=0;i<W+2;i++)
    cout<<b.at(i);
  cout<<endl;
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      if(j==0)
        cout<<'#';
      cout<<a.at(i).at(j);
      if(j==W-1)
        cout<<'#'<<endl;
    }
    
  }
   for(int i=0;i<W+2;i++)
    cout<<b.at(i);
}

Measured memory_bytes: 3628
#include <vector>
#include <functional>

template <typename T>
class func_sum
{
private:
    std::vector<std::vector<T>> sum_table;
protected:
    virtual T acc_sum(int i, int j);
public:
    func_sum(std::function<T(int, int)> func, int nx, int ny) ;
    ~func_sum();

    T calc_section_sum(int px, int qx, int py, int qy);
};

template <typename T>
T func_sum<T>::acc_sum(int i, int j) {
    return sum_table[i][j];
};

template <typename T>
func_sum<T>::~func_sum() {}

template <typename T>
func_sum<T>::func_sum(std::function<T(int, int)> func, int nx, int ny) {
    sum_table = std::vector<std::vector<T>>(nx + 1, std::vector<T>(ny + 1, T()));
    //j=0の場合の総和の計算
    for (int i = 1; i <= nx; i++) {
        sum_table[i][0] += func(i - 1, 0);
    }
    //i=0の場合の総和の計算
    for (int j = 1; j <= ny; j++) {
        sum_table[0][j] += func(0, j - 1);
    }
    //総和の計算
    for (int i = 1; i <= nx; i++) {
        for (int j = 1; j <= ny; j++) {
            sum_table[i][j] += func(i - 1, j - 1) +
                sum_table[i - 1][j] +
                sum_table[i][j - 1] -
                sum_table[i - 1][j - 1];

        }
    }
}

template <typename T>
T func_sum<T>::calc_section_sum(int px, int qx, int py, int qy) {
    return acc_sum(qx, qy) - 
           acc_sum(qx, py - 1) - 
           acc_sum(px - 1, qy) + 
           acc_sum(px - 1, py - 1);
}

#include <vector>
#include <iostream>

int main()
{
    int N, M, Q;
    std::cin >> N >> M >> Q;
    std::vector<std::vector<int>> table(N, std::vector<int>(N, 0));
    for (int i = 0; i < M; i++) {
        int L, R;
        std::cin >> L >> R;
        table[L - 1][R - 1]++;
    }

    auto func = [](int i, int j,
        const std::vector<std::vector<int>>& table) { return table[i][j]; };

    std::function<int(int, int)>  func_curried = std::bind(func,
        std::placeholders::_1,
        std::placeholders::_2,
        table);

    func_sum<int> ds(func_curried, N, N);

    for (int i = 0; i < Q; i++) {
        int p, q;
        std::cin >> p >> q;
        std::cout << ds.calc_section_sum(p, q, p, q) << std::endl;
    }
    return 0;
}




Measured memory_bytes: 4864
#include <bits/stdc++.h>
using namespace std;
#define rep(i, s, e) for (int i = s; i < e; ++i)
#define sort_(a) stable_sort(a.begin(), a.end())
#define rsort(a) stable_sort(a.rbegin(), a.rend())
#define sum(a) accumulate(a.begin(), a.end(), 0LL)
#define join(a, d) accumulate(a.begin() + 1, a.end(), a[0], [](string s, string t) {return s + d + t;})
#define all(a) a.begin(), a.end()
#define __lcm(a, b) std::__detail::__lcm(a, b)
typedef long long ll;
const long MOD = 1e9 + 7;

template<int MOD> struct Fp {
    long long val;
    constexpr Fp(long long v = 0) noexcept : val(v % MOD) {
        if (val < 0) val += MOD;
    }
    constexpr int getmod() { return MOD; }
    constexpr Fp operator - () const noexcept {
        return val ? MOD - val : 0;
    }
    constexpr Fp operator + (const Fp& r) const noexcept { return Fp(*this) += r; }
    constexpr Fp operator - (const Fp& r) const noexcept { return Fp(*this) -= r; }
    constexpr Fp operator * (const Fp& r) const noexcept { return Fp(*this) *= r; }
    constexpr Fp operator / (const Fp& r) const noexcept { return Fp(*this) /= r; }
    constexpr Fp& operator += (const Fp& r) noexcept {
        val += r.val;
        if (val >= MOD) val -= MOD;
        return *this;
    }
    constexpr Fp& operator -= (const Fp& r) noexcept {
        val -= r.val;
        if (val < 0) val += MOD;
        return *this;
    }
    constexpr Fp& operator *= (const Fp& r) noexcept {
        val = val * r.val % MOD;
        return *this;
    }
    constexpr Fp& operator /= (const Fp& r) noexcept {
        long long a = r.val, b = MOD, u = 1, v = 0;
        while (b) {
            long long t = a / b;
            a -= t * b; swap(a, b);
            u -= t * v; swap(u, v);
        }
        val = val * u % MOD;
        if (val < 0) val += MOD;
        return *this;
    }
    constexpr bool operator == (const Fp& r) const noexcept {
        return this->val == r.val;
    }
    constexpr bool operator != (const Fp& r) const noexcept {
        return this->val != r.val;
    }
    friend constexpr ostream& operator << (ostream &os, const Fp<MOD>& x) noexcept {
        return os << x.val;
    }
    friend constexpr Fp<MOD> modpow(const Fp<MOD> &a, long long n) noexcept {
        if (n == 0) return 1;
        auto t = modpow(a, n / 2);
        t = t * t;
        if (n & 1) t = t * a;
        return t;
    }
};
using mint = Fp<MOD>;

int main(void) {
#ifdef DEBUG
  freopen("input.txt", "r", stdin);
#endif

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

  int N;
  cin >> N;
  mint ans = 1;
  rep(i, 1, N + 1) {
    ans *= i;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

#include <bits/stdc++.h>
using namespace std;

int main(){
  int a,b;
  cin>>a>>b;
  
  if(a%2==1 && b%2==1) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;

  return 0;
}

Measured memory_bytes: 3632
import java.util.*;
import java.io.*;
import java.lang.*;
import java.math.BigInteger;

public class Main {

    public static void main(String[] args) {
        try {
            InputReader in;
            PrintWriter out;
            boolean useOutput = false;
            // if (System.getProperty("ONLINE_JUDGE") == null) useOutput = true;
            if (useOutput) {
                FileInputStream fin = new FileInputStream(new File("src/testdata.in"));
                in = new InputReader(fin);
                FileOutputStream fout = new FileOutputStream(new File("src/testData.out"));
                out = new PrintWriter(fout);
            } else {
                InputStream inputStream = System.in;
                in = new InputReader(inputStream);
                OutputStream outputStream = System.out;
                out = new PrintWriter(outputStream);
            }
            Solver solver = new Solver();
            solver.solve(in, out);
            out.close();
            // fin.close();
            // fout.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    static class Solver
    {

        public void solve (InputReader cin, PrintWriter cout)
        {
            try {
                int n = cin.nextInt();
                boolean cando = false;
                for (int i = 0; i < 26; ++i) {
                    for (int j = 0; j < 15; ++j) {
                        int ret = 4 * i + 7 * j;
                        if (ret == n) cando = true;
                    }
                }
                if (cando) {
                    cout.println("Yes");
                } else {
                    cout.println("No");
                }
            } catch (RuntimeException e) {
                e.printStackTrace();
                return;
            } catch (Exception e) {
                e.printStackTrace();
                return;
            }

        }
    }

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

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
            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 int nextInt() {
            return Integer.parseInt(next());
        }

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

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

    }

}

Measured memory_bytes: 23252
#include <stdio.h>

int main()
{
    int a, b;

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

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

    return 0;
}



Measured memory_bytes: 2132
#include <bits/stdc++.h>
#define SORT(x) sort(x.begin(),x.end())
#define ALL(x) x.begin(),x.end()
#define deb(x) cout<<#x<<"="<<x<<endl
#define rep(i, n) for(int i = 0; i < n; i++)
#define reps(i, m, n) for(int i = m; i < n; i++)
#define repr(i, m, n) for(int i = m; i >= n; i--)
#define INF 1000000007
#define PI (acos(-1))
#define MOD 1000000007
using namespace std;
typedef long long ll;


void Main(){

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

  int ax[N],ay[N],bx[M],by[M];

  rep(i,N){
    cin>>ax[i]>>ay[i];
  }
  rep(j,M){
    cin>>bx[j]>>by[j];
  }


  rep(i,N){
    int ma=INF;
    int ans;
    rep(j,M){
      if(ma>abs(ax[i]-bx[j])+abs(ay[i]-by[j])){
        ans=j;
        ma=abs(ax[i]-bx[j])+abs(ay[i]-by[j]);
      };
    }
    cout<< ++ans<<"\n";
  }


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


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <ctype.h>
#include <math.h>
#include <stack>
#include <string>
#include <string.h>
using namespace std;
double PI = 3.1415926535897932;
long mod = 1000000007;

const long INF = 1e9 + 1;

int main() {
  string s;
  cin >> s;

  if(s == "Sunny")
    cout << "Cloudy" << endl;
  else if(s == "Cloudy")
    cout << "Rainy" << endl;
  else cout << "Sunny" << endl;
}


Measured memory_bytes: 3636
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
typedef long long ll;

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    vector <ll> array(n); rep(i,n)cin>>array[i];
    vector <ll> lgcd(n+1,0); rep(i,n) lgcd[i+1] = gcd(lgcd[i], array[i]);
    vector <ll> rgcd(n+1,0); rep(i,n) rgcd[i+1] = gcd(rgcd[i], array[n-i-1]);
    //for(auto x : lgcd) cout << x << endl;
    ll ans = -INF;
    for(int i = 1; i <= n; ++i){
        ll tmp_gcd = gcd(lgcd[i-1], rgcd[n-i]);
        ans = max(ans, tmp_gcd);
    }
    cout << ans << endl; return 0;
}


Measured memory_bytes: 2560
import sys
input = sys.stdin.readline
class UnionFind:
  def __init__(self,nodes):
    self.parents={node: node for node in nodes}
  def root(self,x):
    if x==self.parents[x]:
      return x
    else:
      rt=self.root(self.parents[x])
      self.parents[x]=rt
      return rt
  def find(self,x,y):
    return self.root(x)==self.root(y)
  def union(self,x,y):
    self.parents[self.root(x)]=self.root(y)

n,m=map(int,input().split())
P=list(map(int,input().split()))
uf=UnionFind(range(1,n+1))
for i in range(m):
  x,y=map(int,input().split())
  uf.union(x,y)
  
ans=0
for i in range(1,n+1):
  if uf.find(i,P[i-1]):
    ans+=1
print(ans)

Measured memory_bytes: 20640
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cmath>

using namespace std;

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

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

	sort(L.begin(), L.end());

	int ans = 0;
	for (int i = 0; i < N; ++i)
	{
		for (int j = 0; j < N; ++j)
		{
			for (int k = 0; k < N; ++k)
			{
				if (0 <= i && i < j && j < k && k <= N) {
					if (L[i] != L[j] && L[j] != L[k] && L[k] != L[i]) {
						bool c1 = L[i] + L[j] > L[k];
						bool c2 = L[j] + L[k] > L[i];
						bool c3 = L[k] + L[i] > L[j];
						if (c1 && c2 && c3) {
							ans++;
						}
					}
				}
			}
		}
	}

	cout << ans;

	return 0;
}

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

const int N = 100000 + 5;
const int mod = 1000000007;

int arr[N], pos[N];
lld moni[N], cmb[2][N];
lld qPow(lld,lld);
lld C(int,int);

int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);
	int n, p, q;cin>>n;
	for(int i=1;i<=n+5;i++) moni[i]=qPow(i, mod-2);
	for(int i=0;i<=n;i++) cin>>arr[i];
	fill(pos, pos+1+n, -1);
	for(int i=0;i<=n;i++){
		if(pos[arr[i]]==-1) pos[arr[i]]=i;
		else{
			p=pos[arr[i]];
			q=i;
			break;
		}
	}
	cmb[0][0]=1;
	cmb[1][0]=1;
	for(int i=1;i<=n+1;i++){
		if(n+1-i+1 >= 1){
			cmb[0][i]=(((cmb[0][i-1]*(lld)(n+1-i+1))%mod)*moni[i])%mod;
		}
		if(n-q+p-i+1 >= 1){
			cmb[1][i]=(((cmb[1][i-1]*(lld)(n-q+p-i+1))%mod)*moni[i])%mod;
		}
	}
	for(int i=1;i<=n+1;i++){
		cout<<(cmb[0][i] - cmb[1][i-1] + mod)%mod<<'\n';
	}
	return 0;
}

lld qPow(lld a, lld b){
	lld r=1;
	while(b){
		if(b&1) r=(r*a)%mod;
		b>>=1;
		a=(a*a)%mod;
	}
	return r%mod;
}

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

using namespace std;

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

	int n,t;
	int cnt = 0;

	cin >> n;

	for(int i=1;i<=n;i++)
	{
		cin >> t;
		if(t!=i)
		{
			cnt++;
		}
	}

	if(cnt>2)
	{
		cout << "NO" << '\n';
		return 0;
	}

	cout << "YES" << '\n';
	
	return 0;
}


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

typedef long long ll;

int v[101];
ll w[101];
ll memo[2][100001];

int main(void)
{
	std::ios_base::sync_with_stdio(false);
	std::cin.tie(NULL);
	std::cout.tie(NULL);
	int n,W;
	std::cin>>n>>W;
	for(int i=1;i<=n;i++)
	std::cin>>w[i]>>v[i];
	for(int i=0;i<2;i++)
	{
		for(int V=0;V<100001;V++)
		memo[i][V] = INF;	
	}	
	memo[0][0] = 0;
	for(int i=1;i<=n;i++)
	{
		for(int V=0;V<100001;V++)
		{
			if((V - v[i]) >= 0)
			memo[1][V] = std::min(w[i] + memo[0][V-v[i]], memo[0][V]);	
			else memo[1][V] = memo[0][V];
		}
		for(int V=0;V<100001;V++)
		memo[0][V] = memo[1][V];	
	}
	int ans = 0;	
	for(int V=0;V<100001;V++)
	{
		if(memo[0][V] <= W)
		ans = std::max(ans, V);	
	}
	std::cout<<ans<<"\n";
	return 0;
}

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

#define int long long
#define IOS ios_base::sync_with_stdio(false); cin.tie(0);

int v[50], c[50];
signed main () {
	IOS;
	#ifndef ONLINE_JUDGE
	// freopen("input.txt", "r", stdin);	 
	// freopen("output.txt", "w", stdout);
	// freopen("errlog.txt", "w", stderr);
	#endif	

	int a, b, t; cin >> a >> b >> t;
	int ans = 0;
	int aa = a;
	while (a <= t) 
		ans += b, a += aa;
	cout << ans;
}	

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

int main(){
    int n;
    const ll max=1e18;
    cin >> n;
    vector<ll> a(n);
    rep(i,n){
        cin >> a[i];
        if(a[i]==0){
            cout << 0 << endl;
            return 0;
            }
    }
    ll ans=a[0];
    for(int i=1;i<n;i++){
        if(a[i] > max/ans){
            cout << -1 << endl;
            return 0;
        }else{ 
            ans *= a[i];
            }
    }
    cout << ans << endl;
}

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

int main(int argc, const char * argv[]) {
    char c;
    cin >> c;
    if(c=='a' || c== 'e' || c=='i' || c=='o' || c=='u'){
        cout << "vowel";
    }else{
        cout << "consonant";
    }
    return 0;
}

Measured memory_bytes: 256
// inputに入力データ全体が入る
function Main(input) {
    // 1行目がinput[0], 2行目がinput[1], …に入る
	input = input.split("\n");
    st = input[0].split(" ");
  

  //  s = st[1].trim();   //Sうけとり
  //  t = st[0].trim();   //Tうけとり
    
  //  var ts='';
   // ts =s+t;    //T+S  連結
    
    console.log(st[1]+st[0]);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 7500
#include <bits/stdc++.h>
#define TOP 0
#define FRONT 1
#define LEFT 2
#define RIGHT 3
#define BACK 4
#define BOTTOM 5
using namespace std;

//TOP,FRONT,LEFT,RIGHT,BACK,BOTTOM
int dice[6]={1,2,4,3,5,6};

void rotN(){
  swap(dice[TOP],dice[FRONT]);
  swap(dice[FRONT],dice[BOTTOM]);
  swap(dice[BOTTOM],dice[BACK]);
}

void rotS(){rotN(),rotN(),rotN();}


void rotE(){
  swap(dice[TOP],dice[LEFT]);
  swap(dice[LEFT],dice[BOTTOM]);
  swap(dice[BOTTOM],dice[RIGHT]);
}

void rotW(){rotE(),rotE(),rotE();}


void rotCW(){
  swap(dice[FRONT],dice[RIGHT]);
  swap(dice[RIGHT],dice[BACK]);
  swap(dice[BACK],dice[LEFT]);
}

void rotCCW(){rotCW(),rotCW(),rotCW();}


int main(){
  cin>>dice[TOP]>>dice[FRONT]>>dice[RIGHT];
  cin>>dice[LEFT]>>dice[BACK]>>dice[BOTTOM];
  
  string str;
  cin>>str;
  for(int i=0;i<str.size();i++){
    if(str[i]=='N') rotN();
    if(str[i]=='S') rotS();
    if(str[i]=='E') rotE();
    if(str[i]=='W') rotW();
  }

  cout << dice[TOP]<<endl;
  
}

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

using namespace std;
#define int long long
#define double long double
#define rep(i, n) for(int i=0;i<(n);++i)
#define INF (1ll<<60)
#define FI first
#define SE second
typedef pair<int, int> pii;
#define l_b lower_bound
#define u_b upper_bound

int H, W;
int cnt[26];

signed main() {
    cin >> H >> W;
    rep(i, H) {
        rep(j, W) {
            char a;
            cin >> a;
            cnt[a - 'a']++;
        }
    }
    int w = W;
    while (w >= 2) {
        int h = H;
        while (h > 0) {
            bool ok = false;
            if (h == 1) {
                rep(i, 26) {
                    if (cnt[i] >= 2 && cnt[i] % 4 != 0) {
                        cnt[i] -= 2;
                        ok = true;
                        break;
                    }
                }
                if (!ok) {
                    rep(i, 26) {
                        if (cnt[i] >= 2) {
                            cnt[i] -= 2;
                            ok = true;
                            break;
                        }
                    }
                }
                h--;
                if (!ok) {
                    cout << "No" << endl;
                    return 0;
                }
            } else {
                rep(i, 26) {
                    if (cnt[i] >= 4) {
                        cnt[i] -= 4;
                        ok = true;
                        break;
                    }
                }
                h -= 2;
                if (!ok) {
                    cout << "No" << endl;
                    return 0;
                }
            }
        }
        w -= 2;
    }
    if (w == 0) {
        cout << "Yes" << endl;
        return 0;
    }
    int h = H;
    while (h > 0) {
        bool ok = false;
        if (h == 1) {
            rep(i, 26) {
                if (cnt[i] >= 1) {
                    cnt[i] -= 1;
                    ok = true;
                    break;
                }
            }
            h--;
            if (!ok) {
                cout << "No" << endl;
                return 0;
            }
        } else {
            rep(i, 26) {
                if (cnt[i] >= 2) {
                    cnt[i] -= 2;
                    ok = true;
                    break;
                }
            }
            h -= 2;
            if (!ok) {
                cout << "No" << endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 256
fn run() {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    let mut it = s.trim().split_whitespace();
    let a: usize = it.next().unwrap().parse().unwrap();
    let b: usize = it.next().unwrap().parse().unwrap();
    let ans = (b - 1 + a - 2) / (a - 1);
    println!("{}", ans);
}

fn main() {
    run();
}

Measured memory_bytes: 4352
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;


int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(12);


    int n, x, t;
    cin >> n >> x >> t;

    int res = (n + x - 1) / x * t;

    cout << res << '\n';


    return 0;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
#define ll long long
#define pb push_back

using namespace std;

int main()
{
    int k;
    string s;
    cin >> k;
    cin >> s;
    if(s.size() <= k){
        cout << s;
    }
    else{
        cout << s.substr(0, k) <<"...";
    }

}


Measured memory_bytes: 3584
#include<cstdio>
#include<cstring>
#include<algorithm>
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,b,a) for(int i=b;i>=a;i--)
#define efo(i,u,v) for(int i=BB[u],v=B[BB[u]][1];i;v=B[i=B[i][0]][1])
#define mset(a,x) memset(a,x,sizeof(a))
using namespace std;
typedef long long ll;
char ch;
const int N=105,V=222,M=5e5+5,INF=1e9;
int n,m,S,T,B0,BB[V],B[M][3];
void link(int u,int v,int r1,int r2)
{
	B[++B0][1]=v,B[B0][2]=r1,B[B0][0]=BB[u],BB[u]=B0;
	if(r2!=-1) link(v,u,r2,-1);
}
int ans,h[V],vh[V];
int aug(int v=S,int flow=INF)
{
	if(v==T) return flow;
	int use=0;
	efo(i,v,u)
		if(B[i][2] && h[v]==h[u]+1)
		{
			int f=aug(u,min(B[i][2],flow-use));
			B[i][2]-=f,B[i^1][2]+=f,use+=f;
			if(use==flow) return use;
		}
	if(!--vh[h[v]]) h[S]=n+m+3;
	++vh[++h[v]];
	return use;
}
int main()
{
	scanf("%d %d\n",&n,&m);
	S=0,T=n+m+1,B0=1;
	fo(i,1,n)
	{
		fo(j,1,m)
		{
			ch=getchar();
			if(ch=='S' || ch=='T' || ch=='o')
			{
				link(i,n+j,1,1);
				if(ch=='S') link(S,i,INF,0),link(S,n+j,INF,0);
				if(ch=='T') link(i,T,INF,0),link(n+j,T,INF,0);
			}
		}
		scanf("\n");
	}
	vh[0]=n+m+2;
	while(h[S]<=n+m+2) ans+=aug();
	printf("%d",ans>=INF?-1:ans);
	return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define Khela ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ll long long int
#define llu long long unsigned int
#define pf printf
#define sf scanf
#define f first
#define s second
#define pb push_back
#define mk make_pair
#define pii pair<int ,int>
#define PII pair<ll ,ll>
 
int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1};
int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1};
int dx4[] = {0, 0, 1, -1};
int dy4[] = {1, -1, 0, 0};
 
typedef tree<pair<int,int>,null_type,less<pair<int,int>>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
int Set(int N,int pos){return N=N | (1<<pos);}
int reset(int N,int pos){return N= N & ~(1<<pos);}
bool check(int N,int pos){return (bool)(N & (1<<pos));}
const int Max=1e9+100;
const ll  MAX=1e18+500;
const int sz=1e3+10;
ll dp[55][55][105];
ll n,ara[55],k;
ll cholo(ll l,ll r,ll k){
    if(k==0) return 0;
    if(r<l){
        if(l>r) return 0;
    }

    ll &ret=dp[l][r][k];
    if(~ret)  return ret;
    ll sum=0;
    if(ara[l]>=0) sum=ara[l]+cholo(l+1,r,k-1);
    else if(ara[l]<0){
        if(k>1) sum=max(sum,cholo(l+1,r,k-2));
        sum=max(sum,ara[l]+cholo(l+1,r,k-1));
    }

    if(ara[r]>=0) sum=max(sum,ara[r]+cholo(l,r-1,k-1));
    else if(ara[r]<0){
        if(k>1) sum=max(sum,cholo(l,r-1,k-2));
        sum=max(sum,ara[r]+cholo(l,r-1,k-1));
    }

    return (ret=sum);
}
int main()
{
    Khela
    ll a,b,c,i,j,q,p,x,y,ct,ct1,m,l,r,x1,y1,mn,h,sum1,in,z,mid,mx;
    char ch;
    double d;
    string str1,str2,str;
    bool bl,bl1;
    int t,cs=1;
    while(cin>>n>>k)
    {
        for(i=0;i<n;i++)  cin>>ara[i];
        memset(dp,-1,sizeof dp);
        ll ans=cholo(0,n-1,k);
        cout<<ans<<endl;
    }




}


Measured memory_bytes: 2688
input = $<.read.split("\n")
W, H, N = input.shift.split.map(&:to_i)

min_x = 0
min_y = 0
max_x = W
max_y = H

input.each do |line|
  x, y, a = line.split.map(&:to_i)
  case a
  when 1
    min_x = [x, min_x].max
  when 2
    max_x = [x, max_x].min
  when 3
    min_y = [y, min_y].max
  when 4
    max_y = [y, max_y].min
  else
    raise
  end
end

# p [max_x, min_x, max_y, min_y]

puts [0, (max_x - min_x)].max * [0, (max_y - min_y)].max



Measured memory_bytes: 1788
XY = list(map(int, input().split()))

at = XY[0] * 4
ac = XY[0] * 2

if (at < XY[1] or ac > XY[1]):
    print("No")
    exit()
if (XY[1] % 2 == 1):
    print("No")
else:
    print("Yes")



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

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

#define int long long
#define ld long double
#define MOD 1000000007
#define mod 998244353
#define precise(i) fixed << setprecision(10) << i
#define f(i,a,b) for(int i=a;i<b;i++)

#define endl '\n'
#define debug cout<<endl;cout<<"*********************"<<endl;
#define err1(a) cout<<#a<<" "<<a<<endl;
#define err2(a,b) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<endl;
#define err3(a,b,c) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<endl;
#define err4(a,b,c,d) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<" "<<#d<<" "<<d<<endl;


#define all(a) a.begin(),a.end()
#define show(a) for(auto xyz:a)cout<<xyz<<" ";
#define maxEl(a) *max_element(a)
#define minEl(a) *min_element(a) 
#define LB lower_bound  //THIS GIVES THE ITR TO THE ELEMENT IN RANGE [SI,EI) THAT IS >= OUR VALUE 
#define UB upper_bound  //THIS GIVES THE ITR TO THE ELEMENT IN RANGE [SI,EI) THAT IS > OUR VALUE 

#define acc accumulate
#define F first
#define S second

#define MAXN 200050
#define INF 1e12

void solve(){
	int k;
	cin>>k;
	string s;
	cin>>s;
	if(s.size()<=k)cout<<s;
	else{
		string ans=s.substr(0,k)+"...";
		cout<<ans;
	}
}
signed main(){
    fastio
	int T=1;
//	cin>>T;
	while(T--){
		solve();
	}
}

Measured memory_bytes: 3572
#include<bits/stdc++.h>
#define ll long long
#define int long long int
#define MOD 1000000007
#define mkp make_pair
#define maxn 100005
#define pb push_back
#define ff first
#define ss second
#define debug1(a) cout<<a<<endl;
#define debug2(a,b) cout<<a<<' '<<b<<endl;
#define debug3(a,b,c) cout<<a<<' '<<b<<' '<<c<<endl;
#define rep(i,n) for(int i=0;i<n;i++)
#define repl(i,a,b) for(int i=a;i<b;i++)
#define pi pair<int,int>
#define pii pair<int,pi>
#define mp map<int,int>
#define ump unordered_map<int,int>
#define  vi vector<int>
#define st set<int>
#define mst multiset<int>
#define pq priority_queue
#define mpq priority_queue<int,vector<int>,greater<int> >
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define in cin>>
#define out cout<<
using namespace std;
const int infi=1e9+7;
void printVector(vector<int> v){
    for(int i=0;i<(int)v.size();i++)
        cout<<v[i]<<" ";
    out endl;
}

void printArray(int arr[],int n)
{
   for(int i=0;i<n;i++)cout<<arr[i]<<' ';
cout<<endl;
}
 set<pair<int,int>> primeset;
 vi prime_number;
void SieveOfEratosthenes(int n)
{
    bool prime[n+1];
    memset(prime, true, sizeof(prime));

    for (int p=2; p*p<=n; p++)
    {
        if (prime[p] == true)
        {
        for (int i=p*p; i<=n; i += p)
                prime[i] = false;
        }
    }
    for (int p=2; p<=n; p++)
       if (prime[p])
           primeset.insert(mkp(p,1));
}
ll modExp(ll base, ll power) {
    if (power == 0) {
        return 1;
    } else {
        ll cur = modExp(base, power / 2); cur = cur * cur; cur = cur % MOD;
        if (power % 2 == 1) cur = cur * base;
        cur = cur % MOD;
        return cur;
    }
}

int32_t main()
{
fastio;
int t=1;
//in t;
while(t--){
int arr[]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
int k;in k;
cout<<arr[k-1]<<endl;
}

    return 0;
}


Measured memory_bytes: 256
//header{{{
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
//#include<boost/multiprecision/cpp_int.hpp>
//#include<boost/math/common_factor_rt.hpp>
  
using namespace std;
//using namespace boost::multiprecision;  
//using namespace boost::math;

#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define Fixed fixed << setprecision(12)
#define int int64_t
using pii = pair<int,int>;
constexpr int INF  = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int mod1 = 1e9+7; 
constexpr int mod2 = 998244353;

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

template <class T> using min_heap = priority_queue<T,vector<T>,greater<T> >;
template <class T> using max_heap = priority_queue<T>;
template <class A, class B> using umap = unordered_map<A,B>;
  
inline int square(int a){ return a * a;}
inline int updiv(int a,int b){ return (a + b - 1) / b; }

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


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

    int n;
    cin >> n;

    int res = 0;
    reps(i,n){
        int a;
        cin >> a;
        if(i % 2 == 1 && a % 2 == 1){
            res++;
        }
    }

    cout << res << '\n';

    return 0;
}


Measured memory_bytes: 3484
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using pint = pair<int,int>;
ll mod = 1000000007,mod2 = 998244353;

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

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL<<60;
ll gcd(ll a,ll b){
    if(b == 0) return a;
    else return gcd(b,a%b);
}

bool is_prime[1000010];

int f[10010];

int main() {
    int n;
    cin >> n;
    for (int i = 1; i <= 100; ++i) {
        for (int j = 1; j <= 100; ++j) {
            for (int k = 1; k <= 100; ++k) {
                if(i*i+j*j+k*k+i*j+j*k+k*i <= 10000){
                    f[i*i+j*j+k*k+i*j+j*k+k*i]++;
                }
            }
        }
    }
    for (int i = 1; i <= n; ++i) {
        cout << f[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 3620
#include <iostream>
#include <algorithm>
using namespace std;int t;string e(int a){string ret;while(a){t=a%8;t+=(t>4)+(t>3);a/=8;ret+='0'+t;}reverse(ret.begin(),ret.end());return ret;}int main(){while(cin>>t&&t)cout <<e(t)<<endl;}

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

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

#define ld long double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

/* Some Libraries */

//-------------------------------------------------

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s; cin>>s;
    int k; cin>>k;
    vector<string> vec;
    FOR(i,1,k){
        rep(j,s.size()-i+1){
            vec.pb(s.substr(j,i));
        }
    }
    sort(all(vec));
    vec.erase(unique(all(vec)), vec.end());
    cout<<vec[k-1]<<endl;
    return 0;
}


Measured memory_bytes: 1660
#include<stdio.h>

int main(void){
    int i,n,x;
    
    scanf("%d",&n);
    for(i=1;i<=n;i++){
        x=i;
        if(x%3==0){
            printf(" %d",i);
        }else{
            while(x!=0){
                if(x%10==3){
                    printf(" %d",i);
                    break;
                }
                x/=10;
            }
        }
    }
    putchar('\n');
    return 0;
}


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

/*qsortの使い方*/
int cmp_int(const void* v1, const void* v2)
{
  const int _v1 = *((const int*)v1);
  const int _v2 = *((const int*)v2);

  if ( _v1 > _v2 ) {
    return 1;
  } else if ( _v1 < _v2 ) {
    return -1;
  } else {
    return 0;
  }
}
/*qsortの使い方*/

int main(void)
{
  int A[3];
  int ans;
  int num1, num2;
  
  scanf("%d %d %d", &A[0], &A[1], &A[2]);
  
  qsort(A, 3, sizeof(int), cmp_int);
  num1 = A[2] - A[1];
  num2 = A[1] - A[0];
  ans = num1 + num2;

  printf("%d", ans);
  
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <queue>
#include <set>
#include <stack>
#include <map>
#include <cmath>
#include <utility> // pair make_pair
#include <algorithm>
#include <iomanip>

#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,63,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define ll long long
#define int ll

using namespace std;
using Graph = vector<vector<int> >;

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

vector<double> P;

double DP[3100][3100];

signed main() {
  int N; cin >> N;
  for (int i = 0; i < N; i++) {
    double p; cin >> p;
    P.push_back(p);
  }

  memset(DP, 0, sizeof(DP));

  DP[0][0] = 1.0;

  for (int i = 1; i <= N; i++) {
    for (int j = 0; j <= i; j++) {
      if (j != 0) DP[i][j] = (1 - P[i-1]) * DP[i - 1][j] + P[i-1] * DP[i - 1][j - 1];
      else DP[i][j] = (1 - P[i - 1]) * DP[i - 1][j];
    }
  }

  double cnt = 0.0;
  for (int i = N/2 + 1; i <= N; i++) {
    cnt += DP[N][i];
  }

  cout << setprecision(12) << cnt << endl;
}


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

using namespace std;

const int OO = 1e9;
const double EPS = 1e-9;

#define ndl cout << '\n'
#define sz(v) int(v.size())
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define present(a, x) (a.find(x) != a.end())
#ifdef LOCAL
#define db(...) ({cout << "> Line " << __LINE__  \
		<< ": "; _db(#__VA_ARGS__, __VA_ARGS__);})
#define RNG() rng()
#else
#define db(...) true
#define RNG() true
#endif

template<class T>
void _db(const char *dbStr, T e) {
	cout << dbStr << " = " << e << endl;
}
template<class T, class... L>
void _db(const char *dbStr, T e, L... r) {
  while(*dbStr != ',') cout << *dbStr++;
  cout << " = " << e << ','; _db(dbStr + 1, r...);
}
template<class S, class T>
ostream& operator<<(ostream& o, const map<S, T>& v) {
	o << "["; int i = 0;
	for (const pair<S, T>& pr : v) o << (!i++ ? "" : ", ") << "{"
	<< pr.fs << " : " << pr.sc << "}"; return o << "]";
}
template<template <class, class...> class S, class T, class... L>
ostream& operator<<(ostream& o, const S<T, L...>& v) {
	o << "["; int i = 0;
	for (const auto& e : v) o << (!i++ ? "" : ", ") << e;
	return o << "]";
}
template<class S, class T>
ostream& operator<<(ostream& o, const pair<S, T>& pr) {
	return o << "(" << pr.fs << ", " << pr.sc << ")";
}
ostream& operator<<(ostream& o, const string& s) {
	for (const char& c : s) o << c;
	return o;
}

template<class T> using V = vector<T>;
template<class T> using VV = V<V<T>>;
template<class T> using VVV = VV<V<T>>;
using ll = long long;
using pii = pair<int, int>;
using vi = V<int>;
using vii = V<pii>;
using vvi = VV<int>;
using mii = map<int, int>;
using umii = unordered_map<int, int>;
using si = set<int>;
using usi = unordered_set<int>;





int main() {
	#ifdef LOCAL
	auto stTime = clock();
//	freopen("in.txt", "r", stdin);
	mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
	#endif
	ios::sync_with_stdio(false);
	cout.precision(10);
	cin.tie(0);

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

	si ac;
	mii waPen;

	for (int i = 0; i < M; ++i) {
		int p;
		string s;
		cin >> p >> s;
		if (s == "AC")
			ac.insert(p);
		else
			if (!present(ac, p))
				++waPen[p];
	}

	cout << sz(ac) << ' ';

	int ans = 0;

	for (auto& p : ac) {
		ans += waPen[p];
	}

	cout << ans << '\n';


	#ifdef LOCAL
	cout << "\n\n\nExecution time: " <<
		(clock() - stTime) * 1e3 / CLOCKS_PER_SEC << " ms" << endl;
	#endif
    return 0;
}


Measured memory_bytes: 9600