akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define roop0(n) for(long long i = 0;i < n;i++)
#define roop1(n) for(long long i = 1;i < n;i++)
#define rep(i,a,b) for(long long i = a; i < b; i++)
#define print(a) for(auto x : a) cout << x << " "; cout << "\n"

using namespace std;
using vi   = vector<int>;
using vll  = vector<long long>;
using vs   = vector<string>;
using vvi  = vector<vector<int>>;
using vvll = vector<vector<long long>>;
using vvs  = vector<vector<string>>;

const static string el = "\n";
long long result = 0;
vi A;
int n;


int main () {
  cin >> n;
  A = vi(n);
  roop0(n) {
    int tmp; cin >> tmp; 
    A[i] = tmp;
  }
  
  int date = 1;
  long long money = 1000;
  long long kabu = 0;
  roop0(n) {
    // cout << money << " " << kabu << endl;
    if (A[date - 1] == A[date]) {
      
    }
    else if (A[date - 1] > A[date]) { // 今日より明日のほうが安いので株をすべて売る
      long long sellable = kabu;
      money += A[date - 1] * sellable;
      kabu = 0;
    }
    else if (A[date - 1] < A[date]) { // 今日より明日のが高いので全額使って買う
      long long buyable = money / A[date - 1];
      money -= buyable * A[date - 1];
      kabu += buyable;
    }
    date++;
  }

  if (kabu > 0) money += kabu * A[n - 1];
  cout << money << endl;
  return 0;
}


Measured memory_bytes: 3576
import java.io.*;
import java.util.*;

public class Main {
	
	static int w, h;
	static boolean[][] ice;
	
	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		String s = sc.next();
		if(s.charAt(2) == s.charAt(3) && s.charAt(4) == s.charAt(5)) {
			prtln("Yes");
		}else {
			prt("No");
		}
	}
	
	static int[] dx = {1, 0, -1, 0};
	static int[] dy = {0, 1, 0, -1};
	
	public static void prtln(String s) {
		System.out.println(s);
	}
	
	public static void prt(String s) {
		System.out.print(s);
	}
}

class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() { return Double.parseDouble(next());}
}


Measured memory_bytes: 23124
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>	// require sort next_permutation count __gcd reverse etc.
#include <cstdlib>	// require abs exit atof atoi 
#include <cstdio>		// require scanf printf
#include <functional>
#include <numeric>	// require accumulate
#include <cmath>		// require fabs
#include <climits>
#include <limits>
#include <cfloat>
#include <iomanip>	// require setw
#include <sstream>	// require stringstream 
#include <cstring>	// require memset
#include <cctype>		// require tolower, toupper
#include <fstream>	// require freopen
#include <ctime>		// require srand
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(A) A.begin(), A.end()

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
int grid[1005][1005];
int dp[1005][1005];

int main()
{
//	cut here before submit 
//	freopen ("testcase.walk", "r", stdin );
	int h, w, n;
	while (scanf ("%d %d %d", &h, &w, &n ), h, w, n ){
		memset (grid, 0, sizeof (grid ) );
		rep (i, h ){
			rep (j, w ){
				scanf ("%d", &grid[i][j] );// 1 : 東 0 : 南
			} // end rep
		} // end rep

		memset (dp, 0, sizeof (dp ) );
		dp[0][0] = n - 1;
		for (int i = 1; i < h; i++ ){
			int k = dp[i-1][0];
			dp[i][0] = (k % 2 == 0 ? k/2 : (!grid[i-1][0] ? (k+1)/2 : (k-1)/2 ) );
		} // end for
		for (int j = 1; j < w; j++ ){
			int m = dp[0][j-1];
			dp[0][j] = (m % 2 == 0 ? m/2 : ( grid[0][j-1] ? (m+1)/2 : (m-1)/2 ) );
		} // end for
		for (int i = 1; i < h; i++ ){
			for (int j = 1; j < w; j++ ){
				int k = dp[i-1][j], m = dp[i][j-1];
				dp[i][j] += (k % 2 == 0 ? k/2 : (!grid[i-1][j] ? (k+1)/2 : (k-1)/2 ) );	
				dp[i][j] += (m % 2 == 0 ? m/2 : ( grid[i][j-1] ? (m+1)/2 : (m-1)/2 ) );
			} // end for
		} // end for

		int row = 0, col = 0;
		while (row < h && col < w ){
			if ((dp[row][col] + grid[row][col] ) % 2 == 0 ){
				row++;
			}else{
				col++;
			} // end if
		} // end while 
 
		printf ("%d %d\n", row+1, col+1 );	
	} // end loop
		
	return 0;
}

Measured memory_bytes: 9084
N=int(input())
A=[]
for i in range(N):
    A.append(int(input()))
maxim=max(A)

new_list=sorted(A)
second=new_list[N-2]


for i in range (N):
  if A[i]!=maxim:
    print(maxim)
  else:
    print(second)

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

int n;
char s[200005];
int pre[200005],suf[200005];

int main(){

    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    cin>>n;
    cin>>s+1;
    for(int i=1;i<=n;i++){
        pre[i]=pre[i-1]+(s[i]=='R');
    }
    for(int i=n;i>=1;i--){
        suf[i]=suf[i+1]+(s[i]=='W');
    }
    cout<<min(pre[n]-pre[pre[n]],suf[1]-suf[n-suf[1]+1])<<endl;

    return 0;
}

Measured memory_bytes: 5404
#include <cstdio>

using namespace std;

int main()
{
	int a, b, c, d;
	scanf("%d %d %d %d", &a, &b,&c,&d);
	if(a*b>c*d){
		printf("%d", a*b);
	}
	if(a*b<c*d){
		printf("%d", c*d);
	}
	if(a*b==c*d){
		printf("%d", a*b);
	}
}



