akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;

int strcmp(string, string);

int main(){
  int n;
  string card_t,card_h;
  int score_t=0;
  int score_h=0;

  cin >> n;
  for(int i=0; i<n; i++){
    cin >> card_t >> card_h;
    //cout << card_t << " "<< card_h << " " << strcmp(card_t, card_h) << endl;
    switch(strcmp(card_t, card_h)){
      case -1:
        score_t+=3;
        break;
      case 1:
        score_h+=3;
        break;
      case 0:
        score_t+=1;
        score_h+=1;
        break;
    }
  }
  cout << score_t << " " << score_h << endl;
  return 0;
}

int strcmp(string s, string t){
  int m;
  if(s.size()>t.size()) m = t.size();
  else m = s.size();
  for(int i=0; i<m;i++){
    if(s[i]<t[i]) return 1;
    else if(s[i]>t[i]) return -1;
  }
  if(s.size()<t.size()) return 1;
  else if(s.size()>t.size()) return -1;
  else return 0;
}


Measured memory_bytes: 3192
#include<iostream>
#include<string>
using namespace std;
int main()
{
	int S,W;
	cin >> S >> W;

	//string s;
	//cin >> s;

	if (S <= W)
	{
		cout << "unsafe" << endl;
	}
	else
	{
		cout << "safe" << endl;
	}
}

Measured memory_bytes: 3632
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <bitset>
#include <queue>
typedef long long ll;
#define rep(i,n) for(int i = 0;i<n;++i)
#define repc(bit,k,n) for (int bit = (1<<k)-1;bit < (1<<n); bit = next_combination(bit))
#define repi(itr,vec) for(auto itr = vec.begin();itr!=vec.end();++itr)
using namespace std;
using Graph = vector<vector<int> >;

/* next combination
 * usage:repc(bit,k,n)
 * */
inline int next_combination(int sub) {
  int x = sub & -sub, y = sub + x;
  return (((sub & ~y) / x) >> 1) | y;
}

/* uniq
 * usage:uniq(vec)
 * */
void uniq(vector<int> &vec){
  sort(vec.begin(), vec.end());
  vec.erase(unique(vec.begin(), vec.end()), vec.end());
  return;
}

/* BinaryIndexedTree
 * usage:update and sum of 1~N
 * */
int N;
int bit[1000010];
void add(int a, int w) {
  for (int x = a; x <= N; x += x & -x) bit[x] += w;
}
int sum(int a) {
  int ret = 0;
  for (int x = a; x > 0; x -= x & -x) ret += bit[x];
  return ret;
}

/* DP
 * usage: chmin(dp[i],dp[i-1]+v);
 * */
const ll INF = 1LL << 60;
ll dp[100010];

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 count(string s,string t){
  ll ret=0;
  rep(i,s.size())if(s[i]==t[i])ret++;
  return ret;
}

int main(){
        ios::sync_with_stdio(false);
        cin.tie(nullptr);
  string s,t;cin>>s>>t;
  vector<ll>ans(s.size()-t.size()+1);
  rep(i,s.size()-t.size()+1){
    ans[i] = count(t,s.substr(i,t.size()));
  }
  sort(ans.begin(),ans.end());
  cout<<t.size()-ans.back()<<endl;


        return 0;
}

Measured memory_bytes: 3644
N,K=[int(s) for s in input().split()]
MOD=10**9+7
a=N-K+2
a+=(N+1)*(N*(N+1)-K*(K-1))//2
a-=N*(N+1)*(2*N+1)//6
a+=K*(K-1)*(2*K-1)//6
print(a%MOD)

Measured memory_bytes: 9188
#include "bits/stdc++.h"

using namespace std;
#ifdef _DEBUG
#define _GLIBCXX_DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
#define ll long long
#define DBG 1
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define loop(n) rep(loop, (0), (n))
#define all(c) begin(c), end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
using pii = pair<int, int>;
// template<class T> ostream &operator<<(ostream &os,T &t){dump(t);return os;}
template <typename T, typename S>istream &operator>>(istream &is, pair<T, S> &p) { is >> p.first >> p.second; return is; }
//template <typename T, typename S>ostream &operator<<(ostream &os, pair<T, S> &p) {os << p.first << " " << p.second;return os;}

template <typename T> void printvv(const vector<vector<T>> &v) {
	cerr << endl;
	rep(i, 0, v.size()) rep(j, 0, v[i].size()) {
		if (typeid(v[i][j]).name() == typeid(INF).name() and v[i][j] == INF) {
			cerr << "INF";
		}
		else
			cerr << v[i][j];
		cerr << (j == v[i].size() - 1 ? '\n' : ' ');
	}
	cerr << endl;
}

#ifndef _DEBUG
#define printvv(...)
#endif
void YES(bool f) { cout << (f ? "YES" : "NO") << endl; }
void Yes(bool f) { cout << (f ? "Yes" : "No") << endl; }
template <class T, class U>bool chmin(T& a, U b) { if (a > b) { a = b; return true; }return false; }
template <class T, class U>bool chmax(T& a, U b) { if (a < b) { a = b; return true; }return false; }

signed main(signed argc, char *argv[]) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(12);

	int D; cin >> D;
	int T = 26;
	vector<int>c(T); rep(i, 0, T) { cin >> c[i]; }

	vector<vector<int>>s(D, vector<int>(T));
	rep(i, 0, D)rep(j, 0, T) { cin >> s[i][j]; }

	vector<int>t(D); rep(i, 0, D) { cin >> t[i]; t[i]--; }

	int score = 0;
	vector<int>last(T);
	rep(i, 0, D) {
		score += s[i][t[i]];
		last[t[i]] = i + 1;
		rep(j, 0, T) {
			score -= c[j] * (i + 1 - last[j]);
		}
		cout << score << endl;
	}

	return 0;
}


Measured memory_bytes: 3708
class Dice(object):

    def __init__(self, nums):
        self.nums = nums
        self.ifaces = [(1,2,3), (2,3,1), (3,1,2),
                       (1,4,2), (4,2,1), (2,1,4),
                       (1,5,4), (5,4,1), (4,1,5),
                       (1,3,5), (3,5,1), (5,1,3),
                       (2,6,3), (6,3,2), (3,2,6),
                       (2,4,6), (4,6,2), (6,2,4),
                       (4,5,6), (5,6,4), (6,4,5),
                       (3,6,5), (6,5,3), (5,3,6),]

    def index(self, num):
        return self.nums.index(num)

    def face(self, iface):
        return [self.nums[i-1] for i in iface]

    def all_face(self):
        for iface in self.ifaces:
            yield self.face(iface)

def is_same(d1, d2):
    for f1 in d1.all_face():
        found = False
        for f2 in d2.all_face():
            if f1 == f2:
                found = True
                break
        if not found:
            return False
    return True

