akhauriyash/Code-Regression huggingface dataset:
#ifndef LOCAL
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#else
#include <iostream>
#include <iomanip> 
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <memory>
#include <cctype>
#include <cstring>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#endif
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; }; sim > rge<c> range(c i, c j) { return rge<c>{i, j}; } sim > auto dud(c* x) -> decltype(cerr << *x, 0); sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; } eni(!=) cerr << boolalpha << i; ris; } eni(==) ris << range(begin(i), end(i)); } sim, class b dor(pair < b, c > d) { ris << "(" << d.first << ", " << d.second << ")"; } sim dor(rge<c> d) { *this << "["; for (auto it = d.b; it != d.e; ++it) *this << ", " + 2 * (it == d.b) << *it; ris << "]"; }
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/tree_policy.hpp> 
// using namespace __gnu_pbds; 
// #define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 

template<typename T> void setmax(T& x, T y) {x = max(x, y);}
template<typename T> void setmin(T& x, T y) {x = min(x, y);}
#define fix(a) fixed << setprecision(a)
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define rep(i, a, b) for (int i = int(a); i < int(b); i++)
#define all(V) V.begin(), V.end()
#define rall(V) V.rbegin(), V.rend()
#define len(V) (int)V.size()
#define ll long long
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define endl '\n'


void solve(){
  int n, d, x, a;
  cin >> n >> d >> x;
  forn(i,n) {
    cin >> a;
    rep(j,0,d+1){
      if ((a * j + 1) <= d) x++;
    }
  }
  cout << x << endl;
}

int main() {
  ios::sync_with_stdio(false);
  int t = 1;
  // cin >> t;
  forn(i, t){
    solve();
  }
}

/* 

1
322123


n - 1
0 ... (n-1) [res ... res] S - (n-1) ... S


 */

Measured memory_bytes: 256
package main

import (
	"bufio"
	"encoding/json"
	"fmt"
	"os"
	"strconv"
	"strings"
)

var (
	sc = bufio.NewScanner(os.Stdin)
)

type Color int

const (
	ColorBlack Color = iota
	ColorRed
)

var strByColor = map[Color]string{
	ColorBlack: "black",
	ColorRed:   "red",
}

func (c Color) String() string {
	return strByColor[c]
}

type Node struct {
	ID      int
	X, Y    int
	Color   Color
	NextIDs map[int]struct{}
}

func (n *Node) String() string {
	d, _ := json.Marshal(n)
	return string(d)
}

type Map struct {
	Width, Height int
	Nodes         map[int]*Node
}

func (m *Map) GetByID(id int) *Node {
	return m.Nodes[id]
}

func (m *Map) Get(x, y int) *Node {
	return m.Nodes[m.getID(x, y)]
}

func (m *Map) SetColor(x, y int, c Color) {
	m.Nodes[m.getID(x, y)].Color = c
}

func (m *Map) getID(x, y int) int {
	return x + y*m.Width
}

func (m *Map) init() {
	for x := 1; x <= m.Width; x++ {
		for y := 1; y <= m.Height; y++ {
			id := m.getID(x, y)
			m.Nodes[id] = &Node{ID: id, X: x, Y: y}
		}
	}
	for x := 1; x <= m.Width; x++ {
		for y := 1; y <= m.Height; y++ {
			nextIDs := map[int]struct{}{}
			if x > 1 {
				nextIDs[m.getID(x-1, y)] = struct{}{}
			}
			if x < m.Width {
				nextIDs[m.getID(x+1, y)] = struct{}{}
			}
			if y > 1 {
				nextIDs[m.getID(x, y-1)] = struct{}{}
			}
			if y < m.Height {
				nextIDs[m.getID(x, y+1)] = struct{}{}
			}
			m.Get(x, y).NextIDs = nextIDs
		}
	}
}

func NewMap(w, h int) *Map {
	m := &Map{Width: w, Height: h, Nodes: map[int]*Node{}}
	m.init()
	return m
}

type Searcher struct {
	Map        *Map
	queue      []*Node
	touchedIDs map[int]struct{}
	visitedIDs map[int]struct{}
}

func NewSearcher(m *Map) *Searcher {
	return &Searcher{
		Map:        m,
		queue:      []*Node{},
		touchedIDs: map[int]struct{}{},
		visitedIDs: map[int]struct{}{},
	}
}

func (s *Searcher) Search(start *Node) {
	s.enqueue(start)

	for {
		if len(s.queue) == 0 {
			break
		}
		for nextID := range s.dequeue().NextIDs {
			n := s.Map.GetByID(nextID)
			if n.Color == ColorRed || s.hasTouched(n) {
				continue
			}
			s.enqueue(n)
		}
	}
}

func (s *Searcher) VisitedNodeCount() int {
	return len(s.visitedIDs)
}

func (s *Searcher) hasTouched(n *Node) bool {
	_, ok := s.touchedIDs[n.ID]
	return ok
}

func (s *Searcher) enqueue(n *Node) {
	s.queue = append(s.queue, n)
	s.touchedIDs[n.ID] = struct{}{}
}

func (s *Searcher) dequeue() *Node {
	n := s.queue[0]
	s.queue = s.queue[1:]
	s.visitedIDs[n.ID] = struct{}{}
	return n
}

func main() {
	for sc.Scan() {
		if sc.Text() == "0 0" {
			break
		}
		chunks := strings.Split(sc.Text(), " ")
		w, _ := strconv.Atoi(chunks[0])
		h, _ := strconv.Atoi(chunks[1])

		m := NewMap(w, h)

		// Set colors
		var start *Node
		for y := 1; y <= h; y++ {
			sc.Scan()
			for i, c := range sc.Text() {
				switch c {
				case '.', '@':
					m.SetColor(i+1, y, ColorBlack)
					if c == '@' {
						start = m.Get(i+1, y)
					}
				case '#':
					m.SetColor(i+1, y, ColorRed)
				}
			}
		}

		// Search
		s := NewSearcher(m)
		s.Search(start)
		fmt.Println(s.VisitedNodeCount())
	}
}

Measured memory_bytes: 6060
#include <bits/stdc++.h>
using namespace std;
 
