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

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

int main() {
    int h, w; cin >> h >> w;
    vector<string> field(h);
    for (int i=0; i<h; ++i) cin >> field[i];
    if (field[0][0] == '#') {
        cout << -1 << endl;
        return 0;
    }
    int wcnt = 0;
    for (int i=0; i<h; ++i) {
        for (int j=0; j<w; ++j) {
            wcnt += (field[i][j] == '.');
        }
    }
    vector<vector<int>> dist(h, vector<int>(w));
    dist[0][0] = 0;
    field[0][0] = '#';
    queue<pair<int, int>> q;
    q.push(make_pair(0, 0));
    while (!q.empty()) {
        int nowy = q.front().first;
        int nowx = q.front().second;
        q.pop();
        for (int i=0; i<4; ++i) {
            int nexty = nowy + dy[i];
            int nextx = nowx + dx[i];
            if (nexty < 0 || h <= nexty) continue;
            if (nextx < 0 || w <= nextx) continue;
            if (field[nexty][nextx] == '#') continue;
            if (!dist[nexty][nextx]) {
                field[nexty][nextx] = '#';
                dist[nexty][nextx] = dist[nowy][nowx] + 1;
                q.push(make_pair(nexty, nextx));
            }
        }
    }
    if (dist[h-1][w-1] == 0) {
        cout << -1 << endl;
    }
    else {
        cout << wcnt - dist[h-1][w-1] - 1 << endl;
    }
}

Measured memory_bytes: 256
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws FileNotFoundException {
		new Main().run();
	}

	public void run() throws FileNotFoundException {
		Scanner sc = new Scanner(System.in);
		long n = sc.nextLong();
		long s = sc.nextLong();
		long sqrt = (long) (Math.sqrt(n));
		for (int b = 2; b <= sqrt; ++b) {
			if (f(n, b) == s) {
				System.out.println(b);
				return;
			}
		}
		if (n - s == 0) {
			System.out.println(n + 1);
			return;
		}

		ArrayList<Long> div = new ArrayList<>();
		for (long i = 1; i * i <= n - s; ++i) {
			if ((n - s) % i == 0) {
				div.add(i);
				div.add((n - s) / i);
			}
		}
		Collections.sort(div);
		for (long v : div) {
			if (f(n, v + 1) == s) {
				System.out.println(v + 1);
				return;
			}
		}
		System.out.println(-1);
	}

	long f(long n, long b) {
		long ret = 0;
		while (n > 0) {
			ret += n % b;
			n /= b;
		}
		return ret;
	}

	void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}
}


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

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

using namespace std;

struct Data {
  int ID,weight;
  bool operator < ( const Data &data ) const { return weight < data.weight; }
};

const int MAX_V = 5100;
int V,E;
vector<int> G[MAX_V];
bool used[MAX_V];
vector<Data> vec;

void compute(){
  sort(vec.begin(),vec.end());
  int mini = 0;
  rep(i,V) if( !used[vec[i].ID] ) {
    used[vec[i].ID] = true;
    mini += vec[i].weight;
    deque<int> deq;
    deq.push_back(vec[i].ID);
    while( !deq.empty() ){
      int cur = deq.front(); deq.pop_front();
      rep(j,(int)G[cur].size()){
	int next = G[cur][j];
	if( !used[next] ) {
	  used[next] = true;
	  deq.push_back(next);
	  mini += vec[i].weight;
	}
      }
    }
  }
  cout << mini << endl;
}

int main(){
  map<string,int> mp;
  cin >> V;
  rep(i,V) {
    string s;
    int c;
    cin >> s >> c;
    mp[s] = i;
    vec.push_back((Data){i,c});
  }
  cin >> E;
  rep(i,E){
    string s,t;
    cin >> s >> t;
    int a = mp[s], b = mp[t];
    G[a].push_back(b);
    G[b].push_back(a);
  }
  compute();
  return 0;
}

Measured memory_bytes: 2016
using System;
using System.Collections.Generic;
class Program{
	static void Main(){
		int[] s=Array.ConvertAll(Console.ReadLine().Split(),int.Parse);
		List<string> li=new List<string>();
		li.Add(new string('.',100));
		li.Add(new string('#',100));
		s[0]--;
		s[1]--;
		while(s[1]>0){
			if(li[0].Length!=100){li[0]+=".#";}
			else{
				li.Insert(0,new string('.',100));
				li.Insert(0,".#");
			}
			s[1]--;
		}
		li[0]+=new string('.',100-li[0].Length);
		while(s[0]>0){
			if(li[li.Count-1].Length!=100){li[li.Count-1]+=".#";}
			else{
				li.Add(new string('#',100));
				li.Add(".#");
			}
			s[0]--;
		}
		li[li.Count-1]+=new string('#',100-li[li.Count-1].Length);
		Console.WriteLine("{0} 100",li.Count);
		Console.WriteLine(String.Join("\n",li));
	}
}

Measured memory_bytes: 13268
#include <complex>
#include <iostream>

using namespace std;

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

    for (auto a = (unsigned long long) sqrt(N); a > 1; a--) {
        if (N % a == 0) {
            auto ab_greater = max(a, N / a);
            cout << to_string(ab_greater).length() << endl;
            return 0;
        }
    }
    cout << to_string(N).length() << endl;
    return 0;
}


Measured memory_bytes: 256
import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv,
    std.functional, std.math, std.numeric, std.range, std.stdio, std.string,
    std.random, std.typecons, std.container;

ulong MAX = 1_000_100, MOD = 1_000_000_007, INF = 1_000_000_000_000;
alias sread = () => readln.chomp();
alias lread(T = long) = () => readln.chomp.to!(T);
alias aryread(T = long) = () => readln.split.to!(T[]);
alias Pair = Tuple!(long, "damage", long, "cost");
alias PQueue(T, alias less = "a<b") = BinaryHeap!(Array!T, less);

void main()
{
    auto h = lread();
    h.kill.writeln();
}

long kill(long h)
{
    if (h == 1)
        return 1;
    auto tmp = kill(h / 2);
    return 1 + 2 * tmp;
}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}


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

using namespace std;

