akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define in(x,y,h,w) x >= 0 && x < h && y >= 0 && y < w

#define int long long
//using ll = long long;
using P = pair<int,int>;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
 
const int INF=1e+18;
const double EPS=1e-9;
const int MOD=1000000007;

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

signed main(){
	int d[4] = {};
	for(int i = 0;i < 3;i++){
		int a,b;
		cin >> a >> b; a--;b--;
		d[a]++;
		d[b]++;
	}
	int ma = 0;
	for(int i = 0;i < 4;i++) chmax(ma,d[i]);
	if(ma <= 2) YES();
	else NO();
}


Measured memory_bytes: 256
use proconio::{input, fastout};
const MODC: u64 = 1000000007;

fn powm (xx: u64, yy: u64) -> u64 {
    let mut x = xx;
    let mut y = yy;
    let mut result = 1;
    while y > 0 {
        if y & 1 != 0 {
            result *= x;
            result %= MODC;
        }
        x *= x;
        x %= MODC;
        y >>= 1;
    }
    result
}
struct Fact {
    mm: Vec<u32>,
    iv: Vec<u32>,
}
impl Fact {
    fn new() -> Fact {
        Fact {
            mm: vec![1],      // idx!
            iv: vec![powm(1, MODC - 2) as u32],     // 1 / idx!
        }

    }
    fn fact(&mut self, x: u64) -> u64 {
        if x < self.mm.len() as u64 { self.mm[x as usize] as u64 }
        else {
            let len = self.mm.len();
            let mut n = self.mm[len-1] as u64;
            for i in (len as u64)..(x + 1) {
                n = n * i % MODC;
                self.mm.push(n as u32);
            }
            n
        }
    } 
    fn facti(&mut self, x: u64) -> u64 {
        if x < self.iv.len() as u64 { self.iv[x as usize] as u64 }
        else {
            let len = self.iv.len();
            let mut n: u64 = 0;
            for i in (len as u64)..(x + 1) {
                n = powm(self.fact(i), MODC - 2);
                self.iv.push(n as u32);
            }
            n
        }
    } 
    fn combm (&mut self, n: u64, k: u64) -> u64 {
        let mut result = self.fact(n);
        result = result * self.facti(n - k) % MODC;
        result * self.facti(k) % MODC
    }
}

#[fastout]
fn main() {
    let mut f = Fact::new();
    input! {
        k: u64,
        s: String,
    }
    let n = s.len() as u64;
    let mut ans = 0;
    for i in 0..(k+1) {
        ans += powm(25, i) * powm(26, k - i) % MODC * f.combm(n + i - 1, n - 1) % MODC;
        if ans >= MODC {ans -= MODC};
    }
    println!("{}", ans);
}


Measured memory_bytes: 15816
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath>
#include <iomanip>
#include <ctype.h>

using namespace std;
using ll = long long;
using PAIR = pair<int, int>;
using PAIRLL = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;

#define rep(i,N) for(int i=0;i<(int)N;++i)

ll GCD(ll x, ll y) {
    if (y == 0) return x;
    else return GCD(y, x % y);
}

bool my_compare(pair<string, int> a, pair<string, int> b) {
    if (a.first != b.first) {
        return a.first < b.first;
    }

    if (a.second != b.second) {
        return a.second > b.second;
    }
    else {
        return true;
    }
}

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

    if (N <= 111) { cout << 111 << endl; }
    else if (N > 111 && N <= 222) { cout << 222 << endl; }
    else if (N > 222 && N <= 333) { cout << 333 << endl; }
    else if (N > 333 && N <= 444) { cout << 444 << endl; }
    else if (N > 444 && N <= 555) { cout << 555 << endl; }
    else if (N > 555 && N <= 666) { cout << 666 << endl; }
    else if (N > 666 && N <= 777) { cout << 777 << endl; }
    else if (N > 777 && N <= 888) { cout << 888 << endl; }
    else if (N > 888 && N <= 999) { cout << 999 << endl; }
}

Measured memory_bytes: 256
main = interact $ show' . solve . read' . lines
  where
    solve = map solveRow
    solveRow [n, x] = length [1 | a <- [1..n-2], b <- [a+1..n-1], c <- [b+1..n], a + b + c == x]
    show' = unlines . map show
    read' = map (map read . words) . init :: [String] -> [[Int]]



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


int main(){
  int N;
  int xorAll;
  cin >> N;
  vector<int> a(N);

  cin >> a[0];
  xorAll = a[0];

  for(int i=1; i < N; i++){
    cin >> a[i];
    xorAll = xorAll ^ a[i];
  }

  for(int i=0; i < N; i++)
    cout << (xorAll ^ a[i]) << " ";

}


Measured memory_bytes: 3944
#define MOD 1000000007
#define PI 3.14159265358979323846
#define inf 100000000000000
#define pb push_back
#define pf push_front
//#define mp make_pair
#define fi first
#define se second
#define ALL(V) V.begin(), V.end()
#define sz(V) (int)V.size()
//#define int long long
#define _ <<" "<<
#define forn(i, n)             for(int i = 0; i < n; i ++)
#define forn1(i, n)            for(int i = 1; i <= n; i ++)
#include <bits/stdc++.h>
 
 
using namespace std;

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

typedef vector<ii> vii;
#define int long long 

signed main(){
    ios::sync_with_stdio(0); cin.tie(0);
    cout.tie(0);
   // freopen("test.txt","r",stdin); 
    int n;cin>>n;
    vector<pair<int ,int > > v;
    bool f = 0;
    for(int i=1;i*i<=n;i++)
    {
        if(n % i == 0)
        {
            v.pb({i , (n/i)});
        }
    } 


    int ans = 10000000000000;

    forn(i , v.size())
    {
        int sum = (v[i].fi + v[i].se) - 2;
        ans = min(ans , sum);
    }
    cout<<ans;



}
    