Measured memory_bytes: 128
/*
 * ある学校には、N 人の生徒がいます。
 * 
 * 生徒たちをいくつかのグループに分け、グループごとにあるテーマについて話し合ってもらうこととなりました。
 * 
 * あなたは、2 人以下のグループだと効果的な話し合いが出来ないと考えており、なるだけ多くのグループを 3 人以上にしたいです。
 * 
 * 生徒たちを上手く分けて、3 人以上のグループの数を最大化してください。
 */

import java.util.*;
	public class Main{
        public static void main(String[] args){
            Scanner sc = new Scanner(System.in);
            // 入力
            int n = Integer.parseInt(sc.next());
            // 出力
            System.out.println(n/3);
            sc.close();
        }
    }


Measured memory_bytes: 23764
using System;
using System.Linq;

namespace ConsoleApp6
{
    class Program
    {
        static void Main()
        {
            var a = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            var patterns = from x in Enumerable.Range(0, a[0] + 1)
                           from y in Enumerable.Range(0, a[0] + 1 - x)
                           let z = a[0] - x - y
                           where x * 10000 + y * 5000 + z * 1000 == a[1]
                           select new { x, y, z };
            var p = patterns.FirstOrDefault();
            Console.WriteLine(p == null ? "-1 -1 -1" : $"{p.x} {p.y} {p.z}");
        }
    }
}


Measured memory_bytes: 15604
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String[] tmp = sc.nextLine().split(" ");
		int r = Integer.parseInt(tmp[0]);
		int d = Integer.parseInt(tmp[1]);
		int x2000 = Integer.parseInt(tmp[2]);
		sc.close();

		int xi = x2000;
		for(int i=0; i<10; i++) {
			xi = r*xi - d;
			System.out.println(xi);
		}
	}
}


Measured memory_bytes: 21584
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const ll LINF = 1e18;
const int MOD = 1e9 + 7;

int main() {
  ll r, D, x;
  cin >> r >> D >> x;
  for (int i = 2001; i <= 2010; i++) {
    x = r * x - D;
    cout << x << endl;
  }
}

Measured memory_bytes: 256
def swap():
  N = int(input())
  P = [int(x) for x in input().split()]
  Q = sorted([int(x) for x in P])
  ans = 0
  for i in range(N):
    if ans!=3:
      if P[i]!=Q[i]:
        ans += 1
    else:
      break
  if ans==0 or ans==2:
    print("YES")
  else:
  	print("NO")
if __name__=="__main__":
  swap()


Measured memory_bytes: 3060
import bisect
import sys
import math
import itertools
sys.setrecursionlimit(10000)

INF = float('inf')

# input macro
def i():
    return int(raw_input())
def ii():
    return map(int,raw_input().split(" "))
def s():
    return raw_input()
def ss():
    return raw_input().split(" ")
def slist():
    return list(raw_input())
#

def join(s):
    return ''.join(s)

#iterate macro
def piter(n,m):
    return itertools.permutations(n,m)
def citer(n,m):
    return itertools.combinations(n,m)

#modulo macro
def modc(a,b,m):
    c = 1
    for i in xrange(b):
        c = c * (a - i) % m
        c = c * modinv(i + 1,m) % m
    return c
 
def gcd(a, b):
    (x, lastx) = (0, 1)
    (y, lasty) = (1, 0)
    while b != 0:
        q = a // b
        (a, b) = (b, a % b)
        (x, lastx) = (lastx - q * x, x)
        (y, lasty) = (lasty - q * y, y)
    return (lastx, lasty, a)
 
def modinv(a, m):
    (inv, q, gcd_val) = gcd(a, m)
    return inv % m

#bisect macro
def index(a, x):
    #Locate the leftmost value exactly equal to x
    i = bisect_left(a, x)
    if i != len(a) and a[i] == x:
        return i
    return -1

#memoize macro
def memoize(f):
    cache = {}
    def helper(*args):
        if args not in cache:
            cache[(args)] = f(*args)
        return cache[args]
    return helper

@memoize
def nck(a,b,m):
    b = min([a-b,b])
    if (b>a or b<0 or a<0):
        return 0
    elif a == 0:
        return 1
    return (nck(a-1,b-1,m)+nck(a-1,b,m)) % m

nh=zip([1,0,-1,0],[0,1,0,-1])

###########

st=slist()
k=i()

for j in range(len(st)):
    o=ord(st[j])
    if k >= 123-o and st[j]!='a':
        k -= (123-o)
        st[j]='a'
        
n=97+(ord(st[len(st)-1])-97+k)%26

st[len(st)-1] = chr(n)
print join(st)


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

#define mod 1000000007
#define ll long long int
#define mk make_pair
#define pb push_back
#define xx first
#define yy second
#define ar array
#define del 1e-8

template<typename T, typename U> static inline void amin(T &x, U y){ if(y<x) x=y; }
template<typename T, typename U> static inline void amax(T &x, U y){ if(x<y) x=y; }

double pi=3.141592653589793238;
const int M = 1e9+7;
const int Nmax=5005;
const int MM = 998244353;
const int N=1000005;


int main()
{
	//ios_base::sync_with_stdio(0), cin.tie(0);
	int T=1;
	//cin>>T;
	while(T--){
      ll n,x,m;
      cin>>n>>x>>m;
      ll ans=0;
      ll k=x;
      map<ll,ll> s;
      int flag=0;
      for(ll i=1;i<=n;i++){
        if(flag==0 && s.count(k)){
            flag=1;
            ll in=(i-s[k]);
            ll pc=0;
            ll kk=k;
            for(ll j=i;j<i+in;j++){
                pc+=kk;
                kk=(kk*kk)%m;
            }
            ll bulk=(n-i+1)/in;
            ans+=bulk*pc;
            i+=bulk*in;
        }
        if(i<=n){
        ans+=k;
        if(flag==0)s[k]=i;
        k=(k*k)%m;
        }
       // cout<<i<<" -=-\n";
      }
      cout<<ans<<"\n";
    }
	return 0;
}


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

