akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>

using namespace std;
typedef long long ll;

vector<pair<char,int> > rfe_tuple(string S){
  vector<pair<char,int> > ff;
  int sum=1;
  for (int i=1;i<S.length();i++){
    while(S[i]==S[i-1]){
      sum++;
      i++;
    }
    ff.push_back(make_pair(S[i-1],sum));
    sum=1;
  }
  if(S[S.length()-1]!=S[S.length()-2]) ff.push_back(make_pair(S[S.length()-1],1));
  return ff;
}

int main(){
  string S;
  int N,K;
  cin >> N >> K;
  cin >> S;
  vector<pair<char,int> > f;
  f=rfe_tuple(S);

  vector<int> sum(f.size() + 1);
  for (int i = 0; i < f.size(); ++i) {
    sum[i + 1] = sum[i] + f[i].second;
  }
  int ans = 0;
  for (int i = 0; i < f.size(); ++i) {
    int ptr = min(i + 2 * K + (f[i].first-'0'), int(f.size()));
    ans = max(ans, sum[ptr] - sum[i]);
  }
  cout << ans << endl;
}


Measured memory_bytes: 4252
import java.util.*;
 
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int c = sc.nextInt();
		int[] b = new int[m];
		int crt = 0;
		for(int i=0;i<m;i++){
			b[i]=sc.nextInt();
		}
		for(int i=0;i<n;i++){
			int a=0;
			for(int j=0;j<m;j++){
				a+=sc.nextInt()*b[j];
			}
			a+=c;
			if(a>0)crt++;
		}
		System.out.print(crt);
	}
}

Measured memory_bytes: 37840
#include <bits/stdc++.h>
#define int long long

using namespace std;
using LL = long long;
using P = pair<int, int>;

#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)

#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

const int INF = (int)1e9;
const LL INFL = (LL)1e18;
const int MOD = 1e9 + 7;

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

    int n, k;
    cin >> n >> k;
    vector<int> x(n);
    REP(i, n) cin >> x[i];

    LL ans = INFL;
    if(k >= 2){
        for(int i = 0; i < n - k + 1; i++){
            if(x[i] < 0 && x[i+k-1] >= 0){
                int num = min(abs(x[i]), abs(x[i+k-1]));
                ans = min(ans, abs(x[i]) + abs(x[i+k-1]) + num);
            }else if(x[i] < 0 && x[i+k-1] < 0){
                ans = min(ans, abs(x[i]));
            }else{
                ans = min(ans, abs(x[i+k-1]));
            }
        }
    }else{
        REP(i, n) ans = min(ans, abs(x[i]));
    }
    cout << ans << endl;
}


Measured memory_bytes: 1024
// https://atcoder.jp/contests/dp/tasks/dp_f

#include <bits/stdc++.h>

using namespace std;

#define REP(i,n)   for(int i=0; i<(int)(n); i++)
#define FOR(i,b,e) for(int i=(b); i<=(int)(e); i++)
#define DUMP(a, n) REP(i, n) printf("%d%c", a[i], i + 1 == n ? '\n' : ' ')
#define DUMP2D(a, n, m) REP(i, n) REP(j, m) printf("%d%c", a[i][j], j + 1 == m ? '\n' : ' '); puts("")

const int S_MAX = 3000;
const int T_MAX = 3000;

char s[S_MAX + 1];
char t[T_MAX + 1];

int n, m;
int dp[S_MAX + 1][T_MAX + 1];
int prv[S_MAX + 1][T_MAX + 1];

char ans[S_MAX + 1];

void solve() {
  n = strlen(s);
  m = strlen(t);
  REP(i, n) REP(j, m) {
    if (s[i] == t[j]) {
      dp[i + 1][j + 1] = dp[i][j] + 1;
      prv[i + 1][j + 1] = i * m + j;
    } else {
      if (dp[i][j + 1] >= dp[i + 1][j]) {
        dp[i + 1][j + 1] = dp[i][j + 1];
        prv[i + 1][j + 1] = prv[i][j + 1];
      } else {
        dp[i + 1][j + 1] = dp[i + 1][j];
        prv[i + 1][j + 1] = prv[i + 1][j];
      }
      // dp[i + 1][j + 1] = max(dp[i][j + 1], dp[i + 1][j]);
    }
  }

  // DUMP2D(dp, n + 1, m + 1);
  // DUMP2D(prv, n + 1, m + 1);
  // printf("%d\n", dp[n][m]);

  int len = dp[n][m];
  int pv = prv[n][m];
  for (int k = len - 1; k >= 0; k--) {
    int pi = pv / m;
    int pj = pv % m;
    ans[k] = s[pi];
    pv = prv[pi][pj];
  }
  printf("%s\n", ans);
}

void input() {
  scanf("%s", s);
  scanf("%s", t);
}

int main() {
  input();
  solve();
  return 0;
}


Measured memory_bytes: 70656
#from collections import deque,defaultdict
printn = lambda x: print(x,end='')
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True # and False
BIG = 10**18
R = 10**9 + 7
#R = 998244353

def ddprint(x):
  if DBG:
    print(x)

l,r,d = inm()
sm = 0
for i in range(l,r+1):
    if i%d==0:
        sm += 1
print(sm)


Measured memory_bytes: 61908
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    string ans;
    int x1, y1, x2, y2;
    int nx, ny;
    cin>>x1>>y1>>x2>>y2;
    nx = x2-x1;
    ny = y2-y1;

    for(int i=0;i<ny;i++) ans.push_back('U');
    for(int i=0;i<nx;i++) ans.push_back('R');
    for(int i=0;i<ny;i++) ans.push_back('D');
    for(int i=0;i<nx;i++) ans.push_back('L');

    ans.push_back('L');
    for(int i=0;i<ny+1;i++) ans.push_back('U');
    for(int i=0;i<nx+1;i++) ans.push_back('R');
    ans.push_back('D');
    ans.push_back('R');
    for(int i=0;i<ny+1;i++) ans.push_back('D');
    for(int i=0;i<nx+1;i++) ans.push_back('L');
    ans.push_back('U');
    cout<<ans<<endl;

}


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

