akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
/// TONI BO$$ was here
/// #MLC

using namespace std;

int main()
{
    int n,f1,f2;
    char a,b,c,d;
    scanf("%c%c%c%c",&a,&b,&c,&d);
    a-='0';
    b-='0';
    c-='0';
    d-='0';
    f1=f2=0;
    if(a*10+b<=12 && a*10+b>0)
        f1=1;
    if(c*10+d<=12 && c*10+d>0)
        f2=1;
    if(f1 && f2)
        printf("AMBIGUOUS");
    if(!f1 && !f2)
        printf("NA");
    if(f1 && !f2)
        printf("MMYY");
    if(!f1 && f2)
        printf("YYMM");


    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define FORD(i,a,b) for(int i=a;i>=b;i--)
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) int((a).size())
#define SORT(c) sort((c).begin(),(c).end())
#define MEMSET(v, h) memset((v), h, sizeof(v))
#define sqr(x) ((x) * (x))
#define bit(n) (1LL<<(n))
#define pcnt(x) __builtin_popcountll(x)
#define PB push_back
#define MP make_pair
#define endl "\n"
using Edge = pair<int,int>;
using Graph = vector<vector<Edge>>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
// ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
// ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int dp[50100];
const int INF = 1001001001;

int main() {
  int n,m; cin >> n >> m;
  FOR(i,1,50000) dp[i] = 1001001001;
  FOR(i,0,m-1){
    int wei; cin >> wei;
    FOR(j,0,50000-wei){
      if(dp[j]!=INF) {
        chmin(dp[j+wei],dp[j] + 1);
      }
    }
  }
  cout << dp[n] << endl;
}



Measured memory_bytes: 3300
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF (1<<29)

struct edge {
	int from, to, cost;
	edge() {}
	edge(int from, int to, int cost) :from(from), to(to), cost(cost) {}
};

