akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
#include <deque>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N; cin >> N;
  int d[101];
  CLR(d);
  FOR(i,0,N) {
    int in; cin >> in;
    d[in]++;
  }
  int ans = 0;
  FOR(i,0,101) {
    if(d[i] > 0) ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
n = int(input())
h = input().split()
for i in range(n):
  h[i] = int(h[i])

ans = 0
i = 0
while(i < n-1):
  tmp = 0
  i_tmp = i
  while(i_tmp<n-1):
    if h[i_tmp+1]>h[i_tmp]:
      break
    i_tmp += 1
    tmp += 1
  if tmp > ans:
    ans = tmp
  i += tmp+1
  
print(ans)


Measured memory_bytes: 11128
#include <bits/stdc++.h>
using namespace std;
#define int long long 
 
#define pi pair<int,int>
#define pb push_back
#define F first
#define S second
#define mod 1000000007
#define mx 1000000
#define mn 0
#define hello 123
int parent[200005];
int countt[200005];
int root(int x)
{
    if(parent[x]!=x)
        parent[x]=root(parent[x]);
    return parent[x];
}

signed main()
{
    int n,m,x,y,p,q;
    cin>>n>>m;
    for(int i=0;i<n;i++){parent[i]=i,countt[i]=1;}
    for(int i=0;i<m;i++)
    {
        cin>>x>>y;
        x--;y--;
        p=root(x);
        q=root(y);
        if(p!=q)
        {
            parent[p]=q;
            countt[q]+=countt[p];
            countt[p]=0;
        }
    }
    //for(int i=0;i<n;i++)cout<<countt[i]<<" ";cout<<endl;
    //for(int i=0;i<n;i++)cout<<parent[i]<<" ";cout<<endl;
    int ans=0;
    for(int i=0;i<n;i++)if(parent[i]==i)ans=max(ans,countt[i]);
    cout<<ans;
}

Measured memory_bytes: 6668
#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
#define REP(i,n) for(ll i=0; i<(n); i++)
#define REP2(i,x,n) for(ll i=x; i<(n); i++)
#define REP3(i,x,n) for(ll i=x; i>(n); i--)
#define zero_pad(num) setfill('0') << std::right << setw(num)
#define space_pad(num) setfill(' ') << std::right << setw(num)
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();
int main(){
    int a;
    cin >> a;
    cout << a*(a+1+a*a) << endl;
    return 0;
}

Measured memory_bytes: 3544
#include "stdio.h"
int main(int argc, char const *argv[])
{
	int room[4][3][10];
	int i,j,k,b,f,r,v,num;
	for(i=0;i<4;i++){
		for (j=0;j<3;j++){
			for (k=0;k<10;k++){
				room[i][j][k]=0;
			}
		}
	}

	scanf("%d",&num);

	for(i=0;i<num;i++){
		scanf("%d",&b); scanf("%d",&f); scanf("%d",&r); scanf("%d",&v);
		room[b-1][f-1][r-1] += v;
	}

	for(i=0;i<4;i++){
		for (j=0;j<3;j++){
			for (k=0;k<10;k++){
				printf(" %d",room[i][j][k]);
			}
			printf("\n");
		}
		if(i != 3)
			printf("####################\n");
	}

	return 0;
}


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

int main()
{
    string s;
    cin >> s;

    if (s[0] == s[1] && s[1] == s[2])
    {
        std::cout << "Yes" << std::endl;
    }
    else if (s[1] == s[2] && s[2] == s[3])
    {
        std::cout << "Yes" << std::endl;
    }
    else
    {
        std::cout << "No" << std::endl;
    }
}

Measured memory_bytes: 256
import java.util.Scanner;
class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int H = sc.nextInt();
        int W = sc.nextInt();
        int h = sc.nextInt();
        int w = sc.nextInt();

        System.out.println((H - h) * (W - w));
    }
}

Measured memory_bytes: 21972
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;

namespace ConsoleAppAtCoderABC169
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(ReadLine());
            var a = ReadLine().Split(' ').Select(s => long.Parse(s)).ToArray();

            var ans = 1L;

            if (a.Contains(0))
            {
                ans = 0;
            }
            else
            {
                try
                {
                    checked
                    {
                        foreach (var i in a)
                        {
                            ans *= i;
                        }

                        if (1000000000000000000 < ans)
                        {
                            ans = -1;
                        }
                    }
                }
                catch (OverflowException ex)
                {
                    ans = -1;
                }
            }

            WriteLine(ans);
        }
    }
}


Measured memory_bytes: 42612
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();
        String trim = line.replace("\n", "");
        String result = trim.replaceAll("hi", "");
        if (result.equals("")) {
            System.out.print("Yes");
        } else {
            System.out.print("No");
        }
        sc.close();
    }
}

Measured memory_bytes: 21972
from collections import defaultdict
N, M = map(int, input().split())
edges = defaultdict(list)
for _ in range(M):
    a, b, c = map(int, input().split())
    a, b = a-1, b-1
    edges[a].append((b, c))
INF = 10 ** 18

def bellman_ford():
    scores = [-INF] * N
    scores[0] = 0
    for i in range(N):
        for v in range(N):
            if scores[v] == -INF:
                continue
            for to, sc in edges[v]:
                if scores[v] + sc > scores[to]:
                    scores[to] = scores[v] + sc
                    if i == N - 1 and to == N - 1:
                        return 'inf'
    return scores[N - 1]

ans = bellman_ford()
print(ans)


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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
#define PI 3.14159265358979
#define MOD 1000000007 // = 10^9 + 7

using namespace std;
using ll = long long;

int n;
string s;
ll ans = 0;

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

void solve()
{
	cin >> n >> s;

	ll cnt[3] = { 0, 0, 0 };
	for(const auto& c : s)
	{
		cnt[toIndex(c)]++;
	}

	ans = cnt[0] * cnt[1] * cnt[2];

	for(int diff = 1; diff <= n / 2; ++diff)
	{
		for(int i = 0; i <= n - 1 - diff * 2; ++i)
		{
			int j = i + diff;
			int k = j + diff;
			if(s[i] != s[j] && s[i] != s[k] && s[j] != s[k])
			{
				ans--;
			}
		}
	}

	cout << ans << endl;
}

int main()
{
	fastio;
	solve();

	return 0;
}

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

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

struct Combination {
  int mod; // e.g. 1000000007
  vector<int> fact; // factorial
  vector<int> invf; // inverse factorial
  vector<vector<int> > part; // partition number