int ans = 0;
vector<int> used(100100, 0);

void solve(vector<vector<int> > &graph, int s){
    if(used[s] == 1){return;}
    else{
        used[s] = 1;
        for(int i = 0; i < graph[s].size(); i++){
            solve(graph, graph[s][i]);
        }
    }
}

int main(){
    int n, m; cin >> n >> m;
    vector<vector<int> > graph(n);
    int ans = 0;
    for(int i = 0; i < m; i++){
        int a, b, c; cin >> a >> b >> c;
        a--; b--;
        graph[a].push_back(b);
        graph[b].push_back(a);
    }
    for(int i = 0; i < n; i++){
        if(used[i] == 0){
            ans++;
            solve(graph, i);
        }
    }
    cout << ans << endl;
}

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




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

    int n,a,b;
    cin >> n >> a >> b;
    cout << min(a, b) << ' ' << max(0, a + b - n) << endl;


    return 0;
}


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

int main() {
  int x1, x2, x3, x4, x5;
  cin >> x1 >> x2 >> x3 >> x4 >> x5;
  int ans = 0;

  if (x1 == 0) ans = 1;
  if (x2 == 0) ans = 2;
  if (x3 == 0) ans = 3;
  if (x4 == 0) ans = 4;
  if (x5 == 0) ans = 5;

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3616
/*
         ██╗ ██████╗ ██╗███╗   ██╗    ██╗   ██╗███████╗
         ██║██╔═══██╗██║████╗  ██║    ██║   ██║██╔════╝
         ██║██║   ██║██║██╔██╗ ██║    ██║   ██║███████╗
    ██   ██║██║   ██║██║██║╚██╗██║    ██║   ██║╚════██║
    ╚█████╔╝╚██████╔╝██║██║ ╚████║    ╚██████╔╝███████║
     ╚════╝  ╚═════╝ ╚═╝╚═╝  ╚═══╝     ╚═════╝ ╚══════╝
*/
//password:+BdCHpO8dQvpo5fnV3/u
#include<bits/stdc++.h>

using namespace std;
typedef long long ll;
const int maxn = 5e5 + 5;
const int inf = 0x3f3f3f3f;



int main() {
    int n;
    cin>>n;
    map<string,ll>mp;
    for(int i=0;i<n;i++)
    {
        string s;
        cin>>s;
        sort(s.begin(),s.end());
        mp[s]++;
    }
    ll ans=0;
    for(auto it:mp)
        ans+=it.second*(it.second-1)/2;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 11136
h1,h2 = map(int,input().split())
k1,k2 = map(int,input().split())
a,b,c,d = map(int,input().split())
h = h1*a+h2*b+h1//10*c+h2//20*d
k = k1*a+k2*b+k1//10*c+k2//20*d
if h < k:
    print("kenjiro")
elif h > k:
    print("hiroshi")
else:
    print("even")


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

int main() {
  
  int N;
  cin >> N;
  int count = 3;
  
  for(int i=0;i<N;i++){
    string color;
    cin >> color;
    if(color == "Y") count = 4;
  }
  
  if(count == 4) 
    cout << "Four" << endl;
  else 
    cout << "Three" << endl;
  
}

Measured memory_bytes: 256
# dpE
import sys
input = sys.stdin.readline

def main():
    N, W = tuple(map(int, input().rstrip().split()))
    A = tuple(tuple(map(int, input().rstrip().split())) for _ in range(N))
    _, V = zip(*A)
    lim = sum(V)  # the max value not considering weight
    dp = [0] + [float("inf")] * lim
    for i in range(N):
        for j in range(lim, A[i][1] - 1, -1):
            dp[j] = min(dp[j], dp[j - A[i][1]] + A[i][0])
    ans = [i for i, j in enumerate(dp) if j <= W]
    print(max(ans))


if __name__ == "__main__":
    main()

Measured memory_bytes: 72524
#include<bits/stdc++.h>
#define F first
#define S second
#define endl '\n'
#define MP make_pair
#define pb push_back

using namespace std;

typedef pair<int, int> P;
typedef pair<int, P> i_P;
typedef long long LL;

static const int INF = INT_MAX;
static const int MIN = INT_MIN;
static const LL L_INF = LLONG_MAX;
static const int MOD = 1000000000 + 7;
static const int SIZE = 100005;

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

    int n, m;
    cin >> n >> m;

    int two_p = 1;
    for( int i = 0; i < m; ++i ) two_p *= 2;

    cout << ( two_p * m * 1900 ) + ( 100 * ( n - m ) * two_p ) << endl;
    return 0;
}



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

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL

Node root;

Node treeMinimum(Node x){
  if(x->left==NIL)
    return x;
  else
    return treeMinimum(x->left);

}

Node treeMaximum(Node x){


}

Node treeSearch(Node u, int k){
  if(u==NIL)
    return u;
  
  else if(u->key>k)
    return treeSearch(u->left,k);
  else if(u->key<k)
    return treeSearch(u->right,k);
  else
    return u;
}

Node treeSuccessor(Node x){


}

void treeDelete(Node z){
  Node y; // node to be deleted
  Node x; // child of y



}

void insert(int k){
  Node y = NIL;
  Node x = root;
  Node np,z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;
  
  if(x==NULL){
    root=z;
    root->parent=NIL;
  }
  else{
  
  for(np=x;;){
    if(np->key>k){
      if(np->left!=NIL)
      np=np->left;
      else{
	np->left=z;
	break;
      }
    }
    else{
      if(np->right!=NIL){
	np=np->right;
	}
    else{
      np->right=z;
      break;
    }
	}
  }
  z->parent=np;
  }

}

void inorder(Node u){
  if (u==NIL)
    return;
  inorder(u->left);
    printf(" %d",u->key);
  inorder(u->right);
}
void preorder(Node u){
  if(u==NIL)
    return;
  printf(" %d",u->key);
  preorder(u->left);
  preorder(u->right);
}


int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'f' ){
      scanf("%d", &x);
      Node t = treeSearch(root, x);
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");
    } else if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    } else if ( com[0] == 'd' ){
      scanf("%d", &x);
      treeDelete(treeSearch(root, x));
    }
  }

  return 0;
}