int main() {
 int a;
cin >> a;
  vector<pair<pair<string,int>,int>> c(a);
    for(int i = 0;i < a;++i){
      cin >> c.at(i).first.first >> c.at(i).first.second;
      c.at(i).first.second *= -1;
      c.at(i).second = i+1;
}
  sort(c.begin(),c.end());
  for(int i = 0;i < a;++i){
    cout << c.at(i).second << endl;}
}

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

int n;
vector<vector<int> > G;
vector<int> D;

void bfs(int src){
    queue<int> Q;
    Q.push(src);
    D[src] = 0; // ?????????
    while(!Q.empty()){
        int cur = Q.front(); // ??????????´???????????????????
        Q.pop();
        for(int dst = 0; dst < n; ++dst){ // ???????????? dst ????????????
            if(G[cur][dst] == 1 && D[dst] == -1){ // cur??????dst???????????????,dst???????¨??????????
                D[dst] = D[cur] + 1;
                Q.push(dst); // dst????¨??????????????????????
            }
        }
    }
}

int main(){
    cin >> n;
    G = vector<vector<int> >(n, vector<int>(n, 0));
    D = vector<int>(n, -1);
    for(int i=0; i<n; ++i){
        int u;
        cin >> u;
        // 1~n???index?????¨????????????????????????????????????1????????????0~n-1????????????
        u -= 1;
        int k;
        cin >> k;
        for(int j=0; j<k; ++j){
            int v;
            cin >> v;
            v -= 1;
            G[u][v] = 1;
        }
    }
    bfs(0);
    for(int i=0; i<n; ++i){
        cout << i+1 << " " << D[i] << endl;
    }
}

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

int main()
{
  int i,j,x;
  for(i=1;i<=9;i++)
    {
      for(j=1;j<=9;j++)
	{
	  x = i*j;
	  cout << i << "x" << j << "=" << x << endl;
	}
    }
  
  return 0;
}

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

#define times(n, i) uptil(0, n, i)
#define upto(f, t, i) for(auto _##i = (t), i = decltype(_##i)(f) poi i <= _##i poi i++)
#define uptil(f, t, i) for(auto _##i = (t), i = decltype(_##i)(f) poi i < _##i poi i++)
#define downto(f, t, i) for(auto i = (f), _##i = decltype(i)(t) poi i >= _##i poi i--)
#define downtil(f, t, i) for(auto i = (f), _##i = decltype(i)(t) poi i > _##i poi i--)

#define unless(c) if(!(c))
#define until(c) while(!(c))
#define loop while(true)

#define poi ;
#define poipoi << "\n"

using namespace std;

#define fuwafuwa(n, c) dokidoki((n) + (c) - 1, c)
#define dokidoki(n, c) ((n) / (c) * (c))

template<class T> T lov_yet(T t){
    if(t) return t poi
    else return 0 poi
}

template<class T> T gcd(T a, T b){
    if(b) return gcd(b, a % b) poi
    else return a poi
}

int main(){
    int n poi
    while(cin >> n){
        int pyon = 0 poi
        times(10, a) times(10, b) times(10, c) times(10, d) if(a + b + c + d == n) pyon++poi
        cout << pyon poipoi poi
    }
    return 0 poi
}

Measured memory_bytes: 1156
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ld long double
#define fi first
#define se second
#define endl '\n'
#define MAX INT_MAX
#define MIN INT_MIN
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define mod 1000000007
#define pb push_back
#define sz(a) (int)((a).size())
#define all(a) a.begin(),a.end()
#define loopf(i,a,b) for(int i = a;i < b;i++)
#define loopb(i,a,b) for(int i = a;i >= b;i--)
typedef vector<int> vi;
typedef vector< vi > vvi;
typedef pair< int,int > pii;
  
bool pal(string s)
{
  int n=s.size();
  for(int i=0;i<n/2;i++)if(s[i]!=s[n-i-1])return false;

  return true;
}

int32_t main()
{
    fast

   int test=1;
   //cin>>test;

  while(test--)
  {

  string s,s1="",s2="";
  cin>>s;
  int n=s.size();
  
  for(int i=0;i<(n-1)/2;i++)s1+=s[i];

  for(int i=(n+3)/2-1;i<n;i++)s2+=s[i];

  if(pal(s) and pal(s1) and pal(s2))cout<<"Yes";
  else cout<<"No";

    //while loop ending 
  }


  return 0;
  }

Measured memory_bytes: 256
#include<stdio.h>

int main()
{
     int arr[10], i, j, k, temp;

     for(k=0; k<10; k++)
     {
          scanf("%d", &arr[k]);
     }
     for(i=0; i<10-1; i++)
     {
          for(j=i+1; j<=10; j++)
          {
               if(arr[i]<arr[j])
               {
                    temp=arr[i];
                    arr[i]=arr[j];
                    arr[j]=temp;
               }
          }
     }
     for(k=0; k<3; k++)
     {
          printf("%d\n", arr[k]);
     }
     return 0;
}

Measured memory_bytes: 600
#include <iostream>
#include <vector>
#include <numeric>//accumulate(v.begin(), v.end(), 0);
#include <algorithm>//sort(v.begin(),v.end());
#include <string>//
using namespace std;
#define ll long long
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

int main(){
        int N;
        cin >> N;
        vector <int> v(N,0);
        rep(i,N){
                cin >> v[i];
        }
        int a=0,b=0,c=0;
        rep(i,N){
                if(v[i]%4==0) {
                        a++;
                }else if(v[i]%2==0) {
                        b++;
                }else{
                        c++;
                }
        }
        if(b!=0) {
                if(a>=c) {
                        cout << "Yes" <<endl;
                }else{
                        cout << "No" <<endl;

                }
        }else{
                if(a+1>=c) {
                        cout << "Yes" <<endl;
                }else{
                        cout << "No" <<endl;

                }
        }
        return 0;
}


