akhauriyash/Code-Regression huggingface dataset:
#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 <numeric>
using namespace std;
typedef long long int ll;

#define EPS (1e-7)
#define INF 1e18
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define PI (acos(-1))

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define rep(i, init, n) for(int i = init; i <(int)(n); i++)

int main() {

    int N;
    cin >> N;
    vector<int> C(N, 0), S(N, 0) ,F(N, 0);
    REP(i, N - 1) cin >> C[i] >> S[i] >> F[i];

    REP(i, N){
        int tmp = 0;
        int clock = 0;
        rep(j, i, N - 1){
            if (clock <= S[j]){
                clock = S[j] + C[j];
            }
            else{
                int hoge = (int)ceil((double)clock / (double)F[j]);
                clock = F[j] * hoge + C[j];
            }
        }
        cout << clock << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long lint;
#define repi(i,a,b) for(lint i=(a), i##_len=(b); i<i##_len; ++i)
#define rep(i,n) repi(i,0,n)
#define all(x) (x).begin(),(x).end()
#define tsort(v) sort((v).begin(), (v).end())
#define trev(v) tsort(v); reverse((v).begin(), (v).end())
#define siz(v) ((int)(v).size())
#define ers(v, n) (v).erase((v).begin() + n)
#define cnt(v, n) count(all(v), n)
#define el "\n"
#define co(x) cout<<(x)<<el
#define coc(c, a, b) if(c)co((a));else co((b))
#define YES(c) coc(c,"YES", "NO")
#define Yes(c) coc(c,"Yes", "No")
#define yes(c) coc(c,"yes", "no")
#ifdef tqktmp_1
#define gc() getchar(); getchar()
#else
#define gc() 1
#endif

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

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

    lint a,b;cin>>a>>b;
    coc((a%3)&&(b%3)&&((a+b)%3), "Impossible", "Possible");
}

Measured memory_bytes: 256
# include <bits/stdc++.h>
// #define INF 9223372036854775807
# define INF 1e9
using namespace std;

int main(){

  int N, A, B, C;
  cin >> N >> A >> B >> C;
  int l[N];
  for(int i =0; i< N; i++){
    cin >> l[i];
  }
  vector<vector<int>> q;
  q.push_back({0, 0, 0, 0, 0, 0});
  for(int i=0; i<N; i++){
    vector<vector<int>> temp;
    for(int j=0; j<q.size(); j++){
      temp.push_back(q[j]);
      for(int k=0; k<3; k++){
        q[j][2*k] += l[i];
        q[j][2*k+1] += 1;
        temp.push_back(q[j]);
        q[j][2*k] -= l[i];
        q[j][2*k+1] -= 1;
      }
    }
    q = temp;
  }

  int ans = INF;
  for(int i=0; i < q.size(); i++){
    int v = 0;
    if(q[i][1]*q[i][3]*q[i][5] != 0){
      v += abs(q[i][0]-A) + (q[i][1]-1) * 10;
      v += abs(q[i][2]-B) + (q[i][3]-1) * 10;
      v += abs(q[i][4]-C) + (q[i][5]-1) * 10;
      ans = min(ans, v);
    }
  }
  cout << ans << endl;

}

Measured memory_bytes: 8372
import java.util.*;
public class Main {
	public static void main(String[] args){
       Scanner sc = new Scanner(System.in);   
       //値の取得
       int N = sc.nextInt();
	   long[] A = new long[N];
      for(int i=0;i<N;i++){
        A[i] = sc.nextLong();
      }
      //カウント
      int count = 0;
      
      //割れる回数
      for(int i=0;i<N;i++){
        while(A[i]%2==0){
          A[i]=A[i]/2;
          count++;
        }
      }
      
      System.out.println(count);
    }
}

Measured memory_bytes: 48904
#include <iostream>
#include <vector>
using namespace std;
int main(){
    int n, m, t;
    cin >> n >> m;
    vector<bool>a(n);
    for(int i=0; i<m; i++){
        cin >> t;
        a[t] = 1;
        if(i!=0&&a[t]==a[t-1]){
            cout << 0 << endl;
            return 0;
        }
    }
    vector<int>F(n+1);
    F[0]=1;
    for(int i=0; i<=n; i++){
        if(a[i]) continue;
        F[i] %= 1000000007;
        F[i+1] += F[i];
        F[i+2] += F[i];
    }
    cout << F[n] << endl;
    return 0;
}

Measured memory_bytes: 3708
def s(x):
    if x <= 9:
        return x
    else:
        return x % 10 + s(x // 10)


n, a, b = map(int, input().split())
ans = 0
for i in range(1, n + 1):
    if a <= s(i) <= b:
        ans += i
print(ans)


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

int main(void) {
  int N;
  cin >> N;
  vector<int> A(N);
  vector<int> l(N, -1);
  vector<int> r(N, -1);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }

  for (int i = 1; i < N; i++) {
    l[i] = max(l[i - 1], A[i - 1]);
  }

  for (int i = N - 2; i >= 0; i--) {
    r[i] = max(r[i + 1], A[i + 1]);
  }

  for (int i = 0; i < N; i++) {
    cout << max(l[i], r[i]) << endl;
  }
  return 0;
}

Measured memory_bytes: 3968
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<algorithm>
#include<math.h>
#include<numeric>
#include<iomanip>
#include<deque>
#include<tuple>
#include<queue>
#include<map>
#include <cstdint>
#include <boost/multiprecision/cpp_int.hpp>


#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define vi vector<int>
#define all(x) (x).begin(),(x).end()
#define Endl endl
#define F first
#define S second

namespace mp = boost::multiprecision;

using cpp_int = mp::cpp_int;
using ll = long long;
using namespace std;

int main(){
	int n;
	cin >> n;
	deque<int>b;
	int flag = true;
	rep(i, n) {
		int a;
		cin >> a;
		if (flag) {
			b.push_back(a);
			flag = false;
		}
		else {
			b.push_front(a);
			flag = true;
		}
	}
	if (n % 2 != 0) {
		reverse(all(b));
	}
	rep(i, b.size()) {
		cout << b[i];
		if (i != b.size() - 1) {
			cout << " ";
		}
		else {
			cout << endl;
		}
	};
}

Measured memory_bytes: 2944
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**6)

n = int(input())

if n == 1:
    print(1)
    exit()

a = 2
b = 1
now = 3
count = 2
for i in range(2, n):
    a = b
    b = now
    now = a+b

print(now)