Measured memory_bytes: 20492
#include<iostream>
using namespace std;
int main(){
  int n;
  int mapp[9][9];
  int koteiyoko,koteitate;
  cin>>n;
  for(int mawa=0;mawa<n;mawa++){
    if(mawa!=0){
      cout << endl;
    }
    for(int i=0;i<9;i++){
      for(int j=0;j<9;j++){
	cin>>mapp[i][j];
      }
    }
    for(int i=0;i<9;i++){
      for(int j=0;j<9;j++){
	koteiyoko=mapp[i][j];
	for(int k=0;k<9;k++){
	  if(koteiyoko==mapp[i][k]%10 && k!=j){
	    mapp[i][k]+=10;
	    mapp[i][j]+=10;
	  }
	}
      }
    }
    for(int i=0;i<9;i++){
      for(int j=0;j<9;j++){
	koteitate=mapp[i][j];
	for(int k=0;k<9;k++){
	  if(koteitate==mapp[k][j]%10 && k!=i){
	    mapp[i][j]+=10;
	    mapp[k][j]+=10;
	  }
	}
      }
    }
    int block[3][3][10]={0};
    for(int i=0;i<9;i++){
      for(int j=0;j<9;j++){
	block[i/3][j/3][mapp[i][j]%10]++;
      }
    }
    for(int i=0;i<9;i++){
      for(int j=0;j<9;j++){
	if(block[i/3][j/3][mapp[i][j]%10]>1){
	  mapp[i][j]+=10;
	}
      }
    }
    for(int i=0;i<9;i++){
      for(int j=0;j<9;j++){
	if(mapp[i][j]>=10){
	  cout<<'*'<<mapp[i][j]%10;
	}else{
	  cout<<' '<<mapp[i][j];
	}
      }
      cout<<endl;
    }
  }
}
     

Measured memory_bytes: 1160
grid = []
3.times do
  grid << gets.split(" ").map(&:to_i)
end

ans = "Yes"

2.times do |i|
  row = grid[i]
  nextrow = grid[i+1]
  tmp1 = row[0] - nextrow[0]
  tmp2 = row[1] - nextrow[1]
  tmp3 = row[2] - nextrow[2]
  if !(tmp1 == tmp2 && tmp1 == tmp3)
    ans = "No"
    break
  end
end

2.times do |i|
  grid = grid.transpose
  row = grid[i]
  nextrow = grid[i+1]
  tmp1 = row[0] - nextrow[0]
  tmp2 = row[1] - nextrow[1]
  tmp3 = row[2] - nextrow[2]
  if !(tmp1 == tmp2 && tmp1 == tmp3)
    ans = "No"
    break
  end
end

puts ans

Measured memory_bytes: 1788
#include <stdio.h>

int main(int argc, const char * argv[])
{

    double eyel, eyer;
    int i, left[4] = {0}, right[4] = {0};
    
    while(scanf("%lf %lf", &eyel, &eyer) != EOF) {
        if (eyel >= 1.1) {
            left[0]++;
        } else if (eyel >= 0.6) {
            left[1]++;
        } else if (eyel >=0.2) {
            left[2]++;
        } else {
            left[3]++;
        }
        if (eyer >= 1.1) {
            right[0]++;
        } else if (eyer >= 0.6) {
            right[1]++;
        } else if (eyer >= 0.2) {
            right[2]++;
        } else {
            right[3]++;
        }
    }
    
    for (i = 0; i < 4; i++) {
        printf("%d %d\n", left[i], right[i]);
    }
    
    return 0;
}

Measured memory_bytes: 628
#include <iostream>
#include <algorithm>

int main(int argc, char *argv[]) {  
	int n, a[123];
	std::cin >> n;
	for (int i = 0; i < n; i++) {
		std::cin >> a[i];
	}
	std::sort(a, a+n);
	std::cout << a[n-1] - a[0];
}

Measured memory_bytes: 256
//
//  main.cpp
//
// https://atcoder.jp/contests/abc133/tasks/abc132_f

#include <algorithm>
#include <array>
#include <assert.h>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <math.h>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

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

struct Mod {
    static ll BASE;
    ll value = 0;
    static ll residue(ll value) {
        return (value % BASE + BASE) % BASE;
    }
    Mod(ll value) : value(residue(value)) {}
    Mod operator+(const Mod& rhs) {
        return Mod(value + rhs.value);
    }
    Mod operator-(const Mod& rhs) {
        return Mod(value - rhs.value);
    }
    Mod operator*(const Mod& rhs) {
        return Mod(value * rhs.value);
    }
    void operator*=(const Mod& rhs) {
        *this = *this * rhs;
    }
};
ll Mod::BASE = 1000000007;

