akhauriyash/Code-Regression huggingface dataset:
#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;

typedef int ll;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;
typedef pair<string, string> pss;
typedef vector<ll> vll;
typedef vector<pll> vpll;
typedef vector<vll> vvll;
typedef vector<vpll> vvpll;
typedef unordered_map<ll, ll> um;
typedef unordered_set<ll> us;

#define fastio ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
#define ts ll t; in(t) while (t--) solve();
#define ks ll t; in(t) FOR(i, 1, t+1) out("Case #" << i << ": " << solve());
#define endl '\n'
#define ln cout << endl;
#define in(x) cin >> x;
#define out(x) cout << x << endl;
#define flush cout << flush;
#define reset(a, b) memset(a, b, sizeof(a));
#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define FOR(i, a, b) for (ll i = a; i < b; ++i)
#define FORI(i, a, b, c) for (ll i = a; i < b; i += c)
#define FORD(i, a, b) for (ll i = a; i > b; --i)
#define FOREACH(it, v, r) for (auto it = v.begin() + r; it != v.end(); it++)
#define FORALL(it, v) for (auto it : v)
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define vin(v, x) vll v(x); FOR(i, 0, x) in(v[i])
#define all(v) v.begin(), v.end()
#define allr(v, r) v.begin(), v.begin() + r
#define showv(v) FORALL(it, v) cout << it << ' '; ln
#define printv(v) FORALL(it, v) out(it)
#define show2d(v) FORALL(it, v) { FORALL(j, it) cout << j << ' '; ln}
#define showm(v) FORALL(it, v) cout << it.F << ": " << it.S << ' '; ln
#define sortv(v) sort(all(v));
#define revv(v) reverse(all(v));
#define maxv(v) *max_element(all(v))
#define minv(v) *min_element(all(v))
#define gcd __gcd
#define checkbit(n, i) (n >> i) & 1               // check ith bit
#define bitcount __builtin_popcount               // count set bits
#define firstbitindex __builtin_ctz               // count trailing zeros
#define lastbitindex __builtin_clz                // count leading zeros
#define bitparity __builtin_parity                // check set bits are even or odd
#define findv(v, x) (find(all(v), x) != v.end())
#define findsm(u, x) (u.find(x) != u.end())
#define findstr(s, x) (s.find(x) != string::npos)
#define sz(a) a.size()
#define precise(x) cout << fixed << setprecision(x);

const ll MAXN = 1e7 + 1, MOD = 998244353, SIZE = 2e7;//, INF = 0x7f7f7f7f7f7f7f7f;
const double EPS = 1e-9, PI = acos(-1);
const int INFi = 0x7f7f7f7f;

ll n, x, y, f, c, i, j;
vll spf(MAXN, 2);
long long ans = 1, z;

int main()
{
	fastio
	for (i = 3; i < MAXN; i += 2)
        spf[i] = i;
    for (i = 3; i < 3162; i += 2)
        if (spf[i] == i)
            for (j = i * i; j < MAXN; j += i)
                if (spf[j] == j)
                    spf[j] = i;
	in(n)
	for (i = 2; i <= n; ++i)
	{
		x = i, f = 1, c = 1, z = 1;
		while (x > 1)
			y = spf[x], x /= y, y > f ? z *= c, c = 2, f = y : ++c;
		ans += i * z * c;
	}
	out(ans)
    return 0;
}

Measured memory_bytes: 42180
n, m = map(int, input().split())
ll = []
for i in range(n):
    l = list(map(int, input().split()))
    ll.append(l)

ll.sort()

t = 0
cst = 0
i = 0
while t < m:
    t += ll[i][1]
    cst += ll[i][0]*ll[i][1]
    if t > m:
        cst -= ll[i][0]*(t-m)
    i += 1
print(cst)

Measured memory_bytes: 27444
import java.io.*;
import java.math.BigInteger;
import java.util.*;
import java.util.Stack;

public class Main{
	public static class FastReader {
		BufferedReader br;
		StringTokenizer root;
		
 
		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}
 
		String next() {
			while (root == null || !root.hasMoreTokens()) {
				try {
					root = new StringTokenizer(br.readLine());
				} catch (Exception r) {
					r.printStackTrace();
				}
			}
			return root.nextToken();
		}
 
		int nextInt() {
			return Integer.parseInt(next());
		}
 
		double nextDouble() {
			return Double.parseDouble(next());
		}
 
		long nextLong() {
			return Long.parseLong(next());
		}
 
		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (Exception r) {
				r.printStackTrace();
			}
			return str;
		}
	}
	
	public static PrintWriter out = new PrintWriter (new BufferedOutputStream(System.out));
	static int mod = (int) (1e9+7),n;
	static long cf = 998244353;
    static final int MAX = (int) 1e6;
    public static List<Integer>[] edges;
    public static int[][] parent;
    public static int col = 20;
    public static long[] Bit;
    public static long[] fac,inv;
    public  static int[] prime; 
    public static long[] dp;
	public static FastReader sc = new FastReader();
	public static void main(String[] args) {
	//	Scanner sc = new Scanner(System.in);
 
		int a = sc.nextInt();
		int b = sc.nextInt();
		int ans = 0;
		if(a >= 13) ans = b;
		else if(a >= 6) ans = b/2;
		out.print(ans);
		out.close();
	}
	
	
}

Measured memory_bytes: 21204
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int mod = 1e9+7;
const int MX = 1000005;