int main() {
	cin.tie(0); ios::sync_with_stdio(false);
	int n, m, s, g1, g2;
	while (cin >> n >> m >> s >> g1 >> g2) {
		if (n == 0 && m == 0 && s == 0 && g1 == 0 && g2 == 0) break;
		n; m; s--; g1--; g2--;
		vector<vector<edge>> G(n);
		vector<vector<int>> dist(n, vector<int>(n, INF));
		for (int i = 0; i < m;i++) {
			int b1, b2, c; cin >> b1 >> b2 >> c;
			b1--; b2--;
			G[b1].push_back(edge(b1, b2, c));
			//dist[b1][b2] = c;
		}

		for (int i = 0; i < n;i++) dist[i][i] = 0;
		for (int i = 0; i < n;i++) {
			queue<int> q; q.push(i);
			while (!q.empty()) {
				int v = q.front(); q.pop();
				for (int j = 0; j < G[v].size();j++) {
					int next = G[v][j].to;
					int c = G[v][j].cost;
					if (dist[i][next] > dist[i][v] + c) {
						dist[i][next] = dist[i][v] + c;
						q.push(next);
					}
				}
			}
		}

		int ans = INF;
		for (int i = 0; i < n;i++) {
			ans = min(ans, dist[s][i] + dist[i][g1] + dist[i][g2]);
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 3260
#include <iostream>
using namespace std;
int main() {
   int a,b,c = 1,d = 1 ,e = 0;
   cin >> a >> b;
   while (true) {
      if (d > a)
         break;
      if (d == a)
         if (c > b)
            break;
      c++;
      d++;
      e++;
   }
   cout << e ;
   return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <complex>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 100010

int sumDigit(ll x){
  int sum = 0;
  while(x){
    sum += x%10;
    x /= 10;
  }
  return sum;
}

ll power(int a, int n){
  ll res = 1;

  for(int i=0;i<n;i++) res = res * a;

  return res;
}

int main(){
  int a, n, m;
  int ans = 0;
  
  cin >> a >> n >> m;

  for(int i=1;i<=7*9;i++){
    ans += i == sumDigit(power(i + a, n)) && power(i + a, n) <= m;
  }

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



Measured memory_bytes: 3080
fn main() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };
    let n: usize = sc.read();
    let mut must_die = vec![0; 1 << n];
    let mut results = vec![0; 1 << n];
    for mask in 0..(1 << n) {
        let result: usize = sc.read();
        if result == 0 && must_die[mask] == 1 {
            println!("-1");
            return;
        }
        if result == 1 {
            for i in 0..n {
                let next_mask = mask | (1 << i);
                must_die[next_mask] = 1;
            }
        }

        results[mask] = result;
    }

    let mut ans = 0;
    for mask in 0..(1 << n) {
        if results[mask] == 0 {
            continue;
        }
        if (0..n)
            .filter(|&i| mask & (1 << i) != 0)
            .map(|i| mask ^ (1 << i))
            .all(|mask| results[mask] == 0)
        {
            ans += 1;
        }
    }

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

pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n')
            .take_while(|&b| b != b' ' && b != b'\n')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}



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



int main(){
int a,b;
char z;
while(true){
  cin>>a>>z>>b;
  if(z=='?')
  break;
  if(z=='+')
  cout<<a+b;
  if(z=='-')
  cout<<a-b;
  if(z=='*')
  cout<<a*b;
  if(z=='/')
  cout<<a/b;
  cout<<endl;
}
return 0;
}

Measured memory_bytes: 3072
import java.util.*;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        while(sc.hasNext()){
            int count = 0;
            int n = sc.nextInt();
            for(int i = 0; i <= 9; i++){
                for(int j = 0; j <= 9; j++){
                    for(int k = 0; k <= 9; k++){
                        for(int l = 0; l <= 9; l++){
                            if(i + j + k + l == n){
                                count++;
                            }
                        }
                    }
                }
            }
            System.out.println(count);
        }
    }
}


Measured memory_bytes: 26264
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define NIL NULL

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node *Node;

Node root;

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(struct node *t)
{
  if(t==NIL)return;
  inorder(t->left);
  printf(" %d",t->key);
  inorder(t->right);
}

void preorder(struct node *t)
{
  if(t==NIL)return;
  printf(" %d",t->key);
  preorder(t->left);
  preorder(t->right);
}

struct node *find(struct node *t,int k)
{
  while(t!=NIL && k!= t->key)
    {
      if(k<t->key)t=t->left;
      else t=t->right;
    }
  return t;
}

int main()
{
  int i,j=0,count,number,fcount=0;
  char order[10];
  char ans[3][2];

  scanf("%d",&count);
  for(i=0;i<count;i++)
    {
      scanf("%s",order);
      if(strcmp(order,"find")==0)
	{
	  scanf("%d",&number);
	  struct node *f =find(root,number);
	  if(f!=NIL)printf("yes\n");
	  else printf("no\n");
	}
      if(strcmp(order,"insert")==0)
	{
	  scanf("%d",&number);
	  insert(number);
	}
      else if(strcmp(order,"print")==0)
	{
	  inorder(root);
	  printf("\n");
	  preorder(root);
	  printf("\n");
	}
    }
  return 0;
}

Measured memory_bytes: 19364
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1000000007;

ll modpow(ll m, ll n)
{
  ll res = 1;
  while (n > 0)
  {
    if (n & 1)
    {
      res = res * m % mod;
    }
    m = m * m % mod;
    n >>= 1;
  }
  return res;
}

int main()
{
  ll m, n;
  cin >> m >> n;
  cout << modpow(m, n) << endl;
}


Measured memory_bytes: 3096
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define FOR(i, a, b) for(int i=a;i<b;i++)
#define REP(i, n) FOR(i, 0, n)
#define LAR(a, b) ((a)=max((a),(b)))
#define SML(a, b) ((b)=max((a),(b)))

#define N 1123
int n;
ld x[N], h[N], t;
int main(){
	scanf("%d%Lf", &n, &t);
	REP(i, n) scanf("%Lf%Lf", x+i, h+i);
	ld ans=0;
	REP(i, n) LAR(ans, h[i]*t/x[i]);
	printf("%.30Lf\n", ans);
}

Measured memory_bytes: 3240
#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>

using namespace std;

#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); i++)
#define REP(i, n) FOR(i, 0, n)
 
#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

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

      int a = n /100, b = (n / 10) % 10,c = n % 10;

      if(a >= b && a >= c){
          cout << a*111 << endl;
      }
      else{
          cout << (a+1)*111 << endl;
      }
      
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef string str;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector <pii> vpii;
typedef vector <pll> vpll;
typedef map <str,int> mapsi;
typedef map <str,int> :: iterator mapsitr;
typedef map <int , int> mint;
typedef map <ll , ll> mll;
typedef set <int> si;
typedef set <ll> sll;
typedef si :: iterator sitr;
typedef si :: reverse_iterator rsitr;
typedef sll :: iterator sltr;
typedef sll :: reverse_iterator rsltr;
#define mset multiset
typedef mset <int> msi;
typedef mset <ll> msll;
typedef msi :: iterator msitr;
typedef msi :: reverse_iterator msritr;
typedef msll :: iterator msltr;
typedef msll :: reverse_iterator mslritr;
#define mp make_pair
#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define fi first
#define se second
#define fs first.second
#define ss second.second
#define ff first.first
#define sf second.first
#define newl '\n'
char to_upper (char x){
    if( 97 <= int(x) && int(x) <= 126)return char(x-32);
    else if( 65 <= int(x) && int(x) <= 90)return x;
}
char to_lower (char x){
    if( 97 <= int(x) && int(x) <= 126)return x;
    else if( 65 <= int(x) && int(x) <= 90)return char(x+32);
}
int numerize (char x){
    if(48 <= int(x) && int(x) <= 57)return int(x-'0');
    else if( 97 <= int(x) && int(x) <= 126)return int(x-96);
    else if( 65 <= int(x) && int(x) <= 90)return int(x-64);
}
//void IO(){
//	#ifndef ONLINE_JUDGE
//	    freopen("input.txt", "r", stdin);
//	    freopen("output.txt", "w", stdout);
//	#endif
//}
// end of Template

int m[10];
int n,f[30];
ll ans;
void comb(){
    for(int i=1;i<=5;i++){
        for(int j=i+1;j<=5;j++){
            for(int k=j+1;k<=5;k++){
                ll a,b,c;
                a = f[m[i]];
                b = f[m[j]];
                c = f[m[k]];
                ll temp = a*b*c;
                ans+=temp;
            }
        }
    }

}
int main(){
	//IO();
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    m[1]=numerize('M');
    m[2]=numerize('A');
    m[3]=numerize('R');
    m[4]=numerize('C');
    m[5]=numerize('H');
    cin>>n;
    for(int i=1;i<=n;i++){
        str s;int temp;
        cin>>s;
        temp = numerize(s[0]);
        f[temp]++;
    }
    comb();
    cout<<ans<<newl;
}


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

#define print2(a, b) cerr << "(" << a << "," << b << ")" << endl
#define print3(a, b, c) cerr << "(" << a << "," << b << "," << c << ")" << endl


void solve(long long N){
    int res = 0;
    for (int i = 1; i <= N; i += 2) {
        int c = 0;
        for (int d = 1; d <= i; d++) {
            if (i % d == 0) c++;
        }
        if (c == 8) {
            res++;
        }
    }
    cout << res << endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    solve(N);
    return 0;
}


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

using namespace std;

#define ll long long 
#define gcd(a,b) __gcd(a,b)
#define endl '\n'
const int N=2e5+10;
const int inf=1e9;
const int mod=1e9+7;

int  main(int argc, char const *argv[])
{
	/*#ifndef ONLINE_JUDGE
      freopen("input.txt","r",stdin);
      freopen("output.txt","w",stdout);
    #endif*/
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(0);

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

	double a[n];
	double sum=0;

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

	int c=0;
	double t;

	double v=4*m;
	t=sum/v;

	double tt=ceil(t);

	for(int i=0; i<n; i++)
	{
		if(a[i]>=tt)
			c++;
	}

	if(c>=m)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
	
	return 0;
}

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


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

    string s = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    int H, W;
    cin >> H >> W;
    string ans = "";
    for(int i=0; i<H; i++){
      for(int j=0; j<W; j++){
        string t;
        cin >> t;
        if(t == "snuke"){
          ans += s[j];
          ans += to_string(i+1);
        }
      }
    }
    cout << ans << endl;
}


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

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