  /*
    constructor : O(sz+log(mod))   
    make factorial table (fact) and inverse factorial table (invf)
  */
  Combination(int sz, int mod) : fact(sz+1), invf(sz+1), mod(mod) {
    fact[0] = 1;
    for ( int i = 1; i < (int)fact.size(); i++ ) {
      fact[i] = fact[i-1]*i%mod;
    }
    invf[sz] = inv(fact[sz]);
    for ( int i = sz-1; i >= 0; i-- ) {
      invf[i] = invf[i+1]*(i+1)%mod;
    }
  }

  int pow(int x, int n) const {
    int ret = 1;
    while ( n > 0 ) {
      if ( n & 1 ) (ret *= x) %= mod;
      (x *= x) %= mod;
      n >>= 1;
    }
    return ret;
  }

  int inv(int x) const {
    return pow(x, mod - 2);
  }

  /*
    permutation
  */
  int P(int n, int r) const {
    if ( r < 0 || n < r ) return (0);
    return fact[n]*invf[n-r]%mod;    
  }

  /*
    combination
  */
  int C(int n, int r) const {
    if ( r < 0 || n < r ) return (0);    
    return fact[n]*invf[r]%mod*invf[n-r]%mod;    
  }  

  /*
    combination with repetition
  */
  int H(int n, int r) const {
    if ( n < 0 || r < 0 ) return 0;
    if ( n == 0 && r == 0 ) return 1;
    return C(n+r-1, n);    
  }

  /*
    stirling number
  */
  int S(int n, int r) const {
    int ret = 0;
    for ( int i = 1; i <= r; i++ ) {
      int add = C(r, i)*pow(i, n)%mod;      
      if ( (r-i)&1 ) ret += mod-add;
      else ret += add;
      ret %= mod;      
    }
    (ret *= invf[r]) %= mod;
    return ret;
  }

  /*
    bell number
  */
  int B(int n, int r) const {
    int ret = 0;
    for ( int i = 1; i <= r; i++ ) {
      (ret += S(n, i)) %= mod;      
    }
    return ret;
  }

  /*
    calc partition number
    return and make partition number table (part)
  */
  vector<vector<int> > built_part(int n, int r) {
    part = vector<vector<int> >(n+1, vector<int>(r+1, 0));
    part[0][0] = 1;
    for ( int i = 0; i <= n; i++ ) {
      for ( int j = 1; j <= r; j++ ) {
	if ( i-j >= 0 ) {
	  (part[i][j] = part[i][j-1]+part[i-j][j]) %= mod;	  
	} else {
	  part[i][j] = part[i][j-1];
	}
      }
    }
    return part;    
  }

  /*
    TODO 
    make built_part() that make only part[i][i]
    https://twitter.com/kirika_comp/status/953482654787149824
    http://d.hatena.ne.jp/DEGwer/20170829
    http://mathworld.wolfram.com/BellNumber.html
  }    
  */
};

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

  int N;
  cin >> N;

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

  const int MOD = 1e9+7;
  Combination C(2*N, MOD);  
  
  vector<int> sum_of_inv(N+1, 0);
  for ( int i = 1; i <= N; i++ ) {
    (sum_of_inv[i] = sum_of_inv[i-1] + C.inv(i)) %= MOD;    
  }

  int ans = 0;
  for ( int i = 1; i < N; i++ ) {
    (ans += (x[i]-x[i-1]) * sum_of_inv[i]) %= MOD;    
  }

  cout << ans*C.fact[N-1]%MOD << endl;
  
  return 0;
}


Measured memory_bytes: 4992
#include <algorithm>
#include <cmath>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <cassert>

using namespace std;

#define LOG(...) printf(__VA_ARGS__)
//#define LOG(...)
#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 ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())
#define CLR(a) memset((a), 0 ,sizeof(a))

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

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

bool table[120][120];

int main() {
    int t, n;

    while(cin >> t >> n, t|n){
        fill_n((bool *)table, 120 * 120, false);

        pii s;
        REP(i, n){
            int x, y;
            cin >> x >> y;
            table[y + 60][x + 60] = true;
        }
        int xx, yy;
        cin >> s.first >> s.second;
        s.first += 60;
        s.second += 60;

        queue<pii> que;
        que.push(s);
        que.push({500,500});

        int cnt = 1;
        while(!que.empty()){
            pii p = que.front(); que.pop();
            if(p.first == 500){
                if(--t == 0){
                    cout << cnt << endl;
                    break;
                }
                que.push(p);
                continue;
            }
            table[p.second][p.first] = true;

            REP(i, 6){
                int sx = p.first + dx[i];
                int sy = p.second + dy[i];
                if(table[sy][sx] == false){
                    table[sy][sx] = true;
//                        LOG("%d %d <- %d %d %d\n",sx-30, sy-30 ,p.first-30,p.second-30, t);
                    cnt ++;
                    que.push({sx, sy});
                }
            }
        }
    }

}

Measured memory_bytes: 1228
#include <iostream>
#include <set>



using namespace std;

int main()
{
  int n;
  cin>>n;
  if(n==1)
  {
  	cout<<"1 1"<<endl;
  }else
  {
  	set<int> st;
  	int tmp,over_red=0;
  	for(int i=0;i<n;i++)
    {
      cin>>tmp;
      if(tmp>=3200)
      {
         over_red++; 
      }else
      {
        st.insert(tmp/400);
      }
    }
    
    int under_red=st.size();    
    cout<<max(1,under_red)<<" "<<under_red+over_red<<endl;  
    
  }



}

Measured memory_bytes: 256
// luogu-judger-enable-o2
#include<bits/stdc++.h>
#pragma GCC optimize(2)
#pragma GCC optimize(3)
using namespace std;
int main(){
	unsigned long long a,b,x,ans,q;
	cin>>a>>b>>x;
    if(a%x==0){
    	ans=a/x;
    }else{
    	ans=a/x+1;
    }
    q=b/x;
    cout<<q-ans+1<<endl;
    
}

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

using namespace std;
int main() {
	
	for (int i=0; ; i++) {
		int a;
		string b;
		int c;
		cin >> a >> b >> c;
		if (b == "+")
			cout << a + c << endl;
		if (b == "-")
			cout << a - c << endl;
		if (b == "*")
			cout << a * c << endl;
		if (b == "/")
			cout << a / c << endl;

		if (b == "?") break;
	}
	



	return 0;

}