Measured memory_bytes: 9128
import collections
import sys
a=input()
b=[]

for i in a:
  b.append(i)
  
b.sort()
c=collections.Counter(b)
c=list(c.values())

for i in range(len(c)):
  if int(c[i])%2==0:
    q=0
  else:
    q=1
    print('No')
    sys.exit()
    
print('Yes')


Measured memory_bytes: 9372
n = int(input())
tmp = 0
lis = []
for i in range(1, n+1):
    if i % 3 == 0:
        lis.append(i)
    else:
        tmp = i
        while i > 0:
            if i % 10 == 3:
                lis.append(tmp)
                break
            else:
                i //= 10
print(" ", end="")
print(*lis)



Measured memory_bytes: 6124
using System;
using System.Linq;

class IDONTKNOWCSHARP
{
    static int[] abc = new int[26];

    public static void Main()
    {
        string str = Console.ReadLine();

        for (int i = 0; i < str.Length; i++)
        {
            abc[str[i] - 97]++;
        }

        foreach(int aaa in abc)
        {
            if(aaa%2!=0)
            {
                Console.WriteLine("No");
                return;
            }
        }
                Console.WriteLine("Yes");
    }


}

Measured memory_bytes: 25832
import java.util.Scanner;

public class Main {
    public static void main(String[] arg) {
        
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();

        if(a > b){
        System.out.println("a > b");
    }else if(a == b){
            System.out.println("a == b");
    }else{
        System.out.println("a < b");
        }
    }
}


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

int aout(int *a, int i){
  int d=0, sum=0;
  while(1){
    sum += a[d];
    if (sum >= i) break;
    d++;
  }
  return d+1;
}
  

int main(){
  int H, W, n, a[10000], c[100][100], rew, h, w, i;
  cin >> H >> W >> n;
  for(i=0; i<n; i++) cin >> a[i];
  i = 1;
  for(h=0; h<H; h++){
    for(w=0; w<W; w++){
      h%2 == 0 ? rew = w : rew = W-w-1;
      c[h][rew] = aout(a, i);
      i += 1;
    }
  }
  for(h=0; h<H; h++){
    for(w=0; w<W; w++){
      cout << c[h][w] << " ";
    }
    cout << endl;
  }
  return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
	ll n;
	cin>>n;
	ll ans=n/11*2;
	n=n%11;
	if(n>6) ans +=2; else if(n) ans ++;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <queue>

typedef char                SINT8;
typedef unsigned char       UINT8;
typedef short               SINT16;
typedef unsigned short      UINT16;
typedef int                 SINT32;
typedef unsigned int        UINT32;
typedef long long           SINT64;
typedef unsigned long long  UINT64;
typedef double              DOUBLE;

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))
#define rep(i,a,b) for(int (i)=int(a);(i)<int(b);(i)++)

#define INF 1000000001
#define MOD 1000000007
#define INF64 1000000000000000001

#define F first
#define S second

#define Pii pair<SINT32,SINT32>
#define Pll pair<SINT64,SINT64>


using namespace std;

