akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1e9+7,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<ll,ll> P;

ll dp[88][88][15000];
void Main() {
  ll n,m;
  cin >> n >> m;
  ll a[n][m],b[n][m];
  rep(i,n)rep(j,m) R a[i][j];
  rep(i,n)rep(j,m) R b[i][j];
  dp[0][0][abs(a[0][0]-b[0][0])]=1;
  rep(i,n+m-1) {
    ll x=max(0LL,i-m+1),y=min(m-1,i);
    while(check(n,m,x,y)) {
      REP(j,1,3) {
        ll xx=x+dx[j],yy=y+dy[j];
        if(!check(n,m,xx,yy)) continue;
        ll d=a[xx][yy]-b[xx][yy];
        rep(k,13000) {
          if(k+d<=13000) dp[xx][yy][abs(k+d)]|=dp[x][y][k];
          if(k-d<=13000) dp[xx][yy][abs(k-d)]|=dp[x][y][k];
        }
      }
      x++;
      y--;
    }
  }
  ll ans=MAX;
  rrep(i,13000) {
    if(dp[n-1][m-1][i]) ans=i;
  }
  pr(ans);
}

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


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

int main(){
  string s;
  cin >> s;
  int d=0;
  for(int i=0; i<s.size(); i++){
    if(i%2 == 0){
      if(s.at(i) == 'L'){
        cout << "No" << endl;
        d++;
        break;
      }
    }
    else{
      if(s.at(i) == 'R'){
        cout << "No" << endl;
        d++;
        break;
      }
    }
  }
  if(!d){
    cout << "Yes" << endl;
  }
}


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

// #define int long long
#define rep(i, n) for (long long i = (long long)(0); i < (long long)(n); ++i)
#define reps(i, n) for (long long i = (long long)(1); i <= (long long)(n); ++i)
#define rrep(i, n) for (long long i = ((long long)(n)-1); i >= 0; i--)
#define rreps(i, n) for (long long i = ((long long)(n)); i > 0; i--)
#define irep(i, m, n) for (long long i = (long long)(m); i < (long long)(n); ++i)
#define ireps(i, m, n) for (long long i = (long long)(m); i <= (long long)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) long long(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

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 ll INF = 1e9+10;
const ll MOD = 1e9+7;
const ll LINF = 1e18;

ll n,k;
ll a[200005];

// k個以上mid以下の数が存在するか
ll isOk(ll mid){
  
  ll cnt=0;
  if(mid>0){
    rep(i,n){
      if(a[i]<0){
        ll idx=lower_bound(a,a+n,mid/a[i])-a;
        chmax(idx,i+1);
        cnt+=n-idx;
      }else if(a[i]>0){
        ll idx=upper_bound(a,a+n,mid/a[i])-a-1;
        ll tmp=idx-i;
        if(tmp>0) cnt+=tmp;
      }else{
        cnt+=n-i-1;
      }
    }
  }else if(mid<0){
    rep(i,n){
      if(a[i]<0){
        ll idx;
        if(mid%a[i]==0) idx=lower_bound(a,a+n,mid/a[i])-a;
        else idx=upper_bound(a,a+n,mid/a[i])-a;
        cnt+=n-idx;
      }
    }
  }else if(mid==0){
    ll zero_border=lower_bound(a,a+n,0)-a;
    rep(i,n){
      if(a[i]<0) cnt+=n-zero_border;
      else if(a[i]==0) cnt+=n-i-1;
    }
  }
  
  return cnt>=k;
  
}

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  
  cin>>n>>k;
  rep(i,n) cin>>a[i];
  sort(a, a+n);
  
  ll ng=-1e18, ok=1e18;
  while(abs(ok-ng)>1){
    ll mid=(ok+ng)/2;
    if(isOk(mid)) ok=mid;
    else ng=mid;
    // cout<<ng<<' '<<ok<<endl;
  }
  cout<<ok<<endl;
  
}

Measured memory_bytes: 5132
#include<iostream>
#define FOR(i,a,b) for(int i=(a);i<(b);++i) 
#define REP(i,n) FOR(i,0,n)
#define EACH(x,a) for(auto& (x):(a))
#define ALL(obj) (obj).begin(),(obj).end()
#define Yes(n) cout<<((n)?"Yes":"No")<<endl;
using namespace std;
using ll=long long;
const int INF=1e9;
const ll LINF=1e18;
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int main(){
  int N, M, C; cin>>N>>M>>C;
  int A[20][20], B[20];
  REP(i,M) cin>>B[i];
  REP(i,N) REP(j,M) cin>>A[i][j];

  int c=0;
  REP(i,N){
    int si=0;
    REP(j,M){
      si += A[i][j]*B[j];
    }
    si += C;

    if(si>0) ++c;
  }
  
  cout<<c<<endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define vvi vector < vi >
#define pii pair<int,int>
#define pll pair<long long, long long>
#define vpll vector < pair<long long,long long> >
#define fill(a,val)  memset(a,val, sizeof (a))
#define sort_unique(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define all(cont) cont.begin(), cont.end()
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define MAX   1e18
#define MIN  -1e9
typedef map<int,int> mpi;
typedef set<int> seti;
typedef multiset<int> mseti;
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define rep(i, n)    for(long long int i = 0; i < (n); ++i)
#define repA(i, a, n)  for(int i = a; i <= (n); ++i)
#define repD(i, a, n)  for(int i = a; i >= (n); --i)
#define repn(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define trav(a, x) for(auto& a : x)
struct Interval {int start, end;};
bool compare(Interval i1, Interval i2) {return (i1.start < i2.start);}
ll dp[1004][1004];
ll mod=1e9+7;
int main()
{
    fill(dp,0);
    ll h,w;
    cin>>h>>w;
    string s[h];
    rep(i,h)
    cin>>s[i];
    dp[0][0]=1;
    rep(i,h)
    if(s[i][0]=='.')
        dp[i][0]=1;
    else
        break;
    rep(i,w)
    if(s[0][i]=='.')
        dp[0][i]=1;
    else
        break;
    repA(i,1,h-1){
        repA(j,1,w-1){
            if(s[i][j]=='#')
                continue;
            dp[i][j]=(dp[i-1][j]+dp[i][j-1])%mod;
        }
    }
    cout<<dp[h-1][w-1];
    return 0;
}


Measured memory_bytes: 9216
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <math.h>
#include <map>
#include <set>
#include <stdlib.h>
#define ll long long
#define inf 0x3f3f3f3f
#define mem(a,b) memset(a,b,sizeof(a))
using namespace std;
const int maxn=1e6+5;
ll a[maxn];
int inverse(int x)
{
    int b=log10(x);
    int m=0,y;
    for(int i=0;i<=b;i++)
    {
       y=x%10;
        m=m*10+y;
        x/=10;
    }
    //cout<<m<<endl;
    return m;
}
int main()
{
    ll a,b;
    cin>>a>>b;
    int sum=0;
    for(int i=a; i<=b; i++)
    {
        if(inverse(i)==i)
        {
              sum++;
              //cout<<i<<endl;
        }
    }
    cout<<sum<<endl;
    return 0;
}
/*
10
5 1 8 8 8 8 8 9 9 9
*/


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

int main() {
    ios_base::sync_with_stdio(false);	
    cin.tie(0);
	cout.precision(20);
	cout << fixed;
	double r;
	cin >> r;
	cout << (r + r) * 3.14159265358979322846 << "\n";
	return 0;
}


Measured memory_bytes: 3764
N, K = map(int, input().split(' '))
tmp = [list(map(int, input().split(' '))) for _ in range(N)]
tmp.sort()
cumB = []
for i in range(N):
    if i == 0:
        cumB.append(tmp[0][1])
    else:
        cumB.append(cumB[i-1]+tmp[i][1])

A = [tmp[i][0] for i in range(N)]

for i in range(N):
    if K <= cumB[i]:
        print(A[i])
        break

Measured memory_bytes: 33196
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)

