akhauriyash/Code-Regression huggingface dataset:
/**
 *      ABC 50 A
 *      author  : kyomukyomupurin
 *      created : 2018-09-05 02:47:55
**/

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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int A; cin >> A; char op; cin >> op; int B; cin >> B;
    op == '+' ? cout << A + B : cout << A - B;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define o(a) cout << a << endl
#define int long long
#define fi first
#define se second
using namespace std;
typedef pair<int, int> P;

signed main(){
    int n;
	string s;
	cin >> n;
	int d[51][26] = {};
	rep(i, 0, n){
		cin >> s;
		rep(j, 0, s.size()){
			d[i][s[j] - 'a']++;
		}
	}
	string res = "";
	rep(i, 0, 26){
		int MIN = 100;
		rep(j, 0, n){
			MIN = min(MIN, d[j][i]);
		}
		rep(j, 0, MIN) res += ('a' + i);
	}
	cout << res << endl;
}

Measured memory_bytes: 256
n,m = map(int,input().split())
ab = []
c = []
for i in range(m):
    ab.append(list(map(int,input().split())))
    s = 0
    for j in map(int,input().split()):
        s += 2**(j-1)
        
    c.append(s)

dp = [[float("INF")]*(2**n) for i in range(m+1)]

dp[0][0] = 0

for i in range(m):
    for j in range(2**n):
        if dp[i][j] != float("INF"):
            dp[i+1][j] = min(dp[i+1][j],dp[i][j])
            x = j|c[i]
            dp[i+1][x] = min(dp[i+1][x],dp[i][j]+ab[i][0])

if dp[-1][-1] == float("INF"):
    print(-1)
else:
    print(dp[-1][-1])



Measured memory_bytes: 137732
void main() {
	auto S = rs;
	long res;
	res += S.count!(a => a == '+');
	res -= S.count!(a => a == '-');
	res.writeln;
}

// ===================================

import std.stdio;
import std.string;
import std.conv;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.container;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}

Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;
using static System.Console;
using static System.Math;
class Z { static void Main() => new K(); }
class K
{
	int F => int.Parse(Str);
	long FL => long.Parse(Str);
	int[] G => Strs.Select(int.Parse).ToArray();
	long[] GL => Strs.Select(long.Parse).ToArray();
	string Str => ReadLine();
	string[] Strs => Str.Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
	const int MOD = 1000000007;
	public K()
	{
		SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
		WriteLine(Solve() ? "Yes" : "No");
		Out.Flush();
	}
	bool Solve()
	{
		var I = G;
		int a = I[0], b = I[1];
		var S = Str;
		if (S.Length != a + b + 1) return false;
		for (var i = 0; i < a; i++) if (S[i] < '0' || '9' < S[i]) return false;
		if (S[a] != '-') return false;
		for (var i = a + 1; i < a + b + 1; i++) if (S[i] < '0' || '9' < S[i]) return false;
		return true;
	}
}


Measured memory_bytes: 13268
S=gets.chomp


ans=Array.new(S.length,0)


count1=0
count2=0
point1=-1
point2=-1
old="R"
S.each_char.each_with_index do |c,i|
  if old=="R"
    if c=="R"
      count1+=1
    else
      count1+=1
      point1=i-1
      point2=i
      ans[point1]+=count2
      ans[point2]+=count1
      count1,count2=[0,0]
    end
  else
    if c=="R"
      ans[point1]+=count2
      ans[point2]+=count1
      count1,count2=[0,0]
      count1+=1
    else
      count1+=1
    end
  end
  count2,count1=count1,count2
  old=c
end
ans[point1]+=count2
ans[point2]+=count1


puts ans.join(" ")


Measured memory_bytes: 5244
n = int(input())
p = list(map(float,input().split()))
dp = [[0]*(n+2) for _ in range(n+2)]
dp[1][1] = 1
for s in range(2,n+2):
  for i in range(1,s+1):
    j = s-i+1
    dp[i][j] = dp[i-1][j]*p[s-2]+dp[i][j-1]*(1-p[s-2])