int main(int argc, char* argv[]) {
    int N;
    int K;
    cin >> N >> K;
    // floors = { floor(N/n) | 1 <= n <= N } を昇順にソートしたもの
    // (O(sqrt(N))で求める方針に修正予定)
    set<int> floors_set;
    if (N >= 2) {
        for (int n = 1; n * (n+1) <= N; n++) {
            floors_set.insert(N/n);
        }
        for (int n = *floors_set.begin(); n >= 1; n--) {
            floors_set.insert(n);
        }
    } else {
        floors_set.insert(1);
    }
    vector<int> floors;
    for (int n : floors_set) {
        floors.push_back(n);
    }
    unordered_map<int, int> inv_floors;
    for (int i = 0; i < floors.size(); i++) {
        inv_floors[floors[i]] = i;
    }
    // dp_a[k][i] = 長さkの列で末尾の数が(floors[f-1], floors[f]]の範囲にはいるものの個数
    vector<vector<Mod>> dp_a;
    vector<Mod> dp_a_init;
    dp_a_init.resize(floors.size(), Mod(0));
    dp_a.resize(K+1, dp_a_init);
    // dp_b[k][i] = 長さkの列で末尾の数が(0, floors[f]]の範囲にはいるものの個数
    vector<vector<Mod>> dp_b;
    vector<Mod> dp_b_init;
    dp_b_init.resize(floors.size(), Mod(0));
    dp_b.resize(K+1, dp_b_init);
    for (int i = 0; i < floors.size(); i++) {
        dp_b[0][i] = Mod(1);
    }
    for (int k = 1; k <= K; k++) {
        for (int f_idx = 0; f_idx < floors.size(); f_idx++) {
            Mod range(1);
            if (f_idx > 1) {
                range = Mod(floors[f_idx]) - Mod(floors[f_idx - 1]);
            }
            int f = floors[f_idx];
            dp_a[k][f_idx] = range * dp_b[k-1][inv_floors[N/f]];
            if (f_idx == 0) {
                dp_b[k][f_idx] = dp_b[k-1][floors.size()-1];
            } else {
                dp_b[k][f_idx] = dp_b[k][f_idx-1] + dp_a[k][f_idx];
            }
        }
    }
    cout << dp_b[K][floors.size()-1].value << endl;
    return 0;
}



Measured memory_bytes: 107800
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>

using namespace std;

typedef long long ll;

template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

int main(void) {
    int N;
    cin >> N;

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

    deque<int> q;
    for (int i = 0; i < N; i++) {
        auto it = lower_bound(q.begin(), q.end(), A[i]);
        if (it == q.begin()) {
            q.push_front(A[i]);
        } else {
            q[it - q.begin() - 1] = A[i];
        }
    }

    cout << q.size() << endl;

    return 0;
}


Measured memory_bytes: 1024
#!/usr/bin/env python3
from collections import defaultdict, deque
import sys

YES = "Yes"  # type: str


def solve(N: int, M: int, A: "List[int]", B: "List[int]"):
    edges = defaultdict(list)
    for i in range(M):
        edges[A[i] - 1].append(B[i] - 1)
        edges[B[i] - 1].append(A[i] - 1)
    queue = deque()
    queue.append(0)
    before_node = [None] * N
    while queue:
        node = queue.popleft()
        for next_node in edges[node]:
            if before_node[next_node] is None:
                queue.append(next_node)
                before_node[next_node] = node + 1
    print("Yes")
    print("\n".join(map(str, before_node[1:])))
    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    A = [int()] * (M)  # type: "List[int]"
    B = [int()] * (M)  # type: "List[int]"
    for i in range(M):
        A[i] = int(next(tokens))
        B[i] = int(next(tokens))
    solve(N, M, A, B)

if __name__ == '__main__':
    main()


Measured memory_bytes: 67472
#include <iostream>
#include <string>
#include <stdio.h>
#include <list>

using namespace std;

main(void){
  int n, i = 0, key = 0;
  char command[100];
  list<int> lst;

  scanf("%d",&n);

  for(i = 0;i < n;i++){
    scanf("%s%d", command, &key);
    if(command[0] == 'i'){
      lst.push_front(key);
    }
    else if(command[6] == 'F'){
      lst.pop_front();
    }
    else if(command[6] == 'L'){
      lst.pop_back();
    }
    else{
      for(auto itr = lst.begin();itr != lst.end();itr++){
	if(*itr == key){
	  lst.erase(itr);
	  break;
	}
      }
    }
  }

  int flag = 0;

  for(auto itr = lst.begin();itr != lst.end();itr++){
    if(flag == 1){
      printf(" ");
    }
    printf("%d",*itr);
    flag = 1;
  }

  printf("\n");
  
  return 0;
}



Measured memory_bytes: 34384
def base(n, b):
    d="abcdefghijklmnopqrstuvwxyz"
    s = []
    while True:
        s.append(d[n % b])
        n = n//b -1
        if n < 0:
          break
    return ''.join(reversed(s))
print(base(int(input())-1,26))

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

#define pb push_back
#define all(c) c.begin(),c.end()
#define allr(c) c.rbegin(),c.rend()
#define MOD 1000000007
#define PI 3.14159265
#define endl '\n'
#define MAX 501

using namespace std;

void quick () {
    cin.tie(0);
    cout.tie(0);
    ios_base::sync_with_stdio(0);/*//*/
}

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

int diva (int n) {
    int counter = 0;
    for (int i = 1 ; i <= n ;i++){
        if (n%i==0)counter++;
    }
    return counter;
}

void readFromText(){
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    #endif // ONLINE_JUDGE
}

int main()
{
    quick();
//    readFromText();
    string s ; long long k ;cin >> s >> k; long double current = 0 ;
    for (int i = 0 ; i < s.length() ; i++){
        if (s[i]=='1'){
            long double old = current ;
            current+=1;
            if (current==k){
                cout << 1 ;
                break;
            }
        }else if (s[i]=='2'){
            current+=(pow(2,5*1e15));
            if (current>=k){
                cout << 2 ;
                break;
            }
        }else if (s[i]=='3'){
            current+=(pow(3,5*1e15));
            if (current>=k){
                cout << 3 ;
                break;
            }
        }else if (s[i]=='4'){
            current+=(pow(4,5*1e15));
            if (current>=k){
                cout << 4 ;
                break;
            }
        }else if (s[i]=='5'){
            current+=(pow(5,5*1e15));
            if (current>=k){
                cout << 5 ;
                break;
            }
        }else if (s[i]=='6'){
            current+=(pow(6,5*1e15));
            if (current>=k){
                cout << 6 ;
                break;
            }
        }else if (s[i]=='7'){
            current+=(pow(7,5*1e15));
            if (current>=k){
                cout << 7 ;
                break;
            }
        }else if (s[i]=='8'){
            current+=(pow(8,5*1e15));
            if (current>=k){
                cout << 8 ;
                break;
            }
        }else if (s[i]=='9'){
            current+=(pow(9,5*1e15));
            if (current>=k){
                cout << 9 ;
                break;
            }
        }
    }
    return 0;
}


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

