akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define FIO ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define DEBUG(x)           cout << '>' << #x << ':' << x << endl;
#define forn(i,n)          for(int i=0;i<(int)n;++i)
#define for1(i,n)          for(int i=1;i<=(int)n;++i)
#define forr(i,n)          for(int i=(int)n-1;i>=0;--i)
#define forre(i,a,b)       for(int i=(int)b;i>=(int)a;--i)
#define fore(i,a,b)        for(int i=(int)a;i<=(int)b;++i)
#define input(arr,n)       for(int i=0;i<n;i++)cin>>arr[i]
#define output(arr,n)      for(int i=0;i<n;i++)cout<<arr[i]<<" "
#define for_each(arr)      for(auto& it:arr)cout<<it<<" "
#define ff                 first
#define ss                 second
#define PI                 acos(-1.0)
#define all(a)             a.begin(),a.end()
#define rall(a)            a.rbegin(),a.rend()
#define Unique(a)          sort(all(a)),a.erase(unique(all(a)),a.end())
#define pb(x)              push_back(x)
#define eb(x)              emplace_back(x) 
#define ppb(x)             pop_back(x)
#define pf(x)              push_front(x)
#define ppf(x)             pop_front(x)
#define in(x,y)            insert({x,y})
#define Sort(a)            sort(a.begin(),a.end())
#define mem(arr,a)         memset(arr,a,sizeof arr)
#define ins(a)             insert(a)
#define max2(a,b)          max(a,b)
#define max3(a,b,c)        max(a,max(b,c))
#define max4(a,b,c,d)      max(a,max3(b,c,d))
#define min2(a,b)          min(a,b)
#define min3(a,b,c)        min(a,min(b,c))
#define min4(a,b,c,d)      min(a,min3(b,c,d))
typedef long long ll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<char> vc;
typedef vector<double> vd;
/*inline int two(int n) { return 1 << n; }
inline int test(int n, int b) { return (n>>b)&1; }
inline void Set(int & n, int b) { n |= two(b); }
inline void Reset(int & n, int b) { n &= ~two(b); }
inline int last_bit(int n) { return n & (-n); }
inline int ones(int n) { int res = 0; while(n && ++res) n-=n&(-n); return res; }*/
/*int fx1[]={+1,-1,+0,+0};
int fy1[]={+0,+0,+1,-1};
int fx2={+0,+0,+1,-1,-1,+1,-1,+1};
int fy2={-1,+1,+0,+0,+1,+1,-1,-1};
*/

ll a,b,c,n,ans,cn1,cn2,cn3,t;
string s,s1,s2;


int main()
{
    FIO;
   /* #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif*/
    cin>>a>>b;
    c=__gcd(a,b);
    ans=1;
    for(ll i=2;i*i<=c;i++){
    	if(c%i==0){
    		++ans;
    		while(c%i==0){
    			c/=i;
    		}
    	}
    }
    if(c!=1)++ans;
    cout<<ans<<endl;
    
   	
    #ifdef ONLINE_JUDGE
    cerr<<"Time elapsed: "<<1.0*clock()/CLOCKS_PER_SEC<<"s.\n";
    #endif
   return 0;
}
 


Measured memory_bytes: 256
def main():
    S = list( map( int, list( input())))
    N = len(S)
    A = [0]*2019
    Q = 2019
    now = 0
    A[0] = 1
    for i in range(N-1,-1,-1):
        now = (S[i]*pow(10,N-1-i,Q)+now)%Q
        A[now] += 1

    ans = 0
    for a in A:
        ans += a*(a-1)//2
    print(ans)
if __name__ == '__main__':
    main()


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

using ll = long long;

#define int ll

const int INF = 1e9 + 5;

int32_t main()
{
	int n;
	scanf("%lld",&n);
	vector<int> h(n);
	for(int& x : h)
	{
		scanf("%lld", &x);
	}
	vector<int> dp(n,INF);
	dp[0] = 0;
	for(int i=0;i<n;i++)
	{
		for(int j : {i + 1, i + 2})
		{
			if(j < n)
			{
				dp[j] = min(dp[j],dp[i] + abs(h[i] - h[j]));
			}
		}
	}
	printf("%lld\n",dp[n-1]);
	return 0;
}


Measured memory_bytes: 1792
#include <iostream>

using namespace std;

