akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
 
typedef long long ll;
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pi pair<ll,int> 
#define pii pair<int,ll>
 
ll mod = 1e9+7;
ll INF = 1e17;
/*ll gcd(ll a,ll b)
{
    if(a==0)
    return(b);
    return(gcd(b%a,a));
}*/
/*ll maxvolume(ll s) 
{ 
    ll l= s / 3; 
    s -= l; 
  
    // finding breadth 
    ll b = s / 2; 
  
    // finding height 
    ll h = s - breadth; 
  
    return l * b * h; 
} */
int main()
{
    double s;
    cin>>s;
    double l=s/3.0;
    s-=l;
    double b=s/2.0;
    double h=s-b;
    cout<<fixed<<setprecision(12)<<l*b*h<<endl;
    return(0);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FO(x) freopen(#x".in","r",stdin),freopen(#x".out","w",stdout)
#define fo(i,j,k) for(int i=(j),end_i=(k);i<=end_i;i++)
#define ff(i,j,k) for(int i=(j),end_i=(k);i< end_i;i++)
#define fd(i,j,k) for(int i=(j),end_i=(k);i>=end_i;i--)
#define DEBUG(x) cerr<<#x<<"="<<x<<endl
#define all(x) (x).begin(),(x).end()
#define cle(x) memset(x,0,sizeof(x))
#define lowbit(x) ((x)&-(x))
#define ll long long
#define ull unsigned ll
#define db double
#define lb long db
#define pb push_back
#define mp make_pair
#define fi first
#define se second
inline int read()
{
	int x=0; char ch=getchar(); bool f=0;
	for(;ch<'0'||ch>'9';ch=getchar()) if(ch=='-') f=1;
	for(;ch>='0'&&ch<='9';ch=getchar()) x=(x<<3)+(x<<1)+(ch^48);
	return f?-x:x;
}
#define CASET fo(___,1,read())

const int N=200010;
const int M=2000000;
namespace Dinic{
	const int inf=2e9;
	int s,t;
	int head[N],cur[N],ne[M],ver[M],val[M],tot=1;
	int d[N];
	queue<int> q;
	inline void add(int x,int y,int v)
	{
		ver[++tot]=y; val[tot]=v; ne[tot]=head[x]; head[x]=tot;
		ver[++tot]=x; val[tot]=0; ne[tot]=head[y]; head[y]=tot;
	}
	inline bool bfs()
	{
		fo(i,0,t) cur[i]=head[i];
		for(;!q.empty();q.pop());
		fo(i,0,t) d[i]=-1; q.push(s); d[s]=0;
		for(int u,v;!q.empty();)
		{
			u=q.front(); q.pop();
			for(int i=head[u];i;i=ne[i])
				if(val[i]&&d[v=ver[i]]==-1)
				{
					d[v]=d[u]+1,q.push(v);
					if(v==t) return 1;
				}
		}
		return 0;
	}
	int dfs(int u,int flow)
	{
		if(!flow||u==t) return flow;
		int res=flow,r,v;
		for(int &i=cur[u];i;i=ne[i])
			if(val[i]&&d[v=ver[i]]==d[u]+1)
			{
				r=dfs(v,min(res,val[i]));
				if(!r) continue;
				val[i]-=r; val[i^1]+=r;
				res-=r; if(!res) break;
			}
		return flow-res;
	}
	int dinic()
	{
		int flow=0;
		while(bfs()) flow+=dfs(s,inf);
		return flow;
	}
}
using namespace Dinic;
int n;
int X[N],Y[N],cnt;
bool vis[N];
void dfs(int u)
{
	for(int i=head[u],v;i;i=ne[i])
		if((v=ver[i])!=s&&!vis[v-n])
		{
			vis[v-n]=1;
			for(int j=head[v];j;j=ne[j])
				if(val[j])
					cnt++,X[v-n]=u,Y[v-n]=ver[j],dfs(ver[j]);
		}
}
int main()
{
	n=read();
	Dinic::t=2*n;
	s=0; t=2*n;
	ff(i,n+1,2*n) CASET add(read(),i,1);
	fo(i,1,n) add(s,i,1);
	ff(i,n+1,2*n) add(i,t,1);
	if(dinic()!=n-1) return puts("-1")&0;
	int root;
	for(int i=head[0];i;i=ne[i]) if(val[i]) root=ver[i];
	dfs(root);
	if(cnt!=n-1) return puts("-1")&0;
	ff(i,1,n) printf("%d %d\n",X[i],Y[i]);
	return 0;
}

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

int main() {
  int a, b;
  cin >> a >> b;
  if (a - 2 * b > 0) cout << a - 2 * b << endl;
  else cout << 0 << endl;
}


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

const ll INF = 1LL << 60;

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

    ll cnt = N / K;
    if (K % 2 == 1) {
        cout << cnt * cnt * cnt << endl;
    } else {
        ll ans = cnt * cnt * cnt;

        // K / 2 の倍数を出す
        ll tmp = 0;
        for (int i = 1; i <= N; i++) {
            if (i % K == (K / 2)) tmp++;
        }
        ans += tmp * tmp * tmp;
        cout << ans << endl;
    }
}

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

bool notPrime[55556];
const int MAX_N=55555;

vector<int>prime;

void prec()
{
    for(int i=2;i<=MAX_N;i++){
        if(notPrime[i])continue;
    prime.push_back(i);
    for(int j=i+i;j<=MAX_N;j+=i)
        notPrime[j]=true;
    }
}





int main()
{
    prec();
    int n;
    cin>>n;
    vector<int>ans;
    for(int i=0;i<prime.size();i++){
        if(ans.size()==n)break;
        if(prime[i]%5==1)ans.push_back(prime[i]);
    }
    for(int i=0;i<n;i++)
        cout<<ans[i]<<' ';



}


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

int main(void){

int N, X, m[110000];
cin >> N >> X;
for (int i=0; i<N; i++) cin >> m[i];
sort(m, m+N);


int left=X;
int count = 0;

 for (int i=0; i<N; i++) {
  left -= m[i];
  count++;
  }
 //count = N;

 while (left >= m[0]){
    left -= m[0];
    count++;
 }
 cout << count << endl;
 return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <string.h>
#define ll long long int
#define pb push_back
#define f(i,n) for(ll i=0;i<n;i++)
#define f1(i,n) for(ll i=1;i<n;i++)

using namespace std;

void solve(){
    //Miles To Go
    ll n,sum=0;
    cin>>n;
    ll a[n];
    f(i,n)
        a[i]=i+1;
    for(ll i=2;i<=n;i+=3)
        a[i]=0;
    for(ll i=4;i<=n;i+=5)
        a[i]=0;
    f(i,n)
        sum+=a[i];
    cout<<sum;
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
	int t;
	//cin>>t;
	//while(t--)
	    solve();
	return 0;
}

Measured memory_bytes: 11464
#include <bits/stdc++.h>
#define REP(i, a, n) for (int i = (a); i < (int)(n); ++i)
#define REPC(i, a, n) for (int i = (a); i <= (int)(n); ++i)
#define ALL(t) t.begin(), t.end()
#define RALL(t) t.rbegin(), t.rend()
#define MATINIT(type, row, col, init)                                          \
  vector<vector<type>>(row, vector<type>(col, init));
#define Yes(cond) cout << (cond ? "Yes" : "No") << endl;
#define YES(cond) cout << (cond ? "YES" : "NO") << endl;
using namespace std;
using LL = long long;
using ULL = unsigned long long;
template <class T> using VEC = std::vector<T>;
template <class T> using MAT = std::vector<std::vector<T>>;
void DUMP() { cerr << endl; }
template <class Head, class... Tail> void DUMP(Head &&head, Tail &&... tail) {
  cerr << head << ", ";
  DUMP(std::move(tail)...);
}
template <typename T> ostream &operator<<(ostream &os, vector<T> &vec) {
  os << "{";
  for (auto v : vec)
    os << v << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, map<T1, T2> &m) {
  os << "{";
  for (auto p : m)
    os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, pair<T1, T2> p) {
  os << "[" << p.first << " " << p.second << "]";
  return os;
}

int main() {
  string s;
  cin>>s;
  int n = s.length();
  int mi = 100000;
  REP(i,0,n-2){
    string t = s.substr(i,3);
    int c = stoi(t);
    mi=min(mi, abs(753-c));
    //DUMP(t,c,mi);
  }
  cout<<mi<<endl;

  return 0;
}


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

void move(int x, int y);

int main(void)
{
	int i, j;
	int a, b;
	int data[20][20];
	
	while (scanf("%d %d", &a, &b)){
		if (a == 0 && b == 0) break;
		
		for (i = 0; i < 20; i++){
			for (j = 0; j < 20; j++){
				data[i][j] = 0;
			}
		}
		
		int n, x, y;
		scanf("%d", &n);
		for (i = 0; i < n; i++){
			scanf("%d %d", &x, &y);
			data[x][y] = -1;
		}
		data[1][1] = 1;
		
		for (i = 1; i <= a; i++){
			for (j = 1; j <= b; j++){
				if (data[i + 1][j] != -1 && data[i][j] != -1){
					data[i + 1][j] += data[i][j];
				}
				if (data[i][j + 1] != -1 && data[i][j] != -1){
					data[i][j + 1] += data[i][j];
				}
			}
		}
		
		printf("%d\n", data[a][b]);
	}
	
	return (0);
}

Measured memory_bytes: 1188
#include <algorithm>
#include <iostream>
#include <stdlib.h>
#include <stdio.h>
#include <string>
#include <vector>
using namespace std;
int main(){
    string S;
    cin >> S;
    int ans;

    /*
    int zero=0;
    int one=0;
    */

    vector<int> cnt(2, 0);
    for(int i=0; i<S.size(); i++){
        cnt[S[i] - '0']++;
    
    /*
        if(S[i]=='0'){
           zero++;
        }else{
            one++;
        }
    */
    }
    
    /*
    if(zero <= one){
        ans = zero;
    }else{
        ans = one;
    }
    */

    ans = min(cnt[0], cnt[1]) * 2;

    cout << ans << endl;
}

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

class Dice{
private:
  int tmp;
public:
  int q[6];
  int operator==(const Dice e){
    for(int i=0; i<=6;i++){//上の面を揃える
      //cout << "a";
      if(i==5){
        this->roll('E');
      } else if(i==6) {
        this->roll('E');
        this->roll('E');
      } else this->roll('N');
      //cout << this->q[0] << " " << this->q[1] << endl;
      if(this->q[0]==e.q[0])break;
    }
    for(int i=0; i<=4;i++){//上の面を固定したまま、横の面をぐるっと一周
      //cout << "b";
      this->roll('E');
      this->roll('N');
      this->roll('W');
      //cout << this->q[0] << " " << this->q[1] << endl;
      if(this->q[0]==e.q[0]&&this->q[1]==e.q[1])break;
    }
    int ans=1;
    for(int i=0; i<6; i++){
      ans*=(this->q[i]==e.q[i]);
    }
    return ans;
  }

  void roll(char d){
    if(d=='N'){
      tmp = q[4];
      q[4] = q[0];
      q[0] = q[1];
      q[1] = q[5];
      q[5] = tmp;
    } else if(d=='E'){
      tmp = q[2];
      q[2] = q[0];
      q[0] = q[3];
      q[3] = q[5];
      q[5] = tmp;
    } else if(d=='W'){
      tmp = q[3];
      q[3] = q[0];
      q[0] = q[2];
      q[2] = q[5];
      q[5] = tmp;
    } else if(d=='S'){
      tmp = q[1];
      q[1] = q[0];
      q[0] = q[4];
      q[4] = q[5];
      q[5] = tmp;
    }
  }
};



int main(){
  Dice d, e;
  for(int i=0; i<6; i++){
    cin >> d.q[i];
  }
  for(int i=0; i<6; i++){
    cin >> e.q[i];
  }

  if(d==e)cout << "Yes" << endl;
  else cout << "No" << endl;
}



Measured memory_bytes: 3100
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<string>
#include<cstring>
#include<climits>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<deque>
#include<tuple>
#include<list>
#include<unordered_map>
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define lb lower_bound
#define pb push_back
#define mp make_pair
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define INF (1 << 30) - 1
#define LLINF (1LL << 61) - 1
// #define int ll
using namespace std;
const int MOD = 1000000007;
const int MAX = 510000;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll a,b;
    cin>>a>>b;
    if(abs(a-b)%2==1){
        cout<<"IMPOSSIBLE"<<endl;
    }
    else{
        cout<<abs(a-b)/2+min(a,b)<<endl;
    }
    return 0;
}

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

/* メモリ食い過ぎ注意 */
#define int long long

typedef long long ll;

int euclid(int a, int b)
{
    if (a < b)
        euclid(b, a);
    if (b == 0)
        return a;
    int r;
    while ((r = a % b))
    {
        a = b;
        b = r;
    }
    return b;
}

/* define const */
const ll INF = (1ll << 60);
const ll MOD = (ll)1e9 + 7;
/* end defineing */

signed main()
{
    string s;
    cin >> s;
    int cnt = 0;
    if (s[0] == '1')
        cnt++;
    if (s[1] == '1')
        cnt++;
    if (s[2] == '1')
        cnt++;
    cout << cnt << endl;
}


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

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> B(M), C(M);
  for (int i = 0; i < M; i++) {
    cin >> C.at(i);
    int b;
    cin >> b;
    while (b--) {
      int c;
      cin >> c;
      B.at(i) += 1 << (c - 1);
    }
  }
  vector<long> DP(1 << N, 1e18);
  DP.at(0) = 0;
  for (int bit = 0; bit < 1 << N; bit++) {
    for (int i = 0; i < M; i++) {
      DP.at(bit | B.at(i)) = min(DP.at(bit | B.at(i)), DP.at(bit) + C.at(i));
    }
  }
  long ans = DP.at((1 << N) - 1);
  cout << ((ans == 1e18) ? -1 : ans) << "\n";
}

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

