akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define f first
#define s second
#define pb push_back
#define _ ios::sync_with_stdio(0);cin.tie(0);

using namespace std;

typedef long long ll;

const int MAX = 1e5+5;
const int MOD = 1e9+7;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3f;

int main(){_

	int n;
	cin >> n;
	vector<ll> v(n);
	for(int i = 0; i < n; i++)
		cin >> v[i];
	ll ans = 0;
	for(int i = 0; i < n; i++)
		for(int j = i+1; j < n; j++)
			ans += v[i]*v[j];
	cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
using namespace std;
#define inf 1000000009
#define int long long
typedef pair<int, int> P;

signed main() {
	string s;
	cin >> s;
	for (int i = 0; i < s.size() - 8; i++)cout << s[i];
	cout << endl;
}

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

using namespace std;

string s_erase(string str, string s) {
        string::size_type pos;
        while ((pos = str.find(s)) != string::npos) {
                str.erase(pos, s.length());
        }
        return str;
}

int main() {
        string s;
        cin >> s;

        s = s_erase(s, "eraser");
        s = s_erase(s, "erase");
        s = s_erase(s, "dreamer");
        s = s_erase(s, "dream");

        if (s.empty())
                cout << "YES" << endl;
        else
                cout << "NO" << endl;
        return 0;
}


Measured memory_bytes: 512
#[doc = " https://github.com/hatoo/competitive-rust-snippets"]
#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
#[allow(unused_imports)]
use std::io::{stdin, stdout, BufWriter, Write};
#[allow(unused_imports)]
use std::iter::FromIterator;
mod util {
    use std::fmt::Debug;
    use std::io::{stdin, stdout, BufWriter, StdoutLock};
    use std::str::FromStr;
    #[allow(dead_code)]
    pub fn line() -> String {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.trim().to_string()
    }
    #[allow(dead_code)]
    pub fn chars() -> Vec<char> {
        line().chars().collect()
    }
    #[allow(dead_code)]
    pub fn gets<T: FromStr>() -> Vec<T>
    where
        <T as FromStr>::Err: Debug,
    {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.split_whitespace()
            .map(|t| t.parse().unwrap())
            .collect()
    }
    #[allow(dead_code)]
    pub fn with_bufwriter<F: FnOnce(BufWriter<StdoutLock>) -> ()>(f: F) {
        let out = stdout();
        let writer = BufWriter::new(out.lock());
        f(writer)
    }
}
#[allow(unused_macros)]
macro_rules ! get { ( [ $ t : ty ] ) => { { let mut line : String = String :: new ( ) ; stdin ( ) . read_line ( & mut line ) . unwrap ( ) ; line . split_whitespace ( ) . map ( | t | t . parse ::<$ t > ( ) . unwrap ( ) ) . collect ::< Vec < _ >> ( ) } } ; ( [ $ t : ty ] ; $ n : expr ) => { ( 0 ..$ n ) . map ( | _ | get ! ( [ $ t ] ) ) . collect ::< Vec < _ >> ( ) } ; ( $ t : ty ) => { { let mut line : String = String :: new ( ) ; stdin ( ) . read_line ( & mut line ) . unwrap ( ) ; line . trim ( ) . parse ::<$ t > ( ) . unwrap ( ) } } ; ( $ ( $ t : ty ) ,* ) => { { let mut line : String = String :: new ( ) ; stdin ( ) . read_line ( & mut line ) . unwrap ( ) ; let mut iter = line . split_whitespace ( ) ; ( $ ( iter . next ( ) . unwrap ( ) . parse ::<$ t > ( ) . unwrap ( ) , ) * ) } } ; ( $ t : ty ; $ n : expr ) => { ( 0 ..$ n ) . map ( | _ | get ! ( $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ ( $ t : ty ) ,*; $ n : expr ) => { ( 0 ..$ n ) . map ( | _ | get ! ( $ ( $ t ) ,* ) ) . collect ::< Vec < _ >> ( ) } ; }
#[allow(unused_macros)]
macro_rules ! debug { ( $ ( $ a : expr ) ,* ) => { eprintln ! ( concat ! ( $ ( stringify ! ( $ a ) , " = {:?}, " ) ,* ) , $ ( $ a ) ,* ) ; } }
const BIG_STACK_SIZE: bool = true;
#[allow(dead_code)]
fn main() {
    use std::thread;
    if BIG_STACK_SIZE {
        thread::Builder::new()
            .stack_size(32 * 1024 * 1024)
            .name("solve".into())
            .spawn(solve)
            .unwrap()
            .join()
            .unwrap();
    } else {
        solve();
    }
}
fn solve() {
    let (t, x) = get!(f64, f64);

    println!("{}", t / x);
}


Measured memory_bytes: 8572
#include <bits/stdc++.h>
using namespace std;
#define SORT(a) sort((a).begin(), (a).end())
#define RSORT(a) reverse((a).begin(), (a).end())
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;
const long long INF = 1LL << 60;

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


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

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

r, c, k = LI()
maze = [[0] * c for _ in range(r)]
for _ in range(k):
    R, C, V = LI()
    maze[R-1][C-1] = V

dp1 = [[0] * (c+1) for _ in range(r+1)]
dp2 = [[0] * (c+1) for _ in range(r+1)]
dp3 = [[0] * (c+1) for _ in range(r+1)]

for i in range(1, r+1):
    for j in range(1, c+1):
        dp1[i][j] = max(dp1[i][j-1], dp1[i-1][j] + maze[i-1][j-1], maze[i-1][j-1], dp2[i-1][j] + maze[i-1][j-1], dp3[i-1][j] + maze[i-1][j-1])
        dp2[i][j] = max(dp2[i][j-1], dp2[i-1][j], dp1[i][j-1] + maze[i-1][j-1])
        dp3[i][j] = max(dp3[i][j-1], dp3[i-1][j], dp2[i][j-1] + maze[i-1][j-1])
ans = max(dp1[-1][-1], dp2[-1][-1], dp3[-1][-1])
print(ans)

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

#define MP make_pair
#define PB push_back
#define ALL(x)      (x).begin(),(x).end()
#define REP(i,n)    for(int i=0;i<(n);i++)
#define REP1(i,n)   for(int i=1;i<(n);i++)
#define REP2(i,d,n) for(int i=(d);i<(n);i++)
#define RREP(i,n)   for(int i=(n);i>=0;i--)
#define CLR(a)      memset((a),0,sizeof(a))
#define MCLR(a)     memset((a),-1,sizeof(a))
#define RANGE(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI > VVI;
typedef vector<string> VS;
typedef vector<LL> VLL;
typedef pair<int,int> PII;

const int INF = 0x3f3f3f3f;
const LL INFL = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-9;

const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};


void solve(long long N, long long M, std::vector<long long> a, std::vector<long long> b){
    VI cnt(N, 0);

    REP(i, M) {
        cnt[a[i]-1]++;
        cnt[b[i]-1]++;
    }

    REP(i, N) {
        cout << cnt[i] << endl;
    }
}

int main(){
    long long N;
    scanf("%lld",&N);
    long long M;
    scanf("%lld",&M);
    std::vector<long long> a(M);
    std::vector<long long> b(M);
    for(int i = 0 ; i < M ; i++){
        scanf("%lld",&a[i]);
        scanf("%lld",&b[i]);
    }
    solve(N, M, std::move(a), std::move(b));
    return 0;
}



Measured memory_bytes: 256
#include <stdio.h>

int main() {
	char S[4], a = ' ', b = ' ', i;
	int acount = 0, bcount = 0;

	scanf("%s", S);

	for (i = 0; i < 4; i++) {
		if (S[i] == a) {
			acount++;
		}
		else if (S[i] == b) {
			bcount++;
		}
		else if (a != ' ') {
			b = S[i];
		}
		else {
			a = S[i];
		}
	}

	if (acount == 1 && bcount == 1) {
		printf("Yes");
	}
	else {
		printf("No");
	}

	return 0;
}

Measured memory_bytes: 128
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
#define REP(var, a, b) for (int var = (a); var < (b); var++)
#define rep(var, n) for (int var = 0; var < (n); ++var)
#define ALL(c) (c).begin(), (c).end()
#define rALL(c) (c).rbegin(), (c).rend()

ll MOD = 1000000007;
ll lcm(ll a, ll b) { return (a / __gcd(a, b) * b); }

int main() {
  //
  string s;
  cin >> s;
  int l = s.size() - 1;
  ll ans = 0;
  rep(x, (1 << l)) {
    ll tmp = 0;
    int prev = 0;
    rep(i, l + 1) {
      if ((x >> i) & 1) {
        // cout << prev << s.substr(prev, i - prev + 1) << endl;
        tmp += stoll(s.substr(prev, i - prev + 1));
        prev = i + 1;
      }
    }
    tmp += stoll(s.substr(prev, l - prev + 1));
    ans += tmp;
  }
  cout << ans << endl;
  return 0;
}


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

void strpart(char *a,char *b,char *c,int n)
{
	int i,j,l=strlen(a);
	for(i=0;i<n;i++){b[i] = a[i];}
	b[i]='\0';
	for(j=0;j<=l;j++){c[j] = a[i++];}
}

void strreverse(char *a)
{
	int i,l=strlen(a);
	char b[731];
	for(i=0;i<l;i++)b[i]=a[l-i-1];
	b[i]='\0';
	strcpy(a,b);
}

void strlink(char *a,char *b,char *c)
{
	strcpy(a,b);
	strcpy(&a[strlen(b)],c);
}

int main(void)
{
	int i,j,k,p;
	int l,m;
	char a[73],b[73],c[73],d[576][73];
	
	scanf("%d ",&m);
	
	for(i=0;i<m;i++)
	{
		scanf("%s ",a);
		l = strlen(a);
		p = 0;
		strcpy(d[p++],a);
		strreverse(a);
		strcpy(d[p++],a);
		if(strcmp(d[0],d[1])==0)p--;
		
		for(j=1;j<l;j++)
		{
			strpart(a,b,c,j);
			
			strlink(d[p++],c,b);
			for(k=0;k<p-1;k++)if(strcmp(d[k],d[p-1])==0)p--;
			
			strreverse(b);
			
			strlink(d[p++],b,c);
			for(k=0;k<p-1;k++)if(strcmp(d[k],d[p-1])==0)p--;
			
			strlink(d[p++],c,b);
			for(k=0;k<p-1;k++)if(strcmp(d[k],d[p-1])==0)p--;
			
			strreverse(c);
			
			strlink(d[p++],b,c);
			for(k=0;k<p-1;k++)if(strcmp(d[k],d[p-1])==0)p--;
			
			strreverse(b);
			
			strlink(d[p++],b,c);
			for(k=0;k<p-1;k++)if(strcmp(d[k],d[p-1])==0)p--;
			
			strlink(d[p++],c,b);
			for(k=0;k<p-1;k++)if(strcmp(d[k],d[p-1])==0)p--;
		}		
		printf("%d\n",p);
	}
	return 0;
}
		

Measured memory_bytes: 452
s=input()
t=input()
ls=len(s)+1
lt=len(t)+1
dp=[[0]*lt for _ in range(ls)]
for i in range(1,ls):
    for j in range(1,lt):
        if s[i-1]==t[j-1]:
            dp[i][j]=max(dp[i-1][j-1]+1,dp[i][j-1],dp[i-1][j])
        else:
            dp[i][j]=max(dp[i][j-1],dp[i-1][j])
ans=""
i=ls-1
j=lt-1
while i>0 and j>0:
    if dp[i][j]==dp[i-1][j]:
        i-=1
    elif dp[i][j]==dp[i][j-1]:
        j-=1
    else:
        ans = s[i-1] + ans
        i-=1
        j-=1
print(ans)

Measured memory_bytes: 112476
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import functools

@functools.lru_cache(maxsize = None)
def simulate(x, y):
    """ return True means first player wins """
    # print("simulate ", x, y)
    if x <= 1 and y <= 1:
        return False
    for i in range(1, x // 2):
        tmp = simulate(x - i * 2, y + i)
        if tmp == False:
            return True
    for i in range(1, y // 2):
        tmp = simulate(x + i, y - i * 2)
        if tmp == False:
            return True
    return False

# size = 100
# for x in range(size):
#     for y in range(size):
#         print(int(simulate(x, y)), end = " ")
#     print("")


def fast(X, Y):
    if X <= 2:
        if Y <= 3:
            return False
        else:
            return True
    elif X == 3:
        if Y <= 4:
            return False
        else:
            return True
    else:
        if X - 1 <= Y <= X + 1:
            return False
        else:
            return True

X, Y = map(int, input().split())
X, Y = min(X, Y), max(X, Y)
if fast(X, Y):
    print("Alice")
else:
    print("Brown")


Measured memory_bytes: 3700
#include <stdio.h>

int main(void) {
    int num;
    int r, c, k, m;
    
    while(scanf("%d", &num) != EOF) {
        
        int count = 0;
        
        for(r = 0; r < 10; r++) {
            for(c = 0; c < 10; c++) {
                for(k = 0; k < 10; k++) {
                    for(m = 0; m < 10; m++) {
                        if(r + c + m + k == num) {
                            count++;
                        }
                    }
                }
            }
        }
        
        printf("%d\n", count);
    }
    
    return(0);
}

Measured memory_bytes: 596
{-
SelectionSort(A)
1 for i = 0 to A.length-1
2     mini = i
3     for j = i to A.length-1
4         if A[j] < A[mini]
5             mini = j
6     swap A[i] and A[mini]
-}

main = do 
    s1 <- getLine
    s2 <- getLine
    let a = map (\x -> read x :: Int) $ words s2
    let (swapCount, sorteda) = ssorti (0,a) 0
    putStrLn $ unwords $ map show sorteda
    putStrLn $ show swapCount

ssorti :: (Int,[Int]) -> Int -> (Int,[Int])
ssorti (swapCount, a) i
  | i <= length a - 1 = ssorti (ssortj (swapCount, a) i i i) (i+1)
  | otherwise         = (swapCount, a)

ssortj :: (Int,[Int]) -> Int -> Int -> Int -> (Int,[Int])
ssortj (swapCount, a) i j mini
  | j <= length a - 1 && a!!j < a!!mini = ssortj (swapCount, a) i (j+1) j
  | j <= length a - 1                   = ssortj (swapCount, a) i (j+1) mini
  | a!!i /= a!!mini                     = (swapCount+1, swap a i mini)
  | otherwise                           = (swapCount, a)

swap :: [Int] -> Int -> Int -> [Int]
swap a i j = (take i1 a) ++ [a!!i2] ++ (take (i2-i1-1) $ drop (i1+1) a) ++ [a!!i1] ++ (drop (i2+1) a)
  where (i1, i2) = (min i j, max i j)


Measured memory_bytes: 4192
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
const int inf=1e9+7;
const ll mod=1e9+7;

int DP1[1000001];
int DP2[1000001];

int main() {
    vector<int> oldarr, newarr;
    for(int i=1;i<200;++i){
        if(i*(i+1)/2*(i+2)/3>1000000) break;
        DP1[i*(i+1)/2*(i+2)/3] = 1;
        oldarr.push_back(i*(i+1)/2*(i+2)/3);
    }
    for(int i=2;i<6;++i){
        newarr.clear();
        for(int j=0;j<oldarr.size();++j){
            for(int k=1;k<200;++k){
                if(oldarr[j]+k*(k+1)/2*(k+2)/3>1000000) break;
                if(DP1[oldarr[j]+k*(k+1)/2*(k+2)/3]==0){
                    DP1[oldarr[j]+k*(k+1)/2*(k+2)/3] = i;
                    newarr.push_back(oldarr[j]+k*(k+1)/2*(k+2)/3);
                }
            }
        }
        oldarr = newarr;
    }

    oldarr.clear();
    for(int i=1;i<200;++i){
        if(i*(i+1)/2*(i+2)/3>1000000) break;
        if((i*(i+1)/2*(i+2)/3) % 2 == 1){
            DP2[i*(i+1)/2*(i+2)/3] = 1;
            oldarr.push_back(i*(i+1)/2*(i+2)/3);
        }
    }
    bool ans = true;
    while(ans){
        ans = false;
        newarr.clear();
        for(int j=0;j<oldarr.size();++j){
            for(int k=1;k<200;++k){
                if(oldarr[j]+k*(k+1)/2*(k+2)/3>1000000) break;
                if((k*(k+1)/2*(k+2)/3) % 2 == 1){
                    if(DP2[oldarr[j]+k*(k+1)/2*(k+2)/3]==0){
                        ans = true;
                        DP2[oldarr[j]+k*(k+1)/2*(k+2)/3] = DP2[oldarr[j]] + 1;
                        newarr.push_back(oldarr[j]+k*(k+1)/2*(k+2)/3);
                    }
                }
            }
        }
        oldarr = newarr;
    }
    int tmp;
    while(true){
        cin>>tmp;
        if(tmp==0) break;
        cout<<DP1[tmp]<<" "<<DP2[tmp]<<endl;
    }
}



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

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,n){
        cin>>a[i];
    }
    rep(i,n){
        if(a[i]%2 == 0 &&a[i]%6 != 0  && a[i]%10 != 0){
        cout << "DENIED" << endl;
        return 0;            
       }
    }
    cout << "APPROVED" << endl;
    return 0;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG //エラーを出すためのおまじない
#include <bits/stdc++.h>
#include <algorithm>
//#include <cstdlib>  // abs() for integer
#include <cmath>    // abs() for float, and fabs()
#include <math.h>
using namespace std;
#define coYES cout << "YES" << endl
#define coNO cout << "NO" << endl
#define coYes cout << "Yes" << endl
#define coNo cout << "No" << endl
#define coyes cout << "yes" << endl
#define cono cout << "no" << endl
//#define cocount cout << count << endl;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i < (int)(n); i++)
#define Cinint(n) int n;\
cin >> n;
#define Cinvecint(a, n) vector<int> a(n);\
for (int i = 0; i < (int)(n); i++) {\
  int num;\
  cin >> num;\
  a.at(i) = num;\
}
#define Cinstring(s) string s;\
cin >>s;

  

int main() {
  int n, x, t;
  cin >> n >> x >> t;
  if (n%x == 0) {
    cout << t*n/x << endl;
  }
  else {
    cout << t*(n/x + 1) << endl;
  }
}


Measured memory_bytes: 3484
#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 RFOR(i,a,b) for (int i = a-1; i >= b; i--)
#define RREP(i,a) RFOR(i,a,0)
#define REPALL(i,x) for (int i = 0; i < x.size(); i++)
#define RREPALL(i,x) for (int i = x.size()-1; i >= 0; i--)
#define ALL(x) x.begin(), x.end()
#define SORT(x) sort(ALL(x))
#define MIN_ELEMENT(x) min_element(ALL(x))
#define MAX_ELEMENT(x) max_element(ALL(x))
#define COUNT(x,num) count(ALL(x), num)
#define MEMSET(x,val) memset(x, val, sizeof(x))
#define MAX(a,b) a = max(a,b)
#define MIN(a,b) a = min(a,b)
void YES(bool flag) {cout<<(flag ? "YES" : "NO")<<endl;}
void Yes(bool flag) {cout<<(flag ? "Yes" : "No")<<endl;}
void yes(bool flag) {cout<<(flag ? "yes" : "no")<<endl;}
#define fst first
#define scd second
#define nextline putchar('\n')
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef vector<ll> VLL;
typedef vector<vector<ll>> VVLL;
const int INF = 1e7;
const ll MOD = 1e9 + 7;

int n, m;
string ans = "";
bool flag = true;

int main()
{
    cin>>n>>m;
    REP(i,n) {
        ans +=  '\0';
    }
    REP(i,m) {
        int s, c;
        cin>>s>>c;
        if (ans[s-1] == '\0') {
            ans[s-1] = '0' + c;
        } else if (ans[s-1] != '0' + c) {
            flag = false;
        }
    }

    if (ans[0] == '0' && n != 1) {
        flag = false;
    }

    if (flag) {
        REP(i,n) {
            if (ans[i] == '\0') {
                if (i == 0 && n != 1)
                    ans[i] = '1';
                else
                    ans[i] = '0';
            }
        }
        cout<<ans<<endl;
    } else {
        cout<<-1<<endl;
    }

    return 0;
}


Measured memory_bytes: 256
function myin(){return require("fs").readFileSync("/dev/stdin", "utf8").trim();}

//0:何もしない  1:数値へ変換  2:半角SPで分割  3:改行で分割  4:半角SPで分割し、数値配列へ
//5:改行で分割し、数値配列へ  6:1文字に分割  7:1文字に分割し、数値配列へ
function myconv(i, no){
  switch(no){
    case 0: return i;
    case 1: return parseInt(i);
    case 2: return i.split(" ");
    case 3: return i.split("\n");
    case 4: return i.split(" ").map((a)=>Number(a));
    case 5: return i.split("\n").map((a)=>Number(a));
    case 6: return i.split("");
    case 7: return i.split("").map((a)=>Number(a));
  }}
function Main(input) {
  input = myconv(input, 3);
  const N = myconv(input[0], 1);
  const D = myconv(input[1], 4)[0];
  const X = myconv(input[1], 4)[1];
  let ans = 0;
  input.shift();
  input.shift();
  input = input.map((a)=>Number(a));
  for(let i = 0; i < N; i++){
    let tmp = 1;
    while (tmp <= D){
      ans++;
      tmp += input[i];
    }
  }
  console.log(ans + X);
}
Main(myin());

Measured memory_bytes: 29616
#include<cstdio>
int main()
{
	char s[4];
	bool flag = false;
	scanf("%s", s);
	for (int i = 0; i < 4; i++)
		if (i>0?s[i] == s[i - 1]:false) {
			flag = true;
			break;
		}
	if (flag)
		printf("Bad");
	else
		printf("Good");
	return 0;
}

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

int main(){
	int N,M,X; cin>>N>>M>>X;
	vector<int> A(M);
	for(int i=0; i<M; ++i) cin>>A[i];
	int pos = lower_bound(A.begin(), A.end(), X) - A.begin();
	cout<< min(pos, M-pos) <<endl;
}

Measured memory_bytes: 256
from functools import reduce
from fractions import gcd
import math
import bisect
import itertools
import sys
input = sys.stdin.readline
INF = float("inf")


def prime_decomposition(n):
    i = 2
    table = []
    while i * i <= n:
        while n % i == 0:
            n = n // i
            table.append(i)
        i += 1
    if n > 1:
        table.append(n)
    return table


# 処理内容
def main():
    N = int(input())
    A = list(map(int, input().split()))
    A.sort()

    P = [True]*1000010
    pairwise = True
    for a in A:
        if P[a] == False:
            pairwise = False
            break
        
        table = prime_decomposition(a)
        for p in table:
            n = 1
            while p*n <= len(P)-1:
                P[p*n] = False
                n += 1

    setwise = True
    if reduce(math.gcd, A) != 1:
        setwise = False

    if pairwise:
        print("pairwise coprime")
    elif setwise:
        print("setwise coprime")
    else:
        print("not coprime")



if __name__ == '__main__':
    main()

Measured memory_bytes: 188692
from collections import deque

class Dinic:
    def __init__(self, v, inf=float('inf')):
        self.V = v
        self.inf = inf
        # self.G = {i:[] for i in range(self.V)}
        self.G = [[] for _ in range(self.V)]
        self.level = [0] * self.V
        self.iter = [0] * self.V

    def add_edge(self, from_v, to_v, cap):
        self.G[from_v].append({'to': to_v, 'cap': cap, 'rev': len(self.G[to_v])})
        self.G[to_v].append({'to': from_v, 'cap': 0, 'rev': len(self.G[from_v]) - 1})

    def bfs(self, s):
        self.level = [-1] * self.V
        self.level[s] = 0
        que = deque()
        que.appendleft(s)

        while len(que) > 0:
            v = que.pop()
            for i in range(len(self.G[v])):
                e = self.G[v][i]
                if e['cap'] > 0 and self.level[e['to']] < 0:
                    self.level[e['to']] = self.level[v] + 1
                    que.appendleft(e['to'])

    def dfs(self, v, t, f):
        if v == t:
            return f

        for i in range(self.iter[v], len(self.G[v])):
            self.iter[v] = i
            e = self.G[v][i]
            if e['cap'] > 0 and self.level[v] < self.level[e['to']]:
                d = self.dfs(e['to'], t, min(f, e['cap']))
                if d > 0:
                    e['cap'] -= d
                    self.G[e['to']][e['rev']]['cap'] += d
                    return d

        return 0

    def maxflow(self, s, t):
        flow = 0
        while True:
            self.bfs(s)
            if self.level[t] < 0:
                return flow

            self.iter = [0] * self.V
            f = self.dfs(s, t, self.inf)
            while f > 0:
                flow += f
                f = self.dfs(s, t, self.inf)


def read_input():
    n = int(input())

    red = []
    for i in range(n):
        a, b = map(int, input().split())
        red.append((a, b))

    blue = []
    for i in range(n):
        c, d = map(int, input().split())
        blue.append((c, d))

    return n, red, blue


def submit():
    n, red, blue = read_input()
    dinic = Dinic(2*n+2)

    for i in range(n):
        dinic.add_edge(2*n, i, 1)
        dinic.add_edge(n+i, 2*n+1, 1)

    for i,b in enumerate(blue):
        for j,r in enumerate(red):
            if r[0] < b[0] and r[1] < b[1]:
                dinic.add_edge(j, n+i, 1)

    print(dinic.maxflow(2*n, 2*n+1))

if __name__ == '__main__':
    submit()


Measured memory_bytes: 46172
S=input()
N=len(S)
n1=0
n2=0
for i in range(N):
 if (i%2==0)and(S[i]=="h"):
  n1=n1+1
 if (i%2==1)and(S[i]=="i"):
  n2=n2+1

if (n1==n2)and(n1+n2==N):
 print("Yes")
else:
 print("No")

Measured memory_bytes: 38256
use std::io::stdin;
use std::io::BufRead;

fn main() {
    let stdin = stdin();
    let mut stdin = stdin.lock();

    let mut n = String::new();
    stdin.read_line(&mut n).unwrap();
    let n = n.trim().parse::<i64>().unwrap();

    let mut arr_of_has_cards: [[bool; 13]; 4] = [
        [false, false, false, false, false, false, false, false, false, false, false, false, false],
        [false, false, false, false, false, false, false, false, false, false, false, false, false],
        [false, false, false, false, false, false, false, false, false, false, false, false, false],
        [false, false, false, false, false, false, false, false, false, false, false, false, false]
    ];

    for _ in 0..n {
        let mut card = String::new();
        stdin.read_line(&mut card).unwrap();
        let card = card.split_whitespace().collect::<Vec<_>>();
        let card = (card.get(0).unwrap(), card.get(1).unwrap().parse::<i8>().unwrap());

        *arr_of_has_cards.get_mut(match *card.0 {
            "S" => 0,
            "H" => 1,
            "C" => 2,
            "D" => 3,
            _ => unreachable!()
        }).unwrap().get_mut((card.1 as usize) - 1 ).unwrap() = true;
    }

    for (card_suit, has_cards) in arr_of_has_cards.iter().enumerate() {
        for (card_num, has_card) in has_cards.iter().enumerate() {
            if *has_card { continue; }
            println!("{} {}", match card_suit {
                0 => "S",
                1 => "H",
                2 => "C",
                3 => "D",
                _ => unreachable!()
            }, card_num + 1);
        }
    }
}


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

class RangeSumQuery{
private:
	vector< int > value;
	int _size;
public:
	
	void Init(int size){
		int bitcount = 0;//?????°
		int t = size;
		
		while(t != 0){
			t /= 2;
			++bitcount;
		}
		if(size % (1 << (bitcount - 1)) != 0) bitcount++;
		_size = (1 << bitcount) - 1;
		
		value.resize(_size);
		
		for(vector< int >::iterator it = value.begin(); it != value.end(); ++it){
			(*it) = 0;
		}
	}
	
	void Update(int index, int v){
		int n = index + (_size>>1);
		value[n] += v;
		
		while(n > 0){
			n = (n - 1) / 2;
			value[n] = value[n * 2 + 1] + value[n * 2 + 2];
		}
	}
	
	int _RunQuery(int s, int t, int k, int l, int r){
		if(s <= l && r <= t){
			return value[k];
		}
		if(r < s || t < l){
			return 0;
		}
		return _RunQuery(s, t, 2 * k + 1, l, (l + r) / 2) + _RunQuery(s, t, 2 * k + 2, (l + r) / 2 + 1, r);
	}
	
	int RunQuery(int s, int t){
		return _RunQuery(s, t, 0, 0, (_size>>1));
	}
};

int main(){
	int n, q;
	int com, x, y;
	RangeSumQuery rsq;
	
	cin >> n >> q;
	rsq.Init(n);
	
	for(int i = 0; i < q; ++i){
		cin >> com >> x >> y;
		
		if(com == 0)rsq.Update(x - 1, y);
		else cout << rsq.RunQuery(x - 1, y - 1) << endl;
	}
}

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


using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0; i<int(n); i++)
#define FOR(i,m,n) for(int i=int(m); i<int(n); i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define VI vector<int>
#define VLL vector<long long>
#define VVI vector<vector<int>>
#define VVLL vector<vector<long long>>
#define VC vector<char>
#define VS vector<string>
#define VVC vector<vector<char>>
#define VB vector<bool>
#define VVB vector<vector<bool>>
#define fore(i,a) for(auto &i:a)

typedef pair <int, int> P;
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; }
const int  INF = 1 << 29;
const ll INFL = 1LL << 60;
const ll mod = 998244353;



const int max_V = 205;
vector<int> G[max_V];
vector<int> color(max_V);
int n;

bool dfs(int v, int c) {
	color[v] = c;
	for (int i : G[v]) {
		if (color[i] == c)return false;
		if (color[i] == 0 && !dfs(i, -c))return false;
	}
	return true;
}

bool is_bipartite() {
	REP(i, max_V) {
		if (color[i] == 0) {
			if (!dfs(i, 1))return false;
		}
	}
	return true;
}

int dist[205][205];


int main() {

	
	int n;
	cin >> n;
	REP(i, n)REP(j, n) {
		char a;
		cin >> a;
		if (a == '1') {
			G[i].push_back(j);
			G[j].push_back(i);
		}
	}

	if (!is_bipartite()) {
		cout << -1 << endl;
		return 0;
	}
	REP(i, 205)REP(j, 205) {
		if (i != j)dist[i][j] = INF;
	}
	REP(i, n) {
		for (int j : G[i]) {
			dist[i][j] = 1;
			dist[j][i] = 1;
		}
	}
	
	


	REP(k, n)REP(i, n)REP(j, n) {
		dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
	}
	int ans = 0;

	REP(i, n)REP(j, n) {
		ans = max(ans, dist[i][j]);
	}

	ans++;

	cout << ans << endl;
	



}




Measured memory_bytes: 640
#include <iostream>
#include <vector>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(0);
    int n;
    string s;
    cin >> n >> s;
    vector< vector<bool> > pref(n, vector<bool>(10, false));
    pref[0][s[0] - '0'] = true;
    for (int i = 1; i < n; ++i)
    {
        for (int j = 0; j < 10; ++j)
            pref[i][j] = pref[i - 1][j];
        pref[i][s[i] - '0'] = true;
    }
    vector< vector<bool> > suf(n, vector<bool>(10, false));
    suf[n - 1][s[n - 1] - '0'] = true;
    for (int i = n - 2; i >= 0; --i)
    {
        for (int j = 0; j < 10; ++j)
            suf[i][j] = suf[i + 1][j];
        suf[i][s[i] - '0'] = true;
    }
    vector<bool> jest(1000, false);
    for (int i = 1; i < n - 1; ++i)
    {
        for (int l = 0; l < 10; ++l)
        {
            for (int p = 0; p < 10; ++p)
            {
                int sr = s[i] - '0';
                if (pref[i - 1][l] && suf[i + 1][p])
                    jest[100 * l + 10 * sr + p] = true;
            }
        }
    }
    int odp = 0;
    for (int i = 0; i < 1000; ++i)
        odp += jest[i];
    cout << odp;
    return 0;
}


