akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
using ll = long long;
int main(int argc, const char * argv[]) {
    int A, B, C;
    ll X, Y;
    cin >> A >> B >> C >> X >> Y;
    
    ll sum[3] = {};
    sum[0] = X * A + Y * B;
    
    if (X > Y) {
        sum[1] = C * 2 * X;
    }else{
        sum[1] = C * 2 * Y;
    }
    
    if (X > Y) {
        sum[2] = C * 2 * Y;
        sum[2] += A * (X - Y);
    }else{
        sum[2] = C * 2 * X;
        sum[2] += B * (Y - X);
    }
    /*
    for (int i = 0; i < 3; i++) {
        cout << sum[i] << endl;
            
    }
    */
    
    ll min;
    min = sum[0];
    for (int i = 1; i < 3; i++) {
        if (min > sum[i]) {
            min = sum[i];
        }
    }
    cout << min << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
   int count=1, n, id, m1, s1, m2, s2, m3, s3, m4, s4, i, key, keyid, S, fst, snd, last, snd_last, fstid, sndid, lastid, snd_lastid;
   scanf("%d", &n);
   while ( n != 0 ){
      i = n;
      fst = fstid = snd = sndid = 1000000;
      last = lastid = snd_last = snd_lastid = 0;
      while ( i != 0 ) {
         S = 0;
         scanf("%d %d %d %d %d %d %d %d %d",&id, &m1, &s1, &m2, &s2, &m3, &s3, &m4, &s4);
         /*printf("count = %d\n", count); count++;*/
         S = ( m1 + m2 + m3 + m4 ) * 60 + s1 + s2 + s3 + s4;
         if (fst > S) {
            key = fst;
            keyid = fstid;
            fst = S;
            fstid = id;
            snd = key;
            sndid = keyid;
         } else if (snd > S) {
            snd = S;
            sndid = id;
         }
         if (last < S) {
            key = last;
            keyid = lastid;
            last = S;
            lastid = id;
            snd_last = key;
            snd_lastid = keyid;
         } else if (snd_last < S) {
            snd_last = S;
            snd_lastid = id;
         }
         i--;
      }
      printf("%d\n%d\n%d\n", fstid, sndid, snd_lastid);
      scanf("%d", &n); 
   }
   return 0;
}

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

int main(){
  while(true){
    int n, m;
    cin >> n >> m;
    if(n == 0)
      break;

    vector<int> taro(n+1), hana(m+1);
    int sumt = 0, sumh = 0;
    for(int i=0; i<n; i++){
      cin >> taro[i];
      sumt += taro[i];
    }
    taro[n] = 101;
    for(int i=0; i<m; i++){
      cin >> hana[i];
      sumh += hana[i];
    }
    hana[m] = 101;
    sort(taro.begin(), taro.end());
    sort(hana.begin(), hana.end());

    int ansi = n, ansj = m;
    for(int i=0; i<n; i++){
      for(int j=0; j<m; j++){
        if(sumt - taro[i] + hana[j] == sumh - hana[j] + taro[i]){
          if(taro[i] + hana[j] < taro[ansi] + hana[ansj]){
            ansi = i;
            ansj = j;
          }
          break;
        }
      }
    }
    if(ansi == n && ansj == m)
      cout << -1 << endl;
    else
      cout << taro[ansi] << ' ' << hana[ansj] << endl;
  }
  
  return 0;
}

Measured memory_bytes: 3088
//32
#include<iostream>
#include<vector>
#include<deque>

using namespace std;

struct S{
  int t,hp,u;
};

int main(){
  for(int hi,hm;cin>>hi>>hm,hi|hm;){
    int r,c;
    cin>>r>>c;
    char g[100][100];
    for(int i=0;i<r;i++){
      for(int j=0;j<c;j++){
	cin>>g[i][j];
      }
    }
    int t;
    cin>>t;
    int d[128];
    while(t--){
      char a;
      cin>>a;
      cin>>d[a];
    }
    int s;
    cin>>s;
    vector<int> v;
    int x=0,y=0;
    while(s--){
      char u;
      int n;
      cin>>u>>n;
      while(n--){
	y+=(u=='D')-(u=='U');
	x+=(u=='R')-(u=='L');
	v.push_back(d[g[y][x]]);
      }
    }
    int p[12];
    int np;
    cin>>np;
    for(int i=0;i<np;i++){
      cin>>p[i];
    }
    static int dp[1001][1<<12];
    fill(dp[0],dp[1001],0);
    deque<S> deq;
    S is={0,hi,0};
    deq.push_back(is);
    while(!deq.empty()){
      S c=deq.front();
      if(c.t==v.size())break;
      deq.pop_front();
      if(c.hp<=dp[c.t][c.u])continue;
      dp[c.t][c.u]=c.hp;
      if(v[c.t]<c.hp){
	c.hp-=v[c.t];
	c.t++;
	deq.push_back(c);
      }else{
	for(int i=0;i<np;i++){
	  if(!(c.u>>i&1)){
	    S n=c;
	    n.hp=min(hm,n.hp+p[i]);
	    n.u|=1<<i;
	    deq.push_front(n);
	  }
	}
      }
    }
    cout<<(deq.empty()?"NO":"YES")<<endl;
  }
  return 0;
}

Measured memory_bytes: 17276
import numpy as np

size=input()
P=input()

p=P.split(" ")
p=np.array(p,dtype=np.int32)

counter=0

for i in range(0,len(p)-2):
    if(p[i]<p[i+1] and p[i+1]<p[i+2]):
        counter+=1
    elif(p[i]>p[i+1] and p[i+1]>p[i+2]):
        counter+=1

print(counter)

Measured memory_bytes: 12508
//dlang template---{{{
import std.stdio;
import std.conv;
import std.string;
import std.array;
import std.algorithm;

// MIT-License https://github.com/kurokoji/nephele
class Scanner
{
  import std.stdio : File, stdin;
  import std.conv : to;
  import std.array : split;
  import std.string;
  import std.traits : isSomeString;

  private File file;
  private char[][] str;
  private size_t idx;

  this(File file = stdin)
  {
    this.file = file;
    this.idx = 0;
  }

  this(StrType)(StrType s, File file = stdin) if (isSomeString!(StrType))
  {
    this.file = file;
    this.idx = 0;
    fromString(s);
  }

