akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<vector>
#define rg register
using namespace std;
template<typename T>inline void in(T &a)
{
	T ch=getchar(),f=1;
	for(a=0;!isdigit(ch);ch=getchar())
	  ch=='-'?f=-1:f=f;
	for(;isdigit(ch);ch=getchar())
	  a=(a<<3)+(a<<1)+ch-'0';
	a*=f;
}
template<typename T>inline void print(T x)
{
	if(x<0)
	  x=-x,putchar('-');
	if(x>9)
	  print(x/10);
	putchar(x%10+'0');
}
long long p,n,tot;
long long a[10000000][2];
long long kk;
inline void prim()
{
	long long sq=sqrt(p)+1;
	for(rg long long i=2;i<=sq;i++)
	if(p%i==0)
    {  
       	kk=0;
       	tot++;
       	a[tot][1]=i;
	    while(p%i==0)  
        {
            a[tot][0]=++kk;
            p/=i;  
        } 
    }
}
inline int power(int a,int b)
{
	int ans=1;
	for(;b;b>>=1,a*=a)
	if(b&1) ans*=a;
	return ans;
}
signed main()
{
	cin>>n>>p;
	if(n==1)
	{
		cout<<p<<endl;
		return 0;
	}
	a[++tot][0]=n,a[tot][1]=1;
	prim();
	long long ans=1,tmp;
	for(rg long long i=tot;i>=1;i--)
	if(n<=a[i][0])
	{
		tmp=a[i][0]/n;
		ans*=power(a[i][1],tmp);
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
N = int(input())
A = [int(i) for i in input().split()]
A.sort(reverse = True)

def calc(a, b):
    largeNum = max(a, b)
    smallNum = min(a, b)
    while(largeNum != 0 and smallNum != 0):
        largeNum %= smallNum
        x = largeNum
        largeNum = smallNum
        smallNum = x
    return max(smallNum, largeNum)

ans = 1
for i in range(0, N - 1):
    a = calc(A[i], A[i+1])
    A[i], A[i+1] = a, a
    if a == 1:
        break
else:
    ans = min(A)

print(ans)

Measured memory_bytes: 14252
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int x1,y1,x2,y2,x3,y3,x4,y4;
  cin >>x1>>y1>>x2>>y2;
  x3=x2-y2+y1;
  x4=x3-x2+x1;
  y3=y2+x2-x1;
  y4=y3-y2+y1;
  cout<<x3<<" "<<y3<<" "<<x4<<" "<<y4<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, b) for(ll i = ll(a); i < ll(b); i++)
#define rer(i, a, b) for(ll i = ll(a) - 1; i >= ll(b); i--)
#define sz(v) (int)(v).size()
#define pb push_back
#define sc second
#define fr first
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define uniq(vec) vec.erase(unique(vec.begin(),vec.end()),vec.end())
using namespace std;
typedef long long int ll;
typedef pair <int, int> P;

const ll MOD=1000000007;
vector<int> E[100001];
ll N,M;
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin>>N>>M;
    deque<int> d;
    set<int> s;
    int a,b;
    rep(i,0,M){
        cin>>a>>b;
        E[a].pb(b);
        E[b].pb(a);
    }
    d.push_front(a);
    d.pb(b);
    s.insert(a);
    s.insert(b);
    for(;;){
        bool t=true;
        rep(i,0,sz(E[b])){
            if(s.find(E[b][i])==s.end()){
                b=E[b][i];
                d.pb(b);
                s.insert(b);
                t=false;
                break;
            }
        }
        if(t) break;
    }
    for(;;){
        bool t=true;
        rep(i,0,sz(E[a])){
            if(s.find(E[a][i])==s.end()){
                a=E[a][i];
                d.push_front(a);
                s.insert(a);
                t=false;
                break;
            }
        }
        if(t) break;
    }
    cout <<sz(d)<<"\n";
    rep(i,0,sz(d)){
        if(i==sz(d)-1) cout <<d[i]<<"\n";
        else cout <<d[i]<<" ";
    }
}

Measured memory_bytes: 11392
#include<stdio.h>
#pragma GCC optimize("O2")
#pragma GCC optimize("O3")
#pragma GCC target("avx")
#define rep(i,N) for(int i=0;i<(int)N;i++)
const int MOD=1e9+7,MAX=1e6;
static inline int IN(void)
{
  int x=0,f=0,c=getchar();while(c<48||c>57){f^=c==45,c=getchar();}
  while(c>47&&c<58){x=x*10+c-48,c=getchar();}return f?-x:x;
}
typedef struct{int SPF[1000001];int Primes[168];int sz;}Template;
struct T{int fact[1000001],inv[1000001];};
Template P;struct T MODINV;
static inline int MPow(int a,int b){return b?1l*MPow(1l*a*a%MOD,b>>1)*(b&1?a:1)%MOD:1;}
static inline void ready(void)
{
  *P.SPF=1,*P.Primes=2,P.sz=1;
  rep(i,MAX/2)P.SPF[2*(i+1)]=2,P.SPF[2*(i+1)-1]=2*(i+1)-1;
  rep(i,MAX/2-1)
  {
    int x=2*(i+1)+1;if(P.SPF[x]==x){P.Primes[P.sz++]=x;}if(x*x>MAX)break;
    rep(j,P.sz){if(P.Primes[j]<=P.SPF[x]&&x*P.Primes[j]<=MAX)P.SPF[x*P.Primes[j]]=P.Primes[j];else break;}
  }
}
static inline void init(void)
{
  MODINV.fact[0]=1;rep(i,MAX)MODINV.fact[i+1]=1l*MODINV.fact[i]*(i+1)%MOD;
  MODINV.inv[MAX]=MPow(MODINV.fact[MAX],MOD-2);
  rep(i,MAX)MODINV.inv[MAX-1-i]=1l*MODINV.inv[MAX-i]*(MAX-i)%MOD;
}
int main(void)
{
  int N=IN(),A=0,flag=0,invsum=0,k=0,lcm=1,x=0,box[168]={0},unique[9999];ready();init();
  rep(i,N)
  {
    A=IN();invsum=(invsum+1l*MODINV.fact[A-1]*MODINV.inv[A]%MOD)%MOD;
    rep(j,168){x=0;while(A%P.Primes[j]==0){A/=P.Primes[j];if(box[j]<++x)box[j]=x;}}
    if(A!=1){rep(j,k){if(unique[j]==A)flag=1;continue;}if(!flag)unique[k++]=A;}flag=0;
  }
  rep(i,168){rep(j,box[i]){lcm=1l*lcm*P.Primes[i]%MOD;}}
  rep(i,k){lcm=1l*lcm*unique[i]%MOD;}
  x=1l*lcm*invsum%MOD;return printf("%d\n",x),0;
}

