akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
const int MX = 100005;
int n, m, a, b, c[MX], t;
bool out;
vector<int> G[MX];
int main(){
	scanf("%d%d", &n, &m);
	rep(i,m){
		scanf("%d%d", &a, &b);
		c[--a]++; c[--b]++;
		G[a].push_back(b);
		G[b].push_back(a);
	}
	rep(i,n){
		if(c[i] % 2) out = true;
		else if(c[i] > 4) t = 3;
		else if(c[i] == 4) (t++ ? a : b) = i;
	}
	if(!out && t == 2) rep(i,3){
		int v = G[a][i], p = a, tmp;
		while(v != a && v != b) {
			tmp = v;
			v = G[v][G[v][0]==p];
			p = tmp;
		}
		if(v == a) t = 3;
	}
	puts(out || t < 3 ? "No" : "Yes");
}


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

using namespace std;

typedef long long ll;

#define mod 1000000007

int sum(int a, int b) {
    return (a + b) % mod;
}

int sub(int a, int b) {
    return (a - b + mod) % mod;
}

int a[110];
int dp[2][100010];

int n;
int go(int pos, int k) {
    if(pos == n) return k == 0;

    int ans = 0;

    for(int i = 0; i <= a[pos] && i <= k; i++) {
        ans += go(pos + 1, k - i);
    }

    return ans;
}


int memo[110][100010];

int main() {
    ios_base::sync_with_stdio(false);

    int k;
    cin >> n >> k;

    for(int i = 0; i < n; i++) {
        cin >> a[i];
    }
    for (int pos = n; pos >= 0; --pos) {
        for (int r = 0; r <= k; r++) {
            if (pos == n) memo[pos & 1][r] = r == 0;
            else {

                int ans = 0;

                int mn = r - min(a[pos], r);
                int mx = r;

//                for (int i = 0; i <= a[pos] && i <= r; i++) {
//                    ans += memo[pos + 1][r - i];
//                }

                memo[pos & 1][r] = sub(memo[(pos + 1) & 1][mx], (mn > 0 ? memo[(pos + 1) & 1][mn - 1] : 0));
            }
        }
        // prefix sum
        if(pos > 0)
        for(int i = 1; i <= k; i++) {
            memo[pos & 1][i] = sum(memo[pos & 1][i], memo[pos & 1][i - 1]);
        }
    }

//    cout << go(0, k) << endl;
    cout << memo[0 & 1][k] << endl;
}

/*
 * M
**/

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

#define ll long long
#define linf (1ll << 60)
#define all(x) (x).begin(), (x).end()

// -------- Main Code -------- //
void runcase() {
    string s;
    cin >> s;
    ll sum = 0;
    for (auto c: s) sum += c - '0';
    if (sum % 9 == 0) cout << "Yes\n";
    else cout << "No\n";
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    // int t;
    // cin >> t;
    // while (t-- > 0)
        runcase();
    return 0;
}


Measured memory_bytes: 3768
#include <cstdio>
#include <iostream>
using namespace std;
#define maxn 2000005
#define ma 10005
int a[maxn],b[maxn],c[maxn];
void countingSort(int k)
{
    for(int i=1;i<=k;++i)
        c[a[i]]++;
    for(int i=1;i<=ma;++i)
        c[i]=c[i-1]+c[i];
    for(int i=k;i>=1;--i)
    {
        b[c[a[i]]]=a[i];
        c[a[i]]--;
    }

}
int main()
{
    int n;
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
        scanf("%d",&a[i]);
    countingSort(n);
    for(int i=1;i<=n;i++)
    {
        if(i>1) printf(" ");
        printf("%d",b[i]);
    }
    printf("\n");
    return 0;
}

Measured memory_bytes: 18820
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
ll n;
cin>>n;
ll sum=0;
for(ll i=1;i<=n;i++)
{
    if((i%3!=0)&&(i%5!=0)&&(i%15!=0))
    {   
        //cout<<i<<" ";
        sum=sum+i;
    }
}
cout<<sum<<endl;
 return 0;
}

Measured memory_bytes: 3640
#include <iostream>                                                   
#include <vector>                                                     
using namespace std;                                                  
                                                                      
int main() {                                                          
  vector<int> Case;                                                   
  while (true) {                                                      
    int x;                                                            
    cin >> x;                                                         
    if (x==0) {                                                       
      break;                                                          
    }                                                                 
    Case.push_back(x);                                                
  }                                                                   
  for (int i=0; i<Case.size(); i++) {                                 
    cout << "Case" << " " << i+1 << ":" << " " << Case[i] << endl;    
  }                                                                   
  return 0;                                                           
}                                                                   

Measured memory_bytes: 3204
#include <bits/stdc++.h>
using namespace std;
int N;
const long long MOD = pow(10,9)+7;
vector<vector<long long>> multi(const vector<vector<long long>>& A,const vector<vector<long long>>& B){
  vector<vector<long long>> ret(N,vector<long long>(N));
  for(int i = 0; i < N; ++i){
    for(int j = 0; j < N; ++j){
      for(int k = 0; k < N; ++k)
        ret[i][j] = (ret[i][j]+A[i][k]*B[k][j])%MOD;
      //cout << i << " " << j << " " << ret[i][j];
    }
  }
  return ret;
}
int main(){
  long long K;
  cin >> N >> K;
  vector<vector<long long>> A(N,vector<long long>(N));
  for(int i = 0; i < N; ++i){
    for(int j = 0; j < N; ++j) cin >> A[i][j];
  }
  vector<vector<long long>> ret(N,vector<long long>(N));
  for(int i = 0; i < N; ++i) ret[i][i] = 1;
  while(K){
    if(K&1) ret = multi(ret,A);
    /*cout << " ******* " << K << endl;
    for(int i = 0; i < N; ++i){
      for(int j = 0; j < N; ++j) cout << ret[i][j] << '\t';
      cout << endl;
    }*/
    K >>= 1;
    A = multi(A,A);
    /*cout << " ******* A ******* " << K << endl;
    for(int i = 0; i < N; ++i){
      for(int j = 0; j < N; ++j) cout << A[i][j] << '\t';
      cout << endl;
    }*/
  }
  long long ans = 0;
  for(int i = 0; i < N; ++i){
    for(int j = 0; j < N; ++j) ans = (ans+ret[i][j])%MOD;
  }
  cout << ans;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int64_t i=0;i < (int64_t)(n);i++)