using namespace std;

#define ll long long
#define ld long double
#define ff first
#define ss second
#define rsz resize
#define ins insert 
#define mp make_pair
#define pf push_front 
#define pb push_back
#define eb emplace_back 
#define ft front() 
#define bk back()
#define sz(x) (int)(x).size()
#define all(x) begin(x), end(x)
#define deb(x) cout<<#x<<" "<<x<<'\n';
#define rep(i,a,b) for (int i = (a); i < (b); ++i)

const ll mod = 1e9+7; // 998244353;
const ll inf = 1e18; 
const ld pie = acos((ld)-1);

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



int main(){
    
	string s;
	cin>>s;
	deque<char> ans;
	int i=0;
	bool ok=0;
	while(i<s.length()){

		if(s[i]=='0'){
			ans.push_back('0');
		}else if(s[i]=='1'){
			ans.push_back('1');
		}else{
			
			while(s[i]=='B'&&!ans.empty()){
				ok=1;
				ans.pop_back();
				i++;
			}	
		}
		if(!ok){
			i++;
		}else{
			ok=0;
		}
	}

	for(auto &x:ans){
		printf("%c",x);
	}printf("\n");

	return 0;

	/*STUFF TO LOOK:	
		1. Check the constraints
		2. Corner cases(n==0||n==1)
		3. Variables in loops
		4. Make sure two ints aren’t multiplied to get a long long
		5. Don't use scanf or printf while using ios_base
		6. using the local variable of the same name when global variable was required to be used
	*/
}


Measured memory_bytes: 3600
import sys

sys.setrecursionlimit(10**6)


def partition(A, p, r):

    x = A[r][1]
    i = p - 1

    for j in range(p, r):
        if A[j][1] <= x:
            i += 1
            A[i], A[j] = A[j], A[i]

    A[i + 1], A[r] = A[r], A[i + 1]

    return i + 1


def quicksort(A, p, r):
    if p < r:
        q = partition(A, p, r)
        quicksort(A, p, q - 1)
        quicksort(A, q + 1, r)


def main():

    N = int(sys.stdin.readline().rstrip())

    A = []

    for i in range(N):
        m, n = sys.stdin.readline().rstrip().split()
        A.append((m, int(n), i))  # stable 確認用に index をつけておく

    quicksort(A, 0, N - 1)

    for i in range(1, N):
        if A[i][1] == A[i - 1][1]:
            if A[i][2] < A[i - 1][2]:
                print("Not stable")
                break
    else:
        print("Stable")

    for m, n, _ in A:
        print(m, n)


main()



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

using ll = long long;
//print(fixed << setprecision(10));
#define rep(i,n) for(ll i = 0; i < (n); i++)
#define repk(i,n,k) for(ll i = k; i < (n); i++)
#define all(n) n.begin(), n.end()
#define print(n) cout << n << endl
double PI = acos(-1.0);
int INF = 1e9;
ll LINF = 1e18;
ll MOD = 1e9+7;


int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    
    int n,k;
    bool f;
    cin >> n >> k;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    rep(i,k){
        vector<int> b(n,0);
        rep(j,n){
            if(j-a[j]<0) b[0]++;
            else b[j-a[j]]++;
            if(j+a[j]<n-1) b[j+a[j]+1]--;
        }
        f=1;
        rep(j,n){
            if(j!=0) b[j] += b[j-1];
            if(f==1 && b[j]!=n) f=0;
        }
        a = b;
        if(f) break;
    }
    rep(i,n) cout << a[i] << " ";
    cout << endl;
    return 0;
}

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

using namespace std;
typedef long long ll;

#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = (ll)(n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define FORD(i, a, b) for (ll i = (a); i >= (b); i--)
#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define INF 1000000000000
#define MOD 1000000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

void solve() {
  int N, dist = 0;
  cin >> N;
  vector<int> A(N);
  REP(i, N) { cin >> A[i]; }
  sort(ALL(A));
  REP(i, N - 1) { dist += A[i + 1] - A[i]; }
  cout << dist << endl;
}

signed main() {
  solve();

  return 0;
}

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

int n, ans, j, k;
int l[2000];
int main() {
	scanf("%d", &n);
	rep(i, n) {
		scanf("%d", &l[i]);
	}
	sort(l, l + n, greater<int>());
	rep(i, n - 2) {
		for (j = i + 1; j < n - 1; ++j) {
			for (k = j + 1; k < n; ++k) {
				if (l[i] - l[j] >= l[k]) break;
				++ans;
			}
		}
	}
	printf("%lld\n", ans);
}


Measured memory_bytes: 256
n,m,c = map(int, input().split())
b = list(map(int, input().split()))
a = [list(map(int, input().split())) for _ in range(n)]
ans = 0

for i in range(n):
  temp = 0
  for j in range(m):
    temp += a[i][j] * b[j]
  temp += c
  if temp > 0:
    ans += 1
print(ans)

Measured memory_bytes: 3064
# include <bits/stdc++.h>
# define speed ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
# pragma GCC optimize "-O3"
# define int long long
  
using namespace std;
  
const int N = 1e4 + 7;
const int mod = 1e9 + 7;

void solve() {
	string s;
	cin >> s;
	if ( s == "ABC" ) s = "ARC";
	else s = "ABC";
	cout << s;
}

int32_t main() {
	speed;
	int T = 1;
	// cin >> T;
	while ( T-- ) {
		solve();
	}
}

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

using namespace std;

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

    vector<int> memo(n + 1, 1000000000);
    memo[0] = 0;

    queue<int> que;
    que.push(0);
    que.push(-1);

    while (true) {
        int cur = que.front();
        que.pop();

        if (cur == n) {
            break;
        } else if (cur >= 0) {
            if (memo[cur + 1] > memo[cur] + 1) {
                memo[cur + 1] = memo[cur] + 1;
                que.push(cur + 1);
            }

            for (long long i = 6; cur + i <= n; i *= 6) {
                if (memo[cur + i] > memo[cur] + 1) {
                    memo[cur + i] = memo[cur] + 1;
                    que.push(cur + i);
                }
            }

            for (long long i = 9; cur + i <= n; i *= 9) {
                if (memo[cur + i] > memo[cur] + 1) {
                    memo[cur + i] = memo[cur] + 1;
                    que.push(cur + i);
                }
            }
        } else {
            que.push(-1);
        }
    }

    cout << memo[n] << endl;
}


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


