akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

#ifdef DGC
#include "debug.h"
#else
#define debug(...) 9715
#endif
typedef long long ll;
typedef long double ld;
typedef complex<ll> point;
#define F first
#define S second

int n, m;
vector<string> a;
int mov[4][2] = { {-1, 0}, {1, 0}, {0, -1}, {0, 1} };

int bfs(int sx, int sy)
{
	const int inf = 1e9;
	vector<vector<int>> d(n, vector<int>(m, inf));
	d[sx][sy] = 0;
	queue<pair<int, int>> q;
	q.push({ sx, sy });
	int r = 0;
	while (!q.empty())
	{
		int x, y;
		tie(x, y) = q.front();
		q.pop();
		for (int k = 0; k < 4; ++k)
		{
			int nx = x + mov[k][0];
			int ny = y + mov[k][1];
			if (nx >= 0 && nx < n && ny >= 0 && ny < m && a[nx][ny] != '#' && d[nx][ny] == inf)
			{
				d[nx][ny] = d[x][y] + 1;
				q.push({ nx, ny });
				r = max(r, d[nx][ny]);
			}
		}
	}
	return r;
}

int main()
{
	#ifdef DGC
		//freopen("a.in", "r", stdin);
		//freopen("b.out", "w", stdout);
	#endif

	ios_base::sync_with_stdio(0), cin.tie(0);

	cin >> n >> m;
	a.resize(n);
	for (auto &i : a) cin >> i;

	int ans = 0;
	for (int i = 0; i < n; ++i)
		for (int j = 0; j < m; ++j)
			if (a[i][j] == '.')
				ans = max(ans, bfs(i, j));
	cout << ans << "\n";

	return 0;
}


Measured memory_bytes: 256
N, K, C = map(int, input().split())
S = input()
dl, pl, dr, pr = [], -(C + 1), [], -(C + 1)

for i in range(N):
    if S[i] == 'o' and i - pl > C and len(dl) < K:
        dl.append(i + 1)
        pl = i
    if S[N - i - 1] == 'o' and i - pr > C and len(dr) < K:
        dr.append(N - i)
        pr = i
for i in range(K):
    if dl[i] == dr[K - i - 1]:
        print(dl[i])


Measured memory_bytes: 67296
/**
 *      purpose : 
 *      author  : kyomukyomupurin
 *      created : 
**/

// input/output
#include <iostream>
#include <fstream>
#include <sstream>
// container class
#include <array>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
// math, algorithm
#include <algorithm>
#include <cmath>
#include <complex>
#include <numeric>
// etc
#include <bitset>
#include <cassert>
#include <cctype>
#include <cstring>
#include <chrono>
#include <functional>
#include <iomanip>
#include <random>
#include <utility>
// using-directive
using namespace std;
// alias template
using int64 = long long;
using uint64 = unsigned long long;
using vi = vector<int>;
using vl = vector<int64>;
using pii = pair<int, int>;
using pll = pair<int64, int64>;
// text macro replacement
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define print(x) cout << (x) << '\n'
#define debug(x) cerr << #x << ": " << (x) << '\n'
#define dbg(v) for (size_t _ = 0; _ < v.size(); ++_){cerr << #v << "[" << _ << "] : " << v[_] << '\n';}
// variadic template
template<typename T> inline void chmin(T &a, T b) {if (a > b) a = b; return;}
template<typename T> inline void chmax(T &a, T b) {if (a < b) a = b; return;}
// constant
const int INF = (1<<30) - 1;
const int64 INF64 = (1LL<<62) - 1;
const int MOD = 1000000007;

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

  int n; cin >> n;
  vi x(n), y(n), h(n);

  rep(i, n) cin >> x[i] >> y[i] >> h[i];

  int mx = *max_element(all(h));

  for (int cx = 0; cx <= 100; ++cx) {
    for (int cy = 0; cy <= 100; ++cy) {
      for (int hh = mx; hh <= mx + 200; ++hh) {
        bool flag = true;
        for (int i = 0; i < n; ++i) {
          if (h[i] != max(hh - abs(cx - x[i]) - abs(cy - y[i]), 0)){
            flag = false;
            break;
            //cout << cx << " " << cy << " " << hh << '\n'; return 0;
          }
        }
        if (flag){cout << cx << " " << cy << " " << hh << '\n'; return 0;}
      }
    }
  }

  return 0;
}

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


using namespace std;


using ll = long long;


const ll MAX = 100;


vector<vector<pair<ll, ll>>> graph;


int main()
{
    ll V, E;
    cin >> V >> E;
    graph.resize(V);

    for (ll i = 0; i < E; i++) {
        ll s, t, d;
        cin >> s >> t >> d;
        graph[s].push_back(make_pair(d, t));
    }

    ll dp[MAX + 1][MAX + 1] = {};
    for (ll i = 0; i < V; i++) {
        for (ll j = 0; j < V; j++) {
            dp[i][j] = i == j ? 0 : LONG_LONG_MAX;
        }
    }

    for (ll i = 0; i < V; i++) {
        for (ll j = 0; j < V; j++) {
            for (auto e : graph[i]) {
                if (e.second == j) {
                    dp[i][j] = e.first;
                    break;
                }
            }
        }
    }

    for (ll k = 0; k < V; k++) {
        for (ll i = 0; i < V; i++) {
            if (dp[i][k] == LONG_LONG_MAX)
                continue;
            for (ll j = 0; j < V; j++) {
                if (dp[k][j] == LONG_LONG_MAX)
                    continue;
                dp[i][j] = min(dp[i][j], dp[i][k] + dp[k][j]);
            }
        }
    }

    for (ll i = 0; i < V; i++) {
        if (dp[i][i] < 0) {
            cout << "NEGATIVE CYCLE" << endl;
            return 0;
        }
    }
    for (ll i = 0; i < V; i++) {
        for (ll j = 0; j < V; j++) {
            if (dp[i][j] != LONG_LONG_MAX) {
                cout << dp[i][j];
            } else {
                cout << "INF";
            }
            if (j != V - 1)
                cout << " ";
        }
        cout << endl;
    }
}



Measured memory_bytes: 3296
#include <iostream>
#include <string>

int main(int argc, char const *argv[])
{
	int n = 0;
	std::cin >> n;
	int score[2] = {0,0};
	std::string taro;
	std::string hanako;
	for(int i = 0 ; i < n ; i ++){
		std::cin >> taro;
		std::cin >> hanako;
		if(taro.compare(hanako) < 0){
			score[0] += 3;
		}else if(taro.compare(hanako) == 0){
			score[0] += 1;
			score[1] += 1;
		}else{
			score[1] += 3;
		}
	}
	std::cout << score[1] << " " << score[0] << std::endl;
	return 0;
}