int main()
{
    double w,h,x,y;cin>>w>>h>>x>>y;
    cout << fixed << setprecision(10) << w * h / 2.0;
    cout << " " << (x==w/2 && y==h/2 ? 1 : 0) << endl;
}

Measured memory_bytes: 256
n,m=gets.split(" ").map(&:to_i) #最初のｎとｍのVALUE　をとる

a=n.times.map do
gets.split.map(&:to_i)
end
b=m.times.map do
gets.to_i
end

a.each do |r|
    puts r.zip(b).map {|x, y| x * y }.inject(0, :+)
  end
  


Measured memory_bytes: 7064
#include<bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
using namespace std;
#define sz(x) ((int)(x).size())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define MEMSET(v, h) memset((v), h, sizeof(v))
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define pb push_back
#define mp make_pair
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
const ll INF = 1LL<<60;
 
int main(void) {
	ll n,m;
  	cin >> n >> m;
  	vector<ll> x(m);
  	rep(i,m){
      cin >> x[i];
    }
  
  	sort(all(x));
  	vector<ll> diffs;
    for (ll i = 1; i < x.size(); ++i) diffs.push_back(x[i] - x[i-1]);
    sort(all(diffs), greater<ll>());
        
  	ll ans = x.back() - x[0];
    for (ll i = 0; i < min((ll)diffs.size(), n-1); ++i) ans -= diffs[i];
  	cout << ans << endl;
}


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

using namespace std;

typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll,ll> pll;
typedef vector<pll> vpll;

#define rep(i,m,n) for(ll i=m;i<n;i++)
#define repr(i,m,n) for(ll i=m;i>=n;i--)

string s;


int main(){
   cin.tie(nullptr);
  ios::sync_with_stdio(false);
  
  cin >> s;
  cout << ((s[2]==s[3]&&s[4]==s[5])?"Yes":"No") << endl;
 
 
}

Measured memory_bytes: 256
h, w = map(int, input().split())
s = ["."+input()+"." for i in range(h)]
s = ["."*(w+2)] + s + ["."*(w+2)]

for i in range(h):
  for j in range(w):
    if s[i][j] == "#":
      if s[i][j+1] == s[i][j-1] == s[i-1][j] == s[i+1][j] == ".":
        print("No")
        exit()

print("Yes")

Measured memory_bytes: 3064
#include <stdio.h>

int main(){
	int W,H,x,y,r;
	scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
	if(x+r<=W && x-r>=0 && y+r<=H && y-r>=0)
		printf("Yes\n");
	else
		printf("No\n");
	return 0;
}

Measured memory_bytes: 584
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		ArrayList<Integer> list = new ArrayList<>();
		for(int i = 0; i < N; i++) {
			list.add(Integer.parseInt(sc.next()));
		}
		sc.close();

		int count = 0;
		for(int i = 0; i < N; i++) {
			int tmp = i + 1;
			int tmpNum = list.get(i);
			if(tmp % 2 == 1) {
				if(tmpNum % 2 == 1) {
					count++;
				}else {
					continue;
				}
			}else {
				continue;
			}
		}
		System.out.println(count);
	}

}

Measured memory_bytes: 35576
#include<bits/stdc++.h>
#define for(i,a,b) for(int i=a;i<=b;i++)
#define _inline __inline__ __attribute__((always_inline))
using namespace std;
_inline void read(int &x){
	int res=0,f=1;
	char c=getchar();
	if(c=='-') f=-1;
	while(c>'9'||c<'0') c=getchar();
	while(c>='0'&&c<='9'){
		res=res*10+c-'0';
		c=getchar();
	}
	x=res*f;
}
inline void print(int x){
    if(x<0) putchar('-'),x=-x;
    if(x>9) print(x/10);
    putchar(x%10+'0');
}
int main(){
	int a,b;
	read(a),read(b);
	if(b>=0&&a<=0){
		puts("Zero");
		exit(0);
	}
	if(a>0&&b>0){
		puts("Positive");
		exit(0);
	}
	if(a<0&&b<0){
		int x=abs(a-b);
		if(x%2==1) puts("Positive");
		else puts("Negative");
		exit(0);
	}
} 

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

#define pb push_back
#define ff first
#define ss second

typedef long long ll;
typedef pair<int, int> pii;

int a, b;

int main() {
	ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	cin >> a >> b;
	if (a <= 5)
		cout << 0;
	else if (a < 13)
		cout << b / 2;
	else
		cout << b;
	return 0;
}


Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))
approved = True
for i in range(N):
    if A[i] % 2 == 0 and not (A[i] % 3 == 0 or A[i] % 5 == 0):
        approved = False
        break
if(approved):
    print("APPROVED")
else:
    print("DENIED")

Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <iomanip>
#include <algorithm>
#include <vector>

using namespace std;
typedef long long ll;

int main()
{

    ll n;
    cin >> n;

    ll l[n];

    ll count = 0;

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

    sort(l, l + n);

    for (int i = 0; i < n - 2; i++)
    {

        for (int k = i + 1; k < n - 1; k++)
        {
            for (int j = n; j > k ; j--)
            {
                if (l[i] + l[k] > l[j])
                {
                    count += j - k;
                    break;
                }
            }
        }
    }

    cout << count << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
#define all(x) (x).begin(), (x).end()
#define fsp(x) fixed << setprecision(x)
//const ll p = 1e9 + 7;
//const ll p = 998244353;
const ll inf = LLONG_MAX;
const long double pi = acos(-1);
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}

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

	string s;
	cin >> s;
	ll n = s.size(), p = 2019;

	vll remcnt(p, 0);
	remcnt[0]++;
	ll a = 0, b = 1;
	for (ll i = n - 1; i >= 0; i--) {
		ll x = s[i] - '0';
		a += x * b % p;
		a %= p;
		remcnt[a]++;
		b *= 10;
		b %= 2019;
	}
	ll ans = 0;
	for (ll i = 0; i < 2019; i++) {
		ans += remcnt[i] * (remcnt[i] - 1) / 2;
	}
	cout << ans << endl;
}


Measured memory_bytes: 3724
a=int(input())
b=input()
C=''
d=''
if(a != int(a/2)*2):
    print('No')