struct mint {
  ll x;
  mint(ll x=0):x(x%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

struct Sieve {
  int n;
  vector<int> f, primes;
  Sieve(int n = 1):n(n), f(n+1) {
    f[0] = f[1] = -1;
    for(ll i = 2; i <= n; i++) {
      if(f[i]) continue;
      primes.push_back(i);
      f[i] = i;
      for(ll j = i*i; j <= n; j+=i) {
        if(!f[j]) f[j] = i;
      }
    }
  }
  bool isPrime(int x) { return f[x] == x; }
  vector<int> factorList(int x) {
    vector<int> res;
    while(x != 1) {
      res.push_back(f[x]);
      x /= f[x];
    }
    return res;
  }
  vector<P> factor(int x) {
    vector<int> fl = factorList(x);
    if(fl.size() == 0) return {};
    vector<P> res(1, P(fl[0], 0));
    for(int p : fl) {
      if(res.back().first == p) {
        res.back().second++;
      } else {
        res.emplace_back(p, 1);
      }
    }
    return res;
  }
};

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

  map<int, int> mp;
  for(int i = 0; i < n; i++) {
    auto f = sieve.factor(a[i]);
    for(auto p : f) {
      mp[p.first] = max(mp[p.first], p.second);
    }
  }
  mint lcm = 1;
  for(auto p : mp) {
    for(int i = 0; i < p.second; i++) {
      lcm *= p.first;
    }
  }
  mint ans;
  for(int i = 0; i < n; i++) {
    mint b = lcm/a[i];
    ans += b;
  }
  cout << ans.x << endl;
  return 0;
}


Measured memory_bytes: 4984
#include<iostream>
#include<string>
#include<vector>

using namespace std;

int main(){
    
    int N;
    cin >> N;
    long long int sum =0;
    for(int n=1;n<=N;n++){
        int a=n;
        if(n%3==0){a=0;}
        if(n%5==0){a=0;}
        sum=sum+a;
    }

    cout << sum << endl;
    
}

Measured memory_bytes: 3596
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <map>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <numeric>
#include <cmath>
#include <iomanip>
#include <deque>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
#define ll              long long
#define PII             pair<int, int>
#define rep(i,a,b)      for(int  i=a;i<=b;i++)
#define dec(i,a,b)      for(int  i=a;i>=b;i--)
using namespace std;
int dir[4][2] = { { 0,1 } ,{ 0,-1 },{ 1,0 },{ -1,0 } };
const long long INF = 0x7f7f7f7f7f7f7f7f;
const int inf = 0x3f3f3f3f;
const double pi = 3.14159265358979323846;
const double eps = 1e-6;
const int mod =1e9+7;
const int N = 1e5+5;
//if(x<0 || x>=r || y<0 || y>=c)

inline ll read()
{
	ll x = 0; bool f = true; char c = getchar();
	while (c < '0' || c > '9') { if (c == '-') f = false; c = getchar(); }
	while (c >= '0' && c <= '9') x = (x << 1) + (x << 3) + (c ^ 48), c = getchar();
	return f ? x : -x;
}
ll gcd(ll m, ll n)
{
	return n == 0 ? m : gcd(n, m % n);
}
ll lcm(ll m, ll n)
{
	return m * n / gcd(m, n);
}
bool prime(int x) {
    if (x < 2) return false;
    for (int i = 2; i * i <= x; ++i) {
        if (x % i == 0) return false;
    }
    return true;
}
ll qpow(ll m, ll k, ll mod)
{
    ll res = 1, t = m;
    while (k)
    {
        if (k & 1)
            res = res * t % mod;
        t = t * t % mod;
        k >>= 1;
    }
    return res;
}      

int main()
{
    string s, t;
    cin >> s >> t;
    vector<vector<int>> a(s.size() + 1, vector<int>(t.size() + 1));
    rep(i, 1, s.size())
    {
        rep(j, 1, t.size())
        {
            if (s[i - 1] == t[j - 1])
            {
                a[i][j] = a[i - 1][j - 1] + 1;
            }
            else
            {
                a[i][j] = max(a[i - 1][j], a[i][j - 1]);
            }
        }
    }
    int j = t.size(),i=s.size();
    vector<char> res;
    while (j > 0 && i > 0)
    {
        while (j>0 && a[i][j] == a[i][j - 1])
            j--;
        while (i>0 && a[i][j] == a[i - 1][j])
            i--;
        if(i>0)
            res.push_back(s[i-1]);
        i--, j--;
    }
    for (int i = res.size() - 1; i >= 0; i--)
        cout << res[i];
    return 0;
}



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

using namespace std;
typedef long long ll;
const int MAXN=2005;
ll x,res=1e15;
int n,pre[MAXN][MAXN];

int main()
{
	scanf("%d%lld",&n,&x);
	for(int i=0;i<n;i++) scanf("%d",&pre[i][0]);
	for(int i=0;i<n;i++)
		for(int j=1;j<n;j++)
		{
			int cur=(i-j+n)%n;
			pre[i][j]=min(pre[i][j-1],pre[cur][0]);
		}
	
	for(int i=0;i<n;i++)
	{
		ll t=i*x;
		for(int j=0;j<n;j++) t+=pre[j][i];
		res=min(res,t);
	}
	printf("%lld",res);
	return 0;
}

Measured memory_bytes: 15872
#include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
#include <string>
#include <cmath>
#include <algorithm>

using namespace std;

#define pb push_back
#define mp make_pair
#define ff first
#define ss second

typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> pii;
typedef vector<pii> vii;
typedef priority_queue<ll> pq;

const int MOD = 1e9+7;
const int INF = 2e9;
const int MAX_N = 1;

int main() {
  string S, T; cin >> S >> T;
  int len = S.length();
  bool flag = false;
  for (int i = 0; i < len; i++) {
    string cmp = S.substr(i, len) + S.substr(0, i);
    // cout << cmp << endl;
    if (cmp == T) {
      flag = true;
    }
  }
  cout << (flag?"Yes":"No") << endl;
  return 0;
}


Measured memory_bytes: 256
//#include "stdafx.h"
#include <iostream>
#include <set>
#include <queue>
#include <vector>
#include <algorithm>
#include <math.h>
#include <cmath>
#include <string>
#include <cstring>
#include <functional>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
#include <tuple>
#include <numeric>
#include <assert.h>
#include <functional>
#include <unordered_map>

using namespace std;

/*-----------------------------------------------------------------------------
　定義
 -------------------------------------------------------------------------------*/
#define REP(i, n)				for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n)			for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define INF						2e9
#define MOD						(1000 * 1000 * 1000 + 7)
#define Ceil(x, n)				(((((x))+((n)-1))/n))		/* Nの倍数に切り上げ割り算 */
#define CeilN(x, n)				(((((x))+((n)-1))/n)*n)		/* Nの倍数に切り上げ */
#define FloorN(x, n)			((x)-(x)%(n))				/* Nの倍数に切り下げ */
#define IsOdd(x)				(((x)&0x01UL) == 0x01UL)			
#define IsEven(x)				(!IsOdd((x)))						
#define	BitSetV(Val,Bit)		((Val) |= (Bit))			
#define	BitTstV(Val,Bit)		((Val) & (Bit))				
#define ArrayLength(x)			(sizeof( x ) / sizeof( x[ 0 ]))
#define	MAX_QWORD				((QWORD)0xFFFFFFFFFFFFFFFF)
#define	MIN_QWORD				((QWORD)0x0000000000000000)
#define	MAX_SQWORD				((SQWORD)0x7FFFFFFFFFFFFFFF)
#define	MIN_SQWORD				((SQWORD)0x8000000000000000)
#define M_PI					3.14159265358979323846
typedef long long				ll;
typedef unsigned long			DWORD;
typedef unsigned long long int	QWORD;
typedef pair<ll, ll>			P;

/*-----------------------------------------------------------------------------
　処理
 -------------------------------------------------------------------------------*/
// メイン
int main()
{
	// 入力
	int N, K;
	cin >> N >> K;

	int ans = 1;
	REP(i, N) {
		if ((ans * 2) < (ans + K)) {
			ans *= 2;
		} else {
			ans += K;
		}
	}
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 256
// Don't Lose Hope, Nor Be Sad 

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

  #define lp(start,finish) for(int i=start; i<finish; i++)
  #define read freopen("input.txt","r",stdin);
  #define fast ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);

int main(){
	//read
	int a,sum=0;
	cin >> a;
	if(a%10==0)cout<<"10\n";
	else
	{	while(a){
		sum+= a%10;
		a/=10;
		}
		cout << sum << endl;
	}
	return 0;
}

Measured memory_bytes: 256
import scala.io.StdIn.readInt

object Main{
  def main(args: Array[String]): Unit = {
    var a = new Array[Int](10)
    for(i <- 0 until 10) {
      a(i) = readInt
    }
    var s = a.sortWith(_ > _)
    for(i <- 0 until 3) {
      println(s(i))
    }
  }
}

Measured memory_bytes: 44072
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

#include <iostream>
#include <vector>
#include <string> 
#include <algorithm> 
#include <cmath>
using namespace std;

// struct arr{
//     string name;  // 名前
//     int    point; // 価格
//     int num;
// };
int ans = 0;

// vector<arr> arrs;
int main(){
    int n = 0;
    int b;
    int l,s;
    int p[11]={0};
    string a;
    cin  >>l;
    cin  >> s;
    rep(i,s){
        int a;
        cin >>a;
        rep(j,a){
            int s;
            cin >> s;
            p[i]+=exp2((double)(s-1));
        }
    }
    int k[11]={0};
    rep(i,s){
        cin >> k[i];
    }
    rep(i,exp2((double)l)){
        int anss = 0;
        rep(j,s){
            //cout << bitset<10>(p[j] & i) << endl;
            if((__builtin_popcount(p[j] & i)%2)==k[j]){
                anss ++ ;
                //cout<<__builtin_popcount(p[j] & i)<<"ans!" << k[j]<< endl;
            }
        }
        if(anss == s){
            ans ++;
        }
    }
    cout <<  ans << endl;
}

Measured memory_bytes: 256
#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;  
typedef tree<int, null_type, less<int>, rb_tree_tag,  tree_order_statistics_node_update>  ordered_set; 
typedef long long ll;
#define pb push_back
#define MP make_pair
#define F first
#define S second
#define ff(i, c, n) for (ll i = c; i < n; i++)
#define fr(i, c, n) for (ll i = c; i >= n; --i)

// DEBUGGING TEMPLATE
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
	*this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
const ll mod=1000000007;
const ll mod1=998244353;

ll modpow(ll a, ll b, ll c)
{ //a^b%c in O(logb)
	ll res = 1;
	while (b > 0)
	{
		if (b & 1)
		{
			res = (res * a) % c;
		}
		a = (a * a) % c;
		b >>= 1;
	}
	return res;
}
ll modinv(ll m, ll n)
{ //modular inverse of n w.r.t m provided 1<=n<=(m-1) in O(logn) and m is prime
	ll inv[n + 1];
	inv[1] = 1;
	for (int i = 2; i < n + 1; ++i)
		inv[i] = (m - (m / i) * inv[m % i] % m) % m;
	return inv[n];
}

void solve(){
	int n;
	cin>>n;
	ll a[n+1];
	ll s=0;
	ff(i,0,n+1) {cin >> a[i]; s+=a[i];};
	ll count=1;
	ll ans=0;
	ff(i,0,n+1){
		ans+=count;
		if(a[i]>count){cout<<"-1"; return;}
		count-=a[i];
		count*=2;
		s-=a[i];
		count=min(count,s);
		
	}
	
	cout<<ans;

}

//a+b=a^b+2*(a&b)
int main()
{
	// your code goes here
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll t;
	t=1;
	while(t--){
		solve();
	}


	return 0;
}


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

using namespace std;

int main(){
	int x,n;
	cin>>x>>n;
	int p[n+1];
	for(int i=1;i<=n;i++){
		cin>>p[i];
	}
	int f=1,minx=0,miny=0,a=0,b=0;
	for(int i=x;i>=0;--i){
		f=1;
		for(int j=1;j<=n;++j){
			if(p[j]==i)f=0;
		}
		if(f==1){
			minx=i;
			a=x-minx;
			break;
		}
	}
	for(int i=x;i<=101;++i){
		f=1;
		for(int j=1;j<=n;++j){
			if(p[j]==i)f=0;
		}
		if(f==1){
			miny=i;
			b=miny-x;
			break;
		}
	}
	
	if(a<=b)cout<<minx;
	else cout<<miny;
	return 0;
}

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

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

using namespace std;

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

	int n=s.length();
	vector<string> S;
	rep(l,5) rep(i,n-l) S.emplace_back(s.substr(i,l+1));

	sort(S.begin(),S.end());
	S.erase(unique(S.begin(),S.end()),S.end());

	cout<<S[k-1]<<endl;

	return 0;
}


Measured memory_bytes: 1660
#define __USE_MINGW_ANSI_STDIO 0
#include <bits/stdc++.h>
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl '\n'
#define rep(i, a, b) for (int i = a; i < b; i++)
#define ff first
#define pii pair<int, int>
#define vii vector< pair<int,int> >
#define vi vector<int>
#define vvi vector< vector< int> >
#define ss second
#define MOD 998244353LL
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define int long long
#define all(a) a.begin(), a.end()
#define inf (1LL<<61)
#define ull unsigned long long
#define trace1(x)                cout<<#x<<": "<<x<<endl
#define trace2(x, y)             cout<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace4(x, y, z, d)          cout<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<" | "<<#d<<": "<<d<<endl

#define trace3(x, y, z)          cout<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define debug1(x) cerr << #x << ": " << x <<'\n'
#define debug2(x, y) cerr << #x << ": " << x << '\t' << #y << ": " << y <<'\n'
#define debug3(x, y, z) cerr << #x << ": " << x << '\t' << #y << ": " << y << '\t' << #z << ": " << z <<'\n'
using namespace std;
int dx[]={1,0,-1, 0};int dy[]={0,1,0, -1}; //4 Direction
//int dx[]={1,1,0,-1,-1,-1,0,1};int dy[]={0,1,1,1,0,-1,-1,-1};//8 direction
bool compare(const pair<int,int> &a,
             const pair<int,int> &b)
{
    if(a.ff == b.ff) {
        return (b.ss < a.ss);
    }
    return (a.ff<b.ff);
}
int findlcm(int arr[], int n) 
{ 
    // Initialize result 
    int ans = arr[0]; 
  
    // ans contains LCM of arr[0], ..arr[i] 
    // after i'th iteration, 
    for (int i = 1; i < n; i++) 
        ans = (((arr[i] * ans)) / 
                (__gcd(arr[i], ans))); 
  
    return ans; 
}
bool prime[1000001];
void SieveOfEratosthenes(int n) 
{
    // Create a boolean array "prime[0..n]" and initialize
    // aint entries it as true. A value in prime[i] wiint
    // finainty be false if i is Not a prime, else true.

    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;
        }
  }
}
// Declare all the variables here - 
int n,m;
vector<int> g[100005];
int vis[100005] = {0};
void dfs(int n){
	vis[n] = 1;
	rep(i, 0, g[n].size()){
		if(!vis[g[n][i]]){
			dfs(g[n][i]);
		}
	}
}
int32_t main()
{
    IOS;
    // #ifndef ONLINE_JUDGE
    // freopen("input.txt","r",stdin);
    // freopen("output.txt","w",stdout);
    // #endif
    /********************* From here ***********************/
    
    cin >> n >> m;
    rep(i, 0, m){
    	int a,b,c;
    	cin >> a >> b >> c;
    	g[a].pb(b);
    	g[b].pb(a);
    }
    int ans = 0;

    for(int i = 1;i<=n;i++){
    	if(!vis[i]){
    		ans++;
    		dfs(i);
    	}
    }

    cout <<ans << endl;	
}