Measured memory_bytes: 3184
#include<stdio.h>
#include<stdlib.h>
int main()
{  	
  	int s1;
	int s2;
	int s3;
  	int num;
  	//printf("ok");
  	scanf("%d",&num);
  	//printf("%d\n",num);
  	//scanf("%s%s%s",s1,s2,s3);
  	//printf("%s\n",s1);
  	//printf("%s\n",s2);
  	//printf("%s\n",s3);
  	//printf("nyu=%d",argv[0][0]);
  	//int num;
  	//scanf("%d",&num);
  	//printf("num=%d\n",num);
	s1=num/100;
	s2=num%100/10;
	s3=num%10;
    
  	//printf("s1%d\n",s1);
  	//printf("s2%d\n",s2);
  	//printf("s3%d\n",s3);
	int ans=s1+s2+s3;
	printf("%d\n",ans);
	return 0;
}

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

int main(int argc, char const *argv[]) {
    int n, m;
    cin >> n >> m;
    vector<bool> flag(n, false);
    vector<int> wa(n);

    int ac = 0, penalty = 0;
    for (size_t i = 0; i < m; i++) {
        int p;
        string s;
        cin >> p >> s;

        if (s == "AC" && !flag[p-1]) {
            ++ac;
            flag[p-1] = true;
            penalty += wa[p-1];
        }else if (s == "WA" && !flag[p-1]) {
            ++wa[p-1];
        }
    }

    cout << ac << ' ' << penalty << endl;
    return 0;
}


Measured memory_bytes: 3772
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

// 内部定数
#define D_NO_CNT		4										// 整理番号数
#define D_OPE_CNT		3										// 演算数
#define D_OPE_PLUS		'+'										// 演算 - ＋
#define D_OPE_MINUS		'-'										// 演算 - －
#define D_SUM			7										// 合計値

// 内部変数
static char sc1No[D_NO_CNT + 5];								// 整理番号
static char sc1Ope[D_OPE_CNT];									// 演算

// 内部変数 - テスト用
#ifdef D_TEST
	static int siRes;
	static FILE *szpFpT, *szpFpA;
#endif

// 演算セット
int
fSetOpe(
	int piONo					// <I> セット位置 0～
)
{
	int i, liRet;

	// 終了チェック
	if (piONo == D_OPE_CNT) {

		// 合計値算出
		int liSum = sc1No[0] - '0';
		for (i = 0; i < D_OPE_CNT; i++) {
			if (sc1Ope[i] == D_OPE_PLUS) {
				liSum += sc1No[i + 1] - '0';
			}
			else {
				liSum -= sc1No[i + 1] - '0';
			}
		}

		// 合計値チェック
		if (liSum == D_SUM) {
			return 0;
		}
		else {
			return -1;
		}
	}

	// ＋セット
	sc1Ope[piONo] = D_OPE_PLUS;
	liRet = fSetOpe(piONo + 1);
	if (liRet == 0) {
		return 0;
	}

	// －セット
	sc1Ope[piONo] = D_OPE_MINUS;
	liRet = fSetOpe(piONo + 1);
	if (liRet == 0) {
		return 0;
	}

	return -1;
}

// 実行メイン
int
fMain(
	int piTNo					// <I> テスト番号 1～
)
{
	char lc1Buf[1024], lc1Out[1024];

	// テストファイルオープン
#ifdef D_TEST
	sprintf(lc1Buf, ".\\Test\\T%d.txt", piTNo);
	szpFpT = fopen(lc1Buf, "r");
	sprintf(lc1Buf, ".\\Test\\A%d.txt", piTNo);
	szpFpA = fopen(lc1Buf, "r");
	siRes = 0;
#endif

	// 整理番号取得
#ifdef D_TEST
	fgets(sc1No, sizeof(sc1No), szpFpT);
#else
	fgets(sc1No, sizeof(sc1No), stdin);
#endif

	// 演算セット
	fSetOpe(0);

	// 結果セット
	sprintf(lc1Out, "%c%c%c%c%c%c%c=%d\n", sc1No[0], sc1Ope[0], sc1No[1], sc1Ope[1], sc1No[2], sc1Ope[2], sc1No[3], D_SUM);

	// 結果表示
#ifdef D_TEST
	fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
	if (strcmp(lc1Buf, lc1Out)) {
		siRes = -1;
	}
#else
	printf("%s", lc1Out);
#endif

	// テストファイルクローズ
#ifdef D_TEST
	fclose(szpFpT);
	fclose(szpFpA);
#endif

	// テスト結果
#ifdef D_TEST
	if (siRes == 0) {
		printf("OK %d\n", piTNo);
	}
	else {
		printf("NG %d\n", piTNo);
	}
#endif

	return 0;
}

int
main()
{

#ifdef D_TEST
	int i;
	for (i = D_TEST_SNO; i <= D_TEST_ENO; i++) {
		fMain(i);
	}
#else
	fMain(0);
#endif

	return 0;
}



Measured memory_bytes: 128
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        long n = scan.nextLong();
        long x = scan.nextLong();
        long m = scan.nextLong();
        x = x % m;
        Map<Long, Integer> M = new HashMap<>();
        List<Long> list = new ArrayList<>();
        M.put(x, 0);
        list.add(x);
        int i = 1;
        for (; i < n; i++) {
            x = x * x % m;
            if (M.containsKey(x)) break;
            M.put(x, i);
            list.add(x);
        }
        if (i == n) {
            long sum = 0;
            for (int j = 0; j < list.size(); j++) sum = sum + list.get(j);
            System.out.println(sum);
            return;
        }
        long ans = 0;
        int pos = M.get(x);
        for (i = 0; i < pos; i++) ans += list.get(i);
        n -= pos;
        int len = list.size() - pos;
        long sum = 0;
        for (int j = pos; j < list.size(); j++) sum = sum + list.get(j);
        long cnt = n / len;
        ans += sum * cnt;
        n %= len;
        for (i = 0; i < n; i++) {
            ans += list.get(pos + i);
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 45136
import java.util.Arrays;
import java.util.Collections;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		PriorityQueue<Double> p = new PriorityQueue<>();
		
		for (int i = 0; i < n; i++) {
			p.add(sc.nextDouble());
		}
		
		double tmp = 0;
		for (int i = 0; i < n - 1; i++) {
			if (p.size() == 1) {
				break;
			}
			tmp = (p.poll() + p.poll()) / 2;
			p.add(tmp);
		}
		
		System.out.println(tmp);
	}
}

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