int main( void )
{
    int a,b,c;
    cin >> a >> b >> c;
    int x[3] = {a,b,c},max = 0,min = 11;
    rep(i,3)
    {
        if ( x[i] > max )
            max = x[i];
        if ( x[i] < min )
            min = x[i];
    }
    
    
    if ( max + min == 12 && a + b + c == 17 )
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
    
}


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

int main() {
  int N, D, X;
  cin >> N >> D >> X;
  vector<int> A(N);
  for (int i = 0; i < N; ++i) {
    cin >> A.at(i);
  }
  int ans = X;
  for (int i = 0; i < N; ++i) {
    ans += (D - 1) / A.at(i) + 1;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
package main

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

const mod = 1000000007

// 1MB
const ioBufferSize = 1 * 1024 * 1024

var sc = func() *bufio.Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Buffer(make([]byte, ioBufferSize), ioBufferSize)
	sc.Split(bufio.ScanWords)
	return sc
}()

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func abs(a int) int {
	if a < 0 {
		return -a
	}

	return a
}

func main() {
	a, b, _, k := nextInt(), nextInt(), nextInt(), nextInt()

	if abs(a-b) > 1000000000000000000 {
		fmt.Println("Unfair")
	} else if k%2 == 1 {
		fmt.Println(b - a)
	} else {
		fmt.Println(a - b)
	}
}


Measured memory_bytes: 640
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		try (Scanner sc = new Scanner(System.in)) {
            int n = sc.nextInt();

            int ans = (int) (n + Math.pow(n,2) + Math.pow(n,3));

            System.out.println(ans);

		} catch (Exception e) {
			// TODO: handle exception
		}
	}
}

Measured memory_bytes: 35756
#include <cstdio>
#include <climits>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <string>
#include <cstdio>
#include <climits>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <utility>
#include <queue>
#include <cstring>
#define rep(i, n) for (int i = 0; i < int(n); i++)
using namespace std;
long long MOD = 1000000007;
long long INF = 1000000000000000;

typedef long long ll;
typedef unsigned long long ull;

vector<int> g[100010];
vector<int> du(100010, -1), dv(100010, -1);

void dfsu(int i, int dd) {
  du[i] = dd;
  int n = g[i].size();
  rep(j, n) {
    if (du[g[i][j]] == -1) {
      dfsu(g[i][j], dd + 1);
    }
  }
}

void dfsv(int i, int dd) {
  dv[i] = dd;
  int n = g[i].size();
  rep(j, n) {
    if (dv[g[i][j]] == -1) {
      dfsv(g[i][j], dd + 1);
    }
  }
}

int main(void) {
  int n, u, v;
  cin >> n >> u >> v;
  u--; v--;
  rep(i, n - 1) {
    int a, b;
    cin >> a >> b;
    a--; b--;
    g[a].push_back(b);
    g[b].push_back(a);
  }


  dfsu(u, 0); dfsv(v, 0);

  int ans = 0;
  //cout << "A" << endl;
  //rep(i, n) cout << dv[i] << " ";cout << endl;
  //cout << "T" << endl;
  //rep(i, n) cout << du[i] << " ";cout << endl;
  rep(i, n) {
    if (du[i] <= dv[i]) {
      ans = max(ans, dv[i]);
    }
  }
  cout << ans - 1<< endl;
}
    
    


Measured memory_bytes: 10368
import math
#import numpy as np
import queue
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit
from scipy.sparse.csgraph import dijkstra
from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)

def main():
    n,m = map(int,ipt().split())
    cos = []
    row = []
    col = []
    for _ in range(m):
        a,b,c = map(int,ipt().split())
        row.append(a-1)
        col.append(b-1)
        cos.append(c)
    csr = csr_matrix((cos,(row,col)),shape=(n,n))
    d = dijkstra(csr,directed=False)
    ans = 0
    for i in range(m):
        rwi = row[i]
        cli = col[i]
        csi = cos[i]
        dri = d[rwi]
        dci = d[cli]
        for j in range(n):
            if dri[j] + csi == dci[j]:
                break
            if j == n-1:
                ans += 1
    print(ans)
    return

if __name__ == '__main__':
    main()


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

// Union Find木
// https://atcoder.jp/contests/atc001/tasks/unionfind_a

struct UnionFind{

    // 親:子の数*(-1)
    // 子:親の番号,par[子の番号] = 親の番号 となる

    vector<int> par;

    // すべてのノードを，根(-1)として初期化
    UnionFind(int N){
        par = vector<int>(N,-1);
    }

    // データxが属する根を再帰で取得
    int root(int x){
        if(par[x] < 0) return x;
        return par[x] = root(par[x]);
    }

    // x,yの木を併合
    bool unite(int x,int y){
        int root_x = root(x);
        int root_y = root(y);
        // xとyが同じ木に属していた場合
        if(root_x == root_y) return false;
        // 小さな木を大きい木に併合する
        if(par[root_x] > par[root_y]) swap(root_x,root_y);
        par[root_x] += par[root_y];
        par[root_y] = root_x;
        return true;
    }

    int size(int x){
        return -par[root(x)];
    }
};

int main(void){
    ll N,M;
    cin >> N >> M;

    int ans = 0;
    UnionFind Trees(N);

    REP(i,M){
        int A,B;
        cin >> A >> B;
        A --; B --;
        Trees.unite(A,B);
    }

    REP(i,N){
        ans = max(ans,Trees.size(i));
    }

    cout << ans << endl;

    return 0;
}

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

using namespace std;

int main() {
   int n,a,b;
   cin >> n >> a >> b;
   cout << min(n*a,b) << endl;
 }

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
#include<complex>
#include<numeric>
using namespace std;

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
ll mod = 1000000007;
const ll INF = mod * mod;
typedef pair<int, int>P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acos(-1.0);