Measured memory_bytes: 10624
//                          VIVEK UPADHYAY
//                          MANIT, BHOPAL(M.P)
/**********************************************************************************************/
/**********************************************************************************************/
//                        $$ JAB-TAK TODEGA NHI,
//                           TAB -TAK CHODEGA NHI :D

// g++ -std=c++11 file_name.cpp
// ./file_name.out
#include<iostream>
#include<algorithm>
#include<vector>
#include<list>
#include<cstdlib>
#include<unistd.h>
#include<string>
#include<cstring>
#include<stack>
#include<queue>
#include<utility>
#include<cmath>
#include<set>
#include<unordered_map>
#include<cstdio>
#include<map>
#include<numeric>
using namespace std;
#define F first
#define S second
#define mk(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define LINE cout<<"\n" ;
#define ok cout<<"ok\n" ;
#define dbg(x) cout<<#x<<" = "<<(x)<<"\n";
#define fill(A, VAL) memset(A, VAL, sizeof(A))
#define sz(a) ((int) a.size())
typedef long long ll ;
const int MAXN = 5*1e5 + 10;

int main () {
    
    ll r , d , x2 ;
    cin >> r >> d >> x2 ;
    for(int i = 0 ; i < 10 ;i++)
    {
        
        x2 = r*x2 - d ;
        cout<<x2<<endl ;
    }
    //cout<<x2<<endl;
    return 0 ;
}


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

