akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define ll  long long int
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define bp __builtin_popcountll
#define MOD 1000000007
#define FAST ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);srand(time(NULL));
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
bool is_prime(ll n)
{
    if(n==0 || n==1)  return 0;
    for(ll i=2;i*i<=n;i++)
    {
        if(n%i==0)   return 0;
    }
    return 1;
}
int main() 
{
    FAST;
    ll n;
    cin >> n;
    for(ll i=n;;i++)
    {
        if(is_prime(i))
        {
            cout<<i;
            return 0;
        }
    }
}


 

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cmath>

using namespace std;

long long compute(long long n) {
    return n * (n+1) / 2;
}

int main() {
    long long X;
    cin>>X;
    // find n such that n(n+1)/2 \ge X
    // n^2 + n + 1/4 \ge 2X + 1/4
    // (n+1/2) \ge \sqrt{2X+1/4}
    // n \ge \sqrt{2X+1/4}-1/2
    long long n = sqrt(2*X+0.25) - 0.5;
    if (compute(n) >= X) {
        cout<<n<<endl;
    } else {
        cout<<n+1<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
/*************************************************************************
    > File Name: a.cpp
    > Author: Amano Sei
    > Mail: amano_sei@outlook.com 
    > Created Time: 2020年01月02日 星期四 21时53分24秒
 ************************************************************************/

#include <cstdio>
#include <algorithm>
#include <cstring>

using namespace std;

char s[105], t[105];

int main(){
    scanf("%s%s", s, t);
    printf("%s%s\n", t, s);
    return 0;
}



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

using namespace std;

typedef double db;
typedef long long ll;
typedef long double ld;
typedef unsigned int ui;
typedef unsigned long long ull;

typedef pair < db, db > pdd;
typedef pair < db, ld > pdl;
typedef pair < ld, db > pld;
typedef pair < ld, ld > ldp;

typedef pair < ll, ll > pll;
typedef pair < int, ll > pil;
typedef pair < ll, int > pli;
typedef pair < int, int > pii;

#define F first
#define S second

#define en end()
#define bg begin()

#define rev reverse
#define mp make_pair
#define pb push_back

#define y1 y1234567890
#define um unordered_map

#define all(x) x.bg, x.en
#define sz(x) (int)x.size()
#define len(x) (int)strlen(x)

#define sqr(x) ((x + 0ll) * (x))
#define sqrd(x) ((x + 0.0) * (x))

#define forn(i, n) for (int i = 1; i <= n; i++)

const ll inf = (ll)1e18;
const ll mod = (ll)1e9 + 7;

const db eps = (db)1e-9;
const db pi = acos(-1.0);

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

const int N = 100500;

map < int, ll > d;

int main() {
	//freopen(".in", "r", stdin);
	//freopen(".out", "w", stdout);
	//freopen(".err", "w", stderr);

	//srand(time(NULL));

	//cin.tie(NULL);
	//cout.tie(NULL);
	//ios_base::sync_with_stdio(false);

	//cout << setprecision(10) << fixed;
	
	ll x, y;
	cin >> x >> y;

	vector < ll > v = {x, -x, y, -y};

	d[x] = d[-x] = d[y] = d[-y] = inf;
	d[x] = 0;

	for (int i = 1; i <= 169; i++) {
		for (int j = 0; j < 4; j++) {
			for (int k = 0; k < 4; k++) {
				if (v[j] <= v[k] && d[v[j]] + v[k] - v[j] < d[v[k]])
					d[v[k]] = d[v[j]] + v[k] - v[j];
				if (v[j] == -v[k] && d[v[j]] + 1 < d[v[k]])
					d[v[k]] = d[v[j]] + 1;
			}
		}
	}

	cout << d[y];

	//cerr << (clock() + 0.0) / CLOCKS_PER_SEC;

	return 0;
}


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

const int MaxN = 2000;

inline int gcd(int a, int b)
{
	while (b > 0)
	{
		a %= b;
		swap(a, b);
	}
	return a;
}

int n;
int a[MaxN + 1];

bool mat[MaxN + 1][MaxN + 1];

bool vis[MaxN + 1];

int deg[MaxN + 1];
vector<int> adj[MaxN + 1];

void dfs_build(const int &u)
{
	vis[u] = true;

	for (int v = 1; v <= n; ++v)
		if (mat[u][v] && !vis[v])
		{
			adj[u].push_back(v), ++deg[v];
			dfs_build(v);
		}
}

struct comparator
{
	inline bool operator()(const int &u, const int &v)
	{
		if (a[u] != a[v])
			return a[u] < a[v];
		return u < v;
	}
};

priority_queue<int, vector<int>, comparator> q;

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

	sort(a + 1, a + n + 1);

	for (int i = 1; i <= n; ++i)
		for (int j = i + 1; j <= n; ++j)
			if (gcd(a[i], a[j]) > 1)
				mat[i][j] = mat[j][i] = true;

	for (int u = 1; u <= n; ++u)
		if (!vis[u])
			dfs_build(u);

	for (int u = 1; u <= n; ++u)
		if (!deg[u])
			q.push(u);

	while (!q.empty())
	{
		int u = q.top();
		q.pop();

		cout << a[u] << ' ';

		for (int v : adj[u])
			if (!--deg[v])
				q.push(v);
	}

	return 0;
}

Measured memory_bytes: 4352
//Operation of Frequency of Apperance
#include<bits/stdc++.h>
using namespace std;

//変換
vector<int> into(vector<int> s){
  map<int, int> mp;
  for(int i=0; i<s.size(); i++){
    if(mp.find(s[i])==mp.end()){
      mp.insert(map<int, int>::value_type(s[i], 1));
    }
    else{
      mp[s[i]]++;
    }
  }
  vector<int> ret;
  for(int i=0; i<s.size(); i++){
    ret.push_back(mp[s[i]]);
  }
  return ret;
}

//判定
bool judge(vector<int> a, vector<int> b){
  for(int i=0; i<a.size(); i++)
    if(a[i]!=b[i])return false;
  return true;
}

int main(){
  int n;
  while(true){
    vector<int> pre, now;
    cin>>n;
    if(n==0)break;
    for(int i=0; i<n; i++){
      int tmp;
      cin>>tmp;
      pre.push_back(tmp);
    }
    int ans=0;
    now=into(pre);
    while(!judge(pre, now)){
      pre=now;
      now=into(pre);
      ans++;
    }
    cout<<ans<<endl;
    for(int i=0; i<n; i++){
      if(i!=n-1)cout<<now[i]<<' ';
      else cout<<now[i]<<endl;
    }
  }
  return 0;
}

Measured memory_bytes: 1216
#include<bits/stdc++.h>
//#include<ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
using namespace std;


#define ff                first
#define ss                second
#define int               long long
#define pb                push_back
#define mp                make_pair
#define pii               pair<int,int>
#define vi                vector<int>
#define mii               map<int,int>
#define pqb               priority_queue<int>
#define pqs               priority_queue<int,vi,greater<int> >
#define setbits(x)        __builtin_popcountll(x)
#define zrobits(x)        __builtin_ctzll(x)
#define mod               1000000007   //10^9 + 7
#define inf               1e18
#define ps(x,y)           fixed<<setprecision(y)<<x
#define mk(arr,n,type)    type*arr = new type[n]
#define w(x)              int x;cin>>x;while(x--)
#define ti(n)             int n;cin>>n
#define rep(i,n)          for(int i=0;i<(n);++i)
#define repA(i,a,n)       for(int i=a;i<=(n);++i)
#define repD(i,a,n)       for(int i=a;i>=(n);--i)
#define itr(type,it,x)    for(type it = x.begin();it!=x.end();it++)
#define endl              "\n"
 mt19937                  rng(chrono::steady_clock::now().time_since_epoch().count());  // to shuffle an array randomly viz. shuffle(arr,arr+n,rng)
 
 //typedef tree<int , null_type , less<int> , rb_tree_tag, tree_order_statistics_node_update> pbds;  //policy based data structure
 
 
 void c_p_c(){
 
       ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	   
	  
	}

	class Activity{
  public:
		int A,B,C;

	};

	int solve(vector<Activity> ac,int n)
	{
         
         int dp[n+1][3];
         dp[1][0]= ac[1].A;
         dp[1][1]=ac[1].B;
         dp[1][2]=ac[1].C;

       for(int i=2;i<=n;++i)
       {
          dp[i][0] = ac[i].A + max(dp[i-1][1],dp[i-1][2]);
          dp[i][1] = ac[i].B + max(dp[i-1][0],dp[i-1][2]);
          dp[i][2] = ac[i].C + max(dp[i-1][1],dp[i-1][0]);

       }

       return  max(dp[n][0],max(dp[n][1],dp[n][2]));
	}
	
	int32_t main(int32_t argc, char const *argv[]){
	
	c_p_c();

   int n,k;
   cin>>n;

   vector<Activity> ac(n+1);

   for(int i=1;i<=n;++i)
   {
   	cin>>ac[i].A;
   	cin>>ac[i].B;
   	cin>>ac[i].C;

   }

   cout<<solve(ac,n)<<endl;

	
	return 0;
	}

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


int main(){
  
  int N;
  cin >> N;
  
  for(int i = 0; i < N; i++){
    char s;
    cin >> s;
    if(s == 'Y'){
      cout << "Four" << endl;
      break;
    }
    else{
      if(i == N - 1){
        cout << "Three" << endl;
      }
      continue;
    }
  }
  
}


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 int ll;

int main() {
  int n; cin >> n;
  vector<int> p(n); rep(i, n) cin >> p[i];
  int ans = 1, s = p[0];
  for (int i = 1; i < n; i++) {
    if (s >= p[i]) {
      ans++;
      s = p[i];
    }
  }
  cout << ans;
  return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <map>
#include <stack>
#include <queue>
#include <sstream>
#define INF 0x3f3f3f3f
using namespace std;

typedef long long ll;
const int mod = 1e9 + 7;
const ll maxn = 1000005;
const double pi = acos(-1.0);

ll n,m;
ll a[maxn];
struct key
{
    ll b,c;
}num[maxn];

bool cmp(key a, key b)
{
    return a.c > b.c;
}

int main()
{
    while(cin >> n >> m)
    {
        memset(a,0,sizeof(a));
        memset(num,0,sizeof(num));
        for(int i = 0; i < n; i ++)
            cin >> a[i];
        sort(a, a + n);
        for(int i = 0; i < m; i ++)
            cin >> num[i].b >> num[i].c;
        sort(num, num + m, cmp);
        ll ans = 0;
        ll pos = 0;
        for(int i = 0; i < n; i ++)
        {
            if(a[i] < num[pos].c && num[pos].b)
            {
                a[i] = num[pos].c;
                ans += a[i];
                num[pos].b --;
            }
            else
                ans += a[i];
            if(num[pos].b == 0)
            {
                if(pos < m - 1)
                    pos ++;
            }
        }
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 23680
#include<iostream>
#include<string>
using namespace std;
string s;
int len,x,y,ans;
int main()
{
	cin>>s;
	len = s.length();
    for(int i=0;i<len;i++)
	{
        if(x == y) {
            x++;
            if(s[i]=='p') ans--;
        }
        else {
            y++;
            if(s[i]=='g') ans++;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 512
#include <stdio.h>
int main()
{
    char a[30];

    scanf("%s",a);

  if(!strcmp(a, "Sunny"))
{
    printf("Cloudy\n");
}
else if(!strcmp(a, "Cloudy"))
{
          printf("Rainy\n");
}
else
{
    printf("Sunny\n");
}

    return 0;
}


Measured memory_bytes: 128
/*in the name of Allah the most beneficent the most merciful.*/
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define MAX 1e18
#define MIN -1e18
#define MOD 1000000007
//#define mod2 20071027
//#define MOD 998244353
// #define base 100001
//#define mod 1000074259
#define base2 31
#define memz(a) memset(a, 0, sizeof(a))
#define memn(a) memset(a, -1, sizeof(a))
#define in1(a) scanf("%lld", &a)
#define in2(a, b) scanf("%lld%lld", &a, &b)
#define TC(c) printf("Case %lld:\n", ++c)
#define out(x) cout << #x << " -> " << x << endl;
#define FAST ios_base::sync_with_stdio(false); cin.tie(NULL);
#define FILE   freopen("input.txt", "r", stdin);  freopen("out.txt", "w", stdout);
using namespace std;
const int N = 300010;
ll t, a, b, c, d;
int solve() {
	cin>>a>>b>>c>>d;
	cout<<max(a*c,max(a*d, max(b*c, b*d)))<<endl;
	return 0;
}
int main()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	return solve();
}

Measured memory_bytes: 3640
l = list(map(int,input().split()))
n = l[0]
k = l[1]
d = list(map(int,input().split()))

n_str = list(str(n))
can_use = []
for i in range(10):
    can_use.append(i)
    
for j in d:
    can_use.remove(j)


for i in range(len(n_str)):
    j = int(n_str[i])
    n_str[i] = j
    

ss = []

for i in range(n * 10 + 1):
    ss.append(n + i)

aaa = 0

for j in ss:
    jl = list(str(j))
    for k in range(len(jl)):
        m = int(jl[k])
        jl[k] = m
    if set(jl) <= set(can_use):
        aaa = jl
        break

bbb = ''
for i in aaa:
    bbb = bbb + str(i)
    
print(int(bbb))

Measured memory_bytes: 7064
#include <bits/stdc++.h>
using namespace std;
int main(){
    char a1,b1,c1,d1;
    int ans,a,b,c,d;
    cin>>a1>>b1>>c1>>d1;
    a=a1-'0';b=b1-'0';c=c1-'0';d=d1-'0';
    for(char i='+';i<='-';i++)
        for(char j='+';j<='-';j++)
            for(char k='+';k<='-';k++){
                ans=a;
                if(i=='+') ans+=b;
                else if(i=='-') ans-=b;
                if(j=='+') ans+=c;
                else if(j=='-') ans-=c;
                if(k=='+') ans+=d;
                else if(k=='-') ans-=d;
                if(ans==7){
                    cout<<a<<i<<b<<j<<c<<k<<d<<"="<<ans<<"\n";
                    return 0;
                }
            }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int N;
    cin >> N;
    vector<int> d(N);
    for(int i=0; i<N; i++){
        cin >> d.at(i);
    }
    int sum=0;
    for(int i=0; i<N; i++){
        for(int j=0; j<N; j++){
            if(i<j){
                sum+=d.at(i)*d.at(j);
            }
        }
    }
    cout << sum << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#define endl "\n"
#define pb push_back
#define f(i,n) for(i=0;i<n;i++)
#define F(i,a,b) for(i=a;a<=b;i++)
#define arr(a,n) for( i=0;i<n;i++)cin>>a[i];
#define fi first
#define se second
#define mp make_pair
#define mod 1000000007
#define YES cout<<"YES"<<endl;
#define Yes cout<<"Yes"<<endl;
#define NO cout<<"NO"<<endl;
#define No cout<<"No"<<endl;
#define yes cout<<"yes"<<endl;
#define no cout<<"no"<<endl;
#define vi vector<ll>
#define ed end()
#define bg begin()
#define sz size()
#define ln length()
#define s() sort(a,a+n);
#define sr() sort(a,a+n,greater<ll>());
#define v()  sort(v.begin(),v.end());
#define vr() sort(v.begin(),v.end(),greater<ll>());
#define mod 1000000007
#define fast() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
ll gcd(ll a, ll b){if(!b)return a;return gcd(b, a % b);}
ll power(ll x,ll y,ll p){ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}
int main() {
    /*#ifndef ONLINE_JUDGE
        // for getting input from input.txt
        freopen("input.txt", "r", stdin);
        // for writing output to output.txt
        freopen("output.txt", "w", stdout);
    #endif*/
        /* 
        Ofcourse it's Hard.
        It's supposed to be Hard.
        If it's easy everyone would do it.
        HARD IS WHAT MAKES IT GREAT

        YESTERDAY U SAID TOMORROW

        SLOWLY BECOMING THE PERSON I 
        SHOULD HAVE BEEN A LONG TIME AGO

        SAME TASK CAN'T BE FOUND DIFFICULT TWICE

        BTBHWSITW

        SPRH TU KAB P

        CP IS ALL ABOUT THINKING 
        YOU HAVE MUCH MORE POTENTIAL THAN U THINK

        AJIT SHIDDAT 10

        UR DAILY ROUTINE 


        */

fast();
//ll t;cin>>t;while(t--)
{
  ll n,k,s=0;
  cin>>n>>k;  
  ll a[n];
  for(int i=0;i<n;i++)
  {
    cin>>a[i];
    
  }
  sort(a,a+n,greater<ll>());
  for(int i=0;i<k;i++)
  {
    s+=a[i];
  }
  cout<<s<<endl;


}
return 0;
}

Measured memory_bytes: 256
input_line = input().split()
num_1 = int(input_line[0])
num_2 = int(input_line[1])
worse = 0
if num_1 == 1:
  worse += 300000
elif num_1 == 2:
  worse += 200000
elif num_1 == 3:
  worse += 100000
if num_2 == 1:
  worse += 300000
elif num_2 == 2:
  worse += 200000
elif num_2 == 3:
  worse += 100000
if num_1 == 1 and num_2 == 1:
  worse += 400000
print(worse)

Measured memory_bytes: 3064
//Himanshu Manwani
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define ul unsigned long int
#define ld long double
#define f(t) for(ll i =0;i<t;i++)
#define vi vector<int>
#define vl vector<ll>
#define pri pair<int,int>
#define mpi map<int,int>
#define prl pair<ll,ll>
#define mp make_pair
#define mpl map<ll,ll>
#define umpl unordered_map<ll,ll>
#define pb push_back
#define ff first
#define ss second
#define MOD 1000000007
#define inf 2e18
#define EPS 1e-3
#define PI 3.1415926535897932385
const double h = 1e-6;
const int MAX_  = 100005;

inline ll mul(ll a, ll b){ return (a * 1ll * b) % MOD; }
inline ll sub(ll a, ll b){ ll c = a - b; if(c < 0) c += MOD; return c; }
inline ll add(ll a, ll b){ ll c = a + b; if(c > MOD) c -= MOD; return c; }
 //////////////////////*********CODE***********/////////////////////
 //////////////////////////////////////////////////////////////////

int main()
 {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    string str1,str2;
    cin>>str1>>str2;
    int n = str1.length();
    int m = str2.length();
    int dp[n+1][m+1];
    memset(dp,0,sizeof(dp));
    for(int i =1;i<=n;i++)
    {
        for(int j=1;j<=m;j++)
        {
            if(str1[i-1] == str2[j-1])
            {
                dp[i][j] = 1+dp[i-1][j-1];
            }
            else
            {
                dp[i][j] = max(dp[i-1][j],dp[i][j-1]);
            }
        }
    }
    string str ="";
    int i = n,j = m;
    while(i>0 && j>0)
    {
        if(str1[i-1] == str2[j-1])
        {
            str += str1[i-1];
            i--,j--;
        }
        else if(dp[i-1][j] > dp[i][j-1])
        {
            i--;
        } 
        else 
        {
            j--;
        }
    }
    reverse(str.begin(),str.end());
    cout << str;

    
    return 0;
 }

Measured memory_bytes: 35456
// include
// ------------------------------------------------
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

// func
// ------------------------------------------------
int CalcSumOfDigit(int n);      // 各桁の和を計算する。
int getDigit(long long n);      // 数字の桁数を取得する。
string upper(string str);       // 英字を大文字に変換する。
string lower(string str);       // 英字を小文字に変換する。

// define
// ------------------------------------------------
#define all(a)        (a).begin(),(a).end()
#define rall(a)       (a).rbegin(),(a).rend()
#define sz(a)         int((a).size())
#define rep(i,n)      for(int(i)=0;(i)<(n);(i)++)
#define repe(i,n)     for(int(i)=0;(i)<=(n);(i)++)
#define vsort(v)      sort((v).begin(),(v).end())
#define rvsort(v)     sort(rall((v)))
#define vi            vector<int>
#define GCD(a,b)      __gcd((a),(b))
#define LCM(a,b)      (a)/GCD((a),(b))*(b)
#define kiriage(a,b)  ((a)+(b)-1)/(b)

const int INF = 1e9;

typedef long long ll;
typedef unsigned long long ull;

// code
// ------------------------------------------------
int main() {

  ll a,b;
  cin >> a >> b;

  ll ans = LCM(a,b);

  cout << ans << endl;

  return 0;
}
// funcの実体
// ------------------------------------------------
int getDigit(ll n)
{
  int i = 1;
  while(1)
  {
    n = n / 10;
    if(n == 0)
      break;
    i++;
  }
  return i;
}
int CalcSumOfDigit(int n)
{
  int s = 0;
  while(n)
  {
    s += n % 10;
    n = n / 10;
  }
  return s;
}

string upper(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(97 <= *itr && *itr <= 122)
    {
      *itr = *itr - 32;
    }
  }
  return str;
}

string lower(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(65 <= *itr && *itr <= 90)
    {
      *itr = *itr + 32;
    }
  }
  return str;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
using namespace std;
#define float long double
typedef vector<int> vi;
#define pb push_back
int dp[100][100001];

int solve(vector<vector<int>> &items,int i,int j){
    if(j < 0 ) return 0;
    if(i == 0 ){
        if(j==0) return dp[i][j] = 0;
        if(items[i][1] == j){
            return dp[i][j] = items[i][0];
        }
        return dp[i][j] = LLONG_MAX/3;
    }
    if(dp[i][j]!=-1) return dp[i][j];

    // we ignote that boi
    int a = solve(items,i-1,j);
    int b = items[i][0]+solve(items,i-1,j-items[i][1]);

    return dp[i][j] = min(a,b);


}


int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n,w;
	cin >> n >> w;
	vector<vector<int>> items;
	for(int i = 0 ; i<n ; i++){
        int wt,val;
        cin >> wt >> val;
        vector<int> temp;
        temp.pb(wt); temp.pb(val);
        items.pb(temp);
	}

	for(int i  =0 ; i< 100;i++){
        for(int j = 0 ;j < 100001 ; j++) dp[i][j] = -1;
    }

    int answer = INT_MAX;
    for(int i = 0 ;i < 100001 ; i++) {
        int temp = solve(items,n-1,i);
        if(temp <= w) answer = i ;
    }
	cout << answer << endl;
}


Measured memory_bytes: 78464
#include<iostream>
#include<vector>
#include<queue>
using namespace std;
struct Edge {
    int d, i, j;
    Edge(int d_, int i_, int j_) : d(d_), i(i_), j(j_) {}
    bool operator< (const Edge& right) const{
        return d > right.d;
    }
};
void calc(int t, vector<vector<pair<int, int > > >& G, vector<int>& distance){
    int new_black = t;
    priority_queue<Edge> temp;
    for (int i = 1; i < G.size(); i++) {
        for (int j = 0; j < G[new_black].size(); j++) {
            if (distance[G[new_black][j].first] != -1) continue;
            int dis = G[new_black][j].second + distance[new_black];
            temp.push(Edge(dis, new_black, G[new_black][j].first));
        }
        while (distance[temp.top().j] != -1) temp.pop();
        distance[temp.top().j] = temp.top().d;
        new_black = temp.top().j;
        temp.pop();
    }
}

int main(){
    int n;
    cin >> n;
    vector<vector<pair<int, int> > > G(n);
    for (int i = 0; i < n; i++) {
        int u, k;
        cin >> u >> k;
        G[u].resize(k);
        for (int j = 0; j < k; j++) {
            int v, c;
            cin >> v >> c;
            G[u][j] = make_pair(v, c);
        }
    }

    vector<int> distance(n, -1);
    distance[0] = 0;
    calc(0, G, distance);
    for (int i = 0; i < n; i++) {
        cout << i << " " << distance[i] << endl;
    }
    return 0;
}



Measured memory_bytes: 9804
#include <stdio.h>
#include <stdbool.h>

#define SIZE 200000

bool binarySearch(int [], int, int);

int main(void)
{
    int i, n, m, b, A[SIZE];
    bool flag = true;

    scanf("%d", &n);
    for (i = 0; i < n; i++)
        scanf("%d", A + i);
    
    scanf("%d", &m);
    for (i = 0; i < m; i++) {
        scanf("%d", &b);
        if (!binarySearch(A, n, b)) {
            flag = false;
            break;
        }
    }
    puts(flag ? "1" : "0");

    return 0;
}

bool binarySearch(int A[], int N, int k)
{
    int low, mid, high;
    low = 0;
    high = N;
    while (low < high) {
        mid = (low + high) / 2;
        if (A[mid] == k)
            return true;
        else if (A[mid] < k)
            low = mid + 1;
        else
            high = mid;
    }
    return false;
}


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

using namespace std;

map< vector< int >, int > beet_aizu;
set< vector< int > > used;

bool uku(vector< int > beet, bool f) {
  if(f && beet[0] == 0 && beet[1] == 1 && beet[2] == 2) {
    return true;
  }
  for(auto &s : beet_aizu) {
    if(s.second > 0) {
      vector< int > tree_one(3);
      tree_one[0] = beet[s.first[0]];
      tree_one[1] = beet[s.first[1]];
      tree_one[2] = beet[s.first[2]];
      s.second--;
      if(uku(tree_one, true)) return true;
      s.second++;
    }
  }
  return false;
}

int main() {
  int N;

  cin >> N;
  for(int i = 0; i < N; i++) {
    int W;
    cin >> W;
    vector< int > vv{0, 1, 2};
    for(int j = 0; j < W; j++) {
      int x;
      cin >> x;
      if(x == 0) swap(vv[0], vv[1]);
      else swap(vv[1], vv[2]);
    }
    beet_aizu[vv]++;
  }
  vector< int > oio{0, 1, 2};
  if(uku(oio, false)) cout << "yes" << endl;
  else cout << "no" << endl;
}


Measured memory_bytes: 3164
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
using ll = long long;
int main(){ 
    ll n,b=0,c=0;
    cin>>n;
    vector<ll> a(n);
    rep(i,n) cin>>a[i];
    vector<ll> d(n);
    rep(i,n) d[i]=a[i];
    sort(d.begin(),d.end());
    b=d[n-1];
    c=d[n-2];
    rep(i,n){
        if(a[i]!=b){
            cout<<b<<endl;
        }else{
            cout<<c<<endl;
        }
    }
    return 0;
}


Measured memory_bytes: 4736
#include<iostream>
#define pb push_back
#define inf 0x3f3f3f3f
#define ll long long
#define endl '\n'
#define pii pair<int,int>
#define mem(a,val) memset(a,val,sizeof(a))
#define mkp make_pair
#define speed ios_base::sync_with_stdio(0);cin.tie(0);
using namespace std;
int main(){
 int x,ans=0;
  cin>>x;
  for(int i=1 ; i<=180 ; i++){
    if(360*i%x==0) ans=360*i/x;
    if(ans) break;
  }
  cout<<ans<<endl;
}


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

int main(){
	lli i,j,k=0,l,n,m;
	cin >> n >> m;
	for(i=0;i<m;i++){cin >> l;
	k=k+l;
	}
	if(k>=n)cout << "Yes" ;
	else cout << "No";
			return 0;
}



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

int main(){
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  while (a != 0 && c != 0){
    c -= b;
    if(c <= 0){
      cout << "Yes" << endl;
      exit(0);
    }
    a -= d;
    if(a <= 0){
      cout << "No" << endl;
      exit(0);
    }
  }
  return 0;
}


Measured memory_bytes: 3608
#![allow(unused_imports, unused_macros, dead_code)]

macro_rules! min {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        it.next().map(|z| it.fold(z, |x, y| min!(x, y)))
    }};
    ($x:expr) => ($x);
    ($x:expr, $($ys:expr),*) => {{
        let t = min!($($ys),*);
        if $x < t { $x } else { t }
    }}
}
macro_rules! max {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        it.next().map(|z| it.fold(z, |x, y| max!(x, y)))
    }};
    ($x:expr) => ($x);
    ($x:expr, $($ys:expr),*) => {{
        let t = max!($($ys),*);
        if $x > t { $x } else { t }
    }}
}


macro_rules! ewriteln {
    ($($args:expr),*) => { let _ = writeln!(&mut std::io::stderr(), $($args),*); };
}
macro_rules! trace {
    ($x:expr) => { ewriteln!(">>> {} = {:?}", stringify!($x), $x) };
    ($($xs:expr),*) => { trace!(($($xs),*)) }
}
macro_rules! put {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        if let Some(x) = it.next() { print!("{}", x); }
        for x in it { print!(" {}", x); }
        println!("");
    }};
    ($x:expr) => { println!("{}", $x) };
    ($x:expr, $($xs:expr),*) => { print!("{} ", $x); put!($($xs),*) }
}