int findSumOfDigits(int n){
    int sum=0;
    while(n>0){
        sum += n%10;
        n /= 10;
    }
    return sum;
}

int main(){
    int n, a, b; cin >> n >> a >> b;
    int total=0;
    for(int i=1; i<=n; i++){
        int sum = findSumOfDigits(i);
        if(sum >= a && sum <= b){
            total += i;
        }
    }
    cout << total << endl;
}


Measured memory_bytes: 256
/*  CREATED BY
    STREAM_CIPHER
    7-aug-2020
*/
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define double long double
#define debug1(a) cout<<#a<<"="<<(a)<<"\n"
#define debug2(a,b) cout<<#a<<"="<<(a)<<","<<#b<<"="<<(b)<<"\n"
#define debug3(a,b,c) cout<<#a<<"="<<(a)<<","<<#b<<"="<<(b)<<","<<#c<<"="<<(c)<<"\n"
#define fix_precision(n) cout << fixed << setprecision(n)
#define all(a) a.begin(),a.end()
const double pi=acos(-1.0);
int inf=0x3f3f3f3f3f3f3f3f;
const int mod=1e9+7;
const int mx=5*1000000;
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        // freopen("output.txt","w",stdout);
    #endif
        int n;cin>>n;
        vector<tuple<int,int,int>>a;
        for(int i=0;i<n;i++)
        {
            int x,y,z;
            cin>>x>>y>>z;
            a.push_back({x,y,z});
        }
        int dp[n+1][4];
        memset(dp,0,sizeof dp);
        auto [x,y,z]=a[0];
        dp[0][1]=x;
        dp[0][2]=y;
        dp[0][3]=z;
        // debug1(max(dp[0][1],max(dp[0][2],dp[0][3])));
        for(int i=1;i<n;i++)
        {
            auto [x,y,z]=a[i];
            dp[i][1]=max(dp[i-1][2]+x,dp[i-1][3]+x);
            dp[i][2]=max(dp[i-1][1]+y,dp[i-1][3]+y);
            dp[i][3]=max(dp[i-1][1]+z,dp[i-1][2]+z);
            // debug1(max(dp[i][1],max(dp[i][2],dp[i][3])));
        }
        cout<<max(dp[n-1][1],max(dp[n-1][2],dp[n-1][3]));
}

Measured memory_bytes: 8696
N, K = gets.split(" ").map(&:to_i)
H = gets.split(" ").map(&:to_i)
ans=0
kick=K
H.sort!.reverse!
N.times do |i|
  if kick>0
    kick -= 1
    next
  else
    ans += H[i]
  end
end
puts ans

Measured memory_bytes: 17648
#include<stdio.h>
#define MAX 500000
#define SENTINEL 2000000000

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

void merge(int e[], int n, int left, int mid, int right){
  int i, j, k;

  int x = mid - left;
  int y = right - mid;
  for ( i = 0; i < x; i++ ) L[i] = e[left + i];
  for ( i = 0; i < y; i++ ) R[i] = e[mid + i];
  L[x] = R[y] = SENTINEL;
  i = j = 0;
  for ( k = left; k < right; k++ ){
    c++;
    if ( L[i] <= R[j] ){
      e[k] = L[i++];
    } else {
      e[k] = R[j++];
    }
  }
}

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

main(){
  int e[MAX], n, i;
  scanf("%d", &n);
  c = 0;
  for ( i = 0; i < n; i++ ) {
    scanf("%d", &e[i]);
    if (e[i] >= SENTINEL ){
      return 1;
    }
  }
  mergeSort(e, n, 0, n);

  for ( i = 0; i < n; i++ ) {
    if ( i!=0 ) printf(" ");
    printf("%d", e[i]);
    }
  printf("\n");

  printf("%d\n", c);

  return 0;
}


Measured memory_bytes: 5600
[N,K] = list(map(int,input().split()))
h = list(map(int,input().split()))


#配るdp
inf = float('inf')
dp = [inf]*N

dp[0] = 0
for i in range(0,N-1):
    for j in range(i+1, min(i+K+1,N)):
        dp[j] = min(dp[i]+abs(h[i]-h[j]), dp[j])

print(dp[N-1])


Measured memory_bytes: 55264
#include <stdio.h>

int main(void)
{
int h, w, i, j;
int a = 0;

while(a == 0){

 scanf("%d", &h);
 scanf("%d", &w);

if(h == 0)
break;

for(i = 0; i < h; i++){
 for(j = 0; j < w; j++){

 printf("#");
}
 printf("\n");

}
 printf("\n");
}


return 0;

}




Measured memory_bytes: 1924
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int n;
ll ans;
int main()
{
	cin>>n;
	vector<int> l(n+1,0),r(n+1,0);
	for (int i=1;i<=n;++i) cin>>l[i]>>r[i];
	sort(l.begin(),l.end());
	sort(r.begin(),r.end());
	reverse(l.begin(),l.end());
	for (int i=0;i<n;++i)
	{
		int d=l[i]-r[i];
		if (d<=0) break;
		ans+=2*d;
	}
	cout<<ans;
	return 0;
}

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

