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

class Main{
    public static void main(String[] args){
        FastScanner fsc=new FastScanner();
        int a=fsc.nextInt();
        int b=fsc.nextInt();
        int c=fsc.nextInt()%b;
        a%=b;
        fsc.close();
        for(int i=1;i<=b;i++){
            if(a*i%b==c){
                System.out.println("YES");
                return;
            }
        }
        System.out.println("NO");
    }
    static class FastScanner {
        private final InputStream in = System.in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int buflen = 0;
        private boolean hasNextByte(){
            if(ptr<buflen) return true;
            else{
                ptr = 0;
                try{
                    buflen = in.read(buffer);
                }
                catch(IOException e){
                    e.printStackTrace();
                }
                if(buflen<=0) return false;
            }
        return true;
        }
        private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
        private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
        public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
        public String next() {
            if (!hasNext()) throw new NoSuchElementException();
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while(isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }
        public long nextLong() {
            if (!hasNext()) throw new NoSuchElementException();
            long n = 0;
            boolean minus = false;
            int b = readByte();
            if (b == '-') {
                minus = true;
                b = readByte();
            }
            if (b < '0' || '9' < b) throw new NumberFormatException();
            while(true){
                if ('0' <= b && b <= '9') {
                    n *= 10;
                    n += b - '0';
                }
                else if(b == -1 || !isPrintableChar(b)) return minus ? -n : n;
                else throw new NumberFormatException();
                b = readByte();
            }
        }
        public int nextInt() {
            long nl = nextLong();
            if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
            return (int) nl;
        }
        public double nextDouble() { return Double.parseDouble(next());}
        public void close(){
            try{in.close();}
            catch(IOException e){e.printStackTrace();}
        }
    }
}


Measured memory_bytes: 23124
#include <iostream>
#include <vector>
#include <array>
#include <cmath>
#include <string>
#include <queue>
#include <list>
#include <unordered_map>
#include <algorithm>
#include <functional>
#include <iomanip> // std::std::setprecision(X)
#include <limits>  //std::numeric_limits<int>::max(), min()

int main (void) {
  std::string S; std::cin >> S;

  int rest = 15 - S.size();
  int win = 0;
  for(int i=0; i<S.size(); i++) if ( S[i] == 'o' ) win++;
  if ( win + rest >= 8 ) std::cout << "YES" << std::endl;
  else std::cout << "NO" << std::endl;

  return 0;
}

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

int main() {
	int a[3];rep(i,3)cin>>a[i];
	sort(a,a+3);
	cout<<a[0]<<' '<<a[1]<<' '<<a[2]<<endl;
}

Measured memory_bytes: 3100
import java.util.*;

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

        int w, n, a, b, i;
        int data[] = new int[30];

        w = scan.nextInt();
        n = scan.nextInt();

        for(i = 0; i < w; i++) {
            data[i] = i + 1;
        }

        for(i = 0; i < n; i++) {
            int tmp, index;
            String s = scan.next();
            index = s.indexOf(",");
            a = Integer.parseInt(s.substring(0, index)) - 1;
            b = Integer.parseInt(s.substring(index + 1)) - 1;


            tmp = data[a];
            data[a] = data[b];
            data[b] = tmp;
        }

        for(i = 0; i < w; i++) {
            System.out.println(data[i]);
        }
    }
}


Measured memory_bytes: 26224
#include<stdio.h>
#define PRN(n) printf("%d\n",n)
#define PRS(s) printf("%s\n",s)
int main(void){
  int a,b;
  scanf("%d %d",&a,&b);
  if((a+b)%2){
    PRS("IMPOSSIBLE");
  }else{
    PRN((a+b)/2);
  }
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i,n) for (int i = (0); i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define show(x) cout << #x << " = " << (x) << endl
#define show2(x,y) cout << #x << " = " << (x) << ", " << #y << " = " << (y) << endl
#define show3(x,y,z) cout << #x << " = " << (x) << ", " << #y << " = " << (y) <<  ", " << #z << " = " << (z) << endl
#define showv(v) rep(i,v.size()) printf("%d%c", v[i], i==v.size()-1?'\n':' ')
#define showv2(v) rep(j,v.size()) showv(v[j])
#define showt(t,n) rep(i,n) printf("%d%c", t[i], i==n-1?'\n':' ')
#define showt2(t,r,c) rep(j,r) showt(t[j],c)
#define showvp(p) rep(i,p.size()) printf("%d %d\n", p[i].first, p[i].second);
#define printv(v) rep(i,v.size()) printf("%d\n", v[i])
#define printt(t,n) rep(i,n) printf("%d\n", t[i])
#define incl(v,x) find(rng(v),x)!=v.end()
#define incls(s,c) s.find(c)!=string::npos
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
typedef vector<pii> vp;
typedef vector<tiii> vt;
const int mod = 1000000007;
const double EPS = 1e-9;
const int INF = (1<<30)-1;
const ll INFLL = (1LL<<62)-1;
#define dame { puts("No"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
inline int in() { int x; scanf("%d",&x); return x;}
//cout << fixed << setprecision(10);
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; }

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

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

  int ans = 0;
  for (int b = 1; b*b <= x; ++b) {
    for (int p = 2; p <= 9; ++p) {
      if (mod_pow(b,p) <= x) ans = max(ans, (int)mod_pow(b,p));
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
 
#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());
 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
 
int dp[101][10001][2], d;
string s;

int solve(int i, int val, int tight) { 
	val %= d;
	if (i == s.length()) {
		if (val % d == 0) {
			return 1;
		}
		return 0;
	}

	if (dp[val][i][tight] != -1) {
		return dp[val][i][tight];
	}

	int limit = 9, ans = 0;
	if (!tight) {
		for (int num = 0; num <= limit; num++) {
			ans += solve(i + 1, val + num, tight);
			ans %= mod;
		}	
	}

	if (tight) {
		limit = s[i] - '0';
		for (int num = 0; num < limit; num++) {
			ans += solve(i + 1, val + num, !tight);
		}	
		ans += solve(i + 1, val + limit, tight);
		ans %= mod;
	}

	return dp[val][i][tight] = ans;
} 

void c_p_c()
{
   ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);  
   cin >> s >> d;
   memset(dp, -1, sizeof dp);
   cout << (solve(0, 0, 1) - 1 + mod) % mod; // excluding zero

}
 
int32_t main()
{
    c_p_c();
    return 0;
}

Measured memory_bytes: 20248
x,y=map(int,input().split())
a=max(x,y)
b=min(x,y)
s=a-b
A=a-s-s
if A>=0 and A%3==0:
    t=A//3
    p=t+s
    q=t
    ans=1
    for i in range(q):
        ans=ans*(p+q-i)*pow((i+1),10**9+5,10**9+7)
        ans=ans%(10**9+7)
    print(ans)
else:
    print(0)

Measured memory_bytes: 72428
import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int max=a+b;
        //System.out.println(max);

        if((a+b)>max){
            max = a+b;
        }
        if((a-b)>max){
            max = a-b;
        }
        if((a*b)>max){
            max = a*b;
        }
        System.out.println(max);


    }
}