Measured memory_bytes: 13360
#include<bits/stdc++.h>
#define ll long long
#define ff first
#define ss second
using namespace std;

const int N = 1e6+69;

ll n,x,y,k,m,a,b;

char c;
string s,t;

int A[N];

int main(){

	cin>>n;
	for(int i=n;;i++){
		bool ok = true;
		for(int j=2;j*j<=i;j++)
		if(i%j==0){
			ok=false;
			break;
		}
		if(ok){
			cout<<i<<endl;
			return 0;
		}
	}
}

Measured memory_bytes: 256
#![allow(
    non_snake_case,
    unused_variables,
    unused_assignments,
    unused_mut,
    unused_imports,
    dead_code
)]
//use proconio::fastout;
use proconio::input;
use proconio::marker::*;
//use std::collections::HashSet;
use std::cmp::*;
//use std::collections::VecDeque;

fn main() {
    input! {
      r:i32,D:i32, mut x:i32
    }
    for i in 0..10 {
        x = r * x - D;
        println!("{}", x);
    }
}


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

namespace ConsoleApp19 {
    class Program {
        static void Main(string[] args) {
            int[] A = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();

            int A1 = A[0];
            int A2 = A[1];
            int A3 = A[2];

            if (A1 + A2 + A3 >= 22) {
                Console.WriteLine("bust");
            } else {
                Console.WriteLine("win");
            }

        }
    }
}


Measured memory_bytes: 13396
def main():
    from heapq import heappop, heappush
    import sys

    input = sys.stdin.readline

    N = int(input())
    a = [int(input()) for _ in range(N)]

    def binary_search(b, x):
        ok, ng = len(b), -1
        while abs(ok - ng) > 1:
            mid = (ok + ng) // 2
            if b[mid] < x:
                ok = mid
            else:
                ng = mid
        return ok

    b = [-1]
    for x in a:
        i = binary_search(b, x)
        if i == len(b):
            b.append(x)
        else:
            b[i] = x

    ans = len(b)

    print(ans)


if __name__ == '__main__':
    main()

# import sys
#
# sys.setrecursionlimit(10 ** 7)
#
# input = sys.stdin.readline
# rstrip()
# int(input())
# map(int, input().split())


Measured memory_bytes: 7880
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

struct RollingHash{
    static const int MD = 3;
    static const vector<ll> hash_base, hash_mod;

    int n;
    vector<ll> hs[MD], pw[MD];

    RollingHash(){}
    RollingHash(const string &s){
        n = s.size();
        rep(i,MD){
            hs[i].assign(n+1,0);
            pw[i].assign(n+1,0);
            hs[i][0] = 0;
            pw[i][0] = 1;
            rep(j,n){
                pw[i][j+1] = pw[i][j]*hash_base[i] % hash_mod[i];
                hs[i][j+1] = (hs[i][j]*hash_base[i]+s[j]) % hash_mod[i];
            }
        }
    }

    // 1-index
    ll hash_value(int l, int r, int i){
        return ((hs[i][r] - hs[i][l]*pw[i][r-l])%hash_mod[i]+hash_mod[i])%hash_mod[i];
    }

    bool match(int l1, int r1, int l2, int r2){
        bool ret = true;
        rep(i,MD) ret &= (hash_value(l1-1,r1,i) == hash_value(l2-1,r2,i));
        return ret;
    }

    vector<ll> calc(int l, int r){
        vector<ll> ret(MD);
        rep(i,MD) ret[i]=hash_value(l-1,r,i);
        return ret;
    }
};
const vector<ll> RollingHash::hash_base{1009,1021,1013};
const vector<ll> RollingHash::hash_mod{1000000009,1000000007,1000000021};

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

    int S = s.size();
    RollingHash h(s);

    int aa = 0;
    for(int a=1; a<S; ++a)
    {
        int b = S-3*a;
        if(b<=0) continue;
        if(b%2==1) continue;

        b/=2;
        bool valid = true;

        if(h.calc(1,a)!=h.calc(a+b+1,a+b+a)) valid = false;
        if(h.calc(a+b+1,a+b+a)!=h.calc(2*(a+b)+1,2*(a+b)+a)) valid = false;
        if(h.calc(a+1,a+b)!=h.calc(2*a+b+1,2*a+b+b)) valid = false;

        if(valid) aa = a;
    }

    if(aa==0) cout << "mitomerarenaiWA" << endl;
    else
    {
        int l = aa + (S-3*aa)/2;
        cout << "Love " << s.substr(0,l) << "!" << endl;
    }
    return 0;
}

Measured memory_bytes: 51240
#include <cstdio>
#include <cstring>
#include <cmath>
#include <bitset>
#include <iostream>
#include <algorithm>
typedef long long ll;
using namespace std;
const int maxn=100100;
int n;
char sz[maxn];
int main(){
    scanf("%s",sz+1);
    n=strlen(sz+1);
    if(sz[n]=='1'||sz[1]=='0'||sz[n-1]=='0'){
        printf("-1\n");
        return 0;
    }
    for(int i=2;i<=n-1;i++){
        if(sz[i]!=sz[n-i]){
            printf("-1\n");
            return 0;
        }
    }
    int root=2,num=1,now=2;
    printf("2 1\n");
    while(now<=n-now){
        if(sz[now]=='1'){
            printf("%d %d\n",++now,root);
            root=now;
        }else{
            printf("%d %d\n",++now,root);
        }
        num++;
    }
    for(int i=num+1;i<n;i++){
        printf("%d %d\n",root,++now);
    }
    return 0;
}

Measured memory_bytes: 1536
using System;
class Aoj
{
    public static void Main()
    {
        String[] st = Console.ReadLine().Split(' ');
        double a = double.Parse(st[0]);
        double r = a * a *Math.PI;
        double f = a * 2 * Math.PI;
        Console.WriteLine("{0} {1}",r,f);
    }

}

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

