akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#define NIL -1
int parent[100001],cleft[100001],right[100001];
int depth(int i){
    int d=0;
    while(parent[i]!=NIL){
        d++;
        i=parent[i];
    }
    return d;
}
void printchildren(int i){
    int c=cleft[i];
    while(c!=NIL && right[c]!=NIL){
        printf("%d, ",c);
        c=right[c];
    }
    if(cleft[i]!=NIL)printf("%d",c);
}

int main(){
    int n;scanf("%d",&n);
    int i;
    for(i=0;i<=n-1;i++)parent[i]=cleft[i]=right[i]=NIL;
    for(i=0;i<=n-1;i++){
        int id,k;
        scanf("%d %d",&id,&k);
        int c[k+1],j;
        for(j=1;j<=k;j++)scanf("%d",&c[j]);
        if(k>=1){
            parent[c[1]]=id;
            cleft[id]=c[1];
        }
        for(j=2;j<=k;j++){
            parent[c[j]]=id;
            right[c[j-1]]=c[j];
        }
    }
    
    
    for(i=0;i<=n-1;i++){
        printf("node %d: parent = %d, depth = %d, ",i,parent[i],depth(i));
        if(parent[i]==NIL) printf("root, [");
        else if(cleft[i]==NIL) printf("leaf, [");
        else printf("internal node, [");
        printchildren(i);
        printf("]\n");
        
    }
    
    return 0;
}


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

int main(){
    const int INF = 1000000;
    int dp[100010];
    for (int i=0; i<100010; i++) dp[i] = INF;
    int pos[12] = {1, 6, 36, 216, 1296, 7776, 46656,
    9, 81, 729, 6561, 59049};

    for (int i=0; i<=100000; i++){
        for (int j=0; j<12; j++){
            if (i==pos[j]) dp[i] = 1;
            if (i-pos[j] < 1) continue;
            dp[i] = min(dp[i], (dp[i-pos[j]]+1));
        }
    }

    int N;
    cin >> N;
    cout << dp[N] << endl;
}

Measured memory_bytes: 640
INF = 1<<60
def resolve():
    def judge(j):
        for i in range(group):
            cnt_Wchoco[i] += div_G[i][j]
            if cnt_Wchoco[i] > K:
                return False
        return True

    H, W, K = map(int, input().split())
    G = [list(map(int, input())) for _ in range(H)]

    ans = INF
    for bit in range(1<<(H-1)):
        group = 0 # 分かれたブロック数
        row = [0]*H
        for i in range(H):
            # 分割ライン
            row[i] = group
            if bit>>i & 1:
                group += 1
        group += 1 # 1つ折ったら2つに分かれるのでプラス1, 折らなかったら1つ

        # 分割したブロックを列方向で見る
        div_G = [[0] * W for _ in range(group)]
        for i in range(H):
            for j in range(W):
                div_G[row[i]][j] += G[i][j]

        num = group-1
        cnt_Wchoco = [0]*group
        for j in range(W):
            if not judge(j):
                num += 1
                cnt_Wchoco = [0] * group
                if not judge(j):
                    num = INF
                    break
        ans = min(ans, num)

    print(ans)

if __name__ == "__main__":
    resolve()


Measured memory_bytes: 9396
n = gets.chomp.to_i
a = gets.chomp.split.map(&:to_i)
b = []
n.downto(1) do |i|
  s = 0
  2.upto(n) do |j|
    if i * j > n then
      break
    end
    s += b[i * j - 1] 
  end
  b[i-1] = (a[i-1] + s) % 2
end
# p b
#q = b.sum
q = b.reduce {|sum,n| sum + n}
if q > 0 then
  r = ''
  1.upto(n) do |i|
    if b[i-1] > 0 then
      r << i.to_s << ' '
    end
  end
  puts q
  puts r.chop
else
  puts q 
end

Measured memory_bytes: 22284
#include <string>
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <vector>
#include <cmath>
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;