const M: i64 = 1_000_000_007;

fn main() {
    let mut sc = Scanner::new();
    let n: usize = sc.cin();
    let k: usize = sc.cin();
    let mut xs: Vec<usize> = sc.vec(n);
    let mut ys: Vec<usize> = sc.vec(n);
    xs.sort(); ys.sort(); xs.reverse();
    // trace!(&xs, &ys);
    if xs.iter().sum::<usize>() <= k {
        put!(0);
        return;
    }

    let mut left = 0; // cannot achieve
    let mut right = xs[0] * ys[n-1]; // can achieve
    {
        for _ in 0..40 {
            let mut rest = k;
            let mid = (left + right) / 2;
            let ok = {
                let mut ok = true;
                for i in 0..n {
                    if xs[i] * ys[i] <= mid {
                        continue;
                    }
                    let dk = xs[i] - mid / ys[i];
                    if dk <= rest {
                        rest -= dk;
                    } else {
                        ok = false;
                    }
                }
                ok
            };
            // trace!(mid, ok);
            if ok {
                right = mid;
            } else {
                left = mid;
            }
        }
    }
    put!(right);
}

use std::io::{self, Write};
use std::str::FromStr;
use std::collections::VecDeque;

struct Scanner { stdin: io::Stdin, buffer: VecDeque<String>, }
impl Scanner {
    fn new() -> Self { Scanner { stdin: io::stdin(), buffer: VecDeque::new() } }
    fn cin<T: FromStr>(&mut self) -> T {
        while self.buffer.len() == 0 {
            let mut line = String::new();
            let _ = self.stdin.read_line(&mut line);
            for w in line.split_whitespace() {
                self.buffer.push_back(String::from(w));
            }
        }
        self.buffer.pop_front().unwrap().parse::<T>().ok().unwrap()
    }
    fn chars(&mut self) -> Vec<char> { self.cin::<String>().chars().collect() }
    fn vec<T: FromStr>(&mut self, n: usize) -> Vec<T> { (0..n).map(|_| self.cin()).collect() }
}