using namespace std;

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

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

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

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

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

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

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

int main(void){
  vector<int> a;
  int x;
  cin >> x; a.PB(x);
  cin >> x; a.PB(x);
  cin >> x; a.PB(x);

  sort(ALL(a));

  if(a[0] == 5 && a[1] == 5 && a[2] == 7) cout << "YES" << endl;
  else cout << "NO" << endl;

  return 0;
}


Measured memory_bytes: 256
#[allow(unused_imports)]
use std::cmp;
use std::io::Write;

// Input macro from https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
  (source = $s:expr, $($r:tt)*) => {
    let mut iter = $s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
  ($($r:tt)*) => {
    let s = {
      use std::io::Read;
      let mut s = String::new();
      std::io::stdin().read_to_string(&mut s).unwrap();
      s
    };
    let mut iter = s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
}

macro_rules! input_inner {
  ($iter:expr) => {};
  ($iter:expr, ) => {};

  ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
    let $var = read_value!($iter, $t);
    input_inner!{$iter $($r)*}
  };
}

macro_rules! read_value {
  ($iter:expr, ( $($t:tt),* )) => {
    ( $(read_value!($iter, $t)),* )
  };

  ($iter:expr, [ $t:tt ; $len:expr ]) => {
    (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
  };

  ($iter:expr, chars) => {
    read_value!($iter, String).chars().collect::<Vec<char>>()
  };

  ($iter:expr, usize1) => {
    read_value!($iter, usize) - 1
  };

  ($iter:expr, [ $t:tt ]) => {{
    let len = read_value!($iter, usize);
    (0..len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
  }};

  ($iter:expr, $t:ty) => {
    $iter.next().unwrap().parse::<$t>().expect("Parse error")
  };
}

fn main() {
  let out = std::io::stdout();
  let mut out = std::io::BufWriter::new(out.lock());
  macro_rules! puts {
    ($($format:tt)*) => (write!(out,$($format)*).unwrap());
  }
  input! {
    _n: usize,
    s: chars,
  }
  let mut prev = '0';
  let mut ans = 0;
  for &c in &s {
    if c == prev {
      continue;
    }
    ans += 1;
    prev = c;
  }

  puts!("{}\n", ans);
}


Measured memory_bytes: 4352
import java.util.*;
public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      long[] dp = new long[n+1];
      dp[0] = 2;
      dp[1] = 1;
      for(int i = 2 ; i <= n ; i++){
      	dp[i] = dp[i-1] + dp[i-2];
      }
      System.out.println(dp[n]);
    }
}


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

using namespace std;

const int MAXN = 1010;

int dp[MAXN][MAXN];

const int MOD = 1e9 + 7;
int main() {
    #ifdef BLAT
        freopen("input", "r", stdin);
    #endif


    int n, m;
    cin >> n >> m;

    dp[1][1] = 1;

    for(int i = 1; i <= n; ++i) {
    	for(int j = 1; j <= m; ++j) {
    		char c;
    		cin >> c;
    		if(c == '#') continue;
    		dp[i+1][j] += dp[i][j];
    		dp[i][j+1] += dp[i][j];
    		if(dp[i+1][j] >= MOD) dp[i+1][j] -= MOD;
    		if(dp[i][j+1] >= MOD) dp[i][j+1] -= MOD;
    	}
    }

    cout << dp[n][m] << '\n';
}   	

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

int main() {
  int n, k;
  cin >> n >> k;
  int h[n];
  rep(i, n) cin >> h[i];
  
  ll score[n+k] = {0};
  
  for (int i=1; i<n; i++) {
    ll min_s = pow(10, 10);
    for (int j=max(0, i-k); j<i; j++) {
      min_s = min(min_s, abs(h[i] - h[j]) + score[j]);
    }
    score[i] = min_s;
  }
  cout << score[n-1];
  
  return 0;
}


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

int main(){
  
  int q, com, x, l, r;
  set<int> S;
  
  cin >> q;
  for(int i = 0;i < q;i++){
    cin >> com;
    
    if(com == 0){
      cin >> x;
      S.insert(x);
      cout << S.size() << endl;
    }else if(com == 1){
      cin >> x;
      cout << S.count(x) << endl;
    }else if(com == 2){
      cin >> x;
      S.erase(x);
    }else if(com == 3){
      set<int>::iterator itl, itr;
      
      cin >> l >> r;
      itl = S.lower_bound(l);
      itr = S.upper_bound(r);
      
      for(set<int>::iterator it = itl;it != itr;it++) cout << *it << endl;
    }
  }
  
  return 0;
}


Measured memory_bytes: 12464
#include <iostream>
#include <algorithm>

using namespace std;
 
int main() {
 int kaisu;
 int x,y,z;
 int kekka;

 cin >> kaisu;

 for(int i = 1; i <= kaisu; i++){
 cin >> x >> y >> z;
 int array[3];
 array[0] = x;
 array[1] = y;
 array[2] = z;
 if( array[0] < array[1] ){
 swap(array[0],array[1]);
 }
 if( array[0] < array[2] ){
 swap(array[0],array[2]);
 }
 if( array[1] < array[2] ){
 swap(array[1],array[2]);
 }

 if ((array[1]*array[1]+array[2]*array[2]) == array[0]*array[0]){
 cout << "YES"<<endl;
 }
 else {
 cout << "NO" << endl;
 }

 }
 
return 0;
 } 

Measured memory_bytes: 1152
import java.util.Scanner;



public class Main {

	public static void main(String[] args) {

		Solve s= new Solve();
		s.solve();

	}
}


class Solve{


	 public void solve() {
		 Scanner sc = new Scanner(System.in) ;
		 int r = sc.nextInt();
		 int D = sc.nextInt();
		 int x2000 = sc.nextInt();
		 int res = r*x2000-D;
		 int res2 = 0;
		 System.out.println(res);
		 
		for(int i = 0;i<9;i++) {
			 res2 = r*res-D;
			 res = res2;
			 System.out.println(res2);
		}
		 
		 
		 
	




		 }
}