#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

using namespace std;
typedef long long ll; typedef vector<int> VI; typedef pair<int,int> pii;
const int MD = (int)1e9 + 7; typedef vector<ll> VL;
void dbg(){ cerr << "\n"; }  template <class T, class ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }


vector<vector<pii>> r, rr;
VI usd;

void ckdfs(int s, const int p, const vector<vector<pii>>& cr){
	if(usd[s] & p) return;
	usd[s] |= p;
	for(auto z: cr[s]) ckdfs(z.first, p, cr);
}

vector<ll> bellman(int s){
	int n = sz(r);
	const ll inf = 1LL<<60;
	vector<ll> ds(n, inf);
	ds[s] =0;
	for(int i =0, nxt =1; i<n+3 && nxt>0 ; i++){
		nxt = 0;
		rep(j, n) if(usd[j]==3) for(auto z: r[j]) if(usd[z.first]==3){
			if(ds[j] != inf && ds[z.first] > ds[j] + z.second){
				ds[z.first] = ds[j] + z.second;
				nxt = 1;
				if(i>n /*&& z.first==n-1*/) {ds[0]=-1; return ds;}
			}
		}
	}
	return ds;
}



int main()
{
	
	cin.tie(0); ios_base::sync_with_stdio(false);
	int n, m, p;
	cin >>n >>m >>p;
	
	r.resize(n); rr.resize(n);
	
	rep(i, m){
		int a,b,c;
		cin >>a >>b >>c;
		a--; b--; c -=p;
		r[a].emplace_back(b, -c);
		rr[b].emplace_back(a, -c);
	}
	usd.resize(n);
	ckdfs(0, 1, r);
	ckdfs(n-1, 2, rr);
	
	
	auto rv = bellman(0);
	//for(auto x :rv) printf("%lld, ",x); puts("");
	if(rv[0]==-1) puts("-1");
	else{
		cout << max(0LL, -rv.back()) <<"\n";
		 
	}
	return 0;
}


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

string dream_rev = "maerd";
string dreamer_rev = "remaerd";
string erase_rev = "esare";
string eraser_rev = "resare";

bool start_with(string S, string prefix, int size) {
  return S.substr(0, size) == prefix;
}

int main() {
  string S;
  cin >> S;
  reverse(S.begin(), S.end());

  while (true) {
    if (S == "") {
      cout << "YES" << endl;
      break;
    }

    int len = (int)(S.length());
    if (len < 5) {
      cout << "NO" << endl;
      break;
    }

    if (start_with(S, dream_rev, 5) || start_with(S, erase_rev, 5)) {
      S = S.substr(5);
    } else if (start_with(S, eraser_rev, 6)) {
      S = S.substr(6);
    } else if (start_with(S, dreamer_rev, 7)) {
      S = S.substr(7);
    } else {
      cout << "NO" << endl;
      break;
    }
  }

  return 0;
}

Measured memory_bytes: 512
// Problem : C - Tsundoku
// Contest : AtCoder - AtCoder Beginner Contest 172
// URL : https://atcoder.jp/contests/abc172/tasks/abc172_c
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

// #pragma GCC optimize ("O3")
// #pragma GCC target ("sse4")
 
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define trav(a,x) for (auto& a : x)
 
#define bug(x) cout<<#x<<"="<<x<<endl; 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert
 
template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const ld pii=3.14159265359; 
const int MOD = 1000000007;
const char nl = '\n';
const int MX = 200001; //check the limits, dummy
ll N,M,T;
vl A,B;



int main() 
{
	// && has higher precedence than ||
	ios_base::sync_with_stdio(0); cin.tie(0);    
	cin>>N>>M>>T;
	vl a(N),b(M);
	F0R(x,N)
		cin>>a[x];
	F0R(x,M)
		cin>>b[x];
	A=a;
	B=b;
	ll t=0,ans=0,mx=0;
	int p1=-1,p2=0;
	F0R(x,N)
	{
		if(t+A[x]>T)break;
		// bug(t);
		t+=A[x];
		ans++;
		p1=x;
	}
	F0R(x,M)
	{
		if(t+B[x]>T)break;
		t+=B[x];
		ans++;
		p2=x+1;
	}
	mx=ans;
	while(p1!=-1)
	{
		// bug(p1);
		t-=A[p1--];
		ans--;
		while(p2<M && t+B[p2]<=T)
		{
			// bug(p2);
			t+=B[p2++];
			ans++;
		}
		mx=max(mx,ans);
	}
	cout<<mx<<nl;
	
	return 0;
}
 
// read the question correctly (ll vs int)
// template by bqi343

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

#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define sperase(v,n) (v).erase(remove(all(v), n), (v).end());
#define vdelete(v) (v).erase(unique(all(v)), (v).end());
#define pb(n) push_back(n);

int a,ans=1000;

main() {
    cin >> a;
    while(a) {
        ans = min(abs(753-a%1000),ans);
        a /= 10;
    }
    cout << ans << endl;
}

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

typedef long long ll;
ll MOD = 1000000007;

int F[1001], C[1001][1001], D[1001][1001];

ll gcd(ll a, ll b) {
	return b ? gcd(b, a % b) : a;
}

vector<vector<int> > f(int N, ll t) {
	vector<vector<int> > a(N + 1);
	for (int n = 1; n <= N; n++) {
		vector<int> dp(N / n + 1);
		dp[0] = 1;
		for (int i = 0; i <= N / n; i++)
			for (int j = 1; i + j <= N / n; j++) {
				if (gcd(t, j * n) != j) continue;
				ll x = dp[i];
				x = x * C[i + j - 1][j - 1] % MOD;
				x = x * F[j - 1] % MOD;
				x = x * D[n][j - 1] % MOD;
				dp[i + j] = (dp[i + j] + x) % MOD;
			}
		a[n] = dp;
	}
	return a;
}

