akhauriyash/Code-Regression huggingface dataset:
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

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

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

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

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

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

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

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

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

fn main() {
    input! {
        b: String,
    }
    let ans = match &*b {
        "A" => "T",
        "C" => "G",
        "T" => "A",
        "G" => "C",
        _ => unreachable!(),
    };
    println!("{}", ans);
}


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

int main()
{
    int N,M;
    cin >> N >> M;
    vector<vector<int>> room(N);
    for(int i = 0; i < M; i++)
    {
        int A,B;
        cin >> A >> B;
        room[A-1].push_back(B-1);
        room[B-1].push_back(A-1);
    }
    vector<int> dest(N);
    queue<int> que;
    vector<int> dist(N, -1);
    que.push(0);
    dist[0] = 0;

    while(!que.empty())
    {
        int s = que.front();
        que.pop();
        for(int i : room[s])
        {
            if(dist[i] == -1)
            {
                dist[i] = dist[s] + 1;
                dest[i] = s;
                que.push(i);
            }
        }
    }

    bool flag = true;
    for(int i : dist)
    {
        if(i == -1) flag = false;
    }
    if(flag)
    {
        cout << "Yes" << endl;
        for(int i = 1; i < N; i++) cout << dest[i] + 1 << endl;
    }
    else cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 10652
#include <iostream>
#include <vector>

using namespace std;

int main() {
  int n, m, t;
  cin >> n >> m >> t;
  vector<int> ok(2 * t + 1);
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    for (int j = 0; j <= m; j++) {
      if (a - j < 0) {
        break;
      }
      ok[a - j] = 1;
    }
    for (int j = 0; j < m; j++) {
      if (a + j >= t) {
        break;
      }
      ok[a + j] = 1;
    }
  }
  
  int ans = 0;
  for (int i = 0; i < t; i++) {
    ans += ok[i] == 0;
  }

  cout << ans << endl;
 

  

  return 0;
}

Measured memory_bytes: 3152
W,H,N = map(int,input().split())
xya = [list(map(int,input().split())) for _ in range(N)]

x1 = 0
y1 = 0
x2 = W
y2 = H

for i in range(N):
    a = xya[i][2]

    if a == 1:
        x1 = max(x1,xya[i][0])
    elif a == 2:
        x2 = min(x2,xya[i][0])
    elif a == 3:
        y1 = max(y1,xya[i][1])
    elif a == 4:
        y2 = min(y2,xya[i][1])

x = x2 - x1
y = y2 - y1

if x > 0 and y > 0:
    print((x2-x1) * (y2-y1))
else:
    print(0)


Measured memory_bytes: 3064
N, Z, W = map(int, input().split())
a = list(map(int, input().split()))

# 初手で全部引く abs(a_N - W) or 1枚残す abs(a_N-1 - a_N) が最適
# 2枚以上残した場合、Yが1枚残すことで abs(a_N-1 - a_N)　とすることが可能で、
# abs(a_N-1 - a_N) より良くすることは出来ない

# 1枚しかない時に注意

if N == 1:
    ans = abs(a[-1] - W)
else:
    ans = max(abs(a[-1] - W), abs(a[-2] - a[-1]))
print(ans)


Measured memory_bytes: 63752
def resolve():
    n = int(input())
    a = [1]
    x = 6
    while x<=n:
        a.append(x)
        x=x*6
    x = 9
    while x<=n:
        a.append(x)
        x=x*9
    a = list(set(a))
    a.sort()
    dp = [10**9]*(n+5)
    dp[0]=0
    for i in range(1,n+1):
        for j in a:    
            if(i>=j):
                dp[i]=min(dp[i],dp[i-j]+1)
            else:
                break
    print(dp[n])


if __name__ == "__main__":
    resolve()

Measured memory_bytes: 40048
#include <iostream>
#include <string>
#include <cstdlib>
#include <cstdio>
#include <queue>
#include <stack>
#include <list>
#include <utility>
#include <vector>
#include <set>
#include <algorithm>

using namespace std;
int in(){
    int temp;
    scanf("%d",&temp);
    return temp;
}


int Mdist(pair<int,int>p1, pair<int,int>p2){
    return abs(p1.first - p2.first) +  abs(p1.second - p2.second);
}

int main() {


    int N = in();
    
    int time = 0;
    typedef pair<int,int> P;
    P p;
    p.first = 0;
    p.second = 0;
    
    int ntime;
    P np;
    

    for (auto i = 0; i < N; i++){
        
        cin >> ntime >> np.first >> np.second;
        if (Mdist(p,np) > (ntime-time) || ((ntime-time) - Mdist(p,np))%2 != 0){
            cout << "No" << endl;
            return 0;
        }
        
        
        time = ntime;
        p.first = np.first;
        p.second = np.second;
    }
    
    cout << "Yes" << endl;
    return 0;
    
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define long long long
#define ull unsigned long long
#define up(i,a,b) for (int i=a; i<=b; i++)
#define down(i,a,b) for (int i=a; i>=b; i--)
#define endl '\n'
#define pb push_back
#define X first
#define Y second
#define II pair<int, int>
#define III pair<int, pair<int, int> >
#define V vector
#define debug(X) cerr<< #X << " = " <<X << endl
#define debug2(X,Y) cerr<< #X << " = " <<X << ","<<#Y<<" = "<<Y<<endl
#define show(X,a,b) {cerr << #X << " = "; up(__,a,b) cerr << X[__] << ' '; cerr << endl;}
#define gc getchar
#define pc putchar

using namespace std;

inline void read(int &x)
{
    register int c = gc();
    x = 0;
    int neg = 0;
    for (;((c<48 || c>57) && c != '-') ;c = gc());
    if(c=='-') {neg=1;c=gc();}
    for(;c>47 && c<58;c = gc()) {x = (x<<1) + (x<<3) + c - 48;}
    if(neg) x=-x;
}
inline void writeln(int x){

         char buffor[21];
         register int i=0;
         int neg=0; if (x<0) {neg=1; x= -x;}
         do{
               buffor[i++]=(x%10)+'0';
               x/=10;
            } while(x);
           i--;
           if (neg) pc('-');
           while(i>=0) pc(buffor[i--]);
           pc('\n');
       }
int n,k,a,G,M;
void input()
{
	M= 0; G= 0;
    cin>>n>>k;
    up(i,1,n)
    {
		cin>>a;
		M= max(M,a);
		G= __gcd(G,a);
    }

    if (k<=M and k%G==0) cout<<"POSSIBLE";
    else cout<<"IMPOSSIBLE";
}

void solve()
{

}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);// don't use when interactive
    #define TASK "tmp"
    //freopen(TASK".inp","r",stdin);
    //freopen(TASK".out","w",stdout);

    input();
    solve();

    return 0;
}