int main()
{
    long long a,b=0;
    cin>>a;
    for(int i=0;i<=a;i++)
    {
        if(i%3==0||i%5==0)
            b=b+0;
        else
            b=b+i;
    }
        cout<<b<<endl;
        return 0;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3f
#define EPS (1e-10)
#define MOD 1000000007
using namespace std;
typedef long long ll;
typedef pair<int,int>P;

signed main(){
	int n;scanf("%d",&n);
	set<int>se;
	rep(i,n){
		int a;cin>>a;
		se.insert(a);
	}
	cout<<se.size()<<endl;
}

Measured memory_bytes: 256
N,K,*A=map(int, open(0).read().split())
x=1
C=[None]*N
C[0]=0
c=0
while c<K:
    x=A[x-1]
    c+=1
    if C[x-1] is None:
        C[x-1]=c
    else:
        a=C[x-1]
        b=c-a
        K=(K-a)%b+a+b
        while c<K:
            x=A[x-1]
            c+=1
        break
print(x)

Measured memory_bytes: 31812
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<numeric>
#define rep(i, start, end) for (int i = (int)start; i < (int)end; ++i)
#define rrep(i, start, end) for (int i = (int)start - 1; i >= (int)end; --i)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
template<typename T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return 0;}
template<typename T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return 0;}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<ll> A(N);
    for (auto& a : A) {
        cin >> a;
    }
    ll b1 = accumulate(all(A), 0) % 2;
    ll b2 = *min_element(all(A)) % 2;
    if (N % 2) {
        if (b1) {
            cout << "First" << endl;
        }
        else {
            cout << "Second" << endl;
        }
    }
    else {
        if (b1 || b2) {
            cout << "First" << endl;
        }
        else {
            cout << "Second" << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 4412
import sys
s = int(input())

ans = 1

while True:
    if s == 1 or s == 2 or s == 4:
        ans += 3
        print (ans)
        sys.exit()
    else:
        if s%2 == 0: #偶数
            s = s//2
        else:
            s = 3 * s + 1
        ans += 1

Measured memory_bytes: 2940
a = [int(input()) for i in range(5)]
n = 0
ans = 0

for x in a:
    if x % 10 != 0:
        t = 10 - x % 10
    else:
        t = 0
        
    ans += x + t
    n = max(n, t)
    
print(ans - n)


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

int main(){
  /*int N;cin>>N;
  const long mod=1000000007;
  bool prime[N+1];
  for(int i=0;i<=N;i++) prime[i]=true;
  vector<int> E;
  for(int i=2;i<=N;i++){
    if(prime[i]){
      for(int j=i*2;j<=N;j+=i) prime[j]=false;
      E.push_back(i);
    }
  }
  int L=E.size();//N以下なのでintでOK
  cout<<L<<endl;
    
 // long ans[N+1][L];
  long ans[L];
  for(int i=0;i<L;i++) ans[i]=1;
  for(int n=2;n<=N;n++){
  int F=n;//バグのもと
    for(int j=0;j<L;j++){
      while(F%E[j]==0){
        F /=X;
        ans[j]++;
      }
      if(F==1) break;
    }
  }
  long count=1;
  for(int i=0;i<L;i++){
    count *=ans[i];
    count %=mod;
  }
  cout<<count<<endl;*/
  
  
  int N;cin>>N;
  const long mod=1000000007;
  vector<bool> prime(N+1);
  for(int i=0;i<=N;i++) prime.at(i)=true;
  vector<int> E;
  for(int i=2;i<=N;i++){
    if(prime.at(i)){
      for(int j=i*2;j<=N;j+=i) prime.at(j)=false;
      E.push_back(i);
    }
  }
  int L=E.size();//N以下なのでintでOK
    
 // long ans[N+1][L];
  vector<long> ans(L,1);
  for(int n=2;n<=N;n++){
    int F=n;//これをしないと無限ループ
    for(int j=0;j<L;j++){
      int X=E.at(j);
      while(F%X==0){
        F /=X;
        ans.at(j)++;
      }
      if(F==1) break;
    }
  }
  long count=1;
  for(int i=0;i<L;i++){
    count *=ans.at(i);
    count %=mod;
  }
  cout<<count<<endl;
}
    


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

typedef long long ll;

int N;
ll L;
vector<string> S;
vector<vector<int> > trie;
vector<int> term, dep;
vector<ll> hi;

void dfs(int u) {
    if(!term[u] && trie[u][0] == -1) hi.push_back(L - dep[u] - 1);
    if(!term[u] && trie[u][1] == -1) hi.push_back(L - dep[u] - 1);
    if(trie[u][0] != -1) dfs(trie[u][0]);
    if(trie[u][1] != -1) dfs(trie[u][1]);
}

int grundy[100];

void Grundy() {
    grundy[0] = 1;

    for(int i = 1; i < 100; i++) {
        vector<int> chk(1000, 0);

        chk[0] = 1;
        int Xor = 0;
        for(int j = i - 1; j >= 0; j--) {
            Xor ^= grundy[j];
            chk[Xor] = 1;
        }

        for(int j = 0; j < 1000; j++) if(!chk[j]) {
            grundy[i] = j;
            break;
        }

        cout << i << ' ' << grundy[i] << endl;
    }
}

int main() {
    scanf("%d %lld", &N, &L);

    S.resize(N);
    for(int i = 0; i < N; i++) {
        cin >> S[i];
    }

    trie.push_back(vector<int>(2, -1));
    term.push_back(0);
    dep.push_back(0);

    for(int i = 0; i < N; i++) {
        int u = 0;
        for(int j = 0; j < S[i].size(); j++) {
            if(trie[u][ S[i][j] - '0' ] == -1) {
                trie[u][ S[i][j] - '0' ] = trie.size();
                trie.push_back(vector<int>(2, -1));
                term.push_back(0);
                dep.push_back(dep[u] + 1);
            }
            u = trie[u][ S[i][j] - '0' ];
        }
        term[u] = 1;
    }

    dfs(0);

    ll Xor = 0;
    for(int i = 0; i < hi.size(); i++) {
        if(hi[i] % 2 == 0) {
            Xor ^= 1;
            continue;
        }
        hi[i]++;

        for(int j = 60; j >= 0; j--) {
            if(hi[i] % (1LL << j) == 0) {
                Xor ^= (1LL << j);
                break;
            }
        }
    }
    if(Xor) printf("Alice");
    else printf("Bob");
}


Measured memory_bytes: 13232
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
//https://stackoverflow.com/questions/31065929/number-of-common-sub-sequences-of-two-strings
//https://www.geeksforgeeks.org/count-common-subsequence-in-two-strings/

class Reader {
    static BufferedReader reader;
    static StringTokenizer tokenizer;

    /** call this method to initialize reader for InputStream */
    static void init(InputStream input) {
        reader = new BufferedReader(new InputStreamReader(input) );
        tokenizer = new StringTokenizer("");
    }

    /** get next word */
    static String next(
    		) throws IOException {
        while ( ! tokenizer.hasMoreTokens() ) {
            //TODO add check for eof if necessary
            tokenizer = new StringTokenizer(reader.readLine() );
        }
        return tokenizer.nextToken();
    }

    static int nextInt() throws IOException {
        return Integer.parseInt( next() );
    }
	
    static double nextDouble() throws IOException {
        return Double.parseDouble( next() );
    }
    static long nextLong() throws IOException {
        return Long.parseLong( next() );
    }
}

public class Main {
	
	static int mod=1000000007;
	
	public static void main(String[] args) throws IOException{
		Reader.init(System.in);
		int N=Reader.nextInt();
		int M=Reader.nextInt();
		int S[]=new int[N];
		int T[]=new int[M];
		for(int i=0;i<N;i++) {
			S[i]=Reader.nextInt();
		}
		for(int i=0;i<M;i++) {
			T[i]=Reader.nextInt();
		}
		long result=commonSubsequence(S,T, N, M);
		System.out.println(result);
	}

	private static long commonSubsequence(int[] s, int[] t, int n, int m) {
		long dp[][]=new long[n+1][m+1];
		
		for(int i=0;i<=n;i++) {
			dp[i][0]=1;
		}
		for(int j=0;j<=m;j++) {
			dp[0][j]=1;
		}
		
		for(int i=1;i<=n;i++) {
			for(int j=1;j<=m;j++) {
				if(s[i-1]==t[j-1]) {
					dp[i][j]=dp[i][j-1]+dp[i-1][j];
				}
	            else {
	            	dp[i][j]=dp[i][j-1]+dp[i-1][j]-dp[i-1][j-1]+mod;
	            }
				dp[i][j]%=mod;
			}
		}
		
		return dp[n][m];
	}
	
}

Measured memory_bytes: 82516
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr long long MOD = 1000000007;
constexpr long long INF = 1LL << 60;
const long double PI = acosl(-1.0);
constexpr long double EPS = 1e-11;
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;
}
void factorization(long long n,map<long long ,long long>& mp){
    for(long long i=2;i*i<=n;i++){
        while(n%i==0){
            mp[i]++;
            n /= i;
        }
     }
     if(!(n == 1)) mp[n]++;
}
vector<long long> divisor(long long n){
    vector<long long> res;
    for(long long i = 1; i * i <= n; i++) {
        if(n%i==0){
            res.push_back(i);
            if (!(i * i == n)) res.push_back(n / i);
        }
    }
    return res;
}
int main(){
    ll n;
    cin >> n;
    vector<ll> mp1 = divisor(n - 1);
    ll ans = 0;
    ans += mp1.size() - 1;
    vector<ll> mp2 = divisor(n);
	for(auto i:mp2){
        if (i == 1) continue;
        ll tmp = n;
        while (tmp % i == 0) tmp /= i;
        if (tmp % i == 1) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3572
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll v[55];
void display(vector<ll> &v){
    for(ll i=0;i<v.size();i++)
    cout<<v[i]<<" ";
    cout<<endl;
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n,jok,res=0;
    cin>>n>>jok;
    for(ll i=1;i<=n;i++)
    cin>>v[i];
    vector<ll> arr;
    for(ll i=0;i<=n;i++){
        if(i>0)
        arr.push_back(v[i]);
        for(ll j=0;j<=i;j++){
            vector<ll> g=arr;
            sort(g.begin(),g.end(),greater<ll>());
            while(ll(g.size())>i-j)
            g.pop_back();
            ll sum=0;
            for(ll k=0;k<g.size();k++)
            sum+=g[k];
            vector<ll> g0;
            for(ll k=n+1;k>i;k--){
                if(k<=n)
                g0.push_back(v[k]);
                sort(g0.begin(),g0.end(),greater<ll>());
                if(i+j+n-k+1<=jok){
                    ll an=jok-i-j-n+k-1,sum0=0;
                    vector<ll> g1=g0;
                    while((!g1.empty())&&(an>0)&&(g1.back()<0)){
                        g1.pop_back();
                        an--;
                    }       
                    for(ll z=0;z<g1.size();z++)
                    sum0+=g1[z];
                    res=max(res,sum+sum0);
                }
            }
        }
    }
    cout<<res;
}


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

int pow2Sum(vector<int> a, vector<int>b) {
  int res = 0;
  int size = a.size();
  rep(i, size) res += (a[i] - b[i]) * (a[i] - b[i]);
  return res;
}

int main() {
  int n, d;
  cin >> n >> d;
  vector<vector<int>> a(n, vector<int>(d));
  rep(i, n) {
    rep(j, d) {
      cin >> a[i][j];
    }
  } 
  int c = 0;

  // int test = pow2Sum(a[0], a[1]);
  // double sqTest = sqrt(test);

  // cout << test << endl; 
  // cout << sqTest - floor(sqTest) << endl; 

  rep(i, n) {
    rep(j, n) {
      if(i != j) {
        double num = sqrt(pow2Sum(a[i], a[j]));
        if(num - floor(num) == 0) ++c;
      }
    }
  }

  cout << c/2 << endl;
  return 0;
}

Measured memory_bytes: 256
while true
  h, w = gets.chomp.split(" ").map{|s| s.to_i}
  break if h == 0 && w == 0

  max_a = 0
  mat = (0...h).map{[]}

  for y in (0...h)
    hl = gets.chomp.split("").map{|s| s == '.'}

    prev_w = 0
    for x in (0...w)
      min_w = prev_w = mat[y][x] = hl[x] ? prev_w + 1 : 0
      h0 = 0
      y.downto(0).each do |y0|
        min_w = mat[y0][x] if min_w > mat[y0][x]
        break if min_w == 0
        h0 += 1
        a = h0 * min_w
        max_a = a if max_a < a
      end
    end
  end

  puts max_a
end

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

#define REP(i,m,n) for(int i=(m); i<(int)(n); i++)
#define RREP(i,m,n) for(int i=(int)(n-1); i>=m; i--)
#define rep(i,n) REP(i,0,n)
#define rrep(i,n) RREP(i,0,n)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define fi first
#define se second
#define debug(...) {cerr<<"[L"<<__LINE__<<"] "; _debug(__VA_ARGS__);}

template<typename T>
string join(const vector<T>&v, string del=", "){ stringstream s;
    for(auto x : v) s << del << x; return s.str().substr(del.size());
}
template<typename T>
ostream& operator<<(ostream& o, const vector<T>&v){
    if(v.size()) o << "[" << join(v) << "]"; return o;
}
template<typename T>
ostream& operator<<(ostream& o, const vector<vector<T> >&vv){
    int l = vv.size();
    if(l){ o<<endl; rep(i,l) o << (i==0 ? "[ " : ",\n  " ) << vv[i] << (i==l-1 ? " ]" : ""); }
    return o;
}
inline void _debug(){cerr<<endl;}
template<class First, class... Rest>
void _debug(const First& first, const Rest&... rest){cerr<<first<<" ";_debug(rest...);}

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;

const double PI = (1*acos(0.0));
const double EPS = 1e-9;
const int INF = 0x3f3f3f3f;
const ll INFL = 0x3f3f3f3f3f3f3f3fLL;
const ll mod = 1e9 + 7;

inline void finput(string filename) {
    freopen(filename.c_str(), "r", stdin);
}

int main(){
    ios_base::sync_with_stdio(0);
    // finput("./input");
    int n; cin >> n;
    vvl a(n, vl(n));
    vvi b(n, vi(n, 1));
    rep(i,n) rep(j,n) cin >> a[i][j];

    rep(k,n) rep(i,n) rep(j,n){
        if(i == k or j == k) continue;
        if(a[i][j] > a[i][k] + a[k][j]){
            cout << -1 << endl;
            return 0;
        }else if(a[i][j] == a[i][k] + a[k][j]){
            b[i][j] = 0;
        }
    }
    ll ans = 0;
    rep(i,n) rep(j,n) if(b[i][j]) ans += a[i][j];
    cout << ans / 2 << endl;
    return 0;
}

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

int main(void) {
    int a, b, c, ans = 0;
    cin >> a >> b >> c;
    
    if (a % 2 != b % 2 && c % 2 != a % 2) {
        b++;
        c++;
        ans++;
    }
    else if (a % 2 != b % 2 && b % 2 != c % 2) {
        c++;
        a++;
        ans++;
    }
    else if (b % 2 != c % 2 && c % 2 != a % 2) {
        a++;
        b++;
        ans++;
    }
    
    if (a >= b && c <= a) {
        ans += (a - b + a - c) / 2;
        b = c = a;
    }
    else if (a <= b && b >= c) {
        ans += (b - a + b - c) / 2;
        c = a = b;
    }
    else if (b <= c && c >= a) {
        ans += (c - a + c - b) / 2;
        a = b = c;
    }
    
    cout << ans << endl;
}


Measured memory_bytes: 256
from itertools import product
n = int(input())

ans = 0

for i in range(3,len(str(n))+1):
    for p in product('753',repeat=i):
        if n >= int(''.join(list(p))) and all(list(p).count(c) > 0 for c in '753'): ans += 1

print(ans)

Measured memory_bytes: 3060
#include <vector>
#include <math.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#include <iomanip>
#include <deque>
#include <cctype>
#include <unordered_map>

using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<long, long>;
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;
#define rep(i, n) for(int i = 0; i<n; i++)
#define rep_s(i, start, n) for(int i= start;  i<n; i++)
#define rep_down(i, n) for(int i = n-1; i>=0; i--)
#define rep_down_s(i, n, start) for(int i = n-1; i>=start; i--)
#define ALL(a) (a).begin(), (a).end()
#define ALL_str(a) (a).cbegin(), (a).cend()

string alphabet_upper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string alphabet_lower  = "abcdefghijklmnopqrstuvwxyz";
string numbers = "0123456789";

/*
using edge = struct {int to; ll cost;};
vector<edge> tree[limit];
ll depth[limit];

void dfs(int v, int p, ll d){
  depth[v] = d;
  //cout <<"v: " << v << endl;
  for (auto &e: tree[v]){
    //cout << "e.to: " << e.to << endl;
    if (e.to == p) continue;
    dfs(e.to, v, d+e.cost);
  }
}
*/
int keta_sum(int num){
  int dig, sum = 0;
  while(num){
    dig = num % 10;
    sum = sum + dig;
    num = num / 10;
  }
  return sum;
}

ll binary_search(ll left_key, ll border, ll low, ll high) {
     // 配列 a の左端と右端
    ll mid = (low+high)/2;
    while (high > low+1) {
       mid = (low+high)/2;
        if (left_key*mid>border) high = mid;
        else if (left_key*mid<border) low = mid;
        else {
          mid =mid-1;
          break;
        }
    }
    return mid;
}

bool IsPrime(ll a){
  ll b = sqrt(a);
  b++;
  while(b-->=2){
    if (a%b==0) return false;
  }
  return true;
}

ll gcd(ll a, ll b){
  ll tmp;
  if(a<b){
    tmp = a;
    a = b;
    b = tmp;
  }

  ll r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }
  return b;
}

struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

int main(void){
  ll N, M, A, B, C, D, K,W, H, Q, X, Y;
  ll ans;
  string S, T;
  cin >> N;
  vector<ll> collatz;
  collatz.push_back(N);
  rep_s(i, 1, (1e+6)+10){
    if (N%2==0) N /= 2;
    else N = 3*N+1;
    //cout << N << endl;
    rep(j, collatz.size()){
      if (N == collatz[j]){
        cout << i+1 << endl;
        return 0;
      }
    }
    collatz.push_back(N);
  }
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;

namespace AtCoder.C
{
    public class Program
    {
        public static void Main() { var r = GetResult(); Debug.WriteLine(r); Console.Write(r); }

        private static object GetResult()
        {
            var (X, Y) = Read2Longs();
            var count = 0;
            var A = X;
            while (A <= Y)
            {
                count++;
                A *= 2;
            }
            return count;
        }

        #region Console.Read

        public static string ReadText() { return Console.ReadLine(); }
        public static List<string> ReadTexts() { return Console.ReadLine().Split(' ').ToList(); }
        public static long ReadLong() { return long.Parse(Console.ReadLine()); }
        public static (long, long) Read2Longs() { var ls = ReadLongs(); return (ls[0], ls[1]); }
        public static (long, long, long) Read3Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2]); }
        public static (long, long, long, long) Read4Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2], ls[3]); }
        public static (long, long, long, long, long) Read5Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2], ls[3], ls[4]); }
        public static List<long> ReadLongs() { return Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToList(); }

        #endregion
    }
}