Measured memory_bytes: 640
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class Program
{
    public static bool f = false, t = true;
    static void Main(string[] args)
    {
        int a = int.Parse(Read.Str());
        int b= int.Parse(Read.Str());
        Console.WriteLine(a*a-b);
    }

    public static long gcd(long a, long b)
    {
        while (true)
        {
            if (a == 0) { return b; }
            if (b == 0) { return a; }
            if (a > b) { a -= b; }
            else { b -= a; }
        }
    }
    public static long lcm(long a, long b)
    {
        return a / gcd(a, b) * b;
    }
    public static bool IsPrime(long n)
    {
        if (n < 2) return false;
        if (n == 2) return true;

        for (long i = 2; i < n; i++)
        {
            if (n % i == 0) return false;
        }
        return true;
    }

}
public static class Read
{
    public static void outl(string n = "") { Console.WriteLine(n); return; }
    public static long Long()
    {
        return long.Parse(Console.ReadLine());
    }
    public static long[] longs()
    {
        return Console.ReadLine().Split().Select(long.Parse).ToArray();
    }
    public static int Int()
    {
        return int.Parse(Console.ReadLine());
    }
    public static int[] ints()
    {
        return Console.ReadLine().Split().Select(int.Parse).ToArray();
    }
    public static string Str() { return Console.ReadLine(); }
    public static string[] Strs() { return Console.ReadLine().Split(); }
}

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

using namespace std;

int64_t P[60];
int64_t B[60];
int64_t L[60];

int64_t Solve(int64_t level, int64_t eat) {
  if (level <= 0) {
    if (eat >= 1) {
      return 1;
    } else {
      return 0;
    }
  }

  // B L P L B
  if (eat <= 1) {
    return 0;
  } else if (eat <= 1 + L[level - 1]) {
    return Solve(level - 1, eat - 1);
  } else if (eat <= 1 + L[level - 1] + 1) {
    return P[level - 1] + 1;
  } else if (eat <= 1 + L[level - 1] + 1 + L[level - 1]) {
    return P[level - 1] + 1 + Solve(level - 1, eat - 2 - L[level - 1]);
  } else {
    return P[level];
  }
}

int main() {
  int64_t N, eat;
  cin >> N >> eat;

  P[0] = 1;
  B[0] = 0;
  L[0] = 1;
  for (int level = 1; level <= 50; level++) {
    P[level] = P[level - 1] * 2 + 1;
    B[level] = B[level - 1] * 2 + 2;
    L[level] = P[level] + B[level];
  }

  printf("%ld\n", Solve(N, eat));

  return 0;
}


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

int64_t nC2(int64_t x){
    if(x == 0 || x == 1){
        return 0;
    }else{
        return x * (x - 1)/2;
    }
}

int main(){ 
    int n; cin >> n;
    vector<int> a(n);
    vector<int64_t> list(n);
    int64_t sum = 0;
    
    for(int i = 0; i < n; i++){
        cin >> a.at(i);
        list.at(a.at(i) - 1) += 1;
    }
    
    for(int i = 0; i < n; i++){
        sum += nC2(list.at(i));
    }
    
    
    for(int i = 0; i < n; i++){
        if(list.at(a.at(i) - 1) == 0 || list.at(a.at(i) - 1) == 1){
            cout << sum << endl;
        }else{
            int diff = list.at(a.at(i) - 1) - 1; 
            cout << sum - diff << endl;
        }
    }
    
}
        


Measured memory_bytes: 4992
#include <bits/stdc++.h>
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define int long long
#define ld long double
#define endl "\n"
using namespace std;

int32_t main() {
  int n;
  cin>>n;
  int a[n];
  for(int i = 0;i < n;i++) {
    cin>>a[i];
  }
  int tot = 0, prev = a[0];
  for(int i = 1;i < n;i++) {
    if(prev > a[i]) {
      tot += prev-a[i];
      a[i] = prev;
    }
    prev = a[i];
  }
  cout<<tot;
  cout<<endl;
  return 0;
}