Measured memory_bytes: 256
a, b, x = map(int, input().split())

from math import atan
from math import degrees

if x >= 0.5 * a * a * b:
  theta = atan(2*(a*a*b - x) / (a**3))
else:
  theta = atan(0.5 * a * b* b / x)
print(degrees(theta))

Measured memory_bytes: 38384
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,x;
  cin >> n >> x;
  int a[n],b=1000;
  for(int i=0;i<n;i++){
    cin >> a[i];
    x-=a[i];
    b=min(b,a[i]);
  }
  n+=x/b;
  cout << n;
}


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

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

    size_t m = 0;
    for (size_t i=0; i<s.size(); i++) {
        if (s[i] == 'A') {
            m = i;
            break;
        }
    }
    size_t n = 0;
    for (int i=s.size()-1; i>=0; i--) {
        if (s[i] == 'Z') {
            n = i;
            break;
        }
    }

    cout << (n - m + 1) << endl;
}


Measured memory_bytes: 3756
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>

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

using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define P pair<ll, ll>
#define sz(x) (ll)x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<ll>
#define COUT(x) cout<<(x)<<endl
#define MA map<ll,ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,VE,greater<ll>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl

ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
bool prime(ll n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}


const long long MOD = 1000000007;
const long long INF = 1e16;
#define int long long

int a[15];
int n = 0;
int ans = 0;

void calc(int i, int sum, int now) {
	if (i == n - 1) {
		ans += sum + now;
	}
	else {
		calc(i + 1, sum + now, a[i+1]);
		calc(i + 1, sum, 10 * now + a[i+1]);
	}
}

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	string s; cin >> s;
	n = s.size();
	rep(i, s.size()) {
		a[i] = s[i] - '0';
	}
	calc(0, 0, a[0]);
	cout << ans << endl;
	return 0;
}


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

int main() {
  int k;
  string n;
  cin>>k>>n;
  if(n.size()<=k)
    cout<<n<<endl;
  else{
    for(int i=0;i<k;i++)
      cout<<n[i];
    cout<<"..."<<endl;
  }
}

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

#define vi vector<int>
#define INFTY 2000000000;

int ans;

void merge(vi& A, int left, int mid, int right) {

  int n1 = mid - left;
  int n2 = right - mid;
  vi L, R;
  for (int i = 0; i < n1; i++) {
      L.push_back(A[left + i]);
  }
  for (int i = 0; i < n2; i++) {
      R.push_back(A[mid + i]);
  }
  L[n1] = INFTY;
  R[n2] = INFTY;
  int i = 0;
  int j = 0;
  for (int k = left; k < right; k++) {
      ans++;
      if (L[i] <= R[j]) {
          A[k] = L[i];
          i++;
      }
      else {
          A[k] = R[j];
          j++;
      }
  }
}

void mergeSort(vi& A, int left, int right) {
    if (left+1 < right) {
        int mid = (left + right)/2;
        mergeSort(A, left, mid);
        mergeSort(A, mid, right);
        merge(A, left, mid, right);
    }
}

int main() {

    int n;
    vi A;
    int tmp;

    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> tmp;
        A.push_back(tmp);
    }

    ans = 0;
    mergeSort(A, 0, n);

    for (int i = 0; i < A.size(); i++) {
        cout << A[i];
        if (i < A.size() - 1) {
            cout << " ";
        }
    }
    cout << endl;
    cout << ans << endl;

    return 0;
}



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

ll gcd(ll a,ll b){
  if(b == 0) return a;
  return gcd(b, a % b);
}
const ll P =  1000000007;
ll factorial(ll n){
   ll ans = 1;
   for(int i = n;i>=1;i--){
     ans *= i;
     ans %= P;
   }
   return ans;
}
using Graph = vector<vector<int>>;

ll kzyou(ll a,ll k){//aのk乗を返す
    ll zyou = 1;
    for(ll i = 1;i<=k;i++){
        zyou *= a;
    }
    return zyou;
}

int main(){
  int N,M;
  cin >> N >> M;
  vector<pair<int,int>> p(M);
  rep(i,M){
    cin >> p[i].first >> p[i].second;
  }
 ll ketaN = kzyou(10,N-1);//N桁の数の最小値
 sort(p.begin(),p.end());
 if( N == 1 && M == 0) cout << 0 << endl;
 else{
 bool flag = true;
 for(int i = 0;i<M-1;i++){
   if(p[i].first == p[i+1].first){
     if(p[i].second != p[i+1].second) flag = false;
   }
 }
 if(!flag) cout << -1 << endl;
 //s,cが矛盾しないとき

 else if(flag){
   set<pair<int,int>> S;
   rep(i,M){
     S.insert(p[i]);
   }
   int ans = 0;
   bool flag1 = false;//１桁目の指定があるか
   for (auto value : S) {
    int k = value.first;//k桁目
    int C = value.second;//k桁目をCにする
    if(k == 1) flag1 = true;

    if(k == 1 && C == 0 && N != 1){//１桁目の指定が0の時アウト
      flag = false;
      break;
    }

    ans += kzyou(10,N-k) * C;
   }
   if(flag == false) cout << -1 << endl;
   //１桁目の指定がない時
   else if(!flag1){
   ans += kzyou(10,N-1);
   cout << ans << endl;
   }
   else cout << ans << endl;
 }

 }
}

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