Measured memory_bytes: 27964
#include <iostream>
#include <bitset>
#include <iomanip>
#include <string>
#include <vector>
#include <cmath>
#include <queue>
#include <algorithm>

using namespace std;

#define ll long long
#define vecll vector<long long>
#define vec2ll vector<vector<long long>>
#define vecbool vector<bool>
#define vecpairll vector<pair<long long,long long>>
#define forll(s,a,b) for(long long s = a;s < b;s++)
#define forllde(s,a) for(long long s = a;s >= 0;s--)

int main()
{
	ll n, ans = 0;
	string s = "Yes";
	bool flag = true;

	cin >> n;

	vecll a(n);

	forll(i, 0, n)
		cin >> a[i];

	forll(i, 0, n-1)
	{
		if (i == 0 && a[i] - a[i + 1] == 1)
			a[i] = max(a[i]-1,(ll)1);
		else if (a[i] < a[i + 1])
			a[i + 1] = max(a[i+1]-1,(ll)1);
		else if (a[i] > a[i + 1])
		{
			s = "No";
			break;
		}
	}
	
	cout << s;
}

Measured memory_bytes: 1024
#include <cstdio>

#define BlueCat "rp++"
#define AtCoder "rp++"
#define R register
#define Maxn 300010
#define Mod 998244353ll
#define min(a,b) ( a < b ? a : b )
#define Maxa min(n,x/a)
#define Maxb min(n,x/b)

