akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
#define pb push_back
#define pii pair < int, int >
#define F first
#define S second
#define int  long long int
#define sync ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#pragma GCC optimize ("Ofast")
#pragma GCC optimize ("O2")
#pragma GCC optimize ("unroll-loops")
using namespace std;
/// age ye mosh dp ro baze dashti dp tedad baz shodeye baste nashode yadet nare !!

int32_t main(){
    sync;
    string s;
    cin >> s;
    ll ans=0;
    ll n=s.size();
    ll z=0;
    vector <int> a;
    for (int i=0;i<n;i++){
       // cout << i << z << endl;
        if (z%2==0){
            ll k=i;
            while(k<n && s[k]=='<'){
                k++;
            }
            a.pb(k-i);
            i=k-1;
            z++;
            continue;
        }
        if (z%2==1){
            ll k=i;
            while(k<n && s[k]=='>'){
                k++;
            }
            a.pb(k-i);
            i=k-1;
            z++;
            continue;
        }
    }
    if (a.size()%2==1){
        a.pb(0);
    }
    for (int i=0;i<a.size();i+=2){
        if (a[i]>a[i+1]){
            ans+=a[i]*(a[i]+1)/2;
            ans+=(a[i+1]-1)*a[i+1]/2;
        }
        else{
            ans+=a[i]*(a[i]-1)/2;
            ans+=(a[i+1]+1)*a[i+1]/2;
        }
    }
    cout << ans;
}













Measured memory_bytes: 3352
import sys
sys.setrecursionlimit(10 ** 9)

N, M = map(int, input().split())
G = [[] for i in range(N)]
G_rev = [set() for i in range(N)]
for i in range(N - 1 + M):
    a, b = map(int, input().split())
    a, b = a - 1, b - 1
    G[a].append(b)
    # 親と子を逆に
    G_rev[b].add(a)


def topological_sort(g):
    topological_list = []
    visited = set()

    def dfs(n):
        for e in g[n]:
            if e not in visited:
                dfs(e)
        topological_list.append(n)
        visited.add(n)

    for i in range(len(g)):
        if i not in visited:
            dfs(i)

    return topological_list[::-1]


topological_order = topological_sort(G)


parents = [set(G_rev[i]) for i in range(N)]
for t in topological_order[::-1]:
    for p in G_rev[t]:
        parents[t] |= parents[p]


ans = [-1] * N
for t in topological_order:
    for child in G[t]:
        for p in G_rev[child]:
            if t in parents[p]:
                flg = True
                break
        else:
            ans[child] = t

for a in ans:
    print(a + 1)


Measured memory_bytes: 117040
import java.util.Scanner;


public class Main{

	public static void main(String[] args) {

		Scanner s = new Scanner(System.in);
		int a = s.nextInt();
		int[] values = new int[a];
		String sr[] = new String[a];
		String str = "";

		for(int i=0 ; i<sr.length ; i++) {
			values[i] = s.nextInt();
		}
		String disp = "";
		for(int j=0 ; j<values.length ; j++) {
			disp += values[j];
			if(j+1<values.length)
				disp += " ";
		}
		System.out.println(disp);
		solve(values);
	}

	public static void solve(int[] values) {
		for(int i=1 ; i<values.length ; i++) {
			int targetV = values[i];
			int movableIndex = i - 1;
			while(movableIndex >= 0 && values[movableIndex] > targetV) {
				values[movableIndex + 1] = values[movableIndex];
				movableIndex--;
			}
			values[movableIndex + 1] = targetV;
			String disp = "";
			for(int j=0 ; j<values.length ; j++) {
				disp += values[j];
				if(j+1<values.length)
					disp += " ";
			}
			System.out.println(disp);
		}
	}
}

Measured memory_bytes: 55304
N,M,C = map(int,input().split())
Blist = list(map(int,input().split()))
Alist = [list(map(int,input().split())) for i in range(N)]

counter = 0

for x in range(N):
    all = C
    xlist = Alist[x]
    for j in range(M):
        all += Blist[j]*xlist[j]
    if all>0:
        counter += 1

print(counter)


Measured memory_bytes: 3060
/*
    Author:zeke
    
    pass System Test!
    GET AC!!
*/
#include <iostream>
#include <queue>
#include <vector>
#include <iostream>
#include <vector>
#include <string>
#include <cassert>
#include <algorithm>
#include <functional>
#include <cmath>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <map>
#include <iomanip>
#include <utility>
#include <stack>
#include <bitset>
using ll = long long;
using ld = long double;
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define rep3(var, min, max) for (ll(var) = (min); (var) < (max); ++(var))
#define repi3(var, min, max) for (ll(var) = (max)-1; (var) + 1 > (min); --(var))
#define Mp(a, b) make_pair((a), (b))
#define F first
#define S second
#define Icin(s) \
    ll(s);      \
    cin >> (s);
#define Scin(s) \
    ll(s);      \
    cin >> (s);
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef vector<V> VV;
typedef vector<P> VP;
//ll mod = 1e9 + 7;
//ll MOD = 1e9 + 7;
ll INF = 1e18;

struct RollingHash
{
    typedef long long lint;
    const string str;
    const lint base, mod;
    const V tempvec;
    vector<lint> hash, pw;

    RollingHash(V &s, lint h = 1000000007, lint b = 1009) : tempvec(s), mod(h), base(b)
    {
        int l = s.size();
        hash.assign(l + 1, 0);
        pw.assign(l + 1, 0);
        pw[0] = 1;
        for (int i = 0; i < l; ++i)
        {
            pw[i + 1] = pw[i] * base % mod;
            hash[i + 1] = (hash[i] * base + s[i]) % mod;
        }
    }

