akhauriyash/Code-Regression huggingface dataset:
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        h: usize,
        w: usize,
        s: [chars; h],
    }
    let mut s = s;

    let mut ans = 0;

    for y in 0..h {
        for x in 0..w {
            if s[y][x] == '#' {
                let t = paint(x as _, y as _, ' ', &mut s);
                ans += t.0 * t.1;
            }
        }
    }

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

fn paint(x: i64, y: i64, prev: char, bd: &mut Vec<Vec<char>>) -> (usize, usize) {
    if !(x >= 0 && x < bd[0].len() as _ && y >= 0 && y < bd.len() as _) {
        return (0, 0);
    }
    let c = bd[y as usize][x as usize];

    if c == ' ' || c == prev {
        return (0, 0);
    }

    bd[y as usize][x as usize] = ' ';

    let mut ret = if c == '.' { (1, 0) } else { (0, 1) };

    let t = paint(x + 0, y + 1, c, bd);
    ret.0 += t.0;
    ret.1 += t.1;

    let t = paint(x + 0, y - 1, c, bd);
    ret.0 += t.0;
    ret.1 += t.1;

    let t = paint(x + 1, y + 0, c, bd);
    ret.0 += t.0;
    ret.1 += t.1;

    let t = paint(x - 1, y + 0, c, bd);
    ret.0 += t.0;
    ret.1 += t.1;

    return ret;
}


Measured memory_bytes: 24316
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Scanner;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int l = sc.nextInt();
    StringBuilder sb = new StringBuilder();
    List<String> sList = new ArrayList<String>();
    for (int i = 0 ; i < n ; i++){
      sList.add(sc.next());
    }
    sList.sort(Comparator.naturalOrder());
    for (String s : sList){
      sb.append(s);
    }
    System.out.println(sb);
    sc.close();
 }
}

Measured memory_bytes: 23764
import math
import sys

# sys.stdin = open("d1.in")

N, A, B = [int(_) for _ in input().split()]
H = sorted([int(input()) for _ in range(N)])

sup = 10 ** 9
inf = 0

while sup - inf > 1:
    x = (sup + inf) // 2
    c = sum([math.ceil((h - x * B) / (A - B)) for h in H if h > x * B])
    if c <= x:
        sup = x
    else:
        inf = x

print(sup)


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

def main():
    N,W = map(int,input().split())
    dp = [-1 for _ in range(W+1)]
    dp[W] = 0
    for _ in range(N):
        nm,nv = [int(a) for a in input().split()]
        for j in range(nm,W+1):
            a = nm
            if dp[j] == -1:
                continue
            if dp[j-a] < dp[j] + nv:
                dp[j-a] = dp[j] + nv
    print(max(dp))

if __name__ == "__main__":
    main()

Measured memory_bytes: 7760
import std.algorithm;
import std.array;
import std.conv;
import std.range;
import std.stdio;
import std.string;
import std.traits;
import std.typecons;

enum INF(T) = T.max / 2; //longの場合10^^18くらい

void main()
{
	auto N = readln.chomp.to!size_t;
	auto input = new long[][](N, N);
	foreach (ref r; input)
	{
		r[] = readln.chomp.split(' ').map!(to!long).array;
	}
	long total;
	auto wf = warshallFloyd(input);
	//writefln("i:\n%sw:\n%s", input.fmt, wf.fmt);
	foreach (f; 0 .. N)
		foreach (t; 0 .. N)
		{
			if (wf[f][t] < input[f][t])
			{
				writeln(-1);
				return;
			}
			else
			{
				total += input[f][t];
				foreach (relay; 0 .. N)
				{
					if (f != relay && t != relay && input[f][t] == wf[f][relay] + wf[relay][t])
					{
						total -= input[f][t];
						break;
					}
				}
			}
		}
	writeln(total / 2);

}

/// graphMatrix[from][to] == cost < INF!T
T[][] graphMatrix(T = long)(size_t e)
{
	auto m = new T[][](e, e);
	foreach (ref r; m)
		r[] = INF!T;
	return m;
}
/// デバッグ用。GraphMatrixを見やすい文字列にする
string fmt(T)(T[][] graph)
{
	auto result = "";
	foreach (r; graph)
	{
		result ~= r.map!(n => (n == INF!T) ? "max" : n.to!string).join("\t") ~ "\n";
	}
	return result;
}

/// warshallFloyd[from][to] == shortestCost
T[][] warshallFloyd(T)(T[][] graph)
{
	auto result = new T[][](graph.length, graph.length);
	foreach(i,ref r;result)
		r[] = graph[i];
	foreach (relay; 0 .. graph.length)
		foreach (from; 0 .. graph.length)
			foreach (to; 0 .. graph.length)
				result[from][to] = min(result[from][to], result[from][relay] + result[relay][to]);
	return result;
}


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

int main(){
  int n, k, count = 0;
  cin >> n >> k;
  vector<int> vec(n);
  for(int i = 0 ; i < k ; i ++){
    int d;
    cin >> d;
    for(int j = 0; j < d; j ++){
      int x;
      cin >> x;
      vec.at(x-1) = 1;
    }
  }
  
  for(int i =0;i < n;i++){
    if(vec.at(i) !=1){
      count++;
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 3556
#include <bits/stdc++.h>
#define REP(i, m, n) for(int (i) = (m); (i) < (n); ++i)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
using namespace std;
using Graph = vector<vector<int>>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
typedef long long ll;
typedef pair<ll, ll> P;
const int INF = 1e9+7;
const ll LINF = 1LL<<60;

int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    ll n, k;
    cin >> n >> k;

    cout << min(abs(n % k - k), (n % k)) << endl;

    return 0;
}

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

#define IOS cin.tie(0);ios_base::sync_with_stdio(false)

#define ll      long long
#define Fi      first
#define Se      second
#define Pb      push_back
#define vi      vector<int>
#define vp      vector<pair<int,int>>
#define vvi     vector<vector<int>>
#define vvp     vector<vector<pair<int,int>>>
using Graph  =  vector<vector<int>>; //Caution!! Segmentation Fault!! Don't forget to add +1!

#define sz(x) (int)x.size()
#define all(v) v.begin(),v.end()
#define output_s(s) printf("%s\n",(s).c_str())
#define END cout<<"\n"

#define rep(i,n)        for(int i=0;i<(int)(n);i++)
#define Rep(i,n,m)      for(int i=(int)(n);i<(int)(m);i++)
#define RepS(i,n,m)     for(int i=(int)(n);i<=(int)(m);i++)
#define RRepS(i,n,m)    for(int i=(int)(n);i>=(int)(m);i--)
#define SRepS(i,n,m)    for(int i=(int)(n);i*i<=(int)(m);i++)
#define RepA(x)         for(auto &item:(x))

void CINT(){} //@shibh308's template
template<class Head,class... Tail> void CINT(Head&& head,Tail&&... tail){cin>>head; CINT(move(tail)...);}    
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)
#define VCIN(x) for(auto &item:x) cin>>item

void OUT(){}
template<class Head,class...Tail> void OUT(Head&& head,Tail&&...tail){cout<<head<<(sizeof...(tail)?" ":"\n"); OUT(move(tail)...);}
#define COUT(...) OUT(__VA_ARGS__)

template<typename TypeInt>TypeInt GCD(TypeInt a,TypeInt b){return a%b==0?b:GCD(b,a%b);} //最大公約数
template<typename TypeInt>TypeInt LCM(TypeInt a,TypeInt b){return a*b/GCD(a,b);} //最小公倍数
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return true;}return false;}
template<class T>bool comp(T a,T b){return abs(a)<abs(b);} //比較関数

