akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <cmath>

using namespace std;
//typedef long long ll;
typedef unsigned long long ll;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) ll(x.size())
//typedef pair<int, int> P;
typedef pair<ll, ll> P;
//const double INF = 1e10;
//const ll INF = LONG_LONG_MAX;
const ll MINF = LONG_LONG_MIN;
const int INF = INT_MAX;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)

bool contain(set<char> &s, int a) { return s.find(a) != s.end(); }


//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);

typedef priority_queue<ll, vector<ll>, greater<ll>> PQ_ASK;
const int mod = 1000000007;


int main() {
    set<int> paint;
    rep(i, 3) {
        int a;
        cin >> a;
        paint.insert(a);
    }
    cout << paint.size()<< endl;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {

  int n;

  int count;


  while(1) {

    cin >> n;

    if(n==0) break;

    count=0;

    while(n>1) {

      if(n%2==0) n/=2;

      else n=3*n+1;

      count++;

    }

    cout << count << endl;

  }

  return 0;

}

Measured memory_bytes: 0
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <complex>
#include <fstream>
#include <cmath>

using namespace std;

int main(void){
    int x, t;
    cin >> x >> t;
    cout << ((x-t>0) ? x-t : 0) << endl;
    return 0;
}


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

int main(int argc, const char * argv[]) {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int qCnt;
    int sCnt;

    cin >> qCnt >> sCnt;

    int acCnt = 0;
    int waCnt = 0;
    bool cleared[qCnt];
    int waCnts[qCnt];

    for (int i=0; i<qCnt; i++) {
        cleared[i] = false;
        waCnts[i] = 0;
    }

    for(int i=0; i<sCnt; i++) {
        int q;
        string a;
        cin >> q >> a;
        int qForA = q - 1;

        if(cleared[qForA]) {
            continue;
        }

        if(a=="AC") {
            cleared[qForA] = true;
            acCnt++;
            int wa = waCnts[qForA];
            waCnt += wa;
        } else {
            int wa = waCnts[qForA];
            waCnts[qForA] = wa + 1;
        }
    }

    cout << acCnt << " " << waCnt;

    return 0;
}


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

int main(){
    int a,b,c;
    cin >> a >> b >> c;
    int res;
    if(a==b||b==c||a==c){
        if(a==b&&b==c){
            res = 1;
        }else{
            res = 2;
        }
    }else{
        res = 3;
    }
    cout << res << endl;;
    return 0;
}


Measured memory_bytes: 256
N,x,y,z=map(int,input().split())
mask=2**(x+y+z)-1
mod=10**9+7
ng=2**(x+y+z-1)+2**(y+z-1)+2**(z-1)
dp=[[0 for i in range(mask+1)] for i in range(N+1)]
dp[0][0]=1
for i in range(N):
  for j in range(mask+1):
    for k in range(1,11):
      if (mask&((j<<k)+(1<<(k-1))))&ng!=ng:
        dp[i+1][mask&((j<<k)+(1<<(k-1)))]+=dp[i][j]
      dp[i+1][j]%=mod
ans=(10**N)%mod
for j in range(mask+1):
  ans-=dp[N][j]
  ans%=mod
print(ans)


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

#define sd(x) scanf("%d", &(x))
#define ll long long
#define pb push_back
#define F first
#define S second
#define pii pair<int, int>

#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

const int N = 4e6 + 10;
bitset<N> B;
int A[2005];
int main(){
	int n, a, b;
	sd(n); sd(a); sd(b);
	if((b - a) & 1){
		printf("Borys\n");
	}
	else printf("Alice\n");
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
#define ll long long

void solve()
{
	int l;cin>>l;
	double ans=(double)l/3;
	float ans1=ans*ans*ans;
	cout.precision(10);
	printf("%.10f",ans1);
}
int main()
{
//	int t;cin>>t;
//	while(t--)
	solve();
}


Measured memory_bytes: 256
N = int(raw_input())
A = map(int, raw_input().split())
count = 0
for i in range(0, N):
    min_j = i
    c = 0
    for j in range(i, N):
        if A[j] < A[min_j]:
            min_j = j
            c = 1
    A[i], A[min_j] = A[min_j], A[i]
    count += c
print " ".join(map(str, A))
print count

Measured memory_bytes: 6452
#include <iostream>
#include <cmath>
#include <complex>

struct POINT_DOUBLE {
  double x;
  double y;
};

struct CIRCLE_DOUBLE {
  POINT_DOUBLE center;
  double radius;
};

std::istream& operator >> (std::istream& is, POINT_DOUBLE& p)
{
  is >> p.x >> p.y;
  return is;
}

std::istream& operator >> (std::istream& is, CIRCLE_DOUBLE& circle)
{
  is >> circle.center >> circle.radius;
  return is;
}

static double GetDistance(const POINT_DOUBLE& pt1, const POINT_DOUBLE& pt2)
{
  return std::sqrt(std::pow(pt1.x - pt2.x, 2) + std::pow(pt1.y - pt2.y, 2));
}

int main(void)
{
  int n;
  std::cin >> n;

  for (int i = 0; i < n; i++) {
    CIRCLE_DOUBLE circleA, circleB;
    std::cin >> circleA >> circleB;
    bool isSwapped = false;
    if (circleA.radius < circleB.radius) {
      std::swap(circleA, circleB);
      isSwapped = true;
    }

    double centerDis = GetDistance(circleA.center, circleB.center);
    if (centerDis > circleA.radius + circleB.radius) {
      std::cout << 0 << std::endl;
    }
    else if (circleA.radius > centerDis + circleB.radius) {
      if (isSwapped) {
        std::cout << -2 << std::endl;
      }
      else {
        std::cout << 2 << std::endl;
      }
    }
    else {
      std::cout << 1 << std::endl;
    }

  }

  return 0;
}



Measured memory_bytes: 3176
#include<iostream>
using namespace std;
int main(void){
  int n,d,x;
  cin>>n>>d>>x;
  int a[n];
  int c(0);
  for(int i(0);i<n;i++){
    cin>>a[i];
    if(d%a[i]==0){
      int b=d/a[i];
      c+=b;
    }else{
      int b=d/a[i];
      c+=b+1;
    }
  }
  cout<<c+x<<endl;
  return 0;
}

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

int main() {
  int N,i,j=0;
  cin >> N;
  
  for(i=0; i<=min(N/7, 3); i++){
    if((N-7*i)%4==0){
      j++; break;
    }
  }
  
  if(j!=0){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
	int a,p;
	cin>>a>>p;
	cout<<(3*a+p)/2<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <cstdlib>
#define rep(i,n) for(int i = 0;i<(n);i++);
#define all(a) (a).begin(),(a).end()
using namespace std;
using ld = long double;
using ll = long long;
const ll INF = 100100100100100;
ll gcd(ll a, ll b) {//a>b
	if (a < b)swap(a, b);
	if (a % b == 0) return b;
	else return gcd(b, a % b);
}

int main() {
	ll K, S;
	cin >> K >> S;
	ll ans = 0;//2 2
	for (int i = 0; i <= K; i++) {
		for (int j = 0; j <= K; j++) {// i + j + k = S
			if(S - i - j<=K && S - i - j >=0){
              ans++;
            }
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include<cstdio>

int main(){
    int a,b,sum;
    while(scanf("%d%d",&a,&b)!=EOF)
    {
        sum=a+b;
        int cnt=0;
        while(sum){
            sum/=10;
            cnt++;
        }
        printf("%d\n",cnt);
    }
    return 0;
}

Measured memory_bytes: 1028
import numpy as np

N=int(input())
line=input()
arr=np.array([int(ai) for ai in line.split()])

maxNum=np.max(arr)
minNum=np.min(arr)

if maxNum==minNum:#全て等しい場合
    if maxNum==(N-1):#全てC-1のとき
        print("Yes")
    else:#全てCのとき
        C=maxNum
        numUniq=0
        if numUniq>=2*C-N and numUniq<C:
            print("Yes")
        else:
            print("No")
elif maxNum==minNum+1:
    C=maxNum
    numUniq=(arr==minNum).sum()
    if numUniq>=2*C-N and numUniq<C:
        print("Yes")
    else:
        print("No")
else:
    print("No")

Measured memory_bytes: 23968
#include "bits/stdc++.h"
#define MOD 1000000007
#define inf 0x3f3f3f3f
#define pi acos(-1.0)
#define ri register int
#define Max(x, y) (((x) > (y)) ? (x) : (y))
#define Min(x, y) (((x) < (y)) ? (x) : (y))
#define Abs(x) ((x) < 0 ? (-(x)) : (x))
#define int long long
const int maxn = 2e2 + 10;
inline int read()
{
    int f = 1, r = 0;
    char c = getchar();
    while (!isdigit(c)) {
        if (c == '-') {
            f = -1;
        }
        c = getchar();
    }
    while (isdigit(c)) {
        r = 10 * r + c - '0';
        c = getchar();
    }
    return f * r;
}
inline void write(int x)
{
    if (x < 0)
        putchar('-'), x = -x;
    if (x > 9)
        write(x / 10);
    putchar(x % 10 + '0');
}
inline void writesp(int x) { write(x), putchar(' '); }
inline void writeln(int x) { write(x), puts(""); }
char src[maxn][maxn], dst[maxn * 2][maxn];
int H, W;
signed main()
{
    H = read(), W = read();
    for (ri i = 1; i <= H; ++i) {
        for (ri j = 1; j <= W; ++j) {
            std::cin >> src[i][j];
        }
    }
    for (ri i = 1; i <= 2 * H; ++i) {
        for (ri j = 1; j <= W; ++j) {
            int ni = (i + 1) / 2;
            dst[i][j] = src[ni][j];
        }
    }
    for (ri i = 1; i <= 2 * H; ++i) {
        for (ri j = 1; j <= W; ++j) {
            std::cout << dst[i][j];
        }
        puts("");
    }
    return 0;
}

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

int main(){
    int X, ans;
    std::cin >> X;

    if(X < 600){
        ans = 8;
    }else if(X < 800){
        ans = 7;
    }else if(X < 1000){
        ans = 6;
    }else if(X < 1200){
        ans = 5;
    }else if(X < 1400){
        ans = 4;
    }else if(X < 1600){
        ans =3;
    }else if(X < 1800){
        ans =2;
    }else if(X < 2000){
        ans =1;
    }

    std::cout << ans;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for (ll i = m; i < n; i++)
#define IFOR(i, m, n) for (ll i = n - 1; i >= m; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define FOREACH(x, a) for (auto&(x) : (a))
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) ll(x.size())

int D;
const int T = 26;      // type no kazu
vector<ll> c(T + 1);   // penalty 1-indexed
vector<vector<ll>> s;  // 1-indexed
vector<set<ll>> days(T + 1);
vector<ll> ans;
ll maxScore = 0;

void readInput() {
  cin >> D;
  REP(i, T) { cin >> c[i + 1]; }
  s = vector<vector<ll>>(D + 1, vector<ll>(T + 1));
  REP(i, D) REP(j, T) { cin >> s[i + 1][j + 1]; }
}

ll calcInitScore(const vector<ll>& t) {
  FOR(i, 1, T + 1) {
    days[i].insert(D + 1);
    days[i].insert(0);
  }

  ll beforeScore = 0;
  FOR(i, 1, D + 1) {
    days[t[i]].insert(i);
    // score gain
    ll afterScore = beforeScore + s[i][t[i]];
    // penalty
    FOR(j, 1, T + 1) { afterScore -= c[j] * (i - *(++days[j].rbegin())); }
    beforeScore = afterScore;
  }
  return beforeScore;
}

int main() {
  readInput();

  ans = vector<ll>(D + 1);

  vector<ll> ord(T);
  iota(ALL(ord), 1);
  sort(ALL(ord), [&](ll i, ll j) { return c[i] > c[j]; });

  FOR(i, 1, D + 1) { ans[i] = ord[(i - 1) % T]; }

  REP(i, D) { cout << ans[i + 1] << endl; }
}

Measured memory_bytes: 3728
#include <algorithm>
#include <deque>
#include <iostream>
#include <vector>

#include <iomanip>

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

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;

int N, K;
int p[200001];

int main() {
    cin >> N >> K;
    int tmp, tmp2;
    double sum = 0.0, ans = 0.0;
    REP(i, N) {
        cin >> p[i];
        sum += (double)p[i];
        if (i >= K - 1) {
            if (sum > ans) {
                ans = sum;
            }
            sum -= p[i - K + 1];
        }
    }
    ans = (ans + (double)K) / 2.0;
    cout << fixed << setprecision(12) << ans << endl;
    return 0;
}


Measured memory_bytes: 1024
#include<stdio.h>
#include<stdlib.h>
typedef struct node
{
  int id;
  struct node *parent;
  struct node *leftMostChild;
  struct node *rightSibling;
} *nodePointer;
nodePointer make1node(void);
void printNode(nodePointer);
int getDepth(nodePointer);
void printType(nodePointer);
void printChild(nodePointer);
nodePointer init(int);
nodePointer head;
int main(void)
{
  int i,j;//counter
  int n;//the number of nodes
  int id;//id of each node
  int k;//the number of children
  int c1,c2;//id of children
  nodePointer p1,p2;
  nodePointer *arr;
  head=init(-1);
  scanf("%d",&n);
  arr=(nodePointer*)malloc(sizeof(nodePointer)*n);
  for(i=0;i<n;i++) arr[i]=init(i);
  for(i=0;i<n;i++)
    {
      scanf("%d",&id);
      scanf("%d",&k);
      for(j=0;j<k;j++)
        {
          scanf("%d",&c1);
          if(j==0)
            {
              arr[id]->leftMostChild=arr[c1];
            }
          else
            {
              arr[c2]->rightSibling=arr[c1];
            }
          arr[c1]->parent=arr[id];
          c2=c1;
        }
    }
  for(i=0;i<n;i++) printNode(arr[i]);
  return 0;
}
nodePointer init(int id)
{
  nodePointer p;
  p=make1node();
  p->id=id;
  p->parent=NULL;
  p->leftMostChild=NULL;
  p->rightSibling=NULL;
  return p;
}
void printNode(nodePointer p)
{
  printf("node %d: ",p->id);
  if(p->parent!=NULL) printf("parent = %d, ",p->parent->id);
  else printf("parent = -1, ");
  printf("depth = %d, ",getDepth(p));
  printType(p);
  printf(", ");
  printChild(p);
  printf("\n");
}
nodePointer make1node(void)
{
  nodePointer p=(nodePointer)malloc(sizeof(struct node));
  return p;
}
int getDepth(nodePointer p)
{
  int depth;
  for(depth=0;p->parent!=NULL;p=p->parent) depth++;
  return depth;
}
void printType(nodePointer p)
{
  if(p->parent==NULL) printf("root");
  else if(p->leftMostChild==NULL) printf("leaf");
  else printf("internal node");
}
void printChild(nodePointer p)
{
  printf("[");
  if(p->leftMostChild!=NULL)
    {
      p=p->leftMostChild;
      printf("%d",p->id);
      for(;p->rightSibling!=NULL;p=p->rightSibling) printf(", %d",p->rightSibling->id);
    }
  printf("]");
}


Measured memory_bytes: 7268
import java.util.Arrays;
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()) {
            int n = sc.nextInt(), l[] = new int[n], s = 0;
            for (int i = 0; i < n; i++)
                l[i] = sc.nextInt();
            Arrays.sort(l);
            for (int i = 0; i < n; i++)
                s += l[i] * (n - i);
            System.out.println(s);
        }
    }
}


Measured memory_bytes: 37828
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <utility>
#include <map>

using namespace std;

typedef long long lint;

int main(int argc, char **argv)
{
    int N;
    cin >> N;

    map<int, int> mset;
    lint total = 0;
    for (int i = 0;i < N; i++) {
        int a;
        cin >> a;
        total += a;
        mset[a]++;
    }

    int Q;
    cin >> Q;
    while (Q--) {
        int B, C;
        cin >> B >> C;
        if (mset.count(B)) {
            int r = mset[B];
            mset.erase(mset.find(B));
            mset[C] += r;
            total -= B * 1LL * r;
            total += C * 1LL * r;
        }

        cout << total << endl;
    }

    return 0;
};


Measured memory_bytes: 6516
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <ctype.h>
#include <limits.h>
#define EPS 1e-10
#define sq(n) ((n)*(n))
#define rep(i,n) for(i=0;i<n;i++)
#define rev(i,n) for(i=n-1;i>=0;i--)
#define sort(a,n) qsort(a,n,sizeof(TYPE),cmp)
#define sort_r(a,n) qsort(a,n,sizeof(TYPE),cmp_r);
#define chsort(s,n) qsort(s,n,sizeof(char),cmp)
#define chsort_r(s,n) qsort(s,n,sizeof(char),char_cmp_r);
#define TYPE int
#define MEMSET(a) memset(a,0,sizeof(a))
long long mod=(long long)1e09+7;
int inf=1<<30;

int in(void){
    int i;scanf("%d",&i);
    return i;
}
long long llin(void){
    long long i;scanf("%lld",&i);
    return i;
}
double din(void){
    double i;scanf("%lf",&i);
    return i;
}
void chin(char s[]){
    scanf("%s",s);
}
void print(int a){
    printf("%d\n",a);
}
void llprint(long long a){
    printf("%lld\n",a);
}
void dprint(double a){
    printf("%.10f\n",a);
}
void print2(int a,int b){
    printf("%d %d\n",a,b);
}
long long max(long long a,long long b){
    return a>b?a:b;
}
long long min(long long a,long long b){
    return a<b?a:b;
}
int cmp(const void *a,const void *b){
    return *(TYPE *)a-*(TYPE *)b;
}
int cmp_r(const void *a,const void *b){
    return *(TYPE *)b-*(TYPE *)a;
}
int char_cmp(const void *a,const void *b){
    return strcmp((char *)a,(char *)b);
}
int char_cmp_r(const void *a,const void *b){
    return strcmp((char *)b,(char *)a);
}
void swap(int *a,int *b){
    int t=*a;
    *a=*b;
    *b=t;
}
long long gcd(long long x,long long y){
    return x%y?gcd(y,x%y):y;
}
long long lcm(long long x,long long y){
    return x/gcd(x,y)*y;
}

// write codes below this
// when you use 'sort',
// make sure TYPE macro is correct
int main(void){
    int i,ans=0;
    char s[5];
    chin(s);
    rep(i,4){
        if(s[i]=='+')ans++;
        else ans--;
    }
    print(ans);
    return 0;
}

Measured memory_bytes: 128
#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
inline void rd(int &x){
  int k;
  int m=0;
  x=0;
  for(;;){
    k = getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
inline void wt_L(char a){
  putchar_unlocked(a);
}
inline void wt_L(int x){
  int s=0;
  int m=0;
  char f[10];
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    putchar_unlocked('-');
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
template<class T> inline T pow2_L(T a){
  return a*a;
}
template<class S, class T> inline S chmin(S &a, T b){
  if(a>b){
    a=b;
  }
  return a;
}
int N;
int X[100];
int main(){
  int i;
  int tmp;
  int res = 1073709056;
  rd(N);
  {
    int Lj4PdHRW;
    for(Lj4PdHRW=(0);Lj4PdHRW<(N);Lj4PdHRW++){
      rd(X[Lj4PdHRW]);
    }
  }
  for(i=(1);i<(101);i++){
    int k;
    tmp = 0;
    for(k=(0);k<(N);k++){
      tmp +=pow2_L((X[k] - i));
    }
    chmin(res, tmp);
  }
  wt_L(res);
  wt_L('\n');
  return 0;
}
// cLay varsion 20200217-1

// --- original code ---
// int N, X[100];
// {
//   int tmp, res = int_inf;
//   rd(N,X(N));
// 
//   rep(i,1,101){
//     tmp = 0;
//     rep(k,N) tmp += (X[k] - i) ** 2;
//     res <?= tmp;
//   }
//   wt(res);
// }


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

int main(){
	int n, m;
	int ai, bi;
	cin >> n >> m;
	int result[n] = {0};
	for (int i = 0; i < m; ++i){
		cin >> ai >> bi;
		result[ai -1] += 1;
		result[bi -1] += 1;
	}
	for (int i = 0; i <  n; ++i){
		cout << result[i] << endl;
	}


}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
int main(void){
	ll n,i;
	cin>>n;
	ll a;
	vector<ll> b,c;
	for(i=0;i<n;i++){
		cin>>a;
		if(i%2==0)b.push_back(a);
		else c.push_back(a);
	}
  if(n%2==0){
	reverse(c.begin(),c.end());
	for(i=0;i<c.size();i++){
		if(i!=0)cout<<" ";
		cout<<c[i];
	}
  cout<<" ";
	for(i=0;i<b.size();i++){
		if(i!=0)cout<<" ";
		cout<<b[i];
	}
	cout<<endl;
  }else{
    reverse(b.begin(),b.end());
	for(i=0;i<b.size();i++){
		if(i!=0)cout<<" ";
		cout<<b[i];
	}
  cout<<" ";
	for(i=0;i<c.size();i++){
		if(i!=0)cout<<" ";
		cout<<c[i];
	}
  }
    
}

Measured memory_bytes: 3948
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<ctime>
#include<cassert>
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<queue>
#include<utility>
#include<bitset>
#include<complex>
#include<map>
#include<set>
#include<unordered_map>
#include<unordered_set>
#include<stack>

using namespace std;

#define mem(a,b) memset(a,b,sizeof(a))
#define REP(i,a,b) for(int i=a; i<=b; ++i)
#define PER(i,a,b) for(int i=a; i>=b; --i)
#define MP make_pair
#define PB push_back
#define fi first
#define se second
typedef long long LL;

const int maxn = 1e5;
const int P = 1e9+7;

int n, cnt[30];
char s[maxn+5];

int main() {
    scanf("%d", &n);
    scanf("%s", s);
    for(int i = 0; i < n; ++i) ++cnt[s[i]-'a'];
    LL ans = 1;
    for(int i = 0; i < 26; ++i) ans = ans * (cnt[i]+1) % P;
    ans = (ans-1 + P) % P;
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <queue>
#include <stack>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <vector>
#include <list>

int w, h;
int p[100010];
int q[100010];

int main() {
    long long res = 0;
    std::cin >> w >> h;

    for(int i = 0; i < w; ++i) {
        std::cin >> p[i];
        res += p[i];
    }
    for(int i = 0; i < h; ++i) {
        std::cin >> q[i];
        res += q[i];
    }

    std::sort(p, p + w);
    std::sort(q, q + h);

    for(int i = 0; i < w; ++i) {
        int n = h - (std::lower_bound(q, q + h, p[i]) - q);
        res += 1ll * p[i] * (n);
    }
    for(int i = 0; i < h; ++i) {
        int n = w - (std::upper_bound(p, p + w, q[i]) - p);
        res += 1ll * q[i] * (n);
    }

    std::cout << res << std::endl;
}

Measured memory_bytes: 1024
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

    public static void main(String[] args) throws IOException {
        int a, b;
        String op;
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        StringBuilder builder = new StringBuilder();

        while (true) {
            String data = reader.readLine();
            String[] number = data.split(" ");
            a = Integer.parseInt(number[0]);
            op = number[1];
            b = Integer.parseInt(number[2]);

            if (op.equals("?")) {
                break;
            }
            if (op.equals("+")) {
                 builder
                    .append(a+b)
                    .append("\n");
            }
            if (op.equals("-")) {
                 builder
                    .append(a-b)
                    .append("\n");
            }
            if (op.equals("*")) {
                 builder
                    .append(a*b)
                    .append("\n");
            }
            if (op.equals("/")) {
                 builder
                    .append(a/b)
                    .append("\n");
            }
        }
        System.out.print(builder);        
    }
}

Measured memory_bytes: 24328
import java.util.*;
public class Main
{
  public static void main(String args[])
  {
    Scanner sc=new Scanner(System.in);
    String s=sc.nextLine();
    int ind=s.indexOf(' ');
    for(int i=ind+1;i<s.length();i++)
      System.out.print(s.charAt(i));
    for(int i=0;i<ind;i++)
      System.out.print(s.charAt(i));
  }
}

Measured memory_bytes: 21840
//JAI SRI KRISHNA.//
#include<stdio.h>
int main()
{
    int i,mx=0,r=0;
    char ch;
    for(i=0;i<3;i++)
    {
        scanf(" %c",&ch);
        if(ch=='R')
            r++;
        else
        {
            if(r>mx)
                mx=r;
            r=0;
        }
    }
      if(r>mx)
        mx=r;
    printf("%d\n",mx);


}


Measured memory_bytes: 1728
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*);
    }
}

#[allow(unused_imports)]
use std::cmp::{min, max};
#[allow(unused_imports)]
use std::io::{stdout, stdin, BufWriter, Write};

fn main() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (write!(out,$($format)*).unwrap());
    }

    input!{
      s: String,
    }
    let days = vec!["SUN","MON","TUE","WED","THU","FRI","SAT"];
    let index = days.iter().position(|&v|v == s).unwrap();
    puts!("{}\n", 7-index);
}


Measured memory_bytes: 4352
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * 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;
		FastScanner in = new FastScanner(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskF solver = new TaskF();
		solver.solve(1, in, out);
		out.close();
	}

	static class TaskF {
		public void solve(int testNumber, FastScanner in, PrintWriter out) {
			int n = in.nextInt();
			int m = in.nextInt();
			int[][] edgeCost = new int[n][n];
			for (int[] arr : edgeCost) {
				Arrays.fill(arr, -1);
			}
			int totalCost = 0;
			for (int i = 0; i < m; i++) {
				int a = in.nextInt() - 1;
				int b = in.nextInt() - 1;
				int c = in.nextInt();
				edgeCost[a][b] = c;
				edgeCost[b][a] = c;
				totalCost += c;
			}

			int[] compCost = new int[1 << n];
			for (int mask = 0; mask < 1 << n; mask++) {
				for (int i = 0; i < n; i++) {
					if ((mask & (1 << i)) == 0) {
						continue;
					}
					for (int j = i + 1; j < n; j++) {
						if ((mask & (1 << j)) == 0) {
							continue;
						}
						if (edgeCost[i][j] >= 0) {
							compCost[mask] += edgeCost[i][j];
						}
					}
				}
			}

			int[][] d = new int[n][1 << n];
			for (int[] arr : d) {
				Arrays.fill(arr, -1);
			}
			for (int mask = 0; mask < 1 << n; mask++) {
				if ((mask & (1 << 0)) > 0) {
					d[0][mask] = compCost[mask];
				}
			}
			int full = (1 << n) - 1;
			for (int mask = 0; mask < 1 << n; mask++) {
				for (int root = 0; root < n; root++) {
					if ((mask & (1 << root)) == 0) {
						continue;
					}
					if (d[root][mask] < 0) {
						continue;
					}
					int others = full ^ mask;
					for (int addMask = others; addMask > 0; addMask = (addMask - 1) & others) {
						for (int nRoot = 0; nRoot < n; nRoot++) {
							if ((addMask & (1 << nRoot)) == 0) {
								continue;
							}
							if (edgeCost[root][nRoot] < 0) {
								continue;
							}
							int nMask = mask | addMask;
							d[nRoot][nMask] = Math.max(d[nRoot][nMask], d[root][mask] + edgeCost[root][nRoot] + compCost[addMask]);
						}
					}
				}
			}

			out.println(totalCost - d[n - 1][full]);
		}

	}

	static class FastScanner {
		private BufferedReader in;
		private StringTokenizer st;

		public FastScanner(InputStream stream) {
			in = new BufferedReader(new InputStreamReader(stream));
		}

		public String next() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					String rl = in.readLine();
					if (rl == null) {
						return null;
					}
					st = new StringTokenizer(rl);
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return st.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

	}
}



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

int main(){
    int t,h,n;
    cin >> n;
    string tc,hc;
    t = h = 0;
    for (int i = 0; i < n; i++){
        cin >> tc >> hc;
        if(tc > hc) t += 3;
        else if (hc > tc) h += 3;
        else{
            t++;
            h++;
        }
    }
    cout << t << " " << h << endl;
    return 0;
}


Measured memory_bytes: 3192
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath> // sqrt
#define _GLIBCXX_DEBUG // check []
#define DIVISOR 1000000007

using namespace std;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<int64_t, int64_t> pII;

template<typename T>
void cins(vector<T>& arr) { for(T& e: arr) cin >> e; }

#ifdef DEBUG
#define debug(fmt, ...) \
    printf("[debug: %s] " fmt, __func__, __VA_ARGS__)
#define ps(arr) \
    debug("size %ld: ", arr.size()); \
    for(auto e: arr) cout << e << " "; \
    cout << endl;
#else
#define debug(fmt, ...)
#define ps(arr)
#endif


int main(void) {
    int num;
    cin >> num;
    vector<int> arr(num);
    cins(arr);
    sort(arr.begin(), arr.end());
    deque<int> deq;
    for(int i = 0; i < num; i++) {
        deq.push_back(arr[i]);
    }

    vector<pii> ans;
    while(deq.size() > 1) {
        int n1 = deq.front(); deq.pop_front();
        int n2 = deq.back(); deq.pop_back();
        int pos = n2-n1;
        int neg = n1-n2;
        // last time
        int flag = (!deq.empty() && deq.front() >= 0);
        debug("%d, %d <- %d\n", n1, n2, flag);
        // pos
        if(!flag) {
            ans.push_back(make_pair(n2, n1));
            deq.push_back(pos);
        // neg
        } else {
            ans.push_back(make_pair(n1, n2));
            deq.push_front(neg);
        }
    }

    cout << abs(deq.front()) << endl;
    for(int i = 0; i < ans.size(); i++) {
        cout << ans[i].first << " " << ans[i].second << endl;
    }
    return 0;
}

Measured memory_bytes: 5108
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <set>
#include <algorithm>
#include <array>
#include <complex>
#include <utility>
#include <map>
int needleX[4] = { -1,0,1,0 };
int needleY[4] = { 0,1,0,-1 };

int main(void) {
    int n,k;
    std::cin >> n >> k;
    std::set<int> d;
    int a;
    for(int i=0;i<k;i++){
        std::cin >> a;
        d.insert(a);
    }
 
    
    for(int i=n;i<=10*n;i++){
        int check;
        int N=i;
        bool flag=false;
        while(N>0){
            check=N%10;
            if(d.count(check)!=0){
                flag=false;
            }else{
                flag=true;
            }
          if(flag==false) break;
            N/=10;
        }
        if(flag==true){
            std::cout << i << std::endl;
            return 0;
        }
    }
    return 0;
}

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

double cal_distance(int x1, int y1, int x2, int y2){
    return sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));
}