int main()
{
    string str;
    cin >> str;
    if(str[0] == '7' || str[1] == '7' || str[2] == '7'){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

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

const int MAXP = 70004;

bool isP[MAXP];
vector<int> Pv;

int init() {
  fill(isP, isP+MAXP, true);
  isP[0] = isP[1] = false;
  for(int i = 2; i < MAXP; ++i) {
    if(!isP[i]) continue;
    Pv.push_back(i);
    for(int j = i*2; j < MAXP; j += i) isP[j] = false;
  }
  return Pv.size();
}

int main() {
  int n;
  init();
  while(cin >> n) {
    int q = upper_bound(Pv.begin(), Pv.end(), n) - Pv.begin();
    int p = q-1;
    if(Pv[p] == n) --p;
    cout << Pv[p] << " " << Pv[q] << endl;
  }
  return 0;
}

Measured memory_bytes: 1344
#include<cstdio>
#include<algorithm>
using namespace std;
char str[10];
int ans,tmp;
int main()
{
	scanf("%s",str);
	for(int i=0;i<3;++i)
	{
		if(str[i]=='R')	++tmp;
		else tmp=0;
		ans=max(ans,tmp);
	}
	printf("%d\n",ans);
}

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

namespace contest_Csharp
{
    class Program
    {
        static void Main(string[] args)
        {
            int  N=int.Parse( Console.ReadLine());
            //var prop = Console.ReadLine().Split(' ')
            //  .Select(x => int.Parse(x)).ToList();
            long sum = 0;
            for (int i = 0; i < N; i++)
            {
                if (!( (i + 1) % 3 == 0 || (i + 1) % 5 == 0))
                {
                    sum += i + 1;
                }
            }
            Console.WriteLine(sum);



        }
    }
}


Measured memory_bytes: 17652
#include <iostream>
#include <vector>
#include <algorithm>
#define rep(i, a, n) for(int i = a; i < n; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main()
{
    ll n;
    cin >> n;
    ll ans = 0;
    ans += (n / 500) * 1000;
    ll k = 0;
    k = n % 500;
    ans += k/5 * 5;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
import sys
import heapq
import math
import fractions
import bisect
import itertools
from collections import Counter
from collections import deque
from operator import itemgetter
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

n=int(input())
s=input()
l=[0]*1000
for _ in range(n):
    i=s[_]
    for j in range(1000):
        k=str(j).zfill(3)
        if k[0]==i:
            if l[j]==2:
                l[j]=3
        if k[1]==i:
            if l[j]==1:
                l[j]=2
        if k[2]==i:
            if l[j]==0:
                l[j]=1
ans=0
for i in l:
    if i==3:
        ans+=1
print(ans)

Measured memory_bytes: 79708
#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define rep(i,n) for (int i=0;i<(int)(n);i++)
#define codefor int test;scanf("%d",&test);while(test--)
#define INT(...) int __VA_ARGS__;in(__VA_ARGS__)
#define LL(...) ll __VA_ARGS__;in(__VA_ARGS__)
#define yn(ans) if(ans)printf("Yes\n");else printf("No\n")
#define YN(ans) if(ans)printf("YES\n");else printf("NO\n")
#define vector2d(type,name,h,...) vector<vector<type>>name(h,vector<type>(__VA_ARGS__))
#define umap unordered_map
#define uset unordered_set
using namespace std;
using ll = long long;
const int MOD=1000000007;
//入力系
void scan(int& a){scanf("%d",&a);}
void scan(long long& a){scanf("%lld",&a);}
template<class T> void scan(T& a){cin>>a;}
template<class T> void scan(vector<T>& vec){for(auto&& it:vec)scan(it);}
void in(){}
template <class Head, class... Tail> void in(Head& head, Tail&... tail){scan(head);in(tail...);}
//出力系
void print(const int& a){printf("%d",a);}
void print(const long long& a){printf("%lld",a);}
void print(const double& a){printf("%.15lf",a);}
template<class T> void print(const T& a){cout<<a;}
template<class T> void print(const vector<T>& vec){if(vec.empty())return;print(vec[0]);for(auto it=vec.begin();++it!= vec.end();){putchar(' ');print(*it);}}
void out(){putchar('\n');}
template<class T> void out(const T& t){print(t);putchar('\n');}
template <class Head, class... Tail> void out(const Head& head,const Tail&... tail){print(head);putchar(' ');out(tail...);}
//デバッグ系
template<class T> void dprint(const T& a){cerr<<a;}
template<class T> void dprint(const vector<T>& vec){if(vec.empty())return;cerr<<vec[0];for(auto it=vec.begin();++it!= vec.end();){cerr<<" "<<*it;}}
void debug(){cerr<<endl;}
template<class T> void debug(const T& t){dprint(t);cerr<<endl;}
template <class Head, class... Tail> void debug(const Head& head, const Tail&... tail){dprint(head);cerr<<" ";debug(tail...);}

int main(){
    INT(n,m);
    int x,y;
    vector<vector<int>> graph(n);
    rep(i,m){
        in(x,y);
        graph[x].push_back(y);
        graph[y].push_back(x); 
    }
    vector<int> color(n,-1);
    int id=0,a;
    rep(i,n){
        if(color[i]==-1){
            id++;
            queue<int> next;
            next.push(i);
            color[i]=id;
            while(!next.empty()){
                a=next.front();
                next.pop();
                rep(j,graph[a].size()){
                    if(color[graph[a][j]]==-1){
                        color[graph[a][j]]=id;
                        next.push(graph[a][j]);
                    }
                }
            }
        }
    }
    codefor{
        in(x,y);
        if(color[x]==color[y])printf("yes\n");
        else printf("no\n");
    }
}


Measured memory_bytes: 8660
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define P pair<int,int>
using ll=int64_t;
using namespace std;
#define ketasuu(n) fixed<<setprecision(n)
#define btoe(p) p.begin(),p.end()
#define etob(p) p.rbegin(),p.rend()




int main(){
    string s; cin>>s;
    int l=s.length();
    int ans=0;
    for(int i=1; i*2<l; ++i){
        string t=s.substr(0,i), u=s.substr(i,i);
        if(t==u) ans=i;
    }
    cout<<ans*2<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    int n;
    cin>>n;
    string s[n];
    int a,w,t,r;
    a=w=t=r=0;
    for(int i=0;i<n;i++){
        cin>>s[i];
        if(s[i]=="AC")
           a++;
        else if(s[i]=="WA")
            w++;
        else if(s[i]=="TLE")
            t++;
        else if(s[i]=="RE")
            r++;
    }

    cout << "AC x " <<a<<"\n";
    cout << "WA x " <<w<<"\n";
    cout << "TLE x " <<t<<"\n";
    cout << "RE x " <<r<<"\n";
    return 0;
}


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

void solve(long long H, long long W, long long h, long long w)
{
    cout << (H * W - (W * h + H * w - (h * w))) << endl;
}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main()
{
    long long H;
    scanf("%lld", &H);
    long long W;
    scanf("%lld", &W);
    long long h;
    scanf("%lld", &h);
    long long w;
    scanf("%lld", &w);
    solve(H, W, h, w);
    return 0;
}


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

const int N = 300010;
const int INF = 1e9;

int w, h, n;
pair<int, int> ps[N];

int ans;

struct Node {
    Node* l;
    Node* r;
    int sz;
    int mx, ad;

    Node(int _sz) : sz(_sz) {
        mx = ad = 0;
        if (sz > 1) {
            l = new Node(sz / 2);
            r = new Node(sz - sz / 2);
        }
    }

    void add(int a, int b, int d) {
        if (b <= 0 || sz <= a) {
            return;
        }
        if (a <= 0 && sz <= b) {
            mx += d;
            ad += d;
            return;
        }
        l->add(a, b, d);
        r->add(a - sz / 2, b - sz / 2, d);
        mx = ad + max(l->mx, r->mx);
    }
};


void trans() {
    for (int i = 0; i < n; i++) {
        swap(ps[i].first, ps[i].second);
    }
    swap(w, h);
}

void solve() {
    sort(ps, ps + n);

    vector<int> l = {0}, r = {0};

    Node* tr = new Node(n);

    for (int i = 0; i < n; i++) {
        ans = max(ans, ps[i].first + tr->mx);

        int y = ps[i].second;
        if (y <= h / 2) {
            tr->add(l.back(), i, -y);
            while (l.size() > 1 && ps[l.back()].second < y) {
                tr->add(l.end()[-2], l.end()[-1], ps[l.back()].second - y);
                l.pop_back();
            }
            l.push_back(i);
        } else {
            tr->add(r.back(), i, y - h);
            while (r.size() > 1 && ps[r.back()].second > y) {
                tr->add(r.end()[-2], r.end()[-1], y - ps[r.back()].second);
                r.pop_back();
            }
            r.push_back(i);
        }

        tr->add(i, i + 1, h - ps[i].first);
    }
}

int main() {
    scanf("%d %d %d", &w, &h, &n);
    for (int i = 0; i < n; i++) {
        int x, y;
        scanf("%d %d", &x, &y);
        ps[i] = make_pair(x, y);
    }
    ps[n] = make_pair(0, 0);
    ps[n + 1] = make_pair(w, h);
    n += 2;

    solve();
    trans();
    solve();

    printf("%d\n", 2 * ans);
}


Measured memory_bytes: 60100
def resolve():
    # 整数 1 つ
    # n = int(input())
    # 整数複数個
    n, x = list(map(int, input().split()))
    # 整数 N 個 (改行区切り)
    # N = [int(input()) for i in range(N)]
    # 整数 N 個 (スペース区切り)
    A = list(map(int, input().split()))
    # 整数 (縦 H 横 W の行列)
    # A = [list(map(int, input().split())) for i in range(H)]

    cnt = 0
    Asort = sorted(A)
    for i in range(n):
        if x >= Asort[i]:
            x -= Asort[i]
            cnt += 1
            if i == n-1 and x > 0:
                cnt -= 1
        else:
            break

    print(cnt)
resolve()

Measured memory_bytes: 38384
#include <stdio.h>

int main() {
  int f, m, r;
  
  while (1){
    scanf("%d%d%d", &m, &f, &r);

    if ( m==-1 && f==-1 && r==-1) break;
    
    if ( f==-1 || m==-1 ) printf("F\n");
    else if ( f+m >= 80 ) printf("A\n");
    else if ( f+m >= 65 ) printf("B\n");
    else if ( f+m >= 50 ) printf("C\n");
    else if ( f+m >= 30 ) {
      if ( r >= 50 ) printf("C\n");
      else printf("D\n");
    }
    else printf("F\n");
  }
  
  return 0;
}


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

using namespace std;


int main(){
	int n , m ,c;
	
	cin>>n>>m>>c;
	vector<int> b(m);
	int count = 0;
	for(int i = 0; i< m; i++){
		cin>>b[i];
		}
	for(int i = 0; i<n ;i++){
		int dummy = c;
		for(int j = 0; j<m; j++){
			int a;
			cin>>a;
			dummy +=a*b[j];
			
			}
			if(dummy>0) count++;
		}
	cout<<count;
	return 0;
	}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
typedef long long l;
typedef int i;
#define r return
vector<l> a;
i n;
bool s(l k){
    i o=0;
    while(k>0){
        i p=k%10;
        if(p==3) o|=1;
        if(p==5) o|=2;
        if(p==7) o|=4;
        k/=10;
    }
    r o==7;
}
void d(l k){
    if(k>n) r;
    else{
        if(s(k)){
            a.push_back(k);
        }
        d(10*k+3);
        d(10*k+5);
        d(10*k+7);
    }
}
i main(){
    cin>>n;
    d(0);
    cout<<a.size()<<endl;
    r 0;
}

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

const int MOD = 1000000007;

vector<pair<long long, long long> > prime_factorize(long long n) {
    vector<pair<long long, long long> > res;
    for (long long p = 2; p * p <= n; ++p) {
        if (n % p != 0) continue;
        int num = 0;
        while (n % p == 0) { ++num; n /= p; }
        res.push_back(make_pair(p, num));
    }
    if (n != 1) res.push_back(make_pair(n, 1));
    return res;
}

vector<long long> calc_divisor(long long n) {
    vector<long long> res;
    for (long long i = 1LL; i*i <= n; ++i) {
        if (n % i == 0) {
            res.push_back(i);
            long long j = n / i;
            if (j != i) res.push_back(j);
        }
    }
    sort(res.begin(), res.end());
    return res;
}

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

int main() {
    long long N, K;
    cin >> N >> K;
    
    vector<long long> div = calc_divisor(N);
    long long res = 0;
    for (auto d : div) {
        long long tmp = 0;
        vector<long long> div2 = calc_divisor(d);
        for (auto e : div2) {
            auto pf = prime_factorize(d/e);
            bool ok = true;
            for (auto p : pf) {
                if (p.second > 1) ok = false;
            }
            if (!ok) continue;
            int mebius = (pf.size() & 1 ? -1 : 1);
            long long pow = modpow(K, (e+1)/2, MOD);
            tmp += pow * mebius;
            tmp = (tmp % MOD + MOD) % MOD;
        }
        res += tmp * (d % 2 == 0 ? d/2 : d) % MOD;
        res = res % MOD;
        
        //cout << d << ": " << tmp << endl;
    }
    cout << res << endl;
}







Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int n = in.nextInt();
        int a = in.nextInt();
        int b = in.nextInt();
        System.out.println(Math.min(n*a,b));
    }
}


Measured memory_bytes: 23892
#include <cstdio>

int main(){
	int t,a=0,b=0;
	for(int i=0;i<4;i++)scanf("%d",&t),a+=t;
	for(int i=0;i<4;i++)scanf("%d",&t),b+=t;
	if(a>=b)printf("%d\n",a);
	else printf("%d\n",b);
	return 0;
}

Measured memory_bytes: 2740
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) FOR(i,0,b)
#define INF 1e9+10
#define dump(x) cerr<<#x<<"="<<x<<endl
#define all(a) (a).begin(),(a).end()
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<vii> viii;
typedef pair<int,int> P;
template <class T> void chmin(T & a, T const & b) { if (b < a) a = b; }
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
using ll = long long;
const ll mod = LLONG_MAX;