int main() {

	SINT32 A,B,C,N;
	SINT32 ans = 0;

	cin >> A>>B>>C>>N;
	
	rep(i,0,N/A+1) {
		rep(j,0,(N-i*A)/B+1) {
			if (((N - A*i - B*j) % C) == 0) {
				ans++;
				
			}
		}
	}

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

//	sort(DATA.begin(),DATA.end());
//	sort(DATA.begin(),DATA.end(),std::greater<SINT32>());
//	__gcd(ANS,DATA[i]);

//	// DATA.emplace_back(BUF);	//後ろに追加

//  DATA.erase(std::unique(DATA.begin(), DATA.end()), DATA.end());	//ソート後に使用

//	DATA.insert(DATA.begin() + X, 0);	//X番目の要素に0を挿入


//	vector<vector<SINT32>> DP(N,vector<SINT32>(3));	//2次元配列

/*
	SINT32 M = 3;
	vector<pair<SINT32,SINT32>> DATA2(M);
	for (SINT32 i = 0; i < M; i++) {
		cin >> DATA2[i].first;
		cin >> DATA2[i].second;
	}
	sort(DATA2.begin(),DATA2.end());
	cout << DATA2[0].first << endl;
	cout << DATA2[0].second << endl;
*/

// 	vector<pair<int,pair<int,int>>> DATA(M);
//	cin >> DATA[i].first;
//	cin >> DATA[i].second.first;
//	cin >> DATA[i].second.second;


//		APOSI = lower_bound(ADATA.begin(),ADATA.end(),QDATA[i]) - ADATA.begin();	//key以上を探す
//		BPOSI = lower_bound(BDATA.begin(),BDATA.end(),QDATA[i]) - BDATA.begin();


/* 文字列回転
	string N;
	cin >> N;
	N = N[N.length()-1] + N.substr(0,N.length()-1);
*/
/* 文字列合成
	string N,M;
	cin >> N >> M;
	SINT64 ans = 0;
	ans = stoi(N+M);
*/

/*
//ワーシャルフロイド
vector<vector<SINT32>> dist(N,vector<SINT32>(N));
rep(i,0,N) {
	rep(j,0,N) {
		if (i != j) {
			dist[i][j] = INF;
		}
	}
}
rep(k,0,N) {
	rep(i,0,N) {
		rep(j,0,N) {
			dist[i][j] = MIN(dist[i][j], dist[i][k]+dist[k][j]);
		}
	}
}
*/



/* SET コンテナ
	set<SINT32> DATA;
	for (SINT32 i = 0; i < N; i++) {
		SINT32 buf;
		cin >> buf;
		DATA.insert(buf);
	}

	//全表示
    set<string>::iterator it; //  イテレータを用意
    for(it = DATA.begin(); it != DATA.end(); it++) {
        cout << *it << endl;
    }

	//N番目を一部表示
	set<string>::iterator it; //  イテレータを用意
	it = DATA.begin();
	rep (i,0,N) {
		it++;
	}
	cout << *it << endl;
*/

/* map
	map<string,SINT32> mp;
	SINT32 N = 0;
	SINT32 mx = 0;

	cin >> N;
	for (SINT32 i = 0; i < N; i++) {
		string s;
		cin >> s;
		mp[s]++;
	}
	for(auto it=mp.begin();it!=mp.end();it++) {
		mx=max(mx,it->second);
	}
*/

/*
	//順列全表示
	//sortしてからでないと全列挙にならない
	sort(DATA.begin(),DATA.end());
	do {
		cout << buf << endl;
		rep(i,0,R) {
			cout << DATA[i] << " ";
		}
		cout << endl;

    } while (next_permutation(DATA.begin(),DATA.end()));
*/

Measured memory_bytes: 256
using System;

namespace ITP1_9_D
{
    class Program
    {
        static void Main(string[] args)
        {

            string str = Console.ReadLine();
            int q = int.Parse(Console.ReadLine());

            for (int i = 0; i < q; i++)
            {
                string[] input = Console.ReadLine().Split(' ');
                int a = int.Parse(input[1]);
                int b = int.Parse(input[2]);

                switch (input[0])
                {
                    case "print":
                        Console.WriteLine(str.Substring(a, b - a + 1));
                        break;
                    case "reverse":
                        string copy = null;
                        for (int j = b; j >= a; j--)
                            copy += str[j];
                        str = str.Substring(0, a) + copy + str.Substring(b + 1);
                        break;
                    case "replace":
                        str = str.Substring(0, a) + input[3] + str.Substring(b + 1);
                        break;
                    default:
                        break;
                }
            }
        }
    }
}

Measured memory_bytes: 9544
#define scanf_s scanf
//#define gets_s gets
#include <stdio.h>
#include <string>
#include <iostream>
#include <math.h>
using namespace std;
#define MAX 10
#define MIN -100001
#define _MAX 10
int main(void)
{
	int a, b, c, s = 0, h = 0;
	while (scanf_s("%d,%d,%d", &a, &b, &c) != EOF) {
		if (a == b) ++h;
		else if (c*c == a*a + b*b) {
			++s;
		}
	}
	printf("%d\n%d\n", s, h);
}	

Measured memory_bytes: 1184
H, W = gets.split.map(&:to_i)


ans = Float::INFINITY

1.upto(H - 1) do |h|
  areaA = h * W
  w = (W / 2).ceil
  areaB = (H - h) * w
  areaC = (H - h) * (W - w)

  ans = [ans, [areaA, areaB, areaC].minmax.inject(:-).abs].min

  c = ((H - h) / 2).ceil
  areaD = c * W
  areaE = (H - h - c) * W

  ans = [ans, [areaA, areaD, areaE].minmax.inject(:-).abs].min
end

1.upto(W - 1) do |w|
  areaA = w * H
  h = (H / 2).ceil
  areaB = (W - w) * h
  areaC = (W - w) * (H - h)

  ans = [ans, [areaA, areaB, areaC].minmax.inject(:-).abs].min

  c = ((W - w) / 2).ceil
  areaD = c * H
  areaE = (W - w - c) * H

  ans = [ans, [areaA, areaD, areaE].minmax.inject(:-).abs].min
end

puts ans


Measured memory_bytes: 1788
#include <stdio.h>
#include <stdlib.h>

int LinearSearch(int *,int ,int);

int main() {
  int n,q;
  int *T;
  int *S;
  int i;
  int number;
  int count=0;

  scanf("%d",&n);
  //printf("%d\n",n);

  S = (int *)malloc(n * sizeof(int));
  
  for(i=0;i<n;i++) {
    scanf(" %d",&S[i]);
  }

  scanf("%d",&q);

  T = (int *)malloc((q+1) * sizeof(int));
  for(i=0;i<q;i++) {
    scanf(" %d",&T[i]);
  }
  
  for(i=0;i<q;i++) {
    //printf("%d\n",T[1]);
    number=LinearSearch(S,T[i],n);
    if(number!=-1) count++;
    //printf("%d ",T[i]);
  }
  //for(i=0;i<q;i++) printf("%d ",T[i]);
  
   printf("%d\n",count);
  
  return 0;
}

int LinearSearch(int *A,int key,int q) {
  int i=0;
  A[q] = key;
  while(A[i] != key) {
    i++;
    if(i==q) return -1;
  }
  //printf(": %d,%d ",key,A[i]);
  return 1;
}



Measured memory_bytes: 2108
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
const int MAXN = 1e5 + 5, MAXM = 2e5 + 5, BOUND = 2e5, MOD = 45989, INF = 0x3f3f3f3f;
const ll INFL = 0x3f3f3f3f3f3f3f3f;
const double PI = acos(-1.0), eps = 1e-3;
#define mid l + ((r-l)>>1)
#define lson o<<1,l,mid
#define rson o<<1|1,mid+1,r
#define lc(x) c[x][0]
#define rc(x) c[x][1]
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
char gdffsaw;
#define G gdffsaw=getchar()
#define GO G;while(gdffsaw<'-')G
#define in(z) GO;z=gdffsaw&15;G;while(gdffsaw>'-')z*=10,z+=gdffsaw&15,G
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 * 10 + ch - '0'; ch = getchar(); }
	return x * f;
}

char str[MAXN];
int main() {
	ios::sync_with_stdio(false);
	cin >> str;
	char stack[MAXN];
	int h = 0, ans = 0;
	rep(i, 0, strlen(str) - 1) {
		stack[++h] = str[i] - '0';
		while (h >= 2 && stack[h] != stack[h - 1]) {
			ans += 2;
			h -= 2;
		}
	}
	cout << ans << "\n";
	return 0;
}

Measured memory_bytes: 512
using System;
class Example
{
    static void Main()
    {
        while (true)
        {
            string input = Console.ReadLine();
            if (string.IsNullOrEmpty(input))
                break;
            int d = int.Parse(input);
            int s = 0;
            for (int i = 0; i * d < 600; i++)
                s = s + d * d * d * i * i;
            Console.WriteLine(s);
        }
    }
}

Measured memory_bytes: 9148
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}
 
#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};
 
    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
 
    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}
 
#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };
 
    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };
 
    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };
 
    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };
 
    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };
 
    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };
 
    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

use std::collections::BinaryHeap;

fn main() {
    input! {
        n: usize,
        m: usize,
        a: [usize; n],
    }

    let mut q = BinaryHeap::new();

    for i in &a {
        q.push(*i);
    }

    for _ in 0..m {
        let mut tmp = q.pop().unwrap();
        tmp = tmp / 2;
        q.push(tmp);
    }

    let ans : usize = q.iter().sum();

    println!("{}", ans);
}


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

using namespace std;

#define int long long
#define ll long long
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define endl '\n'
#define Endl '\n'
#define cont continue
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) a*b/__gcd(a,b)
#define pb push_back
#define mp make_pair
#define mem(x) memset(x, 0, sizeof(x))