int main(){
    int N;
    string S;
    cin >> N >> S;

    int maxs=0;
    for (int i = 1; i < N; i++){
        string s = S.substr(0, i);
        string t = S.substr(i, S.size());

 //       cout << s << ":" << t << endl;

        vector<int> cnts(26,0);
        vector<int> cntz(26,0);
        for (int j = 0; j < i; j++){
            cnts[s[j] - 'a']++;
        }
        for (int j = 0; j < N-i; j++){
            cntz[t[j]-'a']++;
        }

        int var = 0;
        for (int j = 0; j < 26; j++){
            if(cnts[j] != 0 && cntz[j] != 0){
                var++;
            }
        }
        maxs = max(maxs, var);
    }

    cout << maxs << endl;
    
}

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

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            string str = cin.ReadLine;

            int cnt = 0;
            int aPos = 0;
            int zPos = 0;
            for (int i = str.Length-1; i >= 0; i--)
            {
                if (str[i] == 'Z') 
                {zPos = i;
                    break;
                }
                

            }
            
            for (int i = 0; i < str.Length; i++)
            {
                if (str[i] == 'A') 
                {aPos = i;
                    break;
                }
                
            }
            
            WriteLine(zPos - aPos + 1);
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); }}
        public int ReadInt { get { return int.Parse(Read); }}
        public long ReadLong { get { return long.Parse(Read); }}
        public double ReadDouble { get { return double.Parse(Read); }}
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret;}
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret;}
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret;}
    }
}


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

#define PI 3.14159265358979323846264338327950288

int main()
{
	int A, B, H, M;
	scanf("%d%d%d%d", &A, &B, &H, &M);

	double ax = -A * sin(-2 * PI * (H / 12.0 + M / 720.0));
	double ay = A * cos(-2 * PI * (H / 12.0 + M / 720.0));
	double bx = -B * sin(-PI * M / 30);
	double by = B * cos(-PI * M / 30);

	double dx = ax - bx;
	double dy = ay - by;
	double len2 = dx * dx + dy * dy;
	printf("%.10f\n", sqrt(len2));

	return 0;
}


Measured memory_bytes: 2536
using System;

namespace String
{
    class Finding_a_Word
    {
        static void Main(string[] args)
        {
            var W = Console.ReadLine().ToLower();
            var line = "";
            var c = 0;
            while((line=Console.ReadLine())!= "END_OF_TEXT")
            {
                var token = line.ToLower().Split(' ');
                for (int i = 0; i<token.Length; i++)
                    if (W == token[i]) c++;
            }
            Console.WriteLine(c);
        }
    }
}

Measured memory_bytes: 9164
n = int(input())
v_array = [int(x) for x in input().split()]
c_array = [int(x) for x in input().split()]

res = 0
for i in range(n):
    if v_array[i] < c_array[i]:
        continue
    else:
        res += v_array[i]- c_array[i]

print(res)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()
#ifdef _DEBUG_
	#define debug(...) printf(__VA_ARGS__)
#else
	#define debug(...) (void)0
#endif
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;

int main() {
	string S;
	cin >> S;
	int ans=0;
	for(int i=SZ(S)-2;i>=0;i--)
		if(S[i]!=S[i+1])
			ans++;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 512
# ABC042A - 和風いろはちゃんイージー / Iroha and Haiku (ABC Edition)
def main():
    A = sorted(map(int, input().split()))
    flg = A == [5, 5, 7]
    print("YES" if flg else "NO")


if __name__ == "__main__":
    main()

Measured memory_bytes: 2940
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <stack>
#include <functional>

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
    #define eprintf(...) 42
#endif

#define rep_(i, a_, b_, a, b, ...) for (int i = (a), i##_len = (b); i < i##_len; ++i)
#define rep(i, ...) rep_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define reprev_(i, a_, b_, a, b, ...) for (int i = (b-1), i##_min = (a); i >= i##_min; --i)
#define reprev(i, ...) reprev_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define all(x) (x).begin(), (x).end()
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; }
// template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int,int> P;
typedef long double ld;

constexpr int MOD = 1000000007;

// + - * / ^
int mod(int a)
{
    int res = a % MOD;
    if(res < 0) {
        return res + MOD;
    }
    return res;
}
int mul_mod(int a, int b)
{
    ll res = ((ll)a * (ll)b) % MOD;
    return mod((int)res);
}
int pow_mod(int a, int b)
{
    ll res = 1;
    while (b > 0) {
        if(b & 1) {
            res = res * (ll)a % (ll)MOD;
        }
        a = mul_mod(a, a);
        b >>= 1;
    }
    return (int)res;
}
int inv_mod(int a)
{
    return pow_mod(a, MOD - 2);
}
int div_mod(int a, int b)
{
    return mul_mod(a, inv_mod(b));
}