int main(void){
	int a, b;
	cin >> a >> b;
	int cnt = 1;
	int now = a;
	if(b == 1){
		cout << 0 << endl;
		return 0;
	}
	while(true){
		if(now >= b) break;
		now += a-1;
		cnt++;
	}
	cout << cnt << endl;;
	return 0;
}


Measured memory_bytes: 256
#include <cstdio>

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

    for (int i=0; i<N; ++i) {
        char temp[105];
        scanf("%s", &temp[0]);
        printf("%s\n%s\n", temp, temp);
    }

    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int x,y,a,b,seiritsujoken;//総数x足数y鶴a亀b成立条件seiritsujoken
  cin>>x>>y;
  
  for (a = 0; a <= x; a++) {
      b = x - a;
      seiritsujoken = (x == a + b) && (y == 2 * a + 4 * b);
    
   if (seiritsujoken) {break;}
}
  
   if(x == a + b && y == 2 * a + 4 * b) {cout<< "Yes" << endl;}
    
   else{cout<< "No" << endl;} 
  
  } 

Measured memory_bytes: 3532
#include <iostream>
#include <cstdio>
#include <string>
#include <sstream>
#include <algorithm>
#include <math.h>
#include <map>
#include <iomanip>
#include <vector>
#include <queue>

#define PI 3.14159265359