int64_t facto(int64_t n){
    int64_t a = 1;
    for(int i=2; i<=n; i++){
        a = a*i;
    }
    return a;
}

int main(){
    int n;
    cin >> n;
    int x[10] = {};
    int y[10] = {};
    for(int i=0; i<n; i++){
        cin >> x[i] >> y[i];
    }
    double ans = 0;
    for(int i=0; i<n; i++){
        for(int j=i+1; j<n; j++){
            ans += cal_distance(x[i], y[i], x[j], y[j]);
        }
    }
    ans *= (2*facto(n-1));
    ans /= facto(n);
    cout << fixed << setprecision(10);
    cout << ans << endl;
    return 0;
}

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

int main()
{
    int a,b,n;
    scanf("%d%d%d",&a,&b,&n);
    int max;
    if(a>b)max=a;
    else max=b;
    int i=0,s=0;
    while(s<n)
    {
        s+=max;
        i++;
    }
    printf("%d",i);
    return 0;
}

Measured memory_bytes: 128
#!/usr/bin/env python3
#import sys; sys.stdin=open('input_file.txt')
#------------------------------------------
from collections import defaultdict
import sys
input = sys.stdin.readline
N = int(input())
D = defaultdict(int)
for i in range(N):
    D[input().rstrip()] += 1