Measured memory_bytes: 23892
import numpy as np
N, M, C = map(int, input().split(" "))
B = np.array(list(map(int, input().split(" "))))
A = []
for i in range(N) :
    A.append(np.array(list(map(int, input().split(" ")))))
    
cnt = 0
for i in range(N) :
    if np.dot(B, A[i]) + C > 0 :
        cnt += 1
        
print(cnt)

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

#define rep(i,n) for(ll i=0;i<n;++i)
#define all_map(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)
#define ALL(a) (a).begin(),(a).end()

using namespace std;
using ll  = long long;
using pll = pair<ll, ll>;

const ll MOD  = 1e9+7;
const ll LINF = 1LL << 60;
const int INF = 1e9 + 7;

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

    rep(i, s.size())cout << "x";
    cout << endl;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    long long int n;
    std::cin >> n;
    if(n==1){
        std::cout << 0 << std::endl;
        return 0;
    }else if(n==2){
        std::cout << 1 << std::endl;
        return 0;
    }
    long long int ans= n*(n-1)/2;
    std::cout << ans << std::endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(int argc, char const* argv[])
{
	int a,b,c;

	while(cin >> a >> b){

		int i;
		c = a + b;
		for( i = 0;(c /= 10) != 0;i++ );

		cout << ++i << endl;
	}
	return 0;
}

Measured memory_bytes: 0
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner in = new Scanner(System.in);
		boolean prime[] = new boolean[50001];
		for(int i=0;i<prime.length;i++)prime[i]=true;
		prime[0]=false;prime[1]=false;
		for(int s=0;s<prime.length;s++){
			if(prime[s])
				for(int i=s+s;i<prime.length;i+=s)prime[i]=false;
		}
		while(in.hasNext()){
			int n = in.nextInt();
			if(n==0)break;
			int cnt = 0;
			boolean sw[] = new boolean[prime.length];
			for(int i=0;i<sw.length;i++)sw[i]=true;
			for(int s=0;s<n;s++){
				if(prime[s]&&prime[n-s]&&sw[s]){
					cnt++;
					sw[s]=false;
					sw[n-s]=false;
				}
			}
			System.out.println(cnt);
		}
	}
}

Measured memory_bytes: 153316
n, x = map(int, input().split())
a = list(map(int,input().split()))

a_sort = sorted(a)
ans = 0

for i in range(n-1):
    if x - a_sort[i] >= 0:
        x -= a_sort[i]
        ans += 1
if a_sort[n-1] == x:
    ans += 1

print(ans)

Measured memory_bytes: 3064
from bisect import bisect_left

n = int(input())
x = list(map(int, input().split()))
x_srt = sorted(x)

for i in range(n):
    if bisect_left(x_srt, x[i]) < n//2:
        print(x_srt[n//2])
    else:
        print(x_srt[n//2-1])

Measured memory_bytes: 25228
N = int(input())
S = input()

count = 0
count_dict = {}
for s in S:
    for k, v in count_dict.items():
        for k2, v2 in v.items():
            if s not in v2:
                v2.append(s)
                count += 1
        if s not in v.keys():
            v[s] = []
    if s not in count_dict.keys():
        count_dict[s] = {}

# print(count_dict)
print(count)


Measured memory_bytes: 3060
def main():
    n = int(input())
    A = list(map(int, input().split()))
    M = max(A)
    dig = len(bin(M)) - 2
    MOD = 10 ** 9 + 7
    ans = 0
    d = {i: 0 for i in range(dig)}
    for a in A:
        a = bin(a)[2:]
        for i in range(len(a)):
            if a[-(i+1)] == '1':
                d[i] += 1
    for i in range(dig):
        ans += d[i] * (n - d[i]) * pow(2, i, MOD)
        ans %= MOD
    print(ans)
main()


Measured memory_bytes: 125624
/*
 *  Author :: Kattu37
 */

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

#define ll long long
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define sortallr(x) sort(allr(x))
#define PI 3.1415926535897932384626
#define mod 1000000007

typedef pair<int, int>  pii;
typedef pair<ll, ll>  pll;
typedef vector<int>   vi;
typedef vector<ll>    vl;
typedef vector<pii>   vpii;
typedef vector<pll>   vpl;
typedef vector<vi>    vvi;
typedef vector<vl>    vvl;

void solve()
{
	int n;
	cin >> n;

	vector<ll> a(n);
	for (int i = 0; i < n; i++)
		cin >> a[i];

	ll c = 0;
	ll mx = a[0];
	for (int i = 1; i < n; i++)
	{
		if (mx - a[i] > 0)
			c += mx - a[i];
		mx = max(mx, a[i]);
	}

	cout << c << "\n";
}

int main(void)
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);

	int t = 1;
	//cin >> t;
	while (t--)
	{
		solve();
	}

	return 0;
}


Measured memory_bytes: 4780
/*
    JAI JAGANNATH!
*/
//@Author : zanj0
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long int lli;
#define ff              first
#define ss              second
#define pb              push_back
#define mp              make_pair
#define pii             pair<lli,lli>
#define vi              vector<lli>
#define mii             map<lli,lli>
#define pqb             priority_queue<lli>
#define pqs             priority_queue<lli,vi,greater<lli> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            lli x; cin>>x; while(x--)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef tree<lli, null_type, less<lli>, rb_tree_tag, tree_order_statistics_node_update> pbds;


void zanj0()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}
void solve() {
	lli s, w;
	cin >> s >> w;
	cout << (w >= s ? "unsafe" : "safe") << endl;
}
int main()
{
	zanj0();
	solve();
	return 0;
}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define i_7 (ll)(1E9+7)
#define i_5 (ll)(1E9+5)
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    else return c+i_7;
}
typedef pair<int,int> i_i;
typedef pair<ll,ll> l_l;
ll inf=(ll)1E12;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll * pos,ll val){*pos=max(*pos,val);}//Max(&dp[i][j],dp[i-1][j]);
void Min(ll * pos,ll val){*pos=min(*pos,val);}
void Add(ll * pos,ll val){*pos=mod(*pos+val);}
const long double EPS=1E-8;
////////////////////////////////////////