long int gcd(long int a,long int b)
{
   if (a%b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a%b));
   }
}

long int lcm(long int a,long int b)
{
   return a * b / gcd(a, b);
}
int main()
{
   long int a, b;
   cin >> a >> b;
if(b>a){
	long int temp;
	temp=a;
	a=b;
	b=temp;
}
  
   cout << lcm(a, b) << endl;
   return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(void){
	int n,m,c;
	int i,j;
	long long int sum;
	priority_queue<int, vector<int>, greater<int> > que;
	cin>>n;
	for(i=0;i<n;i++){
		cin>>m;
		for(j=0;j<m;j++){
			cin>>c;
			que.push(c);
		}
		for(j=0;j<m-1;j++) que.pop();
	}
	sum=0;
	for(i=0;i<n;i++){
		sum+=que.top();
		que.pop();
	}
	cout<<sum<<endl;
	return 0;
}


Measured memory_bytes: 4952
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int y = sc.nextInt();

        System.out.print(x * y + " ");
        System.out.println(x * 2 + y * 2);
    }
}



Measured memory_bytes: 26396
#include <stdio.h>

int main()
{
  int a, b, c, d, e, f;
  double x, y;

  while (scanf("%d %d %d %d %d %d", &a, &b, &c, &d, &e, &f) > 0) {
    x = (double)(e * c - b * f)/ (a * e - d * b);
    y = (double)(a * f - d * c)/ (a * e - d * b);
    x == -0.0 ? x = 0.0 : x;
    y == -0.0 ? y = 0.0 : y;
    printf("%.3f %.3f\n", x, y);
  }

  return 0;
}

Measured memory_bytes: 0
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Scanner;

public class Main {


	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();

		HashMap<Integer, ArrayList<Integer>> graph = new HashMap<>();

		for (int i=1;i<=n;i++) {
			graph.put(i, new ArrayList<Integer>());
		}
		for (int i=0;i<m;i++) {
			int u = sc.nextInt();
			int v = sc.nextInt();

			graph.get(u).add(v);
		}

		int s = sc.nextInt();
		int t = sc.nextInt();

		HashMap<Integer, Integer> dist = new HashMap<>();


		HashSet<Integer> set = new HashSet<>();


		set.add(s);
		int i=0;
		while(!set.isEmpty()) {
			for (Integer intg : set) {
				dist.put(intg, i);
			}
			HashSet<Integer> first = new HashSet<>();
			HashSet<Integer> second = new HashSet<>();
			HashSet<Integer> third = new HashSet<>();
			for (Integer intg : set) {
				for (Integer intg2 : graph.get(intg)) {
					first.add(intg2);
				}
			}
			for (Integer intg2 : first) {
				for (Integer intg3 : graph.get(intg2)) {
					second.add(intg3);
				}
			}
			for (Integer intg3 : second) {
				for (Integer intg4 : graph.get(intg3)) {
					if (!dist.containsKey(intg4)) {
						third.add(intg4);
					}
				}
			}

			set=third;
			i++;
		}
		if(dist.containsKey(t)) {
			System.out.println(dist.get(t));
		} else {
			System.out.println("-1");
		}
	}






}

Measured memory_bytes: 121000
#include <iostream>

using namespace std;

int main()
{
    string s,t;
    int c =0;
    cin >> s;
    cin >>t;
    for (int i=0; i<s.size(); i++)
        if (s[i] != t[i])
        c++;
    cout<< c;
    return 0;
}


Measured memory_bytes: 3916
program dividing_chocolate
  implicit none
  integer :: h, w, k, a(10,1000) = 0, i, j, l, m, c(10), d(10), u, x = 1e9, y
  character(1000) :: s
  read(*,*) h, w, k
  do i = 1, h
    read(*,'(a)') s
    do j = 1, w
      if (s(j:j) == "1") a(i,j) = 1
    end do
  end do
  u = lshift(1,h-1)
  do l = 0, u-1
    c = 0
    d = 0
    y = popcnt(l)
    do j = 1, w
      m = 1
      do i = 1, h
        if (i /= 1 .and. btest(l,i-2)) m = m+1
        c(m) = c(m)+a(i,j)
      end do
      if (any(c > k)) then
        y = y+1
        c = c-d
        if (any(c > k)) goto 100
      end if
      d = c
    end do
    x = min(x,y)
100 end do
  write(*,'(i0)') x
end program dividing_chocolate

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

int main () {
    int h1, m1, h2, m2, k;
    cin >> h1 >> m1 >> h2 >> m2 >> k;

    int ans = 60 * h2 + m2 - (60 * h1 + m1) - k;
    
    cout << ans << endl;

}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
typedef pair<long long, long long> P;
#define int long long
#define override_rep(i, l, r, mes, ...) mes
#define rep1(i, n) for (int i = 0; i < n; i++)
#define rep2(i, l, r) for (int i = l; i < r; i++)
#define rep(...) override_rep(__VA_ARGS__, rep2, rep1)(__VA_ARGS__)
#ifdef DEBUG
std::ostream& dout = cout;
#else
stringstream dout;
#endif
template<typename T, typename U>
istream& operator>>(istream& in, pair<T, U>& p) {
    in >> p.first >> p.second;
    return in;
}
signed main(signed argc, char* argv[]) {
    cin.tie(0);
    ios::sync_with_stdio(false);
    const int MOD = 1000000007;
    int k,n;
    cin>>k>>n;
    int before=-1,mx=0,bgn=0;
    rep(i,n){
        int in;
        cin>>in;
        if(i==0){
            bgn=in;
            before=in;
        }
        else{
            mx=max(mx,in-before);
            before=in;
        }
    }
    mx=max(mx,k+bgn-before);
    cout<<k-mx<<endl;
}


Measured memory_bytes: 256
import itertools
N,M = map(int,input().split())
s = []
for i in range(M):
    dp = [0]*(N)
    tmp = list(map(int,input().split()))
    for j in tmp[1:]:dp[j-1]=1
    s.append(dp)
p = list(map(int,input().split()))
ans = 0