ans = 0
for i in range(n//2+1,n+1):
  ans += dp[i+1][n+1-i]
print(ans)

Measured memory_bytes: 290440
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
using namespace std;
using ll = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF = 1e9;
const ll MOD = 1e9 + 7;


int main(){
    int s, w;
    cin >> s >> w;
    if(w >= s) cout << "unsafe" << endl;
    else cout << "safe" << endl;
}

Measured memory_bytes: 3592
#include<bits/stdc++.h>
#define rep(i,k,n) for(int i=k;i<=n;i++)
#define fi first
#define se second
using namespace std;
const int maxn=100005;
int n,m;
pair<int,pair<int,int> > c[maxn];
string ans[maxn];
int num[maxn];
int main()
{
	scanf("%d%d",&n,&m);
	rep(i,1,m)
	{
		scanf("%d%d",&c[i].se.fi,&c[i].fi);
		c[i].se.se=i;
	}
	sort(c+1,c+m+1);
	rep(i,1,m)
	{
		string s="";
		int now=c[i].se.fi;
		num[now]++;
		int nnow=num[now];
		while(nnow>0)
		s=char((nnow%10)+'0')+s,nnow/=10;
		rep(i,s.size(),5) s='0'+s;
		while(now>0)
		s=char((now%10)+'0')+s,now/=10;
		rep(i,s.size()-6,5) s='0'+s;
//		int qaq=1;
//		rep(i,0,5)
//		s=char((nnow)%(qaq*10)/qaq+'0')+s,nnow/=qaq;
//		qaq=1;
//		rep(i,0,5)
//		s=char((now%(qaq*10))/qaq+'0')+s,now/=qaq;
		ans[c[i].se.se]=s;
	}
	rep(i,1,m)
	cout<<ans[i]<<endl;
	return 0;
}

Measured memory_bytes: 8576
#include <bits/stdc++.h>
using namespace std;
#define rep(i, s, e) for (int i = s; i < e; ++i)
#define sort_(a) stable_sort(a.begin(), a.end())
#define rsort(a) stable_sort(a.rbegin(), a.rend())
#define sum(a) accumulate(a.begin(), a.end(), 0LL)
#define join(a, d) accumulate(a.begin() + 1, a.end(), a[0], [](string s, string t) {return s + d + t;})
#define all(a) a.begin(), a.end()
#define __lcm(a, b) std::__detail::__lcm(a, b)
typedef long long ll;
const long mod = 1e9 + 7;

int main(void) {
#ifdef DEBUG
  freopen("input.txt", "r", stdin);
#endif

  ios_base::sync_with_stdio(false);
  cin.tie(0);

  int H, W;
  cin >> H >> W;
  vector<string> S(H + 2);
  S[0] = string(W + 2, '@');
  S[H+1] = string(W + 2, '@');
  rep(i, 1, H + 1) {
    cin >> S[i];
    S[i] = '@' + S[i] + '@';
  }
 
  vector<string> g(H + 2);
  g[0] = string(W + 2, '@');
  g[H+1] = string(W + 2, '@');
  rep(i, 1, H + 1) {
    g[i] = '@' + string(W, '.') + '@';
  }

  rep(i, 1, H + 1) {
    rep(j, 1, W + 1) {
      if (S[i][j] == '#') {
        int d[] = {0, 1, 0, -1};
        int nx, ny;
        int n = 0;
        rep(k, 0, 4) {
          nx = i + d[k];
          ny = j + d[k^1];
          if (S[nx][ny] == '#') {
            g[nx][ny] = '#';
            ++n;
          }
        }
        if (n) S[i][j] = '#';
      }
    }
  }

  rep(i, 1, H + 1) {
    if (S[i] != g[i]) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}


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

#define each(i, c) for (auto& i : c)
#define mkp(a, b) make_pair(a, b)

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> Pll;
const ll MOD = 1e9+7;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << ": " << p.second << ")"; return os; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ", "; os << ")"; return os; }
template<typename K, typename V> ostream& operator << (ostream& os, map<K, V> m) { os << "{"; each (i, m) os << i << ", "; os << "}"; return os; }

vector<ll> divisor(ll n) {
  vector<ll> res;
  for (ll i = 2; i*i <= n; ++i) {
    if (n % i == 0) {
      res.push_back(i);
      if (i != n/i) res.push_back(n/i);
    }
  }
  return res;
}

bool is_prime(ll p) {
  if (p < 2) return false;
  if (p == 2) return true;
  if (p % 2 == 0) return false;
  for (ll i = 3; i <= sqrt(p); i+=2) {
    if (p % i == 0) {
      return false;
    }
  }
  return true;
}

bool prime_mul(ll p) {
  ll a = 2;
  map<ll, bool> div;
  while (p >= a*a) {
    if (p % a == 0) {
      p /= a;
      div[a] = true;
    } else {
      ++a;
    }

    if (div.size() >= 2) return false;
  }
  div[p] = true;
  if (div.size() >= 2) return false;
  return true;
}

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

  if (n == 1) {
    cout << 0 << endl;
    return 0;
  } else if (is_prime(n)) {
    cout << 1 << endl;
    return 0;
  }

  auto d = divisor(n);
  sort(d.begin(), d.end());

  ll ans = 0;
  for (ll i = 0; i < d.size(); ++i) {
    if (!prime_mul(d[i])) continue;
    if (n % d[i] == 0) {
      n /= d[i];
      ++ans;
    }
    if (n == 1) break;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3728
#include <bits/stdc++.h>
#include <sys/types.h>
#include <unistd.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;}

using ll=long long;
using R=long double;
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 NMAX = 1001000;
const int SIGMA = 26;

bool leaf[NMAX];
int mov[NMAX][SIGMA];
int nxt = 1;

void add(const string &s) {
	int cur = 0;
	for (auto &c : s) {
		int idx = c - 'a';
		if (mov[cur][idx] == -1) {
			cur = mov[cur][idx] = nxt++;
		} else {
			cur = mov[cur][idx];
		}
	}

	leaf[cur] = true;
}


ll cnt[SIGMA + 1];
ll ans = 0LL;

void dfs(int v, int ch) {
	ll tmp = 0LL;

	if(ch != -1) {
		tmp = cnt[ch];
		cnt[SIGMA] += tmp;
		cnt[ch] = 0LL;

		if (leaf[v]) {
			ans += cnt[SIGMA];
		}
	}

	rep(c, SIGMA) {
		if(mov[v][c] != -1) {
			cnt[c] += leaf[mov[v][c]];
		} 
	}

	rep(c, SIGMA) {
		if(mov[v][c] != -1) {
			dfs(mov[v][c], c);
		}	
	}

	rep(c, SIGMA) {
		if(mov[v][c] != -1) {
			cnt[c] -= leaf[mov[v][c]];
		}  
	}

	if(ch != -1) {
		cnt[SIGMA] -= tmp;
		cnt[ch] = tmp;
	}

}

int main(void){
	rep(i, NMAX) {
		leaf[i] = false;

		rep(j, SIGMA) {
			mov[i][j] = -1;
		}
	}

	int n;
	cin >> n;
	
	rep(i, n) {
		string s;
		cin >> s;
		reverse(begin(s), end(s));
		add(s);
	}	

	dfs(0, -1);
	ans -= n;
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 151748
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 401;
const int mod = 1e9 + 7;
inline int add(ll x, ll y) {return (x + y) % mod;}
inline int mul(ll x, ll y) {return x * y % mod;}
inline int sub(ll x, ll y) {return (x - y + mod) % mod;}
int dp[N][N], sum[N][N], A[N], B[N];

int main()
{
    int n, c; scanf("%d%d", &n, &c);
    for (int i = 1; i <= n; i++) scanf("%d", &A[i]);
    for (int i = 1; i <= n; i++) scanf("%d", &B[i]);
    for (int y = 1; y <= 400; y++)
        for (int x = 0, v = 1; x <= 400; x++, v = mul(v, y)) sum[x][y] = v;
    for (int x = 0; x <= 400; x++)
        for (int y = 1; y <= 400; y++) sum[x][y] = add(sum[x][y], sum[x][y - 1]);
    memset(dp, -1, sizeof(dp));
    dp[0][c] = 1;
    for (int i = 1; i <= n; i++)
        for (int j = 0; j <= c; j++)
            for (int k = j; k <= c; k++) if (dp[i - 1][k] != -1)
            {
                if (dp[i][j] == -1) dp[i][j] = 0;
                int use = k - j;
                dp[i][j] = add(dp[i][j], mul(dp[i - 1][k], sub(sum[use][B[i]], sum[use][A[i] - 1])));
            }
    printf("%d\n", dp[n][0]);
    return 0;
}

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

int main()
{
    int x;
    cin >> x;
    int a = x % 100;
    int b = x / 100;
    int c = 0;
    if(a % 5 == 0) c = a / 5;
    else c = a / 5 + 1;
    if(b >= c) cout << 1 << endl;
    else cout << 0 << endl;
    return 0;
}

Measured memory_bytes: 256
// Try AtCoder
// author: Leonardone

fn main() {
    let mut stdin = String::new();
    std::io::Read::read_to_string(&mut std::io::stdin(), &mut stdin).unwrap();
    let mut stdin = stdin.split_whitespace();
    let mut get = || stdin.next().unwrap();
    macro_rules! get {
        ($t:ty) => (get().parse::<$t>().unwrap());
        () => (get!(i64));
    }
    
    let a = get!();
    let b = get!();
    let ans = a * (b / gcd(a, b));
    println!("{}", ans);
}

fn gcd(a: i64, b: i64) -> i64 {
    if a == 0 {
        b
    } else {
        gcd(b % a, a)
    }
}

Measured memory_bytes: 4352
S = input()
l = len(S)
N = 0
for i in range(l):
    if(i % 2 == 0):
        if S[i] != "R" and S[i] != "U" and S[i] != "D":
            N = 1
    else:
        if S[i] != "L" and S[i] != "U" and S[i] != "D":
            N = 1

if N == 0:
    print("Yes")
else:
    print("No")

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

#define LL long long
#define LD long double
#define SC(t,x) static_cast<t>(x)
#define AR(t) vector < t >
#define PII pair < int, int >
#define PLL pair < LL, LL >
#define PIL pair < int, LL >
#define PLI pair < LL, int >
#define MP make_pair
#define PB push_back
#define PF push_front
#define POB pop_back
#define POF pop_front
#define PRF first
#define PRS second
#define INIT(ar,val) memset ( ar, val, sizeof ( ar ) )
#define lp(loop,start,end) for ( int loop = start; loop < end; ++loop )
#define lpd(loop,start,end) for ( int loop = start; loop > end; --loop )
#define lpi(loop,start,end) for ( int loop = start; loop <= end; ++loop )
#define lpdi(loop,start,end) for ( int loop = start; loop >= end; --loop )
#define qmax(a,b) (((a)>(b))?(a):(b))
#define qmin(a,b) (((a)<(b))?(a):(b))
#define qabs(a) (((a)>=0)?(a):(-(a)))

const int INF = 0x3fffffff;
const int SINF = 0x7fffffff;
const long long LINF = 0x3fffffffffffffff;
const long long SLINF = 0x7fffffffffffffff;
const int MAXN = 100007;
const int MAXM = 100007;

struct eT
{
	void setd ( int _u, int _v, int _l )
	{
		u = _u, v = _v, last = _l;
	}
	
	int u, v, last;
}edge[MAXM], re[MAXM];

int n, m;
int ke, kr, la[MAXN], lr[MAXN];
int kb;
int inb[MAXN];
AR(int) bl[MAXN];
int c[MAXN];

void init ();
void input ();
void work ();

void dfs ( int now, int bid );

LL getans ( AR(int) &ar );
bool paint ( int now, int nc );



int main()
{
	init();
	input();
	work();
}



void init ()
{
	// Init Everything Here
	
	ios::sync_with_stdio ( false );
}

void input ()
{
	// input method
	
	scanf ( "%d%d", &n, &m );
	int u, v;
	INIT ( la, -1 );
	INIT ( lr, -1 );
	lp ( i, 0, m ){
		scanf ( "%d%d", &u, &v );
		edge[ke].setd ( u, v, la[u] );
		la[u] = ke++;
		re[kr].setd ( v, u, lr[v] );
		lr[v] = kr++;
	}
}

void work ()
{
	// main work
	
	lpi ( i, 1, n ) if ( !inb[i] ) ++kb, dfs ( i, kb );
	
	INIT ( c, -1 );
	LL ans = 0;
	lpi ( i, 1, kb ) ans += getans ( bl[i] );
	
	cout << ans << endl;
}



void dfs ( int now, int bid )
{
	if ( inb[now] ) return;
	inb[now] = bid;
	bl[bid].PB ( now );
	for ( int i = la[now]; ~i; i = edge[i].last ) dfs ( edge[i].v, bid );
	for ( int i = lr[now]; ~i; i = re[i].last ) dfs ( re[i].v, bid );
}



LL getans ( AR(int) &ar )
{
	bool flag = true;
	for ( auto x : ar ){
		if ( c[x] == -1 ){
			if ( !paint ( x, 0 ) ){
				flag = false;
				break;
			}
		}
	}
	
	LL ans = 0;
	if ( flag ){
		int cc[3] = { 0 };
		for ( auto x : ar ) ++cc[c[x]];
		
		if ( cc[1] && cc[2] ){
			ans = SC ( LL, cc[0] ) * cc[1] + SC ( LL, cc[0] ) * cc[2] + SC ( LL, cc[1] ) * cc[2];
		}else{
			for ( auto x : ar ){
				for ( int i = la[x]; ~i; i = edge[i].last ) ++ans;
			}
		}
	}else{
		ans = SC ( LL, ar.size () ) * ar.size ();
	}
	
	return ans;
}

bool paint ( int now, int nc )
{
	if ( ~c[now] ) return c[now] == nc;
	c[now] = nc;
	for ( int i = la[now]; ~i; i = edge[i].last ) if ( !paint ( edge[i].v, ( nc + 1 ) % 3 ) ) return false;
	for ( int i = lr[now]; ~i; i = re[i].last ) if ( !paint ( re[i].v, ( nc + 2 ) % 3 ) ) return false;
	return true;
}

Measured memory_bytes: 11768
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include <iomanip>
using namespace std;
int main()
{
	int n, m, l;
	long long int sum = 0;
	cin >> n >> m >> l;
	int a[200][200];
	int b[200][200];
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			cin >> a[i][j];
		}
	}
	for (int i = 0; i < m; i++) {
		for (int j = 0; j < l; j++) {
			cin >> b[i][j];
		}
	}
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < l; j++) {
			for (int k = 0; k < m; k++) {
				sum += a[i][k] * b[k][j];
			}
			if (j) {
				cout << " ";
			}
				cout << sum;
				sum = 0;
			
		}
		cout<<endl;
	}
}