// ! C
constexpr int FAC_MAX = 1500001;
ll fac[FAC_MAX], finv[FAC_MAX], inv[FAC_MAX];
void com_init()
{
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < FAC_MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
ll com_mod(int a, int b){
    if (a < b) return 0;
    if (a < 0 || b < 0) return 0;
    return fac[a] * (finv[b] * finv[a - b] % MOD) % MOD;
}

int main (void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    com_init();
    int n; cin >> n;
    vector<int> a(n + 1); rep (i, a.size()) cin >> a[i];
    map<int, int> m;
    int p, q;
    rep (i, a.size()) {
        if (m[a[i]] != 0) {
            p = m[a[i]] - 1; q = i;
            break;
        } else {
            m[a[i]] = i + 1;
        }
    }
    rep (k, 1, n + 2) {
        ll ans = 0;
        ans = mod(ans + com_mod(n - 1, k - 2));
        ans = mod(ans + com_mod(n - 1, k));       
        ans = mod(ans + mul_mod(2, com_mod(n - 1, k - 1)));
        ans = mod(ans - com_mod(n - (q - p), k - 1));
        cout << ans << "\n";
    }
    return 0;
}

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

long long mod=1000000007LL;

template<typename T>
constexpr T modpow(T a,int n){//(a^n)%MOD
    T ret=1;
    while(n>0){
        if((n&1)!=0){//n%2==1
            ret=ret*a%mod;
        }
        a=a*a%mod;
        n=n/2;
    }
    return ret;
}

std::vector<long long> fac;
std::vector<long long> ifac;

//long long mod=1000000007LL;

template <typename T>
T modcomb(T a, T b){
    if(a == 0 && b == 0)return 1;
    if(a < b || a < 0)return 0;
    long long tmp = ifac[a-b]* ifac[b] % mod;
    return tmp * fac[a] % mod;
}

void combinit(int maxn){
    fac.resize(maxn+1);
    ifac.resize(maxn+1);
    fac[0] = 1;
    ifac[0] = 1;
    for(long long i = 0; i<maxn; i++){
        fac[i+1] = fac[i]*(i+1) % mod;
        ifac[i+1] = ifac[i]*modpow(i+1, mod-2) % mod;
    }
}

using namespace std;
using ll = long long;
int main() {
    combinit(200005);
    ll n,k;
    cin>>n>>k;
    ll ans=0;
    ll low=0;
    ll high=0;
    for(int i = 1;i < k;++i) {
        low+=i-1;
        high+=n+1-i;
    }
    for(ll i = k;i <= n+1;++i) {
        low+=i-1;
        high+=n+1-i;
        ans+=(high-low)+1;
        ans%=mod;
        //cerr<<low<<" "<<high<<endl;
    }
    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 6284
#include <cstdio>
#include <algorithm>

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

int W, H;
int map[20][20];
int sx, sy, gx, gy;

void show(int x, int y, int t){
    printf("%d, %d, %d\n", x, y, t);
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            printf("%d ", (j==x&&i==y ? 2 : map[i][j]));
        }
        puts("");
    }
}

int dfs(int x, int y, int time, int map[20][20]){
    // show(x, y, time);
    
    if(time == 10){return 252521;}

    int res = 252521;
    for(int i=0;i<4;i++){
        // static int rule[] = {3, 0, 2, 1};
        // if(i != rule[time]){continue;}

        if(!(0 <= x + dx[i] && x + dx[i] < W &&
             0 <= y + dy[i] && y + dy[i] < H) ||
           map[y+dy[i]][x+dx[i]] != 0){
            continue;
        }
        
        int nx = x, ny = y;
        bool f = false;
        
        for(int j=0;0<=nx&&nx<W&&0<=ny&&ny<H;j++){
            if(nx == gx && ny == gy){
                res = time + 1;
                break;
            }

            if(0 <= nx + dx[i] && nx + dx[i] < W &&
               0 <= ny + dy[i] && ny + dy[i] < H &&
               map[ny+dy[i]][nx+dx[i]] == 1){
                break;
            }
            
            nx += dx[i];
            ny += dy[i];
        }

        if(f){break;}

        if(!(0 <= nx && nx < W && 0 <= ny && ny < H)){
            continue;
        }

        if(nx == gx && ny == gy){
            res = time + 1;
            break;
        }
        
        map[ny+dy[i]][nx+dx[i]] = 0;
        // printf("-> %d\n", i);
        res = std::min(res, dfs(nx, ny, time+1, map));
        map[ny+dy[i]][nx+dx[i]] = 1;
    }

    return res;
}

int main(){
    while(scanf("%d %d", &W, &H), W){
        for(int i=0;i<H;i++){
            for(int j=0;j<W;j++){
                scanf("%d", &map[i][j]);

                if(map[i][j] == 2){
                    sx = j;
                    sy = i;
                    map[i][j] = 0;
                }else if(map[i][j] == 3){
                    gx = j;
                    gy = i;
                    map[i][j] = 0;
                }
            }
        }

        int res = dfs(sx, sy, 0, map);
        printf("%d\n", res != 252521 ? res : -1);
    }
}

Measured memory_bytes: 1012
#include<iostream>
using namespace std;
bool notp[51001] = {true,true,false};
void prime(){
	int i,j;
	i=2;
	while(i<=226){
		j=i*i;
		while(j<=51000){
			notp[j] = true;
			j += i;
		}
		i++;
		while(i<=226){
			if(notp[i] == false) break;
			i++;
		}
	}
}

int main(){
	int i,up, low, n;
	prime();/*
	for(i=0;i<100;i++){
		if(notp[i]==false)cout<<i<<endl;
	}*/
	while(cin>>n){
		i=n+1;
		while(true){
			if(notp[i] == false){
				up=i;
				break;
			}
			i++;
		}
		i=n-1;
		while(true){
			if(notp[i] == false){
				low=i;
				break;
			}
			i--;
		}
		cout<<low<<" "<<up<<endl;
	}
	return 0;
}

Measured memory_bytes: 1208
#include <iostream>
#include <algorithm>
using namespace std;
 