Measured memory_bytes: 3136
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<map>
#include<utility>
#include<functional>
#include<stack>
#include<queue>
#include<cmath>
# define MOD 1000000000+7
# define INF 1e9
# define LINF 1e18
typedef long long ll;

using namespace std;
int gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
 

bool broken[100000] = {false};
int dp[100010] = {};

int main() {

	int n = 0, m = 0;
	cin >> n >> m;

	for (int i = 0; i < m; i++) {
		int temp;
		cin >> temp;
		broken[temp] = true;
	}

	dp[0] = 1;

	for (int i = 0; i < n; i++) {
		for (int j = i + 1; j <= min(i + 2, n); j++) {

			if (broken[j] == false) {
				dp[j] += dp[i];
				dp[j] %= MOD;
			}

		}
	}

	cout << dp[n] << endl;

	return 0;

}

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

typedef long long ll;
//const int INF = 2e9;
//const ll INF = 9e18;


int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;
    int n = s.size();
    int l = 0;
    int r = n-1;
    int ans = 0;
    while (r>l){
        if (s[l] == s[r]){
            l++;r--;
        } else if (s[l] == 'x'){
            l++;ans++;
        } else if (s[r] == 'x'){
            r--;ans++;
        } else {
            cout << -1 << "\n";
            return 0;
        }
    }
    cout << ans << "\n";
}

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

typedef struct node node;
typedef struct edge{
    int w;
    node* target;
    struct edge* next;
}edge;
typedef struct node{
    int value;
    edge* fst;
    edge* lst;
}node;

void init(node* p){
    p->value = -1;
    p->fst = NULL;
    p->lst = NULL;
}

void add(node* p, node* target, int w){
    if(p->fst == NULL){
        p->fst = (edge*)malloc(sizeof(edge));
        p->lst = p->fst;
    }else{
        p->lst->next = (edge*)malloc(sizeof(edge));
        p->lst = p->lst->next;
    }
    p->lst->w = w;
    p->lst->target = target;
    p->lst->next = NULL;
}

void func(node* p){
    edge* e = p->fst;
    while(e != NULL){
        if(e->target->value == -1){
            if((e->w)%2){
                e->target->value = ((p->value)+1)%2;
            }else{
                e->target->value = p->value;
            }
            func(e->target);
        }
        e = e->next;
    }
}

int main(){
    int n;
    scanf("%d", &n);
    node a[n];
    for(int i=0; i<n; i++){
        init(&a[i]);
    }
    for(int i=0; i<n-1; i++){
        int u, v, w;
        scanf("%d%d%d", &u, &v, &w);
        u--;
        v--;
        add(&a[u], &a[v], w);
        add(&a[v], &a[u], w);
    }
    a[0].value = 0;
    func(&a[0]);
    for(int i=0; i<n; i++){
        printf("%d\n", a[i].value);
    }

    return 0;
}

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

  
int main() {
  int A,B;
  cin >>A>>B;
  if(A%3==0 || B%3==0 || (A+B)%3==0) puts("Possible");
  else puts("Impossible");
  return 0;
}


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

typedef long long ll;
const int N = 300;
int edge[N][N];

ll solve(int n){
  ll sum = 0;
  for(int i = 0;i < n;i++){
    for(int j = i+1;j < n;j++){
      sum += edge[i][j];
    }
  }
  for(int i = 0;i < n;i++){
    for(int j = i+1;j < n;j++){
      int decrease = 0;
      for(int k = 0;k < n;k++){
	if (k == i || k == j)continue;
	if (edge[i][j] > edge[i][k] + edge[k][j])return -1;
	if (edge[i][j] == edge[i][k] + edge[k][j]){
	  decrease = edge[i][j];
	}
      }
      sum -= decrease;
    }
  }
  return sum;
}

int main(){
  int n;
  cin >> n;
  for(int i = 0;i < n;i++){
    for(int j = 0;j < n;j++){
      cin >> edge[i][j];
    }
  }
  cout << solve(n) << endl;
  return 0;
}


Measured memory_bytes: 640
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
// const int INF = 2000000000;
// const ll MOD = 1000000007;

int N, H;
int max_a;
vector<int> a, b;
vector<int> use_b;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> N >> H;
  a.resize(N);
  b.resize(N);
  for (int i = 0; i < N; i++) {
    cin >> a[i] >> b[i];
    max_a = max(max_a, a[i]);
  }

  for (int i = 0; i < N; i++) {
    if (max_a < b[i]) {
      use_b.push_back(b[i]);
    }
  }
  sort(use_b.begin(), use_b.end(), greater<int>());

  int cnt = 0;
  for (int i = 0; i < use_b.size(); i++) {
    H -= use_b[i];
    cnt++;
    if (H <= 0) {
      cout << cnt << endl;
      return 0;
    }
  }

  if (H % max_a == 0) {
    cnt += (H / max_a);
  } else {
    cnt += (H / max_a) + 1;
  }

  cout << cnt << endl;
  return 0;
}

Measured memory_bytes: 1660
# import numpy as np
# import math
# import copy
# from collections import deque
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(10000)
from numba import njit,i8


@njit(i8(i8))
def sum_g(N):
    res = 0
    for i in range(1,N+1):
        end = N // i
        res += end * (end + 1) * i // 2
    return res


def main():
    N = int(input())

    res = sum_g(N)

    print(res)


main()


Measured memory_bytes: 108988
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, s, e) for (ll (i) = (s); (i) < (e); ++(i))
#define per(i, s, e) for (ll (i) = (s); (i) >= (e); --(i))
#define all(x) x.begin(),x.end()
 