#define INF 99999999
#define rep(i,n) for(int (i)=0,temp=(int)(n);(i)<temp;++(i)) 
#define repi(i,start,end) for(int (i)=(start),temp=(int)(end);i<(end);++(i))
#define rfor(v,x) for(const auto& (x) : (v)) //xは値を表す
#define all(x) (x).begin(),(x).end()
#define SORT(v, n) sort((v), (v)+(n))
#define vsort(v) sort((v).begin(), (v).end())
#define vfsort(v,lambda) sort(all((v)),(lambda))
#define vint vector<int>
#define vvint vector<vector<int>> //vvint v(n,vint(n))のように宣言できる
#define vin(v) rep(i,(v).size()) {cin >> (v)[i];}
//最終奥義(使うときはINFも書き換えろ!!)
#define int long long
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; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int ctoi(char c) {return c-'0';}
//lambda式 -> [&](int x, int y){return x<y;}
//vector内の重複を削除-> v.erase(unique(all(v)),v.end());

signed main(void){
  int n,k,s;cin >> n >> k >> s;
  if(n==k){
    rep(i,n)cout << s << " ";
    cout << endl;
    return 0;
  }
  int o=s+1;if(s==1000000000)o=s-1;
  int h=s/2;
  if(k==0){
    rep(i,n)cout << o << " ";
    cout << endl;
    return 0;
  }
  if(s==1){
    rep(i,n){
      if(i<k)cout << 1 << " ";
      else cout << o << " ";
    }
    cout << endl;
    return 0;
  }
  if(s%2==0){
    rep(i,n){
      if(i<=k)cout << h << " ";
      else cout << o << " ";
    }
    cout << endl;
    return 0;
  }
  rep(i,n){
    if(i<=k)cout << h+(i%2) << " ";
    else cout << o << " ";
  }
  cout << endl;
}


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

#define for_(i,a,b) for(int i=(a);i<(b);++i)
template< typename T > using Vec = vector< T >;

int N, Ma, Mb, dp[41][401][401];

void update(int& a, int b) {
	if (a == -1) a = b;
	else a = min(a, b);
}

int main() {
	cin >> N >> Ma >> Mb;
	
	memset(dp, -1, sizeof(dp));
	dp[0][0][0] = 0;
	
	for_(i,0,N) {
		int a, b, c;
		cin >> a >> b >> c;
		
		for_(x,0,401) for_(y,0,401) {
			if (dp[i][x][y] == -1) continue;
			update(dp[i+1][x][y], dp[i][x][y]);
			update(dp[i+1][x+a][y+b], dp[i][x][y] + c);
		}
	}
	
	int ans = -1;
	for_(r,1,400) {
		if (r * Ma > 400 || r * Mb > 400) break;
		if (dp[N][r*Ma][r*Mb] > 0) update(ans, dp[N][r*Ma][r*Mb]);
	}
	cout << ans << endl;
}

Measured memory_bytes: 26112
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

const int mod = 998244353;
struct mint {
    ll x;

    mint(ll x = 0) : x((x % mod + mod) % mod) {}

    mint operator-() const { return mint(-x); }

    mint &operator+=(const mint a) {
      if ((x += a.x) >= mod) x -= mod;
      return *this;
    }

    mint &operator-=(const mint a) {
      if ((x += mod - a.x) >= mod) x -= mod;
      return *this;
    }

    mint &operator*=(const mint a) {
      (x *= a.x) %= mod;
      return *this;
    }

    mint operator+(const mint a) const {
      mint res(*this);
      return res += a;
    }

    mint operator-(const mint a) const {
      mint res(*this);
      return res -= a;
    }

    mint operator*(const mint a) const {
      mint res(*this);
      return res *= a;
    }

    mint pow(ll t) const {
      if (!t) return 1;
      mint a = pow(t >> 1);
      a *= a;
      if (t & 1) a *= *this;
      return a;
    }

    mint inv() const {
      return pow(mod - 2);
    }

    mint &operator/=(const mint a) {
      return (*this) *= a.inv();
    }

    mint operator/(const mint a) const {
      mint res(*this);
      return res /= a;
    }
};

mint table[200020];
void init() {
  table[0] = table[1] = 1;
  for (int i = 2; i < 200020; i++) {
    table[i] = table[i - 1] * i;
  }
}

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

  ll n, m, k;
  cin >> n >> m >> k;

  init();
  mint ans = 0;

  for (ll d = n - k - 1; d <= n - 1; d++) {
    mint comb = table[n - 1] / table[n - 1 - d] / table[d];
    mint p = mint(m - 1).pow(d);
    p *= m;
    mint tmp = comb * p;
    ans += tmp;
  }
  cout << ans.x << endl;
}

Measured memory_bytes: 5192
package main

import (
    "fmt"
    "bufio"
    "os"
)

func main(){
    r := bufio.NewReader(os.Stdin)
    var n, m int
    
    fmt.Fscan(r, &n, &m)
    
    if n < m {
        fmt.Println("a < b");
    } else if n > m {
        fmt.Println("a > b");
    } else {
        fmt.Println("a == b");
    }
    
}



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

using namespace std;
using ll = long long;
#define MOD 1e9+7

