akhauriyash/Code-Regression huggingface dataset:
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#define REP(i, n, N) for(ll i=(n);i<(N);i++)
#define RREP(i, n, N) for(ll i=(N-1);i>=(n);i--)
#define CK(n, a, b) ((a)<=(n)&&(n)<(b))
#define ALL(v) (v).begin(), (v).end()
#define MCP(a, b) memcpy(b,a,sizeof(b))
#define p(s) cout<<(s)<<endl
#define p2(a, b) cout<<(a)<<" "<<(b)<<endl
typedef long long ll;
using namespace std;
const ll mod = 1e9 + 7;
const ll inf = 1e18;

int N, M;
int P[100010], Y[100010];

string ans[100010];

vector<pair<int, pair<int, int>>> v;   //県, <年,市ID>

string create (int p, int cnt){
    string ret = "";

    int d = 100000;
    REP(i,0,6){
        ret += (string){(char)('0' + (p%(10*d))/d)};
        d /= 10;
    }

    d = 100000;
    REP(i,0,6){
        ret += (string){(char)('0' + (cnt%(10*d))/d)};
        d /= 10;
    }

    return ret;
}

int main() {
    cin>>N>>M;
    REP(i,0,M){
        cin>>P[i]>>Y[i];
        v.push_back({P[i], {Y[i], i}});
    }

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

    int cnt = 0;
    REP(i,0,M){
        if(i > 0 && v[i].first != v[i-1].first){
            cnt = 1;
        }else{
            cnt++;
        }

        ans[v[i].second.second] = create(v[i].first, cnt);
    }

    REP(i,0,M){
        cout<<ans[i]<<endl;
    }


    return 0;
}


Measured memory_bytes: 10484
#include<iostream>
#include<algorithm>
using namespace std;
bool path[2][200005];
int main(){
	int n,m;
	int i,j,k;
	int a,b,c;
	bool s=false;
	cin>>n>>m;
	for(i=0;i<m;i++){
		cin>>a>>b;
		a--,b--;
		if(a>b)swap(a,b);
		if(a==0)path[0][b]=true;
		if(b==n-1)path[1][a]=true;
	}
	for(i=0;i<n;i++){
		if(path[0][i] && path[1][i])s=true;
	}
	if(s)cout<<"POSSIBLE"<<endl;
	else cout<<"IMPOSSIBLE"<<endl;
	return 0;
}


Measured memory_bytes: 640
import sys
import math
def I():return int(sys.stdin.readline().replace("\n",""))
def I2():return map(int,sys.stdin.readline().replace("\n","").split())
def S():return str(sys.stdin.readline().replace("\n",""))
def L():return list(sys.stdin.readline().replace("\n",""))
def Intl():return [int(k) for k in sys.stdin.readline().replace("\n","").split()]
def Lx(k):return list(map(lambda x:int(x)*-k,sys.stdin.readline().replace("\n","").split()))

if __name__ == "__main__":
    a,b,c = I2()
    print(0 if a%2 == 0 or b%2 == 0 or c%2 == 0 else min(a*b,b*c,c*a))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<29;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-11;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

int main(){
	ll n,res=0;
	cin>>n;
	map<ll,ll> mp;
	vl a;
	for(ll i=1;i<=n;i++) for(ll j=i;(i+j)*(j-i+1)/2<=n;j++){
		ll t=(i+j)*(j-i+1)/2;
		mp[t]++;
		a.push_back(t);
	}
	for(auto i:a) if(n%i==0) res+=mp[n/i];
	cout<<res<<endl;
}


Measured memory_bytes: 16996
import java.util.Scanner;

public class Main{
  static int n, k;

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

    n = sc.nextInt();
    k = sc.nextInt();

    int a = 1;
    for(int i = 0; i < n; i++){
      a = Math.min(a + k, 2 * a);
    }

    System.out.println(a);
  }
}

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

int main()
{
  int N;
  string S;
  cin >> N >> S;
  int ans = 0;
  for (int i = 0; i < N - 2; i++)
  {
    if (S.at(i) == 'A' && S.at(i+1) == 'B' && S.at(i+2) == 'C')
    {
      ans++;
    }
  }
  cout << ans << endl;
}


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

int main()
{
	int l, N;
	cin >> N;

	int B[N-1];
	for(int i=0; i<N-1 && cin>>l; i++) B[i] = l;

	int sum = B[0];
	for(int i=1; i<N-1; i++) sum += (B[i-1] < B[i]) ? B[i-1] : B[i];
	sum += B[N-2];

	cout << sum; 
}