int main(void) {
    int n; cin >> n;
    string s; cin >> s;
    vector<char> ans;
    
    int cnt = 0;
    char tmp = s[0];
    rep(i, 0, n) {
        if (s[i] == tmp) {
            cnt++;
        } else {
            ans.push_back(tmp);
            tmp = s[i];
            cnt = 1;
        }
    }
    ans.push_back(tmp);

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


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
ll gya(ll n,ll p,ll m){
	ll b=1;
	while(p){
		if(p%2)b=(b*n)%m;
		n=(n*n)%m;
		p/=2;
	}
	return b;
}
ll per[214514],be[214514];
ll comb(ll n,ll r){
	ll mod=1e9+7;

	ll x=per[n]*be[r]%mod*be[n-r]%mod;
	return x;
}
int main(){
	ll h,w,a,b,mod=1e9+7;
	cin>>h>>w>>a>>b;
	per[0]=per[1]=1;
	be[0]=be[1]=1;
	for(int i=2;i<=200010;i++){
		per[i]=i*per[i-1];
		per[i]%=mod;
		be[i]=gya(per[i],mod-2,mod);
	}
	ll ans=comb(h+w-2,h-1);
	for(int i=0;i<b;i++){
		ans=(ans-(comb(h-a-1+i,i)*comb(a+w-2-i,a-1)%mod)+mod)%mod;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 6664
#include <algorithm>
#include <bits/stdc++.h>
#include <bitset>
#include <cassert>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <memory>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <vector>
using namespace std;
#define REP(i, n) for (int64_t i = 0; i < (int64_t)n; i++)
#define REP_FOR(i, a, b) for (int64_t i = (int64_t)a; i < (int64_t)b; i++)
#define REP_REV(i, a, b) for (int64_t i = (int64_t)a; i > (int64_t)b; i--)
#define FORALL(v) (v).begin(), (v).end()
#define mp(a, b) make_pair(a, b)
#define eb(x) emplace_back(x)
#define F first
#define S second
typedef long long ll;
typedef long double ld;
typedef pair<int64_t, int64_t> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pdd;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<int64_t> vii;
typedef vector<vii> vvii;
const ll mod = 1e9 + 7;
const int64_t infi = 1147483600;
const ll infl = 4e18 + 5;
const char EOL = '\n';
//cout << fixed << setprecision(17) << res << endl;
const ll MOD = 998244353;

int main() {
    ll n, m;
    cin >> n >> m;
    vector<ll> A(m+1);
    for (ll i = 0; i < n; ++i) {
        ll k;
        cin >> k;
        for (ll j = 0; j < k; ++j) {
            ll a;
            cin >> a;
            ++A[a];
        }
    }
    ll res = 0;
    for (ll i = 1; i <= m; ++i) {
        if (A[i] == n) ++res;
    }
    cout << res << endl;
}


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

int main(int argc,char **argv) {
	int k,n;
	cin>>k>>n;
	for(int i=n-k+1;i<n;i++)
		cout<<i<<" ";
	cout<<n<<" ";
	for(int i=n+1;i<n+k;i++)
		cout<<i<<" ";
	cout<<endl;
	return 0;
}


Measured memory_bytes: 256
/*
これを入れて実行
g++ code.cpp
./a.out
 */
 
#include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>
#include <bitset>
 
using namespace std;
typedef long long ll;
typedef long double ld;
 
int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
 
const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;
 
bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}
 
ll gcd(ll a, ll b){
	if (b == 0)return a;
	return gcd(b, a % b);
}
 
ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}
 
ll nCr(ll n, ll r){
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return (nCr(n - 1, r) + nCr(n - 1, r - 1));
}
 
ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}
 
//-----------------------ここから-----------
ll n, m;
vector<pair<ll,ll>> prime;
ll factorial[201000];
ll invfactorial[201000];

ll extGCD(ll a, ll b, ll &x, ll &y){
	if (b == 0){
		x = 1;
		y = 0;
		return a;
	}
 
	ll d = extGCD(b, a % b, y, x);
	y -= a / b * x;
	return d;
}

ll nCrM(ll n, ll r){
	ll ret = factorial[n];
	ret *= invfactorial[n - r];
	ret %= MOD;
	ret *= invfactorial[r];
	ret %= MOD;
	return ret;
}

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

    ll tm = m;

    for(ll i = 2; i * i <= m; i++){
        if(tm % i == 0){
            ll cnt = 0;
            while(tm % i == 0){
                cnt++;
                tm /= i;
            }
            prime.push_back(make_pair(i, cnt));
        }
    }
    if(tm != 1) prime.push_back(make_pair(tm, 1));

    factorial[0] = 1;
	for (int i = 1; i < 201000; i++){
		factorial[i] = (factorial[i - 1] * i) % MOD;
	}
	for (int i = 0; i < 201000; i++){
		ll x, y;
		ll g = extGCD(factorial[i], MOD, x, y);
		while (x < 0) x += MOD;
		x %= MOD;
		invfactorial[i] = x;
	}

    ll ans = 1;
    for(auto &i : prime){
        ans *= nCrM(n + i.second - 1, i.second);
        ans %= MOD;
    }

    cout << ans % MOD << endl;
    


}

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

// syntax sugar: `for (int i = 0; i < N; ++i)`
#define rep(i, N) for (int i = 0; i < (int)(N); ++i)
#define rep2(i, startValue, N) for (int i = (int)(startValue); i < (int)(N); ++i)
// syntax sugar: `for (int i = 0; i < N; ++i)`
#define REP(type, name, beginValue, endCondValue) \
  for (type name = beginValue; name < endCondValue; ++name)
// syntax sugar: 多次元vector
#define VECTOR_DIM3(T, name, d1, d2, d3, initValue) \
    std::vector<std::vector<std::vector<T>>> name(d1, std::vector<std::vector<T>>(d2, std::vector<int>(d3, initValue)));
#define VECTOR_DIM2(T, name, d1, d2, initValue) \
    std::vector<std::vector<T>> name(d1, std::vector<T>(d2, initValue));
#define VECTOR_DIM1(T, name, d1, initValue) \
    std::vector<T> name(d1, initValue);
#define ll long long
#define ld long double
#define DUMP(v) "," #v ":" << v


// ABC165 D - Floor Function
int main(){
  ll a, b, n;
  cin >> a >> b >> n;

  ll x = min(n, b-1);
  ll ans = (a * x / b) - a * (x / b);
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3632
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
vector<int> v;
int main() {
	int h[100010]; int w[100010]; int i = 0; int a = 0;
	for (;;) {
		cin >> h[i] >> w[i];
		if (w[i] == 0 && h[i] == 0)
			break;
		i++;
		a = i;
	}
	for (int j = 0; j < a;j++) {
		for (int k = 0; k < h[j]; k++) {
			if (k == 0 || k == h[j] - 1) {
				for (int l = 0; l < w[j]; l++) {
					cout << "#";
				}
			}
			else {
				cout << "#";
				for (int l = 1; l < w[j] - 1; l++) {
					cout << ".";
				}
				cout << "#";
			}
			cout << endl;
		}
		cout << endl;
	}
}


Measured memory_bytes: 3104
#include<iostream>
#include<algorithm>
#include<cmath>
#include<map>
#include<string>
#include<set>
#include<vector>
using namespace std;

int solve(){
  int n;  cin >> n;
  cout << (n+1)/2 << endl;
}

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


Measured memory_bytes: 256
N, M = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(N)]
cnt = 0
ans = 0
i = 0
ab.sort()
while cnt < M:
    tmp = ab[i][1]
    prc = ab[i][0]
    ans += prc * tmp
    cnt += tmp
    i += 1