Measured memory_bytes: 384
#include<iostream>
#include<string>
using namespace std;
int main()
{
    int n;
    cin>>n;
    string s;
    cin>>s;
    int k=n/2;
    if(n%2==0&&s.substr(0,k)==s.substr(k,k)){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
    return 0;
}


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

#define ALL(a) (a).begin(), (a).end()

typedef struct{int x,y;}Point;

int main(){
	int n;	cin>>n;
	vector<int> order(n);
	vector<Point>pos(n);
	for(int i=0;i<n;i++){
		order[i]=i;
		cin>>pos[i].x>>pos[i].y;
	}

	double ans=0,cnt=0;
	do{
		++cnt;
		double cost=0;
		for(int i=0;i+1<n;i++){
			int s=order[i],t=order[i+1];
			ans+=sqrt(pow(pos[s].x-pos[t].x, 2) + pow(pos[s].y-pos[t].y, 2));
		}

	}while( next_permutation(ALL(order)) );

	ans/=cnt;
	printf("%.8lf\n",ans);

	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(){
	int W,H;
	int i,j;
	
	for(;scanf("%d%d",&H,&W),H,W;){
		for(i=0;i<H;i++){
			for(j=0;j<W;j++){
				printf("#");
			}
			printf("\n");
		}
		printf("\n");
	}
	
	return 0;
}

Measured memory_bytes: 572
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <tuple>
#include <utility>
#include <vector>
#define ll long long
#define itn int
#define endl '\n'
#define co(ans) cout<<ans<<endl
#define COYE cout<<"YES"<<endl
#define COYe cout<<"Yes"<<endl
#define COye cout<<"yes"<<endl
#define CONO cout<<"NO"<<endl
#define CONo cout<<"No"<<endl
#define COno cout<<"no"<<endl
#define FORE(i,a) for(auto &i:a)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define PB push_back
#define MP make_pair
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define EACH(V,i) for(typeof((V).begin()) i=(V).begin();i!=(V).end();++i)
#define equals(a,b) (fabs((a)-(b))<EPS)
#define INF ((1LL<<62)-(1LL<<31))
#define EPS 1e-10
#define PI 3.141592653589793238
#define MOD 1000000007
#define MMOD 998244353
#define MAX 2010101
using namespace std;
using Edge=pair<ll,ll>;
using Graph=vector<vector<int>>;
inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T>inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int main(){
  ll N;
  cin>>N;
  
  ll X[N+2];
  X[0]=0,X[N]=INF;
  RREP(i,N) cin>>X[i];
  
  ll L;
  cin>>L;
  
  // ダブリング
  ll DP[N+1][25];
  RREP(i,N) DP[i][0]=upper_bound(X,X+N+2,X[i]+L)-X-1;
  REP(i,20) RREP(j,N) DP[j][i+1]=DP[DP[j][i]][i];
  
  // クエリ(Q*logN)
  ll Q;
  cin>>Q;
  REP(q,Q){
    ll A,B;
    cin>>A>>B;
    if(A>B) swap(A,B);
    
    ll ans=0;
    for(ll i=20; i>=0; --i){
      if(DP[A][i]<B){
        A=DP[A][i];
        ans+=(1<<i);
      }
    }
    
    cout<<ans+1<<endl;
  }
  
  return 0;
}

Measured memory_bytes: 23788
#define y1 askjdkasldjlkasd
#include <bits/stdc++.h>
#undef y1

using namespace std;

#define pb push_back
#define mp make_pair
#define fi(a, b) for(int i=a; i<=b; i++)
#define fj(a, b) for(int j=a; j<=b; j++)
#define fo(a, b) for(int o=a; o<=b; o++)
#define fdi(a, b) for(int i=a; i>=b; i--)
#define fdj(a, b) for(int j=a; j>=b; j--)
#define fdo(a, b) for(int o=a; o>=b; o--)
#define sz(x) (int)x.size()

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<ll> vll;

#ifdef LOCAL
#define err(...) fprintf(stderr, __VA_ARGS__)
#else
#define err(...) while (0)
#endif

double START_TIME;

void exit() {
#ifdef LOCAL	
	cerr << "TIME: " << setprecision(5) << fixed << (clock() - START_TIME) / CLOCKS_PER_SEC << endl;
#endif	
	exit(0);
}

template<typename A, typename B>
ostream& operator<<(ostream& os, pair<A, B> p) {
	os << "(" << p.first << ", " << p.second << ")";
	return os;
}

template<typename T>
ostream& operator<<(ostream& os, vector<T> v) {
	fi(0, sz(v) - 1) {
		os << v[i] << " ";
	}
	return os;
}

template<typename T>
ostream& operator<<(ostream& os, set<T> t) {
	for (auto z : t) {
		os << z << " ";
	}
	return os;
}

template<typename T1, typename T2>
ostream& operator<<(ostream& os, map<T1, T2> t) {
	cerr << endl;
	for (auto z : t) {
		os << "\t" << z.first << " -> " << z.second << endl;
	}
	return os;
}

#ifdef LOCAL
#define dbg(x) {cerr << __LINE__ << "\t" << #x << ": " << x << endl;}
#define dbg0(x, n) {cerr << __LINE__ << "\t" << #x << ": "; for (int ABC = 0; ABC < n; ABC++) cerr << x[ABC] << ' '; cerr << endl;}
#else
#define dbg(x) while(0){}
#define dbg0(x, n) while(0){}
#endif

#ifdef LOCAL
#define ass(x) if (!(x)) { cerr << __LINE__ << "\tassertion failed: " << #x << endl, abort(); }
#else
#define ass(x) assert(x)
#endif

///////////////////////////////////////////////////

const int MAX = 1e3 + 41;

int n;
int m;
char a[MAX][MAX];
int dx[4] = {-1, 0, 1, 0};
int dy[4] = {0, 1, 0, -1};

int d[MAX][MAX];

bool inside(int x, int  y) {
	if (x < 0 || x >= n) return false;
	if (y < 0 || y >= m) return false;
	return true;

}



void solve () {
	memset(d, -1, sizeof(d));
	deque<pii> deq;
	int ans = 0;
	fi(0, n - 1) fj(0, m - 1) if (a[i][j] == '#') {
		deq.pb(mp(i, j));
		d[i][j] = 0;
	}
	while (sz(deq)) {
		pii cur = deq.front();
		deq.pop_front();
		int x = cur.first;
		int y = cur.second;
		fo(0, 3) {
			int x2 = x + dx[o];
			int y2 = y + dy[o];
			if (!inside(x2, y2)) continue;
			if (d[x2][y2] != -1) continue;
			d[x2][y2] = 1 + d[x][y];
			deq.pb(mp(x2, y2));
			ans = d[x2][y2];
		}
	}

	printf("%d\n", ans);	
}

int main() {
#ifdef LOCAL
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	START_TIME = (double)clock();
#endif

	scanf("%d %d", &n, &m);
	fi(0, n - 1) scanf("%s", a[i]);	
	solve();

	exit();
	return 0;
}





Measured memory_bytes: 13712
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstring>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)

struct A{
	int t,s,d;
	A(int t,int s,int d):t(t),s(s),d(d){}
	bool operator<(const A &a)const{return t<a.t;}
};

bool infected[20000];
int main(){
	int n,m;
	while(cin>>n>>m,n||m){
		vector<A> v;
		v.reserve(m);
		memset(infected,false,sizeof(infected));
		infected[0]=true;
		rep(i,m){
			int t,s,d;
			cin>>t>>s>>d;
			v.push_back(A(t,s-1,d-1));
		}
		sort(v.begin(),v.end());
		rep(i,v.size()){
			infected[v[i].d] |= infected[v[i].s];
		}
		cout<<count(infected,infected+n,true)<<endl;
	}
	return 0;
}

Measured memory_bytes: 1460
k, n = map(int, input().split())
a = list(map(int, input().split()))
max_dif = 0
for i in range(len(a)-1):
    max_dif = max(max_dif, a[i+1] - a[i])
max_dif = max(max_dif, k - a[-1] + a[0])
print(k - max_dif)

Measured memory_bytes: 78540
#include <iostream>
#include <sstream>
#include <queue>
#include <map>
#include <set>
#include <vector>
#include <numeric>
#include <algorithm>
#include <string>
#include <complex>
 
#include <cassert>
#include <cstdlib>
#include <cmath>
#include <cstdio>
#include <cstring>
 
#define REP(i,e) for(int i=0;i<(int)(e);i++)
#define FOR(i,b,e) for(int i=(int)(b);i<(int)(e);i++)
#define ALL(c) (c).begin(), (c).end()
#define EACH(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();++it)
#define RALL(c) (c).rbegin(), (c).rend()
#define ALLA(a,n) ((a)+0), ((a)+n)
 
using namespace std;
 
typedef long long ll;
typedef vector<int> vint;
typedef vector<long long> vll;
typedef vector<string> vstring;
typedef vector<double> vdouble;
 
template<class T>void pp(T v,int n){ REP(i,n)cout<<v[i]<< ' ' ; cout << endl; }
template<class T>void pp(T v){ EACH(it,v) cout << *it << ' ' ; cout << endl;  }
template<class T>T& ls(T& a,T b){ if(b<a) a=b; return a; }
template<class T>T& gs(T& a,T b){ if(b>a) a=b; return a; }
inline ll to_i(const string& s){ll n;sscanf(s.c_str(),"%lld",&n);return n;}
inline string to_s(ll n){char buf[32];sprintf(buf,"%lld",n);return string(buf);}

inline void write_bool(bool b, const string &tval, const string &fval) {
  cout << (b ? tval : fval) << endl;
} 
inline void YESNO(bool b) { return write_bool(b, "YES", "NO"); }
inline void YesNo(bool b) { return write_bool(b, "Yes", "No"); }
inline void yesno(bool b) { return write_bool(b, "yes", "no"); }


int main() {
  int a, b;
  while (cin >> a >> b) {
    int k = b - a;
    if (k % 2 != 0) cout << "IMPOSSIBLE" << endl;
    else cout << a + k / 2 << endl;
  }
}


Measured memory_bytes: 888
using System;
using System.Linq;
using System.Collections.Generic;
using System.IO;
using static System.Console;

namespace atcorder2
{
    class Program
    {
        public static long Read()
        {
            return long.Parse(Console.ReadLine());
        }

        public static long[] Reads()
        {
            return Console.ReadLine().Split().Select(long.Parse).ToArray();
        }


        public static long gcd(long x, long y)
        {
            if (y < x) gcd(y, x);
            while (y != 0)
            {
                var z = x % y;
                x = y;
                y = z;
            }
            return x;
        }
        public static long keta(long x)
        {
            var z = 1;
            while (x > 0)
            {
                x /= 10;
                z++;
            }
            return z;
        }
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            var hw = Reads();
            var h = hw[0];
            var w = hw[1];
            var a = new char[h][];
            var fy = new bool[h];
            var fx = new bool[w];
            for (int i = 0; i < h; i++)
            {
                a[i] = ReadLine().ToCharArray();
            }
            for (int i = 0; i < h; i++)
            {
                for (int j = 0; j < w; j++)
                {
                    if (a[i][j] == '#')
                    {
                        fy[i] = true;
                        fx[j] = true;
                    }
                }
            }
            for (int i = 0; i < h; i++)
            {
                if (fy[i])
                {
                    for (int j = 0; j < w; j++)
                    {
                        if (fx[j]) Write(a[i][j]);
                    }
                    WriteLine();
                }
            }

            
            

            Console.Out.Flush();
        }
    }
}