vector<int> a(112345);
int main(){
  int n;
  cin>>n;
  rep(i,n){
    cin>>a[i];
  }
  sort(all(a));
  reverse(all(a));


  int x=-1;
  double diff=INF;
  for(int i=1;i<n;i++){
    double t = abs((a[0]*1./2*1.)-a[i]);
  //  dump(t);
    if(t<diff){
      diff=t;
      x=i;
    }
  }
  cout<<a[0]<<" "<<a[x]<<endl;


}


Measured memory_bytes: 768
#include<bits/stdc++.h>
typedef long long int ll;
using namespace std;
const int mxN = 2e5 + 5;
unordered_set<int> s[mxN];
bool visited[mxN] = {0};
int sz = 0, mx = 0;


void dfs(int x)
{
	for(int y :s[x])
	{
		if(visited[y]) continue;
		visited[y] = true;
		sz++;
		dfs(y);
	}
	mx = max(sz, mx);
}

void solve()
{
	int n, m;
	cin >> n >> m;
	
	if(m == 0)
	{
		cout << "1\n";
		return ;
	}
	
	for(int i = 0; i<m; i++)
	{
		int a, b;
		cin >> a >> b;
		a--; b--;
		s[a].insert(b);
		s[b].insert(a);
	}
	
	for(int i = 0; i<n; i++)
	{
		dfs(i);
		sz = 0;
	}
	
	cout << mx << "\n";
	
}

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



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