Measured memory_bytes: 256
function Main(input) {
		var str = input;
  var ans = 0;//数字の場合	
	var str = str.split("\n")[0];//一行の場合
	var num = str.split(" ");//一行の場合

	for(var i = 0;i<5;i++){
		num[i]=Number(num[i]);
		if(num[i]===0){
			ans = i +1;
			break;
			}
		}
	
		
	console.log(ans);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 29628
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb(x) push_back(x)
#define mp make_pair
#define sz(x) ((int)(x).size())
#define endl "\n"
#define fastio ios_base::sync_with_stdio(false); cin.tie(nullptr);
#define all(x) x.begin(),x.end()
#define y1 omg
#define INF 1000000010
#define FOR(x, n) for(int x=0; x<n; x++)
#define ini(x, n) memset(x, n, sizeof(x));
#define MOD ((int)1e9 + 7)
#define atoi(x) ((x)-'0')
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef pair<int, ii> iii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<vi> vvi;

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

ll n, arr[10000001], ans;

int main() {
	cin >> n;
	for (int i = 1; i <= n; i++) {
		for (int j = i; j <= n; j += i) {
			arr[j]++;
		}
		ans += i * arr[i];
	}
	cout << ans;
}

Measured memory_bytes: 81744
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;

// http://luzhiled.hatenablog.com/entry/2017/12/03/124453
string N;
int K;
int dp[10002][2][5];

// k桁目
int rec(int k = 0, bool tight = true, int num = 0){
	if(num>K)return 0LL;
	if(k==N.size())return num==K;
	int x = N[k] - '0';
	int r = (tight ? x:9);
	int &res = dp[k][tight][num];
	if(~res) return res;
	res = 0;
	for(int i=0;i<=r;++i){
		(res += rec(k+1,tight&&i==r,(num+(i!=0))) ) %= MOD;
	}
	return res;
}

int main(){
	cin >> N >> K;
	memset(dp, -1, sizeof(dp));
	cout << rec() << endl;
}


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

int main() {
    int a, b;
    cin >> a >> b;
    string s;
    cin >>s;
    string result = "Yes";
    
    if (s[a] == '-') {
        s.replace(a, 1, "1");
        for (char buf : s) {
            unsigned char ss = static_cast<unsigned char>(buf);
            if (!(isdigit(ss))) {
                result = "No";
                break;
            }
        }
    } else {
        result = "No";
    }
    
    cout << result << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cstdlib>  
#include <algorithm>
#include <string>
#include <cassert>
#include <numeric>
using namespace std;
 
int main() {
    int k;cin>>k;
    int ko = 0;
    for(int a = 1;a<=k;a++){
    	for(int b = 1;b<=k;b++){
          for(int c = 1;c<= k;c++){
             ko += gcd(gcd(a,b),c);
          }
        }
    }
    cout<<ko;
    return 0;
}

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

struct TPond
{
	int DownPoint;
	int Surface;
};

void ConstructPond(vector<TPond> &PondRow, vector<int> &DownPointRow, int InputCount)
{
	TPond Pond;
	Pond.DownPoint = DownPointRow.back();
	Pond.Surface = InputCount - DownPointRow.back();
	//????????´???????±????????????§???????±????????????????????????°?±?list???????????????
	//????????´???????±????????????§???????±????????????????????????°????????´???????±???????????????????
	while(!PondRow.empty() && Pond.DownPoint < PondRow.back().DownPoint){
		Pond.Surface += PondRow.back().Surface;
		PondRow.pop_back();
	}
	PondRow.push_back(Pond);
	DownPointRow.pop_back();
}

void Output(vector<TPond> PondRow)
{
	//?????¢???????±???????
	int SumOfSurface = 0;
	for(int i = 0; i < PondRow.size(); i++){SumOfSurface += PondRow[i].Surface;}
	//?????¢?????¨??°??¨?????????????????¢??????????????????
	cout << SumOfSurface << endl; 
	cout << PondRow.size();
	for(int i = 0; i < PondRow.size(); i++){cout << ' ' << PondRow[i].Surface;}
	cout << endl;
}

int main()
{
	//?±?(????????????????????°??¨??¢???????????±?????????)????????????list???????????????
	vector<TPond> PondRow;
	//????????????????????°????????????stack???????????????
	vector<int>   DownPointRow;
	//????????????????????°???????????????????????????????????°???????????????
	int InputCount = 0;
	while(true){
		//??????????????????????????\???????????\?????????
		char Input;
		cin >> Input;
		if(cin.good() == false){break;}
		InputCount += 1;
		//???????????\???????????????DownPointRow???????????????
		//???????????\????????????????????´?????????????????????????±?????§??????????
		if(Input == '\\'){
			DownPointRow.push_back(InputCount);
		}else if(Input == '/' && !DownPointRow.empty()){
			ConstructPond(PondRow, DownPointRow, InputCount);
		}
	}
	Output(PondRow);
	return 0;
}

Measured memory_bytes: 1328
fn main() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };
    let a: i64 = sc.read();
    let b: i64 = sc.read();
    if a >= b*2 {
        println!("{}", a-b*2);
    }else{
        println!("{}", 0);
    }
}

pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()//byteに変換
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n')
            .take_while(|&b| b != b' ' && b != b'\n')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
        .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}



Measured memory_bytes: 4352
[<AutoOpen>]
module Program

open System

let read f = stdin.ReadLine() |> f
let reada f = stdin.ReadLine().Split() |> Array.map f
let reads f = stdin.ReadLine().Split() |> Array.toList |> List.map f

let inline upperBound (array: ^T []) first last value =
    let rec loop left right =
        if left > right then
            left
        else
            let mid = left + ((right - left) >>> 1)
            if array.[mid] <= value then
                loop (mid + 1) right
            else
                loop left (mid - 1)
    loop first (last - 1)

[<EntryPoint>]
let main _ =
    let N = read int
    let LS = reada int |> Array.sort

    let mutable ans = 0
    for i in [N-1 .. -1 .. 2] do
        for j in [i-1 .. -1 .. 1] do
            let high = LS.[i]
            let mid = LS.[j]
            let bound = upperBound LS 0 LS.Length (high - mid)
            let lows = max 0 (j - bound)
            ans <- ans + lows

    Console.WriteLine(ans)
    0

Measured memory_bytes: 21808
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const ll mod = 998244353;
const int maxn = 3100;
ll a, b, c, d;
ll dp[maxn][maxn];

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

	dp[a][b] = 1LL;

	for(int i=1;i<=c;i++) {
		for(int j=1;j<=d;j++) {
			if(i == a && j == b) continue;

			dp[i][j] = (i * dp[i][j-1])%mod + (j * dp[i-1][j])%mod; dp[i][j] %= mod;
			dp[i][j] = dp[i][j] + mod - (dp[i-1][j-1] * (i - 1) * (j - 1))%mod; dp[i][j] %= mod;
		}
	}

	cout<<dp[c][d]<<"\n";
}

Measured memory_bytes: 76188
//B - Trained?: 
//Assunto:
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define loop(i, a, b) for(int i = a; i < b; i++)
#define loopBack(i, a, b) for(int i = a; i >= b; i--)
#define INF INT_MAX
#define LINF LLONG_MAX
#define DINF DBL_MAX
#define MAX 100050
#define MOD 1000000007
using namespace std;
typedef long long int ll;
typedef pair<int, int> ii;

int main() {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    //freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
    int n, ans = 0, x;
    cin >> n;
    vector<int> buttons(n+1);
    loop(i, 1, n+1) cin >> buttons[i];
    x = 1;
    loop(i, 1, n+1) {
        if(x == 2) break;
        x = buttons[x];
        ans++;
    }
    if(x != 2) ans = -1;
    cout << ans << '\n';
}

