akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

  public static void main(String[] args) throws IOException {
    
    try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {

      StringBuilder line  = new StringBuilder();
      String wordA;
      String wordB;
      int turn = Integer.parseInt(br.readLine());
      int pointA = 0;
      int pointB = 0;
      int result = 0;

      for ( int i = 0; i < turn; i++ ) {

        line.append(br.readLine());
        wordA = line.substring(0, line.indexOf(" "));
        wordB = line.substring(line.indexOf(" ")+1, line.length());

        result = wordA.compareTo(wordB);
        pointA += result == 0 ? 1 : result < 0 ? 0 : 3;
        pointB += result == 0 ? 1 : result < 0 ? 3 : 0;

        line.setLength(0);
      }

      System.out.println(pointA + " " + pointB);
    }
  }
}


Measured memory_bytes: 24800
import static java.lang.Integer.parseInt;
import static java.lang.Long.parseLong;
import static java.lang.System.exit;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {

	static void solve() throws Exception {
		int k = scanInt(), n;
		if (k == 1) {
			n = 1;
		} else {
			n = (k + 3) / 4 * 2;
		}
		out.println(n);
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				int d = (i + j) % n;
				out.print((d < k - n && j % 2 != 0 ? d + n : d) + 1 + " ");
			}
			out.println();
		}
	}

	static int scanInt() throws IOException {
		return parseInt(scanString());
	}

	static long scanLong() throws IOException {
		return parseLong(scanString());
	}

	static String scanString() throws IOException {
		while (tok == null || !tok.hasMoreTokens()) {
			tok = new StringTokenizer(in.readLine());
		}
		return tok.nextToken();
	}

	static BufferedReader in;
	static PrintWriter out;
	static StringTokenizer tok;

	public static void main(String[] args) {
		try {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
			solve();
			in.close();
			out.close();
		} catch (Throwable e) {
			e.printStackTrace();
			exit(1);
		}
	}
}

Measured memory_bytes: 41376
#include<bits/stdc++.h>
typedef long long int ll;
using namespace std;
int main()
{
    ll n,m,k;
    cin>>n>>m>>k;
    ll a[n],b[m];
    for(int i=0;i<n;i++)
    cin>>a[i];
    for(int i=0;i<m;i++)
    cin>>b[i];
    for(int i=1;i<n;i++)
        a[i]=a[i-1]+a[i];
    for(int i=1;i<m;i++)
        b[i]=b[i-1]+b[i];
    ll ans = max(upper_bound(a,a+n,k) - a , upper_bound(b,b+m,k) - b);
    for(int i=0;i<n;i++)
    {
        int ele1=a[i];
        if(ele1 > k)
            break;
        if(ele1==k)
        {
            ans = max((ll)i+1,ans);
            break;
        }
        int ele2=k-a[i];
        int pos = upper_bound(b,b+m,ele2) - b;
        ans=max(ans,(ll)i+1+pos);
    }
    cout<<ans<<endl;
}

//#include<iostream>
//typedef long long int ll;
//using namespace std;
//int main()
//{
//    ll n,m,k;
//    cin>>n>>m>>k;
//    ll a[n],b[m];
//    for(int i=0;i<n;i++)
//    cin>>a[i];
//    for(int i=0;i<m;i++)
//    cin>>b[i];
//    ll count=0;
//    ll p1=0,p2=0;
//    while(p1<n || p2<m)
//    {
//        if(p1 == n)
//        {
//            if(k- b[p2] >= 0)
//            {
//                count++;
//                k=k-b[p2];
//                p2++;
//            }
//            else
//                p2++;
//        }
//        else if(p2 == m)
//        {
//            if(k- a[p1] >= 0)
//            {
//                count++;
//                k=k-a[p1];
//                p1++;
//            }
//            else
//                p1++;
//        }
//        else
//        {
//            if(a[p1]<=b[p2])
//            {
//                if(k- a[p1] >= 0)
//                {
//                    count++;
//                    k=k-a[p1];
//                    p1++;
//                }
//                else
//                p1++;
//            }
//            else if(a[p1]>b[p2])
//            {
//                if(k- b[p2] >= 0)
//                {
//                    count++;
//                    k=k-b[p2];
//                    p2++;
//                }
//                else
//                p2++;
//            }
//        }
//    }
//    cout<<count<<endl;
//}


Measured memory_bytes: 6756
n = int(input())

c=0
for i in range(n):
    a = i+1
    for j in range(n-a+1):
        d = a*(j+1+i)
        if(d >= n):
            tmp = j*2-1
            if(tmp < 0):
                print(c)
                exit()
            c += j*2-1
            break
        

Measured memory_bytes: 9124
fun main(args: Array<String>) {
    Main.init()

    Main.execute()

    Main.display()
}

data class Timestamp(var findedAt: Int? = null, var endedAt: Int? = null)

class Main {

    companion object {
        private val graphMatrix = arrayListOf<List<Int>>()


        private val nodeList = arrayListOf<Node>()

        fun init() {
            val num = readLine()!!.toInt()

            for (index in 1..num) {
                val inputs = readLine()!!.split(" ").subList(1, num + 1).map {
                    if (it == "-1") Int.MAX_VALUE else it.toInt()
                }

                graphMatrix.add(inputs)

                nodeList.add(Node())
            }
        }

        fun display() {
            println(nodeList.sumBy {
                it.minCost
            })
        }

        /**
         * 深さ優先
         */
        fun execute() {

            nodeList[0].minCost = 0

            while (true) {
                // 黒ではなく、なおかつ最小のノードを取得
                var minCost = Int.MAX_VALUE
                var minIndex: Int? = null
                for (index in 1..nodeList.size) {
                    if (nodeList[index - 1].color != Node.Color.BLACK && minCost > nodeList[index - 1].minCost) {
                        minCost = nodeList[index - 1].minCost
                        minIndex = index
                    }
                }

                // 一つもないので終了
                if (minCost == Int.MAX_VALUE || minIndex == null) {
                    break
                }

                // 色を変える
                nodeList[minIndex - 1].color = Node.Color.BLACK

                graphMatrix[minIndex - 1].forEachIndexed { index, cost ->
                    // 調査対象かどうかチェック
                    if (nodeList[index].color != Node.Color.BLACK && cost != Int.MAX_VALUE) {

                        // もともとのコストより小さいかチェック
                        val originalCost = nodeList[index].minCost
                        val foundedCost = graphMatrix[index][minIndex!! - 1]
                        if (originalCost > foundedCost) {
                            nodeList[index].color = Node.Color.GRAY
                            nodeList[index].minCost = foundedCost
                        }
                    }
                }
            }
        }
    }
}