A = []
maxv = 0
for k,v in sorted(D.items(),key=lambda x:x[1],reverse=True):
    if maxv > v:
        break
    maxv = v
    A.append(k)
A.sort()
print('\n'.join(A))


Measured memory_bytes: 43484
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <map>
#include <set> 
#include <bitset>
#include <cmath>
using namespace std;
#define REP(i,n) for(int i=0;i<n;i++)
typedef long long ll;

int infinity = 1000000000;

int main () {
    
    int n, T;
    cin >> n >> T;

    vector<int> cv(n, infinity);

    for (int i = 0; i < n; i++) {
        int c, t;
        cin >> c >> t;
        if(t <= T) {
            cv[i] = c;
        } 
    }

    sort(cv.begin(), cv.end());
    
    if(cv[0] == infinity) {
        cout << "TLE" << endl;
    } else {
        cout << cv[0] << endl;  
    } 
    
    return 0;
}

Measured memory_bytes: 256
function Main(input) {
  "use strict"
  const temp = input.split("\n");

	const n = parseInt(temp.shift());
  const an = temp.shift().split(" ").map(x => parseInt(x));
  const bn = temp.shift().split(" ").map(x => parseInt(x));
  const cn = temp.shift().split(" ").map(x => parseInt(x));
  
  let sumOfBn = bn.reduce((acc, cur) => acc + cur);
  let counter = 0;
  an.forEach((x, i) => {
    if(i !== 0 && x === an[i - 1] + 1){
      counter += cn[x - 2];
    }
  })
  console.log(sumOfBn + counter)
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 7372
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
print(N//3)

Measured memory_bytes: 5204
#include<bits/stdc++.h>
using namespace std;
int n, m, l[307][307], pos[307], tot[307], res;
bool is[307];
int read()
{
	int num = 0;
	char c = getchar();
	while (c < '0' || c>'9')c = getchar();
	while (c >= '0' && c <= '9')num = num * 10 + c - '0', c = getchar();
	return num;
}
int main()
{
	n = read();
	m = read();
	for (int i = 1; i <= n; i++)
		for (int j = 1; j <= m; j++)
			l[i][j] = read();
	is[0] = 1;
	res = n;
	for (int i = 1; i <= m; i++)
	{
		for (int j = 1; j <= n; j++)
			while (is[l[j][pos[j]]])pos[j]++;
		memset(tot, 0, sizeof tot);
		for (int j = 1; j <= n; j++)
			tot[l[j][pos[j]]]++;
		int rres = 0;
		for (int j = 1; j <= m; j++)
			if (tot[j] > tot[rres])rres = j;
		res = min(res, tot[rres]);
		is[rres] = 1;
	}
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <cstring>

using namespace std;
// ascending order
#define vsort(v) sort(v.begin(), v.end())
// descending order
#define vsort_r(v) sort(v.begin(), v.end(), greater<int>())
#define vunique(v) v.erase(unique(v.begin(), v.end()), v.end())
#define mp make_pair
#define ts(x) to_string(x)
#define rep(i, a, b) for(int i = (int)a; i < (int)b; i++)
#define repm(i, a, b) for(int i = (int)a; i > (int)b; i--)
#define bit(a) bitset<8>(a)
#define des_priority_queue priority_queue<int, vector<int>, greater<int> >
typedef long long ll;
typedef pair<int, int> P;
const ll INF = 1e18;

#define MAX_V 1000000

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

  int N;
  cin >> N;
  map<string, vector<int> > vm;
  map<pair<string, int>, int> mp;
  rep(i, 0, N) {
      string s;
      int p;
      cin >> s >> p;
      vm[s].push_back(p);
      pair<string, int> pa(s, p);
      mp[pa] = i + 1;
  }

  for(auto itr = vm.begin(); itr != vm.end(); ++itr) {
      vsort_r(itr->second);
      vm[itr->first] = itr->second;
      for(auto vItr = itr->second.begin(); vItr != itr->second.end(); ++vItr) {
          pair<string, int> pa(itr->first, *vItr);
          cout << mp[pa] << endl;
      }
  }

}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
    public static void main (String [] args){
        Scanner sc =new Scanner(System.in);
        int i=1;
        while(true){
        int a =sc.nextInt();
        if(a==0)break;
        System.out.println("Case "+i+": "+a);
        i++;
    }
        sc.close();
   }
 
}


Measured memory_bytes: 41620
#include<bits/stdc++.h>
#define int long long
#define fi first
#define se second
#define vll vector<int>
#define pii pair<int,int>
#define pb push_back
#define sz(v) (int)(v).size()
#define inf 2e18
#define md 1000000007
#define all(v) (v).begin(),(v).end()
#define rep(i,a,b) for(int i=a;i<b;++i)
using namespace std;

#define M 100010


int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
   	
   	int a,b,c,d;cin>>a>>b>>c>>d;
   	int ans=-inf;
   	ans=max(ans,a*c);
   	ans=max(ans,a*d);
   	ans=max(ans,b*c);
   	ans=max(ans,b*d);
   	cout<<ans;
    return 0;
}

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