d1 = Dice([int(i) for i in input().split()])
d2 = Dice([int(i) for i in input().split()])

if is_same(d1, d2):
    print('Yes')
else:
    print('No')


Measured memory_bytes: 5612
package main

import (
	"fmt"
	"math"
	"sort"
)

func main() {
	var (
		a int
		b int
		k int
	)

	fmt.Scan(&a, &b, &k)

	var (
		ra int
		rb int
	)

	var ab []int

	cnt := int(math.Min(float64(a), float64(b)))
	i := 1

	for cnt >= i {
		ra = a % i
		rb = b % i

		if ra == 0 && rb == 0 {
			ab = append(ab, i)
		}

		i++
	}

	sort.Sort(sort.Reverse(sort.IntSlice(ab)))

	fmt.Print(ab[k-1])
}


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

int main() {
    string str;
    long long i, size, count=0;
    
    cin >> str;
    size = str.size();
    
    for(i=0; i<size; i++) {
        count += str.at(i)-'0';
    }
    
    if(count%9 == 0)
    cout << "Yes";
    else
    cout << "No";
}






Measured memory_bytes: 3652
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <set>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <utility>


#define FOR(i,b,n) for(int i=b;i<n;i++)
#define RFOR(i,b,n) for(int i=n-1;i>=b;i--)
#define CLR(mat) memset(mat, 0, sizeof(mat))
#define NCLR(mat) memset(mat, -1, sizeof(mat))

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)

using namespace std;

static const double EPS = 1e-9;
typedef long long ll;
typedef pair<int, int> paii;

map< string, vector<int> > book;

void solve()
{
	EACH(i, book)
	{
		cout << i->first << endl;
		
		FOR(j, 0, i->second.size()-1)
		{	
			cout << i->second[j];
			cout <<	' ';
		}
		
		cout << i->second[i->second.size()-1] << endl;
	}
	
	return;
}


int main()
{
	string str;
	int pg;
	
	while(cin >> str, !cin.eof())
	{
		cin >> pg;
		book[str].push_back(pg);
		
		sort(ALL(book[str]));
	}
	
	solve();
	
	return 0;
}

Measured memory_bytes: 1244
#[allow(unused_macros)]
macro_rules! debug {
    ($($arg:tt)*) => (if cfg!(debug_assertions) {print!("[DEBUG] "); eprintln!($($arg)*)});
}

fn main() {
    use std::cmp;
    let mut rd = reader::Reader::new();

    let n = rd.next();
    let a: i64 = rd.next();
    let b: i64 = rd.next();

    let x: Vec<i64> = rd.next_n(n);

    let mut s: i64 = 0;
    for i in 1..n {
        let d = x[i] - x[i - 1];
        s += cmp::min(d * a, b);
    }
    println!("{}", s)
}

mod reader {
    use std::fmt::Debug;
    use std::str::FromStr;
    use std::collections::VecDeque;
    use std::io::{self, Read};

    fn _read_line() -> String {
        let mut buf = String::new();
        let _ = io::stdin().read_to_string(&mut buf);
        buf
    }

    fn _read_vec_deque_string() -> VecDeque<String> {
        _read_line()
            .split_whitespace()
            .map(|s| s.to_string())
            .collect()
    }

    #[allow(dead_code)]
    pub struct Reader {
        buf: VecDeque<String>,
    }

    #[allow(dead_code)]
    impl Reader {
        pub fn new() -> Reader {
            Reader { buf: VecDeque::new() }
        }

        fn update_buf(&mut self) {
            if self.buf.is_empty() {
                self.buf = _read_vec_deque_string();
            }
        }

        pub fn next<T>(&mut self) -> T
            where
                T: FromStr,
                T::Err: Debug,
        {
            self.update_buf();
            self.buf.pop_front().unwrap().parse::<T>().unwrap()
        }

        pub fn next_n<T>(&mut self, n: usize) -> Vec<T>
            where
                T: FromStr,
                T::Err: Debug,
        {
            let mut vec: Vec<T> = Vec::with_capacity(n);

            for _ in 0..n {
                vec.push(self.next());
            }
            vec
        }
    }
}


Measured memory_bytes: 10492
#include<bits/stdc++.h>
using namespace std;
int main(){
int a,b,c;
  cin>>a>>b>>c;
if(a==b&&b==c){
cout<<1<<endl;
}else if(a==b&&b!=c){
cout<<2<<endl;
}else if(a==c&&c!=b){
cout<<2<<endl;
}
  else if(b==c&&c!=a){
  cout<<2<<endl;
  }
  else{
  cout<<3<<endl;
  }
  
  

}

Measured memory_bytes: 256
//#include<stdio.h>
//#include<stdlib.h>
#include<bits/stdc++.h>
//#define Min(a,b,c) min((a),min((b),(c)))
#define mp(a,b) make_pair((a),(b))
#define pii pair<int,int>
#define pll pair<LL,LL>
#define pb(x) push_back(x)
#define x first
#define y second
#define sqr(x) ((x)*(x))
#define EPS 1e-11
#define MEM(x) memset(x,0,sizeof(x))
//#define N 200005
#define M
#define pi 3.14159265359
using namespace std;
typedef long long LL;
vector<LL> ans; 
int main(){
	int n;
	scanf("%d",&n);
	int count[50][50];
	memset(count,0,sizeof(count));
	for(int i=0;i<n;i++){
		char c[100];
		scanf("%s",c);
		for(int j=0;c[j]!=0;j++){
			count[i][c[j]-'a']++;
		}
	}
	for(int i=0;i<26;i++){
		int num=1e9;
		for(int j=0;j<n;j++)
		num=min(count[j][i],num);
		for(int j=0;j<num;j++)
		printf("%c",i+'a'); 
	} 
	printf("\n");
}
/*
Y  * (5y-4)(y+1)*/


Measured memory_bytes: 256
import sys
import fractions

def input():
    return sys.stdin.readline().rstrip()

def lcm(a, b):
    return (a * b) // fractions.gcd(a, b)