int main() {
	F[0] = 1;
	for (int i = 1; i <= 1000; i++)
		F[i] = (ll)F[i - 1] * i % MOD;
	for (int i = 0; i <= 1000; i++) {
		C[i][0] = 1;
		for (int j = 1; j <= i; j++)
			C[i][j] = (C[i - 1][j - 1] + C[i - 1][j]) % MOD;
	}
	for (int i = 1; i <= 1000; i++) {
		D[i][0] = 1;
		for (int j = 1; j <= 1000; j++)
			D[i][j] = (ll)D[i][j - 1] * i % MOD;
	}
	int N; ll X, Y, Z;
	cin >> N >> X >> Y >> Z;
	vector<vector<int> > a = f(N, 2), b = f(N, abs(X - Y + Z));
	if (!X && !Y && !Z) {
		cout << (ll)a[1][N] * D[N][N] % MOD << endl;
		return 0;
	}
	vector<int> dp(N + 1);
	dp[0] = 1;
	for (int n = 1; n <= N; n++)
		for (int k = N; k >= 0; k--) {
			ll z = 1;
			for (int i = 1; k + i * n <= N; i++) {
				z = z * C[i * n - 1][n - 1] % MOD * F[n - 1] % MOD;
				ll x = dp[k];
				x = x * C[k + i * n][i * n] % MOD;
				x = x * z % MOD;
				x = x * a[n][i] % MOD;
				x = x * b[n][i] % MOD;
				dp[k + i * n] = (dp[k + i * n] + x) % MOD;
			}
		}
	cout << dp[N] << endl;
}

Measured memory_bytes: 11152
#include "bits/stdc++.h"
using namespace std;
int main() {
	long N;
	cin >> N;
	vector<long>A(N);
	for (int i = 0; i < N; i++) {
		cin >> A.at(i);
	}
	vector<long>B(N, 0);
	for (int i = 0; i < N; i++) {
		while (A.at(i) % 2 == 0) {
			B.at(i)++;
			A.at(i) /= 2;
		}
	}
	sort(B.begin(), B.end());
	cout << B.at(0) << endl;
}

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

int main(){
  int N;
  cin >> N;
  vector<int> X(N);
  for(int i=0; i<N; i++){
    cin >> X[i];
  }
  long m=1e15;
  for(int i=1; i<=100; i++){
    long tmp=0;
    for(int j=0; j<N; j++){
      tmp+=(long)pow(X[j]-i,2);
    }
    if(tmp<m) m =tmp;
  }
  cout << m << endl;
  return 0;
}

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

int main()
{
	int h,w,cntnt=0;cin>>h>>w;
	int a[101][101]={0};
	char c;
	for(int i=0;i<h;i++)
	{
		for(int j=0;j<w;j++)
		{
			cin>>c;
			if(c=='#')a[i][j]=2;
			else a[i][j]=1;
		}
	}
	for(int i=0;i<h;i++)
	{
		int cnt=0;
		for(int j=0;j<w;j++)
		{
			if(a[i][j]==1)
			{
				cnt++;
			}
		}
		if(cnt==w)
		{
			for(int j=0;j<w;j++)
			{
				a[i][j]=0;

			}
			cntnt++;
		}
	}
	for(int j=0;j<w;j++)
	{
		int cnt=0;
		for(int i=0;i<h;i++)
		{
			if(a[i][j]==1)
			{
				cnt++;
			}
		}
		if(cnt==h-cntnt)
		{
			for(int i=0;i<h;i++)
			{
				a[i][j]=0;

			}
		}
	}
	for(int i=0;i<h;i++)
	{
		int cnt=0;
		for(int j=0;j<w;j++)
		{
			if(a[i][j]==1)cout<<".";
			else if(a[i][j]==2)cout<<"#";
			else cnt++;
		}
		if(cnt!=w)cout<<endl;
	}
	return 0;
}

Measured memory_bytes: 888
#include<cstdio>
#include<algorithm>
int x[100000];
int main(){
    int n,m;
    scanf("%d%d",&n,&m);
    if(n>=m){
        printf("0\n");
        return 0;
    }
    for(int i=0;i<m;i++)scanf("%d",&x[i]);
    std::sort(x,x+m);
    for(int i=m-1;i>0;i--)x[i]-=x[i-1];
    x[0]=0;
    std::sort(x,x+m);
    int ans=0;
    for(int i=0;i<=m-n;i++)ans+=x[i];
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define ll long long
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define N 1000000007
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n;
    string s;
    cin>>n>>s;
    for(auto &i : s)
        i = (i -'A' + n )%26 + 'A';
    cout<<s;
    return 0;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var n, max uint
	fmt.Scan(&n)

	a := make([]uint, 20)
	x := [20][20]uint{}
	y := [20][20]uint{}

	for i := uint(1); i <= n; i++ {
		fmt.Scan(&a[i])
		for j := uint(1); j <= a[i]; j++ {
			fmt.Scan(&x[i][j], &y[i][j])
		}
	}

	for bits := uint(1); bits < 1<<n; bits++ {
		ok := true
		for i := uint(1); i <= n; i++ {
			if bits&(1<<(i-1)) == 0 {
				continue
			}
			for j := uint(1); j <= a[i]; j++ {
				if (bits>>(x[i][j]-1))&1 != y[i][j] {
					ok = false
				}
			}
		}

		cnt := counter(bits)
		if ok && cnt > max {
			max = cnt
		}
	}

	fmt.Println(max)
}

func counter(x uint) uint {
	if x == 0 {
		return 0
	}
	return counter(x>>1) + (x & 1)
}


Measured memory_bytes: 512
N, M = map(int, input().split())
AB = [tuple(map(int,input().split())) for i in range(M)]

class UnionFind:
    def __init__(self,N):
        self.parent = [i for i in range(N)]
        self._size = [1] * N
        self.count = 0

    def root(self,a):
        if self.parent[a] == a:
            return a
        else:
            self.parent[a] = self.root(self.parent[a])
            return self.parent[a]
    def is_same(self,a,b):
        return self.root(a) == self.root(b)

    def unite(self,a,b):
        ra = self.root(a)
        rb = self.root(b)
        if ra == rb: return
        if self._size[ra] < self._size[rb]: ra,rb = rb,ra
        self._size[ra] += self._size[rb]
        self.parent[rb] = ra
        self.count += 1

    def size(self,a):
        return self._size[self.root(a)]

uf = UnionFind(N)
for a,b in AB:
    a,b = a-1,b-1
    if uf.is_same(a,b): continue
    uf.unite(a,b)

ans = 0
for i in range(N):
    ans = max(ans, uf.size(i))
print(ans)


Measured memory_bytes: 45580
//https://tenka1-2018-beginner.contest.atcoder.jp/tasks/tenka1_2018_c
#include <bits/stdc++.h>
#define ll long long
using namespace std;