    lint const get_hash(int l, int r)
    {
        return ((hash[r] - hash[l] * pw[r - l]) % mod + mod) % mod;
    }
};

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin >> n;
    V Vec1(n);
    rep(i, n) cin >> Vec1[i];
    V Vec2(n);
    rep(i, n) cin >> Vec2[i];
    V vec1(n);
    V vec2(n);
    rep(i, n)
    {
        vec1[i] = Vec1[i] ^ Vec1[(i + 1) % n];
        vec2[i] = Vec2[i] ^ Vec2[(i + 1) % n];
    }
    rep(i,n){
        vec1.push_back(vec1[i]);
    }
    RollingHash tree(vec1, 1e9 + 7, 1e3 + 7);
    RollingHash tree2(vec1, 999999937, 1e3 + 7);
    RollingHash tree5(vec1, 1000000033, 1e3 + 7);
    RollingHash tree3(vec2, 1e9 + 7, 1e3 + 7);
    RollingHash tree4(vec2, 999999937, 1e3 + 7);
    RollingHash tree6(vec2, 1000000033, 1e3 + 7);
    VP res;
    //  cout<<s<<" "<<t<<endl;
    rep(i, n)
    {
        ll s_hash = tree.get_hash(i, i + n);
        ll t_hash = tree3.get_hash(0, n);
        ll s_hash2 = tree2.get_hash(i, i + n);
        ll t_hash2 = tree4.get_hash(0, n);
        ll s_hash3 = tree5.get_hash(i, i + n);
        ll t_hash3 = tree6.get_hash(0, n);
        if (s_hash == t_hash && s_hash2 == t_hash2 && s_hash3 == t_hash3)
        {
            res.push_back({i, Vec1[i] ^ Vec2[0]});
        }
    }
    rep(i, res.size())
    {
        cout << res[i].F << " " << res[i].S << endl;
    }
}


Measured memory_bytes: 58720
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using static kyoupuro.Input;
using static kyoupuro.MyMath;

namespace kyoupuro {

    class MainClass {

        public static void Main() {
            var x = NextInt();
            var y = NextInt();

            Console.WriteLine(Math.Max(0, x - y));
        }
    }

    class MyMath {
        static long Gcd(long a, long b) {
            return b == 0 ? a : Gcd(b, a % b);
        }
    }

    class Input {
        static IEnumerator<string> enumerator = new string[] { }.AsEnumerable().GetEnumerator();

        public static string Line() {
            return Console.ReadLine();
        }

        public static int NextInt() {
            while (!enumerator.MoveNext()) {
                enumerator = StrArr().AsEnumerable().GetEnumerator();
            }
            return int.Parse(enumerator.Current);
        }

        public static long NextLong() {
            while (!enumerator.MoveNext()) {
                enumerator = StrArr().AsEnumerable().GetEnumerator();
            }
            return long.Parse(enumerator.Current);
        }

        public static string[] StrArr() {
            return Line().Split(' ');
        }

        public static List<int> IntList() {
            return StrArr().Select(int.Parse).ToList();
        }

        public static List<long> LongList() {
            return StrArr().Select(long.Parse).ToList();
        }

        public static void Skip(int line = 1) {
            enumerator.Reset();
            for (int i = 0; i < line; i++) Console.ReadLine();
        }

        public static void Reset() {
            enumerator.Reset();
        }
    }
}

Measured memory_bytes: 13268
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define dup(x,y) (((x)+(y)-1)/(y))
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> pii;
const double EPS = 1e-10;
const int INF = 1e9;
const ll LINF = 1e15;
const int MOD = 1000000007;
const double PI = acos(-1);
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};

int main() {
	int n;
	cin >> n;
	vector<int> v(n+2);
	v[0] = 0;
	v[n+2-1] = 0;
	rep(i,n) {
		cin >> v[i+1];
	}

	ll sum = 0;
	rep(i,n+1) {
		sum += abs(v[i] - v[i+1]);
	}

	for (int i = 0; i < n; i++) {
		int a = v[i];
		int b = v[i+1];
		int c = v[i+2];
		if ((a <= b && b <= c) || (c <= b && b <= a)) {
			cout << sum << endl;
		} else {
			if (a <= b && b >= c) {
				if (c <= a) cout << sum - 2*abs(b-a) << endl;
				 else cout << sum - 2*abs(b-c) << endl;
			} else {
				if (c <= a) cout << sum - 2*abs(b-c) << endl;
				else cout << sum - 2*abs(b-a) << endl;
			}
		}
	}
}

Measured memory_bytes: 3748
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second

const int mx=200010;
const ll mod=1e9+7;