Measured memory_bytes: 3256
#include <algorithm>
#include <iostream>
#include <vector>

int distance(int leftNum, int rightNum, const std::vector<int> &sortedLeft, const std::vector<int> &sortedRight) {
	if(leftNum > sortedLeft.size() || rightNum > sortedRight.size()) {
		return std::numeric_limits<int>::max();
	}

	int leftDistance;
	if(leftNum != 0) {
		leftDistance = -sortedLeft.at(sortedLeft.size() - leftNum);
	} else {
		leftDistance = 0;
	}

	int rightDistance;
	if(rightNum != 0) {
		rightDistance = sortedRight.at(rightNum - 1);
	} else {
		rightDistance = 0;
	}

	int shortDistance = std::min(leftDistance, rightDistance);
	int longDistance = std::max(leftDistance, rightDistance);

	return shortDistance * 2 + longDistance;
}

int main() {
	int N, K;
	std::cin >> N >> K;

	std::vector<int> sortedLeft;
	std::vector<int> sortedRight;
	for(int i = 0; i < N; i++) {
		int x;
		std::cin >> x;
		if(x < 0) {
			sortedLeft.emplace_back(x);
		} else {
			sortedRight.emplace_back(x);
		}
	}

	int result = distance(0, K, sortedLeft, sortedRight);
	for(int i = 1; i <= K; i++) {
		result = std::min(result, distance(i, K - i, sortedLeft, sortedRight));
	}

	std::cout << result << std::endl;

	return 0;
}