void YES(bool f){printf(f?"YES\n":"NO\n");}
void Yes(bool f){printf(f?"Yes\n":"No\n");}
void Possible(bool f){printf(f?"Possible\n":"Impossible\n");}
void POSSIBLE(bool f){printf(f?"POSSIBLE\n":"IMPOSSIBLE\n");}

//----------------------library------------------------//

//const int dx[4]={1,0,-1,0};
//const int dy[4]={0,1,0,-1};
const int dx[8]={1,0,-1,0,1,-1,-1,1};
const int dy[8]={0,1,0,-1,1,1,-1,-1};
const int NMAX = 200;
const int INF = 1e9;
const int MOD = 1e9+7;
bool flag;

//----------------------Global-------------------------//


signed main(){
    LCIN(N,a,b,c,d,e);
    ll ans;ans=max({(N-1)/a,(N-1)/b,(N-1)/c,(N-1)/d,(N-1)/e})+5;
    printf("%lld\n",ans);

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

const int N = 610;
int a[N][N], sr[N][N], sc[N][N];

bool isin(int i, int j){
    return i >= 0 && j >= 0 && i < N && j < N;
}

bool exist(int i, int j){
    return isin(i, j) && a[i][j];
}

int main() {
    int h, w;
    cin >> h >> w;
    REP(i,h){
        string s;
        cin >> s;
        REP(j,w){
            a[i+j][i-j+300] = (s[j] == '#');
        }
    }

    REP(i,N) REP(j,N-1) sr[i][j+1] = sr[i][j] + a[i][j];
    REP(j,N) REP(i,N-1) sc[i+1][j] = sc[i][j] + a[i][j];

    ll ans = 0, ans2 = 0;
    REP(i,N) REP(j,N){
        if (!a[i][j]) continue;
        FOR(d,1,N){
            ll tmp = 0;
            if (exist(i - d, j)){
                if (j + d < N) tmp += sc[i][j+d] - sc[i-d+1][j+d];
                if (j - d >= 0) tmp += sc[i][j-d] - sc[i-d+1][j-d];
            }
            if (exist(i + d, j)){
                if (j + d < N) tmp += sc[i+d][j+d] - sc[i+1][j+d];
                if (j - d >= 0) tmp += sc[i+d][j-d] - sc[i+1][j-d];
            }
            if (exist(i, j - d)){
                if (i + d < N) tmp += sr[i+d][j] - sr[i+d][j-d+1];
                if (i - d >= 0) tmp += sr[i-d][j] - sr[i-d][j-d+1];
            }
            if (exist(i, j + d)){
                if (i + d < N) tmp += sr[i+d][j+d] - sr[i+d][j+1];
                if (i - d >= 0) tmp += sr[i-d][j+d] - sr[i-d][j+1];
            }
            ans2 += (exist(i - d, j) + exist(i + d, j)) * (exist(i, j - d) + exist(i, j + d));
            ans += tmp;
        }
    }
    cout << ans / 2 + ans2 << endl;

    return 0;
}


Measured memory_bytes: 4608
r = gets.to_i
word=gets.chomp
n = r/2
half_word =  word.insert(n, ",").split(",")

  if r % 2 != 0
    puts "No"
  else  
    if half_word[0] == half_word[1]
      puts "Yes"
    else
      puts "No"
    end
  end  

Measured memory_bytes: 1788
//#include <bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<cmath>
#include<cstring>
#include<bitset>
#include<stack>

#define X first
#define Y second
#define PB push_back
#define MP make_pair
#define scd(a) scanf("%d",&a)
#define scdd(a,b) scanf("%d%d",&a,&b)
#define scddd(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define ALL(x) x.begin(),x.end()
#define mst(var,val) memset(var,val,sizeof(var))
#define IOS ios::sync_with_stdio(false);cin.tie(0)
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define ls rt<<1
#define rs rt<<1|1
#ifdef local
#define dbg(a) cout << #a": " << a << endl;
#else
#define dbg(a)
#endif // loacl


using namespace std;
typedef long long ll;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <double, double> pdd;
const ll inf=0x3f3f3f3f;
const long long INF=0x3f3f3f3f3f3f3f3fLL;
const double PI=acos(-1.0);
const long double eps=1e-6;
const int mod=1e9+7;
const int maxn=20;
const int N=1e5+10;
const int M=N<<1;
const ll mm=(1LL<<32);

template <class T>
inline void read(T &x) {
    x = 0;
    char c = getchar();
    bool f = 0;
    for (; !isdigit(c); c = getchar()) f ^= c == '-';
    for (; isdigit(c); c = getchar()) x = x * 10 + (c ^ 48);
    x = f ? -x : x;
}

template <class T>
inline void write(T x) {
    if (x < 0) {
        putchar('-');
        x = -x;
    }
    T y = 1;
    int len = 1;
    for (; y <= x / 10; y *= 10) ++len;
    for (; len; --len, x %= y, y /= 10) putchar(x / y + 48);
}
ll qpow(ll a,ll b,ll MOD)
{
    ll ans=1;
    while(b)
    {
        if(b&1) ans=(ans*a)%MOD;
        b>>=1;
        a=(a*a)%MOD;
    }
    return ans;
}

int a[N];
int main()
{
#ifdef local
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
#endif // local
    ll n;cin>>n;
    cout<<n*(n-1)/2;
}



Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    final String S=sc.next();
    char[] s=S.toCharArray();
    boolean flg=false;
    for(int i=0;i<3;i++){
      if(s[i]==s[i+1]){
        flg=true;
        break;
      }
    }
    if(flg){
      System.out.println("Bad");
    }else{
      System.out.println("Good");
    }
  }
}