Measured memory_bytes: 18988
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
ull a, b, c, d;
map<ull, ull> dp;

ull solve(ull n) {
	if (dp.count(n)) return dp[n];
	ull ret = d*n;
	ret = min(ret, solve(n/2) + a+d*(n%2));
	if (n % 2) ret = min(ret, solve(n/2+1) + a+d);

	ret = min(ret, solve(n/3) + b+d*(n%3));
	if (n % 3) ret = min(ret, solve(n/3+1) + b+d*(3-n%3));
	
	ret = min(ret, solve(n/5) + c+d*(n%5));
	if (n % 5) ret = min(ret, solve(n/5+1) + c+d*(5-n%5));

	return dp[n] = ret;
}

int main()
{
	int T; scanf("%d", &T);
	while (T--) {
		dp.clear();
		ull n; scanf("%llu%llu%llu%llu%llu", &n, &a, &b, &c, &d);
		dp[0] = 0; dp[1] = d;
		printf("%llu\n", solve(n));
	}
	return 0;
}

Measured memory_bytes: 4436
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i,c) for (int i = 0; i < (int)c; i++)
#define all(v) v.begin(), v.end()
const int inf = 1000000000; //10^9
using ll = long long;
using P = pair<int,int>;
//加算代入演算子は+=！！！！！
//int 2^31 10^9まで
int main() {
    int k, n;
    cin >> k >> n;
    vector<int> a(n);
    rep (i, n) cin >> a.at(i);
    a.push_back(k + a[0]);
    int l = 0; //一番長い距離
    rep (i, n) {
        l = max(l, a[i + 1] - a[i]);
    }
    cout << k - l << endl;
}