else:
    e=int(a/2)
    c = b[:e]
    d = b[e:]
    if(c==d):
        print('Yes')
    else:
        print('No')



Measured memory_bytes: 2940
#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 ALL(a)     (a).begin(),(a).end()
#define MOD 1000000007

typedef long long int ll;

const ll INF=(ll)1e19;
//const int INF=(1<<30);


int main(){
  int N,K;
  cin >> N >> K;
  ll ans = 0;

  if(K==0){
    cout << (ll)N*N << endl;
    exit(0);
  }

  FOR(i,K+1,N+1){
    int t = (i-K) * (N/i) + max(0,(N%i-K+1));
    ans += t;
  }
  cout << ans << endl;
}



Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string>
#include <utility>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define loop(i, x, n) for (int i = (x); i < (n); i++)
#define all(v) (v).begin(), (v).end()
#define int long long
using namespace std;
const int MOD = 1e9 + 7;
const int INF = 1e9;
template<typename T> void cmax(T &a, T b) { a = max(a, b); }
template<typename T> void cmin(T &a, T b) { a = min(a, b); }

signed main() {
  int n;
  cin >> n;
  vector<int> a(n);
  map<int, int> m;
  rep(i, n) {
    cin >> a[i];
    m[a[i] % (n - 1)]++;
  }
  for (auto x : m) {
    int tmp = 0;
    if (2 <= x.second) {
      bool flag = false;
      rep(i, n) {
        if (a[i] % (n - 1) == x.first) {
          if (flag) cout << ' ';
          cout << a[i];
          flag = true;
          tmp++;
        }
        if (tmp == 2) {
          cout << endl;
          return 0;
        }
      }
    }
  }
  return 0;
}



Measured memory_bytes: 3160
#include <iostream>

using namespace std;

int main() {
	int pre, cur, ans;
	string str;
	while (cin >> str) {
		pre = cur = ans = 0;
		for (int i = 0; i < str.size(); i++) {
			switch (str[i]) {
				case 'I': cur = 1;		break;
				case 'V': cur = 5;		break;
				case 'X': cur = 10;		break;
				case 'L': cur = 50;		break;
				case 'C': cur = 100;	break;
				case 'D': cur = 500;	break;
				case 'M': cur = 1000;	break;
				default:
					cout << "unknown figure" << endl;
					break;
			}
			if (i == 0) {
				pre = cur;
				continue;
			}
			switch (cur) {
				case 1:
					ans += pre;
					pre = cur;
					break;
				case 5:
				case 10:
					if (pre == 1)
						ans -= pre;
					else
						ans += pre;
					pre = cur;
					break;
				case 50:
				case 100:
					if (pre == 10)
						ans -= pre;
					else
						ans += pre;
					pre = cur;
					break;
				case 500:
				case 1000:
					if (pre == 100)
						ans -= pre;
					else
						ans += pre;
					pre = cur;
					break;
			}
		}
		ans += pre;
		cout << ans << endl;
	}

	return 0;
}

Measured memory_bytes: 1184
#include <iostream>

using namespace std;

int main()
{
  	string S;
  	cin >> S;
  	int a = 0;
  	for(int i = 2; i < S.size() - 1; i++){
      if(S.at(i) == 'C'){
        a++;
      }
    }
  	int b = 0;
  	for(int i = 0; i < S.size(); i++){
      if(isupper(S.at(i))){
        b++;
      }
    }
  	if(S.at(0) == 'A' && a == 1 && b == 2){
      cout << "AC";
    }else{
      cout << "WA";
    }
  	return 0;
}

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

int main(int argc, char const *argv[])
{
	int n; cin >> n;
	map<string, ll> ma;
	rep(i, n) {
		string s; cin >> s;
		sort(s.begin(), s.end());
		ma[s]++;
	}

	ll ans = 0;
	for (auto u : ma) {
		ans += u.second * (u.second - 1) / 2;
	}
	cout << ans << endl;
	return 0;
}


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

#define ln '\n'
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define FOR(i, a, b) for (int i = (a); i <= (int)(b); ++i)
#define FORR(i, a, b) for (int i = (a); i >= (int)(b); --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
typedef vector<P> VP;
typedef vector<PL> VPL;
typedef vector<string> VS;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, b;
    cin >> a >> b;
    if ((a + b) % 2 == 0) {
        cout << (a + b) / 2 << ln;
    } else {
        cout << "IMPOSSIBLE" << ln;
    }
    return 0;
}


Measured memory_bytes: 3616
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<vector>
using namespace std;
int main(){
int a,b,c,d;
cin>>a>>b>>c;
d=a-b;
if(c<=d)cout<<0;
else cout<<c-d;
return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys


def solve(N: int, K: int, H: "List[int]"):
    H = sorted(H, reverse=True)
    H = H[K:]
    result = sum(H)
    print(result)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    H = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, K, H)


if __name__ == "__main__":
    main()


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

int main()
{
    size_t N;
    int A, B, C;
    cin >> N >> A >> B >> C;
    map<char, int> score;
    score['A'] = A;
    score['B'] = B;
    score['C'] = C;

    vector<string> s(N);
    for (string &S : s)
    {
        cin >> S;
    }

    vector<char> ans;
    for (size_t i = 0; i < N; i++)
    {
        if (score[s[i][0]] > score[s[i][1]])
        {
            score[s[i][0]]--;
            score[s[i][1]]++;
            ans.push_back(s[i][1]);
        }
        else if (score[s[i][0]] < score[s[i][1]])
        {
            score[s[i][0]]++;
            score[s[i][1]]--;
            ans.push_back(s[i][0]);
        }
        else
        {
            if (score[s[i][0]] == 0 && score[s[i][1]] == 0)
            {
                cout << "No" << endl;
                return 0;
            }
            else if (score[s[i][0]] == 1 && score[s[i][1]] == 1)
            {
                if (i + 1 < N)
                {
                    if (s[i][0] == s[i + 1][0] || s[i][0] == s[i + 1][1])
                    {
                        score[s[i][0]]++;
                        score[s[i][1]]--;
                        ans.push_back(s[i][0]);
                    }
                    else
                    {
                        score[s[i][0]]--;
                        score[s[i][1]]++;
                        ans.push_back(s[i][1]);
                    }
                }
                else
                {
                    ans.push_back(s[i][0]);
                }
            }
            else
            {
                score[s[i][0]]++;
                score[s[i][1]]--;
                ans.push_back(s[i][0]);
            }
        }
    }
    cout << "Yes" << endl;
    for (char a : ans)
    {
        cout << a << endl;
    }
}


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

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;
typedef pair<ll, ll> PL;
typedef pair<P, ll> PPL;