Measured memory_bytes: 22868
//{{{
#include <bits/stdc++.h>
using namespace std;
#define repX(a,b,c,x,...) x
#define repN(a) repX a
#define rep(...) repN((__VA_ARGS__,rep3,rep2,loop))(__VA_ARGS__)
#define rrep(...) repN((__VA_ARGS__,rrep3,rrep2))(__VA_ARGS__)
#define loop(n) rep2(i_,n)
#define rep2(i,n) rep3(i,0,n)
#define rep3(i,begin,end) for(int i=(int)(begin),i##_end=(int)(end);i<i##_end;++i)
#define rrep2(i,n) rrep3(i,n,0)
#define rrep3(i,begin,end) for(int i=(int)(begin-1),i##_end=(int)(end);i>=i##_end;--i)
#define foreach(x,a) for(auto&x:a)
using ll=long long;
const ll MOD=(ll)1e9+7;
//}}}

ll f1[200001] = {0};
ll f2[200001] = {0};
ll comb1[200001];
ll comb2[200001];

ll mod_pow(ll x, ll n){
  ll res = 1LL;
  while(n > 0){
    if(n & 1) res = res * x % MOD;
    x = x*x % MOD;
    n >>= 1;
  }
  return res;
}

ll mod_inv(ll x){
  return mod_pow(x, MOD-2) % MOD;
}

ll comb_mod1(int n, int r){
  return (((f1[n] * mod_inv(f1[r])) % MOD) * mod_inv(f1[n-r])) % MOD;
}
ll comb_mod2(int n, int r){
  return (((f2[n] * mod_inv(f2[r])) % MOD) * mod_inv(f2[n-r])) % MOD;
}

int main(){
  ll H, W, A, B;
  cin >> H >> W >> A >> B;
  ll ans = 0;

  {
    int N = H - A + B - 1;
    f1[0] = f1[1] = 1;
    rep(i, 2, N + 1) f1[i] = (i * f1[i-1]) % MOD;
    rep(i, N + 1) comb1[i] = comb_mod1(N, i);
  }
  {
    int N = W - B + A - 1;
    f2[0] = f2[1] = 1;
    rep(i, 2, N + 1) f2[i] = (i * f2[i-1]) % MOD;
    rep(i, N + 1) comb2[i] = comb_mod2(N, i);
  }

  rep(i, min(W - B, H - A)){
    ans += comb1[B + i] * comb2[A + i];
    ans %= MOD;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 5888
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <cmath>

using namespace std;
#define PI 3.1415926535897932384626433832795
#define MOD (1000000007)
#define EPS (1e-15)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repc(i, s, n) for (int i = (s); i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define rrepc(i, s, n) for (int i = (s); i >= (n); i--)
#define bet(x, a, b) (a) <= (x) && (x) < (b)
typedef long long ll;
typedef unsigned long long ull;

int A[10000];

int main()
{
	int N, M, sum = 0;

	cin >> N >> M;
	rep(i, M) cin >> A[i];

	rep(i, M) sum += A[i];

	cout << (sum <= N ? N - sum : -1) << endl;

	return 0;
}


Measured memory_bytes: 3644
using System;

namespace abc139_b
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int a = int.Parse(input[0]);
            int b = int.Parse(input[1]);


            int result = 0;


            while (((a - 1) * (result - 1) + a) < b)
            {
                result++;
            }

            Console.WriteLine(result);

        }
    }
}


Measured memory_bytes: 11092
/*
* @Author: Nazrul Islam
* @Date:   2020-09-21 00:43:11
* @Last Modified by:   Nazrul Islam
* @Last Modified time: 2020-09-21 00:56:42
*/

#include<bits/stdc++.h>
using namespace std;
#define IO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
typedef long long ll; 
typedef double dd;
typedef vector<int> vi;
typedef vector<char> vc;
typedef list<int> li;
typedef set<int> si;
typedef map<int,int> mp;
#define pb push_back
#define pf push_front
#define mk make_pair
#define sc scanf
#define pr printf
#define pi acos(-1.0)
#define endl '\n'
// char s[200009];
// char st[200009];
// int a[600][600];
// int b[29][10];
// int a[200009];
// int c[200009];
ll dp[2003];
ll m = 1e9+7;

ll mod(ll n) {
	return ((n%m + m)%m);
}

ll add(ll a, ll b) {
	return mod(mod(a) + mod(b));
}

ll result(ll n) {
	if(n == 0) return 1;
	else if(n < 3) return 0;
	else if(n >= 3 && n < 6) return 1;
	else if(dp[n] != -1) return dp[n];
	else {
		ll p = 0;
		for (int i = 3; i <= n; i++) {
			if(n-i >= 0)
				p = add(p, result(n-i));
		}
		
		return dp[n] = p;
	}
}

void solve()
{
	ll n;
	cin >> n;
	memset(dp, -1, sizeof(dp));
	dp[0] = 1;
	ll q = result(n);
	cout << q%m << endl; 
}
int main()
{
	IO;
	int t; 
	t = 1;
	// cin >> t;
	while(t--)
		solve();
	return 0;
}

Measured memory_bytes: 3664
def update(i, x):
    i += base
    st[i] = x
    while i>0:
        i = (i-1)//2
        st[i] = min(st[i*2+1], st[i*2+2])


def find(a, b):
    return _find(a, b+1, 0, 0, n)


def _find(a, b, k, l, r):
    if b <= l or r <= a:
        return 2**31-1

    if a <= l and r <= b:
        return st[k]

    rl = _find(a, b, 2*k+1, l, (l+r)/2)
    rr = _find(a, b, 2*k+2, (l+r)/2, r)
    return min(rl, rr)


(_n, q) = map(int, input().split())

n=1
while(n<=_n):
    n *= 2
base = n-1
st = [2**31-1]*(2*n-1)

for i in range(q):
    (c, l, r) = map(int, input().split())
    if c:
        print(find(l, r))
    else:
        update(l, r)

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