Measured memory_bytes: 1020
import math


if __name__ == '__main__':
    N, K = map(int, input().split())

    answer = 0
    for A1 in range(1, N+1):
        if A1 >= K:
            answer += 1.0 / N
        else:
            k = math.ceil(math.log2(K/A1))
            answer += 1.0 / N * math.pow(0.5, k)
    print(answer)

Measured memory_bytes: 3060
N = int(input())
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
ans = 0
for i in range(N):
    b = min(A[i], B[i])
    ans += b
    A[i] -= b
    B[i] -= b
    a = min(A[i+1], B[i])
    ans += a
    A[i+1] -= a
    B[i] -= a
print(ans)

Measured memory_bytes: 25476
# coding: utf-8

def dp_flog(N, lst):
    lst_cost = [0] * N
    for i in range(N):
        if i==0:
            lst_cost[i]=0
        elif i==1:
            lst_cost[i] = abs(lst[0] - lst[1])
        else:
            lst_cost[i] = min(lst_cost[i-2] + abs(lst[i-2] - lst[i]), lst_cost[i-1] + abs(lst[i-1] - lst[i]))
    return lst_cost

N = int(input())
lst_flog = list(map(int, input().split()))
print(dp_flog(N, lst_flog)[N-1])

Measured memory_bytes: 13980
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))

def do():
    n=INT()
    p=LIST()
    tm=10**9
    ct=0
    for i in range(n):
        if tm>=p[i]:
            ct+=1
        tm=min(tm,p[i])
    print(ct)

if __name__=='__main__':
    do()

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

#define rep(i, n) for(int i = 0; i < n; i++)
#define INF 1000000000000000LL

typedef long long ll;
using namespace std;
int mod = 1000000007;

ll d_yen[100000];
ll d_snu[100000];

struct edge{
    int to;
    ll yen_cost;
    ll snu_cost;
};

vector<edge> nodes[100000];

void dijk_yen(int s){
    fill(d_yen, d_yen + 100000, INF);
    d_yen[s] = 0;
    priority_queue<pair<ll, int>, vector<pair<ll, int>>, greater<pair<ll, int>>> pq;
    pq.push(make_pair(0, s));
    while(!pq.empty()){
        pair<ll, int> op = pq.top();
        pq.pop();
        int id = op.second;
        ll cost = op.first;
        if(cost > d_yen[id]) continue;
        rep(i, nodes[id].size()){
            //cout << "in: " << i << endl;
            int to = nodes[id][i].to;
            if(cost + nodes[id][i].yen_cost < d_yen[to]){
                d_yen[to] = cost + nodes[id][i].yen_cost;
                pq.push(make_pair(d_yen[to], to));
            }
        }
    }
}

void dijk_snu(int t){
    fill(d_snu, d_snu + 100000, INF);
    d_snu[t] = 0;
    priority_queue<pair<ll, int>, vector<pair<ll, int>>, greater<pair<ll, int>>> pq;
    pq.push(make_pair(0, t));
    while(!pq.empty()){
        pair<ll, int> op = pq.top();
        pq.pop();
        int id = op.second;
        ll cost = op.first;
        if(cost > d_snu[id]) continue;
        rep(i, nodes[id].size()){
            int to = nodes[id][i].to;
            if(cost + nodes[id][i].snu_cost < d_snu[to]){
                d_snu[to] = cost + nodes[id][i].snu_cost;
                pq.push(make_pair(d_snu[to], to));
            }
        }
    }
}

int main(void){
    ll have = 1000000000000000ll;
    //sからtに向かう。どこかのタイミングで円をスヌークに変換
    //円でどこまで行くかという問題. yen[i]: sからiへ円で行く最小コスト snu[i]: tからiへスヌークで行く最小コスト
    //minimize yen[k] + snu[k] (0-indexed)
    //(yen[k]+snu[k], k)をpqに突っ込む
    //小さい順に見ていく(ただし,a年後(a回目のループ)について a>k ならpop)
    int N, M, S, T; cin >> N >> M >> S >> T;
    rep(i, M){
        int u, v; ll y, s; cin >> u >> v >> y >> s;
        u--; v--;
        edge e; e.yen_cost = y; e.snu_cost = s;
        e.to = v; nodes[u].push_back(e);
        e.to = u; nodes[v].push_back(e);
    }
    dijk_yen(S-1);
    dijk_snu(T-1);

    priority_queue<pair<ll, int>, vector<pair<ll, int>>, greater<pair<ll, int>>> pq;
    rep(i, N){
        pq.push(make_pair(d_yen[i]+d_snu[i], i));
    }

    rep(a, N){
        pair<ll, int> op = pq.top();
        if(a > op.second){
            pq.pop();
            a--;
            continue;
        }
        cout << have - op.first << endl;
    }

    //rep(i, N) cout << d_yen[i] << " "; cout << endl;
    //rep(i, N) cout << d_snu[i] << " "; cout << endl;
    return 0;
}

Measured memory_bytes: 13936
#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return 1;
    }
    return 0;
}
typedef long long int ll;

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define endl "\n"
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
const double PI = acos(-1);
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//-------------------------------------

struct edge
{
    int to, id;
};

int n;
vector<vector<edge>> g;
vector<int> ans;
void dfs(int now, int par, int c)
{
    int col = 0;
    for (auto next : g[now])
    {
        if (next.to != par)
        {
            if (c == col)
            {
                col++;
            }
            ans[next.id] = col + 1;
            dfs(next.to, now, col);
            col++;
        }
    }
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n;
    g.resize(n);
    for (int i = 0; i < n - 1; i++)
    {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        g[a].emplace_back(edge{b, i});
        g[b].emplace_back(edge{a, i});
    }
    ans.resize(n - 1);
    dfs(0, -1, -1);
    cout << *max_element(ALL(ans)) << endl;
    for (int i = 0; i < n - 1; i++)
    {
        cout << ans[i] << endl;
    }
}

