akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

public class Main {

    public static final int MOD = 1000000007;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());
        long ans = (modPow(2, n) - 1) % MOD;
        ans -= comb(n, a);
        if (ans < 0) {
            ans += MOD;
        }
        ans -= comb(n, b);
        if (ans < 0) {
            ans += MOD;
        }
        System.out.println(ans);
    }

    // 繰り返し２乗法
    private static long modPow(long n, int p) {
        long res = 1;
        long a = n;
        for (a %= MOD; p > 0; a = a * a % MOD, p >>= 1) {
            if ((p & 1) > 0) {
                res = res * a % MOD;
            }
        }
        return res;
    }

    // 逆元
    private static long modInv(long a) {
        return modPow(a, MOD - 2);
    }

    private static long comb(long n, long r) {
        long ret = 1;
        for (long i = 0; i < r; i++) {
            ret *= n - i;
            ret %= MOD;
            ret *= modInv(i + 1);
            ret %= MOD;
        }
        return ret;
    }
}

Measured memory_bytes: 23636
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<string>
#define rep(i,n) for(int i=0;i<n;i++)

using namespace std;

int main(){

int N,L;
cin >> N;
int SUM=0;
int M=0;
rep(i,N){
cin >> L;
SUM+=L;
M=max(L,M);
}
 if(2*M<SUM){
     cout <<"Yes"<<endl;
 }
 else{
 cout <<"No"<<endl;
 }
 return 0;
}

Measured memory_bytes: 256
N = int(input())
A = [int(input()) for _ in range(N)]
B = list(A)

A.sort()
d = {}
for a in A:
    if a in d:
        d[a] += 1
    else:
        d[a] = 1

ans1 = A[-1]
if d[ans1] >= 2:
    ans2 = A[-1]
else:
    ans2 = A[-2]

for b in B:
    if b == ans1:
        print(ans2)
    else:
        print(ans1)


Measured memory_bytes: 21720
MOD = 10**9 + 7
N = int(input())
arr = list(map(int, input().split()))
check = [sum(arr)]*N
ans = 0
tmp = 0
for i in range(N-1):
    tmp += arr[i]
    check[i] -= tmp
for i in range(N-1):
    ans += check[i]*arr[i]
    ans %= MOD
print(ans)

Measured memory_bytes: 105272
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <deque>
long long sum[1023];

int main(){
  int N;
  scanf("%d", &N);
  std::vector<int > C(N), S(N), F(N);
  for (int i=0; i<N-1; i++){
    scanf("%d", &C[i]);
    scanf("%d", &S[i]);
    scanf("%d", &F[i]);
  }
  for (int i=0; i<N; i++){
    //printf("i=%d\n", i);
    int time = 0;
    for (int j=i; j<N-1; j++){
      //printf("j=%d\n", j);
      if (time<S[j]){
        time = S[j]+C[j];
      } else {
        time = S[j]+((time-S[j]+F[j]-1)/F[j])*F[j]+C[j];
      }
      //printf("time=%d\n", time);
    }
    printf("%d\n", time);
  }
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);i++)
int main(){
  string s;
  string op;
  cin >> s;
  int n = s.size();
  for(int bit = 0; bit < (1<<n); bit++){
    string op = "+++";
    int sum = s.at(0) - '0';
    for(int i = 1; i < n; i++){
      if(bit & (1<<i)){
        sum += s.at(i) -'0';
      }
      else{
        sum -= s.at(i) - '0';
        op.at(i-1) = '-';
      }
    }
    if(sum == 7){
      cout << s.at(0);
      for(int i = 1; i < 4; i++){
        cout << op.at(i-1) << s.at(i);
      }
      cout << "=7" << endl;
      break;
    }
  }
  return 0;
}


Measured memory_bytes: 256
#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 N 200005
#define M
#define pi 3.14159265359
using namespace std;
typedef long long LL;
const LL mod =2147483647;
main(){
	int n;
	while(scanf("%d",&n)!=EOF){
		for(int i=1;;i++){
			if(i*(i+1)/2>=n){
			printf("%d\n",i);
			break;
			}
		}
	}
}

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

#define rep(i, m, n) for(int(i) = (int)(m); i < (int)(n); ++i)
#define rep2(i, m, n) for(int(i) = (int)(n)-1; i >= (int)(m); --i)
#define REP(i, n) rep(i, 0, n)
#define REP2(i, n) rep2(i, 0, n)
#define all(hoge) (hoge).begin(), (hoge).end()
#define en '\n'
using ll = long long;
using ull = unsigned long long;
using ld = long double;
template <class T>
using vec = vector<T>;
template <class T>
using vvec = vector<vec<T>>;
typedef pair<ll, ll> P;
constexpr long long INF = 1LL << 60;
constexpr int INF_INT = 1 << 25;
constexpr long long MOD = (ll)1e9 + 7;
//constexpr long long MOD = 998244353LL;
using ld = long double;
static const ld pi = 3.141592653589793L;
typedef vector<ll> Array;
typedef vector<Array> Matrix;

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;
}

struct Edge {
    ll to, rev;
    long double cap;
    Edge(ll _to, long double _cap, ll _rev) {
        to = _to;
        cap = _cap;
        rev = _rev;
    }
};
using Edges = vector<Edge>;
using Graph = vector<Edges>;

void add_edge(Graph &G, ll from, ll to, long double cap, bool revFlag,
              long double revCap) {
    G[from].push_back(Edge(to, cap, (ll)G[to].size()));
    if(revFlag)
        G[to].push_back(Edge(from, revCap, (ll)G[from].size() - 1));
}

class UnionFind {
    vector<int> data;
    int num;

  public:
    UnionFind(int size) : data(size, -1), num(size) {}
    bool unionSet(int x, int y) {
        x = root(x);
        y = root(y);
        if(x != y) {
            if(data[y] < data[x])
                swap(x, y);
            data[x] += data[y];
            data[y] = x;
            num--;
        }
        return x != y;
    }
    bool findSet(int x, int y) {
        return root(x) == root(y);
    }
    int root(int x) {
        return data[x] < 0 ? x : data[x] = root(data[x]);
    }
    int size(int x) {
        return -data[root(x)];
    }
    int numSet() {
        return num;
    }
};

void solve() {
    ll n, m;
    cin >> n >> m;
    UnionFind uni(n);
    REP(i, m) {
        int x, y, z;
        cin >> x >> y >> z;
        x--;
        y--;
        uni.unionSet(x, y);
    }
    cout << uni.numSet() << en;
}

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

    solve();
    /*
    ll t;
    cin >> t;
    REP(i, t) { solve(); }*/

    return 0;
}