Measured memory_bytes: 640
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<string>

using namespace std;

typedef long long ll;

map<pair<string, string>, ll> leftMap, rightMap;

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

	string leftS, rightS;
	for (int i = 0; i < n; i++)leftS.push_back(s[i]);
	for (int i = 2 * n - 1; i >= n; i--)rightS.push_back(s[i]);

	for (int i = 0; i < (1 << n); i++) {
		string f, s;
		if (i & 1) {
			for (int j = 0; j < n; j++)
				if((i >> j) & 1)f.push_back(leftS[j]);
				else s.push_back(leftS[j]);
		}
		else {
			for (int j = 0; j < n; j++)
				if ((i >> j) & 1)s.push_back(leftS[j]);
				else f.push_back(leftS[j]);
		}
		leftMap[make_pair(f, s)]++;
	}

	for (int i = 0; i < (1 << n); i++) {
		string f, s;
		if (i & 1) {
			for (int j = 0; j < n; j++)
				if ((i >> j) & 1)f.push_back(rightS[j]);
				else s.push_back(rightS[j]);
		}
		else {
			for (int j = 0; j < n; j++)
				if ((i >> j) & 1)s.push_back(rightS[j]);
				else f.push_back(rightS[j]);
		}
		rightMap[make_pair(f, s)]++;
	}

	ll ans = 0;
	for (auto it = leftMap.begin(); it != leftMap.end(); it++) {
		auto tmp = (*it).first;
		ans += (rightMap[make_pair(tmp.second, tmp.first)] + rightMap[make_pair(tmp.first, tmp.second)]) * (*it).second / 4;
	}
	ans *= 2LL;
	cout << ans  << "\n";
	return 0;
}

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

int main() {
	int count[26] = { 0 };
	char str[101];
	char end = str[0];
	cin >> str;
	for (int i = 0; str[i] != end; ++i) {
		count[str[i] - 'a']++;
	}
	for (int i = 0; i < 26; ++i) {
		if (count[i] % 2 != 0) {
			cout << "No\n";
			return 0;
		}
	}
	cout << "Yes\n";
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include<limits.h>
#include<iomanip>
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(),v.end()
#define RALL(v) v.rbegin(),v.rend()
#define check(v) rep(i,v.size()) cout << v[i] << " ";\
cout << endl
#define INF 1e8
typedef long long ll;
using namespace std;
//オーバーフローに気をつけろよおおおおおお
//確認忘れるなよおおおおおお

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int h, w; cin >> h >> w;

    queue<pair<int,int>> Q;

    vector<string> field(h);
    vector<vector<int>> dismap(h,vector<int> (w, INF));
    rep(i, h) {
        cin >> field[i];
        rep(j,w) {
            if(field[i][j]=='#') {
                dismap.at(i).at(j) = 0;
                Q.push({i,j});
            }
        }
    }

    while(!Q.empty()) {
        int x = Q.front().second;
        int y = Q.front().first;
        Q.pop();

        if(x+1<w) {
            if(dismap.at(y).at(x+1)>dismap.at(y).at(x)+1) {
                dismap.at(y).at(x+1) = dismap.at(y).at(x)+1;
                Q.push({y,x+1});
            }
        }
        if(x-1>=0) {
            if(dismap.at(y).at(x-1)>dismap.at(y).at(x)+1) {
                dismap.at(y).at(x-1) = dismap.at(y).at(x)+1;
                Q.push({y,x-1});
            }
        }
        if(y+1<h) {
            if(dismap.at(y+1).at(x)>dismap.at(y).at(x)+1) {
                dismap.at(y+1).at(x) = dismap.at(y).at(x)+1;
                Q.push({y+1,x});
            }
        }
        if(y-1>=0) {
            if(dismap.at(y-1).at(x)>dismap.at(y).at(x)+1) {
                dismap.at(y-1).at(x) = dismap.at(y).at(x)+1;
                Q.push({y-1,x});
            }
        }
    }
    int ans = 0;
    rep(i,h) {
        rep(j,w) {
            ans = max(ans,dismap.at(i).at(j));
        }
    }
    cout << ans << endl;

    return 0;
}

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

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define LCM(a, b) (a) / __gcd((a), (b)) * (b)
#define CEIL(a, b) (a)/(b)+(((a)%(b))?1:0)
#define ln '\n'

using namespace std;
using LL = long long;
using ldouble = long double;
using P = pair<int, int>;
using LP = pair<LL, LL>;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1e9 + 7;
static const int SIZE = 200005;

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

vector<LL> Div(LL n) {
    vector<LL> ret;
    for(LL i = 1; i * i <= n; ++i) {
        if(n % i == 0) {
            ret.pb(i);
            if(i * i != n) ret.pb(n / i);
        }
    }
    sort(all(ret));
    return ret;
}

vector<pair<P, LL>> edges;
int root[SIZE];

void init() {
    for( int i = 0; i < SIZE; ++i ) {
        root[i] = i;

    }
}

int Root( int x ) {
    if( x == root[x] ) return x;
    return root[x] = Root( root[x] );

}

bool Unite( int x, int y ) {
    int rx, ry;
    rx = Root( x );
    ry = Root( y );

    if( rx == ry ) return false;
    if( rx < ry ) {
        root[ry] = rx;

    } else {
        root[rx] = ry;

    }
    return true;

}

/*
 * pair< long long, P >
 */
LL Kruskal() {
    vector<pair<LL, P>> ed(int(edges.size()));
    for(int i = 0; i < edges.size(); ++i) {
        ed[i].F = edges[i].S;
        ed[i].S = edges[i].F;
    }

    sort(all(ed));

    LL res = 0;
    for(int i = 0; i < ed.size(); ++i) {
        if(Unite(ed[i].S.F, ed[i].S.S)) {
            res += ed[i].F;
        }
    }
    return res;

}



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

    init();
    int N;
    cin >> N;
    vector<pair<P, int>> v(N);
    for(int i = 0; i < N; ++i) {
        cin >> v[i].F.F >> v[i].F.S;
        v[i].S = i + 1;
    }

    sort(all(v));
    for(int i = 0; i < N - 1; ++i) {
        edges.pb(MP(MP(v[i].S, v[i + 1].S), v[i + 1].F.F - v[i].F.F));
        swap(v[i].F.F, v[i].F.S);
    }
    swap(v[N - 1].F.F, v[N - 1].F.S);

    sort(all(v));
    for(int i = 0; i < N - 1; ++i) {
        edges.pb(MP(MP(v[i].S, v[i + 1].S), v[i + 1].F.F - v[i].F.F));
    }

    cout << Kruskal() << endl;

    return 0;
}