Measured memory_bytes: 8320
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
vector<int>v;
map<string, int>m;
int gcd( int a,int b)
{
    if(a%b==0)
        return b;
    else
        return gcd(b,a%b);

}
/*void prime()
{
    bool p[201];
    for (int i=1;i<=200;i++) p[i]=true;
    for (int i=2;i*i<=200;i++)
    {
        if (p[i])
        {
            for (int j=2;i*j<=200;j++)
                p[i*j]=false;
        }
    }
    p[1]= false;
    for (int i=1;i<=200;i++)
    {
        if(p[i])
            v.push_back(i);
    }
    for (int i=0;i<v.size();i++)
    {
        for (int j=i+1;j<v.size();j++)
            m[i*j]++;
    }
    return ;
        
    
    
}*/
void f()
{
    ll x, y;
    x= 0 ,y=1;
    v.push_back(0);
    v.push_back(1);
    while (x<10000000)
    {
        ll t= x%10;
        x=y%10;
        y=t+y%10;
        cout <<y<<endl;
        v.push_back(y);
    }
}
void solve()
{
   int n; cin>>n;
   string s;
   for (int i=0;i<n;i++)
   {
       cin>>s;
       m[s]++;
   }
   cout << "AC x "<<m["AC"]<<endl;
   cout << "WA x "<<m["WA"]<<endl;
   cout << "TLE x "<<m["TLE"]<<endl;
   cout << "RE x "<<m["RE"]<<endl;
}
int main()
{
    int t; t=1 ;while (t--)
    {
       solve();
       return 0;
    }
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
typedef long long lint;
using namespace std;

bool isOk(int a, int b, int c) {
    vector<int> l = {a, b, c};
    sort(l.begin(), l.end());
    if (l[0] == l[1] || l[1] == l[2]) {
        return false;
    }
    return l[0] + l[1] > l[2];
}

int main() {
    int n;
    cin >> n;
    vector<int> l(n);
    for (int i = 0; i < n; i++) {
        cin >> l[i];
    }
    int ans = 0;
    for (int i = 0; i < n; i++) {
        for (int j = i + 1; j < n; j++) {
            for (int k = j + 1; k < n; k++) {
                if (isOk(l[i], l[j], l[k])) {
                    ans++;
                }
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3600
#include <stdio.h>

int main(){
	char a1, a2, a3;
	scanf("%c %c %c", &a1, &a2, &a3);
	if (a1, a2 != a3){
		printf("Yes\n");
	}
	else if (a1, a3 != a2){
		printf("Yes\n");
	}
	else if (a2, a3 != a1){
		printf("Yes\n");
	}
	else if (a1 == a2, a2 == a3){
		printf("No\n");
	}
	
	return 0;
}

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

int main() {
  long long int a, b, k;
  cin >> a >> b >> k;
  
  if (a >= k) {
    a = a - k;
  }
  else if (a < k) {
    b = b - (k - a);
    a = 0;
  }
  
  if (b < 0) {
    b = 0;
  }
  cout << a << " " << b << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
	int w, h, x, y, r;
	scanf("%d%d%d%d%d", &w, &h, &x, &y, &r);
	if(x+r > w || y+r > h || x-r<0 || y-r<0 ){
		puts("No");
	}
	else puts("Yes");
	return 0;
}


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

typedef long long ll;
typedef vector<long long> VLL;
typedef vector<pair<int,int>> VP;
#define INF (int)(1e9)
#define MAXX 1.1529215e+18
#define inf 999999
#define EPS (1e-7)
#define MOD (1e9+7)
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define REP(i,n) for(int i=1;i<=(int)(n);i++)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define ALL(a)  a.begin(),a.end()
#define RALL(a) a.begin(),a.end(),greater<int>()
#define ROT(a) a.begin(),a.begin()+1,a.end()
#define RROT(a) a.begin(),a.end()-1,a.end()
#define PB push_back
#define MP make_pair
#define PI acos(-1.0)
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
/*--------------------------------------------*/


int n,A,B,C;
vector<int> l(8);

int dfs(int cur,int a, int b, int c){
  if(cur == n){
    if(a * b * c != 0){
      return abs(a-A) + abs(b-B) + abs(c-C) - 30;
    }else{
      return INF;
    }
  }
  int ret = INF;
  
  chmin(ret,dfs(cur+1,a,b,c));
  chmin(ret,dfs(cur+1,a + l[cur],b,c) + 10);
  chmin(ret,dfs(cur+1,a,b + l[cur],c) + 10);
  chmin(ret,dfs(cur+1,a,b,c + l[cur]) + 10);
  
  return ret;
  
}

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
    
  
  cin >> n >> A >> B >> C;
  rep(i,n) cin >> l[i];
  
  cout << dfs(0,0,0,0) << endl;
}
  
  

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
  ll n,a;
  cin>>n>>a;
  int x[n];
  for(int i=0;i<n;i++){
    cin>>x[i];
  }
  ll dp[n+1][n+1][n*a+1];
  memset(dp,0,sizeof dp);
  for(int i=0;i<=n;i++){
    for(int j=0;j<=i;j++){
      for(int g=0;g<=n*a;g++){
        if(i==0&&j==0&&g==0) dp[i][j][g]=1;
        else if(i>0&&x[i-1]>g) dp[i][j][g]=dp[i-1][j][g];
        else if(i>0&&j>0&&x[i-1]<=g)
dp[i][j][g]=dp[i-1][j][g]+dp[i-1][j-1][g-x[i-1]];
      }
    }
  }
  ll c=0;
  for(int i=1;i<=n;i++){
    c+=dp[n][i][i*a];
  }
  cout<<c<<endl;
}

Measured memory_bytes: 51072
def read_input():
    a, b, c = map(int, input().split())
    return a, b, c


def mymod(x, y):
    return x % y

def submit():
    a, b, c = read_input()

    mods = list(set([mymod(i*a, b) for i in range(1, b)]))
    mods.sort()

    while True:
        temp = []
        for i in range(len(mods)):
            for j in range(len(mods)):
                temp.append(mymod(mods[i] + mods[j], b))
        new_mods = list(set(mods + temp))
        new_mods.sort()

        if mods == new_mods:
            break

        mods = new_mods

    if c in mods:
        print('YES')
    else:
        print('NO')



if __name__ == '__main__':
    submit()

Measured memory_bytes: 38640
# coding: utf-8
import sys
from collections import defaultdict

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

# MODの管理をして右から進める
N, P = lr()
S = sr()
dic = defaultdict(int)
dic[0] = 1
num = 0
power = 1
answer = 0
if P%2 == 0 or P%5 == 0:
    x = [i for i, y in enumerate(S, 1) if int(y) % P == 0]
    answer = sum(x)
else:
    for s in S[::-1]:
        s = int(s)
        num += s * power
        num %= P
        answer += dic[num]
        dic[num] += 1
        power *= 10; power %= P

print(answer)
# 14

Measured memory_bytes: 48076
import java.util.Scanner;

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

    void solve(Scanner sc) {
        int n = sc.nextInt();
        int[] as = new int[100000 + 1];
        for (int i = 0; i < n; i++) {
            as[sc.nextInt()]++;
        }

        int ans = 0;
        for (int i = 1; i < 100000; i++) {
            ans = Math.max(ans, as[i - 1] + as[i] + as[i + 1]);
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 49808
package main

import "fmt"

func nextperm(p []int) bool {
	i := len(p) - 1
	for i > 0 && p[i-1] > p[i] {
		i--
	}
	if i == 0 {
		return false
	}
	i--
	j := len(p) - 1
	for p[j] < p[i] {
		j--
	}
	p[i], p[j] = p[j], p[i]
	i, j = i+1, len(p)-1
	for i < j {
		p[i], p[j] = p[j], p[i]
		i, j = i+1, j-1
	}
	return true
}

func identical(n, m []int) bool {
	for i := 0; i < len(n); i++ {
		if n[i] != m[i] {
			return false
		}
	}
	return true
}

func main() {
	var N int
	fmt.Scan(&N)
	p := make([]int, N)
	q := make([]int, N)
	for i := range p {
		fmt.Scan(&p[i])
	}
	for i := range q {
		fmt.Scan(&q[i])
	}

	A := make([]int, 0)
	for i := 1; i <= N; i++ {
		A = append(A, i)
	}
	// fmt.Println("N", N, "p", p, "q", q)
	cnt := 1
	var a, b int
	for {
		if identical(A, p) {
			a = cnt
		}
		if identical(A, q) {
			b = cnt
		}
		// fmt.Println("A", A)
		if !nextperm(A) {
			break
		}
		cnt++
	}
	fmt.Println(abs(a - b))
}
func abs(a int) int {
	if a >= 0 {
		return a
	}
	return -a
}


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

long long n, a[4], x, y;

int main() {
	cin >> a[0] >> a[1] >> a[2] >> a[3] >> n;
	x = min({a[0] * 4, a[1] * 2, a[2]});
	y = min(x * 2, a[3]); 
	if (n == 1) {
		cout << x; 
	} else if (n & 1) {
		cout << min(x * (n - 2) + y, y * (n - 1) / 2 + x);
	} else {
		cout << y * n / 2;
	}
}

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

#define COUT(x) cout << #x << " = " << (x) << ", "
typedef long long ll;
const int MOD = 1000000007;

int main(){
  int N,M;
  cin >> N >> M;
  vector<int> S(3,-1);
  bool flag = true;
  for(int i = 0; i < M; i++){
    int s,c;
    cin >> s >> c;
    if(S[s+2-N] == -1){
      S[s+2-N] = c;
    }else{
      if(S[s+2-N] != c){
	cout << -1 << endl;
	return 0;
      }
    }
  }
  if(N != 1 && S[3-N] == 0){
    cout << -1 << endl;
    return 0;
  }
  for(int i = 3-N; i < 3; i++){
    if(S[i] == -1){
      if(i == 3-N && N > 1){
	cout << 1;
      }else{
	cout << 0;
      }
    }else{
      cout << S[i];
    }
  }
  cout << endl;
}


Measured memory_bytes: 256
from math import sqrt

n = 50022
p = [1 for i in range(n)]
p[0] = 0
for i in range(1,int(sqrt(n))):
    if p[i]:
        for j in range(2*(i+1)-1,n,i+1):
            p[j] = 0

pmax = [0 for i in range(50022)]
pmin = [0 for i in range(50022)]
prev = 2

for i in range(50022):
    if p[i]:
        pmax[i] = i+1
        prev = i+1
    else:
        pmax[i] = prev
prev = 50021
for i in range(50001)[::-1]:
    if p[i]:
        pmin[i] = i+1
        prev = i+1
    else:
        pmin[i] = prev

while(1):
    try:
        n = int(input())
        print(pmax[n-2],pmin[n])
    except EOFError:
        break


Measured memory_bytes: 7588
/**
 *COYG, 14 FA Cups we are back baby
 */
#include <bits/stdc++.h>
using namespace std;
#define mod 		1000000007
#define ll 		long long
#define mp 		make_pair
#define pb 		push_back
#define forn(i,n) 	for(int i=0;i<n;i++)
#define for1(i,n) 	for(int i=1;i<n;i++)
#define ford(i,n) 	for(int i=n-1;i>=0;i--)
#define vi 		vector<int>
#define vl 		vector<ll>
#define pii 		pair<int,int>
#define pll 		pair<ll,ll>
#define vpi 		vector<pair<int,int> >
#define vpl		vector<pair<ll,ll> >
#define vvi 		vector<vector<int> >
#define vvl 		vector<vector<ll> >
#define ull 		unsigned long long
#define IOS 		ios_base::sync_with_stdio(false);
#define PI 		3.1415926535897932384626
#define ff 		first
#define ss 		second
#define char2Int(c) 	(c-'0')
#define FOREACH(i,t) 	for (auto i=t.begin(); i!=t.end(); i++)
#define clr(a,x) 	memset(a,x,sizeof(a)) //set elements of array to some value
#define all(x)		(x).begin(),(x).end()//cout<<"Case #"<<zzz<<": ";
#define plll pair<ll,pll >
ll n;vl a;vl pre;
ll dp[401][401];
ll getans(ll l,ll r)
{
    if(l>=r)return 0;
    if(dp[l][r]!=-1)return dp[l][r];
    ll ans=LLONG_MAX;
    for(int i=l;i<r;i++)
    {
        ans=min(ans,pre[r+1]-pre[l]+getans(l,i)+getans(i+1,r));
    }
    dp[l][r]=ans;
    return ans;
}
void solve()
{
    cin>>n;a.resize(n);forn(i,n)cin>>a[i];pre.clear();pre.pb(0);
    ll sum=0;
    for(int i=0;i<n;i++)
    {
        sum+=a[i];pre.pb(sum);
    }
    for(int i=0;i<=n;i++)for(int j=0;j<=n;j++)dp[i][j]=-1;
    cout<<getans(0,n-1)<<endl;
}
int main()
{
    IOS;cin.tie(NULL);
    ll zz;zz=1;
    //cin>>zz;
    for(int zzz=1;zzz<=zz;zzz++)
    {
        solve();
    }
    return 0;
}


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

int main() {
	ios_base::sync_with_stdio( false );

	string tb = "abcdefghijklmnopqrstuvwxyz";
	string s;

	while( getline( cin, s ) ) {
		string t( s.size(), ' ' );

		for( int i = 0; i < tb.size(); ++i ) {
			transform( s.begin(), s.end(), t.begin(), [tb, i]( char c ) {
				return (char)(c >= 'a' && c <= 'z' ? tb[(c-'a' + i) % tb.size()] : c);
			} );

			if( t.find( "the"  ) != string::npos ) { break; }
			if( t.find( "this" ) != string::npos ) { break; }
			if( t.find( "that" ) != string::npos ) { break; }
		}

		cout << t << '\n';
	}
}



Measured memory_bytes: 3056
import sys
readline = sys.stdin.readline

def main():
    N, W = map(int, readline().rstrip().split())
    dp = [0] * (W + 1)

    for _ in range(N):
        v, w = map(int, readline().rstrip().split())
        for i in range(W, w-1, -1):
            dp[i] = max(dp[i], dp[i-w] + v)

    print(max(dp))

if __name__ == '__main__':
    main()


Measured memory_bytes: 5920
#include<stdio.h>

int main()
{

int n,y,c,sum;
int f1[10],f2[10],f3[10],f4[10],f5[10],f6[10],f7[10],f8[10],f9[10];
for(int i=0;i<=9;i++)
{f1[i]=i;f2[i]=i;f3[i]=i;f4[i]=i;f5[i]=i;f6[i]=i;f7[i]=i;f8[i]=i;f9[i]=i;}

while(1)
{
c=0;sum=0;
scanf("%d %d",&n,&y);
if(n==0&&y==0)break;
for(int i1=0;i1<10;i1++)
{
	 if(n==1){if(f1[i1]==y)c++;}
	else if(n!=1){
				for(int i2=i1+1;i2<10;i2++)
					{
						if(n==2){if(f1[i1]+f2[i2]==y)c++;}
							else if(n>2){
							for(int i3=i2+1;i3<10;i3++)
										{						
										if(n==3){if(f1[i1]+f2[i2]+f3[i3]==y)c++;}
										else if(n>3){
														for(int i4=i3+1;i4<10;i4++)
																	{
if(n==4){if(f1[i1]+f2[i2]+f3[i3]+f4[i4]==y)c++;}
else if(n>4){
for(int i5=i4+1;i5<10;i5++)
{
if(n==5){if(f1[i1]+f2[i2]+f3[i3]+f4[i4]+f5[i5]==y)c++;}
else if(n>5){
for(int i6=i5+1;i6<10;i6++)
{
if(n==6){if(f1[i1]+f2[i2]+f3[i3]+f4[i4]+f5[i5]+f6[i6]==y)c++;}
else if(n>6){
for(int i7=i6+1;i7<10;i7++)
{
if(n==7){if(f1[i1]+f2[i2]+f3[i3]+f4[i4]+f5[i5]+f6[i6]+f7[i7]==y)c++;}
else if(n>7){
for(int i8=i7+1;i8<10;i8++)
{
if(n==8){if(f1[i1]+f2[i2]+f3[i3]+f4[i4]+f5[i5]+f6[i6]+f7[i7]+f8[i8]==y)c++;}
else if(n>8){
for(int i9=i8+1;i9<10;i9++)
{
{if(f1[i1]+f2[i2]+f3[i3]+f4[i4]+f5[i5]+f6[i6]+f7[i7]+f8[i8]+f9[i9]==y)c++;}

}}}}}}}}}}}}}}}}}
printf("%d\n",c);
c=0;
}
return 0;
}

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

#define int long long

#define ii pair<int,int>
#define fi first
#define sc second

#define all(x) (x).begin(),(x).end()

signed main() {
#ifdef _DEBUG
  // freopen("in" , "r", stdin );
  // freopen("out", "w", stdout);
#endif
  ios::sync_with_stdio(0); cin.tie(0);
  string s;
  cin >> s;
  set<int> d;
  for (auto &i : s) d.insert(i);
  if (d.size() == s.size()) {
    cout << "yes" << '\n';
  }
  else cout << "no" << '\n';
}


Measured memory_bytes: 3656
<?php

$path = [];
for ($i=0; $i < 3; $i++) { 
	$input = explode(' ', trim(fgets(STDIN)));
	$path[(int)$input[0]][] = [
		(int)$input[1],
	];
	$path[(int)$input[1]][] = [
		(int)$input[0],
	];
}

for ($i=1; $i <= 4; $i++) { 
	$tmp = $path[$i];
	if (count($tmp) > 2) {
		echo 'NO';
		exit();
	}
}
echo 'YES';


Measured memory_bytes: 4728
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include <cstdio>
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stdio.h>
using namespace std;
using ll = long long;
map <int ,int> mpa,mpb;

int main(){
  ll x,y;
  cin >>x >>y;
  ll ans=0;
  if (x*y==0 ){
    ans=max(abs(x),abs(y));
    if(x>y) ans++;
    cout << ans;
    return 0;
  }
  else if(x*y>0 && x<=y){
    cout << y-x;
    return 0;
  }
  else if(x*y>0 && x>y){
    cout << x-y+2;
    return 0;
  }
  else if(x*y<0){
    cout << abs(x+y)+1;
    return 0;
  }
}

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

using namespace std;
typedef long long ll;
typedef complex<long double> point;
const ll N = 2e5+5,mod=1e9+7,inf=1e9+5;
long double pi=3.14159265359;
ll a[N],b[N],inv[N],fact[N];
int n,c;
ll fp(int base,int exp){
    if(exp==0)return 1;
    ll ans=fp(base,exp/2);
    ans=(ans*ans)%mod;
    if(exp%2)
        ans=(ans*base)%mod;
    return ans;
}
ll ncr(int n,int r){
return ((fact[n]*inv[n-r])%mod*inv[r])%mod;
}
int main()
{
    iostream::sync_with_stdio(false);
     cin.tie(0);
     cout.tie(0);
     int n,m,mm;
     inv[0]=fact[0]=1;
     for(int i=1;i<2e5;i++){
        fact[i]=(i*fact[i-1])%mod;
        inv[i]=fp(fact[i],mod-2);
     }

     cin>>n>>m;
     mm=m;
     ll ans=1;
     for(int i=2;i*i<=m;i++){
            int c=0;
        while(m%i==0){
            m/=i;
     c++;
        }

        ans*=ncr(n+c-1,c);
        ans%=mod;
     }
     if(m>1){
        ans*=n;

        ans%=mod;
     }
     cout<<ans;

    return 0;
}


Measured memory_bytes: 6776
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define lper(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define ins insert
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vpl=vector<pl>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};
ll modfac(ll a){
    ll ans=1;
    while(a>1){
        ans*=a;
        ans%=1000000007;
        a--;
    }
    return ans;
}
ll modinv(ll a,ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m; 
    if (u < 0) u += m;
    return u;
}
struct UnionFind {
    vector<int> par;
    
    UnionFind(int n) : par(n, -1) {}

    int root(int x) {
        if (par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }
    
    bool same(int x, int y) {
        return root(x) == root(y);
    }
    
    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y);
        par[x] += par[y];
        par[y] = x;
        return true;
    }
    
    int size(int x) {
        return -par[root(x)];
    }
};
ll modpow(ll a, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
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;
}
int main(){
    ll n;cin >> n;
    vl v(n);
    rep(i,n)v[i]=i+1;
    ll cnta=0,cntb=0;
    vl a(n),b(n);
    rep(i,n)cin >> a[i];
    rep(i,n)cin >> b[i];
    do{
        cnta++;
        if(a==v)break;
    }while(next_permutation(all(v)));
    sort(all(v));
    do{
        cntb++;
        if(b==v)break;
    }while(next_permutation(all(v)));
    cout << abs(cnta-cntb) <<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int u[100] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

int main()
{
    int k;
    scanf("%d", &k);
    printf("%d\n", u[k - 1]);
    return 0;
}


Measured memory_bytes: 256
N, K = list(map(int, input().split()))
A = [0] + list(map(int, input().split()))
time = [-1] * (N + 1)
curr = 1
time[curr] = 0
now = 0
while True:
  now += 1
  curr = A[curr]
  if time[curr] >= 0:
    break
  if now == K:
    print(curr)
    exit()
  time[curr] = now

# K = time[curr] + loop * (now - time[curr]) + r
idx = (K - time[curr]) % (now - time[curr])
print(time.index(idx + time[curr]))

Measured memory_bytes: 32352
N,D = map(int,input().split())
X = [0]+[list(map(int,input().split()))for _ in range(N)]
List = []
ans = 0
for j in range(1,N):
    for i in range(j+1,N+1):
        v = 0
        for k in range(D):
            v+=(X[j][k]-X[i][k])**2
        for l in range(v+1):
            List.append(l**2)
        if v in List:
            ans+=1
      
            
print(ans)



Measured memory_bytes: 8600
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;

namespace atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var ori = Console.ReadLine()
                .Split(' ')
                .Select(num => int.Parse(num)).ToArray();
            var dic = ori.Distinct().ToDictionary(x => x, x => ori.Count(y => y == x));

            var keys = dic.Keys.ToArray();
            var result = 0;
            for (var i = 0; i < keys.Length; i++)
            {
                var a = keys[i];
                for (var j = i + 1; j < keys.Length; j++)
                {
                    var b = keys[j];
                    for (var k = j + 1; k < keys.Length; k++)
                    {
                        var c = keys[k];
                        if (a + b > c && b + c > a && c + a > b)
                        {
                            result += dic[a] * dic[b] * dic[c];
                        }
                    }
                }
            }
            Console.WriteLine(result);
        }
    }
}

Measured memory_bytes: 28220
import java.util.*;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        long b = sc.nextLong();
        long n = sc.nextLong();
        System.out.println(function(a,b,Math.min(n,b-1)));
    }
    static long function(long a, long b, long x){
        return (long)(Math.floor(a*x/(double)b)-a*Math.floor(x/(double)b));
    }

}


