akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#define lli long long int
#define lower(a) transform(a.begin(),a.end(),a.begin(),::tolower);


using namespace std;

const int N = 3e5 + 500;
const long long mod = 1e9 + 7;
const long long INF = 1LL << 57;
const int M = 1e6 + 500;

lli cnt[200000];
bool ok[200000];

void solve()
{
    lli a, b;
    cin>>a>>b;
    lli ans = a + b;
    ans = max(ans, a - b);
    ans = max(ans, a * b);
    cout<<ans;
    return ;
}
/*
10
6
10 3 2 5 7 8
*/
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    lli t;
    t = 1;
//    cin>>t;
    while(t --)
    {
        solve();
    }
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<stdio.h>
using namespace std;
int main(){
  double a,b,c,PI=3.1415926535;
  cin >> a >> b >> c;
  printf("%.5f\n",a*b*sin(c*PI/180)/2);
  printf("%.5f\n",sqrt(a*a+b*b-2*a*b*cos(c*PI/180))+a+b);
  printf("%.5f\n",b*sin(c*PI/180));
  return 0;
}



Measured memory_bytes: 3376
import java.io.IOException;
import java.util.Scanner;
public class Main {

	public static void main(String[] args) throws IOException{
		Scanner sc = new Scanner(System.in);
		int a,b;
		int length;
		while(sc.hasNext()){
			a = sc.nextInt();
			b = sc.nextInt();
			length = String.valueOf((a+b)).length();
			System.out.println(length);;
		}
		
	}

}

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

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second

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

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, pll> pip;
const ll INF = 1ll<<29;
const ll MOD = 1000000007;
const double EPS  = 1e-9;

struct Dice {
	int num[6]; // top, bottom, front, back, right, left;
	static const int rd[3][4]; //?????¢??????
	
	Dice(int top, int bottom, int front, int back, int right, int left) {
		num[0] = top;		num[1] = bottom;
		num[2] = front;	num[3] = back;
		num[4] = right;	num[5] = left;
	}
	Dice(const Dice &d) {
		copy(d.num, d.num + 6, num);
	}
	
	bool operator < (const Dice &d) const {
		REP(i, 6) if (num[i] != d.num[i]) {
			return num[i] < d.num[i];
		}
		return false;
	}
	
	void X(int cnt = 1) { cnt %= 4; REP(i, cnt) rotate(0); }
	void Y(int cnt = 1) { cnt %= 4; REP(i, cnt) rotate(1); }
	void Z(int cnt = 1) { cnt %= 4; REP(i, cnt) rotate(2); }
	
	void rotate(int p) {
		int tmp = num[rd[p][0]];
		
		REP(i, 3) num[rd[p][i]] = num[rd[p][i + 1]];
		num[rd[p][3]] = tmp;
	}
	
	Dice unique() {
		Dice now = *this;
		
		Dice mi(*this);
		
		REP(i, 4) {
			REP(j, 4) {
				REP(k, 4) {
					if (now < mi) mi = now;
					now.X();
				}
				now.Y();
			}
			now.Z();
		}
		return mi;
	}
	
	void print() {
		REP(i, 6) printf("%d%c", num[i], i == 5 ? '\n' : ' ');
	}
};

const int Dice::rd[3][4] = {
	{2,1,3,0}, // x
	{2,4,3,5}, // y
	{0,5,1,4}, // z
};

int main() {
	int num[6];
	REP(i, 6) scanf("%d", num + i);
	string str; cin >> str;
	
	Dice dice(num[0], num[5], num[1], num[4], num[2], num[3]);
	REP(i, str.size()) {
		switch (str[i]) {
			case 'E': dice.Z(); break;
			case 'N': dice.X(); break;
			case 'S': dice.X(3); break;
			case 'W': dice.Z(3); break;
		}
	}
	
	printf("%d\n", dice.num[0]);
	
	
	return 0;
}

Measured memory_bytes: 3268
# include <bits/stdc++.h>
# define int        long long
# define all(vc)   vc.begin(),vc.end()
# define alll(vc)  vc.rbegin(),vc.rend()
# define pb        push_back
# define fi        first
# define se        second
# define speed     ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
# define time      cerr << "\nTime elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n"
 
using namespace std;

void solve(){
    string s;
    cin >> s;
    if( s[2] == s[3] && s[4] == s[5] ) cout<<"Yes";
    else cout<<"No"; 

}

int32_t main(){
    speed;
    int n = 1;
    //cin >> n;
    while( n-- ){
         solve();
         cout<<'\n';
    }

    time;
}



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

#define for_(i,a,b) for(int i=(a);i<(b);++i)
#define allof(a) (a).begin(),(a).end()
template< typename T > using Vec = vector< T >;
template< typename T > void minUpdate(T& a, T b) { a = min(a, b); }

int main() {
	int N, M;
	cin >> N >> M;
	
	struct Edge { int u, v, c; };
	Vec< Edge > edges;
	
	Vec< Vec< int > > dst(N, Vec< int >(N, 1L << 28));
	for_(i,0,N) dst[i][i] = 0;
	
	for_(i,0,M) {
		int u, v, c;
		cin >> u >> v >> c;
		--u; --v;
		
		edges.push_back(Edge{u, v, c});
		dst[u][v] = dst[v][u] = c;
	}
	
	for_(k,0,N) for_(i,0,N) for_(j,0,N) minUpdate(dst[i][j], dst[i][k] + dst[k][j]);
	
	int ans = 0;
	for (Edge& e : edges) if (dst[e.u][e.v] < e.c) ++ans;
	cout << ans << endl;
}

Measured memory_bytes: 256
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

#define debug(...) fprintf(stderr, __VA_ARGS__)
#define int long long int
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
typedef pair<int, int> pii;
typedef long long ll;
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1001001001001001LL;
const ll MOD = 1000000007LL;
 