if __name__ == "__main__":
    a, b, c, d = map(int, input().split())

    x = ((a-1) // c) + ((a-1) // d) - ((a-1) // lcm(c, d))
    y = (b // c) + (b // d) - (b // lcm(c, d))

    print((b - a + 1) - (y - x))


Measured memory_bytes: 5048
#include <algorithm>
#include <vector>
#include <iostream>
#define MAX 1000000000000000LL

using namespace std;
int main() {
    vector<long long> S({1, 2, 3, 4, 5, 6, 7, 8});
    for (int a = 0; a < 200; a++) {
        if (a % 10 == 9) continue;
        int sum = 0, temp = a;
        while (temp > 0) { sum += temp % 10; temp /= 10; }
        int k = (a + 1 - sum + 8) / 9;
        if (k >= 15) continue;
        long long n = a + 1;
        while (k--) { n *= 10; }
        while (n <= MAX) { S.push_back(n - 1); n *= 10; }
    }
    sort(S.begin(), S.end());
    int k; cin >> k;
    for (int i = 0; i < k; i++) cout << S[i] << endl;
}


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

int main(){
    string s, t;
    cin >> s >> t;
    sort(s.begin(), s.end());
    sort(t.rbegin(), t.rend());
    if (s < t)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

Measured memory_bytes: 3624
import java.util.*;
public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      	char[] s = sc.next().toCharArray();
      	int[] a = new int [26];
      	for(int i = 0; i < s.length; i++){
        	a[s[i]-'a']++;
        }
      	boolean exist = false;
      	for(int i = 0; i < 26; i++){
        	if(a[i] > 1) exist = true;
        }
      
      	if(exist) System.out.println("no");
      	else System.out.println("yes");
    }
}

Measured memory_bytes: 35688
<?php
/*
    http://agc005.contest.atcoder.jp/tasks/agc005_b

    Score  :
    Result :
    Time   : ms
    Memory : KB
 */

ini_set('memory_limit', -1);

// define('DEBUG', true);
define('DEBUG', false);

// test
// $N = 10;
// $a = array(3, 9, 7, 1, 10, 8, 5, 2, 4, 6);

fscanf(STDIN, "%d", $N);
$a = explode(" ", trim(fgets(STDIN)));

$a_address = array_flip($a);
$mmap = array();
$rmap = array();
$area = 0;
$ans = 0;
// var_dump($a_address);

for ($i = $N; $i > 0; $i--) {
    $pos = $a_address[$i];
    // echo "{$i} {$a_address[$i]}\n";
    // $l = array_search($pos - 1, $mmap);
    $l = isset($rmap[$pos-1]);
    $r = isset($mmap[$pos+1]);
    if ($l === false) {
        if ($r === false) {
            // 左も右もない
            $lw = 1;
            $rw = 1;
            $mmap[$pos] = $pos;
            $rmap[$pos] = $pos;
        } else {
            // 右だけある
            $lw = 1;
            $rw = $mmap[$pos+1] - $pos + 1;
            $mmap[$pos] = $mmap[$pos+1];
            $rmap[$mmap[$pos+1]] = $pos;
            unset($mmap[$pos+1]);
        }
    } else {
        if ($r === false) {
            // 左だけある
            $lw = $pos - $rmap[$pos-1] + 1;
            $rw = 1;
            $mmap[$rmap[$pos-1]] = $pos;
            $rmap[$pos] = $rmap[$pos-1];
            unset($rmap[$pos-1]);
        } else {
            // 左も右もある
            $lw = $pos - $rmap[$pos-1] + 1;
            $rw = $mmap[$pos+1] - $pos + 1;
            $mmap[$rmap[$pos-1]] = $mmap[$pos+1];
            $rmap[$mmap[$pos+1]] = $rmap[$pos-1];
            unset($mmap[$pos+1]);
            unset($rmap[$pos-1]);
        }
    }

    // ksort($mmap);
    // $arrTmp = array();
    // foreach ($mmap as $key => $val) {
    //     $arrTmp[] = "{$key}->{$val}";
    // }

    // ksort($rmap);
    // $arrTmp2 = array();
    // foreach ($rmap as $key => $val) {
    //     $arrTmp2[] = "{$key}->{$val}";
    // }

    // $area += $lw * $rw;
    $ans += $lw * $rw * $i;
    // printf("N:%d lw:%d rw:%d map:%s\n", $i, $lw, $rw, implode(" ", $arrTmp));
    // printf("N:%d lw:%d rw:%d\n", $i, $lw, $rw);
    // printf("mmap:%s\n", implode(" ", $arrTmp));
    // printf("rmap:%s\n", implode(" ", $arrTmp2));
}

// echo "area={$area}\n";
echo $ans . PHP_EOL;


Measured memory_bytes: 29168
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define vout(x) rep(i,x.size()) cout << x[i] << " "
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const int inf = 1e9;
const ll inf_l = 1e18;
const int MAX = 100005;

bool check(int x) {
    deque<int> q;
    while (x > 0) {
        q.push_back(x%10);
        x /= 10;
    }
    int tmp = 0;
    while (q.size() != 1) {
        int a = q.front();
        int b = q.back();
        if (a != b) return false;
        q.pop_front(); q.pop_back();
    }
    return true;
}

int main() {
    int a, b; cin >> a >> b;
    int ct = 0;
    for (int i = a; i <= b; i++) {
        if (check(i)) ct++;
    }
    cout << ct << endl;
}

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

#define ll long long

int main()
{
	ll n, m;
	cin >> n >> m;
	string ss;
	cin >> ss;

	for (int i = 0; i < ss.size(); i++)
	{
		if (i == m - 1)
			putchar(tolower(ss[i]));
		else cout << ss[i];
	}
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
  int a, b;
  scanf("%d %d", &a, &b);
  if (a > b)
    printf("%d\n", 2 * a - 1);
  else if (b > a)
    printf("%d\n", 2 * b - 1);
  else
    printf("%d\n", a + b);
}

Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#define ll long long
using namespace std;
inline int read()
{
	int x = 0, f = 1; char ch = getchar();
	while(ch < '0' || ch > '9') {if(ch == '-') f = -1; ch = getchar();}
	while(ch >= '0' && ch <= '9') {x = (x << 3) + (x << 1) + (ch ^ 48); ch = getchar();}
	return x * f;
}
int T,A,B,C,D,k;
ll a,b;
void getAB(int p)
{
	a = A - p / (k + 1) * k - p % (k + 1);
	b = B - p / (k + 1);
}
int main()
{
	T = read();
	while(T --)
	{
		A = read(); B = read(); C = read(); D = read();
		k = (A + B) / (min(A,B) + 1);
		int l = 0,r = A + B,mid;
		while(l < r)
		{
			mid = (l + r) >> 1; getAB(mid);
			if(b <= a * k) l = mid + 1;
			else r = mid;
		}
		getAB(l); r = l + 1 + b - a * k;
		for(int i = C;i <= D;i ++)
		{
			if(i <= l)
			{
				if(i % (k + 1)) cout << 'A';
				else  cout << 'B';
			}
			else
			{
				if((i - r) % (k + 1)) cout << 'B';
				else cout << 'A';
			}
		}
		puts("");
	}
	return 0;
}


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

int main(){
    string S;
    cin >> S;
    if(S[0] == 'S') cout << "Cloudy" << endl;
    else if(S[0] == 'C') cout << "Rainy" << endl;
    else cout << "Sunny" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  string a;
  cin >> a;
  for (int i = 0; i < 3; i++) {
    if (a[i] == '1') {
      a[i] = '9';
    } else {
      a[i] = '1';
    }
  }
  cout << a << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define x first
#define y second
#define all(v) v.begin(), v.end()
#define compress(v) sort(all(v)), v.erase(unique(all(v)), v.end())
using namespace std;

typedef long long ll;

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    int h1, m1, h2, m2, k;
    cin >> h1 >> m1 >> h2 >> m2 >> k;
    int t1 = h1 * 60 + m1, t2 = h2 * 60 + m2;
    int len = t2 - t1;
    cout << len - k;
}

Measured memory_bytes: 3640
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

int main(void) {
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i=0; i<n; i++) {
        cin >> a[i];
        a[i] *= 2;
    }
    sort(a.begin(), a.end());
    auto lb = lower_bound(a.begin(), a.end(), a[n-1]/2);
    if(abs(a[distance(a.begin(), lb-1)] - a[n-1]/2) <= abs(a[distance(a.begin(), lb)] - a[n-1]/2)) {
        cout << a[n-1]/2 << " " << a[distance(a.begin(), lb-1)]/2 << endl;
    } else {
        cout << a[n-1]/2 << " " << a[distance(a.begin(), lb)]/2 << endl;
    }
    return 0;
}


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