Measured memory_bytes: 5128
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define REP1(i, n) for(int i = 1; i <= (n); i++)
#define REPD(i,a,b) for (int i=(a);i<=(b);i++)
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef set<int> si;
typedef vector<si> vsi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<int, int> pi;
typedef queue<int> qi;
typedef queue<pi> qpi;
typedef pair<ll, ll> pll;
typedef queue<pll> qpll;
typedef vector<pi> vpi;
typedef vector<pll> vpll;
const int mod = 1000000007;
const int INF = 1001001001;
// 小数点　<< fixed << setprecision(0) <<
// sort降順　sort(ALL(),greater<int>());
// 円周率　M_PI
// 文字判定　isupper islower
// 文字変換　
// 順列　do {} while(next_permutation(ALL(X)));
// 最大値　LLONG_MAX
// a内でx以上　auto iter = lower_bound(ALL(a), x);
// a内でxより大きい　auto iter = upper_bound(ALL(a), x);
int dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
int dy[8] = {0, 1, 0, -1, 1, -1, 1, -1};
struct edge {
    int from; //出発点
    int to;   //到達点
    int cost; //移動コスト
};
typedef struct edge se;
typedef vector<edge> ve;
unsigned Euclidean_gcd(unsigned a, unsigned b) {
  if(a < b) return Euclidean_gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

int digit_sum(int n) {
  int sum=n%10;
  while(n!=0) {
    n/=10;
    sum+=n%10;
  }
  return sum;
}

vpll PrimeFactorization(ll n) {
  vpll res;
  for (ll i=2; i*i<=n; i++) {
    if(n%i!=0) continue;
    ll ex=0;
    while(n%i==0) {
      ex++;
      n/=i;
    }
    res.push_back(pll(i,ex));
  }
  if(n!=1) res.push_back(pll(n,1));
  return res;
}




int main() {
  char s[27];
  cin >> s;
  int n=strlen(s);
  map<char,int> m;
  REP(i,n) {
    char x=s[i];
    m[x]++;
  }
  bool flg=true;
  for(const auto& [x, y]:m) {
    if(y>1) flg=false;
  }
  if(flg) cout << "yes" << endl;
  else cout << "no" << endl;
  return 0;
}


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

using namespace std;

#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

inline int toInt(string s) {int v; istringstream sin(s);sin>>v; return v;}

typedef long long ll;

int main(){
    string a, b, c;
    cin >> a >> b >> c;

    cout << (char)(a[0]-32);
    cout << (char)(b[0]-32);
    cout << (char)(c[0]-32);
    cout << endl;

    return 0;
}

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

int main() {
    int w, h, n;
    cin >> w >> h >> n;
    int maxx = w, maxy = h, minx = 0, miny = 0;

    for (int i = 0; i < n; i++)
    {
        int x, y, a;
        cin >> x >> y >> a;
        if (a == 1) minx = max(x, minx);
        else if (a == 2) maxx = min(x, maxx);
        else if (a == 3) miny = max(y, miny);
        else if (a == 4) maxy = min(y, maxy);
    }
    
    if (maxx >= minx && maxy >= miny) {
        cout << (maxx - minx) * (maxy - miny) << endl;
    } else {
        cout << 0 << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define watch(x) cout<<(#x)<<"="<<(x)<<'\n'
#define mset(d,val) memset(d,val,sizeof(d))
#define setp(x) cout<<fixed<<setprecision(x)
#define forn(i,a,b) for(int i=(a);i<(b);i++)
#define fore(i,a,b) for(int i=(a);i<=(b);i++)
#define pb push_back
#define F first
#define S second
#define pqueue priority_queue
#define fbo find_by_order
#define ook order_of_key
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef long double ld;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;
void amin(ll &a, ll b){ a=min(a,b); }
void amax(ll &a, ll b){ a=max(a,b); }
void SD(int t=0){ cout<<"PASSED "<<t<<endl; }
const ll INF = ll(1e18);
const int MOD = 998244353;

const int MAXN = 100005;

int n;
vii adj[MAXN];
int clr[MAXN];
ll Max=0;

void dfs(int u, int p, int c){
	//watch(u);
	for(ii tmp: adj[u]){
		int v=tmp.F, e=tmp.S;
		if(v==p) continue;
		clr[e]=c;
		
		c++;
		c%=Max;
		dfs(v,u,c);
	}
}

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	
	cin>>n;
	forn(i,0,n-1){
		int u,v; cin>>u>>v; u--; v--;
		adj[u].pb({v,i});
		adj[v].pb({u,i});
	}
	
	forn(i,0,n) Max=max(Max, (ll)adj[i].size());
	
	dfs(0,-1,0);
	
	cout<<Max<<'\n';
	forn(i,0,n-1){
		cout<<clr[i]+1<<'\n';
	}
	
	return 0;
}


Measured memory_bytes: 12796
// #pragma GCC target("avx2")
#pragma GCC optimize("O3", "unroll-loops")

// #include <bits/extc++.h>
// using namespace __gnu_pbds;

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

#define int long long
#define double long double
// template <typename T>
// using pbds_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
using pii = pair<int, int>;
template<typename T>
using prior = priority_queue<T, vector<T>, greater<T>>;
template<typename T>
using Prior = priority_queue<T>;

#define X first
#define Y second
#define ALL(x) (x).begin(), (x).end()
#define eb emplace_back
#define pb push_back

#define fastIO() ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define RANDOM() random_device __rd; \
                 mt19937 __gen = mt19937(__rd()); \
                 uniform_int_distribution<int> __dis(0, 1); \
                 auto rnd = bind(__dis, __gen);

const int INF = 1E18;
const int mod = 1E9 + 7;

int32_t main() {
    fastIO();
    
    int a, b;
    cin >> a >> b;
    
         if (a > 0)             cout << "Positive\n";
    else if (a <= 0 and b >= 0) cout << "Zero\n";
    else if ((b-a+1) & 1)       cout << "Negative\n";
    else                        cout << "Positive\n";
    
    return 0;
}

Measured memory_bytes: 256
object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val n = sc.nextInt()
  val as = List.fill(n)(sc.nextLong())
  val m = 1000000

  val factors = Array.fill(m + 1)(List[Long]())

  def primeFactors(n: Int, res: List[Long] = Nil): List[Long] = {
    if (n == 1) {
      res
    } else if (factors(n).nonEmpty) {
      factors(n) ++ res
    } else {
      var i = 2L
      var d = 0L
      while (d == 0 && i * i <= n) {
        if (n % i == 0) {
          d = i
        }
        i += 1
      }

      val ans = {
        if (d != 0) {
          primeFactors(n / d.toInt, d :: res)
        } else {
          n.toLong :: res
        }
      }.distinct
      factors(n) = ans
      ans
    }
  }

  def gcd(a: Long, b: Long): Long = {
    if (b == 0) a else gcd(b, a % b)
  }

  val pair = if (as.count(_ != 1) >= 80000) {
    false
  } else {
    val exist = Array.fill(m + 1)(false)
    var p = true
    as.map(a => primeFactors(a.toInt)).foreach(fs =>
      for (f <- fs) {
        if (exist(f.toInt)) {
          p = false
        } else {
          exist(f.toInt) = true
        }
      }
    )
    p
  }

  if (pair) {
    println("pairwise coprime")
  } else if (as.reduceLeft[Long] { case (x, y) => gcd(x, y) } == 1) {
    println("setwise coprime")
  } else {
    println("not coprime")
  }
}


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

int a[200];
int main(){
    int n;
    cin>>n;
    rep(i,n) cin>>a[i];
    int ans=1000100010;
    rep(i,n){
        int cnt=0,p=a[i];;
        while(p>0&&p%2==0){
            p/=2;++cnt;
        }
        ans=min(ans,cnt);
    }
    cout<<ans<<endl;
    return 0;
}

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

int main(void){
    int a,b; cin >> a >> b;
    if(a*b %2 == 0){
        cout << "Even" << endl;
    }else{
        cout << "Odd" << endl;
    }
    return 0;
}

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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int i = 0;i < (n);i++)
#define FOR(i, a, b) for(int i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

const int64 mod = 1e9+7;

int32 N;
vector<int64> A;
map<int64, int32> mp;

int main(void){
	cin >> N;
	A.resize(N);
	REP(i, N){
		cin >> A[i];
		mp[A[i]] = i;
	}
	sort(all(A));
	int32 cnt = 0;
	REP(i, N){
		cnt += (i%2 != mp[A[i]]%2);
	}
	cout << cnt/2 << endl;
}

Measured memory_bytes: 7296
#include <bits/stdc++.h>
using namespace std;
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}
typedef long long int ll;

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define endl "\n"
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
const double PI = acos(-1);
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//-------------------------------------