signed main() {
    int N; cin >> N;
    string s; cin >> s;
    int red = 0, blue = 0;
    for(int i=0; i<N; i++) {
        if(s[i] == 'R') red++;
        if(s[i] == 'B') blue++;
    }

    if(red > blue) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


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

int main(){
    int n;
    cin >> n;
    vector <int> d(n);
    for (int tsumugi = 0; tsumugi < n; tsumugi++){
        cin >> d[tsumugi];
    }

    //中央値を返せばよい
    sort(d.begin(), d.end());
    int lower = d[n / 2 - 1];
    int upper = d[n / 2];
    int ans = upper - lower;

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
using namespace std;

typedef long long ll;
#define rep(i, n) for(int i = 0; i < n; i++)

int main(){
    ll N, M;
    cin >> N >> M;
    ll ans = 0;
    if(2 * N > M){
        ans = ll(M / 2);
    }else{
        ans = N;
        ll rest = M - 2 * N;
        ans += ll(rest / 4);
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;


int partition(vector<int>& ary, int p, int r) {
	int x = 0, i = 0, sw = 0;
	x = ary[r];
	i = p - 1;

	for (int j = p;j < r;j++) {
		if (ary[j] <= x) {
			i = i + 1;
			sw = ary[i];
			ary[i] = ary[j];
			ary[j] = sw;
		}
	}
	sw = ary[i + 1];
	ary[i + 1] = ary[r];
	ary[r] = sw;
	return i + 1;
}


int main() {

	int n = 0, cnt = 0, mid = 0;
	cin >> n;
	vector<int> ary(n);

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

	int ref= partition(ary, 0, n - 1);

	for (int i = 0;i < n;i++) {
		string tp = to_string(ary[i]);
		if (i == ref) tp = "[" + tp + "]";

		cout << tp;
		if (i < n - 1) cout << " ";
	}
	cout << endl;

	return 0;
}



Measured memory_bytes: 3284
/*
 
 * This code is written by Sanskar Agarwal
 
*/
#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define PII pair<int,int>
#define PLL pair<ll,ll>
#define VPLL vector<PLL>
#define VPII vector<PII>
#define PQ priority_queue<PLL,VPLL, greater<PLL> > 
#define PQI priority_queue<PII,VPII,greater<PII> >
#define UMLL unordered_map<ll,ll>
#define UMII unordered_map<int,int>
#define VI vector<int>
#define VL vector<ll>
#define S second
#define F first
#define PB push_back


int main()
{

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

        
    ll n;
    cin>>n;
    ll a[n],i;
    for(i=0;i<n;i++)
        cin>>a[i];

    ll curr=0;
    ll amt=1000;
    ll mini=a[0];
    ll maxi=a[0];
    for(i=1;i<n;i++)
    {
        if(a[i]==a[i-1])
            continue;
        if(a[i]>a[i-1])
        {
            maxi=a[i];
        }
        else
        {
            ll st=amt/mini;
            ll left=amt-(st*mini);
            ll pro=maxi*st;
            amt=left+pro;
            mini=maxi=a[i];
        }
    }
    ll st=amt/mini;
    ll left=amt-(st*mini);
    ll pro=maxi*st;
    amt=left+pro;
    cout << amt;


    return 0;
}

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

int main(){
	int n;
	cin >> n;
	vector<double> x(n);
	for(int i = 0 ; i < n ; i += 1){
		cin >> x[i];
	}
	sort(x.begin(),x.end());
	double sum=(x[0]+x[1])/2;
	for(int i = 2 ; i < n ; i += 1){
		sum += x[i];
		sum /= 2;
	}
	cout << setprecision(6) << fixed;
	cout << sum << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <numeric>
#include <iostream>

using namespace std;

#define FOR(i, a, b)   for(int i = (a); i < (b); ++i)
#define RFOR(i, a, b)  for(int i = (a); i > (b); --i)
#define rep(i, n)	   for(int i = 0; i < (n); ++i)
#define all(c)		   begin(c), end(c)
#define rall(c)		   rbegin(c), rend(c)
#define SZ(a)		   ((ll) a.size())

typedef long long		   ll;
typedef unsigned long long ull;


int main(){
  int N;
  cin >> N;
  vector<vector<char>> S(N,vector<char>(N));
  string str;
  rep(i,N){
    cin >> str;
    rep(j,N){
      S[i][j]=str[j];
    }
  }
  int ans=0;
  int flag;
  vector<vector<char>> ori(N,vector<char>(N));
  vector<vector<char>> mir(N,vector<char>(N));
  int yoko,tate;
  rep(i,N){
    yoko=0;
    tate=i;
    rep(j,N){
      rep(k,N){
        ori[j][k]=S[(j+yoko)%N][(k+tate)%N];
      }
    }
    rep(j,N){
      rep(k,N){
        mir[j][k]=ori[k][j];
      }
    }
    flag=0;
    rep(j,N){
      rep(k,N){
        if(ori[j][k]==mir[j][k]) flag++;
      }
    }



    if(flag==(N*N)) ans+=N;
  }
  cout << ans;
}


Measured memory_bytes: 640
using System;
using System.Collections.Generic;
using System.Linq;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            input_iter = LazyLoadAllLines();
            //------------------------------------------------//
            var n = Read<long>();
            var k = Read<long>();
            //var b = Read<long>();
            //var c = Read<long>();
            //var x = Read<long>();
            var hls = Read<long>(n);

            //als.Sort((l, r) => (int)(r - l));


            Console.WriteLine(hls.Where(h => h >= k).Count());

        }



        static IEnumerator<string> input_iter;

        static _T Read<_T>() where _T : struct
        {
            input_iter.MoveNext();
            return (_T)Convert.ChangeType(input_iter.Current, typeof(_T));
        }
        static string Read()
        {
            input_iter.MoveNext();
            return input_iter.Current;
        }
        static List<_T> Read<_T>(long num) where _T : struct { return new List<_T>(Enumerate<_T>(num)); }


        static IEnumerable<_T> Enumerate<_T>(long num)
        {
            for (long i = 0; i < num; ++i)
            {
                input_iter.MoveNext();
                yield return (_T)Convert.ChangeType(input_iter.Current, typeof(_T));
            }
        }
        static IEnumerator<string> LazyLoadAllLines()
        {
            string line;
            do
            {
                line = Console.ReadLine();
                foreach (var s in line.Split(' '))
                    yield return s;
            } while (line != null);
        }
    }
}


Measured memory_bytes: 24924
import Control.Applicative ((<$>), (<*>))
import Control.Monad
import Data.List

main :: IO ()
main = do
  solve <$> getl toInt <*> getl toInt <*> getl toInt >>= print

solve :: Int -> Int -> Int -> Int
solve a b h = (a + b) * h `div` 2

toInt :: String -> Int
toInt = read

getl :: (String -> a) -> IO a
getl f = f <$> getLine


Measured memory_bytes: 508
from sys import stdin, setrecursionlimit
from collections import deque


def main():
    input = stdin.buffer.readline
    k = int(input())
    count = 0
    q = deque()
    for i in range(1, 10):
        q.append(str(i))
    while True:
        qi = q.popleft()
        last = int(qi[-1])
        if last != 0:
            q.append(qi + str(last - 1))
        q.append(qi + str(last))
        if last != 9:
            q.append(qi + str(last + 1))
        count += 1
        if count == k:
            print(qi)
            break


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()


Measured memory_bytes: 90212
from heapq import *
import sys
from collections import *

from itertools import *
from decimal import *
import copy
from bisect import *
import time

import math

def gcd(a,b):
    if(a%b==0):return(b)
    return (gcd(b,a%b))
sys.setrecursionlimit(10**7)
input=lambda :sys.stdin.readline().rstrip()
D,G=map(int,input().split())
PC=[list(map(int,input().split())) for i in range(D)]
value=10**18
for i in range(2**D):
    count=0
    score=G
    bit=[i>>m&1 for m in range(D)]
    for d in range(D):
        p,c=PC[d]
        if bit[d]:
            count+=p
            score-=c+p*(d+1)*100
    for d in range(D)[::-1]:
        p,c=PC[d]
        if not bit[d] and score>0:
            _p=min(p,score//((d+1)*100)+bool(score%((d+1)*100))*1)
            count+=_p
            score-=c+_p*(d+1)*100
    value=min(value,count)
print(value)


Measured memory_bytes: 62700
def main():
        run()

def run():
        n = int(input())
        data = [int(x) for x in input().split(" ")]

        max_sum = 0 
        max_m = max(data)

        for num in data:
                max_sum += num - 1
        print(max_sum)



if __name__ == "__main__":
        main()



Measured memory_bytes: 3316
import sys

n, *a = map(int, sys.stdin.read().split())

def main():
    for i in range(n - 1): a[i+1] += a[i]
    res = float('inf')
    for i in range(n - 1): res = min(res, abs(a[-1] - a[i] * 2))
    print(res)

if __name__ ==  '__main__':
    main()

Measured memory_bytes: 24064
#include <bits/stdc++.h>
using namespace std;
int main(void){
    string s1;
    cin>>s1;
    string s2;
    cin>>s2;
    int a,b;
    cin>>a>>b;
    string tmp;
    cin>>tmp;
    if (tmp==s1) {
        a--;
    } else if (tmp==s2) {
        b--;
    }
    cout<<a<<" "<<b<<endl;
}

Measured memory_bytes: 256
n = int(input())
nlist = [input() for i in range(n)]
m = int(input())
mlist = [input() for i in range(m)]
 
for i in mlist:
    if i in nlist:
        nlist.remove(i)
 
def maxCOUNT( lis ):
  '''
  与えられたリストの中に、最も多く存在する要素を返す
  (最大の数の要素が複数ある場合、pythonのsetで先頭により近い要素を返す)
  '''
  L = lis[:]#copy
  S = set(lis)
  S = list(S)
  MaxCount=0
 
  for elem in S:
    c=0
    while elem in L:
      ind = L.index(elem)
      foo = L.pop(ind)
      c+=1
    if c>MaxCount:
      MaxCount=c
  return MaxCount
 
print(maxCOUNT(nlist))
    

Measured memory_bytes: 3064
#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <string>
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>

using namespace std;

void SolveA()
{
	int a, b;
	scanf("%d %d", &a, &b);

	int x = ceil((a + b) / 2.0);
	printf("%d\n", x);
}

void SolveB()
{
	string s, t;
	cin >> s;	// s
	cin >> t;	// t

	sort(s.begin(), s.end());	// sの中身を昇順ソート
	sort(t.rbegin(), t.rend());	// tの中身を降順ソート

	if (s < t)
	{
		printf("Yes\n");
	}
	else
	{
		printf("No\n");
	}
}

void SolveC()
{
	int N;
	scanf("%d", &N);
	
	//const int MAX_A = 1000000000;

	////vector<long long int> kind;
	////kind.resize(MAX_A, 0);
	//int *kind = new int[MAX_A];

	//for (int i = 0; i < N; i++)
	//{
	//	long long int a;
	//	cin >> a;
	//	kind[a]++;
	//}

	//long long int cnt = 0;
	//for (long long int i = 0; i < MAX_A; i++)
	//{

	//	if (kind[i] - i > 0)
	//	{
	//		cnt += (kind[i] - i);
	//	}
	//	else if (kind[i] - i < 0)
	//	{
	//		cnt += kind[i];
	//	}
	//}

	vector<int> kind;
	//kind.resize(N);
	vector<int> numKind;
	numKind.resize(N, 0);

	int pos = 0;
	for (int i = 0; i < N; i++)
	{
		long long int a;
		cin >> a;
		if (std::find(kind.begin(), kind.end(), a) != kind.end())
		{
			// 見つかった
			int j = 0;
			while (kind[j] != a)
			{
				j++;
			}
			numKind[j]++;
		}
		else
		{
			numKind[pos]++;
			//kind[pos] = a;
			kind.push_back(a);
			pos++;
		}
	}

	long long int cnt = 0;
	for (int i = 0; i < pos; i++)
	{
		if (numKind[i] - kind[i] > 0)
		{
			cnt += (numKind[i] - kind[i]);
		}
		else if (numKind[i] - kind[i] < 0)
		{
			cnt += numKind[i];
		}
	}

	cout << cnt << "\n";
}

int main()
{
	//SolveA();
	//SolveB();
	SolveC();
}

Measured memory_bytes: 1276
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<string.h>
#include<math.h>
#include<map>

using namespace std;

int main(){
	int w,a,b;
	cin >> w >> a >> b;
	int ans;
	if(abs(a-b)<=w){
		cout << "0" << endl;
		return 0;
	}else{
		cout << min(abs(b-(a+w)),abs(a-(b+w))) << endl;
		return 0;
	}
	return 0;
	
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define int long long
#define ff first
#define ss second
using namespace std;
typedef pair<int,int> pii;

int32_t main(){
  int m,d;
  cin>>m>>d;
  int ans=0;
  for(int i=1;i<=m;i++){
    for(int j=1;j<=d;j++){
      int d1 = j%10;
      int d2 = j/10;
      if(d1<2 || d2<2)continue;
      if(d1*d2==i)ans++;
      
      
    }
  
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
import java.util.*;
import java.math.RoundingMode;
import java.math.BigDecimal;
 
 
public class Main{
	public static void main (String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
        int k = sc.nextInt();
        int a[] = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }
        int l = 0;
        int r = 1000000007;
        while (r - l > 1) {
            int x = (l + r) / 2;
            long now = 0;
            for (int i = 0; i < a.length; i++) {
                now += (a[i]-1) / x;
            }
            if (now <= k) {
                r = x;
            } else {
                l = x;
            }
        }
        System.out.println(r);
	}
}

Measured memory_bytes: 61452
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(x),end(x)
#define show(obj) {for(auto x:obj)cout<<x<<' ';cout<<endl;}
#define line "----------"
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> LP;
const int inf = 1001001000;
const ll INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

int main(){
	int D, T, S;
	cin >> D >> T >> S;
	cout << ((T * S >= D) ? "Yes" : "No") << endl;
	return 0;
}


Measured memory_bytes: 3648
#include <iostream>
#include <string.h>
#include <algorithm>
#include <vector>
#include <queue>

using namespace std;
typedef long long ll;
const ll INF=100000000000000LL;

int main() {
	int n,a;
	cin>>n>>a;
	cout<<(n*n)-a<<endl;

		return 0;
}


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

using namespace std;
int a[4][4];
int b[20];
int n;

bool finde(int x)
{
    for(int i=0;i<n;i++)
    {
        if(b[i]==x) return true;
    }
    return false;
}
int main()
{
    cin>>n;
    if(n%2) cout<<n/2+1<<endl;
    else cout<<n/2<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N,M;
  cin >> N >>M;
  vector<int>c(N);
  for(int i = 0;i<M;i++){
    int L;
    cin >> L;
    for(int i = 0;i<L;i++){
      int x=0;
      cin >> x;
      c.at(x-1)++;
    }
  }
  int count = 0;
    for(int i = 0;i<N;i++){
      if(c.at(i) == 0){
        count++;
      }
    }
    cout << count << endl;
  }
    
  

Measured memory_bytes: 3636
n=int(input())
ans=len(str(n))
for i in range(1, int(n**0.5)+1):
    if n % i != 0:
        continue
    a=i
    b=i
    if i != n // i:
        b=n//i
    ans=min(ans,len(str(max(a,b))))
print(ans)

Measured memory_bytes: 3188
#
import sys
import math
import numpy as np
import itertools

# いくつか入力
a, b = (int(i) for i in input().split())

p = []
answer=-1
for i in range(1,1001):
    if int(i*0.08) == a:
        p.append(i)

for i in p:
    if int(i*0.1) == b:
        answer = i
        break

print(answer)




Measured memory_bytes: 14448
a,b,c,x,y=map(int,input().split())
ans=x*a+y*b
if x>=y:
  ans=min(ans,c*min(x,y)*2+a*(x-y))
else:
  ans=min(c*min(x,y)*2+b*(y-x),ans)
ans=min(c*max(x,y)*2,ans)
print(ans)


Measured memory_bytes: 61052
#include <iostream>
#include <vector>
#include <algorithm>
#include <cassert>
#include <functional>
#include <numeric>
#include <limits>
#include <iomanip>
#include <queue>
#include <cmath>
#include <math.h>
#include <string>
#include <cmath>
using namespace std;
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; }
const long long INF = 1LL << 60;
using pll = pair<long long, long long>;
#define min(a, b) ((a) < (b) ? (a) : (b))

int main() {
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	// cout << std::fixed << std::setprecision(15);

	long long H; cin >> H;
	int  count = 0;
	long long res = 0;
	while (H > 0) {

		H = floor(H / 2);
		res +=pow(2, count);
		++count;
	}

	cout << res << endl;
}


Measured memory_bytes: 256
n = gets.to_i
words = Array.new(n){ gets.chomp.bytes.sort.join.to_sym }

h = Hash.new
ans = 0
words.each do |s|
  
  if h.has_key?(s)
    h[s] += 1
    ans += h[s]
    p 
  else
    h[s] = 0
  end
end

puts ans

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

class line{
public:
	int h,p,q;
	line(int h,int p,int q):h(h),p(p),q(q){}
};

bool operator < (line a,line b){
	return a.h>b.h;
}

int main()
{
	int n,m,a;
	while(cin>>n>>m>>a && n!=0){
		vector<line> L;
		for(int i=0;i<m;i++){
			int h,p,q; cin>>h>>p>>q;
			L.push_back(line(h,p,q));
		}
		sort(L.begin(),L.end());

		int now=a;
		for(int i=0;i<L.size();i++){
			if(L[i].p==now) now=L[i].q;
			else if(L[i].q==now) now=L[i].p;
		}
		cout<<now<<endl;
	}
	return 0;
}

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

int A;
int B;
int C;
int X;
int res = 0;

int main() {
  cin >> A >> B >> C >> X;
  
  for (int i = 0; i <= A; i++) {
    for (int j = 0; j <= B; j++) {
      for (int k = 0; k <= C; k++) {
        if (500*i + 100*j + 50*k == X) {
          res += 1;
        }
      }
    }
  }
  
  cout << res << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using ll = long long;

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

	ll h, w;
	cin >> h >> w;
	if (w == 1 || h == 1) cout << 1 << '\n';
	else cout << h * (w/2) + (w & 1) * (h+1)/2 << '\n';
}


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

int main()
{
   ios::sync_with_stdio(false);
   cin.tie(0);
   cout.tie(0);
   
   cout<<fixed<<setprecision(12);
   
  long double L;
  
  cin>>L;
  
   long double x = L/3;
   
   cout<<(x)*(x)*(x)<<endl;

   return 0;
}


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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
using ll = long long;

int main(){
    int n; cin >> n;
    vector<ll> a(n); REP(i, n) cin >> a[i];

    deque<ll> b;

    int cnt = 0;
    while(true) {
        if(cnt % 2 == 0) {
            b.push_back(a[cnt]);
        } else {
            b.push_front(a[cnt]);
        }
        cnt++;

        if(cnt == n) {
            if(cnt % 2 == 0) {

            } else {
                reverse(all(b));
            }
            break;
        }
    }

    REP(i, n) cout << b[i] << " ";
    cout << endl;
}

Measured memory_bytes: 5376
#include<iostream>
#include<algorithm>
#include<ctime>
#include<vector>
#include<string>
#include<cmath>
#include<map>
#include<iomanip>
#include<numeric>
#include<queue>
#include<deque>
#include<cfloat>
#include<functional>
#include<tuple>
#include<math.h>
#include<bitset>
#include<stack>
#include<set>
#include<random>
#include<stdlib.h>
#define rip(i,n) for(int i=0;i<n;i++)
#define Rip(i,n) for(int i=1;i<=n;i++)
#define RIP(i,a,b) for(int i=a;i<b;i++)
#define all(V) V.begin(),V.end()
#define sec  setprecision;
#define _CRT_SECURE_NO_WARNINGS
#pragma target("avx")
#pragma optimize("O3")
#pragma optimize("unroll-loops");
constexpr double eps = 1e-9;
constexpr double pi = 3.141592653589793238462643383279;
using namespace std;
using ll = long long;
using ld = long double;
using Pa = pair<int, int>;
ll mod = 1000000007;
ll MOD = 998244353;
ll gcd(ll a, ll b)
{
	if (a % b == 0)	return(b);
	else return(gcd(b, a % b));
}
ll lcm(ll a, ll b)
{
	return a * b / gcd(a, b);
}
ll pow(ll x, ll n) {
	x %= mod;
	if (n == 0)
		return 1;
	if (n % 2 == 0)
		return (pow((x * x) % mod, n / 2) % mod);
	else
		return (x * pow(x, n - 1)) % mod;
}
signed main() {
	ll a, b, c, d; cin >> a >> b >> c >> d;
	ll k = lcm(c, d);
	ll bb = b + (b / k) - b / c - b / d;
	a--;
	ll aa = a + (a / k) - a / c - a / d;
	cout << bb - aa << endl;
}

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

int main() {
	int n, m;
	scanf("%d%d", &n, &m);
	int cost[m];
	std::vector<int> can[m];
	for (int i = 0; i < m; i++) {
		int a, b;
		scanf("%d%d", &a, &b);
		cost[i] = a;
		can[i].resize(b);
		for (int j = 0; j < b; j++) {
			int c;
			scanf("%d", &c);
			can[i][j] = c - 1;
		}
	}
	
	int dp[m + 1][1 << n]; // 1 << n
	// 000000000001 : 1
	// 000000001000 : 8
	// 000000100000 : 32
	for (int i = 0; i <= m; i++)
		for (int j = 0; j < 1 << n; j++)
			dp[i][j] = 1000000000;
	
	dp[0][0] = 0;
	for (int i = 0; i < m; i++) {
		for (int j = 0; j < 1 << n; j++) {
			// dp[i][j] => ?
			// 使わない
			dp[i + 1][j] = std::min(dp[i + 1][j], dp[i][j]);
			// 使う
			int usable = j;
			for (int k : can[i]) usable |= 1 << k;
			dp[i + 1][usable] = std::min(dp[i + 1][usable], dp[i][j] + cost[i]);
		}
	}
	// dp[m][(1 << n) - 1]
	int res = dp[m][(1 << n) - 1];
	if (res == 1000000000) std::cout << -1 << std::endl;
	else std::cout << res << std::endl;
	
	return 0;
}


Measured memory_bytes: 16384
# frozen_string_literal: true

s = gets.chomp
rle = s.each_char.slice_when { |i, j| i != j }.map(&:size)

rle.each_slice(2) do |r, l|
  print '0 ' * (r - 1)
  print "#{(r / 2.0).ceil + l / 2} #{r / 2 + (l / 2.0).ceil} "
  print '0 ' * (l - 1)
end

puts ''

Measured memory_bytes: 7292
#include<iostream>

//関数の宣言
void matrixMultiplication(int n, int m, int l, long int matrixA[100][100], long int matrixB[100][100], long int matrixC[100][100]);

int main(){

	int n;
	int m;
	int l;

	long int matrixA[100][100];
	long int matrixB[100][100];
	long int matrixC[100][100];

	for (int i = 0; i < 100; ++i){
		for (int j = 0; j < 100; ++j){
			matrixA[i][j] = 0;
			matrixB[i][j] = 0;
			matrixC[i][j] = 0;
		}
	}


	std::cin >> n >> m >> l;

	for (int i = 0; i < n; ++i){
		for (int j = 0; j < m; ++j){
			std::cin >> matrixA[i][j];
		}
	}

	for (int i = 0; i < m; ++i){
		for (int j = 0; j < l; ++j){
			std::cin >> matrixB[i][j];
		}
	}

	matrixMultiplication(n, m, l, matrixA, matrixB, matrixC);

	for (int i = 0; i < n; ++i){
		for (int j = 0; j < l; ++j){
			if (j == l - 1){
				std::cout << matrixC[i][j];
			}
			else{
				std::cout << matrixC[i][j] << ' ';
			}
		}
		std::cout << std::endl;
	}
	return 0;
}

//関数の定義
//void matrixMultiplication(int n, int l, int matrixA[100][100], int matrixB[100][100], int matrixC[100][100]){
//
//	for (int i = 0; i < n; ++i){
//		for (int j = 0; j < l; ++j){
//			matrixC[i][j] =( matrixA[i][0] * matrixB[0][j]) + (matrixA[i][1] * matrixB[1][j]);
//		}
//
//	}
//}

void matrixMultiplication(int n, int m, int l, long int matrixA[100][100], long int matrixB[100][100], long int matrixC[100][100]){
	for (int i = 0; i < n; ++i){
		for (int j = 0; j < l; ++j){
			for (int k = 0; k < m; ++k){
				matrixC[i][j] += matrixA[i][k] * matrixB[k][j];
			}
		}
	}
}


Measured memory_bytes: 3348
// warm heart, wagging tail,and a smile just for you!
//                                                                     ███████████   
//                                                                   ███╬╬╬╬╬╬╬╬╬╬███
//                                                                ███╬╬╬╬╬████╬╬╬╬╬╬███
//                                            ███████████       ██╬╬╬╬╬████╬╬████╬╬╬╬╬██
//                                      █████████╬╬╬╬╬████████████╬╬╬╬╬██╬╬╬╬╬╬███╬╬╬╬╬██
//                               ████████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████████╬╬╬╬╬╬██╬╬╬╬╬╬╬██
//                             ████╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████████╬╬╬╬╬╬╬╬╬╬╬██
//                           ███╬╬╬█╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬███╬╬╬╬╬╬╬█████
//                         ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬████████╬╬╬╬╬██
//                       ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬╬╬╬╬╬███
//                     ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬██
//                 ████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████╬╬╬╬╬████
//     █████████████╬╬╬╬╬╬╬╬██╬╬╬╬╬████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬██████
//   ████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬██████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██████╬╬╬╬╬╬╬███████████╬╬╬╬╬╬╬╬██╬╬╬██╬╬╬██
// ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████╬╬╬╬╬╬╬╬╬╬╬█╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬██
// ██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬▓▓▓▓▓▓╬╬╬████╬╬████╬╬╬╬╬╬╬▓▓▓▓▓▓▓▓██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬███
// ██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██████▓▓▓▓▓▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓▓▓▓▓▓▓██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬█████
// ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████████
//   ███╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██
//       ██████████████  ████╬╬╬╬╬╬███████████████████████████╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████
//                         ███████                           █████  ███████████████████  
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
const double EPS = 1e-9;
#define INF (1LL<<60)
#define fs first
#define sc second
#define pb push_back
#define int long long
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i = (b-1);i>=a;i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x)  cout << #x << " = " << (x) << endl;
#define SP << " " << 
typedef pair<int,int> P;
typedef vector<vector<P> > Graph;
typedef vector<int> vec;
typedef vector<vector<int>> mat;

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

  int n;
  string s;
  cin >> n >> s;

  vec flag(26,0);
  int ans = 0;
  int id = 0;
  REP(i,n){
    flag[s[i]-'a']++;
    int cnt = 1;
    REP(j,26) if(j != s[i]-'a' && flag[j]){
      cnt *= flag[j]+1;
      cnt %= MOD;
    }
    ans += cnt;
    ans %= MOD;
  }

  cout << ans << endl;

  return 0;
}

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

int main(){
  string s;
  cin >> s;
  
  int n=s.size();
  
  vector<int> a(n);
  
  for(int i=0;i<n;i++){
    if(s.at(i)=='A'||s.at(i)=='C'||s.at(i)=='G'||s.at(i)=='T')
      a.at(i)++;
  }
  
  int k=0;
  int i=0;
  
  while(i<n){
    if(a.at(i)==0){
      i++;
    }
    
    else{
      int x=0;
      while(a.at(i)==1){
        x++;
        i++;
        if(i==n)
          break;
      }
    k=max(x,k);
    }
    
  }
  cout << k << endl;
}

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

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();
            int l = input[0];
            int r = input[1];

            if (r >= l + 2019)
            {
                Console.WriteLine("0");
                return;
            }

            l = l % 2019;
            r = r % 2019;
            if(l > r)
            {
                int tmp = r;
                r = l;
                l = tmp;
            }

            int minimaize = 2019;
            for(int i = l; i <= r; i++)
            {
                for(int j = i + 1; j <= r; j++)
                {
                    minimaize = Math.Min(minimaize, (i * j) % 2019);
                    if (minimaize == 0) break;
                }
                if (minimaize == 0) break;
            }
            Console.WriteLine($"{minimaize}");
        }
    }
}