int main() {
	
	long long int n,k;
	
	cin>>n>>k;
	
	long long int ans = n%k;
	
	long long int temp = abs(ans - k);
	
	if(temp < ans)
	ans = temp;
	
	cout<<ans;
	
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
   int n,i,j,k,count=0;
   scanf("%d",&n);
   int a[n];
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
  }
  for(j=0;j<n;j++){
    if(a[j]%2==0){
       if(a[j]%3==0 || a[j]%5==0){
         count++;
       }
      
    }
    else if(a[j]%2!=0){
         count++;
    }
  }
  if(count==n)
    printf("APPROVED");
  else
    printf("DENIED");
  return 0;
}

    


          
   
   
   
   

Measured memory_bytes: 128
#pragma GCC optimize("Ofast")
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using ull = unsigned long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define MOD7 1000000007
#define LL_INF 1LL << 60
#define LL_MINF -1LL << 60
#define INT_INF 2000000000
#define INT_MINF -2000000000
#define all(a) (a).begin(), (a).end()
#define fi first
#define se second
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const long double PI = (acos(-1));


int main(){
    vector<string> A;
    while(true){
        string s;
        cin >> s;
        if(s == "-") break;
        int M;
        cin >> M;
        for(int i = 0; i < M; i++){
            int N;
            cin >> N;
            s = s.substr(N) + s.substr(0, N);
        }
        A.push_back(s);
    }
    for(string s : A) cout << s << endl;
}


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

#define rep(i, n) for(int i = 0; i < (n); i++)
#define all(a) (a).begin(),(a).end()
#define SORT(a) sort(all(a))
#define rSORT(a, i) sort(all(a),(i))

using ll = long long;
constexpr ll INF = 10000000000;
constexpr ll MOD = 1000000007;

using namespace std;

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

	sort(all(a));
	sort(all(b));
	sort(all(c));

	ll ans = 0;
	for (ll i = 0; i < n; i++) {
		ll m = lower_bound(all(a), b[i]) - a.begin();		//b[i]よりも{小さい}ものの数を配列aから数える
		ll k = c.end() - upper_bound(all(c), b[i]);			//b[i]よりも{大きい}ものの数を配列bから数える
		ans += (m * k);
	}
	cout << ans << endl;
}


Measured memory_bytes: 2560
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
using namespace std;
#define rep(i, n)for(int i=0; i<n; i++)

int main(){
  int A;
  long long B, N;
  cin >> A >> B >> N;
  //入力終わり

  //xに対してx+Bは同じ値を取る
  //法がBみたいなかんじ

  //最大なのはB-1だが，それがNを超えていてはいけない
  long long m = min(B-1, N);

  cout << A*m/B - A*(m/B) << endl;
  
  return 0;
}


Measured memory_bytes: 3568
//
//  main.cpp
//  atcoder-sushi1
//
//  Created by r on 6/14/19.
//  Copyright © 2019 r. All rights reserved.
//

#include <iostream>
#include <algorithm>
#include <cstring>
#include <iomanip>
#include <fstream>
#include <cmath>
#include <vector>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <map>
#include <stack>
#include <queue>
#include <assert.h>
#include <limits>
#include <cstdio>
using namespace std;

//#define RDEBUG 1
#ifdef RDEBUG
#define D(x) x
#else
#define D(x)
#endif
#define inf 0x7fffffff
#define MOD 1000000007

typedef long long ll;


ll add(ll a, ll b) {
    a += b;
    if(a >= MOD) {
        a -= MOD;
    }
    return a;
}
ll sub(ll a, ll b) {
    a -= b;
    if(a < 0) {
        a += MOD;
    }
    return a;
}
void add_self(ll& a, ll b) {
    a = add(a, b);
}
void sub_self(ll& a, ll b) {
    a = sub(a, b);
}

const ll MAXN = 310;
int N;
ll plates[MAXN];
double dp[MAXN][MAXN][MAXN];
ll s[4];

// dp[i][j][k] needs dp[i-1][j][k], dp[i+1][j-1][k], dp[i][j+1][k-1];

int main() {
    ios_base :: sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> N;
    for (ll i = 0; i<N; i++) {
        cin >> plates[i];
        s[plates[i]]++;
    }
    dp[0][0][0] = 0;
    for (ll k = 0; k<=s[3]; k++) {
        for (ll j = 0; j<=s[2]+s[3]-k; j++) {
            for (ll i = 0; i<=s[1]+s[2]+s[3]-k-j; i++) {
                if (i == 0 && i == j && i == k) {
                    continue;
                }
                double p_hit[4] {(double)(i+j+k)/(N), (double)i/(i+j+k), (double)j/(i+j+k), (double)k/(i+j+k)};
                double c1 = 0, c2 = 0, c3 = 0;
                if (i>0) {
                    c1 = dp[i-1][j][k];
                }
                if (j>0) {
                    c2 = dp[i+1][j-1][k];
                }
                if (k>0) {
                    c3 = dp[i][j+1][k-1];
                }
                dp[i][j][k] = 1/p_hit[0] + p_hit[1]*c1 + p_hit[2]*c2 + p_hit[3]*c3;
            }
        }
    }
    cout << std::fixed;
    cout << setprecision(10);
    cout << dp[s[1]][s[2]][s[3]] << endl;
    return 0;
}