int main()
{
    int N;
    cin >> N;

    vector<int> p(N);

    for(int i = 0; i < N; i++)
    {
        cin >> p.at(i);
    }

    int count = 0;

    for(int i = 1; i < N-1; i++)
    {
        if((p.at(i) < p.at(i+1) && p.at(i-1) < p.at(i)) || (p.at(i) > p.at(i+1) && p.at(i-1) > p.at(i)))
        {
            count++;
        }
    }

    cout << count << endl;

    return 0;

}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <deque>
#include <queue>//for queue and priority_queue
#include <fstream>
#include <iomanip>
#include <stack>
#include <algorithm>
#define endl "\n"

using namespace std;
void Lancer() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); }

//int  frq[100007];
int main(){
	Lancer();
	//cout << fixed << setprecision(12);
	
	double n, m, sum = 0,r;
	cin >> n >> m;
	vector<int>vec(n);
	for (int i = 0; i < n; i++){
		cin >> vec[i];
		sum += vec[i];
	}
	r = (1.0 / (4.0*m))*sum;
	for (int i = 0; i < n; i++){
		if (vec[i] >= r)
			m--;
		if (!m)
			break;
	}

	cout <<( m > 0 ? "No" : "Yes");
	cout << endl;
	return 0;
}


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

int main()
{
    int a,b,c,d;
    while(~scanf("%d%d%d%d",&a,&b,&c,&d))
    {
        if(a*b>c*d)
            printf("%d\n",a*b);
        else
            printf("%d\n",c*d);
    }
    return 0;
}