const ll inf=1e18;
const int mod=1e9+7;
inline int bigmod(int B,int P){int R=1;while(P>0){if(P&1){R=(R*B)%mod;}P>>=1;B=(B*B)%mod;}return R;}
const int mxn = 2e5+10;

int Mod(int a) {
	return (a+mod)%mod;
}
int Mul(int a, int b) {
	return Mod(Mod(a) * Mod(b));
}
int Add(int a, int b) {
	return Mod(Mod(a) + Mod(b));
}
//ll fact[mxn];
//ll in_fact[mxn];
//fact[0] = 1;
//for(ll i = 1; i < mxn; i++) {
	//fact[i] = (i*fact[i-1])%mod;
//}
//in_fact[mxn-1] = bigmod(fact[mxn-1],mod-2);
//for(ll i = mxn-2; i >= 0; i--) {
	//in_fact[i] = (in_fact[i+1] * (i+1))%mod;
//}
//ll c(ll n,ll r) {
	//ll ans = (fact[n] * (in_fact[r] * in_fact[n-r]%mod))%mod;
	//return ans;
//}

signed main(){
    fast;
	//freopen ("input.txt", "r", stdin);
	//freopen ("output.txt", "w", stdout);
    int tt = 1;
    //cin>>tt;
    for(int tc = 1; tc <= tt; tc++) {
        int n;
        cin>>n;
        int ten = 1,nin = 1,eig = 1;
        for(int i = 0; i < n; i++) {
			ten = Mul(ten,10);
			nin = Mul(nin,9);
			eig = Mul(eig,8);
		}
		nin = Mul(nin,2);
		int ans = Mod(ten - nin + eig);
		cout<<ans<<endl;
		//nin = Mul(nin,2);
		//ten = ten-nin;
		//ten = Add(ten,eig);
		//cout<<ten<<endl;
		//cout<<ten-fck<<endl;
        
    }



return 0;
}


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


using namespace std;




int main() 
{
    int n;cin>>n;
   unordered_set<string>s;
   for(int i=0;i<n;i++)
   {
       string a;cin>>a;
       s.insert(a);
   }
   cout<<s.size();
}


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

#define int long long
#define itn int
#define For(i, a, b) for (int i = (a); i <= static_cast<int>(b); i++)
#define Forr(i, a, b) for (int i = (a); i >= static_cast<int>(b); i--)
#define rep(i, n) For(i, 0, n - 1)
#define repall(i, arr) for (auto& i : (arr))
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define dump(x) cerr << #x << " = " << (x) << '\n'
#define dump2(x, y) \
    cerr << #x << " = " << (x) << " " << #y << " = " << (y) << '\n'
#define SZ(x) ((int)(x).size())
#define bit(n) (1LL << (n))
constexpr int MOD = 1e9 + 7;

template <typename T>
using pq = priority_queue<T>;
template <typename T>
using pqr = priority_queue<T, vector<T>, greater<T>>;
const int INF = LLONG_MAX / 2;
using P = pair<int, int>;
using vec = vector<int>;
template <typename T>
using mat = vector<vector<T>>;

// clang-format off
template <typename T1, typename T2>
ostream& operator<<(ostream& stream, const pair<T1, T2>& p) { return stream << p.first << "," << p.second; }
template <typename T>
void print(const vector<T> vec) { rep (i, vec.size() - 1) cout << vec[i] << ' '; cout << vec[vec.size() - 1] << '\n'; }
template <typename Arg>
void print(const Arg arg) { cout << arg << '\n'; }
template <typename Head, typename... Args>
void print(const Head head, const Args... args) { cout << head << " "; print(args...); }
template <typename T, typename U>
void init(vector<T>& v, vector<U>& w) { rep (i, v.size()) cin >> v[i] >> w[i]; }
template <typename T>
void init(vector<T>& v) { rep (i, v.size()) cin >> v[i]; }
template <typename T>
T sum_(vector<T> vec, T init = 0) { return std::accumulate(all(vec), T(init)); }
template<typename T>
bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } return false; }
template<typename T>
bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } return false; }
template <typename T>
int index(const T& vec, const typename T::iterator it) { return distance(vec.begin(), it); }
template <typename T = int>
mat<T> mmat(int n, int m=0) { return mat<T>(n, vector<T>(m)); }
template <typename T = int>
vector<T> ivec(int n) { vector<T> v(n); init(v); return v; }
// clang-format on

void yn(bool tf) { print(tf ? "Yes" : "No"); }
void YN(bool tf) { print(tf ? "YES" : "NO"); }

int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
// -------------------------------------------------------------------
// sort 1 2 3 4
// pqr 1 2 3 must impl >

signed main() {
    cin.tie(0), cout.tie(0), ios::sync_with_stdio(false);
    double a, b, x;
    cin >> a >> b >> x;
    double h = x / a / a;
    double dif = b - h;

    if (h > b / 2) {
        dif *= 2;
        cout << setprecision(10) << atan2(dif, a) / M_PI * 180 << endl;
    } else {
        double l = x / a * 2 / b;
        cout << setprecision(10) << atan2(b, l) / M_PI * 180 << endl;
    }

    return 0;
}


Measured memory_bytes: 512
from collections import deque

N, M, K = map(int, input().split())

f = [set() for _ in range(N + 1)]
b = [set() for _ in range(N + 1)]

for _ in range(M):
    f1, f2 = map(int, input().split())
    f[f1].add(f2)
    f[f2].add(f1)

for _ in range(K):
    b1, b2 = map(int, input().split())
    b[b1].add(b2)
    b[b2].add(b1)


dq = deque()
ans = [0] * (N + 1)
visited = [False] * (N + 1)

for i in range(1, N + 1):

    # iを含む連結リストが既に作られている場合はスキップ
    if visited[i]:
        continue

    # setは{}で書く、後で積集合が楽に取れる
    link = {i}
    dq.append(i)
    visited[i] = True

    # DFS
    while dq:
        n = dq.pop()
        # nのフレンド全員について
        for j in f[n]:
            # まだ訪れていないノードの場合
            if not visited[j]:
                link.add(j)
                dq.append(j)
                visited[j] = True

    for user in link:
        # 全体-既にフレンドの人数-ブロックした人数-自分自身
        # set同士で積集合をとる
        ans[user] = len(link) - len(link & f[user]) - len(link & b[user]) - 1

print(*ans[1:])


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

using namespace std;
#define IOS cin.sync_with_stdio(0); cin.tie(0); cout.tie(0);

