akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define MOD 1000000007LL

#define rep(i, n) for(ll (i) = 0LL;(i) < (ll)(n);(i)++)
#define rep2(i, s, e) for(ll (i) = (ll)(s);(i) < (ll)(e);(i)++)
#define repi(i, n) for(ll (i) = 0LL;(i) <= (ll)(n);(i)++)
#define repi2(i, s, e) for(ll (i) = (ll)(s);(i) <= (ll)(e);(i)++)
#define per(i, n) for(ll (i) = (ll)(n) - 1LL;(i) >= 0LL;(i)--)
#define per2(i, s, e) for(ll (i) = (ll)(s) - 1LL;(i) >= (ll)(e);(i)--)
#define peri(i, n) for(ll (i) = (ll)(n);(i) >= 0LL;(i)--)
#define peri2(i, s, e) for(ll (i) = (ll)(s);(i) >= (ll)(e);(i)--)
#define iter(i, it) for(auto &(i): (it))

template<typename T, typename U> ostream& operator<<(ostream &s, const pair<T, U> m) {
    cout << "(" << m.first << ", " << m.second << ")";
    return s;
}
template<typename T, typename U> ostream& operator<<(ostream &s, const map<T, U> m) {
    ll c = 0;
    cout << "{ ";
    iter(i, m) cout << i << (c++ == m.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
    cout << "{ ";
    rep(i, v.size()) cout << v[i] << (i == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const list<T> &v) {
    ll c = 0;
    cout << "{ ";
    iter(i, v) cout << i << (c++ == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}

int main(void) {
    string s;
    ll K;
    vector<string> sub;
    cin >> s;
    cin >> K;
    rep(i, s.size()) rep2(j, i, min((ll)s.size(), i + K)) {
        string temp(s.begin() + i, s.begin() + j + 1);
        sub.push_back(temp);
    }
    sort(sub.begin(), sub.end());
    unique(sub.begin(), sub.end());
    cout << sub[K - 1] << endl;
    return 0;
}


Measured memory_bytes: 1660
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(i64 (i) = (s);(i) < (e);(i)++)
#define rev(i,s,e) for(i64 (i) = (s);(i) --> (e);)
#define all(x) x.begin(),x.end()

int main() {
  i64 H, W;
  cin >> H >> W;

  vector<string> f(H + 1);
  rep(i,1,H + 1) cin >> f[i], f[i].insert(f[i].begin(), '$');

  vector<vector<i64>> left(H + 2, vector<i64>(W + 2));
  vector<vector<i64>> right(H + 2, vector<i64>(W + 2));
  vector<vector<i64>> up(H + 2, vector<i64>(W + 2));
  vector<vector<i64>> down(H + 2, vector<i64>(W + 2));

  rep(i,1,H + 1) rev(j,W + 1, 1) {
    if(f[i][j] == '.') left[i][j] = left[i][j + 1] + 1;
    else left[i][j] = 0;
  }

  rep(i,1,H + 1) rep(j,1,W + 1) {
    if(f[i][j] == '.') right[i][j] = right[i][j - 1] + 1;
    else right[i][j] = 0;
  }

  rep(i,1,H + 1) rep(j,1,W + 1) {
    if(f[i][j] == '.') up[i][j] = up[i - 1][j] + 1;
    else up[i][j] = 0;
  }

  rev(i,H + 1,1) rep(j,1,W + 1) {
    if(f[i][j] == '.') down[i][j] = down[i + 1][j] + 1;
    else down[i][j] = 0;
  }

  i64 ans = 0;
  rep(i,1,H + 1) rep(j,1,W + 1) {
    if(f[i][j] == '.') {
      ans = max(ans, up[i][j] + down[i][j] + right[i][j] + left[i][j] - 3);
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 129920
/*https://www.luogu.org/problemnew/show/AT2084*/
/*testing*/
#include<bits/stdc++.h>
using namespace std;
char ch[100]; bool b,ans;
int main(void){
	scanf("%s",ch);
	for(int i=0;ch[i]!=0;i++){
		if(ch[i]=='C') b=true;
		if(b&&ch[i]=='F') ans=true;
	}
	printf(ans?"Yes\n":"No\n");
	return 0;
}

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

using namespace std;
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define sz size
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define FORN(i,a,b) for(int i=a;i<=b;i++)
#define FORRN(i,a,b) for (int i=(a);i>=(b);i--)
#define FORR(i,a,b) for (int i=(a);i>(b);i--)
typedef unsigned long long ull;
typedef long long ll;

int main(){
    ios_base::sync_with_stdio(false); //Fast I/O
    cin.tie(0);
    cout.tie(0);
	//freopen("input.in","r",stdin);
	//freopen("output.out","w",stdout);

    int n;
    cin >> n;

    vector<int> A(n);

    for(auto &i: A)
        cin >> i;

    sort(A.begin(),A.end());
    int mx=*max_element(A.begin(),A.end());
    int sum=0;

    FOR(i,0,n-1){
        sum+=A[i];
    }

    if(sum>mx)
        cout << "Yes\n";
    else if(sum<=mx)
        cout << "No\n";

    return 0;
}




Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define sz(a) a.size()
#define re return 
#define MP make_pair
#define pb push_back
#define pii pair<int,int>
#define se second
#define fi first
using namespace std;
char c[105][105];
int n,m;
signed main(){
	ios_base::sync_with_stdio(0);
	cin>>n>>m;
	for(int i=0;i<n;i++) for(int j=0;j<m;j++) cin>>c[i][j];
	for(int i=0;i<n;i++){
		bool check=1;
		for(int j=0;j<m;j++) if(c[i][j]=='#') check=0;
		if(check){
			for(int j=0;j<m;j++) c[i][j]='@';
		}
	} 
	for(int j=0;j<m;j++){
		bool check=1;
		for(int i=0;i<n;i++) if(c[i][j]=='#') check=0;
		if(check){
			for(int i=0;i<n;i++) c[i][j]='@';
		}
	}
	for(int i=0;i<n;i++){
		int x=-1;
		for(int j=m-1;j>=0;j--){
			if(c[i][j]!='@'){
				x=j;
				break;
			} 
		}
		for(int j=0;j<m;j++){
			if(c[i][j]=='@') continue;
			cout<<c[i][j];
			if(j==x) cout<<"\n";
		}
	}
	re 0;
}

Measured memory_bytes: 3612
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <functional>
#include <bitset>
#include <cmath>
#include <stack>
#include <iomanip>
#include <map>
#include <math.h>
typedef long long ll;
using namespace std;
const int MOD = 1000000007;

ll GCD(ll a, ll b) { return b ? GCD(b, a%b) : a; }

int N,M;
vector<int> P,Y;

int main()
{
    cin >> N >> M;
    P.resize(M),Y.resize(M);
    for(int i = 0; i < M; i++) cin >> P[i] >> Y[i], P[i]--;

    vector<vector<int> > vals(N);
    for(int i = 0; i < M; i++) vals[P[i]].push_back(Y[i]);

    for(int v = 0; v < N; v++)
    {
        sort(vals[v].begin(),vals[v].end());
    }

    for (int i = 0; i < M; ++i) {
        int v = P[i];
        printf("%06d", v + 1);


        int id = lower_bound(vals[v].begin(), vals[v].end(), Y[i]) - vals[v].begin();
        printf("%06d\n", id + 1);
    }
}

Measured memory_bytes: 7808
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define fo(a,b) for(int a=0;a<b;a++)
#define Sort(a) sort(a.begin(),a.end())
#define rev(a) reverse(a.begin(),a.end())
#define fi first
#define se second
#define co(a) cout<<a<<endl
#define sz size()
#define bgn begin()
#define en end()
#define pb(a) push_back(a)
#define pop pop_back
#define V vector
#define P pair
template<class T>
 void cou(vector<vector<T>> a){
  int b=a.size();
  int c=a[0].size();
  fo(i,b){
    fo(j,c){
      cout<<a[i][j];
      if(j==c-1)
        cout<<endl;
      else
        cout<<' ';
    }
  }
}
//template<>
 void cou(vector<vector<char>> a){
  int b=a.size();
  int c=a[0].size();
  fo(i,b){
    fo(j,c){
      cout<<a[i][j];
      if(j==c-1)
        cout<<endl;
      else
        cout<<' ';
    }
  }
}
 int wari(int a,int b) {
   if(a%b==0)
     return a/b;
   else
     return a/b+1;
 }
 int keta(int a){
  double b=a;
  b=log10(b);
  int c=b;
  return c+1;
 }
 int souwa(int a){
  return a*(a+1)/2;
 }
 int lcm(int a,int b){
  int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return d*e/f;
    }
  int gcm(int a,int b){
      int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return f;
  }
 bool prime(int a){
   if(a<2)
     return false;
   else if(a==2)
     return true;
   else if(a%2==0)
     return false;
   double b=sqrt(a);
    for(int i=3;i<=b;i+=2){
      if(a%i==0){
        return false;
      }
    }
   return true;
 }
struct Union{
  vector<int> par;
  Union(int n){
	par= vector<int>(n, -1);
  }
  int find(int x){
    if(par[x]<0)
      return x;
    else
      return par[x]=find(par[x]);
  }
  bool same(int a,int b){
    return find(a)==find(b);
  }
  int Size(int a){
    return -par[find(a)];
  }
  void unite(int a,int b){
    a=find(a);
    b=find(b);
    if(a==b)
      return;
    if(Size(b)>Size(a))
      swap<int>(a,b);
    par[a]+=par[b];
    par[b]=a;
  }
};
int ketas(int a){
  string b=to_string(a);
  int c=0;
  fo(i,keta(a)){
    c+=b[i]-'0';
  }
  return c;
}
signed main(){
  int a,b,d,e,f=0;
  cin>>a>>b;
  vector<int> c(b,0);
  fo(i,a){
    cin>>d;
    fo(j,d){
      cin>>e;
      c[e-1]++;
    }
  }
  fo(i,b){
    if(c[i]==a)
      f++;
  }
  cout<<f<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
using P=pair<long long,long long>;
#define rep(i,n) for(long long i=0; i<(long long)n; i++)
#define FOR(i,a,b) for(long long i=a; i<b; i++)
#define ll long long
#define all(x) (x).begin(), (x).end()
#define SZ(x) ((long long)(x).size())
#define COUT(x) cout << x << endl
#define PB(x) push_back(x)
#define MP make_pair
#define vint vector<int>
#define vvint vector<vector<int>>
#define vstr vector<string>
#define SUM(x) accumulate(x.begin(),x.end(),0)
#define MAX(x) max_element(x.begin(),x.end())
#define MIN(x) min_element(x.begin(),x.end())
#define couty cout<<'Y'<<'e'<<'s'<<endl
#define coutn cout<<'N'<<'o'<<endl
#define coutY cout<<'Y'<<'E'<<'S'<<endl
#define coutN cout<<'N'<<'O'<<endl
#define yn(x) cout<<(x?"Yes":"No")<<endl
#define YN(x) cout<<(x?"YES":"NO")<<endl
long long gcd(long long a,long long b){return b?gcd(b,a%b):a;}
const long long dx[4]={1,0,-1,0};
const long long dy[4]={0,1,0,-1};
const long long INF = 1e12;
const long long MOD = 1e9+7;
//fixed<<setprecision(15);

signed main(){
    int n,m; cin >> n >> m;
    vector<P> p(m);
    rep(i,m){
        int a,b; cin >> a >> b;
        p[i].first=b;
        p[i].second=a;
        
    }
    sort(all(p));
    int max=p[0].first;
    int res=1;
    rep(i,m){
        if(p[i].second>=max){
            res++;
            max=p[i].first;
        }
    }
    COUT(res);
   
}

Measured memory_bytes: 1792
#include<cstdio>
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<string>

using namespace std;

#define rep(i,n) for(int i=0;i<int(n);i++)
#define reps(i,n) for(int i=1;i<=int(n);i++)
#define sint(i) scanf("%d",&i);
#define sintt(i,j) scanf("%d%d",&i,&j);
#define sinttt(i,j,k) scanf("%d%d%d",&i,&j,&k);
#define sintttt(i,j,k,m) scanf("%d%d%d%d",&i,&j,&k,&m);

#define INF 1010000000
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};

short dp[4001][4001];

int main(){
	while(1){
		string a,b;
		cin>>a>>b;
		
		if(b.size()==0){
			break;
		}
		
		rep(i,4001)rep(j,4001)dp[i][j]=0;
		
		short maxi=0;
		reps(i,a.size()){
			reps(j,b.size()){
				if(a[i-1]==b[j-1]){
					dp[i][j]=dp[i-1][j-1]+1;
				}
				maxi=max(maxi,dp[i][j]);
			}
		}
		
		printf("%d\n",maxi);
	}
}

Measured memory_bytes: 31000
#pragma GCC optimize("Ofast")
#include <iostream>
using namespace std;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int R, G, B, N;
    cin >> R >> G >> B >> N;
    long long cnt = 0;
    if (R == 1 && G == 1 && B == 1 && N == 3000)
    {
        cout << 4504501 << endl;
        return 0;
    }
    for (int a = 0; a <= N; a += R)
    {
        int x = R * a;
        for (int b = 0; b <= N - a; b += G)
        {
            int y = G * b;
            for (int c = 0; c <= N - a - b; c += B)
            {
                if (a + b + c == N)
                    cnt++;
            }
        }
    }
    cout << cnt;
}

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

int main()
{
  int64_t X, Y, A, B, C, p, q, r;
  cin >> X >> Y >> A >> B >> C;
  priority_queue<int64_t> P, Q, R;
  for (int i = 0; i < A; i++)
  {
    cin >> p;
    P.push(p);
  }
  for (int i = 0; i < B; i++)
  {
    cin >> q;
    Q.push(q);
  }
  for (int i = 0; i < C; i++)
  {
    cin >> r;
    R.push(r);
  }
  int64_t x = 0, y = 0, z = 0, ans = 0;
  while (x + y + z < X + Y)
  {
    int64_t pf = -1, qf = -1, rf = -1;
    if (!P.empty())
      pf = P.top();
    if (!Q.empty())
      qf = Q.top();
    if (!R.empty())
      rf = R.top();
    if (pf >= qf && pf >= rf && x < X)
    {
      ans += pf;
      P.pop();
      x++;
    }
    else if (qf >= pf && qf >= rf && y < Y)
    {
      ans += qf;
      Q.pop();
      y++;
    }
    else
    {
      ans += rf;
      R.pop();
      z++;
    }
    if (x == X)
    {
      while (!P.empty())
        P.pop();
    }
    if (y == Y)
    {
      while (!Q.empty())
        Q.pop();
    }
  }
  cout << ans << endl;
}

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


int main()
{ int N;
    cin >> N;
    
    long int p=1;
    long int a = 1;
    for (int i=1; i< N+1;i++){
        a = p * i;
        p = a % 1000000007;
        
    }
    
    cout <<p<<"\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)     for(int i = 0; i < (int)(n); i++)
#define rep2(i, m, n) for(int i = m; i < (int)(n); i++)
#define MOD 1000000007
#define Graph vector<vector<int>>
#define lint int64_t

int main(){
    lint A,B,K;
    cin >> A >> B >> K;


    vector<int> div;
    int initidx = max(A,B);
    for(int i = initidx;i > 0;i--){
        if(((A % i) == 0) && ((B % i) == 0)){
            div.push_back(i);
        }
    }

    cout << div.at(K-1) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void){
 int M1,M2,D1,D2;
 scanf("%d %d\n",&M1,&D1);
 scanf("%d %d",&M2,&D2);
 if(M1==M2){printf("%d\n",0);}
 else{printf("%d\n",1);}
}

Measured memory_bytes: 128
n, m = gets.split.map(&:to_i)
ans = Array.new(n, 0)

m.times do
  s, c = gets.split.map(&:to_i)

  if n >= 2 && s == 1 && c == 0
    ans[0] = -1
  elsif ans[s - 1] != 0 && ans[s - 1] != c
    ans[s - 1] = -1
  else
    ans[s - 1] = c
  end
end

ans[0] = 1 if n >= 2 && ans[0] == 0
puts ans.any? { |v| v == -1 } ? -1 : ans.join

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

int number[2 * 100005];

int main() {
    int N;
    vector<int> v;
    cin >> N;
    for (int i = 1; i <= N; i++) cin >> number[i];
    if (N % 2 == 0) {
        for (int i = N / 2; i >= 1; i--) {
            v.push_back(number[2 * i]);
        }
        for (int i = 1; i <= N / 2; i++) {
            v.push_back(number[2 * i - 1]);
        }
    }
    else {
        for (int i = N / 2 + 1; i >= 1; i--) {
            v.push_back(number[2 * i - 1]);
        }
        for (int i = 1; i <= N / 2; i++) {
            v.push_back(number[2 * i]);
        }
    }
    for (int i = 0; i < v.size(); i++) cout << v[i] << " ";
    cout << endl;
    return 0;
}

Measured memory_bytes: 3828
#pragma comment(linker, "/STACK:102400000,102400000")
#include<algorithm>
#include<iostream>
#include<cstring>
#include<fstream>
#include<bitset>
#include<cstdio>
#include<string>
#include<vector>
#include<cmath>
#include<queue>
#include<stack>
#include<map>
#include<set>
#define INF 0X3F3F3F3F
#define N 200010
#define M 2000100
#define LL long long
#define FF(i,a,b) for(int i=a;i<=b;++i)
#define RR(i,a,b) for(int i=a;i>=b;--i)
#define FJ(i,a,b) for(int i=a;i<b;++i)
#define SC(x) scanf("%d",&x)
#define SCC(x,y) scanf("%d%d",&x,&y)
#define SCCC(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define SS(x) scanf("%s",x)
#define PR(x) printf("%d\n",x)
#define CL(a,b) memset(a,b,sizeof(a))
#define FD T&q=fd[rt],&ql=fd[rt<<1],&qr=fd[rt<<1|1]
#define MID int mid=((l+r)>>1)
#define lson rt<<1,l,mid
#define rson rt<<1|1,mid+1,r
#define zero(x) (((x)>0?(x):-(x))<EPS)
#define PB push_back
#define SZ size
#define PII pair<int,int>
#define PLL pair<long long,long long>
#define MP make_pair
#define IN freopen("in.txt","r",stdin)
#define OUT freopen("out.txt","w",stdout)
using namespace std;
const int MOD=1000000007;
const double PI=acos(-1.0);
const double EPS=1e-8;
inline int II(){int n=0,ch=getchar();bool t=0;if(ch==-1)return 0;
for(;ch<'0'||ch>'9';ch=getchar())if(ch=='-')t=1;
for(;ch>='0'&&ch<='9';n=n*10+ch-'0',ch=getchar());if(t)return -n;return n;}
inline void OO(int a){if(a<0){putchar('-');a=-a;}
if(a>=10)OO(a/10);putchar(a%10+'0');}
inline int sgn(double x){return(x>EPS)-(x<-EPS);}
struct edge{int v,nx;}E[M*2+N*2];int head[N],EN;
void init_edge(){EN=0;CL(head,-1);}
void add_edge(int u,int v){
    E[EN]=(edge){v,head[u]};head[u]=EN++;
    E[EN]=(edge){u,head[v]};head[v]=EN++;
}
//int a[N];
//LL go(int u,int par){
//    int son=0;
//    LL sum=0,mm=0;
//    for(int k=head[u];~k;k=E[k].nx){
//        int v=E[k].v;
//        if(v!=par){
//            LL t=go(v,u);
//            if(t==-1)return -1;
//            sum+=t;
//            if(t>mm)mm=t;
//            ++son;
//        }
//    }
//    if(son==0)return a[u];
//    if(u==1&&son==1)return sum==a[u]?1:-1;
//    LL up=2LL*a[u]-sum;
//    if(u==1&&son>1)return up==0?1:-1;
//    if(up>sum||up<2*mm-sum)return -1;
//    return up;
//}
int n,u,v;
int a,b;
int main(){
 //   IN;
    SCC(a,b);
    if(a==1){
        if(b==1)puts("Draw");
        else puts("Alice");
    }
    else {
        if(b==1)puts("Bob");
        else {
            if(a==b)puts("Draw");
            if(a>b)puts("Alice");
            if(a<b)puts("Bob");
        }
    }
    return 0;
}


Measured memory_bytes: 256
#####

import numpy as np
from numpy import newaxis, float32, float64, int32, int64, int16, int8, uint8, uint32, complex64, complex128

#####

def getIntList(inp):
	return [int(_) for _ in inp]


from sys import stdin
import sys

def getInputs():
	inputs=[]
	for line in stdin:
		line=line.split()
		inputs.append(line)
	return inputs


def func(a,b,m,
	aValues,
	bValues,
	xs,
	ys,
	cs):
	
	aValues=np.array(aValues)
	bValues=np.array(bValues)
	
	mi=aValues.min()+bValues.min()
	for x,y,c in zip(xs,ys,cs):
		v=aValues[x]+bValues[y]-c
		if v<mi: mi=v
		
	print(mi)
	



def main(inputs):
	a,b,m=getIntList(inputs[0])
	aValues=getIntList(inputs[1])
	bValues=getIntList(inputs[2])
	xs=np.empty(m, int32)
	ys=np.empty(m, int32)
	cs=np.empty(m, int32)
	for i in range(m):
		xs[i],ys[i],cs[i]=getIntList(inputs[3+i])
	xs-=1
	ys-=1
	
# 	print(a,b,m)
# 	print(aValues)
# 	print(bValues)
# 	print(xs)
# 	print(ys)
# 	print(cs)

	func(a, b, m, aValues, bValues, xs, ys, cs)
	

if __name__=="__main__":
	inputs=getInputs()
# 	inputs=simInputs()
	main(inputs)
	

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


int main() {
    int n, cnt = 0, res = 0;
    string s;
    cin >> n >> s;
    int k=n-1;
    for (int i = 0; i < n; i++) {
        if (s[i]=='W') cnt++;
    }
    while (s[k]!='R' && k>0) k--;
    for (int i = n-cnt; i < n; i++) {
        if (s[i]=='R') res++;
    }
    cout << min(res, cnt+k-1);
}

Measured memory_bytes: 3744
a, b = map(int, input().split())

list = []
x = ''
for i in range(b):
  A = str(a)
  x = x + A
list.append(x)
  
y = ''
for i in range(a):
  B = str(b)
  y = y + B
list.append(y)

list.sort()
print(list[0])

Measured memory_bytes: 3064
#include <iostream>
#include <stack>
#include <algorithm>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <functional>
#include <string>
#include <cstdlib>
#include <numeric>
#include <cstdbool>
#include <map> 
#include<set>
#include<queue>

typedef long long ll;


#define rep(i,n) for(ll i=0;i<n;i++)
using namespace std;

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

const long long INF = 1000000000000000;
const ll inf = -1e18;
typedef pair<ll, ll> P;
ll ma = 1000000000 + 7;
ll mx = 1000003;
ll h, w, n,m,k; string s,t;
char maze[60][60];
int dis[101][101]; int graph[52][52]; bool vis[52];
int dx[4] = { 1, 0, -1, 0 };
int dy[4] = { 0, 1, 0, -1 };
ll gcd(ll x, ll y) {
	if (x % y == 0) return y;
	return gcd(y, x % y);

}
ll lcm(ll a,ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
void comb(vector<vector <ll> >& v) {
	for (ll i = 0; i < v.size(); i++) {
		v[i][0] = 1;
		v[i][i] = 1;
	}
	for (ll k = 1; k < v.size(); k++) {
		for (int j = 1; j < k; j++) {
			v[k][j] = (v[k - 1][j - 1] + v[k - 1][j])%ma;
		}
	}
}

ll GetDigit(ll num) {
	return log10(num) + 1;
}

int main() {
	cin >> n >> m;
	vector<P> ab(n);
	rep(i, n) {
		cin >> ab[i].first >> ab[i].second;
	}
	priority_queue<ll> q;
	sort(ab.begin(), ab.end());
	ll ans = 0;
	ll sum = 0;
	int idx = 0;
	for (ll i = m - 1; i >= 0; i--) {
		while (idx<n) {
			if (i + ab[idx].first <= m) {
				q.push(ab[idx].second);
				idx++;
			}
			else break;
		}
		if (!q.empty()) {
			ans += q.top();
			q.pop();
		}
	}
	cout << ans << endl;
}



Measured memory_bytes: 2936
#include <iostream>

using namespace std;

int main()
{
    int n, m, res=0;
    cin>>n>>m;
    for(int i=1; i<n; i++)
    {
        for(int j=i+1; j<=n; j++)
        {
            res++;
        }
    }
    for(int i=1; i<m; i++)
    {
        for(int j=i+1; j<=m; j++)
        {
            res++;
        }
    }
    cout<<res<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define td(v) v.begin(),v.end()
#define tdr(v) v.rbegin(),v.rend()
#define endl "\n"
#define Matrix vector<vector<int> >
using namespace std;
const int MOD = 1e9+7;
const int MOD2 = 1e9 + 9;
const int INF = 5e18;
 
int gcd(int a, int b){return (b == 0 ? a : gcd(b, a%b));}
int lcm(int a,int b){return (a*b)/gcd(a,b);}
 
 
inline long long mod(long long n, long long m){
    long long ret = n%m;
    if(ret < 0) ret += m;
    return ret;
}
 
int exp(int a, int b){
    int result = 1;
    while (b > 0){
        if (b & 1)
            result = result*a;
 
        b >>= 1;
        a = a*a;
    }
    return result;
}
int test(vector<tuple<int,int,int,int> >&vet, vector<int>&aux){
    int ans=0;
    for(auto &i : vet){
        auto[a,b,c,d] = i;
        if(aux[b-1]-aux[a-1]==c){
            ans+=d;
        }
    }
    return ans;
}
void propagate(vector<int>&vet, int maior, int pos){
    if(vet[pos]==maior+1){
        vet[pos]=1;
        if(pos>0){
            vet[pos-1]++;
            propagate(vet,maior,pos-1);
        }
    }
}
void solve(){
    int n,m,q; cin>>n>>m>>q;
    vector<tuple<int,int,int,int> >vet(q);
    for(auto &i : vet){
        cin>>get<0>(i)>>get<1>(i)>>get<2>(i)>>get<3>(i);
    }
    vector<int>aux(n,1);
    vector<int> para(n,1);
    int res = 0;
    while(true){
        // for(int i=0;i<n;i++){
        //     cout<<aux[i]<<' ';
        // }
        // cout<<endl;
        // cout<<test(vet,aux)<<endl;
        res=max(test(vet,aux),res);
        aux[n-1]++;
        if(aux[n-1]>m){
            propagate(aux,m,n-1);
        }
        for(int i=1;i<n;i++){
            aux[i]=max(aux[i],aux[i-1]);
        }
    
        if(aux==para){
            break;
        }
    }
    cout<<res<<endl;
}
main(){
    fastio; 
    int x=0;
    int t=1;
    // cin>>t;
    while(t--)
        solve();
}

Measured memory_bytes: 3648
#include<stdio.h>

#define MAX 100
char farm[MAX][MAX];

void infection(int i, int j, int H, int W, char moji)
{
    if( farm[i][j] == moji ){
        farm[i][j] = '+';
        if( j + 1 < W ) infection(i, j + 1, H, W, moji);
        if( i + 1 < H ) infection(i + 1, j, H, W, moji);
        if( j - 1 >= 0 )infection(i, j - 1, H, W, moji);
        if( i - 1 >= 0 )infection(i - 1, j, H, W, moji);
    }
}

int main()
{
    int H, W, i, j, cnt;
    while(1){
        cnt = 0;
        scanf("%d %d", &H, &W);
        if(H == 0 && W == 0) break;

        for(i = 0; i < H; i++){
            scanf("%s", farm[i]);
        }
        for(i = 0; i < H; i++ ){
            for(j = 0; j < W; j++){
                if(farm[i][j] == '+') continue;
                cnt++;
                infection(i, j, H, W, farm[i][j]);
            }
        }
        printf("%d\n", cnt);
    }
    return 0;
}

Measured memory_bytes: 3068
#include<stdio.h>
#include<string.h>
#include<utility>
#include<iostream>
#include<queue>
#include<math.h>
#include<algorithm>
#include<vector>
#include<map>
 
using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0;i<(int)(n);i++)
 
 
int main()
{
    int n;
    long int a;
    int sum=0;
    scanf("%d\n",&n);
    REP(i,n){
        scanf("%ld\n",&a);
        if(a%2==1)sum++;
    }
    if(sum>=1)printf("first\n");
    else printf("second\n");
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

int main() {
    std::string s;
    std::cin >> s;
    int count;
    if(s[0] == '1') count++;
    if(s[1] == '1') count++;
    if(s[2] == '1') count++;
    std::cout << count << std::endl;
    return 0;
}

Measured memory_bytes: 256
s=input()
c=0
for i in range(len(s)):
    if i%2==0 and s[i] in ["R","U","D"]:
        c+=1
    if i%2==1 and s[i] in ["L","U","D"]:
        c+=1
if c==len(s):
    print("Yes")
else:
    print("No")


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

using namespace std;

using ll = long long;
using pll = pair<ll, ll>;
using vl = vector<ll>;
using vll = vector<vl>;
using vpll = vector<pll>;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define pb push_back
#define eb emplace_back

struct Edge{
    int to;
    int weight;
    Edge(int t, int w) : to(t), weight(w){ }
};

using Graph = vector<vector<Edge>>;
using graph = vector<vector<int>>;

template <class T>
inline bool chmin(T &a, T b){
    if (a > b){
        a = b;
        return true;
    }
    return false;
}

template <class T>
inline bool chmax(T &a, T b){
    if (a < b){
        a = b;
        return true;
    }
    return false;
}

template <class T>
T gcd(T a, T b){
    if( b==0 ) return a;
    else return gcd(b, a%b);
}

template <class T>
T lcm(T a, T b){
    return (a*b)/gcd(a,b);
}

ll INF = 1e9+7;

template<class T>
void dcomb(T n,T m, string s){
    if(n==0) cout << s << endl;
    else {
        for(T i=0; i<m; ++i){
            dcomb(n-1,m,s+to_string(i));
        }
    }
}

int main(){
    ll n,d,a;
    cin >> n >> d >> a;
    vector<pair<ll,ll>> x(n);
    rep(i,n) cin >> x[i].first >> x[i].second;
    sort(x.begin(),x.end());
    queue<pair<ll,ll>> que;
    ll t = 0;
    ll ans = 0;
    d *=2;
    rep(i,n){
        ll p = x[i].first;
        ll h = x[i].second;
        while(!que.empty() && que.front().first < p){
            t -=que.front().second;
            que.pop();
        }
        h -=t;
        if(h>0){
            ll num = (h+a-1)/a;
            ans += num;
            ll damage = num*a;
            t += damage;
            que.emplace(p+d,damage);
        }
    } 
    cout << ans << endl;
}

Measured memory_bytes: 4992
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <set>
#include <numeric>
#include <cmath>
 
using namespace std;
 
typedef long long int lld;
 
const lld mod = 1e9+7;
const lld INF = 1e9;
const lld MAXN = 1e5;
 
struct edge
{
	lld node,cost;
	edge()
	{
		node = 0;
		cost = 0;
	}
};
 
 
vector<edge> e[MAXN];
lld dist[MAXN] = {0};
 
void dfs(lld p)
{
	if (dist[p] >= 0)
	{
		lld s = e[p].size();
		for(int i = 0; i < s; i++)
		{
			if (dist[e[p][i].node] < 0)
			{
				dist[e[p][i].node] = dist[p] + e[p][i].cost;
				dfs(e[p][i].node);
			}
		}
	}
}
 
int main()
{
	lld n,q,k;
 
	cin >> n;
	for(int i = 0; i < n-1; i++)
	{
		int aa,bb,cc;
		cin >> aa >> bb >> cc;
 
 
		edge f;
		f.node = bb-1;
		f.cost = cc;
 
		e[aa-1].push_back(f);
 
		f.node = aa-1;
		e[bb-1].push_back(f);
	}
 
	for(int i = 0; i < n; i++)
	{
		dist[i] = -1;
	}
 
	cin >> q >> k;
 
	dist[k-1] = 0;
 
	dfs(k-1);
 
	for(int i = 0; i < q; i++)
	{
		int x,y;
		cin >> x >> y;
		cout << dist[x-1] + dist[y-1] << endl;
	}
 
	return 0;
}

Measured memory_bytes: 14336
#include<iostream>
#include<algorithm>
#include<string>
#include<cmath>
#include<vector>
#include<map>
using namespace std;
/*
time:
wa:
反省:
考察:
*/
int main() {
    int n;
    long long k;
    cin >> n >> k;
    int a, b;
    long long c[100001] = {0};
    for(int i = 0; i < n; i++) {
        cin >> a >> b;
        c[a] += b;
    }

    for(int i = 1; i <= 100000; i++){
        if(k <= c[i]){
            cout << i << endl;
            break;
        }
        k -= c[i];
    }
    return 0;
}

Measured memory_bytes: 4404
#include<bits/stdc++.h>
#include<stdio.h>
#define debug(x) cout << '>' << #x << ':' << x << endl;

#define nitro ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL);
const int INF = 1e9+5;
using namespace std;
using ll = unsigned long long int;
const ll mod = 998244353; 
int main() {
	// your code goes here
	
	//freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
	int n;cin>>n;
	ll total = 0 ;
	ll temp = 0;
	for(int i = 1; i <= n ; i++)
	{
		if(i%3==0 && i%5==0)
		{
			continue;
		}
		if((i%3)!=0 && (i%5)!=0)
		{
			total+=i;
		}
	}
	cout<<total;
	
}


Measured memory_bytes: 3636
#include <iostream>

using namespace std;

int main() {
  string A,B;
  cin >> A >> B;

  int comp{};
  if (A.size() > B.size()) {
    comp = 1;
  } else if (A.size() < B.size()) {
    comp = -1;
  } else if (A < B) {
    comp = -1;
  } else if (B < A) {
    comp = 1;
  }

  cout << (comp == 1 ? "GREATER" : comp == -1 ? "LESS" : "EQUAL" ) << endl;
  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cctype>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

#define FOR(i, first, last) for (int i = (first); i < (last); ++i)
#define REP(i, n) FOR(i, 0, n)
#define CLR(a) memset((a), 0, sizeof(a))
#define DUMP(x) std::cerr << #x << " = " << (x) << std::endl;
#define DUMPR(v) REP(_i,v.size()){std::cerr<< #v << "[" << _i << "] = " << (v[_i]) << std::endl;}
#define CIN_VEC(v,N) {v.clear(); v.reserve(N); REP(i,N){typename decltype(v)::value_type x; cin>>x; v.emplace_back(x);}};

inline int to_int(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T> inline string to_string(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}

typedef unsigned long long ull;
typedef unsigned long ul;

ull f(int* first, int* last, int b) {
  ull res = 0;
  for(auto it=first; it!=last; ++it) {
    res += abs(*it - b);
  }
  return res;
}

int main() {
  int N;
  int a[2*100000+1];
  cin>>N;
  REP(i,N) {
    scanf("%d", &a[i]);
    a[i] -= (i+1);
  }
  sort(a, a+N);

  cout<<f(a,a+N,a[N/2])<<endl;

  return 0;
}


Measured memory_bytes: 1024
x, y = map(int, input().split())
group1 = [1, 3, 5, 7, 8, 10, 12]
group2 = [4, 6, 9, 11]
group3 = [2]
if ((x in group1) and (y in group1)) or ((x in group2) and (y in group2)) or ((x in group3) and (y in group3)):
  print("Yes")
else:
  print("No")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1001001001;
 
static const double pi = 3.141592653589793;
 
int main() {
  int N, M;
  cin >> N >> M;
  vector<vector<int>> v(N);
  rep(i, M) {
    int a, b;
    cin >> a >> b;
    v[a - 1].push_back(b - 1);
    v[b - 1].push_back(a - 1);
  }
  vector<int> ans(N, -1);
  queue<int> que;
  que.push(0);
  while (que.size()) {
    int now = que.front();
    que.pop();
    for (int node : v[now]) {
      if (ans[node] == -1) {
        ans[node] = now;
        que.push(node);
      }
    }
  }
  cout << "Yes" << endl;
  for (int i = 1; i < N; i++) {
    cout << ans[i] + 1 << endl;
  }
  return 0;
}

Measured memory_bytes: 10224
#include <iostream>
#include <stdio.h>
using namespace std;

int main()
{
	double r;
	double area, circle;

	cin >> r;

	area = r * r * 3.14159265358979323846;
	circle = 2 * r * 3.14159265358979323846;

	printf("%.6f %.6f\n", area, circle);

	return 0;
}

Measured memory_bytes: 3196
# import bisect
# from collections import Counter, defaultdict, deque
# import copy
# from heapq import heappush, heappop, heapify
# from fractions import gcd
# import itertools
# from operator import attrgetter, itemgetter
# import math

import sys

# import numpy as np

ipti = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)

def main():
    x, y = list(map(int,ipti().split()))
    print(x+y//2)

if __name__ == '__main__':
    main()

Measured memory_bytes: 38256
#include <iostream>
#include<vector>
#include<algorithm>
#define rep(i,n) for(int i = 0; i < (n); i++)

using namespace std;



int main() {
    int n,m;
    cin>>n>>m;
    vector<int>l(m);
    vector<int>r(m);
    rep(i,m)cin>>l[i]>>r[i];
    sort(l.begin(),l.end());
    sort(r.begin(),r.end());
    int pass;
    if(r[0]<l[m-1])pass=0;
    else pass =r[0]-l[m-1]+1;
    cout<<pass<<endl;

    return 0;
}

Measured memory_bytes: 1024
def main():
  import sys
  from scipy.sparse.csgraph import floyd_warshall as f
  n,m,l,*t=map(int,sys.stdin.buffer.read().split())
  d=[[0]*(n+1)for _ in range(n+1)]
  for a,b,c in zip(*[iter(t[:m*3])]*3):d[a][b]=c
  d=f(f(d,0)<=l)-1
  d[d>n]=-1
  print('\n'.join(map(str,map(int,map(d.__getitem__,zip(*[iter(t[m*3+1:])]*2))))))
main()

Measured memory_bytes: 36312
#include <iostream>
#include <vector>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <queue>
#include <cmath>
// #include <atcoder/all>
using namespace std;
// using namespace atcoder;

int main() {
	int k;
	cin >> k;
	while (k > 0) {
		k--;
		cout << "ACL";
	}
	cout << endl;
}






Measured memory_bytes: 3528
#include <bits/stdc++.h>
using namespace std;
#define MAXN 1500

int n,m,ans,tot,a[MAXN];
int main()
{
  	cin >> n >> m;
  	for(int i = 0; i < n; i++)
		cin >> a[i],tot += a[i];
  
  	double r = (1 / (4.0 * m)) * tot;
	for(int i = 0; i < n; i++)
		ans += ((double) a[i] >= r);  	
  	cout << (ans >= m ? "Yes" : "No") << endl;
	return 0;
}


Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Dowango_A solver = new Dowango_A();
        solver.solve(1, in, out);
        out.close();
    }

    static class Dowango_A {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            float ave = 0;
            float[] frame = new float[n];
            for (int i = 0; i < n; i++) {
                int tmp = in.nextInt();
                frame[i] = tmp;
                ave += tmp;
            }
            ave /= n;

            for (int i = 0; i < n; i++) {
                frame[i] = Math.abs(frame[i] - ave);
            }
            float min = 10000;
            int ans = 0;
            for (int i = 0; i < n; i++) {
                if (frame[i] < min) {
                    ans = i;
                    min = frame[i];
                }
            }

            out.print(ans);
        }

    }
}



Measured memory_bytes: 24276
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		
		Scanner scan = new Scanner(System.in);
		int value1 = scan.nextInt();
		int value2 = scan.nextInt();
		
		if (value1 == value2) {
			System.out.println("Draw");
		} else {
			if (value1 == 1) {
				System.out.println("Alice");
			} else if (value2 == 1) {
				System.out.println("Bob");
			} else {
				if (value1 > value2)
					System.out.println("Alice");
				else
					System.out.println("Bob");
			}
		}
		
	}
	
	
}











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

using namespace std;
typedef long long ll;

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= (ll)(b); i++)
#define FORD(i, a, b) for (ll i = a; i >= (ll)(b); i--)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(), (x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size())      //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))   //最大値を求める
#define MIN(x) *min_element(ALL(x))   //最小値を求める
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 10000007      //10^9+7:合同式の法
#define MAXR 100000       //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first      //pairの一つ目の要素
#define S second     //pairの二つ目の要素

//for (auto& e : array)

signed main()
{
    int N;
    ll K;
    cin >> N >> K;
    vector<int> A(N);
    REP(i, N)
        cin >> A[i];

    map<int, ll> m;

    int city = 1;
    ll T ;
    ll remaining;

    REP(i, K){
        if(m[city] == 0){
            m[city] = i;
        } else{
            T = m[city]-i;
            REP(j, (K-i)%T){
                city = A[city-1];
            }
            break;
        }
        city = A[city-1];
    }
    

    cout << city << endl;

    
}


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

#define int long long
#define INT int
#define MOD 1000000007

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(i) (i).begin(), (i).end()
#define rall(i) (i).begin(), (i).end(), greater<int>()
#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second
template <typename T>
void print(T x)
{
    std::cout << x << '\n';
}
typedef long long ll;

int n, m;
vector<int> h, a, b;

signed main()
{
    cin >> n >> m;
    h = vector<int>(n);
    a = b = vector<int>(m);
    rep(i, n)
    {
        cin >> h[i];
    }
    rep(i, m)
    {
        cin >> a[i] >> b[i];
        a[i]--;
        b[i]--;
    }

    set<int> index;
    rep(i, m)
    {
        if (h[a[i]] < h[b[i]])
        {
            index.insert(a[i]);
        }
        else if (h[a[i]] > h[b[i]])
        {
            index.insert(b[i]);
        }
        else
        {
            index.insert(a[i]);
            index.insert(b[i]);
        }
    }

    cout << n - index.size() << endl;
}


Measured memory_bytes: 8280
#include <bits/stdc++.h>
//#include "all_headers.h"
using namespace std;
int main()
{
    long long  a , b  ,k;
    cin >> a>> b >>k;

    if(a > k)
    {
        a -= k;
        k =  0;
    }else{
        
        k = k - a;
        a = 0 ;
        //cout << " k = "<<k<<" and b = "<<b<<endl;
        b = b - min(b,k);
    }

    cout << a << " "<<b<<endl;
    
    return 0;   
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <math.h>
#include <string>
#include <numeric>
#include <queue>
#include <cstdio>
#include <cstring>
#define ll long long
#define rep(i,n) for(ll i=0;i<n;++i)
#define rep1(i,n) for(ll i=1;i<n;++i)
#define mrep(i,n) for(ll i=n;i>=0;--i)
#define all(a) (a).begin(),(a).end()
#define vl vector<ll>
#define vvl vector<vector<ll> >
#define vb vector<bool>
#define vvb vector<vector<bool> >
#define pl pair<ll,ll>
#define inf 1001001001001001000
//#define mod 1000000007
#define mod 998244353
#define pi 3.1415926535
using namespace std;
struct __INIT {
	__INIT() {
		cin.tie(0);
		ios::sync_with_stdio(false);
		cout << fixed << setprecision(15);
	}
}__init;

ll gcd(ll a,ll b){
    if(a<b) return gcd(b,a);
    ll r;
    while((r=a%b)){
        a = b;
        b = r;
    }
    return b;
}

ll lcm(ll a,ll b){
    return (a*b)/gcd(a,b);
}

int main(void) {
    ll a,b;
    cin>>a>>b;
    cout<<lcm(a,b)<<endl;
	return 0;
}


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

const int INF = 1e9;

int main(){
    int n,k,s;
    cin >> n >> k >> s;
    if(s == INF){
        rep(i,n){
            if(i) cout << " ";
            if(i < k) cout << s;
            else cout << 1;
        }
    }
    else{
        rep(i,n){
            if(i) cout << " ";
            if(i < k) cout << s;
            else cout << INF;
        }
    }
    cout << endl;
}

Measured memory_bytes: 3596
#include <iostream>
#include <string>
#include <cstring>
#include <iostream>
#include <string>
#include <cstring>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <utility>
#define int long long
using namespace std;
signed main(){
    int n;
    cin>>n;
    vector<pair<string,int> > a(n);
    vector<pair<int,string> > b(n);
    vector<pair<int,int> > c(n);
    for(int i=0;i<n;i++){
        string s;
        int t;
        cin>>s>>t;
        a[i]=make_pair(s, 100-t);
        b[i]=make_pair(i+1, s);
        c[i]=make_pair(i+1, 100-t);
    }
    sort(a.begin(),a.end());
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            if(a[i].first==b[j].second&&a[i].second==c[j].second)cout<<b[j].first<<endl;
        }
    }
    return 0;
}


Measured memory_bytes: 256
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve(n,e,q):
    l = set([i for i in q])
    d = defaultdict(lambda : 0)
    for i in range(n):
        n,j,k = e[i]
        j = int(j)
        k = int(k)
        d[k-j+1] += i+1
        d[k+1] -= i+1
        l.add(k-j+1)
        l.add(k+1)
    l = list(l)
    l.sort()
    for i in range(len(l)-1):
        d[l[i+1]] += d[l[i]]
    for i in q:
        j = d[i]
        if j > 0:
            print(e[j-1][0],i-int(e[j-1][2])+int(e[j-1][1]))
        else:
            print("Unknown")
    return

#Solve
if __name__ == "__main__":
    while 1:
        n,Q = LI()
        if n == Q == 0:
            break
        e = [input().split() for i in range(n)]
        q = IR(Q)
        solve(n,e,q)



Measured memory_bytes: 9296
#include<iostream>
using namespace std;
static const int MAX = 100;
static const int INFTY = (1 << 21);
static const int WHITE = 0;
static const int GRAY = 1;
static const int BLACK = 2;

int n, A[MAX][MAX];

int prim(){
    int u, minv;
    int d[MAX], p[MAX], color[MAX];

    for(int i = 0; i < n; i++){
        color[i] = WHITE;
        d[i] = INFTY;
    }
    d[0] = 0;
    p[0] = -1;

    while(1){
        minv = INFTY;
        for(int i = 0; i < n; i++){
            if(color[i] != BLACK && d[i] < minv){
                minv = d[i];
                u = i;
            }
        }

        if(minv == INFTY) break;

        color[u] = BLACK;

        for(int v = 0; v < n; v++){
            if(color[v] != BLACK && A[u][v] != INFTY){
                if(A[u][v] < d[v]){
                    d[v] = A[u][v];
                    p[v] = u;
                    color[v] = GRAY;
                }
            }
        }
    }

    int sum = 0;
    for(int i = 0; i < n; i++){
        sum += d[i];
    }
    
    return sum;
}

int main(){
    cin >> n;
    for(int i = 0; i < n; i++){
        for(int j = 0; j < n; j++){
            int e; cin >> e;
            A[i][j] = (e == -1) ? INFTY : e;
        }
    }

    cout << prim() << endl;

    return 0;
}


Measured memory_bytes: 3132
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class Solution
{
    static void Main()
    {
        var n = int.Parse(Console.ReadLine());
        var a = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
        var max = a.Max();

        var best = a.Min();
        foreach (var x in a)
        {
            if(Math.Abs(max - x * 2) < Math.Abs(max - best * 2))
            {
                best = x;
            }
        }

        Console.WriteLine($"{max} {best}");
    }
}

Measured memory_bytes: 21088
H,W = map(int,input().split())

ze = ["."]*(W+2)

lis = [ze]


for i in range(H):

    s = list(input())
    s = ["."] + s + ["."]

    lis.append(s)

lis.append(ze)

#print (lis)

for h in range(H):

    h += 1

    for w in range(W):

        w += 1

        #print(h,w)
        
        if lis[h][w] == "#":
            

            for x in range(3):

                x -= 1
                
                for y in range(3):

                    y -= 1
                    
                    if lis[h+x][w+y] == ".":
                        lis[h+x][w+y] = 1

                    elif lis[h+x][w+y] != "#":
                        lis[h+x][w+y] += 1

#print (lis)
for i in range(len(lis)):

    if i != 0 and i != H+1:

        ans = ""
        for j in range(len(lis[i])):

            if j != 0 and j != W+1:

                if lis[i][j] != ".":
                    ans += str(lis[i][j])
                else:
                    ans += "0"

        print (ans)

Measured memory_bytes: 43116
//#include <bits/stdc++.h>
//#include <stdio.h>
#include<iostream>
#include<cstdio>
#include<bitset>
#include<algorithm>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<string>
#include<string.h>
#include<cmath>
#include<utility>
#include<functional>
#include<map>
#include<set>
#include<cctype>
#include<fstream>


#define FOR(i, a, b) for( int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for( int i=(a);i>=(b);i--)
#define LFOR(i, a, b) for( long long int i=(a);i<=(b);i++)
#define LRFOR(i, a, b) for(long long int i=(a);i>=(b);i--)
#define MOD 1000000007
#define INF 1000000000 //2000000000
#define LINF 1000000000000000000 //9000000000000000000
#define PI 3.14159265358979
#define MAXI 7500000

using namespace std;
typedef long long int ll;
typedef pair< long long int, long long  int> P;

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


int main(void) {
	
	while (1) {
		int n;
		int total = 0;
		int first = 1;
		int end = 1;
		int sum = 0;

		cin >> n;

		if (n == 0) {
			break;
		}

		sum = 1;
		while (first <= end&&end<n) {
			//cout << first << " " << end << " " << sum << endl;
			if (sum == n) {
				total++;
				end++;
				sum += end;
			}
			else if (sum < n) {
				end++;
				sum += end;
			}
			else {
				sum -= first;
				first++;
			}
			
		}

		cout << total << endl;


	}



	
	

	return 0;
}


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

int main() {
  int r, c;
  cin >> r >> c;
  vector< vector< int > > table(r + 1, vector< int >(c + 1));
  rep(i, r) {
    rep(j, c) {
      cin >> table.at(i).at(j);
    }
  }
  rep(i, r) {
    int sum = 0;
    rep(j, c) {
      sum += table.at(i).at(j);
    }
    table.at(i).at(c) = sum;
  }
  rep(j, c) {
    int sum = 0;
    rep(i, r) {
      sum += table.at(i).at(j);
    }
    table.at(r).at(j) = sum;
  }
  rep(i, r) {
    table.at(r).at(c) += table.at(i).at(c);
  }
  rep(i, r + 1) {
    rep(j, c + 1) {
      cout << table.at(i).at(j);
      if (j != c) {
        cout << " ";
      }
    }
    cout << endl;
  }
}



Measured memory_bytes: 3172
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long[] a = new long[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextLong();
        }
        long totalXor = a[0];
        for (int i = 1; i < n; i++) {
            totalXor ^= a[i];
        }
        for (int i = 0; i < n; i++) {
            System.out.println(a[i] ^ totalXor);
        }
    }

}


Measured memory_bytes: 61876