int main(){
  int x,y,a,b,c;
  cin >> x >> y >> a >> b >> c;
  vector<ll> p(a); rep(i,a){cin>>p[i];} sort(p.rbegin(),p.rend());
  vector<ll> q(b); rep(i,b){cin>>q[i];} sort(q.rbegin(),q.rend());
  priority_queue<ll> m;
  vector<ll> r(c); rep(i,c){cin>>r[i]; m.push(r[i]);}  //sort(r.rbegin(),r.rend());
  priority_queue<ll,vector<ll>,greater<ll>> eat;
  ll ans=0;
  rep(i,x){ eat.push(p[i]); ans+=p[i]; }
  rep(i,y){ eat.push(q[i]); ans+=q[i]; }
  while(!m.empty()){
    if(eat.top()<m.top()){
      int e = eat.top(); eat.pop();
      ans -= e;
      int n = m.top(); m.pop();
      ans += n;
    } else {
      break;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 5492
#include <stdio.h>

int main(void)
{
    int A = 0, B = 0, C = 0, D = 0, res = 0;
    
    scanf("%d", &A);
    scanf("%d", &B);
    scanf("%d", &C);
    scanf("%d", &D);
    
    if(A >= B){
        res = B;
    }else {
        res =  A;
    }
    
    if(C >= D){
        res = res + D;
    }else {
    
        res = res + C;
    }
    
    printf("%d", res);
    
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
    int n;
    vector <int> data(200001,0);
    cin >> n;
    int x;
    for(int i=0;i<n-1;i++){
        cin >>x;
        data.at(x-1)+=1;
    }
    for(int i=0;i<n;i++){
        cout << data.at(i) <<endl;
    }
}


Measured memory_bytes: 3852
#include <iostream>
#include <cstdio>
#include <string.h>
#include <vector>
#include <limits>
#include <algorithm>
#include <stdlib.h>
#include <math.h>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <assert.h>
#include <sstream>
#include <type_traits>
#define SET(x,y) x |= (1 << y)
#define CLEAR(x,y) x &= ~(1<< y)
#define READ(x,y) ((0u == (x & (1<<y)))?0u:1u)
#define TOGGLE(x,y) (x ^= (1<<y))
#define watch(x) cout << (#x) << " is " << (x) << endl
#define pb push_back
#define mp make_pair
#define si(n) scanf("%d",&n)
#define sf(n) scanf("%f",&n)
#define sl(n) scanf("%lld",&n)
#define slu(n) scanf("%llu",&n)
#define sd(n) scanf("%lf",&n)
#define ss(n) scanf("%s",n)
#define pnl printf("\n")
#define ll long long
#define pii pair<int, int>
#define pll pair<long long, long long>
#define pF first
#define pS second
#define CL(a,b) memset(a,b,sizeof(a))
#define sqr(x) ((x)*(x))
#define intLIMIT numeric_limits<int>
#define longLIMIT numeric_limits<long long>
#define GCD(a,b) __gcd((a),(b))
#define dbl(x) (double)(x)
#define vi vector <int>
#define vii vector < pair <int, int> >
#define vll vector <long long>
#define allof(x) (x).begin(), (x).end()
#define fastCin cin.sync_with_stdio(0);cin.tie(0)
#define scanUnsigned(x) do{while((x=getchar())<'0'); for(x-='0'; '0'<=(_=getchar()); x=(x<<3)+(x<<1)+_-'0');}while(0)
#define printArr(a,l) cout<<#a<<": ";for(int i=0;i<(l);i++){cout<<a[i]<<" ";}cout<<endl
#define print2dArr(a,r,c) cout<<#a<<":\n";for(int i=0;i<(r);i++){for(int j=0;j<(c);j++){cout<<a[i][j]<<" ";}cout<<endl;}
char _;
using namespace std;
void PRINT (int x, int y) { for (int i = y-1; i >= 0; i--) { cout << READ(x,i); } cout << endl; }

vector<string>vec_splitter(string s){s+=',';vector<string>res;while(!s.empty()){res.push_back(s.substr(0,s.find(',')));s=s.substr(s.find(',')+1);}
return res;}
void debug_out(vector<string>__attribute__((unused))args,__attribute__((unused))int idx,__attribute__((unused))int LINE_NUM){cerr<<endl;}
template<typename Head,typename...Tail>void debug_out(vector<string>args,int idx,int LINE_NUM,Head H,Tail...T){if(idx>0)cerr<<", ";else cerr<<"Line("<<LINE_NUM<<") ";stringstream ss;ss<<H;cerr<<args[idx]<<" = "<<ss.str();debug_out(args,idx+1,LINE_NUM,T...);}
#ifdef LOCAL_DBG
#define dbg(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
#else
#define dbg(...) 42
#endif

int main () {
	fastCin;
	int n, ans = 0;
	ll d, a, b;
	cin >> n >> d;
	for (int x = 0; x < n; x++) {
		cin >> a >> b;
		if (a*a + b*b <= d*d) {
			ans++;
		}
	}
	cout << ans << "\n";
	return 0;
}

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

signed main(){
    string s,t,u; cin>>s>>t>>u;
    char a='A'+(s.at(0)-'a'),b='A'+(t.at(0)-'a'),c='A'+(u.at(0)-'a');
    cout<<a<<b<<c;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <cmath>
#include <string>
#include <sstream>
#include <iomanip>
#include <complex>
using namespace std;

#define ll long long
#define vvi vector< vector<int> >
#define vi vector<int>
#define All(X) X.begin(),X.end()
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define pii pair<int,int>
#define mp make_pair
#define pi 3.14159265359
#define shosu(X) fixed << setprecision(X)
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}


int main(){
	int h,w;
	vector<pair<int,pair<int,int> > > data;
	FOR(i,1,151){
		FOR(j,i+1,151){
			int tai = i*i+j*j;
			data.push_back(make_pair(tai,make_pair(i,j)));
		}
	}
	sort(All(data));
	while(1){
		cin >> h >> w;
		if(h==0&&w==0) break;
		REP(i,data.size()){
			if(data[i].first==h*h+w*w && data[i].second.first==h && data[i].second.second==w){
				cout << data[i+1].second.first << " "  << data[i+1].second.second << endl;
				i = data.size();
			}
		}
	}
}

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

namespace B
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            Console.WriteLine(1.0/Console.ReadLine().Split(' ').Select(item => 1.0/int.Parse(item)).Sum());

            
        }
    }
}


Measured memory_bytes: 11220
/* -----------------------------------------------------------------------------
	????????????????????? 2012 ?????? ??????5 
	???????????????????????????????????????(?????????) C++?¨????
	g++ pckpre1205.cpp -O2
----------------------------------------------------------------------------- */
#include <iostream>
#include <algorithm>
#include <vector> 

using namespace std;

#define PIPE_MAX 65000

int main() {

	int		n;						// ???????????¬??°
	int 	pipe[PIPE_MAX];			// ??????????????????
	vector<int>	joint;				// ?????§??????????????????
	
	long long		jp;						// ????????¨???????????§??????????????????
	long long		L, L_max;				// ?????????+?????§????????????????????????
	long long		mul;					// ??????
	long long		wage;	// ??????

	// ???????????¬??°???????????????
	cin >> n;

	while(n > 0) {

		// ?????????????????????????????????
		for(int i = 0; i < n; i++)
			cin >> pipe[i];

		// ?????????????????????????????????
		for(int i = 1; i < n; i++) {
			int x;	cin >> x; joint.push_back(x); 
		}

		// ???????????????????????´????????????
		sort(joint.begin(), joint.end());

		// ????????¨???????????§??????????????????
		jp = n-2;
		
		// ????????????????????????
		L = 0;
		for(int i = 0; i < n; i++) L += pipe[i];
		L_max = L; mul = n;

		// ???????????§???????±???????
		for(int i = n - 1; i >= 0; i--) {
			// 
			if(L_max * mul < (L + joint[jp]) * i) {
				// ?????§??????????????????????????????+?????§???????????????????????????????¨???¶
				L_max = L + joint[jp]; mul = i;
			}
			// ??´??°
			L += joint[jp];
			jp--;
		}
				
		// ?????§???????????¨???
		cout << L_max * mul << endl;

		// ???????????¬??°???????????????
		cin >> n;
		joint.clear();
	}

	return 0;
}