using ll = long long;
using ld = long double;

#define pb push_back
#define pii pair<int,int>
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()

const int mod = 1e9+7;

const int N = 3005;


 
int main(){
   IOS

   int n; cin>>n;

   vector<double> dp(N);

   dp[0] = 1;

   for(int coin  = 0; coin < n; ++coin){
       double p_heads;
       cin>>p_heads;

    
       for(int i  = coin + 1; i >= 0; --i){
           dp[i] = (i==0 ? 0 : dp[i-1])*p_heads + dp[i]*(1-p_heads);
       }
   }

   double ans = 0.0;
   for(int h = 0; h <= n; h++){
       int t = n-h;
       if(h > t){
           ans += dp[h];
       }
   }

   printf("%.10lf\n", ans);



   
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>
#include <climits>
#include <sstream>
using namespace std;
static const double EPS = 1e-5;
typedef long long ll;

string FB(int n){
	if(n%3==0 && n%5==0)return "FizzBuzz";
	if(n%3==0)return "Fizz";
	if(n%5==0)return "Buzz";
	stringstream ss;
	ss<<n;
	return ss.str();
}

main(){
	int m,n;
	while(scanf(" %d%d ",&m,&n),m){
		set<int> play;
		for(int i=0;i<m;i++)play.insert(i);
		
		int cur=0;
		for(int i=0;i<n;i++){
			string word;
			cin>>word;
			if(play.size()==1)continue;
			while(play.count(cur)==0 && !play.empty())cur=(cur+1)%m;
			if(word==FB(i+1))cur=(cur+1)%m;
			else play.erase(cur),cur=(cur+1)%m;
		}
		if(!play.empty())cout<<*play.begin()+1;
		set<int>::iterator p=play.begin();
		for(++p;p!=play.end();++p)cout<<" "<<*p+1;
		cout<<endl;
	}
}

Measured memory_bytes: 1004
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define int long long
#define _GLIBCXX_DEBUG

signed main() {
  int N; cin >> N;
  vector<int> a(N);
  rep(i, N) cin >> a[i];
  unordered_map<int,int> two;

  rep(i, N) {
    if(a[i]%4 == 0) two[2]++;
    else if(a[i]%2 == 0) two[1]++;
    else two[0]++;
  }
  if(two[2] >= two[0] || (two[1]==0&&two[2]>=two[0]-1)) cout << "Yes" << endl;
  else cout << "No" << endl;

}

Measured memory_bytes: 1024
use std::io::stdin;
use std::str::FromStr;

fn read_line<T>() -> Vec<T>
where
    T: FromStr,
    <T as std::str::FromStr>::Err: std::fmt::Debug,
{
    let mut s = String::new();
    stdin().read_line(&mut s).ok();
    s.trim()
        .split_whitespace()
        .map(|x| x.parse().unwrap())
        .collect()
}

fn read_str_as_char_vec() -> Vec<char> {
    let mut s = String::new();
    stdin().read_line(&mut s).ok();
    s.trim().chars().collect()
}

fn read_str_as_T<T>() -> T
where
    T: FromStr,
    <T as std::str::FromStr>::Err: std::fmt::Debug,
{
    let mut s = String::new();
    stdin().read_line(&mut s).ok();
    s.trim().parse().unwrap()
}

fn main() {
    let n: usize = read_line()[0];

    if vec![2, 4, 5, 7, 9].contains(&(n % 10)) {
        println!("hon");
    } else if vec![0, 1, 6, 8].contains(&(n % 10)) {
        println!("pon");
    } else {
        println!("bon");
    }
}


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

int main() {
    ll a;
    cin >> a;
    double b;
    cin >> b;
    ll ib = b*100+0.5; // 189.99999とかになることがあるから+0.5しておく
    a *= ib;
    a /= 100;
    printf("%lld\n", a);

    return 0;
}

Measured memory_bytes: 3756
#include <iostream>
#include <cstdlib>
#include <algorithm>

using namespace std;

int main(void) {
  int n;
  int d[101];
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> d[i];
  }

  sort(d, d + n);
  int *u = unique(d, d + n);
  int res = distance(d, u);
  cout << res << endl;
  return EXIT_SUCCESS;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <cctype>
#include <algorithm>
#include <functional>
#include <utility>
#include <vector>
using ll = long long;
const ll ha = 1000000007LL;

const int maxn = 305;
ll d[maxn][maxn][maxn];
int lim[maxn][4], n;
inline bool is_available(int i, int j, int k) {
  if(i < j) std::swap(i, j);
  if(i < k) std::swap(i, k);
  if(j < k) std::swap(j, k);
  assert(i >= j && j >= k);
  if(lim[i][3]) {
    int l = lim[i][3];
    if(k < l) return false;
  }
  if(lim[i][2] <= n) {
    int l = lim[i][2];
    if(k >= l || j < l) return false;
  }
  if(lim[i][0]) {
    int l = lim[i][0];
    if(k >= l || j < l) return false;
  }
  if(lim[i][1] <= n) {
    int l = lim[i][1];
    if(j >= l) return false;
  }
#ifdef LOCAL
  printf("OK state (%d, %d, %d)\n", i, j, k);
#endif
  return true;
}
inline void extend(int i, int j, int k) {
  const int th = std::max(i, std::max(j, k));
  const int nx = th + 1;
  const ll val = d[i][j][k];
  if(!val) return;
#ifdef LOCAL
  printf("d[%d][%d][%d] : %lld\n", i, j, k, val);
#endif
  if(is_available(nx, j, k)) {
    d[nx][j][k] = (d[nx][j][k] + val) % ha;
  }
  if(is_available(i, nx, k)) {
    d[i][nx][k] = (d[i][nx][k] + val) % ha;
  }
  if(is_available(i, j, nx)) {
    d[i][j][nx] = (d[i][j][nx] + val) % ha;
  }
}

int main() {
  int m; scanf("%d%d", &n, &m);
  for(int i = 0; i <= n; i ++) {
    lim[i][1] = lim[i][2] = n + 1;
  }
  for(int i = 1; i <= m; i ++) {
    int l, r, t; scanf("%d%d%d", &l, &r, &t);
    if(t == 1) {
      lim[r][1] = std::min(lim[r][1], l);
    } else if(t == 2) {
      lim[r][0] = std::max(lim[r][0], l);
      lim[r][2] = std::min(lim[r][2], l);
    } else {
      lim[r][3] = std::max(lim[r][3], l);
    }
  }
  d[0][0][0] = 1;
  for(int i = 0; i < n; i ++) {
    extend(i, 0, 0);
    if(i > 0) extend(0, i, 0);
    if(i > 0) extend(0, 0, i);
    for(int j = 0; j < i; j ++) {
      for(int k = 0; k < j; k ++) {
        extend(i, j, k);
        extend(i, k, j);
        extend(j, i, k);
        extend(j, k, i);
        extend(k, i, j);
        extend(k, j, i);
      }
    }
  }
  ll ans = d[n][0][0] + d[0][n][0] + d[0][0][n];
  for(int j = 0; j < n; j ++) {
    for(int k = 0; k < j; k ++) {
      int i = n;
      ans += d[i][j][k];
      ans += d[i][k][j];
      ans += d[j][i][k];
      ans += d[j][k][i];
      ans += d[k][i][j];
      ans += d[k][j][i];
      ans %= ha;
    }
  }
  printf("%lld\n", ans);
  return 0;
}

Measured memory_bytes: 219264
#include<vector>
#include<stack>
#include<algorithm>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<queue>
#include<string>
#include<cstring>
using namespace std;
#define INF 1<<30
const int maxn = 3e5 + 7;
int n;
string s;
int w[maxn] = { 0 }; //从左到右 第i个位置共有w的个数
int e[maxn] = { 0 }; ////从右到左 第i个位置共有e的个数
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin >> n >> s;
	for (int i = 0; i < n; i++)
	{
		if (s[i] == 'W')
			w[i] = w[i - 1] + 1;
		else
			w[i] = w[i - 1];
	}
	for (int i = n - 1; i >= 0; i--)
	{
		if (s[i] == 'E')
			e[i] = e[i + 1] + 1;
		else
			e[i] = e[i + 1];
	}
	int ans = INF;
	for (int i = 0; i < n; i++)
	ans = min(ans, w[i - 1] + e[i + 1]);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 2964
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(100000)


def main():
    n, m = [int(i) for i in input().strip().split()]
    s1 = min(n, m // 2)
    s2 = (m - s1 * 2) // 4
    print(s1 + s2)


if __name__ == "__main__":
    main()


Measured memory_bytes: 61876
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		if (A * B * C == 175) {
			System.out.print("YES");
		}else {
			System.out.print("NO");			
		}
	}
}

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

