akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
using namespace std;
template<class T>inline void read(T&a){
	char c=getchar();int f=1;a=0;
	while(c>'9'||c<'0'){if(c=='-') f=-1;c=getchar();}
	while(c<='9'&&c>='0') a=(a<<1)+(a<<3)+c-48,c=getchar();
	a*=f;
}
template<class T>void write(T a){
	if(a<0) putchar('-'),a=-a;
	if(a>9) write(a/10);
	putchar(a%10+48);
}
const int o=3010;
#define int long long
inline int max(int a,int b){return a>b?a:b;}
int r,c,K,ro,co,vo,f[o][o][4],t[o][o];
signed main(){
	read(r);read(c);read(K);
	while(K--) read(ro),read(co),read(vo),t[ro][co]=vo;
	for(int i=1;i<=r;++i)
		for(int j=1;j<=c;++j){
			for(int k=0;k<4;++k) f[i][j][k]=f[i][j-1][k];
			f[i][j][0]=max(f[i][j][0],max(max(f[i-1][j][0],f[i-1][j][1]),max(f[i-1][j][2],f[i-1][j][3])));
			if(t[i][j]){for(int k=1;k<4;++k) f[i][j][k]=max(f[i][j][k],f[i][j-1][k-1]+t[i][j]);
			f[i][j][1]=max(f[i][j][1],max(max(f[i-1][j][0],f[i-1][j][1]),max(f[i-1][j][2],f[i-1][j][3]))+t[i][j]);}
		}
	write(max(max(f[r][c][0],f[r][c][1]),max(f[r][c][2],f[r][c][3])));
	return 0;
}

Measured memory_bytes: 354108
n = int(input())
a = list(map(int, input().split()))

t = 1
limit = pow(10, 18)

if 0 in set(a):
    print(0)
else:
    for i in a:
        t *= i
        if t > limit:
            print(-1)
            break
    else:
        print(t)


Measured memory_bytes: 101776
import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;

public class Main{
	Scanner sc=new Scanner(System.in);

	int INF=1<<28;
	double EPS=1e-12;

	int n;
	int[] pow;
	String[] names;
	HashSet<String>[] sets;

	@SuppressWarnings("unchecked")
	void run(){
		for(;;){
			n=sc.nextInt();
			if(n==0){
				break;
			}
			names=new String[n];
			pow=new int[n];
			sets=new HashSet[n];
			for(int j=0; j<n; j++){
				names[j]=sc.next();
				pow[j]=sc.nextInt();
				sets[j]=new HashSet<String>();
				int m=sc.nextInt();
				for(int i=0; i<m; i++){
					sets[j].add(sc.next());
				}
			}
			solve();
		}
	}

	long[] g;
	int[] _;
	int ans;

	void solve(){
		HashMap<String, Integer> map=new HashMap<String, Integer>();
		for(int i=0; i<n; i++){
			map.put(names[i], i);
		}
		g=new long[n];
		for(int i=0; i<n; i++){
			for(String s : sets[i]){
				int j=map.get(s);
				g[i]|=1L<<j;
			}
		}
		// _:順番->ID
		_=new int[n];
		for(int i=0; i<n; i++){
			_[i]=i;
		}
		for(int j=0; j<n; j++){
			for(int i=j+1; i<n; i++){
				if(Long.bitCount(g[_[i]])<Long.bitCount(g[_[j]])){
					int t=_[i];
					_[i]=_[j];
					_[j]=t;
				}
			}
		}

		ans=0;
		// mis(1, 1, pow[0]);
		mis_(0, 1, pow[0]);
		println(ans+"");
	}

	void mis_(int k, long choosed, int sum){
		if(k==n){
			ans=max(ans, sum);
			return;
		}
		if((choosed&(g[_[k]]|(1L<<_[k])))==0){
			mis_(k+1, choosed|(1L<<_[k]), sum+pow[_[k]]);
			long rem=0;
			for(int i=k+1; i<n; i++){
				if((choosed&g[_[i]])==0)
					rem|=g[_[i]];
			}
			if((rem>>>_[k]&1)==0){
				return;
			}
		}
		mis_(k+1, choosed, sum);
	}

	void mis(int k, long choosed, int sum){
		if(k==n){
			// String c=Long.toBinaryString(choosed);
			// for(; c.length()<n; c="0"+c);
			// debug(c, sum);
			ans=max(ans, sum);
			return;
		}
		if((choosed&(g[k]|(1L<<k)))==0){
			mis(k+1, choosed|(1L<<k), sum+pow[k]);
			long rem=0;
			for(int i=k+1; i<n; i++){
				if((choosed&g[i])==0)
					rem|=g[i];
			}
			if((rem>>>k&1)==0){
				return;
			}
		}
		mis(k+1, choosed, sum);
	}

	void debug(Object... os){
		System.err.println(Arrays.deepToString(os));
	}

	void print(String s){
		System.out.print(s);
	}

	void println(String s){
		System.out.println(s);
	}

	public static void main(String[] args){
		new Main().run();
	}
}

Measured memory_bytes: 13000
//おまじない
//#include <bits/stdc++.h>
//#include <stdio.h>
#include <iostream>
//#include <math.h>
#include<iomanip>
#include <map>
#include <set>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#define INF 1e16
#define rep(i,n) for(int i=0;i<n;i++)
#define all(a) a.begin(),a.end()
#define P pair<int,int>
#define space ' '
#define pll pair<ll,ll>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

//(int)'a'は97 (int)'A'は65 (int)'1'は49
//おまじない

const int maxn = 200000;

ll ans = 0;
ll m;
ll d[maxn],c[maxn];
vector<ll> v;

void cal(ll d,ll c){
    ans+=c-1;
    ll k = (d*c-1)/ll(9);
    ans +=k;
    v.push_back(d*c-9*k);
    return;
}

int main(){
    
    cin >> m;
    rep(i,m)cin >> d[i]>>c[i];
    
    rep(i,m)cal(d[i],c[i]);
    
    ans += m-1;
    ll sum = 0;
    rep(i,m)sum+=v[i];
    
    ans += (sum-1)/9;
    
    cout << ans<<endl;
    
    return 0;
}


Measured memory_bytes: 5492
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        char[] arr = s.toCharArray();
        arr[0] = arr[0] == '0' ? '1' : '0';
        System.out.println(Math.min(painted(arr, 1), painted(s.toCharArray(), 0)));
    }

    private static int painted(char[] arr, int count) {
        for (int i = 1; i < arr.length; i++) {
            if (arr[i] == arr[i-1]) {
                count++;
                arr[i] = arr[i] == '0' ? '1' : '0';
            }
        }
        return count;
    }
}

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