open class Node {
    enum class Color {
        WHITE, GRAY, BLACK
    }

    var minCost: Int = Int.MAX_VALUE

    var color: Color = Color.WHITE


    override fun toString(): String {
        return "$minCost, $color"
    }
}


Measured memory_bytes: 36196
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <set>
#include <cstring>
#include <string>
#include <cmath>
#include <functional>
#include <queue>
#include <map>
using namespace std;

typedef long long ll;
const int M = 1e9 + 7;
const int N = 2e5 + 10;
const int MAX = 1e9 + 1;
//int dx[] = {-1, 0, 1, 0}, dy[] = {0, 1, 0, -1};

int n;
ll mp[400][400];
ll mp2[400][400];

bool s() {
    int i, j, k;
    for (i = 1; i <= n; ++i) {
        for (j = 1; j <= n; ++j) {
            if (j == i)
                continue;
            for (k = j + 1; k <= n; ++k) {
                if (k == i)
                    continue;
                ll t = mp[j][i] + mp[i][k];
                if (t < mp[j][k])
                    return 0;
                if (mp2[j][k] == 0)
                    mp2[j][k] = t;
                else
                    mp2[j][k] = min(mp2[j][k], t);
            }
        }
    }
    return 1;
}

int main() {
    int i, j;
    cin >> n;
    for (i = 1; i <= n; ++i) {
        for (j = 1; j <=n; ++j) {
            cin >> mp[i][j];
        }
    }
    if (!s()) {
        cout << -1 << endl;
        return 0;
    }
    ll sum = 0;
    for (i = 1; i <= n; ++i) {
        for (j = i + 1; j <= n; ++j) {
            if (mp2[i][j] < mp[i][j]) {
                sum += mp[i][j];
            }
            if (mp2[i][j] > mp[i][j]) {
                sum += mp[i][j];
            }
        }
    }
    cout << sum << endl;
    return 0;
}


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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcountll

#define INF 1e16
#define mod 1000000007

struct UnionFind{
  vector<int> v;
  UnionFind(int n) : v(n, -1) {}
  void init(){ for(int i = 0;i < (int)v.size();i++)v[i]=-1; }
  int find(int x) { return v[x] < 0 ? x : v[x] = find(v[x]); }
  bool unite(int x, int y) {
    x = find(x); y = find(y);
    if (x == y) return false;
    if (-v[x] < -v[y]) swap(x, y);
    v[x] += v[y]; v[y] = x;
    return true;
  }
  bool root(int x) { return v[x] < 0; }
  bool same(int x, int y) { return find(x) == find(y); }
  int size(int x) { return -v[find(x)]; }
};


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

  int n,m;
  cin>>n>>m;
  UnionFind uf(n);
  rep(i,m){
    int a,b;
    cin>>a>>b;
    a--;b--;
    uf.unite(a,b);
  }

  int mx=0;
  rep(i,n){
    maxch(mx,uf.size(i));
  }
  cout<<mx<<endl;

  return 0;
}


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

int main()
{
  int n;
  cin >> n;
  map<int, int> mp;
  for(int i = 0; i < n; i++)
  {
    int a;
	cin >> a;
    ++mp[a];
  }
  int ans = 0;
  int even_cnt = 0;
  for(auto m: mp)
  {
    if(m.second == 1)
    {
      ++ans;
    }
    else if(m.second % 2 == 1)
    {
      ++ans;
    }
    else
    {
		++even_cnt;
    }
  }
  if(even_cnt % 2 == 0)
  {
	cout << ans + even_cnt << endl;
  }
  else
  {
    cout << ans + even_cnt - 1 << endl;
  }
  return 0;
}


Measured memory_bytes: 8096
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <map>
using namespace std;
int main()
{
	map<int,int> mp;
	int n;
	mp.clear();
	scanf("%d",&n);
	for (int i = 0; i < n; i++){
		 int x;
		 scanf("%d",&x);
		 mp[x]++;
	}
	map<int,int>::iterator it;
	int ans = 0; 
	for (it = mp.begin(); it != mp.end(); it++)
		if (it->second >= it->first)
		{
			ans += it->second - it->first;
		}
		else ans += it->second;
	printf("%d\n",ans);
}

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

int n, place;

struct node
{
	int id, pid, bid, depth, degree, h;
	int lc, rc;
	string type;
}N[10000];

void Set()
{
	cin >> n;

	for (int i = 0; i < n; i++)
	{
		N[i].pid = -1;
		N[i].bid = -1;
		N[i].h = 0;
	}

	for (int i = 0; i < n; i++)
	{
		cin >> place;
		N[place].id = place;

		cin >> N[place].lc >> N[place].rc;
		N[N[place].lc].id = N[place].lc;
		N[N[place].rc].id = N[place].rc;

		if (N[place].lc != -1 && N[place].rc != -1)
		{
			N[N[place].lc].bid = N[N[place].rc].id;
			N[N[place].rc].bid = N[N[place].lc].id;

			N[N[place].lc].pid = N[place].id;
			N[N[place].rc].pid = N[place].id;

			N[place].degree = 2;
		}
		else if (N[place].lc == -1 && N[place].rc == -1)
			N[place].degree = 0;
		else
		{
			if (N[place].lc != -1)
				N[N[place].lc].pid = N[place].id;
			else
				N[N[place].rc].pid = N[place].id;

			N[place].degree = 1;
		}
	}
}

void GetDepth(node& GN)
{
	GN.depth = 0;
	node temp = GN;
                                           
	while (temp.pid != -1)
	{
		GN.depth++;
		temp = N[temp.pid];
	}
}