memo = [[-1] * N for _ in range(2)]
memo[0][0] = A[0][0]
for i in range(2):
    for j in range(N):
        if i == 0:
            if j == 0:
                continue
            memo[i][j] = memo[i][j-1] + A[i][j]
        else:
            if j == 0:
                memo[i][j] = memo[i-1][j] + A[i][j]
            else:
                memo[i][j] = max(memo[i-1][j], memo[i][j-1]) + A[i][j]

print(memo[1][N-1])


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

namespace abs118b
{
    class Program
    {
        static void Main(string[] args)
        {
            var nm = ReadIntList();
            var n = nm[0];
            var m = nm[1];
            var suki = Enumerable.Range(1, 30).ToList();
            for (int i = 0; i < n; i++)
            {
                var ka = ReadIntList();
                suki = suki.FindAll(_ => ka.Skip(1).Contains(_));
            }
            Console.WriteLine(suki.Count());
#if DEBUG
            Console.ReadKey();
#endif
        }

        private static bool IsRange(int a, int from, int to) => (from <= a && a <= to);
        private static int ReadInt() => int.Parse(Console.ReadLine());
        private static List<int> ReadIntList() => Console.ReadLine().Split(' ').Select(_ => int.Parse(_)).ToList();
        private static List<int> Int2Digits(int a) => a.ToString().ToCharArray().Select(_ => int.Parse(_.ToString())).ToList();
    }
}


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

int main(){
  string s, t;
  cin >> s >> t;
  int n = s.size();
  int ans = 0;
  for(int i=0; i<n; ++i){
    if(s[i] != t[i]) ++ans;
  }
  cout << ans << endl;
}

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

int main() {
    string str;
    cin>>str;
    ll win=0;
    ll lose=0;
    for(ll i=0;i<str.size();i++) {
        if(str[i]=='o'){
            win++;
        }else{
            lose++;
        }
    }
    if(lose>=8){
        cout<<"NO"<<endl;
    }else {
        cout<<"YES"<<endl;
    }
}


Measured memory_bytes: 256
while line = gets.chomp
  h,w = line.split(" ").map{|x| x.to_i}
  if h==0 && w==0
    break
  end
  for i in 1..h do
    for j in 1..w do
      if (i+j)%2==0
        print "#"
      else
        print "."
      end
    end
    print "\n"
  end
  print "\n"
end