#define invrep(i,n) for(int64_t i=n-1;i >= 0;i--)
#define _GLIBCXX_DEBUG
using namespace std;

int main(){
  int64_t k,a,b;
  cin >> k >> a >> b;
  if(k <= a || a+2 >= b){
    cout << k+1;
  }else{
    if((k-a+1) % 2 == 0){
      cout << a+(b-a)*((k-(a-1))/2);
    }else{
      cout << 1+a+(b-a)*((k-a)/2) << endl;
    }
  }
}
      
      
      
    
      

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

int main(){
  
  int N, M;
  cin >> N >> M;
  
  vector<int> work(M);
  for (int i=0; i<M; i++){
    cin >> work.at(i);
  }
  
  int sum=0;
  for (int i=0; i<M; i++){
    sum = sum+work.at(i);
  }
  if(N-sum>=0){
    cout << N-sum << endl;
  }
  
  else {
    cout << "-1" << endl;
  }
}


Measured memory_bytes: 3668
#include <iostream>
#include <vector>
#include <queue>

using namespace std;

const long long INF = (1LL << 60);

bool valid(const vector<vector<pair<int,int>>>& g, long long v0){
	if(v0 <= 0) return false;
	const int n = g.size();
	vector<long long> value(n, 0);
	vector<int> visit(n, 0);
	queue<int> qu; qu.push(0);
	value[0] = v0;
	while(!qu.empty()){
		int curPos = qu.front(); qu.pop();
		if(visit[curPos]) continue;
		visit[curPos] = 1;
		for(auto next : g[curPos]){
			int nextValue = next.second - value[curPos];
			if(nextValue <= 0) return false;
			if(value[next.first] != 0 && value[next.first] != nextValue) return false;
			value[next.first] = nextValue;
			qu.push(next.first);
		}
	}
	return true;
}

long long solve(const vector<vector<pair<int,int>>>& g){
	const int n = g.size();
	vector<int> sgn(n, 0);
	vector<long long> value(n, 0);
	queue<int> qu; qu.push(0);
	sgn[0] = 1;
	long long min_value = 0, max_value = 1LL << 60;
	while(!qu.empty()){
		int curPos = qu.front(); qu.pop();
		if(sgn[curPos] == 1) min_value = max(min_value, -value[curPos]);
		else max_value = min(max_value, value[curPos]);
		for(auto nextData : g[curPos]){
			int nextPos = nextData.first;
			int nextValue = nextData.second - value[curPos];
			if(sgn[nextPos] != 0){
				if(sgn[nextPos] == sgn[curPos]){
					long long vd = sgn[curPos] * (nextData.second - value[curPos] - value[nextPos]);
					if(abs(vd)%2 != 0) return 0;
					return valid(g, vd/2) ? 1 : 0;
				} else {
					if(nextValue != value[nextPos]) return 0;
				}
			} else {
				sgn[nextPos] = -sgn[curPos];
				value[nextPos] = nextValue;
				qu.push(nextPos);
			}
		}
	}
	return max(0LL, max_value - min_value - 1);
}

int main(){
	int n, m;
	while(cin >> n >> m){
		vector<vector<pair<int,int>>> g(n);
		for(int i=0;i<m;i++){
			int u, v, s; cin >> u >> v >> s;
			--u; --v;
			g[u].emplace_back(v, s);
			g[v].emplace_back(u, s);
		}
		cout << solve(g) << endl;
	}
}


Measured memory_bytes: 9216
#include <iostream>
#include <algorithm>
using namespace std;
const int maxn = 300010;
char a[maxn];
int n, b[maxn], c[maxn];

