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

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    N,M=MI()
    if N%2==1:
        a=1
        b=N
        for i in range(M):
            print(a,b)
            a+=1
            b-=1
    else:
        ans=[]
        a=1
        b=N//2
        for i in range(M):
            ans.append([a,b])
            a+=1
            b-=1
            if a>=b:
                break

            
        a=N//2+1
        b=N-1
        for i in range(M):
            ans.append([a,b])
            a+=1
            b-=1
            if a>=b:
                break
            
        for i in range(M):
            print(' '.join(map(str, ans[i])))
            
            
            
            
            
            
                    
            
            
        
        
    

main()


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

long long modpow (long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

long long modinv(long long a, long long mod) {
    return modpow(a, mod - 2, mod);
}


int main() {
	long long n;
	cin >> n;
	long long mod=1000000007;
	long long res=modpow(2,n,mod)-1;
	for(int i=0;i<2;i++){
		long long a;
		cin >> a;
		long long com=1;
		for(long long j=n;j>=n-a+1;j--){
			com=com*j%mod;
		}
		for(long long j=a;j>=1;j--){
			com=com*modinv(j,mod)%mod;
		}
		res-=com;
		if(res<0)res+=mod;
	}
	cout << res <<endl;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.ArrayList;
import java.util.List;
 
  
  
  
public class Main {
     
    private static List<String> base = new ArrayList<String>();
    private static int inningScore;
    private static List<Integer> finalScore = new ArrayList<Integer>();  
    public static void main(String[] args) {
         
        try {
            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
              
            String str;
            int round = Integer.parseInt(br.readLine());             
           
            for(int i = 0; i<round; i++)
            {
            
            	int out = 0;
                inningScore = 0;
                base.clear();
               
                while(out<3)
                {
                 
                str = br.readLine();
                
                if(str.equals("HIT"))
                {
                     
                    calHit();
                     
                }
                 
                if(str.equals("HOMERUN"))
                {
                     
                    calHomerun();
                     
                }
                 
                if(str.equals("OUT"))
                {
                    out++;
     
                }
                
            }
                finalScore.add(inningScore);
           }
             for(int i = 0; i<finalScore.size(); i++)
             {
            	 System.out.println(finalScore.get(i));
             }
            
        }catch (Exception e) {
            e.printStackTrace();
        }
         
    }
      
    private static void calHit() {
          
       if(base.size()==0 || base.size()==1 || base.size()==2)
       {
          base.add("Runner");
       }
        
       else if(base.size()==3)
       {
         inningScore++;
       }
        
    }
      
    private static void calHomerun() {
         
         inningScore = inningScore+base.size()+1;
         base.clear();
          
   }
}

Measured memory_bytes: 24184
#include<bits/stdc++.h>
using namespace std;
int main()
{
   int a,b,k,ans;
   cin>>a>>b;
   k=(a+b)/2;
   if(a%2==0 && b%2==0 || a%2!=0 && b%2!=0)
        cout<<k<<endl;
   else
        cout<<"IMPOSSIBLE"<<endl;


}


Measured memory_bytes: 256
from collections import deque
Q = deque()
n = int(input())

for _ in range(n):
    command = input()
    if command[0] =="0":
        if command[2] == "0":
            Q.appendleft(command[4:])
        else:
            Q.append(command[4:])
    
    elif command[0] == "1":
        print(Q[int(command[2:])])
    
    else:
        if command[2] =="0":
            Q.popleft()
        else:
            Q.pop()
        



Measured memory_bytes: 34576
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>

int main(){
    int n;
    std::cin >> n;
    std::vector<int> a(n);
    std::vector<int> b(n-1);
    for(int i=0; i<n-1; i++){
        std::cin >> b[i];
        a[i+1] = b[i];
    }
    a[0] = a[1];
    for(int i=0; i<n-1; i++){
        if(b[i] < a[i]) a[i] = b[i];
        if(b[i] < a[i+1]) a[i+1] = b[i];
    }
    int asum = std::accumulate(a.begin(), a.end(), 0);

    std::cout << asum << std::endl;
	return 0;
}

Measured memory_bytes: 256
# abc155_b.py
# https://atcoder.jp/contests/abc155/tasks/abc155_b

# B - Papers, Please /
# 実行時間制限: 2 sec / メモリ制限: 1024 MB
# 配点: 200点

# 問題文
# あなたは AtCoder 王国の入国審査官です。
# 入国者の書類にはいくつかの整数が書かれており、あなたの仕事はこれらが条件を満たすか判定することです。
# 規約では、次の条件を満たすとき、またその時に限り、入国を承認することになっています。
#     書類に書かれている整数のうち、偶数であるものは全て、3または 5で割り切れる。
# 上の規約に従うとき、書類に N個の整数 A1,A2,…,ANが書かれた入国者を承認するならば APPROVED を、しないならば DENIED を出力してください。

# 注記
#     問題文中の条件は、「xが書類に書かれている整数のうち、偶数であるものならば、x は 3 または 5で割り切れる。」 
#     と言い換えられます。 ここで、「または」 「ならば」 は論理学における意味です。

# 制約
#     入力はすべて整数
#     1≤N≤100
#     1≤Ai≤1000

# 入力
# 入力は以下の形式で標準入力から与えられる。
# N
# A1 A2 … AN

# 出力
# 規約に従うとき、入国者を承認するならば APPROVED を、しないならば DENIED を出力せよ。

# 入力例 1
# 5
# 6 7 9 10 31

# 出力例 1
# APPROVED

# 書類に書かれている整数のうち、偶数であるものは 6,10です。
# これらは全て 3または 5で割り切れるので、この入国者は承認します。

# 入力例 2
# 3
# 28 27 24

# 出力例 2
# DENIED

# 28が条件を満たさないので、この入国者は承認しません。


global FLAG_LOG
FLAG_LOG = False


def log(value):
    # FLAG_LOG = True
    # FLAG_LOG = False
    if FLAG_LOG:
        print(str(value))


def calculation(lines):
    # S = lines[0]
    N = int(lines[0])
    # N, M = list(map(int, lines[0].split()))
    values = list(map(int, lines[1].split()))
    # values = list(map(int, lines[2].split()))
    # values = list()
    # for i in range(N):
    #     values.append(int(lines[i]))
    # valueses = list()
    # for i in range(N):
    #     valueses.append(list(map(int, lines[i+1].split())))

    result = 'APPROVED'
    for n in range(N):
        if values[n] % 2 == 0:
            if values[n] % 3 != 0 and values[n] % 5 != 0:
                result = 'DENIED'

    return [result]


# 引数を取得
def get_input_lines(lines_count):
    lines = list()
    for _ in range(lines_count):
        lines.append(input())
    return lines


# テストデータ
def get_testdata(pattern):
    if pattern == 1:
        lines_input = ['5', '6 7 9 10 31']
        lines_export = ['APPROVED']
    if pattern == 2:
        lines_input = ['3', '28 27 24']
        lines_export = ['DENIED']
    return lines_input, lines_export


# 動作モード判別
def get_mode():
    import sys
    args = sys.argv
    global FLAG_LOG
    if len(args) == 1:
        mode = 0
        FLAG_LOG = False
    else:
        mode = int(args[1])
        FLAG_LOG = True
    return mode


# 主処理
def main():
    import time
    started = time.time()
    mode = get_mode()
    if mode == 0:
        lines_input = get_input_lines(2)
    else:
        lines_input, lines_export = get_testdata(mode)

    lines_result = calculation(lines_input)

    for line_result in lines_result:
        print(line_result)

    # if mode > 0:
    #     print(f'lines_input=[{lines_input}]')
    #     print(f'lines_export=[{lines_export}]')
    #     print(f'lines_result=[{lines_result}]')
    #     if lines_result == lines_export:
    #         print('OK')
    #     else:
    #         print('NG')
    # finished = time.time()
    # duration = finished - started
    # print(f'duration=[{duration}]')


# 起動処理
if __name__ == '__main__':
    main()


Measured memory_bytes: 9276
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <algorithm>
#include <utility>
using namespace std;
int main() {
	int N, K;
	int ans = 0;
	cin >> N >> K;
	vector<int> x(N);
	for (int i = 0; i < N; i++) {
		cin >> x.at(i);
		ans += 2*min(abs(K - x.at(i)), abs(x.at(i)));
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3596
#include <stdio.h>

int main(void){
	int n, i, j;
	while( scanf(" %d", &n) * n != 0){
		int f[15][15]={0};
		f[n/2+1][n/2]=1;
		int now=2, nx=n/2, ny=n/2+1;
		
		while(now<=n*n){
			if( f[(ny+1) % n][(nx+1) % n] == 0 ){
				nx = (nx+1)%n;
				ny = (ny+1)%n;
				f[ny][nx]=now;
				++now;
			}
			else{ 
				if(nx-1<0) nx=n-1;
				else --nx;
				
				ny = (ny+1)%n;
			}
		}
		
		for(i=0; i<n; i++){
			for(j=0; j<n; j++){
				printf("%4d", f[i][j]);
			}
			printf("\n");
		}
	
	}
	return 0;
}

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

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

const int N = 1<<19 ;
const ll inf = 1<<40;

int n , b , a[N];
ll ans[N];
pll dp[N];

bool cmp(int i,int j){ return a[i]<a[j]; }

pll join(pll A,pll B){
ll x[4]={ A.first,A.second,B.first,B.second };
sort(x,x+4,cmp);
return {x[3],x[2]};
}

int main(){

scanf("%d",&b);
n = 1<<b;
for(int i=0;i<n;i++)scanf("%d",a+i);
a[n]=-inf;

for(int i=0;i<n;i++)dp[i]={i,n};

for(int i=0;i<b;i++)
    for(int j=0;j<n;j++)
        if( !( j&( 1<<i ) ) ){
            int k = j|(1<<i);
            dp[k] = join( dp[k] , dp[j] );
        }

for(int i=0;i<n;i++)ans[i] = a[ dp[i].first ]+a[ dp[i].second ];
ans[0]=-inf;
for(int i=1;i<n;i++){
    ans[i]=max(ans[i],ans[i-1]);
    printf("%lld\n",ans[i]);
}

return 0;
}


Measured memory_bytes: 15360
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  int l[N], r[N];
  int sum = 0;
  for ( int i = 0; i < N; i++ ) {
    cin >> l[i] >> r[i];
   }
  for ( int i = 0; i < N; i++ ) {
    sum = sum + r[i] - l[i] + 1;
  }
  cout << sum;
}

Measured memory_bytes: 256
A = []
for _ in range(3):
    A.append(list(map(int, input().split())))

N = int(input())
for _ in range(N):
    b = int(input())
    for i in range(3):
        for j in range(3):
            if A[i][j] == b:
                A[i][j] = 0

for i in range(3):
    if sum(A[i]) == 0:
        print('Yes')
        exit()
    elif A[0][i]+A[1][i]+A[2][i]==0:
        print('Yes')
        exit()
if A[0][0]+A[1][1]+A[2][2] == 0:
    print('Yes')
    exit()
elif A[0][2]+A[1][1]+A[2][0] == 0:
    print('Yes')
    exit()

print('No')

Measured memory_bytes: 62096
#include<iostream>
#include<vector>
#include<algorithm>
#include<complex>
using namespace std;
static const double EPS = 1e-8;
static const double INF = 1e12;
typedef complex<double> P;
namespace std{
    bool operator < (const P& a, const P& b){
        return fabs(imag(a) - imag(b)) > EPS ? imag(a) < imag(b) : real(a) < real(b);
    }
}
double cross(const P& a, const P& b){
    return imag(conj(a) * b);
}
double dot(const P& a, const P& b){
    return real(conj(a) * b);
}
typedef vector<P> G;
 
int ccw(P a, P b, P c){
    b -= a; c -= a;
    if(cross(b, c) > EPS) return 1;
    if(cross(b, c) < -EPS) return -1;
    if(dot(b, c) < -EPS) return 2;
    if(norm(b) < norm(c)) return -2;
    return 0;
}
 
G convex_hull(G ps){
    int n = ps.size(), k = 0;
    sort(ps.begin(), ps.end());
    G ch(2 * n);
    for(int i = 0; i < n; ch[k++] = ps[i++]){
        while(k >= 2 && ccw(ch[k - 2], ch[k - 1], ps[i]) <= 0 && ccw(ch[k - 2], ch[k - 1], ps[i]) != -2) --k;
    }
    for(int i = n - 2, t = k + 1; i >= 0; ch[k++] = ps[i--]){
        while(k >= t && ccw(ch[k - 2], ch[k - 1], ps[i]) <= 0 && ccw(ch[k - 2], ch[k - 1], ps[i]) != -2) --k;
    }
    ch.resize(k - 1);
    return ch;
}
 
int main(){
    int n;
    G a;
    cin >> n;
    for(int i = 0; i < n; i++){
        double x, y;
        cin >> x >> y;
        complex<double> c(x, y);
        a.push_back(c);
    }
    G ans = convex_hull(a);
    cout << ans.size() << endl;
    for(int i = 0; i < ans.size(); i++){
        cout << ans[i].real() << " " << ans[i].imag() << endl;
    }
    return 0;
}


Measured memory_bytes: 9220
#include<stdio.h>
int main(){
	int a,i,t[10],at[10],bt[10],h[10],m[10],s[10],ah[10],am[10],as[10],bh[10],bm[10],bs[10];
	for(i=0;i<3;i++){
		scanf("%d%d%d%d%d%d",&h[i],&m[i],&s[i],&ah[i],&am[i],&as[i]);
		t[i]=h[i]*3600+m[i]*60+s[i];
		at[i]=ah[i]*3600+am[i]*60+as[i];
		bt[i]=at[i]-t[i];
		bh[i]=bt[i]/3600;
		bm[i]=bt[i]%3600/60;
		bs[i]=bt[i]%3600%60;
	}
	for(i=0;i<3;i++)printf("%d %d %d\n",bh[i],bm[i],bs[i]);
	return 0;
}


Measured memory_bytes: 2112
#include <iostream>
#include <string>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <cmath>
#include <array>
#include <queue>
#include <map>
#include <stack>
typedef long long int llint;

template<long long int MODVALUE> class modllint{
  typedef long long int llint;
  llint val;
  void mod(){
    while( this->val < 0 ) this->val += MODVALUE;
    this->val %= MODVALUE;
  }
  void assign(const llint val){
    this->val = val;
    mod();
  }
public:
  modllint(): val(0){};
  modllint(const llint val){assign(val);};
  
  modllint& operator+=(const llint val){
    this->assign(this->val + val);
    return *this;
  }
  modllint& operator+=(const modllint& obj){
    this->assign(this->val + obj.val);
    return *this;
  }
  modllint operator+(const llint val){return this += val;}
  modllint operator+(const modllint& obj){return this += obj;}
  
  modllint& operator*=(const llint val){
    this->assign(this->val * val);
    return *this;
  }
  modllint& operator*=(const modllint& obj){
    this->assign(this->val * obj.val);
    return *this;
  }
  modllint operator*(const llint val){return this *= val;}
  modllint operator*(const modllint& obj){return this *= obj;}

  modllint& operator=(const modllint& obj){
    assign(obj.val);
    return *this;
  }
  modllint& operator=(const llint intvalue){
    assign(intvalue);
    return *this;
  }
  
  friend std::ostream& operator<<(std::ostream& os, const modllint<MODVALUE>& val){
    os << val.val;
    return os;
  }
  friend std::istream& operator>>(std::istream& is, modllint<MODVALUE>& val){
    is >> val.val;
    return is;
  }
};



int main(void){

  int n;
  std::cin >> n;
  std::vector<int> A(n);

  modllint<1000000007> ret = 1;
  std::vector<int> counter(n, 0);
  for(int i=0; i<n; i++){
    std::cin >> A[i];
    counter[A[i]]++;

    if(A[i]==0) continue;
    ret *= (counter[A[i]-1] - counter[A[i]] + 1);
  }
  if(counter[0]==1)     ret *= 3;
  else if(counter[0]>3) ret = 0;
  else                  ret *= 6;

  std::cout << ret << std::endl;

  
  return 0;
}


Measured memory_bytes: 1024
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def LS(): return list(map(list, input().split()))
def S(): return list(input().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#solve
def solve():
    k, x = LI()
    if k * 500 >= x:
        print("Yes")
    else:
        print("No")
    return


#main
if __name__ == '__main__':
    solve()


Measured memory_bytes: 38768
import java.util.Scanner;

class Main
{

    public static void main(String args[])
    {
        Scanner scan = new Scanner(System.in);
        int N = scan.nextInt();
        int A[] = new int[N];
        for (int k = 0; k < N; k++) {
            A[k] = scan.nextInt();
        }
        for (int i = 0; i < N; i++) {
            int v = A[i];
            int j = i - 1;
            while (j >= 0 && A[j] > v) {
                A[j + 1] = A[j];
                j--;
            }
            A[j + 1] = v;
            for (int h = 0; h < N; h++) {
                if (h == N - 1) {
                    System.out.println(A[h]);
                } else {
                    System.out.print(A[h] + " ");
                }
            }
        }
    }
}



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

int main(void){
    int A,B,C;
    cin >> A >> B >> C;

    if( (C-(A-B)) < 0 ){
        cout << 0 <<endl;
    }else{
        cout << C-(A-B) <<endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <vector>
#include <queue>
#include <algorithm>

using namespace std;

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

ll mod = 1e9 + 7;

int main(){
	ll a,b,k;
	cin >> a >> b >> k;
	ll m = min(a,k);
	cout << a - m << " ";
	k -= m;
	cout << max(0ll,b-k) << endl;
	return 0;
}


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

namespace ITP2_9_D
{
    public class Program

    {
        public static void Main(string[] args)
        {
            int n = ReadInt();
            int[] a = ReadIntAr();
            int m = ReadInt();
            int[] b = ReadIntAr();
            a = a.Union(b).Except(a.Intersect(b)).ToArray();
            Array.Sort(a);
            foreach (var item in a) Console.WriteLine(item);
        }

        static string ReadSt() { return Console.ReadLine(); }
        static int ReadInt() { return int.Parse(Console.ReadLine()); }
        static long ReadLong() { return long.Parse(Console.ReadLine()); }
        static double ReadDouble() { return double.Parse(Console.ReadLine()); }
        static string[] ReadStAr(char sep = ' ') { return Console.ReadLine().Split(sep); }
        static int[] ReadIntAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => int.Parse(e)); }
        static long[] ReadLongAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => long.Parse(e)); }
        static double[] ReadDoubleAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => double.Parse(e)); }
        static string WriteAr(int[] array, string sep = " ") { return String.Join(sep, array.Select(x => x.ToString()).ToArray()); }
        static string WriteAr(double[] array, string sep = " ") { return String.Join(sep, array.Select(x => x.ToString()).ToArray()); }
        static string WriteAr(long[] array, string sep = " ") { return String.Join(sep, array.Select(x => x.ToString()).ToArray()); }

    }

}