Measured memory_bytes: 13396
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <math.h>
#include <stdio.h>
#include <vector>
using namespace std;
typedef long long ll;
int main(){
	int a,b;
	cin >> a>>b;
	if (b%a==0) {
		cout << a+b << endl;
	} else {
		cout << b-a << endl;
	}
	return 0;
}

Measured memory_bytes: 256
// C++ includes used for precompiling -*- C++ -*-

// Copyright (C) 2003-2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library.  This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.

// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.

// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
// <http://www.gnu.org/licenses/>.

/** @file stdc++.h
 *  This is an implementation file for a precompiled header.
 */

// 17.4.1.2 Headers

// C
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
// #include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

using namespace std;
typedef long long ll;

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

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

  int mn = a[0], mx = a[0];
  for (int i = 1; i < n; i++)
  {
    if (mn > a[i])
      mn = a[i];
    if (mx < a[i])
      mx = a[i];
  }

  cout << mx - mn << endl;
}


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

int main()
{
    ios_base::sync_with_stdio(0);
    int c=0;
    char ar[3];
    for(int i=0; i<3; i++)
    {
        cin>>ar[i];
        if(ar[i]=='1')
        {
            c++;
        }
    }

    cout<<c<<endl;
}


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

using namespace std;
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

#define PB(x, v) x.push_back(v);
#define M_P(a, b) make_pair(a, b)
#define pll pair<ll, ll>
#define ll long long
#define mll map<ll, ll>
#define vl vector<ll>
#define fa(x, v) for(auto x: v)
#define fr(i, a, b) for(int i= a;i <=b; i++)
#define TEST  ll Test; cin >> Test; while(Test--)