Measured memory_bytes: 17536
def yakusu(x):
    ans=[1]
    check=2
    while(x!=1 and check <= int(x**0.5)+2):
        if(x%check==0):
            ans.append(check)
            while(x%check==0):
                x=x//check
        check+=1
    if x != 1:
        ans.append(x)
    return ans
def main():
    a,b = map(int,input().split())	
    ans=0
    y1=yakusu(a)
    for i in y1:
        if b%i==0:
            ans+=1
    print(ans)

main()

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const static ll MOD = 1e9+7;



int main() {
    ll N, K; cin >> N >> K;
    vector<ll> A(N); for(int i = 0; i < N; i++) cin >> A[i];
    vector<bool> DP(K+1); DP[0] = false;
    for(auto v : A){
       DP[v] = true;
    }
    for(int i = 0; i < K+1; i++){
        if(DP[i]) continue;
        bool flag = false;
        // 1つでもfalse を見つける
        for(auto v : A){
            if(i-v>0){
                if(!DP[i-v]) flag = true;
            }
        }
        DP[i] = flag;
    }
    if(DP[K]) cout << "First" << endl;
    else cout << "Second" << endl;

}

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

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

#define repa(i, a, b) for (auto i = (a); i <= (b); i++)
#define repd(i, a, b) for (auto i = (a); i >= (b); i--)
#define rep(i, n) for (int i = 0; i < n; i++)
#define all(x) (x).begin(), (x).end()
#define zero(a)  memset((a), 0, sizeof (a))
#define sz(x) (int)(x).size()
#define debug(x) cout << (x) << "\n";
#define mp make_pair
#define pb push_back