using namespace std;

char s[100005];
long long res = 0;
vector<string> summ;

void compute(int level, int n, string sum) {

    if (level > n) return;
    if (level == n) {
        summ.push_back(sum);
        return ;
    }
    
    compute(level + 1, n, sum + "+" + s[level]);

    compute(level + 1, n, sum + s[level]);
}
long long compute(int level, string s) {
    long long res = 0;
    while (level < s.length()) {
        if (s[level] != '+') {
            long long cum = 0;
                while (level < s.length() && s[level] != '+') cum = cum * 10 + (s[level++] - '0');
                res += cum;
                level++;
        }
    }

    return res;
}
int main() {
    scanf("%s", s);

    int n = strlen(s);
    string sum = "";
    compute(1, n, sum + s[0]);

    for (string s: summ) res += compute(0, s);
    printf("%lld\n", res);
    return 0;
}


Measured memory_bytes: 256
def main():
    x1, y1, x2, y2 = map(int, input().split())
    dx, dy = x2 - x1, y2 - y1
    x3, y3, x4, y4 = x2 - dy, y2 + dx, x1 - dy, y1 + dx
    print('%d %d %d %d' % (x3, y3, x4, y4))


if __name__ == '__main__':
    main()


Measured memory_bytes: 38256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define bit(n) (1<<(n))
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
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;}
int const INF = 1001001001;


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

ll N;
cin >> N;
vl a(N);
rep(i,N) cin >> a[i];

ll cnt = 0;
vl b;
bool zero = false;
rep(i,N) {
    if(a[i] == 0) zero = true;
    if(a[i] < 0) cnt++;
    b.push_back(abs(a[i]));
}

ll ans = 0;
rep(i,N) {
    ans += b[i];
}

if(zero || cnt % 2 == 0) cout << ans << endl;
else {
    sort(all(b));
    ans -= 2*b[0];
    cout << ans << endl;
}

return 0;
}

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

const int MAX_N = 200000;

int main(){
    int min, res;
    int n;
    int R[MAX_N];
    cin >> n;
    for(int i = 0; i < n; i++) cin >> R[i];

    min = R[0];
    res = R[1] - R[0];
    for(int i = 1; i < n; i++){
        if(R[i] - min > res) res = R[i] - min;
        if(R[i] < min) min = R[i];
    }

    cout << res << "\n";
    return 0;
}




Measured memory_bytes: 3868
N, K = map(int, input().split())
x = list(map(int, input().split()))
L = [0]*(N-K+1) 
 
for i in range(N-K+1):
    if x[i] <= 0 and x[i+K-1] <= 0:
        L[i] = -x[i]
    elif x[i] <= 0 and x[i+K-1] >= 0:
        L[i] =   min ((2*x[i+K-1]-x[i]),(-2*x[i]+x[i+K-1]))
    elif x[i] >= 0 and x[i+K-1] >= 0:
        L[i] = x[i+K-1]
print(min(L))

Measured memory_bytes: 14564
import java.util.*;

public class Main {
        public static void main(String args[]) {
                Scanner sc = new Scanner(System.in);
                int A = sc.nextInt();
                int B = sc.nextInt();
                sc.nextLine();
                String S = sc.nextLine();
                String[] arStr = S.split("-");
                if (S.length() == A + B + 1 &&
                                arStr.length == 2 &&
                                arStr[0].length() == A &&
                                arStr[1].length() == B)
                {
                        System.out.println("Yes");
                } else {
                        System.out.println("No");
                }
        }
}


Measured memory_bytes: 22868
#include<stdio.h>
#include<stdlib.h>
#define MAX 2000001
#define VMAX 10000

int main(){
  unsigned short *A, *B;

  int C[VMAX+1];
  int n, i, j;
  scanf("%d",&n);

  A = malloc(sizeof(short)*n+1);
  B = malloc(sizeof(short)*n+1);

  for(i = 0; i <= VMAX; i++)C[i] = 0;

  for(i = 0; i < n; i++){
     scanf("%hu",&A[i+1]);
     C[A[i+1]]++;
  }

  for(i = 1; i <= VMAX; i++)C[i] += C[i-1];

  for(j = 1; j <= n; j++){
    B[C[A[j]]] = A[j];
     C[A[j]]--;
  }
  
  for(i = 1; i <= n; i++){
    if(i > 1)printf(" ");
    printf("%d",B[i]);
  }
  printf("\n");

  return 0;
}



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

long f(long x, long y, long z){
  return x*x+y*y+z*z+x*y+y*z+z*x;
}

int main(){
  long n;  cin >> n;
  vector<long> ans(n+3, 0);

  bool xflag = false, yflag = false;
  for(long x=1; ; x++){
    for(long y=x; ; y++){
      for(long z=y; ; z++){
	long fr = f(x, y, z);
	if(fr <= n){
	  if(x!=y && y!=z && z!=x)	    ans[fr] += 6;
	  else if(x==y && y==z && z==x)	    ans[fr] += 1;
	  else	    ans[fr] += 3;
	}else{
	  if(z == y)  yflag = true;
	  if(yflag && y == x)  xflag = true;
	  break;
	}
      }
      if(yflag){
	yflag = false;
	break;
      }
    }
    if(xflag)  break;
  }

  for(int i=1; i<=n; i++)
    cout << ans[i] << endl;

  return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
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; }
 
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    ごちゃごちゃ場合分けを考える前に全探索は考えましたか？
*/

// const ll mod = 1e9+7;

// void chmod(ll &M){
//     if(M >= mod) M %= mod;
//     else if(M < 0){
//         M += (abs(M)/mod + 1)*mod;
//         M %= mod;
//     }
// }


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

    int ans = 0;

    for(int k=28; k>=0; --k){
        int T = 1<<k;
        for(int i=0; i<N; ++i) { a[i] %= 2*T; b[i] %= 2*T; }
        sort(b.begin(), b.end());
        int cnt = 0;
        for(int i=0; i<N; ++i){
            auto i2 = lower_bound(b.begin(), b.end(), 2*T-a[i]);
            auto i1 = lower_bound(b.begin(), b.end(), T-a[i]);
            
            auto i4 = lower_bound(b.begin(), b.end(), 4*T-a[i]);
            auto i3 = lower_bound(b.begin(), b.end(), 3*T-a[i]);
            
            int cnt1 = i2-i1;
            int cnt2 = i4-i3;

            cnt += cnt1+cnt2;
        }
        if(cnt%2) ans += T;
        // 上、if(cnt%2 == 1)にするとWAになる　cnt<0 になることなんてある？
    }

    cout << ans << endl;
}