Measured memory_bytes: 6868
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <bitset>
using namespace std;

typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P2;
const int inf=1000000000;
int main() {
	string s;
	cin>>s;
	cout<<"ABC"<<s<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<atcoder/dsu>
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
using namespace std;
using ll = long long int;
using namespace atcoder;
template<typename T>
ostream& operator+(ostream& out, const vector<T> &vec){
    for(const auto &x : vec){
        out<<x<<" ";
    }
    out<<"\n";
    return out;
}
template<typename T>
ostream& operator*(ostream& out, const vector<T> &vec){
    for(const auto &x : vec){
        out+x;
    }
    return out;
}
template<typename T>
istream& operator>>(istream& in, vector<T> &vec){
    for(auto &x : vec){
        in>>x;
    }
    return in;
}
void solve(){
    int n;
    cin>>n;
    vector<int> x(n), y(n);
    for(int i=0;i<n;i++){
        cin>>x[i]>>y[i];
        --x[i];--y[i];
    }
    dsu comp(n);
    vector<int> order(n);
    iota(order.begin(), order.end(), 0);
    sort(order.begin(), order.end(), [&](int l,int r){
        return x[l] < x[r];
    });
    set<int> roots;
    for(const auto &i : order){
        roots.insert(y[i]);
        vector<int> toremove = {y[i]};
        for(const auto &x : roots){
            if(x < y[i]){
                toremove.pb(x);
            }
            else{
                break;
            }
        }
        int left = *min_element(toremove.begin(), toremove.end());
        for(const auto &x : toremove){
            comp.merge(left, x);
            if(x!=left){
                roots.erase(x);
            }
        }
    }
    for(int i=0;i<n;i++){
        cout<<comp.size(y[i])<<"\n";
    }
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
}

Measured memory_bytes: 11880
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<utility>
#include<set>
#include<stack>
#include<list>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cstring>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<cmath>
#include<cctype>

#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define len(s) s.length()
#define forp(i,a,b) for( i=a;i<=b;i++)
#define rep(i,n)    for( i=0;i<n;i++)
#define ren(i,n)    for( i=n-1;i>=0;i--)
#define forn(i,a,b) for( i=a;i>=b;i--)
#define all(v) v.begin(),v.end()
#define b(v) v.begin()
#define e(v) v.end()
#define mem(n,m) memset(n,m,sizeof(n))
#define lb lower_bound
#define ub upper_bound
#define pii pair<int,int>
#define pll pair<long long,long long>
#define vii vector<int>
#define vll vector<long long>
#define gl(cin,s)  getline(cin,s);
#define bitc(n) __builtin_popcountll(n)
#define present(s,x) (s.find(x) != s.end()) 
#define cpresent(s,x) (find(all(s),x) != s.end()) 
#define tr(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++) 

#define boost ios_base::sync_with_stdio(0)
#define MOD 1000000007
#define EPSILON 1e-9
#define PI 3.14159265358979323846
#define SIZE 100010
#define SZ 110

typedef long long  ll;
typedef unsigned long long ull;
typedef long double  ldo;
typedef double  db ;
using namespace std;
int dp[SIZE][4];
int N;
int A[SIZE],B[SIZE],C[SIZE];
int func(int which,int last)
{
    if(which > N)
    return 0LL;
    if(dp[which][last] != -1)
    return dp[which][last];
    int fans = 0;
    if(last != 1){
        fans = max(fans,A[which]+func(which+1,1));
    }
    if(last != 2){
        fans = max(fans,B[which]+func(which+1,2));
    }
    if(last != 3){
        fans = max(fans,C[which]+func(which+1,3));
    }
    dp[which][last] = fans;
    return fans;
}
int main()
{  	
	/* #ifndef ONLINE_JUDGE
	freopen(fi, "r", stdin);
	#endif */
	//freopen("route.in","r",stdin);
	//freopen("route.out","w",stdout);
	//cin.ignore();
	//cin.clear();
	boost;
	//cin.tie(0);
	//cout<<"Case "<<tt<<": ";
	cin>>N;
	for(int i=1;i<=N;i++){
	    cin>>A[i]>>B[i]>>C[i];
	}
	mem(dp,-1);
	cout<<max(func(1,1),max(func(1,2),func(1,3)));
	return 0;
}

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

int main(void){
    int n;
    ll m;
    cin >> n >> m;
    map<ll,ll> mod;
    mod[0] = 1;
    ll res = 0;
    ll sum = 0;
    rep(i,n){
        ll a;
        cin >> a;
        sum += a;
        res += mod[sum%m]++;
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 4224
import java.math.BigInteger;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long h = sc.nextLong();
		long w = sc.nextLong();
		if(h == 1 || w == 1) {
			System.out.println(1);
		} else {
			BigInteger ans = new BigInteger(Long.toString(h / 2));
			ans = ans.multiply(new BigInteger(Long.toString(w)));
			if(h % 2 == 1) {
				ans = ans.add(new BigInteger(Long.toString((w + 1) / 2)));
			}
			System.out.println(ans);
		}

	}

}


Measured memory_bytes: 21972
package main

import (
	"fmt"
)

func main() {
	var n int
  	fmt.Scan(&n)
  
  ans := 0
  for i := 0; i <= n; i++ {
    if i * i <= n {
      ans = i * i
    } else {
    	break
    }
  }
  fmt.Println(ans)
}


Measured memory_bytes: 512
fn main() {
    let v: Vec<u32> = read_vec();
    let (a, b, c) = (v[0], v[1], v[2]);
    if a + b + c >= 22 {
        println!("bust");
    } else {
        println!("win");
    }
}






//**********************************************************************************************************************************************//

// 標準入力から一行を読み取り、指定の型に変換する関数
pub fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

// 標準入力から一行を読み取り、空白文字で分割し、各要素を指定の型に変換する関数
pub fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

// 標準入力からn行を読み取り、各行を空白文字で分割し、各要素を指定の型に変換する関数
pub fn read_vec2<T: std::str::FromStr>(n: u64) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}


Measured memory_bytes: 4352
// clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define forever while (true)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
template<typename A> using V = std::vector<A>;
template<typename A> using F = std::function<A>;
template<typename A, typename B> using P = std::pair<A, B>;
using pii = P<int, int>;
using vi = V<int>;
using vd = V<double>;
using vs = V<std::string>;
using vpii = V<pii>;
using vvi = V<vi>;
using vvpii = V<vpii>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
template<typename T> std::istream &operator>>(std::istream &is, std::vector<T> &v) { for (T &x : v) is >> x; return is; }
using namespace std;
// clang-format on