Measured memory_bytes: 1792
/*
If you want to aim high, aim high
Don't let that studying and grades consume you
Just live life young
******************************
What do you think? What do you think?
1st on Billboard, what do you think of it
Next is a Grammy, what do you think of it
However you think, I’m sorry, but shit, I have no fcking interest
*******************************
I'm standing on top of my Monopoly board
That means I'm on top of my game and it don't stop
til my hip don't hop anymore
https://www.a2oj.com/Ladder16.html
*******************************
300iq as writer = Sad!
*/
import java.util.*;
import java.io.*;
import java.math.*;

   public class Main
   {
      public static void main(String hi[]) throws Exception
      {
         BufferedReader infile = new BufferedReader(new InputStreamReader(System.in));
         StringTokenizer st = new StringTokenizer(infile.readLine());
         int N = Integer.parseInt(st.nextToken());
         String res = "Yes";
         if(N < 30)
         res = "No";
         System.out.println(res);
      }
   }

Measured memory_bytes: 32636
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	sc.Split(bufio.ScanWords)
	n := nextInt()
	ok := false
	for i := 0; 4*i <= n; i++ {
		if (n-4*i)%7 == 0 {
			ok = true
			break
		}
	}
	if ok {
		puts("Yes")
	} else {
		puts("No")
	}
	wt.Flush()
}

var (
	sc  = bufio.NewScanner(os.Stdin)
	rdr = bufio.NewReaderSize(os.Stdin, 1000000)
	wt  = bufio.NewWriter(os.Stdout)
)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	i, _ := strconv.Atoi(next())
	return i
}

func nextFloat64() float64 {
	f, _ := strconv.ParseFloat(next(), 64)
	return f
}

func nextInts(n int) []int {
	slice := make([]int, n)
	for i := 0; i < n; i++ {
		slice[i] = nextInt()
	}
	return slice
}

func nextFloat64s(n int) []float64 {
	slice := make([]float64, n)
	for i := 0; i < n; i++ {
		slice[i] = nextFloat64()
	}
	return slice
}

func nextMega() string {
	buf := make([]byte, 0, 1000000)
	for {
		l, p, _ := rdr.ReadLine()
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}

func putf(format string, a ...interface{}) {
	fmt.Fprintf(wt, format, a...)
}

func puts(a ...interface{}) {
	fmt.Fprintln(wt, a...)
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = (s); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) for(int i = (n); i >= 0; i--)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';
#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

int main(void)
{
    IOS

    int N; cin >> N;
    vector<int> vl(N),vr(N);
    REP(i,N) {
        cin >> vl[i] >> vr[i];
    }

    sort(ALL(vl));
    sort(ALL(vr));
    int ans = 0;
    if (N % 2 == 0) {
        int l = vl[N/2-1] + vl[N/2];
        int r = vr[N/2-1] + vr[N/2];
        ans = r - l + 1;
    } else {
        int l = vl[N/2];
        int r = vr[N/2];
        ans = r - l + 1;
    }

    cout << ans << '\n';

    return 0;
}

Measured memory_bytes: 4776
n,A,B,C = map(int,input().split())
l = [int(input()) for _ in range(n)]

def dfs(depth,a,b,c):
    if depth == n:
        if min(a,b,c) > 0:
            return abs(a-A)+abs(b-B)+abs(c-C) - 30
        else:
            return 10**9
        
    numA = dfs(depth+1,a+l[depth],b,c) + 10
    numB = dfs(depth+1,a,b+l[depth],c) + 10
    numC = dfs(depth+1,a,b,c+l[depth]) + 10
    numX = dfs(depth+1,a,b,c)
    return min(numA,numB,numC,numX)
print(dfs(0,0,0,0))

Measured memory_bytes: 3064
#coding:utf-8
#dp[i]:i段目に登るまでの組み合わせ総数
#dp[i] = dp[i-1] + dp[i-2] if dp[i] != B[i] else 0
N,M = list(map(int,input().split()))
B = [True] * N

for _ in range(M):
    B[int(input())-1] = False
dp = [0] * N
if B[0]:
    dp[0] = 1
if N >= 2 and B[1]:
    dp[1] = dp[0] + 1 
mod = 10**9 + 7
for i in range(2,N):
    if B[i] :
        dp[i] = dp[i-1] + dp[i-2]
        dp[i] %= mod
print(dp[-1])



Measured memory_bytes: 45016
N = int(input())
a = [i for i in map(int , input().split())]
a.sort()
ai = a[N-1]
tmp = ai // 2
aj = 0
if ai % 2 == 0:
    for  i in a :
        if tmp == i:
            aj = i            
            break
        elif i - tmp > 0:
            if i - tmp < tmp - aj:
                aj = i
            break
        aj = i
else :
    for  i in a :
        if tmp == i:
            aj = i            
            break
        elif i - tmp > 0:
            if i - tmp <= tmp - aj:
                aj = i
            break
        aj = i

        
print(ai,aj)

Measured memory_bytes: 14060
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#define ll long long
#define ld long double
#define mk make_pair
#define fi first
#define se second
#define vll vector<ll>
#define pii pair<ll,ll>
#define vvll vector< vector<ll> >
#define pb push_back
#define sz(v) (v).size()
#define inf 1e18
#define md 1000000007
#define all(v) (v).begin(),(v).end()
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define tel(a){cout<<a<<"\n";}
#define tell(a,b){cout<<a<<" | "<<b<<"\n";}
#define telll(a,b,c){cout<<a<<" | "<<b<<" | "<<c<<"\n";}
#define teln(v,n){cout<<"v- ";rep(i,0,n)cout<<v[i]<<" ";cout<<"\n";}
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); 

