akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <stack>
#include <string>
using namespace std;

int main(){
	while(1){		
		string str;
		getline(cin, str);
		if(str[0] == '.') break;
	/*	//string::iterator ite = str.end()--;
		if(str[str.size()-1] != '.'){
			while(1){
				string s;
				cin >> s;
				str.append(s);
				//ite = s.end()--;
				if(s[s.size()-1] == '.') break;
			}
		}
*/
		stack<char> sta;
		string s = "yes";
		for(int i = 0;str[i] != '.'; i++){
			if(str[i] == '(' || str[i] == '['){
				sta.push(str[i]);
			}else if(str[i] == ')'){
				if(sta.empty()){
					s = "no"; break;
				}
				if(sta.top() == '('){
					sta.pop();
				}else{
					s = "no"; break;
				}
			}else if(str[i] == ']'){
				if(sta.empty()){
					s = "no"; break;
				}
				if(sta.top() == '['){
					sta.pop();
				}else{
					s = "no"; break;
				}
			}
		}
		if(!sta.empty()) s = "no";

		cout << s << endl;
	}
	return 0;
}

Measured memory_bytes: 1184
Public Class Program
  Shared Sub Main()
    Dim n As Integer = Cin.Int()
    Dim p As Integer() = Cin.IntArr()
    Dim ans As Integer = 1
    Dim pre As Integer = p(0)
    For i As Integer = 1 To n - 1
      If p(i) < pre Then
        ans += 1
        pre = p(i)
      End If
    Next
    Console.WriteLine(ans.ToString())
  End Sub
End Class

Public Class Cin
  Public Shared Function Str() As String
    Return Console.ReadLine().Trim()
  End Function
  Public Shared Function Int() As Integer
    Return Integer.Parse(Str())
  End Function
  Public Shared Function Lng() As Long
    Return Long.Parse(Str())
  End Function
  Public Shared Function Dbl() As Double
    Return Double.Parse(Str())
  End Function
  Public Shared Function StrArr(Optional separator As String = " ") As String()
    Return Str().Split(separator)
  End Function
  Public Shared Function IntArr(Optional separator As String = " ") As Integer()
    Return Array.ConvertAll(Of String, Integer)(StrArr(separator), AddressOf Integer.Parse)
  End Function
  Public Shared Function LngArr(Optional separator As String = " ") As Long()
    Return Array.ConvertAll(Of String, Long)(StrArr(separator), AddressOf Long.Parse)
  End Function
  Public Shared Function DblArr(Optional separator As String = " ") As Double()
    Return Array.ConvertAll(Of String, Double)(StrArr(separator), AddressOf Double.Parse)
  End Function
End Class

Measured memory_bytes: 31620
def main():
    S = input()
    length = len(S)
    S1 = S[0:int((length-1)/2)]
    S2 = S[int((length+3)/2-1):length]
    ans = "Yes"
    for i in range(len(S)):
        if S[i] != S[-i-1]:
            ans = "No"
            break
    for i in range(len(S1)):
        if S1[i] != S1[-i-1]:
            ans = "No"
            break
    for i in range(len(S2)):
        if S2[i] != S2[-i-1]:
            ans = "No"
            break
    print(ans)

if __name__ == "__main__":
    main()

Measured memory_bytes: 3064
using System;
class main
{
    static void Main(string[] args)
    {
        while (true)
        {
            string s = Console.ReadLine();
            if (s != null)
            {
                    string[] t = s.Split(' ');
                    int a = int.Parse(t[0]);
                    int b = int.Parse(t[1]);
                    int c = a + b;
 
                    Console.WriteLine(c.ToString().Length);
            }
            if (s == null)
            {
                break;
            }
        }
    }
}

Measured memory_bytes: 5584
//in the name of god
//if you read this code please search about imam hussain
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

#define pb push_back
#define endl "\n"
#define X first
#define Y second
#define pii pair<int,int>
#define migmig ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define read freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout)

const int maxn=1e5+5;
const int mod=1e9+7;
const int inf=1e9;
const int del=728729;

ll poww(ll a, ll b, ll md) {return (!b ? 1 : (b & 1 ? a * poww(a * a % md, b / 2, md) % md : poww(a * a % md, b / 2, md) % md));}
int gcd(int a, int b) {
	if (a == 0)
		return b;
	return gcd(b % a, a);
}
int main(){
	migmig;
	ll a;
	ll b;
	cin >> a >> b;
	cout<<a*b/gcd(a,b);
	return 0;
}



Measured memory_bytes: 256
def main28():
    import sys
    N, M = (int(x) for x in input().split())

    if N >= M:
        S = input()
        T = input()
    else:
        T = input()
        S = input()

    def lcm(n, m):
        gcd = 0
        for i in range(1, min(n, m) + 1):
            if n % i == 0 and m % i == 0:
                gcd = i

        return int(n * m / gcd)

    LCM = lcm(N, M)

    a = int(LCM / max(N, M))
    b = int(LCM / min(N, M))

    for i in range(min(N, M)):
        small_index = i * b
        if int(small_index % a) == 0:
            if S[int(small_index / a)] != T[i]:
                print("-1")
                sys.exit()
    print(LCM)

main28()

Measured memory_bytes: 3316
#include <iostream>
#include <limits>

int main()
{
	long long N, K;
	std::cin >> N >> K;
	long long mod = N % K;
	long long tmp = std::numeric_limits<long long>::max();
	if (mod <= K) {
		tmp = std::abs(mod - K);
	}
	std::cout << (tmp < mod ? tmp : mod);
}

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

int main()
{
    string s;
    string t;
    int i = 0, j = 0, sub = 0;
    cin >> s >> t;
    for(i = 0; i < s.size(); i++)
    {
        if(s == t)
        {
            cout << "Yes";
            i = -1;
            break;
        }
        for(j = 0; j < s.size(); j++)
        {
            if(j == 0)
            {
                sub = s[j];
                continue;
            }
            s[j - 1] = s[j];
        }
        s[s.size() - 1] = sub;
    }
    if(i != -1)
    {
        cout << "No";
    }
return 0;
}


Measured memory_bytes: 256
#include<cstdio>