Measured memory_bytes: 3720
#include <bits/stdc++.h>
using namespace std;
using pint = pair<int, int>;
using ll = long long;
using pll = pair<ll, ll>;
#define FOR(i, begin, end) for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define VREP(s, ite) for (auto ite = s.begin(); ite != s.end(); ++ite)
#define FI first
#define SE second
//#define endl "\n"
#define ciosup  \
    cin.tie(0); \
    ios::sync_with_stdio(false);
#define eb emplace_back
#define vint vector<int>
constexpr ll INF = 1e9 + 7;
constexpr ll MOD = 1e9 + 7;
template <typename T>
void vecin(vector<T> &v, int n = 0)
{
    if (n == 0)
        n = v.size();
    for (int i = 0; i < n; ++i)
    {
        cin >> v[i];
    }
}
template <typename T>
void vecout(vector<T> &v, int n = 0)
{
    if (n == 0)
        n = v.size();
    for (int i = 0; i < n - 1; ++i)
    {
        cout << v[i] << " ";
    }
    cout << v[n - 1] << endl;
}

void solve(long long A, long long B, long long C, long long K){
    ll now = K;
    ll ans = min(K,A);
    K -= A + B;
    if (K <= 0){
        cout<<ans<<endl;
        return;
    }
    cout << ans - K << endl;
}

int main(){
    long long A;
				scanf("%lld",&A);
				long long B;
				scanf("%lld",&B);
				long long C;
				scanf("%lld",&C);
				long long K;
				scanf("%lld",&K);
    solve(A, B, C, K);
}


Measured memory_bytes: 3768
//Hello Wolrd
//There is Special Pig Jiong in the world. 
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<algorithm>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef pair<int,int> pii;
const int inf = 0x3f3f3f3f,oo = inf;
const double pi = acos(-1.0);
#define pc putchar
#define RG register
#define gc getchar
inline ll read(){
	RG ll x=0,f=1;RG char c=gc();
	for(;c<'0'||c>'9';c=gc())if(c=='-')f=-1;
	for(;c>='0'&&c<='9';c=gc())x=(x<<1)+(x<<3)+(c^48);
	return x*f;
}
void write(ll x){
	if(x<0)x=-x,pc('-');
	if(x>=10)write(x/10);
	putchar(x%10+'0');
}
void writeln(ll x){
	write(x);puts("");
}
const int Mod = 1e9+7;
int Pow(int a,int b){int ans=1;for(;b;b>>=1,a=1ll*a*a%Mod)if(b&1)ans=1ll*ans*a%Mod;return ans;}
#define rd read
#define mem(x,v) memset(x,v,sizeof(x))
#define pb push_back
#define mp make_pair
#define sqr(x) ((x)*(x))
#define lowbit(x) ((x)&(-(x)))
#define rep(i,a,b) for(RG int i=(a);i<(b);++i)
#define Rep(i,a,b) for(RG int i=(a);i<=(b);++i)
#define Down(i,a,b) for(RG int i=(a);i>=(b);--i)
#define fin(x) {freopen(#x".in","r",stdin);}
#define fout(x) {freopen(#x".out","w",stdout);}
#define y1 ________y1
#define x first
#define y second

ll n,A,B,tot,need,rem;
int main(){
	n = rd(),A = rd(),B = rd();
	if(B==1){
		if(A!=n){
			puts("-1");
			return 0;
		}
		Rep(i,1,n) printf("%d ",i);
		return 0;
	}
	if(n>A*B || A>n || B>n || (A+B-1>n)){
		puts("-1");
		return 0;
	} else{
		need = (n-A) / (B-1);
		Rep(i,1,need)
			for(ll j=i*B;j>=i*B-(B-1);j--) printf("%lld ",j);
		tot = need * B;
		rem = n - A - need * (B-1);
		tot+=rem+1;int _ttt=tot;
		rem++;
		while(rem--){
			if(tot<=n)printf("%lld ",tot);
			tot--;
//			_ttt++;
		}
		tot=_ttt+1;
		while(tot<=n){
			printf("%lld ",tot);
			tot++;
		}
	}
	return 0;
}


/*
934285914
287927211
*/