Measured memory_bytes: 128
fun main() {
    val s = next()
    println("$s${if (s.last() == 's') "es" else "s"}")
}
// # Utils
// ## Input
fun next() = readLine()!!
fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun nextDouble() = next().toDouble()
fun nextList() = next().split(" ")
fun nextIntList() = next().split(" ").map(String::toInt)
fun nextLongList() = next().split(" ").map(String::toLong)
fun nextDoubleList() = next().split(" ").map(String::toDouble)
// ## Array
inline fun <reified T> sizedArray(size: Int, default: T) = Array(size) { default }
inline fun <reified T> sized2DArray(row: Int, column: Int, default: T) = Array(row) { Array(column) { default } }
// ## mod^-1
//    [NOTE] CANNOT use this for 0, mod, 2mod, 3mod ...(return wrong value)
fun modinv(num: Long, mod: Long): Long {
    var a = num
    var b = mod
    var u = 1L
    var v = 0L
    while (b > 0) {
        val t = a.div(b)
        a -= t * b
        a = b.also { b = a } // swap a and b
        u -= t * v
        u = v.also { v = u } // swap u and v
    }
    u %= mod
    if (u < 0) u += mod
    return u
}

fun gcd(x: Int, y: Int): Int {
    fun innerGcd(x: Int, y: Int): Int {
        return if (x % y == 0) y else innerGcd(y, x % y)
    }
    return if (x >= y) innerGcd(x, y) else innerGcd(y, x)
}