#define B_ begin()
#define E_ end()
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define NL_ "\n"
#define F first
#define S second
#define FF first.first
#define FS first.second
#define SF second.first
#define SS second.second

#define mod(a) a%1000000007
#define MAX 2000000000
#define  ull unsigned long long
 string s, t;

 ll atleast(ll& i)
 {
     if(s.length()-i <t.length())  return LLONG_MAX;
     ll len = 0;
     for(ll j = 0; j<t.length(); j++)
     {
           if(s[i+j]==t[j]) continue;
           len++;
     }
     return len;
 }



int main()
{

    FAST;
    ll ans = LLONG_MAX;
    cin >> s>> t;
    for(ll i=0; i< s.length(); i++)
        ans = min(ans, atleast(i) );
    cout << ans;
    return 0;
}


Measured memory_bytes: 3644
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
#include <sstream>
using namespace std;
#define ll long long 
#define rep(i, s, n) for(int i = s; i < n; i++)

int main() {
    ll n;
    cin >> n;
    int ans = 100;
    int flag = 0;
    string r = to_string(n);
    int rs = r.size();
    string s, t;
    for(ll i = 1; i*i <= n; i++) {
        if(n%i != 0) continue;
        
        s = to_string(i);
        t = to_string(n/i);
        int ss = s.size();
        int ts = t.size();
        int count = max(ss, ts);
        
        if(ans > count) {
            ans = count;
        }
    }
    cout << ans << endl;
    return 0;
}

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

