akhauriyash/Code-Regression huggingface dataset:
#define ll     long long int
#define db     double
#define   pb      push_back
#include<bits/stdc++.h>
using namespace std ;
int main()
{
      //ll q;cin>>q;while(q--)
      ll a,b,c,d=0,n,i,j;
      cin>>n;
    vector<string >s(n);
     string s1;
     set<string>t;
     for(i=0;i<n;i++)
         {
             cin>>s[i];
         }
      for(i=0;i<n;i++)
      {
          t.insert(s[i]);
      }
      a=t.size();
      cout<<a<<endl;



}



Measured memory_bytes: 25092
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        Set<Integer> set = new HashSet<>();
        for (int i = 0; i < n; i++) {
            if(!set.add(scanner.nextInt())){
                System.out.println("NO");
                return;
            };
        }
        System.out.println("YES");
    }
}

Measured memory_bytes: 99004
#include<stdio.h>
#include<string.h>
int main()
{
	char s[100];
	int max, i, count, l;
	while(~scanf("%s", s))
	{
		max = 0;
		for(l=strlen(s), i=0; i<l; i++)
		{
			count = 0;
			while((s[i]=='A'|| s[i]=='C' || s[i]=='G' || s[i] == 'T')&& i<l)
			{
				count++;
				i++;
			}
			if(count>max)
				max = count;
		}
		printf("%d\n", max);
	}
	return 0;
}

Measured memory_bytes: 504
#define _USE_MATH_DEFINES   //M_PI                                                 
#include <iostream>           //std::cout, std::cin                                
#include <cmath>          //abs, pow, sqrt, sin, cos,                              
#include <iomanip>            //std::setprecision                                  
                                                                                   
using namespace std;                                                               
                                                                                   
int main(void) {                                                                   
                                                                                   
  int a, b, C;                                                                     
  cin >> a >> b >> C;                                                              
                                                                                   
  double S = a*b*sin(C*M_PI/180.0)/2.0;                                            
  double L = a+b+sqrt(pow(a,2)+pow(b,2)-(2*a*b*cos(C*M_PI/180.0)));                
  double H = b*sin(C*M_PI/180.0);                                                  
                                                                                   
  cout << fixed << setprecision(6) << S << endl;                                   
  cout << fixed << setprecision(6) << L << endl;                                   
  cout << fixed << setprecision(6) << H << endl;                                   
                                                                                   
}                                                                                  
                                       