ll mod_pow(ll a, ll n, ll m = mod) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * a%m;
		a = a * a%m; n >>= 1;
	}
	return res;
}

struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n%mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint &a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint &a, modint b) { a.n = ((ll)a.n*b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a*a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }
const int max_n = 10000;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}

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


void solve() {
	int n, m; cin >> n >> m;
	int sum = 0;
	rep(i, m) {
		int a; cin >> a; sum += a;
	}
	if (n < sum) {
		cout << -1 << "\n";
	}
	else {
		cout << n - sum << "\n";
	}
}


signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(4);
	//init_f();
	//init();
	//int t; cin >> t; rep(i, t)solve();
	solve();
	stop
		return 0;
}


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

using namespace std;

int main()
{
    int N;
    cin>>N;
    vector<vector<int>> E(N);
    for (int i=0; i<N-1; i++)
    {
        int a, b;
        cin>>a>>b;
        a--, b--;
        E[a].push_back(b);
        E[b].push_back(a);
    }

    vector<int> D(N, -1);
    D[0] = 0;
    queue<int> Q;
    Q.push(0);
    while (!Q.empty())
    {
        int p = Q.front();
        Q.pop();
        for (int e: E[p])
            if (D[e] == -1)
                D[e] = D[p] + 1,
                Q.push(e);
    }

    vector<int> C(N, -1);
    int p = N-1;
    while (p != 0)
    {
        C[p] = D[p]<=D[N-1]/2 ? 0 : 1;

        for (int e: E[p])
            if (D[e] == D[p]-1)
            {
                p = e;
                break;
            }
    }
    C[p] = 0;

    Q = queue<int>();
    Q.push(0);
    while (!Q.empty())
    {
        int p = Q.front();
        Q.pop();
        for (int e: E[p])
            if (C[e] == 0 || C[e] == -1)
                C[e] = 2,
                Q.push(e);
    }

    Q = queue<int>();
    Q.push(N-1);
    while (!Q.empty())
    {
        int p = Q.front();
        Q.pop();
        for (int e: E[p])
            if (C[e] == 1 || C[e]==-1)
                C[e] = 3,
                Q.push(e);
    }

    int n = 0;
    for (int c: C)
        if (c == 2)
            n++;

    cout<<(n>N-n ? "Fennec" : "Snuke")<<endl;
}


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

using namespace std;

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

int main() {
	int m; cin >> m;
	rep(_, m) {
	    set<string> t;
	    string s; cin >> s;
	    rep(i, s.size()) {
	        t.insert(s);

	        string a = s.substr(0, i);
	        string b = s.substr(i, s.size());
	        string ra(a);
	        string rb(b);
	        reverse(ra.begin(), ra.end());
	        reverse(rb.begin(), rb.end());
	        
	        t.insert(a + b);
	        t.insert(b + a);
	        t.insert(ra + b);
	        t.insert(b + ra);
	        t.insert(a + rb);
	        t.insert(rb + a);
	        t.insert(ra + rb);
	        t.insert(rb + ra);
	    }

	    cout << t.size() << endl;
	}
}



Measured memory_bytes: 3192
#include<iostream>
#include<cstdio>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
const double PI = 3.14159265358979;
const double E = 2.718281828459045;
const double root2 = sqrt(2);
typedef pair<int, int> P;
typedef unsigned int ui;
int main() {
	int isprime[1300000] = {};
	for (int i = 2; i < 1300000; i++) {
		if (!isprime[i]) {
			for (int j = 2 * i; j < 1300000; j += i) {
				isprime[j] = 1;
			}
		}
	}
	int n;
	while (cin >> n) {
		if (n == 0)break;
		if (!isprime[n])cout << 0 << endl;
		else {
			int cnt = 0;
			int le = n; int ri = n;
			while (isprime[le]) {
				le--; cnt++;
			}
			while (isprime[ri]) {
				ri++; cnt++;
			}
			cout << cnt << endl;
		}
	}
	return 0;
}


Measured memory_bytes: 8124
n = int(input())
a = [set() for i in range(n)]
e = []
for i in range(n-1):
  b, c = map(int, input().split())
  b -= 1
  c -= 1
  a[b].add(c)
  a[c].add(b)
  e.append(c)

col = [0 for i in range(n)]
visited = [False for i in range(n)]
visited[0] = True
v = [0]

while v:
  d = v.pop(0)
  k = 1
  for i in a[d]:
    if visited[i] == False:
      if col[d] == k:
        k += 1
      col[i] = k
      visited[i] = True
      v.append(i)
      k += 1

print (max(col))
for i in e:
  print (col[i])

Measured memory_bytes: 44332
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll=long long;
using vi = vector<int>;
using Graph = vector<vi>;
using P = pair<int,int>;
const int MOD=(int)1e9+7;
const int INF=(int)1e9;
const ll LINF=(ll)1e18;

int main(){
    int n;
    cin >> n;
    map<int,int> m;
    rep(i,n){
        int a;
        cin >> a;
        if(m[a]){
            //cout << "---" << endl;
            m[a]--;
        }else{
            m[a]++;
        }
    }
    int ans = 0;
    for(auto t : m){
        if(t.second>0) ans++;
    }
    cout << ans << endl;
}

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

#define ll long long

using namespace std;

const int MAX = 2e5;

int main()
{
	ll k, n;
	cin >> k >> n;
	
	vector<int> a;
	for (int i=0 ; i<n; ++i) {
		int t; cin >> t;
		a.push_back(t);
	}
	
	a.push_back(a[0] + k);
	
	int ans = 0;
	for (int i = 0; i < n; ++i) {
		ans = max(ans, a[i+1] - a[i]);
	}
	
	cout << k - ans << endl;
	
	return 0;
}




Measured memory_bytes: 1400
/*
auth - @sportykush
*/

#include <bits/stdc++.h>
using namespace std;
// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/tree_policy.hpp> 
// typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set; 
// using namespace __gnu_pbds;

typedef long long int ll;
typedef long double ld;