int main(){
    int N, L, i;
    string S[120];
    int a_min = 1200;
    int a_max = 0;

    cin >> N >> L ;

    for (i=0; i<N; i++){
        cin >> S[i];
    }

    sort (S, S+N);

    for (i=0; i<N; i++){
        cout << S[i];
        }
    cout << endl;

    }




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

#define MOD 1000000007
#define rep(i, n) for(ll i=0; i < (n); i++)
#define rrep(i, n) for(ll i=(n)-1; i >=0; i--)
#define ALL(v) v.begin(),v.end()
#define rALL(v) v.rbegin(),v.rend()
#define FOR(i, j, k) for(ll i=j;i<k;i++)
#define debug_print(var) cerr << #var << "=" << var <<endl;
#define DUMP(i, v)for(ll i=0;i<v.size();i++)cerr<<v[i]<<" "
#define fi first
#define se second

using namespace std;
typedef long long int ll;
typedef vector<ll> llvec;
typedef vector<double> dvec;
typedef pair<ll, ll> P;
typedef long double ld;
struct edge{ll x, c;};

ll mod(ll a, ll mod){
  ll res = a%mod;
  if(res<0)res=res + mod;
  return res;
}

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

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

ll gcd(ll a, ll b){
  ll r = a%b;
  if(r==0) return b;
  else return gcd(b, a%b);
}

bool is_prime(ll n){
  ll i = 2;
  if(n==1)return false;
  if(n==2)return true;
  bool res = true;
  while(i*i <n){
    if(n%i==0){
      res = false;
    }
    i = i+1;
  }

  //if(i==1)res = false;
  if(n%i==0)res=false;
  return res;
}

struct UnionFind{
  ll N;
  llvec p;
  llvec cnt;
  UnionFind(ll n){
    N = n;
    p=llvec(N);
    cnt=llvec(N, 0);
    rep(i, N){
      p[i] = i;
      cnt[i] = 1;
    }
  }

  void con(ll a, ll b){
    P at = root(a);
    P bt = root(b);
    if(at.second!=bt.second){
      if(at.first>bt.first){
        swap(at, bt);
        swap(a, b);
      }
      p[at.second] = bt.second;
      cnt[bt.second]+=cnt[at.second];
      p[a]=bt.second;
    }
  }

  P root(ll a){
    ll atmp = a;
    ll c=0;
    while(atmp!=p[atmp]){
      atmp = p[atmp];
      c++;
    }
    p[a] = atmp;
    return {c, atmp};
  }

  bool is_con(ll a, ll b){
    P at=root(a);
    P bt=root(b);
    return at.second == bt.second;
  }
  
};

struct dijkstra{
  ll N;
  llvec d;
  vector<vector<edge>> e;
  dijkstra(ll n){
    N = n;
    //d = llvec(N, 1e18);
    e = vector<vector<edge>>(N);
  }

  void add_edge(ll from, ll to, ll cost){
    e[from].push_back({to, cost});
  }

  void run(ll start){
    priority_queue<P, vector<P>, greater<P>> que;
    que.push({0, start});
    d = llvec(N, 1e18);
    d[start]=0;
    while(!que.empty()){
      P q = que.top();que.pop();
      ll dc = q.first;
      ll x = q.second;
      if(dc>d[x]){
        continue;
      }else{
        for(auto ip: e[x]){
          if(d[ip.x]<=d[x]+ip.c){
            continue;
          }else{
            d[ip.x]= d[x]+ip.c;
            que.push({d[ip.x], ip.x});
          }
        }
      }
    }
  }  
};


/**************************************
** A main function starts from here  **
***************************************/
int main(){
  ll N;
  cin >> N;
  for(ll h=1;h<=3500;h++){
    for(ll n=h;n<=3500;n++){
      ll d = 4*h*n - N * n - N * h;
      if(d<=0)continue;
      if((N*h*n)%d==0){
        cout << h << " " << n << " " << (N*h*n)/d<<endl;
        return 0;
      }
    }
  }
  return 0;
}


Measured memory_bytes: 3644
#dpでできないかな？
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod=10**9+7

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def lcm(a, b):
    return a // gcd(a, b) * b
a,b,c,d=MI()
u=lcm(c,d)
#print(u)
#1~x mod y==0
'''def div(x,y):
    return int(x/y) '''
'''ansb=b-div(b,c)-div(b,d)+div(b,u)
ansa=a-1-div(a-1,c)-div(a-1,d)+div(a-1,u)'''
ansb=b-b//c-b//d+b//u
ansa=a-1-(a-1)//c-(a-1)//d+(a-1)//u

print(ansb-ansa)
mod = 10**9 + 7

Measured memory_bytes: 3316
#if 0
date +%Y.%m.%d

题解先咕着。
#endif
#include <cstdio>
#include <algorithm>
#define debug(...) fprintf(stderr, __VA_ARGS__)

typedef long long ll;

struct {
	inline operator int () { int x; return scanf("%d", &x), x; }
	inline operator ll () { ll x; return scanf("%lld", &x), x; }
	template<class T> inline void operator () (T &x) { x = *this; }
	template<class T, class ...A> inline void operator () (T &x, A &...a)
	{ x = *this; this -> operator () (a...); }
} read;

const int maxn = 1000005;
char s[maxn];
int a[maxn];

