akhauriyash/Code-Regression huggingface dataset:
;;; Utils

(defmacro read-numbers-to-list ()
  `(read-from-string
    (concatenate 'string "(" (read-line) ")")))


(defmacro read-line-to-array (dimension)
  (if (< dimension 0)
      (error "invalid arguments for dimension.")
      `(make-array ,dimension :initial-contents (read-numbers-to-list))))

(defmacro read-line-to-char-list ()
  `(concatenate 'list (read-line)))

(defmethod make-cumlative-sum ((sequence list))
  (labels ((inner (sequence &optional (acc '(0)))
             (if (null sequence)
                 (reverse acc)
                 (inner (rest sequence) (cons (+ (first sequence)
                                                 (first acc))
                                              acc)))))
    (inner sequence)))





(defmethod princ-for-each-line ((sequence list))
  (labels ((inner (sequence)
             (if (null sequence)
                 nil
                 (progn
                   (fresh-line)
                   (princ (first sequence))
                   (inner (rest sequence))))))
    (inner sequence)))

(defmethod princ-for-each-line ((sequence array))
  (dotimes (i (length sequence))
    (fresh-line)
    (princ (aref sequence i))))



;;; Write code here

(defun count-difference (str1 str2)
  (assert (= (length str1) (length str2)))
  (labels ((inner (s1 s2 &optional (cnt 0))
             (cond
               ((null s1) cnt)
               ((char-equal (first s1) (first s2))
                (inner (rest s1) (rest s2) cnt))
               (t
                (inner (rest s1) (rest s2) (1+ cnt))))))
    (inner str1 str2)))



(defun solve (bigger smaller)
  (let ((b-len (length bigger))
        (s-len (length smaller))
        (k 0)
        (ans 10001))
    (loop while (<= (+ k s-len) b-len)
       do
         (progn
           (setq ans (min ans (count-difference (subseq bigger 0 s-len)
                                                smaller)))
           (pop bigger)
           (incf k))
       finally
         (return ans))))




(defun main ()
  (let ((str1 (read-line-to-char-list))
        (str2 (read-line-to-char-list)))
    (format t "~a~%" (solve str1 str2))))

(main)


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

int dx[4] = {1,0,-1,0},dy[4] = {0,1,0,-1};
class Dice{
private:
    int l[7][7] = {}; 
public:
    int x,y,z;
    int top,front,bottom,back,right,left;
    Dice(int t,int f){
        l[1][2] = 4; l[1][3] = 2; l[1][4] = 5; l[1][5] = 3;
        l[2][3] = 6; l[2][4] = 1; l[2][6] = 4; l[3][5] = 6; l[3][6] = 2;
        l[4][5] = 1; l[4][6] = 5; l[5][6] = 3;
        top = t; front = f;
        if(t<f) left = l[t][f];
        else left = 7-l[f][t];
        bottom = 7-top; back = 7-front; right = 7-left;
    }
    int num(int d){
        if(d==0) return front;
        if(d==1) return right;
        if(d==2) return back;
        if(d==3) return left;
    }
    void roll(int d){
        int buf;
        if(d==0){//手前
            buf=top;top=back;back=bottom;bottom=front;front=buf;x--;
        }else if(d==1){//右
            buf=top;top=left;left=bottom;bottom=right;right=buf;z++;
        }else if(d==2){//後
            buf=top;top=front;front=bottom;bottom=back;back=buf;x++;
        }else if(d==3){//左
            buf=top;top=right;right=bottom;bottom=left;left=buf;z--;
        }
        y--;
    }
};

int N;
int main(){
    while(cin >> N && N>0){
        vector<vector<int>> height(210,vector<int>(210,0)),number(210,vector<int>(210,0));
        int t,f;
        for(int i=0;i<N;i++){
            cin >> t >> f;
            Dice dice(t,f);
            int x = 101,y = 101;
            bool update = true;
            int h = height[x][y];
            while(update){
                update = false;
                int ma = 0,direction = -1;
                for(int i=0;i<4;i++){
                    if(dice.num(i)<4) continue;
                    if(height[x+dx[i]][y+dy[i]]>=height[x][y]) continue;
                    if(ma<dice.num(i)){
                        ma = dice.num(i); direction = i;
                    }
                }
                if(direction==-1) continue;
                update = true;
                dice.roll(direction);
                x += dx[direction]; y += dy[direction];
                h = height[x][y];
            }
            height[x][y]++;
            number[x][y] = dice.top;
        }
        vector<int> ans(7,0);
        for(int i=0;i<210;i++) for(int j=0;j<210;j++) ans[number[i][j]]++;
        for(int i=1;i<=6;i++) cout << ans[i] << (i!=6? " ":"\n");
    }
}


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

#define rep(i, n) rep2(i, 0, n)
#define rep2(i, m, n) for(int i = m; i < (int)(n); ++i)
#define pb(e) push_back(e)

typedef long long ll;

int main()
{
    int m, n, ans = 0, s, t;
    cin >> m >> n;
    rep(i, m) {
        s = 0;
        rep(i, n) cin >> t, s += t;
        ans = max(ans, s);
    }
    cout << ans << endl;
}

Measured memory_bytes: 1164
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
using namespace std;


int main(int argc, char* argv[])
{
    int n,m;
    scanf("%d%d", &n, &m);

    set<pair<double,int> > z;
    int i;
    for(i=0; i<n; i++) {
        int tmp;
        scanf("%d", &tmp);
        z.insert(make_pair(tmp,i));
    }

    for(i=0; i<m; i++) {
        auto it=z.rbegin();
        double val=it->first;
        int id=it->second;
        z.erase(*it);
        z.insert(make_pair(val/2,id));
    }

    const int eps=1e-12;
    ll ans=0;
    auto it=z.begin();
    for(; it!=z.end(); ++it) {
        double val=it->first;
        int aa=(val+eps);
        ans+=aa;
    }
    printf("%lld\n", ans);

    return 0;
}

Measured memory_bytes: 6528
n = gets.chomp.to_i
xy = []
x = []
y = []

if n == 1
    puts "1"
else

    for i in 1..n do
        input = gets.chomp.split(" ").map(&:to_i)
        xy.push(input) 
    end

    xy.sort! {|a,b| (a[0] <=> b[0]).nonzero? || (a[1] <=> b[1])}
    dif = []
    count_max = 1
    for i in 1..n-1 do
        for j in i+1..n do
            x0 = xy[j-1][0] - xy[i-1][0]
            y0 = xy[j-1][1] - xy[i-1][1]
            dif.push([x0,y0])
        end
    end
    dif.sort! {|a,b| (a[0] <=> b[0]).nonzero? || (a[1] <=> b[1])}
    


    count = 1
    tar = dif[0]
    size = dif.length
    for i in 1..(size -1)
        if dif[i] == tar
            count += 1
        else
            if count_max < count 
                count_max = count                
            end
            count = 1
            tar = dif[i]
        end
    end
    p n - count_max
end

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

int N,a[100010],dp[100010],arr[100010]; vector<int> g[100010];

void dfs(int nod){
    int i; int K=0;
    for (i=0; i<g[nod].size(); i++)
        dfs(g[nod][i]);

    for (i=0; i<g[nod].size(); i++)
        arr[++K]=dp[g[nod][i]];

    if (K==0) return;
    sort(arr+1,arr+K+1);
    dp[nod]=0;
    for (i=1; i<=K; i++)
        dp[nod]=max(dp[nod],arr[i]+(int)(g[nod].size())-i+1);

}

int main(){
    cin >> N;

    int i;
    for (i=2; i<=N; i++){
        cin >> a[i];
        g[a[i]].push_back(i);
    }

    dfs(1);
    cout << dp[1] << "\n";
    return 0;
}


Measured memory_bytes: 12800
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define all(n) begin(n),end(n)
using ll = long long;
using P = pair<int,int>;



int main() {
    int n, a, b, c, d;
    string s;
    cin >> n >> a >> b >> c >> d >> s;
    a--, b--, c--, d--;
    bool ans = true;
    for(int i = a; i < c; ++i) if(s[i]=='#' && s[i+1]=='#') ans = false;
    for(int i = b; i < d; ++i) if(s[i]=='#' && s[i+1]=='#') ans = false;
    if(c < d) {
        if(ans) cout << "Yes" << endl;
        else cout << "No" << endl;
        return 0;
    }
    if(c > d) {
        for(int i = b; i < min(n-1, d+1); ++i) {
            if(s[i-1]=='.' && s[i]=='.' && s[i+1]=='.') {
                cout << "Yes" << endl;
                return 0;
            }
        }
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 3752
/* Author : Pranav Deshmukh
            PICT,Pune
   Purpose: Practice Atcoder
*/

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

#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")

#define int             long long
#define dip(type,var)   type var; cin>>var;
#define dipi(x)			int x; cin>>x;
#define w(x)            int x; cin>>x; while(x--)
#define mka(arr,n,type) type *arr=new type[n];
#define foi(i,n)		for(int i=0;i<n;i++)
#define mod             pow(10,9)+7
#define inf             1e18
#define pi 				3.141592653589793238
#define endl			"\n"
#define ff              first
#define ss              second
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >

void c_p_c()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cin.tie(0);
#ifndef ONLINE_JUDGE

	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}

int32_t main() {
	c_p_c();
	dipi(a);
	cout << 2 * pi*a << endl;
}

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

int main()
{
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  if(abs(a - c) <= d || (abs(a - b) <= d && abs(b - c) <= d)){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include<stdio.h>
 
 int main()
{
  int r,w,i,j,y=0,f,g,h;
  scanf("%d",&r);
  int x[r];
  char c[12];

  for(i=0;i<r;i++){
    scanf("%s %d",c,&w);

    if(c[0]=='i'){
      x[i]=w;
    }

    else if(c[6]=='F'){
      i-=2;r-=2;
    }

    else if(c[6]=='L'){
      i--;r--;y++;
    }

    else{
      i--;r--;
      f=0;
      for(j=i;j>=0;j--){

    if(f>0)break;

    if(w==x[j]){
      h=0;
      g=i-j;
      f++;
      while(g!=h++)x[j+h-1]=x[j+1+h-1];
      i--;r--;
    }
      }
    }
  }
  for(i=0;i<r-y;i++){
    if(i==r-y-1)printf("%d\n",x[r-1-i]);
    else printf("%d ",x[r-1-i]);
  }
  return 0;
}

Measured memory_bytes: 4592
#include<bits/stdc++.h>
#include<unordered_map>
using namespace std;	
typedef vector <int> vi;
typedef vector<vi> vvi;
typedef map<int,int> mii;
typedef pair<int,int> pii;
#define INF 1000000000
#define MOD 1000000007
#define itr ::iterator it
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
#define remin(a,b) (a) = min((a),(b))
#define remax(a,b) (a) = max((a),(b))	
#define ll long long
#define db double
#define el "\n"
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	int n,i;
	cin>>n;
	int a[n];
	for(i=0;i<n;i++){
		cin>>a[i];
	}
	int ans[n];
	ans[0]=0;
	ans[1]=abs(a[1]-a[0]);
	for(i=2;i<n;i++){
		ans[i]=min(ans[i-1]+abs(a[i]-a[i-1]),ans[i-2]+abs(a[i]-a[i-2]));
	}
	cout<<ans[n-1];
}

Measured memory_bytes: 1024
package main

// Solution for https://atcoder.jp/contests/abc173/tasks/abc173_d

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"sort"
)

type contest struct {
	in  io.Reader
	out io.Writer
}

func (con *contest) Scan(a ...interface{}) (int, error) {
	return fmt.Fscan(con.in, a...)
}
func (con *contest) Scanln(a ...interface{}) (int, error) {
	return fmt.Fscanln(con.in, a...)
}
func (con *contest) Scanf(f string, a ...interface{}) (int, error) {
	return fmt.Fscanf(con.in, f, a...)
}
func (con *contest) Print(a ...interface{}) (int, error) {
	return fmt.Fprint(con.out, a...)
}
func (con *contest) Println(a ...interface{}) (int, error) {
	return fmt.Fprintln(con.out, a...)
}
func (con *contest) Printf(f string, a ...interface{}) (int, error) {
	return fmt.Fprintf(con.out, f, a...)
}
func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	con := &contest{in: in, out: out}
	con.main()
}

func (con *contest) main() error {
	var n int
	con.Scan(&n)
	a := make([]int, n)
	for i := 0; i < n; i++ {
		con.Scan(&a[i])
	}
	sort.Slice(a, func(i, j int) bool { return a[i] > a[j] })
	b := make([]int, 0, n*2)
	b = append(b, a[0])
	c := 0
	for i := 1; i < n; i++ {
		c += b[i-1]
		b = append(b, a[i])
		b = append(b, a[i])
	}
	con.Println(c)
	return nil
}


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

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

    std::string s;
    std::cin >> s;

    std::string alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

    for ( int i = 0; i < s.length(); i++ ) {
        std::string tmp_moji = s.substr(i, 1);
        for ( int j = 0; j < 26; j++ ) {
            int index_num = j;
            if ( tmp_moji == alphabet.substr(index_num, 1) ) {
                index_num += n;
                if ( index_num >= 26 ) {
                    std::cout << alphabet.substr(index_num-26, 1);
                }
                else {
                    std::cout << alphabet.substr(index_num, 1);
                }
            }
        }
    }
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#define DEBUG(x) std::cout << '>' << #x << ':' << x << '\n';
#define PRINTVEC(x) for (int i = 0; i < (int)x.size(); i++) std::cout << x[i] << ' '; std::cout << '\n';
#define PRINTP(x) for (int i = 0; i < (int)x.size(); i++) std::cout << x[i].first << ' ' << x[i].second << '\n'; std::cout << '\n';
#define io std::ios_base::sync_with_stdio(false);std::cin.tie(NULL);   
const int INF = 1<<29;
typedef long long ll;



int main()
{
	io;
    #ifndef ONLINE_JUDGE
    //freopen("input.txt", "r", stdin); 
    //freopen("output.txt", "w", stdout);  
    #endif

    int a,b;
    std::cin >> a >> b;
    int ans = 0;
    for (int i = 0; i < std::max(a,b)*100+1; i++) {
        if (std::floor(i * 0.08) == a && std::floor(i * 0.1) == b)
            return std::cout << i,0;
    }
    std::cout << -1;

    #ifndef ONLINE_JUDGE   
    //std::cout << '\n' << "Time elapsed : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec \n";
    #endif
    return 0;
}


Measured memory_bytes: 256
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
#include<bitset>
#include<stack>
#include<memory>
using namespace std;
using namespace std::chrono;
typedef long long int llint;
typedef double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
/*cout<<fixed<<setprecision(20);cin.tie(0);ios::sync_with_stdio(false);*/
const int mod=998244353;
const llint big=2.19e18+1;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-15;
template <class T,class U>bool mineq(T& a,U b){if(a>b){a=b;return true;}return false;}
template <class T,class U>bool maxeq(T& a,U b){if(a<b){a=b;return true;}return false;}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){if(a==0){return b;}return a/gcd(a,b)*b;}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
template<class T>llint LBI(vector<T>&ar,T in){return lower_bound(ar.begin(),ar.end(),in)-ar.begin();}
template<class T>llint UBI(vector<T>&ar,T in){return upper_bound(ar.begin(),ar.end(),in)-ar.begin();}
int main(void){
	cin.tie(0);ios::sync_with_stdio(false);
	int n,i,K=10000;cin>>n;
	vector<int>C(K+2);
	vector<int>A(n);
	vector<int>B(n);
	for(i=0;i<n;i++){cin>>A[i];C[A[i]+1]++;}
	for(i=0;i<=K;i++){C[i+1]+=C[i];}
	for(i=0;i<n;i++){
		B[C[A[i]]]=A[i];
		C[A[i]]++;
	}
	for(i=0;i<n;i++){cout<<B[i]<<(i+1==n?"\n":" ");}
	return 0;
}


Measured memory_bytes: 18252
g = gets.chomp
g = g.split(" ",2)

n = g[0].to_i
m = g[1].to_i

square = n * m

if n == 1 && m == 1
  answer = 1
elsif n == 1 || m == 1
  answer = n * m - 2
else
  answer = square - 2*n - 2*m + 4
end
puts answer

Measured memory_bytes: 1788
a = gets.to_i
b = gets.to_i
c = gets.to_i
x = gets.to_i

ans = 0

0.upto(a) do |aa|
    break if aa * 500 > x

    0.upto(b) do |bb|
        break if aa * 500 + bb * 100 > x

        0.upto(c) do |cc|
            break if aa * 500 + bb * 100 + cc * 50 > x
            if aa * 500 + bb * 100 + cc * 50 == x
                ans += 1 
                break
            end
        end
    end
end

puts ans

Measured memory_bytes: 3836
import sys
A = "1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51".split(", ")

N = int(sys.stdin.readline().rstrip())

print(A[N-1])


Measured memory_bytes: 3060
import java.util.*;
import java.io.PrintWriter;
import static java.lang.Integer.*;
import static java.lang.Long.parseLong;
//import static java.lang.Long.*;
//import static java.lang.Math.*;
import static java.lang.Math.*;
import static java.lang.System.*;

public class Main {
	public static int AB = 26;
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(in);
		char[] s = sc.next().toCharArray();
		sc.close();
		int st = (s.length -1)/2;
		for (i = st; i > 0; i--) {
			boolean f = false;
			for (j = 0; j < i; j++) {
				if(s[j]!=s[j+i]) break;
			}
			if(j==i) break;
		}
		out.println(i*2);
	}
}


Measured memory_bytes: 21716
#include <iostream>

using namespace std;

int main(int argc, const char *argv[]) {
  int N;
  long int ans = 0;
  cin >> N;

  for(int i = 1; i< N+1;i++){
    if (i % 3 != 0 && i % 5 != 0){
      ans += i;
    }
  }
  cout << ans << endl;
  return 0;
}


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

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

    for(int i = 0; i < 1300; ++i) {
        int tmp1 =  i* 0.08 ;
        int tmp2 = i * 0.1; 
        if(tmp1 == a && tmp2 == b) {
            cout << i << endl;
            return 0;
        }
    }
    cout << -1 << endl;
    return 0;
}


Measured memory_bytes: 384
n, m, Q = map(int, input().split())
M = [[0]*n for _ in range(n)]
for i in range(m):
    l, r = map(int, input().split())
    M[r-1][l-1] += 1

for q in range(n):
    for p in reversed(range(1, n)):
        M[q][p-1] += M[q][p]
for p in range(n):
    for q in range(n-1):
        M[q+1][p] += M[q][p]

for i in range(Q):
    p, q = map(int, input().split())
    print(M[q-1][p-1])


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

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> ii;
typedef tuple<ll, ll, ll> iii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
#define REP(i,n) for (ll i = 0; i < n; ++i)
#define REPR(i,n) for (ll i = n-1; i >= 0; --i)
#define FOR(i,m,n) for (ll i = m; i < n; ++i)
#define FORR(i,m,n) for (ll i = n-1; i >= m; --i)
#define FORE(x,xs) for (const auto& x : xs)
#define ALL(v) v.begin(), v.end()
#define CHMIN(x,y) x = min(x, y)
#define CHMAX(x,y) x = max(x, y)

int N;
string A;

int lucas(int m, int n) {
    int comb[2][2] = {{1, 0}, {1, 1}};
    int ret = 1;
    while (m) {
        int m_ = m%2, n_ = n%2;
        ret *= comb[m_][n_];
        m /= 2; n /= 2;
    }
    return ret;
}

int sub(int b) {
    int ret = 0;
    REP (i, N) {
        int x = (A[i] - '1') >> b;
        ret += lucas(N-1, i) * x;
    }
    return ret % 2;
}

int solve() {
    if (sub(0)) return 1;
    REP (i, N) if (A[i] == '2') return 0;
    return sub(1) * 2;
}

int main() {
    cin >> N >> A;
    cout << solve() << endl;
}

Measured memory_bytes: 1412
N,M = map(int,input().split())
def xor_sum(N):
    N+=1
    value = 0
    value += (N//2)%2 # 2^0の位
    for i in range(1,40):
        # print(N%(2**(i+1))-2**i)
        cnt = max(0,N%(2**(i+1))-2**i) #mod2^(i+1)のcnt
        value += (cnt%2) * 2**i
    return value

# print(xor_sum(3))
print(xor_sum(M)^xor_sum(N-1))


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
int i,j,k,n,d,a[11][11],sum,x,ans=0;
int main(){
    cin>>n>>d;
    for(i=1;i<=n;i++){
        for(j=1;j<=d;j++){
            cin>>a[i][j];
        }
    }
    for(i=1;i<=n;i++){
        for(j=i+1;j<=n;j++){
            sum=0;
            for(k=1;k<=d;k++){
                x=a[i][k]-a[j][k];
                sum+=x*x;
            }
            int r=sqrt(sum);
            if(r*r==sum){
                ans++;
            }
        }
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 256
integer N
integer(16),allocatable,dimension(:)::A,B
read*,N
allocate(A(N),B(N))
read*,A
do i=1,N
  if(mod(i+N,2)==1)then
    B((N+1)/2+(i+1)/2)=A(i)
  else
    B((N+1)/2-(i+1)/2+1)=A(i)
  endif
end do
print"(i0)",B
end

Measured memory_bytes: 8960
#include <cstdio>
#include <algorithm>
#include <map>
using namespace std;

#define MOD 1000000007

typedef long long ll;

map<pair<ll, ll>, pair<ll, ll> > M;
ll pow2[222222] = { 1 };

ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }

int main(void)
{
	ll n, i, x, y, tmp = -1, cnt = 1;

	scanf("%lld", &n);
	while (n--)
	{
		scanf("%lld %lld", &x, &y);

		if (x == 0 && y == 0)
		{
			++tmp;
			continue;
		}

		if (make_pair(x, y) < make_pair(0LL, 0LL))
			x = -x, y = -y;

		ll GCD = gcd(abs(x), abs(y));
		x /= GCD, y /= GCD;

		if (y > 0)
			M[make_pair(x, y)].first++;
		else
			M[make_pair(-y, x)].second++;
	}

	for (i = 1; i < 222222; i++)
		pow2[i] = pow2[i - 1] * 2 % MOD;

	for (auto p : M)
		cnt = cnt * (pow2[p.second.first] + pow2[p.second.second] - 1LL) % MOD;

	printf("%lld", (tmp + MOD + cnt) % MOD);
	return 0;
}

Measured memory_bytes: 20536
package main

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

func abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

func main() {
	var n int
	fmt.Scan(&n)

	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	a := make([]int, n+2)
	a[0], a[len(a)-1] = 0, 0
	mv := 0
	for i := 1; i < len(a)-1; i++ {
		sc.Scan()
		a[i], _ = strconv.Atoi(sc.Text())
		mv += abs(a[i-1] - a[i])
	}
	mv += abs(a[len(a)-2] - a[len(a)-1])

	wr := bufio.NewWriter(os.Stdout)
	for i := 1; i < len(a)-1; i++ {
		ans := mv - (abs(a[i-1]-a[i]) + abs(a[i+1]-a[i])) + abs(a[i+1]-a[i-1])
		wr.WriteString(strconv.Itoa(ans) + "\n")
	}
	wr.Flush()
}


Measured memory_bytes: 4608
#include <bits/stdc++.h>
using namespace std;
#define int                  long long int
#define ff                   first
#define ss                   second
#define pb                   push_back
#define mp                   make_pair
#define pii                  pair<int,int>
#define vi                   vector<int>
#define mi                   map<int,int>
#define pqb                  priority_queue<int>
#define pqs                  priority_queue<int,vi,greater<int>>
#define setbits(x)           __builtin_popcountll(x)
#define zrobits(x)           __builtin_ctzll(x)
#define mod                  1000000007
#define inf                  1e18
#define precise(x,y)         fixed<<setprecision(y)<<x
#define w(x)                 int x;cin>>x;while(x--)
#define endl                 "\n"
#define no_of_digit(n)       floor(log10(n))+1
#define copyarr(a,b,n)       copy_n(a,n,b)
mt19937                      rng(chrono::steady_clock::now().time_since_epoch().count());

//*******************to check if all number in array are positive*******************
//all_of(arr,arr+n,[](int x){return x>0;})?cout<<"positive":cout<<"some negative";


//*******************to check if any element in array is negative*******************
//any_of(arr,arr+n,[](int x){return x<0;})?cout<<"Any negative":cout<<"All positive";


int32_t main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    //*****************Enter the code here*******************//
    int n;
    cin>>n;
    int prod=1;
    for(int i=1;i<=n;i++){
        prod=((prod%mod)*(i%mod))%mod;
    }
    cout<<prod;
    return 0;
}


Measured memory_bytes: 256
H, W = [int(x) for x in input().split()]

S = []
for _ in range(H):
    S.append(input())

TATE = [[0 for i in range(W + 1)] for j in range(H + 1)]
YOKO = [[0 for i in range(W + 1)] for j in range(H + 1)]


for j in range(1, H + 1):
    for i in range(1, W + 1):
        if S[j - 1][i - 1] == '.':
            YOKO[j][i] = YOKO[j][i - 1] + 1
        if S[j - 1][i - 1] == '.':
            TATE[j][i] = TATE[j - 1][i] + 1


for j in range(H, 0, -1):
    for i in range(W, 0, -1):
        if i != W and YOKO[j][i + 1] != 0 and S[j - 1][i - 1] == '.':
            YOKO[j][i] = YOKO[j][i + 1]
        if j != H and TATE[j + 1][i] != 0 and S[j - 1][i - 1] == '.':
            TATE[j][i] = TATE[j + 1][i]
ans = 0
for j in range(1, H + 1):
    for i in range(1, W + 1):
        ans = max(ans, TATE[j][i] + YOKO[j][i] - 1)

print(ans)








Measured memory_bytes: 127960
#include<stdio.h>
int main(){
    int a,b,c;
    char x='x',y='=';
    for(a=1;a<=9;a++){
        for(b=1;b<=9;b++){
            c=a*b;
            printf("%d%c%d%c%d\n",a,x,b,y,c);
        }
    }

    return 0;
}

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

using namespace std;
#define all(a)a.begin(),a.end()
#define rep(i,n) for (int i = 0; i < (n); ++i)
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod = int(1e9)+7;
using V = vector<ll>;
using P = pair<ll,ll>;

int main()
{
    int tmp=0;
    int n;cin >>n;
    int ans=1;
    rep(i,n){
        ll a,t;cin >>a;
        if(i==0){
            t=a;
            continue;
        }
        if(tmp==0){
            if(a-t>0)tmp=1;
            if(a-t<0)tmp=2;
        }
        if(tmp==1){
            if(a-t<0){
                tmp=0;
                ans++;
            }
        }
        if(tmp==2){
                if(a-t>0){
                tmp=0;
                ans++;
            }
        }
         t=a;
    }
    cout << ans << endl;
    return 0;
}


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


typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef long double ld;

typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;

const int INF = 1e9 + 7;
const int MOD = 1e9 + 7;
const int MAXN = 1e6 + 3;

#define _  %  MOD
#define __ %= MOD

#define      each(it,s)        for(auto it = s.begin(); it != s.end(); ++it)
#define      sortA(v)          sort(v.begin(), v.end())
#define      sortD(v)          sort(v.begin(), v.end(), greater<auto>())
#define      fill(a)           memset(a, 0, sizeof (a))

#define      swap(a,b)        {a=a+b;b=a-b;a=a-b;}
#define      rep(i, n)         for(ll i = 0; i < (n); ++i)
#define      repA(i, a, n)     for(ll i = a; i <= (n); ++i)
#define      repD(i, a, n)     for(ll i = a; i >= (n); --i)
#define watch(x) cout << (#x) << " is " << (x) <<endl

#define fi first
#define se second
#define mp make_pair
#define pb push_back

#define fbo find_by_order
#define ook order_of_key

ll gcd(ll a,ll b){if(b==0) return a; else return gcd(b,a%b);}
ll power(ll x,ll y){ll res=1; while(y>0){if(y&1) res=res*x;y=y>>1;x=x*x;}return res;} // modular exponent

int main()
{
    ios_base::sync_with_stdio(false); // don't use printf and scanf
    cin.tie(NULL); // cout<<fixed<<setprecision
    ll n,k;
    cin>>n>>k;
    ll ans=0;
    repA(i,k,n+1)
    {
        ll temp=i*(n-i+1) + 1;
        temp%=INF;
        ans+=temp;
        ans%=INF;
    }
    cout<<ans<<'\n';
    return 0;
}
// JUST ASK YOURSELF DID YOU GIVE YOUR BEST ? ISSE ZYADA
// KUCH KAR BHI NAHI SAKTE !! ENJOY AND GIVE YOUR BEST!!


Measured memory_bytes: 3660
#include<bits/stdc++.h>
using namespace std;
int a[55],b[55],c[55],d[55];
int main()
{
	int n,m;
	cin>>n>>m;
	for(int i=1;i<=n;i++) cin>>a[i]>>b[i];
	for(int i=1;i<=m;i++) cin>>c[i]>>d[i];
	for(int i=1;i<=n;i++)
	{
		int dmin=1234567890,minp;
		for(int j=1;j<=m;j++)
		if(dmin>abs(a[i]-c[j])+abs(b[i]-d[j]))
		dmin=abs(a[i]-c[j])+abs(b[i]-d[j]),minp=j;
		cout<<minp<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
import numpy as np

N = int(input())
mod = 10**9 + 7
A = np.array(input().split(), int)

ans = 0
for i in range(60):
    b = np.count_nonzero(A >> i & 1)
    ans += 2**i*(b*(N-b))
    ans %= mod
    c = np.count_nonzero(A >> i & 1)
print(ans)



Measured memory_bytes: 82124
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i, n) for (int i = 0; i < n; i++)
#define ALL(a) (a).begin(), (a).end()
typedef vector<int> vi;
const int INF = 1LL << 58;
const int MOD = 1000000007;
const int MAX_N = 200100;

signed main()
{
    //  以降 cin の入力元が 'input.txt' になる
    //std::ifstream in("input.txt");
    //std::cin.rdbuf(in.rdbuf());
    int N;
    cin >> N;
    map<int, vi> a;
    map<int, vi> b;
    set<int> ss;
    REP(i, N)
    {
        int t;
        cin >> t;
        a[i + t].push_back(i);
        ss.insert(i + t);
        b[i - t].push_back(i);
    }

    int ans = 0;

    for (auto iter = ss.begin(); iter != ss.end(); iter++)
    {
        vi aa = a[*iter];
        vi bb = b[*iter];
        sort(ALL(bb));
        REP(j, aa.size())
        {
            int t = aa[j] + 1;
            ans += bb.end() - upper_bound(ALL(bb), t);
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 66800
#include<iostream>

using namespace std;

int main(){
  int a,b,c;
  bool ans=false;
  cin >> a >> b >>c;
  for(int i=1;i<=b;i++){
    if((a*i)%b==c){
      ans=true;
      break;
    }
  }
  if(ans){
    cout << "YES" << endl;
  }
  else{
    cout << "NO" << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <vector>
using namespace std;
int main(){
  cin.tie(NULL);
  ios::sync_with_stdio(false);
  int x,a,b;
  cin>>x>>a>>b;
  x-=a;
  a=x/b;
  x-=a*b;
  cout<<x<<"\n";
  return 0;
}

Measured memory_bytes: 3648
N = int(input())
H = list(map(int,input().split()))
count = 1
for i in range(1,N):
  judge = 0
  for j in range(i):
    if(H[j]>H[i]):
      judge = judge +1
      break
  if(judge==0):
    count=count+1
print(count)
  
  
  
  

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


class Program
{
    static void Main(string[] args)
    {
        // 入力
        //var s = Console.ReadLine();
        //var n = int.Parse(Console.ReadLine());
        long[] kab = Console.ReadLine().Split().Select(long.Parse).ToArray();
        var k = kab[0];
        var a = kab[1];
        var b = kab[2];

        //ビスケットをたたき続けた場合
        long ans = k + 1;

        //可能なだけabの動作を繰り返した場合
        long tmp1 = a - 1;
        long tmp2 = 0;
        if ((k - tmp1) % 2 == 0)
        {
            tmp2 = (k - tmp1) / 2 * (b - a) + a;
        }
        else
        {
            tmp2 = (k - tmp1) / 2 * (b - a) + a + 1;
        }
        ans = Math.Max(ans, tmp2);

        Console.WriteLine(ans);
    }
}

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

#define for_(i,a,b) for(int i=(a);i<(b);++i)
typedef long long lint;

lint gcd(lint a, lint b) { return b != 0 ? gcd(b, a % b) : a; }

lint A, B;
int N;

void solve() {
	lint ans = 1L << 60;
	for_(a,1,N+1) for_(b,1,N+1) {
		// a/b=A/B -> A = a/b*B
		lint nA = (lint)a * B / (lint)b;
		lint g = gcd(nA, B);
		if (nA / g != a || B / g != b) continue;
		ans = min(ans, abs(A - nA));
	}
	cout << ans << endl;
}

int main() {
	cin >> A >> B >> N;
	solve();
}

Measured memory_bytes: 3088
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,m,c,a=0;cin>>n>>m>>c;
  vector<int>b(m);for(int i=0;i<m;i++)cin>>b.at(i);
  for(int i=0;i<n;i++){
    int x=c;
    for(int j=0;j<m;j++){int y;cin>>y;x+=b.at(j)*y;}
    if(x>0)a++;
  }
  cout<<a<<endl;
}


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

using namespace std;

#define all(x) x.begin(), x.end()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define reps(i, m, n) for (int i = m; i <= n; ++i)

using i64 = long long;
using pii = pair<i64, i64>;

template<class A, class B>inline bool chmax(A &a, const B &b){return b > a ? a = b,1 : 0;}
template<class A, class B>inline bool chmin(A &a, const B &b){return b < a ? a = b,1 : 0;}

constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int MOD = int(1e9) + 7;

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

  int n;
  cin >> n;

  vector<pii> vec;
  rep(i, n) {
    i64 a, b;
    cin >> a >> b;
    vec.push_back(pii(a, b));
  }

  sort(all(vec), greater<pii>());

  cout << vec[0].first + vec[0].second << "\n";

  return 0;
}

Measured memory_bytes: 2420
#include <iostream>

using namespace std;

int main(){
	long long int h, w;
	cin >> h >> w;

	if(h == 1 || w == 1)
		cout << "1";
	else if(h * w % 2 == 0)
		cout << h * w / 2;
	else
		cout << (h * w + 1) / 2;
}

Measured memory_bytes: 3596
#[allow(unused_imports)]
use {
   proconio::{fastout, input, marker::*},
   std::cmp::*,
   std::collections::*,
};

#[fastout]
fn main() {
   input! {
      n: usize,
      k: usize,
      a: [usize; n]
   }
   let mut high = 1e9 as usize;
   let mut low = 0;
   while high - low != 1 {
      let mid = (high + low) / 2;
      let mut x = 0;
      for &a in a.iter() {
         x += (a - 1) / mid;
      }
      if x <= k {
         high = mid;
      } else {
         low = mid;
      }
   }
   println!("{}", high);
}


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

namespace AtCoder_20190707_1
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] damWater = Console.ReadLine().Split(' ');
            int k = int.Parse(damWater[0]);
            int x = int.Parse(damWater[1]);

            List<string> answer = new List<string>();

            for(int i = x - k + 1; i < x + k; i++)
            {
                if (-1000000 <= i  && i <= 1000000)
                {
                    answer.Add(i.ToString());
                }
            }

            Console.WriteLine(String.Join(" ",answer.ToArray()));
        }
    }
}

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

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

int main() {
    string s,t;cin>>s>>t;
    int ss,st;ss=s.size();st=t.size();
    int dp[ss+1][st+1];
    bool dp1[ss+1][st+1];
    int inf=10000;
    for(int i=0;i<=ss;i++){
        dp[i][0]=0;
    }
    for(int j=1;j<=st;j++){
        dp[0][j]=inf;
    }
    for(int i=1;i<=ss;i++){
        for(int j=1;j<=st;j++){
            int a=dp[i-1][j-1]+1;
            int b=inf;
            while(a<=st){
                if(s[i-1]==t[a-1]){
                    b=a;
                    a=inf;
                }else{
                    a++;
                }
            }
            dp[i][j]=min(dp[i-1][j],b);
            if(dp[i-1][j]<=b){
                dp1[i][j]=true;
            }else{
                dp1[i][j]=false;
            }
        }
    }
    string ans="";
    int a=-1;
    for(int k=0;k<=st;k++){
        if(dp[ss][k]==inf & a==-1){
            a=k-1;
        }
    }
    if(a==-1){
        a=st;
    }
    for(int i=ss;i>=1;i--){
        if(a>0){
            if(dp1[i][a]==false){
                ans=s[i-1]+ans;
                a=a-1;
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 44288
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  long a[n];
  int i;
  for(i=0;i<n;i++){
    cin >> a[i]; 
  }
  long s[i] = {};
  s[0] = a[0];
  for(i=1;i<n;i++){
    s[i] = a[i] + s[i-1];
  }
  long summ = s[n-1];
  long min = abs(s[0]*2-summ);
  for(i=1;i<n;i++){
    if(min > abs(s[i]*2-summ))min = abs(s[i]*2-summ);
  }
  cout << min;
}

Measured memory_bytes: 3328
#include <iostream>

using namespace std;

int main()
{
    int a;
    int b;
    int sum = 0;
    cin >> a >> b;
    for (int i = 1 ; i <= 3 ; i++){
        if ((a * b * i) % 2 == 1){
            sum++;
        }
    }
    if (sum > 0){
        cout << "Yes";
    }else{
        cout << "No";
    }
    return 0;
}


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

int main(){
    ll n;cin>>n;
    ll amin = 1001001001001001, a;
    rep(i,5){
        cin>>a;
        amin = min(amin, a);
    }
    
    cout << 4LL + (n+amin-1)/amin << endl;
    
    return 0;
}


Measured memory_bytes: 256
// To the MOTHER OF DRAGONS

#include <bits/stdc++.h>
#define ll long long int
#define llu unsigned long long
#define ld long double
#define pb push_back
#define mp make_pair
#define MOD 1000000007
#define PI 3.14159265358979323846
#define RAGE ios::sync_with_stdio(0); cin.tie(0);
using namespace std;

void solve()
{
	string s;
	cin >> s;
	for(ll i = 0; i < s.length() - 1; i++)
	{
		if(s[i] != s[i + 1])
		{
			cout << "Yes\n";
			return;
		}
	}
	cout << "No\n";
}

int main()
{
	RAGE
	ll t;
	//cin >> t;
	//while(t--)
		solve();
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(){
  int h,w;
  char s[101];
  scanf("%d%d",&h,&w);
  for(int i=0;i<h;i++){
    scanf("%s",s);
    printf("%s\n",s);
    printf("%s\n",s);   
  }
  return 0;
}
  

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define mod 1000000007
#define MOD(x) ((x)%mod)
#define pii pair<int,int>
#define mp(a,b) make_pair(a,b)
using namespace std;
int n,m;
struct edge
{
	int to,next;
}e[200005];
int cnt;
int head[200005];
void ins(int u,int v)
{
	cnt++;
	e[cnt].to=v;
	e[cnt].next=head[u];
	head[u]=cnt;
}
bool vis[100005];
int dp[100005];
int in[100005];
int ans;
void dfs(int u,int fa)
{
	vis[u]=1;
	ans=max(ans,dp[u]);
	for(int i=head[u];i;i=e[i].next)
	{
		int v=e[i].to;
		if(v==fa) continue;
		in[v]--;
		dp[v]=max(dp[v],dp[u]+1);
		if(!in[v]) dfs(v,u);
	}
}
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=m;i++)
	{
		int u,v;
		scanf("%d%d",&u,&v);
		ins(u,v);
		in[v]++;
	}
	for(int i=1;i<=n;i++)
		if(in[i]==0&&vis[i]==0) dfs(i,0);
	printf("%d",ans);
	return 0;
}



Measured memory_bytes: 7040
#include<bits/stdc++.h>
#define fo(i,a,b) for((i)=(a);i<=(b);i++)
#define rfo(i,a,b) for((i)=(a);i>=(b);i--)
#define inrange(x,y,z) (((x)>=(y))&&((x)<=(z)))
#define ALL(vec) ((vec).begin(),(vec).end())
#define SOR(vec) sort(ALL(vec))
#define UNI(vec) (vec).erase(unique(ALL(vec)),(vec).end())
using namespace std;
int m;
long long n,a[10010],tot;
int main(){
	#ifdef FILIN
		#ifndef LOCAL
			freopen(FILIN,"r",stdin);
			freopen(FILOUT,"w",stdout);
		#endif
	#endif
	ios::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>n>>m;
	for(int i=1;i<=m;i++){
		cin>>a[i];
		tot+=a[i];
	}
	if(tot>n)
		cout<<-1<<endl;
	else
		cout<<n-tot<<endl;
	return 0;
}


Measured memory_bytes: 3688
#include<iostream>
#include <vector> 
#include <algorithm>
#include<iomanip>
#include<math.h>
#include<string>
#include <cstring>
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))
using namespace std;
struct Room {
	int* a;
	int shortest;
	int way;
	int ways;
};
//for (int x = 0; x < N; x++)room[x].a=(int*)malloc(room[x].way * sizeof(int));
int main() {
	static long N, a[2] = { 0 },sum=0,D;
	cin >> N >> D;
	for (int x = 0; x < N; x++) {
		cin >> a[0];
		cin >> a[1];
		if (sqrt(a[0] * a[0] + a[1] * a[1]) * 10 <=D*10)sum++;
	}
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 3672
# -*- coding: utf-8 -*-
#種類の数を取得
kind = input().split()
kind_int = [int(l) for l in kind]
#価格を取得
price = input().split()
price_int = [int(l) for l in price]
price_int.sort()
#必要な分だけ取り出して合計
price_int_2 = price_int[0:kind_int[1]]
print(sum(price_int_2))

Measured memory_bytes: 9168
#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 <queue>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <complex>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <stdio.h>

using namespace std;

//conversion
//------------------------------------------
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();}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<double> VEC;
typedef vector<VEC> MAT;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<int, PII> TIII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
//container util

//------------------------------------------
#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 MT(a,b,c) MP(a, MP(b, c))
#define T1 first
#define T2 second.first
#define T3 second.second.first
#define T4 second.second.second

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define EPS 1.0e-9

int main(){
	LL p = 100;
	int n;
	cin>>n;
	REP(i,n){
		if(p%20)p+=p/20+1;
		else p+=p/20;
	}
	p*=1000;
	cout << p<< endl;
	return 0;
}

Measured memory_bytes: 1152
#include <iostream>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>
using namespace std;

struct Edge{
	int to, cost;
};

typedef pair<int, int> P;

const int MAX_V = 3010;
const int INF = 1 << 30;

vector<Edge> vec[MAX_V];
int d[MAX_V][11];	// d[i][j] = ??????????????????j????????¨??????i?????§????????¢
priority_queue<P, vector<P>, greater<P> > que;

int c, n, m, s, d0;

void dijkstra(int s, int a){
	for(int i = 0; i < n; ++i){
		d[i][a] = INF;
	}

	d[s][a] = 0;

	que.push(P(0, s));

	while(!que.empty()){
		P p = que.top();
		que.pop();
		int v = p.second;
		if(d[v][a] < p.first) continue;
		for(size_t i = 0; i < vec[v].size(); ++i){
			Edge e = vec[v][i];
			int m0 = (a == 0 ? d[v][a] + e.cost : min(d[v][a] + e.cost, d[v][a - 1] + e.cost / 2));
			if(d[e.to][a] > m0){
				d[e.to][a] = m0;
				que.push(P(d[e.to][a], e.to));
			}
		}
	}
}

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

	while(cin >> c >> n >> m >> s >> d0 && !(c == 0 && n == 0 && m == 0 && s == 0 && d0 == 0)){
		--s, --d0;

		for(int i = 0; i < m; ++i){
			int a, b, f;
			cin >> a >> b >> f;
			--a, --b;
			vec[a].push_back(Edge{b, f});
			vec[b].push_back(Edge{a, f});
		}

		for(int i = 0; i <= c; ++i){
			dijkstra(s, i);
			//cout << d[d0][i] << endl;
		}

		cout << d[d0][c] << endl;

		for(int i = 0; i < n; ++i){
			vec[i].clear();
		}
	}

	return 0;
}

/*
?????????????????°
??????????????????????????°
?????????????????°
???????????????????????±
?????\?????¨??????????????°????????? ?????°?????§???????????????????????????????????????????????°???????????????????????????????????? 
?????????????????° c ??? 1 ??\??? 10 ??\???
??????????????????????????° n ??? 2 ??\??? 100 ??\???
?????????????????° m ??? 1 ??\??? 500 ??\?????? ??´??°??¨????????????
??????????????????????????????????????§??????????????????
?????? f ??? 1000 ??\??? 10000 ??\?????? 100 ???????????´??°??§??????
????????????????????????????????°?????? 1 ?????? n ?????§????????????????????????????????????
????????° s ??¨ ????????° d ?????\????????§??????????????????????????????????????¨????????????
*/

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

int main() {
  int n,k,h,ans=0,i;
  
  scanf("%d%d",&n,&k);
  for(i=0;i<n;i++){
    scanf("%d",&h);
    if(h>=k)ans++;
  }
  
  printf("%d\n",ans);
  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
static const ll MOD = 1e9 + 7;

bool pairCompare(const pair<int, int>& firstElof, const pair<int, int>& secondElof) {
    return firstElof.first > secondElof.first;
}

int main(void) {
    int H, A;
    cin >> H >> A;

    int ans;
    ans = H / A;
    if(H%A!=0) ans++;

    cout << ans;
    return (0);
}


Measured memory_bytes: 256
let inf = 1010101010101010
let rec seq a b = if a >= b then [] else a :: seq (a+1) b
let (>>=) xs f = List.concat (List.map f xs)

let () =
  let n, c = Scanf.scanf "%d %d" (fun x y -> x, y) in
  let d = Array.init c (fun _ ->
    Array.init c (fun _ -> Scanf.scanf " %d" (fun x -> x))) in

  let sc = Array.init 3 (fun _ -> Array.make c 0) in

  seq 0 (n*n) |> List.iter (fun m ->
    let g = (m/n + m mod n) mod 3 in
    Scanf.scanf " %d" (fun x ->
      let col = x-1 in
      seq 0 c |> List.iter (fun i ->
        sc.(g).(i) <- sc.(g).(i) + d.(col).(i))));

  seq 0 c >>= (fun i ->
  seq 0 c >>= (fun j ->
  seq 0 c >>= (fun k ->
    if i = j || j = k || k = i then []
    else [ sc.(0).(i) + sc.(1).(j) + sc.(2).(k) ])))
  |> List.fold_left min inf
  |> Printf.printf "%d\n"

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

int main() {
    int M, D;
    cin >> M >> D;

    int ans = 0;

    for (int m = 1; m <= M; ++m) {
        for (int d = 1; d <= D; ++d) {
            int d1 = d % 10;
            int d10 = d / 10;

            if (d1 >= 2 && d10 >= 2 && m == d1 * d10) {
                ++ans;
            }
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
N, M = map(int, input().split())
query = [list(map(int, input().split())) for _ in range(M)]
query = sorted(query, key=lambda x: x[1])

rightest_bridge = -1
ans = 0
for a, b in query:
    if a > rightest_bridge:  # 現状切られている橋の中で最も右の橋よりも右にあるなら、区間の最も右の橋を切って要望を満たす
        ans += 1
        rightest_bridge = b-1
print(ans)


Measured memory_bytes: 29848
include Math
gets.to_i.times do
  x1, y1, x2, y2, x3, y3 = gets.split(' ').map(&:to_f)

  a = ((x3 - x2) ** 2 + (y3 - y2) ** 2) ** 0.5
  b = ((x3 - x1) ** 2 + (y3 - y1) ** 2) ** 0.5
  c = ((x2 - x1) ** 2 + (y2 - y1) ** 2) ** 0.5

  cosA = (-a ** 2 + b **2 + c ** 2) / (2 * b * c)
  cosB = (a ** 2 - b **2 + c ** 2) / (2 * a * c)
  cosC = (a ** 2 + b **2 - c ** 2) / (2 * a * b)

  sin2A = sin(2 * acos(cosA))
  sin2B = sin(2 * acos(cosB))
  sin2C = sin(2 * acos(cosC))

  px = (x1 * sin2A + x2 * sin2B + x3 * sin2C) / (sin2A + sin2B + sin2C)
  py = (y1 * sin2A + y2 * sin2B + y3 * sin2C) / (sin2A + sin2B + sin2C)
  r = (((px - x1) ** 2 + (py - y1) ** 2) ** 0.5).round(3)

  # puts "#{px.round 3} #{py.round 3} #{r}"
  puts "%.3f %.3f %.3f" % [px, py, r]
end



Measured memory_bytes: 7024
program main
    use,intrinsic :: iso_fortran_env
    implicit none
    character(3):: s

    read*, s

    if (s == "RRR") then
        print'(i0)', 3
    else if (s(1:2) == "RR" .or. s(2:3) == "RR") then
        print'(i0)', 2
    else if (s == "SSS") then
        print'(i0)', 0
    else
        print'(i0)', 1
    end if
end program main

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

using namespace std;

typedef unsigned int ui;
typedef long long ll;
typedef unsigned long long ull;

constexpr int MAXS = 100;

char s[MAXS + 2];

int main() {
	cin >> s;
	int len = strlen(s);
	cout << s[0] << (len - 2) << s[len - 1] << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
#define INF LLONG_MAX/3
#define eps LDBL_EPSILON
#define moder 1000000007
#define pie 3.141592653589793238462643383279
#define P std::pair<int,int>
#define prique priority_queue
using namespace std;
int x,y;
signed main(){
	cin>>x>>y;
	if(abs(x-y)<=1)puts("Brown");
	else puts("Alice");
	return 0;
}

Measured memory_bytes: 256