akhauriyash/Code-Regression huggingface dataset:
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,fma,abm,mmx,avx,avx2,tune=native")
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#ifdef rd
#define trace(...) cout<<"Line:"<<__LINE__<<" "; __f(#__VA_ARGS__, __VA_ARGS__)
template<typename Arg1>
void __f(const char* name, Arg1&& arg1) {
	cout<<name<<" : "<<arg1<<endl;
}
template<typename Arg1, typename ... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
	const char* comma=strchr(names+1,',');
	cout.write(names,comma-names)<<" : "<<arg1<<" | ";
	__f(comma+1,args...);
}
#else
#define trace(...)
#define endl '\n'
#endif
#define pb push_back
#define fi first
#define se second
#define int long long
typedef long long ll;
typedef float f80;
#define double long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define sz(x) ((long long)x.size())
#define fr(a,b,c) for(int a=b; a<=c; a++)
#define rep(a,b,c) for(int a=b; a<c; a++)
#define trav(a,x) for(auto &a:x)
#define all(con) con.begin(),con.end()
const ll infl=1e18;
const int infi=1e9;
const int mod=998244353;
//const int mod=1000000007;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> oset;
auto clk=clock();
mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());
int rng(int lim) {
	uniform_int_distribution<int> uid(0,lim-1);
	return uid(rang);
}
int powm(int a, int b) {
	int res=1;
	while(b) {
		if(b&1)
			res=(res*a)%mod;
		a=(a*a)%mod;
	}
	return res;
}


int a[100005];
map<int,int> b;
void solve() {
	int n;
	cin>>n;
	int allzero=0;
	fr(i,1,n) {
		cin>>a[i];
		allzero|=a[i];
	}
	if(allzero==0) {
		cout<<"Yes"<<endl;
		return;
	}
		fr(i,1,n)
			b[a[i]]++;
		set<int> c;
		int xo=0;
		for(auto i:b)
			c.insert(i.se);
		if(sz(c)==1) {
			if(sz(b)==2) {
				if(c.count(0)) {
					cout<<"Yes"<<endl;
					return;
				}
			} else if(sz(b)==3) {
				int xo=0;
				for(auto i:b)
					xo^=i.fi;
				if(xo==0) {
					cout<<"Yes"<<endl;
					return;
				}
			}
		} else if(sz(c)==2&&b.count(0)) {
			if(sz(b)==2) {
				int tot=3*b[0];
				for(auto i:b)
					tot-=i.se;
				if(tot==0) {
					cout<<"Yes"<<endl;
					return;
				}
			}
		}
	cout<<"No"<<endl;
}
signed main() {
	ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	srand(chrono::high_resolution_clock::now().time_since_epoch().count());
	cout<<fixed<<setprecision(10);
	int t=1;
//	cin>>t;
	fr(i,1,t) {
		solve();
	}
#ifdef rd
	cout<<endl<<endl<<endl<<endl<<"Time elapsed: "<<(double)(clock()-clk)/CLOCKS_PER_SEC<<endl;
#endif
	return 0;
}


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

int main()
{
    ll n;
    string s;
    cin >> n >> s;

    map<char, ll> M;
    rep(i, s.length())
    {
        M[s[i]]++;
    }

    ll ans = 1;
    for (auto p : M)
    {
        ans = (ans * (p.second + 1)) % MOD;
    }

    ans = (ans - 1) % MOD;

    cout << ans << endl;
}

//なんでわからんかった

Measured memory_bytes: 3760
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include<iomanip>
using namespace std;
bool prime(int n){
 for(int i=2;i<=n/2;i++){
   if (n%i==0)
    return false;
 }
 return true;}
 int a[10000];
 int b[10000];
 int prefx[10000000];
 int freq[10000000];
typedef pair<int,int> pii;
typedef pair<pii,int> piii;
typedef vector<int> vi;
typedef vector<pii> vii;
typedef long long ll;
#define loop(n)      for(int i=0;i<(n);i++)
#define lp(x,s,e)    for(int x=(s);x<(e);x++)
#define lpe(x,s,e)    for(int x=(s);x<=(e);x++)
#define MP make_pair
#define PB push_back
#define all(a)  a.begin(),a.end()
#define clr(x,val) memset((x),(val),sizeof(x))
#define endl '\n'
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    int n;
    cin>>n;
    while(n--){
    string s;
    cin>>s;
    if(s=="AC")
    freq[1]++;
    else if(s=="WA")
     freq[2]++; 
     else if(s=="TLE")
     freq[3]++; 
     else if(s=="RE")
     freq[4]++; }
 
    cout<<"AC x "<<freq[1]<<endl;    
     cout<<"WA x "<<freq[2]<<endl; 
     cout<<"TLE x "<<freq[3]<<endl; 
     cout<<"RE x "<<freq[4]<<endl; 
}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pi;
 
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define rep(i,a,b) for (int i=a; i<b; i++)
// #define endl "\n"
const int mod = 1000000007;
const int INF = 1e9 + 5;

ll power(ll x, ll y) 
{ 
    ll res = 1;     // Initialize result 
   
    while (y > 0) 
    { 
        // If y is odd, multiply x with result 
        if (y & 1) 
            res = res*x; 
        res%=mod;
        // n must be even now 
        y = y>>1; // y = y/2 
        x = x*x;
        x%=mod;  // Change x to x^2 
    } 
    return res%mod; 
}

int main() {
    ios_base::sync_with_stdio(false);    //Fast I/O
    cin.tie(NULL);
 
    // freopen("input.txt", "r", stdin);    // Read and write from a file
    // freopen("output.txt", "w", stdout);
    int n, k;
    cin >> n;
    cin >> k;
    vector<int> arr(n,0);
    rep(i,0,n)
        cin >> arr[i];

    if(n<2){
        cout << 0 << endl;
        return 0;
    }
    vector<int> dp(n,INT_MAX);
    dp[0]=0;    
 
    for(int i=0; i<n; i++){
        for(int j=1; j<=k; j++){
            if(j<n)
                dp[i+j] = min(dp[i+j], dp[i]+abs(arr[i+j]-arr[i]));
        }
    }

    cout << dp[n-1] << endl;
 
    return 0;
}

Measured memory_bytes: 1024
import java.util.*;
class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int h = sc.nextInt();
        int ans = (a+b)*h/2;
        System.out.println(ans);
    }
}