for i in itertools.product([0, 1], repeat=N):
    tmp = 0
    dp = [0]*M
    for I in range(M):
        for j in range(N):
            dp[I] += s[I][j] * i[j]
    for e,i in enumerate(dp):
        dp[e] = i%2
    if dp == p:
        ans+=1
print(ans)


Measured memory_bytes: 3064
#s = gets.chomp
#n = gets.chomp.to_i
n,k = gets.chomp.split(" ").map{|i|i = i.to_i}
h = gets.chomp.split(" ").map{|i|i = i.to_i}


# 方針 #
h.sort!
sum=0
count = 0
if (n-1-k) < 0 then
  puts 0
else
  h[0..(n-1-k)].each do|i|
    sum+= i
    count += 1
  end
  puts(sum)
  #puts("count = "+count.to_s)
end

Measured memory_bytes: 19824
#include <bits/stdc++.h>
#define int long long int
#define fastio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
void solve() {
 	int n;
  	cin >> n;
  	cout << min((n-1)/2, n/2) << '\n';
  	return ;
}
int32_t main() {
	fastio();
  	solve();
  	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long//
#define rp(i,a,b) for(ll i=a;i<b;i++)
#define r(i,n) for(ll i=0;i<n;i++)
#define rt return
#define db double
#define ldb long double
#define vd void
#define p(x) cout<<(x)<<endl;
#define ce continue;
#define bl bool
#define r0 rt 0;
#define r1 rt 1;
#define elif else if
#define bk break;
#define A p("A")
#define B p("B")
#define C p("C")
#define D p("D")
#define E p("E")
#define F p("F")
#define S(a) sort(a.begin(),a.end());
#define R(a) reverse(a.begin(),a.end());
#define cl cout<<endl;
#define pb(x) push_back(x);
#define str string
using namespace std;
void Cond(int g){if(g)p("YES")else p("NO")rt;}
void cond(int g){if(g)p("Yes")else p("No")rt;}
ll gcd(ll a,ll b){if(a<b)swap(a,b);if(a%b==0)rt b;gcd(b,a%b);}
str su="0123456789";
str m1="abcdefghijklmnopqrstuvwxyz";
str m2="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
map<char,ll>m5;
typedef pair<ll,ll> P;
const ll INF=(ll)1e18+10;
ll t1=0,t2=0,t3=0,t4=0,t5=0,t6=0,t7=0,t8=0,g=0,ans=0;
ll n=0,m=0,k=0,mx=-INF,mn=INF,ct=0;
ll tmp=0,tmp1=0,tmp2=0,tmp3=0,tmp4=0;
ll sum=0,mask=0;
set<P> pst;
set<ll>st,st1,st2;
set<char> cst;
ll powmod(ll a,ll b,ll x){//(a^b)modx
    if(!b)r1
    if(!(b%2)){//B
        ll t=powmod(a,b/2,x);
        rt t*t%x;
    }
    rt ((a)*powmod(a,b-1,x))%x;
}
void di(){m5['a']=0;
    m5['b']=1;
    m5['c']=2;
    m5['d']=3;
    m5['e']=4;
    m5['f']=5;
    m5['g']=6;
    m5['h']=7;
    m5['i']=8;
    m5['j']=9;
    m5['k']=10;
    m5['l']=11;
    m5['m']=12;
    m5['n']=13;
    m5['o']=14;
    m5['p']=15;
    m5['q']=16;
    m5['r']=17;
    m5['s']=18;
    m5['t']=19;
    m5['u']=20;
    m5['v']=21;
    m5['w']=22;
    m5['x']=23;
    m5['y']=24;
    m5['z']=25;
}
map<ll,ll>mp,mp1,mp2,mp3;
typedef std::vector<ll> vl;
typedef pair<ll,ll> P;
typedef pair<ll,P>  P2;
typedef struct edge2{P tos;ll cost;}EDGE2;
typedef struct edge1{ll to,cost;}EDGE;
bl used[(ll)1e9];
const ll M=(ll)1e9+7;
ll fac[1000007],finv[1000007],inv[1000007];
void initcmb(){
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    for(int i=2;i<1000007;i++){
        fac[i]=fac[i-1]*i%M;
        inv[i]=M-inv[M%i]*(M/i)%M;
        finv[i]=finv[i-1]*inv[i]%M;
    }
}
ll cmb(ll n,ll k){
    if(n<k)return 0;
    if(n<0 || k<0)return 0;
    return fac[n]*(finv[k]*finv[n-k]%M)%M;
}
db pi=3.14159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651328230664709384460955058223172535940812848111745028410270193852110555964462294895493038196;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll MAX=5+(ll)1e5*3;
vl rui(MAX);

   

vector<vector<EDGE>>G(1e6);
vector<ll>a;

int main(){//swap(ary１,ary２)
    //a.erase(a.begin()+5),a.insert(a.begin()+3,tmp)    ios_base::sync_with_stdio(0); cin.tie(0);
clock_t start = clock();//timecalc
di();

cin>>t1>>t2;
p(t1*t2)







clock_t end = clock();//
const double time = static_cast<double>(end - start) / CLOCKS_PER_SEC * 1000.0;//timecalc
//printf("time %lf[ms]\n", time);//
return 0;
}//main


Measured memory_bytes: 28992
#include<bits/stdc++.h>
using namespace std;
inline int read()
{
	int n=0;bool b=0;char c=getchar();
	while(c<'0'||c>'9'){if(c=='-')b=1;c=getchar();}
	while(c>='0'&&c<='9')n=(n<<3)+(n<<1)+(c^48),c=getchar();
	return b?-n:n;
}

int n;

int d(int x){return x%10;}

main()
{
	n=read();
	if(d(n)==2||d(n)==4||d(n)==5||d(n)==7||d(n)==9)puts("hon");
	if(d(n)==0||d(n)==1||d(n)==6||d(n)==8)puts("pon");
	if(d(n)==3)puts("bon");
	return 0;
}


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

int main()
{
    int r, g, b;
    cin >> r >> g >> b;
    
    string s = "NO";
    if (((r*100)+(g*10)+b) % 4 == 0)
    {
        s = "YES";
    }

    cout << s << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	while(a>0 and c>0){
	    c-=b;
	    if(c<=0){
	        cout<<"Yes"<<endl;
	        return 0;
	    }
	    a-=d;
	    if(a<=0){
	        cout<<"No"<<endl;
	        return 0;
	    }
	}
}


Measured memory_bytes: 3540
#include <iostream>

using namespace std;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a, b, c, x;
    cin>>a>>b>>c>>x;
    int count=0;
    
    for(int i=0; i<=a; i++){
        if(500*i>x) break;
        for(int j=0; j<=b; j++){
            int k=(x-500*i-100*j)/50;
            if(k<0) break;
            if(k<=c) ++count;
        }
    }
    cout<<count<<'\n';
    return 0;
}