typedef long long LL;
int n , a , b;
LL x;
LL fac[Maxn] , inv[Maxn];	/* fac : 阶乘 , inv : 逆元 */

inline LL Qpow(LL x , LL y) {
	R LL ret = 1;
	for(; y; y>>=1) {
		if(y&1)	ret = ret * x % Mod;
		x = x * x % Mod;
	}
	return ret;
}

inline LL C(int n , int m) {
	return fac[n] % Mod * inv[m] % Mod * inv[n-m] % Mod;
}

int main() {
	
	scanf("%d%d%d%lld",&n,&a,&b,&x);
	
	inv[0] = fac[0] = 1ll;
	for(R int i=1; i<=n; i++)
		fac[i] = fac[i-1] * (LL)i % Mod;
	inv[n] = Qpow(fac[n],Mod-2ll);
	for(R int i=n-1; i>=1; i--)
		inv[i] = inv[i+1] * LL(i+1) % Mod;
	
	R LL ans = 0;
	for(R int i=0; i<=Maxa; i++) {
		if((x-(LL)a*i) % b)	continue;
		R int j = ( x - (LL)a * i ) / b;
		if(j > Maxb)	continue;
		ans = ( ans + C(n,i) * C(n,j) % Mod ) % Mod;
	}
	
	printf("%lld\n",ans);
	
	return 0;
	
}

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