int main(){
	char s[200];
	char p[100];
	char t ;
	int c = 0;
	scanf("%c", &t);
	while(t - 10){
		s[c] = t;
		c++;
		scanf("%c", &t);
	}

	int a = 0;
	scanf("%c", &t);
	while(t - 10){
		p[a] = t;
		a++;
		scanf("%c", &t);
	}

	for(int i = 0; i < c; i++){
		s[i + c] = s[i];
		int j;
		for(j = 0; j < a; j++){
			if(p[j] - s[j + i]){
				j += a;
			}
		}
		if(j == a){
			printf("Yes\n");
			return 0;
		}
	}
	printf("No\n");
	return 0;
}

Measured memory_bytes: 944
#include <bits/stdc++.h>
#define ll long long
#define MODV 1000000007
#define INF INT_MAX // 2147483647
#define INFLL LLONG_MAX // 9223372036854775807
#define rep(i, n) for(ll i=0, i##_len=(ll)(n); i<i##_len; i++)
#define repf(i, n) for(ll i=1, i##_len=(ll)(n+1); i<i##_len; i++)
#define per(i, n) for(ll i=((ll)(n))-1; i>=0; i--)
#define perf(i, n) for(ll i=((ll)(n)); i>0; i--)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
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; }
using namespace std;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(10);
    string s, t;
    cin >> s >> t;
    if(s.size()+1 == (t.size()) && s.substr(0, s.size()) == t.substr(0, s.size())) Yes();
    else No();
}

Measured memory_bytes: 3640
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int k = sc.nextInt();
    int a = sc.nextInt();
    int b = sc.nextInt();
    if(a+2>=b){
      System.out.println(k+1);
      return;
    }
    int count = 0;
    long bis = 1l;
    while(a>bis){
      count++;
      bis++;
    }
    while(k-1>count){
      count+=2;
      bis += b-a;
    }

    while(k>count){
      count++;
      bis++;
    }
    System.out.println(bis);
  }
}


Measured memory_bytes: 35504
n = int(input())
data = []
for i in range(n):
    data.append(list(map(int, input().split())))

memo = []
for _ in range(n):
    memo.append([-1]*n)


def mul(i, j):
    if i == j:
        return 0
    if memo[i][j] >= 0:
        return memo[i][j]
    num = 100000
    for k in range(i, j):
        num = min(num, mul(i, k) + mul(k+1, j) + data[i][0] * data[k][1] * data[j][1])
    memo[i][j] = num
    return memo[i][j]

print(mul(0, n-1))


Measured memory_bytes: 5716
#include<bits/stdc++.h>
using namespace std;
const int mxn = 1e5+5;
long long a[mxn] , b[mxn] , h;
int n;

bool check(long long move)
{
	long long tmp = 0;
	int ai = n-1 , bi = n-1;
	while(move)
	{
		if(b[bi] > a[ai])
		{
			tmp += b[bi];
			bi--;
			move--;
		}
		else
		{
			tmp += move*a[ai];
			move = 0;
		}
	}
	if(tmp >= h) return true;
	else return false;
}

int main()
{
	cin>>n;
	cin>>h;
	for(int i = 0; i < n; i++)
	{
		cin>>a[i]>>b[i];
	}
	sort(a , a+n);
	sort(b , b+n);
	long long left = 0 , right = h , ans , mid;
	while(left <= right)
	{
		mid = (left + right) >> 1;
		if(check(mid))
		{
			ans = mid;
			right = mid-1;
		}
		else
		{
			left = mid+1;
		}
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#define endl "\n"
#define ll long long
#define mod 1000000007
using namespace std;

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

    ll ans = 0;
    for(ll i = k; i <= n + 1; i ++)
    {
    	ll low = (i * (i - 1)) / 2;
    	ll high = (i * (n + n - i + 1)) / 2;
    	// cout << low << " " << high << endl;
    	ans = (ans % mod + high % mod - low % mod + 1 + mod) % mod;
    }
    cout << ans << endl;
    // ll ans = k * fastExp(10, 100);

}

Measured memory_bytes: 3636
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Scanner;
import java.util.Set;

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

		long ans = 1000;

		int[] ai = new int[n];
		for (int i = 0; i < n; i++) {
			ai[i] = sc.nextInt();
		}		
		for (int i = 0; i < n-1; i++) {
			if( ai[i] < ai[i+1] ) {
				long stock = ans / ai[i];
				ans += (ai[i+1] - ai[i]) * stock;  
			}
		}
		
		System.out.println(ans);
		
	}
}


Measured memory_bytes: 35792
import bisect

LENGTH = 1000000


def eratosthenes(length):
    from math import sqrt

    def is_prime_number(num):
        limit = int(sqrt(num)) + 1

        for lp in range(3, limit, 2):
            if num % lp == 0:
                return False

        return True

    is_prime_number_list = [True] * (LENGTH + 1)
    is_prime_number_list[0] = False
    is_prime_number_list[1] = False
    is_prime_number_list[2] = True

    for index in range(4, length + 1, 2):
        is_prime_number_list[index] = False

    limit = int(sqrt(length)) + 1

    for lp in range(3, limit, 2):
        if is_prime_number(lp):

            for index in range(lp * 2, length + 1, lp):
                is_prime_number_list[index] = False

    return is_prime_number_list


is_prime_number_list = eratosthenes(LENGTH)
prime_number_list = [index for index, item in enumerate(is_prime_number_list) if item]

while True:
    input_count = int(input())

    if input_count == 0:
        break

    pay = 0

    for _ in range(input_count):
        p, m = [int(item) for item in input().split(" ")]

        lower = p - m if 0 < p - m else 0
        upper = p + m if p + m < LENGTH else LENGTH

        lower_index = bisect.bisect_left(prime_number_list, lower)
        upper_index = bisect.bisect_right(prime_number_list, upper)

        prize = upper_index - lower_index
        pay += prize - 1

    print(pay)



Measured memory_bytes: 16672
def main():
    h, w = map(int, input().split())
    n = int(input())
    a = list(map(int, input().split()))

    grid = [[0 for j in range(w)] for i in range(h)]
    i, j, idx = 0, 0, 0
    while idx < n:
        while 0 < a[idx]:
            grid[i][j] = idx + 1
            a[idx] -= 1

            if i % 2 == 0:
                j += 1
                if j == w:
                    j = w - 1
                    i += 1
            else:
                j -= 1
                if j == -1:
                    j = 0
                    i += 1
        idx += 1

    for i in range(h):
        print(" ".join([str(j) for j in grid[i]]))


if __name__ == '__main__':
    main()


Measured memory_bytes: 3568
#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;