#define INF 1000000;

using namespace std;


/*
class ElectronicPetEasy
{
public:
	string isDifficult(int st1, int p1, int t1, int st2, int p2, int t2)
	{
		
	}
};
*/






int main()
{
	vector<string> V;
	
	V.push_back("");
	V.push_back(".,!? ");
	V.push_back("abc");
	V.push_back("def");
	V.push_back("ghi");
	V.push_back("jkl");
	V.push_back("mno");
	V.push_back("pqrs");
	V.push_back("tuv");
	V.push_back("wxyz");
	
	int n;
	cin >> n;
	
	for (int i=0; i<n; i++)
	{
		string out = "";
		string inp = "";
		cin >> inp;
		char now;
		int kai;
		now = '0';
		kai = 0;
		for (int j=0; j<inp.length(); j++)
		{
			if (inp[j] == '0')
			{
				if (kai != 0)
				{
					kai--;
					out += V[now-'0'][kai%(V[now-'0'].length())];
				}
				now = inp[j];
				kai = 0;
				continue;
			}
			now = inp[j];
			kai++;
		}
		cout << out << endl;
	}
	
	return 0;
}

Measured memory_bytes: 1216
#include<bits/stdc++.h>
#define ll long long
#define clr(x,i) memset(x,i,sizeof(x))
using namespace std;
const int N=200005;
const ll mod=1e9+7;
inline int read()
{
    int x=0,f=1; char ch=getchar();
    while(ch<'0'||ch>'9') {if(ch=='-') f=-1; ch=getchar();}
    while(ch>='0'&&ch<='9') {x=x*10+ch-'0',ch=getchar();}
    return x*f;
}
int h,n,a[N];
int main()
{
	h=read(); n=read();
	for(int i=1; i<=n; i++){
		int x=read(); h-=x;
	}
	if(h<=0) puts("Yes");
	else puts("No");
}

Measured memory_bytes: 256
nu = gets.to_i
na = Array.new(nu).map{Array.new(1, "+")}
for i in 0..nu - 1
  na[i] = gets.chomp.split("")
end
march = [0, 0, 0, 0, 0]
for i in 0..nu - 1
  if na[i][0] == "M"
    march[0] += 1
  elsif na[i][0] == "A"
    march[1] += 1
  elsif na[i][0] == "R"
    march[2] += 1
  elsif na[i][0] == "C"
    march[3] += 1
  elsif na[i][0] == "H"
    march[4] += 1
  end
end

ans = 0
count = [0, 1, 2]

while count[0] <= 2
  while count[1] <= 3
    while count[2] <= 4
      ans += march[count[0]]*march[count[1]]*march[count[2]]
      count[2] += 1
    end
    count[2] = 2 + count[1]
    count[1] += 1
  end
  count[0] += 1
  count[1] = 1 + count[0]
  count[2] = 2 + count[0]
end

print ans


Measured memory_bytes: 122492
def gcd(a, b)
  if (a == 0)
    return b
  else
    return gcd(b % a, a)
  end
end

def lcm(a, b)
  return a * b / gcd(a, b)
end

a, b = gets.split.map(&:to_i)
puts lcm(a, b)


Measured memory_bytes: 1788
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
  int n, tl;
  vector<int> cs;
  cin >> n >> tl;

  for(int i=0; i<n; i++) {
    int c, t;
    cin >> c >> t;
    if(t <= tl) {
      cs.push_back(c);
    }
  }

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

  if(cs.size() <= 0) {
    cout << "TLE" << endl;
  } else {
    cout << cs[0] << endl;
  }
  return 0;
}

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

#define INF 1001001001
#define MAX 1e18

int main() {
  int n, m;
  cin >> n >> m;
  vector<ll> a(n), b(m);
  rep(i,n) cin >> a[i];
  rep(i,m) cin >> b[i];
  vector<ll> c = convolution(a,b);
  rep(i,c.size()) {
    cout << c[i];
    if (i==c.size()-1) cout << endl; else cout << " ";
  }

  return 0;
}


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

using namespace std;


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


    int n;
    cin >> n;
    int m;
    cin >> m;


    long long t = m * 1900 + (n - m) * 100;
    long long res = t;
    for (int i = 0; i < m; ++i) {
        res <<= 1;
    }
    cout << res << '\n';

    return 0;
}