int main() {
  int n;
  cin >> n;
  vector<int> cnt(n + 1);
  for (int d = 1; d <= n; d++) {
    for (int i = d; i <= n; i += d) {
      cnt[i]++;
    }
  }
  long long ans = 0;
  for (int i = 1; i < n; i++) {
    ans += cnt[i];
  }
  cout << ans << endl;
}


Measured memory_bytes: 7120
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stdio.h>
#include <map>
#include <set>
#include <utility>
#include <queue>
#include <bitset>
#include <math.h>
#include <numeric>
#include <stack>

using namespace std;
 
#define rep(i,m,n) for(int i=m;i<(int)(n);i++)
#define endl '\n'
typedef long long ll;

int gcd(int x,int y){
    return y ? gcd(y,x%y) : x;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int r; cin >> r;
    int s = r * r;
    cout << s << endl;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <memory>
#include <regex>
using namespace std;

long long solve(vector<int> a, vector<int>& ope)
{
    int n = a.size();
    ope.clear();
 
    auto it = max_element(a.begin(), a.end());
    if(*it <= 0){
        int j = it - a.begin();
        for(int i=n-1; i>j; --i)
            ope.push_back(i);
        for(int i=0; i<j; ++i)
            ope.push_back(0);
        return *it;
    }

    vector<long long> sum(2, 0);
    for(int i=0; i<n; ++i)
        sum[i%2] += max(0, a[i]);
    if(sum[0] < sum[1]){
        ope.push_back(0);
        a.erase(a.begin());
        -- n;
    }
    if(n % 2 == 0){
        ope.push_back(n-1);
        a.erase(--a.end());
        -- n;
    }

    for(int i=n-1; i>=0; i-=2){
        if(a[i] < 0){
            ope.push_back(i);
            if(i == n - 1)
                ope.push_back(i-1);
            else if(i == 0)
                ope.push_back(0);
            n -= 2;
        }
    }

    while(n > 1){
        ope.push_back(1);
        n -= 2;
    }

    return max(sum[0], sum[1]);
}

int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i=0; i<n; ++i)
        cin >> a[i];

    vector<int> ope;
    cout << solve(a, ope) << endl;
    cout << ope.size() << endl;
    for(int x : ope)
        cout << (x + 1) << endl;

    return 0;
}


Measured memory_bytes: 256
/* kop Chy_Chy*/
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef pair<ll , ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
#define si(x)   scanf("%d", &x)
#define sl(x)   scanf("%lld", &x)
#define pi(x)   printf("%d\n", x)
#define pl(x)   printf("%lld\n", x)
#define deb(x)  cout<< #x << " = " << x << endl // debugging kop 
#define mp      make_pair
#define pb      push_back
#define MOD     1000000007
#define PI      acos(-1)
#define ff      first
#define ss      second
#define newline printf("\n")
ll binpow(ll a, ll b); // binary exponentiation kop
void prime_factorization(ll n, vll &prime_factors); // prime factorization kop
ll gcd(ll a, ll b); // greatest common divisor kop. Use LONG LONG
void speedup() {
    ios::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
}

int main(){
    speedup();
    int t = 1;
    // cin>> t;
    while(t--){
        // khela final Mamooo
        double d, t, s;cin>> d >> t >> s;
        double T = d / s;
        if (T <= t){
            cout<< "Yes\n";
        }
        else cout<< "No\n";
        
        
    }
    // kop kop return 
    return 0;
}


// kop kop functions:
ll binpow(ll a, ll b){
    a = a % MOD; ll res = 1;
    while(b > 0){
        if(b & 1) res *= a % MOD;
        a = a* a % MOD;b = b >> 1;}
    return res;
}
/*---------------------------------------------------------------------------------------------------------------*/
ll gcd(ll a, ll b){
    if(b == 0) return a;
    return gcd(b, a%b);
}
/*---------------------------------------------------------------------------------------------------------------*/
void prime_factorization(ll n, vll &prime_factors){
    // first two step taking care of composite number
    // taking care of 2
    while(n%2 == 0){
        prime_factors.pb(2);
        n = n / 2;
    }
    // now n must be odd. And the remaining prime divisors are odd. so we start from 3 and increamenting 2
    for(ll i = 3; i <= sqrt(n); i = i + 2){
        while(n%i == 0){
            prime_factors.pb(i);
            n = n / i;
        }
    }
    // now we are taking care of  n is prime number and greater than 2
    if(n > 2){
        prime_factors.pb(n);
    }
}
/*---------------------------------------------------------------------------------------------------------------*/