Measured memory_bytes: 225536
#include <iostream>
#include <fstream>
#include <vector>
#include <map>
#include <unordered_map>
#include <string>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <functional>
#include <numeric>
#include <iomanip>
#include <queue>
using namespace std;

typedef int64_t ll;
const ll INF = 1000000000000000000;
#define fori(i, a, b) for (ll i = (a); i < (b); ++i)
#define ford(i, a, b) for (ll i = (b - 1); (a) <= i; --i)
#define rep(i, n) fori(i, 0, n)
#define vll vector<ll>
#define all(v) (v).begin(), (v).end()



int main() {
	ll r;
	cin >> r;
	if (r < 1200) cout << "ABC" << endl;
	else if (r < 2800) cout << "ARC" << endl;
	else cout << "AGC" << endl;


}

Measured memory_bytes: 256
import java.math.*;
import java.io.*;
import java.util.*;

public class Main {
	
    public static void main(String[] args) throws Exception{
    	
       	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
       	String str[] = br.readLine().trim().split("\\s+");
       	BigInteger b1 = new BigInteger(str[0]);
       	BigInteger b2 = new BigInteger(str[1]);
       	if(b1.compareTo(b2) == 0)
       	{
       		System.out.println(0);
       	}
       	else if(b1.compareTo(b2) < 0)
       	{
       		BigInteger b3 = b1.mod(b2);
       		BigInteger b4 = b1.subtract(b2).abs();
       		b4 = b4.min(b3);
       		System.out.println(b4);
       	}
       	else
       	{
       		BigInteger b3 = b1.mod(b2);
       		BigInteger b4 = b3.subtract(b2).abs();
       		b3 = b3.min(b4);
       		System.out.println(b3);
       	}
    }
}

Measured memory_bytes: 22996
#include<bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[])
{
    map<string, int> m;
    m["SUN"] = 7;
    m["SAT"] = 1;
    m["FRI"] = 2;
    m["THU"] = 3;
    m["WED"] = 4;
    m["TUE"] = 5;
    m["MON"] = 6;
    string str;

    cin>>str;
    cout<<m[str]<<endl;
    return 0;
}


Measured memory_bytes: 256
import java.io.*;

class Main{
    public static void main(String[] args){
		try {
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	
			String str = br.readLine();
	        for(int i = str.length() - 1;i >= 0; i--) {
				System.out.print(str.charAt(i));
			}
			System.out.print('\n');
		} catch(Exception e) {
			System.out.print(e);
		}
    }
}


Measured memory_bytes: 16860
#include <bits/stdc++.h>
#define rep(i, n) for(long long int i = 0; i < n; i++)
#define _rep(i, m, n) for(long long int i = m; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int N = 1000000;
const ll mod = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

ll gcd(ll A, ll B){
    if(B == 0)return A;
    return gcd(B, A % B);
}
ll lcm(ll A, ll B){
    return A * B / gcd(A, B);
}

/*------------------------------------------------------------------*/
int main(){
    int n; cin >> n;
    vector<int> c(n - 1);
    vector<int> s(n - 1);
    vector<int> f(n - 1);
    rep(i, n - 1) cin >> c[i] >> s[i] >> f[i];
    _rep(i, 1, n){
        vector<int> time(n, 0);
        _rep(j, i, n){
            int t = max(time[j - 1], s[j - 1]);
            time[j] = (t + f[j - 1] - 1) / f[j - 1] * f[j - 1] + c[j - 1]; 
        }
        cout << time[n - 1] << endl;
    }
    cout << 0 << endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main{

    public static void main(String[] args){

	Scanner sc = new Scanner(System.in);
	int[] table = new int[3];
	int temp = 0;
	
	for(int i=0;i<3;i++){
	    table[i] = sc.nextInt();
	}
	
	int k = sc.nextInt();

	for(int i=0;i<2;i++){
	    
	    for(int j=i+1;j<3;j++){
		if(table[i]<table[j]){
		    temp = table[i];
		    table[i] = table[j];
		    table[j] = temp;
		}
	    }
	}


      	for(int j=0;j<k;j++){
	    
		if(table[0]>table[1]){
		    table[0] = table[0] * 2;
		}else{
		    table[1] = table[1]*2;
		    temp = table[0];
		    table[0] = table[1];
		    table[1] = temp;
		}
	    
	}

	int sum = 0;

	for(int i=0;i<3;i++){
	
	    sum = sum + table[i];
	}
      	System.out.println(sum);
    }
}


Measured memory_bytes: 22100
# DPL 1 A

def solve():
    INF = 1e+9
    n, m = map(int, input().split())
    c = list(map(int, input().split()))

    dp = [[0]*(n+1) for _ in range(m+1)]
    for j in range(n+1):
        dp[0][j] = INF

    for i in range(1, m+1):
        for j in range(1, n+1):
            jj = j - c[i-1]
            if jj < 0:
                dp[i][j] = dp[i-1][j]
            else:
                dp[i][j] = min(dp[i-1][j], dp[i][jj] + 1)

    print(dp[-1][-1])


if __name__ == "__main__":
    solve()



Measured memory_bytes: 43744
#include <stdio.h>

int main(void){
  int H,W;
  scanf("%d%d",&H,&W);

  char str[H*2][W];
  char s[W];
  for(int i = 0;i < H*2;i += 2){
    scanf("%s",s);
    for(int j = 0;j < W;j++){
      str[i][j] = str[i+1][j] = s[j];
    }
  }

  for(int i = 0;i < 2*H;i++){
    for(int j = 0;j < W;j++){
      printf("%c",str[i][j]);
    }
    printf("\n");
  }
  return 0;
}

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

const string YES = "YES";
const string NO = "NO";

void solve(long long N, std::vector<long long> A){
    set<long long> a;
    for (long long i = 0;i<N;i++){
        a.insert(A[i]);
    }
    if (a.size() == N) cout << YES <<endl;
    else cout << NO << endl;

}

// Generated by 1.1.6 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 N;
    scanf("%lld",&N);
    std::vector<long long> A(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&A[i]);
    }
    solve(N, std::move(A));
    return 0;
}


Measured memory_bytes: 11136
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lvector vector<ll>
#define lque queue<ll>
#define lpque priority_queue<ll>
#define dlpque priority_queue<ll,lvector,greater<ll>>
#define P pair<ll,ll>
#define ALL(a) (a).begin(),(a).end()
#define rep(i,n) for(ll (i)=0; (i)<(n); ++(i))
#define print(a) cout << (a) << endl

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n,ans=0;cin>>n;
  lvector p(n,0),mn(n,0);rep(i,n) cin>>p[i];
  mn[0]=p[0];
  for(ll pos=1;pos<n;++pos) mn[pos]=min(mn[pos-1],p[pos]);
  rep(i,n) if(mn[i]>=p[i]) ans++;
  print(ans);
  return 0;
}