int main () {
	int n = read;
	scanf("%s", s + 1);
	-- n;
	for (int i = 1; i <= n; i ++)
		a[i] = std::abs(s[i] - s[i + 1]);

	bool one = 0;
	for (int i = 1; i <= n; i ++)
		if (a[i] == 1)
			one = 1;

	if (one) {
		for (int i = 1; i <= n; i ++)
			if (a[i] == 2)
				a[i] = 0;
	}
	else {
		for (int i = 1; i <= n; i ++)
			if (a[i] == 2)
				a[i] = 1;
	}

	int ans = 0;
	int pc = 0;
	for (int i = 1; i <= n; i ++) {
		if (!pc and a[i]) ans ^= 1;
		if (i < n) {
			for (int x = n - i; !(x & 1); x >>= 1)
				++ pc;
			for (int x = i; !(x & 1); x >>= 1)
				-- pc;
		}
	}

	if (!one)
		ans <<= 1;
	printf("%d\n", ans);
}


Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
typedef double db;
mt19937 mrand(random_device{}()); 
const ll mod=1000000007;
int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
int main() {
	string s;
	cin>>s;
	int c1=0,c2=0;
	for(int i=0;i<s.length();i++)
	{
		if(s[i]=='A')
		c1++;
		else
		c2++;
	}
	if(c1>0 && c2>0)
	cout<<"Yes";
	else
	cout<<"No";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	string s;
	cin>>s;
	int ans=0;
	int cnt;
	int c[26];
	int d[26];
	for(int i=0;i<26;i++){
		c[i]=0;
		d[i]=0;
	}
	for(int i=0;i<n;i++)d[(int)(s[i]-'a')]++;
	for(int i=0;i<n;i++){
		cnt=0;
		c[(int)(s[i]-'a')]++;
		d[(int)(s[i]-'a')]--;
		for(int i=0;i<26;i++)if(c[i]!=0&&d[i]!=0)cnt++;
		if(cnt>ans)ans=cnt;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<utility>

#define NMAX 1000000

using namespace std;

int main(void){

	int a,b;
	bool f;
	bool f2=false;

	while(1){
		cin>>a>>b;
		if(a==0&&b==0) break;
		if(f2) cout<<endl;
		f2=true;
		f=false;
		for(int i=a;i<=b;i++){
			if(i%4==0){
				if(i%100!=0||i%400==0){
					cout<<i<<endl;
					f=true;
				}
			}
		}
		if(!f) cout<<"NA"<<endl;
	}

	return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <sstream>
#define ll long long int
#define rep(i,x,y) for(int i=x;i<y;i++)
#define rel(i,x,y) for(int i=x-1;i>=y;i--)
#define all(x) x.begin(),x.end()
 
using namespace std;

int main (){
    int n,m;
	cin >> n >> m;
	int l[m],r[m];
	int a=1,b=n,c=0;

	rep(i,0,m){
		cin >> l[i] >> r[i];
		if(l[i] > b){
			c=1;
		}
		else if(r[i]<a){
			c=1;
		}
		if(l[i]>a){
			a=l[i];
		}
		if(r[i]<b){
			b=r[i];
		}
	}

	if(c==1){
		cout << "0" << endl;
	}
	else{
		cout << b-a+1 << endl;
	}
}

Measured memory_bytes: 1024
import math
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

n, p = map(int, input().split())
A = list(map(lambda x: int(x) % 2, input().split()))
x = A.count(0)
y = n - x
if p == 1:
    cnt = 0
    for i in range(y + 1):
        if i % 2 == 1:
            cnt += combinations_count(y, i)
    print(2 ** x * cnt)
else:
    cnt = 0
    for i in range(y + 1):
        if i % 2 == 0:
            cnt += combinations_count(y, i)
    print(2 ** x * cnt)

Measured memory_bytes: 9196
//karna padega 
#include<bits/stdc++.h>
using namespace std;  
#pragma GCC optimize("Ofast") 
#define int long long
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back 
#define eb emplace_back
#define fn for(int i =0 ;i <n;i++)
#define fn1 for( int i =1;i<=n; i++)
#define fm for(int j =0 ;j <m;j++)
#define fm1 for(int j =1;j<=m;j++)
#define fi first
#define se second
#define endl '\n'
#define PI  3.14159265358979323846
#define MOD 1000000007
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
const int N = 2e6+5;
const int INF = 1e18L;
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}
int ar[N];
signed main(){
  #ifndef ONLINE_JUDGE
  freopen("input.txt","r",stdin);
  freopen("output.txt","w",stdout);
  #endif
  IOS;
  int T=1;
  // cin >> T;
  while(T--){
    int n , m ,k;
    cin >> n >> m >> k;
    vector<int>dp(n),dp2(m);
    fn{
      cin>>dp[i];
      if(i)dp[i]+=dp[i-1];
    }
    fm{
      cin>>dp2[j];
      if(j)dp2[j]+=dp2[j-1];
    }
    int ans = 0;
    fn{
      int rem =k - dp[i];
      if(rem<0)break;
      int pos =  lower_bound(all(dp2),rem)- dp2.begin();
      if(dp2[pos] == rem)pos++;
      ans =max(ans, i + 1ll + max(0ll,min(m,pos)));
    }
    fm{
      int rem =k - dp2[j];
      if(rem<0)break;
      int pos =  lower_bound(all(dp),rem)- dp.begin();
      if(dp[pos] == rem)pos++;
      ans =max(ans, j + 1ll + max(0ll,min(n,pos)));
    }
    cout << ans;
  
  }
  return 0;
}

Measured memory_bytes: 6300
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for _ in range(n)]
def LIR(n):
    return [LI() for _ in range(n)]
def SR(n):
    return [S() for _ in range(n)]
def LSR(n):
    return [LS() for _ in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    def comb(a,b):
        if a < b:
            return 0
        return f[a]*inv[b]*inv[a-b]
    s = I()
    N = 1000000
    f = [1]*(N+1)
    for i in range(N):
        f[i+1] = f[i]*(i+1)%mod
    inv = [None]*(N+1)
    inv[N] = pow(f[N],mod-2,mod)
    for i in range(N)[::-1]:
        inv[i] = inv[i+1]*(i+1)%mod
    ans = 0
    for i in range(1,s//3+1):
        n = s-3*i
        ans += comb(n+i-1,n)
        ans %= mod
    print(ans)
    return

#Solve
if __name__ == "__main__":
    solve()


Measured memory_bytes: 93840
#include <bits/stdc++.h>
using namespace std;
struct Fast { Fast() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20);} } fast;

int main() {
    int n, m;
    cin >> n >> m;
    vector<int>dp(n + 1, 1e9);
    vector<int>cs(m);
    dp[0] = 0;
    for (int i = 0; i < m; i++){
        cin >> cs[i];
    }
    for (int i = 1; i <= n; i++){
        for (int j = 0; j < m; j++){
            if (i - cs[j] >= 0){
                dp[i] = min(dp[i], dp[i - cs[j]] + 1);
            }
        }
    }
    cout << dp[n] << endl;
}


Measured memory_bytes: 3184
N = int(input())
import math
def is_prime(q):
    q = abs(q)
    if q == 2: return True
    if q < 2 or q&1 == 0: return False
    return pow(2, q-1, q) == 1
def prime(q):
    a = int(math.sqrt(q))
    for i in range(2,a+1):
        if q % i == 0:
            return False
    return True
while True:
    if prime(N):
        print(N)
        exit()
    N += 1

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

int main() {
  int a,b;cin>>a>>b;
  rep(i,10000){
    int A=i*8/100,B=i*10/100;
    if(a==A&&b==B){
      cout<<i<<endl;
      return 0;
    }
  }
  cout<<-1<<endl;
}

Measured memory_bytes: 3556
import java.util.*;
import java.lang.*;


public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long a[] = new long[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextLong();
        }
        Arrays.sort(a);
        int ans = 0;
        if (a[0] % 2 != 0) {
            ans = n;
        }
        for (int i = 1; i < n; i++) {
            if ((a[i] - a[i - 1]) % 2 != 0) {
                ans ^= n - i;
            }
        }
        if (ans == 0) {
            System.out.println("second");
        } else {
            System.out.println("first");
        }
    }
}