int main()
{
	cin>>n;
	for(int i = 1; i <= n; i++)
	cin>>a[i]; 
	for(int i = 1; i <= n; i++)
	{
		if(a[i] == 'W')
			b[i] = b[i - 1] + 1;
		else
			b[i] = b[i - 1];
	}
	for(int i = n; i >= 1; i--)
	{
		if(a[i] == 'E')
			c[i] = c[i + 1] + 1;
		else
			c[i] = c[i + 1];
	}
	int ans = maxn;
	for(int i = 1; i <= n; i++)
		ans = min(ans, b[i] + c[i] - 1);
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 2944
using System;
using System.Linq.Expressions;

class ComparingString
{
    static void Main(string[] args)
    {
        var input = Console.ReadLine().Split(' ');

        string word_one = "";

        string  word_two = "";

        for (var i = 0; i < int.Parse(input[1]); i++)
        {
            word_one += input[0];
        }
        for (var i = 0; i < int.Parse(input[0]); i++)
        {
            word_two += input[1];
        }

        string[] dict = new string[2] { word_one, word_two };

        Array.Sort(dict);

        Console.WriteLine(dict[0]);


    }
}

Measured memory_bytes: 13408
{-# LANGUAGE OverloadedStrings #-}

import Control.Monad
import qualified Data.ByteString.Char8 as B
import Data.Attoparsec.ByteString.Char8

main :: IO ()
main = do
  contents <- B.getContents
  case parseOnly inputParser contents of
    Right r -> B.putStrLn $ if solve r then "Yes" else "No"
    Left  e -> error e

inputParser = decimal

solve :: Int -> Bool
solve n = any (match n) [1 .. 9]
  where
    match n k = r == 0 && q < 10
      where (q, r) = n `divMod` k

Measured memory_bytes: 508
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
using ll = long long ;
using P = pair<int,int> ;
using pll = pair<long long,long long>;
constexpr int INF = 1e9;
constexpr long long LINF = 1e17;
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979323846;

int main(){
    vector<int> c(5);
    rep(i,5) cin >> c[i];
    int ans = -1;
    rep(i,5){
        if(c[i] == 0) ans = i;
    }
    cout << ans+1 << endl;
    return 0;
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
#define fastIO ios::sync_with_stdio(0), cin.tie(0)
#define endl '\n'
typedef long long ll;

int main() {
    #ifndef LOCAL
        fastIO;
    #endif
    ll a,b,c,d,rta;
    cin >> a >> b >> c >> d;
    a--;
    rta=(b-((b/c)+(b/d)-(b/((c*d)/__gcd(c,d)))))-(a-((a/c)+(a/d)-(a/((c*d)/__gcd(c,d)))));
    cout << rta << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.*;
 
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		double n = sc.nextDouble();
		double half = n / 2;

		if (n % 2 == 0) {
			System.out.println(half / n);
		} else {
			System.out.println((half + 0.5) / n);
		}
	}
}


Measured memory_bytes: 24016
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
using namespace std;
typedef long long ll;

namespace mp = boost::multiprecision;
using Bint = mp::cpp_int;
using Real = mp::number<mp::cpp_dec_float<1024>>;

#define INCANT cin.tie(0), ios::sync_with_stdio(false), cout << fixed << setprecision(20)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) FOR(i,0,n)
#define all(x) (x).begin(),(x).end()
#define out(a) cout << a << endl
#define PRINT(V) for (auto v : (V)) cout << v << " "

const int MOD = 1000000007;
const double PI = acos(-1.0);

void solve() {
    ll N;
    cin >> N;
    ll max_a=0;
    ll ans=0;
    rep(i, N){
        ll a;
        cin >> a;
        if(max_a < a){
            max_a = a;
            continue;
        }
        else{
            ans += max_a-a;
        }
    }
    out(ans);
}
int main() {
    INCANT;
    solve();
    return 0;
}




Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
constexpr int di[] = { 0, 1, 0, -1 }, dj[] = { 1, 0, -1, 0 };
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define SORT(v) sort((v).begin(), (v).end())
#define SORTR(v) sort((v).rbegin(), (v).rend())
#define all(v) (v).begin(), (v).end()
#define vmax 10000
constexpr ll inf = 100000000000000;
/*cout<<fixed<<setprecision(20);cin.tie(0);ios::sync_with_stdio(false);*/

bool check(int mid){
  return false;
}

ll serch(ll ok,ll ng) {
	while (abs(ok-ng) > 1) {
		int mid = (ok + ng) / 2;
		if (check(mid))ok = mid;
		else ng = mid;
	}
	return ok;
}

int main(){
  ll a,b,k;
  cin>>a>>b>>k;
  if(k>=a){

    k-=a;
    a=0;
  }else{
    cout<<a-k<<" "<<b<<endl;
    return 0;
  }
  if(k>=b){
    cout<<0<<" "<<0<<endl;
  }else{
    b-=k;
    cout<<0<<" "<<b<<endl;
  }
  return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
int main(){
  int i=1,num;
  cin >> num;
while(num != 0) {
    cout << "Case " << i << ": " << num << endl;
    i++;
    cin >> num;
  }
  return 0;
}



Measured memory_bytes: 3076
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <iterator>
#include <cmath>
#include <set>
#include <deque> 
#include <string>


using namespace std;

long long h1,m1,h2,m2,k;

int main()
{
	scanf("%lld%lld%lld%lld%lld", &h1, &m1, &h2, &m2, &k);
	
	long long t1 = h1 * 60 + m1;
	long long t2 = h2 * 60 + m2;
	long long duration = t2 - t1;
	long long ans = duration - k;
	if (ans < 0)
		ans = 0;
	printf("%d\n", ans);
	
	return 0;
}


Measured memory_bytes: 1736
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

set<int> solve(string&s, int& i){
    vector<set<int> > num;
    vector<char> ope;
    ++ i;
    for(;;){
        if(s[i] == '('){
            num.push_back(solve(s, i));
        }else{
            int a = 0;
            while('0' <= s[i] && s[i] <= '9'){
                a *= 10;
                a += s[i] - '0';
                ++ i;
            }
            num.resize(num.size() + 1);
            num.back().insert(a);
        }
        if(s[i] == ')'){
            ++ i;
            break;
        }
        ope.push_back(s[i]);
        ++ i;
    }

    int n = num.size();
    vector<vector<set<int> > > dp(n, vector<set<int> >(n));
    for(int i=0; i<n; ++i)
        dp[i][i] = num[i];

    for(int i=1; i<=n; ++i){
        for(int j=0; j+i<n; ++j){
            for(int k=j; k<j+i; ++k){
                set<int>& a = dp[j][k];
                set<int>& b = dp[k+1][j+i];
                set<int>& c = dp[j][j+i];
                set<int>::iterator it1;
                for(it1=a.begin(); it1!=a.end(); ++it1){
                    set<int>::iterator it2;
                    for(it2=b.begin(); it2!=b.end(); ++it2){
                        if(ope[k] == '+')
                            c.insert((*it1) + (*it2));
                        else if(ope[k] == '-')
                            c.insert((*it1) - (*it2));
                        else if(ope[k] == '*')
                            c.insert((*it1) * (*it2));
                        else if((*it2) != 0){
                            int x = abs(*it1) / abs(*it2);
                            if(((*it1) < 0) != ((*it2) < 0))
                                x *= -1;
                            c.insert((*it1) / (*it2));
                        }
                    }
                }
            }
        }
    }
    return dp[0][n-1];
}

int main()
{
    for(;;){
        string s;
        cin >> s;
        if(s == "#")
            return 0;

        s = '(' + s + ')';
        int i = 0;
        cout << solve(s, i).size() << endl;
    }
}

Measured memory_bytes: 0
import sys
input = sys.stdin.readline
N,T = map(int,input().split())
data = [list(map(int,input().split())) for _ in range(N)]

dp1 = [[0]*(N+1) for t in range(T+1)] #dp1[t][n] := (data[:n]の中からtまでに食べ切る範囲で美味しく）
dp2 = [[0]*(N+1) for t in range(T+1)] #dp1[t][n] := (data[:n]の中からt-1までに注文する範囲で美味しく)


for t in range(1,T+1):
    for n in range(1,N+1):
        if t-data[n-1][0] >= 0:
            dp1[t][n] = max(dp1[t][n-1],dp1[t-data[n-1][0]][n-1]+data[n-1][1])
            dp2[t][n] = max(dp2[t][n-1],dp2[t-data[n-1][0]][n-1]+data[n-1][1],dp1[t-1][n-1]+data[n-1][1])
        else:
            dp1[t][n] = dp1[t][n-1]
            dp2[t][n] = max(dp2[t][n-1],dp1[t-1][n-1]+data[n-1][1])


print(dp2[T][N])

Measured memory_bytes: 177032
#include<bits/stdc++.h>
#include<string.h>
#define ll long long int
#define fio ios_base::sync_with_stdio(false); cin.tie(NULL);
#define MAX_LIMIT 100000
#define r return 0
#define f(i,a,n) for(i=a;i<n;++i)
using namespace std;
int main()
{
    fio
    ll n,k,i;
    cin>>n>>k;
    string str,c;
    cin>>str;
    for(i=0;str[i];i++){
        str[k-1]=tolower(str[k-1]);
    }
    cout<<str;
}

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

int Cmp(const void *a, const void *b){
  return *(int *)a - *(int *)b;
}

void Do(int N, int M, int X, int Y){
  int i, Z;
  int x[N], y[M];
  for(i = 0;i < N;i++) scanf("%d", &x[i]);
  for(i = 0;i < M;i++) scanf("%d", &y[i]);
  qsort(x, N, sizeof(int), Cmp);
  qsort(y, M, sizeof(int), Cmp);
  if(x[N-1] >= y[0]) printf("War\n");
  else{
    for(Z = x[N-1] + 1;Z <= y[0];Z++) if(X < Z && Y >= Z) break;
    if(Z <= y[0]) printf("No War\n");
    else printf("War\n");
  }
}

int main(void){
  int N, M, X, Y;
  scanf("%d %d %d %d", &N, &M, &X, &Y);
  Do(N, M, X, Y);
  return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define INF 0x3f3f3f3f
const double PI=acos(-1.0);
const int maxn=1e5+5;
int f[maxn];
int Find(int x)
{
	return (f[x]==x)?x:(f[x]=Find(f[x]));
}
void Union(int x,int y)
{
	int fx=Find(x),fy=Find(y);
	f[fx]=fy;
	fx=Find(x);
}
int main()
{
	int m,n,ans,a[maxn],x,y;
	while( cin>>n>>m )
	{
		vector<int>zu[maxn];
		bool vis[maxn];
		ans=0;
		int temp=0;
		for(int i=1;i<=n;i++)
		{
			cin>>a[i];
			ans+=(a[i]==i);
			vis[i]=false;
		}
		for(int i=1;i<=n;i++)
			f[i]=i;
		for(int i=1;i<=m;i++)
		{
			cin>>x>>y;
			Union(x,y);
		}
		for(int i=1;i<=n;i++)
			int ll=Find(i);
		for(int i=1;i<=n;i++)
			if( f[a[i]]==f[i] )
				temp++;
		cout<<max(ans,temp)<<endl;
	}
}


Measured memory_bytes: 3328
#include<stdio.h>
int main(void){
    int m,f,r;
    while(1){
        scanf("%d %d %d",&m,&f,&r);
        if(m<=50 && f<=50 && r<=100 && m>=-1 && f>=-1 && r>=-1){
            if(m==-1 && f==-1 && r==-1){
            break;
             
            }else if(m==-1 || f==-1){
            printf("F\n");
                 
            }else if(80<=m+f){
            printf("A\n");
             
            }else if(65<=m+f && 80>m+f){
            printf("B\n");
             
            }else if(50<=m+f && 65>m+f){
            printf("C\n");
             
            }else if(30<=m+f && 50>m+f){
             
                if(50<=r){
                printf("C\n");
             
                }else{
                printf("D\n");
                }
             
            }else{
                printf("F\n");
            }
             
        }
         
    }return 0;
     
}



Measured memory_bytes: 2056
using System;
using System.Linq;

namespace _0620
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int[] Bibs = new int[x[0]];
            for (int i = 0; i < x[0]; i++)
            {
                Bibs[i] = int.Parse(Console.ReadLine());
            }
            for (int i = 1; i <= x[1]; i++)
            {
                for (int j = 0; j < x[0] - 1; j++)
                {
                    if (Bibs[j] % i > Bibs[j + 1] % i)
                    {
                        int a = 0;
                        a = Bibs[j];
                        Bibs[j] = Bibs[j + 1];
                        Bibs[j + 1] = a;
                    }
                }
            }
            for (int i = 0; i < x[0]; i++)
            {
                Console.WriteLine(Bibs[i]);
            }
        }
    }
}

Measured memory_bytes: 9484
#include <stdio.h>


int main()
{
  //n<=20, q<=200
  
  int n, q, i, j, num, m;
  int A[2001]={1};
  
  scanf("%d", &n);
  for(i=0; i<n; i++){
    scanf("%d", &num);
    for(j=2000-num; j>=0; j--){
      if(A[j])
        A[j+num] = 1;
    }
  }
    
  scanf("%d", &q);
  for(i=0; i<q; i++){
    scanf("%d", &m);
    if(A[m])
      puts("yes");
    else
      puts("no");
  }
  
  return 0;
}

Measured memory_bytes: 2608
#include<stdio.h>
#include<algorithm>
#include<iostream>
#include <string.h>
using namespace std;
typedef long long ll;
ll t=0,n,m;
ll y,z;
ll i,j,k;
ll a[10000005],p[1000005],b[1000005],c[1000005];
int main()
{
    ll h,x=0,j,ma=-10000000000,k,d,flag,ans;

    ans=0;
    scanf("%lld",&n);
    for(i=1; i<=n; i++)
    {
        scanf("%lld",&a[i]);
    }
    for(i=2; i<=n; i++)
    {
        if(a[i]<a[i-1])
        {
            ans+=(a[i-1]-a[i]);
            a[i]=a[i-1];
        }
    }
    printf("%lld\n",ans);

    return 0;
}


Measured memory_bytes: 5244
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define REP(i,b) FOR(i,0,b)
#define RFOR(i,a,b) for (int i = a-1; i >= b; i--)
#define RREP(i,a) RFOR(i,a,0)
#define REPALL(i,x) for (int i = 0; i < x.size(); i++)
#define RREPALL(i,x) for (int i = x.size()-1; i >= 0; i--)
#define ALL(x) x.begin(), x.end()
#define SORT(x) sort(ALL(x))
#define MIN_ELEMENT(x) min_element(ALL(x))
#define MAX_ELEMENT(x) max_element(ALL(x))
#define COUNT(x,num) count(ALL(x), num)
#define MEMSET(x,val) memset(x, val, sizeof(x))
#define MAX(a,b) a = max(a,b)
#define MIN(a,b) a = min(a,b)
void YES(bool flag) {cout<<(flag ? "YES" : "NO")<<endl;}
void Yes(bool flag) {cout<<(flag ? "Yes" : "No")<<endl;}
void yes(bool flag) {cout<<(flag ? "yes" : "no")<<endl;}
#define fst first
#define scd second
#define nextline putchar('\n')
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef vector<ll> VLL;
typedef vector<vector<ll>> VVLL;
const int INF = 1e7;
const ll MOD = 1e9 + 7;

int main()
{
    string s;
    cin>>s;
    bool flag = true;
    REPALL(i,s) {
        if (i % 2 == 0 && s[i] == 'L') {
            flag = false;
            break;
        }
        if (i % 2 == 1 && s[i] == 'R') {
            flag = false;
            break;
        }
    }
    Yes(flag);

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
void mksosu();
int so[1000001];
int main(){
  mksosu();
  while(1){
    int a,d,n,c;
    cin >> a >> d >> n;
    if(a==0&&d==0&&n==0)break;  
    c=0;
    for(int i=a;i<1000001;i+=d){
      if(so[i]==1){
	c++;
	if(c==n)cout << i << endl;
      }
    }
  }
  return 0;
}
void mksosu(){
  int flag=0;
  so[2]=1;
  for(int i=2;i<1000001;i++){
    flag=0;
    for(int j=2;j*j<=i;j++){
      if(i%j==0){
	flag=1;
	break;
      }
    }
    if(flag==0)so[i]=1;
  }
}

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

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) std::cout << x << '\n'
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define sz(x) ((int)(x).size())
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { ll g = gcd(a, b); return a / g * b; }
const int dx[4] = { 1, 0, -1,  0 };
const int dy[4] = { 0, 1,  0, -1 };
const int INF = (int)1e9;
const ll  inf = (ll)1e18;
const int mod = 1000000007;
const int MAX_N = 100010;
const double PI = acos(-1);

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(10);
	/*------------------------------*/

	int n, a, b;
	cin >> n >> a >> b;

	out(min(a * n, b));

	return 0;
}