Measured memory_bytes: 3456
#include <stdio.h>

int main(void)
{
    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: 1008
/*author : Yashvardhan
Thursday, May 30, 2019
12:40 PM
*/

#include<bits/stdc++.h>
using namespace std;

typedef long long ll;

#define int ll
#define pb push_back
#define vi vector<int>
#define pi pair<int,int>
#define vpi vector<pi>
#define ff first
#define ss second
#define mp make_pair
#define endl '\n'

#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize ("O3")
#pragma GCC optimize ("O2")
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define _CRT_SECURE_NO_WARNINGS

#ifdef __APPLE__
#define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){cerr << name << " : " << arg1 << endl;}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');
	cerr.write(names, comma - names) << " : " << arg1 << "  ";
	__f(comma + 1, args...);}
#else
#define debug(...)
#endif

template <typename T> ostream& operator << (ostream& os,const vector<T>& v){for(int i=0;i<v.size();++i) os<<v[i]<<" ";return os;} 
template <typename T> ostream& operator << (ostream& os,const set<T>& v){for(auto it:v) os<<it<<" ";return os;} 
template <typename T, typename S> ostream& operator << (ostream& os, const pair<T,S>& v) {os<<v.ff<<" "<<v.ss;return os;}

const int mod = 1e9 + 7;
const int inf = 2e18;
const int ninf = -2e18;

string ans;

int pow(int a, int b, int m)
{
	int ans = 1;
	while (b)
	{
		if (b & 1)
			ans = (ans * a) % m;
		b /= 2;
		a = (a * a) % m;
	}
	return ans;
}

void tobin(int n){
	ans = "";
	while(n != 0){
		int q = n/2;
		int rem = n%2;
		n = q;
		ans += to_string(rem);
	}
	reverse(ans.begin(),ans.end());
}
void pad(int len){
	string tmp = "";
	for(int i = 0; i < len ; i++){
		tmp += '0';
	}
	ans = tmp + ans;
}

signed main()
{

	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	#ifdef __APPLE__
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
		freopen("error.txt","w",stderr);
	#endif

	time_t t1, t2;
	t1 = clock();
	
	int n,m;
	cin>>n>>m;

	vi arr[11];
	vi parr(11,0);

	for(int i = 0; i < m ; i++){
		int k;
		cin>>k;
		for(int j = 0; j < k; j++){
			int x;
			cin>>x;
			x--;
			arr[i].pb(x);
		}
	}

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

	int bound = pow(2,n,mod);
	bound--;

	tobin(bound);

	int rl = ans.size();

	vi state(11,0);

	int fin = 0;

	//debug(state);

	for(int i = 0; i <= bound;i++){
		tobin(i);
		if(ans.size() != rl){
			pad(rl - ans.size());
		}

		//cout<<ans<<" "<<i<<endl;
		
		for(int f = 0; f < n ; f++){
			if(ans[f] == '0') state[f] = 0;
			else state[f] = 1;
		}

		//cout<<state<<endl;

		int gc = 0;
		for(int j = 0; j < m ; j++){
			vi swi = arr[j];
			int count = 0;
			for(auto k: swi){
				if(state[k] == 1) count++;
			}
			if(count%2 == parr[j]) gc++;
		}
		if(gc == m) fin++;
		
	}
	cout<<fin<<endl;
	

	t2 = clock();
	cerr<<endl<<t2-t1<<endl;
	
	return 0;
}



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

#define eb emplace_back
#define ff first
#define ss second
#define all(x) x.begin(), x.end()

using namespace std;
using ll = long long;
using ull = unsigned long long;
using Vi = vector<int>;

const int mx = 1e6+7;
vector<int> primes;
bitset<mx>ok;

void siv () {
	ok[1] = 1;
	primes.push_back(2);

	for (int i = 4; i < mx; i += 2) 
		ok[i] = 1;
	for (int i = 3; i * i < mx; i += 2) 
		if (!ok[i])
			for (int j = i*i; j < mx; j+=i) 
				ok[j] = 1;
	for(int i = 3; i < mx; i+=2) 
		if(!ok[i])
			primes.push_back(i);
}

void run() {
    ll n;
    cin >> n;
    int cnt = 0;
    vector<pair<int,int>> facs;

    for (auto i : primes) {
    	if(i > n) break;
    	int temp = 0;
    	if(n%i == 0) {
    		while(n%i == 0) {
    			n/=i;
    			++temp;
    		}
    		// facs.push_back({i, temp});
    		// cerr << i << " " << temp << endl;
    		// temp == 1 ? ++cnt : cnt+=(temp+1)/2;
    		int take = 1;
    		while(take <= temp) {
    			temp -= take;
    			take++;
    			cnt++;
    		}
    	}
    }
    // if(n>1) facs.push_back({n, 1});
    if(n>1) ++cnt;
    /*for (auto i : facs) {
    	cout << i.ff << " " << i.ss << endl;
    }*/
    cout << cnt << endl;
}

int main() 
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
    double st = clock();

    siv();
    int t = 1;
    // cin >> t;

    while(t--) {
        run();
    }

    cerr << "\n" << "time = " << (clock() - st) / CLOCKS_PER_SEC << "\n";
    return 0;
}

Measured memory_bytes: 4056
N = int(input())
Cook = list(map(int, input().split()))
Manzoku = list(map(int, input().split()))
addManzoku = list(map(int, input().split()))

result_sum = 0
past_c = 55

for i, c in enumerate(Cook):
    result_sum += Manzoku[c-1]

    if c - past_c == 1:
        result_sum += addManzoku[c-2]
    past_c = c

print(result_sum)

Measured memory_bytes: 38256
import java.util.*;
 
public class Main{
  public static void main(String args[]) {
    Scanner sc = new Scanner(System.in);
    int N=sc.nextInt(), count=0, a;
    
    for(int i=0; i<N; i++) {
      a = sc.nextInt();
      while(a % 2 == 0) {
        count++;
        a /= 2;
      }
    }
 
    System.out.println(count);   
  }
}

Measured memory_bytes: 35412
#include <iostream>
#include <math.h>
#include <algorithm>
#include <vector>
#include <numeric>
#include <string>
using namespace std;
const double PI = acos(-1.0);
const string alp = "abcdefghijklmnopqrstuvwxyz";
const string ALP = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define SUM(c) accumulate((c).begin(),(c).end(),0)
 
int main(){
  string a,s,c;
  cin >> a >> s >> c;
  cout << 'A' << s[0] << 'C';
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <set>

using lint = long long;

void solve() {
    lint n, k;
    std::cin >> n >> k;
    n %= k;

    std::set<lint> s;
    while (!s.count(n)) {
        s.insert(n);
        n = std::abs(n - k);
    }

    std::cout << *s.begin() << std::endl;
}

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

    solve();

    return 0;
}


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

