akhauriyash/Code-Regression huggingface dataset:
import sys
input = sys.stdin.readline

N = int(input())

# if power of 2
n = N.bit_length()
if N == 1 << (n-1):
    print('No')
    exit()

def solve(N):
    graph = []
    for n in range(2,N,2):
        graph.append((n,n+1))
        graph.append((n+1,1))
        graph.append((1,N+n))
        graph.append((N+n,N+n+1))
    graph.append((N+1,2))
    if N&1:
        return graph
    L = N.bit_length()
    n = 1 << (L-1)
    m = N ^ n ^ 1
    # n even, m odd
    graph.append((N,m))
    graph.append((n+N,N+N))
    return graph


graph = solve(N)

print('Yes')
for a,b in graph:
    print(a,b)

Measured memory_bytes: 29344
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
 
public class Main {
    public static void main(String[] args){
         
        try {
            InputStreamReader isr = new InputStreamReader(System.in);
            BufferedReader br = new BufferedReader(isr);
            String buf = br.readLine();
            StringTokenizer st=new StringTokenizer(buf," ");
            int a = Integer.parseInt(st.nextToken());
            int b = Integer.parseInt(st.nextToken());
 
            if(a < b)
                System.out.println("a < b");
            else if(a > b)
                System.out.println("a > b");
            else if(a == b)
                System.out.println("a == b");
 
        } catch(IOException e) {
            System.err.println(e);
        }
    }
}

Measured memory_bytes: 17004
s=int(input())
mod=10**9+7
ans=0
def comb(n,k,p):
  from math import factorial
  if n<0 or k<0 or n<k: return 0
  if n==0 or k==0: return 1
  a=factorial(n) %p
  b=factorial(k) %p
  c=factorial(n-k) %p
  return (a*power_func(b,p-2,p)*power_func(c,p-2,p))%p