int n;
vector<ll> a;
vector<vector<ll>> memo(500, vector<ll>(500, LLINF));

// dp[l][r] := [l, r]をまとめるための最小コスト
ll dp(int l, int r) {
    if(memo[l][r] != LLINF) {
        return memo[l][r];
    }
    if(l >= r) {
        return 0;
    }
    ll res = LLINF;
    for(int i = l; i < r; i++) {
        chmin(res, dp(l, i) + dp(i + 1, r));
    }
    return memo[l][r] = res + (l == 0 ? a[r] : a[r] - a[l - 1]);
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n;
    a.resize(n);
    for(int i = 0; i < n; i++) {
        cin >> a[i];
    }
    for(int i = 1; i < n; i++) {
        a[i] += a[i - 1];
    }
    cout << dp(0, n - 1) << endl;
}

Measured memory_bytes: 2304
#include <iostream>
//#include <iomanip>
//#include <string>
//#include <vector>
//#include <algorithm>
//#include <utility>
//#include <set>
//#include <map>
//#include <queue>
//#include <deque>
//#include <bitset>
//#include <math.h>
using namespace std ;
using ll = long long ;
//using ld = long double ;
//using vll = vector<ll> ;
//using vvll = vector<vll> ;
//using vc = vector<char> ;
//using vvc = vector<vc> ;
//using vb = vector<bool> ;
//using vvb = vector<vb> ;
//using pll = pair<ll,ll> ;

//ll mod = 1000000007 ;
//long double pie = acos(-1) ;

//void yorn(bool a){if(a) cout << "Yes" << endl ; else cout << "No" << endl ;}
//void YorN(bool a){if(a) cout << "YES" << endl ; else cout << "NO" << endl ;}
//ll gcd(long long a,long long b){if(b==0) return a ; return gcd(b,a%b) ;}
//ll lcm(long long a,long long b){return a/gcd(a,b)*b ;}
//ll sa(long long a,long long b){if(a>b) return a-b ; return b-a ;}
//void mysort(vector<long long> &a){sort(a.begin(),a.end()) ;}
//void myrev(vector<long long> &a){reverse(a.begin(),a.end()) ;}

int main(){
	ll n ; cin >> n ;
	ll mn = 1000000000,mx = 0 ;
	for(int i=0;i<n;i++){
		ll a ; cin >> a ;
		if(a>mx) mx = a ;
		if(a<mn) mn = a ;
	}
	ll d = mx-mn ;
	if(d&1) cout << d/2+1 << endl ;
	else cout << d/2 << endl ;
}



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

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

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

	ll n;
	cin >> n;
	vector<ll> a(n);
	rep(i, n) cin >> a[i];

	sort(rall(a));

	ll h = 0, w = 0;
	for (int i = 0; i < n - 1; i++) {
		if (a[i] == a[i + 1]) {
			if (h == 0) {
				h = a[i];
			}
			else if(w == 0) {
				w = a[i];
			}
			i++;
		}
	}

	out(h * w);

	return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>

int main(void){
  int n, a;
  int b;

  scanf("%d", &n);
  scanf("%d", &a);

  b = n % 500;
  if (a >= b) {
    printf("Yes\n");
  }
  else {
    printf("No\n");
  }

  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define mod 1000000007
#define pb push_back
#define ll long long
using namespace std;
ll dp[109][2];
int main(){
	ll n,p,a[109];
	cin>>n>>p;
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}
	dp[0][0]=1;
	for(int i=1;i<=n;i++){
		if(a[i] % 2 == 0){
			dp[i][0] = 2*dp[i-1][0];
			dp[i][1] = 2*dp[i-1][1];
		}
		else{
			dp[i][0] = dp[i-1][1]+dp[i-1][0];
			dp[i][1] = dp[i-1][1]+dp[i-1][0];
		}
	}
	cout<<dp[n][p]<<endl;
	return 0;
}

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

using namespace std;

struct RECORD{
  int x;
  int y;
};

int main(){
  int i, j, k, l, n, w, h, loop;
  string tile[100];
  RECORD one;
  vector<RECORD> data;

  while(1){
    cin >> w >> h;
    if(w == 0 && h == 0) break;

    for(i=0; i<w; ++i)
      cin >> tile[i];

    i = 0;
    j = 0;
    loop = 0;
    while(1){
      k = i;
      l = j;

      if(tile[i][j] == '>'){
	++j;
      }else if(tile[i][j] == '<'){
	--j;
      }else if(tile[i][j] == '^'){
	--i;
      }else if(tile[i][j] == 'v'){
	++i;
      }else if(tile[i][j] == '.'){
	cout << j << " " << i << endl;
	break;
      }

      if(tile[i][j] != tile[k][l]){
	for(n=0; n<data.size(); ++n){
	  if(data[n].x == i && data[n].y == j){
	    cout << "LOOP" << endl;
	    loop = 1;
	    break;
	  }
	}

	if(loop == 1) break;
	one.x = i;
	one.y = j;
	data.push_back(one);
      }
    }

    data.clear();
  }

  return 0;
}

Measured memory_bytes: 0
n = int(input())
a = list(map(int, input().split()))
q = int(input())
bc = [list(map(int, input().split())) for _ in range(q)]
dic = {}
suma = sum(a)

for i in a:
    if i in dic:
        dic[i] += 1
    else:
        dic[i] = 1

for j in bc:
    dif = j[1] - j[0]
    if j[0] in dic:
        suma += dif * dic[j[0]]
    else:
        print(suma)
        continue
    if j[1] in dic:
        dic[j[1]] += dic.pop(j[0])
    else:
        dic[j[1]] = dic.pop(j[0])
    print(suma)

Measured memory_bytes: 37408
using System;

namespace at
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var a = Console.ReadLine().Split(' ');
            var k = long.Parse(a[0]);
            for (int i = 1; i < n; i++)
            {
                k = (Gcd(long.Parse(a[i]), k));
            }
            Console.WriteLine(k);
        }
        public static long Gcd(long a, long b)
        {
            if (a < b)
                // 引数を入替えて自分を呼び出す
                return Gcd(b, a);
            while (b != 0)
            {
                var remainder = a % b;
                a = b;
                b = remainder;
            }
            return a;
        }
    }
}


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

