akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define MOD 1000000007
#define INF (1LL<<25)     //33554432
#define PI 3.14159265359
#define EPS 1e-12
//#define int ll

VI g[100010];
int h[100010], s[100010], t[100010];
signed main(void)
{
  int v, e;
  cin >> v >> e;
  REP(i, e) {
    cin >> s[i] >> t[i];
    g[s[i]].push_back(t[i]);
  }

  stack<int> st;

  for(auto& i: g)
    for(auto& j: i)
      h[j]++;

  REP(i, v) {
    if(h[i] == 0) st.push(i);
  }

  VI ans;
  while(st.size()) {
    int i = st.top(); st.pop();
    ans.push_back(i);
    for(auto& j: g[i]) {
      h[j]--;
      if(h[j] == 0) st.push(j);
    }
  }

  for(int i: ans) cout << i << endl;

  return 0;
}

Measured memory_bytes: 6364
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
    int a[3];
    cin >> a[0] >> a[1] >> a[2];

    sort(a, a + 3);
    cout << a[0] << " " << a[1] << " " << a[2] << endl;
    
    return 0;
}


Measured memory_bytes: 3120
#MLE注意！0や1のケースに注意

def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    import math
    #from math import gcd

    #inf = 10**17
    #mod = 10**9 + 7

    s,w = map(int, input().split())
    if s<=w:
        print('unsafe')
    else:
        print('safe')

if __name__ == '__main__':
    main()

Measured memory_bytes: 65224
import math
import string


def readints():
    return list(map(int, input().split()))


def nCr(n, r):
    return math.factorial(n)//math.factorial(n-r)*math.factorial(r)


n = int(input())
sum = 0
for i in range(n):
    x, u = input().split()
    if u == 'JPY':
        sum += int(x)
    else:
        sum += float(x)*380000
print(sum)


Measured memory_bytes: 3892
#include <iostream>
#include <string>
#include <stdio.h>
#include <cmath>
#include <cfloat>
#include <algorithm>
#include <numeric>
#include <vector>
#include <iterator>
#include <set>
#include <map>
using namespace std;

const double PI=acos(-1);