def power_func(a,b,p):
  if b==0: return 1
  if b%2==0:
    d=power_func(a,b//2,p)
    return d*d %p
  if b%2==1:
    return (a*power_func(a,b-1,p ))%p
if s>=3:
  ans+=1
  for i in range(2,1001):
    if s//i<3:
      break
    else:
      n=s-3*i
      ans+=comb(n+(i-1),i-1,mod)
      ans%=mod
else:
  pass
print(ans)

Measured memory_bytes: 73328
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<vector>
#include<queue>
#include<map>
#include<bitset>
#include<set>
#define N ()
#define M ()
#define inf (0x7f7f7f7f)
#define rg register int
#define Label puts("NAIVE")
#define spa print(' ')
#define ent print('\n')
#define rand() (((rand())<<(15))^(rand()))
#define file(s) freopen(s".in","r",stdin),freopen(s".out","w",stdout)
typedef long double ld;
typedef long long LL;
typedef unsigned long long ull;
using namespace std;
namespace fastIO1{
	inline char read(){
		static const int IN_LEN=1000000;
		static char buf[IN_LEN],*s,*t;
		return (s==t?t=(s=buf)+fread(buf,1,IN_LEN,stdin),(s==t?-1:*s++):*s++);
	}
	template<class T>
	inline void read(T &x){
		static bool iosig;
		static char c;
		for(iosig=false,c=read();!isdigit(c);c=read()){
			if(c=='-')iosig=true;
			if(c==-1)return;
		}
		for(x=0;isdigit(c);c=read())x=((x+(x<<2))<<1)+(c^'0');
		if(iosig)x=-x;
	}
	inline char readc(char &c){
		for(c=read();!isalpha(c)&&!isdigit(c);c=read())
		if(c==-1)return 0;
	}
	const int OUT_LEN = 10000000;
	char obuf[OUT_LEN],*ooh=obuf;
	inline void print(char c){
		if(ooh==obuf+OUT_LEN)fwrite(obuf,1,OUT_LEN,stdout),ooh=obuf;
		*ooh++=c;
	}
	template<class T>
	inline void print(T x){
		static int buf[30],cnt;
		if(x==0)print('0');
		else{
			if(x<0)print('-'),x=-x;
			for(cnt=0;x;x/=10)buf[++cnt]=x%10+48;
			while(cnt)print((char)buf[cnt--]);
		}
	}
	inline void flush(){fwrite(obuf,1,ooh-obuf,stdout);}
}
namespace fastIO2{
	template<class T>
	inline void read(T &x){
		static bool iosig;
		static char c;
		for(iosig=false,c=getchar();!isdigit(c);c=getchar()){
			if(c=='-')iosig=true;
			if(c==-1)return;
		}
		for(x=0;isdigit(c);c=getchar())x=((x+(x<<2))<<1)+(c^'0');
		if(iosig)x=-x;
	}
}
using namespace fastIO1;
int n,P,f[6010][8010],ans;
void add(int &x,int y){
	x=x+y>P?x+y-P:x+y;
}
int main(){
	read(n); read(P); f[0][n]=1;
	for(int i=1;i<=3*n;i++)
	for(int j=-n;j<=3*n;j++){
		if(j+n>0)add(f[i][j+n],f[i-1][j-1+n]);
		if(i>=2)add(f[i][j+n],1ll*(i-1)*f[i-2][j+1+n]%P);
		if(i>=3)add(f[i][j+n],1ll*(i-1)*(i-2)%P*f[i-3][j+n]%P); 
	}
	for(int i=n;i<=4*n;i+=3)add(ans,f[n*3][i]);
	printf("%d\n",ans);
} 

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

int main(){
  int N; cin>>N;
  double T,A; cin>>T>>A;
  double x;
  vector<int> H(N);
  double ln = 2147483640;
  int lb;
  for(int i=0;i<N;i++){
    cin>>x;
    x=abs(T-x*0.006-A);
    if(ln>x){
      lb=i; ln=x;
    }
  }
  cout<<lb+1<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
	ll n;
	cin>>n;
	
	vector<ll> vec(n,0);
	ll sum=0;
	for(ll i=0;i<n;i++) cin>>vec[i];
	for(ll i=0;i<n;i++) {sum+=vec[i];vec[i]*=2;}
	
	ll ans=0;
	for(ll i=0;i<n;i+=2){
		ans+=vec[i];
	}
	
	ll a=ans-sum;
	cout<<a<<" ";
	for(ll i=0;i<n-1;i++){
		cout<<vec[i]-a<<" ";
		a=vec[i]-a;
	}
}

Measured memory_bytes: 2048
w = int(input())
n = int(input())
l = list(reversed([list(map(int, input().split(','))) for x in range(n)]))

for i in range(1, w + 1):
    c = i
    for a in l:
        if a[0] == c:
            c = a[1]
        elif a[1] == c:
            c = a[0]

    print(c)

Measured memory_bytes: 7672
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int main(){
    IOS;
    int n;
    cin >> n;
    long long ans = 0;
    long long tempOne = 2;
    long long tempTwo = 1;
    if(n==1){
        cout << 1 <<endl;
    }else{
        for(int i=2; i<=n; i++){
        ans = tempOne+tempTwo;
        tempOne = tempTwo;
        tempTwo = ans;
    }
    cout << ans <<endl;
    }
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
#define int long long
using namespace std;

int32_t main(){
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
	ios::sync_with_stdio(0),cin.tie(0);
	int h,n,w;
	cin >> h >> w >> n;
	cout << ceil((double(n)/max(h,w)));
}


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

int n,ans;
int main(){
	scanf("%d",&n);
	for (int i=1;i<=n;i++){
		if (!(i%2)) continue;
		int rst=0;
		for (int j=1;j<=i;j++) if (!(i%j)) rst++;
		if (rst==8) ans++;
	}
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3

import sys
input=sys.stdin.readline

def judge(k):
    if k%2==0 or k%5==0:
        print(-1)
    else:
        tmp=0
        for i in range(10**6):
            tmp+=7
            tmp%=k
            if tmp==0:
                print(i+1)
                break
            else:
                tmp*=10

k=int(input())
judge(k)


Measured memory_bytes: 9016
#include <bits/stdc++.h>
#define BIT(n) (1LL << (n))
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPB(i, n) for (int i = 0; i < BIT(n); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORA(i, n) for (auto &&i : n)
#define FORS(i, m, n) for (int i = m; i <= n; i++)
#define DEBUG(x) cerr << #x << ": " << x << "\n"
#define PRINTALL(V)                                                            \
  for (auto v : (V)) {                                                         \
    cerr << v << " ";                                                          \
  }                                                                            \
  cerr << "\n";
#define ALL(v) v.begin(), v.end()
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
#define epb emplace_back
#define int long long
using namespace std;
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 (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template < class T > using vec = std::vector< T >;
template < class T > void print(const T &x) { cout << x << "\n"; }
const int MOD = 1000000007, INF = 1061109567;
const double EPS = 1e-10, PI = acos(-1.0);
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
signed main() {
  cin.tie(0), ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  int N, K;
  string S;
  cin >> N >> K >> S;
  int ans = 0;
  vec< pair< int, int > > b;
  int begin;
  bool flg = true;
  string P = "RL";
  if (S[0] == 'R')
    swap(P[0], P[1]);
  REP(i, N) {
    if (S[i] == P[0] && flg) {
      begin = i;
      flg = false;
    } else if (S[i] == P[1] && !flg) {
      flg = true;
      b.pb(mp(begin, i));
    }
  }
  if (!flg) {
    b.pb(mp(begin, N));
  }
  REP(i, min(K, (int)b.size())) {
    FOR(j, b[i].first, b[i].second) { S[j] = P[1]; }
  }
  //DEBUG(S);

  REP(i, N) {
    if (S[i] == P[1] && i - 1 >= 0 && S[i - 1] == P[1])
      ans++;
    if (S[i] == P[0] && i + 1 <= N - 1 && S[i + 1] == P[0])
      ans++;
  }
  print(ans);
}

Measured memory_bytes: 1480
#include <bits/stdc++.h>
     
#define pll pair <long long,long long>
#define pb push_back
#define ll long long
#define ff first
#define ss second
#define vll vector <ll>
#define NFS ios_base::sync_with_stdio(0); cin.tie(NULL);
#define endl '\n'
#define M 1000000007
#define MAX 1000003   
using namespace std;

map<ll,ll> fac;
long long sfc[MAX];

void sieve()
{
    //cout<<"ss"<<endl;
	sfc[0]=sfc[1]=1;
	for(ll i=2;i<MAX;i++)
		sfc[i]=0;
	for(ll i=2;i<MAX;i++)
	{
		if(sfc[i]==0)
		{
			sfc[i]=i;
			for(ll j=i*i;j<MAX;j+=i)
			{
				if(sfc[j]==0)
					sfc[j]=i;
			}
		}
	}
	//cout<<"ends"<<endl;
}

ll powe(ll a,ll b)
{
	ll rs=1;
	while(b>1)
	{
		if(b%2)
			rs=(rs*a)%M;
		a=(a*a)%M;
		b/=2;
	}
	if(b==1)
	    rs=(rs*a)%M;
	return rs;
}

ll modinv(ll d)
{
	return powe(d,M-2);
}

ll findlcm(const ll *a,ll n)
{
	for(int i=0;i<n;i++)
	{
		ll num=a[i];
		map<ll,ll> tp;
		while(num>1)
		{
			ll fc=sfc[num];
			tp[fc]++;
			num/=fc;
		}
		for(auto it:tp)
		{
			fac[it.ff]=max(fac[it.ff],it.ss);
			//cout<<it.ff<<" "<<it.ss<<endl;
		}
	}
	ll lc=1;
	for(auto it:fac)
	{
		lc=(lc*powe(it.ff,it.ss))%M;
		//cout<<it.ff<<" "<<it.ss<<endl;
		//cout<<lc<<endl;
	}
	return lc;
}

void solve()
{
	sieve();
	ll n;
	cin>>n;
	ll a[n];
	for(int i=0;i<n;i++)cin>>a[i];
	ll lcm=findlcm(a,n);
    //cout<<lcm<<endl;
	ll ans=0;
	for(int i=0;i<n;i++)
	{
		ans=(ans%M+lcm*modinv(a[i]))%M;
	}
	cout<<ans;
}
 
int main()
{
    NFS
 	int t=1;
 	//cin>>t;
 	while(t--)
 	{
 		solve();
 	}
    return 0;
}

Measured memory_bytes: 8832
#pragma region
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <list>
#include <iomanip>
#include <cstdint>
#include <bitset>

using namespace std;
typedef long long ll;
//#define rep(i, s, e) for (int(i) = (s); (i) < (e); ++(i))
#define rep(i, e) for (int(i) = 0; (i) < (e); ++(i))
#define rrep(i, s) for (int(i) = (s) - 1; (i) >= 0; --(i))
#define all(x) x.begin(),x.end()

#pragma region UnionFind
struct UnionFind
{
	vector<int> par;

	UnionFind(int n) : par(n, -1) {}
	void init(int n) { par.assign(n, -1); }

	int root(int x)
	{
		if (par[x] < 0) return x;
		else return par[x] = root(par[x]);
	}

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

	bool merge(int x, int y)
	{
		x = root(x); y = root(y);
		if (x == y) return false;
		if (par[x] > par[y]) swap(x, y);
		par[x] += par[y];
		par[y] = x;
		return true;
	}

	int size(int x)
	{
		return -par[root(x)];
	}
};
#pragma endregion
#pragma region GCD
int gcd(int a, int b)
{
	if (a%b == 0)return b;
	return gcd(b, a%b);
}
#pragma endregion
#pragma region chmin
template<class T> inline bool chmin(T& a, T b)
{
	if (a > b)
	{
		a = b;
		return true;
	}
	return false;
}
#pragma endregion
#pragma region chmax
template<class T> inline bool chmax(T& a, T b)
{
	if (a < b)
	{
		a = b;
		return true;
	}
	return false;
}
#pragma endregion
#pragma endregion


int main()
{
	int n; cin >> n;
	vector<pair<double,double>> v(n); 
	rep(i, n)
	{
		double x, y; cin >> x >> y;
		v[i] = make_pair(x, y);
	}
	sort(all(v));
	double res = 0;
	int cnt = 0;
	do
	{
		++cnt;
		for (int i = 1; i < n; ++i)
		{
			res += sqrt(pow(v[i].first - v[i - 1].first, 2) + pow(v[i].second - v[i - 1].second, 2));
		}
	} while (next_permutation(all(v)));
	res /= (double)cnt;
	cout << fixed << setprecision(10) << res << endl;
}

Measured memory_bytes: 3768
#include<iostream>
#define ll long long
using namespace std;
int main(){
    ll t[2],a[2],b[2];
    cin>>t[0]>>t[1];
    cin>>a[0]>>a[1];
    cin>>b[0]>>b[1];
    ll ans=0;
    if(a[0]*t[0]+a[1]*t[1]==b[0]*t[0]+b[1]*t[1]){
        if(a[0]*t[0]!=b[0]*t[0]){
            cout<<"infinity"<<endl;
            return 0;
        }
        else ans=0;
    }
    else{
        ll x1=a[0]*t[0];
        ll x2=a[1]*t[1];
        ll y1=b[0]*t[0];
        ll y2=b[1]*t[1];
        if(a[0]*t[0]+a[1]*t[1]>b[0]*t[0]+b[1]*t[1]){
            if(a[0]*t[0]>=b[0]*t[0])ans=0;
            else{
                ans=1+(y1-x1)/(x1+x2-y1-y2)+(y1-x1)/(x1+x2-y1-y2);
                if((y1-x1)%(x1+x2-y1-y2)==0)ans--;
            }
        }
        else{
            if(a[0]*t[0]<=b[0]*t[0])ans=0;
            else{
                ans=1+(x1-y1)/(y1+y2-x1-x2)+(x1-y1)/(y1+y2-x1-x2);
                if((x1-y1)%(y1+y2-x1-x2)==0)ans--;
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pint;
typedef vector<long long> vlong;
typedef vector<string> vstring;
#define vpush(a,x) a.push_back(x);
#define rep(i, n) REP(i, 0, n)
#define all(v) v.begin(), v.end()
#define REP(i, x, n) for(int i = x; i < n; i++)
const int INF = 1 << 30;
const int dx[] = {1,0,-1,0,1,1,-1,-1};
const int dy[] = {0,-1,0,1,1,-1,-1,1};
#define stp(x)  setprecision(x)
const long double PI=3.14159265358979323846264338327950;
int main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n;
  cin>>n;
  rep(i,n){
    int k,p;
    cin>>k>>p;
    if(k%p==0){
      cout<<p<<'\n';
    }
    else{
      cout<<k%p<<'\n';
    }
  }
  return(0);
}


Measured memory_bytes: 3204
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <fstream>
#include <sstream>
#include <iomanip>
#define ll long long

using namespace std;

long long MOD = 1000000007;

int main(){
    int N, X;
    cin >> N >> X;
    int sum_=0;
    for(int i=0; i<N; i++){
        int l;
        cin >> l;
        sum_+=l;
        if(sum_>X){
            cout << i+1 << endl;
            return 0;
        }
    }
    cout << N+1 << endl;
}

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


int main()
{
    string s;
    cin>>s;
    int n=s.length();
    int f=0;
    for(int i=0;i<n/2 && f==0;i++)
    {
        if(s[i]!=s[n-1-i])
            f=1;
    }
    for(int i=0;i<n/2 && f==0;i++){
        if(s[i]!=s[n/2-i-1])
            f=1;
    }
    for(int i=(n+3)/2-1;i<n && f==0;i++)
    {
        if(s[i]!=s[n-1-i])
            f=1;
    }
    if(f==0)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
    return 0;
}

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

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            var str = Console.ReadLine().Split();
            var n = Int32.Parse(str[0]);
            var m = Int32.Parse(str[1]);
            var a = new List<int>();
            str = Console.ReadLine().Split();
            for (int i = 0; i < m; i++)
                a.Add(Int32.Parse(str[i]));

            var ret = Solver.Solve(n, m, a);
            if (ret == null) Console.WriteLine("Impossible");
            else
            {
                foreach (var v in ret.Item1)
                    Console.Write(v + " ");
                Console.WriteLine();
                Console.WriteLine(ret.Item2);
                foreach (var v in ret.Item3)
                    Console.Write(v + " ");
                Console.WriteLine();
            }
        }
    }

    public class Solver
    {
        public static Tuple<List<int>, int, List<int>> Solve(int n, int m, List<int> a)
        {
            if (a.Count(v => v % 2 == 1) > 2) return null;

            if (m == 1)
            {
                List<int> ret;
                if (a[0] > 2)
                    ret = new List<int>() { a[0] - 1, 1 };
                else
                    ret = a.ToList();
                return new Tuple<List<int>, int, List<int>>(a, ret.Count(), ret);
            }

            //move odd items to first and last
            if (a.Count(v => v % 2 == 1) > 0)
            {
                var fst = a.First(v => v % 2 == 1);
                a.Remove(fst);
                a.Insert(0, fst);
                var lst = a.Last(v => v % 2 == 1);
                var lstIdx = a.LastIndexOf(lst);
                a.RemoveAt(lstIdx);
                a.Add(lst);
            }

            var b = new List<int>() { a.Last() + 1 };
            for (int i = a.Count - 2; i > 0; i--)
            {
                b.Add(a[i]);
            }
            if (a[0] > 1) b.Add(a[0] - 1);
            b.Reverse();

            return new Tuple<List<int>, int, List<int>>(a, b.Count(), b);
        }
    }
}


Measured memory_bytes: 3032
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define range(i,a,n) for(ll i=(a);i<(n);i++)
#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI (3.1415926535897932384)

int dx[]={1,0,-1,0,1,-1,-1,1},dy[]={0,1,0,-1,1,1,-1,-1};
template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S sum(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
int sgn(const double&r){return (r>EPS)-(r<-EPS);} // a>0  : sgn(a)>0
int sgn(const double&a,const double&b){return sgn(a-b);} // b<=c : sgn(b,c)<=0

template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>void tf(bool b,S t,T f){if(b)puta(t);else puta(f);}
void YN(bool b){tf(b,"YES","NO");}
void Yn(bool b){tf(b,"Yes","No");}
void yn(bool b){tf(b,"yes","no");}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1;for(auto s:t){os<<(a?"":" ")<<s;a=0;}return os;}
template<class S>auto&operator>>(istream&is,vector<S>&t){for(S&a:t)cin>>a;return is;}

/*他のライブラリを入れる場所*/


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,m;
    cin>>n>>m;
    vl a(n);cin>>a;
    sort(all(a));
    vl b(m,0),c(m,0); ll t=0;
    rep(i,n){
        b[a[i]%m]++;
        if(i)if(a[i]==a[i-1]){
            t=1-t;
            if(t)c[a[i]%m]+=2;
        }else t=0;
    }
    // puta(b);
    // puta(c);
    ll ans=0;

    rep(i,m){
        ll p=(m-i)%m;
        if(i==p){
            ans += b[i]/2;
            b[i]=0;
        }else{
            ll d=min(b[i],b[p]);
            ans += d;
            b[i] -= d;
            b[p] -= d;
        }
    }
    // puta(b);
    rep(i,m)ans+=min(b[i],c[i])/2;
    puta(ans);
    return 0;
}

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

char get_grade(int m, int f, int r){
    int sum = m + f;
    char grade;
    if(m == -1 || f == -1){
        grade = 'F';
    }
    else if(80 <= sum){
        grade = 'A';
    } else if(65 <= sum && sum < 80){
        grade = 'B';
    } else if(50 <= sum && sum < 65){
        grade = 'C';
    } else if(30 <= sum && sum < 50){
        if(50 <= r) grade = 'C';
        else grade = 'D';
    } else if(sum < 30){
        grade = 'F';
    }
    
    return grade;
}


int main(){
    int m, f, r;
    
    while(1){
        std::cin >> m >> f >> r;
        if(m == -1 && f == -1 && r == -1) break;
        std::cout << get_grade(m, f, r) << std::endl;
    }
    return 0;
}


Measured memory_bytes: 3116
#include<algorithm>
#include<iostream>
#include<string>
#include<cstdlib>
#include<cstring>
#include<cmath>
using namespace std;
int gcd(int p,int q){
  int s;
  while(q){
    p%=q;
    s=p;
    p=q;
    q=s;
  }
  return p;
}
int main(){
  int i,j;
  int a,b,n;
  int ln;
  string s,t;
  cin>>n;
  getline(cin,s);
  for(i=0;i<n;i++){
    getline(cin,s);
    ln=s.length();
    for(a=1;a<26;a++){
      if(gcd(26,a)==1){
	for(b=0;b<26;b++){
	  t="";
	  for(j=0;j<ln;j++){
	    if('a'<=s[j]&&s[j]<='z')
	      t+=(a*(s[j]-'a')+b)%26+'a';
	    else
	      t+=s[j];
	  }
	  if(t.find("that")!=string::npos||t.find("this")!=string::npos)
	    break;
	}
	if(b!=26)
	  break;
      }
    }
    cout<<t<<endl;
  }
  return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <map>
#include <set>
#include <utility>
#include <numeric> 
#include <bits/stdc++.h>
typedef long long ll;
typedef std::pair<std::pair<int,int>,int>pi;
using namespace std;

int main() {
    int n; cin >> n;
    ll sum = 0;
    for(int i = 1; i <=n; i++){
        if(i % 3 == 0 && i % 5 == 0){
            continue;
        }
        else if(i % 3 == 0 && i % 5 != 0){
            continue;
        } else if(i % 5 == 0 && i % 3 != 0){
            continue;
        }
        else {
            sum += i;
        }
    }
    cout << sum << endl;
}




Measured memory_bytes: 3632
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

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


	ll N, A, B;
	cin >> N >> A >> B;

	if ((A + B) % 2 == 0) {
		co(abs((A + B) / 2 - A));
	}
	else {
		co(min(A + ((B - A - 1) / 2), N - B + ((B - A + 1) / 2)));
	}


	Would you please return 0;
}

Measured memory_bytes: 256
c[60000],j,n;main(i){for(i=2;i*i<5e4;i++)for(j=i;!c[i]&&j<5e4;c[j+=i]=1);for(;scanf("%d",&j),j;n=!printf("%d\n",n))for(i=1;++i<=j/2;n+=!(c[i]+c[j-i]));exit(0);}

Measured memory_bytes: 604
n, p = map(int, input().split())

pp = p
# 2のべき乗チェック
count_2 = 0
while True:
    if pp % 2 == 0:
        pp = pp / 2
        count_2 += 1
    else:
        break


result = 2 ** (count_2 // n)

p = p / (2 ** count_2)

kisu = True if p / 2 != 0 else False

num2 = int(p ** (1/n)) + 1
if kisu:
    num2 = num2 - 1 if num2 % 2 == 0 else num2
else:
    num2 = num2 - 1 if num2 % 2 != 0 else num2


for i in range(num2, 1, -2):
    if p % (i ** n) == 0:
        print(result * i)
        break

else:
    print(result * 1)

Measured memory_bytes: 3064
#include <set>
#include <array>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <queue>
#include <vector>
#include <tuple>
#include <string>
#include <math.h>
#include <time.h>
#include <bitset>
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <algorithm>
#include <limits>
#include <climits>
#include <numeric>
#include <functional>

#define lnd '\n'
// #define reverse(i, n) for(ll i = n-1; i >= 0; --i)
#define from(i, n) for (ll i = 0; i < n; ++i)
#define loop(i, n) for(ll i = 0; i < n; i++)
#define REPN(i, n) for (ll i = 1; i <= n; ++i)
#define ALL(s) (s).begin(), (s).end()
#define rALL(s) (s).rbegin(), (s).rend()
#define sz(s) (int)(s).size()
#define mk make_pair
#define pb push_back
#define sqr(s) ((s) * (s))

using namespace std;

typedef long long ll;
typedef long long int lli;
typedef long double ld;
typedef unsigned long long ull;
typedef unsigned int ui;

template <class T>
T GCD (T a, T b) {
  if(a == 0) return b;
  return GCD(b%a, a);
}

template <class T>
T LCM(T a, T b){
  return a*b/GCM(a,b);
}

template <class T>
T modpow(T x, T p){
    T res = 1;
    while(p > 0){
        if(p&1) res *= x;
        x *= x;
        p /= 2;
    }
    return res;
}

template <class T>
T modpow(T x, T p, ll mod){
    T res = 1;
    while(p > 0){
        if(p&1) res = (res*x)%mod;
        x = (x*x)%mod;
        p /= 2;
    }
    return res%mod;
}

template <class T>
void print(T a[], ll n){
    for (ll i = 0; i < n; i++) std::cout << a[i] << ' ';
    cout << endl;
}

template<class T>
void printc(T c){
    for(auto const& v: c) std::cout << v << ' ';
    cout << endl;
}

struct HASH{
  size_t operator()(const pair<long,long>&x)const{
    return hash<long long>()(((long long)x.first)^(((long long)x.second)<<32));
  }
};

bool pair_sort(const pair<int, int> &p1, const pair<int,int> &p2){
    if(p1.first != p2.first) return p1.first < p2.first;
    else return p1.second < p2.second;
}

const int INF = std::numeric_limits<int>::max();
const ll M_INF = std::numeric_limits<ll>::min();
const ll LL_INF = std::numeric_limits<ll>::max();

void solution();
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    solution();
    return 0;
}

void solution(){
  ll n;
  cin >> n;
  vector<int> a(n+1);
  loop(i, n-1){
    int tmp;
    cin >> tmp;
    a[tmp]++;
  }

  for(int i = 1; i <= n; i++){
    cout << a[i] << endl;
  }

  
}     



Measured memory_bytes: 3560
#include <bits/stdc++.h>
#define pb push_back
#define all(a) a.begin(), a.end()
#define sz(a) (int)a.size()
#define x first
#define y second
#define debug(...) cout<<"["<<#__VA_ARGS__<<": "<<__VA_ARGS__<<"]\n"
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int>pii;
const int maxn = 1e5 + 100;
const int mod = 1e9 + 7;
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
int n, W, w[maxn], v[maxn];
ll dp[maxn];
int main()
{
    ios_base::sync_with_stdio(false), cin.tie(0);
    cin >> n >> W;
    int sum = 0;
    for(int i = 1; i <= n; i++)
    {
        cin >> w[i] >> v[i];
        sum += v[i];
    }
    for(int i = 1; i <= sum; i++)
        dp[i] = (ll)1e18;
    dp[0] = 0;
    for(int i = 1; i <= n; i++)
        for(int c = sum; c >= v[i]; c--)
            dp[c] = min(dp[c], dp[c - v[i]] + w[i]);
    for(int i = sum; i >= 1; i--)
        if(dp[i] <= W) return cout << i << "\n", 0;
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for (ll i = m; i < n; i++)
#define IFOR(i, m, n) for (ll i = n - 1; i >= m; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define FOREACH(x, a) for (auto&(x) : (a))
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) ll(x.size())

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

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

int main() {
  // all - (divisivle by c or d)
  ll a, b, c, d;
  cin >> a >> b >> c >> d;

  auto calc = [&](ll m) { return m - (m / c + m / d - m / lcm(c, d)); };

  ll ans = calc(b) - calc(a - 1);
  cout << ans << endl;
}

Measured memory_bytes: 256
N,X,Y = map(int,input().split())
for k in range(1,N):
    s = 0
    for i in range(1,N-k+1):
        d = abs(i - X)
        if d <= k-1:
            front = Y + k -1 -d
            back = Y - k + 1+ d
            first = i + k
            if front == back:
                if first >= front :
                    s += 1
                else:
                    s += 2
            else:
                if back - i == k:
                    if front <= N:
                        s += 2
                    else:
                        s += 1
                elif back - i > k:
                    if front <= N:
                        s += 3
                    else:
                        s += 2
                else:
                    if first >= front:
                        s += 1
                    else :
                        if front <= N:
                            s += 1
                        c = abs(Y - first)
                        if d + c + 1 >= k:
                            s += 1


        else:
            s += 1
    print(s)

Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
typedef long long  ll;
#define FOR(i,a,n) for(ll i=(ll)a;i<(ll)n;i++)
#define RFOR(i,a,n) for(ll i=(ll)n-1;i >= (ll)a;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,0,n)
#define ALL(v) v.begin(), v.end()
#define bra(first,second) '(' << first << ',' << second << ')'
constexpr ll MOD = 1000000007;
//constexpr ll MOD = 998244353;
ll INF = 4001001001001001001;
long double EPS = 1e-9;
long double PI = 3.141592653589793238;
template<typename T>
void remove(std::vector<T>& vector, unsigned int index){
    vector.erase(vector.begin() + index);
}

using Graph = vector<vector<ll>>;

// MOD確認

int main(){
    string S;
    cin >> S;
    if(S[0] == '7' || S[1] == '7' || S[2] == '7'){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
typedef long long   signed int LL;
typedef long long unsigned int LU;
#define incID(i, l, r) for(LL i = (l)    ; i <  (r); ++i)
#define incII(i, l, r) for(LL i = (l)    ; i <= (r); ++i)
#define decID(i, l, r) for(LL i = (r) - 1; i >= (l); --i)
#define decII(i, l, r) for(LL i = (r)    ; i >= (l); --i)
#define inc(i, n)  incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define dec(i, n)  decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))
#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
template<typename T> bool setmin  (T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmax  (T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
LL mo(LL a, LL b) { assert(b > 0); a %= b; if(a < 0) { a += b; } return a; }
LL fl(LL a, LL b) { assert(b > 0); return (a > 0 ? a / b : (a - b + 1) / b); }
LL ce(LL a, LL b) { assert(b > 0); return (a < 0 ? a / b : (a + b - 1) / b); }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
#define bit(b, i) (((b) >> (i)) & 1)
#define BC __builtin_popcountll
#define SC static_cast
#define SI(v) SC<int>(v.size())
#define SL(v) SC<LL >(v.size())
#define RF(e, v) for(auto & e: v)
#define ef else if
#define UR assert(false)

// ---- ----

int n, d[100000];

int main() {
	cin >> n;
	inc(i, n) { cin >> d[i]; }
	sort(d, d + n);
	
	cout << d[n / 2] - d[n / 2 - 1] << endl;
	
	return 0;
}


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

using namespace std;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    set<int> s;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        int x;
        cin >> x;
        s.insert(x);
    }
    if (s.size() == n) cout << "YES\n";
    else cout << "NO\n";
    return 0;
}


Measured memory_bytes: 9600
import sys
import math
from collections import defaultdict, deque, Counter
from copy import deepcopy
from bisect import bisect, bisect_right, bisect_left
from heapq import heapify, heappop, heappush
    
input = sys.stdin.readline
def RD(): return input().rstrip()
def F(): return float(input().rstrip())
def I(): return int(input().rstrip())
def MI(): return map(int, input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int, input().split()))
def TI(): return tuple(map(int, input().split()))
def LF(): return list(map(float,input().split()))
def Init(H, W, num): return [[num for i in range(W)] for j in range(H)]
    
    
def main():
    a,b,x = MI()
    a2b = (a**2)*b
    a3 = (a**3)/2
    ab2 = a*(b**2)/2
    
    pai = math.pi/2
    low = 0
    high = math.pi/2
    mid = (low+high)/2
    
    while high - low > 0.0000000000001:
        if a * math.tan(pai-mid) < b:
            v = a2b - a3 * math.tan(pai-mid)
        else:
            v = ab2 * math.tan(mid)
        
        if v < x:
            low = mid
        else:
            high = mid
            
        mid = (low+high)/2

    print(90 - math.degrees(mid))

if __name__ == "__main__":
    main()

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

#define ll long long
#define ar array
 
using namespace std;

int main() {

    int a, b, t, res, i = 0;
    
    cin >> a >> b;
	
	if(a >= 13){
		cout << b << endl;
	}else if(a <= 5){
		cout << 0 << endl;
	}else{
		cout << b/2 << endl;
	}
	
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
char str1[4001], str2[4001];
int main() {
    while (scanf("%s%s",&str1,&str2)!=EOF) {
        int res=0;
        for (int off=-1*(int)strlen(str1); off<=(int)strlen(str2); off++) {
            int len=0;
            for (int i=max(off,0); i<min(strlen(str1)+off,strlen(str2)); i++) {
                if (str1[i-off]==str2[i]) {
                    len++;
                    res=max(res,len);
                } else {
                    len=0;
                }
            }
        }
        printf("%d\n",res);
    }
}

Measured memory_bytes: 772
import os
from math import gcd


def main():
        k = int(input())
        result = 0
        for i in range(1,k+1):
                for j in range(1,k+1):
                        t = gcd(i,j)
                        for l in range(1,k+1):
                                result += gcd(t,l)
        print(result)
    

if __name__ == "__main__":
    main()


Measured memory_bytes: 9176
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef long long ll;
const long long MOD=1e09+7;



#define rep(i,n) for(int i=0;i<n;i++)
#define rep2(i,m,n) for(int i=m;i<n;i++)
#define vi vector<int>


int main(){
  

  int k;
  string s;
  cin>>k>>s;
  
  if (int(s.size())<=k){
    cout<<s<<endl;
  }
  
  else {
    rep(i,k){
      cout<<s.at(i);
    }
    cout<<"..."<<endl;
  }
  
  

  
  
  
  
  
  
      
 

  
}

Measured memory_bytes: 3636
#include "bits/stdc++.h"
using namespace std;

#define ASC(vec) vec.begin(), vec.end()		// 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend()	// 降順ソート 例:sort(DESC(vec));
#define rep(i, n) for(int i = 0; i < n; i++)
#define Rep(i, n) for(int i = 1; i < n; i++)
#define In(vec) rep(i, n) cin>>vec[i];
#define ANS(s) cout << s << endl
#define inc(a, b) cin >> a >> b;

const int mod = 1000000007;
const int inf = (int)1e9 + 7;
const long long INF = 1LL << 60;

int main() {
	int m, f, b;
	cin >> m >> f >> b;

	if (b > m + f) cout << "NA" << endl;
	else {
		cout << max(b - m, 0) << endl;
	}
}


Measured memory_bytes: 3100
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin >> n;
    vector<int> c(101);
    for(int i = 0; i < 101; i++)
    {
        for(int j = 0; j <= 100/4; j++)
        {
            for(int k = 0; k <= 100/7; k++)
            {
                if(4*j + 7*k == i) c[i] = true;
            }
        }
    }
    if(c[n]) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define fi first
#define se second
#define mp make_pair
#define itrfor(itr,A) for(auto itr = A.begin(); itr !=A.end();itr++)
template <class T> using reversed_priority_queue = priority_queue<T, vector<T>, greater<T> >;
typedef long long llong;
char moji[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
char moji2[26]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
char moji3[10]={'0','1','2','3','4','5','6','7','8','9'};
#define Sort(a) sort(a.begin(),a.end());
#define Reverse(a) reverse(a.begin(),a.end());
#define print(a) cout << a << endl;
#define MOD llong(1e9+7)
#define MAX int(2 * 1e5 +5)
#define debug(x)  cout << #x << " = " << (x) << endl;
#define pi acos(-1.0)
#define int llong
#define INF llong(1e18 + 3)
template<class T> bool chmax(T &a,  T b) {if(a<b){a=b; return 1;} return 0;}
template<class T> bool chmin(T &a,  T b) {if(a>b){a=b; return 1;} return 0;}
bool Add(int &a,int b){a = (a + b) % MOD;}
void myprint(int* A,int A_num){
   REP(i,A_num) cout << A[i] << " ";
   cout << endl;
}

signed main(){
    int x;
    cin >> x;
    int cnt = 0;
    int amari = x % 100;
    REPR(i,5){
        if(i == 0) break;
        cnt += amari / i;
        amari %= i;
    }
    if(cnt * 100 <= x){
        cout << 1 << endl;
    }
    else{
        cout << 0 << endl;
    }
}

Measured memory_bytes: 256
#include <algorithm>
#include <bits/stdc++.h>
#include <cmath>
#include <cstdint>
#include <cstdlib>
#include <iostream>
#include <list>
#include <queue>
#include <set>
#include <string>
#include <vector>

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep_r(i, n) for (int i = n - 1; i >= 0; i--)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define all(x) (x).begin(), (x).end()
#define SZ(x) ((ll)(x).size())
#define bit(n) (1LL << (n))
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());

#define INF bit(60)
#define pb push_back
#define mod 1000000007

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

using namespace std;
using uif = uint_fast64_t;
using ll = long long int;

int qp(int a, ll b)
{
  int ans = 1;
  do
  {
    if (b & 1)
      ans = 1ll * ans * a % mod;
    a = 1ll * a * a % mod;
  } while (b >>= 1);
  return ans;
}
int qp(int a, ll b, int mo)
{
  int ans = 1;
  do
  {
    if (b & 1)
      ans = 1ll * ans * a % mo;
    a = 1ll * a * a % mo;
  } while (b >>= 1);
  return ans;
}

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

#define FACSIZE 2002

ll invfac[FACSIZE];
ll fac[FACSIZE];

ll mod_pow(ll, ll);
ll mod_add(ll, ll);
ll mod_mul(ll, ll);
ll mod_div(ll, ll);
void make_fact(ll);
void make_invfact(ll);

int main(void)
{

  ll n;
  cin >> n;
  vector<ll> a(n);
  rep(i, n) cin >> a[i];

  unordered_map<ll, ll> um;

  for (auto x : a)
  {
    if (um.find(x - 1) != end(um))
    {
      um[x] = um[x - 1];
    }
    else
    {
      um[x] = x;
    }
  }
  unordered_map<ll, ll> umCnt;
  for (auto p : um)
  {
    umCnt[p.second]++;
  }
  ll ans = n;
  for (auto p : umCnt)
  {
    ans = min(ans, n - p.second);
  }

  cout << ans << endl;

  return 0;
}

ll mod_pow(ll x, ll r)
{
  if (r == 0)
    return 1;
  else if (r == 1)
    return x % mod;
  else if (r % 2 == 0)
  {
    ll t = mod_pow(x, r / 2) % mod;
    return t * t % mod;
  }
  else
  {
    ll t = mod_pow(x, r / 2) % mod;
    ll k = t * t % mod;
    return k * x % mod;
  }
}
ll mod_add(ll a, ll b)
{
  return (a + b) % mod;
}

ll mod_mul(ll a, ll b)
{
  return (a * b) % mod;
}

ll mod_div(ll a, ll b)
{
  return mod_mul(a, mod_pow(b, mod - 2));
}

void make_fact(ll n)
{
  fac[0] = 1;
  rep(i, n)
  {
    fac[i + 1] = mod_mul(fac[i], i + 1);
  }
}

void make_invfact(ll n)
{
  invfac[n] = mod_pow(fac[n], mod - 2);
  for (int i = n - 1; i >= 0; i--)
  {
    invfac[i] = mod_mul(invfac[i + 1], i + 1);
  }
}


Measured memory_bytes: 18376
///Bismillahir Rahmanir Rahim
#include "bits/stdc++.h"

#define                           ll                          long long
#define                           int                         ll
#define                           fi                          first
#define                           si                          second
#define                           mp                          make_pair
#define                           pb                          push_back
#define                           pi                          pair<ll,ll>
#define                           clr(x)                      memset(x,0,sizeof(x));
#define                           f(i,l,r)                    for(int i=l;i<=r;i++)
#define                           rf(i,r,l)                   for(int i=r;i>=l;i--)
#define                           done(i)                     cout<<"done = "<<i<<endl;
#define                           show(x,y)                   cout<<x<<" : ";for(auto z:y)cout<<z<<" ";cout<<endl;
#define                           fast                        ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

using namespace std;

const ll inf=1e18;
const int mod=1e9+7;
const int M=1000005;
int cnt[M];
int a[200005];
 main()

{
    fast
    int n;
    cin>>n;
    f(i,1,n)
    {
        int x;
        cin>>x;a[i]=x;
        cnt[x]++;
    }
    int ses=0;
    f(i,1,n)
    {
        int x=a[i];
        int flag=0;
        for(int j=2;j*j<=x;j++)
        {
            if(x%j==0)
            {
               int d=j;
               if(cnt[d]>=1)flag=1;
               d=x/j;
               if(cnt[d]>=1)flag=1;
            }
        }
        if(cnt[x]>=2)flag=1;
        if(x!=1)
        {
            if(cnt[1]>=1)flag=1;
        }
        if(flag==0)ses++;

    }
    cout<<ses<<endl;
    return 0;

}





































Measured memory_bytes: 12912
#include<map>
#include<bitset>
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#include<stack>
#define REP(i,x,y) for(ll i=x;i<=y;i++)
typedef long long ll;
using namespace std;

ll const MAX = 100005;
map<pair<int , int>,int> map1, map2;
pair<int, int> black[MAX];
ll dx[9] = { 1,1,1,0,0,0,-1,-1,-1 };
ll dy[9] = { 1,0,-1,1,0,-1,1,0,-1 };
ll ans[10];

bool inner(pair<ll, ll> cur, ll h, ll  w) {
	return cur.first >= 2 && cur.first <= h-1 && cur.second >= 2 && cur.second <= w-1;
}

int main() {
	REP(i, 0, 9) ans[i] = 0;
	ll h, w, n;
	cin >> h >> w >> n;
	REP(i, 1, n) {
		int x, y;
		cin >> x >> y;
		black[i] = { x,y };
		map1[{x, y}] = 1;
	}
	REP(i, 1, n) {
		int x, y;
		x = black[i].first; y = black[i].second;
		REP(i, 0, 8) {
			pair<ll, ll> cur = { x + dx[i], y + dy[i] };
			if (map2[cur] == 0 && inner(cur, h, w)) {
				map2[cur] = 1;
				ll cnt = 0;
				REP(j, 0, 8) {
					pair<ll, ll> next = { cur.first + dx[j],cur.second + dy[j] };
					cnt += map1[next];
				}
				ans[cnt]++;
			}
		}
	}
	ans[0] = (h - 2)*(w - 2);
	REP(i, 1, 9) {
		ans[0] -= ans[i];
	}
	REP(i, 0, 9) {
		cout << ans[i] << endl;
	}
}


Measured memory_bytes: 213504
import math
total = 0
times = []
for i in range(5):
  times.append(int(input()))
  
d1 = 10
for i in range(5):
  total += math.ceil(times[i] / 10) * 10
  if times[i] % 10 != 0:
    d1 = min(d1, times[i] % 10)
  
print(total - 10 + d1)

Measured memory_bytes: 38384
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<functional>
#include<map>
#include<cstring>
#define P pair<int,int>//cost to
using namespace std;

vector<P>rinsetu[100];
int mincost[100];
signed main() {
	int a; cin >> a;
	for (int b = 0; b < a; b++) {
		int c, d; cin >> c >> d;
		for (int e = 0; e < d; e++) {
			int f, g; scanf("%d%d", &f, &g);
			rinsetu[c].push_back(P(g,f));
		}
	}
	fill(mincost, mincost + a, 1 << 29);
	mincost[0] = 0;
	priority_queue<P, vector<P>, greater<P>>Q;
	Q.push(P(0,0));
	while (Q.size()) {
		P t = Q.top(); Q.pop();
		if (t.first > mincost[t.second])continue;
		for (P i : rinsetu[t.second]) {
			if (mincost[i.second] > t.first + i.first) {
				mincost[i.second] = t.first + i.first;
				Q.push(P(t.first + i.first,i.second));
			}
		}
	}
	for (int i = 0; i < a; i++) {
		cout << i << " " << mincost[i] << endl;
	}
}

Measured memory_bytes: 3232
import java.util.Scanner;
public class Main{
    public static long gcd(long a, long b){
        if(a < b) {
            long tmp = a;
            a = b;
            b = tmp;
        }
        if(b==0) return a;
        return gcd(b,a%b);
    }
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        long a = sc.nextLong() - 1;
        long b = sc.nextLong();
        long c = sc.nextLong();
        long d = sc.nextLong();

        long lcm = c * d / gcd(c,d);
        long n = b - (b/c) - (b/d) + (b/lcm);
        long m = a - (a/c) - (a/d) + (a/lcm);

        System.out.println(n-m);
    }
}


Measured memory_bytes: 24404
# -*- coding: utf-8 -*-

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N, T = MAP()
A = LIST()

ans = T
for i in range(N-1, 0, -1):
    ans += min(T, A[i]-A[i-1])
print(ans)


Measured memory_bytes: 25708
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string> //文字列
#include <iomanip> //doubleの桁数指定 setprecision()
#include <list> //前後に数値を入れれる配列
#include <map> //map
#include <vector> //vecror

#define REP(i,m,n) for(ll i = (ll) (m);i < (ll) (n);i++) //forの短縮
#define rep(i,n) REP(i,0,n) //REPが0の時
#define ll long long int

using namespace std;

double PI = acos(-1); //円周率
ll mod = 1e9 + 7;


//提出コード
ll n, m, x, c[15], a[15][15], cnt[15], ans = 10000000000;
bool ans_J;

bool Judge() {
	bool J = true;
	rep(j, m) {
		if (cnt[j] < x) J = false;
	}
	return J;
}

void dfs(ll i, ll now) {
	if (i == n) {
		if (Judge()) {
			ans = min(now, ans);
			ans_J = true;
			return;
		}
		else return;
	}

	dfs(i + 1, now);

	rep(j, m) {
		cnt[j] += a[i][j];
	}

	dfs(i + 1 , now + c[i]);

	rep(j, m) {
		cnt[j] -= a[i][j];
	}
}




int main() {
	cin >> n >> m >> x;
	rep(i, n) {
		cin >> c[i];
		rep(j, m) {
			cin >> a[i][j];
		}
	}
	
	dfs(0, 0);
	if (ans_J) {
		cout << ans << endl;
	}
	else cout << -1 << endl;






	return 0;
}



Measured memory_bytes: 3636
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
using namespace std;
const int mod = 1e9 + 7;

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

    if(N[0]=='7'
    || N[1]=='7'
    || N[2]=='7'
    ) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 3628