Measured memory_bytes: 1792
def main():
	n = int(input())
	for i in range(n):
		x = i + 1
		multipleOf3(i, x)
	print('')

def multipleOf3(i, n):
	if(n % 3) == 0:
		print(' %d' % (i + 1), end='')
	else:
		firstDigitis3(i, n)

def firstDigitis3(i, n):
	if(n % 10) == 3:
		print(' %d' % (i + 1), end='')
	else:
		n = n // 10
		if n > 0:
			firstDigitis3(i, n)

main()


Measured memory_bytes: 5872
import sys
import math
import itertools
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int()
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7

A,B,C = I()
print(A*B//2)

Measured memory_bytes: 5052
#include <stdio.h>
#include <string.h>

void change(int n, char letter[], int len){
	for(int i = 0; i < len; i++){
		for(int j = 1; j <= n; j++){
			if(letter[i] == 'Z'){
				letter[i] = 'A';
				continue;
			}
			letter[i] ++;
		}
		printf("%c", letter[i]);
	}
}

int main(){
	int n;
	scanf("%d", &n);
	getchar();
	
	char letter[10002];
	scanf("%[^\n]", letter);
	
	int len = strlen(letter);
	
	change(n, letter, len);
	
	return 0;
}

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

int main(void){
  string S;
  cin >> S;
  string ret;
  if(S[6] > '4') ret = "TBD";
  else if(S[5] == '1') ret = "TBD";
  else ret = "Heisei";
  cout << ret << endl;
  return 0;  
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
    string a="ABCDEF";
    char x,y;
    cin>>x>>y;
    for(int i=0;i<6;i++)
    {
        if(a[i]==x&&a[i]==y)
        {cout<<"=";
        break;}
        else if(a[i]==x)
        {cout<<"<";
        break;}
        else if(a[i]==y)
        {cout<<">";
        break;}
    }

}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdio>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <functional>
#include <queue>
#include <math.h>
#include <cmath>
#include <unordered_map>

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





// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<std::string> S(N);

    int cntAC=0;int cntWA=0;int cntTLE=0;int cntRE=0;

    for(int i = 0 ; i < N ; i++){
        std::cin >> S[i];
        if(S[i]=="AC"){
            cntAC++;
        }else if(S[i]=="WA"){
            cntWA++;
        }else if(S[i]=="TLE"){
            cntTLE++;
        }else if(S[i]=="RE"){
            cntRE++;
        }
    }
    cout<<"AC x "<<cntAC<<endl;
    cout<<"WA x "<<cntWA<<endl;
    cout<<"TLE x "<<cntTLE<<endl;
    cout<<"RE x "<<cntRE<<endl;
    return 0;
}


Measured memory_bytes: 6456
#include<cstdio>
using namespace std;
int main(){
    int m,f,r;
    while(1){
        scanf("%d %d %d",&m,&f,&r);
        if(m==-1 && f==-1 && r==-1){
            break;
        }
        if(m==-1 || f==-1){
            printf("F\n");
            continue;
        }else if(m+f>=80){
            printf("A\n");
            continue;
        }else if(m+f<80&&m+f>=65){
            printf("B\n");
            continue;
        }else if(m+f<65&&m+f>=50){
            printf("C\n");
            continue;
        }else if(m+f<50&&m+f>=30){
            if(r>=50){
                printf("C\n");
                continue;
            }else{
                printf("D\n");
                continue;
            }
        }else if(m+f<30){
            printf("F\n");
            continue;
        }
    }
    return 0;

}


Measured memory_bytes: 2560
import java.util.Scanner;

class Main {

    static int gcd(int x, int y) {
        if (y == 0) {
            return x;
        } else {
            return gcd(y, x % y);
        }
    }

    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int W = sc.nextInt();
        int H = sc.nextInt();
        int WH = gcd(W, H);
        int C = sc.nextInt();

        
        int a = (W/WH)*(H/WH);
        
        System.out.println(a*C);
    }
}


Measured memory_bytes: 26312
#include <iostream>
using namespace std;
int main(){
  int N;
  cin >> N;
  int A[N], T[N];
  for(int i = 0; i < N; ++i){
    cin >> T[i];
  }
  for(int i = 0; i < N; ++i){
    cin >> A[i];
  }
  if(N == 1){
    if(A[0] == T[0]) cout << 1 << endl;
    else cout << 0 << endl;
    return 0;
  }
  int H[N][2];
  for(int i = 0; i < N; ++i){
    H[i][1] = min(T[i],A[i]);
    H[i][0] = 1;
  }
  H[0][0] = T[0];
  H[N-1][0] = A[N-1];
  long long int ans = 1LL, mod = 1000000007LL;
  for(int i = 1; i < N-1; ++i){
    bool f = false;
    if(T[i-1] != T[i]){
      H[i][0] = T[i];
      f = true;
    }
    if(A[i] != A[i+1]){
      /*
      if(f && H[i][0] != A[i]){
	cout << 0 << endl;
	return 0;
      }
      */
      H[i][0] = A[i];
    }
  }
  
  for(int i = 0; i < N; ++i){
    ans *= max(0LL,(long long int)(H[i][1]-H[i][0]+1));
    ans %= mod;
  }
  
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1792
#define MAX 100005
#define NIL -1

typedef struct {
	int p, l, r;
} Node;

Node T[MAX];
int n, D[MAX];

void print(int u) {
	int i, c;

	printf("node %d: ", u);
	printf("parent = %d, ", T[u].p);
	printf("depth = %d, ", D[u]);

	if (T[u].p == NIL)	printf("root, ");
	else if (T[u].l == NIL) printf("leaf, ");
	else printf("internal node, ");

	printf("[");
	for (int i = 0, c = T[u].l; c != NIL; i++, c = T[c].r)
	{
		if (i) printf(", ");
		printf("%d", c);
	}
	printf("]\n");
}

int rec(int u, int p) {
	D[u] = p;
	if (T[u].r != NIL) rec(T[u].r, p);
	if (T[u].l != NIL) rec(T[u].l, p + 1);
	if (T[u].p == NIL) return 0;
}

int main() {
	int i, j, d, v, c, l, r;

	scanf("%d", &n);
	for (i = 0; i < n; i++) {
		T[i].p = T[i].l = T[i].r = NIL;
	}

	for (i = 0; i < n; i++) {
		scanf("%d %d", &v, &d);
		for (j = 0; j < d; j++) {
			scanf("%d", &c);
			if (j == 0) T[v].l = c;
			else T[l].r = c;
			l = c;
			T[c].p = v;
		}
	}

	for (i = 0; i < n; i++) {
		if (T[i].p == NIL) r = i;
	}

	rec(r, 0);
	for (i = 0; i < n; i++) {
		print(i);
	}

	return 0;
}


Measured memory_bytes: 6376
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
const int INF=1145141919,MOD=1e9+7;
const long long LINF=8931145141919364364,LMOD=998244353;
inline long long mod(long long n,long long m){return(n%m+m)%m;}
// const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};

long long dp[1010][1010];
int main(){
    int h,w; cin>>h>>w;
    string a[h]; rep(i,h) cin>>a[i];
    dp[0][0]=1;
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            if(a[i][j]=='#') continue;
            if(i-1>=0&&a[i-1][j]=='.'){
                dp[i][j]+=dp[i-1][j];
            }
            if(j-1>=0&&a[i][j-1]=='.'){
                dp[i][j]+=dp[i][j-1];
            }
            dp[i][j]%=MOD;
        }
    }
    cout<<dp[h-1][w-1]<<endl;
	return 0;
}