using namespace std;
using namespace __gnu_pbds;

template<typename T>
using o_set=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define M 100010


int main(){
	IOS;
	ll n,k;cin>>n>>k;
	ll a[n];rep(i,0,n)cin>>a[i];
	ll ans=0;
	for(ll i=min(n,k);i>=0;--i){
		ll e=min(i,k-i);
		if(e<0)e=0;
		rep(j,0,i+1){
			ll left=j,right=i-j,cnt=e;
			vll v;
			rep(k,0,left)v.pb(a[k]);
			for(ll k=n-1;k>(n-1-right);--k)v.pb(a[k]);
			sort(all(v));
			ll sum=0;
			rep(k,0,sz(v)){
				if(v[k]<0 and cnt>0)cnt--;
				else sum+=v[k];
			}
			ans=max(ans,sum);
		}
	}
	cout<<ans;
	return 0;
}



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

int D, G;
int p[10];
int c[10];


void solve() {
  int ans = 10000;
  int score;
  int count;
  for(int bit = 0; bit < (1<<D); bit++) {
    bool f = false;
    int score = 0;
    count = 0;
    for(int i = 0; i < D; i++) {
      if(bit & (1<<i)) {
        score += 100*(i+1)*p[i] + c[i];
        count = count + p[i];
        if(score >= G) {
          f = true;
        }
      }
    }
    if(f == false) {
      for(int i = D-1; i >= 0; i--) {
        if((bit & (1<<i)) == 0) {
          if(((G - score) % (100*(i+1)) == 0) && ((G - score) / (100*(i+1)) < p[i])) {
            count += (G - score) / (100*(1+i));
            score += (G - score);
            f = true;
            break;
          } else if(((G - score) % (100*(i+1)) != 0) && ((G - score) / (100*(i+1)) + 1 < p[i])) {
            count += (G - score) / (100*(i+1)) + 1;
            score += ((G - score) / (100*(i+1)) + 1) * (100*(i+1));
            f = true;
            break;
          }
        }
      }
    }
    if(f) {
      ans = min(ans, count);
    }
  }
  cout << ans << endl;
}


int main() {
  cin >> D >> G;
  for(int i = 0; i < D; i++) {
    cin >> p[i] >> c[i];
  }
  solve();
  return 0;
}

Measured memory_bytes: 256
n = int(input())
s = input()

minv = 0
score = 0
for i in range(n):
    if s[i] == '(':
        score += 1
    else:
        score -= 1
    minv = min(minv, score)

ans = ""
for i in range(0, -minv):
    ans += "("
ans += s
for i in range(0, score-minv):
    ans += ")"
print(ans)

Measured memory_bytes: 38384
#include<stdio.h>
int main(void) {
    int i;
    int a, b, c;
    int cnt = 0;
    scanf("%d %d %d", &a, &b, &c);
    for(i = a; i <= b; i++) {
        if(c%i == 0) {
            cnt++;
        }
    }
    printf("%d\n", cnt);
    return 0;
}

Measured memory_bytes: 596
import Control.Applicative
import Control.Monad.State
import Data.Array.IO

main = do
  n <- readLn
  list <- map read.words<$>getLine
  newListArray (1,n) list >>= insertionSortA


insertionSortA arr = do
  st <- fst<$>getBounds arr
  runStateT insertSteps (st,arr)

insertSteps :: StateT (Int,IOArray Int Int)  IO (IOArray Int Int)
insertSteps = do
  (i,arr) <- get
  (st, en) <- liftIO $ getBounds arr
  if i > en then return arr
            else do
              e <- liftIO $ readArray arr i
              liftIO $ insertA i arr e
              liftIO $ getElems arr >>= putStrLn.unwords.map show
              put (i+1,arr)
              insertSteps

insertA :: Ord e => Int -> IOArray Int e -> e -> IO ()
insertA i arr e = do
  (st,en) <- getBounds arr
  if i == st then writeArray arr i e
             else do
               e' <- readArray arr (i-1)
               if e' > e then do
                           writeArray arr i e'
                           insertA (i-1) arr e
                         else writeArray arr i e

Measured memory_bytes: 4140
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
//#include<boost/multiprecision/cpp_int.hpp>
//#include<boost/multiprecision/cpp_dec_float.hpp>
//namespace mp=boost::multiprecision;
//#define mulint mp::cpp_int
//#define mulfloat mp::cpp_dec_float_100
using namespace std;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
//constexpr int MOD=1000000007;
constexpr int MOD=998244353;
#define INF (1<<30)
#define LINF (lint)(1LL<<56)
#define endl "\n"
#define rep(i,n) for(lint (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(lint (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcountll(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
#define plint pair<lint,lint>
#define fi first
#define se second
typedef long long lint;
int dx[8]={1,1,0,-1,-1,-1,0,1};
int dy[8]={0,1,1,1,0,-1,-1,-1};
const int MAX_N=2e5+5;
//struct edge{lint to,num;};
//vector<int> bucket[MAX_N/1000];

vector<int> edge[600];