int main(){
    ll m,n,q;cin>>m>>n>>q;//注意！
    
    ll a[q];
    rep(i,0,q-1){
        cin>>a[i];a[i]--;
    }
    reverse(a,a+q);
    ll ans[n+1];fill(ans,ans+n+1,-1);
    ll anspos=0;
    ll ansc[n+1];memset(ansc,0,sizeof(ansc));
    ll rev[n];fill(rev,rev+n,-1);
    rep(i,0,q-1){
        ll x=a[i];
        if(rev[x]==-1){
            rev[x]=anspos;
            ll y=rev[x];
            ans[y]=x;
            ansc[y]++;
            anspos++;
        }else{
            ll y=rev[x];
            if(y==0)ansc[y]++;
            else if(y>0&&ansc[y-1]>ansc[y])ansc[y]++;
        }
    }
    vector<ll>v;
    ll pos=0;
    while(pos<=n-1&&ansc[pos]>=m){
        pos++;
    }
    while(pos<=n-1&&ans[pos]!=-1){
        v.pb(ans[pos]);
        pos++;
    }
    //for(auto x:v)cout<<x<<" ";cout<<endl;
    rep(i,0,n-1){
        if(rev[i]==-1)v.pb(i);
    }
    ll s=v.size();
    //for(auto x:v)cout<<x<<" ";cout<<endl;
    //cout<<" ans:";rep(i,0,n)cout<<ans[i]<<" ";cout<<endl;
    //cout<<"ansc:";rep(i,0,n)cout<<ansc[i]<<" ";cout<<endl;
    //cout<<" rev:";rep(i,0,n-1)cout<<rev[i]<<" ";cout<<endl;
    rep(i,0,s-2){
        if(v[i]>=v[i+1]){
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
    
    return 0;
}


Measured memory_bytes: 4472
#include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
long long N, a, Min, result;

int main()
{
    scanf("%lld %lld", &N, &Min);
    for(int i = 0; i < 4; i++)
    {
        scanf("%lld", &a);
        Min = min(Min, a);
    }
    int temp = 0;
    if(N % Min != 0)
    {
        temp = 1;
    }
    printf("%lld", N / Min + 4 + temp);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
 
int main(){
	int n, m, k;
	cin >> n >> m >> k;
	bool f = false;
	rep(i, n+1){
		rep(j, m+1){
			if((n-i)*j + (m-j)*i == k) f = true;
		}
	}
	if(f){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  long n;
  cin >> n;
  long ans = 0;
  long digit = 10;
  int chk = 1;
  while(chk == 1){
    if(digit<=n){
      ans += 9;
      digit *= 10;
    }else{
      if(n%(digit/10)==(digit/10)-1||digit==10)ans += n*10/digit;
      else ans += n*10/digit -1;
      chk = 0;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef unsigned long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
//問題文および制約はちゃんと確認しよう！
//サイズは10^5じゃなくて2×10^5とかかもしれないし、重要な制約・条件を見落としているかも
//とりあえずサンプルを読んでから解法を考えよう？
#define N 10007
lint a[5010][5010];
int main()
{
	int n;string s;cin>>n;cin>>s;
	rep(i,n){
		a[i][0]=0;
		rep(j,n-i) a[i][j+1]=a[i][j]*N+(s[i+j]-'a');
	}
	int out=0;
	rep(i,n) REP(j,i+1,n){
		int lo=out,hi=j-i;
		while(hi>lo){
			int mi=(hi+lo+1)/2;
			if(a[i][mi]==a[j][mi]) lo=mi;else hi=mi-1;
		}
		out=max(out,lo);
	}
	cout<<out<<endl;
}


Measured memory_bytes: 194944
/// Coded by Dhiman Sarker Bappi (Dhimanda) - RMSTU

#include<bits/stdc++.h>
using namespace std;
#define    in_file     freopen("input.txt", "r", stdin)
#define    out_file    freopen("output.txt", "w", stdout)
#define    fast        ios_base :: sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define    F           first
#define    S           second
#define    pb          push_back
#define    popb        pop_back
#define    pf          push_front
#define    popf        pop_front
#define    lcm(a,b)    (a*b)/gcd(a,b)
#define    gcd(a,b)    __gcd(a,b)
#define    pi          2*acos(0)
#define    elif        else if
#define    ll          long long
#define    sp          fixed<<setprecision
#define    nl          '\n'
#define    endl        '\n'
#define    forr(i,b,e) for(int (i)=(b); (i) <= (e); (i)++)
#define    fora(i,n)   for(int (i)=0; (i) < (n); (i)++)


int Int(){int x;scanf("%d", &x);return x;}
#define    Int         Int()
#define    mx          100010
void dhimanda();
int main()
{
    //fast;
    //in_file;
    //out_file;
    int t=1;
    //t=Int;
    forr(i,1,t){
        //printf("Case %d: ", i);
        dhimanda();
    }
    return 0;
}
void dhimanda(){
    ll n;
    cin >> n;
    ll ans = 0 ;
    for(int i=1; i<= n ; i++) {
        if(i%3!=0 and i%5!=0) ans+= i ;
    }
    cout << ans <<endl;
}

// Contact : chessdhiman@gmail.com



Measured memory_bytes: 3636
#include <iostream>
using namespace std;
 
int main() {
	int A, B;
	cin>>A>>B;
	if((A==1 && B==3) || (A==3 && B==1)){
		cout<<2;
	}else if((A==1 && B==2) || (A==2 && B==1)){
		cout<<3;
	}else if((A==2 && B==3) || (A==3 && B==2)){
		cout<<1;
	}
}

Measured memory_bytes: 3576
#include <bits/stdc++.h>
#define REP(i, a, b) for (long long i = a; i <= b; ++i)
#define ll long long
#define N 110
using namespace std;

ll n, ans = INT_MAX, a[N];

inline ll read(){										//快读 
	ll s = 0, w = 1;
	char ch = getchar();
	while (ch < '0' || ch > '9'){
		if (ch == '-') w *= -1;
		ch = getchar();
	}
	while (ch >= '0' && ch <= '9'){
		s = s * 10 + ch - '0';
		ch = getchar();
	}
	return s * w;
}

inline void init(){										//输入 
	n = read();
	REP(i, 1, n) a[i] = read();
}

inline void work(){										//操作 
	init();
	sort(a + 1, a + n + 1);								//先从小到大排序一波 
	REP(i, 1, a[n]){									//从1循环到最大的那个数的值 
		ll sum = 0;										//初始为0 
		REP(j, 1, n) sum += pow(abs(a[j] - i), 2);		//逐个枚举，求值 
		ans = min(ans, sum);							//取最小值 
	}
	printf("%lld\n", ans);								//输出 
}

int main(){
	work();
	return 0;
}

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

using namespace std;

int main() {
	int a,b;
	cin >> a >> b;
	int sum = a + b;
	if(sum%2!=0){
		cout << (sum+1)/2 << endl;
	}
	else {
		cout << sum / 2 << endl;
	}
}

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

#define rep(i,n) for(i = 0;i < n;++i)
#define all(v) v.begin(), v.end()
using ll = long long;

int main()
{
    ll i,j;
    ll d;
    cin >> d;
    vector<ll> c(26);
    for(i = 0;i < 26;++i){
        cin >> c.at(i);
    }
    vector<vector<ll>> s(d,vector<ll>(26));
    for(i = 0;i < d;++i){
        rep(j,26){
            cin >> s.at(i).at(j);
        }
    }
    vector<ll> t(d);
    for(i = 0;i < d;++i){
        cin >> t.at(i);
        --t.at(i);
    }
    vector<ll> last(26,0);
    ll ans = 0;
    for(i = 0;i < d;++i){
        ans += s.at(i).at(t.at(i));
        last.at(t.at(i)) = i+1;
        rep(j,26){
            ans -= c.at(j)*(i+1 - last.at(j));
        }
        cout << ans << endl;
    }



    return 0;
}

Measured memory_bytes: 3720
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <cmath>
#include <queue>
#include <set>

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

using namespace std;
typedef long long int ll;
const int INF = 100000000;

int main()
{
    int n;
    int d[100];
    cin >> n;
    set<int> s;
    rep(i, n) {
        int d;
        cin >> d;
        s.insert(d);
    }
    int c = *rbegin(s);
    int ans = 0;
    while (c > 0) {
        if (s.count(c)) ans++;
        c--;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
import sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**5) 
 
def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

def dfs(v: int, graph: list) -> int:
    if graph[v] == []:
        return 0
    
    else:
        ret = -1
        cands = []
        for ch in graph[v]:
            cands.append(dfs(ch, graph))
            
        cands.sort(reverse=True)
        
        for idx, cand in enumerate(cands):
            ret = max(ret, idx+1 + cand)
            
        return ret
    

n = ni()
graph = [[] for _ in range(n)]

person = 1
for _ in range(n-1):
    ai = ni()-1
    graph[ai].append(person)
    
    person += 1
    
ans = dfs(0, graph)
print(ans)

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

using namespace std;

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)

using ll = long long;
using P = std::tuple<int,int>;

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

int N, A[200];

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

    std::cin >> N;

    for(int i=0;i<2*N;++i){
        std::cin >> A[i];
    }

    sort(A, A+2*N);

    int res = 0;
    for(int i=0;i<2*N;i+=2){
        res += A[i];
    }

    std::cout << res << std::endl;
}


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

const double EPS = 1e-9;
typedef complex<double> P;

struct L : public vector<P>{ L(const P &a,const P &b){ push_back(a); push_back(b); } };

double cross(const P&a,const P &b){
	return imag(conj(a)*b);
}
double dot(const P&a,const P &b){
	return real(conj(a)*b);
}

int ccw(P a,P b,P c){
	b -= a; c-= a;
	if( cross(b,c) > 0 ) return +1;
	if( cross(b,c) < 0 ) return -1;
	if( dot(b,c) < 0 ) return +2;
	if( norm(b) < norm(c) ) return -2;
	return 0;
}
bool intersectSS(const L&s,const L&t){
	return ccw(s[0],s[1],t[0])*ccw(s[0],s[1],t[1]) <= 0 && ccw(t[0],t[1],s[0]) * ccw(t[0],t[1],s[1]) <= 0;
}
P projection(const L &l,const P&p){
	double t = dot(p-l[0],l[0]-l[1]) / norm(l[0]-l[1]);
	return l[0] + t * (l[0]-l[1]);
}
bool intersectSP(const L&s,const P&p){ return abs(s[0]-p)+abs(s[1]-p)-abs(s[1]-s[0]) < EPS; }

double distanceSP(const L&s,const P&p){
	P r = projection(s,p);
	if( intersectSP(s,r) ) return abs(r-p);
	return min(abs(s[0]-p),abs(s[1]-p));
}
double distanceSS(const L &s,const L&t){
	if( intersectSS(s,t) ) return 0;
	return min(min(distanceSP(s,t[0]),distanceSP(s,t[1])),min(distanceSP(t,s[0]),distanceSP(t,s[1])));
}

P in(){
	double a,b;
	cin >> a >> b;
	return P(a,b);
}
int main(){
	int n;
	while( cin >> n && n ){
		P s = in();
		P g = in();
		bool allOk = 1;
		vector< pair<double,double> > lim;
		for(int i = 0 ; i < n ; i++){
			int x1,y1,x2,y2;
			double h;
			cin >> x1 >> y1 >> x2 >> y2 >> h;
			vector<P> p = {P(x1,y1),P(x2,y1),P(x2,y2),P(x1,y2)};
			double sub = 1e9;
			int flagS = 0;
			int flagG = 0;
			for(int j = 0 ; j < p.size() ; j++){
				P a = p[j];
				P b = p[(j+1)%p.size()];
				if( ccw(a,b,s) > 0 ) flagS++;
				if( ccw(a,b,g) > 0 ) flagG++;
				sub = min(distanceSS(L(a,b),L(s,g)),sub);
			}
			if(flagS == 4 || flagG == 4) allOk = 0;
			lim.push_back(make_pair(h,sub));
			//cout << h << " " << sub << endl;
		}
		double l = 0 , r = 1000000;
		for(int _ = 0 ; _ < 128 ; _++){
			double R = (l+r) / 2;
			bool flag = 1;
			for(int j = 0 ; j < lim.size() ; j++){
				double h = min(R,lim[j].first);
				double d = R*R-(R-h)*(R-h);
				d = sqrt(d);
				if( lim[j].second < d ) flag = 0;
				
			}
			if( allOk && flag ) l = R;
			else r = R;
		}
		printf("%.10lf\n",l);
	}
}

Measured memory_bytes: 1264
#include <iostream>
#include <sstream>
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;

int main(void){
	vector <int> v(3);
	for(int i=0; i<3; i++){
		cin >> v[i];
	}
	sort(v.begin(), v.end());
	cout << v[0]+v[1] << endl;
	return 0;
}

Measured memory_bytes: 256
"""
DFSを実装する.再帰を計算する必要があるので，関数の定義が必要
a - a -a
      -b
  - b -a
      -b
      -c
"""
N=int(input())
a_uni = ord('a')
z_uni = ord('z')
def dfs(s,maximum_uni):
    if len(s)==N:
        print(s)
        return None
    for i in range(a_uni,(maximum_uni+1)+1):
        maximum_uni = max(maximum_uni,i)
        dfs(s+chr(i),maximum_uni)
dfs('a',a_uni)




Measured memory_bytes: 4412
#include <bits/stdc++.h>
// #include <cmath>
// #include <numeric>
// #include <regex> //正規表現
using namespace std;
#define rep(i,a,b) for(int i=(a); i<(b); ++i) // a ≦ i < b 
#define Rrep(i,a,b) for(int i=(a);i>=(b);--i) // reverse repeat. a から b まで減少．
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend() //逆イテレータ
#define RANGE(a,b,c) (a).begin()+b,(a).begin()+c // コンテナ a の 要素 b から c へのイテレータ
#define MOD 1000000007ll
#define INF 1000000000
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VP;
// グリッドグラフの移動ベクトル
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

void dfs(map<int, set<int>> &G, vector<bool> seen, int &cnt, int len, int node){
    seen[node] = true;
    ++len;
    if (len == seen.size() - 1) {
        ++cnt; 
        return;
    }
    for (int v : G[node]){
        if (seen[v]) continue;
        dfs(G, seen, cnt, len, v);
    }
}

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

int N, M; cin >> N >> M;
int a, b; 
map<int, set<int>> map;
rep(i, 0, M) {
    cin >> a >> b;
    map[a].insert(b);
    map[b].insert(a);
}

vector<bool> seen(N+1, false);
int cnt = 0, len = 0;

dfs(map, seen, cnt, len, 1);


cout << cnt << endl;
}

// 境界，出力文字列 チェック



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

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

    vector<int> A(N);
    for(int i=0;i<N;i++){
        cin >> A[i];
    }
    vector<int> l_gcd(N+1), r_gcd(N+1);
    l_gcd[0] = 0;
    r_gcd[N] = 0;
    for(int i=0;i<N;i++){
        l_gcd[i+1] = __gcd(l_gcd[i], A[i]);
    }
    for(int i=N;i>0;i--){
        r_gcd[i-1] = __gcd(r_gcd[i], A[i-1]);
    }
    vector<int> gcd(N);
    int ans = 1;
    for(int i=0;i<N;i++){
        gcd[i] = __gcd(l_gcd[i], r_gcd[i+1]);
        ans = max(ans, gcd[i]);
    }

    cout << ans << endl;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
//#define cerr if (false) cerr
#define db(x) cerr << #x << "=" << x << endl
#define db2(x, y) cerr << #x << "=" << x << "," << #y << "=" << y << endl
#define db3(x, y, z) cerr << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z << endl
#define dbv(v) cerr << #v << "="; for (auto _x : v) cerr << _x << ", "; cerr << endl
#define dba(a, n) cerr << #a << "="; for (int _i = 0; _i < (n); ++_i) cerr << a[_i] << ", "; cerr << endl
template <typename A, typename B>
ostream& operator<<(ostream& os, const pair<A, B>& x) {
	return os << "(" << x.first << "," << x.second << ")";
}
typedef long long ll;
typedef long double ld;
char str[305];
int main() {
	int n;
	scanf("%d%s", &n, str);
	int m = 1 << n;
	vector<int> S;
	bool sol = true;
	for (int i = 1; i < m; ++i) {
		bool bad = false;
		if (str[i] == '1') continue;
		for (int j = 0; j < n; ++j) {
			if (i & (1 << j)) {
				if (str[i ^ (1 << j)] == '0') bad = true;
			} else {
				if (str[i ^ (1 << j)] == '1') sol = false;
			}
		}
		if (!bad) S.push_back(i);
	}
	if (!sol) printf("Impossible\n");
	else {
		vector<pair<int, int>> ans = {{0, 0}};
		for (int b : S) {
			vector<pair<int, int>> curve;
			int las = -1;
			for (int i = n - 1; i >= 0; --i) {
				if (!(b & (1 << i))) continue;
				if (las == -1) {
					curve = {{i, 0}, {i, 1}, {i + 1, 1}, {i + 1, 0}, {i, 0}};
					las = i;
					continue;
				}
				vector<pair<int, int>> ncurve;
				ncurve.emplace_back(i, 0);
				for (int j = i; j <= las; ++j) ncurve.emplace_back(j, 1);
				ncurve.insert(ncurve.end(), curve.begin(), curve.end());
				for (int j = las; j >= i; --j) ncurve.emplace_back(j, 1);
				ncurve.emplace_back(i, 0);
				ncurve.emplace_back(i + 1, 0);
				for (int j = i + 1; j <= las; ++j) ncurve.emplace_back(j, 1);
				ncurve.insert(ncurve.end(), curve.rbegin(), curve.rend());
				for (int j = las; j >= i + 1; --j) ncurve.emplace_back(j, 1);
				ncurve.emplace_back(i + 1, 0);
				ncurve.emplace_back(i, 0);
				curve = ncurve;
				las = i;
			}
			if (las) {
				vector<pair<int, int>> ncurve = {{0, 0}};
				for (int j = 0; j <= las; ++j) ncurve.emplace_back(j, 1);
				ncurve.insert(ncurve.end(), curve.begin(), curve.end());
				for (int j = las; j >= 0; --j) ncurve.emplace_back(j, 1);
				ncurve.emplace_back(0, 0);
				curve = ncurve;
			}
			ans.pop_back();
			ans.insert(ans.end(), curve.begin(), curve.end());
		}
		printf("Possible\n%d\n", (int)ans.size() - 1);
		for (auto& a : ans) printf("%d %d\n", a.first, a.second);
	}
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll mod=1000000007;
#define IO ios_base::sync_with_stdio(false);cin.tie(NULL);
int main()
{
    IO
    string s,dp;
    cin>>s;
    if(s=="ABC")
    dp="ARC";
    else
    dp="ABC";
    cout<<dp;
    return 0;
}

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

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


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

int main() {
  
  vector<int> A(9);
  for(int i = 0; i < 9; i++) cin >> A.at(i);
  
  int N;
  cin >> N;
  
  vector<int> B(N);
  for(int i = 0; i < N; i++) {
    cin >> B.at(i);
    for(int j = 0; j < 9; j++) {
      if(B.at(i) == A.at(j)) A.at(j) = 0;
    }
  }
  
  int x1, x2, x3, x4, x5, x6, x7, x8, xx;
  x1 = A.at(0) + A.at(1) + A.at(2);
  x2 = A.at(3) + A.at(4) + A.at(5);
  x3 = A.at(6) + A.at(7) + A.at(8);
  x4 = A.at(0) + A.at(3) + A.at(6);
  x5 = A.at(1) + A.at(4) + A.at(7);
  x6 = A.at(2) + A.at(5) + A.at(8);
  x7 = A.at(0) + A.at(4) + A.at(8);
  x8 = A.at(2) + A.at(4) + A.at(6);
  xx = x1*x2*x3*x4*x5*x6*x7*x8;
  
  if(xx == 0) cout << "Yes" << endl;
  else cout << "No" << endl;

}

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

int main(){
        string n, ans[9];
        int i, j, cal, tmp, flg=0;
        cin >> n;
        ans[0] = n[0];
        ans[2] = n[1];
        ans[4] = n[2];
        ans[6] = n[3];
        ans[7] = "=";
        ans[8] = "7";
        for(i=0;i<(1<<3);++i){
                cal = (int)n[0] - 48;
                for(j=0;j<3;++j){
                        if((i>>j)&1){
                                tmp = (int)n[3-j] - 48;
                                ans[5-2*j] = "+";
                        }else{
                                tmp = -((int)n[3-j] -48);
                                ans[5-2*j] = "-";
                        }
                        cal += tmp;
                }
                if(cal==7){
                        for(j=0;j<9;++j) cout << ans[j];
                        cout << endl;
                        flg = 1;
                }
                if(flg==1) break;
        }
        return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=23;
const ll INF=1LL<<60;

bool can[MAX][MAX][MAX];

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    while(1){
        int P,Q;cin>>P>>Q;
        if(P+Q==0) break;
        vector<int> A(P+3),B(P+3),C(P+3),cnt(P+3);
        
        for(int i=0;i<P;i++){
            string S;cin>>S;
            bool ok=true;
            for(int j=0;j<S.size();j++){
                if(ok){
                    if(S[j]=='.') cnt[i]++;
                    else ok=false;
                }
                
                if(S[j]=='(') A[i+1]++;
                if(S[j]==')') A[i+1]--;
                
                if(S[j]=='{') B[i+1]++;
                if(S[j]=='}') B[i+1]--;
                
                if(S[j]=='[') C[i+1]++;
                if(S[j]==']') C[i+1]--;
            }
            
            A[i+2]=A[i+1];
            B[i+2]=B[i+1];
            C[i+2]=C[i+1];
        }
        
        memset(can,0,sizeof(can));
        
        for(int a=1;a<=20;a++){
            for(int b=1;b<=20;b++){
                for(int c=1;c<=20;c++){
                    can[a][b][c]=1;
                    
                    for(int i=0;i<P;i++){
                        if(A[i]*a+B[i]*b+C[i]*c!=cnt[i]) can[a][b][c]=0;
                    }
                }
            }
        }
        
        A.resize(Q+3);
        B.resize(Q+3);
        C.resize(Q+3);
        cnt.resize(Q+3);
        
        for(int i=0;i<Q+3;i++){
            A[i]=0;
            B[i]=0;
            C[i]=0;
            cnt[i]=0;
        }
        
        for(int i=0;i<Q;i++){
            string S;cin>>S;
            
            for(int j=0;j<S.size();j++){
                
                if(S[j]=='(') A[i+1]++;
                if(S[j]==')') A[i+1]--;
                
                if(S[j]=='{') B[i+1]++;
                if(S[j]=='}') B[i+1]--;
                
                if(S[j]=='[') C[i+1]++;
                if(S[j]==']') C[i+1]--;
            }
            
            A[i+2]=A[i+1];
            B[i+2]=B[i+1];
            C[i+2]=C[i+1];
            
            set<int> ans;
            
            for(int a=1;a<=20;a++){
                for(int b=1;b<=20;b++){
                    for(int c=1;c<=20;c++){
                        if(!can[a][b][c]) continue;;
                        
                        ans.insert(A[i]*a+B[i]*b+C[i]*c);
                    }
                }
            }
            
            if(i) cout<<" ";
            
            if(ans.size()==1) cout<<(*ans.begin());
            else cout<<-1;
        }
        cout<<endl;
        
    }
    
    
}




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

int main(){

    int n;
    cin >> n;

    vector<int> h(n);
    rep(i,n)cin >> h[i];
    int ans=0;
    rep(i,n){
        bool f=true;
        rep(j,i){
            if(h[j]>h[i]){
                f=false;
            }
        }
        if(f){
            ans++;
        }
    }

    cout << ans << endl;

    return 0;
}

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

using namespace std;
#define ll long long
#define ld long double

int main()
{
    ios_base::sync_with_stdio(0),cin.tie(NULL),cout.tie(NULL);
    ll h, w;
    cin >> h >> w;
    if(h == 1 || w == 1) {
        cout << 1 << endl;
        return 0;
    }
    cout << (h * w + 1) / 2;
    return 0;
}


Measured memory_bytes: 256
//abc150
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define cinf(n,x) for(int i=0;i<(n);i++)cin>>x[i];
#define ft first
#define sc second
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define mod 1000000007
using namespace std;
typedef long long ll;
template<class T> using V=vector<T>;
using Graph = vector<vector<int>>;
using P=pair<ll,ll>;
typedef unsigned long long ull;
typedef long double ldouble;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

const ll INF=1e18;

const ull B=1000000007;//ハッシュの基数

//aはbに含まれているか？
bool contain(string a,string b){
    int al=a.length(),bl=b.length();
    if(al>bl) return false;

    //Bのal乗を計算
    ull t=1;
    for(int i=0;i<al;i++) t*=B;

    //aとbの最初のal文字に関するハッシュ値を計算
    ull ah=0,bh=0;
    for(int i=0;i<al;i++) ah=ah*B+a[i];
    for(int i=0;i<al;i++) bh=bh*B+b[i];

    //bの場所を1つずつ進めながらハッシュ値をチェック
    for(int i=0;i+al<=bl;i++){
        if(ah==bh) return true;//bのi文字目からのal文字が一致
        if(i+al<bl) bh=bh*B+b[i+al]-b[i]*t;
    }
    return false;
}

int main(){
    int n;
    cin>>n;
    V<ll> a(n),b(n),c(n-1),d(n);
    cinf(n,a);
    cinf(n,b);
    rep(i,n-1) c[i]=(b[i]^b[i+1]);
    rep(i,n) d[i]=(a[i%n]^a[(i+1)%n]);
    if(n==1){
        cout<<0<<' '<<(a[0]^b[0])<<endl;
    }else{
        priority_queue<P,V<P>,greater<P>> que;
        int cl=n-1,dl=n;//a->c,b->d

        //Bのal乗を計算
        ull t=1;
        for(int i=0;i<cl;i++) t*=B;

        //aとbの最初のal文字に関するハッシュ値を計算
        ull ch=0,dh=0;
        for(int i=0;i<cl;i++) ch=ch*B+c[i];
        for(int i=0;i<cl;i++) dh=dh*B+d[i];

        //bの場所を1つずつ進めながらハッシュ値をチェック
        for(int i=0;i<dl;i++){
            if(ch==dh){
                P p=P(i,(b[0]^a[i]));
                que.push(p);
            } //dのi文字目からのcl文字が一致
            dh=dh*B+d[(i+cl)%n]-d[i%n]*t;
        }
        while(!que.empty()){
            P p=que.top();
            que.pop();
            cout<<p.ft<<' '<<p.sc<<'\n';
        }
    }
}

Measured memory_bytes: 13676
// BEGINNING WITH THE NAME OF ALMIGHTY GOD ALLAH
// AUTHOR:: MOHAMMAD FAISAL
#include<bits/stdc++.h>
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.flush();
    string res = "";
	for(int i=0;i<3;i++)
    {
       string s;
       cin >> s;
       res+=s[i];
    }
    cout<<res;
	return 0;
	// BYE BYE 
}

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

int main()  
{  
	int n,w;
	cin>>n>>w;
	ll aa,bb;
	//vector<pair<ll,ll> > val(n);
	//for(ll i=0;i<n;i++){
		//cin>>aa>>bb;
		//val[i] = {aa,bb};
	//}
	
	vector<ll> dp(1000*n+1,INT_MAX);
	dp[0] = 0;
	
	for(ll i=0;i<n;i++){
		cin>>aa>>bb;
		for(ll j=1000*n;j>=0;j-- ){
			if(j-bb>=0)
			dp[j] = min(dp[j],dp[j-bb] + aa);
		}
	}
	ll ans =INT_MAX;
	 for(ll i=0;i<dp.size();i++){
		 if(dp[i]<=w) ans = i;
	 }
	 cout<<ans;
    return 0;  
} 


Measured memory_bytes: 1152
d=int(input())
c=list(map(int,input().split()))
s=[list(map(int,input().split())) for i in range(d)]
def costcalc(t):
    ans=0
    last=[0]*26
    for i in range(d):
        ans+=s[i][t[i]-1]
        last[t[i]-1]=i+1
        for j in range(26):
            ans-=(c[j]*(i+1-last[j]))
        return max(10**6+ans,0)
anss=[[costcalc([j]*d),j+1] for j in range(26)]
anss.sort(reverse=True)
for i in range(d):
    print(anss[0][1])

Measured memory_bytes: 67696
use std::fmt::{Debug, Display};
use std::io::{self, Read};
use std::str::{self, FromStr};


fn solve(s: String) -> String {
    let s = s.as_bytes();
    let mut result = Vec::with_capacity(100);
    for (i, &c) in s.iter().enumerate() {
        if i % 2 == 0 {
            result.push(c);
        }
    }
    unsafe { String::from_utf8_unchecked(result) }
}


fn main() {
    let stdin = io::stdin();
    let mut sc = Scanner::new(stdin.lock().bytes());
    println!("{}", solve(sc.next()));
}


struct Scanner<R: Read> {
    buf: Vec<u8>,
    bytes: io::Bytes<R>,
}

#[allow(dead_code)]
impl<R: Read> Scanner<R> {
    fn new(bytes: io::Bytes<R>) -> Self {
        Scanner {
            buf: Vec::with_capacity(256),
            bytes: bytes,
        }
    }

    fn next<T: FromStr>(&mut self) -> T
    where
        <T as FromStr>::Err: Debug,
    {
        self.buf.clear();
        for c in self.bytes
            .by_ref()
            .map(|c| c.unwrap())
            .skip_while(|&c| c == ' ' as u8 || c == '\n' as u8)
            .take_while(|&c| !(c == ' ' as u8 || c == '\n' as u8))
        {
            self.buf.push(c);
        }
        str::from_utf8(&self.buf).unwrap().parse().unwrap()
    }

    fn vec<T: FromStr>(&mut self, n: usize) -> Vec<T>
    where
        <T as FromStr>::Err: Debug,
    {
        (0..n).map(|_| self.next()).collect()
    }

    fn pairs<A: FromStr, B: FromStr>(&mut self, n: usize) -> Vec<(A, B)>
    where
        <A as FromStr>::Err: Debug,
        <B as FromStr>::Err: Debug,
    {
        (0..n).map(|_| (self.next(), self.next())).collect()
    }

    fn trios<A: FromStr, B: FromStr, C: FromStr>(&mut self, n: usize) -> Vec<(A, B, C)>
    where
        <A as FromStr>::Err: Debug,
        <B as FromStr>::Err: Debug,
        <C as FromStr>::Err: Debug,
    {
        (0..n)
            .map(|_| (self.next(), self.next(), self.next()))
            .collect()
    }

    fn mat<T: FromStr>(&mut self, m: usize, n: usize) -> Vec<Vec<T>>
    where
        <T as FromStr>::Err: Debug,
    {
        (0..n).map(|_| self.vec(m)).collect()
    }
}


#[allow(dead_code)]
fn print_foreach<T: Display>(answer: &[T]) {
    for x in answer {
        println!("{}", x);
    }
}


#[allow(dead_code)]
fn print_yn(answer: bool, yes: &str, no: &str) {
    println!("{}", if answer { yes } else { no });
}


#[allow(dead_code)]
fn print_or<T: Display>(answer: &Option<T>, or: &T) {
    match *answer {
        Some(ref x) => println!("{}", x),
        None => println!("{}", or),
    }
}


Measured memory_bytes: 4352
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int n;
    cin>>n;
    int ans=0;
    for(int i=0;i<n;i++){
        int a;
        cin>>a;
        while(a%2==0){
            a/=2;
            ans++;
        }
    }
    cout<<ans<<endl;
}


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

namespace atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.ReadLine();
            Console.WriteLine(Console.ReadLine().Split(' ')
                .Select(num => int.Parse(num))
                .Where((num, i) => i % 2 == 0 && num % 2 == 1)
                .Count());
        }
    }
}

Measured memory_bytes: 28248
n, l = map(int, input().split())

if 0 <= l:
    print((l + n - 1 + l + 2 - 1) * (n - 1) // 2)
elif 0 <= l + n - 1:
    print(sum(range(l, l + n)))
else:
    print((l + n - 2 + l) * (n - 1) // 2)


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

int main(){
	cout<<fixed<<setprecision(12);	

	int n;
	
	while(1){
		double a, s[1000], m, sum = 0;
		cin>>n;
		if(n == 0) break;
		for(int i = 0; i < n; i++){
			cin>>s[i];	
			sum += s[i];
		}
		m = sum / n;
		sum = 0;
		for(int i = 0; i < n; i++){
			sum += pow(s[i] - m, 2);
		}
		
		a = sqrt(sum / n);
		
		cout<<a<<endl;
	}
	return 0;
}


Measured memory_bytes: 3228
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=1;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define maxs(a, b) a = max(a, b)
#define mins(a, b) a = min(a, b)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll linf = (ll)4e18;
const int inf = 1001001001;
const int mod = 1000000007;

int dist[2005][2005];

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, x, y;
	cin >> n >> x >> y;
	x--; y--;
	rep(i, n)
		for (int j = i + 1; j < n; ++j)
			dist[i][j] = j - i, dist[j][i] = j - i;
	vector<int> ans(n);
	rep(i, n)
		for (int j = i + 1; j < n; ++j)
			mins(dist[i][j], dist[i][x] + dist[j][y] + 1), ans[dist[i][j]]++;
	rrep(i, n)cout << ans[i] << endl;
	return 0;
}


Measured memory_bytes: 16000