long long maxSum(long long a[], long long n){
    sort(a,a+n);
    long long l=a[n-1]; //kiri
    long long r=l;             // kanan
    long long i=0,j=n-2;
    long long sum=0;
    while(i<j){
        long long li=abs(l-a[i]),ri=abs(r-a[i]);
        long long lj=abs(l-a[j]),rj=abs(r-a[j]);
        if(li>ri||lj>rj){ //kiri
                if(li>lj){
                        sum+=li;
                        l=a[i++];
                }else{
                        sum+=lj;
                        l=a[j--];
                }
        }else{
                if(ri>rj){
                        sum+=ri;
                        r=a[i++];
                }else{
                        sum+=rj;
                        r=a[j--];
                }
        }
        //cout<<l<<"---"<<r<<"------"<<i<<"---"<<j<<"----------"<<sum<<endl;
    }
    sum += max(abs(l-a[i]),abs(r-a[i]));
    return sum;
}

int main(){
    long long n;
    cin >> n;
    long long a[n];
    for(long long i=0; i<n; i++){
        cin >> a[i];
    }
    cout<< maxSum(a,n) <<endl;
}


Measured memory_bytes: 1024
N, M = map(int, input().split())
sc = [list(map(int, input().split())) for _ in range(M)]
sc = list(map(list, set(map(tuple, sc))))
M = len(sc)
if N == 1:
    if M == 1:
        print(sc[0][1])
        exit()
    if M == 0:
        print(0)
        exit()

tmp = [-1] * N
for i in range(M):
    if sc[i][0] == 1 and sc[i][1] == 0:
        print(-1)
        exit()

    if tmp[sc[i][0]-1] == -1:
        tmp[sc[i][0]-1] = sc[i][1]
    else:
        print(-1)
        exit()

if tmp[0] == -1:
    tmp[0] = 1
ans = ""
for i in range(N):
    if tmp[i] == -1:
        ans += "0"
    else:
        ans += str(tmp[i])
print(int(ans))

Measured memory_bytes: 3064
#include <cstdio>
using namespace std;
const int N=30+10;
int n,m;
bool a[N][N];
void readData(){
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++){
		int k;
		scanf("%d",&k);
		for(int j=1;j<=k;j++){
			int x;
			scanf("%d",&x);
			a[i][x]=true;
		}
	}
}
void solve(){
	int ans=0;
	for(int i=1;i<=m;i++){
		bool flag=true;
		for(int j=1;j<=n;j++)
			if(!a[j][i]){
				flag=false;
				break;
			}
		ans+=flag;
	}
	printf("%d\n",ans);
}
int main(){
	readData();
	solve();
	return 0;
}

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

int main(){
double A,B; //1<=A,B<=10^100という広い範囲をカバーするにはdouble型
  cin>>A>>B;
  
  if(A>B){cout<<"GREATER"<<endl;}
  else if(A==B){cout<<"EQUAL"<<endl;} 
  else{cout<<"LESS"<<endl;}
}

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

int main() {
    int h,w,k;
    cin>>h>>w>>k;
    vector<vector<int>> rui(h,vector<int>(w+1,0));
    for(int i = 0;i < h;++i) {
        for(int j = 0;j < w;++j) {
            char c;
            cin>>c;
            rui[i][j+1]+=c-'0';
        }
    }
    for(int i = 0;i < h;++i) {
        for(int j = 0;j < w;++j) {
            rui[i][j+1]+=rui[i][j];
        }
    }
    ll mans=h*w;
    for(int bit = 0;bit < (1<<h);++bit) {
        ll ans=__builtin_popcount(bit);
    //cerr<<bit<<" "<<ans;
        int ind=0;
        for(int i = 1;i <= w;++i) {
            //if(bit!=2)break;
            int cnt=0;
            for(int j = 0;j < h;++j) {
                cnt+=rui[j][i]-rui[j][ind];
                while(j+1<h&&(bit&(1<<j))==0) {//jとj+1の間が割れていない
                    ++j;
                    cnt+=(rui[j][i]-rui[j][ind]);
                }
            //cerr<<i<<" "<<j<<" "<<cnt<<endl;
                if(cnt>k){
                    if(i-ind==1){
                        ans=h*w;
                        goto eol;
                    }
                    ++ans;
                    ind=i-1;
                    break;
                }
                else {
                    cnt=0;
                }
            }
        }
        eol:;
    //cerr<<" "<<ans<<endl;
        mans=min(ans,mans);
    }
    cout<<mans<<endl;
    return 0;
}


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

int A[100];

int selectionSort(int A[], int N);

int main(){
    int N;
    cin >> N;
    for (int i=0; i<N; i++) cin >> A[i];
    int sum=selectionSort(A, N);
    for (int i=0; i<N; i++) cout << A[i] << (i != N-1 ? " " : "\n");
    cout << sum << endl;
}

int selectionSort(int A[], int N){
    int sum=0;
    for (int i=0; i<N; i++){
        int minj=i;
        bool flag = false;
        for (int j=i+1; j<N; j++){
            if (A[j] < A[minj]){
                minj = j;
                flag = true;
            }
        }
        if (flag){
            swap(A[i], A[minj]);
            sum++;
            flag = false;
        }
    }
    return sum;
}


Measured memory_bytes: 3076
S = str(input())
l = len(S)
mod = [0] * 2019
dp = 0
pw = 1
for i in range(l):
    mod[dp % 2019] += 1
    dp = dp + pw * int(S[-1-i])
    pw = (pw * 10) % 2019
mod[dp % 2019] += 1
cnt = 0
for i in range(2019):
    cnt += (mod[i]*(mod[i]-1))//2
print(cnt)

Measured memory_bytes: 9104
import random

X = int(input())
def is_prime(n):
    if n == 2: return True
    if n == 1 or n & 1 == 0: return False

    d = (n - 1) >> 1
    while d & 1 == 0:
        d >>= 1

    for k in range(100):
        a = random.randint(1, n - 1)
        t = d
        y = pow(a, t, n)

        while t != n - 1 and y != 1 and y != n - 1:
            y = (y * y) % n
            t <<= 1

        if y != n - 1 and t & 1 == 0:
            return False

    return True

x = X
while(1):
    if is_prime(x):
        print(x)
        break
    x += 1
    

Measured memory_bytes: 4208
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0;i < (int)(n);i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n);i++)