void solve() {
    int k;
    cin >> k;
    int sum = 0;
    repa(a, 1, k) repa(b, 1, k) repa(c, 1, k) sum += gcd(a, gcd(b, c));
    cout << sum;
	cout << "\n";
}

int main() {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	solve();
	return 0;
}

Measured memory_bytes: 3656
/*author:revolIA*/
/*明日を変えるなら今日変えなきゃ*/
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 1e5+7,mod = 1e9+7;
ll T1,T2;
ll A1,A2,B1,B2;
int main(){
    scanf("%lld%lld",&T1,&T2);
    scanf("%lld%lld",&A1,&A2);
    scanf("%lld%lld",&B1,&B2);
    A1 *= T1,A2 *= T2;
    B1 *= T1,B2 *= T2;
    ll delt1 = A1-B1;
    ll delt2 = A2-B2;
    if(delt1<0)delt1 *= -1,delt2 *= -1;
    ll delt = delt1+delt2;
    if(delt == 0)return 0*printf("infinity\n");
    if(delt > 0){
        printf("0\n");
    }else{
        ll ans;
        ans = (delt1/(-delt))*2+1;
        if(delt1%(-delt)==0)
            ans --;
        printf("%lld\n",ans);
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <string>
#include <bitset>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define fin(ans) cout<<(ans)<<endl
#define STI(s) atoi(s.c_str())
#define mp(p,q) make_pair(p,q)
#define pb(n) push_back(n)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define Sort(a) sort(a.begin(),a.end())
#define Rort(a) sort(a.rbegin(),a.rend())
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
const int P = 1000000007;
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;



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

    string s;
    cin>>s;
    if(s.length()==2){
        if(s[0]==s[1])cout<<"1 2"<<endl;
        else cout<<"-1 -1"<<endl;
        return 0;
    }
    for(int i=0;i<s.length()-2;i++){
        if(s[i+0]==s[i+1]||s[i+1]==s[i+2]||s[i+0]==s[i+2]){
            cout<<i+1<<" "<<i+3<<endl;
            return 0;
        }
    }
    cout<<"-1 -1"<<endl;

//////////////////////////////////////////////////////
return 0;}

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

typedef long long ll;

int main() {
  ll N, sum;
  cin >> N;

  sum = (ll)0;
  if( N != 1 ) {
    for ( ll m = 1; m*m <= N; m++ ) {
      ll t = N/m - 1;
      if ( N/t == N%t ) { sum += t; }
    }
  }

  cout << sum << endl;
  return 0;
}

Measured memory_bytes: 256
n,k = map(int, input().split())

di ={}
for i in range(1, n+1):
  di[i] = 0

for i in range(k):
  d = int(input())
  l = list(map(int, input().split()))
  for ii in range(d):
    no = l[ii]
    di[no] +=1

ans = 0
for i in di.values():
  if i == 0:
    ans += 1

print(ans)

Measured memory_bytes: 9156
#include<bits/stdc++.h>
using namespace std;
int n,k;
int h[200100];
int main(){
	cin>>n>>k;
	for(int i=1;i<=n;i++)
		cin>>h[i];
	sort(h+1,h+n+1);
	if(k>=n){
		cout<<0<<endl;
		return 0;
	}
	long long res=0LL;
	for(int i=1;i<=n-k;i++)
		res+=h[i];
	cout<<res<<endl;
	return 0;
} 

Measured memory_bytes: 1024
A,B,C,X,Y = map(int,input().split())
if A+B < C*2:
    print(A*X+B*Y)
elif X > Y:
    if A < C*2:
        print(Y*C*2+(X-Y)*A)
    else:
        print(X*C*2)
else:
    if B < C*2:
        print(X*C*2+(Y-X)*B)
    else:
        print(Y*C*2)

Measured memory_bytes: 38348
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
typedef vector<double> VD;
typedef vector<VD> VVD;

template<typename T> void chmin(T &a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T &a, T b) { if (a < b) a = b; }

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

int main() {
    int n;
    cin >> n;
    cout << 180 * (n - 2) << endl;
    return 0;
}

Measured memory_bytes: 256
a,b,c,d = map(int,[input() for i in range(4)])
ans = 0
for i in range(a+1):
    for j in range(b+1):
        for n in range(c+1):
            if 500 * i + 100 * j + 50 * n == d:
                ans += 1
print(ans)

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

typedef long long ll;
const int N = 200005;
const ll INF = 1e18;

int n, m;
vector<pair<int,ll>> add[N];
vector<pair<int,ll>> del[N];
ll T[N << 2], lz[N << 2];

void push(int v,int l,int r) {
	if (lz[v]) {
		T[v] += lz[v];
		if (l < r) {
			lz[v << 1] += lz[v];
			lz[v << 1 | 1] += lz[v]; 
		}
		lz[v] = 0;
	}
}

void upd(int v,int l,int r,int L,int R,ll x) {
	push(v, l, r);
	if (L > r || R < l) {
		return;
	}
	if (L <= l && R >= r) {
		lz[v] = x; 
		push(v, l, r);
		return;
	}
	int mid = (l + r) >> 1;
	upd(v << 1, l, mid, L, R, x);
	upd(v << 1 | 1, mid + 1, r, L, R, x);
	T[v] = max(T[v << 1], T[v << 1 | 1]);
}

ll get(int v,int l,int r,int L,int R) {
	push(v, l, r);
	if (L > r || R < l) {
		return -INF;
	}
	if (L <= l && R >= r) {
		return T[v];
	}
	int mid = (l + r) >> 1;
	return max(get(v << 1, l, mid, L, R), get(v << 1 | 1, mid + 1, r, L, R));
}

int main() {
	scanf("%d %d", &n, &m);
	for (int i = 1; i <= m; ++i) {
		int l, r; ll x; 
		scanf("%d %d %lld", &l, &r, &x);
		add[l].push_back(make_pair(l - 1, x));
		del[r].push_back(make_pair(l - 1, x));
	}
	ll ans = 0;
	for (int i = 1; i <= n; ++i) {
		for (auto q : add[i]) {
			upd(1, 0, n, 0, q.first, q.second);
		}
		ll now = get(1, 0, n, 0, i - 1);
		ans = max(ans, now);
		upd(1, 0, n, i, i, now);
		for (auto q : del[i]) {
			upd(1, 0, n, 0, q.first, -q.second);
		}
	}
	printf("%lld\n", ans);
}


Measured memory_bytes: 34560
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <iomanip>
#include <queue>

using namespace std;

int main() {
    int a, b;
    cin >> a >> b;
    
    if(a >= 13) {
        cout << b << endl;
    }
    else if(a >= 6) {
        cout << b / 2 << endl;
    }
    else {
        cout << 0 << endl;
    }
    
    return 0;
}



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

#define llint long long int

using namespace std;

int main(){
    int N, M;

    cin >> N >> M;

    int A = 0;

    for(int i = 0; i < M; i ++){
        int temp;

        cin >> temp;

        A += temp;
    }
    if(N - A < 0){
        cout << -1 << endl;
    }else{
        cout << N - A << endl;
    }
}

Measured memory_bytes: 3624
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int[] a = new int[n];
        double total = 0;
        int count = 0;
        for(int i=0; i<n; i++) {
            a[i] = sc.nextInt();
            total += a[i];
        }
        for(int i=0; i<n; i++) {
            if(total/4/m <= a[i] ) {
                count++;
            }
        }
        if(count < m) System.out.println("No");
        else System.out.println("Yes");
    }
}