void dump(vector<int> v) {
    string res = "@[";
    for (auto i : v) {
        res += to_string(i);
        res += ", ";
    }
    res += "]";
    cout << res << endl;
}

void solve() {
    int n,m; cin >> n >> m;
    vector<int> a(n);
    rep(i,n) {
        cin >> a[i];
        a[i] = a[i] % m;
    }
    map<int,int> ma;
    vector<int> acm(n+1);
    acm[0] = 0;
    rep(i,n) {
        acm[i+1] = acm[i] + a[i];
        acm[i+1] = acm[i+1] % m;
        ma[acm[i+1]] ++;
    }
    lint ans = 0;
    rep(i,n) {
        int t = acm[i] % m;
        ans += ma[t];
        ma[acm[i+1]] --;
        
    }
    //for (int i=1; i<n; i++) {
    //    if (a[i] == 0) ans ++;
    //}
    cout << ans << endl;

    // True
    /*
    lint anst = 0;
    for (int l=0; l<=n; l++) {
        for (int r=l+1; r<=n; r++) {
            if ((acm[r] - acm[l]) % m == 0) anst ++;
        }
    }
    cout << anst << endl;
    if (anst != ans) {
        cout << "false" << endl;
        cout << "n " << n << " m " << m << endl;
        dump(a);
    }
    */

}

int main() {
    solve();
}

Measured memory_bytes: 6904
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
typedef long long ll;
typedef pair<int,int> pint;

int p[26],q[26];
int main(){
    string s,t;
    cin>>s>>t;
    int n=s.size();
    memset(p,-1,sizeof(p));
    memset(q,-1,sizeof(q));
    rep(i,n){
        int si=s[i]-'a',ti=t[i]-'a';
        if(p[si]!=-1&&p[si]!=ti||q[ti]!=-1&&q[ti]!=si){
            cout<<"No"<<endl;
            return 0;
        }
        p[si]=ti,q[ti]=si;
    }
    cout<<"Yes"<<endl;
    return 0;
}

Measured memory_bytes: 776
#include<cstdio>

#define N 51

int n,m,ans,now,mp[N][N],vis[N];

int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=m;i++)
	{
		int a,b;
		scanf("%d%d",&a,&b);
		vis[a]++;
		vis[b]++;
		mp[a][b]=mp[b][a]=1;
	}
	bool flag;
	while(1)
	{
		flag=true;
		for(int i=1;i<=n;i++)
		{
			if(vis[i]==1)
			{
				ans++;
				now=i;
				flag=false;
				vis[i]--;
				break;
			}
		}
		if(flag) break;
		for(int i=1;i<=n;i++) if(mp[now][i]==1) vis[i]--;
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main(void)
{
   string t;
   cin>>t;
      for(long long int i=0;i<t.size();i++)
      {
         if(t[i]!='?')
            cout<<t[i];
         else
            cout<<'D';
      }
   return 0;
}


Measured memory_bytes: 3724
#include<bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef vector<pair<ll, ll>> pll;
 
#define mod 1000000007
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define popcount(x) __builtin_popcountll(x)
 
const long double PI = acos(-1);
 
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;}
ll stringcount(string s, char c){return count(s.cbegin(), s.cend(), c);}
bool isInteger(double x){return floor(x) == x;}
 
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
 
  ll n;
  cin >> n;
  vector<ll> a(n), b(n);
  map<ll, ll> mp;
  for(ll i = 0; i < n; i++){
    cin >> a[i];
    b[i] = a[i];
    mp[a[i]]++;
  }

  sort(all(b));
  b.erase(unique(all(b)), b.end());
  vector<ll> cnt(200005);
  vector<ll> deccnt(200005);
  ll sum = 0;
  for(ll i = 0; i < b.size(); i++){
    cnt[b[i]] = (mp[b[i]]) * (mp[b[i]]-1)/2;
    deccnt[b[i]] = (mp[b[i]]-1) * (mp[b[i]]-2)/2;
    sum += cnt[b[i]];
  }
  
  for(ll i = 0; i < n; i++){
    ll ans = sum;
    ll dec = cnt[a[i]] - deccnt[a[i]];
    //cout << ans << " " << dec << endl;
    cout << ans - dec << endl;
  }

  return 0;
}

Measured memory_bytes: 17024
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define repr(i,x,n) for(int i=x; i<(n); i++)
#define ALL(x) (x).begin(),(x).end()
#define INF 1e9
typedef long long ll;
using VI = vector<int>;
using VS = vector<string>;
using graph = vector<vector<int>>;
int main()
{
string a;
cin>>a;
if (a=="ABC")
{
    cout<<"ARC"<<endl;
}
else
{
    cout<<"ABC"<<endl;
}

    return 0;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;

#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define range(i,a,n) for(int i=(a);i<(n);i++)

#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI 3.1415926535897932384

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

template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S acm(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
void YN(bool b){cout<<(b?"YES":"NO")<<"\n";}
void Yn(bool b){cout<<(b?"Yes":"No")<<"\n";}
void yn(bool b){cout<<(b?"yes":"no")<<"\n";}

ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s;a=0;} return os;}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin>>n;
	priority_queue<double> q;
	rep(i,n){
		double in;
		cin>>in;
		q.push(-in);
	}
	while(q.size()!=1){
		double a,b;
		a=q.top();q.pop();
		b=q.top();q.pop();
		q.push((a+b)/2);
	}
	cout<<-q.top()<<endl;


}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define rrep(i,a) for(int i=(int)a-1;i>=0;--i)
#define REP(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define RREP(i,a,b) for(int i=(int)a-1;i>=b;--i)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using ll=long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;
 
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;
}