#define N 9

int ans[N];
int cur[N];
int anspos[N];
int movepos[4] = {-3, 1, 3, -1};

// int trace[1000][N];
int ti=0;

int checkAns() {
  for (int i = 0; i < N; i++) {
    if (ans[i] != cur[i]) return 0;
  }
  return 1;
}

int calcEst() {
  int total = 0, t;
  for (int i = 0; i < N; i++) {
    t = (i % 3) - (anspos[cur[i]] % 3);
    if (t >= 0)
      total += t;
    else
      total -= t;

    t = (i / 3) - (anspos[cur[i]] / 3);
    if (t >= 0)
      total += t;
    else
      total -= t;
  }
  return total;
}

int dfs(int x, int px,int lim) {
  int res = -1, minres = -1;

  int mark[N];

  if (checkAns()) return 0;
  if (lim == 0) return -1;
  if (calcEst() > lim) return -1;
ti++;
  for (int i = 0; i < 4; i++) {
    if (x + movepos[i]==px)continue;
    if ((x%3==0&&movepos[i]==-1)||(x%3==2&&movepos[i]==1)) continue;
    if (x + movepos[i] >= N || x +movepos[i] < 0) continue;
    swap(cur[x], cur[x + movepos[i]]);
    res = dfs(x + movepos[i],x, lim - 1);
    if (res != -1) {
      // return res+1;
      if (minres == -1){

        minres = res + 1;
                // for (int i = 0; i < N; i++) trace[ti][i] = cur[i];
      }

      else {
        minres = min(minres, res + 1);
        // for (int i = 0; i < N; i++) trace[ti][i] = cur[i];
      }
    }
    swap(cur[x], cur[x + movepos[i]]);
  }


ti--;
  return minres;
}

int main() {
  int x, lim = 0, res;

  for (int i = 0; i < N; i++) ans[i] = i + 1;
  ans[N - 1] = 0;
  for (int i = 0; i < N; i++) anspos[i] = i - 1;
  anspos[0] = N - 1;

  for (int i = 0; i < N; i++) {
    cin >> cur[i];
    if (cur[i] == 0) x = i;
  }

  while (true) {
    res = dfs(x,x, lim);
    if (res >= 0) break;
    lim++;
  }
//           for (int i = 0; i < res+2; i++) {
//             for (int j = 0; j < N;j++){ cout << trace[i][j]<<" " ;if (j%3==2)cout <<endl;}
// cout <<"----------" <<endl;
//           }

  cout << res << endl;
  return 0;
}


Measured memory_bytes: 3104
def calc_mod_comb(x, y):
  numerator = 1
  for i in range(y):
    numerator = (numerator * (x-i))%modval
  denominator = 1
  for i in range(1, y+1):
    denominator = (denominator * i)%modval
  denominator = pow(denominator, modval-2, modval)
  return (numerator * denominator)%modval

n, a, b = map(int, input().split())
modval = 10**9+7

a_combs = calc_mod_comb(n, a)
b_combs = calc_mod_comb(n, b)

ans = (pow(2, n, modval) - 1 - a_combs - b_combs)%modval

print(ans)

Measured memory_bytes: 3064
//@winlere
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>

using namespace std;  typedef long long ll;
inline int qr(){
	int ret=0,f=0,c=getchar();
	while(!isdigit(c)) f|=c==45,c=getchar();
	while( isdigit(c)) ret=ret*10+c-48,c=getchar();
	return f?-ret:ret;
}
const int maxn=1e5+5;
vector<int> e[maxn];
void add(int fr,int to){
	e[fr].push_back(to);
	e[to].push_back(fr);
}
int n,m,dep[maxn],val[maxn],sum[maxn],S,T,r[maxn];

void dfs(int now,int last){
	dep[now]=dep[last]+1;
	sum[now]=val[now]=dep[now]&1?-1:1;
	r[now]=last;
	for(auto t:e[now])
		if(!dep[t]) dfs(t,now),sum[now]+=sum[t];
		else if(t!=last&&dep[t]<dep[now]) S=now,T=t;
}

int main(){
	n=qr(); m=qr();
	for(int t=1;t<=m;++t) add(qr(),qr());
	dfs(1,0);
	if(m==n-1){
		if(sum[1]==0){
			int ans=0;
			for(int t=1;t<=n;++t) ans+=abs(sum[t]);
			printf("%d\n",ans);
		}else puts("-1");
	}else if((dep[S]&1)==(dep[T]&1)){
		if(abs(sum[1])&1) puts("-1");
		else {
			int temp=-sum[1]/2,ans=abs(temp);
			while(S) sum[S]+=temp,S=r[S];
			while(T) sum[T]+=temp,T=r[T];
			for(int t=1;t<=n;++t) ans+=abs(sum[t]);
			printf("%d\n",ans);
		}
	}else{
		if(sum[1]==0){
			vector<int> ve;
			while(S!=T) ve.push_back(sum[S]),dep[S]=0,S=r[S];
			sort(ve.begin(),ve.end());
			int mid=ve[(ve.size()+1)/2-1],ans=abs(mid);
			for(int t=1;t<=n;++t)
				if(dep[t]) ans+=abs(sum[t]);
			for(auto t:ve) ans+=abs(t-mid);
			printf("%d\n",ans);
		}else puts("-1");
	}
	return 0;
}


Measured memory_bytes: 14204
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<stack>
#include<algorithm>
typedef long long int ll;
using namespace std;

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define REP(i,n) for (int i=0;i<(n);i++)
#define EREP(i,a) for (int i=1;i<=(a);i++)
const ll MOD = (10*10*10*10*10*10*10*10*10+7);

    int A,B,C;
    int N,M,K,X,Y;
    int ans;
    string S;
    int temp[100]={0};
    bool f=true;

int main(){
    cin>>S;
    for(auto x:S){
        temp[(int)x%26]++;
    }
    REP(i,26){
        if(temp[i]%2==1&&temp!=0){
            f=false;
        }
    }
    f?cout<<"Yes":cout<<"No";
    //cout<<ans;
    return 0;
}


Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author lstd
 */

#include <iostream>
#include <fstream>

#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <bitset>
#include <random>
#include <chrono>
#include <complex>
#include <algorithm>
#include <utility>
#include <functional>
#include <cmath>
#include <cstring>
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <ctime>

using namespace std;

#define sqr(x) ((x)*(x))
#define mp make_pair
#define pb push_back
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define RE(i, n) FOR(i,1,n)
#define REP(i,n) FOR(i, 0, (int)(n)-1)
#define fst first
#define snd second

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
typedef long double ld;