Measured memory_bytes: 21716
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define M1 					1000000007
#define M2 					998244353
#define ll 					long long int
#define pll 				pair<ll,ll>
#define mll 				map<ll,ll>
#define F 					first
#define S 					second
#define PB 					push_back
#define mp 					make_pair
#define lb 					lower_bound
#define ub 					upper_bound
#define V(a) 				vector<a>
#define endl 				'\n'
#define test(t) 			while(t--)
#define PI 					acos(-1.0)
#define rep(i,a,b) 			for(ll i=a;i<b;i++)
#define repp(i,b,a) 		for(ll i=b-1;i>=a;i--)
#define clr(ar, val)		memset(ar, val, sizeof(ar))
#define setbits(x) 			__builtin_popcountll(x)
#define zrobits(x) 			__builtin_ctzll(x)
#define ps(y) 				fixed << setprecision(y)
#define all(x) 				begin(x),end(x)
#define allr(x) 			rbegin(x),rend(x)
const int inf= 				0x3f3f3f3f;
const ll INF= 				0x3f3f3f3f3f3f3f3f;
const int dx[4]= 			{ 0, -1, 0, 1 };
const int dy[4]= 			{ -1, 0, 1, 0 };

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template<typename T>
#define o_set(T) tree<T, null_type,less<T>, rb_tree_tag,tree_order_statistics_node_update>
//member functions :
//1. order_of_key(k) : number of elements strictly lesser than k
//2. find_by_order(k) : k-th element in the set

ll CalculateMex(set<ll> Set){
    ll Mex = 0;
    while(Set.find(Mex)!=Set.end()){
        Mex++;
    }
    return Mex;
}

ll floor_div(ll a, ll b) {
	return a / b - (((a ^ b) < 0) and a % b);
}
ll ceil_div(ll a, ll b){
    return a / b + (((a ^ b) >= 0) and a % b);
}

inline void INP()
{
	#ifndef ONLINE_JUDGE
	    freopen("input.txt","r",stdin);   
	    freopen("output.txt","w",stdout);
	#endif 
}

void solve()
{
    ll n;
    cin>>n;
    cout << ps(15) << 2*PI*n << endl;

}

int32_t main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int t=1;
    // cin>>t;
    test(t){
        solve();
    }
    return 0;
}


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

int main() {
	int i,j,k;
	int n,d;
	double dis;
	int tmp;
	int ans = 0;
	
	cin >> n >> d;
	
	double **array = new double*[n];
	for (i = 0; i < n; i++) {
	    array[i] = new double[d];
		for (j = 0; j < d; j++){
			cin >> array[i][j];
		}
	}
	
	for (i = 0; i < n-1; i++){
		for (j = i+1; j < n; j++){
			dis = 0;
			for(k = 0; k < d; k++){
				dis += pow(array[i][k] - array[j][k], 2.0);
			}
			
			dis = sqrt(dis);
			
			if (dis - (int)dis == 0){
				ans++;
			}
		}
	}
	
	cout << ans;
	
	return 0;
	
}

Measured memory_bytes: 256
//https://betrue12.hateblo.jp/entry/2018/06/24/220417

#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>;
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)

int k;
ll sum(ll num){
    ll res=0;
    while(num>0){
        res+=num%10;
        num/=10;
    }
    return res;
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);

    cin>>k;
    ll last=1;
    vector<ll>ans;
    ans.push_back(1);
    ll diff=1;
    ll cur=k;
    while(--cur>0){
        ll num1=last+diff;
        ll num2=last+diff*10;
        ll next;
        if(num1*sum(num2)<=num2*sum(num1)){
            next=num1;
        }else
        {
            next=num2;
            diff*=10;
        }
        ans.push_back(next);
        last=next;        
    }
    rep(i,k)cout<<ans[i]<<endl;

    return 0;
}



Measured memory_bytes: 256
#include <stdio.h>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
#include <functional>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef vector<vector<int>> v2int;
typedef vector<vector<vector<int>>> v3int;
typedef vector<ll> vll;
typedef vector<vector<ll>> v2ll;
typedef vector<vector<vector<ll>>> v3ll;
typedef list<int> liint;
typedef pair<int, int> pint;
typedef vector<pair<int, int>> vpint;
typedef vector<pair<ll, ll>> vpll;
typedef vector<pair<ll, int>> vpll_int;
typedef vector<pair<int, ll>> vpint_ll;
typedef set<pair<int, int>> spint;
typedef set<pair<ll, int>> spll;
typedef unordered_map<int, unordered_set<int>> Graph;
const int INF = int(2e9);
const ll LINF = ll(2e9) * ll(2e9);
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T, class C> void chmax(T& a, C b) { a > b ? : a = b; }
template<class T, class C> void chmin(T& a, C b) { a < b ? : a = b; }



int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string S, T;
    cin >> S >> T;
    ll ans = 0;
    rep(i, S.size()) {
        if (S[i] != T[i]) ans++;
    }

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

Measured memory_bytes: 3768
import bisect
import cmath
import heapq
import itertools
import math
import operator
import os
import random
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353

A = [list(map(int, sys.stdin.buffer.readline().split())) for _ in range(3)]
N = int(sys.stdin.buffer.readline())
B = [int(sys.stdin.buffer.readline()) for _ in range(N)]

A = np.array(A, dtype=int)
board = np.zeros((3, 3), dtype=bool)
for b in B:
    board[A == b] = True

ok = False
for i in range(3):
    ok |=np.all(board[i])
    ok |=np.all(board[:, i])
a = True
b = True
for i in range(3):
    a &= board[i][i]
    b &= board[i][~i]
ok |= a
ok |= b
if ok:
    print('Yes')
else:
    print('No')



Measured memory_bytes: 24060
import java.util.*;

public class Main {
	private static final int NOT_FOUND = 10;

	public static void main(String[] args) {
		try (Scanner s = new Scanner(System.in)) {
			String n = s.next();
			int[] src = new int[n.length()];
			for (int i = 0; i < n.length(); i++) {
				src[i] = Integer.parseInt(n.substring(i, i + 1));
			}
			int k = s.nextInt();
			boolean[] d = new boolean[10];
			for (int i = 0; i < k; i++) {
				d[s.nextInt()] = true;
			}

			int minValue = getNextValue(d, 0);
			StringBuilder sb = new StringBuilder(src.length + 1);
			for (int i = src.length - 1; i >= 0; i--) {
				int c = src[i];
				int newValue = getNextValue(d, c);
				if (c != newValue) {
					if (newValue == NOT_FOUND) {
						if (i != 0) {
							src[i - 1]++;
						} else {
							sb.append(getNextValue(d, 1));
						}
						src[i] = minValue;
					} else {
						src[i] = newValue;
					}
					for (int j = i + 1; j < src.length; j++) {
						src[j] = minValue;
					}
				}
			}
			for (int i = 0; i < n.length(); i++) {
				sb.append(src[i]);
			}
			System.out.println(sb);
		}
	}