int main() {
int N, M, a, b;
  cin >> N >> M;
  a = max(N + M, N - M);
  b = max(a, N * M);
  cout << b << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ll long long
#define ld long double
#define all(a) (a).begin(),(a).end()
#define mk make_pair
ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;


int main() {
  ll n,k;
  cin >> n >> k;
  ll ans=k;
  rep(i,n-1){
      ans*=(k-1);
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define watch(x) std::cerr << #x << " = " << x
#define watchsp(x) watch(x) << " "
#define watchln(x) watch(x) << std::endl
#define bits(n,x) std::bitset<n>(x)
#define cerr cerr && false && std::cerr
using vi = std::vector<int>;
using vvi = std::vector<vi>;
const int mod = (int)1e9+7;
int main() {
    int n; std::cin >> n;
    vi curr(1 << n, 0), next(1 << n);
    vvi a(n, vi(n));
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            std::cin >> a[i][j];
        }
    }
    curr[0] = 1;
    for (int i = 0; i < n; i++) {
        std::fill(all(next), 0);
        for (int j = 0; j < n; j++) {
            if (a[i][j] == 0) continue;
            for (int mask = 0; mask < (1 << n); mask++) {
                if (mask & (1 << j)) {
                    next[mask] += curr[mask ^ (1 << j)];
                    if (next[mask] >= mod) next[mask] -= mod;
                }
            }
        }
        curr = next;
        watchln("-----------------");
        for (int mask = 0; mask < (1 << n); mask++) {
            watchsp(bits(3,mask));
            watchln(curr[mask]);
        }
    }
    std::cout << curr[(1 << n) - 1] << std::endl;
    return 0;
}

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

// repetition
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define NREP(i, n) FOR(i, 1, n + 1)
#define RFOR(i, a, b) for (int i = (a); i >= (b); i--)
#define RREP(i, n) RFOR(i, n, 0)
#define RNREP(i, n) RFOR(i, n, 1)

// debug
#define test(x) cout << #x << " = " << x << endl

// answer output
#define Yes(c) cout << ((c) ? "Yes" : "No") << endl;
#define YES(c) cout << ((c) ? "YES" : "NO") << endl;
#define yes(c) cout << ((c) ? "yes" : "no") << endl;
 
#define possible(c) cout << ((c) ? "possible" : "impossible") << endl;
#define POSSIBLE(c) cout << ((c) ? "POSSIBLE" : "INPOSSIBLE") << endl;

int main() {

  string s;
  cin >> s;
  
  for ( int i = 0; i < s.size(); i++){
    cout << 'x';
  }
  
  cout << endl;

}

Measured memory_bytes: 256
n,w = map(int, input().split())
w4 = [[] for i in range(4)]
w1 = None
for i in range(n):
    ws, vs = map(int,input().split())
    if i == 0:
        w1 = ws
    ws -= w1
    w4[ws].append(vs)

for i in range(4):
    w4[i].sort(reverse=True)
    tmp = [0]
    for j in w4[i]:
        tmp.append(tmp[-1]+j)
    w4[i] = tmp
ans = 0
for i in range(len(w4[0])):
    for j in range(len(w4[1])):
        for k in range(len(w4[2])):
            for l in range(len(w4[3])):
                if w >= w1*(i+j+k+l) + j + 2*k + 3*l:
                    ans = max(ans, w4[0][i]+w4[1][j]+w4[2][k]+w4[3][l])
print(ans)

Measured memory_bytes: 3064
from collections import deque

n, m = map(int, input().split())

adj_list = [[] for _ in range(n)]

for i in range(m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    adj_list[a].append(b)
    adj_list[b].append(a)

distance = [-1] * n
prev = [-1] * n

q = deque()
q.append([0, 0, 0])  #[room, distance, prev]

while len(q) > 0:
    room, d, p = q.popleft()
    #if distance[room] == -1:
    #    distance[room] = d
    #    prev[room] = p

    for n_room in adj_list[room]:
        if distance[n_room] > 0:
            continue
        q.append([n_room, d + 1, room])
        distance[n_room] = d + 1
        prev[n_room] = room

flag = True
for i in range(n):
    if distance[i] < 0:
        flag = False
        break

if flag is True:
    print("Yes")
    for i in range(1, n):
        print(prev[i] + 1)
else:
    print("No")


Measured memory_bytes: 102220
#include<stdio.h>
#include<math.h>
#include<string.h>
int main()
{
    int n,i,j,a=0,x,y;
    scanf("%d",&n);
    scanf("%d%d",&x,&y);
    for(i=1;i<=1000;i++)
    {
        if(n*i>=x && n*i<=y)
            {a=1;break;}

    }
    if(a>0)
        printf("OK");
    else
        printf("NG");
    return 0;
}


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

enum inf = 1_001_001_001;
enum inf6 = 1_001_001_001_001_001_001L;
enum mod = 1_000_000_007L;



void main() {
    int n;
    scan(n);

    auto cnt = new int[][](11, 11);

    foreach (i ; 1 .. n + 1) {
        int f = i.to!string.front - '0';
        int b = i.to!string.back  - '0';
        cnt[f][b]++;
    }

    long ans;

    foreach (i ; 1 .. 10) {
        foreach (j ; 1 .. 10) {
            ans += 1L * cnt[i][j] * cnt[j][i];
        }
    }

    writeln(ans);
}
















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

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}

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

bool chmin(T, U...)(ref T x, U args) {
    bool isChanged;

    foreach (arg; args) {
        if (x > arg) {
            x = arg;
            isChanged = true;
        }
    }

    return isChanged;
}

bool chmax(T, U...)(ref T x, U args) {
    bool isChanged;

    foreach (arg; args) {
        if (x < arg) {
            x = arg;
            isChanged = true;
        }
    }

    return isChanged;
}


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

inline int  cal(int a,int b,int c,int d){
    return abs(a-c) + abs(b-d);
}

int main()
{
    int n,m,x,y;
    cin >> n >> m;
    vector < pair < int , int > > st;
    vector < pair < int , int > > chk;
    for(int i=0;i<n;i++){
        cin >> x >> y;
        st.push_back(make_pair(x,y));
    }
    for(int j=0;j<m;j++){
        cin >> x >> y;
        chk.push_back(make_pair(x,y));
    }
    for(int i=0;i<n;i++){
        int res = INT_MAX,idx = m;
        for(int j=m-1;j>=0;j--){
            int temp = cal(st[i].first,st[i].second,chk[j].first,chk[j].second);
            if(res >= temp){
                res = temp;
                idx = j;
            }
        }
        cout << idx+1 << endl;
    }
    return 0;
}


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

int main(){
    ll h,w,m;
    cin>>h>>w>>m;
    vector<pair<ll,ll>> row,col;
    map<ll,ll> mr,mc;
    map<pair<ll,ll>,ll> ma;
    for(ll i=0;i<m;i++){
        ll x,y;
        cin>>x>>y;
        mr[x-1]++;
        mc[y-1]++;
        ma[make_pair(x-1,y-1)]++;
    }
    for(auto i : mr)    row.push_back(make_pair(i.second,i.first));
    for(auto i : mc)    col.push_back(make_pair(i.second,i.first));
    sort(row.begin(),row.end());reverse(row.begin(),row.end());
    sort(col.begin(),col.end());reverse(col.begin(),col.end());
    ll ans=0,flag=0;
    for(ll i=0;i<(ll)row.size();i++){
        if(row[i].first!=row[0].first) break;
        for(ll j=0;j<(ll)col.size();j++){
            ll tt=0;
            if(col[j].first!=col[0].first)   break;
            ll currAns=row[i].first+col[j].first;
            tt=ma[make_pair(row[i].second,col[j].second)];
            if(tt>0ll)    currAns--;
            ans=max(ans,currAns);
            if(tt==0ll){
                break;
                flag=1;
            }
        }
        if(flag)    break;
    }
    cout<<ans<<endl;
    return 0;

}

Measured memory_bytes: 87524
N, A, B = map(int, input().split())

cont_num = A+B

k = N // cont_num
# print(k)

adjust_num = N - k*cont_num
add_blue = 0
if adjust_num >= A:
    add_blue = A
else:
    add_blue = adjust_num

print(k*A + add_blue)

Measured memory_bytes: 9136
#include <stdio.h>

int main(void)
{
    int i=0;
    int n;
    int t;
    int s[300000] = {0};
    int j=0;
    int count = 0;
    long long ans = 0;

    scanf("%d",&n);
    scanf("%d",&t);
    
    for(i=0;i<n;i++){
        scanf("%d",&s[i]);
    }
    i=0;

    /*for(i=0;i<n;i++){
        if(count == 0 && i != s[j]){//A
            i++;
            //printf("i=%d j=%d ans = %d count = %d\n",i,j,ans,count);
        }else if(count == 0 && i == s[j]){//B
            count = t-1;
            i++;
            j++;
            ans++;
            //printf("i=%d j=%d ans = %d count = %d\n",i,j,ans,count);
        }else if(count != 0 && i == s[j]){//C
            count = t-1;
            i++;
            j++;
            ans++;
        }
    }*/
    while(((j==n)&&(count==0)) == 0){
        if(count == 0 && i != s[j]){//A
            i++;
            //printf("i=%d j=%d ans = %d count = %d\n",i,j,ans,count);
        }else if(count == 0 && i == s[j]){//B
            count = t-1;
            i++;
            j++;
            ans++;
            //printf("i=%d j=%d ans = %d count = %d\n",i,j,ans,count);
        }else if(count != 0 && i == s[j]){//C
            count = t-1;
            i++;
            j++;
            ans++;
            //printf("i=%d j=%d ans = %d count = %d\n",i,j,ans,count);
        }else if(count != 0 && i!= s[j]){//D
            count--;
            i++;
            ans++;
            //printf("i=%d j=%d ans = %d count = %d\n",i,j,ans,count);
        }
    }

    printf("%lld\n",ans);

        return 0;   
}

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

#define rep(i,n) for(ll i = 0; i < (n); ++i)
#define rep1(i,n) for(ll i = 1; i <= (n); ++i)

using namespace std;
using ll = long long;

int main() {
    pair<string, int> p;
    queue<pair<string, int>> Q;
    
    int n; cin >> n;
    int q; cin >> q;
    rep(i,n) {
        cin >> p.first >> p.second;
        Q.push(p);
    }
    int t = 0;

    while(!Q.empty()) {
        pair<string, int> u = Q.front();
        if(u.second - q <= 0) {
            t+=u.second;
            cout << u.first << ' ' << t << endl;
            Q.pop();
        }
        else {
            t+=q;
            u.second -= q;
            Q.push(u);
            Q.pop();
        }
    }

}


Measured memory_bytes: 6348
n = int(input())
As = [int(round(float(input())*10**9)) for _ in  range(n)]

fives = [0] * n
twos = [0] * n
cnts = [[0] * 20 for i in range(20)]
for i, a in enumerate(As):
    tmp = a
    five = 0
    two = 0
    while tmp % 5 == 0:
        five += 1
        tmp //= 5
    while tmp % 2 == 0:
        two += 1
        tmp //= 2
    cnts[min(two,18)][min(five,18)] += 1

# fiveの和とtwoの和が共に18以上ならOK
# 条件を満たすcnts        
ans = 0
for i1 in range(19):
    for j1 in range(19):
        for i2 in range(19):
            for j2 in range(19):
                if i1+i2 >= 18 and j1+j2>=18:
                    ans += cnts[i1][j1]*cnts[i2][j2]

# 自分自身を除外
for i in range(19):
    for j in range(19):
        if i*2 >= 18 and j*2 >= 18:
            ans -= cnts[i][j]

# ダブルカウント
ans //= 2
print(ans)

Measured memory_bytes: 20204
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
use std::io::{Write, BufWriter};
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, [ $t:tt ]) => {{
        let len = read_value!($next, usize);
        (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    }};

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused)]
macro_rules! debug {
    ($($format:tt)*) => (write!(std::io::stderr(), $($format)*).unwrap());
}
#[allow(unused)]
macro_rules! debugln {
    ($($format:tt)*) => (writeln!(std::io::stderr(), $($format)*).unwrap());
}