Measured memory_bytes: 9216
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds; 
using namespace std;
#define int long long
#define ll long long
#define pll pair<ll,ll>
#define pii pair<int,int>
#define mll map<ll,ll>
#define mii map<int,int>
#define mp make_pair
#define pb push_back
#define rep(i,b) for(ll (i)=0;i<(b);i++)
#define all(c) (c).begin(), (c).end()
#define F first
#define S second
#define CLR(p) memset(p, 0, sizeof(p))
#define SET(p) memset(p, -1, sizeof(p))
#define DEBUG true
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);
//typedef long long int ll;
typedef tree<int, null_type, less<int>, rb_tree_tag, 
tree_order_statistics_node_update> new_data_set; 
const int MAX=200005;
#define MOD 1000000007
/*std::cout << std::fixed;
std::cout << std::setprecision(6);*/
//(a%mod-b%mod+mod)%mod



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


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

vector<vector<ll>>v;
ll T=0;
ll cnt1=0,cnt0=0;
vector<ll>dep;
bool visited[MAX];
vector<ll>par;
vector<ll>tin,tout;
vector<ll>col;
ll f=0,k=1;
map<pll,ll>m;
ll dp1[MAX],dp2[MAX];
ll red,blue;
ll ans;
ll dp[MAX];

ll lca(ll u,ll v){
	while(u!=v){
		ll l1,l2;
		l1 = log2(u);
		l2 = log2(v);
		//cout<<l1<<"$$"<<l2<<endl;
		if(l1<l2)
			swap(u,v);
		u /=2;
	}
	return u;
}





signed main(){
	boost;
	int t=1;
	// cin>>t;
	while(t--){
		int n;
		cin>>n;
		string s;
		cin>>s;
		vector<int>r,g,b;
		for(int i=0;i<n;i++){
			if(s[i]=='R')
				r.pb(i+1);
			else if(s[i]=='G')
				g.pb(i+1);
			else b.pb(i+1);
		}
		//cout<<r.size()<<" "<<g.size()<<" "<<b.size()<<endl;
		int ans = r.size()*g.size()*b.size();
		//cout<<ans<<endl;
		for(int i=0;i<n;i++){
			for(int j=1;j<n;j++){
				int a = i+j;
				int c = i+(2*j);

				if(c<n&&s[a]!=s[i]&&s[i]!=s[c]&&s[a]!=s[c])
					ans--;
			}
		}
		cout<<ans<<endl;
	}

	return 0;
}

Measured memory_bytes: 3760
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <numeric>

int main() {
	int N=0;
	
	std::cin >>N;

	int total_candy=0;

	for(int i = 0; i <N+1 ; i++) {
	
	total_candy=i+total_candy;

	}
	std::cout << total_candy << std::endl;

	return 0;
}