Measured memory_bytes: 256
import java.util.*;

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

    List<Double> v = new ArrayList<Double>();
    for(int i = 0; i < n; i++) v.add(scan.nextDouble());

    Collections.sort(v);
    for(int i = 0; i < n - 1; i++) {
      double x = (double)v.get(0);
      double y = (double)v.get(1);
      x = (x + y) / 2.0;
      v.set(0, x);
      v.remove(1);
    }

    System.out.println(v.get(0));
  }
}

Measured memory_bytes: 23252
#include <bits/stdc++.h>
using namespace std;
    
int main() {
    int N;
    cin >> N;
    vector<int> X(N);
    for (int i=0;i<N;i++) cin >> X.at(i);
    
    int sum_min = 1000000000;
    for (int i=1;i<=100;i++) {
        int sum = 0;
        for (int j=0;j<N;j++) {
            int diff = X.at(j)-i;
            sum += pow(diff, 2);
        };
        sum_min = min(sum_min, sum);
    }

    cout << sum_min << endl;
}

Measured memory_bytes: 256
import collections

n = int(input())

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
  
def nannko(s):
  i = 1
  while s > i-1:
    s -= i
    i +=1
  return i-1

c = collections.Counter(prime_factorize(n))
kosuu = list(c.values())

ans = 0
for i in kosuu:
  ans += nannko(i)