int GetHeight(node& GN)
{
	int h1 = 0, h2 = 0;

	if (GN.lc != -1)
		h1 = GetHeight(N[GN.lc]) + 1;
	if (GN.rc != -1)
		h2 = GetHeight(N[GN.rc]) + 1;

	return GN.h = h1 > h2 ? h1 : h2;
}

void GetType(node& GN)
{
	if (GN.pid == -1)
		GN.type = "root";
	else if (GN.degree == 0)
		GN.type = "leaf";
	else
		GN.type = "internal node";
}

void print()
{
	for (int i = 0; i < n; i++)
	{
		cout << "node " << N[i].id << ": " << "parent = " << N[i].pid << ", ";
	    cout << "sibling = " << N[i].bid << ", ";
		cout << "degree = " << N[i].degree << ", ";
		cout << "depth = " << N[i].depth << ", ";
		cout << "height = " << N[i].h << ", ";
		cout << N[i].type << endl;
	}
}

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

	for (int i = 0; i < n; i++)
	{
		GetDepth(N[i]);	
		GetHeight(N[i]);
		GetType(N[i]);
	}
	
	print();

	return 0;
}



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

using namespace std;

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

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

    int i = n - 2;
    for(; i >= 0; i--)
    {
        if(A[i] > A[i + 1] && A[i] - A[i + 1] > 1)
        {
            cout << "No" << endl;
            break;
        }
        else if(A[i] > A[i + 1])
        {
            A[i]--;
        }
    }

    if(i == -1)
    {
        cout << "Yes" << endl;
    }

    return 0;
}

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

int main(){
	int N,M;
  	cin>>N>>M;
  	int A[N],sum=0;
  	for(int i=0;i<N;i++) {
      	cin>>A[i];
      	sum=sum+A[i];
    }
  	sort(A,A+N);
  	if(A[N-M]*4*M<sum) cout<<"No";
  	else cout<<"Yes";
    return 0;
}

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

int main(){
    int H,W,x,y;
    cin >> W >> H >> x >> y;
    double area;
    int div;
    area = ( (double) H*W)/2.0;
    if( ( (double) x == (double)  W/2 ) && ( (double) y == (double) H/2 ) ){
        div = 1;
    }else{
        div = 0;
    }

    cout << setprecision(9) << area << " " << div << endl;

    return 0;
}

Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var N int
	fmt.Scan(&N)
	ans := 0

	for i := 1; i <= N; i++ {
		if i%3 == 0 || i%5 == 0 {
			continue
		}
		ans += i
	}

	fmt.Println(ans)
}


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

int main(){
    int n, k;
    cin >> n >> k;
    vector<bool> trick(n, 1); // trick[i] = 1 なら すぬけ i は お菓子をもらってない
    for(int i = 0; i < k; i++){
        int d;
        cin >> d;
        for(int i = 0; i < d; i++){
            int a;
            cin >> a;
            a--;
            trick[a] = 0;
        }
    }
    cout << accumulate(trick.begin(), trick.end(), 0) << endl;
}

Measured memory_bytes: 3600
/*
 *
 * Author : fcbruce <fcbruce8964@gmail.com>
 *
 * Time : Sun 21 Aug 2016 20:20:06
 *
 */
#include <cstdio>
#include <iostream>
#include <sstream>
#include <cstdlib>
#include <algorithm>
#include <ctime>
#include <cctype>
#include <cmath>
#include <string>
#include <cstring>
#include <stack>
#include <queue>
#include <list>
#include <vector>
#include <map>
#include <set>
#define sqr(x) ((x)*(x))
#ifdef _WIN32
#define lld "%I64d"
#else
#define lld "%lld"
#endif

const int INF = 0x3f3f3f3f;
const long long INFLL = 0x3f3f3f3f3f3f3f3fll;
const double PI = acos(-1.0);
const double eps = 1e-10;

typedef long long LL;
typedef int itn;

const int maxn = 100007;
const int maxm = 0;

int a[maxn], b[maxn];

int main()
{
#ifdef FCBRUCE
  //freopen("/home/fcbruce/code/t", "r", stdin);
#endif // FCBRUCE

  int n;
  scanf("%d", &n);
  
  for (int i = 0; i < n; i++) scanf("%d", a + i);
  memcpy(b, a, sizeof b);

  std::sort(a, a + n);
  int cnt = 0;
  for (int i = 0; i < n; i++)
  {
    int x = std::lower_bound(a, a + n, b[i]) - a;
    x ^= i;
    if (x & 1)
    {
      cnt++;
    }
  }

  printf("%d\n", cnt >> 1);




  return 0;
}


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

using namespace std;

int main()
{

    int n,k,q,t;
    cin>>n>>k>>q;
    int l[n+1];
    memset(l,0, sizeof(l));

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

        if((k-q+l[i])>=1)
        {
            cout<<"Yes"<<endl;
        }
        else
        {
            cout<<"No"<<endl;
        }
    }


}