print(ans - (cnt-M)*prc)

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

typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P,ll> PLL;
typedef pair<P,P> PP;
typedef vector<ll> llVEC;
typedef vector<P> PVEC;
typedef priority_queue<P,PVEC,greater<P> > PPQ;
typedef priority_queue<ll, llVEC, greater<ll> > llPQ;

#define rep(i,a,n) for(ll i = a;i < n;i++)
#define rrep(i,a,n) for(ll i = n-1; i >= a;i--)
#define index_check(i,n) if(i > n-1 || i < 0) continue;
#define LINF (ll)1e18
#define INF (int)1e9
#define fs first
#define sc second

template<typename T>
ll sz(vector<T> &vec){ return (ll)vec.size(); }
ll sz(string &s){ return (ll)s.size(); }
ll gcd(ll a,ll b){ return ((!b) ?a :gcd(b, a%b)); }
ll lcm(ll a,ll b){ return a / gcd(a,b) * b; }

int main(){
    ll n;
    cin >> n;
    ll a[n] = {};
    rep(i,0,n) cin >> a[i];
    sort(a,a+n);

    cout << abs(a[0] - a[n-1]) << endl;
    return 0;
}


Measured memory_bytes: 3620
/*
Hey there stalker....

█▀▀▄░░░░░░░░░░░▄▀▀█
░█░░░▀▄░▄▄▄▄▄░▄▀░░░█
░░▀▄░░░▀░░░░░▀░░░▄▀
░░░░▌░▄▄░░░▄▄░▐▀▀
░░░▐░░█▄░░░▄█░░▌▄▄▀▀▀▀█
░░░▌▄▄▀▀░▄░▀▀▄▄▐░░░░░░█
▄▀▀▐▀▀░▄▄▄▄▄░▀▀▌▄▄▄░░░█
█░░░▀▄░█░░░█░▄▀░░░░█▀▀▀
░▀▄░░▀░░▀▀▀░░▀░░░▄█▀
░░░█░░░░░░░░░░░▄▀▄░▀▄
░░░█░░░░░░░░░▄▀█░░█░░█
░░░█░░░░░░░░░░░█▄█░░▄▀
░░░█░░░░░░░░░░░████▀
░░░▀▄▄▀▀▄▄▀▀▄▄▄█▀

Like what you see?
*/
#include <bits/stdc++.h>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define pii         pair<ll ,ll>
#define vi          vector<ll>
#define present(container, element) (container.find(element) != container.end()) /* For set n maps */
#define cpresent(container, element) (find(all(container),element) != container.end()) /* For vectors */
#define all(a)      (a).begin(),(a).end()
#define invect(data,n,commands) for(int i = 0;i<n;i++){int tmp;cin>>tmp;data.pb(tmp);commands}
#define inset(data,n,commands) for(int i = 0;i<n;i++){int tmp;cin>>tmp;data.I(tmp);commands}
#define F           first
#define S           second
#define I           insert
#define sz(x)       (ll)x.size()
#define rep(i,a,b)    for(ll  i=a;i<b;i++)
#define repr(i,a,b) for(ll  i=a;i>b;i--)
#define trav(a, x) 	for(auto& a : x)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define lcase(a) (char)tolower(a)
#define ll long long int
#define lld long double
#define endl "\n"
#define PI 3.14159265358979323844
#define MOD 1000000007
#define max(a, b) (a < b ? b : a)
#define min(a, b) ((a > b) ? b : a)
#define mod 1e9 + 7
const int N = 1e5 + 5;
/*	For Debugging	*/
#define DEBUG 		cerr<<"\n>>>I'm Here<<<\n"<<endl;
#define display(x) trav(a,x) cout<<a<<" ";cout<<endl;
#define what_is(x)  cerr << #x << " is " << x << endl;

int32_t main()
{
   IOS

    int TESTS=1;
    //cin >> TESTS;
    while (TESTS--)
    {
        ll n;
        cin >> n;
        map<string,int>mp;
        while(n--)
        {
            string s;
            cin >> s;
            mp[s]++;
        }
        cout<< "AC x"<<" "<<mp["AC"]<< endl;
        cout<< "WA x"<<" "<<mp["WA"]<< endl;
        cout<< "TLE x"<<" "<<mp["TLE"]<< endl;
        cout<< "RE x"<<" "<<mp["RE"]<< endl;




    }
    return 0;
}


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

#define rep(i,a,b)      for(int i=a;i<=b;i++)
#define revp(i,a,b)     for(int i=b;i>=a;i--)

string s;
int main()
{
    
    cin>>s;
    rep(i,1,s.length())
        cout<<'x';
}




Measured memory_bytes: 256
n = int(input())
l = [0] * n
for i in map(int,input().split()):
  l[i] += 1