Measured memory_bytes: 9324
#frog
N = int(input())
h = list(map(int,input().split()))
dp = [10000000000000] * N
dp[0] = 0

def dpf():
    for i in range(1,N):
        x = abs( h[i] - h[i-1] ) + dp[i-1]
        y = abs( h[i] - h[i-2] ) + dp[i-2]
        if x >=y:
            dp[i] = y
        else:
            dp[i] = x

def solve():
    dpf()
    print(dp[N-1])

if __name__ == "__main__":
    solve()


Measured memory_bytes: 13976
import java.util.Scanner;

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

		int[] scores = new int[10000];
		int maxscore, max = 0, minscore, min = 0, sum;

		while (true) {
			int n = sc.nextInt();
			if (n == 0) {
				break;
			}

			maxscore = 0;
			minscore = 1000;
			sum = 0;

			for (int i = 0; i < n; i++) {
				scores[i] = sc.nextInt();

				if (scores[i] <= minscore) {
					min = i;
					minscore = scores[i];
				}
				if (maxscore <= scores[i]) {
					max = i;
					maxscore = scores[i];
				}
			}
			for (int i = 0; i < n; i++) {
				if (i != min && i != max) {
					sum += scores[i];
				}
			}
			System.out.println(sum / (n - 2));
		}
	}
}

Measured memory_bytes: 28760
class gv:
    input = None;
    
def build():
    gv.str = input()

def solve():
    slen = len(gv.str)
    if (slen&1) == 1:
        print("No")
        return
    
    for i in range(0,slen,2):
        if (gv.str[i:i+2] == "hi") :
            pass
        else :
            print("No")
            return
    
    print("Yes")
    
    

build()
solve()


Measured memory_bytes: 3060
n=int(input())
ans=[]
def rec(i,s):
    if i == n:
        ans.append(s)
        return True
    else:
        if len(set(s)) == 1:
            rec(i+1,s+"a")
            rec(i+1,s+"b")
        if len(set(s)) == 2:
            rec(i+1,s+"a")
            rec(i+1,s+"b")
            rec(i+1,s+"c")
        if len(set(s)) == 3:
            rec(i+1,s+"a")
            rec(i+1,s+"b")
            rec(i+1,s+"c")
            rec(i+1,s+"d")
        if len(set(s)) == 4:
            rec(i+1,s+"a")
            rec(i+1,s+"b")
            rec(i+1,s+"c")
            rec(i+1,s+"d")
            rec(i+1,s+"e")
        if len(set(s)) == 5:
            rec(i+1,s+"a")
            rec(i+1,s+"b")
            rec(i+1,s+"c")
            rec(i+1,s+"d")
            rec(i+1,s+"e")
            rec(i+1,s+"f")
        if len(set(s)) == 6:
            rec(i+1,s+"a")
            rec(i+1,s+"b")
            rec(i+1,s+"c")
            rec(i+1,s+"d")
            rec(i+1,s+"e")
            rec(i+1,s+"f")
            rec(i+1,s+"g")
        if len(set(s)) == 7:
            rec(i+1,s+"a")
            rec(i+1,s+"b")
            rec(i+1,s+"c")
            rec(i+1,s+"d")
            rec(i+1,s+"e")
            rec(i+1,s+"f")
            rec(i+1,s+"g")
            rec(i+1,s+"h")
        if len(set(s)) == 8:
            rec(i+1,s+"a")
            rec(i+1,s+"b")
            rec(i+1,s+"c")
            rec(i+1,s+"d")
            rec(i+1,s+"e")
            rec(i+1,s+"f")
            rec(i+1,s+"g")
            rec(i+1,s+"h")
            rec(i+1,s+"i")
        if len(set(s)) == 9:
            rec(i+1,s+"a")
            rec(i+1,s+"b")
            rec(i+1,s+"c")
            rec(i+1,s+"d")
            rec(i+1,s+"e")
            rec(i+1,s+"f")
            rec(i+1,s+"g")
            rec(i+1,s+"h")
            rec(i+1,s+"i")
            rec(i+1,s+"j")
rec(1,"a")
print("\n".join(ans))    
        

Measured memory_bytes: 15184
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
#include <deque>
#include <iomanip>
#include <limits>
#include <fstream>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N;
  cin >> N;
  int K;cin>>K;
  ll x[N];
  FOR(i,0,N) cin >> x[i];
  ll ans = 1e9;
  FOR(i,0,N) {
    int j = i + K - 1;
    if(j >= N) break;
    if(x[i] <= 0 && x[j] <= 0) {
      ans = min(ans, abs(x[i]));
    } else if(x[i] <= 0 && x[j] >= 0) {
      ans = min(ans, abs(x[i]) + abs(x[j]) + min(abs(x[i]), abs(x[j])));
    } else {
      ans = min(ans, x[j]);
    }
  }
  cout << ans << endl;
}

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

const ll MOD = 1000000007;

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

long long modinv(long long a, long long m)
{
    long long b = m, u = 1, v = 0;
    while (b)
    {
        long long t = a / b;
        a -= t * b;
        swap(a, b);
        u -= t * v;
        swap(u, v);
    }
    u %= m;
    if (u < 0)
        u += m;
    return u;
}