Measured memory_bytes: 3636
//const int N = 3005;
//ll dp[N][N];
//void _(){
//    ll a,b,c,d,e,f;
//    cin >> a >> b >> c >> d >> e >> f;
//    dp[0][0] = 1;
//    for(int i = 0; i < N; ++i)
//        for(int j = 0; j < N; ++j){
//            if(!dp[i][j]) continue;
//            if(i+100*a < N) dp[i+100*a][j] = true;
//            if(i+100*b < N) dp[i+100*b][j] = true;
//            if(j+c < N) dp[i][j+c] = true;
//            if(j+d < N) dp[i][j+d] = true;
//        }
//    ll s = 0, w = 0;
//    for(int i = 0; i < N; ++i)
//        for(int j = 0; j < N; ++j){
//            if(!dp[i][j]) continue;
//            if(i+j <= f && i/100*e >= j){
//                if(s*i <= j*w){
//                    w = i;
//                    s = j;
//                }
//            }
//        }
//    cout << s+w << ' ' << s << '\n';
//}
//
//
//
#include <iomanip>
#include <vector>
#include <utility>
#include <iostream>
#include <string>
#define all(v) (v).begin(), (v).end()
#define T1 template<typename T> static
using namespace std;
typedef long long ll;
T1 ostream& operator<<(ostream& stream, const vector<T>& t);
T1 istream& read(T, T, istream& = cin);
const int N = 3005;
ll dp[N][N];
void _(){
    ll a,b,c,d,e,f;
    cin >> a >> b >> c >> d >> e >> f;
    dp[0][0] = 1;
    for(int i = 0; i < N; ++i)
        for(int j = 0; j < N; ++j){
            if(!dp[i][j]) continue;
            if(i+100*a < N) dp[i+100*a][j] = true;
            if(i+100*b < N) dp[i+100*b][j] = true;
            if(j+c < N) dp[i][j+c] = true;
            if(j+d < N) dp[i][j+d] = true;
        }
    ll s = 0, w = 0;
    for(int i = 0; i < N; ++i)
        for(int j = 0; j < N; ++j){
            if(!dp[i][j]) continue;
            if(i+j <= f && i/100*e >= j){
                if(s*i <= j*w){
                    w = i;
                    s = j;
                }
            }
        }
    cout << s+w << ' ' << s << '\n';
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(15);
        _();
}


Measured memory_bytes: 59648
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
	int n, w;
	cin >> n >> w;
	vector<ll> weight(n), value(n);
	for(int i = 0; i < n; ++i) {
		cin >> weight[i] >> value[i];
	}
	vector<ll> dp(w + 1, 0);
	for(int j = 0; j < n; ++j) {
		for(int i = w; i >= 0; --i) {
			if (i - weight[j] >= 0) {
				dp[i] = max(dp[i], dp[i - weight[j]] + value[j]);
			}
		}
	}
	ll best = 0;
	for(int i = 0; i <= w; ++i) {
		best = max(best, dp[i]);
	}
	cout << best << '\n';
}


Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
using namespace std;
const int N=3010,Mo=1000000007,P=(Mo+1)/2;
int a[N],f[N][N],g[N][N];
inline int gi() {
    int x=0,o=1;
    char ch=getchar();
    while(ch<'0'||ch>'9') ch=='-'?o=-1:0,ch=getchar();
    while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
    return o*x;
}
int main() {
    int n,Q,ans=0,t=1;
    cin>>n>>Q;
    for(int i=1;i<=n;i++) a[i]=gi();
    for(int i=1;i<=n;i++)
	for(int j=1;j<=n;j++)
	    f[i][j]=(a[i]<a[j]),g[i][j]=(a[i]>a[j]);
    for(int i=1;i<=Q;i++) {
	int x=gi(),y=gi();t=2*t%Mo;
	for(int j=1;j<=n;j++)
	    if(j!=x&&j!=y) {
		g[x][j]=g[y][j]=f[j][x]=f[j][y]=1LL*P*(f[j][x]+f[j][y])%Mo;
		f[x][j]=f[y][j]=g[j][x]=g[j][y]=1LL*P*(g[j][x]+g[j][y])%Mo;
	    }
	f[x][y]=g[x][y]=f[y][x]=g[y][x]=1LL*P*(f[x][y]+g[x][y])%Mo;
    }
    for(int i=1;i<=n;i++)
	for(int j=i+1;j<=n;j++)
	    ans=(ans+1LL*g[i][j]*t)%Mo;
    cout<<ans;
    return 0;
}

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

int main(){
  

  while(1){
      int x,y;
      cin>>x>>y;
      if(x == 0 && y == 0) break;

      if(x > y) swap(x,y);
      cout<<x<<" "<<y<<endl;
    }
  
   return 0;
}


Measured memory_bytes: 3052
from itertools import permutations
n_ver,n_edge = map(int,input().split())
path_mat = [[0]*n_ver for _ in range(n_ver)]
for i in range(n_edge):
    a,b = map(int,input().split())
    a -= 1
    b -= 1
    path_mat[a][b] = 1
    path_mat[b][a] = 1
ans = 0
vers = [i for i in range(n_ver)]
for path in permutations(vers):
    if path[0] != 0:
        continue
    can = True
    for i in range(n_ver-1):
        from_ = path[i]
        to = path[i+1]
        if not path_mat[from_][to]:
            can = False
            break
    if can:
        ans += 1
print(ans)



Measured memory_bytes: 9160
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
#define chmin(a, b) ((a) = min((a), (b)))
#define chmax(a, b) ((a) = max((a), (b)))
#define fs first
#define sc second
#define eb emplace_back
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;

const ll MOD = 1e9 + 7;
const ll INF = 1e18;
const double pi = acos(-1);
const double eps = 1e-10;

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