Measured memory_bytes: 59584
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
vector<string>v; int n, a[1000], b[1000], c[1000]; string s1[1000], s2[1000], t[1000];
vector<int>u[1000]; int group[1000], dist[1000]; bool OK = true;
int s(string Y) { return lower_bound(v.begin(), v.end(), Y) - v.begin(); }

void merge(int a, int b, int c) {
	if (group[a] == group[b]) { if ((dist[a] - dist[b]) != c)OK = false; return; }
	int w1 = group[a], w2 = group[b];
	int sa = (dist[a] - dist[b]) - c;
	for (int i : u[w2])dist[i] += sa;
	for (int i : u[w2])u[w1].push_back(i);
	for (int i : u[w2])group[i] = w1;
	u[w2].clear();
	sort(u[w1].begin(), u[w1].end());
	return;
}
int main() {
	while (true) {
		cin >> n; v.clear(); if (n == 0)break;
		for (int i = 0; i < n; i++) {
			string a1, a2; cin >> a1 >> s1[i] >> a2 >> t[i] >> s2[i];
			v.push_back(s1[i]); v.push_back(s2[i]);
		}
		sort(v.begin(), v.end()); v.erase(unique(v.begin(), v.end()), v.end()); OK = true; int m = v.size();
		for (int i = 0; i < m; i++) { group[i] = i; u[i].clear(); u[i].push_back(i); }
		for (int i = 0; i < n; i++) { a[i] = s(s1[i]); b[i] = s(s2[i]); c[i] = stoi(t[i].substr(3, t[i].size() - 3)); }
		for (int i = 0; i < n; i++) { merge(a[i], b[i], c[i]); }
		if (OK == true)cout << "Yes" << endl; else cout << "No" << endl;
	}
	return 0;
}

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

template<class Abel> struct UnionFind {
    vector<int> par;
    vector<int> rank;
    vector<Abel> diff_weight;

    UnionFind(int n = 1, Abel SUM_UNITY = 0) {
        init(n, SUM_UNITY);
    }

    void init(int n = 1, Abel SUM_UNITY = 0) {
        par.resize(n); rank.resize(n); diff_weight.resize(n);
        for (int i = 0; i < n; ++i) par[i] = i, rank[i] = 0, diff_weight[i] = SUM_UNITY;
    }

    int root(int x) {
        if (par[x] == x) {
            return x;
        }
        else {
            int r = root(par[x]);
            diff_weight[x] += diff_weight[par[x]];
            return par[x] = r;
        }
    }

    Abel weight(int x) {
        root(x);
        return diff_weight[x];
    }

    bool issame(int x, int y) {
        return root(x) == root(y);
    }

    bool merge(int x, int y, Abel w) {
        w += weight(x); w -= weight(y);
        x = root(x); y = root(y);
        if (x == y) return false;
        if (rank[x] < rank[y]) swap(x, y), w = -w;
        if (rank[x] == rank[y]) ++rank[x];
        par[y] = x;
        diff_weight[y] = w;
        return true;
    }

    Abel diff(int x, int y) {
        return weight(y) - weight(x);
    }
};

int main() {
    ll n,q;
    std::cin >> n>>q;
    
    UnionFind<ll> uf(n);
    
    for (int i = 0; i < q; i++) {
        ll c;
        std::cin >> c;
        if(c==0){
            ll x,y,z;
            std::cin >> x>>y>>z;
            uf.merge(x,y,z);
        }else{
            ll x,y;
            std::cin >> x>>y;
            if(uf.issame(x,y)){
                std::cout << uf.diff(x,y) << std::endl;
            }else{
                std::cout << "?" << std::endl;
            }
        }
    }
}



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

using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
ll dp[101][2];
 int main() {
	 int L, K;
	 cin >> L >> K;
	 dp[1][0] = 1;
	 if (K <= L) dp[K][0] = 1;
	 for (int i = 1; i < L; i++) {
		 dp[i + 1][1] += dp[i][0];
		 dp[i + 1][0] += dp[i][1];
		 if (i + K <= L) dp[i + K][0] += dp[i][1];
	 }
	 ll ans = 0;
	 for (int i = 1; i <= L; i++) ans += dp[i][0];
	 cout << ans << endl;
}


Measured memory_bytes: 3112
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vll = vector<vl>;
using vb = vector<bool>;
using vs = vector<string>;
using msi = map<string, int>;
using mii = map<int, int>;
using psi = pair<string, int>;
using pii = pair<int, int>;
using vlai = valarray<int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
#define mp make_pair
#define INF 1E9
#define LINF 1E18*5
#define EPS 1E-9
#define MOD 1000000007
#define PI 3.1415926535897932384

template<class S, class T>ostream& operator<<(ostream&os, pair<S, T>p) { os << "[" << p.first << ", " << p.second << "]"; return os; };
template<class S>auto&operator<<(ostream&os, vector<S>t) { bool a = 1; for (auto s : t) { os << (a ? "" : " ") << s; a = 0; } return os; }

//int dx[]={1,1,1,0,-1,-1,-1,0},dy[8]={1,0,-1,-1,-1,0,1,1,1};
//
constexpr ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }

class compare {
public:
	bool operator()(tuple<int, int> a, tuple<int, int> b) {
		return (get<1>(a) < get<1>(b));
	}

};

vl fact(200002), finv(200002);

ll modpw(ll x, ll k) {
	ll res = 1;
	while (k != 0) {
		if (k& 1) res = res*x % MOD;
		x = x*x % MOD;
		k = k >> 1;
	}
	return res;
}

ll comb(ll n, ll k) {
	if (n == 0 && k == 0)return 1;
	if (n < k || n < 0)return 0;
	return fact[n] * finv[n - k] % MOD * finv[k] % MOD;;
}