Measured memory_bytes: 1796
#include <iostream>
#include <vector>
#include <queue>
#include <sstream>
#include <algorithm>
#include <bitset>
#include <limits>
#include <map>
#include <set>
#include <iomanip>
#include <cmath>

using namespace std;

typedef long long int ll;
typedef std::numeric_limits<double> dbl;
const long long int LL_INF=1LL<<60;

vector<string> split(const string& input, char delimiter)
{
    stringstream stream(input);
    
    string field;
    vector<string> result;
    while (getline(stream, field, delimiter)) {
        result.push_back(field);
    }
    return result;
}

//#define DEBUG

ll A, B, M, N, D, K, Q, W, H, T, X, Y;

int main()
{
    cin >> N >> M;
    vector<string> sA(N), sB(M);
    for (auto& a : sA)
        cin >> a;
    for (auto& b : sB)
        cin >> b;

    for (int i = 0; i < N - M + 1; ++i) {
        for (int j = 0; j < N - M + 1; ++j) {
            bool match = true;
            for (int k = 0; k < M; ++k) {
                for (int l = 0; l < M; ++l) {
                    if (sB[k][l] != sA[i + k][j + l])
                        match = false;
                }
            }
            if (match) {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }

    cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Split(bufio.ScanWords)
	log.SetFlags(log.Lshortfile)
	s := nextString()
	weather := "Sunny"
	switch s {
	case "Sunny":
		weather = "Cloudy"
	case "Cloudy":
		weather = "Rainy"
	}
	fmt.Println(weather)
}

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

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

var dy = []int{0, 1, 0, -1}
var dx = []int{1, 0, -1, 0}
var MAX = math.MaxInt32

func pow(a, b int) int {
	return int(math.Pow(float64(a), float64(b)))
}

func lcm(a, b int) int {
	return a * b / gcd(a, b)
}
func gcd(a, b int) int {
	if a < b {
		a, b = b, a
	}
	for b != 0 {
		a, b = b, a%b
	}
	return a
}
func max(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r < a[i] {
			r = a[i]
		}
	}
	return r
}
func min(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r > a[i] {
			r = a[i]
		}
	}
	return r
}
func sum(a []int) (r int) {
	for i := range a {
		r += a[i]
	}
	return r
}
func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

type pair struct {
	a, b int
}

type pairs []pair

func (p pairs) Len() int {
	return len(p)
}
func (p pairs) Swap(i, j int) {
	p[i], p[j] = p[j], p[i]
}

func (p pairs) Less(i, j int) bool {
	if p[i].a == p[j].a {
		return p[i].b < p[j].b
	}
	return p[i].a < p[j].a
}


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

int main() {
    int t, p, r;
    while (cin >> t >> p >> r, (t or p or r)) {
        int ac[t+1], wa[t+1][p+1], tm[t+1], wan[t+1];

        fill(ac, ac+t+1, 0);
        fill(tm, tm+t+1, 0);
        fill(wan, wan+t+1, 0);
        fill(wa[0], wa[t+1], 0);

        rep(i, r) {
            int td, pd, t;
            string st;
            cin >> td >> pd >> t >> st;
            td--;
            pd--;
            if (st == "WRONG") {
                wa[td][pd] += 1;
                wan[td] += 1;
            }
            else if (st == "CORRECT") {
                tm[td] += wa[td][pd] * 1200 + t;
                ac[td] += 1;
            }
        }

        rep(i, t) {

            bool ok=false;
            int a = 0;
            rep(i, t) {
                a = max(a, ac[i]);
            }
            int f=0, team=0;
            rep(i, t) {
                if (a == ac[i] and ac[i] != -1) {
                    f++;
                    team = i;
                }
            }
            if (f == 1) {
                cout << team+1 << ' ' << ac[team] << " " << tm[team] << endl;
                ok = true;
                ac[team] = -1;
                continue;
            }

            if (!ok) {

                int w=1e8;
                rep(i, t) {
                    if ( a == ac[i]) {
                        w = min(w, tm[i]);
                    }
                }

                int f=0, team=0;
                rep(i, t) {
                    if (w == tm[i] and ac[i] != -1) {
                        f++;
                        team = i;
                    }
                }

                if (f == 1) {
                    cout << team+1 << ' ' << ac[team] << " " << tm[team] << endl;
                    ok=true;
                    ac[team] = -1;
                    continue;
                }

                if (!ok) {
                    rep(i, t) {
                        if (a == ac[i] and w == tm[i]) {
                            cout << i+1 << ' ' << ac[i] << " " << tm[i] << endl;
                            ac[i] = -1;
                            break;
                        }
                    }
                }

            }

        }

    }
}

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

#define MOD 1000000007
typedef unsigned long long ull;