const int MOD=1000000007;
const int INF=0x3f3f3f3f;
const ll INFL=0x3f3f3f3f3f3f3f3f;

#include <atcoder/math>
using namespace atcoder;

int main(){
	int T;cin>>T;
	rep(Case,T){
		ll n,m,a,b;cin>>n>>m>>a>>b;
		cout<<floor_sum(n,m,a,b)<<endl;
	}
}

Measured memory_bytes: 3592
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <string>
#include <cstring>
#include <sstream>
#include <cmath>
#include <functional>
#include <fstream>
#include <cstdlib>
typedef long long ll;
const ll MOD = 1e9+7;


#define REP(i, N) for (ll i = 0; i < (N); i++)
#define REPP(i, a, b) for (ll i = (a); i < (b); i++)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define VSORT(c) sort((c).begin(),(c).end())
#define SZ(x) ((ll)(x).size())
//vvintを作る　マクロで　 #define vvint(N,M) vector<vector<ll>>

using namespace std;
bool cmp(pair<int,int> a , pair<int,int> b){
    if(a.first == b.first){
        return a.second > b.second;
    }
    return a.first < b.first;
}


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

    int n,m;
    cin >> n >> m;
    vector<pair<int,int> > o;
    for(ll i = 0; i < m;i++){
        int a,b;
        cin >> a >> b;
        o.push_back(make_pair(a,b));
    }
    ll ans = 1;
    sort(ALL(o),cmp);
    int r = o[0].second;
    for(ll i = 0; i < m;i++){
        if(r <= o[i].first){
            ans++;
            r = o[i].second;
        }else{
            r = min(r,o[i].second);
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1400
#include <iostream>
#include <iomanip>
#include <string>
#include <map>
#include <math.h>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <set>
#include <queue>
#include <sstream>
#include <stack>
#include <deque>
#include <memory.h>
#include <cassert>
#include <ctime>
#include <climits>
#include <list>
#include <time.h>
#include <unordered_map>
#include <bitset>
#include <exception>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef unsigned long long ull;
#define pb push_back
#define mp make_pair
#define FILE "file"
#define lc v << 1
#define rc (v << 1) + 1
#define inf 1e+9
#define linf ll(1e+18)
#define dinf 1e+14

typedef long long ll;
#define pb push_back
#define mp make_pair


void solve()
{
    int n;
    cin >> n;
    ll a = 2, b = 1;
    for(int i = 2; i <= n; i++)
    {
        ll c = a + b;
        a = b;
        b = c;
    }
    cout << b;
}

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0), cout.tie(0);
    //freopen(FILE ".in", "r", stdin);freopen(FILE ".out", "w", stdout);
    //freopen("file.in", "r", stdin);freopen("file.out", "w", stdout);
    int t = 1;
    //cin >> t;
    
    while(t--)
    {
        solve();
    }
    
    return 0;
}


Measured memory_bytes: 256
// In god we trust
 
#include <bits/stdc++.h>
#include <chrono>
#include <algorithm>
#include <signal.h>
#include <thread>
#include <pthread.h>
#include <omp.h>
 
#define pb push_back
#define fi first
#define se second
#define Vi vector<int>
#define Vb vector<bool>
#define Pi pair<int, int>
#define MP make_pair
#define MT make_tuple
#define Q queue
#define Qi Q<int>
#define INF 1000000000 
#define LINF 1000000000000000000
#define int long long
using namespace std;
using namespace std::chrono;

unordered_map<int, int> factor(int n){
  int cnt = 0;
  unordered_map<int, int> m;
  int nn = n;
  while (!(nn & 1))
    cnt++, nn /= 2;
  if(cnt)
    m[2] = cnt;
  for (int i = 3; i <= sqrt(n); i++){
    cnt = 0;
    while(nn % i == 0)
      nn /= i, cnt++;
    if (cnt)
      m[i] = cnt;
  }
  if (nn > 2)
    m[nn] = 1;
  
  return m;
}

signed main(){
  ios_base::sync_with_stdio(false); 
  cin.tie(NULL);
  string c;
  cin >> c;
  if (c >= "A" and c <= "Z")
    cout << "A" << endl;
  else
    cout << "a" << endl;
}


Measured memory_bytes: 3688
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
typedef long long ll;
typedef unsigned long long ull;
typedef long double LD;
using namespace std;
const int INF = 2147483647;
const int INF2 = 0x3f3f3f3f;
const ll INF64 = 3e18;
const double INFD = 1e30;
const double EPS = 1e-9;
const double PI = acos(-1);
const int MOD = 998244353;
template <typename T>
inline T read() {
    T X = 0, w = 0;
    char ch = 0;
    while (!isdigit(ch)) {
        w |= ch == '-';
        ch = getchar();
    }
    while (isdigit(ch)) X = (X << 3) + (X << 1) + (ch ^ 48), ch = getchar();
    return w ? -X : X;
}
const int MAXN = 200005;
int n, m, k;
int dr[4] = {1, 0, -1, 0};
int dc[4] = {0, 1, 0, -1};
int dr2[8] = {1, 1, 1, -1, -1, -1, 0, 0};
int dc2[8] = {1, 0, -1, 1, 0, -1, 1, -1};
int CASE = 1;
int fastExp(ll x, ll p, int mod) {
    if (p == 0) return 1;
    if (p < 0) return 0;
    ll ans = 1;
    while (p) {
        if (p & 1) ans = ans * x % mod;
        x = x * x % mod;
        p >>= 1;
    }
    return ans;
}
void extgcd(ll a, ll b, ll& d, ll& x, ll& y) {
    if (!b) {
        d = a;
        x = 1;
        y = 0;
    } else {
        extgcd(b, a % b, d, y, x);
        y -= x * (a / b);
    }
}

inline ll getInv(ll x, ll mod) {
    ll g, a, b;
    extgcd(x, mod, g, a, b);
    return (a % mod + mod) % mod;
}
ll fact[MAXN];
ll choose(int n, int k) {
    if (k > n) return 1;
    return fact[n] * getInv(fact[k] * fact[n - k] % MOD, MOD) % MOD;
}