int main(void){
    int N,M;
    cin >> N >> M;
    rep(i,M){
        int u,v;
        cin >> u >> v;
        u--,v--;
        edge[u].push_back(v);
    }
    double ans=1e9;
    rep(i,N){
        double dp[N]={};
        reprev(j,N){
            vector<int> es=edge[j];
            int cnt=es.size();
            vector<double> to;
            rep(k,es.size()) to.push_back(dp[es[k]]);
            double maxi=0,ers=0;
            rep(k,to.size()) if(maxi<to[k]) maxi=to[k],ers=k;
            if(i==j) if(cnt>1) to.erase(to.begin()+ers);
            rep(k,to.size()) dp[j]+=(to[k]+1)/to.size();
        }
        ans=min(ans,dp[0]);
    }
    cout << ans << endl;
}

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

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

    int fab=100;
    for(int a=1;a<=sqrt(n);a++){
        long long b = n/a;
        if(a*b!=n) continue;
        int digb=0; long long tmp = b;
        while(b>0){
            b /= 10;
            digb++;
        }
        fab = min(fab,digb);
    }

    cout << fab << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
#define PI acos(-1.0)

int main()
{
    int A, B, H, M;
    double deg1, deg2, deg, dist;

    scanf("%d %d %d %d", &A, &B, &H, &M);

    deg1 = 30*(double)H + 0.5*(double)M;
    deg2 = 30*(double)M/5;
    deg = deg1 - deg2;
    deg = PI/180 * deg;

    dist = sqrt((double)A*(double)A + (double)B*(double)B - cos(deg)*2*(double)A*(double)B);

    printf("%.20lf", dist);

    return 0;
}

Measured memory_bytes: 2536
#include <algorithm>
#include <climits>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <vector>

using namespace std;
constexpr long long int INF = std::numeric_limits<long long int>::max();
constexpr long long int NINF = std::numeric_limits<long long int>::min();
constexpr long long int MOD = 1000000007;
#define int long long int

vector<int> V(1000000, 0);

void solve() {
  int N;
  cin >> N;
  while (N--) {
    int a;
    cin >> a;
    V[a]++;
    V[a + 1]++;
    if (a > 0) {
      V[a - 1]++;
    }
  }

  int ans = 0;
  for (int a : V) {
    ans = max(ans, a);
  }

  cout << ans << endl;
}

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  solve();
  return 0;
}


Measured memory_bytes: 8064
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <fstream>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <stack>
#include <vector>
#include <set>
#include <tuple>
#include <utility>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
const int INF = 1000000000;
const int MOD = 1000000007;
int main(){
	int a,b;
	cin >> a >> b;
	vector<vector<char>> grid(100,vector<char>(100));

	for(int i = 0;i < 100;i++){
		for(int j = 0;j < 100;j++){
			if(i < 50)grid[i][j] = '.';
			else grid[i][j] = '#';
		}
	}

	int cnt1 = 0;
	for(int i = 0;i < 50;i+=2){
		if(cnt1 == b-1)break;
		for(int j = 0;j < 50;j+=2){
			if(cnt1 == b-1)break;
			grid[i][j] = '#';
			cnt1++;
		}
	}

	int cnt2 = 0;
	for(int i = 51;i < 100;i+=2){
		if(cnt2 == a-1)break;
		for(int j = 0;j < 100;j+=2){
			if(cnt2 == a-1)break;
			grid[i][j] = '.';
			cnt2++;
		}
	}

	cout << 100 << " " << 100 << endl;
	for(int i = 0;i < 100;i++){
		for(int j = 0;j < 100;j++){
			cout << grid[i][j];
		}
		cout << endl;
	}
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <utility>
#include <iomanip>
#include <functional>
#include <queue>
#include <stack>
#include <cmath>
#define INF 100000000
#define MOD 1000000007
using namespace std;


int main(){
    stack<int> stc;
    
    int a;
    while(cin>>a){
        if(a==0){
            cout<<stc.top()<<endl;
            stc.pop();
        }else{
            stc.push(a);
        }
    }
    
    return 0;
}



Measured memory_bytes: 3120
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <bitset>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
#include <functional>
#include <cassert>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
#define ALL(v) v.begin(),v.end()
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; }
#define DEBUG_VLL(vec) REP(sz, vec.size()) std::cerr<<vec[sz]<<(sz==vec.size()-1?'\n':' ');

const long long MOD = 1000000007;
const long long HIGHINF = (long long)1e18;
const int INF = (int)1e9;

string s;
ll q;
ll mode = 0;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> s >> q;
    deque<char> deq;
    for (ll i = 0; i < s.size(); i++) {
        deq.push_back(s[i]);
    }

    for (ll i = 0; i < q; i++) {
        ll t; cin >> t;
        if (t == 1) mode ^= 1;
        else {
            ll f;
            char c;
            cin >> f >> c;
            if (f == 1) {
                if (mode == 0) deq.push_front(c);
                else deq.push_back(c);
            } else {
                if (mode == 0) deq.push_back(c);
                else deq.push_front(c);
            }
        }
    }

    while (!deq.empty()) {
        if (mode == 0) {
            cout << deq.front();
            deq.pop_front();
        } else {
            cout << deq.back();
            deq.pop_back();
        }
    }
    cout << '\n';
    return 0;
}


Measured memory_bytes: 976
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vb = vector<bool>;
using vl = vector<long>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvb = vector<vector<bool>>;
using vvc = vector<vector<char>>;
using vvl = vector<vector<long>>;
using pii = pair<int, int>;
using pil = pair<int, long>;
using pll = pair<long, long>;
#define fix20 cout << fixed << setprecision(20)
#define YES cout << "Yes" << endl
#define NO cout << "No" << endl
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define REP(i,s,t) for(int i=s; i<t; i++)
#define RNG(i,s,t,u) for(int i=s; i<t; i+=u)
#define MOD 1000000007
#define all(vec) vec.begin(), vec.end()
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; }