Measured memory_bytes: 3132
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
ll INF = 1LL << 60;
int MOD = 1e9+7;
main(){
    int N;
    cin >> N;
    vector<int> X(N);
    ll sum = 0;
    for(int i = 0;i < N;i++){
        cin >> X[i];
        sum += X[i];
    }
    ll sum2 = X[0];
    sum -= X[0];
    ll ans = abs(sum2 - sum);
    for(int i = 1;i < N-1;i++){
        sum2 += X[i];
        sum -= X[i];
        ans = min(ans, abs(sum2 - sum));
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
#include <stdio.h>
int main(void){
    int a, b, c;
    scanf("%d%d%d", &a, &b, &c);
	if(a == b  && a == c){
	    printf("1");
	}else if(a == b || a == c || b == c){
	    printf("2");
	}else{
	    printf("3");
	}
    
}


Measured memory_bytes: 1608
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <list>

using namespace std;
typedef long long ll;
//#define rep(i, s, e) for (int(i) = (s); (i) <= (e); ++(i))
#define rep(i, e) for (int(i) = 0; (i) < (e); ++(i))
#define all(x) x.begin(),x.end()

ll dp[10010][2][110];


int main()
{
	string K; int D;
	cin >> K >> D;

	ll MOD = 1e9 + 7;
	rep(i, K.size() + 1)rep(j, 2)rep(k, D)dp[i][j][k] = 0;
	dp[0][0][0] = 1;

	rep(i, K.size()) {
		int d = K[i] - '0';
		rep(j, 2) {
			rep(k, D)rep(l, (j ? 10: d + 1)) {
				dp[i + 1][j || (l < d)][(k + l) % D] += dp[i][j][k];
				dp[i + 1][j || (l < d)][(k + l) % D] %= MOD;
			}
		}
	}
	cout << (dp[K.size()][0][0] + dp[K.size()][1][0] + MOD - 1) % MOD << endl;
}


Measured memory_bytes: 17408
#include<iostream>
#include<vector>
using namespace std;
int main(){
    int n;
    cin >> n;
    vector<int> d1(n);
    vector<int> d2(n);
    int cnt=0;
    bool flg=false;
    bool ans = false;
    for(int i=0; i<n; i++){
        cin >> d1[i] >> d2[i];
        if(d1[i]==d2[i]){
            flg = true;
            cnt++;
        }else{
            flg=false;
            cnt=0;
        }
        if(flg and cnt==3){
            ans = true;
        }
    }
    if(ans){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

}



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

using namespace std;

typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> VI;
typedef vector<VI> VVI;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = numeric_limits<int>::max() / 2;
const int NEG_INF = numeric_limits<int>::min() / 2;
const int MOD=1e9+7;

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

  int n;
  while(true){
      cin>>n;
      if(n==0) break;
      std::vector<string> f(n);
      std::vector<int> w(n),s(n),v(n),res(n);
      for(int i=0;i<n;i++) cin>>f[i]>>w[i]>>s[i];
      for(int i=0;i<n;i++) v[i]=i;
      double mi=1e9;
      do{
          double g=0;//,sum=0;
          for(int i=1;i<=n;i++){
              g+=i*w[v[i-1]];
             // sum+=w[v[i-1]];
          }
          bool flag=true;
          for(int i=0;i<n;i++){
              int wa=0;
              for(int j=i+1;j<n;j++) wa+=w[v[j]];
              if(s[v[i]]<wa) flag=false;
          }
          if(flag){
              if(g<mi){
                  for(int i=0;i<n;i++) res[i]=v[i];
                  mi=g;
              }
          }
      }while(next_permutation(v.begin(),v.end()));
      for(int i=0;i<n;i++) cout<<f[res[i]]<<endl;
  }
}

Measured memory_bytes: 3144
#include<stdio.h>

void bubbleSort(int A[], int N);

int main(void)
{
	int n=0, i=0;
	
	scanf("%d", &n);
	
	int a[n];
	
	for(i=0; i<n; i++)
	{
		scanf("%d", &a[i]);
	}

	bubbleSort(a, n);
	
	return 0;
}

void bubbleSort(int A[], int N)
{
	int flag = 1, i=0, j, temp=0, c=0;
	
	while(flag == 1)
	{
		flag = 0;
		
		for(j=N-1; j>=1; j--)
		{
			if(A[j] < A[j-1])
			{
				/* A[j]とA[j-1]を交換*/
				temp = A[j];
				A[j] = A[j-1];
				A[j-1] = temp;
				
				flag = 1;
				c++;
			}
			
			if(flag==1) //もし交換したならば
			{
				break;
			}
		}

	}
	
	for(i=0; i<N; i++)
	{
		if(i<N-1)
		{
			printf("%d ", A[i]);
		}
		else
		{
			printf("%d", A[i]);
		}
	}
	printf("\n%d\n", c);
}




Measured memory_bytes: 2040
#include <iomanip>
#include <iostream>

using namespace std;

int main()
{
    int n;
    cin >> n;
    double ans = 0;
    for (int i = 0; i < n; i++)
    {
        string tag;
        double money;
        cin >> money >> tag;
        if (tag == "BTC")
        {
            ans += 380000.0 * money;
        }
        else
        {
            ans += money;
        }
    }
    cout << setprecision(15);
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <list>
#include <set>
#include <queue>
#include <map>
#include <algorithm>
#include <functional>
#include <string>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <tuple>
using namespace std;

#define REP(i,p,n) for(ll i=p;i<ll(n);++i)
#define rep(i,n) REP(i,0,n)

using ll = long long int;
using pll = pair<ll, ll>;

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

    vector<ll> A(N);
    rep (i, N) { cin >> A[i]; }

    sort(A.begin(), A.end(), greater<ll>());

    ll lhs = 0;
    ll rhs = A[0];

    while (lhs + 1 < rhs)
    {
        const auto mid = (lhs + rhs) / 2;

        ll k = 0;
        rep (i, N) { k += (A[i] - 1) / mid; };

        // cout << "lhs=" << lhs << ", rhs=" << rhs << ", mid=" << mid;
        // cout << ", k=" << k << ", K=" << K << endl;

        if (k <= K) { rhs = mid; }
        else        { lhs = mid; }
    }

    cout << rhs << endl;

    return 0;
}


Measured memory_bytes: 4760
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define pb push_back
const int maxn = 10000;
const int INF32 = 1'050'000'000;
const long long INF64 = 4'000'000'000'000'000'000;
const int MOD7 = 1'000'000'007;
const int MOD9 = 1'000'000'009;
const int mod = MOD7;

void ERROR(int num) { cout << "ERROR" << num << endl; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
int dx[8]={-1,0,1,0,1,1,-1,-1};
int dy[8]={0,-1,0,1,1,-1,1,-1};


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

    ll N, W;
    cin >> N >> W;
    vector<ll> v(N), w(N);
    rep(i,N) cin >> w[i] >> v[i];

    // vector<vector<int>> dp(N+5,vector<int>(W+5));
    vector<ll> dp(W+5);
    for(ll i = 0; i < N; i++){
        for(ll j = W; j >= w[i]; j--){
            dp[j] = max(dp[j], dp[j-w[i]]+v[i]);
        }
    }
    cout << dp[W] << endl;
}

Measured memory_bytes: 3980
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>

using namespace std;

const int MAXN = 200000 + 1000;

int n, m;
long long ans = 0;
vector<int> edg[MAXN];
bool iss[MAXN];
vector<int> spe;
int fa[MAXN], dup[MAXN], ddo[MAXN], cnt[MAXN];

void dp1(int x, int father)
{
	ddo[x] = 1, cnt[x] = iss[x], fa[x] = father;
	for(int i = 0; i < edg[x].size(); i++)
		if(edg[x][i] != father)
		{
			int y = edg[x][i];
			dp1(y, x);
			ddo[x] = max(ddo[x], ddo[y] + 1);
			cnt[x] += cnt[y];
		}
}

typedef pair<int, int> pii;

pii max(const pii &a, int b)
{
	if(b < a.second) return a;
	else if(b > a.first) return make_pair(b, a.first);
	else return make_pair(a.first, b);
}

void dp2(int x, int father)
{
	pii mx(0, 0);
	for(int i = 0; i < edg[x].size(); i++)
		if(edg[x][i] != father)
			mx = max(mx, ddo[edg[x][i]]);
	for(int i = 0; i < edg[x].size(); i++)
		if(edg[x][i] != father)
		{
			int y = edg[x][i];
			dup[y] = max(dup[x], mx.first == ddo[y] ? mx.second : mx.first) + 1;
			dp2(y, x);
		}
}

void work()
{
	dp1(1, 0);
	dp2(1, 0);
	// for(int i = 1; i <= n; i++)
	// 	cout << i << ' ' << ddo[i] << ' ' << dup[i] << ' ' << cnt[i] << endl;
	for(int i = 1; i <= n; i++)
	{
		pii mx(0, 0);
		for(int j = 0; j < edg[i].size(); j++)
			if(edg[i][j] != fa[i])
				mx = max(mx, ddo[edg[i][j]]);
		mx = max(mx, dup[i]);
		int high = min(mx.second + 1, mx.first - 1);
		int low = high + 1;
		if(!iss[i])
		{
			for(int j = 0; j < edg[i].size(); j++)
				if(edg[i][j] != fa[i])
					if(cnt[edg[i][j]])
						low = min(low, ddo[edg[i][j]]);
			if(m - cnt[i])
				low = min(low, dup[i]);
		}
		else
			low = 0;
		ans += high - low + 1;
	}
	ans = ans + 1;
	cout << ans << endl;
}

int main()
{
	ios::sync_with_stdio(false);
	// freopen("1.in", "r", stdin);
	// freopen("1.out", "w", stdout);

	cin >> n;
	for(int i = 1; i <= n - 1; i++)
	{
		int x, y;
		cin >> x >> y;
		edg[x].push_back(y), edg[y].push_back(x);
	}
	static char ss[MAXN];
	cin >> (ss + 1);
	for(int i = 1; i <= n; i++)
		if(ss[i] == '1')
			iss[i] = true, spe.push_back(i);
	m = spe.size();

	work();


	return 0;
}


Measured memory_bytes: 29944
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  string str,result;
  cin >> N;
  result = "Three";
  for(int i = 0; i < N; i++){
    if(result == "Four") break;

    cin >> str;
    if(str == "Y"){
      result = "Four";
      break;
    }
  }
  cout << result << endl;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
"""
D - Binomial Coefficients
https://beta.atcoder.jp/contests/abc094/tasks/arc095_b

"""
import sys
from sys import stdin
input = stdin.readline


def solve(A):
    A.sort()
    large = A[-1]
    small = A[0]
    target = large / 2.0
    gap = large - small

    for a in A[1:-1]:
        t = abs(target - a)
        if t < gap:
            gap = t
            small = a
    return large, small


def main(args):
    n = int(input())
    A = [int(x) for x in input().split()]
    l, s = solve(A)
    print(l, s)


if __name__ == '__main__':
    main(sys.argv[1:])
    


Measured memory_bytes: 14520
use std::io::Read;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();

    let answer = solve(&buf);

    println!("{}", answer);
}

fn solve(input: &str) -> String {
    let mut iterator = input.split_whitespace();

    let a: usize = iterator.next().unwrap().parse().unwrap();
    let b: usize = iterator.next().unwrap().parse().unwrap();

    let sum = a + b;

    if sum >= 10 {
        return "error".to_string();
    }

    return sum.to_string();
}


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

int n, l, x[303000], t[303000], ans=1, c0, c1;

bool okl(int i){ return x[i]*2>=t[i]; }
bool okr(int i){ return (l-x[i])*2>=t[i]; }

int main(){
    cin>>n>>l;
    for (int i=1;i<=n;++i) cin>>x[i];
    for (int i=1;i<=n;++i){
        cin>>t[i]; ans+=t[i]/(l*2);
        t[i]%=l*2;
    }
    for (int i=1;i<=n;++i){
        if (!t[i]) continue;
        c0+=i==n;
        if (c0&&okr(i)){
            --c0;
            if (okl(i)) ++c1;
        }else if (okl(i)){
            ++c0; ++ans;
        }else if (okr(i)&&c1){
            --c1; ++c0; ++ans;
        }else{
            ++ans;
        }
    }
    cout<<2ll*l*ans<<endl;
}

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

#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define ALL(x) x.begin(),x.end()
#define EPS (1e-8)
#define equals(a,b) (fabs((a)-(b))<EPS)

using namespace std;

typedef long long ll;
bool LTE(double a,double b) { return equals(a,b) || a < b; }
bool LT(double a,double b) { return !equals(a,b) && a < b; }

void compute() {

}

int N,T,A;
double calc(double x) {
  return (double)T -  x * 0.006;
}

int main() {

  cin >> N >> T >> A;
  vector<double> H(N);
  rep(i,N) cin >> H[i];
  int pos=0;
  REP(i,1,N) {
    double a = calc(H[pos]);
    double b = calc(H[i]);
    if( LT(fabs(b-(double)A),fabs(a-(double)A)) ) {
      pos = i;
    }
  }
  cout << pos+1 << endl;
  compute();
  return 0;
}


Measured memory_bytes: 256
import java.util.*;
class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
Scanner s=new Scanner(System.in);

long a=s.nextLong();long b=s.nextLong();
if(a<0&&b<0) {
	long xx=Math.max(a,b)-Math.min(b, a);
	if(xx%2!=0)
	System.out.println("Positive");
	else
		System.out.println("Negative");
	return;
}
else if(a>0&&b>0) {
	System.out.println("Positive");
}else {
	System.out.println("Zero");
}
	}

}