int main() {
	int h, w, a, b;
	cin >> h >> w >> a >> b;
	ll ans = 0;
	fact[0] = 1;
	finv[0] = 1;
	rep(i, 200001) {
		fact[i + 1] = (fact[i] * (i + 1)) % MOD;
		finv[i + 1] = modpw(fact[i + 1], MOD - 2);
	}
	rep(i, w - b) {
		ans += comb(h - a + b + i - 1, h - a - 1)*comb(a + w - b - i - 2, a - 1);
		ans %= MOD;
	}
	cout << ans << endl;
}


Measured memory_bytes: 3456
S = input()
sl = list(S)

if sl[0]==sl[1] and sl[2]==sl[3] and sl[0]!=sl[2]:
  print("Yes")
elif sl[0]==sl[2] and sl[1]==sl[3] and sl[0]!=sl[1]:
  print("Yes")
elif sl[0]==sl[3] and sl[1]==sl[2] and sl[0]!=sl[1]:
  print("Yes")
else:
  print("No")


Measured memory_bytes: 3064
import sys
                                       
lst = []
for i in sys.stdin:
    lst.append(int(i))
                                                                                            
a = lst[0]*lst[4]
                                            
b = lst[1]
if lst[4] > lst[2]:
    b = b + lst[3]*(lst[4]-lst[2])

if a > b:
    print b
else:
    print a
sys.exit(0)

Measured memory_bytes: 6444
#include <iostream>
#include <math.h>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <iomanip>
#include <string.h>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()

typedef long long lint;

using namespace std;

int main(){
  bool f=true;
  map<char,int> m;
  string s;
  cin>>s;
  for(auto c:s){
    if(m[c]>=1)f=false;
    m[c]++;
  }
  cout<<(f?"yes":"no")<<endl;
  return 0;
}


Measured memory_bytes: 764
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define FOR(i,a,b) for(int i=(a); i<=(b); i++) 
#define rep(i,n); for(int i = 0; i < (n); i++)
#define chmin(a,b) if((a)>(b)) (a)=(b); 
#define chmax(a,b) if((a)<(b)) (a)=(b);
#define vi vector<int>
#define all(v) (v).begin(),(v).end()
int gcd(int a,int b){/*a>=0,b>=0,￢(a=b=0)*/
  while(min(a,b)>0){if(a<b)swap(a,b);a%=b;}return max(a,b);
}
int dx[]={0,1,0,-1,1,-1,-1,1};
int dy[]={1,0,-1,0,1,1,-1,-1};
const int MOD = 1e9+7;
const int INF = 1e18+10;

/*----------------------------------------------*/

int fra(int a){
  if(a==0) return 1;
  else return a*fra(a-1);
}

signed main(){
  int n;
  cin>>n;
  vi p(n),q(n);
  rep(i,n) cin>>p[i];
  rep(i,n) cin>>q[i];
  int a=0,b=0;
  vector<bool> cp(n+1,1),cq(n,1);
  int k;
  rep(i,n-1) {//i桁目の数字の手前まで確定
    k=0;
    FOR(j,1,p[i]-1) {
      if(cp[j]) k++;
    }
    a+=fra(n-i-1)*k;
    cp[p[i]]=0;
  }
  a++;
  rep(i,n-1) {//i桁目の数字の手前まで確定
    k=0;
    FOR(j,1,q[i]-1) {
      if(cq[j]) k++;
    }
    b+=fra(n-i-1)*k;
    cq[q[i]]=0;
  }
  b++;
  int ans=abs(a-b);

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define MOD 1000000007
typedef long long ll;

using namespace std;

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

  int d = a / b;
  int r = a % b;
  double f = (a * 1.0) / (b * 1.0);

  cout << d << " " << r << " " << fixed << setprecision(5) << f << "\n";
}


Measured memory_bytes: 3244
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;cin>>n;
	deque<int> q;
	while(n--){
		int a,x,y;cin>>a;
		if(a==0){
			cin>>x>>y;
			if(x==0)q.push_front(y);
			if(x==1)q.push_back(y);
		}
		if(a==1){
			cin>>x;
			cout<<q[x]<<endl;
		}
		if(a==2){
			cin>>x;
			if(x==0)q.pop_front();
			if(x==1)q.pop_back();
		}
	}
	return 0;
}



Measured memory_bytes: 4676
#include<cstdio>
const int N=1e5+7;
int n,es[N*2],enx[N*2],e0[N],ep=2,del[N],flag=0;
void f1(int w,int pa){
	for(int i=e0[w];i;i=enx[i]){
		int u=es[i];
		if(u==pa)continue;
		f1(u,w);
	}
	if(!del[w]&&!del[pa])del[w]=del[pa]=1;
	if(!del[w])flag=1;
}
int main(){
	scanf("%d",&n);
	for(int i=1,a,b;i<n;++i){
		scanf("%d%d",&a,&b);
		es[ep]=b;enx[ep]=e0[a];e0[a]=ep++;
		es[ep]=a;enx[ep]=e0[b];e0[b]=ep++;
	}
	del[0]=1;
	f1(1,0);
	puts(flag?"First":"Second");
	return 0;
}

Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
const int maxn = 5e5;
int a[maxn];
int main(){
    int n;
    scanf("%d",&n);
    double pi = acos(-1.0);
    //printf("%d\n")
    printf("%.6f\n",2.0*n*pi);




    return 0;
}



Measured memory_bytes: 3824
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <unordered_map>

using namespace std;
using ll = long long;

void _cin(){} template <class Head, class... Tail> void _cin(Head&& head, Tail&&... tail){ cin >> head; _cin(forward<Tail>(tail)...); }
void _cout(){ cout << "\n"; } template <class Head, class... Tail> void _cout(Head&& head, Tail&&... tail){ cout << head; _cout(forward<Tail>(tail)...); }
int gcd(int a, int b){ return (b == 0) ? a : gcd(b, a % b); }
template<typename S, typename T> ostream& operator<<(ostream &os, const pair<S, T> &p){ cout << "[" << p.first << ", " << p.second << "]"; return os; }