Measured memory_bytes: 256
import sys
import os
import bisect, collections, copy, itertools, math, string
def I(): return int(input())
def S(): return input()
def LI(): return list(map(int, input().split()))
def LS(): return list(input().split())

def solve():
	R = I()
	r = 2 * math.pi * R
	print(r)
	
if __name__ == '__main__':
	solve()


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

int main() {

    int n; cin >> n;
    string ans;
    int t = n % 10;
    if (t == 3) ans = "bon";
    else if (t == 0 || t == 1 || t == 6 || t == 8) ans = "pon";
    else ans = "hon";
    cout << ans << endl;
    return 0;
}

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

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

using namespace std;

#define REP(i, N) for (int (i) = 0; (i) < (N); ++(i))
#define READALL(c) for (auto &e : c) { cin >> e; }
#define PRINTALL(c) for (const auto &e : c) { cout << e << "\t"; } cout << "\n";

template <typename T>
using V = vector<T>;

typedef long double ld;

int N;
string S;


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

	cin >> S;
	N = S.size();

	V<int> DP(1<<26, 1e9);
	DP[0] = 0;

	int bs = 0, res;

	REP(i, N) {
		bs ^= (1<<(S[i]-'a'));
		int ans = DP[bs];
		REP(c, 26) ans = min(ans, DP[bs^(1<<c)]);
		// cout << i << " " << bs << " " << ans+1 << endl;
		DP[bs] = min(DP[bs], ans+1);
		res = ans+1;
	}

	cout << res << endl;
	
}

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

using namespace std;

#define rep(i,n) for(int i=0;i<(int)(n);i++)
const int MOD = 1e9+7;
const long long INF = 1LL << 60;
const int inf = 1e9;
typedef long long ll;