int main(){
    int N,K;cin >>N >> K;
    int ans = 0;
    for(int i = 0;i < N;i++){
        int b;cin >> b;
        if(b >= K)ans++;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <tuple>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cassert>
#include <cstdint>
#include <cctype>
#include <numeric>
#include <bitset>
#include <functional>

using namespace std;

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

constexpr int INF = 1 << 30;
constexpr ll LINF = 1LL << 60;
constexpr ll MOD = 1000000007;
constexpr long double EPS = 1e-10;
constexpr int dyx[4][2] = {
    { 0, 1}, {-1, 0}, {0,-1}, {1, 0}
};

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int k;
    cin >> k;
    queue<ll> que;
    for(int i=1;i<=9;++i) que.push(i);
    while(k > 1) {
        ll x = que.front(); que.pop();
        if(x % 10 != 0) que.push(10 * x + x % 10 - 1);
        que.push(10 * x + x % 10);
        if(x % 10 != 9) que.push(10 * x + x % 10 + 1);
        --k;
    }
    cout << que.front() << endl;
}


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

public class AtCoderA
{
    static void Main()
    {
        var sc = new Scanner();

        long n = sc.NextLong();
        long mod = 1000000007;

        long answer = 1;
        for (long i = 1; i <= n; i++)
        {
            answer = (answer * i) % mod;
        }

        Console.WriteLine(answer);
    }

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}

Measured memory_bytes: 13140
import java.util.*;
    public class Main{
	public static void main(String[] args){
	    Scanner scan = new Scanner(System.in);
	    
	    int numM = scan.nextInt();
	    
		
	   
		if(numM%2==0){
		    System.out.println(numM);
		}else{
		    System.out.println(numM*2);
		}
	       
	    
	   
	}
    }

Measured memory_bytes: 21844
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Math;
using static System.Console;

namespace msolutions2020
{
    class SolverC
    {
        static void Main()
        {
            Solve();
        }

        public static void Solve()
        {
            var _nk = ReadLine().Split(" ").Select(x => int.Parse(x)).ToArray();
            (int N, int K) = (_nk[0], _nk[1]);
            int[] A = ReadLine().Split(" ").Select(x => int.Parse(x)).ToArray();
            for (int i=K; i<N; i++)
            {
                WriteLine(A[i-K] < A[i] ? "Yes" : "No");
            }
        }
    }
}


Measured memory_bytes: 46280
class UnionFind:
    # 初期化
    def __init__(self, n):
        # 根なら-size, 子なら親の頂点
        self.par = [-1] * n
        # 木の高さ
        self.rank = [0] * n

    # 検索
    def find(self, x):
        if self.par[x] < 0:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    # 併合
    def unite(self, x, y):
        x = self.find(x)
        y = self.find(y)
        # 異なる集合に属する場合のみ併合
        if x != y:
            # 高い方をxとする。
            if self.rank[x] < self.rank[y]:
                x,y = y,x
            # 同じ高さの時は高さ+1
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1
            # yの親をxとし、xのサイズにyのサイズを加える
            self.par[x] += self.par[y]
            self.par[y] = x

    # 同集合判定
    def same(self, x, y):
        return self.find(x) == self.find(y)

    # 集合の大きさ
    def size(self, x):
        return -self.par[self.find(x)]

n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

# ソート
c = sorted(a)
d = sorted(b)

# 必要
for i in range(n):
    if c[i]>d[i]:
        print('No')
        exit()

# 十分。同値含むケース除外も
for i in range(n-1):
    if c[i+1]<=d[i]:
        print('Yes')
        exit()

# indexのためのdict
aa = {}  # 初期a
bb = {}  # 初期b
cc = {}  # 最終a
dd = {}  # 最終b
for i in range(n):
    aa[a[i]]=i
    bb[b[i]]=i
    cc[c[i]]=i
    dd[d[i]]=i

# サイクルでグループ化
u = UnionFind(n)
for i in range(n):
    j = aa[c[dd[b[i]]]]
    u.unite(i,j)

# グループ2つ以上でOK
for i in range(n):
    if u.same(0,i)==False:
        print('Yes')
        exit()

print('No')

Measured memory_bytes: 126020
import java.util.*;
 
public class Main {
	public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	int n = sc.nextInt();
        int m = sc.nextInt();
        int x = sc.nextInt();
        int c[] = new int[n];
        int a[][] = new int[n][m];
        int min;
        for(int i = 0; i < n; i++){
            c[i] = sc.nextInt();
        	for(int j = 0; j < m; j++){
            	a[i][j] = sc.nextInt();
            }
        }
        ArrayList<Integer> ans = new ArrayList<>();
        for(int i = 0; i < 1 << n; i++){
            int sum[] = new int[m];
            boolean bl = true;
            int cost = 0;
        	for(int j = 0; j < n; j++){
                if((1 & i >> j) == 1){
                	for(int k = 0; k < m; k++){
                    	sum[k] += a[j][k];
                    }
                    cost += c[j];
                }
            }
            for(int j = 0; j < m; j++){
            	if(sum[j] < x){
                	bl = false;
                	break;
                }
            }
            if(bl){
            	ans.add(cost);
            }
        }
        if(ans.isEmpty()){
        	System.out.println(-1);
        }else{
        	Collections.sort(ans);
            System.out.println(ans.get(0));
        }
    }
}

Measured memory_bytes: 37988
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=(a);i<(b);++i)

template<class T> inline void chmin(T& a, T b) {if (a > b) a = b;}
template<class T> inline void chmax(T& a, T b) {if (a < b) a = b;}

//vector出力
template <class T>ostream &operator<<(ostream &o,const vector<T>&v){
  o<<"{";
  for(int i=0;i<(int)v.size();i++) o << (i>0?", ":"") << v[i];
  o<<"}";
  return o;
}