fn solve() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (write!(out,$($format)*).unwrap());
    }
    input! {
        a: [i64],
    }
    let n = a.len();
    let mut a = a;
    a.sort();
    a.dedup();
    puts!("{}\n", if a.len() == n { "YES" } else { "NO" });
}

fn main() {
    // In order to avoid potential stack overflow, spawn a new thread.
    let stack_size = 104_857_600; // 100 MB
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}


Measured memory_bytes: 10620
#include <bits/stdc++.h>
#define ll long long int
#define mod 1000000007
#define pii pair<int, int>
#define fr(n) for (int i = 0; i < n; i++)
#define fr1(n) for (int i = 1; i <= n; i++)
using namespace std;

int d[2003][2003];

int main() {
    ios::sync_with_stdio(false);
    int n, k, x, y, z = 0, tb = 0, tw = 0;
    pii a[2003] = {}, b[2003] = {};
    char c;
    cin >> n >> k;
    fr(n) {
        cin >> x >> y >> c;
        if (c == 'B') d[x % (k + k)][y % (k + k)]++, tb++;
        else d[x % (k + k)][y % (k + k)]--, tw++;
    }
    fr(k + k) {
        for (int j = 0; j < k + k; j++) {
            if (i) d[i][j] += d[i - 1][j];
            if (j) d[i][j] += d[i][j - 1];
            if (i && j) d[i][j] -= d[i - 1][j - 1];
        }
    }
    fr(k + k) {
        //for (int j = 0; j < k + k; j++) cout << d[i][j] << ' ';
        //cout << '\n';
    }
    fr(k) {
        for (int j = 0; j < k; j++) {
            int t = 0;
            t += d[k + k - 1][j + k - 1];
            if (j) t -= d[k + k - 1][j - 1];
            //cout << t << ' ';
            t += d[i + k - 1][k + k - 1];
            if (i) t -= d[i - 1][k + k - 1];
            //cout << t << ' ';
            t -= d[i + k - 1][j + k - 1];
            if (i) t += d[i - 1][j + k - 1];
            if (j) t += d[i + k - 1][j - 1];
            if (i && j) t -= d[i - 1][j - 1];
            t -= d[i + k - 1][j + k - 1];
            if (i) t += d[i - 1][j + k - 1];
            if (j) t += d[i + k - 1][j - 1];
            if (i && j) t -= d[i - 1][j - 1];
            z = max(z, t + tw);
            z = max(z, n - t - tw);
            //cout << t << ' ';
        }
    }
    cout << z;
}