#define _1 first
#define _2 second
#define pb push_back
#define mp make_pair
#define sqr(x) ((x) * (x))
#define all(x) (x).begin(), (x).end()
#define uni(x) (x).erase(unique(all(x)), (x).end())
#define reset(x, y) memset(x, y, sizeof(x))
#define BUG(x) cerr << #x << " = " << (x) << endl
#define BUGP(x) cout << #x << " = " << (x)._1 << ", " << (x)._2 << endl
using namespace std;

typedef long long LL;
typedef pair<int, int> pii;
typedef pair<LL, LL> pll;

const int dr[] = {-1, 0, 1, 0, -1, -1, 1, 1};
const int dc[] = {0, -1, 0, 1, -1, 1, -1, 1};
// Head

const int N = 212345;

string s;
int a[N], cnt[N], n, p;

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

    cin >> n >> p;
    cin >> s;

    LL ans = 0;
    if (p == 2) {
        for (int i = 0; i < n; ++i) {
            if (int(s[i] - '0') % 2 == 0) ans += i + 1;
        }
    } else if (p == 5) {
        for (int i = 0; i < n; ++i) {
            if (s[i] == '0' || s[i] == '5') ans += i + 1;
        }
    } else {
        int base = 1;
        for (int i = n - 1; i >= 0; --i) {
            a[i] = (s[i] - '0') * base % p;
            a[i] = (a[i] + a[i + 1]) % p;
            base = base * 10 % p;
        }

        for (int i = 0; i <= n; ++i) {
            ans += cnt[a[i]];
            ++cnt[a[i]];
        }
    }

    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 1428