Measured memory_bytes: 4480
#include <bits/stdc++.h>
#define forn(x, n)              for (int x = 0; x < n; x++)
#define forr(x, n)              for (int x = n; x >= 0; x--)
#define fore(x, a, b, c)        for (int x = a; x <= b; x += c)
#define forre(x, a, b, c)       for (int x = a; x >= b; x -= c)
#define clr                     cin.ignore(numeric_limits<streamsize>::max(), '\n')
#define all(container)          (container).begin(), (container).end()
#define rall(container)         (container).rbegin(), (container).rend()
#define FILL(x, val)            memset(x, val, sizeof(x))
#define sz(container)           ((int) (container).size())
#define pb                      push_back
#define eb                      emplace_back
#define fi                      first
#define se                      second
#define mod                     (ll)1000000007
#define INF                     (int)0x3f3f3f3f

using namespace std;

#ifdef LOCAL_DEFINE
    #include "../../CLionProjects/Codeforces/library/DEBUG.hpp"
#endif

template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }  

typedef long long ll; 
typedef vector<bool> vb;
typedef vector<vector<int>> vvi;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pair<int, int>> vpii;
typedef vector<pair<long long, long long>> vpll;

void solve() {
    int n; cin >> n;
    queue<ll> q;
    for (ll i = 1; i <= 9; i++) q.push(i);
    int cnt = 0;
    while (cnt != n - 1) {        
        ++cnt;
        ll curr = q.front();
        q.pop();
        ll last = curr % 10;
        if (last) q.push(curr * 10 + last - 1);
        q.push(curr * 10 + last);
        if (last < 9) q.push(curr * 10 + last + 1);
    }
    ll ans = q.front();
    cout << ans << '\n';
}