Measured memory_bytes: 1024
from math import gcd
MOD = 10 ** 9 + 7
N = int(input())
d = dict()
zeros = 0
for _ in range(N):
    a, b = tuple(map(int, input().split()))
    if not any((a, b)):
        zeros += 1
        continue
    g = gcd(a, b) * (a // abs(a)) if all((a, b)) else a if a else b
    p = a // g, b // g
    d[p] = d.get(p, 0) + 1
done = set()
total = 1
for (a, b), v in d.items():
    if (b, -a) in done or (-b, a) in done:
        continue
    done.add((a, b))
    w = d.get((b, -a), 0) + d.get((-b, a), 0)
    total = total * (pow(2, v, MOD) + pow(2, w, MOD) - 1) % MOD
print((total + zeros - 1) % MOD)

Measured memory_bytes: 72060
#include <stdio.h>

int main(int argc, const char * argv[]) {
    int a,b;
    scanf("%d %d",&a,&b);
    if (a>b) {
        printf("a > b\n");
    }if (a==b) {
        printf("a == b\n");
    }if (a<b) {
        printf("a < b\n");
    }
    return 0;
}

Measured memory_bytes: 576
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include <prettyprint.hpp>
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

template <typename T>
void print(T x) {
    cout << x << "\n";
}

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REVFOR(i, m, n) for (int i = (n - 1); i >= (m); --i)
#define REP(i, n) FOR(i, 0, n)
#define REVREP(i, n) REVFOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
const ll MOD = 10007;

struct Dijkstra {
    struct Edge {
        ll to;
        ll c;
    };

    int V;
    vector<vector<Edge>> e;
    vector<ll> d;

    Dijkstra(int V): V(V) {
        e.resize(V);
        d.resize(V);
    }

    void add_edge(int from, int to, ll cost) {
        e[from].pb({to, cost});
    }

    ll query(ll dest) {
        return d[dest];
    }

    void operator()(ll s) {
        priority_queue<Pll, vector<Pll>, greater<>> q;

        REP(i, V) d[i] = INF;
        d[s] = 0;
        q.push({0, s});

        while(!q.empty()) {
            Pll n = q.top(); q.pop();
            ll v = n.se;
            if (d[v] < n.fi) continue;

            REP(i, e[v].size()) {
                Edge cur = e[v][i];
                ll cost = d[v] + cur.c;
                if (d[cur.to] > cost) {
                    d[cur.to] = cost;
                    q.push({cost, cur.to});
                }
            }
        }
    }
};

int main() {
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    int v, e, r; cin >> v >> e >> r;

    Dijkstra graph(v);

    REP(i, e) {
        int s, t, d;
        cin >> s >> t >> d;
        graph.add_edge(s, t, d);
    }

    graph(r);

    REP(i, v) {
        ll ans = graph.query(i);
        if (ans == INF) print("INF");
        else print(ans);
    }
}


Measured memory_bytes: 19360
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define fsp(x) fixed << setprecision(x)
#define xout cerr
const ll inf = LLONG_MAX;
const long double pi = acosl(-1);
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	//const ll p = 1e9 + 7;
	//const ll p = 998244353;

	ll n;
	cin >> n;
	vector<ll> a(n);
	ll ans = 0;
	for (ll i = 0; i < n; i++) {
		cin >> a[i];
		while (a[i] % 2 == 0) {
			a[i] /= 2;
			ans++;
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 384
#include <algorithm>     //sort,二分探索,など
#include <bitset>        //固定長bit集合
#include <cmath>         //pow,logなど
#include <complex>       //複素数
#include <deque>         //両端アクセスのキュー
#include <functional>    //sortのgreater
#include <iomanip>       //setprecision(浮動小数点の出力の誤差)
#include <iostream>      //入出力
#include <iterator>      //集合演算(積集合,和集合,差集合など)
#include <map>           //map(辞書)
#include <numeric>       //iota(整数列の生成),gcdとlcm(c++17)
#include <queue>         //キュー
#include <set>           //集合
#include <stack>         //スタック
#include <string>        //文字列
#include <unordered_map> //イテレータあるけど順序保持しないmap
#include <unordered_set> //イテレータあるけど順序保持しないset
#include <utility>       //pair
#include <vector>        //可変長配列

using namespace std;
typedef long long ll;

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= (ll)(b); i++)
#define FORD(i, a, b) for (ll i = a; i >= (ll)(b); i--)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(), (x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size())      //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))   //最大値を求める
#define MIN(x) *min_element(ALL(x))   //最小値を求める
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 10000007      //10^9+7:合同式の法
#define MAXR 100000       //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first      //pairの一つ目の要素
#define S second     //pairの二つ目の要素

signed main()
{
    int N, M;
    cin >> N >> M;
    vector<int> H(N);
    REP(i, N){
        cin >> H[i];
    }

    vector<bool> G(N, true);


    REP(i, M){
        int A, B;
        cin >> A >> B;
        A--;
        B--;
        if(H[A]>=H[B]){
            G[B] = false;
        }
        if(H[B]>=H[A]){
            G[A] = false;
        }
    }

    int ans = 0;

    REP(i, N){
       if(G[i] == true){
           ans++;
       }
    }

    cout << ans << endl;
    
}

Measured memory_bytes: 3796
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
using ll = long long ;
using P = pair<int,int> ;
using pll = pair<long long,long long>;
constexpr int INF = 1e9;
constexpr long long LINF = 1e17;
constexpr int MOD = 1000000007;
int n,m,q = 54;
vector<int> a(q),b(q),c(q),d(q);
ll mx = 0;

void dfs(int i,int last,vector<int> A){
    if(i==n){
        ll res = 0;
        rep(j,q){
            if(A[b[j]] - A[a[j]] == c[j]) res += d[j];
        }
        mx = max(mx,res);
    }
    else{
        for(int j=last;j<=m;j++){
            vector<int> B = A;
            B.push_back(j);
            dfs(i+1,j,B);
        }
    }
}

int main(){
    cin >> n >> m >> q;
    rep(i,q){
        cin >> a[i] >> b[i] >> c[i] >> d[i];
        --a[i];--b[i];
    }
    dfs(0,1,vector<int>(0));
    cout << mx << endl;
    return 0;
}

Measured memory_bytes: 3604
#include<bits/stdc++.h>
using namespace std;
const int N=5e5+5;
int n,k,pos[N],a[N];
const int INF=0x3f3f3f3f;
struct SegT{
	int t[N<<2];
	void build(int x,int l,int r){
		int mid=(l+r)>>1;
		t[x]=INF;if(l==r)return ;
		build(x<<1,l,mid);build(x<<1|1,mid+1,r);
	}
	void chg(int x,int l,int r,int pos,int sum){
		int mid=(l+r)>>1;
		t[x]=min(t[x],sum);
		if(l==r)return;
		if(pos>mid)chg(x<<1|1,mid+1,r,pos,sum);
		else chg(x<<1,l,mid,pos,sum);
	}
	int qry(int x,int l,int r,int ql,int qr){
		if(ql>qr)return INF;
		int mid=(l+r)>>1,ans=INF;
		if(ql<=l&&qr>=r)return t[x];
		if(ql<=mid)ans=min(ans,qry(x<<1,l,mid,ql,qr));
		if(qr>mid)ans=min(ans,qry(x<<1|1,mid+1,r,ql,qr));
		return ans;
	}
}T;
int hed[N],to[N*3],nxt[N*3],cnt;
int d[N];
inline void adde(int u,int v){
	//cout<<u<<' '<<v<<endl;
	++cnt;to[cnt]=v,nxt[cnt]=hed[u];hed[u]=cnt;
	d[v]++;
}
priority_queue<int,vector<int>,greater<int> >Q;
int ans[N],top;
int main()
{
	scanf("%d%d",&n,&k);
	for(int i=1;i<=n;i++){
		scanf("%d",&a[i]);
		pos[a[i]]=i;
	}
	T.build(1,1,n);
	//for(int i=1;i<=n;i++)cout<<pos[i]<<" ";puts("");
	for(int i=n;i;i--){
		//cout<<i<<" :: ";
		int p=pos[i];
		//cout<<p<<" ? "<<p+1<<" "<<p+k-1<<endl;
		int R=T.qry(1,1,n,p+1,min(n,p+k-1));
		int L=T.qry(1,1,n,max(1,p-k+1),p-1);
		//cout<<L<<" "<<R<<endl;
		if(R<=n)adde(pos[i],pos[R]);
		if(L<=n)adde(pos[i],pos[L]);
		T.chg(1,1,n,pos[i],i);
	}
	for(int i=1;i<=n;i++)if(!d[i]){
		Q.push(i);
		//cout<<"!"<<i<<endl;
	}int top=0;
	while(!Q.empty()){
		int u=Q.top();Q.pop();
		//cout<<u<<endl;
		ans[u]=++top;
		for(int i=hed[u];i;i=nxt[i]){
			int v=to[i];d[v]--;
			if(!d[v])Q.push(v);
		}
	}
	for(int i=1;i<=n;i++)printf("%d\n",ans[i]);
}

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

int main(){
  int A,B,C;
  cin >> A >> B >> C;
  if(A>C){
    cout << "NO" << endl;
  }
  else if(A+B<C){
    cout << "NO" << endl;
  }
  else{
	cout << "YES" << endl;
  }
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define PII pair<int,int>
#define ll long long
using namespace std;
const double PI = acos(-1.0);
const double eps = 1e-6;
int read()
{
    char ch=getchar();
    int x=0;
    while(ch>'9' || ch<'0') ch=getchar();
    while(ch<='9' && ch>='0') x=x*10+ch-'0',ch=getchar();
    return x;
}
int weight[105];
int sum[105];
int main()
{
    int n=read();
    for(int i=1;i<=n;i++) weight[i]=read();
    //sort(weight+1,weight+1+n);
    for(int i=1;i<=n;i++) sum[i]=weight[i]+sum[i-1];
    //for(int i=1;i<=n;i++) printf("%d ",weight[i]);
    //printf("\n");
    //for(int i=1;i<=n;i++) printf("%d ",sum[i]);
    //printf("\n");
    int ans=10000000;
    for(int i=1;i<=n;i++){
        ans=min(ans,abs(sum[n]-sum[i]*2));
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main
{
	public static void main(String arg[])
	{
		Scanner sc = new Scanner(System.in);
		int a[] = new int[6];
		while(sc.hasNext())
		{
			for(int i=0; i<6; i++)
				a[i]=sc.nextInt();
			boolean flag =false;

			a[2]=a[5]-a[2];
			if(a[2]<0)
			{
				a[2] = 60+a[2];
				a[1] = a[4]-a[1]-1;
				flag =true;
				if(a[1]<0)
				{
					a[1]=60+a[1];
					a[0]=a[3]-a[0]-1;
					for(int i=0; i<3; i++)
					{
						if(i==2)
							System.out.println(a[i]);
						else
							System.out.print(a[i]+" ");
					}
					continue;
				}
			}
			if(!flag)
				a[1]=a[4]-a[1];
			if(a[1]<0)
			{
				a[1]=60+a[1];
				a[0]=a[3]-a[0]-1;
				for(int i=0; i<3; i++)
				{
					if(i==2)
						System.out.println(a[i]);
					else
						System.out.print(a[i]+" ");
				}
				continue;
			}
			a[0]=a[3]-a[0];
			for(int i=0; i<3; i++)
			{
				if(i==2)
					System.out.println(a[i]);
				else
					System.out.print(a[i]+" ");
			}
		}
	}
}

Measured memory_bytes: 11000
#include <bits/stdc++.h> 
using namespace std;
typedef long long ll; const ll MM = 1000000000;ll mod = MM + 7;
#define rep(i, n) for(ll i=0; i<n; i++)
#define Rep(i, j, n) for(ll i=j; i<n; i++)
#define all(vec) vec.begin(), vec.end()
template<class T> inline bool chmin(T& a, T b) {if(a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) {if(a < b) {a = b; return true;} return false;}
const ll INF = 1LL << 60;

int main() {
    double a, b, c, d;
    while(1) {
        cin >> a >> b >> c >> d;
        if(a == 0 && b == 0 && c == 0 && d == 0) return 0;
        if(a / b >= c) cout << 0 << endl;
        else cout << ceil((c*b - a) / d) << endl;
    }
}


Measured memory_bytes: 3212
//Name: SAT-EN-3
//Level: 3
//Category: 構文解析
//Note:

/**
 * 加法標準形なので、X&~Xの形を含まない項があればその項は真にでき、全体も真になる。
 *
 * オーダーは O(|S|)。
 */
#include <iostream>
#include <string>
#include <cassert>
#include <map>

using namespace std;

pair<char,bool> literal(const string &str, int &pos) {
    pair<char,bool> res('\0', false);
    if(str[pos] == '~') {
        res.second = true;
        ++pos;
    }
    res.first = str[pos++];
    return res;
}

bool parse(const string &str, int pos) {
    if(pos >= str.size()) return false;
    if(str[pos] == '|') ++pos;
    assert(str[pos] == '(');
    ++pos;
    map<char,bool> vars;
    bool ok = true;
    for(int i = 0; i < 3; ++i) {
        pair<char,bool> var = literal(str, pos);
        if(vars.count(var.first) && vars[var.first] != var.second) {
            ok = false;
        }
        vars[var.first] = var.second;
        if(i != 2) {
            assert(str[pos] == '&');
            ++pos;
        }
    }
    assert(str[pos] == ')');
    ++pos;
    if(ok) return true;
    else return parse(str, pos);
}

bool solve() {
    string str;
    if(!(cin >> str)) return false;
    if(str == "#") return false;

    cout << (parse(str, 0) ? "yes" : "no") << endl;
    return true;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout.setf(ios::fixed);
    cout.precision(10);

    while(solve()) ;
    return 0;
}

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

int main(){
  int a,b;
  cin >> a>>b;
  int temp = 1;
  int count =0;
  rep(i,30){
    if(temp>=b){
      break;
    }
    temp +=a-1;
    count +=1;  
  }
  cout << count <<endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<(n);++i)
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
int gcd(int a,int b) { return b ? gcd(b,a%b) : a;}
int lcm(int a,int b) { return a/gcd(a,b)*b;}
void printb(unsigned int v) {
  unsigned int mask = (int)1 << (sizeof(v) * CHAR_BIT - 1);
  do putchar(mask & v ? '1' : '0');
  while (mask >>= 1);
}
void putb(unsigned int v) {putchar('0'), putchar('b'), printb(v), putchar('\n');}
#define ALL(W) (W).begin(),(W).end()

signed main(){
  int N,M,ans=0;
  cin >> N >> M;
  vector<int> a(N);
  rep(i,M){
    int k;
    cin >> k;
    rep(j,k){//スイッチごとに電球のonoffを管理
      int s;
      cin >> s;
      s--;//0-indexedに
      a[s] |= 1 << i;
    }
  }
  int p=0;
  rep(i,M){
    int x;
    cin >> x;
    p |= x << i;
  }
  //cout << "p:" << bitset<3>(p) << endl;
  rep(s,1<<N){//スイッチのオンオフ全探索
    //cout << "all:" << bitset<3>(s) << endl;
    int t=0;
    rep(i,N){//一桁ずつチェック
      if(s>>i & 1) t ^= a[i];
    }
    //cout << bitset<3>(t) << endl;
    if(t==p) ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define mod 1000000007
#define int long long int
#define phi 1.6180339
#define rep(i,n) for(auto i=0;i<(n);i++)
#define endl "\n"
#define For(i,a,b) for(auto i=(a);i<(b);i++)
#define op1 cin.tie(NULL)
#define op2 cout.tie(NULL)
#define op3 std::ios_base::sync_with_stdio(false)
#define MAXX 1000001
using namespace std;
vector<int> arr(MAXX);
void trozen()
{
    int n,k;
    cin>>n>>k;
    vector<int> v1(n+1);
    for(int i=1;i<=n;i++)cin>>v1[i];
    vector<int> dp(n+1);
    dp[0]=0;
    dp[1]=0;
    dp[2]=abs(v1[2]-v1[1]);
    for(int i=3;i<=n;i++)
    {
        dp[i]=INT_MAX;
        for(int j=i-1;j>max(0ll,i-k-1);j--)
        {
            dp[i]=min(dp[j]+abs(v1[j]-v1[i]),dp[i]);
        }
    }
    cout<<dp[n];
}
int32_t main()
{
    op1;op2;op3;
    /*#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif*/
    trozen();
    return 0;
}


Measured memory_bytes: 12688
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=5010,mod=1e9+7;
int fa[maxn],dep[maxn],val[maxn];
int F(int x){return (!fa[x])?x:fa[x]=F(fa[x]);}
struct edge{
	int u,v,w;
	friend bool operator < (edge a,edge b){return a.w<b.w;}
}e[maxn];
int n,m;
vector<pair<int,int> > G[maxn];
ll X,tot,s1,s2;
ll fpm(ll a,ll b){
	ll ret=1ll;
	for(;b;b>>=1,a=a*a%mod)
		if(b&1)ret=ret*a%mod;
	return ret;
}
void dfs(int u,int f){
	fa[u]=f;dep[u]=dep[f]+1;
	for(int i=0;i<G[u].size();++i){
		if(G[u][i].first!=f){
			val[G[u][i].first]=G[u][i].second;
			dfs(G[u][i].first,u);
		}
	}
}
int mx_dis(int x,int y){
	int ret=0;
	while(x!=y){
		if(dep[x]>dep[y])ret=max(ret,val[x]),x=fa[x];
		else ret=max(ret,val[y]),y=fa[y];
	}
	return ret;
}
void solve(){
	scanf("%d%d",&n,&m);
	scanf("%lld",&X);
	for(int i=1;i<=m;++i)
		scanf("%d%d%d",&e[i].u,&e[i].v,&e[i].w);
	sort(e+1,e+m+1);
	for(int i=1,u,v,s=1;i<=m;++i){
		u=F(e[i].u);v=F(e[i].v);
		if(u==v)continue;
		fa[u]=v;tot+=e[i].w;
		G[e[i].u].push_back(make_pair(e[i].v,e[i].w));
		G[e[i].v].push_back(make_pair(e[i].u,e[i].w));
		if(++s>=n)break;
	}
	dfs(1,0);
	for(int i=2,mx;i<=m;++i){
		mx=mx_dis(e[i].u,e[i].v);
		if(tot-mx+e[i].w==X)++s1;
		else if(tot-mx+e[i].w>X)++s2;
	}
	cout<<(fpm(2,s1)-1+mod)%mod*fpm(2,s2+1)%mod<<endl;
}
int main(){
	solve();

	return 0;
}


Measured memory_bytes: 512
#include<iostream>
#include<vector>
#include<string>
#include<deque>
#include<unordered_map>
#include<unordered_set>
#include<queue>
#include<algorithm>
#include<cmath>
#include<numeric>
using namespace std;
typedef long long LL;

const int MOD = 1e9+7;
void solve(){
    int n,m;
    cin>>n>>m;
    if(m>=n){
        cout<<"Yes"<<endl;
    }
    else cout<<"No"<<endl;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int T = 1;
    // cin>>T;
    while(T--){
        solve();
    }
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;

public class CSharp{
    public static void Main(){
        Kyopuro chokudai = new Kyopuro();
	    chokudai.AtCoder();
	}
}

public class Kyopuro{
    int n;
    List<List<int>> list;
    List<int>[] tree;
    List<int>[] ptree;
    bool[] v;
    int[] star;
    bool ans;
    
    public void AtCoder(){
        n = int.Parse(Console.ReadLine());
        tree = new List<int>[n];
        ptree = new List<int>[n];
        for (int i=0; i<n; i++){
            tree[i] = new List<int>();
            ptree[i] = new List<int>();
        }
        string[] s;
        for (int i = 0; i < n - 1; i++){
		    s = Console.ReadLine().Split(' ');
		    int a = int.Parse(s[0]) - 1;
		    int b = int.Parse(s[1]) - 1;
		    tree[a].Add(b);
		    tree[b].Add(a);
        }
        
        ans = false;
        v = new bool[n];
        v[0] = true;
        star = new int[n];
        list = new List<List<int>>();
        list.Add(new List<int>());
        list[0].Add(0);
        Bfs(1);
        int cc = 0;
        foreach(int x in ptree[0]){
            if(star[x] == 1) cc++;
        }
        if(cc != 1) ans = true;
        if(ans) Console.WriteLine("First");
        else Console.WriteLine("Second");
    }
    
    void Bfs(int d){
        list.Add(new List<int>());
        foreach(int p in list[d-1]){
            foreach(int q in tree[p]){
                if(!v[q]){
                    list[d].Add(q);
                    ptree[p].Add(q);
                    v[q] = true;
                }
            }
        }
        if(list[d].Count > 0){
            Bfs(d+1);
            foreach(int x in list[d]){
                star[x] = 1;
                int cc = 0;
                foreach(int y in ptree[x]){
                    if(star[y] == 1){
                        cc++;
                        star[x] = 0;
                    }
                }
                if(cc>1) ans = true;
            }
        }
    }
    
    public static void DebugWL(object x){ System.Diagnostics.Debug.WriteLine(x); }
}

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

int main()
{

   int n,k;
   cin>>n>>k;
   int a[n+1];
   for(int i=1;i<=n;i++)
   {

       cin>>a[i];
   }
   int dp[n+1];
   dp[1]=0;
   dp[2]=abs(a[2]-a[1]);
   int ans;
   for(int i=3;i<=n;i++)
   {
      ans=INT_MAX;

      for(int j=1;j<=k;j++)
      {
          if((i-j)>=1)
          ans=min(ans,dp[i-j]+abs(a[i]-a[i-j]));
      }

       dp[i]  = ans;
   }

   cout<<dp[n];

}

Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        int a = Integer.parseInt(s.substring(0, 1));
        int b = Integer.parseInt(s.substring(1, 2));
        int c = Integer.parseInt(s.substring(2, 3));
        int d = Integer.parseInt(s.substring(3, 4));
        String aSign = "";
        String bSign = "";
        String cSign = "";
        for(int i=0; i<Math.pow(2, 3); i++) {
            for(int j=0; j<2; j++) {
                if(j == 0) aSign = "+";
                else aSign = "-";
               for(int k=0; k<2; k++) {
                   if(k == 0) bSign = "+";
                   else bSign = "-";
                   for(int l=0; l<2; l++) {
                       int total = 0;
                       if(l == 0) cSign = "+";
                       else cSign = "-";
                       if("+".equals(aSign)) {
                           total = a + b;
                       }
                       else {
                           total = a - b;
                       }
                       if("+".equals(bSign)) {
                           total += c;
                       }
                       else {
                           total -= c;
                       }
                       if("+".equals(cSign)) {
                           total += d;
                       }
                       else {
                           total -= d;
                       }
                       if(total == 7) {
                           String ans = Integer.toString(a)
                                   + aSign
                                   + Integer.toString(b)
                                   + bSign
                                   + Integer.toString(c)
                                   + cSign
                                   + Integer.toString(d)
                                   + "=7";
                           System.out.println(ans);
                           return;
                       }
                   }
               }
            }
        }
    }
}

Measured memory_bytes: 41620
unittest
{
	assert( [ "7 7" ].parse.expand.solve == 2 );
	assert( [ "6 0" ].parse.expand.solve == 2 );
	assert( [ "18 10" ].parse.expand.solve == 7 );
	assert( [ "100 8" ].parse.expand.solve == 45 );
	
	assert( [ "2 7" ].parse.expand.solve == 0 );		// 追加ケース
}



import std.conv;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto nk = input.front.split.to!( long[] );
	return tuple( nk[ 0 ], nk[ 1 ] );
}

auto solve( long n, long k )
{
	if( n <= 2 ) return 0L;
	
	const M = 11L;
	
	auto cs = new long[ M ];
	auto t = ( 1 + 2 + 3 + 8 + 9 + 10 + 15 + 16 + 17 ) % M;
	foreach( y, ref c; cs )
	{
		foreach( x; 0L .. 5L )
		{
			if( t % M == k ) c++;
			t = ( t + 9 ) % M;
		}
		t = ( t + 18 ) % M;
	}
	
	auto ans = 0L;
	auto d = ( n - 2 ) / M;
	auto r = ( n - 2 ) % M;
	foreach( y, c; cs )
	{
		if( y < r ) ans += c * ( d + 1 );
		else        ans += c * d;
	}
	return ans;
}


Measured memory_bytes: 256
n=int(input())
c=[[0]*10 for _ in range(10)]
ans=0
for i in range(1,n+1):
    s=str(i)
    c[int(s[0])][int(s[-1])] += 1
    
for i in range(1,10):
    for j in range(1,10):
        ans += c[i][j] * c[j][i]
        
print(ans)

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

using ll = long long;
using ull = unsigned long long;

const double PI = acos(-1);
const int inf = 2e9;
const ll INF = 2e18;
const ll MOD = 1e9+7;

#define sz(s) (s).size()
#define pb push_back
#define fi first
#define se second
#define REP(i,n) for (int i = 0; i<n; i++)
#define ALL(a) begin(a), end(a)

int main (void) {
    string s;
    cin>>s;
    ll f = 0;
    ll x = stoi(s);
    REP(i,s.size()) f += s[i] - '0';
    if (x%f == 0) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Scanner;


class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		ArrayList<String> SL = new ArrayList<String>();
		while(true){
			int num = Integer.parseInt(in.readLine());
			if(num == 0){
				break;
			}
			ArrayList<String> shain = new ArrayList<String>();
			HashSet<String> over = new HashSet<String>();
			HashMap<String,Integer> sale = new HashMap<String,Integer>();
			for(int i = 0;i<num;i++){
				String[] ss = in.readLine().split(" ");
				if(!over.contains(ss[0])){	
					if(!sale.containsKey(ss[0])){	
						sale.put(ss[0],0);
						shain.add(ss[0]);
					}
					long s = (long)sale.get(ss[0])+(long)Integer.parseInt(ss[1])*(long)Integer.parseInt(ss[2]);
					
					if(s > 999999){
						over.add(ss[0]);
					}
					else{
						sale.put(ss[0],(int)s);
					}
				}
			}
			ArrayList<String> SLs = new ArrayList<String>();
			for(String s:shain){
				if(over.contains(s)){
					SLs.add(s);
				}
			}
			if(SLs.size() == 0){
				SLs.add("NA");
			}
			SL.addAll(SLs);
		}
		for(String s : SL){
			System.out.println(s);
		}

	}

}

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

#define int long long

int32_t main(){
	int n , k;
	cin >> n >> k ;
	int a[n] ;
	for(int i = 0 ; i < n ; i++) cin >> a[i] ;
	sort(a,a+n,greater<int>()) ;
	k = min(n,k) ;
	cout << accumulate(a+k,a+n,0LL) ;
	return 0 ;
}



Measured memory_bytes: 1792
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>
#include <random>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define RREP(i,m,n) for(int i=int(n)-1;i>=int(m);--i)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
//#define int long long

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;
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; }

constexpr double EPS = 1e-10;
//constexpr double PI  = acos(-1.0);
//constexpr int INF = INT_MAX;
constexpr int MOD = 1'000'000'007;
//inline void modAdd(LL &l, LL &r) {l = (l + r) % MOD;}

template<class T> inline T sqr(T x) {return x*x;}

void solve() {
    string s;
    cin >> s;
    if (s.size() % 2 == 1) {
        cout << "No" << endl;
        return;
    }
    REP(i,0,s.size()/2) {
        if (s.substr(i*2,2) != "hi") {
            cout << "No" << endl;
            return;
        }
    }
    cout << "Yes" << endl;
}

signed main() {
    solve();
    
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <list>
#include <ctime>
#include <sstream>
#include <queue>
#include <stack>
#include <bitset>
#include <numeric>
#include <cassert>
using namespace std;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;
#define FOR(x, b, e) for(int x=(b); x<=(e); ++x)
#define FORD(x, b, e) for(int x=((int)(b))-1; x>=(e); --x)
#define REP(x, n) for(int x=0; x<(n); ++x)
#define ALL(c) c.begin(),c.end()
#define sz(x) ((int)((x).size()))
#define pb push_back
#define st first
#define nd second
#define mp(x,y) make_pair(x,y)
typedef short int sint;

#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 << ((it != d.b) ? ", " : "") << *it;
  }
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

int val(char c) {
	if (c == 'R') return 0;
	if (c == 'G') return 1;
	if (c == 'B') return 2;
	return -1;
}

vector<vector<int>> pr;

int sumOf(int kt, int p, int q) {
	int res = pr[kt][q];
	if (p > 0) {
		res -= pr[kt][p-1];
	}
	return res;
}

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

	long long n;
	cin >> n;
	string x;
	cin >> x;
	long long total = 0;
	pr.assign(3, vector<int>(n, 0));
	pr[val(x[0])][0] = 1;
	for (int i=1; i < n; ++i) {
		++pr[val(x[i])][i];
		REP(j, 3) {
			pr[j][i] += pr[j][i - 1];
		}
	}
	for (int j=1;j<n-1;++j) {
		int curr = val(x[j]);
		int d1, d2;
		if (curr == 0 ) {
			d1 = 1, d2 = 2;
		} else if (curr == 1) {
			d1 = 0, d2 = 2;
		} else {
			d1 = 0, d2 = 1;
		}
		// d1 z przodu i d2 z tylu
		// d2 z przodu i d1 z tylu
		total += sumOf(d1, 0, j-1)*sumOf(d2, j+1, n-1) + sumOf(d2, 0, j-1)*sumOf(d1, j+1, n-1);
		for (int diff=1; j - diff >= 0 && j + diff < n; ++diff) {
			if (x[j - diff] != x[j] && x[j - diff] != x[j + diff] && x[j] != x[j + diff]) {
				--total;
			}
		}
	}
	cout << total << endl;
}

Measured memory_bytes: 3712
def warshallFloyd(V, dp):
    for k in range(V):
        for i in range(V):
            for j in range(V):
                dp[i][j] = min(dp[i][j], dp[i][k] + dp[k][j])

V, E = map(int,input().split())
dp = [[float('inf')]*V for _ in range(V)]
for i in range(V):
    dp[i][i] = 0
for _ in range(E):
    f, t, d = map(int,input().split())
    dp[f][t] = d
warshallFloyd(V, dp)

ncircle = False
for i in range(V):
    if dp[i][i] < 0:#負経路＝ある点から出て自分に帰ってくる経路＝点iから点i
        ncircle = True
if ncircle:
    print('NEGATIVE CYCLE')
else:
    for d in dp:
        print(' '.join(map(str, d)).replace('inf', 'INF'))



Measured memory_bytes: 5984
#include<stdio.h>

int main()
{
    int a,b,c,d;

    scanf("%d %d %d %d",&a,&b,&c,&d);

    if((a<b || a==b) && (c<d||c==d))
        printf("%d\n",a+c);
    else if((a<b || a==b) && (c>d||c==d))
        printf("%d\n",a+d);
    else if((a>b||a==b) && (c<d || c==d))
        printf("%d\n",b+c);
    else if((a>b||a==b) && (c>d || c==d))
        printf("%d\n",b+d);
    else if(a==b && c==d)
        printf("%d\n",a+c);

    return 0;
}


Measured memory_bytes: 1728