print(ans)


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

const int N = 2e5 + 10;

int n, m;
int dist[N];
vector <int> a[N];

int main() {
//    freopen("input.in", "r", stdin);
  //  freopen("output.out", "w", stdout);

    scanf("%d%d", &n, &m);
    while (m--) {
        int u, v; scanf("%d%d", &u, &v);
        a[u].push_back(v);
        a[v].push_back(u);
    }

    queue <int> q; q.push(1); dist[1] = 1;
    while (!q.empty()) {
        int u = q.front(); q.pop();
        if (u == n) {
            puts(dist[n] == 3 ? "POSSIBLE" : "IMPOSSIBLE");
            return 0;
        }
        for (int i = 0; i < (int) a[u].size(); ++i) {
            int v = a[u][i];
            if (!dist[v]) {
                dist[v] = dist[u] + 1;
                q.push(v);
            }
        }
    }

    puts("IMPOSSIBLE");

    return 0;
}


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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)

int main(){
   
   long long a,b,x,count;
   cin >> a >> b >> x;

   if(a == 0){
      cout << b / x + 1 << endl;
   }else{
      cout << b / x - (a - 1) / x << endl;
   }

   return 0;
}

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

/*void print(vector<int> x){
    for(auto i=x.begin();i!=x.end();i++)cout<<*i<<",";
    cout<<endl;
}*/

int main(){
    int N,K;
    cin>>N>>K;
    vector<int> V(N),R(N+1),L(N+1);
    for(int i=0; i<N; i++) cin>>V[i];
    int r=0,l=0;
    R[0]=0;L[0]=0;
    for(int i=1; i<=N; i++){
        r+=V[N-i];
        l+=V[i-1];
        R[i]=r;
        L[i]=l;
    }
    int ans=0;
    for(int i=0; i<=min(N,K); i++){
        //合わせてi個
        for(int j=0; j<=i; j++){
            //左がj,右がi-j個
            int tmp=0;
            tmp=L[j]+R[i-j];
            vector<int> left(V.begin(),V.begin()+j);
            left.insert(left.end(),V.end()-(i-j),V.end());
            sort(left.begin(),left.end());
            //print(left);
            int k=0;
            while(k<K-i&&k<i){
                if(left[k]>0) break;
                else tmp-=left[k];
                k++;
            }
            //cout<<tmp<<endl;
            if(tmp>ans) ans=tmp;
        }

    }
    cout<<ans;
    return 0;
}

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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;

#define MOD 1000000007
#define REP(i, N) for (int i = 0; i < N; ++i)
#define REP1(i, N) for (int i = 1; i <= N; ++i)
#define RREP(i, N) for (int i = N - 1; i >= 0; --i)
#define ALL(a) a.begin(), a.end()