int main() {
  int n, m;  // n桁
  cin >> n >> m;
  int hidarikara, num;

  int a100, a10, a1;
  a100 = a10 = a1 = -1;
  for (int i = 0; i < m; i++) {
    cin >> hidarikara >> num;

    if (n == 1) {
      if (a1 == -1) {
        a1 = num;
      } else {
        if (a1 != num) {
          cout << "-1";
          return 0;
        }
      }
    } else if (n == 2) {
      // 全部で2けた
      if (hidarikara == 1) {
        if (a10 == -1) {
          a10 = num * 10;
        } else {
          if (a10 != num * 10) {
            cout << "-1";
            return 0;
          }
        }
      } else {
        if (a1 == -1) {
          a1 = num;
        } else {
          if (a1 != num) {
            cout << -1;
            return 0;
          }
        }
      }
    } else if (n == 3) {
      // 全部で3けた
      if (hidarikara == 1) {
        if (a100 == -1) {
          a100 = num * 100;
        } else {
          if (a100 != num * 100) {
            cout << "-1";
            return 0;
          }
        }
      } else if (hidarikara == 2) {
        if (a10 == -1) {
          a10 = num * 10;
        } else {
          if (a10 != num * 10) {
            cout << "-1";
            return 0;
          }
        }
      } else {
        if (a1 == -1) {
          a1 = num;
        } else {
          if (a1 != num) {
            cout << "-1";
            return 0;
          }
        }
      }
    }
  }

  // 最左端が0なら-1 (2,3桁のとき)
  if (n == 2) {
    if (a10 == 0) {
      cout << "-1";
      return 0;
    }
  }
  if (n == 3) {
    if (a100 == 0) {
      cout << "-1";
      return 0;
    }
  }

  // 3桁指定で -1 -1 X のとき a100=100, a10=0
  if (n == 3) {
    if (a100 == -1 && a10 == -1) {
      a100 = 100;
      a10 = 0;
    } else if (a100 == -1) {
      a100 = 100;
      if (a1 == -1) {
        a1 = 0;
      }
    } else {
      if (a10 == -1) {
        a10 = 0;
      }
      if (a1 == -1) {
        a1 = 0;
      }
    }
  } else if (n == 2) {
    // 2桁指定で -1 X のとき a10=10
    if (a10 == -1) {
      a10 = 10;
    }
    if (a1 == -1) {
      a1 = 0;
    }

  } else {
    // 1桁指定のとき
    if (a1 == -1) {
      a1 = 0;
    }
  }

  if (a100 == -1) {
    a100 = 0;
  }
  if (a10 == -1) {
    a10 = 0;
  }
  if (a1 == -1) {
    a1 = 0;
  }
  cout << a100 + a10 + a1;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

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

    int x = -1;
    for(int i=1;i<=1100;i++){
        int t1 = i * 0.08;
        int t2 = i * 0.1;
        if(t1 == a && t2 == b) {
            x = i;
            break;
        }
    }

    cout << x << endl;
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
using namespace std;
int main(void){
  int A,B,C;
  cin >> A >> B >> C;
  if(A == B && A != C)cout << "Yes" << endl;
  else if(B == C && A != B)cout << "Yes" << endl;
  else if(C == A && B != C)cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define MOD ll(1e9+7)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cerr<<#x<<": "<<x<<endl


int main(){
    ll n;
    cin >> n;
    vector<ll> a(n);
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }

    vector<vector<ll>> dp(n+1, vector<ll>(3,0));
    ll ans = 1;
    for(int i = 0; i < n; i++){
        ll num = 0;
        ll index = 0;
        for(int j = 0; j < 3; j++){
            if(dp[i][j] == a[i]){
                num++;
                index = j;
            }
        }
        for(int j = 0; j < 3; j++){
            if(index == j){
                dp[i+1][j] = dp[i][j]+1;
            }else{
                dp[i+1][j] = dp[i][j];
            }
        }
        ans *= num;
        ans %= MOD;
    }
    cout << ans << endl;

    return 0;

}


Measured memory_bytes: 6528
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define sz(x) (int)(x).size()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define EPS (1e-10)
#define equals(a, b) (fabs((a)-(b)) < EPS)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;
  
int main() {
  ll X;
  cin >> X;
  vl five(1000);
  srep(k,1,1000) {
    five[k] = pow(k,5);
  }
  rep(a,1000) {
    srep(b,a,1000) {
      if(five[a]+five[b]==X) {
        cout << a << " " << -b << endl;
        return 0;
      }
      if(five[a]-five[b]==X) {
        cout << a << " " << b << endl;
        return 0;
      }
      if(five[b]-five[a]==X) {
        cout << b << " " << a << endl;
        return 0;
      }
    }
  }
  return 0;
}

Measured memory_bytes: 4116
///FUCKOUT
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")

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

#define pb push_back
#define F first
#define S second
#define f(i,a,b)  for(int i = a; i < b; i++)
//#define endl '\n'

using ll = long long;
using db = long double;
using row = vector<int>;
using ii = pair<ll, ll>;

#define int ll

const int N = 1e5+5, M = 1e6 + 5, LG = 17, MOD = 1e6 + 3;
const int BLOCK = 55;
const int BLOCKN = N / BLOCK + 1;
const long double EPS = 1e-7;
using ull = unsigned long long;

typedef long long LL;
map<int,int> mp;
int32_t main(){
#ifdef ONLINE_JUDGE
  ios_base::sync_with_stdio(0);
  cin.tie(0);
#endif // ONLINE_JUDGE


  int n, m;
  cin >> n >> m;
  int ans = m;
  int prv = 0;
  f(i,0,n){
    int x;
    cin >> x;
    if(i){
      ans += min(x-prv,m);
    }
    prv = x;
  }
  cout << ans << '\n';

  return 0;
}


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

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

    ll h, w; cin >> h >> w;

    if (h % 3 == 0 || w % 3 == 0) {
        cout << 0 << endl;
        return 0;
    }

    ll ans = min(h, w);
    for (int i = 1; i < h; ++i) {
        if (w % 2 == 0) ans = min(ans, abs(i*w - (h-i)*w/2));
        else {
            ll a = i*w, b = (h-i)*(w/2), c= (h-i)*(w/2+1);
            ans = min(ans, max({abs(a-b), abs(b-c), abs(c-a)}));
        }
    }

    for (int i = 1; i < w; ++i) {
        if (h % 2 == 0) ans = min(ans, abs(i*h - (w-i)*h/2));
        else {
            ll a = i*h, b = (w-i)*(h/2), c = (w-i)*(h/2+1);
            ans = min(ans, max({abs(a-b), abs(b-c), abs(c-a)}));
        }
    }
    
    cout << ans << endl;

    return 0;
}

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

int main()
{
    int k,minone=99,sign=0,i,j,l;
    char n[100];
    int x[15]={0},y[15]={0},p=0,q=0;
    cin>>n>>k;
    for(i=0;i<k;i++)
    {
        cin>>l;
        x[l]=1;
    }
    for(i=0;i<10;i++)
    {
        if(x[i]==0)
        {
            minone=i;
            break;
        }
    }

    for(i=0;i<10;i++)
    {
        if(i> (n[0]-'0') && x[i]==0)   //首项大于
        {
            sign=1;
            cout<<i;
            break;
        }
        if(i== (n[0]-'0') && x[i]==0)
        {
            sign=2;
            break;
        }
    }

    if(sign==0)
    {
        sign=2;
    }

    if(sign==1)
    {
        for(i=1;i<strlen(n);i++)
        {
            cout<<minone;
        }
    }
    else if(sign==2)
    {
        for(i=strlen(n)-1;i>=0;i--)
        {
            for(j=(n[i]-'0'+q);j<10;j++)
            {
                if(x[j]==0 && j+y[p]<10)
                {
                    y[p++]=j;
                    break;
                }
            }
            q=0;
            if(j>=10)
            {
                y[p]=minone;
                q++;
                p++;
                if(i==0)
                {
                    for(j=1;j<10;j++)
                    {
                        if(x[j]==0)
                        {
                            y[p++]=j;
                            break;
                        }
                    }
                }
            }
        }
        for(i=p-1;i>=0;i--)
        {
            cout<<y[i];
        }
    }
    cout<<endl;
    return 0;
}

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