ll fact2(int x) {
    if (x <= 0) return 1;
    return fact[x];
}
int main() {
#ifdef LOCALLL
    freopen("in", "r", stdin);
    freopen("out", "w", stdout);
#endif
    scanf("%d%d%d", &n, &m, &k);
    fact[0] = 1;
    for (int i = 1; i <= n; i++) {
        fact[i] = (ll)fact[i - 1] * i % MOD;
    }
    ll ans = 0;
    for (int i = 1; i <= k; i++) {
        int x = n - 1;
        int y = i;
        ll a = (choose(x, y) % MOD) * m % MOD;
        ll b = a * fastExp(m - 1, n - i - 1, MOD) % MOD;
        ans += b;
        ans %= MOD;
    }
    ans += (ll)m * fastExp(m - 1, n - 1, MOD) % MOD;
    printf("%lld", ans % MOD);
    return 0;
}

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

int main() {
  int H, W;
  cin >> H >> W;
  
  vector<vector<char>> table(H, vector<char>(W));
  
  for (int i = 0; i < H; i++) {
    for  (int j = 0; j < W; j++) {
      cin >> table.at(i).at(j);
    }
  }
  
  vector<bool> row(H, false);
  vector<bool> col(W, false);
  
  for (int i =0; i < H; i++) {
    for (int j = 0; j < W; j ++) {
      if (table.at(i).at(j) == '#') {
        row.at(i) = true;
        col.at(j) = true;
      }
    }
  }
  
  for (int i = 0; i <H; i++) {
    if (row.at(i)) {
      for (int j = 0; j < W; j ++) {
        if (col.at(j)) {
          cout << table.at(i).at(j);
        }
      }
      cout << endl;
    }
  }
}

Measured memory_bytes: 256
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx,avx2,fma")
#pragma GCC optimize("O3")
#include<iostream>
#include<algorithm>
#include<string>
#include<cmath>
#include<cstdlib>
#include<set>
#include<vector>
#include<sstream>
#include<queue>
#include <iomanip>
#include<unordered_set>
#include <stack>
#include <unordered_map>
#include <map>
#include<numeric>
#include<chrono>
#include <fstream>
constexpr auto INF = 9223372036854775807;
typedef long long int ll;
typedef unsigned long long int ull;
typedef unsigned long int ul;
#define f(i,a,b) for(ll i=(ll)a;i<(ll)b;i+=1)
#define rf(i,a,b) for(ll i=(ll)a;i>=(ll)b;i-=1)
#define endl '\n'
#define N 1000000007 // prime modulo value 
#define M 998244353
#define all(x) x.begin(),x.end()
#define mkp(a,b) make_pair(a,b)
using namespace std;
struct custom_hash {
	static uint64_t splitmix64(uint64_t x) {
		// http://xorshift.di.unimi.it/splitmix64.c
		x += 0x9e3779b97f4a7c15;
		x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
		x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
		return x ^ (x >> 31);
	}

	size_t operator()(uint64_t x) const {
		static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
		return splitmix64(x + FIXED_RANDOM);
	}
};
inline int mex(unordered_set<int> st)
{
	int m = 0;
	while (st.find(m) != st.end())
	{
		m += 1;
	}
	return m;
}
inline int calculateGrundy(int n)
{
	if (n == 1)
		return 0;
	unordered_set<int> mexi;
	for (int i = 1; i <= sqrt(n); i += 1)
	{
		if (n % i == 0)
		{
			if (n / i != n)
				mexi.insert(calculateGrundy(n / i));
			mexi.insert(calculateGrundy(i));
		}
	}
	return mex(mexi);
}
inline ll gcd(ll a, ll b)
{
	// This is code taken from geeksforgeek
	if (b == 0)
		return a;
	return gcd(b, a % b);
}
/*ll power(ll x, ll y)
{
	// This is code taken from geeksforgeek
	ll res = 1;

	x = x % N;
	if (x == 0) return 0;
	while (y > 0)
	{
		if (y & 1)
			res = (res * x) % N;
		y = y >> 1;
		x = (x * x) % N;
	}
	return res;
}*/
ll power(ll x, ll y)
{
	ll res = 1;

	x = x;

	while (y > 0)
	{

		if (y & 1)
			res = (res * x);

		y = y >> 1;
		x = (x * x);
	}
	return res;
}


/*ll modInverse(ll n, ll p)
{
	return power(n, p - 2, p);
}*/

ll sum(ll n)
{
	return (n * (n + 1)) / 2;
}
ll sum_digit(ll n)
{
	ll ans = 0;
	while (n)
	{
		ans += n % 10;
		n /= 10;
	}
	return ans;
}
int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	ll n;
	cin>>n;
	vector<ll> arr(n,0);
	f(i,0,n)
	{
		cin>>arr[i];
	}
	sort(all(arr));
	ll ans=0;
	f(i,0,n-2)
	{
		f(j,i+1,n-1)
		{
			f(k,j+1,n)
			{
				if(arr[k]-arr[j]<arr[i]&& arr[i]+arr[j]>arr[k])
				{
					if(arr[i]!=arr[j]&&arr[j]!=arr[k])
					{
						ans+=1;
					}
				}
			}
		}
	}
	cout<<ans;
	return 0;
}


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

#define ASC(vec) vec.begin(), vec.end()		// 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend()	// 降順ソート 例:sort(DESC(vec));
#define rep(i, n) for(int i = 0; i < n; i++)
#define Rep(i, n) for(int i = 1; i < n; i++)
#define In(vec) rep(i, n) cin>>vec[i];
#define ANS(s) cout << s << endl
#define inc(a, b) cin >> a >> b;

const int mod = 1000000007;
const int inf = (int)1e9 + 7;
const long long INF = 1LL << 60;

typedef long long ll;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef vector<pair<int, int>> vii;

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
int round_int(int a, int b) { return (a + (b - 1)) / b; }


// 4,8方向に探索する際に用いる配列
//int dx[4] = { 0,  0, 1, -1 };
//int dy[4] = { 1, -1, 0,  0 };
int dx[8] = { 1, 0, -1,  0, 1, -1, -1,  1 };
int dy[8] = { 0, 1,  0, -1, 1,  1, -1, -1 };

constexpr auto MAX = 100010;

// ────────────────────────────────────────────────────

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

	if (n == 1) cout << "Hello World" << endl;
	else {
		int a, b;
		cin >> a >> b;
		cout << a + b << endl;
	}
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int result = 0;
		int a = sc.nextInt(),b = sc.nextInt(),c = sc.nextInt();
		if(a != b) result++;
		if(a != c) result++;
		if(b != c) result++;
		if(a == b && b == c) result++;
		System.out.println(result);
	}
}

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


void main() {
    int n;
    scan(n);
    writeln(n % s(n) == 0 ? "Yes" : "No");
}