//約数列挙
vector<ll> divisor(ll n) {
  vector<ll> ret;
  for(ll i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}


int main() {
  ll N,K;
  cin >> N >> K;
  vector<ll> A(N);
  ll s=0;
  rep(i,N) {
    cin >> A[i];
    s+=A[i];
  }
  auto div = divisor(s);
  ll ans=1,cnt;
  
  for (auto t:div) {
    vector<ll> inc(N),dic(N),tA(N);
    rep(i,N) tA[i]=A[i]%t;
    sort(tA.begin(),tA.end());
    rep(i,N) {
      dic[i]=tA[i];
      if (i>0) dic[i]+=dic[i-1];
    }
    rep(i,N) {
      inc[i]=t-tA[N-1-i];
      if (i>0) inc[i]+=inc[i-1];
    }
    reverse(inc.begin(),inc.end());
    rep(i,N-1){
      if (dic[i]==inc[i+1]&&dic[i]<=K) {chmax(ans,t);break;}
    }
    // cout << t << endl << dic << endl << inc << endl;
  }
  cout << ans << endl;
}

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

signed main(){
  string s,t;

  cin>>s>>t;

  int count=0;

  if(s[0]==t[0]) count++;
  if(s[1]==t[1]) count++;
  if(s[2]==t[2]) count++;

  cout<<count<<endl;

  return(0);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0; i<(int)n; i++)
#define REPR(i, n) for(int i=(int)n-1; i>=0; i--)
#define FOR(i, m, n) for(int i=(int)m; i<(int)n; i++)
#define FORR(i, m, n) for(int i=(int)m-1; i>=(int)n; i--)
#define ALL(x) (x).begin(), (x).end()
#define ASC(v) sort(ALL(v));
#define DESC(v) sort(ALL(v), greater<int>());
#define UNIQ(a) sort(ALL(a));(a).resize(unique(ALL(a)) - a.begin());
#define DEBUG(x) cout<<#x<<": "<<x<<"\n"
typedef long long ll;
const double PI = acos(-1);
ll lcm(ll a, ll b) { return a / __gcd(a, b) * b; }
bool isprime(int x){ int i; if(x<2)return 0; else if(x==2) return 1; if(x%2==0) return 0; for(i=3; i*i<=x; i+=2) if(x%i==0) return 0; return 1; }
int digsum(int n) { int r=0; while(n>0) { r+=n%10; n/=10; } return r; }
int fact(int k){ int s=1; for (int i=1; i<=k; ++i) { s*=i; } return s; }
//struct nya{ nya(){ cin.tie(0); ios::sync_with_stdio(false); } }nyan;


void solve(long long N, std::vector<long long> P, std::vector<long long> Q){
	ll a = 0, b = 0;
	vector<ll> R(N);
	REP(i, N) R[i] = i+1;
	ll i = 0;
	do{
		if (R==P) a = i;
		if (R==Q) b = i;
		i++;
	}while(next_permutation(ALL(R)));
	cout << abs(a - b) << "\n";
}

int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> P(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&P[i]);
    }
    std::vector<long long> Q(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&Q[i]);
    }
    solve(N, std::move(P), std::move(Q));
    return 0;
}


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