Measured memory_bytes: 23764
import sys
from io import StringIO
import unittest


def resolve():
    l, r = map(int, input().split())
    ll = []

    for i in range(l, r + 1, 1):
        if i % 2019 in ll:
            break
        else:
            ll.append(i % 2019)

    ll.sort()
    ans = 2020

    for i in range(len(ll)):
        for j in range(i + 1, len(ll)):
            tmp = (ll[i] * ll[j]) % 2019
            if tmp < ans:
                ans = tmp

    print(ans)


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """2020 2040"""
        output = """2"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """4 5"""
        output = """20"""
        self.assertIO(input, output)


if __name__ == "__main__":
    # unittest.main()
    resolve()


Measured memory_bytes: 16204
package main

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

type Vector struct {
	v []int
}

func (vec *Vector) pushBack(x int) {
	vec.v = append(vec.v, x)
}

func (vec *Vector) randomAccess(p int) int {
	return vec.v[p]
}

func (vec *Vector) popBack() {
	vec.v = vec.v[:len(vec.v)-1]
}

func nextInt(sc *bufio.Scanner) (x int, err error) {
	sc.Scan()
	x, err = strconv.Atoi(sc.Text())
	return
}

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)

	q, _ := nextInt(sc)
	v := &Vector{}

	for i := 0; i < q; i++ {
		cmd, err := nextInt(sc)
		if err != nil {
			break
		}

		var x int
		switch cmd {
		case 0:
			x, _ = nextInt(sc)
			v.pushBack(x)
		case 1:
			x, _ = nextInt(sc)
			fmt.Println(v.randomAccess(x))
		case 2:
			v.popBack()
		}
	}
}



Measured memory_bytes: 7896
program test02
     character*50 S
     character*3 ic
     integer N
     integer i, j
     integer :: countA=0
     
     read *,N
     read *,S
     
     do j=3,N
      i=j-2
      ic=S(i:j)
      if (ic=='ABC') then
       countA=countA+1
      end if
     end do
     
     print '(i0)', countA
 endprogram test02

Measured memory_bytes: 256
while True:
    n = int(input())
    if n == 0:
        break
    data = list(map(int, input().split()))
    ave = sum(data) / len(data)
    a = 0
    for i in range (n):
        a += (data[i] - ave)**2
    k = (a/n)**0.5
    print(k)
        


Measured memory_bytes: 5668
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int N;
    cin >> N;
    vector<int> P(N), Q(N), perm(N);
    for (int i = 0; i < N; i++)
    {
        perm[i] = i + 1;
        cin >> P[i];
    }
    for (int i = 0; i < N; i++)
    {
        cin >> Q[i];
    }

    int num=0,a=0, b=0;
    do
    {
        num++;
        if(P == perm){
            a = num;
        }
        if(Q == perm)
        {
            b = num;
        }
    } while (next_permutation(perm.begin(), perm.end()));
    cout << abs(a-b) << endl;
}

Measured memory_bytes: 256
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include <prettyprint.hpp>
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

template <typename T>
void print(T x) {
    cout << x << endl;
}

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
ll MOD = 1e9+7;

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    
    int A, B;
    cin >> A >> B;

    if (A > 9 || B > 9) print(-1);
    else print(A * B);
    
}


Measured memory_bytes: 3656
using System;

class F
{
	static void Main()
	{
		var s = Console.ReadLine();
		var t = Console.ReadLine();

		var t_sub = new int[t.Length];
		t_sub[0] = -1;
		for (int i = 1; i < t.Length; i++)
		{
			var p = t_sub[i - 1];
			t_sub[i] = p > -1 && t[i] == t[p + 1] ? p + 1 : t[i] == t[0] ? 0 : -1;
		}

		var st = new bool[s.Length];
		for (int i = 0, j = 0; i < s.Length;)
		{
			for (; ; j++)
			{
				if (s[(i + j) % s.Length] != t[j]) { j--; break; }
				if (j == t.Length - 1) { st[i] = true; break; }
			}

			if (j == -1)
			{
				i++;
				j = 0;
			}
			else if (t_sub[j] == -1)
			{
				i += j + 1;
				j = 0;
			}
			else
			{
				i += j - t_sub[j];
				j = t_sub[j] + 1;
			}
		}

		var M = 0;
		var u = new int[s.Length];
		for (int i = 0; i < s.Length; i++)
		{
			if (!st[i] || u[i] > 0) continue;

			var j = i;
			while (st[MInt(j - t.Length, s.Length)])
			{
				j = MInt(j - t.Length, s.Length);
				if (j == i) { Console.WriteLine(-1); return; }
			}

			var c = 0;
			while (st[j])
			{
				u[j] = ++c;
				j = (j + t.Length) % s.Length;
			}
			M = Math.Max(M, c);
		}
		Console.WriteLine(M);
	}

	static int MInt(int x, int mod) => (x %= mod) < 0 ? x + mod : x;
}


Measured memory_bytes: 19296
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <queue>
#include <stack>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <set>
#include <string.h>
#include <stdlib.h>

using namespace std;
// vector push_back push front top empty pop make_pair long long insert begin end  
typedef long long ll;
typedef vector<int> vi;
typedef vector<pair <int,int> > vpi;
typedef vector<long long> vll;
typedef pair<int,int> pi;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define B begin()
#define RB rbegin()
#define E end()
#define RE rend()
#define Z size()
#define REP(i,a,b) for (int i = a; i < b; i++)
#define L length()
#define show(a) cerr << " *** " << a << endl;
#define show1(a) cerr << " /// " << a << endl;
#define valid(a,b,c) (a >= b && a < c ? 1 : 0)
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
const int mod = (int)1e9 + 7;
void ads(ll &a, ll b){a += b;if (a >= mod)a -= mod;}
void mis(ll &a, ll b){a -= b;if (a >= mod)a -= mod; if (a < 0)a += mod;}
ll gcd(ll a, ll b) {return (b==0? a:gcd(b,a%b));}
ll egcd(ll a, ll b, ll & x, ll & y) {if (a == 0){x = 0;y = 1;return b;}ll x1, y1;ll d = egcd(b % a, a, x1, y1);x = y1 - (b / a) * x1;y = x1;return d;}
ll mbinp(ll a, ll b){a %= mod;if (b == 0)return 1;ll ans = mbinp(a, b/2);ll tmp = (ans * ans) % mod;if (b % 2)return ((tmp * a) % mod);return ((tmp) % mod);}
ll binp(ll a, ll b){if (b == 0)return 1;ll ans = binp(a, b/2);ll tmp = (ans * ans);if (b % 2)return ((tmp * a));return ((tmp));}

const int maax = 100 * 1000 + 50;
ll dp[maax];
ll acc[maax];
int tab[110];
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int n,k;
	cin >> n >> k;
	REP(i,0,n)
		cin >> tab[i];
	dp[0] = 1;
	REP(j,0,n)
	{
		for (int used = k; used >= 0; used--)
		{
			int r = min(used + tab[j],k);
			int l = used+1;
			if (l <= r)
			{
				if (r+1 <= k)
					mis(acc[r+1],dp[used]);
				ads(acc[l],dp[used]);
			}
		}
		/*REP(i,0,k+1)
		  cout << acc[i] << " ";
		  cout << endl;*/
		ll pre = 0;
		REP(x,0,k+1)
		{
			ads(pre,acc[x]);
			acc[x] = 0;
			ads(dp[x], pre);
		}
	}
	cout << dp[k];
}


Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <numeric>
#include <math.h>
#include <stdlib.h>
using namespace std;

int main() {
    int n;
    cin >> n;
    int w[n];
    for (int i = 0; i < n; ++i) cin >> w[i];
    int s1 = w[0];
    int s2 = accumulate(w + 1, w + n, 0);
    int dif;
    for (int i = 1; i < n; ++i) {
        dif = s2 - s1;
        if (dif > w[i]) {
            s1 += w[i];
            s2 -= w[i];
        } else {
            break;
        }
    }
    cout << abs(dif) << endl;
    return 0;
}

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

int main(void) {
    ll N;
    ll S = 0;
    cin >> N;
    ll tmp = N;
    while(tmp) {
        S += tmp % 10;
        tmp /= 10;
    }
    if(N % S == 0) {
        cout << "Yes" << endl;;
    } else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,N) for(i=0;i<N;i++)
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL;
  typedef pair<ll,char> PLC;
  typedef pair<char,ll> PCL;

typedef struct{
  int u,v,w;
}T;

bool comp(const T& l, const T& r){
  if(l.u == r.u){
    return l.v < r.v;
  }
  return l.u < r.u;
}

class UnionFind{
  public:
    //親の番号を格納．親の場合は-(その集合のサイズ)
    vector<int> Parent;
    int count;
    //作るときはParentの値をすべて-1にする
    UnionFind(int N){
      Parent = vector<int>(N,-1);
      count = N;
    }

    //親を求める
    int find(int x){
      if(Parent[x] < 0) return x;
      //親の紐づけを変更
      return Parent[x] = find(Parent[x]);
    }

    //xの属する集合のサイズを取ってくる
    int size(int x){
      return -Parent[find(x)];
    }

    //xとyの属する集合を併合
    //併合できたらtrue，すでに併合していたらfalse 
    bool unite(int x, int y){
      //xとyを直接つけない，親同士をつける
      x = find(x);
      y = find(y);
      if(x==y) return false;

      //大きいほうに小さいほうをくっつける
      if(size(x) < size(y)) swap(x,y);

      //xのサイズを更新
      Parent[x] += Parent[y];
      Parent[y] = x;
      count--;
      return true;
    }

    //xとyが同じ集合に属するか
    bool same(int x, int y){
      return find(x) == find(y);
    }
};

int main(void){
  int N;cin >> N;
  UnionFind uni = UnionFind(N+1);
  vector<vector<int> > diff(N+1,vector<int>(0));
  queue<PII> que;
  int i;
  REP(i,N-1){
    int x,y;ll z; cin >> x >> y >> z;
    if(z%2 == 0) uni.unite(x,y);
    else{
      diff[x].push_back(y);
      diff[y].push_back(x);
      que.push(PII(x,y));
    }
  }
  while(!que.empty()){
    PII p = que.front();que.pop();
    int p_1 = uni.find(p.first), p_2 = uni.find(p.second);
    diff[p_1].push_back(p_2);
    diff[p_2].push_back(p_1);
  }
  map<int,int> m;
  vector<int> Parent;
  REP(i,N){
    int pare = uni.find(i+1);
    if(m.count(pare))continue;
    m[pare] = 1;
    Parent.push_back(pare);
  }
  REP(i,Parent.size()){
    int pare = Parent[i];
    for(int j = 1; j<diff[pare].size();j++){
      uni.unite(diff[pare][0],diff[pare][j]);
    }
  }
  REP(i,N){
    if(uni.same(1,i+1)) cout << 1 << endl;
    else cout << 0 << endl;
  }
  return 0;
}


Measured memory_bytes: 11896
#include <iostream>

using namespace std;

int main()
{
    char p;
    int n, x, num = 0;
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> p >> x;
        if (p == '(') {
            num += x;
        }
        else{
            num -= x;
        }
        if (num < 0) {
            cout << "NO" << endl;
            return 0;
        }
    }
    if (num == 0) {
        cout << "YES" << endl;
    }
    else{
        cout << "NO" << endl;
    }

    return 0;
}

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

#define mod      1e9+7;
#define INF      1e9+9;
#define ps(x,y)  fixed<<setprecision(y)<<x
# define PI 3.14159265358979323846264338327950 L
typedef long long ll;
typedef unsigned long long ull;
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
#endif
	int x;
	cin>>x;
	if(x>=30)
		cout<<"Yes\n";
	else
		cout<<"No\n";

	return 0;
}

Measured memory_bytes: 3572
#include <iostream>
using namespace std;
int main(){
  int A, B;
  cin >> A >> B;
  if (A > B && B != 1){
    cout << "Alice" << endl;
  }else if(A < B && A != 1){
    cout << "Bob" << endl;
  }else if(A == 1 && B != 1){
    cout << "Alice" << endl;
  }else if(B == 1 && A != 1){
    cout << "Bob" << endl;
  }else{
    cout << "Draw" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#include<iomanip>
#include<set>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define brep(index,num) for(int index=num-1;index>=0;index--)
#define brep1(index,num) for(int index=num;index>0;index--)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-9
#define mp(a1,a2) make_pair(a1,a2)
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef long long ll;
typedef long double ld;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=1e+18+1;
int INF=1e+9+1;
int main(){
	int K,T,a[101],amax=0;
	scan(K>>T);
	rep(i,T) scan(a[i]),amax=max(amax,a[i]);
	prin(max(0,amax-(K-amax+1)));
	return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
char a[100];
int b[30]={0},c[30]={0};
int main(){
    int n,i,j,t;
    scanf("%d",&n);
    getchar();
    for(i=0;i<n;i++){
        scanf("%s",a);
        t=strlen(a);
        if(i==0){
            for(j=0;j<t;j++){
                b[a[j]-'a']++;
            }
        }
        else{
            for(j=0;j<t;j++){
                c[a[j]-'a']++;
            }
            for(j=0;j<26;j++){
                if(b[j]>c[j])
                    b[j]=c[j];
            }
            memset(c,0,sizeof(c));
        }

    }
    for(i=0;i<26;i++){
      //printf("%d ",b[i]);
            for(j=1;j<=b[i];j++)
                printf("%c",i+'a');
    }
    printf("\n");

    return 0;
}


Measured memory_bytes: 128
#include<cstdio>
#include<algorithm>
#define fo(i,a,b) for(i=a;i<=b;i++)
using namespace std;
const int maxn=2000+10;
int h[maxn],go[maxn*2],nxt[maxn*2],f[maxn][maxn],g[maxn],dep[maxn];
int i,j,k,l,t,n,m,tot,top,ans;
void add(int x,int y){
	go[++tot]=y;
	nxt[tot]=h[x];
	h[x]=tot;
}
void dfs(int x,int y){
	f[x][0]=1;
	dep[x]=0;
	int t=h[x],i,j;
	while (t){
		if (go[t]!=y){
			dfs(go[t],x);
			fo(i,0,m) g[i]=f[x][i];
			fo(i,0,dep[x])
				fo(j,0,dep[go[t]])
					if (i+j+1<=m) g[max(i,j+1)]=max(g[max(i,j+1)],f[x][i]+f[go[t]][j]);
			dep[x]=max(dep[x],dep[go[t]]+1);
			fo(i,0,m) f[x][i]=g[i];
		}
		t=nxt[t];
	}
	fo(i,0,m) ans=max(ans,f[x][i]);
}
int main(){
	scanf("%d%d",&n,&m);
	if (m==0){
		printf("%d\n",n-1);
		return 0;
	}
	fo(i,1,n-1){
		scanf("%d%d",&j,&k);
		add(j,k);add(k,j);
	}
	fo(i,0,n)
		fo(j,0,n)
			f[i][j]=-n;
	dfs(1,0);
	ans=n-ans;
	printf("%d\n",ans);
}

Measured memory_bytes: 16000
#include<bits/stdc++.h>
using namespace std;
int main()
{
      ios_base::sync_with_stdio(false);
      long long int n,k,a,b=0,c,m,i,j,p,q;
      cin>>n;
      for(i=1;i<=n;i++){
            if(i%3!=0 && i%5!=0)b+=i;
      }
      cout<<b;
      return 0;
}


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

int main(){
    string word,word2,p;
    int x,b,a;
    cin >> word;
    cin >> x;
    for(int i=0;i<x;i++){
        cin >> word2 >> a >> b;
        if(word2=="print") cout << word.substr(a,b-a+1) << endl;
        else if(word2=="reverse"){
            string word3 = word.substr(a,b-a+1);
            int n = word3.size();
            for(int i=0;i<n;i++) word[i+a] = word3[n-i-1];
        }else if(word2=="replace"){
            cin >> p;
            word = word.replace(a,b-a+1,p);
        }
    }
    return 0;
}


Measured memory_bytes: 3216
n = gets.strip.to_i
h = gets.strip.split.map(&:to_i)

high = 0
count = 0

(1..n-1).each do |i|
  if h[i-1] >= h[i]
    count += 1
    high = count if count > high
  else
    count = 0
  end
end

puts high

Measured memory_bytes: 9604
#include <iostream>
#include <vector>

using namespace std;

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

    vector<int> city(N, 0);
    for (int i = 0; i < M; i++) {
        int a, b; cin >> a >> b; a--; b--;
        city[a]++;
        city[b]++;
    }

    for (auto c: city) {
        cout << c << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define lld long long
#define N 200005
#define INF 1e18
#define INF2 1e16
#define mod 998244353
lld power(lld a,lld b,lld c){
  lld ans=1;
  while(b){
    if(b&1){
      ans=ans*a%mod;
    }
    a=a*a%mod;
    b=b/2;
  }
  return ans;
}
int main() {
	lld a,b,c;
	cin>>a>>b>>c;
	if(c<a+b)
	{
		cout<<"No";
		return 0;
	}
	c=c-a-b;
	if(c*c>4*a*b)cout<<"Yes";
	else cout<<"No";
}

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

int main() {
    int n;
    cin >> n;
    int a[n];
    for (int i = 0; i < n; i++)
        cin >> a[i];
    int odd = 0;
    for (int i = 0; i < n; i++) {
        if (a[i] % 2 != 0)
            odd++;
    }
    if (odd % 2 == 0)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 640
import java.util.*;

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

Measured memory_bytes: 24020
#include <iostream>
#include <vector>
#include <cstdio>
#include <algorithm>
#include <string>
#include <stack>
#include <deque>
using namespace std;
int N;
deque<int> dq;
int main(){
  cin >> N;
  int a;
  for(int i=0;i<N;i++){
    cin >> a;
    if(i%2==1){
      dq.push_back(a);
    }
    else dq.push_front(a);
  }

  deque<int> ::iterator itr;
  if(N%2==1){
    for( itr = dq.begin();itr!=dq.end();++itr)cout << *itr << " ";
  }
  else{
    itr=dq.end()-1;
    while(1){
      cout << *itr << " ";
      if(itr==dq.begin())break;
      itr--;
    }
  }
  
  return 0;
}


Measured memory_bytes: 2944
#include <bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define rep_start(a,i,n) for(ll i=a;i<=n;i++)
#define rev(i,n) for(ll i=n-1;i>=0;i--)
#define rev1(i,n) for(ll i=n;i>0;i--)
#define sz(a) int((a).size())
#define all(c) c.begin,c.end()
#define tr(c,i) for(typeof(c).begin() i=c.begin; i!=c.end(); i++)
#define present(c,x) (c.find(x)!=c.end())
#define cpresent(c,x) (find(all(c),x)!=c.end())
#define pb push_back
#define F first
#define S second
#define INF 1e9+7
typedef long long int ll;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef pair<int,int> ii;
typedef vector<ii> vii;

void solve(){
    int n;string str;
    cin>>n;
    set<string> s;
    rep(i,n) {cin>>str; s.insert(str);}
    cout<<s.size();
}

signed main() {
    // your code goes here
    IOS
    ll t=1;
    //cin>>t;
    rep1(i,t){
        solve(); 
    }
    return 0;
}

Measured memory_bytes: 19224
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define INF (1<<29)
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
int gcd(int a,int b){
	if(b==0)return a;
	return gcd(b,a%b);
}
int lcm(int a,int b){
	return a/gcd(a,b)*b;
}
bool prime(int p){
	for(int i=2;i<=sqrt(p);i++){
		if(!p%i)return false;
	}
	return true;
}
int modpow(int a,int b){
    if(b==0)return 1;
    if(b==1)return a%MOD;
    if(b%2)return modpow(a,b-1)*a%MOD;
    else return modpow(a,b/2)*modpow(a,b/2)%MOD;
}
int comb(int a,int b){
    if(b==0||a==b)return 1;
    if(b==1)return a%MOD;
    return (comb(a-1,b-1)+comb(a-1,b))%MOD;
}
// Library End !
int n,a[100000],ans=1;
int u=1;
signed main(){
	cin>>n;
	rep(i,n)cin>>a[i];
	if(a[0]>a[1])u=0;
	if(a[0]<a[1])u=2;
	for(int i=1;i<n-1;i++){
		if(u==2&&a[i]>a[i+1]){
			ans++;
			u=1;
			i++;
		}
		if(u==0&&a[i]<a[i+1]){
			ans++;
			u=1;
			i++;
		}
		if(a[i]<a[i+1])u=2;
		if(a[i]>a[i+1])u=0;
	}
	cout<<ans<<endl;
	return 0;
}


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

int main(){
  int T;
  cin>>T;
  while(T--){
    ll h,w;
    cin>>h>>w;
    if(h==w){
      cout<<"1 0"<<endl;
    }else{
      ll z=__gcd(h,w);
      h/=z;
      w/=z;
      
      ll a=h*w/2;
      ll b=h*w-a;
      ll x=__gcd(a,b);
      a/=x;
      b/=x;
      cout<<b<<' '<<a<<endl;
    }
  }
  return 0;
}

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

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める

int main(){
    int H,W,K;
    cin >> H >> W >> K;
    char map[6][6];
    REP(i,H){
        REP(j,W){
            cin >> map[i][j] ;
        }
    }
    int ans=0;
    for(int i=0;i<(1<<H);i++){
        for(int j=0;j<(1<<W);j++){
            int num=0;
            REP(a,H){
                REP(b,W){
                    if(!(i & (1<<a)) && !(j & (1<<b)) && map[a][b] == '#'){
                        num++;
                    }
                }
            }
            if(num == K) ans++;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3672
#include <bits/stdc++.h>
#define fo(i,a) for(i = 0;i < a;i++)
using namespace std;
int main(void)
{
	int n,m,fr=0,i,a[10001],b[10001],flag[10001]={0};
	flag[0] = 1;
	
	cin >> n >> m ;
	while(n != 0 || m != 0){
		fo(i,m){
			cin >> a[i] >> b[i] ;
			if(a[i] == 1){
				fr++ ;
				flag[b[i]] = 2 ;
			}
		}
		fo(i,m){
			if(flag[a[i]] == 2 && flag[b[i]] == 0){
				fr++ ;
				flag[b[i]] = 3 ;
			}
		}
		fo(i,m){
			if(flag[a[i]] == 0 && flag[b[i]] == 2){
				fr++ ;
				flag[a[i]] = 3 ;
			}
		}
		cout << fr-1 << endl;
		fr = 0;
		flag[0] = 1 ;
		fill (flag,flag + 10001,0);
		cin >> n >> m ;
	}
	
	return 0;
}

Measured memory_bytes: 3164
# coding: utf-8
import numpy as np


def solve(*args: str) -> str:
    n, k = map(int, args[0].split())
    A = np.array(tuple(map(int, args[1].split())))

    l, r = 0, np.max(A)
    while l+1 < r:
        m = (l+r)//2
        if k < np.sum(np.ceil(A/m)-1):
            l = m
        else:
            r = m

    return str(r)


if __name__ == "__main__":
    print(solve(*(open(0).read().splitlines())))


Measured memory_bytes: 51204
#include<bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
#define pb push_back
int dy[]={0, 0, 1, -1, 1, 1, -1, -1};
int dx[]={1, -1, 0, 0, 1, -1, -1, 1};

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define mp make_pair
#define fi first
#define sc second
ll n,m;
vector<ll> G[300000];
bool used[300000];
bool dfs(ll i,ll j) {
	if(i == n - 1) {
		return true;
	}
	if(j >= 2) 
		return false;

	bool ret = false;
	REP(k,G[i].size()) {
		if(!used[G[i][k]]){
			used[G[i][k]] = true;
			ret |= dfs(G[i][k],j + 1);
		}
	}
	return ret;
}
int main(){
	cin >> n >> m;
	REP(i,m) {
		ll a,b;
		cin >> a >> b;
		a--;b--;
		G[a].pb(b);
		G[b].pb(a);
	}
	if(dfs(0,0)) {
		cout << "POSSIBLE" << endl;
	}else {
		cout <<"IMPOSSIBLE" << endl;
	}

	return 0;
}


Measured memory_bytes: 15336
#define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<queue>
#include<cmath>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<stack>
#include<cstdio>
#include<cstring>
#include<bitset>
#include<unordered_map>
#include<climits>
#include<fstream>
#include<time.h>
#include<cassert>

using namespace std;
#define ll long long
#define ld long double
#define int long long
#define all(a) (a).begin(),(a).end()
#define EPS (1e-13)
#define fs first
#define sc second
#define xx first
#define yy second.first
#define zz second.second
#define H pair<int, int>
#define P pair<int, pair<int, int>>
#define Q(i,j,k) mkp(i,mkp(j,k))
#define rep(i,n) for(int (i) = 0 ; (i) < (n) ; (i)++)
#define mkp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define crdcomp(b) sort(all((b)));(b).erase(unique(all((b))),(b).end())
#define ssp(i,n) (i==n-1?"\n":" ")
const int mod = 1e9 + 7;
const int Mod = 998244353;
const ll Inf = 3 * 1e18;
const int inf = 15 * 1e8;
ll read() {
	ll u, k = scanf("%lld", &u);
	return u;
}
ll gcd(ll i, ll j) {
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcd(j % i, i);
}
ll mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x % p;
		x = x * x % p;
		n >>= 1;
	}
	return res;
}
ll bcount(ll x) {
	int sum = 0;
	for (int i = 0; i < 20; i++)
		if ((1ll << i) & x) sum++;
	return sum;
}
const int fn_ = 2000000;
ll fact_[fn_], comp_[fn_];
ll comb(ll x, ll y, ll Mod = mod) {
	if (!fact_[0]) {
		fact_[0] = 1; comp_[0] = 1;
		for (int i = 1; i < fn_; i++) {
			fact_[i] = fact_[i - 1] * i % Mod;
			comp_[i] = mod_pow(fact_[i], Mod - 2, Mod);
		}
	}
	if (x < y) return 0;
	return fact_[x] * comp_[x - y] % Mod * comp_[y] % Mod;
}
//---------------------------------------------------
int a, b;
signed main() {
	cin >> a >> b;
	cout << max({ a + b,a - b,a * b }) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin >> s;
  if(s=="abc"||s=="acb"||s=="bac"||s=="bca"||s=="cab"||s=="cba"){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
    int n; cin >> n;
    int ans = 100;
    for (int i = 0; i < n; i++) { 
        int a;
        cin >> a;
        int cnt = 0;
        while (a % 2 == 0) {
            cnt++;
            a /= 2;
        }
        ans = min(ans, cnt);
    }
    cout << ans << endl; 
}

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

using namespace std;

const int MAXN = 300;
long double dp[MAXN + 1][MAXN + 1][MAXN + 1];

int main()
{
    int n;
    cin >> n;
    int a, b, c;
    a = b = c = 0;
    for (int i = 0; i < n; i++)
    {
        int x;
        cin >> x;
        if (x == 1)
            a++;
        else if (x == 2)
            b++;
        else
            c++;
    }
    for (int sum = 1; sum <= n; sum++)
    {
        for (int three = 0; three <= sum; three++)
        {
            for (int two = 0; two + three <= sum; two++)
            {
                int one = sum - (three + two);
                int zero = n - (one + two + three);
                dp[one][two][three] = 1 / ((long double) sum / n) - 1;
                if (one)
                    dp[one][two][three] += ((long double) one / sum) * (1 + dp[one - 1][two][three]);
                if (two)
                    dp[one][two][three] += ((long double) two / sum) * (1 + dp[one + 1][two - 1][three]);
                if (three)
                    dp[one][two][three] += ((long double) three / sum) * (1 + dp[one][two + 1][three - 1]);
            }
        }
    }
    cout << fixed << setprecision(10) << dp[a][b][c] << endl;
    return 0;
}


Measured memory_bytes: 426240
#include <bits/stdc++.h>
#define ll long long
#define dot cout<< setprecision(20)<<endl;
#define vsor(x) sort(x.begin(),x.end());
#define vrev(x) reverse(x.begin(),x.end());
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define bit(b,n) for(int b=0;b<(1<<(ll)(n));b++)
 
 using namespace std;

ll n;


 int main(){
     cin>>n;
     cout<<0<<endl;
     for(int i=2;i<=n;i++){
         int ans=0;
     for(int x=1;x*x<i;x++)
     for(int y=x;y*y<i;y++)
     for(int z=y;z*z<i;z++){
         if(x*x+y*y+z*z+x*y+y*z+z*x==i&&x==y&&y==z)ans++;
         if(x*x+y*y+z*z+x*y+y*z+z*x==i&&((x==y&&y!=z)||(y==z&&z!=x)||(z==x&&x!=y)))ans+=3;
         if(x*x+y*y+z*z+x*y+y*z+z*x==i&&(x!=y&&y!=z))ans+=6;
     }
     cout<<ans<<endl;
     }
 }

Measured memory_bytes: 3568
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <utility>
#include <algorithm>
#include <cstdio>
#include <iomanip>
#include <queue>
#include <deque>
#include <stack>
#include <fstream>
#include <cmath>
#include <random>
#include <complex>
#include <functional>

#define ll int64_t
#define Rep(i, n) for (ll i = 0; i < n; i++)
using namespace std;
typedef vector<ll> vec;
typedef vector<vec> mat;

const ll inf = 1LL << 60;

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

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

    ll N;
    cin >> N;
    vec X(N);
    Rep (i, N) {
        cin >> X[i];
    }

    ll ans = inf;
    for (ll i = 1; i <= 100; i++) {
        ll tmp = 0;
        Rep (j, N) {
            tmp += (X[j] - i) * (X[j] - i);
        }
        chmin(ans, tmp);
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
    long long a, b, k;
    cin >> a >> b >> k;
    if(a < k){
        cout << 0 << " ";
        k -= a;
        if(b < k) cout << 0;
        else cout << b - k;
    }
    else cout << a - k << " " << b;
    return 0;
}

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

int main() {
  int N, M;
  cin >> N >> M;
  
  vector<int> vec(N);
  for (int i = 0; i < N; i++) {
    cin >> vec.at(i);
  }
  
  int sum = 0;
  for (int i = 0; i < N; i++) {
    sum += vec.at(i);
  }
  
  sort(vec.begin(), vec.end()); 
  reverse(vec.begin(), vec.end());
  
  if (vec.at(M -1) * (4*M) >= sum){
    cout << "Yes" << endl;
  }
  
  else{
    cout << "No" << endl;
  }   
      
}

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

#define REP(i,n) for(int i=0;i<(int)(n);i++)
int main()
{
    int mat[200005][25];
    long long int inp;
    long long int ans=0;
    long int n;
    scanf("%ld\n",&n);
    int poi=0;
    for(long int i=0;i<n;i++)
    {
        poi=0;
        scanf("%lld ",&inp);
        while(poi<=20)
        {
            mat[i][poi]=inp%2;
            inp=(inp-mat[i][poi])/2;
            poi++;
        }
    }
    int keep[25]={0};
    int check=0;
    long int down=0;
    long int up=0;
    REP(i,21)keep[i]=mat[0][i];
    while(down<n)
    {
        if(check==0 && up<n-1)
        {
            up++;
            REP(i,21)
            {
                keep[i]+=mat[up][i];
                if(keep[i]==2)check=1;
            }
        }
        else
        {
            if(check==1)ans+=up-down;
            else ans+=up-down+1;
            //printf("%ld %ld##\n",down,up);
            check=0;
            down++;
            REP(i,21)
            {
                keep[i]-=mat[down-1][i];
                if(keep[i]==2)check=1;
            }
        }
    }
    printf("%lld\n",ans);
    return 0;
}

Measured memory_bytes: 19840
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<math.h>
using namespace std;

int main()
{
    char s[20];
    cin>>s;
    int len=strlen(s),aa=0,cc=0,flag=0;
    for(int i=0; s[i]!='\0'; i++)
        if(s[i]=='A')
        {
            aa++;
            if(i!=0)flag=1;
        }
        else if(s[i]=='C')
        {
            cc++;
            if(i==1||i==len-1)flag=1;
        }
        else if(s[i]-'a'<0)flag=1;
    if(flag)cout<<"WA"<<endl;
    else if(aa!=1||cc!=1)cout<<"WA"<<endl;
    else cout<<"AC"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<stdbool.h>
#include<time.h>
#include<math.h>
#include<assert.h>
#define inf 1072114514
#define llinf 4154118101919364364
#define mod 1000000007
#define pi 3.1415926535897932384
int max(int a,int b){if(a>b){return a;}return b;}
int min(int a,int b){if(a<b){return a;}return b;}
int zt(int a,int b){return max(a,b)-min(a,b);}
int gcd(int a,int b){int c;while(b!=0){c=a%b;a=b;b=c;}return a;}
int lcm(int a,int b){int c=gcd(a,b);a/=c;return a*b;}
int nCr(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
int nHr(int a,int b){return nCr(a+b-1,b);}
int fact(int a){int i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}
int dsum(int x){int r=0;while(x){r+=(x%10);x/=10;}return r;}
int dsumb(int x,int b){int r=0;while(x){r+=(x%b);x/=b;}return r;}
int sankaku(int x){return ((1+x)*x)/2;}
void swap(int *a,int *b){int c;c=(*a);(*a)=(*b);(*b)=c;}
//小さい順
int compareInt(const void* a, const void* b){int aNum = *(int*)a;int bNum = *(int*)b;return aNum - bNum;}

int main(void){
    char ei[100];
    scanf("%s",ei);
    int cnt=0;
    while(ei[cnt]!='\0'){
        cnt++;
    }
    for(int i=0;i<cnt;i++){
        int chk=0;
        for(int j=0;j<cnt;j++){
            if(ei[i]==ei[j]){
                chk++;
            }
        }
        if(chk%2!=0){
            printf("No");
            return 0;
        }
    }
    printf("Yes");
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cassert>
#include <cctype>
using namespace std;
typedef long long lint;
#define cout cerr
#define ni (next_num<int>())
template<class T>inline T next_num(){
	T i=0;char c;
	while(!isdigit(c=getchar())&&c!='-');
	bool flag=c=='-';
	flag?c=getchar():0;
	while(i=i*10-'0'+c,isdigit(c=getchar()));
	return flag?-i:i;
}
template<class T1,class T2>inline void apmax(T1 &a,const T2 &b){if(a<b)a=b;}
template<class T1,class T2>inline void apmin(T1 &a,const T2 &b){if(b<a)a=b;}
const int N=2010,O=924844033;
int f[N][N][2][2],g[N];
inline void dp(int n){//n slots n elements
	memset(f,0,sizeof(f));
	f[0][0][0][0]=1;
	for(int i=1;i<=n;i++){
		for(int j=0;j<i;j++){
			for(int a=0;a<2;a++){//i-1
				for(int b=0;b<2;b++){//i
					int F=f[i-1][j][a][b];
					if(F==0)continue;
					//use nothing
					(f[i][j][b][0]+=F)%=O;
					//use i-1
					if(a==0&&i>1){
						(f[i][j+1][b][0]+=F)%=O;
					}
					//use i+1
					if(i<n){
						(f[i][j+1][b][1]+=F)%=O;
					}
				}
			}
		}
	}
	for(int i=0;i<=n;i++){
		g[i]=(f[n][i][0][0]+f[n][i][1][0])%O;
	}
}
int h[N];
int fac[N];
inline void gmath(int n){
	fac[0]=1;
	for(int i=1;i<=n;i++){
		fac[i]=(lint)fac[i-1]*i%O;
	}
}
inline int Main(){
	int n=ni,k=ni;
	gmath(n);
	int sum=0,lastlen=-1;
	memset(h,0,sizeof(h));
	h[0]=1;
	for(int i=1;i<=k;i++){
		int curlen=(n-i)/k+1;
		if(curlen!=lastlen){
			dp(lastlen=curlen);
		}
		for(int j=sum;j>=0;j--){
			lint tmp=h[j];
			h[j]=0;
			for(int k=0;k<=curlen;k++){
				(h[j+k]+=tmp*g[k]%O)%=O;
			}
		}
		sum+=curlen;
	}
	lint ans=0;
	for(int i=0;i<=n;i++){
		if(i&1){
			ans-=(lint)h[i]*fac[n-i]%O;
		}else{
			ans+=(lint)h[i]*fac[n-i]%O;
		}
	}
	return (ans%O+O)%O;
}
int main(){
	printf("%d\n",Main());
	return 0;
}

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

int main() {
  int a, b;
  scanf("%d %d", &a, &b);
  int product = a * b;
  if (product % 2 == 0) {
	printf("Even\n");
  } else {
    printf("Odd\n");
  }
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
	int n, m;
	int xi, yi;
	vector<int>	x, y;

	cin >> n >> m >> xi >> yi;

	x.push_back(xi);
	y.push_back(yi);

	for (int i = 0; i < n; ++i) {
		cin >> xi;
		x.push_back(xi);
	}

	for (int i = 0; i < m; ++i) {
		cin >> yi;
		y.push_back(yi);
	}

	sort(x.begin(), x.end());
	sort(y.begin(), y.end());

	cout << (x.back() < y.front() ? "No War" : "War") << endl;
}

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

#define lli long long int
#define pb push_back


main()
{
    lli n,c,a,b,i,j;
    cin>>n>>c;
    lli w[n],v[n];
    lli dp[100001];

    for(i=0;i<n;i++)
    {
        cin>>w[i]>>v[i];
    }
    for(i=1;i<=100000;i++)
    {
        dp[i] = c+1;
    }
    dp[0] = 0;
    for(i=0;i<n;i++)
    {
        for(j=100000;j>=v[i];j--)
        {
            if(dp[j-v[i]] < c)
            {
                dp[j] = min(dp[j], (dp[j-v[i]] + w[i]));
            }
        }
    }

    for(i=100000;i>=0;i--)
    {
        if(dp[i]<=c)
        {
            cout<<i;
            break;
        }
    }
}


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

int main() {
        int n,k;
        cin >> n;
        cin>>k;
        int arr[n];
        for(int i { 0 }; i < n; ++i){
            cin >> arr[i];
        }
for(int i=k+1;i<=n;i++){
    if(arr[i-1]>arr[i-k-1]){
        cout<<"Yes\n";
    }
    else{
        cout<<"No\n";
    }
    }
}


Measured memory_bytes: 4416
#include <iostream>
#include <string>
#include <cstring>
#include <iostream>
#include <string>
#include <cstring>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <utility>
#define int long long
using namespace std;
signed main(){
    int n;
    int a,b,c,d;
    cin>>n>>a>>b>>c>>d;
    string s;
    cin>>s;
    bool ans=true;
    vector<bool> sh(s.size(),false);
    for(int i=1;i<s.size()-1;i++){
        if(s[i]=='#'){
            if(s[i-1]=='.')sh[i-1]=true;
            if(s[i+1]=='.')sh[i+1]=true;
        }
    }
    if(s[s.size()-1]=='#'){
        if(s[s.size()-2]=='.')sh[s.size()-2]=true;
    }
    for(int i=a;i<max(c,d)-1;i++)if(s[i]=='#'&&s[i+1]=='#')ans=false;
    int count1=0;
    int count2=0;
    for(int i=b-1;i<min(c,d);i++){
        if(s[i]=='.')count1++;
        if(s[i]=='.'&&sh[i]==true)count2++;
    }
    if(c>d){
        if(count1==count2)ans=false;
    }
    if(ans==true)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}


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

int main(){
  int H, W;
  cin >> H >> W;
  
  vector<vector<char>>data(H, vector<char>(W));
  vector<int> judge(H, 0);
  vector<int> judge2(W, 0);
  
  for(int i=0; i<H; i++){
    for(int j=0; j<W; j++){
      cin >> data.at(i).at(j);
      if(data.at(i).at(j) == '#'){       
        judge.at(i) = 1;
        judge2.at(j) = 1;
      }
    }
  }
  
  for(int i=0; i<H; i++){
    if(judge.at(i) == 1){
      for(int j=0; j<W; j++){
        if(judge2.at(j) == 1){
          cout << data.at(i).at(j);
        }
        if(j == W-1){
          cout << endl;
        }
      }
    }
  }
}


Measured memory_bytes: 256
def main():
    s = input()
    q = int(input())
    l,r = '',''
    rev = 0
    for i in range(q):
        Q = input().split()
        if Q[0]=="1":
            rev = (rev+1)%2
        else:
            if Q[1]=='1':
                if rev==0:
                    l = Q[2]+l
                else:
                    r = r+Q[2]
            else:
                if rev==0:
                    r = r+Q[2]
                else:
                    l = Q[2]+l
    s = l+s+r
    if rev==0:
        print(s)
    else:
        print(s[::-1])

if __name__ == "__main__":
    main()

Measured memory_bytes: 4712
#include<bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  while(cin >> n >> m, n | m) {
    vector<int> sum = {0};
    for(int i = 0; i < n; ++i) {
      int K;
      cin >> K;
      sum.push_back((sum.back() + (K % m)) % m);
    }
    int answer = 0;
    set<int> used = {m};
    for(auto j: sum) {
      answer = max(answer, (j - *used.upper_bound(j) + m) % m);
      used.insert(j);
      used.insert(j + m);
    }
    cout << answer << "\n";
  }
}

Measured memory_bytes: 3708
// lcmとか__builtin_popcountとかはg++ -std=c++17 default.cppみたいなかんじで

#include <bits/stdc++.h>
#define mod 1000000007
#define INF LLONG_MAX
#define ll long long
#define ln cout<<endl
#define Yes cout<<"Yes"<<endl
#define NO cout<<"NO"<<endl
#define YES cout<<"YES"<<endl
#define No cout<<"No"<<endl
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
using namespace std;
ll dx[4]={1,0,-1,0};
ll dy[4]={0,1,0,-1};

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

    ll  a,b,c,d,e,n,k,maxi=0,f=0,mini=INF,sum=0,q;
	string str,stra,ko;
    ll x,y,w,z;
    char hoge,fuga;
    cin>>n;
    set<char> ch;
    rep(i,n){
        cin>>hoge;
        ch.insert(hoge);
    }
    if(ch.size()==3) cout<<"Three"<<endl;
    else cout<<"Four"<<endl;
    return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <vector>
#include <tuple>
#include <queue>
#include <stack>
#include <set>
#include <map>

#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define fi first
#define se second

typedef long long ll;

int N,M,W,K,A,B,S;

using namespace std;

int main() {
    cin >> N;
    int k = N/2;
    int k2 = k*2;
    int diago;

    if(N%2 == 0) M = k2 * (k-1);
    if(N%2 == 1) M = k2 * k;

    cout << M << endl;
    rep(i,k2){
        diago = k2 - i - 1;
        reps(j,i+1,k2){
            if(j == diago) continue;
            cout << i+1 << ' ' << j+1 << endl;
        }
    }

    if(N%2 == 1) {
        rep(i,k2) cout << i+1 << ' ' << N << endl;
    }

}

Measured memory_bytes: 256
fun main (args:Array<String>) {
    val a = readLine()!!
    if (a!=a.reversed()){
        println("No")
        return
    }
    val b=a.substring(0,(a.length-1)/2)
    if (b != b.reversed()) {
        println("No")
        return
    }

    val c = a.substring(((a.length + 3) / 2) - 1, a.length)
    if (c != c.reversed()) {
        println("No")
        return
    }
    println("Yes")
}

Measured memory_bytes: 33844