Measured memory_bytes: 3472
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define eps LDBL_EPSILON
#define moder 1000000007
#define int long long
#define ll long long
#define INF LLONG_MAX/3
#define P std::pair<int,int>
#define prique priority_queue<int,vector<int>,greater<int>>
using namespace std;
int n,k,h[100010];
signed main(){
	cin>>n>>k;
	rep(i,n)cin>>h[i];
	sort(h,h+n);
	int ans=INF;
	rep(i,n-k+1){
		ans=min(ans,h[i+k-1]-h[i]);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1024
import queue

ans = 0

N = int(input())
A = list(map(int, input().split()))
A.sort(reverse=True)
q = queue.Queue()
q.put(0)
for a in range(len(A)):
    ans += q.get()
    q.put(A[a])
    if a != 0:
        q.put(A[a])

print(ans)


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

int main() {
	int H=0,W=0;
	while(1)
	{
		cin>>H>>W;
		if(H==0 && W==0)break;
		for(int i=1;i<=W;i++)cout<<"#";
		cout<<endl;
		for(int j=1;j<=(H-2);j++)
		{
			cout<<"#";
			for(int k=1;k<=(W-2);k++)cout<<".";
			cout<<"#"<<endl;
		}
		for(int i=1;i<=W;i++)cout<<"#";
		cout<<endl<<endl;
	}
	return 0;
}


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

int main(){
    int n;
    scanf("%d", &n);
    std::vector<int> s(n);
    for(int &x : s){
        scanf("%d", &x);
    }
    std::vector<int> dp(n, INT_MAX);
    dp[0] = 0;
    for(int i=0; i<n; ++i){
        for(int j : {i+1, i+2}){
            if(j < n){
                dp[j] = std::min(dp[j], dp[i] + std::abs(s[i] - s[j]));
            }
        }
    }
    printf("%d\n", dp[n-1]);
    return 0;
}


Measured memory_bytes: 1024
#include <cstdio>
#include <iostream>
#include <cstring>
#include <vector>
#include <map>
#include <cmath>
#include <string>
#include <cstdlib>
#include <set>
#include <algorithm>
#include <ctime>
using namespace std;


#define P 998244353

long long n, a, b, k;
int mi[310000], inv[310000];

int Pow(int x, int y) {
    int ans = 1;
    for (int i = 1; i <= y; i *= 2, x = 1LL * x * x % P)
        if (i & y)
            ans = 1LL * ans * x % P;
    return ans;
}

int C(int a, int b) {
	return 1LL * mi[a] * inv[b] % P * inv[a - b] % P;
}

int main() {
	int ans = 0;
	cin >> n >> a >> b >> k;
	mi[0] = 1;
	for (int i = 1; i <= n; i++)
		mi[i] = 1LL * mi[i - 1] * i % P;
	inv[n] = Pow(mi[n], P - 2);
	for (int i = n - 1; i >= 0; i--)
		inv[i] = 1LL * inv[i + 1] * (i + 1) % P;
	for (int i = 0; i <= n; i++) {
		long long q = k - i * a;
		if (0 <= q && q <= n * b && q % b == 0) {
			ans = (ans + 1LL * C(n, i) * C(n, q / b)) % P;
		}
	}
	printf("%d\n", ans % P);
}


Measured memory_bytes: 2560
#include <iostream>
#include <map>
#include <vector>
#include <algorithm>
#include <set>
using namespace std;
	typedef long long int lli;
	const int MaxN=200005;
	#define fst first
	#define snd second
	int mcd(int a,int b){	
		if(a==0)return b;
		return mcd(b%a,a);
	}	
	float arr[MaxN];
int main(){
	lli N,K,i,j,p;
	float tot=0,q=0;
	cin>>N>>K;
	for(i=0;i<N;i++){
		cin>>arr[i];
		tot+=arr[i];
	}
	float limit;
	limit=tot/(4*K);
	for(i=0;i<N;i++){
		if(arr[i]>=limit){
			q+=1;
		}
	}
	if(q>=K)cout<<"Yes";
	else cout<<"No";
	
}

Measured memory_bytes: 256
/*1 insert(T, z)
2     y = NIL // x の親
3     x = 'T の根'
4     while x ≠ NIL
5         y = x // 親を設定
6         if z.key < x.key
7             x = x.left // 左の子へ移動
8         else
9             x = x.right // 右の子へ移動
10    z.p = y
11
12    if y == NIL // T が空の場合
13        'T の根' = z
14    else if z.key < y.key
15        y.left = z // z を y の左の子にする
16    else
17        y.right = z // z を y の右の子にする*/

#include<stdio.h>
#include<stdlib.h>

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL

Node root;

Node treeMinimum(Node x){
  while(x->left != NIL){
    x = x->left;
  }
  return x;
}

Node treeMaximum(Node x){
  while(x->right != NIL){
    x = x->right;
  }
  return x;
}

Node treeSearch(Node u, int k){
  while(u != NIL && k != u->key){
    if(k < u->key) u = u->left;
    else u = u->right;
  }
  return u;
}

Node treeSuccessor(Node x){
  if(x->right != NIL) return treeMinimum(x->right);
  Node y;
  y = x->parent;
  while(y !=NIL && x == y->right){
    x = y;
    y = y->parent;
  }
  return y;
}

void treeDelete(Node z){
  Node y; // node to be deleted
  Node x; // child of y

  if(z->left == NIL || z->right == NIL) y = z;
  else y = treeSuccessor(z);

  if(y->left != NIL) x = y->left;
  else x = y->right;

  if(x != NIL) x->parent = y->parent;

  if(y->parent == NIL) root = x;
  else if(y == y->parent->left) y->parent->left = x;
  else y->parent->right = x;

  if(y != z) z->key = y->key;
}

void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

  while(x != NIL){
    y = x;
    if(z->key < x->key) x = x->left;
    else x = x->right;
  }
  z->parent = y;

  if(y == NIL) root = z;
  else if(z->key < y->key) y->left = z;
  else y->right = z;
}

void inorder(Node u){
  if(u != NIL){
    inorder(u->left);
    printf(" %d", u->key);
    inorder(u->right);
  }
  else return;
}

void preorder(Node u){
  if(u != NIL){
    printf(" %d", u->key);
    preorder(u->left);
    preorder(u->right);
  }
  else return;
}


int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'f' ){
      scanf("%d", &x);
      Node t = treeSearch(root, x);
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");
    } else if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    } else if ( com[0] == 'd' ){
      scanf("%d", &x);
      treeDelete(treeSearch(root, x));
    }
  }

  return 0;
}



Measured memory_bytes: 20532
#ABC066A
a,b,c = map(int,input().split())
if (a == b)&(b == c):
    print(a + b)
elif(a > b)&(a > c):
    print(b + c)
elif (b > a)&(b > c):
    print(a + c)
elif (c > a)&(c > b):
    print(a + b)

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

int main(){
  string s,t;cin >> s >> t;
  int a,b;cin >> a >> b;
  string u;cin >> u;
  if(u == s){
    a -= 1;
  } else if(t == u){
    b -= 1;
  }
  cout << a << " " << b << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		int K = scan.nextInt();
		scan.close();
		if(K % 2 == 0) {
			long cnt1 = 0;
			long cnt2 = 0;
			for(int i = 1; i <= N; i++) {
				if(i % K == 0) {
					cnt1 ++;
				}
				if(i % K == K / 2) {
					cnt2 ++;
				}

			}
			long ans = cnt1 * cnt1 * cnt1 + cnt2 * cnt2 * cnt2;
			System.out.println(ans);
		}else {
			long cnt1 = 0;
			for(int i = 1; i <= N; i++) {
				if(i % K == 0) {
					cnt1 ++;
				}
			}
			long ans = cnt1 * cnt1 * cnt1;
			System.out.println(ans);
		}

	}
}

Measured memory_bytes: 23252
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
 
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy
 
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);    
	
    ll H, W; cin >> H >> W;

    if (H > W) swap(H, W);

    if (H == 1) {
        cout << 1 << endl; return 0;
    }

    cout << (H*W+1)/2 << endl;
	
	return 0;
}
 
// read the question correctly (ll vs int)
// template by bqi343



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

bool g[10][10];
bool color[10];
int n, m;

int dfs(int x) {
    bool judge = true;
    for (int i = 1; i <= n; i++) {
        if (!color[i]) judge = false;
    }
    if (judge) {
        return 1;
    }

    int res = 0;
    for (int i = 1; i <= n; i++) {
        if (g[x][i] && !color[i]) {
            color[i] = true;
            res += dfs(i);
            color[i] = false;
        }
    }
    return res;
}