fun gcd(x: Long, y: Long): Long {
    fun innerGcd(x: Long, y: Long): Long {
        return if (x % y == 0L) y else innerGcd(y, x % y)
    }
    return if (x >= y) innerGcd(x, y) else innerGcd(y, x)
}

// classes
class UnionFindTree(val size: Int) {
    private val r = sizedArray(size, -1)
    fun root(x: Int): Int {
        if (r[x] < 0) return x
        return root(r[x])
    }

    fun unite(x: Int, y: Int) {
        var rx = root(x)
        var ry = root(y)
        if (rx == ry) return
        if (r[rx] > r[ry]) {
            rx = ry.also { ry = rx }
        }
        r[rx] += r[ry]
        r[ry] = rx
    }

    fun size(x: Int) = -r[root(x)]

    override fun toString(): String {
        return r.joinToString(separator = ", ")
    }
}

Measured memory_bytes: 37180
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int a[] = new int[n];
		double sum = 0;
		for(int i = 0; i < n; i++){
			a[i] = sc.nextInt();
		}
		Arrays.sort(a);
		double avg = (double)a[0];
		for(int i = 1; i < n; i++){
			avg = (double)(avg + a[i]) / 2.0;
		}
		System.out.println(avg);
	}


}


Measured memory_bytes: 21588
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;