using namespace std;
#define rep(i,n) for(long long i=0; i<(long long)(n);i++)
//rep…「0からn-1まで」の繰り返し
#define rep2(i,s,n) for(long long i=s; i<=(long long)(n);i++)
//rep2…「sからnまで」の繰り返し
#define repr(i,s,n) for(long long i=s;i>=(long long)(n);i--)
//repr…「ｓからnまで」の降順の繰り返し

typedef long long ll;

const int inf = 1e9+7;
const int mod = 1e9+7;


int main(){
    ll n,q;
    string s;
    cin>>n>>q>>s;

    vector<ll>l(q),r(q);
    rep(i,q)cin>>l[i]>>r[i];

    vector<ll>cnt(n+1);
    rep2(i,0,n-2){
        if(s[i]=='A'&&s[i+1]=='C'){
            cnt[i+2]=cnt[i+1]+1;
        }
        else cnt[i+2]=cnt[i+1];
    }

    rep(i,q){
        cout<<cnt[r[i]]-cnt[l[i]]<<endl;
    }

}


Measured memory_bytes: 3456
# D - Christmas

N, X = map(int, input().split())

height = [1] # レベルiバーガーの高さ
for _ in range(N):
    height.append(height[-1]*2 + 3)
    
patty = [1] # レベルiバーガーに含まれるパティの総数
for _ in range(N):
    patty.append(patty[-1]*2 + 1)

def dp(n,x): # レベルnバーガーの下からx個の層に含まれるパティの数
    if n == 0:
        return 1
    elif x == 1:
        return 0
    elif x <= 1 + height[n-1]:
        return dp(n-1, x-1)
    elif x == 2 + height[n-1]:
        return patty[n-1] + 1
    elif 2 + height[n-1] < x <= height[n] - 1:
        return patty[n-1] + 1 + dp(n-1, x - (height[n-1] + 2))
    else:
        return patty[n]
    
print(dp(N,X))

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

using P = pair<short, short>;
using T = pair<short, P>;

int h, w, l, p;
short g[4010][4010];
short s[2][4010][4010];

struct FenwickTree {
	FenwickTree(){ init(); }
	void init(){
		fill(begin(v), end(v), 0);
	}
	void add(int k, short x){
		k++;
		while (k < 4010){
			v[k] += x;
			k += k & -k;
		}
	}
	short sum(int k){
		k = max(0, min<int>(4009, k));
		int s = 0;
		while (k){
			s += v[k];
			k -= k & -k;
		}
		return s;
	}
	short sum(int l, int r){
		return sum(r) - sum(l);
	}

private:
	short v[4010];
};

int main()
{
	scanf("%d %d %d %d", &h, &w, &l, &p);
	for (int i = 1; i <= h; i++){
		for (int j = 1; j <= w; j++){
			g[i][j] = 1;
		}
	}
	for (int i = 0; i < p; i++){
		int a, b;
		scanf("%d %d", &a, &b);
		g[a][b] = 0;
	}

	for (int i = 1; i <= h; i++){
		for (int j = 1; j <= w; j++){
			s[0][i][j] = s[1][i][j] = 9999;
		}
	}

	for (int i = 1; i <= h; i++){
		short t = 0;
		for (int j = 1; j <= w; j++){
			t = g[i][j] ? t + 1 : 0;
			s[0][i][j] = min(s[0][i][j], t);
		}
	}
	
	for (int j = 1; j <= w; j++){
		short t = 0;
		for (int i = 1; i <= h; i++){
			t = g[i][j] ? t + 1 : 0;
			s[0][i][j] = min(s[0][i][j], t);
		}
	}

	for (int i = 1; i <= h; i++){
		short t = 0;
		for (int j = w; j >= 1; j--){
			t = g[i][j] ? t + 1 : 0;
			s[1][i][j] = min(s[1][i][j], t);
		}
	}

	for (int j = 1; j <= w; j++){
		short t = 0;
		for (int i = h; i >= 1; i--){
			t = g[i][j] ? t + 1 : 0;
			s[1][i][j] = min(s[1][i][j], t);
		}
	}

	int offset = w - 1;
	/*
	vector<vector<T>> vs(h + w - 1);
	for (int i = 1; i <= h; i++){
		for (int j = 1; j <= w; j++){
			int k = vs[i - j + offset].size() / 2;
			vs[i - j + offset].emplace_back(s[1][i][j], P(0, k));
			vs[i - j + offset].emplace_back(s[0][i][j], P(1, k));
		}
	}
	*/

	vector<pair<int, int>> ss;
	for (int i = 1; i <= h; i++) ss.emplace_back(i, 1);
	for (int i = 2; i <= w; i++) ss.emplace_back(1, i);
	
	long long res = 0;
	vector<FenwickTree> tr(2);
	for (auto sp : ss){
		vector<T> v;
		while (sp.first <= h && sp.second <= w){
			int k = v.size() / 2;
			v.emplace_back(s[1][sp.first][sp.second], P(0, k));
			v.emplace_back(s[0][sp.first][sp.second], P(1, k));
			sp.first++; sp.second++;
		}
		
		tr[0].init(); tr[1].init();
		sort(begin(v), end(v), greater<T>());
		for (auto t : v){
			tr[t.second.first].add(t.second.second, 1);
			if (t.second.first == 0){
				int ll = t.second.second + l - 1;
				int rr = t.second.second + t.first;
				if (ll < rr) res += tr[1].sum(ll, rr);
			}
			else {
				int ll = t.second.second - t.first + 1;
				int rr = t.second.second - l + 2;
				if (ll < rr) res += tr[0].sum(ll, rr);
			}
		}
		v.clear();
		v.shrink_to_fit();
	}
	
	printf("%lld\n", res);
}