int main() {
    cin >> n >> m;

    fill(color, color + n + 1, false);

    for (int i = 0; i < m; i++) {
        int a, b;
        cin >> a >> b;
        g[a][b] = g[b][a] = true;
    }

    color[1] = true;
    cout << dfs(1) << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;

struct Info{
	int row,col;
};

Info** info;
int** dp;
int W,H;

int calc(int row1,int col1,int row2,int col2){
	return abs(row1-row2)+abs(col1-col2);
}

void func(){

	char buf[5];

	int max_num = 0,table[2501],start_row,start_col,goal_row,goal_col;
	int num;

	table[0] = 1;
	for(int i = 1; i < 2501; i++)table[i] = 0;


	for(int row = 0; row < H; row++){
		for(int col = 0; col < W; col++){
			scanf("%s",buf);
			switch(buf[0]){
			case '.':
				//Do nothing
				break;
			case 'S':
				start_row = row;
				start_col = col;
				break;
			case 'G':
				goal_row = row;
				goal_col = col;
				break;
			default:
				num = 0;
				for(int i = 0; buf[i] != '\0'; i++){
					num = 10*num + buf[i] - '0';
				}
				info[num][table[num]].row = row;
				info[num][table[num]].col = col;
				table[num]++;

				max_num = max(max_num,num);
				break;
			}
		}
	}

	info[0][0].row = start_row;
	info[0][0].col = start_col;

	max_num++;
	info[max_num][0].row = goal_row;
	info[max_num][0].col = goal_col;
	table[max_num] = 1;

	dp[0][0] = 0;

	for(int i = 1; i <= max_num; i++){
		for(int k = 0; k < table[i]; k++)dp[i][k] = BIG_NUM;
	}

	for(int from = 0; from <= max_num-1; from++){
		int to = from+1;
		for(int a = 0; a < table[from]; a++){
			for(int b = 0; b < table[to]; b++){
				dp[to][b] = min(dp[to][b],dp[from][a]+calc(info[from][a].row,info[from][a].col,info[to][b].row,info[to][b].col));
			}
		}
	}

	printf("%d\n",dp[max_num][0]);
}


int main(){

	info = (Info**)malloc(sizeof(Info*)*2501);
	dp = new int*[2501];

	for(int i = 0; i <= 2500; i++){
		info[i] = (Info*)malloc(sizeof(Info)*2501);
		dp[i] = new int[2501];
	}

	while(true){
		scanf("%d %d",&W,&H);
		if(W == 0 && H == 0)break;

		func();
	}
	return 0;
}

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

int main(){
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  rep(i,n) cin >> a[i];

  vector<int> dp(k+2, 0);

  dp[0] = 1;

  for (int i = 0; i < n; i++) {
    vector<int> cum(k+2,0);
    for (int j = 0; j < k+1; j++) (cum[j + 1] = cum[j] + dp[j]) %= mod;
    for (int j = 0; j < k+1; j++) {
      dp[j] = (cum[j + 1] - cum[max(0, j - a[i])] + mod) % mod;
    }
  }
  cout << dp[k] << endl;
  return 0;
} 

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
template <class T>
bool chmax(T& a, const T& b)
{
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T& a, const T& b)
{
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}

#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define all(x) (x).begin(), (x).end() //sortなどの引数を省略したい
#define F first
//#define S second

typedef long long ll;
const ll MOD = 1e9 + 7;
const int inf = 1000000;
const int minf = -1000000;
const ll lnf = 1e12;
const ll mlnf = -1e12;
const double e = 1e-10;

void debug_vector(vector<int>& v)
{
    int n = v.size();
    for (int i = 0; i < n; i++) {
        cout << v[i] << " ";
    }
    cout << endl;
}


//////////////////////
//// coding start ////
//////////////////////

// global variet


long long cal(long long a, long long b);
long long second_condition(int locate);

void solve();

int N;
string S;
int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    solve();
    return 0;
}

long long cal(long long a, long long b){
    return a * (a - 1) * b / 2;
}


long long second_condition(int locate){
    int limit = min(locate, N-1 - locate);
    long long res = 0;
    for (int i = 1; i <= limit; i++){
        set<char> tmp;
        tmp.insert(S[locate]);
        tmp.insert(S[locate + i]);
        tmp.insert(S[locate - i]);
        if (tmp.size() == 3) res++;
    }
    return res;
}

void solve(){
    cin >> N;
    cin >> S;
    long long ans = N * (N-1) * (N-2) / 6;
    long long r, g, b;
    r = 0;
    g = 0;
    b = 0;
    for (int i = 0; i < N; i++){
        if (S[i] == 'R'){
            r++;
        }else if(S[i] == 'G'){
            g++;
        }else{
            b++;
        }
    }
    long long llans = r * g * b;
    for (int i = 1; i < N - 1; i++){
        ans -= second_condition(i);
        llans -= second_condition(i);
    }

    ans -= cal(r, g);
    ans -= cal(g, r);
    ans -= cal(g, b);
    ans -= cal(b, g);
    ans -= cal(r, b);
    ans -= cal(b, r);
    ans -= r * (r-1) * (r-2) / 6;
    ans -= g * (g-1) * (g-2) / 6;
    ans -= b * (b-1) * (b-2) / 6;
    // printf("%lld\n", ans);
    printf("%lld\n", llans);
}