template<int MOD> struct modint{
    int val;
    constexpr modint(int v): val(v % MOD){
        if(val < 0) val += MOD;
    }
    constexpr int getmod(){
        return MOD;
    }
    constexpr modint operator-(){
        return val? MOD - val : 0; 
    }

    constexpr modint operator+(const modint& r){
        return modint(*this) += r;
    }
    constexpr modint operator-(const modint& r){
        return modint(*this) -= r;
    }
    constexpr modint operator*(const modint& r){
        return modint(*this) *= r;
    }
    constexpr modint operator/(const modint& r){
        return modint(*this) /= r;
    }


    constexpr modint& operator+=(const modint &r){
        val += r.val;
        if(val >= MOD) val -= MOD;
        return *this;
    }
    constexpr modint& operator-=(const modint& r){
        val -= r.val;
        if(val < 0) val += MOD;
        return *this;
    }
    constexpr modint& operator*=(const modint& r){
        val = (val * r.val) % MOD;
        return *this;
    }
    constexpr modint& operator/=(const modint& r){
        // ax + bz = a, ay + bw = b からスタートして
        // 右辺について互除法して係数を変えていく
        // (x, y) -> (y, x-y*(a/b)), (z, w) -> (w, z-w*(a/b))
        // 最終的に ax + bz = gcd(a, b) となるので a, b が互いに素なら x が逆元
        // z と w を覚えておく必要はない
        int a = r.val, b = MOD, x = 1, y = 0;
        while(b){
            x -= y * (a/b); swap(x, y);
            a -= b * (a/b); swap(a, b);
        }
        val = (val * x) % MOD;
        if(val < 0) val += MOD;
        return *this;
    }

    constexpr bool operator==(const modint& r){
        return val == r.val;
    }
    constexpr bool operator!=(const modint& r){
        return val != r.val;
    }

    constexpr modint modpow(int e){
        modint ans = 1, n = *this;
        while(e){
            if(e & 1) ans *= n;
            n *= n;
            e /= 2;
        }
        return ans;
    }

    friend constexpr ostream& operator<<(ostream &os, const modint<MOD>& x){
        return os << x.val;
    }
};

const int MOD = 1000000007;
using mint = modint<MOD>;

signed main(){
    // cout << fixed << setprecision(10) << flush;

    int n;
    cin >> n;
    vector<int> a(n), aa(n);
    bool flag = false;
    for(int i=0; i<n; i++){
        cin >> a[i];
        aa[i] = a[i];
        if(a[i]) flag = true;
    }

    vector<int> num_one;
    while(flag){
        int num = 0;
        flag = false;
        for(int i=0; i<n; i++){
            num += aa[i] % 2;
            aa[i] /= 2;
            if(aa[i]) flag = true;
        }
        num_one.push_back(num);
    }

    mint ans = 0;
    for(int i=0; i<n; i++){
        vector<int> num_ai(num_one.size());
        for(int d=0; d<num_one.size(); d++){
            num_ai[d] = a[i] % 2;
            a[i] /= 2;
        }
        mint num = 0;
        for(int d=num_one.size()-1; d>=0; d--){
            num = (num * 2 + num_one[d] + num_ai[d] * (-2*num_one[d] + n));
        }
        ans += num;
    }
    cout << ans/2 << endl;

    return 0;
}

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

int main() {
  string s;
  cin>>s;
  string ans;
  rep(i,s.size()){
  if(s[i]=='0') ans.push_back('0');
  if(s[i]=='1') ans.push_back('1');    
  if(s[i]=='B') {
    if(ans.size()<1){
      
    }else{
    ans.pop_back();
    }
  }
  }
  
  rep(i,ans.size()) cout<<ans[i];
  cout<<endl;
}

Measured memory_bytes: 256
n = int(input())
c = [int(input()) for _ in range(n)]

mod = 10**9 + 7

if n <= 2:
    print(1)
    exit()

# 圧縮
a = [c[0]]
m = 1
for c1, c2 in zip(c, c[1:]):
    if c2 != c1:
        a.append(c2)
        m += 1

memo = [-1] * (2 * 10**5 + 1)
ans = 1
dp = [0] * (m+1)
dp[0] = 1

for i in range(m):
    if memo[a[i]] == -1:
        memo[a[i]] = i
        dp[i+1] = dp[i]
    else:
        idx = memo[a[i]] + 1
        dp[i+1] += dp[i] + dp[idx]
        dp[i+1] %= mod
        memo[a[i]] = i

print(dp[m] % mod)

Measured memory_bytes: 23152
#include <stdio.h>

int main()
{
    int a, b, c;
    int temp;
    
    scanf("%d %d %d", &a, &b, &c);
    
    if (a > b) {
        temp = a;
        a = b;
        b = temp;
        if (b > c) {
            temp = b;
            b = c;
            c = temp;
            if (a > b) {
                temp = a;
                a = b;
                b = temp;
            }
        }
    } else {
        if (b > c) {
            temp = b;
            b = c;
            c = temp;
            if (a > b) {
                temp = a;
                a = b;
                b = temp;
            }
        }
    }
    printf("%d %d %d\n", a, b, c);
    return 0;
}


Measured memory_bytes: 2104
#include <algorithm>
#include <string.h>
#include <iostream>
#include <stdio.h>
#include <string>

using namespace std;

typedef long long ll;
const ll N = 2e5 + 10;
string s[N];
ll n;

int main() {
	cin >> n;

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

	ll t = 1;
	sort(s, s + n);
	for (int i = 1; i < n; i++) {
		if (s[i - 1] != s[i]) {
			t++;
		}
	}

	cout << t << endl;

	return 0;
}

Measured memory_bytes: 9888
// ========================================================================================================
// Library
// ========================================================================================================
#define _CRT_SECURE_NO_WARNINGS

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

// competitive macro
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b) - 1; i >= (a); i--)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i ,n) for (int i = (n) - 1; i >= 0; i--)
#define LL long long
#define ULL unsigned long long

void fastIOS()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
}
// ========================================================================================================
// ========================================================================================================