#define Sq(x) (x)*(x)
#define For(i, n) for(int i = 0; i < (n); i ++)
#define Rep(n) For(_, n)
#define Range(c) c.begin(), c.end()
#define RevRange(c) c.rbegin(), c.rend()
#define Contains(c, x) (find(Range(c), x) != c.end())
#define Search(rb, re, x) distance(rb, find(rb, re, x))
#define Sort(a) sort(Range(a))
#define DeSort(a) sort(RevRange(a))
#define Reverse(c) reverse(Range(c))
#define Unique(a) a.erase(unique(Range(a)), a.end())
#define Cusum(T, xs, sxs) vector<T> sxs(xs.size()+1); For(i, (int)xs.size()) sxs[i+1] = sxs[i] + xs[i]
#define Cin(T, ...) T __VA_ARGS__; _cin(__VA_ARGS__)
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i]
#define Cins2(T, n, xs, ys) vector<T> xs(n), ys(n); For(i, n) cin >> xs[i] >> ys[i]
#define Cins3(T, n, xs, ys, zs) vector<T> xs(n), ys(n), zs(n); For(i, n) cin >> xs[i] >> ys[i] >> zs[i]
#define Cinss(T, n, m, xs) Vec2(T, n, m, xs); For(i, n) For(j, m) cin >> xs[i][j]
#define Cinm(T, n, map) unordered_map<T, int> map; Rep(n){ Cin(T, x); map[x] ++; }
#define Cout(...) _cout(__VA_ARGS__)
#define Couts(xs) { for(const auto &e : xs) cout << e << " "; cout << "\n"; }
#define Coutyn(cond) Cout((cond) ? "yes" : "no")
#define CoutYn(cond) Cout((cond) ? "Yes" : "No")
#define CoutYN(cond) Cout((cond) ? "YES" : "NO")
#define Return(expr) { Cout(expr); return 0; }
#define vc vector
#define Mini(a, x) a = min(a, x)
#define Maxi(a, x) a = max(a, x)

// constexpr int MOD = 1e9+7;

int main(void){
    Cin(int, n, m, x);
    vc<int> c(n);
    vc<vc<int>> a(n, vc<int>(m));
    For(i, n){
        cin >> c[i];
        For(j, m) cin >> a[i][j];
    }
    
    auto dfs = [&](vc<bool> &seq, auto self) -> unsigned {
        if(seq.size() == n){
            For(j, m){
                int rikai = 0;
                For(i, n) if(seq[i]) rikai += a[i][j];
                if(rikai < x) return (unsigned)-1;
            }
            unsigned cost = 0;
            For(i, n) if(seq[i]) cost += c[i];
            return cost;
        }
        seq.push_back(false);
        unsigned r0 = self(seq, self);
        seq.back() = true;
        unsigned r1 = self(seq, self);
        seq.pop_back();
        return min(r0, r1);
    };
    
    vc<bool> empty;
    Cout((int)dfs(empty, dfs));
}


Measured memory_bytes: 3632
#include <cassert>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <complex>
#include <chrono>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
#include <random>
#include <memory>
#include <utility>
#include <limits>
#include "limits.h"
 
#define rep(i, a, b) for (long long (i) = (a); i < (b); i++)
#define all(i) i.begin(), i.end()
#define debug(...) std::cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

void debug_out(){std::cerr<<std::endl;}

template<typename Head,typename... Tail>
void debug_out(Head h,Tail... t){
  std::cerr<<" "<<h;
  debug_out(t...);
}
 
template <typename T1, typename T2>
std::ostream& operator<<(std::ostream& os, std::pair<T1, T2> pa) {
  return os << pa.first << " " << pa.second;
}
 
template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (int i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}
 
template<typename T1,typename T2>
inline bool chmax(T1& a,T2 b){return a<b && (a=b,true);}
 
template<typename T1,typename T2>
inline bool chmin(T1& a,T2 b){return a>b && (a=b,true);}
 
long long pow_mod(long long a, long long b, long long mod=-1) {
  if(b==0)return 1;
  if ((a == 0)||(mod!=-1&&(a+mod)%mod==0)) {
    return 0;
  }
  long long x = 1;
  while (b > 0) {
    if (b & 1) {
      x = (mod!=-1)?(x * a) % mod:x*a;
    }
    a = (mod!=-1)?(a * a) % mod:a*a;
    b >>= 1;
  }
  return x;
}

// const long long MOD = 998244353;
const long long MOD = 1e9 + 7;

//Nまでの逆元をコンパイル時計算する
template<long long N,long long MOD>
class ModInv_calc{
  public:
  long long inv[N+1];
  constexpr ModInv_calc():inv(){
    inv[1]=1;
    for(int i=2;i<=N;i++)inv[i]=inv[MOD%i]*(MOD-MOD/i)%MOD;
  }

  constexpr long long operator[](size_t i)const noexcept{return inv[i];}
};

constexpr ModInv_calc<1000000,MOD> inv{ModInv_calc<1000000,MOD>()};

using ll = long long;
using P=std::pair<long long,long long>;

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

  ll n;
  std::cin>>n;
 
  std::vector<ll> a(n);
  rep(i,0,n)std::cin>>a[i];
 
  ll lcm=1;
 
  std::map<ll,ll> max;
 
  rep(i,0,n){
    ll temp=a[i];
    for(ll j=2;j*j<=a[i];j++){
      if(temp%j==0){
        ll cnt=0;
        while(temp%j==0){
          cnt++;
          temp/=j;
        }
        chmax(max[j],cnt);
      }
    }
    if(temp!=1)chmax(max[temp],1);
  }
 
  for(auto e:max){
    lcm=(lcm*pow_mod(e.first,e.second))%MOD;
  }
 
  ll ans=0;
  rep(i,0,n){
    ans=(ans+lcm*inv[a[i]])%MOD;
  }
 
  std::cout<<ans<<"\n";

  return 0;
}

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

int main(){
    ll n; cin >> n;
    vector<ll> p(n);
    rep(i,n){
        ll a; cin >> a; a--;
        p[a] = i;
    }
    multiset<ll> check;
    check.insert(n);
    check.insert(n);
    check.insert(-1);
    check.insert(-1);

    ll ans = 0;
    rrep(i,n){
        ll k = p[i];
        auto iter = check.lower_bound(k);
        ll r1 = *iter;
        ll r2 = *(next(iter));
        iter--;
        ll l1 = *(iter);
        ll l2 = *(prev(iter));
        ans += (r1-k)*(l1-l2)*(i+1);
        ans += (r2-r1)*(k-l1)*(i+1);
        check.insert(k);
    }
    cout << ans << endl;
}

Measured memory_bytes: 8724