Measured memory_bytes: 97356
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n int
	fmt.Scan(&n)

	dList := []int{}
	for i := 0; i < n; i++ {
		var d int
		fmt.Scan(&d)
		dList = append(dList, d)
	}

	sort.Sort(sort.IntSlice(dList))

	max := 0
	cnt := 0
	for _, val := range dList {
		if max < val {
			cnt++
			max = val
		}
	}

	fmt.Println(cnt)
}


Measured memory_bytes: 512
#!/usr/bin/python
# -*- coding: UTF-8 -*-

import sys
import re


def std_in():
    return sys.stdin.readline().strip()


def first_match_of_pattern(text, pattern):
    if type(text) != str:
        text = str(text)

    re_patter = re.compile(pattern)
    ans = re_patter.findall(text)
    if ans:
        return ans[0]
    return ""


def _main():
    s = std_in()
    az = [chr(i) for i in range(97, 97+26)]
    for c in az:
        p = r"[" + c + r"][a-z][" + c + "]"
        mt = first_match_of_pattern(s, p)
        if mt != "":
            first = s.find(mt) + 1
            end = first + len(mt) - 1
            print(first, end)
            break

        p = r"[" + c + r"][" + c + "]"
        mt = first_match_of_pattern(s, p)
        if mt != "":
            first = s.find(mt) + 1
            end = first + len(mt) - 1
            print(first, end)
            break
    else:
        print(-1, -1)


if __name__ == "__main__":
    _main()


Measured memory_bytes: 10032
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,ceil,sqrt,factorial,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    N=I()
    S=LIN(N)
    can = set([0])
    for s in S:
        for c in can.copy():
            can.add(c+s)
    for c in sorted(can,reverse=True):
        if c%10!=0:
            print(c)
            exit()
    print(0)
if __name__ == '__main__':
    main()

Measured memory_bytes: 51440
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1000000000000000
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

void print(const std::vector<int> &v) {
    std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
    std::cout << std::endl;
}