int s(int n) {
    return n > 0 ? s(n / 10) + n % 10 : 0;
}






































void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    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: 256
#include<bits/stdc++.h>

using namespace std;

int main()
{
  int N, C, K, T[100000];

  cin >> N >> C >> K;
  for(int i = 0; i < N; i++) {
    cin >> T[i];
  }

  sort(T, T + N);

  int ret = 1, latte = N - 1;
  for(int i = N - 2; i >= 0; i--) {
    bool flip = false;
    if(T[latte] - T[i] > K) flip = true;
    if(latte - i + 1 > C) flip = true;
    if(flip) {
      latte = i;
      ++ret;
    }
  }

  cout << ret << endl;
}

Measured memory_bytes: 764
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		long n = sc.nextLong();
		
		if( n < 1000) {
			System.out.println("ABC");
		}else {
			System.out.println("ABD");
		}
		
		
	}

}

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

using namespace std;

int main() {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    
    string s, t;
    int res = 1000;
    
    cin >> s >> t;
    
    for(int i = 0; i <= s.size() - t.size(); i++) {
        int temp = 0;
        for(int j = 0; j < t.size(); j++)
            temp += (s[i + j] != t[j]);
        res = min(res, temp);
    }
    
    cout << res;
    
    return 0;
}


Measured memory_bytes: 3660
#include<cstdio>
#include<vector>
#define INF 2000000000
#define M 100
#define _for(j,N) for(int i = (j);i < (N);++i)

using namespace std;

long adj[100][100];
int V;
int E;

int main(void){
    scanf("%d %d",&V,&E);
    long s,t,w;

    for(int i = 0; i < V;++i){
        for(int j = 0; j < V;++j){
            adj[i][j] = INF;
            if(i == j) adj[i][i] = 0;
        }
    }

    _for(0,E){
        scanf("%ld %ld %ld",&s,&t,&w);
        adj[s][t] = w;
    }


    _for(0,V){
        for(int j = 0; j < V;++j){
            for(int k = 0;k < V;++k){
                if(adj[j][i] != INF && adj[i][k] != INF && adj[j][k] > adj[j][i] + adj[i][k])
                    adj[j][k] = adj[j][i] + adj[i][k];
            }
        }
    }

    _for(0,V){
        if(adj[i][i] < 0){
        printf("NEGATIVE CYCLE\n");
        return 0;
        }
    }

    for(int i = 0; i < V;++i){
        for(int j = 0; j < V;++j){
            if(adj[i][j] == INF) printf("INF");
            else printf("%ld",adj[i][j]);
            if(j != V-1) printf(" ");
        }
        printf("\n");
    }
    return 0;
}


Measured memory_bytes: 2836
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
#define PI 3.14159265358979
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define repp(i, s, e) for(int i = (s); i <= (e); ++i)
#define sz(x) ((int)x.size())
#define all(x) x.begin(), x.end()
#define FAST_IO() ios::sync_with_stdio(0); cin.tie(0)
template<typename T>
ostream& operator<<(ostream &os, const vector<T> &v) { for (auto x : v) os << x << " "; return os << "\n"; }
template<class U, class V>
ostream& operator<<(ostream &os, const pair<U, V> &p) { return os << "(" << p.first << "," << p.second << ")";}

int main() {
    FAST_IO();
    ll N, A, B; cin >> N >> A >> B;
    if((B - A) % 2 == 0) {
        cout << (B - A) / 2 << "\n";
    } else {
        cout << min((A + B - 1) / 2, (N - A + N - B + 1) / 2) << "\n";
    }
}

Measured memory_bytes: 256
import 'dart:async';
import 'dart:io';
import 'dart:convert';

import 'dart:math';

Stream<String> get lineStream =>
    stdin.transform(utf8.decoder).transform(const LineSplitter());

Future<List<String>> readLines() async {
  final lines = <String>[];
  await for (var line in lineStream) {
    lines.add(line);
  }
  return lines;
}

void main() async {
  final lines = await readLines();
  final charR = 'R'.codeUnitAt(0);
  var s = List.from(lines[0].runes);
  var r = 0;
  var ans = 0;
  for (var c in s) {
    if (c == charR) {
      ans = max(++r, ans);
    } else {
      ans = max(r, ans);
      r = 0;
    }
  }
  print(ans);
}

Measured memory_bytes: 13064
#include "bits/stdc++.h"
#define rep(i,a,n) for(int i = (a);i < (n);i++)
typedef unsigned long long ull;
typedef long long ll;
using namespace std;