Measured memory_bytes: 21716
#C
n = int(input())
a = list(map(int, input().split()))
aa = [[i, a[i]] for i in range(n)]
# print(aa)
aa.sort(key=lambda x: x[1])
# print(aa)
for i in range(n):
    print(aa[i][0] + 1, end=" ")
    

Measured memory_bytes: 26252
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <functional>
#include <string>

using namespace std;
static const int MAX = 1000;
static const long long INFTY = 100000000;

int n;
long long d[MAX][MAX];
long long ind[MAX][MAX];

void floyd() {
    for (int k = 0; k < n; k++) {
        for (int i = 0; i < n; i++) {
            if (d[i][k] == INFTY) {
                continue;
            }
            for (int j = 0; j < n; j++) {
                if (d[k][j] == INFTY) {
                    continue;
                }
                d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
            }
        }
    }
}

int main() {
    int e, u, v, c;
    cin >> n >> e;

    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            d[i][j] = ((i == j) ? 0 : INFTY);
            ind[i][j] = ((i == j) ? 0 : INFTY);
        }
    }

    for (int i = 0; i < e; i++) {
        cin >> u >> v >> c;

        ind[u - 1][v - 1] = c;
        ind[v - 1][u - 1] = c;
        d[u - 1][v - 1] = c;
        d[v - 1][u - 1] = c;
    }

    floyd();

    int cnt = 0;
    for (int i = 0; i < n; i++) {
        for(int j = 0;j < n;j++){
            if ((d[i][j] != ind[i][j]) && (d[i][j] != ind[i][j]) &&  ind[i][j] != INFTY) {
                cnt++;
            }
        }
    }

    cout << cnt/2 << endl;

    return 0;
}