Measured memory_bytes: 3776
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) throws NumberFormatException,
			IOException {
		BufferedReader reader = new BufferedReader(new InputStreamReader(
				System.in));
		StringBuilder builder = new StringBuilder();
		int count = 1;
		while (true) {
			String line = reader.readLine();
			if (line.equals("0")) {
				break;
			}
			int w = Integer.parseInt(line);
			int n = Integer.parseInt(reader.readLine());
			int[] v = new int[n];
			int[] k = new int[n];
			for (int i = 0; i < n; i++) {
				StringTokenizer tokenizer = new StringTokenizer(
						reader.readLine(), ",");
				v[i] = Integer.parseInt(tokenizer.nextToken());
				k[i] = Integer.parseInt(tokenizer.nextToken());
			}
			int max = 0;
			Map<Integer, Integer> memo = new HashMap<Integer, Integer>();
			memo.put(0, 0);
			for (int i = 0; i < n; i++) {
				Map<Integer, Integer> memotmp = new HashMap<Integer, Integer>();
				memotmp.putAll(memo);
				for (Entry<Integer, Integer> entry : memo.entrySet()) {
					int newK = entry.getKey() + k[i];
					int newV = entry.getValue() + v[i];
					if (newK > w) {
						continue;
					}
					if (memotmp.get(newK) == null) {
						memotmp.put(newK, newV);

					} else {
						int oldV = memotmp.get(newK);
						if (oldV < newV) {
							memotmp.put(newK, newV);
						}
					}
					if (newK <= w) {
						if (memotmp.get(max) < newV) {
							max = newK;
						} else if (memotmp.get(max) == newV) {
							if (max > newK) {
								max = newK;
							}
						}
					}
				}
				memo = memotmp;
			}
			System.out.println(String.format("Case %d:", count));
			System.out.println(memo.get(max));
			System.out.println(max);
			count++;

		}
	}
}

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

#define rep(i, n) rep2(i, 0, n)
#define rep2(i, m, n) for (ll i = m; i < (n); i++)

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



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



Measured memory_bytes: 3628
#include<bits/stdc++.h>
#define ll long long int
#define FOR(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define REP(i,n) FOR(i,0,n)
#define REP1(i,n) FOR(i,1,n)
#define MAX 500000
#define SENTINEL 2000000000
using namespace std;

int L[MAX/2 + 2], R[MAX/2 + 2];
int cnt;

void merge(int A[], int n, int left, int mid, int right) {
  int n1 = mid - left;
  int n2 = right - mid;
  REP(i, n1) L[i] = A[left + i];
  REP(i, n2) R[i] = A[mid + i];
  L[n1] = R[n2] = SENTINEL;
  int i = 0, j = 0;
  FOR(k, left, right) {
    cnt++;
    if ( L[i] <= R[j] ) {
      A[k] = L[i++];
    } else {
      A[k] = R[j++];
    }
  }
}

void mergeSort(int A[], int n, int left, int right) {
  if (left+1 < right) {
    int mid = (left + right) / 2;
    mergeSort(A, n, left, mid);
    mergeSort(A, n, mid, right);
    merge(A, n, left, mid, right);
  }
}

int main() {
  int A[MAX], n, i;
  cnt = 0;

  cin >> n;
  REP(i, n) {
    cin >> A[i];
  }

  mergeSort(A, n, 0, n);

  REP(i, n) {
    if ( i ) cout << " ";
    cout << A[i];
  }
  cout << endl;

  cout << cnt << endl;

  return 0;
}

Measured memory_bytes: 6896
n = int(input())
n1 = n % 10
if(n1 == 0):
    print("pon")
if(n1 == 1):
    print("pon")
if(n1 == 2):
    print("hon")
if(n1 == 3):
    print("bon")
if(n1 == 4):
    print("hon")
if(n1 == 5):
    print("hon")
if(n1 == 6):
    print("pon")
if(n1 == 7):
    print("hon")
if(n1 == 8):
    print("pon")
if(n1 == 9):
    print("hon")

Measured memory_bytes: 9212
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout<< (x) << " "

int main(){
    int n;cin>>n;
    int a[n+1];rep1(i,n)cin>>a[i];
    int cnt=0;
    rep1(i,n){
        if(i==a[a[i]])cnt++;
    }
    co(cnt/2);
}

Measured memory_bytes: 640
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while(true) {
            int H = sc.nextInt();
            int W = sc.nextInt();
            if(H==0 && W==0) {
                break;
            }
            for(int i=0;i<H;i++) {
                for(int j=0;j<W;j++) {
                    System.out.print('#');
                }
                System.out.println();
            }
            System.out.println();
        }
        sc.close();
    }
}


Measured memory_bytes: 38736
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 10e9+9
#define EPS 1e-10
#define MAX_N 100100
#define MAX_M 100100

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;
typedef pair<P, char> PC;

int n, b;

int main(){
	while (cin >> n&&n){
		V v, ans, rep;
		REP(i, n){
			cin >> b;
			v.push_back(b);
		}
		int co = 0;
		while (1){
			bool f = 1;
			REP(i, v.size()){
				if (v[i] != i + 1){
					f = 0;
					break;
				}
			}
			if (f || co > 10000)break;
			rep.clear();
			co++;
			REP(i, v.size()){
				if (v[i] != 1)rep.push_back(v[i] - 1);
			}
			rep.push_back(v.size());
			v.clear();
			REP(i, rep.size()){
				v.push_back(rep[i]);
			}
		}
		if (co <= 10000)cout << co << endl;
		else cout << -1 << endl;
	}
}

Measured memory_bytes: 1264
package main
 