int main()
{
  int N, K;
  cin >> N >> K;
  cout << N - K + 1 << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <algorithm>
using namespace std;
double org_pw(int n)
{
    double k = 1;
    for(int i = 0; i < n; i++){
        k /= 2;
    }
    return k;
}
int main()
{
    int n, k;
    double ans = 0;
    cin >> n >> k;
    if(n >= k) ans += (double)(n - (k - 1)) / n;
    for(int i = 1; i < min(n+1, k); i++){
        ans += org_pw(ceil(log2((double)k/i))) / n;
    }
    printf("%.10lf\n", ans);
    return 0;
}

Measured memory_bytes: 768
#include<stdio.h>

int main(void)
{
  int n,m;
  int y=0;
  scanf("%d",&n);
  m=n;
  do{
    y=y+(m%10);
    m=m/10;
  }while(m>0);
  if(n%y)
    {
      puts("No");
    }
  else
    {
      puts("Yes");
    }
  return 0;
}

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

int main(){
    string x ,y;cin>>x>>y;
    int d=0;
    for (int i = 0; i < x.size(); i++)
    {
        if(x[i]==y[i]){
            d=1;
            continue;
        }else{
            d=0;
            break;
        }
    }
    if(d==1){
        cout<< "Yes"<<endl;

    }else{
        cout<< "No"<<endl;
    }
    
    
}

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

int main(){
  int ans;
  int p , q, r;
  cin >> p >> q >> r;
  if(p+q <= p+r)ans = p+q;
  else ans = p+r;
  if(ans > q+r)ans = q+r;
  cout << ans << endl;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
#%% for atcoder uniittest use
import sys
input= lambda: sys.stdin.readline().rstrip()
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
#%%code
def resolve():
    N,=pin()
    A=tupin()
    
    from fractions import gcd

    temp=A[0]
    for i in range(N):
          temp=gcd(temp,A[i])
    print(temp)
#%%submit!
resolve()

Measured memory_bytes: 80164
X, N = gets.split.map(&:to_i)
P = gets.split.map(&:to_i)
0.upto(200) do |i|
  min = X - i
  max = X + i
  unless P.include? min
    puts min 
    exit
  end
  unless P.include? max
    puts max
    exit
  end
end


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

#define X first
#define Y second
#define pb push_back
#define mp make_pair
#define all(a) a.begin(), a.end()
#define rep(i, st, n) for (int i = (st); i < (n); ++i)
#define repinv(i, st, n) for (int i = ((n)-1); i >= (st); --i)
#define MEM(a, b) memset(a, b, sizeof(a));
#ifdef LOCAL
#define debug(x) std::cerr << #x << ": " << x << endl
#else
#define debug(x) 860111
#endif
#define fastIO() ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define fileIO(in, out) freopen(in, "r", stdin); freopen(out, "w", stdout)

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef long double ld;

//mt19937 mrand(random_device{}());
//mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
const ll mod=1e9+7;
//int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
pii operator+(const pii&x, const pii&y) { return mp(x.X+y.X, x.Y+y.Y);}
pii operator-(const pii&x, const pii&y) { return mp(x.X-y.X, x.Y-y.Y);}
//INT_MAX, ULLONG_MAX, LLONG_MAX or numeric_limits<int>::min()

inline ll read(){
	char ch=getchar();ll x=0,f=0;
	while(ch<'0' || ch>'9') f|=ch=='-',ch=getchar();
	while(ch>='0' && ch<='9') x=x*10+ch-'0',ch=getchar();
	return f?-x:x;
}

//------------------------------------------------------------------------//
int T;
const int maxn = 2e5+7;
int n;
//ll a[maxn];

//check T
void solve()
{
  //cin >> n; rep(i, 0, n) cin >> a[i];
  cin >> n;
  int a = n/100;
  int b = n%100;
  int oka = a >= 1 && a <= 12;
  int okb = b >= 1 && b <= 12;
  if(oka && okb) cout << "AMBIGUOUS\n";
  else if(!oka && !okb) cout << "NA\n";
  else if(oka) cout << "MMYY\n";
  else if(okb) cout << "YYMM\n"; 
  return;
}


signed main()
{
  fastIO();
  T = 1;
  //1700cin >> T; //this
  rep(tc, 1, T+1)
  {
    //cout << "Case #" << tc << ": ";
    solve();
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long u_ll;
typedef pair<int, int> pair_;
 
const int INF = 1001001001;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
int k;
 
int gcd(int a, int b){
    if(b == 0) return a;
 
    return gcd(b, a%b);
}
 
int main(){
    int n;
    cin >> n;
    vector<string> s_(n);


    rep(j,n) cin >> s_[j];

    sort(s_.begin(), s_.end());
    int count=1;

    rep(i,n){
        if(i==0) continue;
        else {
            if(s_[i] == s_[i-1]) continue;
            else count++;
        }
    }

    cout << count;

    return 0;
}

Measured memory_bytes: 9548
/*
	@Raghul

	Created : Long ago

*/
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	ll a,b,c;
	cin>>a>>b;
	ll pro = a*b;
	for(c=1;c<=3;c++){
		if((pro*c)%2==1){
			cout<<"Yes"<<endl;
			return 0;
		}
	}
	cout<<"No";
	return 0;
}

Measured memory_bytes: 256
N, K = list(map(int, input().strip().split(" ")))
candles = input().strip()
min_cost_index = candles.count("-")
candles = list(map(int, candles.split(" ")))

def update():
    start_index = max(0, min_cost_index - K - 1)
    end_index = min(N, min_cost_index + K + 1)
    new_candles = candles[start_index: end_index]
    return new_candles

def compute_cost(start_index):
    start_point = candles[start_index]
    end_point = candles[start_index + K - 1]
    if(start_point * end_point >= 0):
        return max(abs(start_point), abs(end_point))
    else:
        return end_point - start_point + min(-start_point, end_point) 

candles = update()

N = len(candles)
min_cost = compute_cost(0)
patterns = N - K + 1

for start_index in range(patterns):
    cost = compute_cost(start_index)
    if(min_cost > cost):
        min_cost = cost
print(min_cost)

Measured memory_bytes: 15616
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
//#include <intrin.h>
//#include <chrono>
//#include <random>
//#include <unordered_map>

using namespace std;

typedef long long ll;

void solve() {
	int n;
	cin >> n;
	map<string, int> all;
	for (int i = 0; i < n; i++) {
		string s;
		cin >> s;
		all[s]++;
	}

	cout << "AC x " << all["AC"] << '\n';
	cout << "WA x " << all["WA"] << '\n';
	cout << "TLE x " << all["TLE"] << '\n';
	cout << "RE x " << all["RE"] << '\n';
}

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
#if defined(_DEBUG)
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	int q = 1;
	//cin >> q;
	for (; q > 0; q--) {
		solve();
		cout << '\n';
	}
}

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

int main(){
  string s;
  int i;
  cin >> i>> i >> s;
  switch(s[i-1])
  {
    case 'A':
        s[i-1] = 'a';
        break;
    case 'B':
       s[i-1] = 'b';
      break;
    case 'C':
      s[i-1] = 'c';
      break;
    default:
      break;
  }
  cout << s;
  return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    static Scanner scanner;

    public static void main(String[] args) {
        scanner = new Scanner(System.in);
        long a = nextLong(),b = nextLong(),c = nextLong(),k= nextLong();
        long takeA = a - k;
        if (takeA >= 0) {
            System.out.println(k);
            return;
        }
        takeA *= -1;
        long takeB = b - takeA;
        if (takeB >= 0) {
            System.out.println(a);
            return;
        }
        takeB *= -1;
        long takeC = takeB;
        System.out.println(a - takeC);
    }

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

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

    public static double nextDouble() {
        return Double.parseDouble(scanner.next());
    }

    public static short nextShort() {
        return Short.parseShort(scanner.next());
    }

    public static float nextFloat() {
        return Float.parseFloat(scanner.next());
    }

    public static void printYes() {
        System.out.println("Yes");
    }

    public static void printYES() {
        System.out.println("YES");
    }

    public static void printNo() {
        System.out.println("No");
    }

    public static void printNO() {
        System.out.println("NO");
    }

    public static void nextLine() {
        scanner.nextLine();
    }
}

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

const int N = 500100;
int n, q, c[N], l, r, qs[N], pos[N];
vector<pair<int, int>> ls[N];

int bit[N];
void add(int i, int d) {
  for (; i <= n; i += i & -i) {
    bit[i] += d;
  }
}
int prefix(int i) {
  int s = 0;
  for (; i > 0; i -= i & -i) {
    s += bit[i];
  }
  return s;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin >> n >> q;
  for (int i = 1; i <= n; ++i) {
    cin >> c[i];
  }
  for (int i = 1; i <= q; ++i) {
    cin >> l >> r;
    ls[r].emplace_back(l, i);
  }
  for (int i = 1, s = 0; i <= n; ++i) {
    int& p = pos[c[i]];
    if (p) add(p, -1);
    else ++s;
    p = i;
    add(i, 1);
    for (auto [l, j] : ls[i]) {
      qs[j] = s - prefix(l - 1);
    }
  }
  for (int i = 1; i <= q; ++i) {
    cout << qs[i] << "\n";
  }
  return 0;
}


Measured memory_bytes: 33196
//Reference: 提出 #7012551 (youtube放送)
//方針：部分木全てにループを回すのではなく、根となった時の値だけ各頂点で持っておき、最後にdfsで累積する

#include<iostream>
using namespace std;
typedef long long ll;
#include<string.h>
#include<vector>
#define pb push_back

#define rep(i, a, b) for(int i=(a); i<(b); i++)

vector<int> to[200005];
vector<int> ans;
//双方向に編が張っている場合、戻らないように親の引数を持っておく必要がある
void dfs(int v, int p=-1){
  for(int u : to[v]){
    //to[v]に関するループ。要素をuに詰める
    if(u==p) continue;//行き先が親と同じなら飛ばす
    ans[u] += ans[v];//頂点vの行き先uに結果を累積する
    dfs(u,v);//頂点v -> 頂点uに移動して、次の行き先を探す
  }
}


int main(){
  ll N,Q;
  cin >> N >> Q;
  //木構造の辺に関する処理
  rep(i,0,N-1){
    int a,b;
    cin >> a >> b;
    --a;--b;
    to[a].pb(b);//a -> b
    to[b].pb(a);//b -> a
  }
  //クエリの処理
  ans.resize(N);
  rep(i,0,Q){
    int p,x;
    cin >> p >> x;
    --p;
    ans[p] += x;
  }
  dfs(0);
  rep(i,0,N) cout << ans[i] << endl;
}


Measured memory_bytes: 23552
#include <cstdio>

int main(){
    int n, m, A[100][100], v[100], ans;
    scanf(" %d %d", &n, &m);
    for(int i = 0; i<n; i++){
        for(int j = 0; j<m; j++){
            scanf("%d", &A[i][j]);
        }
    }
    for(int i = 0; i<m; i++){
        scanf("%d", &v[i]);
    }
    for (int i = 0; i<n; i++){
        ans = 0;
        for(int j = 0; j<m; j++){
            ans += A[i][j] * v[j];
        }
        printf("%d\n", ans);
    }
    return 0;
}


Measured memory_bytes: 2748
#include <bits/stdc++.h>
using namespace std ;
#define An setprecision(16) 
int main(){
    int N,B;
    cin >> N >> B;
    if(N>=13)cout << B << endl;
    else if(N>=6)cout << B/2 << endl;
    else cout << 0 << endl;
}

Measured memory_bytes: 3620
N = [1, 5, 2, 3, 0, 4]
S = [4, 0, 2, 3, 5, 1]
E = [3, 1, 0, 5, 4, 2]
W = [2, 1, 5, 0, 4, 3]
dice = [dice for dice in input().split()]
dice_t = ["" for dice_t in range(6)]
direction = input()
for d in direction:
    if d == "N":
        for i in range(6):
            dice_t[i] = dice[N[i]]
    elif d == "S":
        for i in range(6):
            dice_t[i] = dice[S[i]]
    elif d == "E":
        for i in range(6):
            dice_t[i] = dice[E[i]]
    else:
        for i in range(6):
            dice_t[i] = dice[W[i]]
    for i in range(6):
        dice[i] = dice_t[i]

print(dice[0])

Measured memory_bytes: 7600
/** Which of the favors of your Lord will you deny ? **/

#include<bits/stdc++.h>
using namespace std;

#define LL long long
#define PII pair<int,int>
#define PLL pair<LL,LL>
#define F first
#define S second

#define ALL(x)      (x).begin(), (x).end()
#define READ        freopen("alu.txt", "r", stdin)
#define WRITE       freopen("vorta.txt", "w", stdout)

#ifndef ONLINE_JUDGE
#define DBG(x)      cout << __LINE__ << " says: " << #x << " = " << (x) << endl
#else
#define DBG(x)
#endif

template<class T1, class T2>
ostream &operator <<(ostream &os, pair<T1,T2>&p);
template <class T>
ostream &operator <<(ostream &os, vector<T>&v);
template <class T>
ostream &operator <<(ostream &os, set<T>&v);

inline void optimizeIO()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}

const int nmax = 2e5+7;

int main()
{
    optimizeIO();

    int n;
    cin>>n;

    vector<int>v(n);

    for(int i=0;i<n;i++) cin>>v[i];

    int ans = 0;



    for(int i=0;i<n;i++)
        for(int j=i+1;j<n;j++)
            for(int k=j+1;k<n;k++)
            {
                vector<int>t;
                t.push_back(v[i]);
                t.push_back(v[j]);
                t.push_back(v[k]);

                sort(ALL(t));

                if(t[0]==t[1] || t[1]==t[2] || t[3]==t[1])
                    continue;

                if(t[0]+t[1]>t[2])
                {
//                    DBG(t);
                    ans++;
                }

            }

    cout<<ans<<endl;


    return 0;
}

/**

**/

template<class T1, class T2>
ostream &operator <<(ostream &os, pair<T1,T2>&p)
{
    os<<"{"<<p.first<<", "<<p.second<<"} ";
    return os;
}
template <class T>
ostream &operator <<(ostream &os, vector<T>&v)
{
    os<<"[ ";
    for(int i=0; i<v.size(); i++)
    {
        os<<v[i]<<" " ;
    }
    os<<" ]";
    return os;
}

template <class T>
ostream &operator <<(ostream &os, set<T>&v)
{
    os<<"[ ";
    for(T i:v)
    {
        os<<i<<" ";
    }
    os<<" ]";
    return os;
}




Measured memory_bytes: 3640
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <sstream>
#include <string>
#define repd(i,a,b) for (int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define inf 2000000007
#define mp make_pair
#define pb push_back
typedef long long ll;
using namespace std;
template <typename T>
inline void output(T a, int p) {
    if(p) cout << fixed << setprecision(p)  << a << "\n";
    else cout << a << "\n";
}
// end of template


int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    // source code
    int H, W;
    cin >> H >> W;
    vector<string> A(H);
    rep(i, H) cin >> A[i];
    
    auto R = A, B = A;
    
    rep(i, H){
        if(i % 2 == 0){
            rep(j, W - 1) R[i][j] = '#';
        }
        else{
            repd(j, 1, W) B[i][j] = '#';
        }
    }
    
    rep(i, H){
        R[i][0] = '#';
        B[i][W - 1] = '#';
    }
    
    rep(i, H){
        output(R[i], 0);
    }
    cout << endl;
    rep(i, H){
        output(B[i], 0);
    }
    
    
    
    return 0;
}

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

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