#define INF INT_MAX/3

#define MAX_N 1000

struct dice{
	int d[6];
	void rotation(int& w,int& x,int& y,int& z){
		int tmp=w; w=x; x=y; y=z; z=tmp;
	}
	void n(){rotation(d[4],d[0],d[1],d[5]);}
	void e(){rotation(d[2],d[0],d[3],d[5]);}
	void w(){rotation(d[3],d[0],d[2],d[5]);}
	void s(){rotation(d[1],d[0],d[4],d[5]);}
	void spin(){rotation(d[1],d[2],d[4],d[3]);}
	int query(int a,int b){
		string ss="WWWWSWW";
		rep(i,ss.length()){
			if(ss[i]=='W')w();
			if(ss[i]=='S')s();
			if(d[0]==a)break;
		}
		if(d[0]!=a)return -1;
		rep(i,4){
			if(d[1]==b)break;
			spin();
		}
		if(d[1]!=b)return -1;
		return d[2];
	}
	bool equal(dice a){
		return a.d[2]==query(a.d[0],a.d[1])&&a.d[3]==d[3]&&a.d[4]==d[4]&&a.d[5]==d[5];
	}
};

int n;
dice dic[111];

int main(){
	cin.sync_with_stdio(false);
	cin>>n;
	rep(i,n){
		rep(j,6)cin>>dic[i].d[j];
	}
	rep(i,n)rep(j,i){
		if(dic[i].equal(dic[j])){
			//dbg(i); dbg(j);
			cout<<"No"<<endl;
			return 0;
		}
	}
	cout<<"Yes"<<endl;
	return 0;
}

Measured memory_bytes: 3224
n = int(input())
num = list(map(int, input().split()))

count = 0
finished = False
while True:
    for index, value in enumerate(num):
        if value % 2 == 0:
            num[index] = value / 2
        else:
            finished = True
            break
    if finished:
        break
    else:
        count += 1
print(count)

Measured memory_bytes: 3060
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

dis_a = 10 - a % 10
dis_b = 10 - b % 10
dis_c = 10 - c % 10
dis_d = 10 - d % 10
dis_e = 10 - e % 10

time = [a,b,c,d,e]
next_time = []
N = 5
for i in range(N):
	if(time[i] % 10 == 0 ): next_time.append(time[i])
	else: next_time.append( time[i] + 10 - time[i] % 10 )

besttime = 999999999

for i in range(N):
	sumtime = 0
	for j in range(N):
		if (i == j) :
			sumtime += time[j]
		else:
			sumtime += next_time[j]
	besttime = min(besttime,sumtime)

print(besttime)

Measured memory_bytes: 3064
N = int(input())
A = list(map(int, input().split()))

num_minus = sum([int(a < 0) for a in A])

abs_a = [abs(a) for a in A]
ans = sum(abs_a)
if num_minus % 2 != 0:
    ans -= min(abs_a) * 2
print(ans)