int main(){
  long r,c,k;
  cin >> r >> c >> k;
  vvl value(r+1,vl(c+1,0));
  vector<vvl> dp(4, vvl(r+1,vl(c+1,0)));
  rep(i,k){
    long rr,cc,v;
    cin >> rr >> cc >> v;
    value.at(rr).at(cc) = v;
  }
  REP(i,1,r+1){
    REP(j,1,c+1){
      dp.at(3).at(i).at(j) = max(dp.at(3).at(i).at(j-1), dp.at(2).at(i).at(j-1) + value.at(i).at(j));
      dp.at(2).at(i).at(j) = max(dp.at(2).at(i).at(j-1), dp.at(1).at(i).at(j-1) + value.at(i).at(j)); 
      dp.at(1).at(i).at(j) = max(dp.at(1).at(i).at(j-1), max(dp.at(0).at(i).at(j-1) + value.at(i).at(j), dp.at(3).at(i-1).at(j) + value.at(i).at(j)));
      dp.at(0).at(i).at(j) = max(dp.at(0).at(i).at(j-1), dp.at(3).at(i-1).at(j));
      chmax(dp[1][i][j], dp[0][i][j]);
      chmax(dp[2][i][j], dp[1][i][j]);
      chmax(dp[3][i][j], dp[2][i][j]);
    }
  }
  cout << dp.at(3).at(r).at(c) << endl;
}

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

int n,k;

bool loadable(int* w, long long int P){
	int cnt_trucks=1;
	long long int load = 0;
	bool is_loadable = true;
	
	for(int i=0; i<n; i++){
		if(w[i] > P){
			is_loadable = false;
			break;
		}
		if(load + w[i] <= P){
			load += w[i];
		}else if(load + w[i] > P){
			load = w[i];
			cnt_trucks+=1;
		}
		if(cnt_trucks > k){
			is_loadable = false;
			break;
		}
	}
	return is_loadable;

}

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

	int w[n];

	for(int i=0; i<n; i++)
		cin >> w[i];
	
	long long int right = 100000 * 10000;
	long long int left = 0;

	while(right - left > 1){
		long long int center = (left + right) / 2;
		bool is_loadable = loadable(w, center);
		if(is_loadable)
			right = center;
		else
			left = center; 
	}
		
	if(loadable(w, right)){
		cout << right << endl;
	}else{
		cout << left << endl;
	}

	return 0;

}

Measured memory_bytes: 3448
#include<bits/stdc++.h>
using namespace std;
int main(){
	long long n;
	long long mon[100010]; 
	long long her[100010]; 
	
	memset(mon,0,sizeof(mon));
	memset(her,0,sizeof(her));
	scanf("%lld",&n);
	for(int i=0;i<n+1;i++){
		scanf("%lld",&mon[i]);
	}
	for(int i=0;i<n;i++){
		scanf("%lld",&her[i]);
	}
	long long js=0;
	for(int i=0;i<n+1;i++){
		if(her[i]>mon[i]){
			if(her[i]-mon[i]>=mon[i+1]){
				js=js+mon[i]+mon[i+1]; mon[i+1]=0;
			}
			else {
				js+=mon[i]+her[i]-mon[i];
				mon[i+1]=mon[i+1]-(her[i]-mon[i]);
			}
		}
		else if(her[i]==mon[i]){
			js+=mon[i];
		}
		else js+=her[i];
	}
	printf("%lld\n",js);
	return 0;
}



Measured memory_bytes: 1792
#include<stdio.h>
#include<stdbool.h>
int main(void){
    int W,H,x,y,r;
    scanf("%d",&W);
    scanf("%d",&H);
    scanf("%d",&x);
    scanf("%d",&y);
    scanf("%d",&r);
    printf((x-r)>=0&&(x+r)<=W&&(y-r)>=0&&(y+r)<=H ? "Yes\n" : "No\n");
    return 0;
}


Measured memory_bytes: 2716
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;

class Main {
    static int n;
    static int[] cards;
    static int[] clone;

    static void riffle() {
        clone = cards.clone();
        for (int i = 0; i < n; i++) {
            cards[2 * i] = clone[i];
            cards[2 * i + 1] = clone[n + i];
        }
    }

    static void cut(int k) {
        clone = cards.clone();
        for (int i = 0; i < 2 * n - k; i++) {
            cards[i] = clone[i + k];
        }
        for (int i = 0; i < k; i++) {
            cards[2 * n - k + i] = clone[i];
        }
    }

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        n = Integer.parseInt(br.readLine());
        cards = new int[2 * n];
        for (int i = 0; i < 2 * n; i++) {
            cards[i] = i + 1;
        }

        int m = Integer.parseInt(br.readLine());
        for (int i = 0; i < m; i++) {
            int k = Integer.parseInt(br.readLine());
            if (k == 0) {
                riffle();
            } else {
                cut(k);
            }
        }

        for (int a : cards) {
            System.out.println(a);
        }

    }
}


Measured memory_bytes: 25928
#include<stdio.h>
int main(void)
{
  int num;
  scanf("%d",&num);
  int ln[num],i;
  for(i=0;i<num;i++)
  {
    scanf("%d",&ln[i]);
  }
  int max,sum=0;
  max=ln[0];
  for(i=0;i<num;i++)
  {
    if(max<ln[i]) max=ln[i];
    sum=sum+ln[i];
  }
  if(max<sum-max) printf("Yes");
  else printf("No");
  return 0;
}

Measured memory_bytes: 128
data = input().split()
N = int(data[0])
Ai = input().split()
ai =[]
for i in range(N):
    ai.append(int(Ai[i]))

ai.sort()#昇順並び替え。list.sort()
alice = 0
bob = 0
for i in range(1,N+1):
    if i%2 != 0:
        alice += ai.pop()#list.pop()は配列の末尾の要素を削除して、削除した要素を返すメソッド
    else:
        bob += ai.pop()
print(alice - bob)

Measured memory_bytes: 38360
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder.Abc
{
    class QuestionB
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            //// 文字列の入力
            //string s = Console.ReadLine();

            //// 整数の入力
            //long n = long.Parse(Console.ReadLine());

            //// 文字列配列の入力
            //string[] inputStrArray = Console.ReadLine().Split(' ');

            //// 整数配列の入力
            //var inputLongArray = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();

            string s = Console.ReadLine();

            var hashset = new HashSet<string>();

            string result = "yes";

            foreach (var a in s) {
                if (hashset.Add(a.ToString()) == false) {
                    result = "no";
                    break;
                }
            }

            Console.WriteLine(result);

            Console.Out.Flush();
        }
    }
}