//souviksn7
//crush pupil

#include<bits/stdc++.h>
//#include <fstream>
#define ll long long
#define int  long long
#include<algorithm>
#include<numeric>
#include<utility>
#include<vector>

#include <string>
//#include <boost/lexical_cast.hpp>// for lexical_cast()
//#define ll long long
#define f0(i,n) for(ll i=0;i<n;i++)
#define f1(i,n) for(ll i=1;i<=n;i++)
#define f(i,a,b) for(ll i=a;i<b;i++)
//#define fin0 for(ll i=n;i>0;i--)
#define tc(t) int t; cin >> t; while (t--)
#define fio ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
#define rr return
#define vi vector<ll>
#define sz size()
#define endl "\n"
#define ss string
#define pb push_back

//#define beg begin()
//#define end end()
#define all(v) v.begin(),v.end()
#define sp " "

using namespace std;
ll gcd(ll a,int b) {if(b==0) return a; else return gcd(b,a%b); }
ll  mod(ll  a,ll  b) { if(a>b) return (a-b);  else return (b-a);}
double distance(ll  x1, ll  y1, ll  x2, ll  y2){ return sqrt(pow(x2 - x1, 2) +pow(y2 - y1, 2) * 1.0);}
int fact(int n){int res = 1; for (int i = 2; i <= n; i++) res = res * i;  return res;}
int nCr(int n, int r){ return fact(n) / (fact(r) * fact(n - r));}
bool isPerfectSquare(long double x){long double sr = sqrt(x);return ((sr - floor(sr)) == 0);}
bool isPrime(int n)
{
    if (n <= 1)
        return false;
    if (n <= 3)
        return true;
    if (n % 2 == 0 || n % 3 == 0)
        return false;

    for (int i = 5; i * i <= n; i = i + 6)
        if (n % i == 0 || n % (i + 2) == 0)
            return false;

    return true;
}
int maxSum(int arr[], int n, int k)
{
    // k must be greater
    if (n < k)
    {
       cout << "Invalid";
       return -1;
    }


    int res = 0;
    for (int i=0; i<k; i++)
       res += arr[i];

    int curr_sum = res;
    for (int i=k; i<n; i++)
    {
       curr_sum += arr[i] - arr[i-k];
       res = max(res, curr_sum);
    }

    return res;
}