int main() {
    int A[200];
    int n;
    cin >> n;

    for (int i = 0; i < n; i++) {
        cin >> A[i];
    }

    bool ok = true;
    int count = -1;
    while (ok) {
        for (int i = 0; i < n; i++) {
            if (A[i] % 2 == 0) {
                A[i] /= 2;
            } else {
                ok = false;
                break;
            }
        }
        count++;
    }

    cout << count << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <vector>
#include <set>
#include <numeric>

using namespace std;
int a[5][110];

int main(){
   int n;
   cin>>n;
   int ans=0;
   for(int i=1;i<=2;i++){
      for(int j=1;j<=n;j++){
         cin>>a[i][j];
      }
   }
   for(int i=1;i<=n;i++){
      int sum=0;
      for(int j=1;j<=i;j++){
         sum+=a[1][j];
      }
      for(int j=i;j<=n;j++){
         sum+=a[2][j];
      }
      ans=max(ans,sum);
   }
   cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define inf 1e9
int solve(vector<int> arr,int n,int k)
{
	vector<int> dp(n+1);
	dp[1]=0;
	for(int i=2;i<=n;i++)
	{
		dp[i]=inf;
		for(int j=i-1;j>=1 && (i-j)<=k;j--)
		{
			dp[i]=min(dp[i],abs(arr[i]-arr[j])+dp[j]);
		}
	}
	return dp[n];
		
}

int main()
{ 
	int n,k;
	cin>>n>>k;
	vector<int> arr(n+1);
	for(int i=1;i<=n;i++)
	{
		cin>>arr[i];
	}
	cout<<solve(arr,n,k);
}


Measured memory_bytes: 4540
#pragma GCC optimize(3,"Ofast","inline")
#include<bits/stdc++.h>

#define int long long
#define pb push_back
#define st first
#define nd second
#define sz(x) ((int)x.size())
#define ins insert
using namespace std;

const int maxn=2e5+10;
const int mod=1e9+7;
const int inf=0x3f3f3f3f;

int gcd(int a,int b){
    return b==0?a:gcd(b,a%b);
}
int lcm(int a,int b){
    return a*b/gcd(a,b);
}
int dir[4][2]={{1,0},{-1,0},{0,1},{0,-1}};
int vis[1010][1010]={};string s[1010];
int n,m;
struct node{
    int x,y;
    node(int x,int y):x(x),y(y){}
};
deque<node>q;
main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin>>n>>m;
    int sx,sy,ex,ey;
    cin>>sx>>sy>>ex>>ey;
    for(int i=0;i<n;++i)
        for(int j=0;j<m;++j)vis[i][j]=inf;
    for(int i=0;i<n;++i)cin>>s[i];
    sx--;sy--;ex--;ey--;
    q.pb(node(sx,sy));
    int dx[6]={-2,-1,0,1,0,2};
    int dy[6]={-2,0,-1,0,1,2};
    vis[sx][sy]=1;
    while(!q.empty()){
        node now=q.front();
        q.pop_front();
        int x=now.x;
        int y=now.y;
        for(int i=0;i<4;++i){
            int xx=x+dir[i][0];
            int yy=y+dir[i][1];
            if(xx>=0&&xx<n&&yy>=0&&yy<m&&vis[xx][yy]>vis[x][y]&&s[xx][yy]=='.'){
                vis[xx][yy]=vis[x][y];
                q.push_front(node(xx,yy));
            }
        }
        for(auto i:dx){
            for(auto j:dy){
                int xx=x+i;
                int yy=y+j;
                if(xx>=0&&xx<n&&yy>=0&&yy<m&&s[xx][yy]=='.'&&vis[xx][yy]>vis[x][y]+1){
                    vis[xx][yy]=vis[x][y]+1;
                    q.pb(node(xx,yy));
                }
            }
        }
    }
//    for(int i=0;i<n;++i){
//        for(int j=0;j<m;++j){cout<<(vis[i][j]==inf?0:vis[i][j])<<" ";}
//        cout<<endl;
//    }
    if(vis[ex][ey]==inf)cout<<"-1"<<endl;
    else cout<<vis[ex][ey]-1<<endl;
}
/**
5 5
1 1
5 5
.#.#.
#####
.###.
#####
.#.#.
**/


Measured memory_bytes: 12784
#include<iostream>
#include<vector>
#include<algorithm>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>
#include<climits>
#include<set>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
using namespace std;
typedef pair<int, int> pii;
typedef long long int ll;
typedef pair<ll,ll> pll;
int dx[4] = {1,0,0,-1};
int dy[4] = {0,1,-1,0};
#define MOD 1000000007
#define ARRAY_MAX 100005

const int INF = 1e9+7;


int main(){

    ll n;
    cin >> n;
    vector<ll> a(n);

    for(int i = 0;i < n;i++){
        cin >> a[i];
    }

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

    ll sum = 0;
    ll ans = n;

    for(int i = 0;i < n-1;i++){
        sum += a[i];
        //cout << sum << endl;
        if(2*sum < a[i+1]){
            ans = n-(i+1);
        }
    }
    cout << ans << endl;









    return 0;
}

Measured memory_bytes: 1024
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0641


#include<iostream>
 using namespace std; //標準名前空間を使用

int main(){

    //変数を読み込む
    int N , A , B ,C ,D ;
    int Xset , Yset , Xprice , Yprice;

    cin >> N >> A >> B >> C >> D ; //変数の読み込み

    // セットXで揃えた場合の必要セット数(Xset)を求める
    if( N % A == 0){
        Xset = N / A ;
    }else{
        Xset = N / A + 1 ;
    }

    // セットXで揃えた場合の合計金額を求める
    Xprice = Xset * B ;


    // セットYで揃えた場合の必要セット数(Yset)を求める

    if( N % C == 0){
        Yset = N / C ;
    }else{
        Yset = N / C + 1 ;
    }

    // セットXで揃えた場合の合計金額を求める
    Yprice = Yset * D ;

    //XpriceとYpriceを比較する
    if(Xprice < Yprice){
    cout << Xprice << endl ; //XpriceがYpriceより小さい場合、Xpriceを出力
    }else{
    cout << Yprice << endl ; //そうでない場合、Ypriceを出力
    }

 return 0;

 }

 // 注：割り算の繰上げはceilでもできる


Measured memory_bytes: 3100
#include <bits/stdc++.h>
using namespace std;
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
template<class T> inline T sqr(T x) {return x*x;}
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) sort((c).rbegin(),(c).rend())
#define UNIQUE(c) SORT(c); (c).erase(unique((c).begin(), (c).end()), (c).end());
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
const double INF = 1e7;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
#define CLR(a) memset((a), 0 ,sizeof(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

inline LL lcm(LL a, LL b){
  return a * b / __gcd(a, b);
}

void solve(LL N, LL M, string S, string T){
	LL L = lcm(N, M);
	int flag_no = 0;
	LL n = L / N, m = L / M;
	LL s = 1, t = 1;
	while (s <= L && t <= L) {
		//cout << s << " " << t << endl;
		if (s == t) {
			if (S[(s - 1) / n] != T[(t - 1) / m]) {
				flag_no = 1;
				break;
			} else {
				s += n;
				t += m;
			}
		} else if (s < t) {
			s += ceil((double)(t - s) / n) * n;
		} else {
			t += ceil((double)(s - t) / m) * m;
		}
	}
	if (flag_no == 0) {
		cout << L << endl;
	} else {
		cout << "-1" << endl;
	}
}


int main(){	
	LL N;
	string S;
	LL M;
	string T;
	scanf("%lld",&N);
	scanf("%lld",&M);
	cin >> S;
	cin >> T;
	solve(N, M, S, T);
	return 0;
}



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

int main(){
        int N,K;
        int D[10] = {};
        int num;
        cin >> N >> K;
        rep(i,K){
                cin >> num;
                D[num]=1;
        }
        for(int i = N; i< 110000; i++) {
                int flag = 0;
                int pay = i;
                while(true) {
                        flag += D[pay % 10];
                        pay /= 10;
                        if (pay == 0) break;
                }
                if (flag == 0) {
                        cout << i << endl;
                        return 0;
                }
        }
        return 0;
}


Measured memory_bytes: 256
n,k,s = map(int,input().split())
L = []
if (s == 10**9):
    for i in range(k):
        L.append(10**9)
    for i in range(n-k):
        L.append(1)
else:
    for i in range(k):
        L.append(s)
    for i in range(n-k):
        L.append(s+1)
print(' '.join(map(str,L)))


Measured memory_bytes: 66208
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
 