int main(){
    string s;
    cin >> s;
    int cnt = 0;
    char prev = ' ';
    for(int i = 0; i < s.length(); i++){
        int j = i;
        if(i == 0){
            cnt++;
            prev = s[i];
            continue;
        }
        if(i == s.length()-1){
            if(prev != s[i]) cnt++;
            continue;
        }
        if(prev == s[i]){
            cnt++;
            i++;
            prev = ' ';
        }else{
            cnt++;
            prev = s[i];
        }
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 644
#include<iostream>
enum{N=100001,M=100000007};long long d[N+1][2],t,i,j,l[2]={3,5};main(){for(;t<2;t++){for(d[1][t]=i=1;i++<l[t];)d[i][t]=d[i-1][t]*2;for(i=l[t];i++<N;)for(d[i][t]=1,j=0;j++<l[t];)d[i][t]=(d[i][t]+d[i-j][t])%M;}for(std::string s;std::cin>>s,s!="#";printf("%d\n",t))for(s+=(t=j=i=1);i<s.size();i++)s[i-1]-s[i]?(t=t*d[j][s[i-1]-56&&s[i-1]-48]%M),j=1:j++;}

Measured memory_bytes: 2712
#include <stdio.h>
#include <math.h>
#include <stdlib.h>

#define PI 3.14159265358979323846264338327950L

int main() {
    int a, b, h, m, dm;
    long double dh, d, ans;
    scanf("%d%d%d%d", &a, &b, &h, &m);
    // 1min 6dig
    dh = 30 * h + 0.5 * m;
    dm = 6 * m;
    d = (PI * fabsl(dh - dm)) / 180;
    ans = sqrtl(a * a + b * b - 2 * a * b * cosl(d));
    printf("%20.20Lf\n", ans);
    return 0;
}

Measured memory_bytes: 2584
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,l,n) for(int i=l; i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
typedef long long ll;

int main() {
  ll h,w; cin>>h>>w;
  if(h==1||w==1) cout<<"1"<<endl;
  else cout<<(ll)((h+1)/2)*(ll)((w+1)/2)+(ll)(h/2)*(ll)(w/2)<<endl;
}

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

def solve():
    X = int(input())

    def f(a, b):
        return a**4+(a**3)*b+(a**2)*(b**2)+a*(b**3)+b**4

    def divisor(n):
        # nの約数を列挙する
        i = 1
        ans = []
        while i*i <= n:
            if n%i == 0:
                ans.append(i)
                if i != n//i:
                    ans.append(n//i)
            i += 1
        return ans

    # 因数分解すると、
    # A-BはXの約数であることがわかる
    ds = divisor(X)

    for d in ds:
        a = 0
        cnt = X**(1/2)+1
        while cnt > 0:
            cnt -= 1
            b = a - d
            ff = f(a,b)
            if ff == X//d:
                print(a, b)
                return
            # elif ff > X//d and b > 0:
            #     break
            a += 1

        a = 0
        cnt = X**(1/2)+1
        while cnt > 0:
            cnt -= 1
            b = a - d
            ff = f(a,b)
            if ff == X//d:
                print(a, b)
                return
            # elif ff > X//d:
            #     break
            a -= 1


if __name__ == "__main__":
    solve()


Measured memory_bytes: 9512
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <vector>
#include <cmath>
#include <bitset>
#include <queue>

using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define sqr(x) (x)*(x)
typedef long long ll;

int main() {
    string s;
    cin >> s;
    int i;
    int count = 0;
    int maxc = 0;
    rep(i, s.length()) {
        string tmp = s.substr(i,1);
        if(tmp == "A" || tmp == "G" || tmp == "C" || tmp == "T") {
            count++;
        } else {
            maxc = max(maxc, count);
            count = 0;
        }
    }
    maxc = max(maxc, count);
    cout << maxc;
}

Measured memory_bytes: 256
# -*- coding utf-8 -*-
N = list(map(int, input().split()))

count = 0
for i in range(4):
    if N[i] == 1:
        count += 1
        N[i] = 'x'
        break
for i in range(4):
    if N[i] == 9:
        count += 1
        N[i] = 'x'
        break
for i in range(4):
    if N[i] == 7:
        count += 1
        N[i] = 'x'
        break
for i in range(4):
    if N[i] == 4:
        count += 1
        N[i] = 'x'
        break
if count == 4:
    print('YES')
else:
    print('NO')


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

struct Card {
	char suit;
	int num;
	bool flag;
};

int main() {
	Card c[52], tmp;
	int i, n, j;
	for (i = 0; i < 52; i++) {
		c[i].num = i % 13 + 1;
		c[i].flag = false;
		if (i < 13) {
			c[i].suit = 'S';
		} else if (i < 26) {
			c[i].suit = 'H';
		} else if (i < 39) {
			c[i].suit = 'C';
		} else {
			c[i].suit = 'D';
		}
	}
	cin >> n;
	for (i = 0; i < n; i++) {
		cin >> tmp.suit >> tmp.num;
		for (j = 0; j < 52; j++) {
			if (c[j].suit == tmp.suit && c[j].num == tmp.num)c[j].flag = true;
		}
	}
	for (i = 0; i < 52; i++) {
		if (c[i].flag == false)cout << c[i].suit << " " << c[i].num << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
main = getContents >>= putStrLn . unwords . itp1_9_c . map words . tail . lines

itp1_9_c cs = match 0 0 cs
 where
  match t h [] = [show t, show h]
  match t h ([ct,ch]:xs)
   | ct > ch  = match (t+3) h xs
   | ct == ch = match (t+1) (h+1) xs
   | ct < ch  = match t (h+3) xs

Measured memory_bytes: 4092
#include<bits/stdc++.h>
using namespace std;
const long long INF = (1LL << 32);
const long long MOD = 1000000007;
const long double PI = 3.1415926;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()
typedef long long int ll;
typedef vector<ll> vi;
typedef vector<pair<ll, ll>> vp;
typedef vector<string> vs;
typedef vector<char> vc;
typedef list<ll> lst;
typedef pair<ll, ll> P;

ll n, m, k, ans = 0, sum = 0, cnt = 0;
string s;
char c;

#define Endl endl

/*--------------------template--------------------*/


int main() {
    cin >> n;
    vp v;
    REP(i,n) {
        ll a, b;
        cin >> a >> b;
        v.push_back({a, b});
    }
    sort(RALL(v));
    cout << v[0].first+v[0].second << endl;
    
}

Measured memory_bytes: 2420
from itertools import groupby, islice
N = int(input())
D = []
c=[]
for i in range(0, N):
    D.append(list(map(int, input().split(" "))))
for i in D:
    if i[0]==i[1]:
        c.append(True)
    else:
        c.append(False)
answer = any(sum(1 for _ in islice(g, 3)) == 3 for k, g in groupby(c) if k)
if answer:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 9204
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from itertools import permutations
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 998244353
import operator
class SegmentTree:
    def __init__(self, size, default, f = operator.add):
        self.size = 2**(size-1).bit_length()
        self.default = default
        self.dat = [default]*(self.size*2)
        self.f = f

    def update(self, i, x):
        i += self.size
        self.dat[i] = x
        while i > 0:
            i >>= 1
            self.dat[i] = self.f(self.dat[i*2], self.dat[i*2+1])

    def add(self, i, x):
        i += self.size
        self.dat[i] = self.f(self.dat[i], x)
        while i > 0:
            i >>= 1
            self.dat[i] = self.f(self.dat[i], x)

    def get(self, a, b = None):
        if b is None:
            b = a + 1
        l, r = a + self.size, b + self.size
        lres, rres = self.default, self.default
        while l < r:
            if l & 1:
                lres = self.f(lres, self.dat[l])
                l += 1

            if r & 1:
                r -= 1
                rres = self.f(self.dat[r], rres)
            l >>= 1
            r >>= 1
        res = self.f(lres, rres)
        return res
def solve():
    n = I()
    a = LIR(n)
    a.sort()
    ans = [None]*(n+1)
    s = SegmentTree(n,0,max)
    ans[n] = 1
    X = [i[0] for i in a]
    for i in range(n)[::-1]:
        x,d = a[i]
        k = x+d
        j = bisect.bisect_left(X,k)
        b = s.get(i,j)
        if j < b:
            j = b
        s.update(i,j)
        ans[i] = ans[j]+ans[i+1]
        ans[i] %= mod
    print(ans[0])
    return

#Solve
if __name__ == "__main__":
    solve()


Measured memory_bytes: 108452
#include <bits/stdc++.h>
using namespace std;
#define max 200009
map<long,long>mp;

int main()
{
    long i,j,t,a,b,n,c,temp,m;
    t=1;
    // cin>>t;
    while(t--)
    {
        cin>>n;
        cout<<"ABC"<<n;
        
        
    }
}

Measured memory_bytes: 256
#include<algorithm>
#include<climits>
#include<cmath>
#include<cstdlib>
#include<iomanip>
#include<iostream>
#include<numeric>
#include<string>
using namespace std;

long gcd(long x, long y) { if (x > y) { return gcd(y, x); } long r; while (y != 0) { r = x % y; x = y; y = r; }return x; }
long lcm(long x, long y) { return(x / gcd(x, y)) * y; }
void indexsort(long* first, long* last, long* func) { sort(first, last, [&](long a, long b) {return func[a] < func[b]; }); }
//--------------------

int main() {

	long res = INT_MIN;

	long N; cin >> N;
	long A[100009]; for (int i = 1; i <= N; i++) cin >> A[i];
	
	//両側累積は「一つだけ累積しない」を素早く調べられる
	//↓
	//両側累積GCD

	long Lcus[100009], Rcus[100009]; Lcus[1] = A[1]; Rcus[N] = A[N];

	for (int i = 2; i <= N; i++) Lcus[i] = gcd(Lcus[i - 1], A[i]);
	for (int i = N - 1; i >= 1; i--) Rcus[i] = gcd(Rcus[i + 1], A[i]);
    
    res = max(Lcus[N - 1] , Rcus[2]);
	for (int i = 2; i <= N - 1; i++) res = max(res, gcd(Lcus[i - 1], Rcus[i + 1]));

	cout << res << endl;
}

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

int main() {
  int N;
  int c = 1;
  cin >> N;
  vector<int> a(N);
  for (int i = 0; i < N; i++)
    cin >> a.at(i);
  int b = a.at(0);
  for (int i = 0; i < N; i++) {
    if ( b == 2 ) {
      cout << c << endl;
      break;
    }
    else {
      c++;
      b = a.at(b-1);
      }
    if ( i == N-1 )
      cout << -1 << endl;
  }
}

Measured memory_bytes: 640
import java.util.*;
import java.io.*;
import static java.lang.Math.*;

public class Main {
    public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int n = sc.nextInt();
		int[] x = new int[n];
		int[] y = new int[n];
		for(int i = 0; i < n; i++){
		    x[i] = sc.nextInt();
		    y[i] = sc.nextInt();
		}
		
		// 計算
		long result = 0;
		long[] A = new long[n];
		long[] B = new long[n];
		for(int i = 0; i < n; i++){
		    A[i] = x[i] - y[i];
		    B[i] = x[i] + y[i];
		}
		
		Arrays.sort(A);
		Arrays.sort(B);
		
		result = max(A[n-1] - A[0], B[n-1] - B[0]);
		
		// 出力
		System.out.println(result);
	}
	
	public static class Scanner {
		private BufferedReader br; private StringTokenizer tok;
		public Scanner(InputStream is) throws IOException { br = new BufferedReader(new InputStreamReader(is));}
		private void getLine() throws IOException { while(!hasNext()) tok = new StringTokenizer(br.readLine());}
		private boolean hasNext() { return tok != null && tok.hasMoreTokens();}
		public String next() throws IOException { getLine(); return tok.nextToken();}
		public int nextInt() throws IOException { return Integer.parseInt(next());}
		public long nextLong() throws IOException { return Long.parseLong(next());}
		public double nextDouble() throws IOException { return Double.parseDouble(next());}
	}

}


Measured memory_bytes: 50284
#include<bits/stdc++.h>
//#include<atcoder/all>
using namespace std;
using ll = long long;

int main()
{
	int n,l;
	cin >> n >> l;
	vector<string> s(n);
	for(auto &i:s)cin >> i;
	sort(s.begin(),s.end());
	for(int i = 0;i<n;i++)cout<<s[i];
	cout<<endl;
}


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

int main(){
 int A, B;
  cin >> A >> B;
  int s = A;
  int p = 0;
  while(s <= B){
    int a, b, c, d;
    a = s % 10; 
    b = s/10000;
    c = s / 10 % 10;
    d = s % 10000 /1000;
    
    if(a == b && c == d){
      p++;
    }
    s++;
  }
  cout << p << endl;
}
       
           

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

typedef long long ll;
void solve() {
	ll x;
	scanf("%lld", &x);
	
	ll now = 100, g = 0;
	while(now < x) {
		now = now + now / 100;
		g++;
	}
	
	printf("%lld\n", g);
}
int main()
{
	int T = 1;
//	scanf("%d", &T);
	
	while(T--) {
		solve();
	}
}

Measured memory_bytes: 3828
#include<stdio.h>
int p[200010];
int d[200010]={};
int S[200010];
int Top(int a){
  for(;p[a]-a;a=p[a]);
  return a;
}
int Find(int a,int b){
  int n,r;
  for(r=Top(a);p[a]!=a;a=n){
    n=p[a];
    p[a]=r;
  }
  for(r=Top(b);p[b]!=b;b=n){
    n=p[b];
    p[b]=r;
  }
  return a-b?1:0;
}
void Union(int a,int b){
  if(Find(a,b)){
    a=Top(a);
    b=Top(b);
    d[a]<d[b]?(p[a]=b):(p[b]=a);
    if(d[a]==d[b])d[a]++;
    S[a]=S[b]=S[a]+S[b];
  }
}
int main(){
  int i,n,m,a,b;
  scanf("%d %d",&n,&m);
  for(i=0;i<=n;i++)p[i]=i;
  for(i=0;i<=n;i++)S[i]=1;
  while(m--){
    scanf("%d %d",&a,&b);
    Union(a,b);
  }
  for(i=0;i<n;i++){
    if(m<S[i+1])m=S[i+1];
  }
  printf("%d\n",m);
  return 0;
}


Measured memory_bytes: 4016
from sys import stdin
N, K, Q = [int(_) for _ in stdin.readline().rstrip().split()]
points = [K]*N
A = [int(stdin.readline().rstrip()) for _ in range(Q)]
ansed = [0]*N
for a in A:
    ansed[a-1] += 1
for i, a in enumerate(ansed):
    points[i] -= Q-a
for p in points:
    if p <= 0:
        print('No')
    else:
        print('Yes')

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

using ll = long long;
using ull = unsigned long long;
using namespace std;

int main(){
    int n, m, x; cin >> n >> m >> x;
    int cost[n];
    int price[n][m];
    rep(i,n){
        cin >> cost[i];
        rep(j,m) cin >> price[i][j];
    }

    int ans = 1<<30;
    rep(i, 1<<n){
        vector<int> count(m,0);
        int cost2 = 0;
        rep(j,n){
            if(i & 1<<j){
                rep(k,m) count[k] += price[j][k];
                cost2 += cost[j];
            }
        }
        bool count2 = true;
        rep(j,m) if(count[j] < x) count2 = false;
        if(count2) ans = min(ans, cost2);
    }
    if(ans == 1<<30) cout << -1 << endl;
  else cout << ans << endl;
}

Measured memory_bytes: 3632
#include "bits/stdc++.h"
#pragma GCC optimize("Ofast")

// Begin {{{
using namespace std;

#ifndef DEBUG
#define dump(...)
#endif

template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

template <class T>
inline vector<T> make_v(const T &initvalue, size_t sz) {
    return vector<T>(sz, initvalue);
}

template <class T, class... Args>
inline auto make_v(const T &initvalue, size_t sz, Args... args) {
    return vector<decltype(make_v<T>(initvalue, args...))>(sz, make_v<T>(initvalue, args...));
}

constexpr int INF = 0x3f3f3f3f;
constexpr int64_t LINF = 0x3f3f3f3f3f3f3f3fLL;

constexpr size_t    operator""_sz(unsigned long long value) { return value; };
constexpr intmax_t  operator""_im(unsigned long long value) { return value; };
constexpr uintmax_t operator""_um(unsigned long long value) { return value; };
// }}} End

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

    size_t N; cin >> N;

    size_t n = N;
    size_t sum = 0;
    while (n > 0) {
        sum += n % 10;
        n /= 10;
    }

    cout << (!(N % sum) ? "Yes" : "No") << "\n";

    return 0;
}


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

# define MOD 1000000000+7
# define INF 1000000000
#define rep(i,rept)	for(ll i = 0; i<rept;i++)
typedef long long ll;
using namespace std;

int main() {
	int n = 0, k = 0,  ans = 0,a=0,flag=0,maxy=-2;
    int counter=0,x=0;
	int ar[100003];
	//0に-1
	cin >> a;
	rep(i, 100003) {
		ar[i] = 0;
	}
	rep(i, a) {
		cin >> n;
		ar[n]++;
		ar[n + 1]++;
		ar[n + 2]++;
	}
	rep(i, 100003) {
		maxy = max(maxy, ar[i]);
	}
	cout << maxy << endl;
}


Measured memory_bytes: 640
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <cstring>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <stack>
#include <cmath>
#include <time.h>
#include <unordered_set>
#include <unordered_map>
#define ll long long
#define LINF 0x3f3f3f3f3f3f3f3f
#define INF 0x3f3f3f3f
#define PI 3.14159265
#define RAND (rand()*rand())
#define MAX(x, y) ((x) > (y) ? (x):(y)) 
#define MIN(x, y) ((x) > (y) ? (y):(x))
#define ABS(x) ((x) > 0 ? (x) : -(x))
#define CEIL(x, y) (((x) + (y) - 1)/(y))
using namespace std;
const int MAXN = 1e5 + 5;
const ll MOD = 1e9 + 7;
int N, M, K, Q, T;
int s1, s2;
vector<int> graph[MAXN];
int dp[MAXN][2];

void dfs(int p, int u, int d, int opt) {
	dp[u][opt] = d;
	for (int i = 0; i < graph[u].size(); ++i) {
		int v = graph[u][i];
		if (v == p) continue;
		dfs(u, v, d + 1, opt);
	}
	return;
}

int main()
{
	int i, j, u, v;
	scanf("%d%d%d", &N, &s1, &s2);
	for (i = 1; i <= N - 1; ++i) {
		scanf("%d%d", &u, &v);
		graph[u].push_back(v);
		graph[v].push_back(u);
	}
	dfs(0, s1, 0, 0);
	dfs(0, s2, 0, 1);
	int maxi = 0;
	for (i = 1; i <= N; ++i) {
		if (dp[i][0] >= dp[i][1]) continue;
		maxi = MAX(maxi, dp[i][1] - 1);
	}
	printf("%d", maxi);
	return 0;
}

Measured memory_bytes: 12928
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define rfor(i, a, b) for(int i = a; i < (int)b; i++)
#define all(ary) (ary).begin(), (ary).end()
#define debug(x) cerr << #x << ": " << x << '\n'
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
using namespace std;
using v = vector<int>;
using ll = long long;
template <class T = int> T in(){ T x; cin >> x; return (x);}

int main(int argc, char *argv[]){
    char a, b, res; cin >> a >> b;
    if(a == 'H'){
        if(b == 'H') res = 'H';
        else res = 'D';
    }else{
        if(b == 'D') res = 'H';
        else res = 'D';
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
// 有點不耐煩會破壞偉大的計劃

#include <bits/stdc++.h>

#define append push_back

using namespace std;
using ll = long long;

const int N = 1e5 + 3;
const int M = 1e6 + 7;
const long long MOD = 1e9 + 7;
const long long INF = 1e18 + 9;
const int SM = 1e3 + 5;
const int logN = 22, BL = 400;
const double EPS = 1e-9, PI = acos(-1);
const int dx[] = {1, 0, 0, -1, -1, 1, -1, 1};
const int dy[] = {0, 1, -1, 0, -1, 1, 1, -1};

void debug() {
	cerr << "\n";
}
template<typename Type1, typename... Type2>
void debug(Type1 a, Type2... b) {
    cerr << a << " ";
    debug(b...);
}

long long g(long long n) {
    long long sum = 0;
    if(n & 1) {
        sum = (n + 1) / 2;
        sum *= n;
    }
    else {
        sum = n / 2;
        sum *= (n + 1);
    }
    return sum;
}

long long f(long long n) {
    long long low = 1, high = MOD, m = 1;
    while(low <= high) {
        long long mid = low + (high - low) / 2;
        if(g(mid) <= n) {
            low = mid + 1;
            m = mid;
        }
        else {
            high = mid - 1;
        }
    }
    return m;
}

int main() {
//    freopen(".in", "r", stdin);
//    freopen(".out", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);

    long long n; cin >> n;

    vector<long long> primes;

    for(long long i = 2; i * i <= n; i++) {
        long long cnt = 0;
        while(n % i == 0) {
            cnt++;
            n /= i;
        }
        if(cnt) primes.append(cnt);
    }

    if(n > 1) primes.append(1);

    long long ans = 0;
    for(auto cur : primes) {
        ans += f(cur);
    }

    cout << ans;

    return 0;
}


Measured memory_bytes: 3644
#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;
string char_to_string(char val) {
  return string(1, val);
}
int char_to_int(char val) {
  return val - '0';
}
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() {
  ll A, B, C; cin >> A >> B >> C;

  ll ans = -1;
  ll tmp_a = A;
  ll tmp_b = B;
  ll tmp_c = C;
  if(A == B && A == C && B == C && (A/2) % 2 == 1) {
    ans = -1;
  } else {
    for(int i = 0; i < pow(10,8); ++i) {
      if(tmp_a % 2 == 1 || tmp_b % 2 == 1 || tmp_c % 2 == 1) {
        ans = i;
        break;
      }
      tmp_a = B/2 + C/2; tmp_b = A/2 + C/2; tmp_c = A/2 + B/2;
      A = tmp_a; B = tmp_b; C = tmp_c;
    }
  }

  cout << ans << endl;
}

Measured memory_bytes: 256
def ri(): return int(input())
def rli(): return list(map(int, input().split()))
def rls(): return list(input())
def pli(a): return "".join(list(map(str, a)))


N, K = rli()
D = set(map(int, input().split()))
All = {1,2,3,4,5,6,7,8,9,0}
All.difference_update(D)

ans = N
for i in range(N*10):
    ls = set(map(int, str(ans)))
    ls.difference_update(All)
    if(ls == set()):
        print(ans)
        break
    ans += 1


Measured memory_bytes: 3064
/*Program from Luvwgyx*/
#include<cstdio>
#include<cstring>
#include<algorithm>
#define ll long long
using namespace std;
const ll  inf=1e18;
const int maxn=2e5+10;
const int maxm=1e2+10;
char s[maxn];int n,lst,nxt[maxn],pre[maxn][26];
ll l,r,cutpos,ans[26],cnt[maxm],f[maxm][26];
ll read(){
    ll x=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
void print(ll x){
    if(x<0)putchar('-'),x=-x;
    if(x>9)print(x/10);
    putchar(x%10+'0');
}
void write(ll x){print(x);putchar(' ');}
void get_nxt(){
    nxt[1]=0;
    for(int i=2,j;i<=n;i++){
        j=nxt[i-1];
        while(j&&s[j+1]!=s[i])j=nxt[j];
        nxt[i]=s[j+1]==s[i]?j+1:0;
    }
}
void cal1(ll x,ll v){
    if(x<=0)return ;ll tmp=x/cutpos;
    for(int i=0;i<26;i++)ans[i]+=v*tmp*pre[cutpos][i];
    tmp=x%cutpos;
    for(int i=0;i<26;i++)ans[i]+=v*pre[tmp][i];
}
void get_fib(){
    cnt[1]=n;
    for(int i=1;i<=n;i++){f[1][s[i]-'a']++;f[2][s[i]-'a']++;}
    cnt[2]=n+cutpos;
    for(int i=0;i<26;i++)f[2][i]+=pre[cutpos][i];
    for(int i=3;;i++){
        for(int j=0;j<26;j++)f[i][j]=f[i-2][j]+f[i-1][j];
        cnt[i]=cnt[i-2]+cnt[i-1];if(cnt[i]>inf){lst=i;break;}
    }
}
void cal2(ll x,ll v){
    for(int i=lst;i>=1;i--)
        if(cnt[i]<=x){
            x-=cnt[i];
            for(int j=0;j<26;j++)ans[j]+=v*f[i][j];
        }
    for(int i=0;i<26;i++)ans[i]+=v*pre[x][i];
}
int main(){
    scanf("%s",s+1);l=read();r=read();n=strlen(s+1);n>>=1;
    for(int i=1;i<=n;i++){
        for(int j=0;j<26;j++)pre[i][j]+=pre[i-1][j];
        pre[i][s[i]-'a']++;
    }get_nxt();cutpos=n-nxt[n];//write(cutpos);puts("");
    //if(!n%cutpos){cal1(r,1);cal1(l-1,-1);}
    //else {get_fib();cal2(r,1);cal2(l-1,-1);}
    get_fib();cal2(r,1);cal2(l-1,-1);
    for(int i=0;i<26;i++)write(ans[i]);puts("");
    return 0;
}


Measured memory_bytes: 12928
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            string S = Console.ReadLine();
            int N = S.Length;
            int[] ans = new int[N];

            int st = 0, en;
            bool l = false;
            for (int i = 0; i < N; i++) {
                if (S[i] == 'R') {
                    if (l) {
                        en = i;
                        Count(S, ans, st, en);
                        st = en;
                        l = false;
                    }
                } else {
                    l = true;
                }
            }
            en = N;
            Count(S, ans, st, en);

            for (int i = 0; i < N; i++) {
                if (i > 0) {
                    Console.Write(" ");
                }
                Console.Write(ans[i]);
            }
            Console.WriteLine();
        }

        private static void Count(string S, int[] ans, int st, int en)
        {
            int countR = 0, countL = 0;
            for (int i = st; i < en; i++) {
                if (S[i] == 'R') {
                    countR++;
                } else {
                    countL++;
                }
            }
            int R = countR / 2 + countR % 2 + countL / 2;
            int L = countR / 2 + countL / 2 + countL % 2;
            for (int i = st; i < en; i++) {
                if (S[i] == 'R' && S[i + 1] == 'L') {
                    ans[i] = R;
                    ans[i + 1] = L;
                    i++;
                }
            }
        }
    }
}


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

int main() {
    int N;
    int c = 0;
    cin >> N;
    for(int i = 1; i <= N; i++){
        if(i%2 == 1){
            c += 1; 
        }
    }
    cout << double(1.0*c/N) << endl;
    return 0;
}


Measured memory_bytes: 256
n = int(input())
h = list(map(int, input().split()))

INF = float('inf')
dp = [INF] * (n+10)

dp[0] = 0
for i in range(n):
    if i + 2 <= n-1:
        dp[i + 2] = min(dp[i + 2], dp[i] + abs(h[i + 2] - h[i]))
    if i + 1 <= n-1:
        dp[i + 1] = min(dp[i + 1], dp[i] + abs(h[i + 1] - h[i]))

print(dp[n-1])


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

using namespace std;

int main() {
    int n, q, a, b;
    cin >> n >> q;

    vector<vector<int> > tree(n+1, vector<int>());
    vector<int> counter(n+1, 0);
    for (int i = 1; i < n; i++) {
        cin >> a >> b;
        tree[a].push_back(b);
      	tree[b].push_back(a);
    }

    int p, x;
    for (int i = 0; i < q; i++) { 
        cin >> p >> x;
        counter[p] += x;
    }

    int now;
    queue<int> qu;
    qu.push(1); 
    vector<bool> check(n+1, false);
    while(!qu.empty()) {
        now = qu.front();
        qu.pop();
        check[now] = true;
        for (int next: tree[now]) {
            if (!check[next]) {
                qu.push(next);
                counter[next] += counter[now];
            }
        }
    }

    for (int i = 1; i <= n; i++) {
        cout << counter[i] << " ";
    }
}

Measured memory_bytes: 15604
import scala.math.min

object Main {
    def main(args: Array[String]) {
        var input = io.Source.stdin.getLines().mkString("\n");
        var ss = input.split('\n').toList;
        val xs = line_to_list_of_int(ss(0));
        val x = xs(0);
        val a = xs(1);
        println(if (x < a) "0" else "10");
    }
    def line_to_list_of_int(s: String): Array[Int] = {
        return s.split(' ').map(_.toInt).toArray;
    }
}


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

#define mx 1000005
#define ll long long 
#define mod 998244353

ll ar[mx];
ll ace[mx];
int m,n,k,ii,dek;

ll bigmod(ll e,ll x)
{
    if(!x)return 1;
    ll p=bigmod(e,x/2);
    p=(p*p)%mod;
    if(x%2)p=(p*e)%mod;
    return p;
}

void solve()
{
	scanf("%d",&n);
	int boro=0;
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&m);
		ar[m]++;
		boro=max(boro,m);
	}
	ll re=0;

	for(int i=boro;i>=1;i--)
	{
		ll sumsq=0;
		ll sqsum=0;
		for(int j=i;j<=boro;j+=i)
		{
			sumsq+=ar[j]*j;
			sqsum+=ar[j]*j*j;
			sumsq%=mod;
			sqsum%=mod;
		}
		sumsq*=sumsq;
		sumsq%=mod;
		ll val=(sumsq-sqsum)%mod;
		if(val<0)val+=mod;
		val*=bigmod(2,mod-2);
		val%=mod;
		for(int j=i;j<=boro;j+=i)
		{
			val=(val-ace[j])%mod;
			if(val<0)val+=mod;
		}
		ace[i]=val;
		re+=(val*bigmod(i,mod-2))%mod;
		re%=mod;
		//cout<<val<<endl;

	}
	printf("%lld\n",re);

}

int main()
{
	#ifndef ONLINE_JUDGE
	freopen("in.txt","r",stdin);
	freopen("out.txt","w",stdout);
	#endif
	int t=1;
	//scanf("%d",&t);
	while(t--)
	{
		solve();
	}
	return 0;
}

Measured memory_bytes: 19436
#include <bits/stdc++.h>
#define mp make_pair
#define X first
#define Y second
#define pii pair<ll,ll>
#define x1 dlfjl
#define x2 dkfj
#define x3 dflgkg
#define MOD 1000000007
#define y1 dskgj
#define y2 dskfj
#define y3 dfhgdh
#define SQ 320
#define PI 3.14159265359
typedef int ll;
using namespace std;
ll n,i,j,k,x,y,z,m,q,h,r,timer,mx,l,sum;
ll a[100500], used[100500];
ll dp[2005][2005];

int t[10500];
int N;

void build() {  // build the tree
  for (int i = N - 1; i > 0; --i) t[i] = t[i<<1] + t[i<<1|1];
}

void modify(int p, int value) {  // set value at position p
  for (t[p += N] = value; p > 1; p >>= 1) t[p>>1] = t[p] + t[p^1];
}

int query(int l, int r) {  // sum on interval [l, r)
  int res = 0;
  for (l += N, r += N; l < r; l >>= 1, r >>= 1) {
    if (l&1) res += t[l++];
    if (r&1) res += t[--r];
  }
  return res;
}
int main() {
    //freopen("input.txt","r",stdin);
    cin >> n;
    for (int i = 0; i < 2*n; i++) {
        char c;
        int x;
        cin >> c >> x;
        x--;
        if (c == 'B')
            x += n;
        a[x] = i;
    }
    N = n*2;
    for (int i = 0; i <= n; i++)
        for (int j = 0; j <= n; j++)
            dp[i][j] = MOD;
    dp[0][0] = 0;
    for (int i = 0; i <= n; i++) {
        for (int j = 0; j <= n; j++) {
            if (i > 0) {
                if (j > 0)
                    modify(a[j+n-1], 1);
                dp[i][j] = min(dp[i][j], dp[i-1][j] + a[i-1] - query(0, a[i-1]));
                if (j > 0)
                    modify(a[j+n-1], 0);
            }
            if (j > 0) {
                if (i > 0)
                    modify(a[i-1], 1);
                dp[i][j] = min(dp[i][j], dp[i][j-1] + a[j+n-1] - query(0, a[j+n-1]));
                if (i > 0)
                    modify(a[i-1], 0);
            }
            if (j > 0)
                modify(a[j+n-1], 1);
        }
        if (i > 0)
            modify(a[i-1], 1);
        for (int j = 0; j < n; j++)
            modify(a[j+n], 0);
    }
    /*for (int i = 0; i <= n; i++) {
        for (int j = 0; j <= n; j++)
            cout << dp[i][j] << " " ;
        cout << endl;
    }*/
    cout << dp[n][n] << endl;
    return 0;
}


Measured memory_bytes: 16640
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
using namespace std;
int main(){
    long long n;
    cin >> n;
    long long p=n;
    string ans="No";
    int total=0;
    int len = to_string(n).length(); 
    for(int i=0;i<len;i++){
        total = total + n%10;
        n = n/10;
    }
    if(p%total==0){
        ans="Yes";
    }
    cout << ans << endl;
}

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

int main(){
  char s[4];
  for(int i=0;i<5;++i)cin >> s[i];
  sort(s,s+4);
  bool yes = false;
  if(s[0]==s[1] && s[1]!=s[2] && s[2]==s[3]) yes = true;
  
  if(yes)
    cout << ("Yes");
  else
    cout << ("No");
    
}


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

#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)

void FIO()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}