Measured memory_bytes: 68200
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <bitset>
#include <climits>
#define REP(i,n) for (int i=0;i<(n);i++)
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define RFOR(i,a,b) for (int i=(a)-1;i>=(b);i--)
#define ll long long
#define ull unsigned long long
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const int INF = 1e9;
const int MOD = 1e9 + 7;

using namespace std;

//[p,r)
int partition(vector<int>& A,int p,int r){
	int x = A[r-1];//partition
	int i = p-1;
	REP(j,r){
		if(A[j] <= x)	swap(A[j],A[++i]);
	}
	return i;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
	int n;cin>>n;
	vector<int> A(n);REP(i,n)cin>>A[i];
	int standard =  partition(A,0,n);
	REP(i,n){
		if(i)cout << ' ';
		if(standard == i)cout << '[';
		cout << A[i];
		if(standard == i)cout << ']';
	}
	cout << endl;
  return 0;
}

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

using namespace std;

int main(int argc, const char *argv[]) {
  int n;
  cin >> n;
  vector<int> vp(n);
  for (int i = 0; i < n; ++i) {
    cin >> vp[i];
  }

  sort(vp.begin(), vp.end(), greater<int>());
  vp[0] = vp[0] / 2;
  int ans = accumulate(vp.begin(), vp.end(), 0);
  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 3544
#include <bits/stdc++.h>
#define LLI long long int
#define FOR(v, a, b) for(LLI v = (a); v < (b); ++v)
#define FORE(v, a, b) for(LLI v = (a); v <= (b); ++v)
#define REP(v, n) FOR(v, 0, n)
#define REPE(v, n) FORE(v, 0, n)
#define REV(v, a, b) for(LLI v = (a); v >= (b); --v)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define ITR(it, c) for(auto it = (c).begin(); it != (c).end(); ++it)
#define RITR(it, c) for(auto it = (c).rbegin(); it != (c).rend(); ++it)
#define EXIST(c,x) ((c).find(x) != (c).end())
#define fst first
#define snd second
#define popcount __builtin_popcount
#define UNIQ(v) (v).erase(unique(ALL(v)), (v).end())
#define bit(i) (1LL<<(i))

#ifdef DEBUG
#include <misc/C++/Debug.cpp>
#else
#define dump(...) ((void)0)
#endif

#define gcd __gcd

using namespace std;
template <class T> constexpr T lcm(T m, T n){return m/gcd(m,n)*n;}

template <typename I> void join(ostream &ost, I s, I t, string d=" "){for(auto i=s; i!=t; ++i){if(i!=s)ost<<d; ost<<*i;}ost<<endl;}
template <typename T> istream& operator>>(istream &is, vector<T> &v){for(auto &a : v) is >> a; return is;}

template <typename T, typename U> bool chmin(T &a, const U &b){return (a>b ? a=b, true : false);}
template <typename T, typename U> bool chmax(T &a, const U &b){return (a<b ? a=b, true : false);}
template <typename T, size_t N, typename U> void fill_array(T (&a)[N], const U &v){fill((U*)a, (U*)(a+N), v);}

struct Init{
  Init(){
    cin.tie(0);
    ios::sync_with_stdio(false);
  }
}init;

int main(){
  int n;
  while(cin >> n){
    double ans = 0;

    FORE(i,1,n) if(i%2) ++ans;

    ans /= n;

    cout << fixed << setprecision(12) << ans << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
#include <set>
#include <map>
#include <bitset>
using namespace std;
int main() {
    int n;
    int a[15];
    int x[15][15], y[15][15];
    bool ho[15], co = false;
    int max = 0, ans = 0;
    cin >> n;
    for (int b = 0; b < n; b++) {
        cin >> a[b];
        for (int c = 0; c < a[b]; c++) {
            cin >> x[b][c] >> y[b][c];
            x[b][c]--;
        }
    }
    for (int bit = 0; bit < (1 << n); bit++) {
        for (int i = 0; i < n; i++) {
            if (bit & (1 << i)) { 
                ho[i] = 1;
            }
            else {
                ho[i] = 0;
            }
        }
        for (int j = 0; j < n; j++) {
            if (ho[j] == 1) {
                ans++;
                for (int k = 0; k < a[j]; k++) {
                    if (ho[x[j][k]] != y[j][k]) {
                        co = true;
                    }
                }
            }
        }
        if (max < ans && co == false) {
            max = ans;
        }
        ans = 0;
        co = false;
    }
    cout << max << endl;
}

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

using namespace std;
typedef long long ll;
#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 FORR(i, m, n) for(int i = m; i >= n; i--)
#define INF (ll)2e9
#define MOD ((ll)1e9+7)
#define ALL(v) v.begin(), v.end()
#define SZ(x) ((int)(x).size())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev
#define bit(n) (1LL<<(n))

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

template<class InputIterator>
InputIterator adv(InputIterator x, typename std::iterator_traits<InputIterator>::difference_type n) {
    advance(x, n);
    return x;
}

class mod {
    static ll fact[];
public:

    template<class... A>
    static ll mul(A... args) {
        ll res = 1;
        for (ll i : std::initializer_list < ll > {args...}) {
            res = (res * i) % MOD;
        }
        return res;
    }

    static ll power(ll base, ll exp) {
        if (exp == 0) return 1;
        if (exp & 1) {
            return mul(base, power(base, exp - 1));
        } else {
            ll p = power(base, exp / 2);
            return mul(p, p);
        }
    }

    static ll factorial(int n) {
        if (fact[n] != 0) return fact[n];
        if (n == 0) return 1;
        return fact[n] = mul(n, factorial(n - 1));
    }

    static ll inverse(int n) {
        return power(n, MOD - 2);
    }

    static ll comb(int n, int r) {
        if (r < 0 || r > n) return 0;
        return mul(factorial(n), inverse(factorial(n - r)), inverse(factorial(r)));
    }

    template<class... A>
    static ll div(ll dividend, A... args) {
        ll res = dividend;
        for (ll i : std::initializer_list < ll > {args...}) {
            res = mul(res, inverse(i));
        }
        return res;
    }

    template<class... A>
    static ll add(A... args) {
        ll res = 0;
        for (ll i : std::initializer_list < ll > {args...}) {
            res = (res * i) % MOD;
        }
        return res;
    }

    template<class... A>
    static ll sub(ll l, A... args) {
        ll res = l;
        for (ll i : std::initializer_list < ll > {args...}) {
            res = (res - i + MOD) % MOD;
        }
        return res;
    }
};

ll mod::fact[(int) 1e6 + 1];

int ni() {
    int i;
    cin >> i;
    return i;
}

ll nll() {
    ll l;
    cin >> l;
    return l;
}

int main() {
    ll N = nll(), M = nll();

    ll ans = min(N, M/2);
    M -= ans*2;

    if (M > 0) {
        ans += M / 4;
    }

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

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
from itertools import product


def solve(H, W, K, C):
    cnt = 0
    L1 = list(product([True, False], repeat=H))
    L2 = list(product([True, False], repeat=W))
    for l1 in L1:
        for l2 in L2:
            num = 0
            for i in range(H):
                if not l1[i]:
                    continue
                for j in range(W):
                    if not l2[j]:
                        continue
                    num += C[i][j]
            if num == K:
                cnt += 1
    print(cnt)
    return

# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    # Failed to predict input format
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    H = int(next(tokens))
    W = int(next(tokens))
    K = int(next(tokens))
    C = [[0 for _ in range(W)] for _ in range(H)]
    for i in range(H):
        col = next(tokens)
        for j in range(W):
            C[i][j] = 1 if col[j] == "#" else 0
    solve(H, W, K, C)

if __name__ == '__main__':
    main()

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



Measured memory_bytes: 2032
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		System.out.println(a * b);

	}

}


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

int main()
{
    int a, b, x[100];
    cin >> a >> b;

    x[0] = a + b;
    x[1] = a - b;
    x[2] = a * b;

    int i, maxx = x[0];
    for(i = 1; i < 3; i++)
    {
        if(x[i] > maxx)
        {
            maxx = x[i];
        }
    }
    cout << maxx;
    return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <array>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;
mt19937 mrand(random_device{}());
int rnd(int x) { return mrand() % x; }

const int N = 1e5 + 10;
char s[N];

struct segment_tree {
  struct node;
  using iter = vector<node>::iterator;

  struct node {
    int a, b;
    iter left, right;
    ii best;
    void pushup() {
      best = min(left->best, right->best);
    }
  };

  vector<node> pool;
  iter last, root;

  iter _build(int a, int b) {
    iter cur = last++;
    cur->a = a;
    cur->b = b;
    cur->best = {INF, INF};
    if (a + 1 == b) return cur;
    cur->left = _build(a, (a + b) / 2);
    cur->right = _build((a + b) / 2, b);
    return cur;
  }

  void init(int n) {
    pool.resize(n * 2);
    last = pool.begin();
    root = _build(0, n);
  }

  void insert(iter cur, int pos, int val) {
    if (cur->a + 1 == cur->b) {
      cur->best = {val, cur->a};
      return;
    }
    if ((cur->a + cur->b) / 2 > pos) {
      insert(cur->left, pos, val);
    } else {
      insert(cur->right, pos, val);
    }
    cur->pushup();
  }

  ii query(iter cur, ii range) {
    if (cur->a >= range.first && cur->b <= range.second) {
      return cur->best;
    }
    ii ret = {INF, INF};
    if ((cur->a + cur->b) / 2 > range.first) {
      ret = min(ret, query(cur->left, range));
    }
    if ((cur->a + cur->b) / 2 < range.second) {
      ret = min(ret, query(cur->right, range));
    }
    return ret;
  }
};

int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  scanf("%s", s);
  segment_tree st;
  st.init(n + 1);
  vector<int> dp(n + 1, -1), nxt(n + 1);
  dp[n] = 0;
  st.insert(st.root, n, dp[n]);
  for (int i = n - 1; i >= 0; --i) {
    if (s[i] == '1') continue;
    int L = i + 1, R = min(i + m, n) + 1;
    auto cur = st.query(st.root, {L, R});
    if (cur.first != INF) {
      dp[i] = cur.first + 1;
      nxt[i] = cur.second;
      st.insert(st.root, i, dp[i]);
    }
  }
  if (dp[0] < 0) {
    puts("-1");
  } else {
    bool first = true;
    for (int i = 0; i != n; i = nxt[i]) {
      if (first) {
        first = false;
      } else {
        putchar(' ');
      }
      printf("%d", nxt[i] - i);
    }
    puts("");
  }
  return 0;
}


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

int main(){
 string s;
 cin >> s;
 if(s[0] == s[1] && s[1] != s[2] && s[2] == s[3]){
     cout << "Yes" << endl;
 }
 else if(s[0] == s[2] && s[0] != s[1] && s[1] == s[3]){
     cout << "Yes" << endl;
 }
 else if (s[0] == s[3] && s[0] != s[1] && s[1] == s[2]){
     cout << "Yes" << endl;
 }
 else{
     cout << "No" << endl;
 }
 

}

Measured memory_bytes: 256
n, k = map(int, input().split())
A = list(map(int, input().split()))

B = []
for i in range(n):
    B.append(A[i])
    s = A[i]
    for j in range(i+1, n):
        s += A[j]
        B.append(s)
        
res = 0
for i in range(42):
    p = res + 2**(41-i)
    cnt = 0
    for b in B:
        if p == p&b:
            cnt += 1
    if cnt >= k:
        res = p
print(res)

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

const int V = 100005;
vector<int> to[V*2];
bool visited[V*2];

vector<int> cnt;
void dfs(int v) {
  if (visited[v]) return;
  visited[v] = true;
  cnt[v/V]++;
  for (int u : to[v]) dfs(u);
}

int main() {
  int n;
  cin >> n;
  rep(i,n) {
    int x, y;
    cin >> x >> y;
    y += V;
    to[x].push_back(y);
    to[y].push_back(x);
  }
  ll ans = 0;
  rep(i,V*2) {
    if (visited[i]) continue;
    cnt = vector<int>(2);
    dfs(i);
    ans += (ll)cnt[0]*cnt[1];
  }
  ans -= n;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 10240
#include<iostream>
#include<string>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<queue>
#include<stack>
#include<map>
using namespace std;
#define ll long long
int main(){
    ll N,M,X;
    cin >> N >> M >> X;
    ll a=0,b=0;
    ll A;
    ll i;
    for(i=0;i<M;i++){
      cin >> A;
      if(A<X)a++;
      if(A>X)b++;
    }
    cout << min(a,b);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(int (i) = (s);(i) <= (e);(i)++)
#define all(x) x.begin(),x.end()

i64 N,K;


vector<i64> a,b;

int NEAR[202];
int NO[202];

void solve() {
  int v = 1;
  while(1) {
    cout << v << endl;
    string s;
    cin >> s;
    if(s == "Yes") return;
    if(s == "Near") {
      v = NEAR[v];
    }
    if(s == "No") {
      v = NO[v];
    }
  }
}

int idx = 1;

vector<int> par;

int rec(i64 n) {
  if(n == 0) return -1;
  for(auto p: par) {
    a.push_back(p);
    b.push_back(idx);
  }
  par.push_back(idx);
  int res = idx;
  n--;
  idx++;

  NEAR[res] = rec(n / 2);

  par.pop_back();

  NO[res] = rec(n - n / 2);

  return res;
}

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

  cout << a.size() << endl;
  for(int i = 0;i < a.size();i++) {
    cout << min(a[i], b[i]) << " " << max(a[i], b[i]) << endl;
  }

  for(int i = 0;i < K;i++) {
    solve();
  }
}



Measured memory_bytes: 3308
sx, sy, gx, gy = map(int, input().split())

cx = gx - sx
cy = gy - sy

dx = abs(gx - sx)
dy = abs(gy - sy)

if cx >= 0 and cy >= 0:
  ans = 'U'*dy+'R'*dx+'D'*dy+'L'*dx
  ans += 'LU'+'U'*dy+'R'*dx+'RD'
  ans += 'RD'+'D'*dy+'L'*dx+'LU'
elif cx < 0 and cy >= 0:
  ans = 'U'*dy+'L'*dx+'D'*dy+'R'*dx
  ans += 'RU'+'U'*dy+'L'*dx+'LD'
  ans += 'LD'+'D'*dy+'R'*dx+'RU'
elif cx >= 0 and cy < 0:
  ans = 'D'*dy+'R'*dx+'U'*dy+'L'*dx
  ans += 'LD'+'D'*dy+'R'*dx+'RU'
  ans += 'RU'+'U'*dy+'L'*dx+'LD'
else:
  ans = 'D'*dy+'L'*dx+'U'*dy+'R'*dx
  ans += 'RD'+'D'*dy+'L'*dx+'LU'
  ans += 'LU'+'U'*dy+'R'*dx+'RD'
print(ans)


Measured memory_bytes: 3064
#![allow(non_snake_case)]
#![allow(unused_variables)]
#![allow(dead_code)]

fn main() {
    let S: Vec<char> = {
        let mut line: String = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        line.trim().chars().collect()
    };

    let ans = if (0..S.len()).all(|i|
        ((i + 1) % 2 == 1 && S[i] != 'L') ||
        ((i + 1) % 2 == 0 && S[i] != 'R')
    ) {
        "Yes"
    } else {
        "No"
    };

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


Measured memory_bytes: 4352
#include<iostream>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    int W, H, x, y, r;
    cin >> W >> H >> x >> y >> r;
    if((x-r >= 0) && (y-r >= 0) && (x+r <= W) && (y+r <= H)) cout << "Yes" << endl;
    else cout << "No" << endl;
}


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

int n,a[100005],temp[100005];
int pr;
int main(){
	cin>>n;
	for(int i=1;i<=n;i++)cin>>a[i];
	int le=0,ri=a[1];
	while(le<=ri){
		int mid=(le+ri)/2;
		temp[0]=mid;
		temp[1]=a[1]-mid;
		for(int i=2;i<=n;i++){
			temp[i]=a[i]-temp[i-1];
		}
		if(temp[n]==temp[0]){
			for(int i=0;i<n;i++){
				cout<<temp[i]*2<<" ";
			}
			return 0;
		}
		else if(temp[0]<temp[n])le=mid+1;
		else ri=mid-1;
	}
	return 0;
}

Measured memory_bytes: 2048
def main():
    N, K = map(int, input().split())
    A = list(map(int, input().split()))

    MOD = 10**9 + 7
    count = 0
    for i in range(N-1):
        for j in range(i+1, N):
            if A[i] == A[j]:
                continue
            elif A[i] > A[j]:
                count += K + K*(K-1) // 2
            else:
                k = K - 1
                count += k + k*(k-1) // 2

    print(count % MOD)
    



main()

Measured memory_bytes: 3188
import java.util.Scanner;
import java.util.Arrays;

public class Main{

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

        // input
        int rate = scan.nextInt();
        int d = scan.nextInt();
        long height = scan.nextInt();

        // answer
        for(int i = 1; i <= 10; i++){
            height = height * rate - d;
            System.out.println(height);
        }

    }
}

Measured memory_bytes: 21844
N, num = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
a.sort()
sum = 0
for count, i in enumerate(a):
    sum+= i
    if sum > num:
        print(count)
        exit()
if sum == num:
    print(N)
else:
    print(N-1)


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

using namespace std;
using ll = long long;
using P = pair<int, int>;

template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

int main() {
  int i;
  cin >> i;
  int num = i % 10;
  if (num == 2 || num == 4 || num == 5 | num == 7 | num == 9) cout << "hon" << endl;
  if (num == 0 || num == 1 || num == 6 | num == 8) cout << "pon" << endl;
  if (num == 3) cout << "bon" << endl;

  return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <map>
#include <algorithm>
#include <vector>


using namespace std;

typedef  pair<int,int> info;


int main(){


  while(1){
    int n,q;
    cin >> n >> q;
    if(n== 0 && q==0) break;

    map<int, string> iniera_map;
    map<string, int> era_years;
    vector<int> iniera_list;

    for(int i=0;i<n;i++){
      // n
      string name;
      int erayear,wyear;
      cin >> name >> erayear >> wyear;
      iniera_map[wyear-erayear+1] = name;
      if(era_years.find(name) == era_years.end())
	era_years[name] = erayear-1;
      else if(era_years[name] > erayear-1){
	era_years.erase(name);
	era_years[name] = erayear-1;
      }
      iniera_list.push_back(wyear-erayear+1);
    }
    sort(iniera_list.begin(),iniera_list.end());
    for(int i=0;i<iniera_list.size();i++){
      //      cout << iniera_list[i] << " ";
    }

    for(int i=0;i<q;i++){
      // query
      int wyear;
      cin >> wyear;
      int eraid,j;
      for(j=iniera_list.size()-1;j>=0; j-- ){
	if(iniera_list[j] <= wyear ) break;
      }
      eraid = j;
      if(j==-1){
	cout << "Unknown\n";
	continue;
      } 
      //      cout << wyear<< " " << iniera_list[eraid] << "~" << iniera_list[eraid] + era_years[iniera_map[iniera_list[eraid]]]  << "\n"; 
      if(iniera_list[eraid] <= wyear ){
	if(wyear <= iniera_list[eraid] + era_years[iniera_map[iniera_list[eraid]]] )
	  cout << iniera_map[iniera_list[eraid]] << " " << wyear - iniera_list[eraid] + 1  << "\n";
       	else
	  cout << "Unknown\n";
      }

      //      string ans_era = iniera_map[];
      //cout << ans_era << " " ;

    }

  }


}

Measured memory_bytes: 1432
use proconio::{input, fastout};
use proconio::marker::{Chars};
use proconio::marker::Usize1;
use std::cmp::*;

macro_rules! debug {
      ($($a:expr),*) => {
          eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

#[fastout]
fn main() {
    input!{
        n: usize,
        a: [[usize; n]; 2],
    }

    let mut ans = 0;
    for down in 0..n {
        let mut sum = 0;
        for i in 0..n {
            if i<=down {
                sum += a[0][i];
                if i==down {
                    sum += a[1][i];
                }
            } else {
                sum += a[1][i];
            }
        }
        ans = max(sum, ans);
        debug!(sum);
    }

    println!("{}", ans);

}


Measured memory_bytes: 2160
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<cstring>
#include<math.h>
#include<bitset>
#include<queue>
#include<set>
#include<iomanip>
// #include<bits/stdc++.h>
using namespace std;
#define ll long long

int main(){
  int N;
  cin >> N;
  vector<pair<int,int>> p;
  for(int i=0; i<N; i++){
    int x,y;
    cin >> x >> y;
    p.push_back(make_pair(x,y));
  }
  sort(p.begin(), p.end());
  double sum=0;
  double n=0;
  do{
    for(int i=0; i<N-1; i++){
      double road;
      road = pow(p[i].first-p[i+1].first,2)+pow(p[i].second-p[i+1].second,2);
      sum += sqrt(road);
    }
    n++;
  }while(next_permutation(p.begin(),p.end()));
  double ans;
  ans = sum/n;
  cout << fixed << setprecision(10) << ans << endl;
  return 0;
}


Measured memory_bytes: 256
from fractions import gcd
def lcm(x,y):return x*y//gcd(x,y)
def inv(x):return pow(x,MOD-2,MOD)
MOD=10**9+7
def main():
  n,*a=map(int,open(0).read().split())
  L=1
  for i in a:L=lcm(L,i)
  L=L%MOD
  ans=0
  for i in a:ans=(ans+L*inv(i))%MOD  
  print(ans)
main()

Measured memory_bytes: 6136
def read_input():
    n, k = map(int, input().split())
    s = input()
    slist = list(s)
    return n, k, slist


def submit():
    n, k, slist = read_input()
    slist[k-1] = slist[k-1].lower()
    print(''.join(slist))
    return


if __name__ == '__main__':
    submit()


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


int main(){
	ios_base::sync_with_stdio(false); 
	cin.tie(NULL);
	ll a,b,c,d,e,k;
	cin >> a >> b >> c >> d >> e >> k;
	if (e-a > k){
		cout << ":(" << endl;
	} else {
		cout << "Yay!" << endl;
	}
	cin >> a;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int boss=1e5;
int n,m,vis[boss+10];
vector<int> lj[boss+10];
int dfs(int u,int fa)
{
if (lj[u].size()>2) return u;
for (int i:lj[u]) if (i!=fa) return dfs(i,u);
return u;
}
int main()
{
int i,u,v;
scanf("%d",&n);
for (i=1;i<n;i++) scanf("%d%d",&u,&v),u++,v++,lj[u].push_back(v),lj[v].push_back(u);
for (i=1;i<=n;i++) if (lj[i].size()==1) vis[dfs(i,0)]=1,m++;
for (i=1;i<=n;i++) if (vis[i]) m--;
printf("%d",max(m,1));
}

Measured memory_bytes: 6656
#include <stdio.h>

int main(void)
{
	char s[20];
	scanf("%s",s);
	
	for(int i=0;i<19;i++){
		if(s[i]==','){
			printf(" ");
		}
		else{
			printf("%c",s[i]);
		}
	}
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,s,n) for(int i=(s); i<(n); i++)
#define all(v) v.begin(),v.end()
#define outve(v) for(auto i : v) cout << i << " ";cout << endl
#define outmat(v) for(auto i : v){for(auto j : i) cout << j << " ";cout << endl;}
#define in(n,v) for(int i=0; i<(n); i++){cin >> v[i];}
#define out(n) cout << (n) << endl
#define fi first
#define se second
#define pb push_back
#define mod 1000000007
#define infi 1900000000
#define infl 1100000000000000000
#define cyes cout << "Yes" << endl
#define cno cout << "No" << endl
#define csp << " " <<
#define outset(n) cout << fixed << setprecision(n);
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
template<typename T> using ve = vector<T>;
template<typename T> using pq2 = priority_queue<T>;
template<typename T> using pq1 = priority_queue<T,vector<T>,greater<T>>;




int main()
{

    string N;
    cin >> N;
    int ans = 0;
    rep(i,4) if(N[i] == '2') ans++;
    cout << ans << endl;
    
    
    

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2e5+5;
int n,a[N];
int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++) scanf("%d",&a[i]);
    sort(a+1,a+1+n);
    bool flag=true;
    for(int i=2;i<=n;i++)
        if(a[i]==a[i-1]) flag=false;
    printf(flag?"YES":"NO");
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define       inf                  1<<30
#define       p5                   100007
#define       p6                   1000007
#define       PI                   acos(-1)
#define       M                    1000000007
#define       sc                   scanf
#define       ss                   second
#define       ff                   first
#define       pf                   printf
#define       scin(x)              sc("%d",&(x))
#define       scin2(x,y)            sc("d",&(x),&(y))
#define       READ(f)              freopen(f, "r", stdin)
#define       WRITE(f)             freopen(f, "w", stdout)
#define       ll                   long long
#define       ull                  unsigned long long
#define       pii                  pair < int, int>
#define       pp                  pair < ll, ll>
#define       pq                   priority_queue
#define       pb                   push_back
#define       FastRead             ios_base::sync_with_stdio(0);cin.tie(0)
//int month[]={31,28,31,30,31,30,31,31,30,31,30,31};
//int dx[5] = {1, -1, 0, 0 };
//int dy[5] = {0, 0, 1, -1};
using namespace std;
int main()
{
	int h,w,a,b,s;
	cin>>h>>w;
	cin>>a>>b;
	s=(h*w)-(a*w-a*b)-(b*h);
	cout<<s<<endl;
	return 0;
}
//CsE91971@%Cou




Measured memory_bytes: 256
// console.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <string>
#include <cmath>

using namespace std;

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

	for (int i = 1; i <= 1009; i++)
	{
		if ((int)(i * 0.08) == a && (int)(i * 0.1) == b)
		{
			cout << i << endl;

			return 0;
		}
	}

	cout << -1 << endl;
}



Measured memory_bytes: 256
import java.util.*;
import java.util.stream.Collectors;


public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        final int a=scanner.nextInt();
        final int b=scanner.nextInt();
        System.out.println(func(b-a-1)-a);

    }
    public static long func(int i){
        if(i==0){
            return 0;
        }
        return i+func(i-1);
    }
}


Measured memory_bytes: 21972
#include<bits/stdc++.h>
typedef long long ll;
ll gi(){
	ll x=0,f=1;
	char ch=getchar();
	while(!isdigit(ch))f^=ch=='-',ch=getchar();
	while(isdigit(ch))x=x*10+ch-'0',ch=getchar();
	return f?x:-x;
}
std::mt19937 rnd(time(NULL));
#define rand rnd
#define pr std::pair<int,int>
#define fi first
#define se second
template<class T>void cxk(T&a,T b){a=a>b?a:b;}
template<class T>void cnk(T&a,T b){a=a<b?a:b;}
#ifdef mod
int pow(int x,int y){
	int ret=1;
	while(y){
		if(y&1)ret=1ll*ret*x%mod;
		x=1ll*x*x%mod;y>>=1;
	}
	return ret;
}
template<class Ta,class Tb>void inc(Ta&a,Tb b){a=a+b>=mod?a+b-mod:a+b;}
template<class Ta,class Tb>void dec(Ta&a,Tb b){a=a>=b?a-b:a+mod-b;}
#endif
int n,K;
struct pe{
	int A[100001];
	int&operator[](int x){return A[x];}
}p,q,mid,g;
pe operator*(pe A,pe B){
	pe c;for(int i=1;i<=n;++i)c[i]=A[B[i]];
	return c;
}
pe operator~(pe A){
	pe c;for(int i=1;i<=n;++i)c[A[i]]=i;
	return c;
}
pe operator^(pe A,int b){
	pe c;for(int i=1;i<=n;++i)c[i]=i;
	while(b){
		if(b&1)c=c*A;
		A=A*A;b>>=1;
	}
	return c;
}
int main(){
#ifdef LOCAL
	freopen("in.in","r",stdin);
	//freopen("out.out","w",stdout);
#endif
	n=gi(),K=gi();
	for(int i=1;i<=n;++i)p[i]=gi();
	for(int i=1;i<=n;++i)q[i]=gi();
	if(K==-1){for(int i=1;i<=n;++i)printf("%d ",p[i]);puts("");return 0;}
	if(K==0){for(int i=1;i<=n;++i)printf("%d ",q[i]);puts("");return 0;}
	int N=(K-1)/6;
	int _=(K-1)%6+1;
	if(_==1)mid=p;
	else if(_==2)mid=q;
	else if(_==3)mid=q*~p;
	else if(_==4)mid=q*~p*~q;
	else if(_==5)mid=q*~p*~q*p*~q;
	else if(_==6)mid=q*~p*~q*p*p*~q;
	g=q*~p*~q*p;g=g^N;
	mid=g*mid*~g;
	for(int i=1;i<=n;++i)printf("%d ",mid[i]);
	return 0;
}


Measured memory_bytes: 29696