int main(){
  int a,b,x;
  cin >> a >> b >> x;
  if(a<=x && x<=a+b){
    cout << "YES" << endl;
  }
  else{
    cout << "NO" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<vector<int>> vvi;
const int MOD = 1e9 + 7;
const int INF = 2e9;
#define pb push_back
#define mp make_pair
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 (a>b) { a=b; return 1; } return 0; }

int main(){
    ll n;
    cin >> n;
    for (ll i = 1; i <= 3500; i++){
        for (ll j = i; j <= 3500; j++){
            if(n*(i+j)<4*i*j){
                if((n*i*j)%(4*i*j-n*(i+j)) == 0){
                    ll k = (n * i * j) / (4 * i * j - n * (i + j));
                    cout << i << ' ' << j << ' ' << k << endl;
                    return 0;
                }
            } 
        }
    }
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
#include<complex>
using namespace std;

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
typedef pair<int, int>P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef pair<ll, ll> LP;
typedef double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-6;
const ld pi = acos(-1.0);
typedef vector<vector<ll>> mat;
typedef vector<int> vec;

void solve() {
	string s; cin >> s;
	sort(s.begin(), s.end());
	if (s == "abc") {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(6);
	//init();
	solve();
	stop
		return 0;
}


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

int main() {
	int n, k;
	cin >> n >> k;
	int a = 1;
	for (int i = 0; i < n; i++) {
		if (a < k) {
			a *= 2;
		} else {
			a += k;
		}
	}
	cout << a << endl;
	return 0;
}


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

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int N = sc.nextInt();
		
		int[] points = new int[N];
		int ans = 0;
		
		for(int i=0; i<N; i++){
			int s = sc.nextInt();
			points[i] = s;
			ans += s;
		}
		
		if(ans % 10 != 0){
			System.out.println(ans);
		}else{
			Arrays.sort(points);
			boolean flag = false;
			for(int i=0; i<N; i++){
				int min = points[i];
				if(points[i] % 10 != 0){
					System.out.println(ans - min);
					flag = true;
					break;
				}
			}
			if(!flag){
				System.out.println(0);
			}
		}
		
		
	}

}

Measured memory_bytes: 21716
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  int ans=1;
  std::cin >> n;
  std::vector<int> p(n);
  int min;
  std::cin >> min;
  for (int i = 1; i < n; i++) {
    std::cin >> p[i];
    if(p[i] <= min){
      ans++;
      min = p[i];
    }
  }
  std::cout << ans << '\n';


  return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<n;++i)

using namespace std;

typedef pair<int,int>P;
typedef pair<ll,ll>pll;

const int MAX_N = 100005;

int Q;

void ccw(pll p0,pll p1,pll p2)
{
	pll a = pll(p1.first - p0.first,p1.second - p0.second);
	pll b = pll(p2.first - p0.first,p2.second - p0.second);
	ll dot = a.first*b.first+a.second*b.second;
	ll cross = a.first*b.second - a.second*b.first;
	ll na = a.first*a.first+a.second*a.second;
	ll nb = b.first*b.first+b.second*b.second;
	if(cross > EPS){
		printf("COUNTER_CLOCKWISE\n");
	}else if(cross < -EPS){
		printf("CLOCKWISE\n");
	}else if(dot < -EPS){
		printf("ONLINE_BACK\n");
	}else if(na < nb){
		printf("ONLINE_FRONT\n");
	}else{
		printf("ON_SEGMENT\n");
	}
}

int main()
{
	pll p0,p1,p2;
	scanf("%lld%lld%lld%lld",&p0.first,&p0.second,&p1.first,&p1.second);
	scanf("%d",&Q);
	rep(i,Q){
		scanf("%lld%lld",&p2.first,&p2.second);
		ccw(p0,p1,p2);
	}
	return 0;
}

Measured memory_bytes: 3160
#include<bits/stdc++.h>
#define ll long long int

using namespace std;

const ll mod=1000000007;
const ll inf=1e18;

int main(){

  ll x;
  cin >> x;

  if(x<=599) cout << 8 << endl;
  else if(x<=799)cout << 7 << endl;
  else if(x<=999)cout << 6 << endl;
  else if(x<=1199)cout << 5 << endl;
  else if(x<=1399)cout << 4 << endl;
  else if(x<=1599)cout << 3 << endl;
  else if(x<=1799)cout << 2 << endl;
  else cout << 1 << endl;

}

Measured memory_bytes: 3632
#include <iostream>

using namespace std;

int main() {
  int a, b;
  cin >> a >> b;
  while(b) {
    bool flag = true;
    for (int i = a; i <= b; ++i) {
      if ((i % 400 == 0) ||
          (i % 4 ==0 && i % 100 != 0)) {
        cout << i << endl;
        flag = false;
      }
    }
    if (flag)
      cout << "NA" << endl;

    cin >> a >> b;
    if (b)
      cout << endl;
  }
}


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

using ll = long long;
#define debug(x) cerr << #x << ": " << x << endl;
#define line() cerr << "---------------" << endl;

bool isPrime(int x) {
   if (x == 1) return false;
   for (int i = 2; i*i <= x; i++) {
      if (x % i == 0) {
         return false;
      }
   }
   return true;
}

int main() {
   int n;
   cin >> n;
   int cnt = 0;
   for (int i = 0; i < n; i++) {
      int x;
      cin >> x;
      if ( isPrime(x) ) {
         cnt++;
      }
   }

   cout << cnt << endl;

   return 0;
}

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

const int maxN = 2001;
const int mod = 1e9 + 7;

long long n, k, dp[maxN][maxN], fac[maxN * maxN], inv_fac[maxN * maxN];

long long pow_mod (long long a, int b) {
	int ans = 1;
	while (b) {
		if (b & 1) { ans = (ans * a) % mod; }
		b >>= 1, a = (a * a) % mod;
	}
	return ans;
}