//#define mp make_pair
#define bug(v)                    cerr<<#v<<" = "<<(v)<<endl;
#define bug2(v1,v2)               cerr<<#v1<<" = "<<(v1)<< ' ' << #v2<<" = "<<(v2)<<endl;
#define ERASE(x)                  x.erase(unique(x.begin(),x.end()),x.end())
#define pb                        emplace_back
#define vii                       vector<int>
#define vll                       vector<ll>
#define vpll                      vector< pair <ll,ll> >
#define pll                       pair <ll,ll>
#define pii                       pair <int,int>
#define pq                        priority_queue< int >
#define khtm                      "\n"
#define F                         first
#define S                         second
#define fr(i,a,n)                 for(i=a;i<n;i++)
#define mem(arr,l)                memset(arr,l,sizeof arr)
#define ALL(x)                    x.begin(), x.end()
#define frr(i,a,n)                for(i=n-1;i>=a;i--)
#define fast                      ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define testcase                  ll T; cin>>T; while(T--)


const double pi = 3.14159265359;
const int MAX = 1e6 +2;
const ll inf =  1e18;
const int N = 1010;
const int dx[] = {-1, 0, 1, 0, 1, -1, -1, 1};
const int dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
//const ll mod = 998244353;
const ll mod = 1000000007;
inline ll add(ll a,ll b){a+=b;if(a>=mod)a-=mod;return a;}
inline ll mul(ll a,ll b){return (((a+mod)%mod)*(b+mod)%mod)%mod;}
inline ll power(ll a,ll b){ll rt=1;while(b>0){if(b&1)rt=mul(rt,a);a=mul(a,a);b>>=1;}return rt;}
inline ll modInverse(ll n, ll p){ return power(n, p-2)%p; }

/*
important builtin functions
__gcd(value1, value2)
__builtin_ffs(x)
  Number of leading zeroes: __builtin_clz(x)
  Number of trailing zeroes : __builtin_ctz(x)
  Number of set bits: __builtin_popcount(x)
*/
 
void stArt()
{
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif
}
void eNd()
{
	#ifndef ONLINE_JUDGE
  	cout<<"\nTime Elapsed : " << 1.0*clock() / CLOCKS_PER_SEC << " s";
  	#endif
}

//////////////////// start /////////////////////////////////
 

ll i,j,k,l,m,r,n;
//ll a[MAX],b[MAX];
vll adj[MAX];
ll val[MAX];
ll dfs(ll v)
{
	if(val[v])
		return val[v];
	val[v] = 1;
	for(auto u:adj[v])
	{
		val[v] = max(dfs(u)+1,val[v]);
	}
	return val[v];
}

int main()
{
 
stArt();
fast
//cout << setprecision(15) << fixed;

cin >> n >> m;
fr(i,0,m)
{
	cin >> l >> r;
	adj[l].pb(r);
}
fr(i,1,n+1)
	if(!val[i])
		dfs(i);
ll ans = -inf;
fr(i,1,1+n)
	ans = max(ans,val[i]);
cout << ans-1;
 eNd();
  return 0;
 
}

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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

int gcd(int a, int b){if (b == 0) return a; return gcd(b, a % b);}

//任意の整数１つを置き換える
//->置き換えるなら最大公約数が最適
//->任意の整数はなくても良い、つまり任意の整数を消すことと等価である
int main() {
    //int ans = -1;
    int n;
    vi a;

    cin >> n;

    a.resize(n);
    REP(i,n) cin>>a[i];

    vi cl(n);//A0...An-1
    vi cr(n);//An-1...A0
    cl[0] = a[0];
    cr[n-1] = a[n-1];

    FOR(i,1,n){
        cl[i] = gcd(cl[i-1], a[i]);
        cr[n-1-i] = gcd(cr[n-1-i+1], a[n-1-i]);
    }

    ll ans = -1;
    REP(i,n){
        ll temp;
        if(i==0)
            temp = cr[i+1];
        else if(i==n-1)
            temp = cl[n-1-1];
        else
            temp = gcd(cl[i-1], cr[i+1]);
        
        ans = max(ans, temp);
    }

    cout << ans << endl;
    return 0;
}

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

#define rep(i,x,y) for(int i=(x);i<(y);++i)
#define debug(x) #x << "=" << (x)

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define print(x)
#endif

const int inf=1e9;
const int64_t inf64=1e18;
const double eps=1e-9;

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
    os << "[";
    for (const auto &v : vec) {
    	os << v << ",";
    }
    os << "]";
    return os;
}

using i64=int64_t;

void solve(){
    string s;
    int k;
    cin >> s >> k;
    vector<int> v1,v2;
    rep(i,0,s.size()){
        if(s[i]=='U' or s[i]=='D') v1.push_back(s[i]=='U'?-1:1);
        else v2.push_back(s[i]=='R'?-1:1);
    }

    static int dp1[2][2001][2001][2],dp2[2][2001][2001][2];
    static bool done1[2][2001][2001][2],done2[2][2001][2001][2];
    function<int(int,int,int,int)> rec1=[&](int b,int i,int j,int k){
        int &res=dp1[b][i][j][k];
        if(done1[b][i][j][k]) return res;
        done1[b][i][j][k]=true;

        if(i==v1.size()) return res=0;
        
        if(b==0) res=-inf;
        else res=inf;
        
        if(j-1>=0){
            int d=(k%2==0?-1:1)*v1[i];
            if(b==0) res=max(res,d+rec1(b,i+1,j-1,(k+1)%2));
            else res=min(res,d+rec1(b,i+1,j-1,(k+1)%2));
        }
        int d=(k%2==0?1:-1)*v1[i];
        if(b==0) res=max(res,d+rec1(b,i+1,j,k));
        else res=min(res,d+rec1(b,i+1,j,k));
        return res;
    };
    function<int(int,int,int,int)> rec2=[&](int b,int i,int j,int k){
        int &res=dp2[b][i][j][k];
        if(done2[b][i][j][k]) return res;
        done2[b][i][j][k]=true;

        if(i==v2.size()) return res=0;
        
        if(b==0) res=-inf;
        else res=inf;
        
        if(j-1>=0){
            int d=(k%2==0?-1:1)*v2[i];
            if(b==0) res=max(res,d+rec2(b,i+1,j-1,(k+1)%2));
            else res=min(res,d+rec2(b,i+1,j-1,(k+1)%2));
        }
        int d=(k%2==0?1:-1)*v2[i];
        if(b==0) res=max(res,d+rec2(b,i+1,j,k));
        else res=min(res,d+rec2(b,i+1,j,k));
        return res;
    };

    int ans=0;
    rep(i,0,k+2){
        rep(j,0,k+2){
            if(i+j>k) break;
            ans=max(ans,max(abs(rec1(0,0,i,0)),abs(rec1(1,0,i,0)))+max(abs(rec2(0,0,j,0)),abs(rec2(1,0,j,0))));
        }
    }
    cout << ans << endl;
}

