akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <vector>

#define rep(i, n) for (int i = 0; i < n; i++)
#define repi(i, n, iv) for (int i = iv; i < n; i++)
#define all(v) v.begin(), v.end()

using namespace std;
typedef long long ll;

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

    int A, B;
    cin >> A >> B;
    cout << A * B << endl;
}


Measured memory_bytes: 3192
#include<stdio.h>
int main(void)
{
	int i, j, h, w;

	while (1)
	{
		scanf("%d%d", &h, &w);
		if ((h == 0) && (w == 0)) break;
		for (i = 0;i < h;i++)
		{
			for (j = 0;j < w;j++)
			{
				if ((i + j) % 2 != 0) printf(".");
				if ((i + j) % 2 == 0) printf("#");
			}
			printf("\n");
		}
		printf("\n");
	}
	return 0;
}


Measured memory_bytes: 572
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;   
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define sz(a) (ll)(a.size())
ll getp(ll x)
{
	return x*x*x*x*x;
}
int main()
{
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	ll x;
	cin>>x;
	map<ll,ll> H;
	H[0]=0;
	for(ll i=1;;i++)
	{
		ll y=getp(i);
		ll z=getp(i-1);
		if(y-z>x)
			break;
		H[y]=i;
	}	
	for(ll i=-1;;i--)
	{
		ll y=getp(i);
		ll z=getp(i+1);
		if(z-y>x)
			break;
		H[y]=i;
	}
	for(auto u:H)
	{
		if(H.find(u.ff-x)!=H.end())
		{
			cout<<u.ss<<" "<<H[u.ff-x]<<"\n";
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 3660
#include<bits/stdc++.h>
using namespace std;
int main()
{
    set<long long>s;
    int n;
    cin>>n;
    for(int i=0; i<n; i++)
    {
        long long x;
        cin>>x;
        s.insert(x);
    }
    cout<<s.size()<<endl;
}



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

int main(void)
{
	int iSize = 0;
	//???????????????????????????
	cin >> iSize;

	//????????????????¢????
	double*Array = new double[iSize];

	for (int i = 0; i<iSize; i++)
	{
		cin >> Array[i];
	}
	//??£??\??????
	//?????????????????????????????§????°??????¨?????????
	//???????????°Sum????????????????????????????????????Array[0]??????????????§?¨?????????§??????
	double Max= Array[0];
	double Min = Array[0];
	double Sum = Array[0];
	for (int i = 1; i<iSize; i++)
	{
		if (Max<Array[i])
		{
			Max = Array[i];
		}
		else if (Min>Array[i])
		{
			Min = Array[i];
		}
		Sum += Array[i];
	}
	cout <<fixed<<setprecision(0)<< Min << " " << Max << " " << Sum << endl;
	delete[] Array;
	return 0;
}

Measured memory_bytes: 3272
#include <bits/stdc++.h>
using namespace std;
#define MAX 100007
int n;
int a[MAX];
int cnt[MAX];

int main(){
	cin >> n;
	for(int i=0;i<n;i++){
		cin >> a[i];
		cnt[a[i]]++;
	}
	int res=cnt[0]+cnt[1];
	for(int i=1;i<MAX;i++){
		res=max(res,cnt[i-1]+cnt[i]+cnt[i+1]);
	}
	cout << res << endl;
}

Measured memory_bytes: 1024
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<iostream>
#include <iomanip>
#include<queue>
#include<algorithm>
#include <functional>
#include<vector>
#include <math.h>
#include <numeric>
#include <stack>
#include <map>
using namespace std;

int X, A;

int main() {
	cin >> X >> A;
	if (X < A) cout << 0 << endl;
	else cout << 10 << endl;
}

Measured memory_bytes: 256
s=input()
if(s=='SUN'):
    print(7)
elif(s=='MON'):
    print(6)
elif(s=='TUE'):
    print(5)
elif(s=='WED'):
    print(4)
elif(s=='THU'):
    print(3)
elif(s=='FRI'):
    print(2)
elif(s=='SAT'):
    print(1)

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

#define DEBUG

long long seriesXor(long long m, long long n)
{
    long long ans = m;
    for (long long i = m + 1; i <= n; i++) {
        ans ^= i;
    }
    return ans;
}

long long calculate(long long x)
{
    if (x % 4 == 0) {
        return x;
    } else if (x % 4 == 1) {
        return 1;
    } else if (x % 4 == 2) {
        return x + 1;
    } else if (x % 4 == 3) {
        return 0;
    } else {
        return 0;
    }
}

int main()
{
    // 输入
    long long a, b, ans = 0;
    scanf("%lld %lld", &a, &b);
    // 计算
    ans = calculate(b) ^ calculate(a - 1);
    // 输出
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 3832
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vii = vector<vector<int>>;
using vl = vector<ll>;
using vll = vector<vector<ll>>;
using pii = pair<int,int>;
#define FOR(i,a,b) for(ll i = (a); i < (b); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(obj) (obj).begin(), (obj).end()
#define pb push_back
const double PI = acos(-1);
const double EPS = 1e-10;
const ll MOD = 1000000007;
void cioacc(){//accelerate cin/cout
  cin.tie(0);
  ios::sync_with_stdio(false);
}
int main(){
  string query, str;
  int n;
  set<string> st;
  cin >> n;
  REP(i,n){
    cin >> query;
    cin >> str;
    if (query == "insert") {
      st.insert(str);
    } else {
      if(st.find(str) != st.end()) cout << "yes" << endl;
      else cout << "no" << endl;
    }
  }
}


Measured memory_bytes: 32600
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
using namespace std;

class dice{
public:
    string top, bottom, right, left, front, back;
    void North();
    void East();
    void South();
    void West();
    void clockRotate();
};
void dice:: North(){
    string tmp = top;
    top = front;
    front = bottom;
    bottom = back;
    back = tmp;
}
void dice:: East(){
    string tmp = top;
    top = left;
    left = bottom;
    bottom = right;
    right = tmp;
}
void dice:: South(){
    string tmp = top;
    top = back;
    back = bottom;
    bottom = front;
    front = tmp;
}
void dice:: West(){
    string tmp = top;
    top = right;
    right = bottom;
    bottom = left;
    left = tmp;
}
void dice:: clockRotate(){
    string tmp = front;
    front = right;
    right = back;
    back = left;
    left = tmp;
}

bool sameDice(dice d1, dice d2){
    string s = "NRRRRNRRRRNRRRRNRRRRERRRRERRRRERRRR";
    rep(i, 0, s.size()){
        if(d1.top == d2.top && d1.front == d2.front && d1.right == d2.right && d1.back == d2.back && d1.left == d2.left && d1.bottom == d2.bottom){
            return true;
        }
        if(s[i] == 'N') d1.North();
        else if(s[i] == 'E') d1.East();
        else if(s[i] == 'S') d1.South();
        else if(s[i] == 'W') d1.West();
        else if(s[i] == 'R') d1.clockRotate();
    }
    return false;
}

signed main(){
    int n;
    while(cin >> n, n){
        vector<dice> dices;
        dice d;
        rep(i, 0, n){
            cin >> d.top >> d.front >> d.right >> d.left >> d.back >> d.bottom;
            dices. push_back(d);
        }
        vector<int> f(n);
        rep(i ,0, n) f[i] = i;
        rep(i, 0, n){
            rep(j, i + 1, n){
                if(sameDice(dices[i], dices[j])){
                    f[i] = f[j];
                }
            }
        }
        set<int> st;
        rep(i, 0, n){
            st.insert(f[i]);
        }
        cout << n - st.size() << endl;
    }
}

Measured memory_bytes: 1232
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
#define FOR(i, x, y) for (decay<decltype(y)>::type i = (x), _##i = (y); i < _##i; ++i)
#define FORD(i, x, y) for (decay<decltype(x)>::type i = (x), _##i = (y); i > _##i; --i)
#ifdef zerol
#define dbg(x...) do { cout << "\033[32;1m" << #x << " -> "; err(x); } while (0)
void err() { cout << "\033[39;0m" << endl; }
template<template<typename...> class T, typename t, typename... A>
void err(T<t> a, A... x) { for (auto v: a) cout << v << ' '; err(x...); }
template<typename T, typename... A>
void err(T a, A... x) { cout << a << ' '; err(x...); }
#else
#define dbg(...)
#endif
// -----------------------------------------------------------------------------

const int N = 20;
char s[N][N];

bool solve(int w, int h) {
    int x = 0, y = 0;
    if (s[x][y] != '#') return false;
    while (x != h - 1 || y != w - 1) {
        s[x][y] = '.';
        if (x < h - 1 && s[x + 1][y] == '#') x++;
        else if (y < w - 1 && s[x][y + 1] == '#') y++;
        else return false;
    }
    s[x][y] = '.';
    FOR (i, 0, h) FOR (j, 0, w) if (s[i][j] != '.') return false;
    return true;
}

int main() {
    int w, h; cin >> h >> w;
    FOR (i, 0, h) scanf("%s", s[i]);
    puts(solve(w, h) ? "Possible" : "Impossible");
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s,st,sr;
    int a=0,i;
    cin>>s>>st;//读入两个字符串
    sr=s+st;//合并成一个字符串
    for (i=0;i<sr.length();i++)
    a=a*10+sr[i]-49+1;//转化为数字形式
    if (sqrt(a)==float(sqrt(a))) cout<<"Yes";//判断是不是完全平方数，是就打印Yes
    else cout<<"No";//否则打印No
    cout<<endl;//记得换行，不然会WA
    return 0;//好习惯......
}

Measured memory_bytes: 256
s = input()
t = input()


flg = True
num = len(s)

if len(s) + 1 == len(t):
    for i in range(num):
        if s[i] != t[i]:
            flg = False
else:
    flg = False


if flg == True:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 9044
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCorder
{
	public class Program
	{
		static void Main(string[] args)
		{
			var cin = new Scanner();
			int a = cin.Int();
			int b = cin.Int();
			if (a >= 1 && a <= 9 && b >= 1 && b <= 9) {
				Console.WriteLine(a * b);
			} else {
				Console.WriteLine(-1);
			}
		}
	}

	public class Scanner
	{
		private readonly char[] delimiter_ = new char[] { ' ' };
		private string[] buf_;
		private int index_;

		public Scanner()
		{
			buf_ = new string[0];
			index_ = 0;
		}

		public string Next()
		{
			if (index_ < buf_.Length) {
				return buf_[index_++];
			}

			string st = Console.ReadLine();
			while (st == "") {
				st = Console.ReadLine();
			}

			buf_ = st.Split(delimiter_, StringSplitOptions.RemoveEmptyEntries);
			if (buf_.Length == 0) {
				return Next();
			}

			index_ = 0;
			return buf_[index_++];
		}

		public int Int() => int.Parse(Next());
		public long Long() => long.Parse(Next());
		public double Double() => double.Parse(Next());

		public int[] ArrayInt(int N, int add = 0)
		{
			int[] Array = new int[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Int() + add;
			}
			return Array;
		}

		public long[] ArrayLong(int N, long add = 0)
		{
			long[] Array = new long[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Long() + add;
			}
			return Array;
		}

		public double[] ArrayDouble(int N, double add = 0)
		{
			double[] Array = new double[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Double() + add;
			}
			return Array;
		}
	}
}

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

using namespace std;
using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vb = vector<bool>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vvb = vector<vector<bool>>;
using vvs = vector<vector<string>>;
template<typename T> using vv = vector<vector<T>>;
template<typename T> using vvv = vector<vector<vector<T>>>;
template<typename T> using pq = priority_queue<T>;
template<typename T> using pqg = priority_queue<T, vector<T>, greater<T>>;

const int INF = 1e9;
const ll LINF = 1e18;
const ll MOD = 1e9 + 7;
const int DX[4] = {1, 0, -1, 0};
const int DY[4] = {0, 1, 0, -1};

#define _sel(_1, _2, x, ...) x
#define repn(i, n) for (ll i = 0; i < (n); i++)
#define reps(i, a, b) for (ll i = (a); i < (b); i++)
#define rep(i, ...) _sel(__VA_ARGS__, reps, repn)(i, __VA_ARGS__)
#define reppn(i, n) for (ll i = 1; i <= (n); i++)
#define repps(i, a, b) for (ll i = (a); i <= (b); i++)
#define repp(i, ...) _sel(__VA_ARGS__, repps, reppn)(i, __VA_ARGS__)
#define rrepn(i, n) for (ll i = (n) - 1; i >= 0; i--)
#define rreps(i, a, b) for (ll i = (b) - 1; i >= (a); i--)
#define rrep(i, ...) _sel(__VA_ARGS__, rreps, rrepn)(i, __VA_ARGS__)
#define rreppn(i, n) for (ll i = (n); i >= 1; i--)
#define rrepps(i, a, b) for (ll i = (b); i >= (a); i--)
#define rrepp(i, ...) _sel(__VA_ARGS__, rrepps, rreppn)(i, __VA_ARGS__)

#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define rng(v) (v).begin(), (v).end()
#define rrng(v) (v).rbegin(), (v).rend()
#define siz(x) int((x).size())
#define pow2(x) (1ll << (x))
#define bit(x, n) ((x) >> (n) & 1)
#define prt(x) cout << (x) << endl
#define dbg(x) dbgn(#x, x)

template<typename T, typename U> inline bool umax(T& m, U x) { if (m < x) { m = x; return true; } return false; }
template<typename T, typename U> inline bool umin(T& m, U x) { if (m > x) { m = x; return true; } return false; }
template<typename T> inline void errv(T& v) { for (auto x: v) cerr << x << " "; cerr << endl; }
inline void errv(vb& v) { for (auto x: v) cerr << (x ? 1 : 0) << " "; cerr << endl; }
template<typename T> inline void dbgn(string n, T x) { cerr << n << ": " << x << endl; }
template<typename T> inline void dbgn(string n, vector<T>& v) { cerr << n << ": "; errv(v); }
template<typename T> inline void dbgn(string n, vv<T>& m) { cerr << n << ":" << endl; for (auto& v: m) errv(v); }


int main() {
    ll a, v, b, w, t;
    cin >> a >> v >> b >> w >> t;

    if (a < b) {
        if (a + v * t >= b + w * t)
            prt("YES");
        else
            prt("NO");
    } else {
        if (a - v * t <= b - w * t)
            prt("YES");
        else
            prt("NO");
    }

    return 0;
}


Measured memory_bytes: 3640
#include <stdio.h>

#define MAX_SIZE 11

int main(int argc,char* argv[]){
  int i,j;
  int matrix[MAX_SIZE][MAX_SIZE];

  for(;;){
    int n;
    scanf("%d",&n);
    
    if(n == 0){
      break;
    }

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

    for(i = 0; i < n; i++){
      int sum = 0;
      for(j = 0; j < n; j++){
	sum += matrix[i][j];
      }
      matrix[i][n] = sum;
    }

    for(i = 0; i < n; i++){
      int sum = 0;
      for(j = 0; j < n; j++){
	sum += matrix[j][i];
      }
      matrix[n][i] = sum;
    }

    {
      int sum = 0;
      for(i = 0; i < n; i++){
	sum += matrix[i][n];
      }

      matrix[n][n] = sum;
    }

    for(i = 0; i <= n; i++){
      for(j = 0; j <= n; j++){
	printf("%5d",matrix[i][j]);
      }
      printf("\n");
    }
  }
  
  return 0;
  
}

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

int main (){

    int N,M;
    scanf("%d %d",&N,&M );

    int pos_aluno_x[N],pos_aluno_y[N];
    int pos_check_x[M],pos_check_y[M];

    for(int i = 0; i < N; ++i){
        scanf("%d %d",&pos_aluno_x[i],&pos_aluno_y[i]);
    }
    for(int j = 0; j < M ; ++j){
        scanf("%d %d",&pos_check_x[j],&pos_check_y[j] );
    }
    for(int w = 0 ; w < N; ++w){
        int coord[50] = {};
        int menor = 0;
        for (int z = 0; z < M; ++z){
            coord[z] = abs(pos_aluno_x[w] - pos_check_x[z]) + abs(pos_aluno_y[w] - pos_check_y[z]) ;
            }
        for (int u = 1; u < M; ++u){
            if (coord[u] < coord[menor]){
                menor = u;
                }
        }

        printf("%d\n",menor+1   );
        }

return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define len(x) (int) (x.size())
using namespace std;
typedef long long ll;

int main() {

    set<int> mys;
    for(int i = 1; i <= 9; i++) {
        for(int j = 1; j <= 9; j++) {
            mys.insert(i*j);
        }
    }
    int n;
    cin >> n;

    if (mys.find(n) != mys.end()) {
        cout << "Yes" << '\n';
    }
    else {
        cout << "No" << '\n';
    }
    
    return 0;
}

Measured memory_bytes: 256
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

n, *b = map(int, read().split())
ans = [0] * n
idx = 0
for i in range(n):
    for j, bb in enumerate(b):
        if j + 1 == bb:
            ans[i] = bb
            idx = j
    if ans[i] == 0:
        print(-1)
        exit()
    b.pop(idx)
print('\n'.join(map(str, ans[::-1])))


Measured memory_bytes: 3064
#include <iostream>
#include <cmath>
#include <string.h>
#include <cstdio>
#include <algorithm>
using namespace std;
struct stu{
    long long ge;
    long long shu;
};
bool com(struct stu a,struct stu b){
    return a.shu < b.shu;
}
int main(){
    long long a,b,c,i,n;
    struct stu z[100000];
    cin>>a>>b;
    for(i = 0;i < a;i++){
        cin>>z[i].shu>>z[i].ge;
    }
    sort(z,z+a,com);
    c = 0;
    for(i = 0;i < a;i++){
        c = c +z[i].ge;
        if(c >= b){
            cout<<z[i].shu;
            return 0;
        }
    }
}


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

#define MIN_INT -2147483648
#define MAX_INT 2147483647
#define MIN_LONG -9223372036854775808L
#define MAX_LONG 9223372036854775807L

#define long long long int

using namespace std;

// @author: pashka

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

    int n, k;
    cin >> n >> k;
    k = min(k, 15);
    string s;
    cin >> s;
    string t = s;
    reverse(t.begin(), t.end());
    string u = s + t;
    string res = s;
    for (int i = 0; i + n <= u.size(); i++) {
        string ss = u.substr(i, n);
        if (k > 0) {
            int j = n - 1;
            while (j >= 0 && ss[j - 1] == ss[n - 1]) j--;
            int x = min((n - j) << (k - 1), n);
            string s3 = "";
            for (int t = 0; t < x; t++) s3 += ss[n - 1];
            for (int t = 0; t < n - x; t++) {
                s3 += ss[j - 1 - t];
            }
            ss = s3;
        }
        if (ss < res) {
            res = ss;
        }
    }
    cout << res;
    
    return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <bitset>
#include <string>
#include <cmath>
#include <complex>
#include <numeric>
#include <cassert>

#include <vector>
#include <array>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <utility>

#define int64 long long
#define uint64 unsigned long long
using namespace std;

int main()
{
	int64 xx;
	cin >> xx;
	if(xx < 1200)
	{
		puts("ABC");
	}
	else
	{
		puts("ARC");
	}
	return 0;
}


Measured memory_bytes: 3620
#include <algorithm>
#include <climits>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <vector>

constexpr int INF = std::numeric_limits<int>::max();
using namespace std;

void solve() {
  int N;
  cin >> N;
  vector<pair<int, int>> red, blue;
  vector<bool> used(2*N+1, false);
  for (int i = 0; i < N; i++)  {
    int x, y;
    cin >> x >> y; red.emplace_back(x, y);
  }
  for (int i = 0; i < N; i++)  {
    int x, y;
    cin >> x >> y; blue.emplace_back(x, y);
  }

  sort(red.begin(), red.end());
  reverse(red.begin(), red.end());

  int ans = 0;
  for (auto r : red) {
    int y = INF;
    for (auto b: blue) {
      if (b.first > r.first && b.second > r.second && !used[b.second]) {
        // printf("(%d,%d) (%d,%d)\n", b.first, b.second, r.first, r.second);
        y = min(y, b.second);
      }
    }

    if (y != INF) {
      ans++;
      used[y] = true;
    }
  }

  cout << ans << endl;
}

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  solve();
  return 0;
}


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

int dx[] = { 1,-1,0,0 }, dy[] = { 0,0,1,-1 };
int c[15][15];
void dfs(int x, int y) {
	c[x][y] = 0;
	rep(i, 4) {
		int nx = x + dx[i], ny = y + dy[i];
		if (0 <= nx&&nx < 12 && 0 <= ny&&ny < 12 && c[nx][ny])
			dfs(nx, ny);
	}
}
int main() {
	while (1) {
		rep(i, 12)rep(j, 12) {
			if(!~scanf("%1d", &c[i][j]))return 0;
		}
		int cnt = 0;
		rep(i, 12) {
			rep(j, 12) {
				if (c[i][j]) {
					dfs(i, j); cnt++;
				}
			}
		}
		cout << cnt << endl;
	}
}

Measured memory_bytes: 3176
n, m = map(int, input().split())
city ={}
for i in range(n):
    city[i+1] = 0
for i in range(m):
    a, b = map(int, input().split())
    city[a] += 1
    city[b] += 1
for i in range(n):
    print(city[i+1])

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

#define ll long long
#define endl '\n'
#define REP(i, a, n) for(int i=a; i<n; ++i)
#define pb push_back
#define sz(x) (int)((x).size())
#define all(x) (x).begin(), (x).end()

typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;

const double PI = 3.141592653589793238460;
const ll mod = 1e9 + 7;

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

int main(){
  FAST();

  int n, d;
  cin >> n >> d;
  vector<vector<int> > coordinates(n, vector<int>(d));
  REP(i, 0, n)
      REP(j, 0, d)
        cin >> coordinates[i][j];

  int cnt = 0;
  REP(i, 0, n){
      REP(j, i + 1, n){
          int temp = 0;
          REP(k, 0, d)
            temp += ((coordinates[i][k] - coordinates[j][k]) * (coordinates[i][k] - coordinates[j][k]));

          int x = sqrt(temp);
          if(temp == x*x)
            cnt++;
      }
  }


  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 256
a = input().split()

if 0 > int(a[2]) - int(a[4]):
    print('No')
elif 0 > int(a[3]) - int(a[4]):
    print('No')
elif int(a[0]) < int(a[2]) + int(a[4]):
    print('No')
elif int(a[1]) < int(a[3]) + int(a[4]):
    print('No')
else:
    print('Yes')   


Measured memory_bytes: 5596
import sys
sys.setrecursionlimit(10 ** 6)  # 再帰関数の再帰の深さを設定
to_index = lambda x: int(x) - 1  # 入力した数字に1を引いたものを返す
print_list_in_2D = lambda x: print(*x, sep="\n")  # リストの要素を改行を挟んで表示する関数

# 入力を整数に変換して受け取る
def input_int(): return int(input())

def map_int_input(): return map(int, input())

MII = map_int_input

def MII_split(): return map(int, input().split())

def MII_to_index(): return map(to_index, input())

def MII_split_to_index(): return map(to_index, input().split())

# 入力全てを整数に変換したものの配列を受け取る
def list_int_inputs(): return list(map(int, input()))

LII = list_int_inputs

def LII_split(): return list(map(int, input().split()))

# 2次元リスト化
def LII_2D(rows_number): return [LII() for _ in range(rows_number)]

def LII_split_2D(rows_number): return [LII_split() for _ in range(rows_number)]

xs = LII_split()
for i in range(1, len(xs)+1):
    if xs[i-1] == 0:
        print(i)

Measured memory_bytes: 9096
s = input()
if len(s) %2 !=0:
  print("No")
else:
  c =0
  for i in range(len(s)//2):
    hi = s[2*i:2*i+2]
    if hi == "hi":
      pass
    else:
      c = 1
      break
  if c ==0:
    print("Yes")
    
  else:
    print("No")


Measured memory_bytes: 2940
n, q = map(int, input().split())
s = input()
a = [0 for i in range(n)]
for i in range(1, n):
    if s[i] == "C" and s[i - 1] == "A":
        a[i] = a[i - 1] + 1
    else:
        a[i] = a[i - 1]
for i in range([q][0]):
    l, r = map(int, input().split())
    print(a[r - 1] - a[l - 1])

Measured memory_bytes: 6180
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define s second
#define f first
long long const mod = 1000000007; 
#define inf 1000000000000000000
inline ll add(ll a, ll b){ return ((a%mod)+(b%mod)+mod)%mod;}
inline ll mul(ll a, ll b){ return (((a%mod)*(b%mod))%mod+mod)%mod;}
inline ll sub(ll a, ll b){ return ((a%mod)-(b%mod)+mod)%mod;}

ll power(ll x,ll y,ll m) 
{ 
    if (y == 0) 
        return 1; 
    ll p = power(x, y/2, m) % m;
    p = (p * p) % m; 
    return (y%2 == 0)? p : (x * p) % m; 
}

ll modInv(ll x)
{
    return power(x,mod-2,mod)%mod;
}

struct st
{
    ll s,e,ind;
};
bool compare(st s1,st s2)
{
    if(s1.s==s2.s)
        return s1.e<s2.e;
    return s1.s<s2.s;
}

bool operator<(const st& t1, const st& t2) 
{ 
    return (t1.ind < t2.ind); 
}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
    
    ll x,y,z;
    cin>>x>>y>>z;
    cout<<z<<" "<<x<<" "<<y<<endl;


    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;

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

int main()
{
	string s, t;
	cin >> s >> t;

	REP(i, (int)s.size()){
		if (s[i] != t[i]){
			char a = s[i], b = t[i];
			for (int j = 0; j < (int)s.size(); j++){
				if (s[j] == a){
					s[j] = b;
					continue;
				}
				if (s[j] == b){
					s[j] = a;
				}
				if (j < i && s[j] != t[j]) {
                  cout << "No" << endl;
                  return (0);
                }
			}
		}
	}

	if (s == t) cout << "Yes" << endl;
	else cout << "No" << endl;
}


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

int main(){
  int n;
  while(cin>>n && n){
    int min=1000;
    int max=0;
    int sum=0;
    for(int i=0;i<n;i++){
      int a;
      cin>>a;
      sum+=a;
      if(min > a) min = a;
      if(max < a) max = a;
    }
    cout<<(sum-min-max)/(n-2)<<endl;
  }
  return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <complex>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <unordered_map>
#include <cstdio>
#include <cstring>
#include <bitset>
 
using namespace std;
 
typedef long double Real;
 
const Real EPS = 0.000001;
const Real PI = acos(Real(-1));
 
typedef complex<Real> point;
 
struct circle {
  point p;
  Real r;
  circle(point p, Real r): p(p), r(r) {}
};
 
typedef vector<point> line;
 
bool equals(point const& a, point const& b) {
  return abs(a - b) < EPS;
}
 
bool equals(Real a, Real b) {
  return abs(a - b) < EPS;
}
 
vector<point> tangent_points(circle const& c, point const& p) {
  vector<point> ret;
  const Real sec2 = norm(p - c.p);
  const Real tan2 = max(Real(0), sec2 - c.r * c.r);
  const point nv = (p - c.p) * c.r * c.r / sec2;
  const point pv = (p - c.p) * point(0, -1) * c.r * sqrt(tan2) / sec2;
  ret.push_back(c.p + nv + pv);
  ret.push_back(c.p + nv - pv);
  return ret;
}
 
int main() {
 
  int x, y; cin >> x >> y;
  point p(x, y);
  int r; cin >> x >> y >> r;
  circle c(point(x, y), r);
 
  vector<point> ans = tangent_points(c, p);
   
  // SWAP
 
  if(!equals(ans[0].real(), ans[1].real())) {
    if(ans[0].real() > ans[1].real())
      swap(ans[0], ans[1]);
  } else if(ans[1].imag() > ans[1].imag()) {
    swap(ans[0], ans[1]);
  }
 
  printf("%.10Lf %.10Lf\n%.10Lf %.10Lf\n", ans[0].real(), ans[0].imag(), ans[1].real(), ans[1].imag());
 
  return 0;
}

Measured memory_bytes: 3288
#include<bits/stdc++.h>
//cervello|Phoenix
using namespace std;
#define ll long long int
#define eb emplace_back
#define mk make_pair
#define all(x) x.begin(),x.end()
#define mod 1000000007

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    string s; cin>>s;
    ll sum=0;
    int n=s.length();
    for(int i=0;i<n;i++){
        sum+=s[i]-'0';
    }
    if(sum%9)
        cout<<"No\n";
    else
        cout<<"Yes\n";
    return 0;
}

Measured memory_bytes: 3764
#include <bits/stdc++.h> 
using namespace std;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define sz(x) (int)(x).size()
typedef vector<int> vi;
// #define ll long long 
#define int long long
#define ld long double
#define fi first
#define se second
#define pb push_back
#define pii pair<int,int>
#define all(x) (x).begin(), (x).end()
const int MOD = 1e9+7;
int mpow(int a,int b,int p=MOD){a=a%p;int res=1;while(b>0){if(b&1)res=(res*a)%p;a=(a*a)%p;b=b>>1;}return res%p;}
const int N=2*1e5+2;

int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	int n,k;
	cin>>n>>k;
	int a[n];
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
	}
	int s=0;
	for(int i=0;i<k;i++)
	{
		s+=a[i];
	}
	ld ans=(ld)(s+k)/2.0;
	for(int i=k;i<n;i++)
	{
		s+=a[i];
		s-=a[i-k];
		ld o=(ld)(s+k)/2.0;
		ans=max(ans,o);
	}
	cout<<fixed<<setprecision(10)<<ans;
} 
// 3,11
// 14/2
// 1,6
// 7/2
// 
// s*p(s)
// (k1+k2+k3...kn)*(p(k1)+p(k2)+p(k3))
// k1*(p(k1)+p(k2)+p(k3)...)+k1*(p(k1)+p(k22)+..)
// 1*(1/a[i]+)
// I never lose. I either win or I learn

Measured memory_bytes: 1792
#include <stdio.h>
#include <iostream>

using namespace std;

int main(){
	while(true){
		int m, f, r;
		cin >> m >> f >> r;
		if(m==-1 && f==-1 && r==-1){
			break;
		}
		else if(m==-1 || f==-1){
			cout << "F\n";
		}
		else if(m+f>=80){
			cout << "A\n";
		}
		else if(m+f>=65){
			cout << "B\n";
		}
		else if(m+f>=50){
			cout << "C\n";
		}
		else if(m+f>=30){
			if(r>=50){
				cout << "C\n";
			}
			else{
				cout << "D\n";
			}
		}
		else{
			cout << "F\n";
		}
	}
}


Measured memory_bytes: 3024
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
const int INF = 1 << 28;
const ll MOD = 1000000007;
template <class T>
bool chmax(T &a, const T &b) {
    return (a < b) ? (a = b, 1) : 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    return (b < a) ? (a = b, 1) : 0;
}

int main() {
    int w, a, b;
    cin >> w >> a >> b;
    if (a + w < b) {
        cout << b - a - w << "\n";
    } else if (b + w < a) {
        cout << a - b - w << "\n";
    } else
        cout << 0 << "\n";
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main(void){
  char alf;
  scanf("%c",&alf);
  if(('a'-0<=alf-0)&&('z'-0>=alf-0)){
    printf("a\n");
  }else{
    printf("A\n");
  }
  return 0;
}
  
  


Measured memory_bytes: 1588
use proconio::input;

fn main() {
    input!(n: usize, a: [usize; n]);
    let mut cnt = vec![0; n + 1];
    for x in a {
        if x <= n {
            cnt[x] += 1;
        }
    }
    println!(
        "{}",
        n - cnt
            .iter()
            .enumerate()
            .filter_map(|(i, &x)| if i <= x { Some(i) } else { None })
            .sum::<usize>()
    );
}


Measured memory_bytes: 3904
# -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue
from decimal import *


class Scanner():
    @staticmethod
    def int():
        return int(sys.stdin.readline().rstrip())

    @staticmethod
    def string():
        return sys.stdin.readline().rstrip()

    @staticmethod
    def map_int():
        return [int(x) for x in Scanner.string().split()]

    @staticmethod
    def string_list(n):
        return [input() for i in range(n)]

    @staticmethod
    def int_list_list(n):
        return [Scanner.map_int() for i in range(n)]

    @staticmethod
    def int_cols_list(n):
        return [int(input()) for i in range(n)]


class Math():
    @staticmethod
    def gcd(a, b):
        if b == 0:
            return a
        return Math.gcd(b, a % b)

    @staticmethod
    def lcm(a, b):
        return (a * b) // Math.gcd(a, b)

    @staticmethod
    def divisor(n):
        res = []
        i = 1
        for i in range(1, int(n ** 0.5) + 1):
            if n % i == 0:
                res.append(i)
                if i != n // i:
                    res.append(n // i)
        return res

    @staticmethod
    def round_up(a, b):
        return -(-a // b)

    @staticmethod
    def is_prime(n):
        if n < 2:
            return False
        if n == 2:
            return True
        if n % 2 == 0:
            return False
        d = int(n ** 0.5) + 1
        for i in range(3, d + 1, 2):
            if n % i == 0:
                return False
        return True


def pop_count(x):
    x = x - ((x >> 1) & 0x5555555555555555)
    x = (x & 0x3333333333333333) + ((x >> 2) & 0x3333333333333333)
    x = (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0f
    x = x + (x >> 8)
    x = x + (x >> 16)
    x = x + (x >> 32)
    return x & 0x0000007f


MOD = int(1e09) + 7
INF = int(1e15)


def solve():
    N, K = Scanner.map_int()
    ans = 0
    for b in range(1, N+1):
        ans += N // b * max(0, b - K)
        ans += max(0, N % b - K + 1)
    if K == 0:
        ans -= N
    print(ans)


def main():
    # sys.stdin = open("sample.txt")
    solve()


if __name__ == "__main__":
    main()


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

int main() {
    int m,d;
    cin >> m >> d;
    int cnt=0;
    for(int i=4;i<=m;i++){
      for(int j=22;j<=d;j++){
        if((j/10)>=2 && (j%10)>=2 &&(j/10)*(j%10)==i) cnt++;
      }
    }
    cout << cnt << endl;

}


Measured memory_bytes: 256
//
#include <vector>
#include <set>
#include <array>
#include <iostream>
#include <cstdio>
#include <cstdint>
#include <algorithm>
#include <numeric>
#include <bitset>
//
using ll = long long;
using namespace std;
#define rep(i,n) for(ll i=0;i<(n);++i)
inline void yes(bool cond) { cond ? puts("Yes") : puts("No"); }
template<typename Type> inline void chmin(Type& a, Type b) { if (a > b) a = b; }
template<typename Type> inline void chmax(Type& a, Type b) { if (a < b) a = b; }
#define BIGP   1000000007
#define INF_I  std::numeric_limits<ll>::max()
#define INF_F  std::numeric_limits<float>::infinity()
//
int main()
{
    cin.tie(0); ios::sync_with_stdio(false);
    ll N;
    struct T
    {
    public:
        ll a;
        ll b;
        ll c;
    };
    vector<T> t;
    cin >> N;
    rep(i, N)
    {
        ll a, b, c;
        cin >> a >> b >> c;
        t.push_back({a,b,c});
    }
    //
    T h0, h1;
    h0.a = t[0].a;
    h0.b = t[0].b;
    h0.c = t[0].c;
    //
    for(ll i=1;i<N;++i)
    {
        ll i1 = i - 1;
        h1.a = t[i].a + max(h0.b, h0.c);
        h1.b = t[i].b + max(h0.a, h0.c);
        h1.c = t[i].c + max(h0.a, h0.b);
        h0 = h1;
    }
    cout << max({ h0.a, h0.b, h0.c });
}

Measured memory_bytes: 5876
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
typedef long long ll;
typedef pair<int,int> pint;

#define eps (1e-10)
struct Point{
    double x,y;
    Point(){}
    Point(double x,double y):x(x),y(y){}
    Point operator+(Point p) {return Point(x+p.x,y+p.y);}
    Point operator-(Point p) {return Point(x-p.x,y-p.y);}
    Point operator*(double k){return Point(x*k,y*k);}
    double norm(){return x*x+y*y;}
    double abs(){return sqrt(norm());}
    bool operator == (const Point &p) const{
    return fabs(x-p.x)<eps && fabs(y-p.y)<eps;
  }
  double dot(Point p){return x*p.x+y*p.y;}
  double det(Point p){return x*p.y-y*p.x;}
};
int ccw(Point a,Point b,Point c){
  Point t1=b-a,t2=c-a;
  if(t1.det(t2)> eps) return 1;//counter clockwise
  if(t1.det(t2)< -eps) return -1;//clockwise
  if(t1.dot(t2)< -eps) return 2;//c-a-b online
  if(t1.norm()<t2.norm()) return -2;//a-b-c online
  return 0;//a-c-b online
}

Point a[101];
int main(){
    int n;
    cin>>n;
    double x,y;
    rep(i,n){
        cin>>x>>y;
        a[i]=Point(x,y);
    }
    int q;
    cin>>q;
    rep(i,q){
        cin>>x>>y;
        Point c(x,y),ex(100000,100000);
        int sum=0,ans=0;
        rep(i,n){
            if(ccw(a[i],a[(i+1)%n],c)==0){
                ans=1;
                break;
            }
            else{
                Point s=a[i]-c,t=a[(i+1)%n]-c;
                if(s.y>t.y) swap(s,t);
                if(s.y<=0&&t.y>0&&s.det(t)<0) ++sum;
            }; 
        }
        if(ans==1) cout<<ans<<endl;
        else if(sum%2==1) cout<<2<<endl;
        else cout<<0<<endl;
    }
    return 0;
}


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

int rd[4][3][10] = { 0 };

int main(){
	int n, b, f, r, v;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> b >> f >> r >> v;
		rd[b-1][f-1][r-1] += v;
	}
	for (int i = 0; i < 4; i++) {
		if (i > 0) {
			cout << "####################" << endl;
		}
		for (int j = 0; j < 3; j++) {
			for (int k = 0; k < 10; k++) {
				cout << " " << rd[i][j][k];
			}
			cout << endl;
		}
	}

	return 0;
}

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

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

  vector<int> A(N);
  for (int i = 0; i < N; i++) cin >> A.at(i);

  vector<int> cntOdd(110000);
  for (int i = 0; i < N; i += 2) {
    cntOdd.at(A.at(i))++;
  }

  vector<int> cntEven(110000);
  for (int i = 1; i < N; i += 2) {
    cntEven.at(A.at(i))++;
  }

  int maxOdd = -1;
  int index;
  for (int i = 0; i < cntOdd.size(); i++) {
    maxOdd = max(maxOdd, cntOdd.at(i));
    if (maxOdd == cntOdd.at(i)) index = i;
  }

  int maxEven = -1;
  for (int i = 0; i < cntEven.size(); i++) {
    if (index != i) maxEven = max(maxEven, cntEven.at(i));
  }

  int ans1 = (N / 2 - maxOdd) + (N / 2 - maxEven);

  maxEven = -1;
  for (int i = 0; i < cntEven.size(); i++) {
    maxEven = max(maxEven, cntEven.at(i));
    if (maxEven == cntEven.at(i)) index = i;
  }

  maxOdd = -1;
  for (int i = 0; i < cntOdd.size(); i++) {
    if (index != i) maxOdd = max(maxOdd, cntOdd.at(i));
  }

  int ans2 = (N / 2 - maxOdd) + (N / 2 - maxEven);

  cout << min(ans1, ans2) << endl;
}


Measured memory_bytes: 1536
#include<iostream>
#include<vector>
using namespace std;
int main(){
	long long item, knapsack;
	cin>>item>>knapsack;
	vector<pair<long long,long long>> items;
	for(int i=0;i<item; i++){
		int weight, value;
		cin>>weight>>value;
		items.push_back(make_pair(weight,value));
	}
	vector<vector<long long>>dp(item+1,vector<long long>(knapsack+1,0));
	for(int i=0; i<item; i++){
		int weight=items[i].first,value=items[i].second;
		for(int j=1;j<=knapsack ; j++){
			if(j<weight)
				dp[i+1][j]=dp[i][j];
			else{
				dp[i+1][j]=max(dp[i][j],dp[i][j-weight]+value);
			}
		}
		
	}
	cout<<dp[item][knapsack]<<endl;
	
	
	return 0;
}


Measured memory_bytes: 80256
def money_root(number, total)
  for a_i in 0..number
    for b_i in 0..number
      c_i = number - (a_i + b_i)
      tmp_total = 10000*a_i + 5000*b_i + 1000*c_i
      if tmp_total == total && c_i >= 0
        nums = [a_i, b_i, c_i]
        puts nums.join(' ')
        return
      end
    end
  end
  # 出力: -1 -1 -1
  puts [-1, -1, -1].join(' ')
end
input = gets.chop.split.map(&:to_i)
money_root(input[0], input[1])

Measured memory_bytes: 1788
#define REP(i, t, n)  for (int i = t; i < n; i++)
#define ALL(n)        (n).begin(),(n).end()
#define ARYLEN(array)	(sizeof(array)/sizeof(array[0]))
#include <limits.h>
#include <stdio.h>
#include <cmath>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <deque>
#include <functional>
#include <algorithm>
#include <cstring>
#include <unordered_map>
#include <numeric>


using namespace std;

typedef bool               BOOL;
typedef short              WORD;
typedef unsigned short     U_WORD;
typedef long               DWORD;
typedef unsigned long      U_DWORD;
typedef long long          QWORD;
typedef unsigned long long U_QWORD;

#define TRUE	(1)
#define FALSE (0)

#define H_MAX	(1000)
#define W_MAX (1000)
#define NIL 	(-1)
#define WHITE (0)
#define BLACK (1)

typedef struct {
	DWORD	dwH;
	DWORD dwW;
} POS;

DWORD H, W;
DWORD adwField[H_MAX + 2][W_MAX + 2];
DWORD aIdx[2] = {-1, 1};

queue<POS> que;

void initField(DWORD height, DWORD width) {
	//番兵でフィールドを初期化
	REP (i, 0, width + 2) {
		adwField[0][i] = NIL;
		adwField[height + 1][i] = NIL;
	}
	REP (i, 0, height + 2) {
		adwField[i][0] = NIL;
		adwField[i][width + 1] = NIL;
	}
}

void procDarkFour(int idxH, int idxW, int times) {
	REP (i, 0, 2) {
		int addIdx = aIdx[i];
		if ((adwField[idxH + addIdx][idxW] == WHITE) || adwField[idxH + addIdx][idxW] > (times + 1)) {
			adwField[idxH + addIdx][idxW] = times + 1;
			que.push(POS{(idxH + addIdx),idxW});
		}
		if (adwField[idxH][idxW + addIdx] == WHITE || adwField[idxH][idxW + addIdx] > (times + 1) ) {
			adwField[idxH][idxW + addIdx] = times + 1;
			que.push(POS{idxH,(idxW + addIdx)});
		}
	}
}

DWORD procDarkField() {
	DWORD dwRet = 0;
	BOOL bIsProc = TRUE;
	int times = 1;

	while(!que.empty()) {
		POS tempPos;
		tempPos = que.front();
		procDarkFour(tempPos.dwH, tempPos.dwW, adwField[tempPos.dwH][tempPos.dwW]);
		dwRet = max(dwRet, adwField[tempPos.dwH][tempPos.dwW]);
		que.pop();
	}

	return dwRet - 1 ;
}

void solve_main()
{
	cin >> H >> W;
	initField(H, W);

	REP (i, 0, H) {
		REP (j, 0, W) {
			char temp;
			cin >> temp;
			switch (temp) {
			case '.':
				adwField[i + 1][j + 1] = WHITE;
				break;
			case '#':
				adwField[i + 1][j + 1] = BLACK;
				que.push(POS{(i + 1), (j + 1)});
				break;
			}
		}
	}

	cout << procDarkField() << endl;
}

int main()
{
#ifdef FOR_IDE
	ifstream in("input.txt");
	cin.rdbuf(in.rdbuf());
#endif

	solve_main();
	return 0;
}


Measured memory_bytes: 24500
import java.util.*;
import java.util.stream.Collectors;
import java.io.*;
import java.math.BigDecimal;
import java.nio.charset.StandardCharsets;

public class Main {
	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		Main ins = new Main(in);
		ins.calc();
		ins.showResult();
	}

	Main(BufferedReader in) throws IOException {
		String line = "1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51";
		String[] tokens = line.split(", ");
		int K = Integer.parseInt(in.readLine());
		System.out.println(tokens[K - 1]);
	}

	void calc() {
	}

	void showResult() {
	}

}


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


int main() {
  string S;
  cin >> S;
  
  if(S=="RRR"){
    cout << 3 <<endl;
  }
  else if(S=="RRS"){
    cout << 2 <<endl;
  }
  else if(S=="SRR"){
    cout << 2 <<endl;
  }
  else if(S=="RSS"){
    cout << 1 <<endl;
  }
  else if(S=="SRS"){
    cout << 1 <<endl;
  }
  else if(S=="SSR"){
    cout << 1 <<endl;
  }
  else if(S=="RSR"){
    cout << 1 <<endl;
  }
  else{
    cout << 0 <<endl;
  }
}


Measured memory_bytes: 3624
N,A,B,C,D=map(int,input().split())
if N%A:
    X=(N//A+1)*B
else:
    X=(N//A)*B
if N%C:
    Y=(N//C+1)*D
else:
    Y=(N//C)*D
if X<Y:
    print(X)
else:
    print(Y)


Measured memory_bytes: 5596
#include <bits/stdc++.h>
#include <string>
using namespace std;
 
int main(){
 
    int N,M;
    string temp,string[110]={},text[110]={};

    int s[110]={},t[110]={},flag[110]={};

    cin >> N;

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


    for(int i=0;i<100;i++){
        if(flag[i]!=1){
            for(int j=i;j<=N;j++){
                if(string[i].compare(string[j])==0){
                    s[i]= s[i] + 1;
                    flag[j]=1;
                }
            }
            if(s[i]==0)s[i]=1;
        }
    }

    cin >> M;

    for(int i=0;i<M;i++){
        cin >> text[i];
    }

    for(int i=0;i<100;i++){
        for(int j=0;j<M;j++){
            if(text[j].compare(string[i])==0){
                t[i]+=1;
            }
        }
    }

    int tmp,ans=0;

    for(int i=0;i<N;i++){
        tmp=s[i]-t[i];
        if(tmp>ans){
            ans = tmp;
        }
    }

    cout << ans << endl;

    return 0;
}

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

ll N;
vector<string> S;

int main() { 
    cin >>N;
    S.resize(N);
    for (int i = 0; i < N; i++) cin >> S[i];
    set<string> st;
    for(int i=0; i <N; i++){
      st.insert(S[i]);
    }
    ll cnt = 0;
    for (auto i: st){
      cnt++;
    }
    cout<< cnt<< endl;
    return 0;
}

Measured memory_bytes: 24916
import collections

n,k=map(int,input().split())
a=list(map(int,input().split()))
a=collections.Counter(a)
A=a.most_common()[::-1]
x=len(A)-k

if x<=0:
  print("0")
else:
  ans=0
  for i in range(x):
    ans+=A[i][1]
  print(ans)

Measured memory_bytes: 37780
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>

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

using namespace std;

int main()
{
	int n;
	while(cin >> n && n)
	{
		map<int,int> m;

		rep(i,n)
		{
			int temp;
			cin >> temp;

			temp /= 10;

			if(temp >= 6) m[6]++;
			else m[temp]++;
		}

		rep(i,7)
		{
			cout << m[i] << endl;	
		}
	}
	return 0;
}

Measured memory_bytes: 1196
N, M = map(int, input().split())
A = list(set(map(lambda x : int(x)//2, input().split())))

def _gcd(a, b):
    return a if b == 0 else _gcd(b, a%b)

def _lcm(a,b):
    return (a*b) // _gcd(a,b)

lcm = A[0] 
for ai in A[1:]:
    lcm = _lcm(lcm, ai)

ret = (M//lcm + 1)//2

for ai in A[1:]:
    if (lcm // ai) % 2 == 0:
        ret = 0
        break
print(ret)


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

int main() {
  int64_t N, A, B, set;
  cin >> N >> A >> B;
  set = N / (A + B);
  if (set == 0 && A > N) {
    cout << N << endl;
  }
  else if (set == 0 && A <= N) {
    cout << A << endl;
  }
  else {
    if (N - set * (A + B) <= A) {
      cout << A * set + (N - set * (A + B)) << endl;
    }
    else {
      cout << A * (set + 1) << endl;
    }
  }
}

Measured memory_bytes: 256
/*
    Problem 15
    https://atcoder.jp/contests/abc145/tasks/abc145_c
*/
#include <bits/stdc++.h>
using namespace std;
/* typedef */
typedef long long ll;
typedef pair<int, int> pii;
/* constant */
const int INF = 1 << 30;
const ll LINF = 1LL << 50;
const int NIL = -1;
const int MAX = 10000;
const int mod = 1000000007;
const double pi = 3.141592653589;
/* global variables */
/* function */
double dist(double x1, double y1, double x2, double y2) {
    double dx = x1 - x2, dy = y1 - y2;
    return sqrt(dx * dx + dy * dy);
}
double fact(double x) {
    double ret = 1.0;
    for (double i = 1; i <= x; i++) ret *= i;
    return ret;
}
/* main */
int main(){
    int N;
    cin >> N;
    vector<double> x(N), y(N);
    for (int i = 0; i < N; i++) cin >> x[i] >> y[i];
    double sum = 0.0;
    vector<int> p(N);
    iota(p.begin(), p.end(), 0);
    do {
        for (int i = 0; i < N - 1; i++)
            sum += dist(x[p[i]], y[p[i]], x[p[i+1]], y[p[i+1]]);
    } while (next_permutation(p.begin(), p.end()));
    cout << fixed << setprecision(10) << sum / fact(N) << '\n';
}

Measured memory_bytes: 3784
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <set>

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

using namespace std;

int main() {
  int N, M;
  while (cin >> N >> M, N + M) {
    vector<vector<int>> G(N);
    REP (i, 0, M) {
      int u, v;
      cin >> u >> v;
      u--;v--;
      G[u].push_back(v);
      G[v].push_back(u);
    }
    vector<int> color(N, 0);
    function<bool(int, int)> dfs = [&](int ind, int c) {
      if (color[ind] != 0) {
	return color[ind] == c;
      } 
      color[ind] = c;
      REP (i, 0, G[ind].size()) {
	bool res = dfs(G[ind][i], -1 * c);
	if (!res) {
	  return false;
	}
      }
      return true;
    };

    set<int> s;
    REP (i, 0, 2) {
      color.assign(N, 0);
      bool res = dfs(0, 2 * i - 1);
      if (res) {
	int a = 0, b = 0;
	REP (j, 0, N) {
	  if (color[j] == 1) {
	    a++;
	  } else {
	    b++;
	  }
	}
	if (a % 2 == 0) {
	  s.insert(a / 2);
	}
	if (b % 2 == 0) {
	  s.insert(b / 2);
	}
      }
    }
    cout << s.size() << endl;
    for (auto i : s) {
      cout << i << endl;
    }
  }
  return 0;
}



Measured memory_bytes: 3208