int main(){
	int A,B;
	int ans;
	cin >> A >> B;
	ans = A - 2*B;
	if(ans <= 0){
		ans = 0;
	}
	cout << ans <<endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <math.h>
#include <assert.h>
#include <vector>
#include <queue>
#include <string>
#include <map>
#include <set>

using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
static const double EPS = 1e-9;
static const double PI = acos(-1.0);

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, n) for (int i = (s); i < (int)(n); i++)
#define FOREQ(i, s, n) for (int i = (s); i <= (int)(n); i++)
#define FORIT(it, c) for (__typeof((c).begin())it = (c).begin(); it != (c).end(); it++)
#define MEMSET(v, h) memset((v), h, sizeof(v))

int n;
int in[1000];
int prev[1000];
int total[1000];

int main() {
  while (scanf("%d", &n), n) {
    MEMSET(in, 0);
    MEMSET(prev, 0);
    MEMSET(total, 0);
    int prevDay = 0;
    REP(iter, n) {
      int mon, day, h, m, id;
      char io;
      scanf("%d/%d %d:%d %c %d", &mon, &day, &h, &m, &io, &id);
      day = mon * 40 + day;
      if (prevDay != day) { MEMSET(in, 0); }
      prevDay = day;
      m += 60 * h;
      if (io == 'I') {
        in[id] = 1;
        prev[id] = m;
      } else {
        in[id] = 0;
        if (id == 0) {
          FOR(i, 1, 1000) {
            if (in[i] == 0) { continue; }
            total[i] += m - max(prev[i], prev[0]);
          }
        } else {
          if (in[0] == 0) { continue; }
          total[id] += m - max(prev[id], prev[0]);
        }
      }
    }
    int mans = 0;
    REP(i, 1000) { mans = max(mans, total[i]); }
    int ans = 0;
    REP(i, 1000) { if (mans == total[i]) { ans += total[i]; } }
    cout << ans << endl;
  }
}