int main(){
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(20);
    solve();
    return 0;
}

Measured memory_bytes: 81596
#include <stdio.h>
 
int main(void) {
    int x,y;
    
    while(1){
        scanf("%d %d",&x,&y);
        //???????????其
        if(x==0 && y==0) break;
        if(x<y) printf("%d %d\n", x,y);
        else printf("%d %d\n", y,x);
    }
         
        return 0;
}
 

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

int main(){
  int n,sum=0,m=0,i,price;
  cin>>n;
  for(i=0;i<n;i++){
    cin>>price;
    m=max(m,price);
    sum+=price;
  }
  cout<<sum-m/2<<endl;
}

Measured memory_bytes: 256
#include<stdio.h>

void trace(int A[], int N){
    int i;
    for (i=0;i<N;i++){
        if (i>0) printf(" ");
        printf("%d",A[i]);
    }
    printf("\n");
}

void insertionSort(int A[], int N){
    int j, i, v;
    for (i=1;i<N;i++){
        v = A[i];
        j = i-1;
        while (j >= 0 && A[j] > v){
            A[j+1]  =A[j];
            j--;    
        }
        A[j+1] = v;
        trace(A,N);
    }
}

int  main(){
    int N, i, j;
    int A[100];

    scanf("%d", &N);
    for (i=0;i<N;i++) scanf("%d", &A[i]);

    trace(A,N);
    insertionSort(A,N);

    return 0;
}


Measured memory_bytes: 2120
# -*- coding: utf-8 -*-
from sys import stdin

class Dice:

    def __init__(self,dicelist):
        self.dice_list = dicelist
        self.all_pattern = 'NNNNWNNNWNNNENNNENNNWNNN'

    def roll(self, direction):
        work = list(self.dice_list)
        if (direction == 'N'):
            self.dice_list[0] = work[1]
            self.dice_list[1] = work[5]
            self.dice_list[2] = work[2]
            self.dice_list[3] = work[3]
            self.dice_list[4] = work[0]
            self.dice_list[5] = work[4]
        elif (direction == 'E'):
            self.dice_list[0] = work[3]
            self.dice_list[1] = work[1]
            self.dice_list[2] = work[0]
            self.dice_list[3] = work[5]
            self.dice_list[4] = work[4]
            self.dice_list[5] = work[2]
        elif (direction == 'S'):
            self.dice_list[0] = work[4]
            self.dice_list[1] = work[0]
            self.dice_list[2] = work[2]
            self.dice_list[3] = work[3]
            self.dice_list[4] = work[5]
            self.dice_list[5] = work[1]
        elif (direction == 'W'):
            self.dice_list[0] = work[2]
            self.dice_list[1] = work[1]
            self.dice_list[2] = work[5]
            self.dice_list[3] = work[0]
            self.dice_list[4] = work[4]
            self.dice_list[5] = work[3]

    def equals(self, another):
        for p in self.all_pattern:
            another.roll(p)
            if self.dice_list == another.dice_list:
                return True
        else:
            return False

N = int(stdin.readline().rstrip())
is_all_different = True
dices = [Dice(list(map(int, stdin.readline().rstrip().split()))) for d in range(N)]

import itertools
for pattern in list(itertools.combinations(range(N), 2)):
    if dices[pattern[0]].equals(dices[pattern[1]]):
        print("No")
        break
else:
    print("Yes")


Measured memory_bytes: 6032
#include<iostream>
#include<cmath>
using namespace std;
typedef long long int ll;
int main()
{
  ll j,s=0;
  string a;
  cin>>a;
  for(ll i=0;i<a.size()&&a[i]!='.';i++)
  {
    j=(int)a[i];
    s=s+(j-48);
  } 
  if(s%9==0)
    cout<<"Yes\n";
  else
    cout<<"No\n";
  return 0;
} 


Measured memory_bytes: 3352
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <iomanip>
#include <bitset>
#include <set>
#include <map>
#include <stdio.h>
#include <numeric>
#include <cstring>

#define rep(i,n) for (int i = 0; i < (n); i++)
#define rep1(i,n) for (int i = 1; i < (n); i++)
#define FOR(i,a,b) for (int i=(a); i < (b); i++)
#define MOD 1000000007 //10^9+7
#define ALL(a)  (a).begin(),(a).end()
using namespace std;
using ll = long long;
using PII = pair<int, int>;
using PLL = pair<long long, long long>;
const int INF = numeric_limits<int>::max();
const ll INFL = numeric_limits<ll>::max();
constexpr ll TEN(int n) { return (n==0) ? 1 : 10*TEN(n-1); }

// 負の数にも対応した % 演算
long long mod(long long val, long long m) {
    long long res = val % m;
    if (res < 0) res += m;
    return res;
}

//greatest common divisor
long long gcd(ll a, ll b) 
{
    if (a % b == 0) {
        return b;
    } else {
        return gcd(b, a % b);
    }
}

//least common multiple
long long lcm(ll a, ll b)
{
    return a / gcd(a, b) * b ;
}

ll factorial(ll n) {
    ll res = 1;
    for (ll i = 1; i <= n; i++) {
        res *= i;
    }
    return res;
}

bool fn_is_prime(ll n) {
    for (ll i = 2; i * i <= n; i++) {
        if (n % i == 0) return false;
    }
    return n != 1;
}