struct Matrix {
    int ret[4][4];

    Matrix(const bool& t = 0) {
        memset(ret, 0, sizeof ret);
        if(t) ret[0][0] = ret[1][1] = ret[2][2] = ret[3][3] = 1;
    }
} A, B;

Matrix operator * (const Matrix& a, const Matrix& b) {
    Matrix c;
    for(int i = 0; i < 4; ++i)
        for(int j = 0; j < 4; ++j)
            for(int k = 0; k < 4; ++k) if(a.ret[i][k] && b.ret[k][j])
                c.ret[i][j] = (c.ret[i][j] + 1ll * a.ret[i][k] * b.ret[k][j]) % mo;
    return c;
}

Matrix operator ^ (const Matrix& a, int exp) {
    Matrix res = 1, base = a;
    for(; exp > 0; exp >>= 1) {
        if(exp & 1)
            res = res * base;
        base = base * base;
    }
    return res;
}

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

    scanf("%d%d", &n, &m);
    for(int i = 0; i < m; ++i) {
        scanf("%d", p + i);
    }

    if(n == 1) return puts("1"), 0;

    A.ret[0][0] = 1;
    A.ret[1][0] = 2;
    A.ret[2][0] = 3;
    A.ret[3][0] = 1;

    B.ret[0][0] = 1; B.ret[0][1] = 1; B.ret[0][2] = 0; B.ret[0][3] = 2;
    B.ret[1][0] = 1; B.ret[1][1] = 2; B.ret[1][2] = 0; B.ret[1][3] = 2;
    B.ret[2][0] = 1; B.ret[2][1] = 2; B.ret[2][2] = 1; B.ret[2][3] = 2;
    B.ret[3][0] = 0; B.ret[3][1] = 0; B.ret[3][2] = 1; B.ret[3][3] = 0;

    int cur = 1;
    for(int i = 0; i < m; ++i) {
        A = (B ^ (p[i] - cur)) * A;
        cur = p[i];
        A.ret[1][0] -= A.ret[0][0];
        A.ret[2][0] -= A.ret[0][0];
    }

    A = (B ^ (n - cur)) * A;
    printf("%d\n", (A.ret[0][0] + mo) % mo);
    return 0;
}