Measured memory_bytes: 2048
#include "bits/stdc++.h"
using namespace std; typedef long long int lint; typedef pair<lint, lint> plint; typedef pair<double long, double long> pld;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define FOR(i, begin, end) for(lint i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(lint i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define endk '\n'
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; }
const lint mod = 1e9 + 7, INF = 1e18;
lint dx[8] = { 0, -1, 1, 0, 1, -1, 1, -1 }, dy[8] = { 1, 0, 0, -1, -1, -1, 1, 1 };

lint N, K;
lint X[100000], Y[100000];
char c;

template< typename T >
struct imos2D {
	vector< vector< T > > data;
	int _H, _W;

	imos2D(int H, int W) {
		_H = H; _W = W;
		data.assign(H + 1, vector< T >(W + 1, 0));
	}

	void add(int y, int x, int value = 1) {
		data[y + 1][x + 1] += value;
	}

	void build() {
		for (int i = 0; i <= _H; i++) {
			for (int j = 0; j < _W; j++) {
				data[i][j + 1] += data[i][j];
			}
		}
		for (int j = 0; j <= _W; j++) {
			for (int i = 0; i < _H; i++) {
				data[i + 1][j] += data[i][j];
			}
		}
	}

	///x1 - x2, y1 - y2
	T query(int x1, int y1, int x2, int y2) {
		return data[y2][x2] - data[y1][x2] - data[y2][x1] + data[y1][x1];
	}
};

int main() {
	cin.tie(0); ios_base::sync_with_stdio(false);
	cin >> N >> K;
	REP(i, N) {
		cin >> X[i] >> Y[i] >> c;
		if (c == 'B') Y[i] += K;
		X[i] %= 2 * K;
		Y[i] %= 2 * K;
	}
	imos2D<lint> dt(K * 2, K * 2);
	REP(i, N) dt.add(Y[i], X[i]);
	dt.build();

	lint maxv = 0;
	REP(i, K + 1) {
		REP(j, K + 1) {
			lint curr = 0;
			curr += dt.query(0, 0, i, j);
			curr += dt.query(i + K, 0, 2 * K, j);
			curr += dt.query(0, j + K, i, 2 * K);
			curr += dt.query(i, j, i + K, j + K);
			curr += dt.query(i + K, j + K, 2 * K, 2 * K);
			chmax(maxv, max(N - curr, curr));
		}
	}
	cout << maxv << endl;
}

Measured memory_bytes: 36180
#include<iostream>
#include<cstdio>
#include<cmath>
#include<vector>
#include<queue>
#include<map>
#include<algorithm>
#include<complex>
#include<string>
#include<cstring>
using namespace std;
#define rep2(x,from,to) for(int x=(from);(x)<(to);(x)++)
#define rep(x,to) rep2(x,0,to)
#define INF 100000000
#define debug(x) cout<<#x<<": "<<x<<endl

#define all(x) x.begin(),x.end()
typedef pair<int,int> P;
typedef pair<int,P> PP;
string s;
int flag[4];
string ss="NWSE";
int main()
{
	cin>>s;
	int t=s.size();
	rep(i,t)
	{
		rep(j,4)
		{
			if(s[i]==ss[j])flag[j]=1;
		}
	}
	if(flag[0]!=flag[2]||flag[1]!=flag[3])
	{
		cout<<"No"<<endl;
	}
	else cout<<"Yes"<<endl;
	return 0;
}

Measured memory_bytes: 256
#input
N, M = map(int, input().split())
A = [0] * M
B = [0] * M
for i in range(M):
    A[i], B[i] = map(int, input().split())

#output

C = [[]] * N
for a in A:
    C[a-1] = [b-1 for i, b in enumerate(B) if A[i] == a]

#iを出発して、ループが形成できるか確認。
search_stack = [[]] * N
visited = [[]] * N
next_position = [-1] * N

for i in range(N):
    search_stack[i] = [i]
    visited[i] = []
    while search_stack[i] != []:
        next_position[i] = search_stack[i].pop(0)
        visited[i].append(next_position[i])
        for node in C[next_position[i]]:
            if node == i:
                visited[i].append(node)
                search_stack[i] = []
                break
            elif node in visited[i]:
                continue
            elif node in search_stack[i]:
                continue
            elif C[node] == []:
                continue
            else:
                search_stack[i].append(node)

short = None
for v in visited:
    if len(v) >= 2 and v[0] == v[-1]:
        if not short or len(v) < len(short):
            short = v

#結果の出力            
if short:
    del short[-1]
    print(len(short))
    for s in short:
        print(s+1)
else:
    print(-1)

Measured memory_bytes: 53212
#include <algorithm>
#include <iostream>
#include <string>
#include <cstring>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iomanip>
#include <limits>
#include <map>
#include <queue>
#include <stack>
#include <vector>
#include <unordered_set>

#define FOR(i,k,n) for(int (i) = (k); (i) < (n); ++(i))
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define all(v) begin(v), end(v)
#define debug(x) cerr << #x << ": " << x << endl
#define debug2(x,y) cerr << #x << ": " << x << ", " << #y << ": " << y << endl

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<i_i, int> p_i;
typedef vector<int> vi;
typedef vector< vector<int> > vvi;
template<class T> using vv=vector< vector<T> >;
typedef deque<int> di;
typedef deque< deque<int> > ddi;


int main() {
    int n;
    cin >> n;
    rep(i,n) {
        unordered_set<string> S;
        string tmp;
        cin >> tmp;
        FOR(j,1,tmp.size()){
            string s1[2];
            s1[0] = tmp.substr(0, j);
            s1[1] = s1[0];
            reverse(s1[0].begin(),s1[0].end());
            string s2[2];
            s2[0] = tmp.substr(j, tmp.size()-j);
            s2[1] = s2[0];
            reverse(s2[0].begin(),s2[0].end());
            rep(k,2) {
                rep(l,2) {
                    string s = s1[k] +s2[l];
                    S.insert(s);
                    s = s2[l] + s1[k];
                    S.insert(s);
                }
            }
        }
        cout << S.size() << endl;
    }

	return 0;
}

Measured memory_bytes: 3228
using System;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using Debug = System.Diagnostics.Debug;
using MethodImplOptions = System.Runtime.CompilerServices.MethodImplOptions;
using MethodImplAttribute = System.Runtime.CompilerServices.MethodImplAttribute;
using LayoutKind = System.Runtime.InteropServices.LayoutKind;
using StructLayoutAttribute = System.Runtime.InteropServices.StructLayoutAttribute;
using FieldOffsetAttribute = System.Runtime.InteropServices.FieldOffsetAttribute;

static class P
{
    static void Main()
    {
        var rdx = Console.ReadLine().Split().Select(int.Parse).ToArray();
        long x = rdx[2];
        for (int i = 0; i < 10; i++)
        {
            x = x * rdx[0] - rdx[1];
            Console.WriteLine(x);
        }
    }
}


Measured memory_bytes: 13268
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<vector>
#include<string>
#include<cstring>

using namespace std;

int main(void){
	int n;
	while(scanf("%d" ,&n) && n != 0){
		char temp;
		int m;
		int ans = 0;
		int d = -1;
		
//		string iois = "I";
//		string str = "";
//		char iois[2000005] = {"I"};
//		char str[2000000] = {0};
		
		/*
		for(int i = 0; i < n; i++){
			iois += "OI";
		}
		*/
		/*
		for(int i = 0; i < n; i++){
			iois[1+i*2] = 'O';
			iois[2+i*2] = 'I';
		}
		iois[n*2+1] = '\0';
		*/
		
		scanf("%d", &m);
		getchar();
		bool flg = false;
		
		for(int i = 0; i < m; i++){
			scanf("%c" ,&temp);
			if(d != -1 && temp == 'I' && flg){
				d++;
				flg = false;
				if(n <= d)ans++;
			}else if(d != -1 && temp == 'O' && !flg){
				flg = true;
			}else if(temp == 'I'){
				d = 0;
				flg = false;
			}else{
				d = -1;
				flg = false;
			}
				
		}
		
		/*
		for(int i = 0; i < m; i++){
			scanf("%c" ,str);
		}
		*/
		/*
		cin >> str;		
		for(int i = 0; i < m-n*2; i++){
			if(str.substr(i,n*2+1) == iois)ans++;
		}
		*/
		/*
		getchar();
		for(int i = 0; i < m; i++){
			scanf("%c", &temp);
			str += temp;
			if(str.size() > n*2+1){
				str = str.substr(1);
			}
			if(str == iois){
				ans++;
			}
		}
		*/
		printf("%d\n", ans);
	}
	return 0;
}

Measured memory_bytes: 888
use std::io;
use std::collections::VecDeque;

fn main() {
    let mut input = Input::new();
    let mut a = input.next().parse::<i64>().unwrap();
    let mut b = input.next().parse::<i64>().unwrap();
    let mut c = input.next().parse::<i64>().unwrap();
    for i in 0..10000 {
        if a % 2 == 1 || b % 2 == 1 || c % 2 == 1 {
            println!("{}", i);
            return;
        }
        let a_ = a / 2;
        let b_ = b / 2;
        let c_ = c / 2;
        a = b_ + c_;
        b = a_ + c_;
        c = a_ + b_;
    }
    println!("{}", -1);
}

struct Input {
    queue: VecDeque<String>,
}

impl Input {
    fn new() -> Input {
        Input { queue: VecDeque::new() }
    }

    fn next(&mut self) -> String {
        if self.queue.is_empty() {
            let mut line = String::new();
            let _ = io::stdin().read_line(&mut line);
            for x in line.split_whitespace() {
                self.queue.push_back(String::from(x));
            }
        }
        return self.queue.pop_front().unwrap();
    }
}



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

//#define int long long
#define x first
#define y second
#define mp make_pair
#define pb push_back
#define all(v) v.begin(), v.end()
#define sz(v) (int) v.size()
#define TASK ""

using namespace std;

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

signed main() {
#ifdef LOCAL
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
#else
if (strlen(TASK) > 0)
	freopen(TASK".in", "r", stdin),
	freopen(TASK".out", "w", stdout);
#endif
	ios_base::sync_with_stdio(0);
	cin.tie(0);

	const int MOD = 1e9 + 7;
	
	int n;
	cin >> n;
	vector<int> a(n);
	for (int i = 0; i < n; ++i) {
		cin >> a[i];
	}
	vector<vector<pii>> f(n);
	for (int i = 0; i < n; ++i) {
		int x = a[i], d = 2;
		while (d * d <= x) {
			int cnt = 0;
			while (x % d == 0) {
				x /= d, ++cnt;
			}
			if (cnt) {
				f[i].pb(mp(d, cnt));
			}
			++d;
		}
		if (x > 1) {
			f[i].pb(mp(x, 1));
		}
	}
	
	function<int(int, int)> add = [&](int x, int y) {
		return (x + y) % MOD;
	};
	function<int(int, int)> mul = [&](int x, int y) {
		return 1ll * x * y % MOD;
	};
	function<int(int, int)> deg = [&](int x, int y) {
		if (y == 0) {
			return 1;
		}
		if (y & 1) {
			return mul(x, deg(x, y - 1));
		}
		int res = deg(x, y >> 1);
		return mul(res, res);
	};
	function<int(int)> inv = [&](int x) {
		return deg(x, MOD - 2);
	};
	function<int(int, int)> fuck = [&](int x, int y) {
		return mul(x, inv(y));
	};
	
	map<int, int> max_deg;
	for (int i = 0; i < n; ++i) {
		for (auto &div : f[i]) {
			max_deg[div.x] = max(max_deg[div.x], div.y);
		}
	}
	int lcm = 1;
	for (auto &div : max_deg) {
		lcm = mul(lcm, deg(div.x, div.y));
	}
	int ans = 0;
	for (int i = 0; i < n; ++i) {
		ans = add(ans, fuck(lcm, a[i]));
	}
	cout << ans << "\n";

	return 0;
}


Measured memory_bytes: 1280
#include<stdio.h>
int main(){
int a,b,c,d,p,x,y;
scanf("%d\n%d\n%d\n%d\n%d",&a,&b,&c,&d,&p);
x=a*p;
if(c>=p){
y=b;
}else{
y=b+(p-c)*d;
}
if(y>x){
printf("%d\n",x);
}else{
printf("%d\n",y);
}
return 0;
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
#define ll long long int
#define all(x) (x).begin(), (x).end()
#define rep(i,a,b) for(int i=a;i<b;i++)
#define pb push_back
#define mp make_pair
#define inputv(a) forall(i,0,a.size()) cin>>a[i]
#define outputv(a) for(auto i:a) cout<<i<<" ";br;
#define fs first
#define sec second
#define lb lower_bound
#define ub upper_bound
#define minv(a) *min_element(all(a))
#define maxv(a) *max_element(all(a))
#define br cout<<"\n"
using namespace std;


int dr[]={1,-1,0,0};
int dc[]={0,0,1,-1};
ll mod=1000000007;
ll po(ll x,ll n){
    ll res = 1;
    while(n>0){
        if(n%2==1)
            res = ((res)*(x))%mod;
        x = (x*x)%mod;
        n = n/2;
    }
    return res%mod;
}
ll ceil(ll x,ll y)
{
    if(x%y==0)
        return x/y;
    else
        return(x/y)+1;
}
ll binomialCoeff(int n, int k)
{
    ll res = 1;
    if (k > n - k)
        k = n - k;

    for (int i = 0; i < k; ++i) {
        res *= (n - i);
        res /= (i + 1);
    }

    return res;
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll a,b,c;
    cin>>a>>b>>c;
    ll tmp=a/c;
    if(a%c==0) tmp--;
    cout<<(b/c)-tmp;
	return 0;
}


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

const int maxn = 1e5 + 10;
char s[maxn];

int main() {
    scanf("%s", s);
    int len = strlen(s);
    if (len == 1) {
        puts("0");
        return 0;
    }  
    int now = 0;
    int ans = 0;
    for (int i = 0; i < len; i++) {
        if (s[i] - '0' != now) ans++;
        now ^= 1;
    } 
    int temp = 0;
    now = 1;
    for (int i = 0; i < len; i++) {
        if (s[i] - '0' != now) temp++;
        now ^= 1;
    }
    printf("%d\n", min(ans, temp));
    return 0;
}

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

using ll = long long;
#define print(n) cout << n << endl

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    
    ll a,b,n;
    cin >> a >> b >> n;
    
    ll x = min(b-1,n);
    print(floor(a*x/b)-a*floor(x/b));
    return 0;
}

Measured memory_bytes: 3760
#include <iostream>
using namespace std;
int main()
{
    string s, t, u;
    int a, b;
    cin >> s >> t >> a >> b >> u;
    if (u == s)
    {
        a--;
    }
    else if (u == t)
    {
        b--;
    }
    cout << a << " " << b << endl;
}

Measured memory_bytes: 256
file = File.exist?('in.in') ? File.new('in.in','r') : STDIN
n = file.gets.chomp.to_i
vec = file.gets.chomp.split.map(&:to_i)

dp = Array.new(n)

dp[0] = 0
dp[1] = (vec[0]-vec[1]).abs

for i in 2...vec.size
  ant = dp[i-1]+(vec[i-1]-vec[i]).abs
  ant2 = dp[i-2]+(vec[i-2]-vec[i]).abs
  dp[i]= [ant, ant2].min
end

puts dp.last

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

signed main(void){
  
 int N,K; cin >> N >> K;
  
  int res = 1; int cnt = 0;
  while( res <= N ){ res *= K; cnt++;}
  
  cout << cnt << endl;
  
  return 0;
}

Measured memory_bytes: 256
N = int(input())

cities = [tuple(map(int,input().split())) for i in range(N)]

from collections import defaultdict
dist = defaultdict(int)

import itertools
for perm in itertools.permutations(range(N), 2):
  x1,y1 = cities[perm[0]]
  x2,y2 = cities[perm[1]]
  dist[perm] = ((x1 - x2) ** 2 + (y1 - y2) ** 2) ** 0.5

ans = 0
cnt = 0
for perm in itertools.permutations(range(N), N):
  cnt += 1
  for i in range(1 ,len(perm)):
    ans += dist[(perm[i - 1], perm[i])]

print(ans / cnt)

Measured memory_bytes: 9660
import java.util.Scanner;

//20180510
//06

public class Main {
    public static void main(String[] args){
		Scanner scanner = new Scanner(System.in);

		String search = scanner.nextLine();
		String end = "END_OF_TEXT";
		int count = 0;

		while (scanner.hasNextLine()) {
			String string = scanner.next();
			if(string.contains(end)) {
				break;
			}
			if(string.equalsIgnoreCase(search)) {
				count++;
			}
		}
		System.out.println(count);
		scanner.close();
    }
}


Measured memory_bytes: 27332
#include <bits/stdc++.h>
using namespace std;
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; }
using ll = long long;