Measured memory_bytes: 16000
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define INF 1<<30
#define LINF 1LL<<60

ll N,C;
vector<pair<pll,ll>> stc;
vector<int> used;
bool ok(int c){
    ll pret,prec;
    fill(used.begin(),used.end(),0);
    for(int i = 0; i < c;i++){
        pret = prec = -1;
        for(int j = 0; j < N;j++){
            if(used[j] == 1) continue;
            if(pret < stc[j].first.first){
                used[j] = 1;
                pret = stc[j].first.second;
                prec = stc[j].second;
            }else if(pret == stc[j].first.first){
                if(prec == stc[j].second){
                    used[j] = 1;
                    pret = stc[j].first.second;
                    prec =stc[j].second;
                }
            }
        }
    }
    for(auto f:used){
        if(f == 0) return false;
    }
    return true;
}

int main(void) {
    cin.tie(0); ios::sync_with_stdio(false);
    cin >> N >> C;
    stc.resize(N); used.resize(N);
    for(auto & in:stc) cin >> in.first.first >> in.first.second >> in.second;
    sort(stc.begin(),stc.end());
    for(int i = 1; i <=C;i++){
        if(ok(i)){
            cout << i << endl;
            break;
        }
    }
    return 0;
}


Measured memory_bytes: 2944
#include <cstdio>

/// @brief Determines Three or Four.
int main() {
    char S[101], max = '\0';
    int i, N;

    scanf("%d", &N);

    for (i = 1; i <= N; ++i) {
        scanf(" %c", &S[i]);

        if (S[i] > max) {
            max = S[i];
        }
    }

    if (max < 'Y') {
        puts("Three");
    } else {
        puts("Four");
    }
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int INF=2147483647;
inline ll read(){
	ll x=0,f=1;
	char ch=getchar();
	while(ch<'0'||ch>'9'){
		if(ch=='-') f=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9'){
		x=(x<<1)+(x<<3)+(ch^48);
		ch=getchar();
	}
	return x*f;
}
int k,a,b;
int main(){
	k=read(),a=read(),b=read();
	for(int i=a;i<=b;i++)
		if(i%k==0){
			printf("OK\n");
			return 0;
		}
	printf("NG\n");
	return 0;
}


Measured memory_bytes: 3636
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <list>
#include <string>
#include <numeric>
#include <math.h>
#include <set>
#include <map>
#include <fstream>
#include <sstream>
#include <iterator>
#include <complex>
using namespace std;

long long gcd(long long a,long long b){return b?gcd(b,a%b):a;}
long long lcd(long long a,long long b){return a*b / gcd(a,b) / gcd(a,b);}
int main()
{
	int N;
	cin>>N;
	
	long long result = 1;
	vector<long long> a(N);
	for(int i=0; i<N; i++)
	{
		cin>>a[i];
	}
	sort(a.begin(),a.end());
	for(int i=0; i<N; i++)
	{
		if(a[i]==0)
		{
			result = 0;
			break;
		}
		if(a[i] > 1000000000000000000 / result)
		{
			cout<<-1<<endl;
			return 0;
		}
		result *= a[i];
		
		
	}
	cout<<result<<endl;
}

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

#define int long long
#define vc vector<char>
#define vi vector<int>
#define vs vector<string>
#define si set<int>
#define pii pair<int,int>
#define SORT(c) sort(c.begin(),c.end())
#define SORTC(c, cmp) sort(c.begin(),c.end(),cmp)
#define mapii map<int,int>
#define pb push_back
#define F first
#define S second
#define rep(i, j, k) for (int i=j;i<k;i++)
#define repb(i, j, k) for (int i=j;i>=k;i--)
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define all(x) x.begin(),x.end()
#define mp make_pair
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define ar array

using namespace std;

#define fast ios::sync_with_stdio(false); cin.tie(0)


const int mxN = 6;
int n, m, k;
char a[mxN][mxN];


void solve() {
    cin >> n >> m >> k;
    rep(i, 0, n) {
        rep(j, 0, m) {
            cin >> a[i][j];
        }
    }
    int ans = 0;
    rep(i, 0, 1 << n) {
        rep(j, 0, 1 << m) {
            int blk = 0;
            rep(x, 0, n) {
                rep(y, 0, m) {
                    if (1 << x & i) {
                        continue;
                    }
                    if (1 << y & j) {
                        continue;
                    }
                    if (a[x][y] == '#') {
                        blk++;
                    }
                }
            }
            if (blk == k) {
                ans++;
            }
        }
    }

    cout <<
         ans;

}

int32_t main() {
    fast;

    int tt{1};
//    cin >> tt;
    while (tt--) {
        solve();
        cout << endl;
    }
    return 0;

}

Measured memory_bytes: 3580