int main(){
  char s[3];
  scanf("%s",s);
  
  if(s[0]=='A'){
    if(s[1]=='A' && s[2]=='A'){
      printf("No");
      return 0;
    }
  }
  
  if(s[0]=='B'){
    if(s[1]=='B' && s[2]=='B'){
      printf("No");
      return 0;
    }
  }
  
  printf("Yes");
  return 0;
}

Measured memory_bytes: 128
#!/usr/bin/env python3
# Generated by https://github.com/kyuridenamida/atcoder-tools
from typing import *
import collections
import functools
import itertools
import math
import sys

INF = float('inf')


def solve(H: int, A: int):
    return H//A+(H % A > 0)


def main():

    sys.setrecursionlimit(10 ** 6)

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    H = int(next(tokens))  # type: int
    A = int(next(tokens))  # type: int
    print(f'{solve(H, A)}')


if __name__ == '__main__':
    main()


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

int main()
{
    double pi = 3.14159265358979323846264338327950L;
    double A, B, H, M, ans, h, m, Z;
    cin >> A >> B >> H >> M;
    h = 30 * H + 0.5 * M;
    m = 6 * M;
    Z = abs(h - m);
    ans = (A * A) + (B * B) - 2 * A * B * cos(Z * pi / 180.0);
    cout << fixed << setprecision(30) << sqrt(ans) << endl;
    return 0;
}


Measured memory_bytes: 4224
#include <numeric>
#include <iostream>
#include <array>
#include <string>
#include <vector>
#include <cassert>
#include <algorithm>
#include <math.h> 
#include <set>
#include <map>
#include <utility>
#include <deque>
#include <queue>


using namespace std;

#define ll long long int
#define rep(i, n) for(ll i = 0; i < n; i++)
#define repp(i, n) for(ll i = 1; i <= n; i++)
#define sort(v) sort((v).begin(), (v).end())
#define riverse(v) reverse((v).begin(), (v).end())
#define pb push_back
#define mp make_pair
#define all(a)  (a).begin(),(a).end()
using vi = vector<int>;
using vs = vector<string>;
using vll = vector<ll>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vb = vector<bool>;
using vvb = vector<vb>;
const ll MOD = 1e9 + 7;
vi alphabet = { 'a','b','c','d','e','f','g','h','i','j','k','l','m',
               'n','o','p','q','r','s','t','u','v','w','x','y','z' };

int ctoi(char c) {
    if ('0' <= c && c <= '9') return (c - '0');
    return -1;
}

int main() {
    string s;
    cin >> s;
    int n = s.size();
    vi a(n);
    rep(i, n) a[i] = ctoi(s[i]);

    ll ans = 0;
    if (n > 1) {
        for (int bit = 0; bit < (1 << n - 1); bit++) {
            ll k = a[0];
            for (int i = 1; i <=n-1;i++) {
                if (bit & (1 << i-1)) {
                    k *= 10;
                    k += a[i];
                }
                else {
                    ans += k;
                    k = a[i];
                }
            }
            ans += k;
        }
    }
    else ans = a[0];
    cout << ans << endl;
}

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

int discriminateCircle(double xa, double ya, double ra, double xb, double yb, double rb){
	double d = sqrt((xa - xb) * (xa - xb) + (ya - yb) * (ya - yb));
	double r1 = ra, r2 = rb;

	if ( ra < rb ) {
		r1 = rb;
		r2 = ra;
	}
	if (d > ra + rb) return 0;
	else if(d == r1 + r2 || d == r1 - r2 || r1 - r2 < d && d < r1 + r2)return 1;
	else {
		if (ra > rb) return 2;
		else return -2;
	}
}

int main(void){
	int n;
	double xa, ya, ra, xb, yb,rb;

	scanf("%d",&n);

	while (n--){
		scanf("%lf %lf %lf %lf %lf %lf", &xa, &ya, &ra, &xb, &yb, &rb);
	
		printf("%d\n", discriminateCircle(xa,ya,ra,xb,yb,rb));
	}
	return 0;
}

Measured memory_bytes: 640
using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		string[] s = Console.ReadLine().Split();
		int N = int.Parse(s[0]);
		int M = int.Parse(s[1]);
		int X = int.Parse(s[2]);
		string[] s2 = Console.ReadLine().Split();
		int[] A = new int[N];
		for(var i=0;i<M;i++){
			int t = int.Parse(s2[i]);
			A[t] = 1;
		}
		int sum = 0;
		for(var i=1;i<X;i++){
			if(A[i] == 1){
				sum += 1;
			}
		}
		int summin = sum;
		sum = 0;
		for(var i=X+1;i<N;i++){
			if(A[i] == 1){
				sum += 1;
			}
		}
		summin = Math.Min(sum,summin);
		Console.WriteLine(summin);
	}
}

Measured memory_bytes: 11092
#B - Guidebook AC(ヒント)
N = int(input())
S = []
P = []
for _ in range(N):
    s,p = input().split()
    S.append(s)
    P.append(int(p)*(-1))#負の値にして降順にソートできるようにする

book = list(zip(S,P))
book_sort = sorted(book)
ans = [book.index(i)+1 for i in book_sort]
for j in ans:
    print(j)