Measured memory_bytes: 35700
fn main() {
    proconio::input! {
        n: usize,
    }
    let mut h = std::collections::HashMap::new();
    for i in 1..=n {
        let mut count = 0usize;
        if let Some(count) = h.get(&i) {
            println!("{}", count);
            continue;
        }
        for x in 1..=100 {
            'outer: for y in x..=100 {
                for z in y..=100 {
                    let num = x * x + y * y + z * z + x * y + y * z + z * x;
                    if num == i {
                        if x == y && y == z {
                            count += 1;
                        } else if x == y || y == z {
                            count += 3;
                        } else {
                            count += 6;
                        }
                    } else if num > i {
                        continue 'outer;
                    }
                }
            }
        }
        h.insert(i, count);
        println!("{}", count);
    }
}


Measured memory_bytes: 2628
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    cin>>s;
    int l=s.length();int c=0;

        for(int i=0;i<l;i++)
        {
            if(s[i]=='R')
            {c++;
                if(s[i]!=s[i+1])
               {
               cout<<c;
               exit(0);}
               else {c++;i++;}


               }

}
cout<<c;}


Measured memory_bytes: 3624
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<string.h>
#include<string>
#include<set>
#include<limits.h>
#include<set>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include<list>
#include<functional>
#include<stack>
#include<deque>
#include<queue>
#define int long long
using namespace std;

signed main() {
	int a, b;
	cin >> a >> b;
	cout << (a + b + 1) / 2 << endl;
}

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

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

  vector<int> A(3);
  REP(i, 3) cin >> A[i];
  sort(A.begin(), A.end());
  cout << A[0] * A[1] / 2 << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define debug(x) cerr << "[(" << __LINE__ << ") " << (#x) << "]: " << x << endl;

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

    int d;
    cin >> d;
    
    int c[26];
    for (int& e: c) cin >> e;

    int s[d][26];
    for (int i=0; i<d; i++) {
        for (int j=0; j<26; j++) {
            cin >> s[i][j];
        }
    }

    for (int i=0; i<d; i++) {
        int mx = 0, mi = 0;
        for (int j=0; j<26; j++) {
            if (s[i][j] > mx) {
                mx = s[i][j];
                mi = j+1;
            }
        }
        cout << mi << "\n";
    }
}


Measured memory_bytes: 3696