ll gcd(ll n, ll m) {
    ll tmp;
    while (m!=0) {
        tmp = n % m;
        n = m;
        m = tmp;
    }
    return n;
}
 
ll lcm(ll n, ll m) {
    return abs(n) / gcd(n, m)*abs(m);//gl=xy
}

using namespace std;

#define int ll

ll dp[65][200005];//dp[i][j]:j番目の要素に対して2^i回操作を適用したときの値
void solve()
{
	ll n,k;
	cin >> n >> k;
	vector<ll> a(n);
	rep(i, n) cin >> a[i], a[i]--;
	memset(dp,0, sizeof(dp));
	rep(i,n){
		dp[0][i] = a[i];
	}
	rep(i,60)
	{
		rep(j,n){
			if((1LL<<(i+1))>k){
				dp[i + 1][j] = -1;
			}
			else{
				dp[i + 1][j] = dp[i][dp[i][j]];
			}
		}
	}
	int s = 0;
	for (int i = 60; i >= 0; --i)
	{
		if(k&(1LL<<i)){
			s = dp[i][s];
		}
	}
	cout << s + 1;
}
#undef int

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(15);
    solve();
    return 0;
}

Measured memory_bytes: 106424
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimization_level 3
using ll = long long;
constexpr ll INF = 1'010'000'000'000'000'017LL;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()

int main(){
	ll n,k,q;

	cin>>n>>k>>q;
	vector<ll> a(q);
	vector<ll> v(n,k-q);

	rep(i,q){
		cin>>a.at(i);
	}

	rep(i,q){
		v.at(a.at(i)-1)++;
	}

	rep(i,n){
		if (v.at(i)>0)
		{
			cout<<"Yes"<<endl;
		} else
		{
			cout<<"No"<<endl;
		}
		
		
	}
}


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

int main() {
    int n;
    cin >> n;
    string digits(n, '0');
    for(int i=0; i<n; ++i) {
        cin >> digits[i];
    }
    int ret = [&digits]() {
        for(int i=0; ; ++i) {
            if(digits.find(to_string(i)) == string::npos) {
                return i;
            }
        }
    }();
    cout << ret << endl;
}


Measured memory_bytes: 3292
#include<iostream>
const int N=100001;
using namespace std;
int main(){
    int n,x[N],y[N],t[N];
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>t[i]>>x[i]>>y[i];
    }
    for(int i=1;i<=n;i++)
        if(x[i]+y[i]>t[i]||(t[i]-x[i]-y[i])%2!=0){
        cout<<"No";
            return 0;   
            }
            cout<<"Yes";
            return 0;
}

Measured memory_bytes: 1408
#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> ipair;
typedef tuple<int, int, int> ituple;

const ll INF = LLONG_MAX;
// const int MOD = (int)1e9 + 7;
// const double EPS = 1e-10;
#define PI acosl(-1)
#define MAX_N 100 + 2

/**
 * ????°??????¨???
 */
class MinCostFlow{
  struct edge{
    int to, cap, cost, rev;
  };
  
protected:
  static const int MAX_V = 1000 + 5;
  int V; // ????????°
  vector<edge> G[MAX_V]; // ??°???????????£??\???????????¨???
  ll dist[MAX_V]; // ???????????¢
  int prevV[MAX_V], prevE[MAX_V]; // ??´??????????????¨???
  
public:
  MinCostFlow(){}
  MinCostFlow(int v){
    assert(v <= MAX_V);
    V = v;
  }
  void addEdge(int from, int to, int cap, int cost){
    G[from].push_back((edge){to, cap, cost, (int)G[to].size()});
    G[to].push_back((edge){from, 0, -cost, (int)G[from].size() - 1});
  }
  
  // s??????t??????????°??????¨???????±???????
  int exec(int s, int t, int f){
    int res = 0;
    
    while (f > 0){
      // ???????????????????????????????????????s-t??????????????????????±???????
      fill(dist, dist + V, INF);
      dist[s] = 0;
      bool update = true;
      while(update){
        update = false;
        for (int v = 0; v < V; v++){
          if (dist[v] == INF){
            continue;
          }
          
          for (int i = 0; i < G[v].size(); i++){
            edge &e = G[v][i];
            if (e.cap > 0 && dist[e.to] > dist[v] + e.cost){
              dist[e.to] = dist[v] + e.cost;
              prevV[e.to] = v;
              prevE[e.to] = i;
              update = true;
            }
          }
          
        }
      }
      
      if (dist[t] == INF){
        // ????????\???????????????
        return -1;
      }
      
      // s-t????????????????????£??????????????????
      int d = f;
      for (int v = t; v != s; v = prevV[v]){
        d = min(d, G[prevV[v]][prevE[v]].cap);
      }
      f -= d;
      res += d * dist[t];
      for (int v = t; v != s; v = prevV[v]){
        edge &e = G[prevV[v]][prevE[v]];
        e.cap -= d;
        G[v][e.rev].cap += d;
      }
    }
    return res;
  }
};

void exec(){
  int V, E, F, u, v, c, d;
  cin >> V >> E >> F;
  
  MinCostFlow mcf = MinCostFlow(V);
  
  for (int i = 0; i < E; i++){
    scanf("%d%d%d%d", &u, &v, &c, &d);
    mcf.addEdge(u, v, c, d);
  }
  
  cout << mcf.exec(0, V-1, F) << endl;

}

void solve(){
  int t = 1;
  // scanf("%d", &t);
  for (int i = 0; i < t; i++){
    exec();
  }
}

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