  private char[] next()
  {
    if (idx < str.length)
    {
      return str[idx++];
    }

    char[] s;
    while (s.length == 0)
    {
      s = file.readln.strip.to!(char[]);
    }

    str = s.split;
    idx = 0;

    return str[idx++];
  }

  T next(T)()
  {
    return next.to!(T);
  }

  T[] nextArray(T)(size_t len)
  {
    T[] ret = new T[len];

    foreach (ref c; ret)
    {
      c = next!(T);
    }

    return ret;
  }

  void scan()()
  {
  }

  void scan(T, S...)(ref T x, ref S args)
  {
    x = next!(T);
    scan(args);
  }

  void fromString(StrType)(StrType s) if (isSomeString!(StrType))
  {
    str ~= s.to!(char[]).strip.split;
  }
}

//Digit count---{{{
int DigitNum(int num) {
  int digit = 0;

  while (num != 0) {
    num /= 10;
    digit++;
  }

  return digit;
}
//}}}
//}}}

void main() {
  Scanner sc = new Scanner;

  int N;
  sc.scan(N);

  double[] a = new double[N];
  double ave = 0;

  foreach (i; 0 .. N) {
    sc.scan(a[i]);
    ave += a[i];
  }

  ave /= N;

  double min = a[0] - ave;
  if (min < 0)
    min *= -1;
  int minNum = 0;
  foreach (i; 0 .. N) {
    if (a[i] - ave < 0) {
      double tmp = (a[i] - ave) * -1;
      if (tmp < min) {
        min = tmp;
        minNum = i;
      }
    } else if (a[i] - ave >= 0) {
      double tmp = a[i] - ave;
      if (tmp < min) {
        min = tmp;
        minNum = i;
      }
    }
  }

  writeln(minNum);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define FS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long int
#define ld long double
#define pb push_back
#define bp __builtin_popcount
#define sz size()
#define ff first
#define ss second
#define vll vector<ll>
#define vbool vector<bool>
#define vpll vector<pair<ll,ll>>
#define pll pair<ll,ll>
#define vllv vector<vector<ll>>
#define setpri(x) cout<<setprecision(x)<<fixed;
#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
#define yesr {cout<<"YES"<<endl;return;}
#define nor {cout<<"NO"<<endl;return;}
// getline (std::cin,name);
ll MOD=1e9+7;
ll ceil1(ll n,ll x){if(n%x==0)return n/x; else return (n/x)+1;}
ll gcd(ll a,ll b){return __gcd(a,b);}
ll lcm(ll a,ll b){return (max(a,b)/gcd(a,b))*min(a,b);}
ll pow1(ll n,ll k,ll mm){
    if(k==0)return 1;
    if(k%2==0)return (pow1((n%mm)*(n%mm),k/2,mm))%mm;
    return ((n%mm)*(pow1((n%mm)*(n%mm),k/2,mm)%mm))%mm;
}
ll pow2(ll n,ll k){ll ans=1;
    while(k>0){
        if(k%2==1)ans=ans*n;n=n*n;k/=2;
    }return ans;
}
ll modinv(ll n,ll mod){
    return pow1(n,mod-2,mod);
}
bool func(pair<ll,ll> &a,pair<ll,ll> &b ){
    if(a.ff != b.ff)return a.ff < b.ff;
    return a.ss > b.ss;
}

void solve(){
    ll i,j,k,l,n,m,x,y,z,r;
	
	ll a,b;
	cin>>a>>b>>n;
	
	ll t=min(n,b-1);
	cout<<(a*t)/b -a*(t/b)<<endl;
  
}
int main(){
    FS;
    ll i,j,k,n,m,x,y,z,q;
    q=1;
    // cin>>q;
    while(q--){
        solve();
    }
    return 0;
}

Measured memory_bytes: 3616
#include <iostream>
#include <ctime>
#include <cstdlib>

using namespace std;

int seq[1010];
int card[1010][1010];

void solve()
{
	srand((unsigned int)time(NULL));
	int N, K;
	while(cin >> N >> K)
	{
		for(int i = 0; i < K; ++i)
		{
			for(int j = 0; j < N / 2; ++j)
			{
				cin >> card[i][j];
				card[i][j]--;
			}
		}
		while (true) 
		{
			for(int i = 0; i < N; ++i)
			{ 
				seq[i] = rand() & 1; 
			}
			for(int i = 0; i < K; ++i)
			{
				int sum = 0;
				for(int j = 0; j < N; ++j)
				{
				  sum += seq[card[i][j]];
				}
				if (sum < N / 8 || sum > 3 * N / 8) 
				{ 
					goto next; 
				}
			}
			break;
next:
			;
		}
		for(int i = 0; i < N; ++i)
		{
		  printf("%d", seq[i]);
		}
		puts("");
	}
}

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

Measured memory_bytes: 2812
void main() {
  problem();
}

void problem() {
  const N = scan!int;
  const M = scan!int;
  const X = scan!int;
  auto C = new int[N];
  int[][] A;

  foreach(i; 0..N) {
    C[i] = scan!int;
    A ~= scan!int(M);
  }

  void solve() {
    int answer = int.max;
    foreach(comb; [true, false].permutationsWithRepetitions(N)) {
      int price;
      auto manabi = new int[M];
      foreach(i; 0..N) {
        if (comb[i]) continue;

        price += C[i];
        foreach(a; 0..M) manabi[a] += A[i][a];
      }

      if (manabi.any!(m => m < X)) continue;
      if (answer > price) answer = price;
    }

    writeln(answer == int.max ? -1 : answer);
  }

  solve();
}

// ----------------------------------------------

import std.stdio, std.conv, std.array, std.string, std.algorithm, std.container, std.range, core.stdc.stdlib, std.math, std.typecons, std.numeric;
T[][] combinations(T)(T[] s, in int m) {   if (!m) return [[]];   if (s.empty) return [];   return s[1 .. $].combinations(m - 1).map!(x => s[0] ~ x).array ~ s[1 .. $].combinations(m); }
string scan(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }
T scan(T)(){ return scan.to!T; }
T[] scan(T)(int n){ return n.iota.map!(i => scan!T()).array; }
void deb(T ...)(T t){ debug writeln(t); }
alias Point = Tuple!(long, "x", long, "y");

import std.stdio, std.array, std.concurrency;
 
Generator!(T[]) permutationsWithRepetitions(T)(T[] data, in uint n)
in {
    assert(!data.empty && n > 0);
} body {
    return new typeof(return)({
        if (n == 1) {
            foreach (el; data)
                yield([el]);
        } else {
            foreach (el; data)
                foreach (perm; permutationsWithRepetitions(data, n - 1))
                    yield(el ~ perm);
        }
    });
}

// -----------------------------------------------


Measured memory_bytes: 13680
import java.util.*
import java.math.*
import kotlin.math.*

fun readLn()=readLine()!!
fun readInt()=readLn().toInt()
fun readInts()=readLn().split(" ").map{it.toInt()}
fun readLong()=readLn().toLong()
fun readLongs()=readLn().split(" ").map{it.toLong()}

val out=mutableListOf<String>()
fun printLine(s:String){out.add(s)}
fun output(){println(out.joinToString("\n"))}

fun main(){
    var x=readLong()
    var y=100L
    var ans=0
    while(y<x){
        ans++
        y+=y/100
    }
    printLine("$ans")
    output()
}

Measured memory_bytes: 36392
using System;
using System.Collections.Generic;
using System.Linq;
using static Atcoder;
using System.Threading.Tasks;
using System.ComponentModel;

public class Hello
{

    public static void Main()
    {
        int N = Cin();
        int[] n = SpRead(' ').Select(a => int.Parse(a)).ToArray();
        int Alice = 0;
        int B = 0;
        Array.Sort(n);
        Array.Reverse(n);
        for (int i = 0; i < N; i++) {
            if (i % 2 == 0) Alice += n[i];
            else B += n[i];
        };
        Console.WriteLine(Alice - B);
    }

}


public class Atcoder
{
    static void Swap<T>(ref T a, ref T b)
    {
        var t = a;
        a = b;
        b = t;
    }
    public static int LCM(int a, int b)
    {
        int c = a * b;
        if (a < b) Swap(ref a, ref b);
        int d = a % b;
        while (d != 0)
        {
            a = b;
            b = d;
            d = a % b;
        }
        return c / b;
    }
    public static string strReverce(string s)
    {
        return new string(s.Reverse().ToArray());
    }
    public static int Cin()
    {
        return int.Parse(Console.ReadLine());
    }
    public static bool IsPrime(int n)
    {
        if (n < 2) return false;
        if (n == 2) return true;
        if (n % 2 == 0) return false;

        //double sqrtNum = Math.Sqrt(n);
        for (int i = 3; i < n; i += 2)
        {
            if (n % i == 0) return false;
        }
        return true;
    }
    public static string[] SpRead(char c)
    {
        return Console.ReadLine().Split(c);
    }

}


Measured memory_bytes: 13396
using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using System.Globalization;
using System.IO;

namespace AOJ2
{
    class Program
    {
        private static StreamScanner sc = new StreamScanner(Console.OpenStandardInput());
        static void Main()
        {
            while (true)
            {
                var n = int.Parse(sc.Scan());
                if (n == 0) break;
                var m = int.Parse(sc.Scan());
                var points = new List<int>();
                points.Add(0);
                for (int i = 0; i < n; i++)
                {
                    points.Add(int.Parse(sc.Scan()));
                }
                points.Sort();
                var sum = new List<int>();
                for (int i = 0; i < points.Count ; i++)
                {
                    for (int j = i; j < points.Count; j++)
                    {
                        if (points[i] + points[j] <= m) sum.Add(points[i] + points[j]);
                    }
                }
                sum.Sort();
                var count =sum.Count -1;
                var ans = 0;
                for (int i = 0; i <= count; i++)
                {
                    while (sum[i] + sum[count] > m) count--;
                    if (ans < sum[i] + sum[count]) ans = sum[i] + sum[count];
                }
                Console.WriteLine(ans);
            }


        }

    }
    public class StreamScanner
    {
        public StreamScanner(Stream stream) { str = stream; }
        private readonly Stream str;
        private readonly byte[] buf = new byte[1024];
        private int len, ptr;
        private byte read()
        {
            if (ptr >= len)
            {
                ptr = 0;
                if ((len = str.Read(buf, 0, 1024)) <= 0)
                {
                    return 0;
                }
            }
            return buf[ptr++];
        }
        public char Char()
        {
            byte b = 0;
            do b = read();
            while (b < 33 || 126 < b);
            return (char)b;
        }
        public string Scan()
        {
            var sb = new StringBuilder();
            for (var b = Char(); b >= 33 && b <= 126; b = (char)read())
                sb.Append(b);
            return sb.ToString();
        }
    }
}

Measured memory_bytes: 11632
N, Q = [int(_) for _ in input().split()]
S = input()
LR = [[int(_) for _ in input().split()] for _ in range(Q)]

cumsum = [0] * (N + 10)
for i in range(N - 1):
    cumsum[i] = cumsum[i - 1]
    if S[i:i + 2] == 'AC':
        cumsum[i] += 1

for l, r in LR:
    print(cumsum[r - 2] - cumsum[l - 2])


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

using namespace std;

#define fio ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define int long long
#define double long double
#define endl '\n'

signed main() {
    fio;
    int n , k , sm = 0; cin >> n >> k;
    vector<int> a(n);
    for(int &it : a) {
        cin >> it;
    }
    sort(a.begin() , a.end());
    for(int i = 0; i < k; i++) {
        sm += a[i];
    }
    
    cout << sm << endl;
   
    
    
    return 0;
}




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

int main()
{
	string cc;
	cin >> cc;
	char a = cc[0];
	char b = cc[1];
	char c = cc[2];
	char d = cc[3];
	if (a == b || b == c || c == d)
		cout << "Bad";
	else
		cout << "Good";
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> T;
const long long INF = 1LL<<60;
// const int MOD = 1000000000+7;
#define rev(s) (string((s).rbegin(), (s).rend()))
// cout << fixed << setprecision(10) << ans << endl; 有効桁数指定
// *min_element(c + l, c + r) *max_element(c + l, c + r) 配列の中のmin-max
// int dx[8]={1,1,0,-1,-1,-1,0,1};
// int dy[8]={0,1,1,1,0,-1,-1,-1};
// int dx[4]={1,0,-1,0};
// int dy[4]={0,1,0,-1};
// ~ は、-1の時だけfalse

int main () {

    int n;cin>>n;

    ll curt,cura;

    rep(i,n) {
        ll t,a;cin>>t>>a;
        if (i==0) {
            curt=t;cura=a;
        } else {
            if (t>=curt&&a>=cura) {
                curt=t;cura=a;
                continue;
            }
            ll mult,mula;
            if (curt%t==0) mult=curt/t;
            else mult=curt/t+1;
            if (cura%a==0) mula=cura/a;
            else mula=cura/a+1;
            ll mul = max(mult,mula);
            curt=mul*t;cura=mul*a;
        }
    }

    cout<<curt+cura<<endl;


}

Measured memory_bytes: 384
// AtCoder template
// 最近sabaがかまってくれないからキレて暴れてる
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i = 0; i < n; ++i)

const ll MOD = 998244353;
ll comb[2*100001];

template<class T>
T pow(long long a, long long b, T mod){
    if(b == 0) return 1;
    if(b % 2 == 0){
        T d = pow(a,b/2,mod);
        return (d*d)%mod;
    }else return a%mod*pow(a,b-1,mod)%mod;
}

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

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

    // 前計算
    comb[0] = 1LL;
    rep(i,n-1){
        comb[i+1] = ((comb[i]*(n-1-i)%MOD)*pow(i+1,MOD-2,MOD))%MOD;
    }

    ll ans = 0LL;
    for(ll i = 0LL; i <= k; ++i){
        ans = (ans + (((m*pow(m-1,n-i-1,MOD))%MOD)*comb[i])%MOD)%MOD;
    }

    cout << ans << endl;
}