int main(void) {    
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cout << fixed;
#ifdef LOCAL_DEFINE
    freopen("in.txt", "r", stdin);
#endif
    int t = 1; 
//    cin >> t;
    while (t--)
        solve();
#ifdef LOCAL_DEFINE
    cerr << "Time elapsed : " << 1.0 * clock() / CLOCKS_PER_SEC << '\n';
#endif
    return 0;
}

Measured memory_bytes: 1792
import java.util.*;

public class Main {
	public static void main(String[] arg) {
		Scanner in = new Scanner(System.in);
		int A = in.nextInt();
		int B = in.nextInt();
		int C = in.nextInt();
		if (A == B && A != C || A == C && A != B || B == C && A != B) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}

Measured memory_bytes: 23636
#include<iostream>
#define int long long
using namespace std;
int A[2000005];
int B[2000005];
int C[10005];
int n,k=10001;
int CountSort()
{
    for(int i=0;i<k;i++)
        C[i]=0;
    for(int i=1;i<=n;i++)cin>>A[i],C[A[i]]++;
    for(int i=1;i<=k;i++)C[i]+=C[i-1];
    for(int i=n;i>0;i--)B[C[A[i]]]=A[i],C[A[i]]--;
    cout<<B[1];
    for(int i=2;i<=n;i++)cout<<' '<<B[i];
    cout<<endl;
}
signed main()
{
    cin>>n;
    CountSort();
    return 0;
}



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

#define ARG4(_1, _2, _3, _4, ...) _4
#define rep(...) ARG4(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define REP(i, a) FOR(i, 0, a)
#define FOR(i, a, b) for (int i = (a); i < (int)(b); ++i)
#define rrep(...) ARG4(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
#define RREP(i, a) RFOR(i, 0, a)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (int)(a); --i)
#define ALL(c) (c).begin(), (c).end()
#define TEN(n) ((ll)(1e##n))
#define pb emplace_back
#define mp make_pair
#define fst first
#define snd second
#define let const auto
#define USE1(T) template <typename T>
#define USE2(T, U) template <typename T, typename U>
#define I_ inline
#define mygc(c) (c) = getchar_unlocked()
#define mypc(c) putchar_unlocked(c)

USE1(T) using duo = std::pair<T, T>;
USE1(T) using vec = std::vector<T>;
using ll = long long;
// clang-format off
USE2(T,U) I_ bool chmax(T&x,U a){return x<a&&(x=a,1);}
USE2(T,U) I_ bool chmin(T&x,U a){return a<x&&(x=a,1);}
USE1(T=int) I_ T in(){T x;std::cin>>x;return x;}
USE1(T=int) I_ vec<T> in(int n){vec<T> v;v.reserve(n);rep(i,n)v.pb(in<T>());return v;}
USE1(T) vec<T> ndvec(T v,int n){return vec<T>(n, v);}
USE2(T,...Ts) auto ndvec(T v,int n,Ts...ns)->vec<decltype(ndvec(v,ns...))>{return ndvec(ndvec(v,ns...),n);}
USE1(T) I_ void pr(T x){std::cout<<x<<'\n';}
USE2(T,...Ts) I_ void pr(T x,Ts...xs){std::cout<<x<<' ';pr(xs...);}
I_ int re(){int x=0,m=0,k;for(;;){mygc(k);if(k=='-'){m=1;break;}if('0'<=k&&k<='9'){x=k-'0';break;}}for(;;){mygc(k);if(k<'0'||'9'<k)break;x=x*10+k-'0';}return x;}
I_ void wr(int x,char c='\n'){int s=0,m=0;char b[32];if(x<0)m=1,x=-x;for(;x;x/=10)b[s++]=x%10;if(!s)b[s++]=0;if(m)mypc('-');for(;s--;)mypc(b[s]+'0');mypc(c);}
struct IoSetup {
  IoSetup(){
    using namespace std;
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout<<setprecision(10);
    cerr<<setprecision(10);
  }
} iosetup;
// clang-format on
// }}}
using namespace std;
const int inf = 1001001001;
const ll infll = 1001001001001001001ll;
const int dd[] = {0, 1, 0, -1, 0};

signed main() {
  map<char, int> cnt;
  for (char c : in<string>()) {
    cnt[c]++;
  }
  for (auto kv : cnt) {
    if (kv.snd % 2) {
      pr("No");
      return 0;
    }
  }
  pr("Yes");
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>
#include <deque>

using namespace std;

#define mod 1000000007

bool ismin(string s, string t)
{
	if(s.length() < t.length()) return true;
	if(s.length() > t.length()) return false;
	for(int i = 0; i < s.length(); i++){
		if(s[i] < t[i]) return true;
		else return false;
	}
	return true;
}

int main()
{
	string s;
	cin >> s;
	string result[26];
	for(int i = 0; i < 26; i++){
		result[i] = (char)('a' + i);
	}
	for(int i = s.length() - 1; i >= 0; i--){
		char now = s[i];
		string next = now + result[0];
		for(int i = 1; i < 26; i++){
			if(ismin(now + result[i], next)){
				next = now + result[i];
			}
		}
		result[now - 'a'] = next;
	}
	string ans = s;
	for(int i = 0; i < 26; i++){
		if(ismin(result[i], ans)) ans = result[i];
	}
	cout << ans << endl;
}

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

class Main{
    static int binarySearch(int[] tempArray, int n, int key){
        int left = 0;
        int right = n;

        while(left < right){
            int mid = (left + right) / 2;
            if(tempArray[mid] == key){
                return 1;
            }else if(key < tempArray[mid]){
                right = mid;
            }else{
                left = mid + 1;
            }
        }
        return 0;
    }

    public static void main(String[] args){
        int count;
        int[] array1;
        int[] array2;
        int[] array3;
        int flag = 0;

        try{
            Scanner scan = new Scanner(System.in);
            String str = scan.next();

            count = Integer.parseInt(str);

            if(count > 100000){
                throw new Exception("ERROE");
            }
            array1 = new int[count];
            array3 = new int[count];

            for(int i = 0; i < array1.length; i++){
                str = scan.next();
                array1[i] = Integer.parseInt(str);
            }

            str = scan.next();
            count = Integer.parseInt(str);

            if(count > 50000){
                throw new Exception("ERROE");
            }
            array2 = new int[count];
            for(int i = 0; i < array2.length; i++){
                str = scan.next();
                array2[i] = Integer.parseInt(str);
            }


            //配列の確認部分
            // for(int i = 0; i < array1.length; i++){
            //     System.out.print(array1[i] + " ");
            // }
            // System.out.println();
            // for(int i = 0; i < array2.length; i++){
            //     System.out.print(array2[i] + " ");
            // }
            // System.out.println();

            //線形探索
            // count = 0;
            // for(int i = 0; i < array2.length; i++){
            //     for(int j = 0; j < array1.length; j++){
            //         flag = 0;
            //         if(array2[i] == array1[j]){
            //             for(int k = 0; k < count; k++){
            //                 if(array2[i] == array3[k]){
            //                     flag = -1;
            //                     break;
            //                 }
            //             }
            //             if(flag != -1){
            //                 array3[count] = array2[i];
            //                 count++;
            //             }
            //         }
            //     }
            // }

            count = 0;
            for(int i = 0; i < array2.length; i++){
                count +=  binarySearch(array1, array1.length, array2[i]);
            }

            System.out.println(count);

        }catch(Exception e){
            System.out.println("ERROR");
        }

    }
}



Measured memory_bytes: 70132
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <functional>

using namespace std;
 
#define mod 1000003
#define FOR(x,to) for(int x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define long long long
inline int rei(){int x;cin>>x;return x;}
inline long rel(){long x;cin>>x;return x;}
inline string res(){string x;cin>>x;return x;}
//------------------------------------------------------- 
struct Fact{
	vector<long> f;
	vector<long> rf;
	long pow(long N,long K){
		if(K == 0){
			return 1;
		}
		else if(K % 2 == 0){
			long t = pow(N,K/2);
			return t*t%mod;
		}
		else{
			return N*pow(N,K-1)%mod;
		}
	}
	Fact(int N):f(N+1),rf(N+1){
		for(int i=0;i<N+1;i++){
			if(i == 0){
				f[i] = 1;
			}
			else{
				f[i] = (f[i-1]*i)%mod;
			}
		}
		for(int i=N;i>=0;i--){
			if(i == N){
				rf[i] = pow(f[N],mod-2);
			}
			else{
				rf[i] = rf[i+1]*(i+1)%mod;
			}
		}
	}
	long GetFact(int N){
		return f[N];
	}
	long GetRFact(int N){
		return rf[N];
	}
	long GetPerm(int N,int R){
		return f[N] * rf[N-R] % mod;
	}
	long GetConv(int N,int R){
		return ((f[N]*rf[R])%mod*rf[N-R])%mod;
	}
	long GetRev(int N){
		if(N == 0){
			return 1;
		}
		else{
			return rf[N] * f[N-1] % mod;
		}
	}
};
pair<long,long> ExGcd(long a_,long b_){
	long a = a_;
	long b = b_;
	long a1 = 1;
	long a2 = 0;
	long b1 = 0;
	long b2 = 1;
	while(b){
		long c = a % b;
		long c1 = a1 - a / b * b1;
		long c2 = a2 - a / b * b2;
		if(c1 > 0){
			c2 += (c1 / b_) * a_;
			c1 = c1 % b_;
		}
		if(c2 > 0){
			c1 += (c2 / a_) * b_;
			c2 = c2 % a_;
		}
		a = b;
		b = c;
		a1 = b1;
		b1 = c1;
		a2 = b2;
		b2 = c2;
	}
	return {a1,a2};
}
long Pow(long a,long r){
	if(r == 0){
		return 1;
	}
	if(r % 2 == 0){
		long t = a * a % mod;
		return Pow(t,r/2);
	}
	return Pow(a,r-1) * a % mod;
}
void Calc(){
	int Q = rei();
	Fact F(1000002);
	for(int i=0;i<Q;i++){
		int x = rei();
		int d = rei();
		int n = rei();
		if(d == 0){
			cout << Pow(x,n) << "\n";
			continue;
		}
		if(n >= mod){
			cout << 0 << "\n";
			continue;
		}
		pair<long,long> g = ExGcd(d,mod);
		long r = (g.second+d)*x%d;
		r = (d-r)%d;
		long a = x + r*mod;
		a /= d;
		a %= mod;
		long b = a+n-1;
		if(b >= mod){
			cout << 0 << "\n";
			continue;
		}
		long ans = F.GetFact(b) * (a == 0 ? 1 : F.GetRFact(a-1)) % mod;
		ans *= Pow(d,n);
		ans %= mod;
		cout << ans << "\n";
	}

}
int main(int argc,char** argv){
	ios::sync_with_stdio(false), cin.tie(0);
	cout.tie(0); Calc(); return 0;
}

Measured memory_bytes: 16512
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    _, s, _ = LSS()    

    print('A' + s[0] + 'C')

if __name__ == '__main__':
    resolve()


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

#define int long long
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rep1(i,n) for(int i=1;i<=(int)(n);++i)
#define rep11(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define repm(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define sperase(v,n) (v).erase(remove(all(v), n), (v).end())
#define vdelete(v) (v).erase(unique(all(v)), (v).end())
#define pb(n) push_back(n)
#define mp make_pair
#define MOD 1000000007
#define INF 9223372036854775807

int a,b;

signed main() {
    cin >> a >> b;
    if (a+b == 15) cout << "+" << endl;
    else if (a*b == 15) cout << "*" << endl;
    else cout << "x" << endl;
}












Measured memory_bytes: 256
A, B, C = list(map(int, input().rstrip().split()))

result = 'NO'
n = 1
f = A * n % B
m = f
while m != C:
    if 1 < n and m == f:
        break

    n += 1
    m = A * n % B


print('YES' if m == C else 'NO')



Measured memory_bytes: 2940
#include "bits/stdc++.h"
// Begin Header {{{
#define all(x) (x).begin(), (x).end()
#define rep(i, s, n) for (i64 i = (s), i##_limit = (n); i < i##_limit; ++i)
#define repr(i, s, t) for (i64 i = (s), i##_limit = (t); i >= i##_limit; --i)
#define repc(i, s, t) for (i64 i = (s), i##_limit = (t); i <= i##_limit; ++i)
#define var(type, ...) \
    type __VA_ARGS__;  \
    read(__VA_ARGS__);
#ifndef DBG
#define dump(...)
#endif
using namespace std;
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template <class T, class U>
inline bool chmax(T &a, const U &b) {
    return b > a && (a = b, true);
}
template <class T, class U>
inline bool chmin(T &a, const U &b) {
    return b < a && (a = b, true);
}
constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;

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

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

template <class T>
inline istream &operator>>(istream &is, vector<T> &vec) {
    for (auto &e : vec) is >> e;
    return is;
}

inline void read() {}

template <class Head, class... Tail>
inline void read(Head &head, Tail &... tail) {
    cin >> head;
    read(tail...);
}

inline void print() { cout << "\n"; }

template <class Head, class... Tail>
inline void print(Head &&head, Tail &&... tail) {
    cout << head;
    if (sizeof...(tail)) cout << ' ';
    print(forward<Tail>(tail)...);
}

template <class T>
inline ostream &operator<<(ostream &os, const vector<T> &vec) {
    static constexpr const char *delim[] = {" ", ""};
    for (const auto &e : vec) os << e << delim[&e == &vec.back()];
    return os;
}

template <class Container>
struct Rev {
    Container &x_;
    inline Rev(Container &x) : x_(x) {}
    inline auto begin() { return rbegin(x_); }
    inline auto end() { return rend(x_); }
};
// }}} End Header

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.setf(ios_base::fixed);
    cout.precision(12);

    var(string, s, t);
    int cnt = 0;
    rep(i, 0, 3) {
        if (s[i] == t[i]) ++cnt;
    }

    print(cnt);

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#define P 998244353
int main(void){
  int n,k;
  int l[100],r[100];
  int a[400400]={0};
  int i,j;
  scanf("%d%d",&n,&k);
  for(i=0;i<k;i++){
    scanf("%d%d",&l[i],&r[i]);
  }
  a[0]=1;
  for(i=0;i<n;i++){
    for(j=0;j<k;j++){
      a[i+l[j]]=(a[i+l[j]]+a[i])%P;
      a[i+r[j]+1]=(a[i+r[j]+1]-a[i]+P)%P;
    }

    a[i+2]=(a[i+2]+a[i+1])%P;
  }
  printf("%d\n",a[n-1]);
  return 0;
}
  

Measured memory_bytes: 3272
#include<string>
#include<iostream>
#include<cstdio>
using namespace std;
long long k, ans, flg=0; string s;
int main(){
	cin>>s>>k;
	if(s.size() == 1){
		return cout<<k/2<<endl, 0;
	}
	int t = 0 ;
	while(s[t] == s[0]) ++t ;
  	for(int i=0;i<(long long)s.size();++i){
    	int p=i ;
      	while(s[p] == s[i] && p<=(long long)s.size()) ++p;
      	ans += (p-i)/2 ; flg = (s[p-1] == s[0] && p == (long long)s.size() && ((p-i+t+1)%2==1))?1:flg ;
      	if(p == (long long)s.size() && i == 0){
      		return cout<<s.size()*k/2<<endl, 0;	
		}
		i=p-1 ;
    }
  	cout<<(ans*k+(flg?(k-1):(0)))<<endl;
}


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

typedef vector<int> veci;
typedef pair<int,int> pii;
typedef vector<pii> vecii;
typedef long long ll;
typedef pair<ll,ll> pll;
typedef vector<ll> vecl;
typedef vector<pll> vecll;
#define EPS (1e-9)
#define MOD (1e9+7)
#define fi first
#define se second
#define endl '\n'

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
#ifdef LOCAL_TEST    
    int tcs;
    cin >> tcs;
    while (tcs-->0)
#endif        
{
    int n, k;
    cin >> n >> k;

    int a;
    veci mp(200000,0);
    for (int i=0; i<n; ++i) {
        cin >> a;
        mp[a-1]++;
    }

    sort(mp.begin(), mp.end());
    auto it = upper_bound(mp.begin(), mp.end(), 0);

    int res = 0;
    for (auto p=it; p!=mp.end(); ++p) {
        if (mp.end()-p<=k)
            break;
        res += *p;
    }

    cout << res << endl;
}}

Measured memory_bytes: 1024