bool isOK(int index, int key, vector<ll>& a) {
    if (a[index] >= key) return true;
    else return false;
}

int binary_search(int key, vector<ll>& a) {
    int ng = -1;
    int ok = a.size();

    while (abs(ok - ng) > 1) {
        int mid = (ok + ng) / 2;

        if (isOK(mid, key, a)) ok = mid;
        else ng = mid;
    }
    return ok;
}

struct UnionFind {
    vector<int> r;

    UnionFind(int N) {
        r = vector<int>(N, -1);
    }

    int root(int x) {
        if (r[x] < 0) return x;
        return r[x] = root(r[x]);
    }

    bool unite(int x, int y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (r[x] > r[y]) swap(x, y);
        r[x] += r[y];
        r[y] = x;
        return true;
    }

    int size(int x) {
        return -r[root(x)];
    }

    bool same(int x, int y) {
        return root(x) == root(y);
    }
};

int main()
{
    int a, b, x; cin >> a >> b >> x;
    if (a > x || a +b < x)
        cout << "NO" << endl;
    else
        cout <<"YES" << endl;
}


Measured memory_bytes: 3568
#include <iostream>
#include <vector>
#include <queue>
#include <unordered_map>
#include <map>
#include <string>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <algorithm> 

#define MaxN 100005

using namespace std;

int a,b,c;

int main()
{
	cin>>a>>b>>c;
	if(c>=a&&c<=b)
		cout<<"Yes\n";
	else cout<<"No\n";
	
	return 0;
}

Measured memory_bytes: 256
/**
*   Bismillahir Rahmanir Rahim.
*   Imtiaz_rafi
*   PCIU, CHITTAGONG
**/
#include<bits/stdc++.h>
using namespace std;
#define speed() ios::sync_with_stdio(0);cin.tie(0);
#define file() freopen ("input.txt", "r", stdin);freopen ("output.txt", "w", stdout);
#define rep(i,a) for(ll i=0;i<a;i++)
#define rep1(i,begin,end) for(ll i=begin;i<=end;i++)
#define mem(dp,i) memset(dp,i,sizeof(dp))
#define all(v)   v.begin(),v.end()
#define rall(v)   v.rbegin(),v.rend()
#define pb push_back
#define pf push_front
#define mp make_pair
#define pi acos(-1)
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
// bitshift (1LL<<(3)) *2^3
typedef long long int ll;
typedef vector<ll>vi;
typedef map<ll,ll>mi;
typedef pair<ll,ll>pll;
typedef vector<pll> vll;
typedef set<ll>st;
typedef set<char>sc;
ll dx[] = {-1,+1,0,0,+1,-1,+1,-1};
ll dy[] = {0,0,-1,+1,+1,+1,-1,-1};
const ll mx = 1e5+123;
const ll MOD = 1e9+7;
ll power(ll a,ll b){a%=MOD;if(!a) return 0;ll p=1;while(b>0){if(b&1){p*=a;p%=MOD;}a*=a;a%=MOD;b=b>>1;}return p;}
ll BS(ll l,ll r,ll a[],ll k){ll mid,i=-1;while(l<=r){mid=(l+r)>>1;if(a[mid]==k){return i=mid;/*r=mid-1;*/}if(a[mid]<k) l=mid+1;if(a[mid]>k) r=mid-1;}return i;}
int main()
{
    speed();
    ll a,i,j,k,ans=0,x,y;
    cin>>a;
    ll b[a];
    rep(i,a)
        cin>>b[i];
    //sort(b,b+a);
    for(i=0;i<a;i++)
    {
        x=b[i];
        for(j=i+1;j<a;j++)
        {
            if(b[i]!=b[j])
            {
                y=b[j];
                for(k=j+1;k<a;k++)
                {
                    if(x+y>b[k] && x+b[k]>y && y+b[k]>x && b[k]!=x && b[k]!=y && x!=y && j<a-1)
                    {
                        ans++;
                    }
                }
            }
        }

    }
    cout<<ans<<endl;
}


Measured memory_bytes: 3648
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <fstream>
#include <sstream>
#include <math.h>
#include <map>
using namespace std;
long L,R;

int main()
{
	int N,K;
	cin >> N >> K;
	if(N%K==0){cout << "0" << endl;}
	if(N%K!=0){cout << "1" << endl;}
}

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

int main() {
    int n;
    cin >> n;
    vector<vector<int>> v(3, vector<int>(n));
    for (int i = 0; i < n; i++)
        for (int j = 0; j < 3; j++)
            cin >> v[j][i];
    for (int i = 0; i < n; i++) {
        int ans = 0;
        for (int j = 0; j < 3; j++) {
            if (count(v[j].begin(), v[j].end(), v[j][i]) == 1)
                ans += v[j][i];
        }
        cout << ans << endl;
    }
}


Measured memory_bytes: 3160
#include <stdio.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
ll pom(ll a,ll n,int m){ll x=1;for(a%=m;n;n/=2)n&1?x=x*a%m:0,a=a*a%m;return x;}
#define MOD 998244353

ll n;
ll x[210],y[210];
ll temp[210];