int main()
{
    ll n, a, b;
    cin >> n >> a >> b;

    vector<ll> dp(max(a, b) + 1, 0);

    dp.at(0) = 1;
    rep(i, max(a, b))
    {
        dp.at(i + 1) = ((dp.at(i) * (n - i)) % MOD * modinv(i + 1, MOD)) % MOD;
    }

    ll ans = modpow(2, n, MOD) - 1 - dp.at(a) - dp.at(b);
    while (ans < 0)
    {
        ans += MOD;
    }

    ans %= MOD;

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

Measured memory_bytes: 4784
n, k = gets.split.map &:to_i
as = gets.split.map &:to_i

ac, wa = as.max, 0
while ac > wa + 1
  wj = (ac + wa) / 2
  if as.sum { |a| (a-1) / wj } <= k
    ac = wj
  else
    wa = wj
  end
end

p ac

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

int main() {
  int n;
  cin >> n;

  ll ans = 0;
  for (int i = 1; i <= n; i++) {
    if (i % 3 == 0 && i % 5 == 0) continue;
    if (i % 3 == 0) continue;
    if (i % 5 == 0) continue;
    ans += i;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;
const ll mod=1000000007;
const ll BIG=1e15;

bool des[100001];

int main(){
    int N,M;
    cin>>N>>M;
    vector<pair<int,int>> d;
    for(int i=0;i<M;i++){
        int x,y; cin>>x>>y;
        d.push_back(make_pair(y,x));
    }
    int ans=0;
    sort(d.begin(),d.end());
    for(int i=0;i<M;i++){
        int a=d.at(i).second, b=d.at(i).first;
        bool okay=false;
        for(int j=a;j<b;j++) if(des[j]){
            okay=true;
            break;
        }
        if(!okay){des[b-1]=true; ans++;}
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 1400
#include<cstdio>
#include<cstring>
char str[200005];
int main()
{
    scanf("%s",str);
    int len=strlen(str);
    for(int i=0;i<len;i++)
    {
        if(str[i]=='A')
        {
            for(int j=len-1;j>=i;j--)
            {
                if(str[j]=='Z')
                {
                    printf("%d\n",j-i+1);
                    return 0;
                }
            }
        }
    }
    return 0;
}


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

vector<vector< pint> > a;
int n;

bool judge(int bit){
    rep(i,n){//i番目の人について調べる
        if(!(bit & (1<<i))) continue;
        
        rep(j,a[i].size()){
            pint xy = a[i][j];
            int x = xy.first;
            int y = xy.second;

            if(y==1 && !(bit & (1<<x))) return false;

            if(y==0 && (bit & (1<<x))) return false;
        }
    }
    return true;
}



int main(){
    cin >> n;
    a.resize(n);
    rep(i,n){
        int A; cin >> A;
        a[i].resize(A);
        rep(j,A){
            cin >> a[i][j].first >> a[i][j].second;
            --a[i][j].first;
        }
    }

    int res = 0;
    for(int bit=0;bit<(1<<n);++bit){

        if(judge(bit)){
            int ct=0;
            rep(i,n){
                if(bit & (1<<i)) ct++;
            }
            res = max(res,ct);
        }
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF LLONG_MAX
#define ll  long long
#define ull unsigned long long
#define rep(i,n) for(int i=0; i<n; ++i)
#define MOD 1000000007
using namespace std;
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;}
inline void cinV(string &a){char buf[100000000]; scanf("%s", buf); a = buf;}
inline void cinV(int &a){scanf("%d", &a);}

int main() {
  int N; string NS; cinV(NS); N = atoi(NS.c_str());
  int odd = 0;
  rep(i, N) {
    int A; cinV(A);
    if(A%2) ++odd;
  }
  printf("%s\n", odd%2?"NO":"YES");
}


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

int main()
{
	int i;
	int n;

	i = 0;
	scanf("%d", &n);
	while ((n % 1000) != 0)
	{
		i++;
		n++;
	}
	printf("%d\n", i);
	return 0;
}

Measured memory_bytes: 1732
s = input()
if s == "SUN":
    x = 7
if s == "MON":
    x = 6
if s == "TUE":
    x = 5
if s == "WED":
    x = 4
if s == "THU":
    x = 3
if s == "FRI":
    x = 2
if s == "SAT":
    x = 1
print(x)


Measured memory_bytes: 2940
from collections import OrderedDict

N = int(input())
a = [int(v) for v in input().split()]
color = OrderedDict([
    (399, 0),
    (799, 0),
    (1199, 0),
    (1599, 0),
    (1999, 0),
    (2399, 0),
    (2799, 0),
    (3199, 0)
])
free_num = 0

for v in a:
    if v >= 3200:
        free_num += 1
    else:
        for top in color.keys():
            if v <= top:
                color[top] += 1
                break

ans_min = 0
for v in color.values():
    if v != 0:
        ans_min += 1

ans_max = ans_min + free_num
if ans_min == 0:
    ans_min += 1

print('{0} {1}'.format(ans_min, ans_max))

Measured memory_bytes: 3316
#include "bits/stdc++.h"
 
typedef long long ll;
#define int ll
#define fi first
#define se second
#define SORT(a) sort(a.begin(),a.end())
#define rep(i,n) for(int i = 0;i < (n) ; i++) 
#define REP(i,n) for(int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define INF LLONG_MAX/2
#define all(x) (x).begin(),(x).end()
#define debug(x) cerr<<#x<<": "<<x<<endl
#define debug_vec(v) cerr<<#v<<":";rep(i,v.size())cerr<<" "<<v[i];cerr<<endl
using namespace std;
typedef pair<int,int> pii;
int MOD = 998244353;

signed main(){

    int n;
    cin >> n;
    map<vector<int>,int> m;
    rep(i,n){
        string s;
        cin >> s;
        vector<int> k(26,0);
        rep(j,10){
            k[s[j]-'a']++;
        }
        // rep(j,26)cerr << k[j];
        // cerr << endl;
        m[k]++;
    }
    int ans = 0;
    for(auto x:m){
        ans += x.se*(x.se -1)/2;
    }
    cout << ans << endl;


    
    return 0;
}

// g++ -std=c++14 code1.cpp
// rm -r -f test;oj dl https://cf17-final-open.contest.atcoder.jp/tasks/cf17_final_a
// rm -r -f test;oj dl http://abc137.contest.atcoder.jp/tasks/abc137_b


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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

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

typedef long long ll;
typedef long double R;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

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

// Problem Specific Parameter:

int main() {
  int a, b, c; cin >> a >> b >> c;
  set<int> st;
  st.insert(a);
  st.insert(b);
  st.insert(c);
  cout << st.size() << endl;

  return 0;
}




Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		if(a==b && a!=c)
		{
			System.out.println(c);
		}
		else if(a!=b && a==c)
		{
			System.out.println(b);
		}
		else {
			System.out.println(a);
		}

	}}

Measured memory_bytes: 23764
import sys
input = sys.stdin.readline

n, m = map(int, input().split())

a_set = {int(input()) for _ in range(m)}

ans_list = []

ans_list = [0] * (n + 1)

for index in range(n + 1):
    if index == 0:
        ans_list[index] += 1
        continue
    if index == 1 and (index not in a_set):
        ans_list[index] += ans_list[index - 1]
        continue

    if index not in a_set:
        if (index - 1) not in a_set:
            ans_list[index] += ans_list[index - 1]
            ans_list[index] %= 1000000007
        if (index - 2) not in a_set:
            ans_list[index] += ans_list[index - 2]
            ans_list[index] %= 1000000007

print(ans_list[n])


Measured memory_bytes: 11884
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rep3(i, l, n) for (int i = l; i < n; ++i)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define out(a) cout << a << endl
#define outa(a, n) rep(_, n) cout << a[_] << " "; cout << endl
#define SZ(v) (int)v.size()
#define inf (int)(1e9+7)

bool comp(pii a, pii b) {
    if (a.S != b.S) return a.S > b.S;
    return a.F > b.F;
}
int main() {
    int n;
    cin >> n;
    vector<pii> r(n), b(n);
    rep(i, n) cin >> r[i].F >> r[i].S;
    rep(i, n) cin >> b[i].F >> b[i].S;
    sort(r.begin(), r.end(), comp);
    sort(b.begin(), b.end()); // x小さい順
    
    // cout << endl; rep(i, n) out(r[i].F << " " << r[i].S);
    map<int, int> mp;
    rep(i, n) {
        rep(j, n) {
            if (mp[j] == 0 && b[i].F > r[j].F && b[i].S > r[j].S) {
                mp[j] = 1;
                break;
            }
        }
    }
    int c = 0;
    for (auto e : mp) if (e.S) c++;
    out(c);
    
}
/*
 3
 1 2
 1 1
 1 3
 2 3
 3 2
 2 1
 
 
 4
 2 1
 4 2
 4 5
 1 2
 5 2
 1 1
 4 1
 4 5
 
 */




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  char c;
  cin >> c;
 
  if(c == 'a'||c == 'e'||c == 'i'||c == 'o' || c== 'u') {
    cout << "vowel" << endl;
  }
  else {
    cout << "consonant" << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <math.h>
#include <vector>
#include <map>
#include <queue>
#include <utility>
#include <algorithm>
#include <string>
using namespace std;

int main() {
  int D;
  cin >> D;
  cout << "Christmas";
  for (int i = 0; i < 25 - D; i++) {
	  cout << " Eve";
	}
  cout << endl;
  return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
using namespace std;

int main()
{
    string s;
    cin >> s;
    int n = s.size();

    long long ans = 0;
    for(int i=0; i<(1<<(n-1)); ++i){
        bitset<10> bs(i);
        long long sum = 0;
        long long a = 0;
        for(int j=0; j<n; ++j){
            a *= 10;
            a += s[j] - '0';
            if(!bs[j]){
                sum += a;
                a = 0;
            }
        }
        ans += sum;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
card ={'S': [0]*13,
       'H': [0]*13,
       'C': [0]*13,
       'D': [0]*13
}

n = int(input())

for i in range(1,n+1):
    m,num = input().split()
    num = int(num)
    card[m][num-1] =1

for c in ["S","H","C","D"]:
    for j in range(1,14):
        if (card[c][j-1]==0):
            print(c,str(j))



Measured memory_bytes: 5600
import java.util.*;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String[] tenki = {"Sunny", "Cloudy", "Rainy"};
		int count = 0;
		for (int i = 0; i < 3; i++) {
			count++;
			if (count >= 3) {
				count = 0;
			}
			if (s.equals(tenki[i])) {
				System.out.println(tenki[count]);
			}
		}
	}
}

Measured memory_bytes: 19412
#include<bits/stdc++.h>
using namespace std;
int main(){
    long long n,a,ans=0,m;
    cin>>n;
    for(int i=1;i<=5;i++){
        cin>>a;
        if(i==1){
            m=a;
        }
        else if(a<m){
            m=a;
        }
    }
    if(n%m==0){
        ans=5+n/m-1;
    }
    else{
        ans=5+n/m;
    }
    cout<<ans<<endl;
    return(0);
}

Measured memory_bytes: 256
<?php
fscanf(STDIN, "%d %d %d %d", $a, $b, $c, $d);

$count = 1;
while (($a > 0) && ($c > 0)) {
    if (($count % 2) == 0) {
        $a -= $d;
    } else {
        $c -= $b;
    }
    $count++;
}


if (($count % 2) == 0) {
    echo "Yes\n"; 
} else {
    echo "No\n";
}

?>

Measured memory_bytes: 16172
#include <stdio.h>
int n, m, l, g, e;
int a[15], b[15];
int x[15][15], y[15][15];
int ans;
int main() {
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%d", a + i);
		for (int j = 0; j < a[i]; j++) {
			scanf("%d%d", x[i] + j, y[i] + j);
			x[i][j]--;
		}
	}
	m = 1;
	for (int i = 0; i < n; i++) {
		m *= 2;
	}
	for (int i = 0; i < m; i++) {
		l = i;
		g = 1;
		e = 0;
		for (int j = 0; j < n; j++) {
			b[j] = l % 2;
			l /= 2;
			e += b[j];
		}
		for (int j = 0; j < n; j++) {
			if (b[j]) {
				for (int k = 0; k < a[j]; k++) {
					if (b[x[j][k]] != y[j][k]) {
						g = 0;
					}
				}
			}
		}
		if (g) {
			if (ans < e)ans = e;
		}
	}
	printf("%d\n", ans);
}


Measured memory_bytes: 1732
# -*- coding: utf-8 -*-
"""
Created on Sun Aug 26 11:59:46 2018

@author: maezawa
"""

n, m = list(map(int, input().split()))
array = [[0]*n for _ in range(n)]
for i in range(m):
    ai, bi = list(map(int, input().split()))
    array[ai-1][bi-1] = 1
    array[bi-1][ai-1] = 1

#print(array)
#dp = [[-1]*n for _ in range(n)]
done = []

def f(i,done):
    if i in done:
        return 0
    if len(done) == n-1:
        return 1
    if sum(array[i]) == 1 and i != 0:
        return 0
    #if dp[i][j] != -1:
    #    return dp[i][j]
    donecopy = done + [i]
    #print(donecopy)
    ans = sum([f(bi,donecopy) for bi in range(n) if array[i][bi] != 0])
    return ans

print(f(0,done))

Measured memory_bytes: 3064
//バケット法
#include <iostream>
using namespace std;

int main()
{
  int N;
  int d[110];
  cin >> N;
  for (int i = 0; i < N; i++)
  {
    cin >> d[i];
  }
  int num[110] = {0}; //　バケット
  for (int i = 0; i < N; i++)
  {
    num[d[i]]++;
  }
  
  int res = 0;
  for (int i = 1; i <= 100; i++) //1~100
  {
    if (num[i])
    {
      res++;
    }
  }
  cout << res << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std ;
#define ll long long
#define pb push_back
const ll N = 2000007 ;
#define mod 1000000007
ll lcm[N] , pw[N][42],use[N],cnt[N] ;
vector< pair<ll,ll> >prdiv[N] ;
vector<ll> us ;

void glcm (ll n) {
    if (cnt[n]) return ;
    cnt[n] = 1 ;
    ll i ,num=n ;
    for (i = 2 ; i*i<=n ; i++) {
        ll x = 0 ;
        while(n%i==0){
            x++; n/=i ;
        }
        if (x) { prdiv[num].pb( {i,x} ) ;
            lcm[i] = max(lcm[i],x) ;
          if (!use[i])  us.pb(i) ;
          use[i] = 1 ;
        }

    }
    if (n>1) { prdiv[num].pb( {n,1} ) ; lcm[n]= max(lcm[n],1LL) ; if (!use[n]) us.pb(n) ; use[n]= 1;  }

}

ll ge (ll n) {
    ll res = 1 ;

    for ( auto &it : prdiv[n]) {
        ll x = lcm[it.first] ;
       // cout << it.first << ' ' << x << endl ;
        lcm[it.first] -= it.second ;
        it.second = x ;
    }
    ll z = us.size() ;
    for (ll i = 0 ; i< z ; i++) {
        //cout << lcm[us[i]] << ' ' ;
        res*=pw[us[i]][lcm[us[i]]] ;
        res%=mod ;
    }

    for (auto &it : prdiv[n]) {
        ll x = it.second - lcm[it.first] ;
        lcm[it.first] = it.second ;
        it.second = x ;
    }

    return res ;

}

int main() {
    vector<ll>pr, v ;
    for ( ll i = 2 ; i<=N ; i++) {
        if (!use[i]) {
            for (ll j = i+i ; j<=N ; j+=i )
                use[j] = 1 ;
            pr.pb(i) ;
        }

    }
    memset(use,0,sizeof use) ;
    ll n = pr.size() ;
   // cout << n << endl ;
    ll i , j ;
    for ( i = 0 ; i< n ; i++) {
          ll  x = 1 ;
        for (j = 0 ; j<40 ; j++) {
            pw[pr[i]][j] = x ;
            x*=pr[i] ;
            x%=mod ;
        }
    }
  //  for ( i = 0 ; i<10 ; i++) cout << pw[2][i] << ' ' <<pw[3][i] << endl ;
    scanf("%lld",&n) ;
    v.resize(n) ;
    for ( i = 0 ; i< n ; i++) {
        scanf("%lld",&v[i]) ;
        glcm(v[i]) ;
    }
    ll ans = 0 ;
    for ( i = 0 ; i< n ; i++) {
        ans += ge(v[i]) ;
        ans%=mod ;
       // cout << ans << endl ;
    }
    cout << ans << endl ;



    return 0 ;
}



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

typedef long long ll;

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

    if(a==x)
    {
        cout<<"YES\n";
        return 0;
    }
    else
    {
        if(a>x)
        {
            cout<<"NO\n";
            return 0;
        }
        if(a+b>x)
        {
            cout<<"YES\n";
            return 0;
        }
    }
    cout<<"NO\n";
        return 0;
}


Measured memory_bytes: 256
//Switches
#include<bits/stdc++.h>
using namespace std;
#define int long long int 
signed main()
{
    int n,m;
    cin>>n>>m;
    vector<vector<int>> connect(m);
    int p[m];
    for(int i=0;i<m;i++)
    {
        int num_switch;
        cin>>num_switch;
        for(int j=0;j<num_switch;j++)
        {
            int s;
            cin>>s;
            connect[i].push_back(s);
        }
    }
    for(int i=0;i<m;i++)
        cin>>p[i];
    
    int res=0;
    for(int bit=0;bit<(1<<n);bit++)
    {
        int lighton=0;
        for(int i=0;i<m;i++)
        {
            int on=0;
            for(int j=0;j<connect[i].size();j++)
            {
                if(bit & (1<<connect[i][j]-1))
                on++;
            }
            if(on%2==p[i])
            lighton++;
        }
        if(lighton==m)
        res++;
    }
    cout<<res<<endl;
}

Measured memory_bytes: 256
N,M = map(int,input().split())
N_High =list(map(int,input().split()))
N_Dict = {}
for i in range(M):
    a,b = map(int,input().split())
    if N_High[a-1] == N_High[b-1]:
        N_Dict[a] = 1
        N_Dict[b] = 1
    elif N_High[a-1] > N_High[b-1]:
        N_Dict[b] = 1
    elif N_High[a-1] < N_High[b-1]:
        N_Dict[a] = 1

print(N-len(N_Dict))

Measured memory_bytes: 19888
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <map>
#include <algorithm>  // std::unique
#include <cmath>
#include <limits.h>
#include <queue>
#include <unordered_map>
#include <sstream>      // std::ostringstream

#define _USE_MATH_DEFINES
#include <math.h>
using namespace std;

using ll = long long;
constexpr auto PrimeBigNum10_9_7 = 1000000007;

std::vector<std::string> split(const std::string &str, char sep)
{
	std::vector<std::string> v;
	std::stringstream ss(str);
	std::string buffer;
	while (std::getline(ss, buffer, sep)) {
		v.push_back(buffer);
	}
	return v;
}


// 素数判定
template <typename T>
bool IsPrimeNumber(T value) {

	for (int i = 2; i * i <= value; ++i) {
		if ((value % i) == 0) {
			return true;
		}
	}
	return false;
}

// 桁数判定
template <typename T>
T GetFigureLength(T value) {
	T figure = 1;
	while (value >= 10) {
		value /= 10;
		++figure;
	}
	return figure;
}

// 素因数分解結果
template <typename T>
map<T, T> GetPrimeFactorize(T value) {

	map<T, T> res;

	for (T i = 2; i * i <= value; ++i) {
		if ((value%i) != 0)	continue;

		T count = 0;
		while ((value % i) == 0) {
			value /= i;
			++count;
		}

		res[i] = count;
	}

	if (value != 1) {
		res[value] = 1;
	}
	return res;
}

void DebugPrint(const vector<ll>& vec) {
	cout << "{";
	for (auto itr = vec.begin(); itr != vec.end(); ++itr) {
		cout << *itr << ",";
	}
	cout << "}" << endl;
}

// valueが2のx乗以下である計算
ll calc2x(ll value) {
	ll n = 0;
	while (value > 0) {
		value /= 2;
		++n;
	}
	return n;
}

struct Vec2 {
	double x;
	double y;

	void rotate(double rad) {
		double s = sin(rad);
		double c = cos(rad);
		double tmpX = this->x*c - this->y*s;
		double tmpY = this->x*s + this->y*c;
		this->x = tmpX;
		this->y = tmpY;
	}
};

int main(void) {

	ll a;
	string b;

	cin >> a >> b;

	auto bVec = split(b, '.');

	auto ansA = a * std::stol(bVec[0]);

	auto ansB = a * std::stol(bVec[1])/100;

	cout << ansA + ansB << endl;
	return 0;
}


Measured memory_bytes: 3648
#include<bits/stdc++.h>
#define int long long
#define pb push_back
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define all(a) (a).begin(),(a).end()
#define X first
#define Y second
#define Max 1000
using namespace std;
const int N=1e5+5;
int dp[N];
int w[105],val[105];
void solve()
{
    int n,wt,ans=0; cin>>n>>wt;
    for(int i=0;i<n;i++)cin>>w[i]>>val[i];
    for(int i=0;i<n;i++)
    {
        for(int j=wt-w[i];j>=0;j--)
        {
            dp[j+w[i]]=max(dp[j+w[i]],dp[j]+val[i]);
            ans=max(ans,dp[j+w[i]]);
        }
    }
    cout<<ans;
    return;
}
signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t; t=1;
    while(t--)solve();
    return 0;
}


Measured memory_bytes: 4352
n=int(input())
h=list(map(int,input().split()))
h[0]-=1
yn=0
for i in range(n-1):
    if h[i]+1<=h[i+1]:
        h[i+1]-=1
    if h[i]>h[i+1]:
        yn=1
        break
if yn==1:
    print("No")
else:
    print("Yes")


Measured memory_bytes: 14252
#include <cstdio>
#include <cstring>
using namespace std;
int x;
int n=100003;
bool is_prime[100005];
void init(){
	memset(is_prime,true,sizeof(is_prime));
	is_prime[1]=false;
	for (int i=2;i*i<=n;i++){
		if (is_prime[i]){
			for (int j=2*i;j<=n;j+=i){
				is_prime[j]=false;
			}
		}
	}
}
int main(){
	init();
	scanf("%d",&x);
	for (int i=x;;i++){
		if (is_prime[i]){
			printf("%d",i);
			break;
		}
	}
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define     fast                    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define     ll                      long long
#define     pb                      push_back
#define     M                       1000000007
using namespace std;
int main()
{
    ll m,n,x,y,sum=0;
    cin>>x>>y;
    if(x%y==0) cout<<0<<endl;
    else cout<<1<<endl;


}


Measured memory_bytes: 3596
#![allow(unused_imports)]
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(deprecated)]

use std::cell::RefCell;
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Formatter, Write as FmtWrite};
use std::io::{stderr, stdin, BufRead, Write};
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;
use std::usize;

const MOD_10_9_7: u64 = 1_000_000_007;
const INF: i64 = 1_000_000_000_000;
const MIN_INF: i64 = -1_000_000_000_000;

/// FYI: https://github.com/vain0x/scan-bench
#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($t:ty) =>
        (rl().parse::<$t>().unwrap());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

fn rl() -> String {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    buf.trim_right().to_owned()
}

fn main() {
    let s: String = read!(String);

    let a = s.replace(",", " ");
    println!("{}", &a);
}


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

const int INF = 1<<30;
int V, E, R;

typedef struct{
    int to, d;
}Edge;

vector<int> dijkstra(vector<vector<Edge>> &G, int s){
    vector<int> d(V, INF);
    
    priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> que;
    d[s] = 0;
    que.push({d[s], s});
    
    while(!que.empty()){
        auto p = que.top(); que.pop();
        if(d[p.second] < p.first)
            continue;
        
        for(auto edge: G[p.second]){
            if(d[edge.to] > d[p.second] + edge.d){
                d[edge.to] = d[p.second] + edge.d;
                que.push({d[edge.to], edge.to});
            }
        }
    }
    return d;
}

int main(){
    cin >> V >> E >> R;
    vector<vector<Edge>> G(V);
    for(int i=0; i<E; i++){
        int s, t, d;
        cin >> s >> t >> d;
        G[s].push_back({t, d});
    }
    
    vector<int> vec = dijkstra(G, R);
    for(auto v: vec){
        if(v == INF)
            cout << "INF" << endl;
        else
            cout << v << endl;
    }
    
    return 0;
}

Measured memory_bytes: 12864