	public static int getNextValue(boolean[] d, int value) {
		for (int i = value; i < d.length; i++) {
			if (d[i] == false) {
				return i;
			}
		}
		return NOT_FOUND;
	}
}


Measured memory_bytes: 23636
import math
x = int(input())
# 6,5,6,5 ・・・と得点していく
# 答えはx/5.5付近
t = math.ceil(x/5.5)
def f(n):
    return 6*n - n//2

if x <= f(t-1):
    print(t-1)
elif x <= f(t):
    print(t)
else:
    print(t+1)

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

int main()
{
	int N;
	cin >> N;
	vector<ll> A(N);
	for(int i(0);i<N;++i){
		cin >> A[i];
	}
	bool allEven(true);
	int ans(0);
	while(allEven){
		for(int i(0);i<N;++i){
			if(A[i] % 2 == 1){
				allEven = false;
				break;
			}else{
				A[i] /= 2;
			}
		}
		if(allEven)ans++;
	}
	cout << ans << endl;
	return 0;
}

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

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

Measured memory_bytes: 3632
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define int ll
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a) (a).begin(),(a).end()
#define pb emplace_back

int n,m;
int f(vector<int> &a, vector<int> &b, vector<int> &c, int p1, int p2, int p3){
    vector<int> v(n);
    rep(i,n){
        v[i] = a[i]*p1 + b[i]*p2 + c[i]*p3;
    }
    
    sort(all(v),greater<int>());
    
    int ret = 0;
    rep(i,m)ret += v[i];
    
    return ret;
}