int main() {
    string N;
    cin >> N;
    bool flag = false;
    REP(i, N.length()) {
        if(N[i] == '9') {
            flag = true;
        }
    }
    if(flag) {
        cout << "Yes" << endl;
        return 0;
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
using namespace std;
#include<bits/stdc++.h>
#define int long long
#define pb push_back 
#define IOS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define repa(i,a,b) for (int i=a; i<=b; i++)
#define repd(i,b,a) for (int i=b; i>=a; i--)
#define endl "\n"
//debugging
#define debug1(a) cout<<#a<<" = "<<(a)<<endl;
#define debug2(a,b) cout<<#a<<" = "<<(a)<<", "<<#b<<" = "<<(b)<<endl;
#define debug3(a,b,c) cout<<#a<<" = "<<(a)<<", "<<#b<<" = "<<(b)<<", "<<#c<<" = "<<(c)<<endl;
#define debug4(a,b,c,d) cout<<#a<<" = "<<(a)<<", "<<#b<<" = "<<(b)<<", "<<#c<<" = "<<(c)<<", "<<#d<<" = "<<(d)<<endl;

const int N = 1e+6+5;
int big = 1e+18+3;
int mod = 998244353;


vector<int> fac, ifac;

int power (int base, int exp, int mod)
{
    int res = 1;
    base%=mod;
    while(exp)
    {
        if (exp & 1)
        {
            res*=base;
            res%=mod;
        }
        exp>>=1;
        base*=base;
        base%=mod;
    }
    return res;
}

int inv (int arg, int mod)
{
    return power(arg, mod-2, mod);
}

void preCompute(int sz)
{
    fac.resize(sz+1);
    ifac.resize(sz+1);
    fac[0]=1;
    for (int i=1; i<=sz; i++)
    {
        fac[i]=fac[i-1]*i;
        fac[i]%=mod;
    }
    ifac[sz]=inv(fac[sz],mod);
    for (int i=sz-1; i>=0; i--)
        ifac[i]=(ifac[i+1]*(i+1))%mod;
}

int nCr (int n, int r)
{
    if (n>=r && r>=0)
        return (((fac[n]*ifac[n-r])%mod)*ifac[r])%mod;
    return 0;
}

signed main()
{
    IOS;
    preCompute(200005);

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

    int ans = 0;

    for (int i=n-1-k; i<=n-1 ; i++)
    {
        int cur_ans = nCr(n-1,i);
        cur_ans*=m;
        cur_ans%=mod;
        cur_ans*=power((m-1),i,mod);
        cur_ans%=mod;
        ans+=cur_ans;
        ans%=mod;
    }    

    cout<< ans <<endl;
    
}

Measured memory_bytes: 6316
#!/usr/bin/env python3
import sys


def solve(N: int):
    print(N*(N-1)//2)
    return


# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)

if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#include <bits/stdc++.h>
      
#define FOR(i,a,b) for(ll i = (a); i < (ll)(b); i++)
#define REP(i,n) FOR(i,0,n)
#define YYS(x,arr) for(auto& x:arr)
#define PW(x) (1LL<<(x))
#define SZ(x) ((ll)(x).size())

#define pb emplace_back
#define fi first
#define se second

using namespace std;

using ld = long double;
using ll = long long int;

const ll INF = (ll)1e9 + 10;
const ll INFLL = (ll)1e18 + 10;
const ll MOD = 1e9+7;
     
template<class T> T &chmin( T &a , const T &b ){ return a = min(a,b); }
template<class T> T &chmax( T &a , const T &b ){ return a = max(a,b); }
template<class T> void UNIQUE(vector<T> &a){ a.erase(unique(a.begin(), a.end()), a.end()); }

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
  os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}

ll in(){long long int x; scanf("%lld", &x); return x;}
ld fin(){double x; scanf("%lf", &x); return x;}
char yuyushiki[1000010]; string stin(){scanf( "%s", yuyushiki ); return yuyushiki;}

// head


ll n, m;

ll a[100010];

int main(){

  n = in();
  m = in();

  vector<pair<ll, ll>> v(0);
  
  REP(i, n){
    a[i] = in() - 1;
    v.pb(a[i], i);
  }

  sort(v.begin(), v.end());

  ll all = 0;
  REP(i, n-1){
    if(a[i+1] < a[i]){
      all += m - a[i] + a[i+1];
    } else {
      all += a[i+1] - a[i];
    }
  }

  // cout << all << endl;
  
  ll cur = 0;
  ll cnt = 0;
  REP(i, n-1){
    if(a[i+1] < a[i]){
      cur += m - a[i] + v[0].fi;
      cnt++;
    }
  }

  ll ans = all - cur + cnt;
  REP(i, n){
    chmin(ans, all - cur + cnt);
    ll p = v[i].se;
    if(p == 0){
      cnt++;
    } else if(p == n-1){
      cnt--;
    }
    if(p > 0){
      if(a[p] < a[p-1]){
        cur -= m - a[p-1] + a[p];
      } else {
        cur -= a[p] - a[p-1];
      }
    }
    if(i == n-1){
      break;
    }
    cur += cnt * (v[i+1].fi - v[i].fi);
  }

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


Measured memory_bytes: 2932
def slove():
    import sys
    import collections
    input = sys.stdin.readline
    n = int(input().rstrip('\n'))
    a = list(map(int, input().rstrip('\n').split()))
    a = sorted(collections.Counter(a).most_common(), key=lambda x: x[0], reverse=True)
    ans = []
    for k, v in a:
        if v >= 2:
            for i in range(v // 2 * 2):
                ans.append(k)
        if len(ans) >= 4:
            print(ans[0] * ans[2])
            exit()
    print(0)


if __name__ == '__main__':
    slove()


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

typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;

const int  MOD=1000000007;
const int  INF= int(1e9);
const int  MAX=100000;
int dp[MAX],n,value[MAX],wt[MAX],capacity;

int main()
{
	ios_base::sync_with_stdio(false);
    cin>>n>>capacity;
    for(int i=1;i<=n;i++) {
        cin>>value[i]>>wt[i];
    }
    dp[0]=0;
    for(int w=1;w<=capacity;w++) {
        dp[w]=0;
        for (int i=1;i<=n;i++) {
            if(wt[i] <= w ) {
                dp[w] = max(dp[w] , dp[w-wt[i]]+value[i]);
            }
        }
    }
    cout<<dp[capacity]<<"\n";


	return 0;

}

Measured memory_bytes: 1252
import sys
input = lambda: sys.stdin.readline().rstrip() 
import math
from functools import reduce

def resolve():
    K = int(input())

    ans = 0
    for a in range(1, K+1):
        for b in range(1, K+1):
            tmp = math.gcd(a, b)
            for c in range(1, K+1):
                ans += math.gcd(tmp, c)

    print(ans)

if __name__ == '__main__':
    resolve()


Measured memory_bytes: 9576
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define pa(x,n) for(ll i=0;i<n;i++){cout<<(x[i])<<" \n"[i==n-1];};
#define pb push_back

using ll = long long;
using namespace std;
using pint = pair<int,int>;
using pll = pair<ll,ll>;
const int INFint = 1e9;
const ll INFll = 1e18;
ll MOD=1e9+7;

ll gcd(ll a, ll b) { return __gcd(a,b); } //最大公約数
ll lcm(ll a, ll b) { return a/gcd(a,b)*b; } //最大公倍数

// aのn乗をMODで割りながら計算する
ll modpow(ll a, ll n) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % MOD;
    a = a * a % MOD;
    n >>= 1; // right shift
  }
  return res;
}

// MODを法としたaの逆元を計算する
ll modinv(ll a) {
  return modpow(a, MOD - 2);
}

int main(){
  ll x,y,z,k,A[1000],B[1000],C[1000];
  cin>>x>>y>>z>>k;
  for (int i(0);i<x;i++) cin>>A[i];
  for (int i(0);i<y;i++) cin>>B[i];
  for (int i(0);i<z;i++) cin>>C[i];
  vector<ll> a(x*y);
  int cnt(0);
  for (int i(0);i<x;i++){
    for (int j(0);j<y;j++){
      a[cnt] = A[i] + B[j];
      cnt++;
    }
  }
  sort(a.rbegin(),a.rend());
  vector<ll> b(k*z);
  cnt = 0;
  for (int i(0);i<min(k,ll(a.size()));i++){
    for (int j(0);j<z;j++){
      b[cnt] = a[i] + C[j]; 
      cnt++;
    }
  }
  sort(b.rbegin(),b.rend());
  for (int i(0);i<k;i++){
    cout << b[i] <<endl;
  }
  return 0;
}



Measured memory_bytes: 31616
#include <bits/stdc++.h>
using namespace std;
int main () {
	long long a, b, c;
	scanf("%lld%lld%lld", &a, &b, &c);
	long long tmp = min(c, a);
	a -= tmp; c -= tmp;
	b -= min(c, b);
	printf("%lld %lld\n", a, b);
}

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

int main() {
  long A, B, C, K, ans = 0;
  cin >> A >> B >> C >> K;
  
  if (A < K) {
    K = K - A;
    ans = A;
  } else {
    ans = K;
    K = 0;
  }

  if (K != 0) K = K - B;
  
  if (K != 0) {
    if (C > K) ans = ans - K;
    else ans = ans - C;
  }
    
  cout << ans << endl;
}

Measured memory_bytes: 3620