void init() {
	fac[0] = 1;
	for (register int i = 1; i <= maxN * maxN; i++) {
		fac[i] = (fac[i - 1] * i) % mod;
	}
	inv_fac[maxN * maxN] = pow_mod(fac[maxN * maxN], mod - 2);
	for (register int i = maxN * maxN - 1; i >= 0; i--) {
		inv_fac[i] = (inv_fac[i + 1] * (i + 1)) % mod;
	}
}

inline long long C(int m, int n) {
	return ((fac[n] * inv_fac[m] % mod) * inv_fac[n - m] % mod); 
}

int main() {
	scanf("%lld%lld", &n, &k);
	init();
	if (k == 1) {
		printf("1\n");
		return 0;
	}
	for (register int i = 0; i <= n; i++) {
		dp[i][0] = 1;
	}	
	for (register int i = 1; i <= n; i++) {
			for (register int j = 0; j <= i; j++) {
				if (!j) { continue; }
				dp[i][j] = (dp[i - 1][j] + (dp[i][j - 1] * (n - j + 1)) % mod * C(k - 2, n * k - i - (j - 1) * (k - 1) - 1)) % mod;
			}
	}
	printf("%lld\n", dp[n][n]);
	return 0;
}


Measured memory_bytes: 94080
#include <bits/stdc++.h>
#define ll  long long int
#define pb push_back
#define ff first
#define ss second
#define vi vector<int>
#define br cout <<"\n";
#define all(x)  (x).begin(),(x).end()
#define rall(x)  (x).rbegin(),(x).rend()
#define tr(c,i) for(auto i :c)
#define pii pair< int,int >
#define Fast_IO() ios_base::sync_with_stdio(false);cin.tie(0)
#define pq priority_queue< pair<ll,pii> ,vector<pair<ll,pii>>,greater <pair<ll,pii>> >p;//container adapter makes ascending q
#define _ <<" "<<
const int MOD = 1000 * 1000  * 1000 + 7; // odd modulus
const int N = 1000 * 1000 ;
using namespace std;
clock_t time_p=clock();
void dem()
{
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}
int main()
{
    Fast_IO();
    int a ; 
    string s ; 
    cin >> a >> s ; 
    if ( a < 3200)cout << "red" ; 
    else 
        cout << s ; 


return 0 ; 

}








Measured memory_bytes: 512
#include <iostream>

int main(int argc, char const *argv[]) {
  using namespace std;
  int n;
  cin >> n;
  int * a = new int[n];
  for (int i = 0; i < n; i++)
  {
    cin >> a[i];
  }
  for (int i = 0; i < n - 1; i++)
  {
    cout << a[i] << ' ';
  }
  cout << a[n - 1] << endl;
  for (int i = 1; i < n; i++)
  {
    int key = a[i];
    int j = i - 1;
    while (j >= 0&&a[j] > key)
    {
      a[j + 1] = a[j];
      a[j] = key;
      j--;
    }
    for (int i = 0; i < n - 1; i++)
    {
      cout << a[i] << ' ';
    }
    cout << a[n - 1] << endl;
  }
  delete[] a;
  return 0;
}



Measured memory_bytes: 3096
#include<string>
#include<iostream>
#include <algorithm>
#include<vector>
#include<functional>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <numeric>
#define ll long long
#define rep(i,n) for(ll i=0;i<(ll)n;i++)
using namespace std;



int main() {
    ll N, M;
    ll seikai = 0, pena = 0;
    cin >> N >> M;
    vector<ll> count(N, 0);
    vector<ll> ans(N, 0);
    rep(i, M) {
        ll p;
        string S;
        cin >> p >> S;
        if (ans[p - 1] == 1) continue;
        if (S == "AC") ans[p - 1] = 1;
        else count[p - 1]++;
    }
    rep(j, N) {
        seikai += ans[j];
       if(ans[j]==1) pena += count[j];
    }
    cout << seikai << " " << pena << endl;

    return 0;
}


Measured memory_bytes: 1792
//
//  main.cpp
//  D - AtCoder Express
//
//  Created by wenhan on 2017/10/28.
//  Copyright © 2017年 wenhan. All rights reserved.
//

#include <cstdio>
#include <algorithm>
using namespace std;
double t[105],v[105];
int main(){
    int n;
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
        scanf("%lf",&t[i]);
    for(int i=1;i<=n;i++)
        scanf("%lf",&v[i]);
    double cur=0,ans=0;
    for(int i=1;i<=n;i++){
        double a=0,b=0,c=0;
        double lim=0x3f3f;
        double tmp=0;
        for(int j=i+1;j<=n+1;j++){
            lim=min(lim, v[j]+tmp);
            tmp+=t[j];
        }
        a=min(min(t[i], v[i]-cur), (-cur+t[i]+lim)*0.5);
        b=max(double(0),cur+a-lim);
        c=t[i]-a-b;
        ans+=0.5*(cur*2+a)*a;
        ans+=(cur+a)*c;
        ans+=0.5*((cur+a)*2-b)*b;
        cur+=a;
        cur-=b;
    }
    printf("%lf\n",ans);
    return 0;
}


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

int n;
int p[25];
int cnt;

int main() {
	cin >> n;
	for (int i = 0; i < n; ++i) {
		cin >> p[i];
	}
	for (int i = 1; i < n - 1; ++i) {
		if ((p[i] - p[i - 1]) * (p[i] - p[i + 1]) < 0) ++cnt;
	}
	cout << cnt;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <vector>
#include <map>
#include <unordered_map>
#include <string>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <functional>
#include <numeric>
#include <iomanip>
#include <queue>
using namespace std;

typedef int64_t ll;
const ll INF = 1000000000000000000;
#define fori(i, a, b) for (ll i = (a); i < (b); ++i)
#define ford(i, a, b) for (ll i = (b - 1); (a) <= i; --i)
#define rep(i, n) fori(i, 0, n)
#define vll vector<ll>
#define all(v) v.begin(), v.end()



int main() {
	ll N;
	cin >> N;
	cout << "ABC" << N << endl;
}


Measured memory_bytes: 256