Measured memory_bytes: 5136
#pragma region head
    #include <bits/stdc++.h>
    using namespace std;
    using ll = long long;
    using vi = vector<int>;
    using vll = vector<ll>;
    using pi = pair<int, int>;
    using pll = pair<ll,ll>;
    template <class T> using vv = vector<vector<T>>;
    #define rep(i,n) for(int i = 0; i < (int)(n); i++)
    #define repi(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
    #define rrep(i,n) for(int i = (int)(n)-1; i >= 0; i--)
    #define rrepi(i,a,b) for(int i = (int)(b)-1; i >= (int)(a); i--)
    #define all(x) (x).begin(), (x).end()
    #define bit(n) (1LL<<(n))
    const int INF = 1002003004;
    const ll LINF = 1002003004005006007ll;
    struct preprocess{preprocess()
    {cin.tie(nullptr);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}}____;
#pragma endregion head

#pragma region library
#pragma endregion library

int main(){
    int n,a;  cin >> n >> a;
    vi x(n); rep(i,n) cin >> x[i];
    rep(i,n) x[i]-=a;
    const int rng = 2000;
    vll dp(rng);
    const int bias = 1000;
    dp[bias]=1;
    rep(i,n){
        if(x[i]>0){
            rrep(j,rng){
                if(j-x[i]>=0)dp[j]+=dp[j-x[i]];
            }
        } else if(x[i]<0){
            rep(j,rng){
                if(j-x[i]<rng)dp[j]+=dp[j-x[i]];
            }
        } else {
            rep(j,rng){
                dp[j]*=2;
            }
        }
    }
    cout<< dp[bias]-1 << endl;
    
}