int maxi=1e5+10;
void pri(int v[],int n, int ind)
{
  for(int i=ind;i<n+ind;i++)
  {
    cout<<v[i%n]<<sp;
  }
}
void maxarray(int a[],int n)
{
  int maxsofar=INT_MIN,maxendinghere=0;
  for(int i=0;i<n;i++)
  {
    maxendinghere=maxendinghere+a[i];
    if(maxsofar<maxendinghere)
      maxsofar=maxendinghere;
    if(maxendinghere<0)
      maxendinghere=0;
  }
  cout<< maxsofar;
}
bool isPowerOfTwo(int n)
{
   if(n==0)
   return false;

   return (ceil(log2(n)) == floor(log2(n)));
}


signed main()
{
 int a;
 cin>>a;
 cout<<a+a*a+a*a*a;
      return 0;
}


Measured memory_bytes: 3680
function main()
  
  (N,K,Q) = map(x -> parse(Int,x), split(readline()))
  
  A = [K-Q for i in 1:N]
  for i in 1:Q
    check = parse(Int,readline())
    A[check] += 1
  end
  
  for i in 1:N
    if A[i] > 0
      println("Yes")
    else
      println("No")
    end
  end
  
end

main()

Measured memory_bytes: 144952
#include <iostream>
using namespace std;
using ll = long long;