string to_string(string s) {
    return '"' + s + '"';
}

string to_string(const char* s) {
    return to_string((string) s);
}

string to_string(bool b) {
    return (b ? "true" : "false");
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
    return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A>
string to_string(A v) {
    bool first = true;
    string res = "{";
    for (const auto &x : v) {
        if (!first) {
            res += ", ";
        }
        first = false;
        res += to_string(x);
    }
    res += "}";
    return res;
}



void debug_out() { cerr << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << to_string(H);
    debug_out(T...);
}

int XMOV[4] = {0, 0, 1, -1};
int YMOV[4] = {1, -1, 0, 0};

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

using namespace std;

class CEnergyDrinkCollector {
public:
	void solve(std::istream& in, std::ostream& out) {
		int n, m;
		in >> n >> m;
		int x, y;
		vector<pll> b;
		REP(i, n)
			in >> x >> y, b.pb(mp(x,y));
		sort(b.begin(), b.end());
		int i = 0;
		ll ans = 0;
		while(m){
			if (b[i].snd <= m){
				ans += b[i].fst * b[i].snd, m-=b[i].snd;
			}
			else
				ans += b[i].fst * m, m = 0;
			i++;
		}
		out << ans;
	}
};

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

Measured memory_bytes: 2420
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()

int main() {
    int N;
    string S;
    cin >> N >> S;

    int ans = 0;
    rep(i,0,10) {
        int i0 = find(all(S), to_string(i)[0]) - S.begin();
        if (i0 >= N-2) continue;
        rep(j,0,10) {
            int i1 = find(S.begin() + i0 + 1, S.end(), to_string(j)[0]) - S.begin();
            if (i1 >= N-1) continue;
            rep(k,0,10) {
                int i2 = find(S.begin() + i1 + 1, S.end(), to_string(k)[0]) - S.begin();
                if (i2 < N) ans++;
            }
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define IO ios_base::sync_with_stdio(0); cin.tie(0)
#define F first
#define S second
#define pb push_back
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> pii;

ll best[101010][101];

int main() {
  IO;
  int n, W; cin>>n>>W;
  for (int i = 1; i <= n; i++) {
    ll w, v; cin>>w>>v;
    for (int cw = 0; cw <= W; cw++) {
      best[cw][i] = best[cw][i - 1];
      if (cw - w >= 0) {
        best[cw][i] = max(best[cw][i], best[cw - w][i - 1] + v);
      }
    }
  }

  ll ans = 0;
  for (int i = 1; i <= n; i++) ans = max(ans, best[W][i]);
  cout<<ans<<"\n";
}

Measured memory_bytes: 79104
#include<bits/stdc++.h>
using namespace std;
#define il inline
#define ls(x) (x<<1)
#define rs(x) (x<<1|1)
#define gc getchar()
#define ll long long
#define int long long
#define ri register int
#define rc register char
#define rb register bool
#define rp(i,x,y) for(ri i=x;i<=y;++i)
#define my(i,x,y) for(ri i=x;i>=y;--i)
using namespace std;
    
const int N=200000+10,inf=1e18;
int n,q,pre,nw,tag[N<<2];
ll tr1[N<<2],tr2[N<<2];
 
il int read()
{
    rc ch=gc;ri x=0;rb y=1;
    while(ch!='-' && (ch>'9' || ch<'0'))ch=gc;
    if(ch=='-')ch=gc,y=0;
    while(ch>='0' && ch<='9')x=(x<<1)+(x<<3)+(ch^'0'),ch=gc;
    return y?x:-x;
}
il void pushdown(int nw) 
{
    if (!tag[nw])return;
    tag[ls(nw)] += tag[nw];
    tag[rs(nw)] += tag[nw];
    tr1[ls(nw)] += tag[nw];
    tr2[ls(nw)] += tag[nw];
    tr1[rs(nw)] += tag[nw];
    tr2[rs(nw)] += tag[nw];
    tag[nw] = 0;
}
void modify(ri nw,ri l,ri r,ri to,ll dat)
{
	if(l==r){tr1[nw]=min(tr1[nw],dat-to),tr2[nw]=min(tr2[nw],dat+to);return;}
	pushdown(nw);ri mid=(l+r)>>1;to<=mid?modify(nw<<1,l,mid,to,dat):modify(nw<<1|1,mid+1,r,to,dat);
	tr1[nw]=min(tr1[nw<<1],tr1[nw<<1|1]);tr2[nw]=min(tr2[nw<<1],tr2[nw<<1|1]);
}
ll query1(ri nw,ri l,ri r,ri to_l,ri to_r)
{
	if(to_l<=l && r<=to_r)return tr1[nw];
	pushdown(nw);ri mid=(l+r)>>1;ll ret=inf;
	if(to_l<=mid)ret=query1(nw<<1,l,mid,to_l,to_r);
	if(mid<to_r)ret=min(ret,query1(nw<<1|1,mid+1,r,to_l,to_r));
	return ret;
}
ll query2(ri nw,ri l,ri r,ri to_l,ri to_r)
{
	if(to_l<=l && r<=to_r)return tr2[nw];
	pushdown(nw);ri mid=(l+r)>>1;ll ret=inf;
	if(to_l<=mid)ret=query2(nw<<1,l,mid,to_l,to_r);
	if(mid<to_r)ret=min(ret,query2(nw<<1|1,mid+1,r,to_l,to_r));
	return ret;
}
ll query(int l, int r, int nw) 
{
    if (l == r)return (tr1[nw] + l);
    int mid = (l + r) >> 1;pushdown(nw);return (min(query(l, mid, ls(nw)), query(mid + 1, r, rs(nw))));
}
signed main() 
{
//	freopen("2558.in","r",stdin);
    n = read(), q = read(), pre = read();memset(tr1, 63, sizeof(tr1));memset(tr2, 63, sizeof(tr2));modify(1,1,n,read(),0);
    while(q--)
	{
        int nw=read();ll dat=min(query1(1,1,n,1,nw)+nw,query2(1,1,n,nw,n)-nw);
        tag[1]+=abs(nw-pre);tr1[1]+=abs(nw-pre);tr2[1]+=abs(nw-pre);modify(1,1,n,pre,dat);
        pre=nw;
    }
    printf("%lld\n",query(1,n,1));
    return (0);
}

Measured memory_bytes: 18688
a,b = map(int, input().split())
if a != 1 and b != 1:
  if a > b:
    print('Alice')
  elif a == b:
    print('Draw')
  else:
    print('Bob')
elif a == 1 and b == 1:
  print('Draw')
elif a == 1:
  print('Alice')
else:
  print('Bob')

Measured memory_bytes: 3060