Measured memory_bytes: 3652
#include <iostream>

using namespace std;

int main()
{
    int r;
    cin >> r;
    if (r < 1200)
    {
        cout << "ABC" << endl;
    }
    else if (r < 2800)
    {
        cout << "ARC" << endl;
    }
    else
    {
        cout << "AGC" << endl;
    }
}

Measured memory_bytes: 256
Scanf.scanf "%d" (fun n ->
    let rec loop i acc =
        if i > n then acc else
            let q = n / i in
            let acc = acc + i * q * (q + 1) / 2 in
            loop (i + 1) acc
    in
    loop 1 0 |> Printf.printf "%d\n"
)

Measured memory_bytes: 3808
#include <bits/stdc++.h>
using namespace std;
 
typedef long long LL;
typedef pair<int, int> pii;
 
#define fst first
#define snd second
#define pb push_back
#define REP(i, a, b)  for(int i = (a), i##end = (b); i < i##end; ++i)
#define DREP(i, a, b) for(int i=(a-1), i##end = (b); i >=i##end; --i)
 
template <typename T> bool chkmax(T& a, T b) { return a < b ? a = b, 1 : 0; }
template <typename T> bool chkmin(T& a, T b) { return a > b ? a = b, 1 : 0; }
 
const int N = 100000;
const int oo = 0x3f3f3f3f;
 
template<typename T> T read() {
    T n(0), f(1);
    char ch = getchar();
    for(;!isdigit(ch); ch = getchar()) if(ch == '-') f = -1;
    for(; isdigit(ch); ch = getchar()) n = n * 10 + ch - 48; 
    return n * f;
}

int n, m;
int deg[N + 5];

bool chk() {
    for(int i = 1; i <= n; ++i) {
        if(deg[i] & 1) return false;
    }
    return true;
}

int main() {
#ifdef Wearry
    freopen("data.txt", "r", stdin);
    freopen("ans.txt", "w", stdout);
#endif 

    scanf("%d%d", &n, &m);
    for(int i = 1; i <= m; ++i) {
        int a, b;
        scanf("%d%d", &a, &b);
        ++ deg[a], ++ deg[b];
    }

    printf(chk() ? "YES" : "NO");
    return 0;
}


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

using namespace std;
typedef long long ll;
void solve(int x){
  int f=0;
  int lim = 120;
  for(int a=-lim;a<=lim;a++){
    for(int b=-lim;b<=lim;b++){
      ll A = (ll)pow(a,5);
      ll B = (ll)pow(b,5);
      if(A-B==x){
        cout<<a<<" "<<b<<endl;
        f=1;
        break;
      }
    }
    if(f) break;
  }
}
int main(){
  int n;
  cin>>n;
  ll cnt=0;
  vector<ll> m,p;
  map< ll, ll> Mm ,Mp;

  for(int i=1;i<=n;i++){
    ll inp;
    cin>>inp;
    m.push_back(i-inp);
    p.push_back(i+inp);
  }
  
  for(int i=0;i<n;i++){
    Mm[m[i]]++;
    Mp[p[i]]++;
  }
  set<ll> ver;
  for(int i=0;i<n;i++){
    ll num = m[i];
    if(ver.count(num)==0)
      cnt+= (Mm[num]*Mp[num]);
    ver.insert(num);
  }
  cout<<cnt<<endl;
}

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