import (
	"bufio"
	"os"
	"strconv"
)
 
var sc = bufio.NewScanner(os.Stdin)
 
func init() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024*1024), bufio.MaxScanTokenSize)
}
 
//func nextString() string {
//	sc.Scan()
//	return sc.Text()
//}
 
func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	var wr = bufio.NewWriter(os.Stdout)
	defer wr.Flush()
	N := nextInt()
	K := nextInt()
	Q := nextInt()
	l := make([]int, N)
	for i := 0; i < Q; i++ {
		n := nextInt()
		l[n - 1]++
	}
	for _, v := range l {
		if v - Q + K > 0 {
			wr.WriteString("Yes\n")
		} else {
			wr.WriteString("No\n")
		}
	}
}


Measured memory_bytes: 3452
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)  
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;



int main(){

  int l;
  cin>>l;
  int keta;
  REP(i,25){
    if(l<pow(2,i)){
      keta = i;
      break;
    }
  }
  int x = l;
  int a[keta];
  REP(i,keta){
    a[i] = x%2;
    x -= x%2;
    x /= 2;
  }

  int count = 0;
  REP(i,keta){
    if(a[i]==1){
      count++;
    }
  }
  int n,m;
  n = keta;
  m = count+keta*2-3;
  cout<<n<<" "<<m<<endl;

  FOR(i,1,n){
    cout<<i<<" "<<i+1<<" "<<0<<endl;
    cout<<i<<" "<<i+1<<" "<<pow(2,n-i-1)<<endl;
  }

  int sum = 0;
  REP(i,n-1){
    if(a[i]==1){
      sum += pow(2,i);
      cout<<1<<" "<<n-i<<" "<<l-sum<<endl;
    }
  }

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
  int a[5]={0};
  cin >> a[0] >> a[1] >> a[2] >> a[3] >> a[4];
  sort(a,a+5);
  cout << a[4] << " "<< a[3]<< " "<< a[2] <<" "<< a[1] <<" "<< a[0] << endl;
}

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

int main()
{
    int n; cin >> n;
    vector<int> a(n);
    int b;
    rep(i, n-1) {
        cin >> b;
        ++a[b - 1];
    }
    rep(i, n) cout << a[i]<< endl;;
    
    return 0;
}


Measured memory_bytes: 4000
#include<stdio.h>
int N;
int max=0;
int map[3][105]={{0}};
void DFS(int num,int i,int j)
{
    if(j+1<N)DFS(num+map[i][j],i,j+1);
    if(i+1<2)DFS(num+map[i][j],i+1,j);
    if(i==1&&j==N-1)
    {
        if(num+map[i][j]>max)max=num+map[i][j];
    }
}
int main()
{
    scanf("%d",&N);
    for(int i=0;i<2;i++)
    {
        for(int j=0;j<N;j++)
        {
            scanf("%d",&map[i][j]);
        }
    }
    DFS(0,0,0);
    printf("%d",max);
    return 0;
}


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


ll stepNum(int n)
{
    if (n <= 9)
        return n;
    vector<ll> temp;
    queue<ll> q;
    for (int i = 1; i <= 9; i++)
    {
        temp.pb(i);
        q.push(i);
    }
    while (temp.size() != n)
    {
        ll num = q.front();
        q.pop();
        int rem = num % 10;
        ll num1 = num * 10 + (rem - 1);
        ll num2 = num * 10 + (rem);
        ll num3 = num * 10 + (rem + 1);
        if (temp.size() == n)
            break;

        if (temp.size() < n && rem != 0)
        {
            temp.pb(num1);
            q.push(num1);
        }

        if (temp.size() == n)
            break;

        if (temp.size() < n)
        {
            temp.pb(num2);
            q.push(num2);
        }

        if (temp.size() == n)
            break;

        if (temp.size() < n && rem != 9)
        {
            temp.pb(num3);
            q.push(num3);
        }


    }

    return temp[n - 1];


}

int main()
{



    int n;
    cin >> n;
    cout << stepNum(n) << "\n";




    return 0;
}

Measured memory_bytes: 1620
import sys
def S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())

n = I()
d = sorted(LI())
m = I()
t = sorted(LI())

j = 0
for i in range(m):
    while t[i] != d[j]:
        j += 1
        if j == n:
            print('NO')
            exit(0)
    j += 1
print('YES')

Measured memory_bytes: 33784
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Mayank
 */



#include "bits/stdc++.h"

#define ll long long
using namespace std;


class ANot {
public:
	void solve(std::istream& cin, std::ostream& cout) {
        ll n;
        cin>>n;
        cout<<(!n)<<"\n";
	}
};


int main() {
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(nullptr);
	ANot solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, l, r) for (int i = l; i <= (int)(r); i++)
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define MOD (int) (1e9+7)
#define INF (int) 2e9
#define LLINF (ll) 2e18

ll d[205][205];
int n;

void warshall_floyd() {
    for(int k=1; k<=n; k++)
        for(int i=1; i<=n; i++)
            for(int j=1; j<=n; j++){
                d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
            }
}

int main(){
    int m, r;
    cin >> n >> m >> r;
    // int rs[r];
    vector<int> rs(r);

    rep(i, r) cin >> rs[i];
    repr(i, 1, n) repr(j, 1, n) if(i!=j) d[i][j] = INF;

    rep(i, m){
        int a, b, c;
        cin >> a >> b >> c;
        d[a][b] = c;
        d[b][a] = c;
    }

    warshall_floyd();

    ll ans = LLINF;
    sort(rs.begin(), rs.end());
    do{
        ll tmp = 0;
        rep(i, r-1){
            tmp += d[rs[i]][rs[i+1]];
        }
        // cout << tmp << endl;
        chmin(ans, tmp);

        // rep(i, r){
        //     cout << rs[i] << " ";
        // }
        // cout << endl;
    }while(next_permutation(rs.begin(), rs.end()));

    cout << ans << endl;
    // printf("%d\n", N);
    return 0;
}

Measured memory_bytes: 512
#include <stdio.h>