int main()
{
	fastIOS();

	int n , k , x , y;
    cin >> n  >> k >> x >> y;
    
    if(n>= k){
    int sum = x*k + y* (n-k);
    
    cout << sum << endl;
    }
    
    else {
        cout << x*n << endl;
    }
    
    return 0;
}

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

int main(){
	int a,b,m;
	scanf("%d%d%d",&a,&b,&m);
	int arr[a],brr[b];
	int ans=1000000010;
	int mina=1000000010,minb=1000000010;
	for(int i=0;i<a;i++){
		scanf("%d",&arr[i]);
		mina=min(mina,arr[i]);
	}
	for(int i=0;i<b;i++){
		scanf("%d",&brr[i]);
		minb=min(minb,brr[i]);
	}
	int x,y,c;
	for(int i=0;i<m;i++){
		scanf("%d%d%d",&x,&y,&c);
		ans=min(ans,arr[x-1]+brr[y-1]-c);
	}
	printf("%d",min(ans,mina+minb));
}

Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cmath>
#include <iomanip>
#include <string>
#include <queue>
#include <list>
#include <stack>

typedef long long ll;
using namespace std;
const int mod = 1000000007;

void bfs(int node);
vector< vector<int> > Adj(100, vector<int>(100));
vector<int> dist(100, -1);
int n;

int main() {

    // input
    cin >> n;
    for (int i = 0; i < n; i++) {
        int u, k; cin >> u >> k;
        for (int j = 0; j < k; j++) {
            int v; cin >> v; v--;
            Adj[i].push_back(v);
        }
    }

    dist[0] = 0;
    bfs(0);

    for (int i = 0; i < n; i++) {
        cout << i + 1 << ' ' << dist[i] << '\n';
    }

}

void bfs(int node) {

    queue<int> q;
    q.push(node);

    while (!q.empty()) {
        int cur = q.front();
        q.pop();
        for (int i = 0; i < Adj[cur].size(); i++) {
            int v = Adj[cur][i];
            // visited
            if (dist[v] != -1) {
                continue;
            }
            // not visited
            else {
                dist[v] = dist[cur] + 1;
                q.push(v);
            }
        }
    }

}



Measured memory_bytes: 3232
using System;

namespace AtCoder.BC087
{
    public class B
    {
        public static void Main()
        {
            int count = 0;
            int a, b, c, x;
            a = int.Parse(Console.ReadLine());
            b = int.Parse(Console.ReadLine());
            c = int.Parse(Console.ReadLine());
            x = int.Parse(Console.ReadLine());

            for (int i = 0; i <= a; i++)
            {
                for (int j = 0; j <= b; j++)
                {
                    for (int k = 0; k <= c; k++)
                    {
                        int tmp = (500 * i) + (100 * j) + (50 * k);
                        if (tmp == x) count++;
                    }
                }
            }
            Console.WriteLine(count);
        }
    }
}

Measured memory_bytes: 27440
#include <iostream>
#include <string>
#include <vector>
#include <iterator>  // std::prev(iter, n) n 個分デクリメントしたイテレータ
#include <tuple>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <stack>
#include <queue>
#include <algorithm>
#include <functional>  // std::greater<T>()
#include <utility>  // std::swap()
#include <numeric>  // accumulate(ALL(vec), 0)  0 は初期値
#include <bitset>  // static_cast<std::bitset<8>>
#include <sstream>  // std::stringstream
#include <cmath>
#include <climits>  // INT_MIN
#include <cctype>  // std::isdigit()
#include <iomanip>  // std::setprecision()
using namespace std;
using ll = long long;

#define REP(i, n) for (ll i=0; i < n; i++)  // 0 ~ n-1
#define MIN(vec) min_element(vec.begin(), vec.end())  // イテレータのため、値を取り出すときは * を先頭につける
#define MAX(vec) max_element(vec.begin(), vec.end())
#define IDX(vec, element_iter) distance((vec).begin(), element_iter)
#define SUM(vec) accumulate(vec.begin(), vec.end(), 0LL)  // 0 は初期値
#define pll pair<ll, ll>
#define F first
#define S second
const ll INF = 1LL<<60;  // 10^18（const int inf   = 1<<29;）

ll dp[100010];  // 状態数よりやや多く確保