Measured memory_bytes: 27180
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;

class Program
{
    static void Main()
    {
        var NK = ReadLine().Split().Select(int.Parse).ToArray();
        var N = NK[0];
        var K = NK[1];
        var h = ReadLine().Split().Select(int.Parse).ToArray();

        var dp = Enumerable.Repeat(int.MaxValue, N).ToArray();
        dp[0] = 0;
        for (int i = 0; i < N; i++)
        {
            for (int j = 1; j <= K; j++)
            {
                if (i - j >= 0) dp[i] = Math.Min(dp[i], Math.Abs(h[i] - h[i - j]) + dp[i - j]);
            }
        }
        WriteLine(dp[N - 1]);
    }
}


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

int main(){
	int n;
	cin >> n;
	
	vector<long long int> subsum(n);
	long long int sum=0;
	for(int i=0; i<n; i++){
		long long int tmp;
		cin >> tmp;
		sum += tmp;
		subsum[i] = sum;
	}
	
	long long int ans = 1e18;
	for(int i=0; i<n-1; i++){
		ans = min(ans, llabs(subsum[i]-(subsum[n-1]-subsum[i])));
	}
		
	cout << ans << endl;
	return 0;
}

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

int main()
{
    int n, m;
    cin >> n >> m;
    vector<int> h(n+1), ma(n+1);
    for(int i=1; i<=n; i++){
        cin >>h[i];
        ma[i] = 0;
    }
    rep(i, m){
        int a, b;
        cin >> a >> b;
        ma[a] = max(ma[a], h[b]);
        ma[b] = max(ma[b], h[a]);

    }
    int ans = 0;
    for(int i = 1; i<=n; i++){
        ans += h[i]>ma[i];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3968
#include<stdio.h>
#include <stdlib.h>
int main(){

    int n,m,j,b,ai,l;
    unsigned long long int  a[101][101], gh[101][101],ans[101][101];
     
    scanf("%d %d %d",&n,&m,&l);
    for(j=0;j<101;j++){
        for(b=0;b<101;b++){
            ans[j][b]=0;
            a[j][b]=0;
            gh[j][b]=0;
        }
    }
    for(j=0;j<n;j++){
        for(b=0;b<m;b++){
            scanf("%d",&a[j][b]);
        }
    }
    for(j=0;j<m;j++){
        for(b=0;b<l;b++){
            scanf("%d",&gh[j][b]);
        }
    }
    for(j=0;j<n;j++){
        for(b=0;b<l;b++){
            for(ai=0;ai<m;ai++){
                ans[j][b]+=a[j][ai]*gh[ai][b];
            }
        }
    }
        for(j=0;j<n;j++){
            for(b=0;b<l;b++){
                if(b==0){printf("%llu",ans[j][b]);
                }
                else{
                    printf(" %llu",ans[j][b]);
                }
            }printf("\n");
        }
        scanf("%d",&n);
    return 0;
}

Measured memory_bytes: 848
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        long x = sc.nextInt();
        ArrayList<Long> fact5 = getFact5();
        for(int i = 0; i <= 10000; i++){
            for(int j = 0; j <= 10000; j++){
                long chk = fact5.get(i);
                long chk2 = fact5.get(j);
                if(chk + chk2 == x){
                    System.out.println(i + " " + -j);
                    return;
                }else if(chk - chk2 == x){
                    System.out.println(i + " " + j);
                    return;
                }else if(-chk + chk2 == x){
                    System.out.println(-i + " " + -j);
                    return;
                }else if(-chk - chk2 == x){
                    System.out.println(-i + " " + j);
                    return;
                }
            }
        }
    }
    
    public static ArrayList<Long> getFact5(){
        int n = 10000;
        ArrayList<Long> li = new ArrayList<Long>();
        for(int i = 0; i <= n; i++){
            long chk = (long)Math.pow(i,5);
            li.add(chk);
        }
        return li;
    }
}