int main(){
    int N; cin >> N;
    int ans=3*N*N;
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define REP(i,a,b) for (int i = a; i < (b); ++i)
#define mREP(i,a,b) for (int i = a; i > (b); --i)
#define all(x) (x).begin(),(x).end()
const int INF = 1000000007;
typedef long long ll;
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a,b) * b; }
int main(){
  ll n;
  cin>>n;
  ll ans = 1LL;
  rep(i,n){
    ll tmp;
    cin>>tmp;
    ans = lcm(ans,tmp);
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
def gcd(a, b):
    if b == 0:
        return a
    if a <= b:
        temp = a
        a = b
        b = temp
    r = a % b
    if r == 0:
        return b
    else:
        return gcd(b, r)


N, K = map(int,input().split())
A = list(map(int,input().split()))
#Aの最大公約数を作ることが出来る

A.sort()
if K > A[-1]:
    print("IMPOSSIBLE")
elif N == 1:
    if K != A[0]:
        print("IMPOSSIBLE")
    else:
        print("POSSIBLE")
else:
    g = gcd(A[0], A[1])
    for i in range(2, N):
        g = gcd(g, A[i])
    if K % g == 0:
        print("POSSIBLE")
    else:
        print("IMPOSSIBLE")

Measured memory_bytes: 62576
//#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>

using namespace std;


void solve() {
    int K, X; cin >> K >> X;
    int sum = 500 * K;
    cout << (sum >= X ? "Yes" : "No") << endl;
}


int main() {
    solve();
    return 0;
}

Measured memory_bytes: 3644
import java.util.*;
class Main{
    public static void main(String[] args){
	Scanner stdIn=new Scanner(System.in);
	int a = stdIn.nextInt();
	int b = stdIn.nextInt();
	int count=0;
	for(int i=1;i<a+1;i++){
	    if(i==a&&b<a){
		break;
	    }
	    count++;
	}
	System.out.println(count);
    }
}


Measured memory_bytes: 21076
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll mod=1000000007;
int main() {
	ll i,j,k,l,m,n,t;
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	t=1;
	while(t--)
	{
		cin>>n;
		ll a[n];
		l=0;
		for(i=0;i<n;i++)
		{
			cin>>a[i];
			if(a[i]%2==0)
			{
			    if(a[i]%3!=0 && a[i]%5!=0)
			    {
			        l=1;
			    }
			}
		}
		if(l==1)
		{
		    cout<<"DENIED";
		}
		else
		{
		    cout<<"APPROVED";
		}
	}
	return 0;
}

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

int main(void){
    int i, j, k, l, n, count, s;
    scanf("%d",&n);
    
    for(i=1;i<=n;i++){
        count = 0;
        if(i==6){
            printf("1\n");
            continue;
        }
        for(j=1;j<=100;j++){
            for(k=1;k<=100;k++){
                for(l=1;l<=100;l++){
                    s = j*j+k*k+l*l+j*k+k*l+j*l;
                    if(s > i){
                        break;
                    }
                    if(s == i){
                        count++;
                    }
                }         
            }            
        }
        printf("%d\n",count);
    }
    return 0;
}

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

main() {
  int n; cin >> n;
  int ans = 0;
  for (int i = 1; i < n + 1; i++) {
    int cnt = 0;
    for (int j = 1; j < i + 1; j++)
      cnt += (i % j == 0);
    if (cnt == 8 && i % 2 == 1) ans++;
  }
  cout << ans << endl;
}


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

int cnt;

void bubbleSort(vector<int>& a, int n) {
	bool flag = true;
	while (flag)
	{
		flag = false;
		for (int j = n - 1; j > 0; j--) {
			if (a[j] < a[j - 1]) {
				swap(a[j], a[j - 1]);
				cnt++;
				flag = true;
			}
		}
	}
}

int main()
{
	int n;
	cin >> n;
	vector<int> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	bubbleSort(a, n);
	for (int i = 0; i < n; i++) {
		cout << a[i];
		if (i < n - 1)
			cout << " ";
		else
			cout << endl;
	}
	cout << cnt << endl;
	return 0;
}


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

#define all(x) x.begin(),x.end()
#define LB(V,x) lower_bound(all(V),x)-V.begin()

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using pi = pair<int32, int32>;
using pll = pair<int64, int64>;
using vi = vector<int32>;
using vll = vector<int64>;
using ll = int64;

inline ll gcd(ll A, ll B){
    if(A<B) swap(A, B);
    if(B==0) return A;
    gcd(B,A%B);
}
inline ll gcd(vll& V){
    ll ans=V[0],i=V.size();
    while(i--) ans = gcd(ans,V[i]);
    return ans;
}

void Main(){
    int N;
    cin >> N;
    vll A(N);
    for(auto &a:A) cin >> a;
    cout << gcd(A) << endl;
}

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

Measured memory_bytes: 1024
#include <iostream>
using namespace std;
int main(void) {
	char s[15], t[15], u[15];
	int a, b;
	cin >> s >> t;
	cin >> a >> b;
	cin >> u;
	if (s[0] == u[0]) {
			a = a - 1;
	}
	else if (t[0] == u[0]) {
			b = b - 1;
	}
	cout << a << " " << b << endl;
	return 0;
}

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

#define int long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, n) for (int i = 1; i <= (n); i++)
#define all(x) begin(x), end(x)
#define uniq(x) (x).erase(unique(all(x)), end(x))
#define bit(n) (1LL << (n))
#define cdiv(a, b) (((a) - 1) / (b) + 1)
#define dump(x) cerr << #x " = " << (x) << endl
using vint = vector<int>;
using vvint = vector<vint>;
using pint = pair<int, int>;
using vpint = vector<pint>;
template<typename T> using priority_queue_rev = priority_queue<T, vector<T>, greater<T>>;
constexpr long double PI = 3.1415926535897932384626433832795028L;
constexpr int DY[8] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr int DX[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int gcd(int a, int b) {
    while (b) { swap(a %= b, b); }
    return a;
}
int lcm(int a, int b) { return a / gcd(a, b) * b; }
template<typename T> void fin(T mes) {
    cout << mes << endl;
    exit(0);
}
template<typename T, typename U> bool chmax(T &a, const U &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> bool chmin(T &a, const U &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &rhs) {
    os << "(" << rhs.first << ", " << rhs.second << ")";
    return os;
}
template<typename T> ostream &operator<<(ostream &os, const vector<T> &rhs) {
    os << "{";
    for (auto itr = rhs.begin(); itr != rhs.end(); itr++) {
        os << *itr << (next(itr) != rhs.end() ? ", " : "");
    }
    os << "}";
    return os;
}
struct setup {
    static constexpr int PREC = 20;
    setup() {
        cout << fixed << setprecision(PREC);
        cerr << fixed << setprecision(PREC);
    };
} setup;

int K;
signed main() {
    cin >> K;
    int ans = 0;
    reps(a, K)reps(b, K)reps(c, K) { ans += gcd(gcd(a, b), c); }
    cout << ans << endl;
}

Measured memory_bytes: 3632
/*
      HET PAGHADAR
      DA-IICT
      @HET262
*/
 
#include<bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
typedef vector<ll> vec; 
#define inf LLONG_MAX
#define bp __builtin_popcountll
#define pb push_back
#define ff first
#define ss second
#define P pair<ll,ll>
#define N 100005
#define LG 20
#define mod 1000000007
#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

int32_t main()
{
      FAST;
      
      bool f=1;
      
      ll n;
      cin>>n;
      
      for(int i=0;i<n;i++)
      {
            ll x;
            cin>>x;
            
            if(x%2==0)
            {
                  ll t1=0;
                  t1+=(x%3!=0);
                  t1+=(x%5!=0);
                  if(t1==2)
                        f=0;
                  
            }
      }
      
      if(f)
            cout<<"APPROVED";
      else
            cout<<"DENIED";
      
      
}

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

using namespace std;
using ll = long long;
using vl = vector<ll>;
using vvl = vector<vl>;
using pll = pair<ll, ll>;

const ll oo = 0x3f3f3f3f3f3f3f3fLL;
const double eps = 1e-9;

#define sz(c) ll((c).size())
#define all(c) begin(c), end(c)
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define FORD(i, a, b) for (ll i = ll(b) - 1; i >= (a); i--)
#define TR(X)                                                  \
    ({                                                         \
        if (1) cerr << "TR: " << (#X) << " = " << (X) << endl; \
    })
#define LL(name) \
    ll name;     \
    cin >> name;
#define VL(name, num) \
    vl name(num);     \
    FOR(INPUT_VL_I, 0, num) { cin >> name[INPUT_VL_I]; }

int main() {
    cin.sync_with_stdio(0);
    LL(N);

    switch (N % 10) {
        case 2:
        case 4:
        case 5:
        case 7:
        case 9:
            cout << "hon" << endl;
            return 0;
        case 3:
            cout << "bon" << endl;
            return 0;
        default:
            cout << "pon" << endl;
            return 0;
    }
}  // cin.tie(0) bei schnellem Wechseln


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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll n;
    string s;
    cin >> n >> s;
    ll ans = 1;
    rep(i,n-1) {
        if(s[i] != s[i+1]) ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 512
#include <stdio.h>
#include <stdlib.h>
typedef struct Node{
    int data;
    struct Node *parent, *left, *right;
}Node;
Node *root;
void insert(int x){
    Node *t = (Node *)malloc(sizeof(Node));
    t->data = x;
    t->left = t->right = t->parent = NULL;

    if(root == NULL){
        root = t;
    }else{
        Node *child = root;
        Node *parent = NULL;
        while(child != NULL){
            parent = child;
            if(x < child->data){
                child = child->left;
            }
            else{
                child = child->right;
            }
        }
        t->parent = parent;
        if(x < parent->data){
            parent->left = t;
        }else{
            parent->right = t;
        }
    }
}
void Preorder(Node *t){
    if(t == NULL) return ;
    printf(" %d", t->data);
    Preorder(t->left);
    Preorder(t->right);
}
void Inorder(Node *t){
    if(t == NULL) return ;
    Inorder(t->left);
    printf(" %d", t->data);
    Inorder(t->right);
}
void find(int b){
    Node *temp = root;
    while(temp != NULL){
        if(temp->data == b){
            printf("yes\n");
            return ;
        }
        if(b < temp->data){
            temp = temp->left;
        }
        else{
            temp = temp->right;
        }
    }
    printf("no\n");
}
int main(){
    root = NULL;
    int n;
    scanf("%d", &n);
    for(int i = 0; i < n; i++){
        char a[10]; int b;
        scanf("%s", a);
        if(a[0] == 'i'){
            scanf("%d", &b);
            insert(b);
        }
        else if(a[0] == 'p'){
            Inorder(root);
            printf("\n");
            Preorder(root);
            printf("\n");
        }
        else if(a[0] == 'f'){
            int c;
            scanf("%d", &c);
            find(c);
        }
    }
    return 0;
}


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

int main()
{
  int N, A = 0, B = 0, tmp, tmpj; //定義


  cin >> N; //入力
    vector<int> ai(N);
  for (int i = 0; i < N; i++)
  cin >> ai.at(i);

  for (int i = 0; i < N; i++){ //ソート
    tmp = 0;
    tmpj = 0;
    for (int j = i; j < N; j++){
      if(tmp < ai.at(j)){
        tmp = ai.at(j);
        tmpj = j;
      }
    }
    ai.at(tmpj) = ai.at(i);
    ai.at(i) = tmp;
  }

  for (int i = 0; i < N; i++){
    if (i % 2 == 0)
    A += ai.at(i);
    else
    B += ai.at(i);
  }

  cout << A - B << endl;
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ADontBeLate solver = new ADontBeLate();
        solver.solve(1, in, out);
        out.close();
    }

    static class ADontBeLate {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int d = in.nextInt(), t = in.nextInt(), s = in.nextInt();

            out.println(t * s >= d ? "Yes" : "No");
        }

    }

    static class InputReader {
        public final BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 25620
#include<cstdio>
#include<map>
using namespace std;
pair<int, int> p;
map<pair<int, int>, bool> grid;
int h, w, n;
long long cnt[10];
int main() {
	scanf("%d%d%d", &h, &w, &n);
	int i,j;
	for (i = 0; i < n; i++) {
		int a, b;
		scanf("%d%d", &a, &b);
		grid[make_pair(a, b)] = true;
	}
	for (auto iter = grid.begin(); iter != grid.end(); iter++) {
		if (!iter->second) continue;
		int x=iter->first.first,y=iter->first.second;
		for (int cx = 1; cx <= 3; cx++) {
			for (int cy = 1; cy <= 3; cy++) {
				bool inclusive = true;
				int count = 0;
				for (i = 1; i <= 3; i++) {
					for (j = 1; j <= 3; j++) {
						int nx = x + i-cx,ny=y+j-cy;
						if (nx<1 || nx>h || ny<1 || ny>w) inclusive = false;
						count += grid[make_pair(nx, ny)];
					}
				}
				if (inclusive) cnt[count]++;
			}
		}
	}
	cnt[0] = (long long)(h - 2)*(w - 2);
	for (i = 1; i <= 9; i++) {
		cnt[i] /= i;
		cnt[0] -= cnt[i];
	}
	for (i = 0; i <= 9; i++) printf("%lld\n", cnt[i]);
	return 0;
}

Measured memory_bytes: 156544
#include <stdio.h>

int main(void){
	int N,K;
	int p[200000];
	int i,j;
	int max,tmp;
	double e;

	scanf("%d %d",&N, &K);
	for(i=0; i<N; i++) scanf("%d",&p[i]);

	max=0;
	for(i=0; i<K; i++) max+=p[i];
	tmp = max;
	j=0;
	for(i=K; i<N; i++){
		tmp = tmp - p[i-K];
		tmp = tmp + p[i];
		if(max < tmp) {max=tmp; j=i-K+1; }
	}

	e=0;
	for(i=j; i<j+K; i++){
		e += (1+p[i]) / 2.0;
	}
	printf("%lf\n",e );
}



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

int n,W;
LL dp[100005];

int main() {
	scanf("%d%d",&n,&W);
	memset(dp,62,sizeof(dp));
	dp[0] = 0;
	int ret = 0;
	for (int i=0; i<n; i++) {
		int w,v;
		scanf("%d%d",&w,&v);
		for (int j=100000; j>=v; j--) {
			if (dp[j-v]+w <= W) {
				dp[j] = min(dp[j],dp[j-v]+w);
				//printf(" at %d %d = %d\n",i,j,dp[j]);
				ret = max(ret,j);
			}
		}
	}
	printf("%d\n",ret);
	return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int i,j,n,m;
string s;
int main()
{
    std::cin.sync_with_stdio(false);
    std::cin.tie(0);
    cin >> s;
    i=0;
    while (i<s.length())
    {
        if (s[i]=='+')
        {
            n++;
        }
        else
        {
            n--;
        }
        i++;
    }
    cout << n;
    return 0;
}


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

int H;
int W;
int dx[]={-1,0,1,0};
int dy[]={0,-1,0,1};

void display_matrix(vector<vector<int>>& matrix){
	int x,y;
	cout << "-----------------" << endl;
	for(y=0;y<H;y++){
		for(x=0;x<W;x++){
			cout << setw(3) << matrix[y][x];  
		}
		cout << endl;
	}
	cout << "-----------------" << endl;
}

int bfs(vector<vector<int>>& maze){
	int x,y;
	int dmax=0;
	int start_x;
	int start_y;
	vector<vector<int>> dist;
	queue<pair<int,int>> que;

	for(start_y=0;start_y<H;start_y++){
		for(start_x=0;start_x<W;start_x++){
			dist.clear();
			dist.resize(H,vector<int>(W,-1));

			if(maze[start_y][start_x]) continue;
			dist[start_y][start_x]=0;
			que.emplace(start_x,start_y);

			while(!que.empty()){
				x=que.front().first;
				y=que.front().second;
				que.pop();

				rep(i,4){
					if(!(0<=x+dx[i] && x+dx[i]<W && 0<=y+dy[i] && y+dy[i]<H)) continue;
					if(dist[y+dy[i]][x+dx[i]]>=0) continue;
					if(maze[y+dy[i]][x+dx[i]]) continue;

					que.emplace(x+dx[i],y+dy[i]);
					dist[y+dy[i]][x+dx[i]]=dist[y][x]+1;
				}
			}

			rep(x,W)rep(y,H) dmax=max(dmax,dist[y][x]);
		}
	}

	return dmax;
}

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

	int i,k;
	int x,y;
	int ans=0;
	int ctr=0;
	char input;

	cin >> H >> W;
	vector<vector<int>> maze(H,vector<int>(W,0));

	for(y=0;y<H;y++){
		for(x=0;x<W;x++){
			cin >> input;
			if(input=='#') maze[y][x]=1;
			else maze[y][x]=0;
		}
	}

	ans=max(ans,bfs(maze));

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



Measured memory_bytes: 3652
import sys
from collections import Counter
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7

def main():
    N, M = map(int, readline().split())
    R = [0]*(N)
    W = [1]*(N)
    R[0] = 1
    W[0] = 0
    for _ in range(M):
        x, y = map(int, readline().split())
        if R[x-1]==1 and W[x-1]>=1:
            W[x-1] -= 1
            if R[y-1]==0:
                R[y-1]+=1
            else:
                W[y-1]+=1
        elif R[x-1]==0 and W[x-1]>=1:
            W[x-1] -= 1
            W[y-1] += 1
        else:
            R[x-1] -= 1
            R[y-1] += 1
    ans = 0
    for i in range(N):
        if R[i]>=1:
            ans += 1
    print(ans)
if __name__ == '__main__':
    main()


Measured memory_bytes: 10720
n=int(input())
a = [input() for i in range(n)]
new_a = [0]*len(a)
cnt = 1
ans = 0
for i in range(len(a)):
    new_a[i] = sorted(a[i]) 
b = sorted(new_a)
for i in range(len(b)-1):
    if b[i] == b[i+1]:
        cnt += 1
    else:
        ans += cnt*(cnt - 1)/2 #組み合わせ(cnt C 2)
        cnt = 1
ans += cnt*(cnt - 1)/2
print(int(ans))

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

int main(){
  int n;
  cin >> n;
  vector<int> vec(n);
  for(int i=0;i<n;i++) cin >> vec.at(i);
  int sum = 0;
  for(int i=0;i<n;i++){
    for(int j=i+1; j < n; j++){
      sum += vec.at(i) * vec.at(j);
    }
  }
  cout << sum << endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;//list用
using System.Text;//StringBuilder用
using System.Collections;
using System.Linq;
class Program
{
static decimal result;
static List<int>[] s;
  static int N,D;
    static void Main()
    {
      
      //N=int.Parse(Console.ReadLine());
      string[] tmp=Console.ReadLine().Split(' ');
      N=int.Parse(tmp[0]);
      D=int.Parse(tmp[1]);
                decimal kyori;
      s=new List<int>[N];
      for(int i=0;i<N;i++){s[i]=new List<int>();}
      for(int j=0;j<N;j++){
  string[] tmp2=Console.ReadLine().Split(' ');
for(int i=0;i<D;i++){s[j].Add(int.Parse(tmp2[i]));        }

    }
      for(int i=0;i<N;i++){
        for(int j=i+1;j<N;j++){
kyori=0;
        for(int k=0;k<D;k++){kyori+=(s[i][k]-s[j][k])*(s[i][k]-s[j][k]);}
          for(int k=1;k<100000;k++){if(kyori==k*k){result++;}}
        }
      }      
                    Console.WriteLine(result.ToString());
    }

static void Read()
{
  string[] tmp=Console.ReadLine().Split(' ');
//for(int i=0;i<N;i++){s.Add(int.Parse(tmp[i]));}
}
}

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

int main() {
	string S;
	cin >> S;
  int top = stoi(S.substr(0,2));
  int bottom = stoi(S.substr(2,2));

  bool topisYY = false;
  bool bottomisYY = false;
  if(top >=13 || top == 0) topisYY = true;
  if(bottom >=13 || bottom == 0) bottomisYY = true;

  if(topisYY && bottomisYY){
    cout << "NA" << endl;
  } else if(topisYY){
    cout << "YYMM" << endl;
  } else if(bottomisYY){
    cout << "MMYY" << endl;
  } else {
    cout << "AMBIGUOUS" << endl;
  }
}

Measured memory_bytes: 256
n = int(input())
i = 1
counter = 0

while i <= n:
    answer = 0
    k = 1
    while k**2  < i:
        if i % k == 0:
            if i == k**2:
                answer+=1
            else:
                answer += 2
        k+=1
    i += 2
    if answer == 8:
        counter+=1

print(counter)

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

int main()
{
  int n,k;
  cin>>n>>k;
  int x,c=0;
  for(int i=0;i<n;i++)
  {
    cin>>x;
    if(x>=k)
      c++;
  }
  cout<<c;
}

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

int main() {
	int n, k;
	cin >> n >> k;
	vector<ll>h(n);
	for (int i = 0; i < n; i++)cin >> h.at(i);
	sort(h.begin(), h.end());
	ll tot = 0;
	for (int i = 0; i < n-k; i++)tot += h.at(i);
	cout << tot << endl;


}

Measured memory_bytes: 1792