main {
  string s;
  getline(cin, s);
  for (auto &c : s) c = ('a' <= c && c <= 'z') ? toupper(c) : ('A' <= c && c <= 'Z') ? tolower(c) : c;
  cout << s << endl;
}

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

unsigned long long x,y,z;

inline ll read(){
	char cc=getchar();
	ll f=1,num=0;
	while (cc<'0'||cc>'9'){
		if (cc=='-') f=-1;
		cc=getchar();
	}
	while (cc>='0'&&cc<='9'){
		num=(num<<1)+(num<<3)+(cc^48);
		cc=getchar();
	}
	return f*num;
}

int main(){
	cin>>x>>y;
	z=x/y;
	cout<<min(x-z*y,(z+1)*y-x);
}

Measured memory_bytes: 256
import sys

read = sys.stdin.buffer.read
input = sys.stdin.buffer.readline
inputs = sys.stdin.buffer.readlines


# mod=10**9+7
# rstrip().decode('utf-8')
# map(int,input().split())
#import numpy as np

def main():
	n,m,v,p=map(int,input().split())
	A=list(map(int,input().split()))
	A.sort(reverse=True)
	teki=A[p-1]
	
	cnt=1
	d=0
	
	for i in range(p,n):
		if A[i]+m<teki:break
		d+=cnt*(A[i-1]-A[i])
		if d>m*(n-v):break
		cnt+=1
	print(p+cnt+-1)
	
	
	
if __name__ == "__main__":
	main()


Measured memory_bytes: 12496
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <iomanip>
#include <random>
#include <cstdio>
#include <cmath>
#include <climits>
#include <map>
#include <queue>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (int) n; i++)

int main() {
    int n,m;
    cin >> n >> m;
    vector<int> a(n);
    int sum = 0;
    int cnt = 0;
    rep(i,n) {
        cin >> a[i];
        sum += a[i];
    }
    rep(i,n) {
        if (a[i]*4*m >= sum) cnt++; 
    }
    if (cnt >= m) {
        cout << "Yes\n";
    } else {
        cout << "No\n";
    }
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(int argc, char *argv[])
{
	int a,b,c,n;
	scanf("%d %d %d",&a,&b,&c);
	n=a*100+b*10+c;
	if(n%4==0)printf("YES");
	else printf("NO");
	return 0;
}

Measured memory_bytes: 128
/** 
 * THIS IS MOOONI'S CODE !
 * HACK IT IF YOU CAN !
**/
#include <bits/stdc++.h>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  double L;
  cin >> L;
  double d = (double) L / 3;
  cout << fixed << setprecision(10);
  cout << (double) d * d * d << '\n';
  return 0;
}

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

    #define all(v) v.begin(),v.end()
    #define rall(v) v.rbegin(),v.rend()
    #define trav(i,a) for(auto i: a)
    #define ff first
    #define ss second
    #define eb emplace_back
    #define tc(t) ll t; cin>>t; while(t--)
    #define prec(n) fixed<<setprecission(n)
    #define mst(arr,value) memset(arr,value,sizeof(arr))
    
    const long long sz = (long long)1e4+5;
    const long long mx = (long long)2e5+5;
    const long long inf = (long long)1e18;
    const long long mod = (long long)1e9+7;
    
    #define f(i,n)     for(ll i=0;   i<n;  i++)
    #define fab(i,a,b) for(ll i=a;   i<b;  i++)
    #define fr(i,n)    for(ll i=n-1; i>=0; i--)
    #define fba(i,b,a) for(ll i=b-1; i>=a; i--)

    long long pw(long long x,unsigned long long y) { 
        if (y==0) return 1; 
        else if (y%2==0)  return pw(x,y/2)*pw(x,y/2); 
        else return x*pw(x,y/2)*pw(x,y/2);
    }

    int main() {
        ios_base::sync_with_stdio(0);
        cin.tie(NULL);
        cout.tie(NULL);
        ll n, k, cost;
        cin >> n >> k;
        ll a[n];
        f(i, n)
            cin >> a[i];
        ll dp[n];
        f(i, n) dp[i] = inf;
        dp[0] = 0;
        f(i, n) {
            k = min(k, n - i - 1);
            fab(j, i + 1, k + i + 1) {
                dp[j] = min(dp[j], dp[i] + abs(a[j] - a[i]));
            }
        }
        cout << dp[n - 1];
        return 0;
    }

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
 
typedef long long int ll;
#define endl "\n"
#define ff first
#define ss second 
#define pb push_back
#define INF ll(1e18)
#define MOD 1000000007
#define debug(x) cout<<x<<"\n";
#define pll pair<ll,ll>
#define mp make_pair
#define Craig ios_base::sync_with_stdio(false) , cin.tie(NULL);
#define all(v) v.begin(),v.end()
#define MAX 200015
#define vll vector<ll>

int main()
{ 
    ll n,i,k=0,m,j,x,y;
    cin>>n;
    cin>>m;
    m=m*m;
    for(i=0;i<n;i++)
    {
        cin>>x>>y;
        x=x*x;
        y=y*y;
        j=x + y;
        if(abs(j)<=abs(m))k++;
    }
    cout<<k<<endl;
}

Measured memory_bytes: 3616
#include <iostream>
using namespace std;
 