Measured memory_bytes: 28156
using System;
using System.Linq;

class Program
{
	static void Main(string[] args)
	{
		// 入力
        var n = int.Parse(Console.ReadLine());
		string[] input = Console.ReadLine().Split(' ');
        var s = input[0];
		var t = input[1];

        var a = "";
        for (int i = 0; i < n; i++)
        {
            a = a + s[i];
            a = a + t[i];
        }

        Console.WriteLine(a); 
	}
}

Measured memory_bytes: 11092
#include <bits/stdc++.h>
#define PI 3.14159265359
#define NIL (-1)
#define LL long long
using namespace std;
const int64_t MOD = 1e9 + 7;
const int INF = INT_MAX;

int main() {
	int64_t L, R;
	cin >> L >> R;

	int64_t a, b;
	a = (L - 1) / 2019;
	b = R / 2019;

	int64_t ret = INF;
	if (b - a == 0) {
		for (int64_t i = L; i < R; i++) {
			for (int64_t j = i + 1; j <= R; j++) {
				int64_t n = (i % 2019) * (j % 2019) % 2019;
				ret = min(ret, n);
			}
		}
	}
	else {
		ret = 0;
	}

	cout << ret << endl;
}

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

struct dice {
  int label[7];
};

struct dice *make_dice(int *num) {
  int i;
  struct dice *dice1;
  dice1 = (struct dice *)malloc(sizeof(struct dice));
  for(i = 1;i <= 6;i++) {
    dice1->label[i] = num[i];
  }
  return dice1;
}