int main(){
    while(true){
        int n, w, h;
        int x, y;
        int s, t;
        int field[100][100];
        int mxcnt=0;
        cin >> n;
        if(!n) break;
        cin >> w >> h;
        for(int i=0;i<w;++i){
            for(int j=0;j<h;++j){
                field[i][j]=0;
            }
        }
        for(int i=0;i<n;++i){
            cin >> x >> y;
            field[x-1][y-1]=1;
        }
        cin >> s >> t;
        for(int i=0;i<w-s+1;++i){
            for(int j=0;j<h-t+1;++j){
                int cnt=0;
                for(int k=0;k<s;++k){
                    for(int l=0;l<t;++l){
                        cnt += field[i+k][j+l];
                    }
                }
                mxcnt = max(mxcnt, cnt);
            }
        }
        cout << mxcnt << endl;
    }
}

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
typedef long long  ll ;
typedef double db;
const double pi = 3.141592654;
#define pb         push_back
#define forab(i,a,b)       for(int i=(a);i<=(b);i++)
#define CIN	ios_base::sync_with_stdio(0); cin.tie(0)
#define pcase(z,x)     printf("Case %ld: %lld\n",z,x)
#define nw				"\n"
int main(void)
{
	CIN;
	ll tc,l,k,sum=0,x=0,y,z=0,m=1,n=0,ans=0,cnt=0;
	cin>>n>>m;
	ll arr[33]={};
	for(ll i=0;i<n;i++){
		cin>>k;
		while(k--){
			cin>>x;
			arr[x]++;
		}
	}
	for(ll i=0;i<=m;i++)
		if(arr[i]==n)sum++;
	cout<<sum<<nw;
}

Measured memory_bytes: 3612
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#include<map>
using namespace std;
typedef long long ll;
int main(){
  ll n,a,b;
  cin>>n>>a>>b;
  ll ans=0;

  ans+=a*(n/(a+b));
  ans+=min(n%(a+b),a);
  cout<<ans<<endl;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys


def solve(H: int, W: int, N: int, a: "List[int]"):
    ret = [[0] * W for _ in range(H)]

    idx = 0
    cnt = 0
    for y in range(H):
        for x in range(W):
            if y % 2 == 1:
                i = W - x - 1
            else:
                i = x
            ret[y][i] = idx + 1
            cnt += 1
            if cnt >= a[idx]:
                idx += 1
                cnt = 0

    for j in range(H):
        print(' '.join([str(x) for x in ret[j]]))
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    H = int(next(tokens))  # type: int
    W = int(next(tokens))  # type: int
    N = int(next(tokens))  # type: int
    a = [ int(next(tokens)) for _ in range(N) ]  # type: "List[int]"
    solve(H, W, N, a)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3572
#include <algorithm>
#include <iostream>
#include <string>
#include <unordered_map>

using namespace std;


class A {
	int a, b, c;

public:
	void solve()
	{
		cin >> a >> b >> c;

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


class B {
	int N;
	unordered_map<string, int> um;
	int ans{ 0 };
	string s;

public:
	void solve()
	{
		unordered_map<string, int>::iterator found;
		cin >> N;
		for (int i{ 0 }; i < N; i++)
		{
			cin >> s;
			if ((found = um.find(s)) == um.end())
				um.insert(make_pair(s, 1));
			else found->second += 1;
		}

		cin >> N;
		for (int i{ 0 }; i < N; i++)
		{
			cin >> s;
			if ((found = um.find(s)) != um.end())
				found->second -= 1;
		}

		for (found = um.begin(); found != um.end(); found++)
			ans = max(ans, found->second);

		cout << ans << endl;

	}
};


int main()
{
	A solution;
	solution.solve();

	return 0;
}

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

const int MAX_N = 3000;

int main() {
	int N, ans = 0;

	std::cin >> N;
	for(int i = 0; i < N; ++i) {
		int a;
		std::cin >> a;
		ans += a - 1;
	}

	std::cout << ans << std::endl;
}


Measured memory_bytes: 256
#include<algorithm>
#include<iostream>
#include<cstdio>
#include<map>
#include<set>
using namespace std;
string s,t;
set<string> S;

void Work()
{
    int lens=s.size();
    int lent=t.size();
    for(int i=0;i<lens;i++)
    {
        if(s[i]=='?'||s[i]==t[0])
        {
            string tmp=s;
            for(int j=0;j<i;j++)
                if(tmp[j]=='?')
                    tmp[j]='a';
            bool can=false;
            for(int j=0;j<lent;j++)
            {

                if(tmp[i+j]!='?'&&tmp[i+j]!=t[j])
                    break;
                tmp[i+j]=t[j];
                if(j == lent - 1) can = true;
            }
            if(can)
            {
                for(int j = i + lent; j < lens; j++) if(tmp[j] == '?') tmp[j] = 'a';
                S.insert(tmp);
            }
        }
    }
    if(S.size()==0) cout<<"UNRESTORABLE"<<endl;
    else cout<<*S.begin()<<endl;
}
int main()
{
    cin>>s>>t;
    Work();
}


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

#define INF 1e9
#define PI 3.141592653589793238
typedef long long ll;

int main() {
    int n,m; cin>>n>>m;
    if(n==m)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;


    return 0;
}

Measured memory_bytes: 3600
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val n = sc.nextInt()
    val q = sc.nextInt()
    val s = sc.next()

    val count = arrayOfNulls<Int>(s.length)
    count[0] = 0
    (1 until count.size).forEach {
        val ac = s[it - 1] == 'A' && s[it] == 'C'
        count[it] = count[it - 1]!! + (if (ac) 1 else 0)
    }


    repeat(q) {
        val cl = count[sc.nextInt()-1]!!
        val rl = count[sc.nextInt()-1]!!
        println(rl - cl)
    }
}

Measured memory_bytes: 75552
dic = {}
lop = int(input())
for i in range(lop):
    N = list(input())
    N.sort()
    N = "".join(N)
    if N in dic:
        dic[N] += 1
    else:
        dic[N] = 1
print(sum(list(map(lambda x: int((x * (x - 1)) / 2), list(dic.values())))))

Measured memory_bytes: 17932
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include<iomanip>
//#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
typedef long double ld;
ll n, pos, neg;
int main()
{
    map<int,int> mp;
   int n,k,res,x;
   cin>>n;
   for(int i=1;i<=n;i++)
   {
       cin>>x;
       mp[x]=i;
   }
   map<int,int>::iterator it;
   for(it=mp.begin();it!=mp.end();it++)
   {
       cout<<it->second<<" ";
   }
}


Measured memory_bytes: 5504