int a[3][3];
int main() {
	for (int i = 0; i < 3; i++) {
		for (int j = 0; j < 3; j++) cin >> a[i][j];
		a[i][1] -= a[i][0]; a[i][2] -= a[i][0]; a[i][0] = 0;
	}
	for (int i = 0; i < 3; i++) {
		if (!(a[0][i] == a[1][i] && a[1][i] == a[2][i])) {
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<bool> vb;
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define INT(str) stoi((str), 0)
#define INTB(str) stoi((str), 0, 2) // 2進数の文字列を int に
 
int main() {
  int X, Y;
  cin >> X >> Y;
  for (int i = 0; i <= X; i++) {
    if (i * 2 + (X - i) * 4 == Y) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
ll c[10000001];
int main() {
    int n;
    cin >> n;
    
    for (int i = 1; i <= n; i++) {
        c[i] = 0;
    }
    for (int i = 1; i <= n; i++) {
        ll j = 1;
        while (j * i <= n) {
            c[j * i]++;
            j++;
        }
    }
    ll ret = 0;
    for (int i = 1; i <= n; i++) {
        ret += i * c[i];
    }
    cout << ret << endl;
    return 0;
}

Measured memory_bytes: 81700
#include <stdio.h>
int main(void){
	char s[11] = { '\0' };
	char t[12] = { '\0' };
	scanf("%s", s);
	scanf("%s", t);
	int i = 0;
	int flg = 1;
	while(s[i] != '\0'){
		if(s[i] != t[i]){
			flg = 0;
			break;
		}
		i++;
	}
	if(flg == 1){
		printf("Yes\n");
	}
	else{
		printf("No\n");
	}
	return 0;
}

Measured memory_bytes: 1648
package main

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

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func nextFloat64() float64 {
	sc.Scan()
	i, e := strconv.ParseFloat(sc.Text(), 64)
	if e != nil {
		panic(e)
	}
	return i
}

func nextString() string {
	sc.Scan()
	return sc.Text()
}

func abs(x int) int {
	if x < 0 {
		return -1 * x
	} else {
		return x
	}
}

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(nil, 10000000000)

	_, _, m := nextInt(), nextInt(), nextInt()

	hs := make([]int, m)
	ws := make([]int, m)

	hsum := make(map[int]int)
	wsum := make(map[int]int)

	bomb := make(map[int]map[int]bool)

	for i := 0; i < m; i++ {
		hs[i], ws[i] = nextInt()-1, nextInt()-1

		if _, ok := bomb[hs[i]]; ok {
			bomb[hs[i]][ws[i]] = true
		} else {
			bomb[hs[i]] = make(map[int]bool)
			bomb[hs[i]][ws[i]] = true
		}

		hsum[hs[i]] += 1
		wsum[ws[i]] += 1

	}

	var hmax int
	var wmax int
	for _, v := range hsum {
		if hmax < v {
			hmax = v
		}
	}
	for _, v := range wsum {
		if wmax < v {
			wmax = v
		}
	}

	checkh := []int{}
	checkw := []int{}

	for k, v := range hsum {
		if v == hmax {
			checkh = append(checkh, k)
		}
	}

	for k, v := range wsum {
		if v == wmax {
			checkw = append(checkw, k)
		}
	}

	ans := hmax + wmax - 1
	for _, ch := range checkh {
		if _, ok := bomb[ch]; !ok {
			continue
		}
		for _, cw := range checkw {
			if _, ok := bomb[ch][cw]; !ok {
				ans = hmax + wmax
				fmt.Println(ans)
				return
			}
		}
	}

	fmt.Println(ans)
}


Measured memory_bytes: 130428
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
using ll = long long;
using P = pair<int,int>;
const long long inf = 1000000001; // const 書き換え禁止
const double PI = 3.14159265358979323846; //M_PI はライブラリ

int main(void){
    int n;
    cin >> n;
    if(n%2==0){
        cout << n << endl;
    }else{
        cout << n*2 << endl;
    }
}

Measured memory_bytes: 3592
#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++)
using Graph = vector<vector<int>>;
const int INF = 10000000;

ll gcd(ll a,ll b){
    if(b == 0) return a;
    return gcd(b,a%b);
}
bool palin(int N){//Nが回文数かどうか
    string S = to_string(N);
    int M = (S.size()-1)/2 + 1;
    int n = S.size();
    bool flag = true;

    for(int i = M;i<n;i++){
        if(S[i] != S[n-i-1]) flag = false;
    }
   return flag;
}
/*まずゴールに辿り着けるかを探索　ゴールまでの距離を求める
最初の白マスの個数ー（距離＋１）が答え
たどり着けない場合、-1を出力
*/
int bfs(int sx,int sy,int gx,int gy,int H,int W,vector<vector<char>> &maze
         ,vector<vector<long long>> &d,vector<int> dx,vector<int> dy){
   queue<P> que;
    que.push(P(sx,sy));
    d[sx][sy] = 0;
    
  while(que.size()){
    
   P p = que.front();
   que.pop();
   if(p.first == gx && p.second == gy){
    break;
    }
    for(int i = 0;i<4;i++){
     int nx = p.first + dx[i],ny = p.second + dy[i];
     
     if(0<=nx && nx <H && 0<=ny && ny <W && maze[nx][ny] != '#' 
         && d[nx][ny] == INF){
         que.push(P(nx,ny));
         d[nx][ny] = d[p.first][p.second] + 1;
        }
       }
    }
      return d[gx][gy];
  }

int main() {
  int H,W;
  cin >> H >> W;
  vector<vector<char>>  maze(H, vector<char>(W));
   for(int i= 0;i<H;i++){
    for(int j = 0;j<W;j++){
     cin >> maze[i][j];
     }
    }
   vector<vector<long long>>  d(H, vector<long long>(W,INF));
   vector<int> dx = {1,0,-1,0};
   vector<int> dy = {0,1,0,-1};
   ll res = bfs(0,0,H-1,W-1,H,W,maze,d,dx,dy);
   int count = 0;//最初の白マスの数
   for(int i= 0;i<H;i++){
    for(int j = 0;j<W;j++){
     if(maze[i][j] == '.') count++;
     }
    }

   if(d[H-1][W-1] == INF) cout << -1 << endl;
   else cout << count - res - 1 << endl;
   
}

Measured memory_bytes: 256
N = int(input())
l = []
for i in range(N):
    h = [int(x) for x in input().split()]
    l.append(h)
DP=[[0 for i in range(3)] for j in range(N+1)]
for j in range(0,N):
    for i in range(3):
        DP[j+1][i%3] = max(DP[j][(i+1)%3]+l[j][i%3], DP[j][(i+2)%3]+l[j][i%3])
print(max(DP[N][0],DP[N][1],DP[N][2]))

Measured memory_bytes: 74328
def judge(h,t,a,b,n):
    counter = 0
    for i in range(n):
        if h[i] > b*t:
            if ((h[i]-b*t)/(a-b))%1 == 0:
                counter += (h[i]-b*t)//(a-b)
            else:
                counter += (h[i]-b*t)//(a-b) + 1
    if counter <= t:
        return True
    else:
        return False

n,a,b = map(int,input().split())
h = []
for i in range(n):
    temp = int(input())
    h.append(temp)

left = 1
right = max(h)//b + 1

while abs(right-left) > 1:
    check = judge(h,(left+right)//2,a,b,n)
    if check:
        right = (left+right)//2
    else:
        left = (left+right)//2

if judge(h,left,a,b,n):
    print(left)
else:
    print(right)

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

int main() {
  int n, l;
  cin >> n >> l;
  vector<int> a(n);
  rep(i,n) {
    a[i] = l+i;
  }
  int s = 0;
  rep(i,n) s += a[i];
  int ans = 1e9;
  rep(i,n) {
    int t = s-a[i];
    if (abs(t-s) < abs(ans-s)) ans = t;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i= (a); i < (b); ++i)
typedef long long ll;
typedef pair<int,int> P;
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
int main() { string s;
  cin >> s;
  if(s[0]==s[2]){
    puts("Yes");
  }else{
    puts("No");
  }
}

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

int64_t MOD = 1000000007;
int64_t MAX = 9223372036854775807;
double PI = 3.141592653589793;

int main()
{
    int D;
    cin >> D;
    cout << "Christmas";
    for (int i = 0; i < 25 - D; i++)
        cout << " Eve";
}

Measured memory_bytes: 256
#include <stdio.h>
#define ll long long int
int main(void){
	ll n,p[5],ans=5,min=1e15;
	scanf("%lld",&n);
	for(int i=0;i<5;i++){
		scanf("%lld",&p[i]);
		if(p[i]<min)min=p[i];
	}
	if(n%min==0)ans += n/min-1;
	else ans += n/min;
	
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 128
int main(void){
    int x, y, z;
    int i, c = 0;
    
    scanf("%d %d %d", &x, &y, &z);
    i = x;
    while(i != y+1){
        if(z % i == 0)
            c++;
        i++;
    }
    printf("%d\n", c);
    return 0;
}


Measured memory_bytes: 2140
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();

		while(n != 0){
			int sumA = 0;
			int sumB = 0;
			for(int i = 0; i < n; i++){
				int a = scan.nextInt();
				int b = scan.nextInt();
				if(a > b){
					sumA = sumA + a + b;
				}else if(b > a){
					sumB = sumB + a + b;
				}else{
					sumA = sumA + a;
					sumB = sumB + b;
				}
			}
			System.out.println(sumA + " " + sumB);
			n = scan.nextInt();
		}
	}
}

Measured memory_bytes: 60116
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, n) for (int i = 1; i <= (int)(n); i++)
#define ll long long
#define umap unordered_map
using graph = vector<vector<int>>;
using graph2 = vector<vector<pair<int, int>>>;

ll mod(ll x, ll y){if(x>=0||x%y==0) return x%y;return y+x%y;} //mod including minus
ll dv0(ll x, ll y){if(x>=0||x%y==0)return x/y;return x/y-1;} //rnd down
ll dv1(ll x, ll y){if(x%y==0) return dv0(x,y);return dv0(x,y)+1;} //rnd up
ll M=1e9+7;
int quick_pow(int x,int p){
    int a=1,po=x;
    while(p){
        if(p&1)  a=1ll*a*po%M;
        po=1ll*po*po%M;p>>=1;
    }
    return a;
}
ll divisornum(ll x){
    ll sum=0;umap<ll, int> dv;
    for(ll i=1;i*i<=x;i++){if(x%i==0){dv[i]=1;dv[x/i]=1;}}
    for(const auto&p : dv){sum++;}
    return sum;
}
//Start from Here
int main(){
    ll N;
    cin>>N;
    //N-1 number of divisor
    ll a;
    a=divisornum(N-1)-1;
    umap<ll, int> dv;
    for(ll i=1;i*i<=N;i++){if(N%i==0){dv[i]=1;dv[N/i]=1;}}
    for(const auto&p : dv){
        if(p.first==1)continue;
        ll b=N;
        while(b%p.first==0){
            b/=p.first;
        }
        if(b%p.first==1){
            a++;
        }
    }
    cout<<a<<endl;
}

Measured memory_bytes: 512
import sys
readline = sys.stdin.readline

A,B,X = map(int,readline().split())

bottle = (A ** 2) * B
x = -1
y = -1
import math
area = X / A
if X < bottle / 2:
  y = (X * 2 / B) / A
  x = B
  print(90 - math.degrees(math.atan(y/x)))
else:
  x = (bottle - X) * 2 / (A ** 2)
  y = A
  if x == 0:
    print(0)
  else:
    print(90 - math.degrees(math.atan(y/x)))


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

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
typedef long double ld;

const int INF = 1e9;
const ld EPS = 1e-8;

int main(){
  int X;
  cin >> X;
  int n = 1;
  while(X > n * (n + 1) / 2) ++n;
  cout << n << endl;
  return 0;
}



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

int main() {
    int n,h,w;cin>>n>>h>>w;
    int ans=0;
    rep(i,n){
        int a,b;cin>>a>>b;
        if(a>=h && b>=w)++ans;
//        else if(a<=w && b<=h)++ans;
    }
    cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3592
import java.util.ArrayList;
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args)
	{
		Scanner s=new Scanner(System.in);
		
		String str=s.next();
		String t=s.next();
		
		int[][] dp=new int[str.length()+1][t.length()+1];
		
		ArrayList<Character> list=new ArrayList<>(); 
		
		for(int i=0;i<str.length();i++)
		{
			for(int j=0;j<t.length();j++)
			{
				if(str.charAt(i)==t.charAt(j))
				{
					dp[i+1][j+1]=1+dp[i][j];
				}
				else
				{
					dp[i+1][j+1]=Math.max(dp[i][j+1],dp[i+1][j]);
				}
			}
		}
	
		int i=str.length();
		int j=t.length();
		
		while(i>0&&j>0)
		{
			if(str.charAt(i-1)==t.charAt(j-1))
			{
				list.add(str.charAt(i-1));
				i--;
				j--;
			}
			else if(dp[i-1][j]>dp[i][j-1])
			{
				i--;
			}
			else
				j--;
		}
		
		for(int k=list.size()-1;k>=0;k--)
		{
			System.out.print(list.get(k));
		}
		
	}
	
}

Measured memory_bytes: 83152