akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef vector<pll> vpl;
typedef vector<vll> vvll;

#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define yes cout<<"Yes"<<endl
#define YES cout<<"YES"<<endl
#define no cout<<"No"<<endl
#define NO cout<<"NO"<<endl
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};


ll mpow(ll m, ll p){
  ll power = m;
  ll res = 1;
  if(p<0)
    return mpow(mpow(m,p*(-1)),MOD-2);

  while(p>0){
    if(p&1)
      res = res*power%MOD;
    power = (power*power)%MOD;
    p /= 2;
  }

  return res;
}

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  ll n;
  cin>>n;
  vll c(n);
  REP(i,n)cin>>c[i];
  sort(ALL(c), greater<ll>());

  ll sum=0;
  REP(i,n){
    sum=(sum+(i+2)*mpow(2,n-2)%MOD*c[i])%MOD;
  }
  cout<<sum*mpow(2,n)%MOD<<endl;
}



Measured memory_bytes: 1792
#include<stdio.h>
int main(void){
  int n,i,length=-1,max=0;
  int a[100000];
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
    if(i==0||a[i-1]>=a[i]){
      length++;
      if(length>max)
      max=length;
    }else{
      if(length>max)
      max=length;
      length=0;
    }

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


Measured memory_bytes: 512
n = int(input())
*h, = map(int, input().split())

h.insert(len(h), float("inf"))

ans = "Yes"
border = 1
for i in range(n):
    if h[i] > h[i+1]:
        _h = h[i] - 1
        if border > _h or _h > h[i+1]:
            ans = "No"
            break

        border = _h

print(ans)


Measured memory_bytes: 14396
#include <cstdio>

int main() {
	int n, q;
	int S[10010], T[510];
	int cnt = 0;

	scanf("%d", &n);
	for (int i = 0; i < n; ++i) scanf("%d", &S[i]);
	scanf("%d", &q);
	for (int i = 0; i < q; ++i) scanf("%d", &T[i]);

	for (int i = 0; i < q; ++i) {
		for (int j = 0; j < n; ++j) {
			if (T[i] == S[j]) {
				cnt++;
				break;
			}
		}
	}
	printf("%d\n", cnt);
}


Measured memory_bytes: 2712
package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	scanInit()

	n := nextInt()
	l := make([]string, n)

	for i := 0; i < n; i++ {
		s := nextStr()
		p := nextInt()
		l[i] = fmt.Sprintf("%s %03d %d", s, 101-p, i+1)
	}
	sort.Strings(l)
	for i := 0; i < n; i++ {
		a := strings.Split(l[i], " ")
		fmt.Println(a[2])
	}

}

// ---- readfunc
func scanInit() {
	const cap = 200 * 1024 // Default=64
	var buf = make([]byte, cap)
	sc.Buffer(buf, cap)
	sc.Split(bufio.ScanWords)
	return
}
func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}
func nextStr() string {
	sc.Scan()
	return sc.Text()
}


Measured memory_bytes: 1756
test = input().split()
n = int(test[0])
building = []
count2 = 0
for i in range(120):
    building.append(0)
for a in range(n):
    actual_room_no = 0
    count = 10 
    b, f, r, v = map(int, input().split())
    if b == 4:
        actual_room_no += 90
    elif b == 3:
        actual_room_no += 60
    elif b == 2:
        actual_room_no += 30
    if f == 3:
        actual_room_no += 20
    elif f == 2:
        actual_room_no += 10
    for j in range(10):
        if r == int(count):
            actual_room_no += count
            count -= 1
        else:
            count -= 1
    actual_room_no -= 1
    building[actual_room_no] += v
for g in range(3):
    for c in range(3):
        for d in range(10):
            print(' ',end='')
            if building[int(count2)] < 0:
                print(0,end='')
                count2 += 1
            else:
                print(int(building[int(count2)]),end='')
                count2 += 1
        print('')
    for e in range(20):
        print('#',end='')
    print('')
for h in range(3):
        for d in range(10):
            print(' ',end='')
            print(building[int(count2)],end='')
            count2 += 1
        print('')


Measured memory_bytes: 5652
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <limits>
#include <sstream>
#include <fstream>
#include <climits>
#include <map>
#include <numeric>
#include <functional>
#include <utility>

typedef long long ll;

int get_ups(int x) {
  int ret = 1;
  for (int i = 1; i <= x; i++) {
    ret *= i;
  }
  return ret;
}

int get_rank(std::vector<int> vec, int x) {
  std::sort(vec.begin(), vec.end(), std::less<int>());
  for (int i = 0; i < vec.size(); i++) {
    if (x == vec.at(i)) {
      return i;
    }
  }
  return -1;
}

int f(std::vector<int> vec) {
  int ret = 1;
  while (vec.size() > 0) {
    int rank = get_rank(vec, vec.at(0));
    int base = get_ups(vec.size() - 1);
    ret += rank * base;
    vec.erase(vec.begin());
  }
  return ret;
}

int main(void) {
  int n;
  std::cin >> n;
  std::vector<int> ps, qs;
  for (int i = 0; i < n; i++) {
    int p;
    std::cin >> p;
    ps.push_back(p);
  }
  for (int i = 0; i < n; i++) {
    int q;
    std::cin >> q;
    qs.push_back(q);
  }

  int rank_ps = f(ps);
  int rank_qs = f(qs);

  std::cout << std::abs(rank_ps - rank_qs) << std::endl;

  return 0;
}


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