int main(){
	scanf("%lld",&n);
	rep(i,0,n)scanf("%lld%lld",x+i,y+i);
	rep(i,0,n)rep(j,i+1,n){
		ll c=0;
		rep(k,0,n){
			if((x[i]-x[j])*(y[j]-y[k])==(x[j]-x[k])*(y[i]-y[j]))c++;
		}
		temp[c]++;
	}
	ll ans=pom(2,n,MOD)-1-n;
	rep(i,2,n+1)if(temp[i]){
		ll cnt=temp[i]*2/i/(i-1);
		//ちょうどi点乗っている直線がcnt本
		ans=(ans-(pom(2,i,MOD)-i-1)*cnt)%MOD;
	}
	printf("%lld\n",(ans+MOD)%MOD);
	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF 1<<30

/*
	p/q == P/Q

	p'/q' + 1/x = (p'x + q')/q'x = P/Q
*/
ll p, q, a, n;
int rec(ll P, ll Q, ll x, ll N) {
	if (p*Q == P*q)return 1;
	if (p*Q < P*q)return 0;
	if (N == n) return 0;

	ll ret = 0;

	for (ll X = x;Q*X <= a;X++) {
		ret += rec(P*X + Q, Q*X, X, N + 1);
	}
	return ret;
}

int main(void) {
	cin.tie(0); ios::sync_with_stdio(false);
	while (cin >> p >> q >> a >> n, p | q | a | n) {
		cout << rec(0, 1, 1, 0) << endl;
	}
}

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

namespace ABC080A
{
    class Program
    {
        static void Main(string[] args)
        {
            int n, a, b, x;

            var word = Console.ReadLine().Split(' ');

            n = int.Parse(word[0]);
            a = int.Parse(word[1]);
            b = int.Parse(word[2]);

            if ((n * a) < b)
            {
                x = n * a;
            }

            else
            {
                x = b;
            }

            Console.WriteLine(x);

            Console.ReadKey();

        }
    }
}


Measured memory_bytes: 13140
#include<stdio.h>
int main()
{
    int i, N, a, b, c;
    scanf("%d", &N);

    for(i=0;i<N;i++){
        scanf("%d %d %d", &a, &b, &c);
        if(a>b && a>c){
            if(a*a==b*b+c*c){
                printf("YES\n");
            }else
                printf("NO\n");
        }else if(b>a && b>c){
            if(b*b==a*a+c*c){
                printf("YES\n");
            }else
                printf("NO\n");
        }else{
            if(c*c==a*a+b*b){
                printf("YES\n");
            }else
                printf("NO\n");
        }   
    }   
    return 0;
}

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

#define ll   long long int
#define PI 3.14159265358979

using namespace std;


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    string s, t;
    cin>>s;
    for(int i=0; i<s.length(); i++)
    {
        char b=s[i];
        if(b=='B')
        {
            if(!t.empty())
                t.pop_back();
        }
        else
            t+=b;
    }
    cout<<t;
    return 0;
}


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


int main()
{
 int m;
 int lp=0;
 scanf("%d",&m);

      if(m>=500){
       int s = m/500;
        lp = lp+s*1000;
          if(m%500==0){
            printf("%d\n",lp);
          }
          else{
            int a = (m%500);
            if(a>=5){
                int b =a/5;
                lp = lp+(b*5);
                printf("%d",lp);
            }

          }
 }
          else{
           int p = m/5;
           lp = lp+5*p;
           printf("%d",lp);
                       }


 return 0;
}


Measured memory_bytes: 128
#include<iostream>
	#include<vector>
	#include<algorithm>
	#include<string>
	#include<cmath>
	#include<map>
	#include<cstdio>
	#include<stack>
	#include<queue>
	#include<fstream>
	#include<cstdio>
	#include<deque>
	#include<iomanip>
	#include <numeric>
	//#include<bits/stdc++.h>

	using namespace std;
	#define ok1 printf("ok1\n");
	#define ok2 printf("ok2\n");
	#define M 1000000000000000000LL
	#define rep(i,n) for(int i=0;i<n;i++)
	#define REP(i,s,n) for(int i=(s);i<(n);i++)
	#define repr(i,n) for(int i=n-1;i>=0;i--)
	#define REPR(i,s,n) for(int i=(s);i>=(n);(i)--)
	#define all(a) (a).begin(),(a).end()
	#define reall(a) (a).rbegin(),(a).rend()
	#define pb push_back
	#define pf push_front
	#define MIN(a,b) a=min((a),(b))
	#define MAX(a,b) a=max((a),(b))
	#define SIZE(v) (int)v.size()
	const double pi = acos(-1.0);

	typedef vector<int> vi;
	typedef vector<string> vs;
	typedef long long ll;
	typedef vector<ll> vll;
	typedef vector<vi> vvi;
	typedef vector<vll> vvll;
	typedef deque<ll> dll;
	typedef pair<ll, ll> P;
	const ll mod = 1e9 + 7;
	ll dx[4] = {1,0,-1,0};
	ll dy[4] = {0,1,0,-1};


	int main() {
		cin.tie(0);
		ios::sync_with_stdio(false);
		
		ll h, w;
		cin >> h >> w;
		ll ans = (ll)(1e10);
		if (h % 3 == 0 || w % 3 == 0) ans = 0;
		else if (h == 2 || w == 2) ans = 1;
		else if (h % 2 == 0 && w % 2 == 0) ans = min(h / 2, w / 2);
		else {
			REP(i,1,w-1) {
				ll h1 = h / 2, h2 = (h + 1) / 2;
				ll s1 = h * i, s2 = h1 * (w - i), s3 = h2 * (w - i);
				ll s_max = max(s1, s3);
				ll s_min = min(s1, s2);
				if (ans>s_max - s_min) ans = s_max - s_min;
			}
			REP(i,1,h-1) {
				ll w1 = w / 2, w2 = (w + 1) / 2;
				ll s1 = w * i, s2 = w1 * (h - i), s3 = w2 * (h - i);
				ll s_max = max(s1, s3);
				ll s_min = min(s1, s2);
				if (ans>s_max - s_min) ans = s_max - s_min;
			}
			ll min_l = min(h, w);
			ans = min(ans, min_l);
		}
		cout << ans << endl;
		return 0;
	}	
	

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
char a[100001];
string k1="Second\n",k2="First\n";
int main(){
	int f=0;
	while(cin>>a){
		f=strlen(a);
		if(f%2){
			if(a[0]==a[f-1])
				cout<<k1;
			else cout<<k2;
		}
		else {
			if(a[0]==a[f-1])
				cout<<k2;
			else cout<<k1;
		}
	}
	return 0;
}

Measured memory_bytes: 384
#include <stdio.h>

int main(void)
{
	int a,b,c;
	scanf("%d%d%d",&a,&b,&c);
	
	if (a<b&&a<c&&b<c){
		printf("Yes\n");
	}
	else{
		printf("No\n");
	}
		
	return 0;
}


Measured memory_bytes: 2052