Measured memory_bytes: 3324
#include<stdio.h>
int main(void){
	int N, D,X,i;
	int A[100];
	scanf("%d %d %d", &N, &D, &X);
	for(i = 0; i < N;i++){
		scanf("%d",&A[i]);
	}
	for(i = 0; i < N; i++){
		if (D%A[i] == 0){
			X += D / A[i];
		}
		else{
			X += D / A[i]+1;
		}
	}
	printf("%d", X);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repI(i, d, n) for (int i = (d); i < (n); ++i)
#define reps1(i, n) for (int i = 1; i < (n); ++i)
using namespace std;
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; }

using ll = long long;
using P = pair<int, int>;
using Pl = pair<ll, ll>;
using M = map<int, int>;
using Ml = map<ll, ll>;
ll const INF = 1ll<<61;
double pi = 3.141592653589793238;

int main() {
  ll n, x, t;
  cin >> n >> x >> t;
  cout << (n + x - 1) / x * t << endl;

  return 0;
}


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

int main() {
  ll a,b,x;
  cin>>a>>b>>x;
  if(a>0) cout<<b/x-(a-1)/x<<endl;
  else cout<<b/x+1<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define X first
#define Y second
#define pb emplace_back
#define FOR(i,a,b) for(int (i)=(a);i<(b);++(i))
#define EFOR(i,a,b) for(int (i)=(a);i<=(b);++(i))
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define reps(X,S,Y) for (int (X) = S;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = (Y)-1;(X) >=0;--(X))
#define rreps(X,S,Y) for (int (X) = (Y)-1;(X) >= (S);--(X))
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()
#define eb emplace_back
#define UNIQUE(X) (X).erase(unique(all(X)),(X).end())

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef ll LL;
typedef pii PII;
typedef pll PLL;
template<class T> using vv=vector<vector<T>>;
template<class T> inline bool MX(T &l,const T &r){return l<r?l=r,1:0;}
template<class T> inline bool MN(T &l,const T &r){return l>r?l=r,1:0;}
const ll MOD=1e9+7;

int N;
int K;
int A[114514];
vector<int> es[114514];
int depth[114514];
int ans = 0;

int Dfs(int v, int p) {
  depth[v] = depth[p]+1;

  int ret = depth[v];
  for (int u : es[v]) {
    int res = Dfs(u, v);
    MX(ret, res);
  }
  
  if (v != 0 && A[v] != 0 && ret >= depth[v]+K-1) {
    ////printf("change in %d\n", v+1);
    ans++;
    ret = -MOD;
  }
  return ret;
}

int main() {
  scanf("%d%d", &N, &K);
  rep(i, N) {
    scanf("%d", &A[i]);
    --A[i];
    if (i > 0) es[A[i]].eb(i);
  }

  if (A[0] != 0) ans++;
  Dfs(0, 0);
  printf("%d\n", ans);
}


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

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

#define MOD 1000000007

int main(void) {
    ll N, M, C;
    ll clear = 0;
    vector<ll> B;
    cin >> N >> M >> C;
    B.resize(M);
    for(ll i = 0;i < M;i++) cin >> B[i];
    for(ll i = 0;i < N;i++) {
        ll c = 0;
        for(ll j = 0;j < M;j++) {
            ll temp;
            cin >> temp;
            c += temp * B[j];
        }
        if(c + C > 0) clear++;
    }
    cout << clear << endl;
    return 0;
}


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

import heapq
import math

def _heappush_max(heap, item):
    heap.append(item)
    heapq._siftdown_max(heap, 0, len(heap)-1)
def _heappop_max(heap):
    """Maxheap version of a heappop."""
    lastelt = heap.pop()    # raises appropriate IndexError if heap is empty
    if heap:
        returnitem = heap[0]
        heap[0] = lastelt
        heapq._siftup_max(heap, 0)
        return returnitem
    return lastelt

heapq._heapify_max(a)

for i in range(m):
  temp=math.floor(_heappop_max(a)/2)
  _heappush_max(a,temp)

print(sum(a))

Measured memory_bytes: 14252
import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
import Data.List

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

main = do
    n <- getInt
    as <- getIntList
    let lgcd = scanl gcd' 0 as
    let rgcd = scanr gcd' 0 as
    let ans = maximum $ zipWith gcd' lgcd (tail rgcd)
    print ans

gcd' a 0 = a
gcd' 0 a = a
gcd' a b = gcd a b

Measured memory_bytes: 31296
// #include {{{
#include <iostream>
#include <cassert>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <ctime>
#include <queue>
#include <set>
#include <map>
#include <stack>
#include <string>
#include <bitset>
#include <vector>
#include <complex>
#include <algorithm>
using namespace std;
// }}}
// #define {{{
typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
typedef vector<int> vi;
#define de(x) cout << #x << "=" << x << endl
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define per(i,a,b) for(int i=(b)-1;i>=(a);--i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define fi first
#define se second
// }}}

int n , K , ban[10];

int main(){
  cin >> n >> K;
  rep(i,0,K) {
    int x;
    cin >> x;
    ban[x] = true;
  }
  for(int i=n;;++i) {
    int t=i,ok=1;
    while(t) {
      if(ban[t%10])
        ok=0;
      t/=10;
    }
    if(ok) {
      cout << i << endl;
      return 0;
    }
  }
  return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
from math import *
from itertools import *
from collections import *
from functools import *
try:
    from math import gcd
except Exception:
    from fractions import gcd


def solve(D: int):
    return {
            25: 'Christmas', 
            24: 'Christmas Eve', 
            23: 'Christmas Eve Eve', 
            22: 'Christmas Eve Eve Eve'
    }[D]


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    D = int(next(tokens))  # type: int
    result = solve(D)
    print(result)

if __name__ == '__main__':
    main()


Measured memory_bytes: 5140
#include <bits/stdc++.h>
#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long int
using namespace std;

int main() {
    fast();
    // ll t;
    // cin>>t;
    // while(t--)			
    // {
         
    // }
    ll n;
    cin>>n;
    vector<ll>cnt(1000006,1);
    for(int i=2;i<1000006;i++)
    {
        for(int j=i;j<1000006;j+=i)
        cnt[j]++;
    }
    ll ans=0;
    for(int i=1;i<n;i++)
    {
        ans+=cnt[n-i];
    }
    cout<<ans;
}



Measured memory_bytes: 11116
#include<cstring>
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<queue>
#include<bitset>
#include<cstdlib>
#include<set>
#include<unordered_map>
#define l(x) (x<<1)
#define r(x) ((x<<1)|1)
#define low(x) (x&(-x))
#define IL inline
#define reg register
#define LL long long
#define N 500010
#define MOD 998244353
#define MO 1000000007
#define INF 0x3f3f3f3f
using namespace std;

int T,n,m,i,j,k,x,y,z;
int a[N],b[N];
char c[N];

struct Data{
	int x,y;
}d[N];

IL int Abs(int x){return (x<0)?-x:x;}
IL void Swap(int &a,int &b){a^=b^=a^=b;}
IL int Min(int a,int b){return (a<b)?a:b;}
IL int Max(int a,int b){return (a>b)?a:b;}
IL bool cmp(const Data a,const Data b){return a.x<b.x;}

IL LL Mi(LL x,LL y){
	LL p=x,t=1,Res=1;
	for (;t<=y;(t&y)?Res=(Res*p)%MOD:0,p=(p*p)%MOD,t<<=1);
	return Res;
}

IL int read(){
	int p=0,f=1;	char	c=getchar();
	while (c<48||c>57)	{if (c=='-')	f=-1;	c=getchar();}
	while (c>=48&&c<=57)	p=(p<<1)+(p<<3)+c-48,c=getchar();
	return p*f;
}

int main(){
	#ifdef __Marvolo
	freopen("zht.in","r",stdin);
	freopen("zht.out","w",stdout);
	#endif
	n=read();
	for (i=1;i<=n;i++)	a[i]=read();
	sort(a+1,a+1+n);
	int Ans=0;
	for (i=1;i<=n;i++)
		for (j=i+1;j<=n;j++)
			for (k=j+1;k<=n;k++){
				if (a[i]==a[j] || a[i]==a[k] || a[j]==a[k])	continue;
				if (a[i]+a[j]>a[k])	Ans++;
			}
	cout<<Ans<<endl;
	return 0;
}

Measured memory_bytes: 3656
#include <iostream>
#include <cmath>
using namespace std;
const int maxn = 1000000;
int dp[maxn];
bool ar[maxn];
int main()
{
	for(int i = 2;i<=maxn;i++)
	{
		if(!ar[i])
		{
			for(int j = 2;j*i<maxn;j++)
				ar[i*j] = true;
		}
		dp[i] = dp[i-1] + !ar[i];
	}
	int n;
	while(cin >> n)
		cout << dp[n] <<endl;
	return 0;
}

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

int main(){
  int N,M;
  cin >> N >> M;
  vector<ll> x(N), y(N), z(N);
  REP(i,N)  {
    cin >> x[i] >> y[i] >> z[i];
  }
  ll ans = 0;
  REP(a,8) {
    vector<ll> K(N);
    REP(i,N) {
      ll t = (a&1) ? -x[i] : x[i];
      t += (a&2) ? -y[i] : y[i];
      t += (a&4) ? -z[i] : z[i];
      K[i] = t;
    }
    sort(K.begin(),K.end(),greater<ll>());
    ll tt = 0;
    REP(i,M) tt += K[i];
    ans = max( ans, tt );
  }
  cout << ans << endl;

}
  


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

int main() {
  int N;
  cin >> N;
  bool a = false;
  for(int i=0; i<100; i++) {
    for(int j=0; j<100; j++) {
      if(4*i + 7*j == N) a = true;
    }
  }
  if(a) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
MOD = 10 ** 9 + 7

def main():
    N = int(input())
    A = list(map(int, input().split()))
    
    max_bin_digits = len(bin(max(A))[2:])
    ans = 0
    for i in range(max_bin_digits):
        cnt = 0
        for a in A:
            if 1 << i & a:
                cnt += 1
        ans += cnt * (N - cnt) * 2 ** i
        ans %= MOD

    print(ans)

if __name__ == "__main__":
    main()

Measured memory_bytes: 122936
n, m, c = map(int, input().split())
B = list(map(int, input().split()))

cnt = 0
for _ in range(n):
    A = list(map(int, input().split()))

    total = 0
    for a, b in zip(A, B):
        total += a * b
    total += c

    if total > 0:
        cnt += 1
print(cnt)

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

int main() {
  int n;
  cin >> n;
  vector<pair<int,int>> p(n);
  for(int i = 0;i < n;i++){
    cin >> p[i].first;
    p[i].second = i + 1;
  }
  sort(p.begin(),p.end());
  for(int i = 0;i < n;i++){
    cout << p[i].second;
    if(i != n - 1)cout << " ";
    else cout << endl;
  }
}


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

void textIO()
{
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
}

void fastIO()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);

}

#define sz 1000006

vector<bool> arr(sz);

int main()
{

    textIO();
    fastIO();

    long long n;
    cin >> n;
    vector<long long> val(n);
    unordered_set<long long> st;

    for(int i=0;i<n;i++){
        cin >> val[i];
        if(st.find(val[i]) == st.end()){
            st.insert(val[i]);
            for(int j=val[i]*2;j<sz;j+=val[i]){
                arr[j] = true;
            }
        }
        else{
            arr[val[i]]  = true;
        }
    }

    long long ans = 0;

    for(int i=0;i<val.size();i++){
        if(!arr[val[i]])
            ans++;
    }

    cout << ans << '\n';

    return 0;
}


Measured memory_bytes: 13004
#include<bits/stdc++.h>
using namespace std;
int main(){
    int A, B, N;
    cin >> A >> B >> N;
    vector<int> a(A);
    for(int i = 0; i < A; i++){
        cin >> a.at(i);
    }
    vector<int> b(B);
    for(int i = 0; i < B; i++){
        cin >> b.at(i);
    }
    vector<vector<int>> n(N, vector<int>(3));
    for(int i = 0; i < N; i++){
        for(int j = 0; j < 3; j++){
            cin >> n.at(i).at(j);
        }
    }
    vector<int> ans(N);
    for(int i = 0; i < N; i++){
        ans.at(i) = a.at(n.at(i).at(0) - 1) + b.at(n.at(i).at(1) - 1) - n.at(i).at(2);
    }
    sort(ans.begin(), ans.end());
    sort(a.begin(), a.end());
    sort(b.begin(), b.end());
    int ans2;
    ans2 = a.at(0) + b.at(0);
    if(ans2 >= ans.at(0)){
        cout << ans.at(0) << endl;
    }
    else if(ans2 < ans.at(0)){
        cout << ans2 << endl;
    }
    return 0;
}

Measured memory_bytes: 6912
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair < int, int >;

// MODULAR ARITHMATIC
const int mod = 998244353;

template < typename T >
void add_self (T & a, T b) {
	a += b;
	if (a >= mod) a -= mod;
}

int main() {
	int n;
	cin >> n;
	vector < pii > a (n);
	for (pii & p : a) {
		cin >> p.first >> p.second;
	}
	sort (a.begin(), a.end(), [&] (const pii & p1, const pii & p2) {
		return p1.first < p2.first;
	});
	vector < int > dp (n + 1);
	stack < int > s;
	dp[n] = 1;
	for (int i = n - 1; i >= 0; i--) {
		// calculate j
		while (!s.empty() && a[s.top()].first < (long) a[i].first + a[i].second) {
			s.pop();
		}
		int j = n;
		if (!s.empty()) j = s.top();
		s.push (i);
		dp[i] = dp[i + 1];
		add_self (dp[i], dp[j]);
	}
	
	cout << dp[0] << endl;
		
	return 0;
}

/**
 * 55 + 6 + 5 + 1 + 1*/


Measured memory_bytes: 3072
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <sstream>
#include <string>
#define repd(i,a,b) for (int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define inf 2000000007
#define mp make_pair
#define pb push_back
typedef long long ll;
using namespace std;
template <typename T>
inline void output(T a, int p) {
    if(p) cout << fixed << setprecision(p)  << a << "\n";
    else cout << a << "\n";
}
// end of template
struct edge{
    int to, cost;
};

struct query{
    int p, q, c;
};

template <typename T>
void unique(vector<T> &A){
    T cur = A[0];
    vector<T> B = {cur};
    for(T a: A){
        if(a == cur)continue;
        else B.pb(a), cur = a;
    }
    A = B;
}



int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    // source code
    
    int N, M;
    cin >> N >> M;

    vector<query> Q(M);
    vector<pair<int, int>> A; // to, line
    
    rep(i, M){
        int p, q, c;
        cin >> p >> q >> c;
        p--, q--;
        Q[i] = {p, q, c};
        A.pb(mp(p, c));
        A.pb(mp(q, c));
    }
    rep(i, N) A.pb(mp(i, -1)); // 各頂点の改札
    
    sort(all(A));
    unique(A);
    
    vector<vector<edge>> G(A.size()); // to, cost
    
    rep(i, M){
        int pi = (int)(lower_bound(all(A), mp(Q[i].p, Q[i].c)) - A.begin());
        int qi = (int)(lower_bound(all(A), mp(Q[i].q, Q[i].c)) - A.begin());
        G[pi].pb({qi, 0});
        G[qi].pb({pi, 0});
    }

    vector<int> dist(A.size(), inf);
    int si = 0;
    rep(i, A.size()){
        if(A[i].second == -1){
            si = i;
        }
        else{
            G[i].pb({si, 0});
            G[si].pb({i, 1});
        }
    }
    
    // 0-1 BFS
    deque<int> q;
    q.push_back(0);
    dist[0] = 0;
    while(!q.empty()){
        int t = q.front();
        q.pop_front();
        for(edge e: G[t]){
            if(dist[e.to] > dist[t] + e.cost){
                dist[e.to] = dist[t] + e.cost;
                if(e.cost == 0) q.push_front(e.to);
                else q.push_back(e.to);
            }
        }
    }
    
    int ans = inf;
    rep(i, A.size()){
        if(A[i].first == N - 1) ans = min(ans, dist[i]);
    }
    
    if(ans == inf) output(-1, 0);
    else output(ans, 0);
    
    return 0;
}

Measured memory_bytes: 38824
#include <algorithm>
#include <iostream>
#include <cstdio>
using namespace std;

int main()
{
    int a, b, c;
    // scanf("%d %d", &a, &b);
    cin >> a >> b >> c;
    int x[3] = {a, b, c};
    sort(x, x + 3);
    cout << x[0] << " " << x[1] << " " << x[2] << endl;

    return 0;
}


Measured memory_bytes: 3116
int main(int argc, const char * argv[])
{
    int a, b;
    scanf("%d %d", &a, &b);
    if(a<b){
        printf("a < b\n");
    }else if(a>b){
        printf("a > b\n");
    }else{
        printf("a == b\n");
    }
    return 0;
}

Measured memory_bytes: 580
#include<bits/stdc++.h>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
 
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int
#define mod 1000000007

#define out1(a) cout<<#a<<" "<<a<<endl
#define out2(a,b) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<endl
#define out3(a,b,c) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<endl

#define ft first
#define sd second
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
 
using namespace std;

bool chkpalin( string s )
{
    for ( int i = 0 ; i < s.length()/2 ; i++ )
    {
        if ( s[i] != s[s.length()-1-i] )
        {
            return false;
        }
    }
    return true;
}

signed main()
{
    fast;
    string s;
    cin>>s;

    if ( chkpalin(s) == false )
    {
        cout<<"No"<<endl;
    }
    else
    {
        string str1 = s.substr(0,(s.length()-1)/2);

        if ( chkpalin(str1) == false )
        {
            cout<<"No"<<endl;
            // out1(str1);
            return 0;
        }

        string str2 = s.substr( (s.length()+3)/2 - 1,s.length() - (s.length()+3)/2 + 1);

        if ( chkpalin(str2) == false )
        {
            cout<<"No"<<endl;
            // out1(str2);
            return 0;
        }

        cout<<"Yes"<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
n,k=[int(i) for i in input().split()]
ans=0
for i in range(max(k,1),n+1):
  ans+=max(0,i-k)
  ans+=(((n-i)//i)*(i-k)+max(0,n%i-k+1)  if i>=k else 0)
  if k==0:
    ans-=1
print(ans)

Measured memory_bytes: 3064