Measured memory_bytes: 4864
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int N = 1e5 + 10, mod = 1e9 + 7;
vector<pair<int, int> > gr[N];
long long dis[3][N], cnt[3][N];
int n, m, s, t, mark[N];
vector<pair<int, pair<int, int> > > e;
void getDis(int st, int tp) {
	dis[tp][st] = 0, cnt[tp][st] = 1;
	set<pair<int, pair<int, int> > > s;
	for (auto p : gr[st]) {
		int u = p.first, w = p.second;
		s.insert({w, {u, st}});
	}
	mark[st] = 1;
	while (!s.empty()) {
		pair<int, pair<int, int> > p = *s.begin();
		s.erase(s.begin());
		int w = p.first, v = p.second.first, par = p.second.second;
		if (mark[v]) {
			if (w == dis[tp][v])
				cnt[tp][v] = (cnt[tp][v] + cnt[tp][par]) % mod;
			continue;
		}
		mark[v] = 1;
		dis[tp][v] = w;
		cnt[tp][v] = (cnt[tp][v] + cnt[tp][par]) % mod;
		for (auto p : gr[v]) { 
			s.insert({w + p.second, {p.first, v}}); 
		}
	}
	memset(mark, 0, sizeof(mark));
	return;
}
signed main() {
	cin >> n >> m >> s >> t;
	s--, t--;
	for (int i = 0; i < m; i++) {
		int x, y, w;
		cin >> x >> y >> w;
		x--, y--;
		e.push_back({w, {x, y}}), e.push_back({w, {y, x}});
		gr[x].push_back({y, w}), gr[y].push_back({x, w});
	}
	memset(dis, 127, sizeof(dis));
	getDis(s, 0), getDis(t, 1);
//	for (int i = 0; i < n; i++) {
//		cout << dis[1][i] << " ";
//	}
//	cout << endl;
//	for (int i = 0; i < n; i++) {
//		cout << cnt[1][i] << " ";
//	}
//	cout << endl;
	long long ans = 1ll * cnt[0][t] * cnt[0][t] % mod, d = dis[0][t];
//	cout << "ans = " << ans << endl;
	for (int i = 0; i < n; i++) {
		if (dis[0][i] + dis[1][i] == d && dis[0][i] == dis[1][i]) {
//			cout << "i = " << i << endl;
			ans = 1ll *  (ans - 1ll * cnt[0][i] * cnt[1][i] % mod * cnt[0][i] % mod * cnt[1][i] % mod + mod) % mod;
		}
	}
//	cout << "ans = " << ans << endl;
	for (auto p : e) {
		int x = p.second.first, y = p.second.second;
		if (dis[0][x] + dis[1][y] + p.first == d && dis[0][x] * 2 < d && dis[1][y] * 2 < d) {
//			cout << "HOO" << endl;
			ans = 1ll * (ans - 1ll * cnt[0][x] * cnt[1][y] % mod * cnt[0][x] % mod * cnt[1][y] % mod + mod) % mod;
		}
	}
	cout << (ans + mod) % mod << endl;
	return 0;
}


Measured memory_bytes: 38312
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstring>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;
#define fst first
#define snd second

/* clang-format off */
template <class T, size_t D> struct _vec { using type = vector<typename _vec<T, D - 1>::type>; };
template <class T> struct _vec<T, 0> { using type = T; };
template <class T, size_t D> using vec = typename _vec<T, D>::type;
template <class T> vector<T> make_v(size_t size, const T& init) { return vector<T>(size, init); }
template <class... Ts> auto make_v(size_t size, Ts... rest) { return vector<decltype(make_v(rest...))>(size, make_v(rest...)); }
template <class T> inline void chmin(T &a, const T& b) { if (b < a) a = b; }
template <class T> inline void chmax(T &a, const T& b) { if (b > a) a = b; }
/* clang-format on */

int main() {
#ifdef DEBUG
  ifstream ifs("in.txt");
  cin.rdbuf(ifs.rdbuf());
#endif
  string S;
  while (cin >> S) {
    sort(S.begin(), S.end());
    bool res = (S[0] == S[1] && S[2] == S[3] && S[0] != S[2]);
    cout << (res ? "Yes" : "No") << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int s,a,b,ans;
char ch;
int main(){
  while(1){
    ans=-1;
    for(int i=0;i<5;i++){
      cin>>a>>b;
      if(a==0&&b==0&&i==0)return 0;
      if(a+b>ans)ans=a+b,ch='A'+i;
    }
    cout<<ch<<' '<<ans<<endl;
  }
}

Measured memory_bytes: 1156
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep2(i, a, n) for(ll i = a; i < (ll)(n); i++)
#define memi cout << endl
#define kono(n) cout << fixed << setprecision(n)
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define hina cout << ' '
#define in(n) cin >> n
#define in2(n, m) cin >> n >> m
#define in3(n, m, l) cin >> n >> m >> l
#define out(n) cout << n
const ll mei = (ll)1e9 + 7;

int main(){
  string s;
  in(s);
  if(s[0] != s[1] && s[1] != s[2] && s[2] != s[3])
    out("Good");
  else
    out("Bad");
  memi;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  ll n, m;
  cin >> n >> m;
  if(n == 1 && m == 1)
    cout << 1 << endl;
  else if(n == 1)
    cout << m - 2 << endl;
  else if(m == 1)
    cout << n - 2 << endl;
  else
    cout << max(0LL, (n - 2) * (m - 2)) << endl;
}

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

  
int main () 
{ 
    int n;
    cin>>n;
    int h[n+1]={0};
    for(int i=0;i<n-1;i++)
    {
        int x;
        cin>>x;
        h[x]++;
    }
    for(int i=1;i<=n;i++)
    cout<<h[i]<<endl;
    
    return 0; 
} 

Measured memory_bytes: 4376