using namespace std;

#define allof(x) (x).begin(), (x).end()

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int MAXN = 4005;

int N;
int W[MAXN];
int B[MAXN];

struct BIT {
    int data[MAXN];
    void update(int pos, int val){
        while(pos < MAXN){
            data[pos] += val;
            pos += pos & -pos;
        }
    }

    int query(int pos){
        int ans = 0;
        while(pos){
            ans += data[pos];
            pos -= pos & -pos;
        }
        return ans;
    }
} ds;

//[W][B]
int dp[MAXN][MAXN];

int main(){
    cin.tie(0);
    cin.sync_with_stdio(0);

    cin >> N;
    for(int a = 1; a <= 2 * N; a++){
        char C;
        int A;
        cin >> C >> A;
        if(C == 'W'){
            W[A] = a;
        } else {
            B[A] = a;
        }
    }

    memset(dp, 0x3f, sizeof dp);

    dp[1][1] = 0;

    for(int w = 1; w <= N + 1; w++){
        for(int b = 1; b <= N + 1; b++){
            if(w != N + 1){
                dp[w + 1][b] = min(dp[w + 1][b], dp[w][b] + (b + w - 2) - ds.query(W[w]));
            }

            if(b != N + 1){
                dp[w][b + 1] = min(dp[w][b + 1], dp[w][b] + (b + w - 2) - ds.query(B[b]));
                ds.update(B[b], 1);
            }
        }

        for(int b = 1; b <= N; b++){
            ds.update(B[b], -1);
        }

        if(w != N + 1){
            ds.update(W[w], 1);
        }
    }

    cout << dp[N + 1][N + 1];
}


Measured memory_bytes: 62976
# include <algorithm>
# include <cassert>
# include <cctype>
# include <cstdio>
# include <cstdlib>
# include <cstring>
# include <cmath>
# include <iostream>
# include <map>
# include <queue>
# include <set>
# include <sstream>
# include <stack>
# include <string>
# include <vector>
# include <iomanip>

# define rep(i, n) for (int i = 0; i < (int)(n); i++)
# define irep(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++)

using namespace std;

int num = 0;

void merge(vector<int> &A, int left, int mid, int right) {
  int n1 = mid - left;
  int n2 = right - mid;
  vector<int> L(n1+1), R(n2+1);

  rep (i, n1) {
    L[i] = A[left+i];
  }
  rep (i, n2) {
    R[i] = A[mid+i];
  }

  L[n1] = 1001001001;
  R[n2] = 1001001001;

  int i = 0;
  int j = 0;

  for (int k = left; k < right; k++) {
    num++;
    if (L[i] <= R[j]) {
      A[k] = L[i];
      i++;
    }
    else {
      A[k] = R[j];
      j++;
    }
  }
}

void merge_sort(vector<int> &A, int left, int right) {
  if ((left+1) < right) {
    int mid = (left + right) / 2;
    merge_sort(A, left, mid);
    merge_sort(A, mid, right);
    merge(A, left, mid, right);
  }
}


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

  merge_sort(A, 0, n);
  
  cout << A[0];
  for(int i=1; i<n; i++) cout << ' ' << A[i];
  cout << endl;
  
  cout << num << endl;
}

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

using namespace std;

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(),v.end()
#define each(it,c) for(__typeof(c.begin()) it=c.begin(); it!=c.end(); it++)
#define INF 1<<30
#define mp make_pair
#define pb push_back

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
typedef vector<pair<int, int> > vp;
typedef map<int,int> mpii;
typedef priority_queue<int, vi, greater<int> > pqi;
typedef long long ll;

string k;

string itos(int N){
  stringstream ss;
  ss<<N;
  return ss.str();
}

bool ok(string s){
    bool f = true;
    rep(i,s.size()){
        rep(j,k.size()){
            f &= (s[i] != k[j]);
        }
    }
    return f;
}

int main(){
	int n,m;
    cin>>n>>m;
    k = "";
    rep(i,m){
        string t; cin>>t;
        k += t;
    }
    while(1){
        string ns = itos(n);
        if(ok(ns)){
            cout<<n<<endl;
            break;
        }
        n++;
    }
	return 0;
}

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

using namespace std;

#define REPI(x) for(int i=0;i<x;i++)
#define REPJ(x) for(int j=0;j<x;j++)
#define SCANFD(x) scanf("%d",&x)

int main(){
    int N;
    int a[200001];
    int b[200001];
    int buf;

    scanf("%d",&N);
    for(int i=1;i<=N;i++)
        scanf("%d",&a[i]);

    if(N%2==0){
        int i=0;
        buf=N;
        while(buf>0){
            b[i] = a[buf];
            buf -= 2;
            i++;
        }
        buf=1;
        while(buf<N+1){
            b[i] = a[buf];
            buf+=2;
            i++;
        }
    }else{
        int i=0;
        buf = N;
        while(buf>0){
            b[i] = a[buf];
            buf -= 2;
            i++;
        }
                    
        buf=2;
        while(buf<N+1){
            b[i] = a[buf];
            buf+=2;
            i++;
        }
    }
    
    for(int i=0;i<N;i++)
        printf("%d ",b[i]);

    printf("\n");

    return 0;
}
    

Measured memory_bytes: 3712
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();

        Integer[] A = new Integer[N * 3];
        for (int i = 0; i < 3 * N; i++) {
            A[i] = sc.nextInt();
        }
        Arrays.sort(A, Collections.reverseOrder());

        long sum=0;
        for (int i = 0; i < N; i++) {
            sum += A[i * 2 + 1];
        }

        System.out.printf("%d\n", sum);
        sc.close();
    }
}

Measured memory_bytes: 98836
Module Module1

    Sub Main()

        Dim N As Integer = CInt(Console.ReadLine())
        Dim S As String = Console.ReadLine()
        Dim ret As String

        ret = "No"

        If N Mod 2 = 0 Then
            If S = Left(S, N / 2) & Left(S, N / 2) Then

                ret = "Yes"

            End If
        End If

        Console.WriteLine(ret)

        ' Console.ReadLine()

    End Sub

End Module


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