int main()
{
   int n;
   cin>>n;
   vector<int>dp(3);
   for(int i=0;i<n;i++)
   {
       vector<int>new_dp(3);
       vector<int>a(3);
       for(int j=0;j<3;j++)
       cin>>a[j];
   
   for(int j=0;j<3;j++)
   {
       for(int k=0;k<3;k++)
       {
           if(j!=k)
           new_dp[j] = max(new_dp[j],dp[k]+a[j]);
       }
       
   }
   dp=new_dp;
   }
   cout<<max({dp[0],dp[1],dp[2]});
 
    
    return 0;
    
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define de(x) cout<<#x<<"="<<x<<endl
#define dd(x) cout<<#x<<"="<<x<<" "
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define repd(i,a,b) for(int i=a;i>=(b);--i)
#define repp(i,a,b,t) for(int i=a;i<(b);i+=t)
#define mt(a,b) memset(a,b,sizeof(a))
#define fi first
#define se second
#define mp(u,v) make_pair(u,v)
#define sz(a) (int)a.size()
#define pb push_back
#define PI acos(-1.0)
#define qc std::ios::sync_with_stdio(false)
#define all(a) a.begin(),a.end()
using namespace std;
typedef vector<int> vi;
typedef long long ll;
typedef double db;
typedef pair<ll,ll> pll;
typedef pair<ll,int> pli;
typedef pair<int,int> pii;
typedef pair<int,pii> piii;

const ll mod = 1000000007;
const int N = 1e5+6;
const int M = 2e6+6;
const double eps = 1e-6;
const int inf = 0x3f3f3f3f;

bool eq(const db &a, const db &b) { return fabs(a - b) < eps; }
bool ls(const db &a, const db &b) { return a + eps < b; }
bool le(const db &a, const db &b) { return eq(a, b) || ls(a, b); }
ll gcd(ll a,ll b) { return a==0?b:gcd(b%a,a); };
ll lcm(ll a,ll b) { return a/gcd(a,b)*b; }
ll kpow(ll a,ll b) {ll res=1;a%=mod; if(b<0) return 1; for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll read(){
    ll x=0,f=1;char ch=getchar();
    while (ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while (ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
//inv[1]=1;
//for(int i=2;i<=n;i++) inv[i]=(mod-mod/i)*inv[mod%i]%mod;
int n, k;
int cnt[N];
vi num;
ll dp[101][N], pre[N];
map<int, int> _map;
void init() {
	num.clear();
	mt(cnt, 0); mt(dp, 0); mt(pre, 0);
	_map.clear();
}
int main() {
	while(~scanf("%d%d",&n,&k)) {
		init();
		int pos = 1;
		// 整除分块
		while(pos <= n) {
			int r = n / (n / pos);
			// de(r);
			cnt[sz(num)] = r - pos + 1;
			num.pb(n / pos);
			pos = r + 1;
		}

		rep(i, 0, sz(num)) _map[num[i]] = i;
		// reverse(all(num));
		// reverse(cnt, cnt + sz(num));
		// rep(i, 0, sz(num)) dd(i), dd(num[i]), de(cnt[i]);
		// dp[i][j] 是第i位的数字以n / num[j]结尾
		rep(i, 0, sz(num)) {
			if(!i) dp[1][i] = cnt[i];
			else dp[1][i] = cnt[i] + dp[1][i-1];
		}
		rep(i, 2, k + 1) {
			rep(j, 0, sz(num)) {
				if(j) dp[i][j]  = dp[i][j-1] + dp[i-1][_map[n / num[j]]] * cnt[j];
				else dp[i][j] = dp[i-1][_map[n / num[j]]] * cnt[j];
				dp[i][j] %= mod;
			}
		}

		printf("%lld\n", dp[k][sz(num)-1]);
	}
    return 0;
}


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

namespace ABC
{
    class ABC174B
    {
        const string FILE = "/tmp/data.txt";

        static void Main(string[] args)
        {
#if DEBUG
            Console.SetIn(new StreamReader(FILE));
#endif
            var Ia = RIa(2);
            var N = Ia[0];
            var D = Ia[1];

            var XY = RIa(N, 2);

            long D2 = (long)D * D;

            int point = 0;
            for (int i = 0; i < N; ++i)
            {
                long dis = (long)XY[i, 0] * XY[i, 0] + (long)XY[i, 1] * XY[i, 1];
                if (dis <= D2)
                {
                    ++point;
                }
            }
            Console.WriteLine(point);



#if DEBUG
            Console.WriteLine("*** end ***");
            Console.SetIn(Console.In);
            Console.ReadKey();
            Console.WriteLine();
#endif
        }

        static int RI()
        {
            return int.Parse(Console.ReadLine());
        }

        static int[] RIa(int n)
        {
            string[] sa = Console.ReadLine().Split(' ');
            int[] la = new int[n];
            for (int i = 0; i < n; ++i)
            {
                la[i] = int.Parse(sa[i]);
            }
            return la;
        }

        static int[,] RIa(int r, int c)
        {
            int[,] la = new int[r, c];
            for (int i = 0; i < r; ++i)
            {
                string[] sa = Console.ReadLine().Split(' ');
                for (int j = 0; j < c; ++j)
                {
                    la[i, j] = int.Parse(sa[j]);
                }
            }
            return la;
        }

    }
}


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

Q = int(input())
for _ in range(Q):
    A, B = map(int, input().split())
    if A > B:
        A, B = B, A
    ans = (A - 1) * 2
    lb, ub = A, B
    while ub - lb > 1:
        m = (lb + ub) // 2
        x = (A+1+m) // 2
        if (m - A) % 2 == 0:
            if x*x >= A*B:
                ub = m
            else:
                lb = m
        else:
            if x*(x-1) >= A*B:
                ub = m
            else:
                lb = m
    ans += lb - A
    print(ans)


Measured memory_bytes: 39792
#pragma GCC optimize("O3")
#pragma GCC target("sse4")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const double PI=acos(-1.0);
#define t1(x)             cerr<<#x<<"="<<x<<endl
#define t2(x, y)          cerr<<#x<<"="<<x<<" "<<#y<<"="<<y<<endl
#define t3(x, y, z)       cerr<<#x<<"=" <<x<<" "<<#y<<"="<<y<<" "<<#z<<"="<<z<<endl
#define t4(a,b,c,d)       cerr<<#a<<"="<<a<<" "<<#b<<"="<<b<<" "<<#c<<"="<<c<<" "<<#d<<"="<<d<<endl
#define t5(a,b,c,d,e)     cerr<<#a<<"="<<a<<" "<<#b<<"="<<b<<" "<<#c<<"="<<c<<" "<<#d<<"="<<d<<" "<<#e<<"="<<e<<endl
#define t6(a,b,c,d,e,f)   cerr<<#a<<"="<<a<<" "<<#b<<"="<<b<<" "<<#c<<"="<<c<<" "<<#d<<"="<<d<<" "<<#e<<"="<<e<<" "<<#f<<"="<<f<<endl
#define GET_MACRO(_1,_2,_3,_4,_5,_6,NAME,...) NAME
#define t(...) GET_MACRO(__VA_ARGS__,t6,t5, t4, t3, t2, t1)(__VA_ARGS__)
//freopen("output.txt","w",stdout);
//freopen("input.txt","r",stdin);
/*-------------------------------------------------------------------------------------------------------------------------------------*/
#define MOD 1000000007
#define endl "\n" 
#define int long long // remove when constraints are tight.
#define inf 1e18
#define ld long double
/*-------------------------------------------------------------------------------------------------------------------------------------*/

int32_t main()
{
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int n;
	cin>>n;
	string s[n];int t[n];
	int sum=0;
	for(int i=0;i<n;i++)
	{
		cin>>s[i]>>t[i];
		sum+=t[i];
	}
	string tmp;
	cin>>tmp;
	int cur=0;
	for(int i=0;i<n;i++)
	{
		cur+=t[i];
		if(s[i]==tmp)
		{
			cout<<sum-cur<<endl;
			return 0;
		}
	}
	
}


Measured memory_bytes: 256
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

template<class T> inline T sqr(T x) {return x*x;}

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

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

#define CLR(a) memset((a), 0 ,sizeof(a))

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

/* 0-indexed only */
class SegmentTree{
private:
  int *stree;
  int n;
public:
  SegmentTree(int N);
  ~SegmentTree();
  void add(int i, int x);
  int getSum(int s, int t);
  int query(int s, int t, int k, int l, int r);
};

SegmentTree::SegmentTree(int N){
  int leading_zero = __builtin_clz(N);

  /* find nearest power of 2 for given N */
  if(__builtin_popcount(N) == 1) n = 1<<(sizeof(int)*8-leading_zero-1);
  else n = 1<<(sizeof(int)*8-leading_zero);

  /* initializing nodes as INF */
  stree = new int[2*n-1];
  for(int i=0;i<2*n-1;i++){
    stree[i] = 0;
  }

}

SegmentTree::~SegmentTree(){
  delete [] stree;
}

void SegmentTree::add(int i, int x){
  int j;

  /* deepest number of nodes */
  j = i + n - 1;
  stree[j] += x;

  while(j>0){
    /* number of upper node */
    j = (j-1)/2;
    stree[j] = stree[2*j+1] + stree[2*j+2];
  }
}

int SegmentTree::getSum(int s, int t){
  return query(s, t+1, 0, 0, n);
}

/* query gives the minimum of [s, t) */
int SegmentTree::query(int s, int t, int k, int l, int r){
  if(r <= s || t <= l) return 0;
  if(s <= l && r <= t) return stree[k];
  else{
    int vl = query(s, t, 2*k+1, l, (l+r)/2);
    int vr = query(s, t, 2*k+2, (l+r)/2, r);
    return vl+vr;
  }
}

int main(void){
  int n, q;
  cin >> n >> q;

  SegmentTree seg(n);

  for(int i=0;i<q;i++){
    int com, x, y;
    cin >> com >> x >> y;
    if(com == 0){
      x--;
      seg.add(x, y);
    }
    if(com == 1){
      x--;
      y--;
      cout << seg.getSum(x, y) << endl;
    }
  }

  return 0;
}

Measured memory_bytes: 2060
#include<stdio.h>

int main(){
  int i,k,j;
  while(1){
    int n,x,ans=0;

    scanf("%d %d", &n, &x);

    if(n+x == 0) break;

    for(i=n;i>x/3;--i){
      for(k=i-1;k>1;--k){
	for(j=k-1;j>0;--j){
	  if(i+k+j == x){
	    ++ans;
	  }
	}
      }
    }

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



Measured memory_bytes: 2032
from fractions import gcd
import itertools
import sys
input = sys.stdin.readline


#nの素数判定
def is_prime(n):
    if n == 1:
        return False
    for i in range(2,int(n**0.5)+1):
        if n % i == 0:
            return False
    return True


#nの約数列挙
def divisor(n):
    ass = []
    for i in range(1,int(n**0.5)+1):
        if n%i == 0:
            ass.append(i)
            if i**2 == n:
                continue
            ass.append(n//i)
    return ass


def coprime(a, b):
    return gcd(a, b) == 1


def main():
    A, B = map(int, input().split())
    # print(gcd(A, B))
    da = sorted(divisor(A))
    db = sorted(divisor(B))
    cd = []
    for i in da:
        if i in db:
            cd.append(i)

    # print(cd)
    li = []
    # c = itertools.combinations(cd, 2)
    for i in cd:
        if i == 1:
            li.append(i)
            continue

        flg = True
        for c in li:
            if not coprime(i, c):
                flg = False

        if flg:
            li.append(i)

    # print(li)
    print(len(li))


if __name__ == '__main__':
    main()


Measured memory_bytes: 67944
using System;
using CompLib.Util;

public class Program
{
    public void Solve()
    {
        var sc = new Scanner();
        int n = sc.NextInt();
        Console.WriteLine(n % 1000 == 0 ? 0 : 1000 - n % 1000);
    }

    public static void Main(string[] args) => new Program().Solve();
}

namespace CompLib.Util
{
    using System;
    using System.Linq;

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}

Measured memory_bytes: 27480
#![allow(unused, non_snake_case, dead_code, non_upper_case_globals)]
use {
    proconio::{marker::*, *},
    std::*,
    std::{cmp::*, collections::*, convert::*, iter::*, marker::*, mem::*, ops::*},
};
fn main() {
    input! {//
        s:Chars,
    }
    let n = s.len();
    for &x in &s {
        print!("{}", x);
    }
    if s[n - 1] == 's' {
        println!("{}", "es");
        return;
    }
    println!("{}", "s");
}
pub fn yn(ans: bool) {
    if ans {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 2136
s=input().split("T")
x,y=map(int,input().split())
a,b=[len(i)for i in s[0::2]],[len(i)for i in s[1::2]]
x-=a[0]
a,b=sorted(a[1:]),sorted(b)
while a:
 if x<0:x+=a.pop()
 else:x-=a.pop()
while b:
 if y<0:y+=b.pop()
 else:y-=b.pop()
print("YNeos"[x!=0 or y!=0::2])

Measured memory_bytes: 9372
#include <stdio.h>

int main(){
    int a,b,i;
    char op;
    
    for (i=0;;) {
    scanf("%d %c %d",&a,&op,&b);
    
    if (op=='+') {
        printf("%d\n",a+b);
    }
    else if(op=='-'){
        printf("%d\n",a-b);
    }
    else if(op=='*'){
        printf("%d\n",a*b);
    }
    else if(op=='/'){
        printf("%d\n",a/b);
    }
    else break;
    }
    return(0);
}

Measured memory_bytes: 600
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


n = int(input())
a = list(map(int, input().split()))
a.sort()
s = sum(a)
target = s//2 if s%2==0 else s//2+1
dp = 1
for i in range(1, n+1):
    dp = dp | (dp<<a[i-1])
ans = float("inf")
for i in range(target, s+1):
    if (dp>>i&1)==1:
        ans = min(ans, i)
        break
print(ans)

Measured memory_bytes: 219048
#include <stdio.h>
#include <math.h>
#include <stdlib.h>

double Manhattan(int n, int x[100], int y[100])
{
    double Man = 0.0;
    int i;
    for (i = 0; i < n; i++)
    {
        Man += (double)abs(x[i] - y[i]);
    }
    return Man;
}
double Euclid2(int n, int x[100], int y[100])
{
    double Euclid = 0.0;
    int i;
    for (i = 0; i < n; i++)
    {
        double ab_val = (double)abs(x[i] - y[i]);
        Euclid += pow(ab_val, 2.0);
    }
    return Euclid;
}
double Euclid3(int n, int x[100], int y[100])
{
    double Euclid = 0.0;
    int i;
    for (i = 0; i < n; i++)
    {
        double ab_val = (double)abs(x[i] - y[i]);
        Euclid += pow(ab_val, 3.0);
    }
    return Euclid;
}

double max(int n, double cheb[100])
{
    int i;
    double max = 0.0;
    for (i = 0; i < n; i++)
    {
        if (max < cheb[i])
        {
            max = cheb[i];
        }
    }
    return max;
}
double Chebyshev(int n, int x[100], int y[100])
{
    double Cheb[100];
    int i;
    for (i = 0; i < n; i++)
    {
        Cheb[i] = (double)abs(x[i] - y[i]);
    }
    return max(n, Cheb);
}
void minko(int n, int x[100], int y[100])
{
    printf("%lf\n", Manhattan(n, x, y));     //p = 1
    printf("%lf\n", sqrt(Euclid2(n, x, y))); //p = 2
    printf("%lf\n", cbrt(Euclid3(n, x, y))); //p = 3　要修正
    printf("%lf\n", Chebyshev(n, x, y));     //p = ∞
}

int main(void)
{
    int n, i;
    int x[100] = {0};
    int y[100] = {0};
    scanf("%d", &n);
    for (i = 0; i < n; i++)
    {
        scanf("%d", &x[i]);
    }
    for (i = 0; i < n; i++)
    {
        scanf("%d", &y[i]);
    }
    minko(n, x, y);

    return 0;
}



Measured memory_bytes: 2092
#include<cstdio>
#include<algorithm>
#define fo(i,a,b) for(i=a;i<=b;i++)
#define fd(i,a,b) for(i=a;i>=b;i--)
using namespace std;
const int maxn=500000+10;
int f[maxn],g[maxn],x[maxn];
int i,j,k,l,t,n,m,d;
int main(){
	scanf("%d%d",&n,&d);
	f[0]=d;
	fo(i,1,n){
		scanf("%d",&x[i]);
		t=x[i];
		if (f[i-1]>=t) f[i]=f[i-1]-t;
		else if (t<=2*f[i-1]) f[i]=t-f[i-1];
		else f[i]=f[i-1];
	}
	g[n+1]=0;
	fd(i,n,1){
		t=x[i];
		if (t<=2*g[i+1]+1) g[i]=g[i+1]+t;else g[i]=g[i+1];
	}
	scanf("%d",&m);
	while (m--){
		scanf("%d",&j);
		d=f[j-1];
		if (d>g[j+1]) printf("YES\n");else printf("NO\n");
	}
}

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

const int M=1005;
char s[M],t[M];

int main()
{
	scanf("%s%s",s,t);
	int n=strlen(s),m=strlen(t);
	int ans=m;
	for(int i=0;i+m<=n;i++)
	{
		int nans=0;
		for(int j=0;j<m;j++)
			nans+=(s[i+j]!=t[j]);
		ans=min(ans,nans);
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 3816
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for(int i=0; i<n; i++)
#define rep2(i, s, e) for(int i=s; i<e; i++)
#define repr(i, n) for(int i=n-1; i>=0; i--)

int v[100001] = {};

int main(){

    int n, k; cin >> n >> k;

    string s; cin >> s;

    // vector<int> v;
    int cnt = 1;
    int index = 0;
    rep2(i, 1, n){
        if(s[i] == s[i-1]){
            cnt++;
        }
        else{
            // v.push_back(cnt);
            v[index] = cnt;
            index++;
            cnt = 1;
        }

        if(i == n-1){
            // v.push_back(cnt);
            v[index] = cnt;
            index++;
        }
    }

    int m = index;

    rep(i, m){
        v[i]--;
    }

    cout << min(accumulate(v, v+m, 0LL) + 2LL*k, ll(n-1)); 


    return 0;
}

Measured memory_bytes: 896
#include <stdio.h>
#define N 2000000

int A[N+1], n;

int parent(int i){
  return i/2;
}

int left(int i){
  return 2*i;
}

int right(int i){
  return 2*i + 1;
}

void maxHeapify(int i){

  int l, r, largest, temp;

  l = left(i);
  r = right(i);
  if(l <= n && A[l] > A[i]) largest = l;
  else largest = i;
  if(r <= n && A[r] > A[largest]) largest = r;

  if(largest != i){
    temp = A[i];
    A[i] = A[largest];
    A[largest] = temp;
    maxHeapify(largest);
  }
  
}

int main(){

  int i;

  scanf("%d", &n);
  for(i=1; i<=n; i++){
    scanf("%d", &A[i]);
  }

  for(i=n/2; i>=1; i--){
    maxHeapify(i);
  }

  for(i=1; i<=n; i++){
    printf(" %d", A[i]);
  }
  printf("\n");
  
  return 0;
}

Measured memory_bytes: 2552
# -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from collections import deque
from functools import lru_cache
import bisect
import re
import queue
import copy
import decimal


class Scanner():
    @staticmethod
    def int():
        return int(sys.stdin.readline().rstrip())

    @staticmethod
    def string():
        return sys.stdin.readline().rstrip()

    @staticmethod
    def map_int():
        return [int(x) for x in Scanner.string().split()]

    @staticmethod
    def string_list(n):
        return [Scanner.string() for i in range(n)]

    @staticmethod
    def int_list_list(n):
        return [Scanner.map_int() for i in range(n)]

    @staticmethod
    def int_cols_list(n):
        return [Scanner.int() for i in range(n)]


def pop_count(x):
    x = x - ((x >> 1) & 0x5555555555555555)
    x = (x & 0x3333333333333333) + ((x >> 2) & 0x3333333333333333)
    x = (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0f
    x = x + (x >> 8)
    x = x + (x >> 16)
    x = x + (x >> 32)
    return x & 0x0000007f


def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)


def lcm(a, b):
    return (a * b) // gcd(a, b)


MOD = 10**9 + 7


def solve():
    N = Scanner.int()
    A = Scanner.map_int()
    l = 1
    for a in A:
        l = lcm(a, l)
    ans = 0
    for a in A:
        ans += l // a
    ans %= MOD
    print(ans)


def main():
    # sys.setrecursionlimit(1000000)
    # sys.stdin = open("sample.txt")
    # T = Scanner.int()
    # for _ in range(T):
    #     solve()
    # print('YNeos'[not solve()::2])
    solve()


if __name__ == "__main__":
    main()


Measured memory_bytes: 11624
#include <cstdio>
#include <algorithm>

using namespace std;

int count_digit(int x) {
  int cnt = 1;
  while (x >= 10) {
    cnt++;
    x /= 10;
  }
  return cnt;
}

int main() {
  int a, b;
  while (scanf("%d %d", &a, &b) == 2) {
    printf("%d\n", count_digit(a+b));
  }
  return 0;
}

Measured memory_bytes: 2732
n,m,k = gets.split.map(&:to_i)
a = gets.split.map(&:to_i)
b = gets.split.map(&:to_i)
c = a.clone
d = b.clone
for i in 1..(n-1)
  c[i] = c[i-1]+c[i]
end
c.unshift(0)
for j in 1..(m-1)
  d[j] = d[j-1]+d[j]
end
d.unshift(0)

upper = 400001
lower = 0
while upper - lower > 1
  mid = (upper+lower)/2
  judge = false
  for l in [0,mid-m].max..[mid,n].min
    if c[l]+d[mid-l] <= k
      judge = true
      break
    end
  end
  if judge
    lower = mid
  else
    upper = mid
  end
end
puts lower

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

  int ans = S.size();
  //(0 or 1)
  for (int i = 0; i < 2; i++)
  {
    int cnt = 0;
    rep(j, S.size())
    {
      // (char)(0 + '0') -> '0'
      // (char)(1 + '0') -> '1'
      if (j % 2 == 0 && S[j] != (char)(i + '0'))
      {
        cnt++;
      }
      if (j % 2 == 1 && S[j] == (char)(i + '0'))
      {
        cnt++;
      }
    }
    ans = min(ans, cnt);
  }
  cout << ans << endl;
  return 0;
}

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

#define EPS (1e-10)
#define equals(a,b) (fabs((a)-(b))<EPS)
//点を表す構造体
class Point {
  public:
  double x,y;
  Point(double x=0,double y=0): x(x),y(y){}

  //各種演算
  Point operator+ (Point p) { return Point(x+p.x,y+p.y); }
  Point operator- (Point p) { return Point(x-p.x,y-p.y); }
  Point operator* (double a) {return Point(a*x,a*y); }
  Point operator/ (double a) {return Point(x/a,y/a); }

  double abs() { return sqrt(norm()); }
  double norm() { return x*x+y*y; }

  bool operator< (const Point &p) const{
    return x!=p.x ? x<p.x : y<p.y;
  }

  bool operator> (const Point &p) const{
    return x!=p.x ? x>p.x : y>p.y;
  }

  bool operator== (const Point &p) const{
    return fabs(x-p.x)<EPS && fabs(y-p.y)<EPS;
  }
};

//ベクトルを表す構造体
typedef Point Vector;

//線分を表す構造体
struct Segment{
  Segment(Point p1 = Point(), Point p2 = Point()) : p1(p1), p2(p2) {}
  Point p1,p2;
};

//直線を表す構造体
typedef Segment Line;

//円を表すクラス
class Circle{
  public:
  //円の中心
  Point c;
  //半径
  double r;
  Circle(Point c=Point(),double r=0.0): c(c),r(r) {}
};

//多角形の表現
typedef vector<Point> Polygon;

//ベクトルaとbの内積
double dot(Vector a,Vector b){
  return a.x*b.x+a.y*b.y;
}

//ベクトルaとbの外積
double cross(Vector a,Vector b){
  return a.x*b.y-a.y*b.x;
}

//ベクトルaとbの直交判定
bool isOrthogonal(Vector a,Vector b){
  return equals(dot(a,b),0.0);
}
bool isOrthogonal(Point a1,Point a2,Point b1,Point b2){
  return isOrthogonal(a1-a2,b1-b2);
}
bool isOrthogonal(Segment s1,Segment s2){
  return equals(dot(s1.p2-s1.p1,s2.p2-s2.p1),0.0);
}

//ベクトルaとbの平行判定
bool isParallel(Vector a,Vector b){
  return equals(cross(a,b),0.0);
}
bool isParallel(Point a1,Point a2,Point b1,Point b2){
  return isParallel(a1-a2,b1-b2);
}
bool isParallel(Segment s1,Segment s2){
  return equals(cross(s1.p2-s1.p1,s2.p2-s2.p1),0.0);
}

//線分sに対する点pの射影
Point project(Segment s,Point p){
  Vector base=s.p2-s.p1;
  double r=dot(p-s.p1,base)/base.norm();
  return s.p1+base*r;
}

//線分sを対称軸とした点pの線対称の点
Point reflect(Segment s,Point p){
  return p+(project(s,p)-p)*2.0;
}

//線分s1と線分s2の交点(ダメらしい)
Point getCrossPoint(Segment s1,Segment s2){
  Vector base=s2.p2-s2.p1;
  double d1=abs(cross(base,s1.p1-s2.p1));
  double d2=abs(cross(base,s1.p2-s2.p1));
  double t=d1/(d1+d2);
  return s1.p1+(s1.p2-s1.p1)*t;
}


int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  int x1,x2,y1,y2;
  cin>>x1>>y1>>x2>>y2;
  int q;
  cin>>q;
  Point p1(x1,y1),p2(x2,y2);
  Line l(p1,p2);
  for(int i=0;i<q;i++){
    int x,y;
    cin>>x>>y;
    Point p(x,y);
    cout<<fixed<<setprecision(15)<<reflect(l,p).x<<' '<<reflect(l,p).y<<'\n';
  }

  return(0);
}


Measured memory_bytes: 3300
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)
#define vv(T) vector<vector<T>>
#define coa cout << ans << endl
using namespace std;
using ll = long long;
using vint = vector<int>;
using vvint = vector<vector<int>>;
using vll = vector<long long>;
using vvll = vector<vector<long long>>;
using vbool = vector<bool>;
using vvbool = vector<vector<bool>>;
using qint = queue<int>;
using sint = stack<int>;
using pii = pair<int, int>;


int main(){
    int n;
    cin >> n;
    vector<int> buka(n, 0);
    rep(i, n - 1){
        int tmp;
        cin >> tmp;
        tmp--;
        buka[tmp]++;
    }

    rep(i, n){
        cout << buka[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 4028
#include "bits/stdc++.h"
using namespace std;
#define repr(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repr(i,0,n)
#define reprrev(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define reprev(i,n) reprrev(i,0,n)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define mp make_pair
#define mt make_tuple
#define MOD 1000000007
#define PI 3.1415926535
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> Pi;
typedef pair<ll, ll> Pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<Pi> vPi;
typedef vector<Pll> vPll;
typedef vector<vector<int>> vvi;
typedef vector<vector<bool>> vvb;
typedef vector<vector<ll>> vvll;
typedef vector<vector<char>> vvc;
typedef vector<vector<string>> vvs;
typedef vector<vector<double>> vvd;
typedef vector<vector<Pi>> vvPi;
typedef priority_queue<int, vector<int>, greater<int>> pqli;
typedef priority_queue<ll, vector<ll>, greater<ll>> pqlll;
typedef priority_queue<Pi, vector<Pi>, greater<Pi>> pqlP;
string YN(bool y) { return (y?"YES":"NO"); }
string yn(bool y) { return (y?"Yes":"No"); }
string ON(bool y) { return (y?"OK":"NG"); }
long long Comb(int n, int r)
{
	//n, rが負またはn<rの時は失敗
	if(n<0||r<0||n<r) return 0;

	//nCr=nCn-r
	r=(n<n-r)?n:(n-r);

	//r=0,1の時は計算する必要がない
	if(r==0) return 1;
	if(r==1) return n;

	vector<int> numerator(r), denominator(r);

	for(int k=0; k<r; k++){
		numerator[k]=n-r+k+1;
		denominator[k]=k+1;
	}

	for(int p=2; p<=r; p++){
		int pivot=denominator[p-1];
		if(pivot>1){
			int offset=(n-r)%p;
			for(int k=p-1; k < r; k+=p){
				numerator[k-offset]/=pivot;
				denominator[k]/=pivot;
			}
		}
	}

	long long result=1;
	for(int k=0; k<r; k++){
		if(numerator[k]>1) result*=numerator[k];
	}
	return result;
}
int main(void)
{
	int n;

	cin>>n;

	vll a(n), sum(n+1, 0), count;

	rep(i, n){
		cin>>a[i];
		sum[i+1]=sum[i]+a[i];
	}
	sort(all(sum));

	int cnt=1;
	rep(i, n){
		if(sum[i+1]==sum[i]){
			cnt++;
		}else{
			count.push_back(cnt);
			cnt=1;
		}
	}
	count.push_back(cnt);
	

	ll ans=0;
	rep(i, count.size()){
		ans+=Comb(count[i], 2);
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 5492
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define pb push_back
#define srt(a) sort(a.begin(),a.end())
#define rsrt(a) sort(a.rbegin(),a.rend())
#define lb(a,b) lower_bound(a.begin(),a.end(),b)
#define ub(a,b) upper_bound(a.begin(),a.end(),b)
#define MOD ((int)( 1e9 + 7  ))
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long
#define float long double
#define sqrt sqrtl
#define cbrt cbrtl
#define endl '\n'
typedef vector<int> vi;
typedef vector<float> vf;
typedef pair<float,int> fi;
typedef pair<int,int> ii;
typedef pair<float,float> ff;
typedef vector<ff> vff;
typedef vector<ii> vii;
typedef vector<fi> vfi;
typedef vector<vi> vvi;
typedef vector<vf> vvf;
typedef vector<vii> vvii;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef priority_queue<int> pqi;
typedef priority_queue<ii> pqii;
typedef priority_queue<fi> pqfi;
typedef priority_queue <int, vector<int>, greater<int> > rpqi; 
typedef priority_queue <ii, vector<ii>, greater<ii> > rpqii; 
typedef priority_queue <fi, vector<fi>, greater<fi> > rpqfi;

const int N=2e5+5;
int par[N];
int root(int v){return par[v] < 0 ? v : (par[v] = root(par[v]));}
void merge(int x,int y){	
        if((x = root(x)) == (y = root(y)) )    return ;
	if(par[y] < par[x])	
		swap(x, y);
	par[x] += par[y];
	par[y] = x;
}

int32_t main()
{
	IOS
	string s1,s2;cin>>s1>>s2;
	int cnt=0;
	for(int i=0;i<3;i++)
	{
		cnt+=s1[i]==s2[i];
	}
	cout<<cnt<<endl;
	
	
		
	
}
 
 


Measured memory_bytes: 256
import sys
from collections import Counter

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N = int(readline())
    S = [readline().strip() for _ in range(N)]

    initials = set('MARCH')
    counter = Counter()
    for s in S:
        if s[0] in initials:
            counter[s[0]] += 1

    vec = list(counter.values())
    ans = 0
    for i in range(len(vec) - 2):
        for j in range(i + 1, len(vec) - 1):
            for k in range(j + 1, len(vec)):
                ans += vec[i] * vec[j] * vec[k]

    print(ans)
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 16560
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/trie_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef trie<string, null_type, trie_string_access_traits<>, pat_trie_tag, trie_prefix_search_node_update> pref_trie;
typedef unsigned long long BITMASK; typedef long long ll; typedef long double ld;
#define smallest_on_bit(bit_mask) (__builtin_ctzint((bit_mask) & (-(bit_mask))))
#define CLOCK_START clock_t chrono_clk_beg = clock()
#define CLOCK_END clock_t chrono_clk_end = clock(); cerr << (double(chrono_clk_end - chrono_clk_beg) / CLOCKS_PER_SEC) << " sec"
#define bug(args ...) cerr << __LINE__ << ">> ", err(new istringstream(string(#args)), args), cerr << '\n'
#define decToBin(name, num) string name = bitset<8>(num).to_string();
#define binToDec(name, binary) unsigned long name = bitset<8>(binary).to_ulong();
#define radToDeg(name, radians) double name = radians * 180 / M_PI;
#define all(x) x.begin(), x.end()
#define mapfind(mp, x) (mp.find(x) != mp.end())
#define arrfind(arr, x) (find(all(arr), x) != arr.end())
#define removeDuplicates(vec) sort(vec.begin(), vec.end()); vec.erase(unique(vec.begin(), vec.end()), vec.end())
#define printMat(mat) for (auto &x : mat) { for (auto &y : x) cout << y << " "; cout << '\n'; }
#define printArr(arr) for (auto &x : arr) cout << x << " "; cout << '\n';
#define int ll
#define double ld
#define INF 987654321
#define M_PI 3.14159265358979323846
void err(istringstream *iss) {} template<typename T, typename ... Args> void err(istringstream *iss, const T &_val, const Args & ... args) { string _name; *iss >> _name; if (_name.back()==',') _name.pop_back(); cerr << _name << " = " << _val << "; ", err(iss, args ...); }
void str_replaceAll(string& str, const string& from, const string& to) { if(from.empty()) return; size_t start_pos = 0; while((start_pos = str.find(from, start_pos)) != std::string::npos) { str.replace(start_pos, from.length(), to); start_pos += to.length(); } }
#define MOD 1000000007

signed main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    int n;
    cin >> n;
    vector<int> arr(n);
    for (auto &x : arr) cin >> x;
    bool flag = false;
    for (auto x : arr)
    {
        if (x&1) continue;
        if (x%3 == 0 || x%5 ==0) continue;
        else { flag = true; break; }
    }
    if (flag) cout << "DENIED\n";
    else cout << "APPROVED\n";
    return 0;
}

Measured memory_bytes: 256
/*
String[]の初期化、整数の型がlongになっているか
関数（splitとかcontainsとか）内では"+"とかは正規表現となされるので"\\+"とする
配列のコピーはarr1=arr.clone()
HashSet<>[]はおのおの初期化した？？？？？
負の数の割り算は絶対値が小さいほうに切り捨てられるex.-1/2=0ので、ある値>kみたいな式だとバグらせやすいので注意
ある値>=kとして、切り上げた値をとるべき
 */
import java.util.*;
import java.awt.*;
import java.awt.Graphics.*;
import static java.lang.System.*;
import static java.lang.Math.*;
public class Main {
    public static void main(String[] $) {
        Scanner sc = new Scanner(in);
        int[] ans = new int[1000000];
        while (sc.hasNext()) {
            String s = sc.nextLine();
            for (int i = 0; i < s.length(); i++) {
                ans[Character.toLowerCase(s.charAt(i))]++;
            }
        }
        for (int i = 'a'; i <= 'z'; i++) {
            out.println((char) i + " : " + ans[i]);
        }
    }
}


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

int main() {
    char A,B='Z',C='Z',D='Z',E;
    int N;
    cin >> N >> A;
    for (int i=0; i < N; i++) {
        cin >> E;
        if (E != A && B == 'Z') {
            B = E;
        }
        else if (E != A && E != B && C == 'Z') {
            C = E;
        }
        else if (E != A && E != B && E != C && D == 'Z') {
            D = E;
        }
    }
    if (D == 'Z') {
        cout << "Three" << endl;
    }
    else {
        cout << "Four" << endl;
    }
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		int ans=0;
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		
		if(n==0) {
			System.out.println(1);
		}
		else {
			System.out.println(0);
		}
		
	}
}


Measured memory_bytes: 35580
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
using ch=char;
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vP;
typedef vector<ch> vc;
typedef vector<vc> vvc;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
#define ROF(i,a,b) for(ll i=a;i>=b;i--)
#define per(i,a) ROF(i,a,0)
#define pb push_back
const ll MOD=1000000007;
const ll MOD2=998244353;
const ld PI=acos(-1);
const ll INF=1e18;
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
struct edge{ll to,cost;};
struct edge2{ll from,to,cost;};


int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin >> n;
    vector<bool> is_prime(n+1,true);
    vector<int> prime(n+1,0);
    is_prime[0]=is_prime[1]=false;
    rep(i,n+1){
        if(is_prime[i]){
            int k=2*i;
            while(k<=n){
                is_prime[k]=false;
                k+=i;
            }
        }
    }
    FOR(i,2,n+1){
        int k=i;
        FOR(j,2,sqrt(i)+1){
            while(is_prime[j]&&k%j==0){
                prime[j]++;
                k/=j;
            }
        }
        if(k!=1){
            prime[k]++;
        }
    }
    ll sf=0,tf=0,ff=0,f=0,t=0;
    rep(i,n+1){
      if(prime[i]>=74){
        sf++;
      }
      if(prime[i]>=24){
        tf++;
      }
      if(prime[i]>=14){
        ff++;
      }
      if(prime[i]>=4){
        f++;
      }
      if(prime[i]>=2){
        t++;
      }
    }
  cout << sf + tf*(t-1) + ff*(f-1) + f*(f-1)*(t-2)/2 << endl;
}

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

using namespace std;

#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

typedef int64_t ll; typedef vector<int> VI; typedef pair<int,int> pii;
const ll mod = 1e9+7;

int main()
{

	ll inf = 1LL<<50;
	int n;
	cin >>n;
	vector<vector<ll> > og(n, vector<ll>(n, inf));
	
	rep(i,n) rep(j,n) cin >>og[i][j];
	
	auto g = og;
	rep(i,n) g[i][i] =0;
	rep(k,n) rep(i,n) rep(j,n) g[i][j] =min(g[i][j], g[i][k] + g[k][j]);

	if(g != og){ puts("-1"); return 0;}
	
	vector<VI> ck(n,VI(n, 0));
	rep(k,n) rep(i,n) rep(j,n){
		if(g[i][j] == g[i][k] + g[k][j]) ck[i][j] += 1;
	}
	//rep(i,n){ rep(j,n) cout << ck[i][j] <<" "; puts("");}
	ll sm =0;
	rep(i,n) rep2(j,i+1,n) if(ck[i][j]==2) sm += g[i][j];
	
	cout << sm <<"\n";
	return 0;
}


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

#define ll long long
#define N 100005
#define mod 1000000007

ll ten[12],two[12];

void pre()
{
    ten[0]=1;two[0]=1;
    
    for(ll i=1;i<12;i++)
    {
        ten[i]=ten[i-1]*10;two[i]=two[i-1]*2;
    }
    
    
}
void f(string s,int n)
{
    ll i,ans=0,dig,j;
    
    for(i=0;i<n;i++)
    {
        dig=s[i]-'0';
        for(j=0;j<n-i;j++)
        {
            ans+=((dig*ten[j]*two[max(n-2-j-i,0ll)])*two[i]);
        }
    }
    
    cout<<ans<<endl;
    
}
int main() 
{
  pre();
  int n ;
  string s;
  cin>>s;
  n=s.length();
  f(s,n);
  
  return 0;
}

Measured memory_bytes: 256
n,m=map(int, input().split())
s=list(map(int, input().split()))
t=list(map(int, input().split()))
dp=[[0]*(n+1) for _ in range(m+1)]
for i in range(m+1):
    dp[i][0]=1
for i in range(n+1):
    dp[0][i]=1
for i in range(m):
    for j in range(n):
        if s[j]==t[i]:
            dp[i+1][j+1]=(dp[i][j+1]+dp[i+1][j])%(10**9+7)
        else:
            dp[i+1][j+1]=dp[i][j+1]+dp[i+1][j]-dp[i][j]
print(dp[-1][-1]%(10**9+7))

Measured memory_bytes: 330624
#include <stdio.h>
#include <stdlib.h>
#define LIMIT 10000

int main(void){
    int n, a, b, c, x, next, cnt;
    int i, j;
    int result[LIMIT];
    j = 0;
    while(1){
        scanf("%d %d %d %d %d", &n, &a, &b, &c, &x);
        if(n == 0){
            break;
        }
        int *y = (int *)malloc(n * sizeof(int));
        for(i = 0; i < n; i++){
            scanf("%d", &y[i]);
        }

        i = 0;
        cnt = 0;
        while(1){
            if(y[i] == x){
                i++;
            }
            if(i == n){
                break;
            }
            else if(cnt == LIMIT){
                cnt = -1;
                break;
            }
            x = (a * x + b) % c;
            cnt++;
        }

        result[j] = cnt;
        j++;
    }

    for(i = 0; i < j; i++){
        printf("%d\n", result[i]);
    }


    return 0;
}

Measured memory_bytes: 644
n = int(input())
from collections import deque
d = deque([0])
cnt = 0
while d[-1] <= n:
    x = d.popleft()
    for i in range(3,8,2):
        d.append(x * 10 + i)
        cnt += 1 if all(str(x * 10 + i).count(c)>0 for c in "753") else 0
ans=0
if d[-3] > n:
    for i in range(1,4):
        ans += 1 if all(str(d[-i]).count(c) > 0 for c in "753") else 0
    print(cnt - ans)
elif d[-2] > n:
    for i in range(1,2):
        ans += 1 if all(str(d[-i]).count(c) > 0 for c in "753") else 0
    print(cnt - ans)
elif d[-1] > n:
    if all (str(d[-1]).count(c) > 0 for c in "753"):
        print(cnt - 1)
    else:
        print(cnt)




Measured memory_bytes: 4060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 2019;

int main(void){
    ll l,r;
    cin >> l >> r;
    if (r-l > MOD) {
        cout << 0 << endl;
    } else {
        ll res = MOD;
        for (ll i = l; i < r; i++) {
            for (ll j = l+1; j <= r; j++) {
                res = min(res, (i*j)%MOD);
            }
        }
        cout << res << endl;
    }
    return 0;
}


Measured memory_bytes: 256
n, m = gets.to_s.split
n, m = n.to_i, m.to_i 

card_min = 1
card_max = n
 
m.times do
  l, r = gets.to_s.split
  l, r = l.to_i, r.to_i
  card_min = l if card_min < l
  card_max = r if card_max > r
  break if card_max - card_min + 1 < 0
end
 
ans = card_max - card_min + 1

puts ans > 0 ? ans : 0

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

int main() {
    string s1,s2;
    cin >> s1 >> s2;
    int s = 0;
    for(int i=0;i<s1.length();i++) {
        s += ((s1[i]-s2[i])?1:0);
    }
    cout << s << endl;
    return 0;
}

Measured memory_bytes: 3892
import sys
input = sys.stdin.readline
 
N,K = map(int,input().split())
h = [0] + list(map(int,input().split()))
 
dp = [None for _ in range(N+1)]
dp[1] = 0
 
for i in range(2,N+1):
    scope = min(i-1,K)
    jump = [dp[i-x] + abs(h[i]-h[i-x]) for x in range(1,scope+1)]
    dp[i] = min(jump)
    
print(dp[N])

Measured memory_bytes: 59428
#include <iostream>
#include <cstdio>
#include <set>
#include <list>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <string>
#include <sstream>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <cctype>
#include <cmath>
#include <fstream>
#include <iomanip>
//#include <unordered_map>
using namespace std;
#define dbg(x) cerr << #x " = " << x << endl;
typedef pair<int, int> P;
typedef long long ll;
const int MAXN = 1e5+5;
int a[MAXN];
int MIN[MAXN];
int MAX[MAXN];
int main()
{
   // freopen("in.txt", "r", stdin);
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n, t;
    cin >> n >> t;
    for(int i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    for(int i = 0; i < n; i++)
    {
        if(!i)
        {
            MIN[i] = a[i];
        }
        else
        {
            MIN[i] = min(MIN[i - 1], a[i]);
        }
        
    }
    for(int i = n -1 ;i  >= 0; i--)
    {
        if(i == n-1)
        {
            MAX[i] = a[i];
        }
        else
        {
            MAX[i] = max(MAX[i + 1], a[i]);
        }
        
    }
    int dis = -1;
    int ans = 0;
    for(int i = 0; i < n; i++)
    {
        dis = max(dis, MAX[i] - MIN[i]);
    }
    //dbg(dis);
    int maxx = -1, minn = -1;
    for(int i = 0; i < n; i++)
    {
        if(MAX[i] - MIN[i] == dis && maxx != MAX[i] && minn != MIN[i])
        {
            maxx = MAX[i];
            minn = MIN[i];
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 1408