Measured memory_bytes: 9088
def d_2017LikeNumber(Q, I):  # Q:クエリの数、I:探索区間の左端と右端
    def prime_list(M):
        # 0以上M以下の素数のリスト
        s = [True] * (M + 1)  # i番目の要素はiが素数ならTrue、非素数ならFalse
        for x in range(2, int(M**0.5) + 1):
            if s[x]:
                for i in range(x + x, len(s), x):
                    # 素数xの倍数は素数ではない
                    s[i] = False
        return s

    def calc_like2017(M, p):
        # i番目の要素が、1以上i以下の"2017に似た数"の個数となるようなリスト
        # 0番目は0と定義する
        # M以下の素数のリストpを予め作っておく必要がある
        c = [0] * (M + 1)
        for i in range(3, M + 1, 2):
            if p[i] and p[(i + 1) // 2]:
                c[i] += 1
        for i in range(3, M + 1):
            c[i] += c[i - 1]
        return c

    c = calc_like2017(10**5, prime_list(10**5))
    ans = ''
    for query in I:
        l, r = query[0], query[1]
        ans += '{}\n'.format(c[r] - c[l - 1])
    return ans[:-1]

Q = int(input())
I = [[int(i) for i in input().split()] for j in range(Q)]
print(d_2017LikeNumber(Q, I))

Measured memory_bytes: 24944
import java.util.Scanner;

public class Main {
    private static final int X = 0;
    private static final int Y = 1;

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

        int[][] students = new int[n][2];
        for (int i = 0; i < n; i++) {
            students[i][X] = sc.nextInt();
            students[i][Y] = sc.nextInt();
        }

        int[][] checkpoints = new int[m][2];
        for (int i = 0; i < m; i++) {
            checkpoints[i][X] = sc.nextInt();
            checkpoints[i][Y] = sc.nextInt();
        }

        int[] result = new int[n];
        for (int i = 0; i < n; i++) {
            int minDist = Integer.MAX_VALUE;
            int minIndex = 0;
            for (int j = 0; j < m; j++) {
                int dist = Math.abs(students[i][X] - checkpoints[j][X]) + Math.abs(students[i][Y] - checkpoints[j][Y]);
                if (dist < minDist) {
                    minDist = dist;
                    minIndex = j;
                }
            }
            result[i] = minIndex + 1;
        }

        for (int i = 0; i < n; i++) {
            System.out.println(result[i]);
        }
    }
}


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

int N ,i ,res ;
int A [100000];

int main (){
  scanf( "%d", &N );
  for ( int i=0; i < N ; i ++) scanf( "%d", &A[i] );
  sort (A, A+N);
  
  while ( i < N ){
    int cc = A[i] , f = 0;
    while ( i < N && A [ i ]== cc ) f++ , i++;
    res += f %2;
  }
  
  printf ( "%d\n", res );
}


Measured memory_bytes: 640
#include <iostream>
#include <vector>

#define ll long long
using namespace std;

ll round;
int n;
vector<ll> cumulative_sum;

bool is_range_possible(ll required_range, int start) {
    int cut = start;

    for (int i = 0; i < 3; i++) {
        auto x = lower_bound(cumulative_sum.begin(), cumulative_sum.end(), cumulative_sum[cut] + required_range);
        cut = x - cumulative_sum.begin();
        if (cut > start + n)return false;
    }

    return true;
}

ll max_range(int start) {
    ll ok = 0;
    ll ng = round / 3 + 10;

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

        if (is_range_possible(mid, start)) ok = mid;
        else ng = mid;
    }

    return ok;
}

int main() {
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++)cin >> a[i];

    cumulative_sum = vector<ll>(n * 2 + 1);
    for (int i = 1; i <= n; i++) {
        cumulative_sum[i] = cumulative_sum[i - 1] + a[i - 1];
    }
    for (int i = 1; i <= n; i++) {
        cumulative_sum[n + i] = cumulative_sum[n + i - 1] + a[i - 1];
    }

    round = cumulative_sum[n];
    ll ret = 0;
    for (int i = 0; i < n; i++) {
        ret = max(ret, max_range(i));
    }

    cout << ret << endl;
    return 0;
}


Measured memory_bytes: 4688
n, y = map(int, input().split())

total = 0
ans = list()
for a in range(0, n+1, 1):
  for b in range(0, n+1, 1):
    if a + b <= n:
      c = n - (a+b)
      total = a*10000 + b*5000 + c*1000
      if total == y:
        lists = [a,b,c]
        ans.append(lists)
    else:
      break

if ans == []:
  answer = ['-1', '-1', '-1']
  answer = ' '.join(answer)
else:
  answer = [str(i) for i in ans[0]]
  answer = ' '.join(answer)

print(answer)

Measured memory_bytes: 9220
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
template<class T = int> using V  = vector<T>;
template<class T = int> using VV = V< V<T> >;

int main() {
  cin.tie(NULL); ios::sync_with_stdio(false);
  string s; cin >> s; int n = s.size();
  V<string> dp(26); for (int i = 0; i < 26; i++) dp[i] = 'a' + i;
  for (int i = n - 1; i >= -1; i--) {
    string t = *min_element(dp.begin(), dp.end(), [](string a, string b) { return a.size() < b.size(); });
    int j = i >= 0 ? s[i] - 'a' : 0;
    dp[j] = i >= 0 ? s[i] + t : t;
  }
  cout << dp[0] << '\n';
}

Measured memory_bytes: 788
int main(){
	int H,W,i,j;
	while(1){
		scanf("%d %d",&H,&W);
		if(H==0 && W==0)break;
		for(i=1;i<=H;i++){
			for(j=1;j<=W;j++){
				if(i==1 || i==H)printf("#");
				else if(j==1 || j==W)printf("#");
				else printf(".");
			}
			printf("\n");
			if(i==H)printf("\n");
		}
	}
	return 0;
}

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

using namespace std;

#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second

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

const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

#define DEBUG_MODE
#ifdef DEBUG_MODE
#define dump(x) cout << #x << " : " << x << endl
#define LINE cout << "line : " << __LINE__ << endl
#define dumpV(v) cout << #v << " : ["; for(auto& t : v) cout << t << ", "; cout<<"]" << endl;
#define STOP assert(false);
#else
#define dump(x) ;
#define LINE 	;
#define dumpV(v);
#define STOP 	;
#endif