int main(){
	int N,M;
	cin>>N>>M;
	vector<pair<int,int>> A(N);
	vector<pair<int,int>> B(M);
	
	for(int i=0;i<N;i++)cin>>A[i].first>>A[i].second;
	for(int j=0;j<M;j++)cin>>B[j].first>>B[j].second;
	
	for(int i=0;i<N;i++){
		int mini = 1000000000;
		int an = 0;
		for(int j=0;j<M;j++){
			int x = abs(A[i].first-B[j].first)+abs(A[i].second-B[j].second);
			//cout<<x<<endl;
			if(mini>x){
				mini=x;
				an=j;
			}
		}
		cout<<an+1<<endl;
	}
	
	
	return 0;
}


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

int main() {
	string s, t;
	cin >> s >> t;
	sort(s.begin(), s.end()); // s'を求めた
	sort(t.begin(), t.end());
	reverse(t.begin(), t.end()); // t'を求めた
	for (int i = 0;i < min(s.length(), t.length());i ++) { // ここから一文字ずつ比較していくよ
		if (s[i] > t[i]) { // s'の方がt'より辞書順で大きい
			cout << "No";
			return 0;
		} else if (s[i] < t[i]) { // s'の方がt'より辞書順で小さい
			cout << "Yes";
			return 0;
		} // 同値、まだ比較を続ける
	}
	if (s.length() < t.length()) cout << "Yes";// ここまで同値なら、後は長さが長い方が辞書順で大きい
	else cout << "No"; // あ、完全にs'とt'が同値でもNoだからね？
	return 0;
}
/*
31536000のコメント解説欄
ここテンプレで用意してるから、A問題とかだとこの先空欄の危険あり

まず、s'<t'にできるs'及びt'が1個でも存在すれば良いので、次のことを考える
1. s'、s''が存在してs'<t'かつs''<t'ならばs''<t'である
2. t'、t''が存在してs'<t'かつt'<t''ならばs'<t''である

よって、s'にする文字列はs'の候補の中で辞書順最小のものにして、
t'にする文字列はt'の候補の中で辞書順最大のものにすればいい
それでもs'>=t'なら辞書順でs'<t'にできないってことだしね

この方法は、アルファベットはchar型における大きさと辞書順が等しいことを利用するよ
つまり、s'は昇順ソート、t'は降順ソートを行ったsとtでおｋ
*/

Measured memory_bytes: 256
#include<algorithm>
#include<math.h>
#include<iostream>
#include<stdio.h>
#include<string.h>
typedef long long ll;
using namespace std;
ll a[1000005];
int main()
{
    ll i,j,n,flag=1,ans=0;
    scanf("%lld",&n);
    printf("%lld\n",n*n);

}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
///////////////////////////////////////////
const long long int INF = 1LL<<60;
const long long int Mod = 1000000007;
using ll = long long int; using ci = const int;
using vi = vector<int>;  using Vi = vector<long long int>;
using P = pair<int, int>;  using PLL = pair<ll, ll>;
using matrix = vector<vector<ll>>;
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define rep(i,N) for(ll i = 0; i < (ll)N; i++)
#define repi(i,a,b) for(ll i = ll(a); i < ll(b); ++i)
template<class T>bool chmax(T &former, const T &b) { if (former<b) { former=b; return true; } return false; }
template<class T>bool chmin(T &former, const T &b) { if (b<former) { former=b; return true; } return false; }
template<class T>T sqar(T x){ return x*x; }//sqrt(x)は平方根;
#define Sort(v) std::sort(v.begin(), v.end(), std::greater<decltype(v[0])>()) //降順でVをソート
#define p_queue(v) priority_queue<v, vector<v>, greater<v> >
template<class T> inline void princ(T x){cout<<x<<" ";}; 
template<class T> inline void print(T x){cout<<x<<"\n";};
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
///////////////////////////////////////////////////////////////////////////////////

string s;
Vi sum;

ll ss[2019][2];

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    std::cout<<std::fixed<<std::setprecision(30);
    cin>>s;
    sum.resize(s.size()+1,0);
    ll n = s.size();
    ll ans = 0;
    rep(i,2019){
        rep(j,2)ss[i][j]=0;
    }
    set<ll> s1,s2;

    rep(i,n){
        rep(j,2019){
            if(ss[j][0]!=0)ss[(j*10+(s[i]-'0'))%2019][1] += ss[j][0];
        }
        ss[(s[i]-'0')][1] += 1;
        ans += ss[0][1];
        rep(j,2019){
            ss[j][0] = ss[j][1];
            ss[j][1] = 0;
        }
    }
    print(ans);
    return 0;
}

Measured memory_bytes: 5164
#include<bits/stdc++.h>
#define pb push_back
#define F first
#define S second
using ll = long long;
#define ull unsigned ll
#define endl "\n"
#define vi vector<int>
#define vl vector<ll>
#define all(v) (v).begin(),(v).end()
#define mst(a,b) memset(a,b,sizeof(a))
#define pii pair<int,int>
#define pll pair<ll, ll>
#define ppi pair<int, pii>
#define vpi vector<pii>
#define vpl vector<pll>
#define mt make_tuple
#define eb emplace_back
using namespace std;

const ll N = 2e5 + 5, mod = 1e9 + 7;
const ll inf = 1e18;

struct cmp{
    bool operator() (pii a, pii b){
        if(a.F == b.F) return a.S < b.S;
        return a.F > b.F;
    }
};

ll power(ll x, ll p){
    ll r = 1ll;
    x = x % mod;
    while(p > 0){
        if(p & 1) r = (r * x) % mod;
        p = p >> 1;
        x = (x * x) % mod;
    }
    return r;
}

void solve(){
    ll n;
    cin >> n;
    vl a(n);
    for(ll i = 0; i < n; i++){
        cin >> a[i];
    }
    ll ans = 0, sum = 0;
    for(ll i = 0; i < n; i++){
        ans = (ans + (sum * a[i]) % mod) % mod;
        sum = (sum + a[i]) % mod;
    }
    cout << ans << endl;
}

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    //cout.tie(0);
    /*#ifndef ONLINE_JUDGE
        freopen("Input.txt", "r", stdin);
    #endif*/
    //freopen("running_on_fumes_chapter_1_input (1).txt", "r", stdin);
    //freopen("Output.txt", "w", stdout);
    int t = 1, p;
    //cin >> t;
    for(p = 1; p <= t; p++){
        //cout << "Case #" << p << ": ";
        solve();
    }
    return 0;
}


Measured memory_bytes: 4780
# -*- coding: utf-8 -*-