int main() {
    int n;
    cin >> n;
    ll s=0, t=0;
    for(int i=0; i<n; i++) {
        ll x,y;
        cin >> x >> y;
        s += x*y;
        t += y;
    }
    ll k=s%9;
    if(k==0) k=9;
    cout << t-1+(s-k)/9 << endl;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
using ll = long long ;
using P = pair<int,int> ;
using pll = pair<long long,long long>;
constexpr int INF = 1e9;
constexpr long long LINF = 1e17;
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979323846;

int main(){
    ll n;
    cin >> n;
    map<ll,ll> mp;
    ll ans = 0;
    rep(i,n){
        ll a;
        cin >> a;
        mp[a] ++;
        ans += a;
    }
    ll q;
    cin >> q;
    while(q--){
        ll b,c;
        cin >> b >> c;

        ans += mp[b] * c - mp[b] * b;
        mp[c] += mp[b];
        mp[b] = 0;

        cout << ans << endl;
    }

    return 0;
}

Measured memory_bytes: 9352
#pragma warning(disable:4996)
#include <bits/stdc++.h>

using namespace std;

#define REP(i,n) for (int i = 0; i<n; i++)
#define ALL(a) begin(a), end(a)
#define TPL template
#define TNM typename

using ll = long long;
using ull = unsigned long long;
TPL<TNM T> using vec = vector<T>;
TPL<TNM T> using vec2 = vec<vec<T>>;
TPL<TNM T> using vec3 = vec<vec2<T>>;
TPL<TNM T> using vec4 = vec<vec3<T>>;
TPL<TNM T> using vec5 = vec<vec4<T>>;

TPL<TNM K, TNM V> using umap = unordered_map<K, V>;
TPL<TNM K, TNM V> using uset = unordered_set<K, V>;

TPL<class T> inline void OUT(const T &x) { cout << x << "\n"; }
struct pre_ { pre_() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(6); } } pre__;

TPL<TNM V, TNM H> void resize(vector<V>& v, const H h) { v.resize(h); }
TPL<TNM V, TNM H, TNM ... T> void resize(vector<V>& v, const H& h, const T ... t) { v.resize(h); for (auto& _v : v) resize(_v, t ...); }
TPL<TNM V, TNM T> void fill(V& x, const T& val) { x = val; }
TPL<TNM V, TNM T> void fill(vector<V>& vec, const T& val) { for (auto& v : vec) fill(v, val); }

int main(void) {
	int D, G;
	cin >> D >> G;
	vec<int> P(D), C(D);
	REP(i, D) {
		cin >> P[i] >> C[i];
	}

	int ans = 1000;
	for (int bits = 0; bits < (1 << D); ++bits) {
		int g = G;
		int num = 0;
		REP(i, D) {
			if (bits & (1 << i)) {
				int s = 100 * (i + 1) * P[i];
				g -= s + C[i];
				num += P[i];
			}
		}
		if (g <= 0) {
			ans = min(ans, num);
			continue;
		}
		for (int i = D - 1; i >= 0; --i) {
			if (!(bits & (1 << i))) {
				int s = 100 * (i + 1);
				int n = min((g + s - 1) / s, P[i]);
				g -= s * n;
				num += n;
			}
			if (g <= 0) {
				ans = min(ans, num);
				break;
			}
		}
	}

	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
	int a, b, c;
	scanf("%d%d%d", &a, &b, &c);
	if (a*a + b * b == c * c) {
		printf("%d", (a*b)/2);
	}
	else if (a*a + c * c == b * b) {
		printf("%d", (a*c)/2);
	}
	else if (c*c + b * b == a * a) {
		printf("%d", (c*b) / 2);
	}




	return 0;

}

Measured memory_bytes: 128
import fractions
A, B, C, D = (int(x) for x in input().split())
x = (B // C) - ((A - 1) // C)
x += (B // D) - ((A - 1) // D)
lcm = (C * D) // fractions.gcd(C, D)
x -= (B // lcm) - ((A - 1) // lcm)
print((B - A + 1) - x)

Measured memory_bytes: 5048
#include <stdio.h>
     
int main(){
   int n,T,c,t,cb,tb,i;
    
   scanf("%d%d",&n,&T);
   scanf("%d%d",&cb,&tb);
   for (i=1;i<n;i++) {
      scanf("%d%d",&c,&t);
      if (t<=T && (c<cb || tb>T)) {
        cb=c;
        tb=t;
      }
   }
   if (tb>T) puts("TLE");
   else      printf("%d\n",cb);
   return 0;
}

Measured memory_bytes: 128
s=input().split()
n=int(s[0])
m=int(s[1])
a=[[0 for j in range(m)]for i in range(n)]
b=[0 for j in range(m)]
for i in range(n):
    t=input().split()
    for j in range(m):
        a[i][j]=int(t[j])
for j in range(m):
    b[j]=int(input())
c=[0 for i in range(n)]
for i in range(n):
    for j in range(m):
        c[i]+=a[i][j]*b[j]
    print("{0}".format(c[i]))

Measured memory_bytes: 5960