int main() {
    // input(sunippets: inpv, inpn, inps)
    ll N;
    cin >> N;
    vector<ll> vec(N);
    REP(i, N) cin >> vec[i];
    
    // calculation
    // dp table 初期化
    REP(i, N) dp[i] = INF;  // 最小化問題のため INF で初期化
    dp[0] = 0;  // 初期条件

    // calc
    // 一個前までの値との差分を取る
    for (ll i = 1; i < N; ++i) {
        if (i == 1) {
            dp[i] = dp[i-1] + abs(vec[i]-vec[i-1]);
        } else {
            ll one = dp[i-1] + abs(vec[i] - vec[i-1]);
            ll two = dp[i-2] + abs(vec[i] - vec[i-2]);
            dp[i] = min(one, two);
        }
    }
    
    cout << dp[N-1] << "\n";
    
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
	using namespace std;
	typedef long long ll;
	#define endl "\n"
	#define space " "
	#define ll long long int
	#define vl vector<ll>
	#define vvl vector < vll >
	#define pii pair<int,int>
	#define pll pair<ll,ll>
	#define vpl vector < pll >
	#define mod 1000000007
	#define pi 3.1415926535897932384626433
	#define inf 1000000000000000001;
	#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
	#define all(c) c.begin(),c.end()
	#define mp(x,y) make_pair(x,y) 
	#define mem(a,val) memset(a,val,sizeof(a))
	#define pb push_back
	#define f first
	#define s second
	
	void solve()
	{
		ll n; cin>>n;
		ll a=0,b=0,c=0,d=0;
		std::vector<string> v;
		for (ll i = 0; i < n; ++i)
		{
			/* code */
			string s; cin>>s;
			v.pb(s);
		}
		for (int i = 0; i < v.size(); ++i)
		{
			/* code */

			if(v[i]=="AC") a++;
			else if(v[i]=="WA") b++;
			else if(v[i]=="TLE") c++;
			else if(v[i]=="RE") d++;
		}
		cout<<"AC x "<<a<<endl;
		cout<<"WA x "<<b<<endl;
		cout<<"TLE x "<<c<<endl;
		cout<<"RE x "<<d<<endl;
	}

	signed main()
	{

	fast;
	#ifndef ONLINE_JUDGE
      freopen("input.txt", "r", stdin);
      freopen("output.txt", "w", stdout);
     #endif

	ll T=1;
	// cin>>T;
	while(T--)
	{
		solve();
	}
	return 0;
	}


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

using namespace std;

int main(){

	
    LL n,k;
	cin>> n>> k;
    //unordered_set<LL> s;
    int d = abs(n - k);
    LL mn = min(n%k,k - (n%k));
        
    cout<<mn<<endl;
}

/*






if k > n
    k 

n k 
n -> n - k, n - 2k
2 6

3 4

2 -> 4 -> 2



7 4

7 -> 3 -> 1 -> 

if n > k
    n = n%k
    n - m.k = r
else

*/

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
using namespace std;
static const int MAX = 10000;
static const int INFTY(1 << 20);
static const int WHITE = 0;
static const int GRAY = 1;
static const int BLACK = 2;

int n;
vector<pair <int, int > >adj[MAX];

void dijkstra() {
	priority_queue<pair <int, int> > PQ;
	int color[MAX];
	int d[MAX];
	for (int i = 0; i < n; i++) {
		d[i] = INFTY;
		color[i] = WHITE;
	}

	d[0] = 0;
	PQ.push(make_pair(0, 0));
	color[0] = GRAY;

	while (!PQ.empty()) {
		pair<int, int> f = PQ.top(); PQ.pop();
		int u = f.second;
		color[u] = BLACK;

		if (d[u] < f.first*(-1))continue;

		for (int j = 0; j < adj[u].size(); j++) {
			int v = adj[u][j].first;
			if (color[v] == BLACK)continue;
			if (d[v] > d[u] + adj[u][j].second) {
				d[v] = d[u] + adj[u][j].second;
				PQ.push(make_pair(d[v] * (-1), v)); //PQはデフォルトで大きい値を優先するため-1かける
				color[v] = GRAY;

			}
		}

	}

	for (int i = 0; i < n; i++) {
		cout << i << " " << (d[i] == INFTY ? -1 : d[i]) << endl;
	}
}


int main() {
	cin >> n;

	int k, u, v, c;

	for (int i = 0; i < n; i++) {
		cin >> u >> k;
		for (int j = 0; j < k; j++) {
			cin >> v >> c;
			adj[u].push_back(make_pair(v, c));
		}
	}

	dijkstra();

	return 0;
}


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

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

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repto(i, n) for(int i = 0; i <= (n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define _1 first
#define _2 second
#define pb push_back
#define mp make_pair
#define INF 1145141919
#define MOD 1000000007
#define DEBUG(x) cout << #x << ": " << x << endl;
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }

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

  ll x;
  cin >> x;
  ll s = 100;
  int i = 0;
  while(1) {
    i++;
    s += s/100;
    if (s >= x) {
      cout << i << endl;
      break;
    }
  }
}


Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define pb push_back
#define mp make_pair
#define fi first
#define se second
const ll inf = 1e16;
const ll mod=1000000007;
typedef pair<ll,ll> pi;

void solve()
{
ll x,k,d;
cin>>x>>k>>d;
x=abs(x);
ll temp=x/d;
if(temp>=k || (k-temp)%2==0)
{
    ll ans=x-min(temp,k)*d;
    cout<<ans;
    return;
}
ll ans=x-temp*d;
ll fir=ans-d;
ll sec=ans+d;
ll res=min(abs(fir),abs(sec));
cout<<res;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t;
    t=1;
    for(ll i=1;i<=t;i++)
    {
        solve();
        cout<<endl;

    }
    return 0;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define DAU  ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define PLEC exit(0);
//#define int long long
using namespace std;
string s;
main() {
    DAU
    cin >> s;
    if (s[0] == s[1] || s[1] == s[2] || s[2] == s[3])
        cout << "Bad";
    else cout << "Good";
    PLEC
}


Measured memory_bytes: 3584
#include<bits/stdc++.h>
using namespace std;
int N;
int A[220000];

int main(void){

    cin >> N;

    for (int i = 0;i < N;i++) {
        cin >> A[i];
    }
    sort (A, A+N, greater<int>()); 
    long long ans = 0;
    for (int i = 0;i < N - 1;i++) {
        ans += A[(i + 1)/2];
    }
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 4404
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
#include<bitset>
#include<stack>
#include<memory>
using namespace std;
typedef long long int llint;
typedef long double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
/*
cout<<fixed<<setprecision(20);
cin.tie(0);
ios::sync_with_stdio(false);
*/
const llint mod=1000000007;
const llint big=2.19e18+1;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-15;
template <class T,class U>bool mineq(T& a,U b){if(a>b){a=b;return true;}return false;}
template <class T,class U>bool maxeq(T& a,U b){if(a<b){a=b;return true;}return false;}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){if(a==0){return b;}return a/gcd(a,b)*b;}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
template<class T>llint LBI(vector<T>&ar,T in){return lower_bound(ar.begin(),ar.end(),in)-ar.begin();}
template<class T>llint UBI(vector<T>&ar,T in){return upper_bound(ar.begin(),ar.end(),in)-ar.begin();}
int main(void){
	int n,i;cin>>n;
	vector<vector<int>>go(n);
	vector<int>zi(n);
	for(i=0;i<n;i++){
		int u,v;cin>>u>>v;u--;v--;
		go[u].pub(v);
		go[v].pub(u);
		zi[u]++;zi[v]++;
	}
	queue<int>que;
	vector<bool>ki(n);
	for(i=0;i<n;i++){if(zi[i]==1){que.push(i);ki[i]=1;}}
	while(que.size()){
		int t=que.front();que.pop();
		for(auto it:go[t]){
			if(ki[it]){continue;}
			zi[it]--;
			if(zi[it]==1){que.push(it);ki[it]=1;}
		}
	}
	int Q;cin>>Q;
	while(Q--){
		int a,b;cin>>a>>b;a--;b--;
		cout<<((ki[a]||ki[b])?1:2)<<endl;
	}
	return 0;
}


Measured memory_bytes: 8696