import sys, re
from collections import deque, defaultdict, Counter
from math import sqrt, hypot, factorial, pi, sin, cos, radians
if sys.version_info.minor >= 5: from math import gcd
else: from fractions import gcd 
from heapq import heappop, heappush, heapify, heappushpop
from bisect import bisect_left, bisect_right
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from functools import reduce, partial
from fractions import Fraction
from string import ascii_lowercase, ascii_uppercase, digits

def input(): return sys.stdin.readline().strip()
def ceil(a, b=1): return int(-(-a // b))
def round(x): return int((x*2+1) // 2)
def fermat(x, y, MOD): return x * pow(y, MOD-2, MOD) % MOD
def lcm(x, y): return (x * y) // gcd(x, y)
def lcm_list(nums): return reduce(lcm, nums, 1)
def gcd_list(nums): return reduce(gcd, nums, nums[0])
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

T, X =MAP()

print(T / X)


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

using namespace std;
typedef long long ll;
#define int ll

#define REP(i,n) for(ll i=0;i<n;++i)
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const int MOD = 1000000007;
#define MAX_N 100010

ll N;

signed main()
{
    ll M = 0, A = 0, R = 0, C = 0, H = 0;
    cin >> N;
    REP(i, N) {
        string s;
        cin >> s;
        if(s[0] == 'M') { M++; }
        if(s[0] == 'A') { A++; }
        if(s[0] == 'R') { R++; }
        if(s[0] == 'C') { C++; }
        if(s[0] == 'H') { H++; }
    }
    ll ans = M * A * R;
    ans += M * R * C;
    ans += M * C * H;
    ans += M * A * H;
    ans += M * R * H;
    ans += M * A * C;
    ans += A * R * C;
    ans += A * R * H;
    ans += A * C * H;
    ans += R * C * H;
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

void Rectangle(int H, int W)
{	
	for(int i = 0; i < H; i++){
		for(int j = 0; j < W; j++){
			printf("#");
		}
		printf("\n");
	}
}
		
int main(void)
{
	int H, W;
	
	while(true){
	
		scanf("%d %d",&H, &W);
		
		if(H == 0 && W == 0){
			break;
		}
		
		Rectangle(H, W);
				
		printf("\n");
	}
	
	return 0;
}

Measured memory_bytes: 2588
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> line;
#define m first
#define b second
const int MN = 2e5+5;
line lines[MN];
ll h[MN];
ll get (line a, ll x) {return a.m * x + a.b;}
double intersect (line f, line s) {return f.m == s.m ? -1e18 : (f.b - s.b)/double(s.m - f.m);}
int main() {
    int n,l=0,r=1; ll c;
    scanf ("%d %lld %lld",&n,&c,&h[0]);
    lines[0] = {-2 * h[0],h[0] * h[0]};
    for (int i = 2; i <= n; i++) {
        scanf ("%lld",&h[i]);
        while (r-l>1 && get(lines[l],h[i]) >= get(lines[l+1],h[i])) l++;
        ll dp = get(lines[l],h[i]) + h[i] * h[i] + c;
        if (i == n) return !printf ("%lld\n",dp);
        line nline = {-2 * h[i],dp + h[i] * h[i]};
        while (r-l>1 && intersect(nline,lines[r-1]) < intersect(lines[r-1],lines[r-2])) r--;
        lines[r++] = nline;
    }
    return 0;
}

Measured memory_bytes: 4864
#include <cstdio>
using namespace std;

int main(){
  int n, m;
  scanf("%d %d", &n, &m);
  int k[30], a[30][30];
  for(int i=0; i<n; i++){
    scanf("%d", &k[i]);
    for(int j=0; j<k[i]; j++) scanf("%d", &a[i][j]);
  }
  int num_like[31] = {};
  for(int i=0; i<n; i++){
    for(int j=0; j<k[i]; j++){
      ++num_like[a[i][j]];
    }
  }
  int result = 0;
  for(int i=1; i<=m; i++){
    if (num_like[i] == n) ++result; 
  }
  printf("%d\n", result);
  return 0;
}

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

typedef long long Int;
typedef pair<int,int> PII;
typedef vector<int> VInt;
 
#define FOR(i, a, b) for(i = (a); i < (b); ++i)
#define RFOR(i, a, b) for(i = (a) - 1; i >= (b); --i)
#define EACH(it, a) for(auto it = (a).begin(); it != (a).end(); ++it)
#define CLEAR(a, b) memset(a, b, sizeof(a))
#define SIZE(a) int((a).size())
#define ALL(a) (a).begin(),(a).end()
#define MP make_pair

bool f(Int a, Int b, Int v, Int w, Int t)
{
    if(a == b) return true;
    if(v <= w) return false;
    return abs(a - b) <= t*(v - w);
}

void solve(int test)
{
    int a, b, v, w, t;
    cin >> a >> v >> b >> w >> t;
    cout << (f(a, b, v, w, t) ? "YES" : "NO") << endl;
}

int main()
{
    int T = 1, t;
    //cin >> T;
    FOR(t, 0, T) solve(t);
    return 0;
}


Measured memory_bytes: 3636
#include <cstdio>
#include <cstring>
#include <cmath>
#include <utility>
#include <iostream>
#include <functional>
#include <bitset>
#include <algorithm>
#include <vector>
#include <forward_list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <numeric>
#include <iomanip>
#define ll long long int
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
using namespace std;
int mx4[] = {0,1,0,-1};
int my4[] = {1,0,-1,0};
int mx2[] = {1,0};
int my2[] = {0,1};

class AAddSubMul {
public:
	void solve(istream& in, ostream& out) {
        int a,b;
        in >> a >> b;
        int ans = max(a + b,max(a - b,a * b));
        out << ans << endl;
	}
};

int main() {
	AAddSubMul solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}

Measured memory_bytes: 256
n = int(input())
v = list(map(int,input().split()))
c = list(map(int,input().split()))
list = [0]
x, y = 0, 0

for i in range(len(v)):
    if v[i] > c[i]:
        x += int(v[i])
        y += int(c[i])
        list.append(x - y)
    else:
        continue

print(max(list))

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

int main() {
    int n, m, x;
    cin >> n >> m >> x;

    vector<int> c(n);
    vector<vector<int>> a(n, vector<int>(m));

    for (int i = 0; i < n; i++) {
        cin >> c[i];
        for (int j = 0; j < m; j++) {
            cin >> a[i][j];
        }
    }

    int64_t ans = 123456789;
    for (int tmp = 1; tmp < (1 << n); tmp++) {
        bitset<12> s(tmp);
        // cout << s << endl;
        vector<int> skill(m, 0);
        int64_t sum = 0;
        for (int i = 0; i < n; i++) {
            if (s.test(i)) {
                sum += c[i];
                for (int j = 0; j < m; j++) {
                    skill[j] += a[i][j];
                }
            }
        }
        bool ok = true;
        for (int k = 0; k < m; k++) {
            if (skill[k] < x) {
                ok = false;
            }
        }
        if (ok) {
            ans = min(ans, sum);
        }
    }
    if (ans == 123456789) {
        cout << -1 << endl;
    } else {
        cout << ans << endl;
    }
}


Measured memory_bytes: 3596
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    long A = scan.nextLong();
    long B = scan.nextLong();

    long AB = A + B;
    if (AB % 2 != 0) {
      System.out.println("IMPOSSIBLE");
      return;
    }
    System.out.println(AB / 2);


  }

}


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

int parent(int i)
{
    return i/2;
}
int left(int i)
{
    return i*2;
}
int right(int i)
{
    return i*2+1;
}

int main()
{
    int H,i,A[MAX];
    cin>>H;
    for(i=1;i<=H;i++)cin>>A[i];

    for(i=1;i<=H;i++)
    {
        cout<<"node "<<i<<": key = "<<A[i]<<", ";
        if(parent(i)>=1)cout<<"parent key = "<<A[parent(i)]<<", ";
        if(left(i)<=H)cout<<"left key = "<<A[left(i)]<<", ";
        if(right(i)<=H)cout<<"right key = "<<A[right(i)]<<", ";
        cout<<endl;
    }
 	return 0;
}



Measured memory_bytes: 3088
#include <cstdio>
#define REP(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) REP(i,0,n)
bool b[101][101];
char g[101][101];
int dx[] = { 1, -1, 0, 0 };
int dy[] = { 0, 0, -1, 1 };
int H, W;
void dfs(int i,int j)
{
    if (b[i][j]) return;
    b[i][j] = true;
    rep(d, 4) {
        int r = i + dy[d];
        int c = j + dx[d];
        if (r < 0 || r >= H || c < 0 || c >= W || g[r][c] != g[i][j]) continue;
        dfs(r, c);
    }
}
int main()
{
    while (true) {
        scanf("%d%d", &H, &W);
        if (!(H | W)) break;
        rep(i, H) rep(j, W) b[i][j] = false;
        rep(i, H) scanf("%s", g[i]);
        int res = 0;
        rep(i, H) rep(j, W) if (!b[i][j]) {
            res++;
            dfs(i, j);
        }
        printf("%d\n", res);
    }
    return 0;
}

Measured memory_bytes: 0
import java.util.*;
public class Main{
    public static Scanner scan  = new Scanner(System.in);
    public static void main(String[]args){
        int n,k;
        int di;

        Set<Integer> h_set = new HashSet<Integer>();

        n=nextInt();
        k=nextInt();
        for(int i=0;i<k;i++){
            di =nextInt();
            for(int j = 0;j<di;j++){
                h_set.add(nextInt());
            }
        }
        print(n-h_set.size());
    }



    public static int nextInt(){
        return Integer.parseInt(scan.next());
    }
    public static long nextLong(){
        return Long.parseLong(scan.next());
    }
    public static String next(){
        return scan.next();
    }
    public static double nextDouble(){
        return Double.parseDouble(scan.next());
    }
    public static float nextFloat(){
        return Float.parseFloat(scan.next());
    }

    //Yes or No
    public static void yesNo(boolean flag){
        if(flag) System.out.println("Yes");
        else System.out.println("No");
    }
    public static void print(Object a){
        System.out.println(a);
    }
}

Measured memory_bytes: 41064
/* When Talent doesn't work, Hard work beats Talent*/

#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")

#include"bits/stdc++.h"

using namespace std;

#define Fast_D cout<<fixed<<setprecision(13);
#define FastIO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

#define nl "\n"
#define int long long
#define double long double
#define all(v) v.begin(),v.end()
#define scanstr(s) cin>>ws; getline(cin,s);

#define debug(x) cout << __LINE__ << " " << #x <<"..." << x << endl
#define dev(x) cout << __LINE__ << " " << #x << "..." ; for(auto &it : x) cout<< it << " "; cout << endl;

const double PI = 3.141592653589793;

void solve()
{
	int a,b;
	cin >> a >> b;
	for(int i=1;i<=1250;i++)
	{
		int x = (8*i)/100;
		int y = (10*i)/100;
		if(x==a && y==b)
		{
			cout << i ;
			return ;
		}
	}
	cout << "-1";
}

int32_t main()
{
	FastIO;
	Fast_D;
	int T;
	T=1;
	while(T--) solve();
	return 0;
}



Measured memory_bytes: 3660
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<iostream>
using namespace std;
const int MAXN=202;
int n,nowred,nowblue,ans=0;
int flag[MAXN];
bool vis[MAXN];
struct edge{
	int v;
	edge *Next;
	edge() {v=0;Next=NULL;}
}*con[MAXN];
struct point{
	int x,y;
}Point[MAXN];
inline void ins(int Start,int End){
	edge *p=new(edge);
	p->v=End;
	p->Next=con[Start];
	con[Start]=p;
}
inline bool Find(int nv)
{
    for(edge *p=con[nv];p;p=p->Next)
    {
        int vv=p->v;
        if(vis[vv]==false)
        {
            vis[vv]=true;
            if(flag[vv]==0||Find(flag[vv]))
            {
                flag[vv]=nv;
                return true;
            }
        }
    }
    return false;
}
int main(){
	ios::sync_with_stdio(false);
	cin>>n;
	for(int i=1;i<=2*n;++i) cin>>Point[i].x>>Point[i].y;
	for(int i=1;i<=n;++i)
		for(int j=n+1;j<=n*2;++j)
			if(Point[j].x>Point[i].x&&Point[j].y>Point[i].y) ins(i,j);
	for(int i=1;i<=n;++i){
		memset(vis,0,sizeof(vis));
		if(Find(i)) ++ans;
	}
	cout<<ans;
	return 0; 
}

Measured memory_bytes: 384
import scala.io.StdIn


object Main extends App {

  val S  = StdIn.readLine()

  def solve(S: String): Int = {
    val l = S.length() - 1
    var cnta = 0

    (0 to l).foreach {
      case n if n % 2 == 0 => if (S(n) == '1') cnta = cnta + 1
      case n => if (S(n) == '0') cnta = cnta + 1        
    }

    var cntb = 0
    (0 to l).foreach {
      case n if n % 2 == 0 => if (S(n) == '0') cntb = cntb + 1
      case n => if (S(n) == '1') cntb = cntb + 1        
    }

    List(cnta, cntb).min
  }

  println(solve(S))
}
  



Measured memory_bytes: 28956
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <utility>
#include <algorithm>
#include <cstdio>
#include <iomanip>
#include <queue>
#include <deque>
#include <stack>
#include <fstream>
#include <cmath>
#include <random>
#include <complex>
#include <functional>

#define ll int64_t
#define Rep(i, n) for (ll i = 0; i < n; i++)
using namespace std;
typedef vector<ll> vec;
typedef vector<vec> mat;

const ll inf = 1LL << 60;

template<class T> inline void chmin(T& a, T b) {
    if (a > b) {
        a = b;
    }
}
template<class T> inline void chmax(T& a, T b) {
    if (a < b) {
        a = b;
    }
}

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

    ll N;
    string S;
    cin >> N >> S;

    vec r, g, b;
    Rep (i, N) {
        if (S[i] == 'R') {
            r.push_back(i);
        } else if (S[i] == 'B') {
            b.push_back(i);
        } else {
            g.push_back(i);
        }
    }

    ll ans = 0;
    Rep (i, N) {
        for (ll j = i+1; j < N; j++) {
            if (S[i] == S[j]) {
                continue;
            }
            if (S[i] == 'R' and S[j] == 'G' or S[i] == 'G' and S[j] == 'R') {
                ll tmp = b.end() - lower_bound(b.begin(), b.end(), j);
                if (2*j-i < N and S[2*j-i] == 'B') tmp--;
                ans += tmp;
            } else if (S[i] == 'G' and S[j] == 'B' or S[i] == 'B' and S[j] == 'G') {
                ll tmp = r.end() - lower_bound(r.begin(), r.end(), j);
                if (2*j-i < N and S[2*j-i] == 'R') tmp--;
                ans += tmp;
            } else {
                ll tmp = g.end() - lower_bound(g.begin(), g.end(), j);
                if (2*j-i < N and S[2*j-i] == 'G') tmp--;
                ans += tmp;
            }
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 3696
// May this submission get accepted!

#pragma GCC optimize ("O3")
#pragma GCC target ("tune=native")
#pragma GCC target ("avx")

#include <bits/stdc++.h>

// 汎用マクロ
#define ALL_OF(x) (x).begin(), (x).end()
#define REP(i,n) for (long long i=0, i##_len=(n); i<i##_len; i++)
#define RANGE(i,is,ie) for (long long i=(is), i##_end=(ie); i<=i##_end; i++)
#define DSRNG(i,is,ie) for (long long i=(is), i##_end=(ie); i>=i##_end; i--)
#define STEP(i, is, ie, step) for (long long i=(is), i##_end=(ie), i##_step = (step); i<=i##_end; i+=i##_step)
#define UNIQUE(v) do { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); } while (false)
template<class T> bool chmax(T &a, const T &b) {if (a < b) {a = b; return true;} return false; }
template<class T> bool chmin(T &a, const T &b) {if (a > b) {a = b; return true;} return false; }
#define INF 0x7FFFFFFF
#define LINF 0x7FFFFFFFFFFFFFFFLL
#define Yes(q) ((q) ? "Yes" : "No")
#define YES(q) ((q) ? "YES" : "NO")
#define Possible(q) ((q) ? "Possible" : "Impossible")
#define POSSIBLE(q) ((q) ? "POSSIBLE" : "IMPOSSIBLE")
#define DUMP(q) cerr << "[DEBUG] " #q ": " << (q) << " at " __FILE__ ":" << __LINE__ << endl
#define DUMPALL(q) do { cerr << "[DEBUG] " #q ": ["; REP(i, (q).size()) { cerr << (q)[i] << (i == i_len-1 ? "" : ", "); } cerr << "] at " __FILE__ ":" << __LINE__ << endl; } while (false)
template<class T> T gcd(const T &a, const T &b) { return a < b ? gcd(b, a) : b ? gcd(b, a % b) : a; }
template<class T> T lcm(const T &a, const T &b) { return a / gcd(a, b) * b; }

// gcc拡張マクロ
#define popcount __builtin_popcount
#define popcountll __builtin_popcountll

// エイリアス
#define DANCE_ long
#define ROBOT_ unsigned
#define HUMAN_ signed
#define CHOKUDAI_ const
using  ll = DANCE_ HUMAN_ DANCE_;
using ull = DANCE_ ROBOT_ DANCE_;
using cll = DANCE_ DANCE_ CHOKUDAI_;
using  ld = long double;
using namespace std;

// モジュール


// 処理内容
int main() {
    
    // インタラクティブ問題では除去した方がいいかも
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    ll n, m; cin >> n >> m;
    vector<ll> a(m), b(m);
    REP(i, m) cin >> a[i] >> b[i];
    vector<ll> rank(m);
    iota(ALL_OF(rank), 0LL);
    sort(ALL_OF(rank), [&](ll i, ll j) {
        return b[i] < b[j];
    });
    ll free = -INF;
    ll ans = 0;
    REP(_i, m) {
        ll i = rank[_i];
        if (free <= a[i]) {
            free = b[i];
            ans++;
        }
    }
    cout << ans << endl;
    
}

Measured memory_bytes: 2560
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <complex>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <iomanip>
#include <assert.h>
#include <array>
#include <cstdio>
#include <cstring>
#include <random>
#include <functional>
#include <numeric>
#include <bitset>
#include <fstream>

using namespace std;

struct before_main{before_main(){cin.tie(0); ios::sync_with_stdio(false);}} before_main;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }

typedef long long ll;
int const inf = 1<<29;

int N;
map<string, int> id;
bool adjacent[41][41];
int weight[41], wes[41];
int ans;

void dfs(ll S, int wsum, int curr) {
  if(wsum + wes[N-1] - (curr ? wes[curr] : 0) <= ans) return;
  if(curr == N-1) {
    ans = max(ans, wsum);
    return;
  }
  const int next = curr + 1;
  dfs(S, wsum, next);
  rep(k, next) if(adjacent[next][k] && (S >> k & 1)) return;
  dfs(S|(1LL<<next), wsum + weight[next], next);
}

int main() {

  while(cin >> N && N) {
    rep(i, 41) weight[i] = 0;
    rep(i, 41) rep(j, 41) adjacent[i][j] = 0;
    id.clear();
    int v = 0;

    rep(i, N) {
      string s; cin >> s;
      if(id.find(s) == id.end()) id[s] = v++;
      cin >> weight[id[s]];
      int n; cin >> n;
      rep(_, n) {
        string t; cin >> t;
        if(id.find(t) == id.end()) id[t] = v++;
        adjacent[id[s]][id[t]] = 1;
      }
    }

    rep(i, N) wes[i] = weight[i] + (i ? wes[i-1] : 0);

    ans = 0;
    dfs(1LL<<0, weight[0], 0);

    cout << ans << endl;

  }
  
  return 0;
}

Measured memory_bytes: 3216
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;
import java.util.regex.Pattern;
import java.util.stream.IntStream;

public class Main {
    public static void main(String[] args) {
        Scanner stdin = new Scanner(System.in);
        int n = Integer.parseInt(stdin.nextLine());
        int[] a = Pattern.compile(" ").splitAsStream(stdin.nextLine()).mapToInt(Integer::parseInt).toArray();
        
        int[] b = new int[n];
        int[] c = new int[n];
        for (int i = n - 1; i >= 0; i--) {
            if (c[i] % 2 == a[i]) {
                continue;
            }
            
            b[i]++;
            for (int factor : factors(i + 1)) {
                c[factor - 1]++;
            }
        }
        
        String[] ans = IntStream.range(0, n).filter(i -> b[i] == 1).mapToObj(i -> Integer.toString(i + 1)).toArray(String[]::new);
        System.out.println(ans.length);
        System.out.println(String.join(" ", ans));
    }
    
    public static Set<Integer> factors(int x) {
        Set<Integer> s = new HashSet<>();
        for (int i = 1; i * i <= x; i++) {
            if (x % i == 0) {
                s.add(i);
                s.add(x / i);
            }
        }
        return s;
    }
}


Measured memory_bytes: 76212
#include <stdio.h>
#define INI -1000000000

int main()
{
  int i,n,k,maxv=INI,minv;

  scanf("%d%d",&n,&minv);

  for(i=1;i<n;i++){
    scanf("%d",&k);
    if(maxv<k-minv) maxv=k-minv; 
    if(k<minv) minv=k;
  }
  printf("%d\n",maxv);

  return 0;
}

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

int main() {
  int a,b,c;
  cin >> a >> b >> c;
  if((a==5 && (b+c == 12 && b*c == 35)) ||(a==7 && b==5 && c == 5)){
    cout << "YES" << endl;
  }else{
    cout << "NO" << endl;
  }
}




Measured memory_bytes: 256
#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector,fast-math")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma comment(linker, "/stack:200000000")

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;

#define X first
#define Y second

//#include <boost/unordered_map.hpp>
//using namespace boost;

/*
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> rbtree;
rbtree T;
*/

namespace io{
	const int L = (1 << 20) + 1;

	char buf[L], *S , *T, c;

	char getchar() {
		if(__builtin_expect(S == T, 0)) {
			T = (S = buf) + fread(buf, 1, L, stdin);
			return (S == T ? EOF : *S++);
		}
		return *S++;
	}

	int inp() {
		int x = 0, f = 1; char ch;
		for(ch = getchar(); !isdigit(ch); ch = getchar())
			if(ch == '-') f = -1;
		for(; isdigit(ch); x = x * 10 + ch - '0', ch = getchar());
		return x * f;
	}

	unsigned inpu()
	{
		unsigned x = 0; char ch;
		for(ch = getchar(); !isdigit(ch); ch = getchar());
		for(; isdigit(ch); x = x * 10 + ch - '0', ch = getchar());
		return x;
	}

	ll inp_ll() {
		ll x = 0; int f = 1; char ch;
		for(ch = getchar(); !isdigit(ch); ch = getchar())
			if(ch == '-') f = -1;
		for(; isdigit(ch); x = x * 10 + ch - '0', ch = getchar());
		return x * f;
	}

	char B[45], *outs=B+40, *outr=B+40;
	template<class T>
	inline void print(register T a,register char x=0){
		if(x) *--outs = x, x = 0;

		if(!a)*--outs = '0';
		else
			while(a)
				*--outs = (a % 10) + 48, a /= 10;

		if(x)
			*--outs = x;

		fwrite(outs, outr - outs , 1, stdout);
		outs = outr;
	}
};

using io :: print;
using io :: inp;
using io :: inpu;
using io :: inp_ll;

using i32 = int;
using i64 = long long;
using u8 = unsigned char;
using u32 = unsigned;
using u64 = unsigned long long;
using f64 = double;
using f80 = long double;
//using i128 = __int128_t;
//using u128 = __uint128_t;
using i128 = i64;
using u128 = u64;

ll power(ll a, ll b, ll p)
{
	if (!b) return 1;
	ll t = power(a, b/2, p);
	t = t*t%p;
	if (b&1) t = t*a%p;
	return t;
}

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

template<class T>
inline void freshmin(T &a, const T &b)
{
	if (a > b) a = b;
}

template<class T>
inline void freshmax(T &a, const T &b)
{
	if (a < b) a = b;
}

const int MOD = 1000000007;
const int INF = 1000000000;
const int MAXN = 100010;

int n;
vector<pii> v[MAXN];
int c[MAXN];

void dfs(int x, int p)
{
	for (auto pp : v[x])
	{
		int y = pp.X;
		int w = pp.Y;
		if (y == p) continue;
		c[y] = c[x]^w;
		dfs(y, x);
	}
}

int main()
{
	
	n = inp();
	for (int i = 1; i < n; ++ i)
	{
		int x = inp();
		int y = inp();
		int w = inp()&1;
		v[x].push_back(pii(y, w));
		v[y].push_back(pii(x, w));
	}
	dfs(1, 0);
	for (int i = 1; i <= n; ++ i)
		printf("%d\n", c[i]);
	
	return 0;
}


Measured memory_bytes: 8704
#pragma comment(linker, "/STACK:64777216")
#define _CRT_SECURE_NO_WARNINGS
#include <string>
#include <vector>
#include <map>
#include <list>
#include <iterator>
#include <set>
#include <queue>
#include <iostream>
#include <sstream>
#include <stack>
#include <deque>
#include <cmath>
#include <memory.h>
#include <cstdlib>
#include <stdio.h>
#include <cctype>
#include <algorithm>
#include <utility>
#include <cassert>
#include <complex>
#include <time.h>
using namespace std;

#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define RFOR(i,b,a) for (int i = (b) - 1; i >= (a); i--)
#define ITER(it, a) for (__typeof(a.begin()) it = a.begin(); it != a.end(); it++)
#define FILL(a, value) memset(a, value, sizeof(a))

#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define MP make_pair
#define PB push_back

typedef long long Int;
typedef vector<int> VI;
typedef pair<int, int> PII;

const double PI = acos(-1.0);
const int INF = 1000 * 1000 * 1000 + 7;

const int MAX = 1000007;
const int CNT = 17;

int n, c, d, a, b;

int main()
{
	//freopen("in.txt", "r", stdin);

	cin >> n >> a >> b >> c >> d;

	n -= 1;

	FOR (x,0,n+1)
	{
		Int l = a + Int(c) * x;
		Int r = a + Int(d) * x;

		l -= Int(d) * (n-x);
		r -= Int(c) * (n-x);

		if (b >= l && b <= r)
		{
			cout << "YES" << endl;
			return 0;
		}
	}

	cout << "NO" << endl;




	return 0;
}


Measured memory_bytes: 256
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        n: usize,
    }
    let mut ok = false;
    for i in 1..10 {
        for j in 1..10 {
            if i * j == n {
                ok = true
            }
        }
    }
    println!("{}", if ok { "Yes" } else { "No" });
}


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

ll inf=9223372036854775806;

int main()
{
	//freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
	ios_base::sync_with_stdio(false); cin.tie(0);
    int n,a[4],i;
    cin>>n;
    for (i=0;i<4;i++){
    	a[3-i]=n%10;
    	n/=10;
    }
    if (a[0]+a[1]+a[2]+a[3]==7){
    	cout<<a[0]<<"+"<<a[1]<<"+"<<a[2]<<"+"<<a[3]<<"="<<"7";
    }
    else if (a[0]+a[1]+a[2]-a[3]==7){
    	cout<<a[0]<<"+"<<a[1]<<"+"<<a[2]<<"-"<<a[3]<<"="<<"7";
    }
    else if (a[0]+a[1]-a[2]+a[3]==7){
    	cout<<a[0]<<"+"<<a[1]<<"-"<<a[2]<<"+"<<a[3]<<"="<<"7";
    }
    else if (a[0]+a[1]-a[2]-a[3]==7){
    	cout<<a[0]<<"+"<<a[1]<<"-"<<a[2]<<"-"<<a[3]<<"="<<"7";
    }
    else if (a[0]-a[1]+a[2]+a[3]==7){
    	cout<<a[0]<<"-"<<a[1]<<"+"<<a[2]<<"+"<<a[3]<<"="<<"7";
    }	
    else if (a[0]-a[1]+a[2]-a[3]==7){
    	cout<<a[0]<<"-"<<a[1]<<"+"<<a[2]<<"-"<<a[3]<<"="<<"7";
    }
    else if (a[0]-a[1]-a[2]+a[3]==7){
    	cout<<a[0]<<"-"<<a[1]<<"-"<<a[2]<<"+"<<a[3]<<"="<<"7";
    } 
    else {
    	cout<<a[0]<<"-"<<a[1]<<"-"<<a[2]<<"-"<<a[3]<<"="<<"7";
    }
	return 0;
}

Measured memory_bytes: 256
N = int(input())
T, A = map(int, input().split())
H = list(map(int, input().split()))

num = 0
for i in range(N):
  deff = abs(T-H[i]*0.006-A)
  if deff < abs(T-H[num]*0.006-A):
    num = i

print(num+1)

Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <numeric>
#include <climits>
#include <math.h>
#include <memory.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, k, n) for(int i = (k); i < (int)(n); i++)
//substr
using namespace std;
using ll = long long;
int N, M;
int cnt = 0;
ll ans = 0LL;
int i_index;
int dh[4] = {1, 0, -1, 0};
int dw[4] = {0, 1, 0, -1};
string board[64];

int main(){
    int N;
    cin >> N;
    for(int i = 0; i < N; i++){
        for(int j = 0; j < N; j++){
            if(N == 4 * i + 7 * j){
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1000000007;

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

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

int main() {
  char c;
  cin >> c;
  if (c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o')
    cout << "vowel" << endl;
  else
    cout << "consonant" << endl;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1000000000LL;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


int main() {
    int sx, sy, tx, ty;
    cin >> sx >> sy >> tx >> ty;
    
    int dx = abs(tx - sx), dy = abs(ty - sy);
    string s;
    rep(i, dx) s +="R";
    rep(i, dy) s += "U";
    rep(i, dx) s += "L";
    rep(i, dy) s += "D";
    s += "D";
    rep(i, dx+1) s += "R";
    rep(i, dy+1) s += "U";
    s += "L";
    s += "U";
    rep(i, dx+1) s += "L";
    rep(i, dy+1) s += "D";
    s += "R";
    
    cout << s << ln;
}

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

typedef long long ll;

int main() {
  ll n;
  string s;
  cin >> n;
  cin >> s;
  ll ans = 1;
  map<char, ll> t;
  for (int i = 0; i < n; i++) {
    t[s[i]]++;
  }
  for (auto i = t.begin(); i != t.end(); i++) {
    ll c = i->second;
    ans *= c + 1;
    ans %= 1000000007;
  }
  ans--;
  if (ans < 0) {
    ans += 1000000007;
  }
  cout << ans << endl;
  return 0;
}

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

#define INF (1<<31)-1
#define LINF (1LL<<63)-1LL
#define MOD 1000000007
#define MOD2 998244353

template<class T,class U>bool chmax(T &a, const U &b){if(a<b){a=b;return 1;}return 0;}
template<class T,class U>bool chmin(T &a, const U &b){if(b<a){a=b;return 1;}return 0;}

#define rep(i,n) for(int i=0,_i=(n);i<_i;++i)
#define rep1(i,a,b) for(int a_=(a),b_=(b),i=a_;i<b_;++i)
#define repr(i,n) for(int _i=(n),i=_i;i>0;--i)

#define db(x) cerr<<#x<<" = "<<x<<" ";
#define db2(x,y) cerr<<"("<<#x<<", "<<#y<<") = ("<<x<<", "<<y<<") ";
#define db3(x,y,z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = ("<<x<<", "<<y<<", "<<z<<") ";
#define ln cout<<endl;

#define all(a)  (a).begin(),(a).end()
#define dig(n)  to_string(n).length()

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define se second
#define fi first

typedef long long ll;

typedef pair<int,int> P;
typedef pair<int,P> iP;
typedef pair<P,P> PP;

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return (a*b)/gcd(a,b);}

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

int main(){

    bool flag=false;
    ll ans=0,sum=0;

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

    vector<string> a(n);
    vector<string> b(m);

    rep(i,n)cin>>a[i];
    rep(i,m)cin>>b[i];

    rep(i , (n-m)+1)rep(j,(n-m)+1){
        bool ok = true;
        
        rep(p,m)rep(q,m){
            if(b[p][q] != a[i+p][j+q]){ok=false;break;}
        }
        
        if(ok){
            cout<<"Yes"<<endl;
            return 0;
        }
    }

    cout << "No" <<endl;

    //cout <<fixed<<setprecision(16)<< << endl;
    //if(flag)cout << "Yes" <<endl;
    //else cout << "No" <<endl;

    return 0;
}


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

int main(){
  
  char a;
  cin >> a;
  
  if (a=='a' || a=='i' || a=='u' || a=='e' || a== 'o'){
    cout << "vowel" << endl;
  }
  else {
    cout << "consonant" << endl;
  }
}


Measured memory_bytes: 256
M=10**9+7
def extended_gcd(a, b)
  last_remainder, remainder = a.abs, b.abs
  x, last_x, y, last_y = 0, 1, 1, 0
  while remainder != 0
    last_remainder, (quotient, remainder) = remainder, last_remainder.divmod(remainder)
    x, last_x = last_x - quotient*x, x
    y, last_y = last_y - quotient*y, y
  end
  return last_remainder, last_x * (a < 0 ? -1 : 1)
end

def invmod(e)
  g, x = extended_gcd(e, M)
  x % M
end

def powmod(x,r)
  ret=1
  b=x
  while r>0
    if r%2>0
      ret=ret*b%M
    end
    b=b*b%M
    r/=2
  end
  ret
end

def cmod(n,r)
  r=n-r if r*2>n
  x1=x2=1
  r.times{|i|
    x1=x1*(n-i)%M
    x2=x2*(i+1)%M
  }
  x1*invmod(x2)%M
end

n,a,b=gets.split.map &:to_i
puts (powmod(2,n)-1-cmod(n,a)-cmod(n,b))%M

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

ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

int main(){
    double l;
    cin >> l;
    l /= 3;
    double ans = pow(l,3.0);

    cout << fixed;
    cout << setprecision(10) << ans << endl;

    return 0;
}  

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

using ll = long long;
const int mod = 1e9+7;

map<int,int> primeFact(int n) {
  map<int,int> r;
  for(int i=2; i*i<=n; i++)
    while(n%i == 0) {
      r[i]++;
      n /= i;
    }
  if(n != 1)
    r[n] = 1;
  return r;
}

int main() {
    int N,i;
    ll c=1;
    cin >> N;
    map<int,int> tr;

    for(i=2; i<=N; i++)
        for(auto p : primeFact(i)) {
            if(tr.count(p.first))
                tr.at(p.first) += p.second;
            else
                tr[p.first] = p.second;
        }

    for(auto p : tr) {
        c *= p.second+1;
        c %= mod;
    }

    cout << c << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define R register
using namespace std;
const int N =2e6+200;
template <class Ruby_Rose> inline void read(Ruby_Rose &x)
{
 	x=0;
	char ch=getchar(), w=0;
	while(!isdigit(ch))w=(ch=='-'), ch=getchar();
	while(isdigit(ch))x=(x<<1)+(x<<3)+(ch^48), ch=getchar();
	x=w?-x:x;
}
int n;
map <string, int> mp;
int val[N];
int main()
{
	read(n);
	for(R int i=1; i<=n; i++)
	{
		string tmp;
		cin>>tmp;
		mp[tmp]=i; read(val[i]);
	}
	string tmp; cin>>tmp; int ans=0;
	for(R int i=mp[tmp]+1; i<=n; i++)ans+=val[i];
	cout<<ans<<endl; return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define rep(i,n) for(int i=0;i<n;i++)
int h,w;
char s[100][100];
int x[]={-1,0,1};
int y[]={-1,0,1};
int n[100][100];
signed main(){
    cin>>h>>w;
    rep(i,h){
        rep(j,w){
            n[i][j]=-1;
            cin>>s[i][j];
            if(s[i][j]=='.')n[i][j]++;
        }
    }
    rep(i,h){
        rep(j,w){
            if(s[i][j]=='#'){
                rep(k,3){
                    rep(l,3){
                        if(i+k>=0&&j+l>=0&&s[i+x[k]][j+y[l]]=='.'){
                            n[i+x[k]][j+y[l]]++;
                        }
                    }
                }
            }
        }
    }
    rep(i,h){
        rep(j,w){
            if(n[i][j]==-1)cout<<"#";
            else cout<<n[i][j];
        }
        cout<<endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
  
using namespace std;
  
template<class T> void ckmin(T &a, T b) { a = min(a, b); }
template<class T> void ckmax(T &a, T b) { a = max(a, b); }
  
#define pb push_back
#define mp make_pair
#define cotu cout
#define itn int
#define Red ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define F first
#define S second
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int i = 0; i < n; ++i)
#define repr(i,n) for(int i = n - 1; i >= 0; --i)
#define Rep(i, a, n) for(int i = (a); i <=(n); ++i)
#define repst(i, n) for(auto it = n.begin(); it != n.end(); ++it)
#define Repr(i, a, n) for(int i = (n); i >= (a); --i)
  
#define ordered_set tree<int , null_type,less<int >, rb_tree_tag,tree_order_statistics_node_update> 
  
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
  
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
  
const int inf = int(1e9);
const int mod = inf + 7;
const int N = 1e6 + 555; // TL MB
const double PI = acos(-1.0);
 
void mul(ll &x, ll y){
	x *= y;
	if(x >= mod) x %= mod;
}
 
void add(ll &x, ll y){
	x += y;
	if(x >= mod) x -= mod;
	if(x < 0) x += mod;
}
ll bp(ll a, ll n){
	ll r = 1;
	while(n){
		if(n & 1) mul(r, a);
		mul(a, a);
		n >>= 1;
	}
	return r;
}


void solve()
{
	vector<int> p = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
	int k;
	cin >> k;
	cout << p[k - 1];
}


 
 
int main()
{
    Red;
  	// int T; cin >> T; while(T--)
    solve();
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
ll N,W;
int main(){
    cin>>N>>W;
    
    ll w[110],v[110];
    rep(i,N) cin>>w[i]>>v[i];
    //cout<<"aaa"<<endl;
    
    ll dp[110][100010];
    for(int i=0;i<N;i++){
        for(int sum_w=0;sum_w<=W;sum_w++){
            if(sum_w-w[i]>=0){
                dp[i+1][sum_w]=max(dp[i][sum_w],dp[i][sum_w-w[i]]+v[i]);
            }
            else{
                dp[i+1][sum_w]=dp[i][sum_w];
            }
        }
    }
    ll res=0;
    cout<<dp[N][W]<<endl;
    
    return 0;
}

Measured memory_bytes: 80128