Measured memory_bytes: 640
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
 
typedef struct Status{
  int p, d;
} St;
 
int head, tail;
St queue[1001];
 
void qpush(St v)
{
  queue[tail++] = v;
}
 
St qpop()
{
  return queue[head++];
}
 
bool qempty()
{
  return head == tail; 
}
 
int n;
bool a[101][101];
int d[101];
 
void bfs()
{
  head = tail = 0;
  St st, st2;
  int i;
  st.p = 1;
  d[1] = st.d = 0;
 
  qpush(st);
  while(!qempty()){
    st = qpop();
 
    for(i = 1; i <= n; ++i)
      if(d[i] == -1 && a[st.p][i]){
    st2.p = i;
    d[i] = st2.d = st.d + 1;
       qpush(st2);
      }
  }
}
 
int main()
{
  int i, u, k, v;
 
  while(scanf("%d", &n) != EOF){
    memset(a, false, sizeof(a));
    memset(d, -1, sizeof(d));
 
    for(i = 0; i < n; ++i){
      scanf("%d %d", &u, &k);
 
      while(0 < k--){
    scanf("%d", &v);
    a[u][v] = true;
      }
    }
 
    bfs();
     
    for(i = 1; i <= n; ++i)
      printf("%d %d\n", i, d[i]);
  }
 
  return 0;
}

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

#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define ll long long
using namespace std;


int main() {
  string s,t;
  cin >> s >> t;
  for (int i = 0; i < s.size(); i++) {
    if (s.at(i) != t.at(i)) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
}



Measured memory_bytes: 3524
import numpy as np
N=int(input())
S=[]
ans={}

pri=[]

for i in range(N):
    tmp=input()
    if(tmp.isdecimal()==0):
        S.append(tmp)

for i in S:
    if(ans.get(i)==None):
        ans[i]=1
    else:
        ans[i]+=1
a=np.max(np.array(list(ans.values())))

for i,j in ans.items():
    if(j==a):
        pri.append(i)
        
pri=sorted(pri)


for i in pri:
    print(i)



Measured memory_bytes: 44460