Measured memory_bytes: 3716
import java.util.Scanner

import scala.annotation.tailrec

object Main {
  def main(args: Array[String]) = {
    val sc = new Scanner(System.in)
    val N, M = sc.nextInt()
    val l = List.fill(M, 2)(sc.nextInt)

    val List(left, right) = l.transpose
    val r = right.min - left.max + 1

    println(if(r < 0) 0 else r)
  }
}

Measured memory_bytes: 82488
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <map>
#include <iomanip>
using namespace std;


int mathC(int a,int b){

  int i,ans=1;
  if(b>a/2) b=a-b;
  for(i=1;i<=b;i++){
    ans*=(a-i+1);
    ans/=i;
  }
  
  return ans;
}

void solve(void){

int K,N;
cin >> K >> N;
  
  int i;
  int A[N];
  for(i=0;i<N;i++){
  cin >> A[i];
  }
  
  int B[N],Bsum=0,Bgap=0;
  for(i=0;i<N;i++){
    if(i==N-1) B[N-1]=min(abs(A[N-1]-A[0]),K-abs(A[N-1]-A[0]));
  else B[i]=min(abs(A[i]-A[i+1]),K-abs(A[i]-A[i+1]));
    if(B[i]>=Bgap) Bgap=B[i];
    Bsum+=B[i];
  }
cout << Bsum-Bgap <<endl;
  
  return;
  
}

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

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

using i64 = int64_t;