int main(){
  	int n,memo = 0,zero = 0;
  	cin >> n;
  	int cx[n] = {0},cy[n] = {0},ch[n] = {0};
  
  	rep(i,0,n){
      cin >> cx[i] >> cy[i] >> ch[i];
      //if(!i) memo = ch[i];
      //else memo = min(memo,ch[i]);
    }
  
  
  	rep(i,0,101){
      rep(j,0,101){
        rep(k,0,n){
          	if(ch[k]){
          	    memo = ch[k] + abs(i-cx[k]) + abs(j-cy[k]);
          	    break;
          	}
        }
        rep(k,0,n){
        	if(max(0,memo-abs(i-cx[k])-abs(j-cy[k])) != ch[k]){
              break;
            }
          	else if(k == n-1){
              cout << i << " "<< j << " " << memo << endl;
              return 0;
            }
        }
      }
    }
  	cout << -1 << endl;
	return 0; 
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <map>

using namespace std;

#define PI	pair<int , int>
#define MP	make_pair



PI input;
int ans;


void Dfs(int n , int now , int index)
{
	if (n > input.first || now > input.second)	{	return ;}

	if (n == input.first)
	{
		if (input.second == now)
		{
			ans++;
		}
		return;
	}

	for (int i = index + 1; i < 10; i++)
	{
		Dfs(n + 1 , now + i , i);
	}
}


int main(void)
{
	while (1)
	{
		ans = 0;
		cin >> input.first >> input.second;

		if (input.first == 0 && input.second == 0)
		{
			break;
		}

		for (int i = 0; i < 10; i++)
		{
			Dfs(1 , i , i);
		}

		cout << ans << endl;
	}

	return 0;
}

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

int main(){
    int N;
    int h,K;
    cin>>N;
    cin>>K;
    int a[N];
    

if ((N>=1) && (N<=100000)){   
    if ((K>=1) && (K<= 500)){

        for (int i=0;i<N;i++){
            cin>>h;
            if (h>=1 && h<=500)
                a[i]=h;
            }        

        int c=0;
        for (int j=0 ;j<N;j++){
            if (a[j]>=K){
                c++;
                }
            }   
        cout<<c<<endl;
        }
    }
return 0;
}

Measured memory_bytes: 640
h,w = map(int,input().split())
grid = [input() for i in range(h)]

whiteh = []
whitew = []
for i in range(h):
  if grid[i] == "."*w:
    whiteh.append(i)

for i in reversed(whiteh):
  grid.pop(i)
h -= len(whiteh)

grid2 = [""]*w
for i in range(h):
  for j in range(w):
    grid2[j] += grid[i][j]    
    
for i in range(w):
  if grid2[i] == "."*h:
    whitew.append(i)    
    
for i in reversed(whitew):
  grid2.pop(i)
w -= len(whitew)

gridans = [""]*h
for i in range(w):
  for j in range(h):
    gridans[j] += grid2[i][j] 

for i in range(h):
  print(gridans[i])

Measured memory_bytes: 3064
#include <iostream>
#include <map>
#include <string>

using namespace std;

class Dice {
public:
    explicit Dice(int a[]) {
        for (int i = 0; i < 6; ++i) {
            face[i] = a[i];
            f2i[a[i]] = i;
        }
    }

    void rotate(char dir);
    void loop_swap(int a[]);

    static int rotate_itr[6][4];
    static map<char, int> c2i;
    map<char, int> f2i;
    int face[6];
};

/* ----- member funcs of Dice class ----- */

void Dice::rotate(char dir) {
    loop_swap(rotate_itr[c2i[dir]]);
}

int Dice::rotate_itr[6][4] = {
    {0, 1, 5, 4},  // N
    {0, 3, 5, 2},  // E
    {0, 2, 5, 3},  // W
    {0, 4, 5, 1},  // S
    {1, 2, 4, 3},  // L
    {1, 3, 4, 2},  // R
};

map<char, int> Dice::c2i = {{'N', 0}, {'E', 1}, {'W', 2}, {'S', 3}, {'L', 4}, {'R', 5}};

void Dice::loop_swap(int a[]) {
    int tmp = face[a[0]];
    for (int i = 0; i < 3; ++i) {
        face[a[i]] = face[a[i + 1]];
    }
    face[a[3]] = tmp;
}

/* ----- main func ----- */

const string ope = "NNNEEE";

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

    Dice dice(a);

    int Q;
    cin >> Q;

    for (int q = 0; q < Q; ++q) {
        int t, f;
        cin >> t >> f;

        for (int i = 0; i < 6; ++i) {
            if (dice.face[0] == t) break;
            dice.rotate(ope[i]);
        }

        for (int i = 0; i < 4; ++i) {
            if (dice.face[1] == f) break;
            dice.rotate('R');
        }

        cout << dice.face[2] << endl;
    }
    return 0;
}



Measured memory_bytes: 3228
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
   long long int c[10][10]={0},sum=0;
   long long int n;
    cin>>n;
    for(long long int i=1;i<=n;i++){
       long long int a=i;
        long long int b=a%10;
        while(a>=10){
            a/=10;
        }
        c[a][b]++;
    }
    for(long long int i=0;i<=9;i++){
        for(long long int j=0;j<=9;j++){
            sum+=(c[i][j]*c[j][i]);
        }
    }
    cout<<sum<<endl;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)  //  repマクロ
#define leng(n) (int)(log10(n)+1)  //  桁数
using namespace std;

signed main() {
  int A;
  cin >> A;
   if (A == 22) cout << "Christmas Eve Eve Eve" << endl;
   if (A == 23) cout << "Christmas Eve Eve" << endl;
   if (A == 24) cout << "Christmas Eve" << endl;
   if (A == 25) cout << "Christmas" << endl;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){

	int i,k,H,W;
	
	while (1){
		scanf("%d %d", &H, &W);
		if (H == 0 && W == 0)break;
		for (i = 0; i < H; i++){
			for (k = 0; k < W; k++){
				printf("#");
				
			}
		
			printf("\n");
		}
		printf("\n");

	}

	return 0;

}


Measured memory_bytes: 2064
program main
implicit none
integer :: i , j 
integer :: a( 5 ), k

do i = 1, 5
read(*,*) a(i)
end do
read(*,*) k

do i = 1, 5
   do j = i, 5
      if( a(j) - a(i) > k ) then
         write(*,*) ':('
         stop
      end if
   end do
end do
write(*,*) 'Yay!'


end program main


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

int main() {
    int A, B, C;
    cin >> A >> B >> C;
    int ans;
    if (C - (A-B) <= 0) {
        ans = 0;
    } else {
        ans = C - (A - B);
    }

    cout << ans << endl;
}


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

int main() {
  int n, x, y;
  cin >> n >> x >> y;
  vector<vector<int>> dist(n, vector<int>(n));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      dist[i][j] = max(0, max(i-j, j-i));
    }
  }
  //input

  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      dist[i][j] = min(dist[i][j], dist[i][x-1] + 1 + dist[y-1][j]);
    }
  }

  vector<int> counts(n-1, 0);
  for (int i = 0; i < n; i++) {
    for (int j = i+1; j < n; j++) {
      counts[(dist[i][j])-1]++;
    }
  }

  for (int x: counts) {
    cout << x << endl;
  }
}


Measured memory_bytes: 16000
#include <iostream>
#include <cstdio>

using namespace std;

typedef long long ll;

ll H, W, h, w;
ll x, y;
ll d[505];

int main()
{
    cin>>H>>W>>h>>w;
    if(H % h == 0 && W % w == 0)
    {
        printf("No\n");
        return 0;
    }
    else if(H % h > 0) x = H, y = h;
    else x = W, y = w;
    printf("Yes\n");
    for(ll i = 0; i < x; i++)
    {
        ll t1 = x % y;
        ll t2 = y - x % y;
        if(i % y < x % y) d[i] = 200000;
        else d[i] = -(200000 * t1) / t2 - 1;
    }
    for(ll i = 0; i < H; i++)
    {
        for(ll j = 0; j < W; j++)
        {
            if(H % h > 0) printf("%lld ", d[i]);
            else printf("%lld ", d[j]);
        }
        puts("");
    }
    return 0;
}


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