void turnS(struct dice *a) {
  int temp;
  temp = a->label[1];
  a->label[1] = a->label[5];
  a->label[5] = a->label[6];
  a->label[6] = a->label[2];
  a->label[2] = temp;
}

void turnW(struct dice *a) {
  int temp;
  temp = a->label[1];
  a->label[1] = a->label[3];
  a->label[3] = a->label[6];
  a->label[6] = a->label[4];
  a->label[4] = temp;
}

void turnN(struct dice *a) {
  int temp;
  temp = a->label[1];
  a->label[1] = a->label[2];
  a->label[2] = a->label[6];
  a->label[6] = a->label[5];
  a->label[5] = temp;
}

void turnE(struct dice *a) {
  int temp;
  temp = a->label[1];
  a->label[1] = a->label[4];
  a->label[4] = a->label[6];
  a->label[6] = a->label[3];
  a->label[3] = temp;
}

void spin(struct dice *a) {
  turnS(a);
  turnE(a);
  turnN(a);
}


int main() {
  int i,j,a,b,q,num[7];
  struct dice *dice1;
  for(i = 1;i <= 6;i++) {
    scanf("%d", num+i);
  }
  dice1 = make_dice(num);

  scanf("%d",&q);
  for(;q > 0;q--) {
    scanf("%d %d", &a, &b);
    for(i = 0;i < 4;i++) {
      for(j = 0;j < 4;j++) {
	if(dice1->label[1] == a && dice1->label[2] == b) break;
	spin(dice1);
      }
      if(dice1->label[1] == a && dice1->label[2] == b) break;
      turnW(dice1);
    }
    for(i = 0;i < 4;i++) {
      for(j = 0;j < 4;j++) {
	if(dice1->label[1] == a && dice1->label[2] == b) break;
	spin(dice1);
      }
      if(dice1->label[1] == a && dice1->label[2] == b) break;
      turnS(dice1);
    }    
    printf("%d\n", dice1->label[3]);
  }

  return 0;
}