int main(){
    int h, w;
    cin >> h >> w;
    vector<vector<i64>> c(10, vector<i64>(10));
    for(int i=0;i<10;++i){
        for(int j=0;j<10;++j){
            cin >> c[i][j];
        }
    }

    for(int k=0;k<10;++k){
        for(int i=0;i<10;++i){
            for(int j=0;j<10;++j){
                c[i][j] = min(c[i][j], c[i][k] + c[k][j]);
            }
        }
    }

    i64 ans = 0;
    for(int i=0;i<h;++i){
        for(int j=0;j<w;++j){
            int a;
            cin >> a;
            if(a == -1)continue;
            ans += c[a][1];
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>                                                                                                                                                                                          
                                                                                                                                                                                                            
int main(void){                                                                                                                                                                                             
  int a, g, b;                                                                                                                                                                                              
  scanf("%d%d%d", &a, &g, &b);                                                                                                                                                                              
  if((10*g+b)%4 == 0){                                                                                                                                                                                      
    printf("YES\n");                                                                                                                                                                                        
  }else{                                                                                                                                                                                                    
    printf("NO\n");                                                                                                                                                                                         
  }                                                                                                                                                                                                         
  return 0;                                                                                                                                                                                                 
}                                                                                                                                                                                                           
         

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

int main() {
    long long S;
    scanf("%lld", &S);
    long long d = 1000000000LL;
    // x1 * y2 - x2 * y1
    long long x1, y1, x2, y2;
    if (S % d == 0LL) {
        x1 = d;
        y2 = S / d;
        x2 = y1 = 0LL;
    } else {
        x1 = S / d + 1LL;
        y2 = d;
        x2 = 1LL;
        y1 = x1 * y2 - S;
    }
    printf("0 0 %lld %lld %lld %lld", x1, y1, x2, y2);
    return 0;
}


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

using namespace std;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  int a, b, c, d;
  cin >> a >> b >> c >> d;
  if (abs(a - c) <= d || (abs(a - b) <= d && abs(b - c) <= d)) {
    cout << "Yes\n";
  } else {
    cout << "No\n";
  }
}


Measured memory_bytes: 256
// #pragma GCC optimize("Ofast")
// #pragma GCC optimize ("unroll-loops")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define ll long long int
#define lu unsigned long long int
#define pi pair<ll, ll>
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define mk make_pair
#define ve vector
#define lr(n) for (ll i = 0; i < n; i++)
#define all(x) x.begin(), x.end()
#define be begin
#define sz(a) (ll)(a.size())
#define INF 1e18
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
// order_of_key(val): returns the number of values less than val
// find_by_order(k): returns an iterator to the kth largest element (0-based)

ll gcd(ll a, ll b){
	return b == 0 ? a : gcd(b, a % b);
}

// ll mod = 1e9+7;

// ll mult(ll x, ll y){
//     ll rem=1;
//     while(y){
//         if(y&1){
//             rem=(rem*x)%mod;
//         }
//         x=(x*x)%mod;
//         y>>=1;
//     }
//     return rem;
// }


void solve(ll T){
	ll n;
	cin>>n;
	ll cnt=0;
	for(ll i=1,x;i<=n;i++){
		cin>>x;
		if(i%2==1 && x%2==1)cnt++;
	}
	cout << cnt << "\n";
}

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	// std::cout << std::unitbuf;
	ll T=1;
	// cin>>T;
	for(ll t=1;t<=T;t++){
		solve(t);
	}
	return 0;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
#define rep(i,n,m) for(int i = (n); i <(m); i++)
#define rrep(i,n,m) for(int i = (n) - 1; i >=(m); i--)
#define pvec(vec) {for (auto v: vec) cout << v << ' '; cout << endl;}
#define pivec(vec) {rep(i, 0, vec.size()) cout << i << ':' << vec[i] << ' '; cout << endl;}

using namespace std;
using ll = long long;


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

    vector<int> A(N), B(N);
    rep(i, 0, N)
        cin >> A[i] >> B[i];

    sort(A.begin(), A.end());
    sort(B.begin(), B.end());
    
    ll ans = 0;
    if (N&1)
    {
        // odd
        int tgt = N/2;
        ans = B[N-1-tgt] - A[tgt]+1;
    }
    else
    {
        // even
        pair<int, int> left, right;
        left.first = A[(N-1)/2];
        left.second = B[(N-1)/2];
        right.first = A[(N-1)/2+1];
        right.second = B[(N-1)/2+1];

        ll l = left.first + right.first;
        ll r = left.second + right.second;

        ans = (r-l+1);
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef vector<ll> vint;
typedef vector<string> vstr;
typedef pair<ll, ll> pint;
unsigned long long inf = (1LL << 62);
ll mod = 1000000007;

//bool operator< (pint a, pint b) {
	//return a.second < b.second;

//}



ll gcd(ll a, ll b) {

	if (b == 0)
		return a;

	return gcd(b, a % b);


}

ll max(ll a, ll b) {
	if (a < b) {
		return b;
	}
	else
		return a;

}

ll min(ll a, ll b) {
	if (a < b)
		return a;

	return b;
}




pint dx[4] = { {1, 0}, {-1, 0}, {0, 1}, {0, -1} };

vector<pint> list;










void floyd(int N, ll** d) {

	rep(k, N+1){
		rep(i, N+1) {
			if (d[i+1][k+1] == inf) continue;
			rep(j, N+1) {
				if (d[j+1][k+1] == inf) continue;

				d[i+1][j+1] = min(d[i+1][j+1], d[i+1][k+1] + d[j+1][k+1]);

			}

		}
	}




}


ll d[100005];
vector<ll> M[100005];
vector<ll> anslist;


stack<int> to_1;







string S;
int main() {
	ll N, T;

	cin >> S;
	ll numg = 0, nump = 0;
	rep(i, S.size()) {
		if (S[i] == 'g')
			numg += 1;

		else
			nump += 1;

	}


	ll ans = (S.size() / 2) - nump;


	cout << ans << endl;

	return 0;
}

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

using namespace std;

typedef long long ll;

int main() {
    ll n, a, *x;
    cin >> n >> a;
    x = new ll[n];
    for (ll i = 0; i < n; i++)
        cin >> x[i];

    sort(x, x+n);

    ll ***dp = new ll **[n+1]; //dp[j][k][s]はj番目まででk枚使ってs点を達成できる組み合わせ数
    for (ll j = 0; j <= n; j++) {
        dp[j] = new ll *[n+1];
        for (ll k = 0; k <= n; k++) {
            dp[j][k] = new ll[n*a+1];
            for (ll s = 0; s <= n*a; s++)
                dp[j][k][s] = 0;
        }
    }

    for (ll k = 0; k <= n; k++) {
        for (ll s = 0; s <= a*n; s++) {
            dp[0][k][s] = 0;
        }
    }

    for (ll j = 0; j <= n; j++)
        dp[j][0][0] = 1;

    for (ll j = 0; j < n; j++) {
        for (ll k = 1; k <= n; k++) {
            for (ll s = 1; s <= n*a; s++) {
                if (s >= x[j]) 
                    dp[j+1][k][s] = dp[j][k-1][s-x[j]] + dp[j][k][s];
                else 
                    dp[j+1][k][s] = dp[j][k][s];
            } 
        }
    } 

    ll ans = 0;
    for (ll k = 1; k <= n; k++) {
        ans += dp[n][k][k*a];
    }

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

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

#define   REP(i, n) for(int i = 0;            i <  (int)(n); i++)
#define  CREP(i, n) for(int i = 1;            i <= (int)(n); i++)
#define  RREP(i, n) for(int i = (int)(n) - 1; i >= 0;        i++)
#define RCREP(i, n) for(int i = (int)(n);     i >  0;        i++)

#define N_MAX 10

using ll = long long;


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

    int N;
    double x[N_MAX];
    std::string u[N_MAX];

    std::cin >> N;
    REP(i, N) {
        std::cin >> x[i] >> u[i];
    }

    double ans = 0;
    REP(i, N) {
        if(u[i] == "JPY") {
            ans += x[i];
        }
        else {
            ans += 380000.0 * x[i];
        }
    }

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


Measured memory_bytes: 256
// SeeAlso: 

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

#define MAX 100000
#define NIL -1
#define MOD 1000000007

typedef int _loop_int;
#define rep(i,n) for(int i = 0; i < n; i++)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define debug(x) cout<<#x<<": "<<x<<endl
#define debig_vec(v) cout<<#v<<":";rep(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

// 最大公約数
inline constexpr ll gcd(ll a,ll b){if(!a||!b)return 0;while(b){ll c=b;b=a%b;a=c;}return a;}
// 最小公倍数
inline constexpr ll lcm(ll a,ll b){if(!a||!b)return 0;return a*b/gcd(a,b);}

#define print2D(h, w, arr) rep(i, h) { rep(j, w) cout << arr[i][j] << " "; cout << endl; }
template<class T> inline void print(const T& x){cout << setprecision(12) << x << endl;}
template<class T, class... A> inline void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }
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; }


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

    ll w[N], v[N];
    rep(i, N) {
        cin >> w[i] >> v[i];
    }

    ll dp[N+1][100100];
    rep(i,N+1) {
        rep(j,100100) {
            dp[i][j] = 1LL<<60;
        }
    }
    dp[0][0] = 0;

    rep(i, N) {
        rep(j, 100100) {
            if(j-v[i]>=0) chmin(dp[i+1][j], dp[i][j-v[i]]+w[i]);
            chmin(dp[i+1][j], dp[i][j]);
        }
    }
    ll ans = 0;
    for(ll i=0;i<100100;i++) {
        if(dp[N][i]<=W) {
            chmax(ans, i);
        }
    }
    print(ans);
    return 0;
}


Measured memory_bytes: 79232
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))