Measured memory_bytes: 13280
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 1000001;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

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

ll lcm(ll a, ll b) {
	return a / gcd(a, b) *b;
}

struct edge {
	ll ind;
	ll to;
	ll d;
};


///////////////////////////


int main() {

	ll N;
	cin >> N;

	vector<ll> a(N + 1);
	repn(i, N) cin >> a[i];

	ll s = 0;
	repn(i, N) s += a[i];

	ll ans = INF;

	ll v = 0;
	repn(i, N - 1) {
		v += a[i];
		ans = min(ans, abs(s - 2 * v));
	}

	cout << ans;

	system("PAUSE");

}


Measured memory_bytes: 2040
program sample
	implicit none
    character(len=16) :: a
    character(len=16) :: b
    integer :: count,i
    
    b='CODEFESTIVAL2016'
    
    read(*,*) a
    count=0
    do i=1,16
    	if (a(i:i)==b(i:i)) then
        	count =count
        else
        	count =count+1
        end if
    end do
    
    write(*,*) count
    
    stop
end program sample





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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;

#define MOD 1000000007
#define REP(i, N) for (int i = 0; i < N; ++i)
#define REP1(i, N) for (int i = 1; i <= N; ++i)
#define RREP(i, N) for (int i = N - 1; i >= 0; --i)
#define ALL(a) a.begin(), a.end()

int n;
vector<int> g[100000];

int dfs(int x) {
  vector<int> vc;
  int k = g[x].size();
  REP(i, k) vc.push_back(dfs(g[x][i]));
  sort(ALL(vc));
  int res = 0;
  REP(i, k) res = max(res, vc[i] + k - i);
  return res;
}

int main() {
  cin >> n;
  for (int i = 1; i < n; ++i) {
    int a;
    cin >> a;
    a--;
    g[a].push_back(i);
  }
  cout << dfs(0) << endl;
  return 0;
}

Measured memory_bytes: 15104
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <limits>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <functional>

using namespace std;

using ll = long long;
using vll = std::vector<ll>;
using vvll = std::vector<vll>;
using vvvll = std::vector<vvll>;
#define reps(i, S, E) for (ll i = (S); i <= (E); i++)
#define rep(i, N) reps(i, 0, N-1)
#define deps(i, E, S) for (ll i = (E); i >= (S); i--)
#define dep(i, N) deps(i, N-1, 0)

//AtCoder Beginner Contest 065 - D
struct LLPoint {
	ll x = 0;
	ll y = 0;
	ll no = 0;
	LLPoint() {}
	LLPoint(ll no, ll x, ll y) {
		this->no = no;
		this->x = x;
		this->y = y;
	}
};

template< typename T >
struct edge {
	int src, to;
	T cost;
	edge(int to, T cost) : src(-1), to(to), cost(cost) {}
	edge(int src, int to, T cost) : src(src), to(to), cost(cost) {}
	edge &operator=(const int &x) {
		to = x;
		return *this;
	}
	operator int() const { return to; }
};

template< typename T >
using Edges = vector< edge< T > >;
template< typename T >
using WeightedGraph = vector< Edges< T > >;
using UnWeightedGraph = vector< vector< int > >;
template< typename T >
using Matrix = vector< vector< T > >;

struct UnionFind {
	vector< int > data;
	UnionFind(int sz) {
		data.assign(sz, -1);
	}
	bool unite(int x, int y) {
		x = find(x), y = find(y);
		if (x == y) return (false);
		if (data[x] > data[y]) swap(x, y);
		data[x] += data[y];
		data[y] = x;
		return (true);
	}
	int find(int k) {
		if (data[k] < 0) {
			return (k);
		}
		return (data[k] = find(data[k]));
	}
	int size(int k) {
		return (-data[find(k)]);
	}
};

template< typename T >
T kruskal(Edges< T > &edges, int V) {
	sort(begin(edges), end(edges), [](const edge< T > &a, const edge< T > &b) {
		return (a.cost < b.cost);
	});
	UnionFind tree(V);
	T ret = 0;
	for (auto &e : edges) {
		if (tree.unite(e.src, e.to)) ret += e.cost;
	}
	return (ret);
}

int main() {
	ll N;
	scanf("%lld", &N);
	vector<LLPoint> xSort(N);
	vector<LLPoint> ySort(N);
	rep(i, N) {
		ll x;
		scanf("%lld", &x);
		ll y;
		scanf("%lld", &y);
		xSort[i].no = i;
		xSort[i].x = x;
		xSort[i].y = y;
		ySort[i].no = i;
		ySort[i].x = x;
		ySort[i].y = y;
	}

	std::sort(xSort.begin(), xSort.end(), [](const LLPoint &a, const LLPoint &b) {
		return a.x < b.x; //�~���ɂ���ɂ� > �Ƃ���
	});

	std::sort(ySort.begin(), ySort.end(), [](const LLPoint &a, const LLPoint &b) {
		return a.y < b.y; //�~���ɂ���ɂ� > �Ƃ���
	});

	Edges<ll> edges;

	rep(i, N - 1) {
		edges.emplace_back(xSort[i].no, xSort[i + 1].no, abs(xSort[i].x - xSort[i + 1].x));
		edges.emplace_back(ySort[i].no, ySort[i + 1].no, abs(ySort[i].y - ySort[i + 1].y));
	}

	ll result = kruskal(edges, (int)N);

	printf("%lld\n", result);
}



Measured memory_bytes: 11120
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define all(v) v.begin(), v.end()
    
int main(){
    long long n,d;
    cin >> n >> d;
    long long ans=0;
    rep(i,n){
        long long x,y;
        cin >> x >> y;
        if((x*x+y*y)<=d*d) ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3632