int cnt_dig(ll n) {
  return floor(log10(n))+1;
}

int main() {
  ll n; cin >> n;
  int ans = cnt_dig(n);
  for (ll a = 1; a*a <= n; ++a){
    if (n%a) continue;
    ll b = n/a;
    chmin(ans, max(cnt_dig(a), cnt_dig(b)));
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
#define rep(i, n) for(int i=0; i<((int)(n)); i++)
#define rep1(i, n) for(int i=1; i<=((int)(n)); i++)
#define rrep(i, n) for(int i=((int)(n)-1); i>=0; i--)
#define ALL(a) (a).begin(), (a).end()
#define pb push_back
using namespace std;
typedef long long ll;
const ll mod = 1e9 + 7;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;
template<class T> bool chmin(T&x,T y){if(x>y){x=y;return true;}return false;}
template<class T> bool chmax(T&x,T y){if(x<y){x=y;return true;}return false;}
ll gcd(ll x, ll y){ if(x>y) swap(x, y);while(x!=0){ y%=x; swap(x, y); }return y; }
ll mpow(ll x, ll r){if(r==0) return 1;if(r%2==1){ return x*mpow(x, r-1)%mod; }else{ ll aa = mpow(x, r/2); return aa*aa%mod; }}

ll num[2019];

int main(){
	string s; cin >> s;
	int n = s.size();
	ll ama[n+1];
	ama[0] = 0;
	num[0]++;
	ll t = 1;
	rep(i, n){
		ll aa = s[n-i-1] - '0';
		ama[i+1] = (ama[i] + t*aa%2019)%2019;
		num[ama[i+1]]++;
		t = (10*t)%2019;
	}
	ll ans = 0;
	rep(i, 2019) ans += num[i]*(num[i]-1)/2;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 5328
#include<iostream>
#include<string>
#include<vector>
#include<math.h>
#include<algorithm>
#include<cstdio>
#include<stdio.h>
#include<stack>
#include<sstream>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<list>
#include<numeric>
typedef long long ll;

#define pi 3.14159265358979323846
#define VI vector<int>
#define VLL vector<long long>
#define MAX max_element
#define MIN min_element
#define all(v) v.begin(), v.end()
const ll MOD = 1e9 + 7;
using namespace std;
template<typename T>
T gcd(T a, T b) {
	return b ? gcd(b, a % b) : a;
}
template<typename T>
T lcm(T a, T b) {
	return a * b / gcd(a, b);
}

template<typename T>
T binarysearch(vector<T> A, T key) {
	ll left = 0;ll right = 4;ll mid;
	while (left < right) {
		mid = (left + right) / 2;
		if (key == A[mid]) return 1;
		if (key > A[mid]) left = mid + 1;
		else if (key < A[mid]) right = mid;
	}
	return 0;
}

template<typename T>
T finder(vector<T> vec, T number) {
	auto itr = find(vec.begin(), vec.end(), number);
	size_t index = distance(vec.begin(), itr);
	if (index != vec.size()) { // 発見できたとき
		return 1;
	}
	else { // 発見できなかったとき
		return 0;
	}
}
ll frac(ll n)//階乗
{
	if (n == 0) {
		return 1;
	}
	return (n * frac(n - 1)) % MOD;
}

template<typename T>
T keta(T a) {
	ll kazu = 1;
	while (1) {
		if (a / 10 != 0) { a /= 10;kazu++; }
		else break;
	}
	return kazu;
}//桁数


/*char r[4];
int yaju[4];
char op[3];
int sum = 0;
scanf("%s", r);
for (int i = 0;i < 4;i++) {
	yaju[i] = r[i] - '0';
}
*/
int main() {
	ll N; cin >> N;
	vector<ll> X(N);
	for (int i = 0;i < N;i++) cin >> X[i];
	sort(all(X));
	ll ans = 0, max = 9999999999, maxx = 0;
	for (int i = X[0];i < X[N - 1]+1;i++) {
		maxx = 0;
		for (int j = 0;j < N;j++) {
			maxx += (i - X[j]) * (i - X[j]);
		}
		if (maxx < max) max = maxx;
	}
	cout << max;
}

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

int main(void){
    int N; cin >> N;
    int A[N][N]; REP(i,N)REP(j,N) cin >> A[i][j];

    ll ans=0;
    REP(i,N)REP(j,N)REP(k,N){
        if(A[i][j] > A[i][k]+A[k][j]){
            cout << -1 << endl;
            return 0;
        }
    }
    REP(i,N-1)FOR(j,i+1,N) ans += A[i][j];
    bool del[N][N]; REP(i,N)REP(j,N) del[i][j] = true;
    REP(i,N-2)FOR(j,i+1,N-1)FOR(k,j+1,N){
        if(A[i][j] == A[i][k]+A[k][j]){
            if(del[i][j]){
                del[i][j] = false; del[j][i] = false;
                ans -= A[i][j];
            }
        }
        if(A[i][k] == A[i][j]+A[j][k]){
            if(del[i][k]){
                del[i][k] = false; del[k][i] = false;
                ans -= A[i][k];
            }
        }
        if(A[j][k] == A[j][i]+A[i][k]){
            if(del[j][k]){
                del[j][k] = false; del[k][j] = false;
                ans -= A[j][k];
            }
        }
    }
    cout << ans << endl;
    return 0;
}

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

int count = 0; // count the number of iterations
int solve(int E) {
  int ans = E;
  for (int y = 0; y*y <= E; ++y)
    for (int z = 0; z*z*z <= E; ++z){
      // ++count; // Minimum number of counts when the looping is minimized; loop y and z thus.
      int x = (int) round(E-y*y-z*z*z);
      if (x + y*y + z*z*z == E && x >= 0)
	ans = min(ans, x + y + z);
    }
return ans;
}
int main() {
  int E;
  while (cin >> E && E>0) {
    cout << solve(E) << endl;
  }
}

Measured memory_bytes: 1168
#include <iostream>
#include <math.h>

using namespace std;

int main(){
  uint64_t x;
  cin >> x;
  int n = x/100;
  int a = x%100;
  //cout << n << " " << a << endl;

  if(a <= n*5){
    cout << 1;
  }
  else{
    cout << 0;
  }

  
  return 0;
}

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

using namespace std;
typedef long long LL;
int _max(int x, int y) {return x > y ? x : y;}
int _min(int x, int y) {return x < y ? x : y;}
const int N = 301, M = 90001;
const int mod = 998244353;
int read() {
	int s = 0, f = 1; char ch = getchar();
	while(ch < '0' || ch > '9') {if(ch == '-') f = -1; ch = getchar();}
	while(ch >= '0' && ch <= '9') s = s * 10 + ch - '0', ch = getchar();
	return s * f;
}
void put(int x) {
	if(x >= 10) put(x / 10);
	putchar(x % 10 + '0');
}

int a[N], f[2][M * 2], g[2][M * 2];

int add(int x, int y) {
	x += y;
	return x >= mod ? x - mod : x;
}

int dec(int x, int y) {
	x -= y;
	return x < 0 ? x + mod : x;
}

int main() {
	int n = read();
	for(int i = 1; i <= n; i++) a[i] = read();
	int ans = 1; for(int i = 1; i <= n; i++) ans = 3LL * ans % mod;
	g[0][M] = f[0][M] = 1; int sum = 0, now = 0;
	for(int i = 1; i <= n; i++) {
		now ^= 1; memset(f[now], 0, sizeof(f[now]));
		memset(g[now], 0, sizeof(g[now]));
		for(int j = M - sum; j <= M + sum; j++) if(g[now ^ 1][j] || f[now ^ 1][j]) {
			g[now][j + a[i]] = add(g[now][j + a[i]], g[now ^ 1][j]);
			g[now][j - a[i]] = add(g[now][j - a[i]], g[now ^ 1][j]);
			f[now][j + a[i]] = add(f[now][j + a[i]], 2LL * f[now ^ 1][j] % mod);
			f[now][j - a[i]] = add(f[now][j - a[i]], f[now ^ 1][j]);
		} sum += a[i];
	} for(int i = M - sum; i <= M; i++) ans = dec(ans, 3LL * f[now][i] % mod);
	ans = add(ans, 3LL * g[now][M] % mod);
	put(ans), puts("");
	return 0;
}


Measured memory_bytes: 3072
#include <iostream>

using namespace std;

int main (){


  int N,L;
  cin >>N >>L; 
  int count=0;
  if(L<0&&-1*L>=N){
    for(int i=0;i<N-1;i++){
      count+=L;
      L++;
  }
    
  }else if(L<0&&-1*L<=N){
    for(int i=0;i<N;i++){
      count+=L;
      L++;
    }
  }else{
    for(int i=0;i<N-1;i++){
      L++;
      count+=L;
    }
  }
  cout<<count<<endl;








  return 0;
}


Measured memory_bytes: 256
#include <cstdio>

int toLowUnder10(int arg) {
	return (10 > arg) ? 1 : (toLowUnder10(arg/10) + 1) ;
}

int main (int argc, char *argv[]) {
	int a,b;
	while (EOF != fscanf(stdin, "%d %d", &a, &b)) {
		printf("%d\n", toLowUnder10(a+b));
	}
	return 0;
}

Measured memory_bytes: 0
/*
─────────────────────
───────────████████──
──────────███▄███████
──────────███████████
──────────███████████
──────────██████─────
──────────█████████──
█───────███████──────
██────████████████───
███──██████████──█───
███████████████──────
███████████████──────
─█████████████───────
──███████████────────
────████████─────────
─────███──██─────────
─────██────█─────────
─────█─────█─────────
─────██────██────────
─────────────────────
*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>

#define int long long
#define read(a) int a; cin >> a;
#define readb(a, b) int a, b; cin >> a >> b;
#define readc(a, b, c) int a, b, c; cin >> a >> b >> c;
#define reads(s) string s; cin >> s;
#define readarr(a, n) int a[(n) + 1] = {}; fori (i, 1, (n)) {cin >> a[i];}
#define readmat(a, n, m) int a[n + 1][m + 1] = {}; fori (i, 1, n) {fori (j, 1, m) cin >> a[i][j];}

#define print(a) cout << a << endl;
#define printarr(a, n) fori (i, 1, n) cout << a[i] << " "; cout << endl;
#define printv(v) for (int i: v) cout << i << " "; cout << endl;
#define printmat(a, n, m) fori (i, 1, n) {fori (j, 1, m) cout << a[i][j] << " "; cout << endl;}
#define all(v) v.begin(), v.end()
#define sz(s) (int)(s.size())
#define pb push_back
#define fi first
#define se second
#define rz resize
#define fori(i, a, b) for (int i = (a); i <= (b); i++)
#define ford(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
#define setprec(x) cout << fixed << setprecision(x);
 
using namespace std;
using namespace __gnu_pbds; 
 
typedef tree<long long,null_type,less<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pair <int, int>> vpi;
typedef vector < vector <int> > vvi;
 
const int INF = 4e18;
const int mod = 1e9+7; 

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


    //start from here

    readb(k, x)

    int l = -1e6, r = 1e6;

    fori (i, max(x-k+1, l), min(r, x+k-1)) cout << i << " ";

    return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h> 
#define F first 
#define S second 
#define MAX 10000003 
using namespace std; 
#define ll long long
#include<fstream>
int main()
{
	ll t;cin>>t;
	if(t>=30)
	cout<<"Yes"<<endl;
	else
	cout<<"No"<<endl;
	return 0;
}
		

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
long long mo = 1e9 + 7;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<class A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}cout << "\n";}
ld PI=3.14159265358979323846;

vector<pair<ll,int>> factorize(ll n){
    vector<pair<ll,int>> res;
    for(ll i=2; i*i <=n;i++){
        if(n%i)continue;
        res.emplace_back(i,0);
        while(n % i == 0){
            n /= i;
            res.back().second++;
        }
    }
    if(n != 1)res.emplace_back(n,1);
    return res;
}

int main(){
    ll N;
    cin >> N;
    map<ll,ll> mp;
    rep(i,N){
        auto t = factorize(i+1);
        rep(j,t.size()){
            mp[t[j].first] += t[j].second;
        }
    }
    map<ll,ll> np;
    for(auto& p:mp){
        if(p.second + 1 >= 75){
            np[75]++;
        }
        if(p.second + 1 >= 25){
            np[25]++;
        }
        if(p.second + 1 >= 15){
            np[15]++;
        }
        if(p.second + 1 >= 5){
            np[5]++;
        }
        if(p.second + 1 >= 3){
            np[3]++;
        }
    }
    ll ans = 0;
    ans += np[75];
    ans += np[25]*(np[3]-1);
    ans += np[15]*(np[5]-1);
    ans += ((np[5]*(np[5]-1))/2)*(np[3]-2);
    cout << ans << endl;
}



Measured memory_bytes: 256
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>

#define ll long long
#define ull unsigned long long
#define ui unsigned int

using namespace std;

int main()
{
	int a, b;
	scanf("%d %d", &a, &b);
	if (500 * a >= b) printf("Yes\n");
	else printf("No\n");

	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <set>
#include <map>
#include <string>
#include <math.h>
#include <algorithm>
 
using namespace std;
 
int main() {
	// 入力
    int N;
    cin >> N;
    long long a[N];
    for (int i = 0; i < N; ++i) cin >> a[i];
 
    int ans;
    for (int i = 0; i < N; ++i){
        int b = a[i];
        while ((b/2)*2==b){
        	++ans;
        	b /= 2;
        }
    }
    cout << ans << endl;;
}


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

#define ll long long
#define INF 99999999
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

template < typename T > std::string to_string( const T& n )
{
    std::ostringstream stm ;
    stm << n ;
    return stm.str() ;
}

int main()
{
    int A,B;
    cin >> A >> B;

    if( A < 10 && B < 10 ) cout << A*B << endl;
    else cout << -1 << endl;

}


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

#define iota(i,n,b,s) for(int i=int(b);i!=int((b)+(s)*(n));i+=(s))
#define range(i,n,m) iota(i,(((n)>(m))?((n)-(m)+1):((m)-(n)+1)),(n),((n)>(m)?-1:1))
#define rep(i,n) iota(i,(n),0,1)

#define INF (1e9)
#define EPS (1e-9)
#define cons(a,b) (make_pair(a,b))
#define car(a) (a.first)
#define cdr(a) (a.second)
#define cadr(a) (car(cdr(a)))
#define cddr(a) (cdr(cdr(a)))
#define all(a) a.begin(), a.end()
#define trace(var) cerr<<">>> "<<#var<<" = "<<var<<endl;

typedef long long Integer;
typedef double Real;

template<class S, class T>
ostream& operator<<(ostream& os, pair<S,T> p) {
  os << '(' << car(p) << ", " << cdr(p) << ')';
  return os;
}

template<class T>
ostream& operator<<(ostream& os, vector<T> v) {
  os << v[0];
  for (int i=1, len=v.size(); i<len; ++i) os << ' ' << v[i];
  return os;
}

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

int main() {

  int n; cin >> n;
  Real c = 100;
  while (n--) {
    c = ceil(c * 1.05);
  }
  cout << int(c) * 1000 << endl;

  return 0;
}

Measured memory_bytes: 1164
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
#define PRint(x) cout<<(x)<<endl
#define INF 1000000000000 // 10^12
#define MOD 1000000007 // 10^9+7
#define PB push_back
#define MP make_pair

const int MAX_N = 200009;

int N, K;
int A[MAX_N];

int binary_search(int, int);
bool isOK(int);

int main() {
    cin >> N >> K;
    REP(i, N) cin >> A[i];
    int ans = binary_search(MOD, 0);
    PRint(ans);
    return 0;
}

int binary_search(int ok, int ng) {
    while (abs(ok - ng) > 1) {
        int mid = (ok + ng) / 2;
        if (isOK(mid)) ok = mid;
        else ng = mid;
    }
    return ok;
}

// 最長の丸太がl以下は可能か
bool isOK(int l) {
    int sum_cut = 0;
    REP(i, N) {
        sum_cut += A[i] / l;
        if (A[i] % l == 0) sum_cut--;
    }
    return sum_cut <= K;
}

Measured memory_bytes: 4348
import sys
sys.setrecursionlimit(300000)

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LMI(): return list(map(int, sys.stdin.readline().split()))
MOD = 10 ** 9 + 7
INF = float('inf')


N = input()
print('Yes' if '7' in N else 'No')

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

typedef long long int ll;
#define rep(i,n) for (int i = 0; i < (n); i++)
const ll mod = 1000000007;

int main() {
    int n;
    cin >> n;
    int a[n];
    rep(i,n) cin >> a[i];

    int m = 0;
    int idx = -1;
    int c = 0;
    rep(i,n) {
        if (m < a[i]) {
            m = a[i];
            idx = i;
            c = 0;
        }
        else if (m == a[i]) {
            c++;
        }
    }
    if (c) {
        rep(i,n) {
            cout << m << endl;
        }
    } else {
        int m2 = 0;
        rep(i,n) {
            if (a[i] != m) m2 = max(m2,a[i]);
        }
        rep(i,n) {
            if (i != idx) cout << m << endl;
            else cout << m2 << endl;
        }
    }
    return 0;
}


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

int main(){
	int a,b,c; cin>>a>>b>>c;

	if(a>=c)
		cout<<c+b;
	else{
		int ans = (a+1);
		c = c - ans;

		if(c > b){
			ans += 2*b;
		}else if(b>=c){
			ans+=b+c;
		}cout<<ans<<endl;
	}
	return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
// すべて右に動かすとしてもよい
// 間隔をソートし大きい順にN - 1個の間隔を消去し総和
int main() {
    #ifdef DEBUG
    std::ifstream in("/home/share/inputf.in");
    std::cin.rdbuf(in.rdbuf());
    #endif
    int N, M;
    cin >> N >> M;
    vector<int64_t> X(M), D(M);
    for(int i = 0; i < M; i++) cin >> X[i];
    sort(X.begin(), X.end());
    D[0] = 0;
    for(int i = 0; i < M - 1; i++) {
        D[i + 1] = X[i + 1] - X[i];
    }
    sort(D.begin(), D.end());
    int64_t ans = 0;
    for(int i = 0; i < M - (N - 1); i++) {
        ans += D[i];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <set>
#include <map>
#include <algorithm>

#define int long long
#define MOD7 1000000007
#define MOD9 1000000009

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

using namespace std;

int nextInt() {int a; cin >> a; return a;}
char nextChar() {char a; cin >> a; return a;}
double nextDouble() {double a; cin >> a; return a;}
string nextString() {string a; cin >> a; return a;}

void inputVector(vector<int> &v, int &n) {rep(i,n){v.push_back(nextInt());}}
void inputVector(vector<double> &v, int &n) {rep(i,n){v.push_back(nextDouble());}}
void inputVector(vector<string> &v, int &n) {rep(i,n){v.push_back(nextString());}}

int dp[1000010];
int dpodd[1000010];

signed main() {
	vector<int> v, vo;

	for (int i = 1; i <= 1000000; i++) {
		dp[i] = INT_MAX;
		dpodd[i] = INT_MAX;
	}
	
	for (int i = 1; true; i++) {
		int num = i * (i + 1) * (i + 2) / 6;
		if (num > 1000000) break;
		
		v.push_back(num);
		if (num % 2) vo.push_back(num);
	}

	for (int i = 1; i <= 1000000; i++) {
		for (int num : v) {
			if (num > i) break;
			dp[i] = min(dp[i], dp[i - num] + 1);
		}
		for (int num : vo) {
			if (num > i) break;
			dpodd[i] = min(dpodd[i], dpodd[i - num] + 1);
		}
	}

	int input;
	cin >> input;

	while (input) {
		cout << dp[input] << ' ' << dpodd[input] << endl;

		cin >> input;
	}

    return 0;
}

Measured memory_bytes: 18784
n, k = map(int, input().split())
aa = list(map(int, input().split()))

inf = 10 ** 9 * 15
ans = inf
for bits in range(2 ** n):
    selected = set()
    for shift in range(n):
        if bits & (1 << shift) > 0:
            selected.add(shift)

    if len(selected) < k:
        continue
    highest = aa[0]
    cost = 0

    for i in range(1, n):
        if highest < aa[i]:
            highest = aa[i]
        else:
            if i in selected:
                highest += 1
                cost += highest - aa[i]
    ans = min(ans, cost)
print(ans)


Measured memory_bytes: 43372
#include <stdio.h>

int main()
{
  int i, j, k, x, y, s, kakaku, maxkakaku;
  int before1, before2, before, after1, after2;
  
  while(1)
    {
      scanf("%d %d %d",&x,&y,&s);

      if(x==0)
	{
	  break;
	}
      k = 1;
      maxkakaku = 0;
      for(i=1;i<=s-1;i++)
	    {
	      before1 = (i*(100+x))/100;
	      for(j=i;j<=s-1;j++)
		{
		  before2 = (j*(100+x))/100;
		  before = before1 + before2;
		  if(before==s)
		    {
		      after1 = (i*(100+y))/100;
		      after2 = (j*(100+y))/100;
		      kakaku = after1 + after2;
		      if(maxkakaku<kakaku)
			{
			  maxkakaku = kakaku;
			}
		    }
		}
	    }
      printf("%d\n",maxkakaku);
    }       
  return 0;
}

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

const int N = 100;

int main() {
  int n;

  while (cin >> n, n != 0) {
    char f[N];
    for (int i = 0; i < n; i++) {
      cin >> f[i];
    }

    int cnt[26] = {};
    char c1 = 'A';
    char c2 = 'B';

    for (int i = 0; i < n; i++) {
      cnt[f[i] - 'A']++;
      if (cnt[f[i] - 'A'] > cnt[c2 - 'A'] && f[i] != c1) {
        c2 = f[i];
      }

      if (cnt[c2 - 'A'] > cnt[c1 - 'A']) {
        char tmp = c1;
        c1 = c2;
        c2 = tmp;
      }

      if (cnt[c1 - 'A'] > cnt[c2 - 'A'] + n - i - 1) {
        cout << c1 << ' ' << i + 1 << endl;
        break;
      }

      if (i == n - 1) {
        cout << "TIE" << endl;
      }
    }
  }

  return 0;
}

Measured memory_bytes: 3004
a = [list(map(int, input().split())) for _ in range(3)]
n = int(input())
b = [int(input()) for _ in range(n)]

for i in b:
    for j in range(3):
        for k in range(3):
            if a[j][k] == i:
                a[j][k] = 0
ans = 'No'
for i in range(3):
    if a[i][0] + a[i][1] + a[i][2] == 0:
        ans = 'Yes'
    if a[0][i] + a[1][i] + a[2][i] == 0:
        ans = 'Yes'
if a[0][0] + a[1][1] + a[2][2] == 0:
    ans = 'Yes'
if a[0][2] + a[1][1] + a[2][0] == 0:
    ans = 'Yes'
print(ans)

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

#define INF 100000000

int n,m[101][101];
int matrix(int *);
int min(int,int);

int main(){
  int m,i;
  scanf("%d",&n);
  int p[n+1];
  for(i=1;i<=n;i++){
    scanf("%d%d",&p[i-1],&p[i]);
  }
  m=matrix(p);
  printf("%d\n",m);
  return 0;
}

int matrix(int *p){
  int l,i,j,k,q;
  n=n+1;
  for(i=1;i<=n;i++){
    m[i][i]=0;
  }
  for(l=2;l<=n;l++){
    for(i=1;i<=n-l+1;i++){
      j=i+l-1;
      m[i][j]=INF;
      for(k=i;k<=j-1;k++){
	q=m[i][k]+m[k+1][j]+p[i-1]*p[k]*p[j];
	m[i][j]=min(m[i][j],q);
      }
    }
  }
  return m[1][n-1];
}
  
int min(int o,int q){
  if(o<=q){
    return o;
  }
  else return q;
}



Measured memory_bytes: 2104
#include <bits/stdc++.h>  
    using namespace std;  
    typedef long long ll;  
    const int N=3e5+20;  
    int n,m,c[N];  
    struct node{  
        int l,r,len;  
    }a[N];  
    bool cmp(node a,node b)  
    {  
        return a.len<b.len;  
    }  
    void update(int j,int k)  
    {  
        for(int i=j;i<=m;i+=(i&-i))  
            c[i]+=k;  
    }  
    int sum(int j)  
    {  
        int res=0;  
        for(int i=j;i>=1;i-=(i&-i))  
            res+=c[i];  
        return res;  
    }  
    int main()  
    {  
        while(cin>>n>>m)  
        {  
            memset(c,0,sizeof(c));//  
            for(int i=1;i<=n;i++)  
            {  
                scanf("%d%d",&a[i].l,&a[i].r);  
                a[i].len=a[i].r-a[i].l+1;  
            }  
            sort(a+1,a+n+1,cmp);  
            int k=1;  
            for(int d=1;d<=m;d++)  
            {  
                //O(m+nlogm)  
                for(;k<=n&&a[k].len<d;k++)//最多n次   
                {  
                    update(a[k].l,1);  
                    update(a[k].r+1,-1);//差分,[1..li..kd..ri,ri+1...m],树状数组统计前缀和   
                }  
                int ans=n-k+1;//区间长度>=d个数   
                //O(mlogm)  
                for(int e=d;e<=m;e+=d)  
                {  
                    ans+=sum(e);  
                }  
                cout<<ans<<endl;  
            }  
        }  
        return 0;  
    }  

Measured memory_bytes: 5632