int main(){
    string s; cin>>s;
    int n = s.size();

    ll Asum = 0;
    ll ans = 0;
    for(int i=0; i<n; i++){
        if(i + 1 < n && s[i] == 'B' && s[i+1] == 'C'){
            ans += Asum;
            i++;
        }
        else if(s[i] == 'A'){
            Asum++;
        }
        else{
            Asum = 0;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <bitset>

using namespace std;

int main() {
    int n,i,j,k=0,temp;
    int pair[11]={
            0b0111111,0b0000110,0b1011011,0b1001111,0b1100110,0b1101101,0b1111101,0b0100111,0b1111111,0b1101111,0b0000000
    };
    vector<int> xtemp;
    vector<vector<int>> x(0,vector<int>());
    do{

        vector<int> xtemp;
        xtemp.push_back(10);
        cin>>j;
        if(j==-1)break;
        for(i=0;i<j;i++){
            cin>>temp;
            xtemp.push_back(temp);
        }
        x.push_back(xtemp);
    }while(temp!=-1);
    for(j=0;j<x.size();j++) {
        for (i = 1; i < x[j].size(); i++) {
            cout << bitset<7>((pair[(unsigned int)x[j][i]]^pair[(unsigned int)x[j][i-1]])) << endl;
        }
    }

   // std::cout << "Hello, World!" << std::endl;
    return 0;
}


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

using namespace std;

#define maxn 100007
#define ll long long int
#define db(x) cout<<#x<<" -> "<<x<<" "<<endl
#define db2(x,y) cout<<#x<<"->"<<x<<", "<<#y<<" -> "<<y<<endl
#define db3(x,y,z) cout<<#x<<" -> "<<x<<" , "<<#y<<" -> "<<y<<" , "<<#z<<" -> "<<z<<endl
#define prt(x) for(auto it:x) { cout<<it<<" "; } cout<<endl
#define IN freopen("input.txt","r",stdin)

int main(){
//    IN ;
    ll a , b;
    cin>>a>>b;
    if(a==b){
        printf("%lld\n",a);
        return 0;
    }
    ll Xor  = 0LL ;
    for(ll i=a; i<=b ; i++){
        if(i%4==0){
            break ;
        }
        Xor^=i;
    }
    for(ll i=b; i>=a ; i--){
        if(i%4==3){
            break;
        }
        Xor^=i;
    }
    printf("%lld\n",Xor);
    return 0;
}


Measured memory_bytes: 256
fn read_line() -> String {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim_right().to_owned()
}

fn str_to_ints(s: String) -> std::vec::Vec<i64> {
    let mut ret = std::vec::Vec::new();
    let ws = s.split_whitespace();
    for w in ws {
        ret.push(w.parse().unwrap());
    }
    ret
}

fn read_ints() -> std::vec::Vec<i64> {
    str_to_ints(read_line())
}

fn f(n: i64) -> i64 {
    if n % 2 == 0 {
        n / 2
    } else {
        3 * n + 1
    }
}

fn main() {
    let s = read_ints()[0];
    let mut set_a: std::collections::HashSet<i64> = std::collections::HashSet::new();

    let mut a: i64 = s;
    for i in 0..1000000 {
        if set_a.contains(&a) {
            println!("{}", i + 1);
            break;
        }
        set_a.insert(a);
        a = f(a);
    }
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
	ll n,c,k,t[114514];
	cin>>n>>c>>k;
	for(int i=0;i<n;i++)cin>>t[i];
	sort(t,t+n);
	ll ans=0,cnt=0,now;
	for(int i=0;i<n;i++){
		if(cnt==0){
			now=t[i]+k;
			cnt=1;
		}else{
			if(t[i]<=now)cnt++;
			else{
				ans++;
				now=t[i]+k;
				cnt=1;
			}
		}
		if(cnt==c){
			ans++;
			cnt=0;
		}
	}
	if(cnt)ans++;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1024
x,y=map(int,input().split())
ans=0
if x==1 and y==1:
  print(1000000)
else:
  if x==3:
    ans+=100000
  if y==3:
    ans+=100000
  if x==2:
    ans+=200000
  if y==2:
    ans+=200000
  if x==1:
    ans+=300000
  if y==1:
    ans+=300000
  print(ans)

Measured memory_bytes: 3064
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
using namespace std;
#define INF 2147483647
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define ARDEB(i,X) cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define ARDEB(i,X) {}
#define END {}
#endif
typedef long long ll;

vector<int> prime;
map<ll,int> prco;
void prfac(ll n){
	ll a=2;
	while(n>=a*a){
		if(n%a==0){
			//prime.push_back(a);
			n/=a;
			prco[a]++;
		}
		else{
			a++;
		}
	}
	//prime.push_back(n);
	prco[n]++;
}

int main(){
    
    ll n,p;
    cin>>n>>p;
    if(p==1){
        cout<<1<<endl;
        return 0;
    }
    if(n==1){
        cout<<p<<endl;
        return 0;
    }
    prfac(p);
    ll ans=1;
    for(auto x:prco){
        ans*=pow(x.first,int(x.second/n));
    }
    cout<<ans<<endl;
    
}


Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <tuple>
#include <cassert>
#include <functional>
#include <set>
#include <deque>
#include <list>
using namespace std;
typedef long long ll;
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
#define LNF __LONG_LONG_MAX__
const ll MOD = 1000000007;
const int MAX = 200000;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
// 法mでのaの逆元を計算
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
// a^n mod を計算する
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
//最大公約数
long long gcd(long long x, long long y){
    if(y==0) return x;
    else return gcd(y,x%y);
}
//最小公倍数
long long lcm(long long x, long long y){
    return x / gcd(x, y) * y;
}
// nが大きく,kが10^7程度の時の二項係数
long long com[200005];
void combination(long long n,long long k){
    com[0] = 1;
    for(int i=1;i<=k;i++){
        com[i] = (com[i-1]*(n-i+1)%MOD)*modinv(i,MOD)%MOD;
    }
}

int main(){
    int N; cin >> N;
    set<char> st;
    for(int i=0;i<N;i++){
        char S; cin >> S;
        st.insert(S);
    }
    int out=st.size();
    if(out==4){
        cout << "Four" << endl;
    }else{
        cout << "Three" << endl;
    }
    return 0;
}


Measured memory_bytes: 3608
#include <iostream>
#include <stdlib.h>
#include <algorithm>

using namespace std;

int main(int argc, char **argv)
{
	int *a, *a2, m, n, t1;
	
	while(1){
		cin >> n >> m;
		if(n == 0){
			break;
		}
		
		a = (int *)calloc(n-m+1, sizeof(int));
		a2 = (int *)calloc(n, sizeof(int));
		
		for(int i = 0; i < n; i++){
			cin >> t1;
			a2[i] = t1;
		}
		
		for(int i = 0; i < m; i++){
			a[0] += a2[i];
		}
		
		for(int i = 0; i < n-m; i++){
			a[i+1] += (a2[m+i] + a[i] - a2[i]);
		}
		
		sort(a, a+(n-m+1));
		cout << a[n-m] << endl;
		
		free(a2);
		free(a);
	}
	
	return 0;
}

Measured memory_bytes: 1280
#include"bits/stdc++.h"
using namespace std;

//RSQ
struct SegmentTree{
private:
	int N;
	vector<long long> node, lazy;
	vector<bool> lazyFlg;
	const long long DEFAULT = 0LL;
public:
	void init(int n){ //初期化 O(N)
		node.clear();
		lazy.clear();
		lazyFlg.clear();
		N = 1;
		while(N < n) N = (N<<1);
		for(int i=0; i<2*N-1; i++){
			node.push_back(DEFAULT);
			lazy.push_back(0LL);
			lazyFlg.push_back(false);
		}
	}
	void eval(int k, int l, int r){ //遅延評価 O(1)
		if(lazyFlg[k]){ //RUQ：下に更新クエリが溜まっていても加算クエリが溜まっていても上書き
			node[k] = lazy[k];
			if(r-l > 1){
				lazy[2*k+1] = lazy[k] / 2;
				lazyFlg[2*k+1] = true;
				lazy[2*k+2] = lazy[k] / 2;
				lazyFlg[2*k+2] = true;
			}
			lazy[k] = 0LL;
			lazyFlg[k] = false;
		}
		else{ //RAQ：下に更新クエリが溜まっていても加算クエリが溜まっていても加算
			node[k] += lazy[k];
			if(r-l > 1){
				lazy[2*k+1] += lazy[k] / 2;
				lazy[2*k+2] += lazy[k] / 2;
			}
			lazy[k] = 0LL;
		}
	}
	void update(int a, long long x){ //[a,a+1)の値を変更 O(log N)
		update(a, a+1, x);
	}
	void update(int a, int b, long long x, int k=0, int l=0, int r=-1){ //[a,b)の値を変更 O(log N)
		if(r == -1) r = N;
		eval(k, l, r);
		if(b <= l || r <= a) return; //交差する場合
		if(a <= l && r <= b){ //完全に含む場合
			lazy[k] = x * (r-l);
			lazyFlg[k] = true;
			eval(k, l, r);
		}
		else{
			update(a, b, x, 2*k+1, l, (l+r)/2);
			update(a, b, x, 2*k+2, (l+r)/2, r);
			node[k] = node[2*k+1] + node[2*k+2];
		}
	}
	void add(int a, long long x){ //[a,a+1)の値に加算 O(log N)
		add(a, a+1, x);
	}
	void add(int a, int b, long long x, int k=0, int l=0, int r=-1){ //[a,b)の値に加算 O(log N)
		if(r == -1) r = N;
		eval(k, l, r);
		if(b <= l || r <= a) return; //交差する場合
		if(a <= l && r <= b){ //完全に含む場合
			lazy[k] += x * (r-l);
			eval(k, l, r);
		}
		else{
			add(a, b, x, 2*k+1, l, (l+r)/2);
			add(a, b, x, 2*k+2, (l+r)/2, r);
			node[k] = node[2*k+1] + node[2*k+2];
		}
	}
	long long sum(int a, int b, int k=0, int l=0, int r=-1){ //[a,b)の和 O(log N)
		if(r == -1) r = N;
		if(b <= l || r <= a) return DEFAULT; //交差する場合
		eval(k, l, r);
		if(a <= l && r <= b) return node[k]; //完全に含む場合
		return sum(a, b, k*2+1, l, (l+r)/2) + sum(a, b, k*2+2, (l+r)/2, r);
	}
};

int main(){
	int N, Q;
	cin >> N >> Q;
	SegmentTree st;
	st.init(N+1);
	for(int q=0; q<Q; q++){
		int c, s, t;
		cin >> c >> s >> t;
		if(c == 0){
			int x; cin >> x;
			st.add(s, t+1, x);
		}
		else cout << st.sum(s, t+1) << endl;
	}
}


Measured memory_bytes: 7140
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<cstdio>
#include<set>
#include<queue>
using namespace std;

typedef long long ll;

int main() {
  int N; cin >> N;
  int A1[101];
  int A2[101];


  for ( int i = 0; i < N; i++ ) cin >> A1[i];
  for ( int i = 0; i < N; i++ ) cin >> A2[i];

  int ans = -1;
  int cnt = 0;
  while(1) {
    int sum = 0;    
    for ( int i = 0; i < N; i++ ) {
      if ( i == cnt ) sum += A1[i] + A2[i];
      else if ( i < cnt ) sum += A1[i];
      else if ( i > cnt ) sum += A2[i];
    }
    ans = max(ans,sum);
    cnt++;
    if( cnt == N ) break;
  }

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


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

int main()
{
  int n;
  cin >> n;
  vector<int> a(n);
  int t;
  for (int i = 0; i < n; i++) {
    cin >> t;
    a[t - 1] = i + 1;
  }
  for (auto&& e : a) {
    cout << e << endl;
  }
}


Measured memory_bytes: 1152
# 2019-11-16 10:55:08(JST)
import sys
# import collections
import math
# from string import ascii_lowercase, ascii_uppercase, digits
# from bisect import bisect_left as bi_l, bisect_right as bi_r
# import itertools
# from functools import reduce
# import operator as op
# from scipy.misc import comb # float
# import numpy as np 

def main():
    n = int(sys.stdin.readline().rstrip())

    digits = math.floor(math.log10(n))
    if  digits % 2 == 0:
        ans = n
    else:
        ans = 10 ** digits - 1
        
    for i in range(1, digits, 2):
        ans -= 10 ** (i+1) - 1 - 10 ** i + 1
    
    print(ans)

if __name__ == "__main__":
    main()


Measured memory_bytes: 3060
#include"bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef vector<int> vi;

int main(void) {
	int X;

	cin >>X;

	for (int i = -1000; i < 1000;i++) {
		for (int j = -1000; j < 1000; j++) {
			if (pow(i, 5) - pow(j, 5) == X) {
				cout << i <<' '<< j;
				return 0;
			}

		}
	}
	

	return 0;
}

Measured memory_bytes: 3980
#include <bits/stdc++.h>
#define boost_io ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define rep(i,a,b) for(int i=a;i<b;i++)
#define num(a) a-'0'
#define maxself(a,b) if(b>a)a=b
#define minself(a,b) if(b<a)a=b;
#define debug(x) cout<<#x<<":"<<x<<" "
#define all(a) (a).begin(), (a).end()
#define vi vector<int>
#define vl vector<long long int>
#define v vector
#define p pair
#define pb push_back
#define mk make_pair
#define f first
#define s second
#define ln "\n"	
typedef long long int ll;
typedef long double ld;
typedef double d;
using namespace std;
ll modF=1e9+7;
ll INF=1e11;

void solve(){
	int n;
	cin>>n;
	vi h(n);
	rep(i,0,n){
		cin>>h[i];
	}
	vi dp(n);
	int ans=0;
	for(int i=n-1;i>=0;i--){
		if(i==n-1){
			dp[i]=1;
		}
		else if(h[i]>=h[i+1]){
			dp[i]=dp[i+1]+1;
		}
		else{
			dp[i]=1;
		}
		maxself(ans,dp[i]);
	}
	cout<<ans-1<<ln;
}

int main(){
	boost_io;
	solve();
	return 0;
}

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

using namespace std;
using ll = long long;

//container util
#define SORT(c) sort((c).begin(),(c).end())

//repetition
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//print
#define pv(val) cerr << #val << '=' << (val) << endl

const int INF = 1e9;

int main(void){

	ll K, A, B; cin >> K >> A >> B;

	ll cnt = 1;

	if(A+1 >= B){
		cnt += K;
	}else{
		if(K > A){
			ll tmp = B - A;
			cnt--;
			K -= A - 1;
			ll hoge = K/A + 1;
			ll foo = K/2*tmp + K%2 + A;
			ll z = min(hoge, K%A) * B;
			cnt += max(foo, z);

		}else if(K <= A) cnt += K;
	}

	cout << cnt << endl;


	return 0;


}


Measured memory_bytes: 256
#include <stdio.h>
int main() {
    int a, b;

    scanf("%d %d", &a, &b);
    
    if (a < b) {
        puts("a < b");
    } else if (a > b) {
        puts("a > b");
    } else {
        puts("a == b");
    }

    return 0;
}
    

Measured memory_bytes: 580
N = int(input())
csf = [[int(i) for i in input().split()] for j in range(N-1)]

for i in range(N-1):
    t = csf[i][1] + csf[i][0]

    for j in range(i+1, N-1):
        if t <= csf[j][1]:
            t = csf[j][1] + csf[j][0]
            continue
        if (t-csf[j][1]) % csf[j][2] == 0:
            t = csf[j][1] + csf[j][2]*((t-csf[j][1])//csf[j][2]) + csf[j][0]
        else:
            t = csf[j][1] + csf[j][2]*((t-csf[j][1])//csf[j][2]+1) + csf[j][0]
    print(t)

print(0)


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

int main() {
    vector<int> shop(5);
    int am, pm;
    while (cin >> am >> pm) {
        if (am == 0 && pm == 0) break;
        shop.clear();
        shop[0] = am + pm;
        for (int i = 1; i < 5; i++) {
            cin >> am >> pm;
            shop[i] = am + pm;
        }
        int max_sum = 0;
        char max_shop = 'A';
        for (int i = 0; i < 5; i++) {
            if (max_sum < shop[i]) {
                max_sum = shop[i];
                max_shop = 'A' + i;
            }
        }
        cout << max_shop << ' ' << max_sum << endl;
        //cout << (char)(shop_i - shop.begin() + 'A') << *shop_i << endl;
    }
    return 0;
}

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

// --------------------------------------------------------------------------------
#define fastio	ios_base::sync_with_stio(false),cin.tie(NULL),cout.tie(NULL)
#define ll long long 
#define mset(arr,val) memset(arr,val,sizeof(arr))
#define deb(name,value) cout <<"->>  "<<name<< "= " <<value<<" "
#define frepi(a,b,k) for(int i=a;i<=b;i+=k)
#define frepj(a,b,k) for(int j=a;j<=b;j+=k)
// --------------------------------------------------------------------------------


void solve_main()
{
    string s;cin>>s;
    int n=s.size();
    frepi(1,n,1)
    {
    	cout<<"x";
    }
}

int main()
{
	// #ifndef ONLINE_JUDGE
 //    	freopen("/home/suryakant/input.txt","r",stdin);
 //        freopen("/home/suryakant/output.txt","w",stdout);
 //    #endif
    int t=1;
    // cin>>t;
    while(t--)
    {
        solve_main();
    }
    
}

Measured memory_bytes: 3612
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        // write your code here
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int x = sc.nextInt();
        int y = sc.nextInt();
        int[] memo = new int[n + 1];

        for (int i = 1; i < n; i++) {
            for (int j = i + 1; j <= n; j++) {
                memo[Math.min(j - i, Math.abs(x - i) + 1 + Math.abs(y - j))]++;
            }
        }

        for (int i = 1; i < n; i++) {
            System.out.println(memo[i]);
        }
    }
}

Measured memory_bytes: 22484
import java.util.Scanner;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    String s = sc.next();
    int ans = 0;
    for(int i = 0; i < 1000; i++){
      String pass = String.format("%03d",i);
      int count = 0;
      for(int j = 0; j < n; j++){
        if(s.charAt(j) == pass.charAt(count)){
          count++;
        }
        if(count == 3){
          ans++;
          break;
        }
      }
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 26600
#include<iostream>
#include<algorithm>

using namespace std;

int main(){
	int n,m,x;
	cin >> n >> m >> x;
	
	int too = 0,ton = 0;
	for(int i = 0;i < m;i++){
		int a;
		cin >> a;
		if(n < x){
			if(n < a && a < x){
				ton++;
			}
		}else{
			if(a < x){
				too++;
			}else if(x < a && a < n){
				ton++;
			}
		}
	}
	
	if(n < x){
		cout << ton << endl;
	}else{
		cout << min(too,ton) << endl;
	}
	
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
#define pb push_back 
#define fr first
#define sc second
#define Rep(i,n) for(int i=0;i<(n);i++)
#define All(v) v.begin(),v.end()
#define Uniq(v) v.erase(unique(All(v)),v.end())
typedef pair<int, int> Pii; 
typedef pair<int, Pii> Pip;
typedef pair<string, int> Psi;
const int INF = (1<<30);
const int dx[]={1,0,-1,0}, dy[]={0,-1,0,1};

int main()
{
  string X;
  int ans;
  
  cin >> X;
  ans = X.size();
  
  int S = 0, T = 0;
  Rep(i, X.size()) {
    //cout << S << " " << T << endl;
    if( X[i] == 'S' ) {
      S ++;
    } else {
      T ++;
      if( S == T ) {
    	ans -= (S + T);
    	S = T = 0;
      } else if( S < T ) {
    	S = T = 0;
      }
    }
  }
     
  if( S && T ) ans -= (min(S, T)) * 2;
     
  cout << ans << endl;
}


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

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

  for(int j=0; j<n; j++) sum=sum+a[j];

  if( sum>= h){cout << "Yes" <<endl;}
  else{cout << "No" <<endl;}

}


Measured memory_bytes: 640
package main

import (
	"fmt"
	"math"
)

func main() {

	var a [5]int
	var mint int
	for i := range a {
		fmt.Scan(&a[i])
	}
	mint = math.MaxInt32
	for i := 0; i < 5; i++ {
		for j := 0; j < 5; j++ {
			if i == j {
				continue
			}
			for k := 0; k < 5; k++ {
				if k == i || k == j {
					continue
				}
				for l := 0; l < 5; l++ {
					if l == i || l == j || l == k {
						continue
					}
					for m := 0; m < 5; m++ {
						if m == i || m == j || m == k || m == l {
							continue
						}
						// a[i], a[j], a[k], a[l], a[m])
						var t, d int
						var b [5]int
						b[0] = a[i]
						b[1] = a[j]
						b[2] = a[k]
						b[3] = a[l]
						b[4] = a[m]
						t += b[0]
						for n := 1; n < 5; n++ {
							d = t % 10
							if d != 0 {
								t += (10 - d)
							}
							t += b[n]
						}
						if mint > t {
							mint = t
						}
					}
				}
			}
		}
	}
	fmt.Println(mint)
}


Measured memory_bytes: 512
a, b, k = map(int, input().strip().split())
result = set()

for small in range(a, min(a + k, b + 1)):
    result.add(small)

for large in range(max(a, b - k + 1), b + 1):
    result.add(large)

result = sorted(list(result))

for r in result:
    print(r)


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

int main() {
  int K,A,B; cin>>K>>A>>B;
  for (int i=1; K*i<=1000; i++) {
    if (K*i>=A && K*i<=B) {
      cout<<"OK"<<endl;
      return 0;
    }
  }
  cout<<"NG"<<endl;
  return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <vector>

using namespace std;
using ll = long long;

ll n;
ll a[100000], b[100000];

int main(void)
{
  cin >> n;
  for (ll i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
  }
  ll ans = 0;
  for (ll i = n - 1; i >= 0; i--) {
    a[i] += ans;
    if (a[i] % b[i] == 0) {
      continue;
    }
    ll n = a[i] / b[i];
    ll d = b[i] * (n + 1) - a[i];
    ans += d;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1792
#include<stdio.h>
int main()
{
    int n,min,max;
    long long sum;
    sum=0;
    min=1000000;
    max=-1000000;
    int i;
    int t;
    scanf("%d",&n);
    for(i=0;i<n;i++)
    {
        scanf("%d",&t);
        if(t<min) min=t;
        if(t>max) max=t;
        sum+=t;
    }
    printf("%d %d %lld\n",min,max,sum);
    return 0;
}



Measured memory_bytes: 2100
import java.util.*;
import java.io.*;
public class Main
{
	public static void main(String args[]) throws IOException
	{
		
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		int n,x,t=0;
		String brr[]=br.readLine().split(" ");
		n=Integer.parseInt(brr[0]);
		x=Integer.parseInt(brr[1]);
		t=Integer.parseInt(brr[2]);
		long ans=0;
		while(n>0)
		{
		ans+=t;
        n-=x;
		}
		System.out.println(ans);
	}
}		

Measured memory_bytes: 32684
#include <bits/stdc++.h>
using namespace std;
#include <boost/multiprecision/cpp_int.hpp> // intは2*10^9まで、int64_tは9*10^18まで
namespace mp = boost::multiprecision;

int main() {
  int64_t n, k, MA = 998244353;
  cin >> n >> k;
  int64_t l[k], r[k];
  mp::cpp_int sum[k] = {0}, ans[n + 1] = {0};
  for (int i = 0; i < k; i++)
    cin >> l[i] >> r[i];
  ans[1] = 1;
  for(int i=0;i<k;i++)
    if(l[i]==1) sum[0] += 1;
  for (int i = 2; i <= n; i++) {
    for (int j = 0; j < k; j++) {
      ans[i] += sum[j];
      ans[i] %= MA;
    }
    for (int j = 0; j < k; j++) {
      if (i - l[j] >= 0) {
        sum[j] += ans[i - l[j] + 1];
        sum[j] %= MA;
      }
      if (i - r[j] >= 1) {
        sum[j] -= ans[i - r[j]];
        sum[j] += MA;
        sum[j] %= MA;
      }
    }
  }
  cout << ans[n];
  return 0;
}

Measured memory_bytes: 9944
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(v) v.begin(),v.end()
using namespace std;
typedef long long ll;
 
int main(){
  int N;
  cin>>N;
  vector<int> P(N);
  int ans=0;
  int mi=10000000;
  rep(i,N) cin>>P[i];
  rep(i,N){
    if(P[i]<mi){
      ans++;
    }
    mi=min(P[i],mi);
  }
  cout<<ans<<endl;
}   

Measured memory_bytes: 4044
import java.util.*;
import java.io.PrintWriter;
public class Main{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		char[] s=sc.next().toCharArray();
		int q=sc.nextInt();
		TreeSet<Integer>[] set=new TreeSet[26];
		for(int i=0; i<26; i++){
			set[i]=new TreeSet<>();
		}
		for(int i=0; i<n; i++){
			set[s[i]-'a'].add(i);
		}
		for(int i=0; i<q; i++){
			int a=sc.nextInt();
			if(a==1){
				int b=sc.nextInt()-1;
				char c=sc.next().charAt(0);
				set[s[b]-'a'].remove(b);
				set[c-'a'].add(b);
				s[b]=c;
			}else{
				int b=sc.nextInt()-1;
				int c=sc.nextInt()-1;
				int ans=0;
				for(int j=0; j<26; j++){
					 Integer ch=set[j].ceiling(b);
         			 if(ch!=null&&ch<=c){
            			ans++;
          			}
				}
				System.out.println(ans);
			}
		}
	}
}


Measured memory_bytes: 105700
#pragma region header
#include <bits/stdc++.h>
using namespace std;

#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_CAT_I(x,y) x ## y
//#define CPP_STR(x) CPP_STR_I(x)
//#define CPP_STR_I(args...) #args
//#define ASSERT(expr...) assert((expr))

using i8 = int8_t;
using u8 = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;
//using f80 = __float80;

constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
constexpr char EL[] = "\n";

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(),(x).end()
#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))
#define UNIQUE(x) (x).erase(unique(all(x)), (x).end());
#define REPIT(x) for(auto it=(x).begin(), end=(x).end(); it!=end; ++it)
#define perm(c) sort(all(c)); for(bool c##p=1;c##p;c##p=next_permutation(all(c)))

template<typename T = i64>
T IN() { T x; cin >> x; return (x); }

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }
template<typename T, size_t N>
i64 SIZE(const T(&)[N]) { return static_cast<i64>(N); }

template<typename T, typename U, typename Comp = less<>>
bool chmax(T& xmax, const U& x, Comp comp = {}) {
	if (comp(xmax, x)) {
		xmax = x;
		return true;
	}
	return false;
}
template<typename T, typename U, typename Comp = less<>>
bool chmin(T& xmin, const U& x, Comp comp = {}) {
	if (comp(x, xmin)) {
		xmin = x;
		return true;
	}
	return false;
}

void print() {
  cout << EL;
}
template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
  cout << head;
  if (sizeof...(tail) != 0) cout << " ";
  print(forward<Tail>(tail)...);
}
template <class T>
void print(vector<T> &vec) {
  for (auto& a : vec) {
	cout << a;
	if (&a != &vec.back()) cout << " ";
  }
  cout << EL;
}
template <class T>
void print(vector<vector<T>> &df) {
  for (auto& vec : df) {
	print(vec);
  }
}

struct ProconInit {
	static constexpr int IOS_PREC = 15;
	static constexpr bool AUTOFLUSH = false;

	ProconInit() {
		cin.tie(nullptr);
		ios::sync_with_stdio(false);
		cout << fixed << setprecision(IOS_PREC);
		if (AUTOFLUSH)
			cout << unitbuf;
	}
} PROCON_INIT;
#pragma endregion

signed solve()
{
	int n;
	cin >> n;
	vector<int> d(n);
	for (int& v : d)
	{
		cin >> v;
	}

	int ans = 0;
	REP(i, n)
	{
		REP(j, n)
		{
			if (i < j)
			{
				ans += d[i] * d[j];
			}
		}
	}
	print(ans);
	return 0;
}

#ifndef LOCALCODE
signed main()
{
	return solve();
}
#endif


Measured memory_bytes: 256