Measured memory_bytes: 596
package main

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

var sc *bufio.Scanner

const bufferSize = 1024

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

var production bool

func debugf(format string, v ...interface{}) {
	if !production {
		fmt.Printf(format, v...)
	}
}

func answer(reader io.Reader, writer io.Writer) {
	sc = bufio.NewScanner(reader)
	buf := make([]byte, bufferSize)
	sc.Buffer(buf, 1e+7)
	sc.Split(bufio.ScanWords)
	a := make([][]bool, 3)
	b := map[int][]int{}
	for i := range a {
		a[i] = make([]bool, 3)
		for j := range a[i] {
			v := nextInt()
			b[v] = []int{i, j}
		}
	}
	n := nextInt()
	for i := 0; i < n; i++ {
		v := nextInt()
		if _, ok := b[v]; ok {
			a[b[v][0]][b[v][1]] = true
		}
	}

	for i := 0; i < 3; i++ {
		if a[i][0] && a[i][1] && a[i][2] {
			_, _ = fmt.Fprint(writer, "Yes")
			return
		}
		if a[0][i] && a[1][i] && a[2][i] {
			_, _ = fmt.Fprint(writer, "Yes")
			return
		}
	}
	if a[0][0] && a[1][1] && a[2][2] {
		_, _ = fmt.Fprint(writer, "Yes")
		return
	}
	if a[2][0] && a[1][1] && a[0][2] {
		_, _ = fmt.Fprint(writer, "Yes")
		return
	}

	_, _ = fmt.Fprint(writer, "No")
}

func main() {
	production = true
	answer(os.Stdin, os.Stdout)
}


Measured memory_bytes: 640
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long a = sc.nextLong();
        long b = sc.nextLong();
        long c = sc.nextLong();
        long d = c - a - b;
        if (d > 0 && 4 * a * b < d * d) {
            System.out.println("Yes");
            return;
        }
        System.out.println("No");
    }

}


Measured memory_bytes: 22612
' Imports System.Collections.Generic
' Imports System.Text.RegularExpressions

Class Main
    Public Shared Sub Main()
        Dim S As String = Console.ReadLine()
        Dim ans As Integer = 0
        For i As Integer = 0 To Math.Floor(Len(S) / 2) - 1
            If S(i) <> S(Len(S) - i - 1) Then
                ans += 1
            End If
        Next
        Console.WriteLine(ans)
        Return
    End Sub
End Class


Measured memory_bytes: 26384
#include"iostream"
#include"math.h"
#include"string"
using namespace std;
int main(void) {
	int long a, b, aA = 0, bB = 0;
	string Ast, Bst;
	cin >> a >> b;
	for (int i = 0; i < b; i++) {
		aA += a * pow(10, i);
	}
	for (int i = 0; i < a; i++) {
		bB += b * pow(10, i);
	}
	Ast = to_string(aA);
	Bst = to_string(bB);
	if (Bst > Ast) {
		cout << aA;
	}
	else {
		cout << bB;
	}


}

Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <string>
#include <unordered_set>
#include <unordered_map>
#include <sstream>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <numeric>

#define repAll(n) (n).begin(), (n).end()
#define repConAll(n) (n).cbegin(), (n).cend()

using namespace std;

namespace {

}

int main()
{
	int a = 0, b = 0;

	cin >> a >> b;

	double c = (double(a) + double(b)) / 2.;

	int ic = (int)c;

	if ((c - ic) > 0) {
		++ic;
	}

	cout << ic << endl;

	return 0;
}

Measured memory_bytes: 256