if n % 2 == 0:
  al = [0] * n
  for i in range(1,n+1,2):
    al[i] = 2
  if l == al:
    print(pow(2,n//2,10**9+7))
  else:
    print(0)
else:
  al = [0] * n
  al[0] = 1
  for i in range(2,n+1,2):
    al[i] = 2
  if l == al:
    print(pow(2,n//2,10**9+7))
  else:
    print(0)

Measured memory_bytes: 52080
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <cassert>
using namespace std;

#define INF (1<<29)
#define MAX 55

typedef pair<int, int> P;

int N, D;
int cost[MAX][MAX];
P dp[MAX][MAX]; // dp[何泊目][泊まってるホテル] := (宿泊代の合計, 移動回数)

bool isValid(int p, int m, vector<int> path){
  int sum = 0;
  int move = 0;
  for(int i = 0 ; i < (int)path.size() ; i++) sum += cost[i][path[i]];
  for(int i = 1 ; i < (int)path.size() ; i++){
    if(path[i] != path[i-1]) move++;
  }
  if(p == sum && move == m) return true;
  else return false;
}

int main(){
  cin >> N >> D;
  for(int i = 0 ; i < N ; i++)
    for(int j = 0 ; j < D ; j++) cin >> cost[j][i];
  
  for(int i = 0 ; i < MAX ; i++)
    for(int j = 0 ; j < MAX ; j++) dp[i][j].first = dp[i][j].second = INF;
  
  vector<int>  paths[MAX][MAX];
  for(int j = 0 ; j < N ; j++){
    dp[0][j] = P(cost[0][j], 0);
    vector<int> p;
    paths[0][j].push_back(j);
  }
  
  for(int i = 1 ; i < D ; i++){
    for(int k = 0 ; k < N ; k++){
      for(int j = 0 ; j < N ; j++){
	
	P next = dp[i-1][k];	  
	next.first += cost[i][j];
	if(j != k) next.second += 1;	  
	
	vector<int> path;
	path = paths[i-1][k];
	path.push_back(j);
	
	if(dp[i][j] >= next){
	  dp[i][j] = min(dp[i][j], next);
	  paths[i][j] = path;
	}
      }
    }
  }

 for(int i = 1 ; i < D ; i++){
    for(int k = N-1 ; k >= 0 ; k--){
      for(int j = N-1 ; j >= 0 ; j--){
	
	P next = dp[i-1][k];	  
	next.first += cost[i][j];
	if(j != k) next.second += 1;	  
	
	vector<int> path;
	path = paths[i-1][k];
	path.push_back(j);
	
	if(dp[i][j] >= next){
	  dp[i][j] = min(dp[i][j], next);
	  paths[i][j] = min(paths[i][j], path);
	}
      }
    }
  }

 for(int i = 1 ; i < D ; i++){
    for(int k = 0 ; k < N ; k++){
      for(int j = 0 ; j < N ; j++){
	
	P next = dp[i-1][k];	  
	next.first += cost[i][j];
	if(j != k) next.second += 1;	  
	
	vector<int> path;
	path = paths[i-1][k];
	path.push_back(j);
	
	if(dp[i][j] >= next){
	  dp[i][j] = min(dp[i][j], next);
	  paths[i][j] = min(paths[i][j], path);
	}
      }
    }
  }

  
  /*
  for(int i = 0 ; i < D ; i++){
    for(int j = 0 ; j < N ; j++){
      cout << " (" << dp[i][j].first << ", " << dp[i][j].second << ") "; 
    }
    cout << endl;
  }
*/
  P ans;
  ans.first = ans.second = INF;
  for(int j = 0 ; j < N ; j++) ans = min(ans, dp[D-1][j]);
  
  cout << ans.first << ' ' << ans.second << endl;
    
  vector<int> ans_path;
  
  for(int j = 0 ; j < N ; j++){
    if(dp[D-1][j] == ans){
      if(!isValid(ans.first, ans.second, paths[D-1][j])) continue;	
      if(ans_path.size() == 0) ans_path = paths[D-1][j];
      else ans_path = min(ans_path, paths[D-1][j]);
    }
  }
  
  if(ans_path.size() == 0) assert(false);
  for(int i = 0 ; i < ans_path.size() ; i++){
    cout << ans_path[i]+1 << endl;
  }
  return 0;
}

Measured memory_bytes: 1604
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i <= n; i++)
#define INF 2e9
#define IMAX 1000000007
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long llong;

// AGC041-A
int main()
{
	long N, A, B;
	cin >> N >> A >> B;

	long dif;
	long ans;
	if (A > B) {
		dif = A - B;
	} else {
		dif = B - A;
	}

	if (dif % 2 == 0) {
		// 差が偶数
		ans = dif / 2;
	} else {
		long difw;
		// 差が奇数
		if (A > B) {
			difw = min(B-1, N-A);
		} else {
			difw = min(A-1, N-B);
		}
		ans = difw + 1 + dif / 2;
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <numeric> // accumulate(v.begin(), v.end(), 0)

using namespace std;
#define ll long long

int main(){
  int a, b, c, d, e, k;
  cin >> a >> b >> c >> d >> e >> k;
  if(e - a > k)
    cout << ":(" << endl;
  else
    cout << "Yay!" << endl;
  return 0;
}

Measured memory_bytes: 256
function Main(input) {
    var A = parseInt(input[0], 10);
    var B = parseInt(input[1], 10);
    var C = parseInt(input[2], 10);
    var D = parseInt(input[3], 10);

    var tNum = Math.ceil(C/B);
    var aNum = Math.ceil(A/D);

    console.log(tNum <= aNum ? 'Yes' : 'No');
}

Main(require("fs").readFileSync("/dev/stdin", "utf8").trim().split(/\n|\s/));

Measured memory_bytes: 29632
#include <iostream>
#include <cstring>
#include <algorithm>

using namespace std;

int main() {
  
  for(int N, M; cin >> N >> M;) {
    int dp[3][330];
    int w[N];
    int v[N][3];
    for(int i=0; i<N; i++) {
      string s; cin.ignore(); getline(cin, s);
      cin >> w[i] >> v[i][0] >> v[i][1] >> v[i][2];
    }
    
    memset(dp, 0, sizeof dp);
    for(int k=0; k<3; k++) {
      for(int i=0; i<N; i++) {
        for(int j=w[i]; j<=M; j++) {
          dp[k][j] = max(dp[k][j], dp[k][j-w[i]] + v[i][k]);
        }
      }
    }
    
    cout << max(dp[0][M], max(dp[1][M], dp[2][M])) << endl;
    
  }
  
  return 0;
}

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

int main(){
    long long N,a,b,minB=1000000000,sum=0;
    cin >> N;
    for(int i=0; i<N; i++){
        cin >> a >> b;
        sum+=a;
        if(a>b && minB>b)
        minB=b;
    }
    if(minB==1000000000)
    cout << 0 << endl;
    else
    cout << sum-minB << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define maxn 200005
vector<int> a(maxn),vis(maxn,-1);
long long i,j,n,k,cur,num,l;
int main(){
  cin>>n>>k;
  for(i=0;i<n;i++) cin>>a[i],a[i]-=1;
  while(vis[cur]==-1&&num<k){
    vis[cur]=num;cur=a[cur];num++;
  }
  k-=vis[cur];l=num-vis[cur];
  for(i=0;i<k%l;i++) cur=a[cur];
  cout<<cur+1;
  return 0;
}


Measured memory_bytes: 4680
#include<math.h>
#include<iostream>
#include <algorithm>
#include <string>
#include<vector>
#include <array>
#include<tuple>
#include<queue>
#include<stack>
#include<iomanip>
#include<bitset>
//AtCoderC++.cpp

using namespace std;

vector<long long> comb = vector<long long>(100 * 100,-1);

long long combination(long long n, long long r) {
	if (n == 1 || n == 0)return 1;
	if (n == r)	return 1;
	else if (r == 0)return 1;
	else if (r == 1)return n;
	else if (comb[100 * (n - 1) + (r - 1)] != -1) return comb[100 * (n - 1) + (r - 1)];
	else {
		auto res = combination(n - 1, r - 1) + combination(n - 1, r);
		comb[100 * (n - 1) + (r - 1)] = res;
		return res;
	}
}

int max_divider(int n, int max) {
	for (size_t i = max; i > 0; i--) {
		if (n%i == 0)return i;
	}
}

int main() {
	int N, M; cin >> N >> M;
	//Mの約数を探せ
	//M=123
	//{1,3,41}
	//M=41に帰着させる
	//N=10
	//和が41になる10個の整数
	//{6,2,6,2,6,2,6,2,6,5}
	cout << max_divider(M, M / N) << endl;
}



Measured memory_bytes: 384
main(){char s[99],*p;while(~scanf("%[ a-z.]\n",s)){while(!strstr(s,"the")&!strstr(s,"this")&!strstr(s,"that"))for(p=s;*p;p++)*p>96&&*p<122?++*p:*p-122||(*p=97);puts(s);}return 0;}

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

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	int n;
	cin >> n;
	vector<int> a(n);
	for(int& x : a) cin >> x;
	int ans = 0;
	
	for(int i = 0; i < n; ) {
		int j = i+1;
		while(j < n && a[j-1] >= a[j]) {
			j++;
		}
		
		ans = max(ans, j - i-1);
		i = j;
	}
	
	cout << ans << endl;
}


Measured memory_bytes: 640
import math
# import numpy as np  # Pythonのみ！
# from operator import xor
# import re
# from scipy.sparse.csgraph import connected_components  # Pythonのみ！
# ↑cf.  https://note.nkmk.me/python-scipy-connected-components/
# from scipy.sparse import csr_matrix
# import string
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():

    r=int(input())
    print(math.pi*r*2)

resolve()

Measured memory_bytes: 9164
fn read_stdin() -> String {
    use std::io::Read;
    let mut input = String::new();
    std::io::stdin().read_to_string(&mut input).unwrap();
    input
}

fn scan<'a, I: Iterator<Item = &'a str>, T: std::str::FromStr>(tokens: &mut I) -> T {
    tokens.next().unwrap().parse().ok().unwrap()
}

fn main() {
    let input = read_stdin();
    let tokens = &mut input.split_whitespace();
    let n: usize = scan(tokens);
    let k: usize = scan(tokens);
    let mut ans = 0;
    for _ in 0..n {
        let h: usize = scan(tokens);
        if h >= k {
            ans += 1;
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll inf=1e9+7;
const ll mod=1e9+7;
vector<vector<int> >G(100010);
ll color[100010];
ll b,w;
bool dfs(int i,int c){
    bool f=1;
    if(c==1)b++;
    if(c==-1)w++;
    for(auto e:G[i]){
        if(color[i]==color[e]){
            f=0;break;
        }
        else if(color[e]==0){
            color[e]=-c;
            if(!dfs(e,-c)){
                f=0;break;
            }
        }
    }
    return f;
}

int main(){
    ll n,m;cin>>n>>m;
    b=0,w=0;
    rep(i,m){
        int a,b;cin>>a>>b;
        G[a].pb(b);
        G[b].pb(a);
    }
    color[1]=1;
    if(dfs(1,1)){
        cout<<b*w-m<<endl;
    }else{
        cout<<(n*(n-1))/2-m<<endl;
    }
}

Measured memory_bytes: 6912
import qualified Data.ByteString.Char8 as BS
import Data.Maybe

getString = BS.unpack <$> BS.getLine

findACGT :: String -> [Int]
findACGT [] = []
findACGT ss = length (fst spanned) : findACGT (snd spanned)
  where
    dropped = dropWhile (`notElem` "ACGT") ss
    spanned = span (`elem` "ACGT") dropped

main = do
  ss <- getString
  print $ maximum (findACGT ss)


Measured memory_bytes: 380
N,M=map(int,input().split())
high_list=list(map(int,input().split()))
highest=[True]*N
for i in range(M):
    a,b=map(int,input().split())
    if(high_list[a-1]>=high_list[b-1]):
        highest[b-1]=False
    if(high_list[a-1]<=high_list[b-1]):
        highest[a-1]=False
print(sum(highest))




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

int main()
{
  int n, k;
  scanf("%d%d", &n, &k);
  vector<int> a(n);
  for(int &i : a)
  {
    scanf("%d", &i);
  }
  vector<bool> dp(k + 1);
  for(int i = 1; i <= k; i++)
  {
    for(int j = 0; j < n; j++)
    {
      if(i - a[j] >= 0 and !dp[i - a[j]])
      {
        dp[i] = true;
      }
    }
  }
  cout << (dp[k] ? "First" : "Second");
  
  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <cmath>
#include <iostream>
using namespace std;
typedef unsigned long long ui64;
typedef long long i64;
void MaximumDifference() {
	int N;
	cin >> N;
	i64 A[101];
	for (size_t i = 0; i < N; i++)
	{
		cin >> A[i];
	}
	i64 m = 0;
	for (size_t i = 0; i < N; i++)
	{
		for (size_t j = i + 1; j < N; j++)
		{
			m = max(m, abs(A[i] - A[j]));
		}
	}
	cout << m;
}
int main() {
	MaximumDifference();
	return 0;
}

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

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

#define p_ary(ary,a,b) do { cout << "["; for (int count = (a);count < (b);++count) cout << ary[count] << ((b)-1 == count ? "" : ", "); cout << "]\n"; } while(0)
#define p_map(map,it) do {cout << "{";for (auto (it) = map.begin();;++(it)) {if ((it) == map.end()) {cout << "}\n";break;}else cout << "" << (it)->first << "=>" << (it)->second << ", ";}}while(0)

template<typename T1,typename T2>ostream& operator<<(ostream& os,const pair<T1,T2>& a) {os << "(" << a.first << ", " << a.second << ")";return os;}

const char newl = '\n';

int main() {
    ll k,m = 0;
    cin >> k;
    for (int i = 0;i < k;++i) {
        m = (m*10+7)%k;
        if (m == 0) {
            cout << i+1 << endl;
            return 0;
        }
    }
    cout << -1 << endl;
}

Measured memory_bytes: 3484
#include <cmath>
#include <iostream>
#include <iomanip>
using namespace std;

int main(int argc, char const *argv[])
{
	double a, b, C;
	double S, L, h;

	cin >> a >> b >> C;
	double PI = acos(-1);
	C=C*PI/180;
	S=a*b*sin(C)/2.0;
	L=a + b + sqrt(a*a + b*b -2*a*b*cos(C));
	h=b*sin(C);

	cout <<fixed << S << " " << L <<" " << h << endl;
	return 0;
}


Measured memory_bytes: 3588
import numpy as np

def input_numbers():
    temp = list(map(int, input().split()))
    return temp

def GCD(a, b):
    if(a < b):
        temp = a
        a = b
        b = temp
    a = a % b
    if(a == 0):
        return b
    else:
        return GCD(a, b)

n = int(input())

ls = [[0, 0, 0]]

for i in range(n):
    temp = input_numbers()
    ls += [temp]

ls.sort(key = lambda x:x[0])

for i in range(1, n + 1):
    dis = abs(ls[i][1] - ls[i - 1][1]) + abs(ls[i][2] - ls[i - 1][2])
    time = abs(ls[i][0] - ls[i - 1][0])

    flag = 0
    if(dis > time):
        flag = 1
    elif((time - dis) % 2 == 1):
        flag = 1
    
    if(flag == 1):
        print('No')
        break

if(flag == 0):
    print('Yes')


Measured memory_bytes: 37112
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     @hamayanhamayan0
　　　　／　　　＼　 　  |　|
　　　 /　　 /￣￣￣￣/　　|
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿
　 　　　＼/＿＿＿＿/　（u　⊃
---------------------------------------------------------------------------------------------------*/













const int MA = 1000001;
int N, A[201010];
int cnt[1010101];
bool ok[1010101];
//---------------------------------------------------------------------------------------------------
void _main() {
	cin >> N;
	rep(i, 0, N) cin >> A[i];

	rep(i, 0, N) cnt[A[i]]++;
	rep(x, 1, MA) ok[x] = true;
	rep(x, 1, MA) if(0 < cnt[x]) {
		if (1 < cnt[x]) ok[x] = false;
		for (int x2 = x * 2; x2 < MA; x2 += x) ok[x2] = false;
	}

	int ans = 0;
	rep(i, 0, N) if (ok[A[i]]) ans++;
	cout << ans << endl;
}







Measured memory_bytes: 9200
import java.util.Scanner;

class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt();
	    int b = scan.nextInt();

	    int d = a / b;
	    int r = a % b;
	    double  f = ((double)a /(double)b);
	    System.out.print(d + " " + r + " ");
	    System.out.printf("%.5f",f);

	 
	}
}

Measured memory_bytes: 26556
import java.util.*;
public class Main{
    static Scanner kbd = new Scanner(System.in);
    public static void main(String[] args){
	solve();
    }

    static void solve(){
	String[] w = new String[1000]; //単語保存
	int[] t = new int[1000];       //単語の回数
	String ml = "";               //最大の単語長を持つ単語
	int mt = 0;                    //最も多く出た単語の配列番号
	int a=0, i=0;
	while(kbd.hasNext()){
	    String s = kbd.next();
	    while(i<a && s.compareToIgnoreCase(w[i])!=0) i++;
	    if(i==a) {
		if(ml.length() < s.length()) ml = s;
		w[i] = s.toLowerCase();
		//System.out.println(w[i]);
		t[i]++;
		if(t[mt] < t[i]) mt = i;
		a++;
	    }
	    else{
		t[i]++;
		if(t[mt] < t[i]) mt = i;
	    }
	    i=0;
	}
	System.out.println(w[mt]+" "+ml);
    }
}

Measured memory_bytes: 17168
#include <vector>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>

using namespace std;

#define LL long long
const int maxn = 2e5 + 7;

LL a[maxn],f[maxn];
int n;

bool check(LL x,LL k) {
    for(int i = 1 , j = n ; i <= n ; i++ , j--) {
        LL temp = a[i] * f[j];
        if(temp > x) {
            k -= (temp - x) / f[j];
            if((temp - x) % f[j] != 0) k--;
        }
        if(k < 0) break;
    }
    if(k >= 0) return true;
    else return false;
}

int main() {
    LL k;
    while(~scanf("%d%lld",&n,&k)) {
        for(int i = 1 ; i <= n ; i++) {
            scanf("%lld",&a[i]);
        }
        for(int i = 1 ; i <= n ; i++) {
            scanf("%lld",&f[i]);
        }
        sort(a+1,a+n+1);
        sort(f+1,f+n+1);
        LL l = 0 , r = a[n]*f[n];
        LL ans = 0;
        while(l <= r) {
            LL mid = (l + r + 1LL) >> 1;
            if(check(mid,k)) {
                ans = mid;
                r = mid - 1;
            } else {
                l = mid + 1;
            }
        }
        printf("%lld\n",ans);
    }
    return 0;
}


Measured memory_bytes: 3328
#include <iostream>
#include <string>

struct node
{
  int key;
  node *parent=nullptr, *left=nullptr, *right=nullptr;
};

using tree = node*;

void preOrder(tree t)
{
  std::cout << " " << t->key;
  if (t->left != nullptr)
    preOrder(t->left);
  if (t->right != nullptr)
    preOrder(t->right);
}

void inOrder(tree t)
{
  if (t->left != nullptr)
    inOrder(t->left);
  std::cout << " " << t->key;
  if (t->right != nullptr)
    inOrder(t->right);
}

void insert(tree &t, int key)
{
  node *new_node = new node;
  new_node->key = key;
  if (t == nullptr)
    {
      t = new_node;
      //std::cout << "New: " << t->key << std::endl;
    }
  else
    {
      tree cur_node = t;
      auto parent = cur_node->parent;
      while (cur_node != nullptr)
        {
          parent = cur_node;
          if (key < cur_node->key)
            cur_node = cur_node->left;
          else
            cur_node = cur_node->right;
        }
      if (key < parent->key)
        {
          parent->left = new_node;
        }
      else
        {
          parent->right = new_node;
        }
      new_node->parent = parent;
    }
}

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

  std::string order;
  tree root = nullptr;
  for (int i=0; i<n; ++i)
    {
      std::cin >> order;
      if (order == "insert")
        {
          int key;
          std::cin >> key;
          insert(root, key);
        }
      else if (order == "print")
        {
          inOrder(root);
          std::cout << std::endl;
          preOrder(root);
          std::cout << std::endl;
        }
    }
}




Measured memory_bytes: 26616