namespace std{
  template<class S,class T>
  ostream &operator <<(ostream& out,const pair<S,T>& a){
    out<<'('<<a.fi<<", "<<a.se<<')';
    return out;
  }
}


int main() {
	int n, m;
	cin >> n >> m;
	vi x(m), y(m);
	rep(i, m) cin >> x[i] >> y[i], x[i]--, y[i]--;
	vector<set<int> > st(n);

	rep(i, n) {
		[&] {
			st[i].insert(i);
			for(int j = m-1; j >= 0; j--) {
				if(st[i].count(x[j]) && st[i].count(y[j])) {
					st[i].clear();
					return;
				}
				if(st[i].count(x[j])) st[i].insert(y[j]);
				else if(st[i].count(y[j])) st[i].insert(x[j]);
			}
		}();
	}
	int ans = 0;
	rep(i, n) rep(j, i) {
		auto check = [&] (const set<int>& a, const set<int>& b){
			if(a.size() == 0) return false;
			for(auto& p : a) {
				if(b.count(p)) return false;
			}
			return true;
		};
		if(st[i].size() < st[j].size()) ans += check(st[i], st[j]) ? 1: 0;
		else ans += check(st[j], st[i]) ? 1:0;
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1024
import java.util.*;

public class Main {
    final static int MOD = 1000000007;
    
    public static void main(String[] args) {
        MyScanner in = new MyScanner();
        int n = in.nextInt();
        String s = in.next();
        int count = 0;
    
        for (int i = 0; i < s.length() - 1 ; i++) {
            if (s.charAt(i) == s.charAt(i+1)) {
                count++;
            }
        }
    
        System.out.println(n - count);
        
        
        
        
    }
    
    static class MyScanner {
        static Scanner sc = new Scanner(System.in);
        
        String next() {
            return sc.next();
        }
        
        String nextLine() {
            return sc.nextLine();
        }
        
        int nextInt() {
            return Integer.parseInt(sc.next());
        }
        
        double nextDouble() {
            return Double.parseDouble(next());
        }
        
        long nextLong() {
            return Long.parseLong(next());
        }
        
        int[] nextIntArray(int n) {
            int[] array = new int[n];
            for (int i = 0; i < n; i++) {
                array[i] = nextInt();
            }
            return array;
        }
        
        double[] nextDoubleArray(int n) {
            double[] array = new double[n];
            for (int i = 0; i < n; i++) {
                array[i] = nextDouble();
            }
            return array;
        }
        
        long[] nextLongArray(int n) {
            long[] array = new long[n];
            for (int i = 0; i < n; i++) {
                array[i] = nextLong();
            }
            return array;
        }
        
        String[] nextLineArray(int n) {
            String[] array = new String[n];
            for (int i = 0; i < n; i++) {
                array[i] = nextLine();
            }
            return array;
        }
        
        int[][] nextIntMatrix(int n, int m) {
            int[][] matrix = new int[n][m];
            for (int i = 0; i < n; i++) {
                for (int j = 0; j < m; j++) {
                    matrix[i][j] = nextInt();
                }
            }
            return matrix;
        }
        
        double[][] nextDoubleMatrix(int n, int m) {
            double[][] matrix = new double[n][m];
            for (int i = 0; i < n; i++) {
                for (int j = 0; j < m; j++) {
                    matrix[i][j] = nextDouble();
                }
            }
            return matrix;
        }
        
        long[][] nextLongMatrix(int n, int m) {
            long[][] matrix = new long[n][m];
            for (int i = 0; i < n; i++) {
                for (int j = 0; j < m; j++) {
                    matrix[i][j] = nextLong();
                }
            }
            return matrix;
        }
    }
}

Measured memory_bytes: 23764
#include<iostream>
#include<algorithm>
#include<bits/stdc++.h>
using namespace std;
//#define mp make_pair
#define pb push_back
#define int long long
#define pi 3.141592653589793238462643383279502
#define M 1000000007
#define F first
#define S second
#define pii pair<int,int>
#define rep(i,n) for(int i=0;i<n;i++)
bool isPowerOfTwo(int n)
{
   if(n==0)
   return false;

   return (ceil(log2(n)) == floor(log2(n)));
}
int power(int x, unsigned int y)
{
    int res = 1;

    x = x;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x);

        y = y>>1;
        x = (x*x);
    }
    return res;
}
bool isprime(int x)
{
      if(x<2)
        return false;
    for(int i=2;i*i<=x;i++)
     {
        if (x%i==0)
            return false;
    }
    return true;
}
vector<int>primeFactors(int n)
{
    vector<int>v;
    while (n % 2 == 0)
    {
        v.pb(2);
        n = n/2;
    }
    for (int i = 3; i <= sqrt(n); i = i + 2)
    {
        while (n % i == 0)
        {
            v.pb(i);
            n = n/i;
        }
    }
    if (n > 2)
        v.pb(n);
    return v;
}

void solve()
{
int a,b,c,d;
cin>>a>>b>>c>>d;
int x,y;
if(a%d==0)
    x=a/d;
else
    x=(a/d)+1;
if(c%b==0)
    y=c/b;
else
    y=(c/b)+1;
if(x>=y)
    cout<<"Yes"<<endl;
else
    cout<<"No"<<endl;
}

signed main()
{ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
int t;
//cin>>t;
t=1;
while(t--)
{
  solve();
}
}


Measured memory_bytes: 3636
#include <stdio.h>
int main()
{
    int T,A,H;
    double tmp,best=300000;
    int i,N,bestH;
    scanf("%d",&N);
    scanf("%d %d",&T,&A);

    for(i=0;i<N;i++){
        scanf("%d",&H);
        tmp = A - (T - H*0.006);
        if(tmp < 0){
            tmp *= -1;
        }
        if(tmp < best){
            best = tmp;
            bestH = i+1;
        }
    }

    printf("%d",bestH);
    return 0;
}

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

int main() {
	int a,b; cin >> a >>b;
	string s; cin>>s;
	for(int i=0;i<a+b+1;++i){
		auto ss=s.substr(i,1);
		if (i==a) {
			if (ss != "-"){
				cout << "No" << endl;
				return 0;
			}
		} else {
				if (ss == "-"){
				cout << "No" << endl;
				return 0;
			}
		}
	}
	cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 256