int main()
{
    int type;
    int powder;
    scanf("%d %d", &type, &powder);
    int min = 100000;
    int pow;
    for (int i = 0; i < type; i++)
    {
        scanf("%d", &pow);
        powder = powder - pow;
        if (min > pow)
        {
            min = pow;
        }
    }
    printf("%d\n", type + (powder / min));
}

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

namespace Poll
{
    class Program
    {
        static void Main(string[] args)
        {
            var nInput = int.Parse(Console.ReadLine());
            List<string> inputs = new List<string>();

            for (int i = 0; i < nInput; i++)
            {
                inputs.Add(Console.ReadLine());
            }

            var output = inputs.ToLookup(n => n).ToLookup(l => l.Count(), l => l.Key).OrderBy(l => l.Key).Last().ToArray();
            List<string> printOutput = output.ToList();
            printOutput.Sort(string.CompareOrdinal);

            foreach (string print in printOutput)
            {
                Console.WriteLine(print);
            }

        }
    }
}

Measured memory_bytes: 55324
#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
using str = string;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
const double PI = 3.141592653589793238;
const ll mod = 1000000007;
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define REP(i, m, n) for (int i = m; i < (int)n; i++)
#define all(a) (a).begin(), (a).end()
#define allg(a) (a).begin(), (a).end(), greator<>()
#define d20 std::setprecision(20)
#define veci vector<int>
#define vecll vector<long long int>
#define vecd vector<double>
template <typename T>
T lcm(T a, T b)
{
	return a / __gcd(a, b) * b;
}
void comb(vector<vector<long long int>> &v)
{
	for (int i = 0; i < v.size(); i++)
	{
		v[i][0] = 1;
		v[i][i] = 1;
	}
	for (int k = 1; k < v.size(); k++)
	{
		for (int j = 1; j < k; j++)
		{
			v[k][j] = (v[k - 1][j - 1] + v[k - 1][j]);
		}
	}
}
bool is_not_out_of_range(size_t now, size_t max_num)
{
	return !(now < 0 || max_num <= now);
}
int main()
{
	int n;
	cin >> n;
	veci a(n);
	rep(i, n)
	{
		cin >> a[i];
	}
	sort(all(a));
	cout << a[n - 1] - a[0] << endl;
	return 0;
}

Measured memory_bytes: 256
a = []
b = []
c = []
a = gets.chomp.split("")
b = gets.chomp.split("")
c = gets.chomp.split("")
a.reverse!
b.reverse!
c.reverse!
#puts a.join
#puts b.join
#puts c.join
ind = a.pop
loop do
if ind == "a"
  if a == []
    puts "A"
    exit 
  end
  ind = a.pop
elsif ind == "b"
    if b == []
    puts "B"
    exit 
  end
  ind = b.pop
else
    if c == []
    puts "C"
    exit 
  end
  ind = c.pop
end
end
  

Measured memory_bytes: 1788
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
#define rep1(i,n) for (int i = 1; i <= (n); i++)
#define repi(i,a,b) for (int i = (a); i < (b); i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using vc = vector<char>;
using vvc = vector<vc>;
using vs = vector<string>;

int main() {
  char a, b;
  cin >> a >> b;
  
  if (a == 'H' && b == 'H') 
    cout << 'H' << endl;
  else if (a == 'D' && b == 'D')
    cout << 'H' << endl;
  else
    cout << 'D' << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>

int main()
{
	int h,a;	
	scanf("%d%d",&h,&a);
	int ans;
	ans=h/a;
	int yu;
	yu=h%a;
	if (yu!=0) ++ans;
	printf("%d",ans);
	return 0;
} 
 

Measured memory_bytes: 128
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 500001), 500000)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func main() {
	fp := os.Stdin
	if len(os.Args) > 1 {
		fp, _ = os.Open(os.Args[1])
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(os.Stdout)

	n := getNextInt(scanner)
	k := getNextInt(scanner)
	l := getNextInt(scanner)

	road := make([]int, n)
	train := make([]int, n)

	for i := 0; i < n; i++ {
		road[i] = i
		train[i] = i
	}

	for i := 0; i < k; i++ {
		p := getNextInt(scanner) - 1
		q := getNextInt(scanner) - 1
		r1 := root(p, road)
		r2 := root(q, road)

		if r1 < r2 {
			road[r2] = r1
			continue
		}
		road[r1] = r2
	}
	for i := 0; i < l; i++ {
		r := getNextInt(scanner) - 1
		s := getNextInt(scanner) - 1
		r1 := root(r, train)
		r2 := root(s, train)

		if r1 < r2 {
			train[r2] = r1
			continue
		}
		train[r1] = r2
	}

	imm := IntMapMap{}
	for i := 0; i < n; i++ {
		imm.increment(root(i, road), root(i, train))
	}
	for i := 0; i < n; i++ {
		fmt.Fprint(writer, imm.get(road[i], train[i]))
		if i == n-1 {
			fmt.Fprintln(writer, "")
			continue
		}
		fmt.Fprint(writer, " ")
	}

	writer.Flush()
}

func root(i int, nodes []int) int {
	if i == nodes[i] {
		return i
	}

	p := root(nodes[i], nodes)

	nodes[i] = p

	return p
}

// IntMap ...
type IntMap map[int]int

func (m IntMap) get(key int) int {
	if _, ok := m[key]; ok {
		return m[key]
	}
	return 0
}

func (m IntMap) set(key, n int) {
	if _, ok := m[key]; ok == false {
		m[key] = 0
	}
	m[key] = n
}

func (m IntMap) increment(key int) {
	if _, ok := m[key]; ok == false {
		m[key] = 0
	}
	m[key]++
}

// IntMapMap ...
type IntMapMap map[int]IntMap

func (m IntMapMap) get(key1, key2 int) int {
	if _, ok := m[key1][key2]; ok {
		return m[key1][key2]
	}
	return 0
}

func (m IntMapMap) set(key1, key2, n int) {
	if _, ok := m[key1]; ok == false {
		m[key1] = make(IntMap, 0)
	}
	m[key1].set(key2, n)
}

func (m IntMapMap) increment(key1, key2 int) {
	if _, ok := m[key1]; ok == false {
		m[key1] = make(IntMap, 0)
	}
	m[key1].increment(key2)
}


Measured memory_bytes: 54140