int main() {
  int n,m;
  scanf("%d %d\n",&n,&m);
  int max=1;
  for (int i = (m/n); i >=1; i--) {
    if(m%i==0){

      max=i;
      break;
    }
  }
  printf("%d\n",max );

}


Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var n int
	var m int
	var l int
	var r int

	fmt.Scan(&n)
	fmt.Scan(&m)

	min := 1
	max := n
	for i := 0; i < m; i++ {
		fmt.Scan(&l)
		fmt.Scan(&r)

		if min < l {
			min = l
		}
		if max > r {
			max = r
		}
	}

	if max >= min {
		fmt.Println(max - min + 1)
	} else {
		fmt.Println(0)
	}
}


Measured memory_bytes: 7556
import sys
input = sys.stdin.readline

class UnionFind():
    def __init__(self, n):
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

n, m = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(m)]

uf = UnionFind(n)

for ai, bi in ab:
    uf.union(ai-1, bi-1)

for i in range(n):
    p = uf.find(i)

print(-min(uf.parents))



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

using namespace std;
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;

struct Edge {
    int to, id;
};

int n;
vector<vector<Edge>> g;
vector<int> ans;

void dfs(int v, int c = -1, int pa = -1) {
    int k = 1;
    for (auto nv : g[v]) {
        if (nv.to == pa) continue;
        if (c == k) ++k;

        ans[nv.id] = k;
        dfs(nv.to, k, v);
        ++k;
    }
}

int main() {

    cin >> n;
    g.resize(n);
    ans.resize(n - 1);

    for (int i = 0; i < n - 1; ++i) {
        int a, b; cin >> a >> b;
        --a; --b;

        g[a].push_back(Edge({b, i}));
        g[b].push_back(Edge({a, i}));
    }

    //どの点から始めても良い
    dfs(0);

    int mx = 0;
    for (int i = 0; i < n - 1; ++i) {
        mx = max(mx, ans[i]);
    }

    cout << mx << endl;

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

Measured memory_bytes: 8320
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define all(a) (a).begin(), (a).end()
#define dunk(a) cout << (a) << endl
#define rall(a) (a).rbegin(), (a).rend()
const int INF = 2e9;
using namespace std;
using Graph = vector<vector<int>>;
typedef pair<int, int> P;
typedef long long ll;

int main()
{
    ll n, m;
    cin >> n >> m;

    ll ans;

    if (n >= 3 && m >= 3)
        ans = (n - 2) * (m - 2);
    else if (n == 2 || m == 2)
        ans = 0;
    else if (n == 1 || m == 1)
        ans = max(max(n - 2, m - 2), 1ll);

    cout << ans << endl;
}

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

using namespace std;

int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);

    string a0;
    int l;
    vector<int> data;
    int ai, ij;
    int j;

    while (cin >> a0 >> l,l) {

        data.clear();

        while (true) {

            while(a0.size() != l)
                a0 = "0" + a0;

            data.push_back(stoi(a0));

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

            string min = a0;
            string max = a0;
            reverse(max.begin(), max.end());

            int d = stoi(max) - stoi(min);

            auto itr = find(data.begin(), data.end(), d);
            j = distance(data.begin(), itr);

            if(j != data.size()) {
                ai = d;
                ij = data.size() - j;
                break;
            }

            a0 = to_string(d);

        }

        cout << j << " " << ai << " " << ij << endl;
    }

    return 0;

}

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

int main () {

	multiset <int> s;
	
	int n;
	cin >> n;
	
	for (int i = 0; i < n; ++i) {
		int x;
		scanf ("%d", &x);
		multiset <int> :: iterator it = s.lower_bound (x);
		if (it == s.begin())
			s.insert (x);
		else {
			--it;
			s.erase (it);
			s.insert (x);
		}
	}

	cout << s.size() << endl;

	return 0;
}

Measured memory_bytes: 4992
import java.io.IOException;
import java.io.InputStream;
import java.util.InputMismatchException;

public class Main {
	public static void main(String[] args) {
		new Main();
	}

	public Main() {
		FasterScanner sc = new FasterScanner(System.in);

		long n = sc.nextInt();
		long m =sc.nextInt();
		long sum = 0;
		long[] a = new long[(int)n];
		for (int i = 0; i < n; i++) {
			a[i] = sc.nextLong();
			sum += a[i];
		}
		long M = m;
		for (int i = 0; i < n; i++) {
			if (a[i]*4*M >= sum) {
				m--;
			}
		}
		if (m <= 0) {
			System.out.println("Yes");
		} else System.out.println("No");

		sc.close();
	}
	
	class FasterScanner {
		private InputStream mIs;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;

		public FasterScanner() {
			this(System.in);
		}

		public FasterScanner(InputStream is) {
			mIs = is;
		}

		public int read() {
			if (numChars == -1)
				throw new InputMismatchException();
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = mIs.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public String nextLine() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isEndOfLine(c));
			return res.toString();
		}

		public String nextString() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public long nextLong() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public int nextInt() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		public boolean isEndOfLine(int c) {
			return c == '\n' || c == '\r' || c == -1;
		}