Measured memory_bytes: 0
#include<iostream>
#include <math.h>
using namespace std;
const long long P = pow(10, 9) + 7;
long long powmod(long long  x, long long  k);
int64_t comb(int64_t n, int64_t k) {
	int64_t x = 1;
	for (int i = n - k + 1; i <= n; i++) {
		x = x * i % P;
	}
	int64_t y = 1;
	for (int i = 1; i <= k; i++) {
		y = y * i % P;
	}
	//cout << "Y:"<<y << endl;
	y = powmod(y, P - 2);
	return x * y % P;
}

long long powmod(long long p, long long n) {
	long long ret = 1;
	while (n != 0) {
		if ((n & 1) == 1) {
			ret *= p;
            ret %= P;
			n--;
		}
		p *= p;
		p %= P;
		n /=2;
	}
	return ret;
}
int main() {
	long n, a, b;
	cin >> n >> a >> b;

	int all = powmod(2, n) - 1;
	int muri = comb(n, a) + comb(n, b);
	int ans = all - muri;
	while (ans < 0) {
		ans += P;
	}
	cout << ans;
	return 0;
}

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

using namespace std;

#define YES cout << "YES" << endl;
#define NO  cout << "NO"  << endl;
#define Yes cout << "Yes" << endl;
#define No  cout << "No"  << endl;
 
#define INF INT_MAX
#define MOD 1000000007
#define PI  acos(-1)

using ll  = long long;
using ull = unsigned long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define rrep(i, n) for (ll i = (n)-1; i >= 0; i--)

int main(int argc, char *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    string S;
    cin >> S;

    string s = "CODEFESTIVAL2016";
    ll ans = 0;
    rep (i, S.size()) {
        if (S[i] != s[i]) {
            ans++;
        }
    }

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

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


int main(){
    int a,b,c,x;
    cin >> a >> b >> c >> x;

    int count = 0;
    for(int i=0;i<=a;i++){
        for(int j=0;j<=b;j++){
            for(int k=0;k<=c;k++){
                if(x == i * 500 + j * 100 + k * 50) count++;
            }
        }
    }

    cout << count << endl;

    return 0;
}

Measured memory_bytes: 256