signed main(){
    cin>>n>>m;
    vector<int> a(n),b(n),c(n);
    rep(i,n){
        cin>>a[i]>>b[i]>>c[i];
    }
    
    int ans = 0;
    for(int i=-1;i<=1;i+=2){
        for(int j=-1;j<=1;j+=2){
            for(int k=-1;k<=1;k+=2){
                ans = max(ans,f(a,b,c,i,j,k));
            }
        }
    }

    cout<<ans<<endl;
    
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	int cnt=0;
	for(int i=1;i<=n;i++)
	{
		int val=n/i;
		if(n%i==0)val-=1;
		cnt+=val;
	}
	cout<<cnt;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
typedef long long int llong ;

#define pb     push_back
#define mp     make_pair
#define all(v) v.begin() , v.end()
#define allr(v) v.rbegin(), v.rend()
const int MOD = 1e9+7;
const int NMAX = 1e5+5;
template<typename T, template<typename ELEM, typename ALLOC=std::allocator<ELEM> > class Container>
std::ostream& operator<< (std::ostream& o, const Container<T>& container)
{ typename Container<T>::const_iterator beg = container.begin();
  /*o << "[";*/ while(beg != container.end()) o << " " << *beg++; /*o << " ]";*/ return o; }
int n, a, b;

#define foreach(v,c) for (typeof((c).begin()) v = (c).begin(); v != (c).end(); ++v)

static vector<pair<int,int> >x, y;
static vector<pair<int, llong> > adj[NMAX + 1];
static bool visited[NMAX + 1];
static int d[NMAX + 1];

llong prim(int start) {
  fill(d, d + n + 1, INT_MAX);

  priority_queue<pair<llong, int> > q;
  d[start] = 0;
  q.push(make_pair(0, start));
  llong res = 0;

  while (!q.empty()) {
    int dist = -q.top().first;
    int a = q.top().second;
    q.pop();
    if (dist > d[a]) continue;
    res += dist;
    visited[a] = true;

    foreach(it, adj[a]) {
      int b = it->first;
      llong w = it->second;
      if (!visited[b] && w < d[b]) {
        d[b] = w;
        q.push(make_pair(-w, b));
      }
    }
  }

  return res;
}

int main(int argc, char const *argv[])
{
  ios_base::sync_with_stdio(false);
    scanf("%d" , &n);

  for(int i = 1 ; i <= n ; i++){
    scanf("%d %d", &a, &b);
    x.pb(mp(a, i));
    y.pb(mp(b, i));
  }

  sort(all(x));
  sort(all(y));

  for(int i = 1 ; i < (int)x.size() ; i++){
    adj[x[i-1].second].pb(mp(x[i].second, abs(x[i].first - x[i-1].first)));
    adj[x[i].second].pb(mp(x[i-1].second, abs(x[i].first - x[i-1].first)));
  }

   for(int i = 1 ; i < (int)y.size() ; i++){
    adj[y[i-1].second].pb(mp(y[i].second, abs(y[i].first - y[i-1].first)));
    adj[y[i].second].pb(mp(y[i-1].second, abs(y[i].first - y[i-1].first)));
  }

  printf("%lld", prim(1));

  return 0;
}  



Measured memory_bytes: 15856
#include <bits/stdc++.h>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstring>
#include <chrono>
#include <complex>
#define endl "\n"
#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define vvi vector < vi >
#define pii pair<int,int>
#define pll pair<long long, long long>
#define mod 1000000007
#define inf 1000000000000000001;
#define all(c) c.begin(),c.end()
#define mp(x,y) make_pair(x,y)
#define mem(a,val) memset(a,val,sizeof(a))
#define eb emplace_back
#define f first
#define s second

using namespace std;
int main()
{
	std::ios::sync_with_stdio(false);
	char ch;
	cin>>ch;
	if(ch>='a' && ch<='z'){
		cout<<'a'<<endl;
	}
	else if(ch>='A' && ch<='Z'){
		cout<<"A"<<endl;
	}

	return 0;
}


Measured memory_bytes: 3632
use proconio::input;
use std::cmp;

fn main() {
    input! {
        n:isize,
        k:isize,
        x:isize,
        y:isize
    }
    let v1 = cmp::min(n, k);
    let v2 = cmp::max(n - k, 0);
    println!("{}", v1 * x + v2 * y);
}


Measured memory_bytes: 2120
#include <iostream>
#include <cstdio>
#include <algorithm>

using namespace std;

int main(){
	
	while(true){
		
		int n;
		
		int a[200];
		
		cin >> n;
		
		if(n == 0){
			break;
		}
		
		int ans = 0;
		
		for(int i = 0; i < n; i++){
			cin >> a[i];
		}
		
		for(int i = 0; i < n - 1; i++){
			for(int j = i + 1; j < n; j++){
				if(a[i] > a[j]){
					ans++;
				}
			}
		}
		
		cout << ans << endl;
		
	}
	
	return 0;
}

Measured memory_bytes: 3052
N = int(input())
if N < 10 :
    L = []
    for i in range(1, N + 1):
        L.append(i)
    print(len(L))

elif 10 <= N < 100:
    L = []
    for i in range(1, 10):
        L.append(i)
    print(len(L))

elif 100 <= N < 1000:
    L = []
    for i in range(1, 10):
        L.append(i)
    for i in range(100, N + 1):
        L.append(i)
    print(len(L))

elif 1000 <= N < 10000 :
    L = []
    for i in range(1, 10):
        L.append(i)
    for i in range(100, 1000):
        L.append(i)
    print(len(L))

elif 10000 <= N < 100000 :
    L = []
    for i in range(1, 10):
        L.append(i)
    for i in range(100, 1000):
        L.append(i)
    for i in range(10000, N + 1):
        L.append(i)
    print(len(L))

elif N == 100000 :
    L = []
    for i in range(1, 10):
        L.append(i)
    for i in range(100, 1000):
        L.append(i)
    for i in range(10000, 100000):
        L.append(i)
    print(len(L))

Measured memory_bytes: 6704
using System;

 namespace Rextester
{
    public class Program    {
        public static void Main(string[] args)
        {
            int s, h, m;
            s = int.Parse(Console.ReadLine());
            h = s / 3600;
            s = s % 3600;
            m = s / 60;
            s = s % 60;
            Console.WriteLine(h + ":" + m + ":" + s);
         }
     }
 }



Measured memory_bytes: 19964
#include<iostream>
#include<string>

using namespace std;

int main()
{
  int N, K, Q;
  cin >> N;
  cin >> K;
  cin >> Q;


  int member[N];
  for(int i=0; i<N; i++)
  {
    member[i] = K -Q;
  }

  
  int A[Q];
  for(int i=0; i<Q; i++)
  {
    cin >> A[i];
  }
  
  for(int i=0; i<Q; i++)
  { 
    member[A[i]-1] = member[A[i]-1] + 1;
  }   

  for(int i=0; i<N; i++)
  {
 //   cout << member[i] << endl;
    if( member[i] >= 1)
    {   
        cout << "Yes" << endl;
    }   
    else
    {   
        cout << "No" << endl;
    }   
  }
  return 0;
}

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


int main()
{
int X;
cin >> X;
int ans = 1;
for(int i = X; i <= 1e9; i++){
  bool flag = true;
  for(int j = 2; j * j <= i; j++){
      if(i % j == 0) {
        flag = false;
        break;
  }

}
  if(flag) {
    ans = i;
    break;
  }
}
cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int X, t;
    cin >> X >> t;
    cout << max(0, X - t) << endl;

    return 0;
}


Measured memory_bytes: 3652
#include <iostream>

using Int = long long;

int main() {
    int n;
    std::cin >> n;
    Int a = 1, b = 0;
    for (int i = 0; i < n; ++i) {
        int q;
        Int x;
        std::cin >> q >> x;
        if (q == 1) {
            a *= x;
            b *= x;
        } else {
            b += x * (q == 2 ? 1 : -1);
        }
    }

    std::cout << -b << ' ' << a << std::endl;
    return 0;
}



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

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

int main( void ) {

	int a,b,c;
	cin >>a>>b>>c;
	int cnt =0;
	for(int i=a;i<=b;i++){
		if(c%i==0)cnt++;
	}
	cout << cnt <<endl;
    return 0;
}



Measured memory_bytes: 3092
import sys
if sys.platform =='ios':
	sys.stdin=open('Untitled.txt')
input = sys.stdin.readline

# 参照URL:https://qiita.com/gogotealove/items/11f9e83218926211083a

# n = [int(x) for x in input().rstrip()]
# op_cnt = len(n) - 1  # すき間の個数
# ans2 = []
# for i in range(2 ** op_cnt):
#     op = [""] * op_cnt  # あらかじめ ["-", "-", "-"] というリストを作っておく
#     for j in range(op_cnt):
#         if ((i >> j) & 1):
#             op[op_cnt - 1 - j] = "+"  # フラグが立っていた箇所を "+" で上書き
#     ans2.append(op)
# for a in ans2:
# 	print(a)

S = input().rstrip() # 入力値 "1234\n" を "1234"に
n = len(S)-1 # オペレータが入りうる隙間はlen(S)-1

ops = []
for i in range(2**n): # 各隙間に対して、 +するしないの2通りがあるので、2^n 回ループ
	op = [""] * n # あらかじめリストを作成
	for j in range(n):
		if((i>>j) & 1) == 1:  # 順に右にシフトさせ最下位bitのチェックを行う
			op[n-1-j] = "+" # フラグが立っていたらopの値を書き換える
	ops.append(op)

# ここまでで ops の中にありうる組み合わせが列挙される（以下はlen(S)-1==3の例）
# ['', '', '']
# ['', '', '+']
# ['', '+', '']
# ['', '+', '+']
# ['+', '', '']
# ['+', '', '+']
# ['+', '+', '']
# ['+', '+', '+']

ans = 0
for o in ops:
	s = [s for s in S]
	for k in range(len(o)):
		s.insert(2*k+1, o[k])
	ans += eval(''.join(s)) # eval を利用することで文字列を式として評価することができる

print(ans)

Measured memory_bytes: 3064
//Md Fahad
// CSE 18

#include<bits/stdc++.h>

using  namespace  std;

#define PI              acos(-1.0)
#define lcm(a,b)        (a * (b / __gcd(a,b)))
#define en '\n'

#define READ_IN freopen("Input.txt","r",stdin);
#define READ_OUT freopen("Output.txt","w",stdout);
#define Infi                0x3f3f3f3f

const int fx[] = {+1,-1,+0,+0};                         // 4 X directions
const int fy[] = {+0,+0,+1,-1};                         // 4 Y directions
const int fx8[] = {+0,+0,+1,-1,-1,+1,-1,+1};            // King X Moves
const int fy8[] = {-1,+1,+0,+0,+1,+1,-1,-1};            // King Y Moves
const int kx[] = {-2, -2, -1, -1,  1,  1,  2,  2};      // Knight X Moves
const int ky[] = {-1,  1, -2,  2, -2,  2, -1,  1};      // Knight Y Moves



int  Set    (int N,int pos) {return N=N | (1<<pos);}    /// turn a bit on
int  reset  (int N,int pos) {return N= N & ~(1<<pos);}  /// turn a bit off
bool check  (int N,int pos) {return (bool)(N & (1<<pos));} /// check, if a bit is on or not

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define trace(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define trace(x...)
#endif

typedef long long int           ll;
typedef unsigned long long int  llu;





int main(void)
{
    //READ_IN;
    //READ_OUT;

    ll n;

    cin >> n;

    int i=1;
    ll cnt=0;

    while(n>=1)
    {

        ll r = abs(floor(n*1.0/2*1.0));
        cnt += pow(2,i);
        i++;
        n=r;

    }

    cout << cnt/2 << endl;

    return 0;
}



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

using namespace std;

#define INF 2000000000
#define MOD 1000000007
typedef long long ll;
typedef pair<int, int> P;


int main()
{
	string s;
	cin >> s;
	for (int i = s.size()-1; i >= 0; i--) {
//		cout << i << " " << s[i] << "\n";
		if (s[i]=='m') {
			if (i<4) {
				cout << "NO" << "\n";
				return 0;
			}
			string tmp = s.substr(i-4,5);
//			cout << tmp << "\n";
			if (tmp=="dream") {
				i-=4;
			} else {
				cout << "NO" << "\n";
				return 0;
			}
			continue;
		}
		if (s[i]=='e') {
			if (i<4) {
				cout << "NO" << "\n";
				return 0;
			}
			string tmp = s.substr(i-4,5);
//			cout << tmp << "\n";
			if (tmp=="erase") {
				i-=4;
			} else {
				cout << "NO" << "\n";
				return 0;
			}
			continue;
		}
		if (s[i]=='r') {
			if (i<5) {
				cout << "NO" << "\n";
				return 0;
			}
			if (s[i-2]=='m') { // dreamer
				string tmp = s.substr(i-6,7);
//				cout << tmp << "\n";
				if (tmp=="dreamer") {
					i-=6;
				} else {
					cout << "NO" << "\n";
					return 0;
				}
				continue;
			} else if (s[i-2]=='s') { // eraser
				string tmp = s.substr(i-5,6);
//				cout << tmp << "\n";
				if (tmp=="eraser") {
					i-=5;
				} else {
					cout << "NO" << "\n";
					return 0;
				}
				continue;
			} else {
				cout << "NO" << "\n";
				return 0;
			}
		}
	}
	cout << "YES" << "\n";
}


Measured memory_bytes: 512
def main() -> None:
    N = int(input())
    A = [int(x)-1 for x in input().split()]
    B = [int(x) for x in input().split()]
    C = [int(x) for x in input().split()]
    ans = sum(B[a] for a in A)
    for a1, a2 in zip(A, A[1:]):
        if a1 + 1 == a2:
            ans += C[a1]
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 9020
import java.util.Scanner;
 class Main{
	int high,low,sa;
	
	public void solve(){
		Scanner sc =new Scanner(System.in);
		
		for(int i=0;i<7;i++){
			high = sc.nextInt();
			low = sc.nextInt();
			sa = high-low;
			System.out.println(sa);
		}
	}
	public static void main(String[] args){
		Main obj = new Main();
		obj.solve();
	}
 }
	

Measured memory_bytes: 17228
#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <string.h>
#include <ctype.h>
#include <algorithm>

using namespace std;

int main() {
  int n, a[110000],ans = 1, flag = 0;
  cin >> n;

  for(int i = 1; i <= n; i++)
    cin >> a[i];

  int x = a[1];
  for(int i = 0; i < n; i++) {
    if(x == 2) {
      flag = 1;
      break;
    }
    x = a[x];
    ans++;
  }
  if(flag) cout << ans << endl;
  else cout << "-1" << endl;
}

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

bool solve(int n, int A[], int p, int sum, int t ){
  if ( sum == t ) return true;
  if ( p == n ) return false;
  if ( solve(n, A, p+1, sum, t) ) return true;
  if ( solve(n, A, p+1, sum+A[p], t) ) return true;
  return false;
}

main(){
  int n, q, M, T[50];
  cin >> n;
  for ( int i = 0; i < n; i++ ){
    cin >> T[i];
  }
  cin >> q;
  for ( int i = 0; i < q; i++ ){
    cin >> M;
    if ( solve(n, T, 0, 0, M) ) cout << "yes" << endl;
    else cout << "no" << endl;
  }

  return 0;
}



Measured memory_bytes: 3092
#DP-A
n=int(input())
h=list(map(int,input().split()))

dp=[float('inf')]*n
dp[0]=0
for i in range(1,n):

    #2パターンの遷移を考え小さいほうを保存する
    dp[i]=dp[i-1]+abs(h[i]-h[i-1])
    if i>1:
        dp[i]=min(dp[i],dp[i-2]+abs(h[i]-h[i-2]))

print(dp[-1])

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

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

int main(){
        int n;
        cin>>n;
        vector<int> a(n+1);
        for(int i=1;i<n+1;i++) cin>>a[i];
        for(int i=1;i<n+1;i++){
                cout<<"node "<<i<<": key = "<<a[i]<<", ";
                if(i!=1) cout<<"parent key = "<<a[parent(i)]<<", ";
                if(left(i)<n+1) cout<<"left key = "<<a[left(i)]<<", ";
                if(right(i)<n+1) cout<<"right key = "<<a[right(i)]<<", ";
                cout<<endl;
        }
        return 0;
}


Measured memory_bytes: 3088
#include <cstdio>
#include <cstring>
#include <algorithm>

const int maxn = 1e5 + 3;
int n, c[maxn], l;
char s[maxn], r[maxn];

int main() {
	scanf("%s", s);
	n = strlen(s);
	for(int i = 0; i < n; ++i) {
		if(s[i] == 'x')
			++c[l];
		else
			r[l++] = s[i];
	}
	for(int i = 0; 2 * i < l; ++i) {
		if(r[i] != r[l - i - 1]) {
			puts("-1");
			return 0;
		}
	}
	long long ans = 0;
	for(int i = 0; 2 * i < l; ++i) {
		ans += std::max(c[i], c[l - i]) - std::min(c[i], c[l - i]);
	}
	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 888
import java.io.InputStream;
import java.io.PrintWriter;
import java.lang.reflect.Array;
import java.math.BigDecimal;
import java.math.MathContext;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Scanner;
import java.util.Set;
import java.util.Stack;
import java.util.TreeMap;
import java.util.TreeSet;

import static java.util.Comparator.*;

public class Main {
    public static void main(String[] args) {
        PrintWriter out = new PrintWriter(System.out);
        Solver solver = new Solver(System.in, out);
        solver.solve();
        out.close();
    }
}
class Solver {
	Scanner sc;
	PrintWriter out;
    public Solver(InputStream in, PrintWriter out) {
    	sc = new Scanner(in);
    	this.out = out;
    }
    // ==================================================================
    public void solve() {
    	int D = ni();
    	long G = nl();
    	int[][] PC = ndii(D,2);
    	long total, cnt, ans = 10000;
    	for (int i = 0; i < (1 << D); i++) {
			total = cnt = 0;
    		for (int j = 0; j < D; j++) {
				if(((i >> j) & 1) == 1) {
					total += (PC[j][0] * (j+1) * 100 + PC[j][1]);
					cnt += PC[j][0];
				}
			}
    		if(total >= G) {
    			ans = Math.min(ans, cnt);
    			continue;
    		}
    		LOOP:
    		for (int j = D-1; j >= 0; j--) {
				if(((i >> j) & 1) == 0) {		// 点数が高くて、コンプリートしていないもの
					for (int j2 = 0; j2 < PC[j][0] - 1; j2++) {
						total += (j+1) * 100;
						cnt++;
						if(total >= G) {
			    			ans = Math.min(ans, cnt);
							break LOOP;
						}
					}
					break LOOP;
				}
    		}
		}
    	out.println(ans);
    }
    // ------------------------------------------
    // 入力
    // ------------------------------------------
    public int ni() {
    	return Integer.parseInt(sc.next());
    }
    public long nl() {
    	return Long.parseLong(sc.next());
    }
    public String ns() {
    	return sc.next();
    }
    public char[] nc() {
    	return sc.next().toCharArray();
    }
    public int[] ndi(int N) {
    	int[] ans = new int[N];
    	for (int i = 0; i < N; i++) {
			ans[i] = ni();
		}
    	return ans;
    }
    public long[] ndl(int N) {
    	long[] ans = new long[N];
    	for (int i = 0; i < N; i++) {
			ans[i] = nl();
		}
    	return ans;
    }
    public String[] nds(int N) {
    	String[] ans = new String[N];
    	for (int i = 0; i < N; i++) {
			ans[i] = ns();
		}
    	return ans;
    }
    public char[][] ndc(int N) {
    	char[][] ans = new char[N][];
    	for (int i = 0; i < N; i++) {
			ans[i] = nc();
		}
    	return ans;
    }
    public int[][] ndii(int N, int S) {
    	int[][] ans = new int[N][S];
    	for (int i = 0; i < N; i++) {
			for (int j = 0; j < S; j++) {
				ans[i][j] = ni();
			}
		}
    	return ans;
    }
}


Measured memory_bytes: 23892
#include <bits/stdc++.h>
using namespace std;
/* typedef */
typedef long long ll;
typedef pair<int, int> pii;
/* constant */
const int INF = 1 << 30;
const ll LINF = 1LL << 50;
const int NIL = -1;
const int MAX = 10000;
const int mod = 1000000007;
const double pi = 3.141592653589;
/* global variables */
/* function */
/* main */
int main(){
    int N, M;
    cin >> N >> M;
    vector<int> a(M);
    for (int i = 0; i < M; i++) cin >> a[i];
    int sum = accumulate(a.begin(), a.end(), 0);
    int rest = N - sum;
    if (rest >= 0) cout << rest << '\n';
    else cout << -1 << '\n';
}


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

#define INF 1e9
#define llINF 1e18
#define MOD 1e9+7
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
using namespace std;
int main(){
  int n,q;
  while(cin>>n>>q,n){
    int hai[100000]={};
    for(int i=0;i<n;i++){
      int m;cin>>m;
      for(int i=0;i<m;i++){
	int num;cin>>num;
	hai[num]++;
      }
    }
    int ans=0;
    bool flag=true;
    int anss=0;
    for(int i=1;i<100000;i++){
      if(hai[i]>=q){
	if(ans<hai[i]){
	  ans=max(ans,hai[i]);
	  anss=i;
	}
      }
    }
    cout<<anss<<endl;
    //if(flag)cout<<0<<endl;
  }
  return 0;
}



Measured memory_bytes: 3464
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <vector>
#include <sstream>
using namespace std;

typedef long long LL;
#define lowbit(x) ((x)&(-x))
#define INF 0x3f3f3f3f
#define memset(a,b) memset(a,b,sizeof(a))
#define	GE() printf(">----------\n")
#define	IN() freopen("in.txt","r",stdin)
#define	OUT() freopen("out.txt","w",stdout)
const int mod=1000000007;
const LL inf=0x3f3f3f3f3f3f3f3f;
const double pi=acos(-1.0);
const double eps=1e-8;
const int maxn=100005;

char str[maxn];
bool vis[maxn];

int main()
{
    while(~scanf("%s", str)){
        memset(vis, 0);
        int len=strlen(str);
        bool ans=1;
        for(int i=0;i<len;i++){
            if(vis[str[i]]){
                ans=0;break;
            }
            vis[str[i]]=1;
        }
        printf("%s\n", ans?"yes":"no");
    }
    return 0;
}



Measured memory_bytes: 384
#include<stdio.h>
#include<string.h>
int main()
{
	char s[999],*p,*q;
	while(fgets(s,999,stdin),strcmp(s,"END OF INPUT\n"))
	{
		for(p=s;;)
		{
			q=strpbrk(p," \n");
			if(!q)break;
			if(p==q)putchar('0');
			else printf("%d",q-p);
			p=q+1;
		}
		puts("");
	}
	return 0;
}

Measured memory_bytes: 0