int main(){
	int N,M;
	cin >> N>> M;
	int x, y;
	int ans = 1, red_point[100000] = {},value[100000];
	
	for (int i = 0;i < N;i++)
		value[i] = 1;

	red_point[0]++;
	for (int i = 0;i < M;i++) {
		cin >> x >> y;
		value[x - 1]--;
		value[y - 1]++;
		if (red_point[x - 1] == 1 ) {
			red_point[y - 1] ++;
			if (value[x - 1] == 0) {
				ans--;
				red_point[x - 1] = 0;
			}
			if (red_point[y - 1] != 2)
				ans++;

			red_point[y - 1] = 1;
		}
	}
	cout << ans << "\n";
	return 0;
}

Measured memory_bytes: 1024
import sys
STRING = ""
for line in sys.stdin:
    STRING += line.lower()
CHRS = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',\
         'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
for i in CHRS:
    print("%s : %d" % (i, STRING.count(i)))

Measured memory_bytes: 7452
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define rep1(i,n) for(int i=1;i<=(int)n;i++)
#define sp(n) cout << fixed << setprecision(n)
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; }
typedef long long ll;
using namespace std;
const ll mod = 1000000007;
long long modpow(long long a, long long n){
  long long r = 1;
  while (n) {
    r = r * ( (n%2)?a:1 ) %mod;
    a = a * a % mod;
    n >>= 1;
  }
  return r;
}
int main(void){
    ll n;cin>>n;
    ll res=modpow(10,n),buf1=modpow(9,n),buf2=modpow(8,n);
    res=(res+mod-buf1)%mod;
    res=(res+mod-buf1)%mod;
    res=(res+buf2)%mod;
    cout<<res<<endl;
}

Measured memory_bytes: 3568
#include <iostream>
#include <cmath>
using namespace std;
bool is_prime(int n){
	if (n<=1) return false;
	int m=int(floor(sqrt(n)+0.5));
	for (int i=2;i<=m;++i){
		if (n%i==0) return false;
	}
	return true;
}
int main(){
	int n,x,count=0;
	cin>>n;
	for (int i=1;i<=n;++i){
		cin>>x;
		if (is_prime(x)) ++count; 
	}
	cout<<count<<endl;
	return 0;
}

Measured memory_bytes: 3044
# -*- coding: utf-8 -*-


N = int(input())
A = [int(i) for i in input().split()]

counter = -1
flag = 0
while flag == 0:
    for i in A:
        if (i%2 == 0):
            continue
        else:
            flag = 1
    counter += 1
    A = [i//2 for i in A]

print(counter)


Measured memory_bytes: 2940
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 m = sc.NextLong();
        long k = sc.NextLong();

        for (long i = 0; i <= n; i++)
        {
            for (long j = 0; j <= m; j++)
            {
                long black = i * m + j * n - (i * j * 2);
                if (black == k)
                {
                    Console.WriteLine("Yes");
                    return;
                }
            }
        }

        Console.WriteLine("No");
    }

    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: 27532
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
using namespace std;

#define DN          int main()
#define li          long long int
#define test()      int t;cin>>t;while(t--)
#define fast()      ios_base::sync_with_stdio(false);cin.tie(NULL);

#define DEC         int i,n,j,cnt=0,flag;
#define mx          100005

#define ff(s,e)         for(i=s;i<e;i+=r)
#define bf(s,e)         for(i=s;i>e;i-=r)
#define ff2(j,s,e,r)    for(j=s;j<e;j+=r)
#define bf2(j,s,e,r)    for(j=s;j>e;j-=r)

void inline inout()
{
    #ifndef ONLINE_JUDGE
    freopen("F:/Problem Solving/Online judges/input.txt","r",stdin);
    freopen("F:/Problem Solving/Online judges/output.txt","w",stdout);
    #endif
}


DN
{
    fast();
    //inout();

    char st[3];
    int num,mxr;
    
    cin>>st;
    num=mxr=0;
    for(int i=0;i<3;i++)
    {
      num=0;
      while(st[i]=='R')
      {
        i++;
        num++;
      }
      if(num>mxr)
      mxr=num;
        
    }

  cout<<mxr<<endl;
    return 0;
}


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

int main() {
	string s;
  	cin >> s;
    bool existc = false;
  	if(s[0] != 'A')	goto wr;
  	if(s[1] < 'a' || s[1] > 'z') goto wr;
 	for(int i = 2; i< s.size()-1 ;i++) {
    	if(s[i] == 'C' && !existc) {
         	existc = true;
          	continue;
        } else if(s[i] == 'C' && existc) {
			goto wr;
        } else if(s[i] <'a' || s[i] > 'z'){
          	goto wr;
        }
    }
  	if(s[s.size()-1] <'a' || s[s.size()-1] > 'z') goto wr;
  	if(!existc) goto wr;
  
    cout << "AC" << endl;
  	return 0;
wr:
   cout << "WA" << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>

using namespace std;

#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ; //何もしない文
#endif

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size()) //unsignedのサイズをint型に変換
#define pb push_back

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

template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

void chmin(int &a, int b) { if (a > b) a = b; }

const int MOD = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;
int N,A,B,C;
VI l;

int dfs(int cur, int a, int b, int c)
{
    if(cur == N)
    {
        if(a != 0 && b != 0 && c != 0)
        {
            return abs(a - A) + abs(b - B) + abs(c - C);
        }
        else
        {
            return INF;
        }
    }

    int res = dfs(cur+1, a,b,c);

    chmin(res, dfs(cur+1, a+l[cur], b, c) + (a ? 10 : 0));
    chmin(res, dfs(cur+1, a, b+l[cur], c) + (b ? 10 : 0));
    chmin(res, dfs(cur+1, a, b, c+l[cur]) + (c ? 10 : 0));

    return res;
}

//ここから書き始める
int main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);	
    cin >> N >> A >> B >> C;
    l.resize(N);
    REP(i,N)
    {
        cin >> l[i];
    }

    cout << dfs(0,0,0,0) << endl;


}


Measured memory_bytes: 256
if __name__ == "__main__":
    r = int(input())

    # 半径１の面積 = 1 * 1 * pi
    # 半径ｒの面積 = r * r * pi
    # 半径 r の円の面積が半径 1 の円の面積の何倍になるか = (r*r*pi)/(1*1*pi) = r * r

    print(r*r)