Measured memory_bytes: 14412
#include <stdio.h>
#include <string.h>
int main()
{   char s[4];
    scanf("%s",s);
    if(strcmp(s,"SUN")==0){
        printf("7");
    }
    if(strcmp(s,"MON")==0){
        printf("6");
    }
    if(strcmp(s,"TUE")==0){
        printf("5");
    }
    if(strcmp(s,"WED")==0){
        printf("4");
    }
    if(strcmp(s,"THU")==0){
        printf("3");
    }
    if(strcmp(s,"FRI")==0){
        printf("2");
    }
    if(strcmp(s,"SAT")==0){
        printf("1");
    }
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int t;
ll a,b,c,d;
ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
int main(){
    cin>>t;
    while(t--){
        cin>>a>>b>>c>>d;
        if(a<b || b>d){
            printf("No\n");continue;
        }
        if(((a%b+((b-1-a%b)/gcd(b,d))*gcd(b,d))>c)) printf("No\n");
        else printf("Yes\n");

    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define V vector<long long>
#define VV vector<vector<long long>>
#define VVV vector<vector<vector<long long>>>
#define rep(i,n) for(ll (i)=0;(i)<(n);++(i))
using namespace std;

int main() {
  int H,W,K;
  cin >> H >> W >> K;
  vector<vector<char>> choco(H,vector<char>(W));
  rep(i,H)rep(j,W) cin >> choco[i][j];
  //入力

  int aaa=10000;
  rep(bit,1 << (H-1)){
    int g = 0;
    vector<int> id(H);
    rep(i,H){
      id[i]=g;
      if(1 << i & bit) g++;
    }
    g++; //グループ数
    int ans = g-1;
    vector<vector<int>> c(g,vector<int>(W,0));
    rep(i,H)rep(j,W) c[id[i]][j] += (choco[i][j]-'0');

    //横の分け方がダメなときの判定
    bool a =false;
    rep(j,W)rep(i,g){
      if(c[i][j] > K) a =true;
    }
    if(a) continue;

    vector<int> now(g);
    rep(j,W){
      rep(i,g) now[i] += c[i][j];
      rep(i,g){
       if(now[i]>K){
        ans++;
        now =vector<int>(g,0);
        rep(i,g) now[i] += c[i][j];
        break;
       }
      }
    }
    aaa = min(aaa,ans);
  }
  cout << aaa << endl;
}

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

string dots(int n){
    if (n==1)  return ".";
    else  return "."+dots(n-1);
}

int main()
{
    int n,k;
    cin >> n >> k;
    vector<int> v(n);
    for (int i=0 ; i<n ; i++){
        cin >> v[i];
    }
    int ans = 2147483647;
    for (int i=0 ; i<n-k+1 ; i++){
        if (v[i+k] < 0)  continue;
        if (i != 0  && v[i-1] > 0)  break;
        ans = min( ans , v[i+k-1]-v[i]+min(abs(v[i+k-1]),abs(v[i])) );
    }
    
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 640
primes = set([2])
X = int(input())
if X == 2:
    print(2)
else:
    for i in range(3, int(X ** .5) + 1, 2):
        for p in primes:
            if i % p == 0:
                break
        else:
            primes.add(i)
    # print(f"primes:{primes}", file=sys.stderr)
    x = X
    if x % 2 == 0:
        x += 1
    found = False
    while not found:
        for p in primes:
            if x % p == 0:
                break
        else:
            print(x)
            found = True
        x += 2

Measured memory_bytes: 3188
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <algorithm>
using namespace std;
class Card {
  public:
    char type;
    int number;
    Card(char _type, int _number) {
      type = _type;
      number = _number;
    }
    // Card(const Card &original) { // Copy Constractor
      // type = new char[1];
      // type = original.type;
      // number = new int[1];
      // number = original.number;
    // }
    string str() {
      stringstream ss;
      ss << type << number;
      // cout << ss.str() << endl;
      // return ss.str();
      return ss.str();
    }
    bool operator > (const Card &right) {
      return (number > right.number);
    }
    bool operator < (const Card &right) {
      return (number < right.number);
    }
    bool operator >= (const Card &right) {
      return (number >= right.number);
    }
    bool operator <= (const Card &right) {
      return (number <= right.number);
    }
    bool operator == (const Card &right) {
      return (number == right.number);
    }
    bool operator != (const Card &right) {
      return (number != right.number);
    }
};
 
void pResult(vector<Card> &, vector<Card> &);
vector<Card> BubbleSort(vector<Card>);
vector<Card> SelectionSort(vector<Card>);
string cardsToStr(vector<Card> &);
 
 
int main() {
  int n;
  cin >> n;
  vector<Card> cards;
  for(int i = 0; i < n; ++i) {
    string s_card;
    cin >> s_card;
    char c_card;
    int d_card;
    stringstream ss;
    ss << s_card;
    ss >> c_card;
    ss >> d_card;
    Card card(c_card, d_card);
    cards.push_back(card);
  }
  vector<Card> result1 = BubbleSort(cards);
  vector<Card> result2 = SelectionSort(cards);
  pResult(result1, result1);
  pResult(result2, result1);
  return 0;
}
 
void pResult(vector<Card> &sorted, vector<Card> &original) {
  string s_result = cardsToStr(sorted);
  cout << s_result << endl;
  cout << ((s_result == cardsToStr(original)) ? "Stable" : "Not stable") << endl;
}
 
string cardsToStr(vector<Card> &cards) {
  stringstream result;
  for(auto i = cards.begin(); i != cards.end(); ++i) {
    result << (*i).str();
    // cout << (*i).str() << endl;
    // cout << cards[0].str() << endl;
    if(i != cards.end() - 1) result << ' ';
  }
  return result.str();
}
 
vector<Card> BubbleSort(vector<Card> cards) {
  // result.resize(cards.size());
  // copy(cards.begin(), cards.end(), result.begin());
  for(int i = 0; i < cards.size(); ++i) {
    for(int j = cards.size() - 1; j > 0; --j) {
      if(cards[j] < cards[j - 1]) swap(cards[j], cards[j - 1]);
    }
  }
  return move(cards);
}
 
vector<Card> SelectionSort(vector<Card> cards) {
  for(auto i = cards.begin(); i != cards.end(); ++i) {
    auto itr_min = min_element(i, cards.end());
    iter_swap(i, itr_min);
  }
  return move(cards);
}


Measured memory_bytes: 3216
// 失敗するからこそ そこから立ち向かって行く強さがあってそんな強さが本当の強さだと私は思うから
// ぜったいあきらめない
#include<bits/stdc++.h>
using namespace std;

#if defined(DAIJOBU)
#include "/home/ichigo/debug.hpp"
#define deb(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define deb(x...)
#endif
#define FIO {ios::sync_with_stdio(0);cin.tie(nullptr);cout.tie(nullptr);}


int main(){
	FIO
	
	int a, b;cin >> a >> b;
	int rem = a % b, ind = a / b;long double div = a / (long double)b;
	cout << ind << " " << rem << " " << fixed << setprecision(10) << div << "\n";
	return 0;
}



Measured memory_bytes: 3268
import sys
import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

Bsize = 700

def Mo_argsort(LR):
    L = LR[:, 0]
    R = LR[:, 1]
    key1 = L // Bsize
    key2 = np.where(key1 & 1, -R, R)
    key = (key1 << 32) + key2
    return np.argsort(key)

def main(A, LR):
    N = len(A)
    Q = len(LR)
    ind = Mo_argsort(LR)
    count = np.zeros(N + 1, np.int32)
    ans = 0

    def add(x):
        nonlocal ans
        if not count[x]:
            ans += 1
        count[x] += 1

    def rem(x):
        nonlocal ans
        count[x] -= 1
        if not count[x]:
            ans -= 1

    answers = np.empty(Q, np.int32)
    nl, nr = 0, 0
    for i in ind:
        l, r = LR[i]
        l -= 1
        # 区間 [l, r) に対する計算
        while nl > l:
            nl -= 1
            add(A[nl])
        while nr < r:
            add(A[nr])
            nr += 1
        while nl < l:
            rem(A[nl])
            nl += 1
        while nr > r:
            nr -= 1
            rem(A[nr])
        #  答を求めて ans[i] に格納する
        answers[i] = ans
    return answers

if sys.argv[-1] == 'ONLINE_JUDGE':
    import numba
    from numba.pycc import CC
    i4 = numba.int32
    i8 = numba.int64
    cc = CC('my_module')

    def cc_export(f, signature):
        cc.export(f.__name__, signature)(f)
        return numba.njit(f)

    Mo_argsort = cc_export(Mo_argsort, (i8[:,:],))
    main = cc_export(main, (i8[:], i8[:, :]))
    cc.compile()

from my_module import main

N, Q = map(int, readline().split())
A = np.array(readline().split(), np.int64)
LR = np.array(read().split(), np.int64).reshape(Q, 2)

ans = main(A, LR)
print('\n'.join(map(str, ans.tolist())))


Measured memory_bytes: 102200
#include<stdio.h>

int main () {

   int x, y, swap;

   while (1) {
        scanf("%d %d", &x, &y);

        if(x == 0 && y == 0){
           break;
        }else if (x > y) {
           swap = x;
           x = y;
           y = swap;
        }

        printf("%d %d\n", x, y);
   }

   return 0;
}

Measured memory_bytes: 1688
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <math.h>
#include <complex>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <bitset>
#include <functional>
#include <assert.h>
using ll=long long;
#define int ll
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define eb emplace_back
#define all(x) x.begin(),x.end()
#define SZ(x) ((int)x.size())
#define fi first
#define se second
const int INF = 1e15;
using namespace std;

template<class T> using vc=vector<T>;
template<class T> using vvc=vc<vc<T>>;

using pi=pair<int,int>;
using vi=vc<int>;

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

signed main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout<<fixed<<setprecision(20);

    long double N,M; cin >> N >> M;
    long double A[(int)N];
    long double sum=0;
    rep(i,N) {cin >> A[i]; sum+=A[i];}
    sort(A,A+(int)N);
    reverse(A,A+(int)N);
    if(A[(int)M-1]/sum < 1.0/(4.0*M)) cout << "No" << endl;
    else cout << "Yes" << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#define pb push_back
#define ins insert
#define ll long long
#define Pair pair<int,int>
#define MT make_tuple
#define MP make_pair
#define INF 0x3f3f3f3f
#define lim 1e9
#define Bigint 3e8+1
#define MAX 3e5
#define NL '\n'
using namespace std;
using namespace __gnu_pbds;
typedef tree<int,null_type,less<int>,rb_tree_tag, //for indexed_set
        tree_order_statistics_node_update> indexed_set;

int main()
{

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    //freopen("input.txt","r",stdin);

    int a,b,n,c,echo=0;
    vector<int>v1(1);
    vector<int>v2(1);

    cin >> n;
    c = 0;
    for(int i=0 ; i<n ; i++){
        cin >> a;
        c += a;
        v1.pb(c);
    }
    c = 0;
    for(int i=0 ; i<n ; i++){
        cin >> a;
        c += a;
        v2.pb(c);
    }

    for(int i=1 ; i<=n ; i++){
        b = (v1[i])+(v2[n]-v2[i-1]);
        echo = max(echo,b);
    }
    cout << echo;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <numeric>
using namespace std;
typedef long long int ll;

#define EPS (1e-7)
#define INF 1e18
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define PI (acos(-1))

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

int main() {

    ll N, K;
    cin >> N >> K;
    vector<double> s(N);
    double tmp;
    REP(i, N){
        cin >> tmp;
        s[i] = (1.0 + tmp) / 2.0;
    }

    double hoge = 0;
    double ans = 0;
    REP(i, K) hoge += s[i];
    ans = hoge;
    rep(i, K, N){
        hoge -= s[i - K];
        hoge += s[i];
        ans = max(ans, hoge);
    }

    //cout << ans << endl;
    printf("%.8f\n", ans);

    return 0;
}

Measured memory_bytes: 1792
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<algorithm>
//deque/functional/iterator/list/map/memory/numeric/queue/set/stack/utility/vector
#define ll long long
using namespace std;

int main()
{
	ios::sync_with_stdio(false);
	int n,m,max=0;
	double sum;
	cin>>n;
	while(n--)
	{
		cin>>m;
		sum+=m;
		if(m>=max)
		{
			max=m;
		}
		
		
	}
	max=max/2+sum-max;
	cout<<max<<endl;
	
return 0;
}





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

using namespace std;

using ll = long long;
using vl = vector<ll>;
using vvl = vector<vl>;
using vb = vector<bool>;
using P = pair<ll, ll>;
template <typename T> using pq = priority_queue<T>;
template <typename T> using minpq = priority_queue<T, vector<T>, greater<T>>;
template <typename T, typename K> using ump = unordered_map<T, K>;
const ll dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll e5 = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);

#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for (ll i = ll(n - 1); i >= 0; i--)
#define each(i, mp) for (auto &i : mp)
#define eb emplace_back
#define F first
#define S second
#define all(obj) (obj).begin(), (obj).end()

template <class T> ostream &operator<<(ostream &out, const vector<T> &list) {
    ll n = list.size();
    rep(i, n) out << list[i] << ' ';
    return out;
}

template <class T> istream &operator>>(istream &in, vector<T> &list) {
    ll n = list.size();
    rep(i, n) in >> list[i];
    return in;
}

template <class T> ostream &operator<<(ostream &out, const vector<vector<T>> &list) {
    ll n = list.size();
    rep(i, n) out << list[i] << '\n';
    return out;
}

/* ------------- ANSWER ------------- */
/* ---------------------------------- */

void solve() {
    string s;
    cin >> s;
    if (s.back() == 's')
        cout << s + "es" << '\n';
    else
        cout << s + "s" << '\n';
}

int main() {
#ifdef MY_DEBUG
    while (true) {
#endif
        solve();
#ifdef MY_DEBUG
    }
#endif
    return 0;
}


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

using namespace std;

int main(){
    int A[3], sum = 0;
    for (int i = 0; i < 3; ++i) {
        cin >> A[i];
    }
    sort(A, A+3);
    sum = abs(A[0] - A[1]) + abs(A[2] - A[1]);
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<string>
#include<iostream>
using namespace std;
 
struct Node {
  int key;
  Node *right, *left, *parent;
};
 
Node *root,*NIL;
 
void insert(int k){
  Node *y = NIL;
  Node *x = root;
  Node *z;
 
  z = (Node *)malloc(sizeof(Node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;
 
  while( x != NIL){
    y = x;
    if( z->key < x->key ){
      x = x->left;
    }else {
      x = x->right;
    }
  }
 
  z->parent = y;
  if( y == NIL ){
    root = z;
  } else {
    if ( z->key < y->key ){
      y->left = z;
    }else{
     y->right = z;
    }
  }
}
 
void inorder(Node *u){
  if ( u == NIL ) return;
  inorder(u->left);
  printf(" %d", u->key);
  inorder(u->right);
}
void preorder(Node *u){
  if ( u == NIL)return;
  printf(" %d", u->key);
  preorder(u->left);
  preorder(u->right);
}
 
int main(){
  int n,i,x;
  string com;
 
  scanf("%d",&n);
 
  for( i = 0; i < n; i++){
    cin >> com;
    if(com == "insert"){
      scanf("%d", &x);
      insert(x);
    } else if( com == "print"){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
  }
 
  return 0;
}


Measured memory_bytes: 26720
#include<iostream>
using namespace std;
int solve(int x)
{
	int sum=2;
	for(int i=2;i<x;i++)
		if(x%i==0)
		sum++;
	return sum;
}
int main()
{
	ios::sync_with_stdio(false);
	int n,ans=0;
	cin>>n;
	for(int i=105;i<=n;i+=2)
	{
		if(solve(i)==8)
		ans++;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
def main():
    n, m = [int(_) for _ in input().split()]
    A = [int(_) for _ in input().split()]

    ans = 0
    d = {}

    cumsum = [0]
    c_sum = 0
    for a in A:
        c_sum = (c_sum + a) % m
        cumsum.append(c_sum)

    for c in cumsum:
        if c not in d.keys():
            d[c] = 0
        d[c] += 1

    for v in d.values():
        if v >= 2:
            ans += v * (v - 1) // 2

    print(ans)


main()

Measured memory_bytes: 16212
#include<bits/stdc++.h>
using namespace std;
inline int read(){
    int res=0;
    char c;
    bool zf=0;
    while(((c=getchar())<'0'||c>'9')&&c!= '-');
    if(c=='-')zf=1;
    else res=c-'0';
    while((c=getchar())>='0'&&c<='9')res=(res<<3)+(res<<1)+c-'0';
    if(zf)return -res;
    return res;
}
signed main(){
	int x=read(),y=read();
	if(x==0){
		if(y>0)printf("%d\n",y);
		else printf("%d\n",-y+1);
	}
	else{
		if(y==0){
			if(x>0)printf("%d\n",x+1);
			else printf("%d",-x);
		}
		else{
			if(x>0&&y>0){
				if(x<=y)printf("%d\n",y-x);
				else printf("%d\n",x-y+2);
			}
			else{
				if(x>0&&y<0){
					printf("%d\n",abs(x+y)+1);
				}
				else{
					if(x<0&&y>0){
						printf("%d\n",abs(x+y)+1);
					}
					else{
						if(x<=y)printf("%d\n",y-x);
						else printf("%d\n",x-y+2);
					}
				}
			}
		}
	}
	return 0;
}

Measured memory_bytes: 3772
L, R = map(int, input().split())

ans = 2018
for i in range(L, R):
    for j in range(i+1, R + 1):
        tmp = (i * j) % 2019
        if ans  > tmp:
            ans = tmp
        if tmp == 0:
            ans = 0
            print(ans)
            exit()

print(ans)


Measured memory_bytes: 2940
#include<stdio.h>
int main(void){
  int num;
  int aMin,bMax;
  int tenFive,tenFour,tenThree,tenTwo,tenOne  = 0;
  int ketaSum;
  int tmpNum;
  int sum = 0;
  
  if(scanf("%d %d %d",&num,&aMin,&bMax));
  
    for(num=num;num>0;num--){ 
      tmpNum = num;
 
      tenFive = num / 10000;
      num = num % 10000;

      tenFour = num / 1000;
      num = num % 1000;

      tenThree = num / 100;
      num = num % 100;

      tenTwo = num / 10;
      num = num % 10;

      tenOne = num / 1;
      num = num % 1;

      ketaSum = tenFive + tenFour + tenThree + tenTwo + tenOne; 
      
      if(aMin <= ketaSum && ketaSum <= bMax){
        sum += tmpNum;
      }
      num = tmpNum;
    }
     
    printf("%d",sum);
  
  return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;

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

        int sum;

        int count = 0;
        for (int i = 1; i <= m; i++) {
            sum = 0;
            for (int j = i; j > 0; j /= 10) {
                sum += j % 10;
            }
//            for (int j = 0; j < is.length; j++) {
//                sum += Integer.parseInt(is[j]);
//            }
            sum += a;
            int rst = 1;
            for (int j = 0; j < n; j++) {
                rst *= sum;
            }
            if (rst == i) {
                count++;
            }

//            if (i == Math.pow((sum + a), n)) {
//                count++;
//            }
        }

        System.out.println(count);
    }

    static int[] intSplit(int n) {
        String[] s = Integer.toString(n).split("");
        int[] a = new int[s.length];

        for (int i = 0; i < s.length; i++) {
            a[i] = Integer.parseInt(s[i]);
        }

        return a;
    }
}


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

using namespace std;

int cnt[110];

int main() {
	int n, m;
	cin >> n >> m;
	for (int i = 0; i < m; ++i) {
		int a, b;
		cin >> a >> b;
		++cnt[a];
		++cnt[b];
	}
	for (int i = 1; i <= n; ++i) {
		cout << cnt[i] << endl;
	}
	
	return 0;
}


Measured memory_bytes: 256
#include <cstdio>

int main () {
	int n, count = 0;
	long long D, x, y;
	scanf("%d %lld", &n, &D);
	for (int i = 1; i <= n; i++) {
		scanf ("%lld %lld", &x, &y);
		if ((x*x + y*y) <= D*D)
			count ++;
	}
	printf("%d\n", count);
	return 0;
}

Measured memory_bytes: 1732
input = gets.strip
sx,sy,tx,ty = input.split(' ').map(&:to_i)

dx = tx - sx
dy = ty - sy

U = 'U'
R = 'R'
D = 'D'
L = 'L'

output = []
dy.times { output << U }
dx.times { output << R }
dy.times { output << D }
dx.times { output << L }

output << L
(dy+1).times { output << U }
(dx+1).times { output << R }
output << D

output << R
(dy+1).times { output << D }
(dx+1).times { output << L }
output << U

puts output.join


Measured memory_bytes: 2044
#include<cstdio>
#include<cstring>

int main(){
  char str[1001];
    
    while(1){
      scanf("%s", str);
      if ( str[0] == '0' ) break;
      int sum = 0;
        for ( int i = 0; i < strlen(str); i++ ){
           sum += (str[i]-'0');
        }
        
     printf("%d\n", sum);
    }      
    
    
    return 0;
}   

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

int main()
{
    int N; cin >> N;
    vector<vector<int>> numbers(3, vector<int>(N));
    for (int i = 0; i < N; ++i)
        for (int j = 0; j < 3; ++j)
            cin >> numbers[j][i];

    vector<int> scores(N);
    for (int j = 0; j < 3; ++j) {
        for (int i = 0; i < N; ++i) {
            for (int k = 0; k < N; ++k) {
                if (i == k) continue;
                if (numbers[j][i] == numbers[j][k])
                    goto next;
            }
            scores[i] += numbers[j][i];
next:;
        }
    }

    for (int s : scores)
        cout << s << endl;
}

Measured memory_bytes: 1216
import java.util.Scanner;

class Main{
public static void main(String args[]){
Scanner s=new Scanner(System.in);
int n=s.nextInt();
char[][] w=new char[3][n];
for(int i=0;i<3;i++){
String input=s.next();
w[i]=input.toCharArray();
}
int count=0;
for(int i=0;i<n;i++){
if((w[0][i]==w[1][i]||w[1][i]==w[2][i])||w[0][i]==w[2][i]){
count++;
}
if((w[0][i]==w[1][i]&&w[1][i]==w[2][i])&&w[0][i]==w[2][i]){
count++;
}
}
System.out.println(n*2-count);
}
}

Measured memory_bytes: 23124
#include<iostream>
#include<string.h>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<queue>
#include<string>
using namespace std;
int main(){
    char S[2][11];
    int a,b;
    char s[10];
    cin>>S[0]>>S[1];
    cin>>a>>b;
    cin>>s;
    for(int i=0;i<strlen(s);i++){
        if(S[0][i]!=s[i]){
            printf("%d %d\n",a,b-1);
            exit(0);
        }
    }
            printf("%d %d\n",a-1,b);

    }

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

int n,A[2000001],B[2000001],l,r,L,R,ans;

bool check(int x){
	L = 1, R = 2*n-1; 
  for(int i=1;i<=n*2-1;i++)
    B[i] = (A[i]>=x);
  
  for(int i=1;i<n;i++)
    if(B[i]==B[i+1]){
    	L = i+1;
    }
  
  for(int i=2*n-1;i>n;i--)
    if(B[i]==B[i-1]){
    	R = i-1;
    }
  
  if((n-L)<(R-n)){
  	return B[L] == 1;
  } else {
  	return B[R] == 1;
  }
}

int main(){
  
  cin>>n;
  for(int i=1;i<=n*2-1;i++){
  	cin>>A[i];
  }
  
  int l = 1, r = 2*n-1;
  while(l<=r){
  	int mid = (l+r)/2;
    if(check(mid)){
    	l = mid + 1;
      	ans = mid;
    } else {
    	r = mid - 1;
    }
  }
  cout<<ans<<endl;
}

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

int main(){
	long long x;
	cin>>x;
	for(long long i=0;i<=1000;i++){
		for(long long j=0;j<=1000;j++){
			if(i*i*i*i*i-j*j*j*j*j==x){
				cout<<i<<" "<<j<<endl;
				return 0;
			}
		}
	}
	for(long long i=0;i<=1000;i++){
		for(long long j=0;j<=1000;j++){
			if(i*i*i*i*i+j*j*j*j*j==x){
				cout<<i<<" "<<0-j<<endl;
				return 0;
			}
		}
	}
}

Measured memory_bytes: 3636
#include <algorithm>
#include <bitset>
#include <cassert>
#include <deque>
#include <fstream>
#include <iostream>
#include <map>
#include <math.h>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stdio.h>
#include <string>
#include <vector>

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define POW(n) ((n) * (n))
#define ALL(a) (a).begin(), (a).end()

using namespace std;

namespace Dump {
#define dump(...) Dump::print(#__VA_ARGS__, __VA_ARGS__)
static std::vector<string> dumpKey;
static string dumpKeyBuf;

void print() { cerr << endl; }
template <class Head, class... Tail> void print(Head &&head, Tail &&... tail) {
  if (dumpKey.empty()) {
    dumpKeyBuf = head;
    dumpKeyBuf.erase(std::remove_if(dumpKeyBuf.begin(), dumpKeyBuf.end(),
                                    [](char c) { return c == ' '; }),
                     dumpKeyBuf.end());

    std::istringstream stream(dumpKeyBuf);
    string field;
    while (std::getline(stream, field, ','))
      dumpKey.push_back(field);

    reverse(dumpKey.begin(), dumpKey.end());
  } else {
    cerr << dumpKey.back() << ":" << head << "  ";
    dumpKey.pop_back();
  }
  Dump::print(std::move(tail)...);
}
}

typedef long long ll;
typedef unsigned long long ull;

typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<long long> vll;
typedef vector<unsigned long long> vull;
typedef pair<int, int> pii; // p.first p.second

// ll n = to_T<ll>("114514")
template <class T> T to_T(const string &s) {
  istringstream is(s);
  T res;
  is >> res;
  return res;
}
template <class T> string to_s(const T &a) {
  ostringstream os;
  os << a;
  return os.str();
}

void solve(long long A, long long B, long long C) {
  if (B == C) {
    cout << A << endl;
  } else if (A == C) {
    cout << B << endl;
  } else {
    cout << C << endl;
  }
}

int main() {
  ios::sync_with_stdio(false);
  long long B;
  long long A;
  long long C;
  cin >> A;
  cin >> B;
  cin >> C;
  solve(A, B, C);
  return 0;
}


Measured memory_bytes: 256