int n, m;
bool a[1001][1001];

int dp[1001][1001];

int solve(int i, int j)
{
	if (i == n - 1 && j == m - 1)
		return 1;

	if (dp[i][j] != -1)
		return dp[i][j];

	int right = 0, down = 0;

	if (i != n - 1 && a[i + 1][j] != 1)
		down =  solve(i + 1, j);
	if (j != m - 1 && a[i][j + 1] != 1)
		right = solve(i, j + 1);

	return dp[i][j] = (down + right) % mod;
}

int32_t main()
{
	FIO();
	cin >> n >> m;
	for (int i = 0; i < n; ++i)
	{
		string s; cin >> s;
		for (int j = 0; j < m; ++j)
		{
			if (s[j] == '.')
				a[i][j] = 0;
			else
				a[i][j] = 1;
		}
	}

	memset(dp, -1, sizeof(dp));

	cout << solve(0, 0) << '\n';

	return 0;
}

Measured memory_bytes: 12532
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


n = int(input())
if n==3:
    ans = [2,3,25]
elif n==4:
    ans = [2,3,4,9]
else:
    n -= 1
    ans = []
    for i in range(2, 30001):
        if i%2==0 or i%3==0:
            ans.append(i)
        if len(ans)>=(n//4)*4:
            if n%4==1:
                ans.append(i+3)
            elif n%4==2:
                ans.append(i+3)
                ans.append(i+6)
            elif n%4==3:
                ans.append(i+2)
                ans.append(i+3)
                ans.append(i+4)
            break
    s = sum(ans)
    if n==19998:
        ans[-2] = 29996
        ans.append(25)
    else:
        for i in range(30000, 1, -1):
            if i%2==0 or i%3==0:
                if i%6==(6 - s%6)%6 and i not in ans:
                    ans.append(i)
                    break

write(" ".join(map(str,ans)))

Measured memory_bytes: 71436
/* BISMILLAHIR RAHMANIR RAHIM */
#include<bits/stdc++.h>
using namespace std;
#define ll        long long
#define ull       unsigned long long
#define sd(x)     scanf("%lf", &x)
#define l0(i,n)   for(ll i=0; i<n; i++)
#define MAX       100005
#define maxn 	  200005
#define pb 		  push_back
#define mk 		  make_pair
#define endl	  "\n"
#define INF 	  1000000000
#define MOD		  1000000007
#define imie(...) "[" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "


int main()
{
	int n,a,b;
	while(cin >> n >> a >> b)
	{
		n*a>=b? cout << b << endl : cout << n*a << endl;
	}	
}

Measured memory_bytes: 3576
#include<bits/stdc++.h>
using namespace std;
     
     
typedef long long ll;
typedef vector <int> vi;
typedef pair <int,int> pi;
typedef tuple <int,int,int> ti;

#define forn(i,a,n) for(int i = a; i < n ; i++)
#define mem(str,a) memset(str, a, sizeof(str));
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(nullptr)
const int MOD = 1e9+7, N = 1e7 + 10, E = 1e-9;
/*
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
//vector <int> show;
//for (auto x : show)
//   cout << x << " ";
getline(cin,s);


*/

int main() {
    string s;
    cin >> s;
    vector<char> v;
    forn(i,0,s.size()) {
        if(s[i] == '0')
            v.push_back('0');
        else if(s[i] == '1')
            v.push_back('1');
        else if(v.size() > 0)
            v.pop_back();
    }
    for (auto x : v)
       cout << x;
    cout << endl;
    return 0;
}

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

using namespace std;

typedef long long ll;

const int INF = 1000000000;

int main()
{
  int N; scanf("%d", &N);
  vector<int> v(N);
  for (int i = 0; i < N; ++i) {
    scanf("%d", &v[i]);
  }
  sort(v.begin(), v.end());
  int ans = 0, i = 0;
  while (i < N) {
    int val = v[i];
    int pos = distance(v.begin(),
                       find_if_not(v.begin() + i, v.end(),
                                   [val](int elt) -> bool { return val == elt; }));
    ans += (pos - i) % 2;
    i = pos;
  }
  // while (i < N) {
  //   int j = i + 1;
  //   while (v[j] == v[i] and j < N) {
  //     ++j;
  //   }
  //   ans += (j - i) % 2;
  //   i = j;
  // }
  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define MAXN 100100
#define pii pair<int, int>
#define pb push_back
typedef long long ll;

using namespace std;

int n ,X, Y;
string s;
vector<int> x, y;
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
    cin >> s >> X >> Y;
    n = s.size();
    bool b = true;
    int c = 0;
    for(int i = 0; i < n; i++){
    	if(s[i] == 'F') c++;
    	else{
    		if(c == 0){
    			b = !b;
    			continue;
    		}
    		if(b) x.pb(c);
    		else y.pb(c);
    		c = 0;
    		b = !b;
    	}
    }
    if(c > 0){
    	if(b) x.pb(c);
    	else y.pb(c);
    }
    if(s[0] == 'F'){
    	X -= x[0];
    	x.erase(x.begin());
    }
    map<int, bool> m;
    m[0] = true;
    for(int i = 0; i < x.size(); i++){
    	map<int, bool> m1 = m;
    	m.clear();
    	for(auto p : m1){
    		m[p.first + x[i]] = true;
    		m[p.first - x[i]] = true;
    	}
    }
    if(!m[X]){
    	cout << "No";
    	return 0;
    }
    m.clear();
    m[0] = true;
    for(int i = 0; i < y.size(); i++){
    	map<int, bool> m1 = m;
    	m.clear();
    	for(auto p : m1){
    		m[p.first + y[i]] = true;
    		m[p.first - y[i]] = true;
    	}
    }
    if(m[Y]) cout << "Yes";
    else cout << "No";
}

Measured memory_bytes: 640
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
#define check cout<<"?"<<endl;

ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

int find_(int x,vector<int> &v){
    if(v[x]<0) return x;
    v[x]=find_(v[x],v);
    return v[x];
}

int same_(int a,int b,vector<int> &v){
    if(find_(a,v)==find_(b,v)) return 1;
    return 0;
}

void union_(int a,int b,vector<int> &v){
    if(same_(a,b,v)) return;
    int a_p=find_(a,v),b_p=find_(b,v);
    if(a_p>b_p) swap(a_p,b_p);
    v[a_p]+=v[b_p]; v[b_p]=a_p;
}

void print_v(vector<int> v){
    rep(i,v.size()) cout<<v[i]<<" ";
    cout<<endl;
}

int main() {
    int n,m,ans=0; cin>>n>>m;
    map<int,set<int>> h;
    map<int,vector<int>> w;
    vector<int> p(n,0),v(n,-1);
    rep(i,n){
        cin>>p[i]; p[i]--;
    }
    rep(i,m){
        int x,y; cin>>x>>y;
        union_(x-1,y-1,v);
    }
    rep(i,n){
        h[find_(i,v)].insert(i);
        w[find_(i,v)].push_back(p[i]);
    }
    for(auto i : w){
        for(auto j : w[i.first]){
            if(h[i.first].count(j)) ans++;
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 25984
def get_matrix(line):
    matrix = []
    for _ in range(line):
        matrix.append(list(map(int, input().split())))
    return matrix


n, m, l = map(int, input().split())
matrix_a = get_matrix(n)
matrix_b = get_matrix(m)

matrix_c = []
for i in range(n):
    line = []
    for j in range(l):
        tmp = 0
        for k in range(m):
            tmp += matrix_a[i][k] * matrix_b[k][j]
        line.append(tmp)
    matrix_c.append(line)
for i in range(n):
    print(' '.join(list(map(str, matrix_c[i]))))


Measured memory_bytes: 6908
// template version 1.12
using namespace std;
#include <iostream>
#include <bits/stdc++.h>

// varibable settings
#define infile "../test/sample-1.in"
#define int long long //{{{
const int INF=1e18;
const int MOD=1e9+7; //}}}

// define basic macro {{{
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _rrep(i,n) rrepi(i,0,n)
#define rrepi(i,a,b) for(int i=(int)((b)-1);i>=(int)(a);--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define each(i,a) for (auto&& i : a)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define uni(x) sort(all(x));x.erase(unique(all(x)),x.end())
#define ub upper_bound
#define lb lower_bound
#define posl(A, x) (lower_bound(all(A), x)-A.begin())
#define posu(A, x) (upper_bound(all(A),x)-A.begin())
template<class T> inline void chmax(T &a, const T &b) { if((a) < (b)) (a) = (b); }
template<class T> inline void chmin(T &a, const T &b) { if((a) > (b)) (a) = (b); }

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> iii;

template<typename T> using PQ = priority_queue<T, vector<T>, greater<T>>;
struct Fast { Fast(){ std::cin.tie(0); ios::sync_with_stdio(false); } } fast;

#if defined(PCM) || defined(LOCAL)
  #include "lib/dump.hpp"
#else
  #define dump(...) 42
  #define dump_1d(...) 42
  #define dump_2d(...) 42
#endif
//}}}

int solve(){
  int m;cin>>m;
  int d;cin>>d;

  int cnt=0;
  rep(i, 2, m+1){
    rep(j, 2, d+1){
      int d1 = j%10;
      int d2 = j/10;
      if (d1>=2 && d2>=2 && i==d1*d2){
        cnt++;
        dump(i, j, d1, d2);
      }
    }
  }
  cout << cnt << endl;
  return 0;
}

signed main() { //{{{
#ifdef INPUT_FROM_FILE
  std::ifstream in(infile);
  std::cin.rdbuf(in.rdbuf());
#endif
  solve();
  return 0;
} //}}}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll                  long long
#define dl                 double
#define pb                push_back
#define F                  first
#define S                  second
#define endl              "\n"
#define rep(i,a,b)       for(i=a;i<b;i++)
#define all(v)             v.begin(),v.end()
#define allr(v)            v.rbegin(),v.rend()
#define mod              1000000007
#define CIN(V,s,n)      for(int i=s;i<n;i++){cin >> V[i];}
#define COUT(V,s,n)   {for(int i=s;i<n;i++){cout <<  V[i] << " "  ;} cout << endl;}
#define fast               ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define CLEAR(V);      for(ll i=0;i<V.size();i++) V[i] = 0;
#define N                  1000LL
#define tmod            998244353
using namespace std;

bool sBs(const pair<int,int> &a,const pair<int,int> &b)
{   return (a.second < b.second);   }

ll SUMD(ll n);
ll BS(vector<ll> &PS,ll s,ll e,ll ser);
ll MI(ll a, ll m);
bool P[N+1];
void Sieve(int n=N);
ll Powb(ll b,ll n);

int main()
{
fast;
ll q=1,t;
//cin >> q;
while(q--)
{
    ll n,m,k,i,j,l,r,c=0,g,counter=0,u,v,d,e,w,p,x,y,flag=1;
    //n=m=i=j=l=r=a=t=b=c=u=v=w=p=x=y=0;
    cin >> n >> k >> g;
    vector<ll> V(n,k-g);
    p = g;
    while(p--)
    {
        cin >> x;
        V[x-1]++;
    }
    for(i=0;i<n;i++)
    {
        if(V[i]<=0) cout << "No" << endl;
        else
            cout << "Yes" << endl;
    }
}
return 0;
}

//*****************************************************************************************************************************************

ll Powb(ll b,ll n)
{
    if(n==0) return 1LL;
    if(n==1) return b;
    ll temp = Powb(b,n/2);
    if(n%2==0){return (temp*temp)%mod;}
    else{return (b*((temp*temp)%mod))%mod;}
}

ll SUMD(ll n)
{   ll sum=0;
    while(n>0){sum += n%10;n = n/10;}
    return sum;

}
ll BS(vector<ll> &PS,ll s,ll e,ll ser)
{
    if(s>e)
        return s;
    ll mid = (s+e)/2;
    if(PS[mid]==ser)
    {
        return mid;
    }
    else if(PS[mid] > ser)
    {
        return BS(PS,s,mid-1,ser);
    }
    else
        return BS(PS,mid+1,e,ser);
}
ll MI(ll a, ll m)
{
    ll m0 = m;
    ll y = 0, x = 1;
    if (m == 1)
      return 0;
    while (a > 1)
    {
        ll q = a / m;
        ll t = m;
        m = a % m, a = t;
        t = y;
        y = x - q * y;
        x = t;
    }
    if (x < 0)
       x += m0;
    return x;
}

void Sieve(int n)
{
    memset(P,true,sizeof(P));
    P[0] = false;
    P[1]= false;
    for(ll i=2;i*i<=n;i++)
    {
        if(P[i])
        {
            for(ll j=i*i;j<=n;j+=i)
            {
                P[j]=false;
            }
        }
    }

}


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

int main() {
  int n,k; cin>>n>>k;
  vector<ll> A(n);
  rep(i, n) cin>>A[i];
  ll res=1e12;

  rep(bit, (1<<n)) {
     int tmp=0;
     rep(i, n) {
       if (bit&(1<<i)) tmp++;
     }
     if (tmp!=k) continue;
     ll sum=0;
     ll minH=A[0];
     for (int i=1; i<n; i++) {
       minH=max(minH, A[i-1]);
       if (bit&(1<<i)) {
         if (minH>=A[i]) {
           sum+=minH-A[i]+1;
           minH++;
         }
       }
     }
     res=min(res, sum);
  }
  cout<<res<<endl;
}


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

int main() {
	int A, B;
	cin >> A >> B;
	string a;
	cin >> a;
	bool flag = 1;
	for (int i = 0; i < A; i++) {
		if (a[i] == '-') {
			flag = 0;
			break;
		}
	}
	if (a[A] != '-') {
		flag = 0;
	}
	for (int i = A + 1; i <= A+B; i++) {
		if (a[i] == '-') {
			flag = 0;
		}
	}
	if (flag) { cout << "Yes" << endl; }
	else { cout << "No" << endl; }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define DEBUG(x) cerr << #x << ": " << (x) << endl;

int main() {
  int n;
  cin >> n;
  printf("%f\n", acos(-1) * n * 2); 
}

Measured memory_bytes: 3724
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;

const long long MOD = 1e9 + 7;


//a^-1 mod を計算する
ll modinv(ll a){
    //a^-1を求める
    //a^-1 = a^(mod-2)

    ll ret = 1;
    for(int i = 0; i < 40; i++){
        if((MOD - 2) & (1LL << i)){
            ret = ret * a % MOD;
        }
        a = a * a % MOD;
    }

    return ret;
}

int main(){
    int N;
    cin >> N;
    ll x[N];
    for(int i = 0; i < N; i++) cin >> x[i];

    ll sum[N]; // 1/1 + 1/2 +  ... + 1/i;
    sum[0] = 1;
    for(ll i = 1; i < N; i++){
        sum[i] = sum[i - 1] + modinv(i + 1);
        //printf("i = %d, modinv = %d\n", i, modinv(i));
        //printf("%d * modinv(%d) = %d\n", i, i, i * modinv(i) % MOD);
        sum[i] %= MOD;
    }

    //cout << modinv(4) << endl;

    ll ans = 0;
    for(int j = 0; j < N - 1; j++){
        ll res = (x[j + 1] - x[j]) * sum[j];
        res %= MOD;
        ans += res;
        ans %= MOD;
    }

    for(ll i = 1; i < N; i++){
        ans *= i;
        ans %= MOD;
    }

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


Measured memory_bytes: 1792