Measured memory_bytes: 9076
import std.stdio, std.string, std.conv, std.algorithm, std.numeric;
import std.range, std.array, std.math, std.typecons, std.container, core.bitop;

int[] di = [1,0,-1,0], dj = [0,1,0,-1];
int ans;

void main() {
    while (1) {
        int w, h;
        scan(w, h);

        if (!w) return;

        auto bd = iota(h).map!(i => readln.chomp.to!(char[])).array;
        int si, sj;

        foreach (i ; 0 .. h) {
            foreach (j ; 0 .. w) {
                if (bd[i][j] == '@') {
                    si = i, sj = j;
                    break;
                }
            }
        }

        ans = 0;
        dfs(h, w, bd, si, sj);

        writeln(ans);
    }
}

void dfs(int h, int w, char[][] bd, int i, int j) {
    ans++;
    bd[i][j] = '#';

    foreach (k ; 0 .. 4) {
        int ni = i + di[k];
        int nj = j + dj[k];

        if (ni < 0 || ni >= h || nj < 0 || nj >= w) continue;

        if (bd[ni][nj] == '.') {
            dfs(h, w, bd, ni, nj);
        }
    }

}


void scan(T...)(ref T args) {
    string[] line = readln.split;
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}


void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

Measured memory_bytes: 2632
#include<iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cstdio>
#include<queue>
using namespace std;

int main(){
    string w;
    cin>>w;
    int c[26];
    for(int i=0;i<26;i++) c[i]=0;
    for(int i=0;i<w.size();i++){
        int j=w[i]-'a';
        c[j]++;
    }

    bool isBeautiful=true;
    for(int i=0;i<26;i++){
        if(c[i]%2==1){
            isBeautiful=false;
        }
    }
    if(isBeautiful) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 760
H, W = map(int, input().split())
A = [''] * H
for i in range(H):
    A[i] = input()
x, y = 0, 0
while True:
    if (x < H-1 and A[x+1][y] == '#') and (y < W-1 and A[x][y+1] == '#'):
        print('Impossible')
        exit()
    elif (x > 0 and A[x-1][y] == '#') and (y > 0 and A[x][y-1] == '#'):
        print('Impossible')
        exit()
    elif x == H-1 and y == W-1:
            print('Possible')
            exit()
    elif (x == H-1 or A[x+1][y] == '.') and (y == W-1 or A[x][y+1] == '.'):
        print('Impossible')
        exit()
    elif x < H-1 and A[x+1][y] == '#':
        x += 1
        continue
    elif y < W-1 and A[x][y+1] == '#':
        y += 1
        continue

Measured memory_bytes: 9152
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> lpair;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define print2(x,y) cout << (x) << " " << (y) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " ";} cout<<endl;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S;
    cin >> S;
    ll cnt_A = 0;
    ll ans = 0;
    ll N = S.size();
    ll is_B = 0;
    ll idx = 1;
    if(S[0] == 'A') cnt_A++;
    while(1){
        if(idx >= N) break;
        if(S[idx] == 'A'){
            cnt_A++;
            idx++;
        }else if(idx <= N-2 && S[idx] == 'B' && S[idx + 1] == 'C'){
            if(cnt_A > 0) ans += cnt_A;
            idx += 2;
        }else{
            cnt_A = 0;
            idx++;
        }

    }
    print(ans);

    
}

Measured memory_bytes: 720
/*
  Contest 064
  A - RGB Cards
  Rakesh Kumar --> 31/08/2020
 */

#include <bits/stdc++.h>

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

    int n = 0;
    for (int i = 0; i < 3; ++i) {
        int a = 0;
        std::cin >> a;
        n = (n * 10) + a;
    }
    std::cout << (n % 4 ? "NO" : "YES") << std::endl;

    return 0;
}


Measured memory_bytes: 3648
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String W = sc.nextLine();
		W = W.toLowerCase();
		int count = 0;
		for(int i=0;;i++) {
			String T = sc.next();
			if(T.equalsIgnoreCase(W)) {
				count++;
				i++;
			}
			if(T.equals("END_OF_TEXT")) break;

		}
		System.out.println(count);
	}
}



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

//降順
int des(const void *a, const void *b)
{
  return *(long *)b - *(long *)a;
}

int main() {
  int N, A, B;
  cin >> N >> A >> B;
  long h[N];
  for (int i=0; i<N; i++)
    cin >> h[i];
  qsort(h, N, sizeof(long), des);
  long b = 0, t = 1000000000;
  while (t-b > 1) {
    long m = (t+b)/2, cnt = 0;
    for (int i=0; i<N; i++) {
      if (h[i]-m*B<=0)
        continue;
      cnt += (h[i]-m*B-1)/(A-B)+1;
    }
    if (cnt <= m)
      t = m;
    else
      b = m;
  }
  cout << t << endl;
  return 0;
}