signed main(){
	set<int> st;
	int s;
	cin >> s;
	for(int i = 1;;i++){
		if(st.count(s)){
			cout << i << endl;
			return 0;
		}
		st.insert(s);
		if(s % 2 == 0) s /= 2;
		else s = 3 * s + 1;
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>

using namespace std;

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

    int N;
    cin >> N;
    vector<int> v(N), c(8, 0);
    int free_color = 0;
    for (int i = 0; i < N; ++i){
        cin >> v[i];
        if (v[i] < 400) c[0] = 1;
        else if (v[i] > 399 && v[i] < 800) c[1] = 1;
        else if (v[i] > 799 && v[i] < 1200) c[2] = 1;
        else if (v[i] > 1199 && v[i] < 1600) c[3] = 1;
        else if (v[i] > 1599 && v[i] < 2000) c[4] = 1;
        else if (v[i] > 1999 && v[i] < 2400) c[5] = 1;
        else if (v[i] > 2399 && v[i] < 2800) c[6] = 1;
        else if (v[i] > 2799 && v[i] < 3200) c[7] = 1;
        else if (v[i] > 3199) free_color += 1;
    }

    //int n_count = (int) count(c.begin(), c.end(), 1);
    int sum = accumulate(c.begin(), c.end(), 0);
    if (sum == 0) cout << 1 << " " << free_color << endl;
    else cout << sum << " " << sum + free_color << endl;


    return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;
import java.lang.*;
public class Main{
public static int gcd(int a,int b){
	if(b==0){return a;}
	return gcd(b,a%b);
}

public static void main(String[] args) throws FileNotFoundException, IOException{
       Scanner s=new Scanner(System.in);
       BufferedWriter out=new BufferedWriter(new OutputStreamWriter(System.out));
       int n=Integer.parseInt(s.nextLine());
       String[][] arr=new String[n][2];
       for(int i=0;i<n;i++){
       	String[] tt=s.nextLine().split(" ");
       	arr[i]=tt;
       }
       String ss=s.nextLine();int k=-1;
       for(int i=0;i<n;i++){
       	if(arr[i][0].equals(ss)){k=i;break;}
       }
       int res=0;
       for(int i=k+1;i<n;i++){res+=Integer.parseInt(arr[i][1]);}
       
       
  out.write(res+" ");
        
        out.flush();
  }
}


Measured memory_bytes: 23252
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main
{
	public static void main(String[] args) {
		new Thread(null, new Runnable() {
			public void run() {
                solve();
            }
        }, "1", 1 << 26).start();
	}
	static void solve () {
		FastReader fr =new FastReader();	PrintWriter op =new PrintWriter(System.out);
 
 		int n =fr.nextInt() ,i ,ct[] =new int[n] ;
 		for (i =1 ; i<n ; ++i) {
 			ct[fr.nextInt()-1]++;
 		}
 		for (i =0 ; i<n ; ++i)	op.println(ct[i]) ;
		op.flush();	op.close();
	}
	static class FastReader {
		BufferedReader br;
		StringTokenizer st;

		public FastReader() {
			br =new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st==null || (!st.hasMoreElements())) 
			{
				try
				{
					st =new StringTokenizer(br.readLine());
				}
				catch(IOException e)
				{
					e.printStackTrace();
				}
				
			}
			return st.nextToken();
		}

		String nextLine() {
			String str ="";

			try
			{
				str =br.readLine();
			}
			catch(IOException e)
			{
				e.printStackTrace();
			}

			return str;
		}

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

		long nextLong() {
			return Long.parseLong(next()) ;
		}
	}
}

Measured memory_bytes: 55224
#include<iostream>
#include <queue>

using namespace std;

const int INF = 100000000;
typedef pair<int, int> P;

const int MAX_H = 50;
const int MAX_W = 50;
char maze[MAX_H][MAX_W];
int d[MAX_H][MAX_W];

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

int main()
{
    int H, W;
    cin >> H >> W;
    int wcount = 0;
    for (int i = 0; i < H; i++){
        for (int j = 0;j < W; j++){
            cin >> maze[i][j];
            d[i][j] = INF;
            if (maze[i][j] == '.'){
                wcount++;
            }
        }
    }

    queue<P> que;
    que.push(P(0, 0));
    d[0][0] = 0;

    while(que.size() > 0){
        P p = que.front();
        que.pop();

        if (p.first == H - 1 && p.second == W - 1) break;

        for (int i = 0; i < 4;i++){
            int nx = p.first + dx[i];
            int ny = p.second + dy[i];

            if (0 <= nx && nx < H && 0 <= ny && ny < W){
                if (maze[nx][ny] == '.' && d[nx][ny] == INF){
                    que.push(P(nx, ny));
                    d[nx][ny] = d[p.first][p.second] + 1;
                }
            }
        }
    }

    if (d[H-1][W-1] == INF){
        cout << -1 << endl;
    } else {
        cout << wcount - d[H-1][W-1] - 1 <<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#define llint long long
#define mod 1000000007

using namespace std;

llint n;
char c[205];
llint dp[205][205];//i番目まで終わった。j個保留。k個あとでUを使わねば;

int main(void)
{
  cin >> n;
  for(int i = 1; i <= n; i++) cin >> c[i];

  dp[0][0] = 1;
  for(int i = 0; i < n; i++){
    for(int j = 0; j <= n; j++){
        if(c[i+1] == 'U'){
          if(j+1 <= n) (dp[i+1][j+1] += dp[i][j]) %= mod;
          (dp[i+1][j] += dp[i][j] * j % mod) %= mod;
        }
        else if(c[i+1] == 'D'){
          if(j-1 >= 0)(dp[i+1][j-1] += dp[i][j] * j % mod * j % mod) %= mod;
          (dp[i+1][j] += dp[i][j] * j % mod) %= mod;
          //(dp[i+1][j] += dp[i][j] * j % mod) %= mod;
        }
        else{
          (dp[i+1][j] += dp[i][j]) %= mod;
        }
      }
    }
  cout << dp[n][0] << endl;

  return 0;
}



Measured memory_bytes: 3400
#include<cstdio>
#include<algorithm>
#include<vector>
#include<deque>
#include<stack>
#include<queue>
#include<string>
#include<iostream>
#include<tuple>
#include<utility>
#include<set>
#include<queue>
#include<iomanip>
#include<iterator>
#include<map>
//#include<chrono>
//cout<<setprecision(12)
//fixed
//#include<random>
using namespace std;
typedef long long int llint;
typedef long double lldo;
const int big=1e9+100000;
const int mod=1e9+7;
const lldo eps=1e-9;
const long double pai=3.141592653589793238462643;
#define mt make_tuple
#define mp make_pair
#define fir first
#define sec second
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define res resize
#define ins insert
#define era erase
#define dme(in) cout<<in<<endl;return 0
template <class T,class U>void mineq(T& a,U b){if(a>b){a=b;}}
template <class T,class U>void maxeq(T& a,U b){if(a<b){a=b;}}
int main(void){
	int i,n,ans=0;cin>>n;
	map<int,int>a;
	for(i=0;i<n;i++){
		int q;cin>>q;
		a[q]++;
	}
	for(auto it=a.begin();it!=a.end();it++){
		if(it->sec%2==1){ans++;}
	}cout<<ans<<endl;
	return 0;
}

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

int main(int argc, char const *argv[])
{
  int N,A[200],ans=0; // N,A : 問題文通りの定義 / ans : 答え
  cin >> N; // Nを格納

  for (int i = 0; i < N; ++i)
  {
    cin >> A[i]; // A_1～A_Nの入力をA[0]～A[N-1]に格納
  }

  ans=0; // 操作可能回数は0回からスタート
  while(1){
    bool allEven = true; // 全て偶数かどうかのフラグ

    for (int i = 0; i < N; ++i) // 黒板の数字すべてについて
    {
        if(A[i]%2==1){ // A[i]が奇数ならば終了
            allEven = false;
            break;
        }else{ // A[i]が偶数ならば2で割って再代入
            A[i] /= 2;
        }
    }

    if(!allEven){ // 奇数が含まれていた場合 => 操作可能回数を増やさず終了
        break;
    } else{
        ans++; // 全て偶数だった場合 => 操作可能回数を+1する
    }

  }

  cout << ans << endl; // 答えを出力
  return 0;
}

Measured memory_bytes: 256
#include <stdlib.h>
#include <cmath>
#include <cstdio>
#include <cstdint>
#include <string>
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <bitset>
using namespace std;
using ll = long long;

int main(){
  int N,M;
  ll X;
  cin >> N >> M >> X;
  vector<ll> C(N);
  vector<vector<ll>> A(N,vector<ll>(M));
  for(int i=0;i<N;i++){
    cin >> C.at(i);
    for(int j=0;j<M;j++) cin >> A.at(i).at(j);
  }

  ll sum=2000000;
  for(int tmp=0; tmp<(1<<12); tmp++){
    bitset<12> bit(tmp);
    vector<ll> understand(M,0);
    ll temp_sum=0;
    for(int i=0;i<N;i++){
      if(bit.test(i)){
	for(int j=0;j<M;j++) understand.at(j)+=A.at(i).at(j);
	temp_sum+=C.at(i);
      }
    }
    int flag=1;
    for(int j=0;j<M;j++){
      if(understand.at(j)<X){
	flag=0;
	break;
      }
    }
    if(flag==1) sum=min(sum,temp_sum);
  }

  if(sum==2000000) cout << -1 << endl;
  else cout << sum << endl;
  
  return 0;
}


Measured memory_bytes: 3636
#include <iostream>
#include <cstdio>
#include <set>
#include <list>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <string>
#include <sstream>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <cctype>
#include <cmath>
using namespace std;
#define dbg(x) cerr << #x " = " << x <<endl;
const int MAXN = 1e6;
int ans[MAXN];
int a[MAXN];

int main()
{
	int n;
	cin >> n;
	for(int i = 0; i < n; i++)
	{
		cin >> a[i];
	}
	sort(a, a+n);
	int MIN = a[0], MAX = a[n-1];
	int cnt = 0;
	for(int i = MIN; i <= MAX; i++)
	{
		int tmp = 0;
		for(int j = 0; j < n; j++)
		{
			tmp += (a[j] - i) * (a[j] - i);
//			dbg(i);
//			dbg(tmp);
		}
		ans[cnt++] = tmp;
	}
	sort(ans, ans+cnt);
	cout << ans[0] << endl;
}

Measured memory_bytes: 2304
#include<stdio.h>
int main(void) {
	int r, d, x, i;
	scanf("%d %d %d", &r, &d, &x);
	for (i = 0; i < 10; i++) {
		x = r * x - d;
		printf("%d\n", x);
	}
	return 0;
}

Measured memory_bytes: 128
//
//  main.cpp
//  c
//
//  Created by 13B10694 on 2015/06/01.
//  Copyright (c) 2015????´ 13B10694. All rights reserved.
//

#include <iostream>
#include <vector>
#include<stdio.h>
#include <algorithm>
#include<string.h>
using namespace std;

int now=1;

class team{
    
public:
    int id, pen, sol;
    int wrong[12];
    vector <int> solved;
    team(){
        memset(wrong, 0, sizeof(wrong));
        id=now++;
        pen=0;sol=0;
    }
    ~team(){
        solved.clear();
    }
    
    bool operator < (const team& b) const
    {
        return solved.size()==b.solved.size() ? pen== b.pen ? id<b.id : pen<b.pen : solved.size()>b.solved.size();
    }
};

int main() {
    int t,p,r;
    while(cin>>t>>p>>r,t){
        now=1;
        vector<team> tea(t);

        for(int i=0;i<r;i++){
            int ti, pi, tim;
            string mes;
            cin>>ti>>pi>>tim>>mes;
            ti-=1;
            if(mes=="WRONG"){
                tea[ti].wrong[pi]++;
                continue;
            }
            if(find(tea[ti].solved.begin(),tea[ti].solved.end(),pi)!=tea[ti].solved.end()){
                continue;
            }
            tea[ti].solved.push_back(pi);
            tea[ti].pen += tea[ti].wrong[pi]*1200+tim;
  
        }
        sort(tea.begin(),tea.end());
        for(int i=0;i<t;i++){
            cout<<tea[i].id<<" "<<tea[i].solved.size()<<" "<<tea[i].pen<<endl;
        }
        tea.clear();
    }
    
    return 0;
}

Measured memory_bytes: 1252
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,N) for(int i=0; i<N; i++){ ;
int main() {
   string s;
   cin>>s;
   for(int i=0; i<s.size(); i++){
       if(s.at(i)==','){
           s.at(i)=' ';
       }
   }
   cout<<s<<endl;
}


Measured memory_bytes: 3592