		public void close() {
			try {
				mIs.close();
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
	}
}


Measured memory_bytes: 21460
n,x = map(int,input().split())
ls = [int(i) for i in input().split()]
points = [sum([ls[j] for j in range(i+1)]) for i in range(n)]
points.insert(0,0)
count = 0
for i in range(n+1):
    if points[i] <= x:
        count = count + 1

print(count)



Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N=1e5+5;
ll n,q,a[N],mp[N];
ll ans;
int main()
{
	cin>>n;
	for(int i=0;i<n;i++)cin>>a[i],mp[a[i]]+=a[i],ans+=a[i];
	cin>>q;
	while(q--)
	{
		int x,y;
		cin>>x>>y;
		mp[y]+=mp[x]/x*y;
		ans-=mp[x];
		ans+=mp[x]/x*y;
		mp[x]=0;
		cout<<ans<<"\n";
	}
	return 0;
}

Measured memory_bytes: 5124
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
const ll mod=1000000007;
const int MAX_N = 1000;         // n の最大値
 
// nCk を取得
double nCk(int n, int k) {
double res=1.0;
for(int i=0; i<n; i++){
res*=0.5;}
for(int i=0; i<k; i++){
res*=(double)(n-i);
res/=(double)(k-i);
}
return res;}
 
int main() {
int a;
cin>>a;
cout<<a+a*a+a*a*a<<endl;}

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

# f(a,b) = f(0,a-1) ^ f(0,b)

# 0からxまでのxorの計算
def calc_xor(x):
    if (x+1) % 2 == 0:
        if (x+1) // 2 % 2 == 0:
            return 0
        else:
            return 1
    else:
        if x // 2 % 2 == 0:
            return 0 ^ x
        else:
            return 1 ^ x

print(calc_xor(a-1) ^ calc_xor(b))


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

int main () {
  int A , B , C ,K ;
  
  cin >> A >> B >> C >> K ; 
  
  if ( A >= K  ){
    cout << K << endl ; 
    
  }
  
  else if(A+B >= K && A < K){
    cout << A << endl ; 
  }
  
  else if(A+B < K && A+B+C >= K  ){
    cout << A - (K-(A+B)) << endl ; 
  }

  return 0 ; 
  
}


Measured memory_bytes: 3576
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

using namespace std;
namespace mp = boost::multiprecision;
#define ll long long
#define cpp mp::cpp_int
#define dequeue deque
#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 srep(i, s, t) for (int i = s; i < t; i++)
#define vi vector<int>
#define P pair<ll, ll>
int mod = 1'000'000'000 + 7;
struct edge {
	int to;
	ll cost;
};

void COME_LET_THE_GAMES_BEGIN() {
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << setprecision(20);
}
void reverse(string* s) {
	reverse((*s).begin(), (*s).end());
}
int main() {
	COME_LET_THE_GAMES_BEGIN();
	int A, B;
	cin >> A >> B;
	if (A >= 13) {
		cout << B << endl;
	}
	else if (A >= 6) {
		cout << B / 2 << endl;
	}
	else {
		cout << 0 << endl;
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <iomanip>
#include <bitset>

#define rep(i,n) for (int i = 0; i < (n); i++)
#define FOR(i,a,b) for (int i=(a); i < (b); i++)
#define INF 100000000000
#define MOD 100000007 //10^9+7
using namespace std;
using ll = long long;
using P = pair<int, int>;

char s[50][50];
int h, w;

int main()
{
    int n, m;
    cin >> n >> m;
    vector<int> h(n);
    rep(i,n) cin >> h[i];

    vector<vector<int>> arr(n);
    int a, b;
    rep(i,m) {
        cin >> a >> b;
        a--; b--;
        arr[a].push_back(b);
        arr[b].push_back(a);
    }

    int ans = 0;
    for (int i = 0; i < n; i++) {
        int flag = 1;
        if (arr[i].size() == 0 ) {
            ans++;
            continue;
        }
        for (int j = 0; j < arr[i].size(); j++) {
            if (h[i] <= h[arr[i][j]]) {
                flag = 0;
            }
        }
        if (flag)
            ans++; 
    }
    cout << ans << endl;
         
    return 0;
}


Measured memory_bytes: 8732
from sys import stdin
N = int(stdin.readline().rstrip())
s = (stdin.readline().rstrip())
t = (stdin.readline().rstrip())
ans = len(s)
for i in range(N,0,-1):
    if list(s)[N-i:] == list(t)[:i]:
        break
    else:
        ans += 1
print(ans)

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

#define llint long long int
#define pb push_back

using namespace std;

int main(){
  int n;
  cin >> n;
  string s[n];
  for(int i = 0; i < n; i++){
    cin >> s[i];
  }
  bool flag = true;
  for(int i = 1; i  < n; i++){
    if(s[i][0] != s[i-1][s[i-1].length()-1])
      flag = false;
  }
  for(int i = 1; i < n; i++)
    for(int j = 0; j < i; j++)
      if(s[i] == s[j])
        flag = false;
  if(flag)
    cout << "Yes";
  else
    cout << "No";
  return 0;
}

Measured memory_bytes: 256
//前置き
#pragma region

#include<iostream>
#include<cstdio>
#include<cmath>
#include<string>
#include<vector>
#include<list>
#include<algorithm>
#include<set>
#include<map>
#include<stack>
#include<queue>

using namespace std;

typedef  long long ll;

#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define SORT(a) sort(all(a))
#define REVERSE(a) reverse(all(a))

#define PRINT(str) printf(#str "\n")
#define yOUT PRINT(Yes)
#define nOUT PRINT(No)
#define YOUT PRINT(YES)
#define NOUT PRINT(NO)

#pragma endregion

//関数定義
#pragma region 
//偶数 ->　true :: 奇数　-> false
bool EVEN(ll a){
    return a%2-1;
}

//最大公約数
ll gcd(ll a, ll b) {  
    if (!b)  
        return a;  
    return gcd(b, a%b);  
}  

//最小公倍数
ll lcm(ll a, ll b) {  
    return a*b/gcd(a,b);  
} 

#pragma endregion

// p-k-mp[]
int main(){
    ll n,p,k,x;
    cin >> n >> p >> k;

    map<ll,ll> mp;

    REP(i,k){
        cin >> x;
        mp[x] ++;
    }


    for(ll i = 1;i<=n ;i++){
        if(p-k+mp[i] > 0){
            cout << "Yes" <<endl;
        }else{
            cout << "No" <<endl;
        }
    }

}

    


Measured memory_bytes: 6912
import java.util.Scanner;
public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();
    for(int i=0;i<2;i++){
      for(int j=0;j<2;j++){
        if(a>b){
          int temp = a;
          a = b;
          b = temp;
        }
        if(b>c){
          int temp = b;
          b = c;
          c = temp;
        }
      }
    }
    System.out.printf("%d %d %d\n", a, b, c);
    sc.close();
  }
}


Measured memory_bytes: 26128
#include <iostream>
#include <cstdio>
#define rep(i,a,b) for(int i = a; i <= b; i++)
#define dep(i,a,b) for(int i = a; i >= b; i--)
using namespace std;
const int N = 1e6 + 10, mod = 998244353;
int fac[N], inv[N];
int pw(int a, int b) { 
	int w = 1; 
	for(;b;b >>= 1, a = 1LL * a * a % mod) if (b & 1) w = 1LL * w * a % mod; 
	return w; 
}
int C(int n, int m) {
	return 1LL * fac[n] * inv[m] % mod * inv[n - m] % mod;
}
int main() {
	int n, m; scanf("%d%d",&n,&m);
	if (n < m) swap(n, m);
	fac[0] = 1; rep(i,1,N - 10) fac[i] = 1LL * fac[i - 1] * i % mod;
	inv[N - 10] = pw(fac[N - 10], mod - 2); 
	dep(i,N - 11,0) inv[i] = 1LL * (i + 1) * inv[i + 1] % mod;
	int ans = n, d = pw(C(n + m, n), mod - 2);
	rep(i,1,m)
		ans = (ans + 1LL * C(n + m - 2 * i, n - i) * C(2 * i - 1, i) % mod * d) % mod;
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 8064
import java.util.Scanner;

public class Main{
	public static void main(String[]args){
		Scanner sc=new Scanner(System.in);

		int k=sc.nextInt();
		int gn=0;
		int kn=0;

		for(int i=1;i<=k;i++){
			if(i%2==0){
				gn++;
			}else{
				kn++;
			}
		}
		System.out.println(gn*kn);

	}



}


Measured memory_bytes: 23764
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int ll
#define REP(i, n) FOR(i, 0, n)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define UM unordered_map
#define ALL(a) (a).begin(), (a).end()
typedef vector<ll> vi;
typedef vector<vector<ll>> vvi;
typedef pair<ll, ll> pii;
const ll INF = 1LL << 58;
const ll MOD = 1000000007;
struct Edge
{
    ll s, t, d;
};
typedef vector<vector<Edge>> Graph;
typedef vector<pii> vpii;
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;
}

signed main()
{
    int N;
    vpii xy;
    cin >> N;
    xy.resize(N);
    REP(i, N)
    cin >> xy[i].first >> xy[i].second;

    //abs(x)+abs(y)のパリティが全部同じかチェック
    bool p = ((abs(xy[0].first) + abs(xy[0].second)) % 2 == 0);
    REP(i, N - 1)
    {
        if (p != ((abs(xy[i+1].first) + abs(xy[i+1].second)) % 2 == 0))
        {
            cout << -1 << endl;
            return 0;
        }
    }

    vi arm;
    if (p)
        arm.push_back(1);
    int tmp = 1;
    REP(i, 39)
    {
        arm.push_back(tmp);
        tmp *= 2;
    }
    sort(arm.begin(), arm.end(), greater<int>());
    cout << arm.size() << endl;
    REP(i, arm.size())
    cout << arm[i] << " ";
    cout << endl;

    int nowA, nowB;
    bool modeA, modeB;
    int dirA, dirB;

    REP(i, N)
    {
        nowA = 0;
        nowB = 0;
        dirA = xy[i].first + xy[i].second;
        dirB = xy[i].first - xy[i].second;
        REP(i, arm.size())
        {
            if (nowA < dirA)
            {
                nowA += arm[i];
                modeA = true;
            }
            else
            {
                nowA -= arm[i];
                modeA = false;
            }
            if (nowB < dirB)
            {
                nowB += arm[i];
                modeB = true;
            }
            else
            {
                nowB -= arm[i];
                modeB = false;
            }
            if (modeA and modeB)
                cout << 'R';
            if (modeA and !modeB)
                cout << 'U';
            if (!modeA and !modeB)
                cout << 'L';
            if (!modeA and modeB)
                cout << 'D';
        }
        cout << endl;
    }

    // system("pause");
}


Measured memory_bytes: 256