Measured memory_bytes: 1788
#include<bits/stdc++.h>
//ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> ppll;
typedef pair<ll,pll> plpl;
typedef tuple<ll,ll,ll> tl;
ll mod=1000000007;
ll mod2=998244353;
ll mod3=1000003;
ll mod4=998244853;
ll inf=1LL<<60;
long double pi=3.14159265358979323846L;
double eps=1e-12;
#define rep(i,m,n) for(ll i=m;i<n;i++)
#define rrep(i,n,m) for(ll i=n;i>=m;i--)
#define srep(itr,st) for(auto itr=st.begin();itr!=st.end();itr++)
int dh[4]={1,-1,0,0};
int dw[4]={0,0,1,-1};
int ddh[8]={-1,-1,-1,0,0,1,1,1};
int ddw[8]={-1,0,1,-1,1,-1,0,1};
ll gcd(ll a,ll b){
    if(a<b)swap(a,b);
    if(b==0)return a;
    if(a%b==0)return b;
    return gcd(b,a%b);
}
ll Pow(ll n,ll k){
    ll ret=1;
    ll now=n;
    while(k>0){
        if(k&1)ret*=now;
        now*=now;
        k/=2;
    }
    return ret;
}
ll gya[1000010];
ll kai[1000010];
ll beki(ll n,ll k,ll md){
  ll ret=1;
  ll now=n;
  while(k>0){
    if(k%2==1){
      ret*=now;
      ret%=md;
    }
    now*=now;
    now%=md;
    k/=2;
  }
  return ret;
}
ll gyaku(ll n,ll md){
  return beki(n,md-2,md);
}
void nckinit(ll n,ll md){
  kai[0]=1;
  kai[1]=1;
  for(int i=2;i<=n;i++){
    kai[i]=kai[i-1]*i;
    kai[i]%=md;
  }
  gya[n]=gyaku(kai[n],md);
  for(int i=n-1;i>=1;i--){
    gya[i]=gya[i+1]*(i+1);
    gya[i]%=md;
  }
  gya[0]=1;
}
ll nck(ll n,ll k,ll md){
  if(k<0)return 0;
  if(k==0||n==k)return 1;
  ll ret=kai[n];
  ret*=gya[n-k];
  ret%=md;
  ret*=gya[k];
  ret%=md;
  return ret;
}
ll npk(ll n,ll k,ll md){
  if(k<0)return 0;
  if(k==0)return 1;
  ll ret=kai[n];
  ret*=gya[n-k];
  ret%=md;
  return ret;
}
int main(){
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    ll n;cin>>n;
    ll a[n+1];
    int num;
    int cnt[n+1];
    fill(cnt,cnt+n+1,0);
    rep(i,0,n+1){
        cin>>a[i];
        cnt[a[i]]++;
        if(cnt[a[i]]==2)num=a[i];
    }
    nckinit(n+10,mod);
    ll l=0,r=0;
    rep(i,0,n+1){
        if(a[i]==num)break;
        l++;
    }
    rrep(i,n,0){
        if(a[i]==num)break;
        r++;
    }
    rep(i,1,n+2){
        ll ans=nck(n+1,i,mod);
        ll hi=0;
        if(i-1<=l+r)hi=nck(l+r,i-1,mod);
        ans=ans-hi+mod;
        cout<<ans%mod<<endl;
    }
}







Measured memory_bytes: 7296
#include<bits/stdc++.h>
using namespace std;
/* Author : Ravikumar Navale */
#define fastIo() ios_base :: sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr)
#define pb push_back
#define endl  "\n"
typedef long long int ll;
vector<pair<ll,ll> >v1, v2, v3;
const ll MOD = 1e9 + 7;
const double peek = 1e7 ;

int main()
{
    fastIo();
    ll N, K;
    cin>> N ;
    ll A[N+1][4];
    ll DP[N+1][4];
    
    
    for(ll i= 1; i<=N ;i++)
        cin >> A[i][1] >> A[i][2] >>A[i][3];
    
    DP[1][1] = A[1][1];
    DP[1][2] = A[1][2];
    DP[1][3] = A[1][3];
    
    for(ll i= 2; i <= N ; i++)
    {
        DP[i][1] = max(DP[i-1][2],DP[i-1][3]) + A[i][1];
        DP[i][2] = max(DP[i-1][1],DP[i-1][3]) + A[i][2];
        DP[i][3] = max(DP[i-1][2],DP[i-1][1]) + A[i][3];
        
    }
    
    cout << max(DP[N][1],max(DP[N][2],DP[N][3]));
    
    
    
}

Measured memory_bytes: 6528
using System;

namespace abc050_a
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] x = Console.ReadLine().Split();
            int a = int.Parse(x[0]);
            int b = int.Parse(x[2]);
            if(x[1]=="+")
            {
                Console.WriteLine(a + b);
            }
            else
            {
                Console.WriteLine(a - b);
            }
            Console.ReadLine();
        }
    }
}

Measured memory_bytes: 2648
using System;
using System.Collections.Generic;
using System.Linq;

class Program {
    static string ReadLine() { return Console.ReadLine(); }
    static int ReadInt() { return int.Parse(ReadLine()); }
    static int[] ReadInts() { return ReadLine().Split().Select(int.Parse).ToArray(); }
    static string[] ReadStrings() { return ReadLine().Split(); }

    static void Swap(ref int a, ref int b) {
        var t = a;
        a = b;
        b = t;
    }

    static String Join<T>(string sep, IEnumerable<T> iter) {
        return string.Join(sep, iter.Select(e => e.ToString()).ToArray());
    }

    static int Partition(int[] xs) {
        int n = xs.Length;
        int pibot = xs[n-1];

        int less = 0; // pibot ??\????????????????´?????????????
        for (int i = 0; i < n-1; i++) {
            if (xs[i] <= pibot) {
                Swap(ref xs[less], ref xs[i]);
                less++;
            }
        }

        // pibot ??????????????????
        Swap(ref xs[less], ref xs[n-1]);
        return less;
    }

    static void Main() {
        ReadInt();
        var xs = ReadInts();

        int p = Partition(xs);
        var ys = xs.Select((e, i) => i == p ? "[" + e.ToString() + "]" : e.ToString());
        Console.WriteLine(Join(" ", ys));
    }
}

Measured memory_bytes: 17240
#if 1
#include <iostream>

int main() {
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(nullptr);
    std::cout.tie(nullptr);

#if DEBUG_ON
    freopen("input", "r", stdin);
#endif

    int a, b;
    std::cin >> a >> b;
    bool found = false;
    for (int i = 0; i < 100000 && !found; ++i) {
        if (((int) (0.08 * i)) == a && ((int) (0.1 * i)) == b) {
            std::cout << i << '\n';
            found = true;
        }
    }
    if (!found) {
        std::cout << "-1\n";
    }
    return 0;
}
#endif

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

/**
 * Common Sub-String
 */
public class Main {

	public static void main(String[] args) throws IOException {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line;
		String[] words;

		while ((line = br.readLine()) != null && !line.isEmpty()) {

			char[] s1 = line.toCharArray();
			char[] s2 = br.readLine().toCharArray();

			int[][] cs = new int[s2.length][s1.length];

			//
			for (int i = 0; i < s1.length; i++) {
				if (s1[i] == s2[0]) cs[0][i] = 1;
			}

			for (int i = 0; i < s2.length; i++) {
				if (s2[i] == s1[0]) cs[i][0] = 1;
			}

			int max = 0;
			for (int i = 1; i < s2.length; i++) {
				for (int j = 1; j < s1.length; j++) {
					if (s2[i] == s1[j]) {
						cs[i][j] = cs[i - 1][j - 1] + 1;
						max = Math.max(max, cs[i][j]);
					}
				}
			}
			System.out.println(max);

		}//end while
	}//end main
}

Measured memory_bytes: 272784