akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<functional>
#include<math.h>

#define rep(i,n) for(ll i=0;i<(n);i++)
typedef long long ll;
using namespace std;

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

	bool rev_check = false;
	bool past = false;
	rep(i, q) {
		int t;
		cin >> t;
		int f;
		string c;
		
		if (t == 1) {
			if(!past) rev_check = true;
			else rev_check = false;
		}


		if (t == 2) {
			cin >> f >> c;
		}

		if (rev_check) {
			if (f == 1) s += c;
			if (f == 2) s.insert(0, c);
		}
		else {
			if (f == 1) s.insert(0, c);
			if (f == 2) s += c;
		}
		past = rev_check;

	}
	if (rev_check) reverse(s.begin(), s.end());
	cout << s << endl;

	return 0;
}

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


int main () {

    int n;
    while ( scanf("%d", &n) != EOF ) {
        int i, j;
        char *a = malloc(n);
        memset(a, 1, n);

        a[0] = 0;
        for ( i = 0; i < n; ++i ) {
            if ( a[i] == 1 ) {
                for ( j = i + (i + 1); j < n; j += (i + 1) ) {
                    a[j] = 0;
                }
            }
        }

        int c = 0;
        for ( i = 0; i < n; ++i) {
            if ( a[i] ) c++;
        }
        printf("%d\n", c);
        free(a);

    }

    return 0;
}

Measured memory_bytes: 1652
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n,m;
  cin >> n>>m;
  vector<int>a(n);
    int b=0;
    for(int i=0;i<n;i++){
      cin>>a.at(i);
      b+=a.at(i);//総得票数
    }
  int c=0;//人気商品
  int d=b/(4*m);//人気商品になるための得票数
  if(b%(4*m)!=0){//端数が出る場合は+1
    d++;
  }
  for(int i=0;i<n;i++){
      if(a.at(i)>=d){
        c++;
      }
    }
  if(c>=m){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
}


Measured memory_bytes: 3576
#include <stdio.h>

int main(void)
{
	int bar[30];
	int w, n, i, a, b, temp;
	
	scanf("%d", &w);
	scanf("%d", &n);
	
	for (i = 0; i < w; i++){
		bar[i] = i + 1;
	}
	
	for (i = 0; i < n; i++){
		scanf("%d,%d", &a, &b);
		
		temp = bar[a-1];
		bar[a-1] = bar[b-1];
		bar[b-1] = temp;
	}
	
	for (i = 0; i < w; i++){
		printf("%d\n", bar[i]);
	}
	
	return (0);
}

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

using namespace std;

const int MOD = 1000000007;
const int MAX32 = 2147483647;
const double PI = 3.14159265358979323846;

int main() {
  long long n, left = 0, right, cnt = 0, flag = 0;
  cin >> n;
  right = n - 1;
  vector<char> c(n);
  for (int i = 0; i < n; i++) {
    cin >> c[i];
  }
  while (left < right) {
    while (c[left] == 'R') {
      left++;
      if (left >= right){
        flag = 1;
        break;
      }
    }
    while (c[right] == 'W') {
      right--;
      if (left >= right) {
        flag = 1;
        break;
      }
    }
    if (flag) break;
    cnt++;
    left++;
    right--;
  }
  cout << cnt << endl;
}


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

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

	string s;
	cin >> s;

	if (s[s.size() - 1] == 's')
		cout << s << "es";
	else
		cout << s << "s";

	return 0;
}

Measured memory_bytes: 3636
import sys
sys.setrecursionlimit(4100000)
import math
import itertools
INF = float('inf')
from heapq import heapify, heappop, heappush
import collections


n,m = map(int, input().split())
par = [i for i in range(n)]
rank = [0]*n

def find(x):
    if par[x] == x:
        return x
    else:
        par[x] = find(par[x])
        return par[x]

def unite(x, y):
    x = find(x)
    y = find(y)
    if x == y:
        return
    if rank[x] < rank[y]:
        par[x] = y
    else:
        par[y] = x
        if rank[x] == rank[y]:
            rank[x] += 1

def main():
    for _ in range(m):
        a,b = map(int, input().split())
        unite(a-1,b-1)

    count = [0]*n
    for p in par:
        count[find(p)] += 1
    print(max(count))


if __name__ == '__main__':
    main()


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

using namespace std;

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

    int ans = 0;
    for (int i = 0; i < N; ++i) {
        set<char> st{A[i], B[i], C[i]};
        ans += (int) st.size() - 1;
    }

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


Measured memory_bytes: 256
#include <iostream>
#define ll long long int
using namespace std;
int main() 
{
    ll n,d, count = 0,x,y;
    cin >> n >> d;
    for(ll i = 0; i < n; i++)
    {
        cin >> x >> y;
        if ( x*x + y*y <= d*d) count++;
    }
    cout << count << endl;
}


Measured memory_bytes: 3668
import numpy as np
N , K = map(int,input().split())
ans = 0
for i in range(1 , N + 1):
    j = i
    idx = 0
    while j < K:
        j *= 2
        idx += 1
    ans += 1 / N * np.power(1 / 2 , idx)
print(ans)

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

const int M = 500;

int main()
{
    int k;
    cin >> k;
    if(k <= M){
        cout << k << endl;
        for(int i = 1; i <= k; i++){
            for(int j = 0; j < k; j++) cout << i << " ";
            cout << endl;
        }
    }
    else{
        cout << M << endl;
        int c[502][502];
        for(int i = 0; i < M * 2 - k; i++){
            for(int j = 0; j < M; j++){
                c[(i + j) % M][j] = i + 1;
            }
        }
        for(int i = M * 2 - k; i < k; i += 2){
            for(int j = 0; j < M; j++){
                if(j % 2) c[((i - (M * 2 - k)) / 2 + (M * 2 - k) + j) % M][j] = i + 2;
                else c[((i - (M * 2 - k)) / 2 + (M * 2 - k) + j) % M][j] = i + 1;
            }
        }
        for(int i = 0; i < M; i++){
            for(int j = 0; j < M; j++) cout << c[i][j] << " ";
            cout << endl;
        }
    }
}

Measured memory_bytes: 2176
#define rep(i,n) for(i=0;i<(n);++i)
#include<iostream>
#include<fstream>
#include<vector>
#include<array>
#include<utility>
#include<string>
#include<algorithm>
#include<bitset>
#include<queue>
#include<cmath>
#include<iomanip>
using ll = unsigned long long int;
using namespace std;

int src(){
    int n;
    cin>>n;
    bool f[101];
    for(int i=1;i<=100;++i) f[i]=false;
    for(int i=1;i<=9;++i){
    for(int j=1;j<=9;++j){
        f[i*j]=true;
    }}
    if(f[n]){
        cout<<"Yes";
    }else{
        cout<<"No";
    }

    return 0;
}

int main(int argc,char* argv[]){
    //ifstream in( argv[1] );
    //cin.rdbuf(in.rdbuf());
    src();    
    return 0;
}

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

using namespace std;
typedef long long ll;

const int maxn = 3e3 + 10;
int dp[maxn][maxn], par[maxn][maxn];

int main(){
	ios_base::sync_with_stdio(false);
	string s, t;
	cin >> s >> t;
	for (int i = 1; i <= s.size(); i++){
		for (int j = 1; j <= t.size(); j++){
			dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]);
			if (dp[i - 1][j] >= dp[i][j - 1])
				par[i][j] = 1;
			else
				par[i][j] = 2;
			if (s[i - 1] == t[j - 1]){
				dp[i][j] = dp[i - 1][j - 1] + 1;
				par[i][j] = 3;
			}
		}
	}
	int x = s.size(), y = t.size();
	string ans;
	while (x > 0 and y > 0){
		if (par[x][y] == 1){
			x --;
		}
		else if (par[x][y] == 2){
			y --;
		}
		else{
			ans += s[x - 1];
			x --, y --;
		}
	}
	reverse(ans.begin(), ans.end());
	cout << ans << endl;
}


Measured memory_bytes: 70912
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define fr(i,a,b) for(int i=a;i <= b;i++)
#define sz(x) x.size()
#define N 60

int temp[N][26];

int main() {
	int n; cin >> n;
	rep(i,n) {
		string s; cin >> s;
		rep(j,sz(s)) temp[i+1][s[j]-'a']++;
	}
	rep(i,26) {
		int MIN = INT_MAX;
		fr(j,1,n) MIN = min(MIN,temp[j][i]);
		rep(k,MIN) {
			char x = i + 'a';
			cout << x;
		} 
	}
	cout << endl;
}

Measured memory_bytes: 256
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())

l = [a,b,c,d,e]
flag = True
for i in range(5):
	for j in range(5):
		#print(i,j)
		if i == j:
			continue
		else:
			if abs(l[i]-l[j]) > k:
				flag = False
				break

if flag==False:
	print(":(")
else:
	print("Yay!")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
    long long int n;
    long long int a[5];
    
    cin>>n;
    for(int i=0;i<5;i++){
        cin>>a[i];
    }
    sort(a, a+5);
    
    if(n%a[0]==0) cout<<4+n/a[0]<<endl;
    else cout<<5+n/a[0]<<endl;
    
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vec;
typedef pair<int,int> pair;
#define F first
#define S second
#define pb push_back
#define PB pop_back
#define MP make_pair
#define rep(i,a,b) for (i = a; i < b; i++)
bool isPrime(int n) 
{ 
    
    if (n <= 1) 
        return false; 
    if (n <= 3) 
        return true; 
  
    
    if (n % 2 == 0 || n % 3 == 0) 
        return false; 
  
    for (int i = 5; i * i <= n; i = i + 6) 
        if (n % i == 0 || n % (i + 2) == 0) 
            return false; 
  
    return true; 
} 
ll binaryToDecimal(ll n) 
{ 
    ll num = n; 
    ll dec_value = 0; 
  
    
    ll base = 1; 
  
    ll temp = num; 
    while (temp) { 
        ll last_digit = temp % 10; 
        temp = temp / 10; 
  
        dec_value += last_digit * base; 
  
        base = base * 2; 
    } 
  
    return dec_value; 
}    

int main(){
ios::sync_with_stdio(0);
cin.tie(0);
	
	 ll n,i;
     cin>>n;
     int count=0;
     int a[n+1];
     rep(i,1,n+1){
        cin>>a[i];
     }
     ll point=1;
     rep(i,1,n+1){
        if(a[i]==point){point++;count++;}
     }
     if(count<=0)cout<<-1<<endl;
     else cout<<n-count<<endl;
	 return 0;
	}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
bool isp(string s){
    int n=s.size();
    for(int i=0;i<=(n-1)/2;i++){
        if(s[i]!=s[n-i-1])return false;
    }
    return true;
}
int main() {
    int f=1;
    string s;
    cin >>s;
    int n=s.size();
    if(s.size()%2==0)f=0;
    if(isp(s)==false)f=-1;
    string k1=s.substr(0,((n-3)/2)+1);
    string k2=s.substr((n+1)/2,n-1);
    if(isp(k1)==false)f=-2;
    if(isp(k2)==false)f=-3;
    if(f!=1)cout << "No" << endl;
    else cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 256
import sys, os, math, bisect, itertools, collections, heapq, queue, copy, array

# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
# from decimal import Decimal
# from collections import defaultdict, deque

sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)

MOD = 10 ** 9 + 7
INF = float('inf')


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

    S = ii()
    dp = [0] * (S + 1)

    dp[0] = 1
    # 0 <= i <= Sの範囲を探索
    for i in range(1, S + 1):
        # 0 <= j <= i - 3の範囲で、
        # 間仕切りを置くことができる個数の合計を集計
        for j in range(0, i - 3 + 1):
            dp[i] += dp[j]
            dp[i] %= MOD
    print(dp[-1])


if __name__ == '__main__':
    main()


Measured memory_bytes: 9820
#include<bits/stdc++.h>
#define ll long long
#define ii pair<int, int>
#define pll pair<ll, ll>
#define N 200123
#define vi vector<int>
#define vii vector<ii>
#define vll vector<ll>
#define vpll vector<pll>
#define pb emplace_back
#define fs first
#define sc second
#define sz(x) ((int)((x).size()))
#define oo 100000012
#define mod 1000000007LL
#define M 10000123

using namespace std;

unordered_map<ll, ll> f;
int n;
ll v[N];
unordered_map<ll, ll> np;

int main(){
    ios_base::sync_with_stdio(0);
    cin >> n;
    ll ma = -1;
    for(int i = 0; i < n; ++i){
        cin >> v[i];
        ma = max(ma, v[i]);
        f[v[i]]++;
    }
    for(int i = 0; i < n; ++i){
        if(v[i] == 1 && f[1] > 1){
            cout << 0 << '\n';
            return 0;
        }
        else if(v[i] == 1 && f[1] == 1) {
            cout << 1 << '\n';
            return 0;
        }

        if(f[v[i]] > 1) {
            np[v[i]] = 1;
        }
        for(ll j = 2 * v[i]; j <= ma; j += v[i]){
            np[j] = 1;
        }
    }
    int ans = 0;
    for(int i = 0; i < n; ++i){
        if(np.count(v[i]) == 0){
            ans++;
        }
    }
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 44268
#include <iostream>
#include <cmath>
#include <cstring>
#include <cstdio>
using namespace std;
#define INF 2000000010
int awal,target,ans=INF,temp;
int main()
{
	scanf("%d%d",&awal,&target);
	if(target>=awal)
	{
		temp=target-awal;
		ans=min(ans,temp);
	}
	if(target>=-awal)
	{
		temp=target-(-awal);
		ans=min(ans,temp+1);
	}
	if(-target>=awal)
	{
		temp=-target-awal;
		ans=min(ans,temp+1);
	}
	if(-target>=-awal)
	{
		temp=-target-(-awal);
		ans=min(ans,temp+2);
	}
	cout<<ans<<endl;
}

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

int main() {
    string s;
    cin >> s;
    int a, z;
    for (int i = 0;; i++) {
        if (s.at(i) == 'A') {
            a = i;
            break;
        }
    }
    for (int i = s.size() - 1;; i--) {
        if (s.at(i) == 'Z') {
            z = i;
            break;
        }
    }
    cout << (z - a + 1) << endl;
    return 0;
}

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

int main() {
  long n,k,ans=0;
  cin >> n >> k;
  vector<long> x(n),a,b;
  for(long i=0;i<n;i++) {
    cin >> x[i];
    if(x[i]>0) {
      a.push_back(x[i]);
    } else if(x[i]<0) {
      b.push_back(0-x[i]);
    } else {
      k--;
    }
  }
  reverse(b.begin(),b.end());
  if(k>0) {
    ans=9999999999999;
    for(long i=1;i<k;i++) {
      if(i<=a.size()&&k-i<=b.size()) ans=min(ans,min(a[i-1],b[k-i-1])*2+max(a[i-1],b[k-i-1]));
    }
    if(k<=a.size())ans=min(ans,a[k-1]);
    if(k<=b.size())ans=min(ans,b[k-1]);
  }
  cout << ans << endl;
}

Measured memory_bytes: 2424
class Node
	attr_accessor :prev, :next, :value
	def initialize value
		@value = value
	end
end

class DoubllyLinkedList
	def initialize
		@nil_node = Node.new nil
		@nil_node.next = @nil_node.prev = @nil_node
	end

	def insert value
		node = Node.new value
		node.next = @nil_node.next
		node.prev = @nil_node
		@nil_node.next.prev = node
		@nil_node.next = node
	end

	def search value
		node = @nil_node.next
		node = node.next until node == @nil_node || node.value == value
		node
	end

	def deleteNode node
		return if node == @nil_node
		node.prev.next = node.next
		node.next.prev = node.prev
	end

	def delete value
		deleteNode search value
	end

	def deleteFirst dummy
		deleteNode @nil_node.next
	end

	def deleteLast dummy
		deleteNode @nil_node.prev
	end

	def values
		arr = []
		node = @nil_node.next
		until node == @nil_node
			arr << node.value
			node = node.next
		end
		arr
	end
end

dll = DoubllyLinkedList.new
n = gets.to_i
n.times{
	line = gets.chomp.split
	dll.send line[0], line[1]
}
puts dll.values.join(" ")

Measured memory_bytes: 147740
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int sz=20;
int n;
struct node{
	int l,r,fl,fr;
	const bool operator<(const node &p)const{
		if(l!=p.l) return l<p.l;
		if(r!=p.r) return r<p.r;
		if(fl!=p.fl) return fl<p.fl;
		if(fr!=p.fr) return fr<p.fr;
	}
};
ll a[sz];
ll g[sz][sz][611][611];
map<node,ll>dp;
ll f(int l,int r,int fl,int fr){
	if(l+1==r) return 0;
	if(fl<611&&fr<611){
		if(g[l][r][fl][fr]) return g[l][r][fl][fr];
	}
	else if(dp[(node){l,r,fl,fr}]) return dp[(node){l,r,fl,fr}];
	ll ret=1e18;
	ll sum=fl+fr;
	for(int i=l+1;i<=r-1;i++){
		ret=min(ret,sum*a[i]+f(l,i,fl,sum)+f(i,r,sum,fr));
	}
	if(fl<611&&fr<611) return g[l][r][fl][fr]=ret;
	else return dp[(node){l,r,fl,fr}]=ret;
}
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%lld",&a[i]);
	printf("%lld\n",a[1]+f(1,n,1,1)+a[n]);
} 

Measured memory_bytes: 327168
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define all(v) v.begin(), v.end()
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<ll> vec;
typedef vector<vec> mat;
ll mod=998244353;
ll inv(ll a){
    ll n=mod-2,ans=1;
    while(n>0){
        if(n&1) ans=ans*a%mod;
        n=n/2;
        a=a*a%mod;
    }
    return ans;
}
ll A[200001];
void init(){       //忘れない
    A[0]=1;
    rep(i,200000) A[i+1]=A[i]*(i+1)%mod;
}
ll nCk(ll n,ll k){
    return A[n]*inv(A[k])%mod*inv(A[n-k])%mod;
}
int main(){
    ll n,m,k;
    cin>>n>>m>>k;
    init();
    ll ans=0;
    vec B(n+1,1);
    rep(i,n) B[i+1]=B[i]*(m-1)%mod;
    rep(i,k+1) (ans+=m*B[n-i-1]%mod*nCk(n-1,i)%mod)%=mod;
    cout<<ans;
}

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

int main(){
    int N;
    cin >> N;
    vector<int> A(N);
    for (int i=0; i<N; i++)
    {
        cin >> A[i];
    }

    long long sum = 0;
    int m = 0;
    for (int i=0; i<N; i++)
    {
         m= max(m, A[i]);
        int s = m;
        sum += s - A[i];
    }

    cout << sum <<'\n';
}


Measured memory_bytes: 4036
#include<iostream>
#include <stdio.h>
#include<string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <cstdint>
#include <queue> 
#include <map>
#include <set>
#define MOD 1000000007
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n)  FOR(i,0,n)
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
typedef long long ll;
using namespace std;

int main(){

  int p[100010] = {};
  int s[100010] = {};
  int n = 100001;
  p[2] = 1;

  for(int i=3;i<n;i+=2){
    int flag = 1;
    for(int j=3; j<= sqrt(i);j+=2){
      if(i%j == 0){
        flag = 0; break;
      }
    }
    if(flag == 1) p[i]++;//素数についての操作//
  }
  
   // REP(i,20) dump(p[i]);

  FOR(i,3,n){
    s[i] = s[i-1];
    if(p[i] == 1 && p[(i+1)/2] == 1) s[i]++;
  }
  
   // REP(i,55){ cout << i << " "; dump(s[i]);}
  
  int q;
  cin >> q;
  REP(i,q){
    int L,R;
    cin >> L >> R;
    
    cout << s[R] - s[L-1]<< endl;
  }
    
 return 0;
}

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

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


int main(void){
	long long int  a,b[100010];
  cin >> a >>b[0];
  
 long long int d=b[0];
  
  for(int i=1;i<a;i++){
    cin >> b[i];
    d = gcd(d,b[i]);
  }
 
  cout << d << endl;
  return 0;
}
      
  
  
  


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<ll>;
using vii = vector<vi>;
using Pll = pair<ll, ll>;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(v) v.begin(), v.end()
#define sz(x) ((int) x.size())
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define F first
#define S second
const int MOD = 1e9+7;
template<class T> void print(const T& t){ cout << t << endl; }
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; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int main(){
  ll n;
  cin >> n;
  vi x(n);
  vi y(n);
  rep(i,n){
    cin >> x[i] >> y[i];
  }
  double total = 0;
  rep(i,n){
    for (ll j = i + 1; j < n;j++){
      total += (double)sqrt((x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j]));
    }
  }
  double ans = total / n*(double)2;
  cout << fixed << setprecision(8) << ans << endl;
}


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

mask = [[0 for _ in range(3)] for _ in range(3)]
for row_idx, row in enumerate(A):
  for column_idx, element in enumerate(row):
    for val in b:
      if element == val:
        mask[row_idx][column_idx] = 1
        break

ans = "No"
for row in mask:
  if sum(row)==3: ans="Yes"
for column_idx in range(3):
  if mask[0][column_idx] + mask[1][column_idx] + mask[2][column_idx] == 3: ans="Yes"
if mask[0][0] + mask[1][1] + mask[2][2] == 3: ans="Yes"
if mask[0][2] + mask[1][1] + mask[2][0] == 3: ans="Yes"
print(ans)

Measured memory_bytes: 3192
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    double x[] = new double[N]; 
    String u[] = new String[N];
    for(int i=0;i<N;i++){
      x[i]=sc.nextDouble();
      u[i]=sc.next();
    }
    double answer=0;
    for(int i=0;i<N;i++){
      if(u[i].equals("JPY")){
        answer=answer+x[i];
      }else{
        answer=answer+x[i]*380000;
      }
    }
    System.out.println(answer);
      
      
  }
  

  
}

Measured memory_bytes: 25172
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i,n) for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define pb push_back
#define eb emplace_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
#define fi first
#define se second
typedef long long ll;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> PP;
typedef multiset<ll> S;
typedef priority_queue<ll> PQ;
typedef priority_queue<P, vector<P>, greater<P>> SPQ;
using vi = vector<ll>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
const ll inf = 1001001001001001;
const int INF = 1001001001;
const int mod = 1000000007;
const double pi = 3.14159265358979323846;
template<class T> bool chmin(T& a, T b) { if (a > b) { a = b; return true; }return false; }
template<class T> bool chmax(T& a, T b) { if (a < b) { a = b; return true; }return false; }
template<class T> void out(T a) { cout << a << endl; }
template<class T> void outp(T a) { cout << '(' << a.fi << ',' << a.se << ')' << endl; }
template<class T> void outvp(T v) { rep(i, v.size())outp(v[i]); }
template<class T> void outv(T v) { rep(i, v.size()) { if (i)cout << ' '; cout << v[i]; }cout << endl; }
template<class T> void outvv(T v) { rep(i, v.size()) { rep(j, v[i].size()) { if (j)cout << ' '; cout << v[i][j]; }cout << endl; } }
int main() {
  int n,m; cin>>n>>m;
  if(n==m) out("Yes");
  else out("No");
}


Measured memory_bytes: 256
N = input()

S = list(raw_input())

ans = 0
for i in range(1,N):
    counter = 0
    X = S[0:i]
    Y = S[i:N]
    data = []
    for j in X:
        if j in Y and j not in data:
            counter += 1
            data.append(j)
    if ans < counter:
        ans = counter

print ans

Measured memory_bytes: 2568
#include <iostream>

using namespace std;
typedef long long ll;
#define REP(i,n) for (ll i = 0; i < (n); ++i)

int main(){
    string s;
    cin >> s;
    const bool hasn = s.find('N') != string::npos;
    const bool hass = s.find('S') != string::npos;
    const bool hase = s.find('E') != string::npos;
    const bool hasw = s.find('W') != string::npos;
    if(((hasn && !hass) || (hass && !hasn)) ||
       ((hase && !hasw) || (!hase && hasw))){
        cout << "No" << endl;
    }else{
        cout << "Yes" << endl;
    }
    return 0;
}


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


int main() 
{

	int n; cin>>n;
	ll a[n], b[n];
	for(int i = 0; i<n; i++) 
	{
		int x, y; cin>>x>>y;
		a[i] = x+y;
		b[i] = x-y;
	}
	sort(a, a+n);
	sort(b, b+n);
	ll res = a[n-1]-a[0];
	res = max(res, b[n-1]-b[0]);
	cout<<res<<endl;
}
 

Measured memory_bytes: 6756
#pragma target("avx")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef unordered_map<ll, ll> U_MAP;
typedef priority_queue<ll> pq;
typedef priority_queue<ll, vector<ll>, greater<ll>> rpq;
constexpr ll INF = 1e9, MOD = 1e9 + 7, ohara = 1e6 + 10;
constexpr ll LINF = 1e18;

#define rep(i, n) for (ll(i) = 0; (i) < (int)(n); (i)++)
#define rrep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrrep(i, a, b) for (ll i = (a); i >= (b); i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout << (x) << endl
#define doublecout(a) cout << fixed << setprecision(15) << a << endl;
#define fi first
#define se second
#define m_p make_pair
#define p_b push_back
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto& x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

//------ Believe yourself as a genius!!!!!! ------

int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
// int dy[]={-1,0,1,-1,1,-1,0,1};int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"), s;
ll n, cnt, ans, a, b, c, d, tmp, m, h, w, x, y, sum, k, q;

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

  cin >> a >> b;
  if (a <= 0 && b >= 0)
    Cout("Zero");
  else if (0 < a)
    Cout("Positive");
  else {
    a *= -1;
    b *= -1;
    tmp = a - b + 1;
    if (tmp % 2 == 1)
      Cout("Negative");
    else
      Cout("Positive");
  }
  return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <bitset>
#include <cmath>
#include <vector>
#include <algorithm>

using namespace std;
typedef long long ll;

#define ALL(obj) (obj).begin(), (obj).end() 
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)

int main(){
    int n;
    cin >> n;
    vector<pair<int, int> > a(n),b(n);
    rep(i,n){int ta,tb; cin >> ta >> tb; a[i]= make_pair(ta,tb);}
    rep(i,n){int tc,td; cin >> tc >> td; b[i]= make_pair(tc,td);}
    sort(ALL(a));
    sort(ALL(b));
    int ans=0;
    rep(i,n){
        int bx = b[i].first, by = b[i].second;
        int id,maxy=-1;
        rep(j,n){
            if(a[j].first < bx && a[j].second < by && a[j].second > maxy){id=j; maxy = a[j].second;}
        }
        if(maxy!=-1){ ans++;
        a[id] = make_pair(400,400);}
    }
    cout << ans << endl;

    return 0;
}

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



int main (int argc, char const* argv[]){
    int n,i;
    int array[100] = {};
    int max=0;
    vector<int> elems;
    
    //各整数の取得
    while((cin >> n)){
        array[n-1] += 1;
    }
    //cout << array[2]<< endl;
    
    //最頻値を求める
    for(i=0; i<100; i++){
        if(max < array[i]){
            max = array[i];
        }
    }
    //最頻値の整数全てを取得
    for(i=0;i<100;i++){
        if(max == array[i]){
            elems.push_back(i+1);
        }
    }
    
    //最頻となる整数を出力
    for(i=0;i<elems.size();i++){
        cout << elems[i] << endl;
    }
    
    return 0;
}

Measured memory_bytes: 1208
#include <iostream>
#include <vector>
#include <string>

using namespace std;

#define MOD 1000000007

//long long dp[100001][2][26] = {};

int main() {
	int n; cin >> n;
	string s, t; cin >> s >> t;
	long long dp[26] = {};
	dp[s[0] - 'a'] = 1;
	for (int i = 1; i < n - 1; ++i)
		dp[s[i] - 'a'] = (dp[s[i] - 'a'] + dp[t[i] - 'a']) % MOD;
	cout << dp[t[n - 1] - 'a'] << endl;

	/*dp[0][0][s[0] - 'a'] = 1;
	for (int i = 1; i < n; ++i) {
		for (int j = 0; j < 26; ++j) {
			if (i > 1) dp[i - 1][0][j] += dp[i - 2][0][j];
			if (t[i] - 'a' == j) {
				dp[i][1][j] += dp[i - 1][0][j];
				dp[i][0][s[i] - 'a'] = (dp[i][0][s[i] - 'a'] + dp[i][1][j]) % MOD;
			}
		}
	}
	cout << accumulate(dp[n - 1][0], dp[n - 1][0] + 26, 0) << endl;*/

	return 0;
}


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

#define ld long double
#define ll long long
#define ALL(a)  (a).begin(),(a).end()
#define spa << " " <<
ll MOD = 1e9+7;
void chmin(long long &a, long long b) { if (a > b) a = b; }

int main(){
  ll i, j;
  ll n;
  cin >> n;
  if(n == 3 || n == 5 || n == 7) 
    cout << "YES" << endl;
  else
    cout << "NO" << endl;

  return 0;
}

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

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

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

  vector<int> a(n);
  rep(i, n) cin >> a[i];

  int mx = 0, g = a[0];
  rep(i, n) {
    mx = max(mx, a[i]);
    g = gcd(g, a[i]);
  }
  bool can = mx >= k && k % g == 0;

  if (can)
    puts("POSSIBLE");
  else
    puts("IMPOSSIBLE");
}

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


#define li			long long int
#define rep(i,to)	for(li i=0;i<((li)(to));i++)
#define repp(i,start,to)	for(li i=(li)(start);i<((li)(to));i++)
#define pb			push_back
#define sz(v)		((li)(v).size())
#define bgn(v)		((v).begin())
#define eend(v)		((v).end())
#define allof(v)	(v).begin(), (v).end()
#define dodp(v,n)		memset(v,(li)n,sizeof(v))
#define bit(n)		(1ll<<(li)(n))
#define mp(a,b)		make_pair(a,b)
#define rin	rep(i,n)
#define EPS 1e-12
#define ETOL 1e-8
#define MOD 1000000007
typedef pair<li, li> PI;

#define INF bit(60)

#define DBGP 1


#define idp if(DBGP)
#define F first
#define S second
#define p2(a,b)		idp cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)		idp cout<<a<<"\t"<<b<<"\t"<<c<<endl
#define p4(a,b,c,d)		idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<endl
#define p5(a,b,c,d,e)		idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<endl
#define p6(a,b,c,d,e,f)		idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<endl
#define p7(a,b,c,d,e,f,g)		idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<endl
#define p8(a,b,c,d,e,f,g,h)		idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<endl
#define p9(a,b,c,d,e,f,g,h,i)		idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<endl
#define p10(a,b,c,d,e,f,g,h,i,j)		idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<"\t"<<j<<endl
#define foreach(it,v)	for(__typeof((v).begin()) it=(v).begin(); it!=(v).end(); ++it)
#define p2p(x)		idp p2((x).F, (x).S)
#define dump(x,n)	idp{rep(i,n){cout<<x[i]<<" ";}puts("");}
#define dump2(x,n)	idp{rep(i,n){cout<<"["<<x[i].F<<" , "<<x[i].S<<"] ";}puts("");}
#define dumpi(x)	idp{foreach(it, x){cout<<(*it)<<" ";}puts("");}
#define dumpi2(x)	idp{foreach(it, x){cout<<"["<<(it)->F<<" , "<<(it)->S<<"] ";}puts("");}

#define read2d(a,w,h)	rep(i,h)rep(j,w)cin>>a[i][j]
#define dump2d(a,w,h)	rep(i,h){rep(j,w)cout<<a[i][j]<<" ";puts("");}

typedef pair<li, li> PI;



int main() {
	li n, m, k;
	cin >> n >> m >> k;
	set<li> st;
	rep(i, n + 1) {
		rep(j, m + 1) {
			li now = i * m + j * n - i * j * 2;
			st.insert(now);
		}
	}
	cout << (st.count(k) > 0 ? "Yes" : "No") << endl;

	return 0;
}

Measured memory_bytes: 13056
#include <bits/stdc++.h>
using namespace std;
#define inf INT_MAX
#define mod 1000000007
#define int long long

void solve() {
	int n;
	cin >> n;
	int k;
	cin >> k;
	int h[n + 1];
	int i, j;
	for (i = 0; i < n; i++)cin >> h[i];

	int dp[n + 1];
	fill(dp, dp + n, INT_MAX);

	dp[0] =  0;

	for (i = 1; i < n; i++) {
		int val = INT_MAX;
		for (j = 1; j <= k; j++) {
			if (i - j >= 0)val = min(val, dp[i - j] + abs(h[i] - h[i - j]));
			else break;
		}
		dp[i] = val;
	}
	cout << dp[n - 1] << endl;

	return;
}

int32_t main() {
	std::ios::sync_with_stdio(false);
	cout.tie(0);
	cin.tie(0);
	solve();
	return 0;
}


Measured memory_bytes: 5188
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,x,n) for(int i=x; i<(n); i++)
const long long INF = 1LL<<60; // 仮想的な無限大の値;
using namespace std;
using ll = long long;
using P  = pair<int, int>;
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; }

int main()
{
    string s;
    cin >> s;
    int cnt = 0;
    bool r = true;
    if(s[0] == 'R'){ ++cnt;
    rep2(i, 1, 3)
    {
        if(s[i] == 'R' && s[i-1] == 'R') ++cnt;
        
    }
    }
    else
    {
        if(s[1] == 'R' && s[2] == 'R') cnt = 2;
        else if(s[1] == 'R' || s[2] == 'R') cnt = 1;

    }
    
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 3612
#include <stdio.h>
#include<string.h>
int main(void){
    char s[30];
    int a[30]={},x=0;
    scanf("%s",s);
    for(int i=0;i<strlen(s);i++){
        a[s[i]-97]++;
        if(a[s[i]-97]>1){x++;break;}
    }
    if(x==0)printf("yes\n");
    else printf("no\n");
    return 0;
    
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

#define repd(i, a, b) for (ll i = (a); i < (b); i++)
#define rep(i, n) repd(i, 0, n)

using namespace std;

namespace mp = boost::multiprecision;
using Bint = mp::cpp_int;

using ll = long long;
ll mod = pow(10, 9) + 7;

template <typename T> void output(T, ll);
ll gcd(ll, ll);
ll lcm(ll, ll);
Bint comb(Bint, Bint);
void prime_map(map<ll, ll> &, ll);

int main() {
    // source
    int r, g;
    cin >> r >> g;
    int dif = g - r;
    int ans = r + 2 * dif;
    cout << ans << endl;
    return 0;
}

Bint comb(Bint a, Bint b) {
    Bint ans = 1;

    if (a < b) {
        return 0;
    }

    rep(i, b) {
        ans *= a - i;
        ans /= i + 1;
    }

    return ans;
}

template <typename T> void output(T a, int precision) {
    if (precision > 0) {
        cout << setprecision(precision) << a << "\n";
    } else {
        cout << a << "\n";
    }
}

template <typename T> T min(T a, T b) {

    if (a < b) {
        return a;
    } else {
        return b;
    }
}

ll gcd(ll a, ll b) {
    if (b == 0) {
        return a;
    }
    return gcd(b, a % b);
}

ll lcm(ll a, ll b) { return a * b / gcd(a, b); }

void prime_map(map<ll, ll> &m, ll num) {

    if (num == 1) {
        return;
    }
    ll cache = num;
    repd(i, 2, sqrt(num) + 2) {
        if (num % i == 0) {
            if (m[i] == 0) {
                m[i] = 1;
            } else {
                m[i]++;
            }

            num /= i;
            break;
        }
    }
    if (cache == num) {
        if (m[num] == 0) {
            m[num] = 1;
        } else {
            m[num]++;
        }

        return;
    }
    prime_map(m, num);
    return;
}


Measured memory_bytes: 256
n = int(input())
d = {"AC":0,"WA":0,"TLE":0,"RE":0}
for i in range(n):
    s = input()
    d[s] += 1 
    

p = str(d["AC"])
q = str(d["WA"])
r = str(d["TLE"])
s = str(d["RE"])

print("AC x " + p)
print("WA x " + q)
print("TLE x " + r)
print("RE x " + s)


    
    
    

Measured memory_bytes: 9204
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define repi(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define itr(it,a) for( auto it = (a).begin(); it != (a).end(); ++it )
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()

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

using ll = long long;
using P = std::pair<ll, ll>;

ll N, K;
ll t[100010], d[100010];
std::vector<ll> vs[100010];
std::vector<ll> ps[2];
ll S[2][100010];
bool used[100010];
ll ans;

int main()
{
  std::cin >> N >> K;

  rep( i, N )
  {
    std::cin >> t[i] >> d[i];
    --t[i];
    vs[t[i]].emplace_back( d[i] );
  }

  rep( i, N )
  {
    if( vs[i].empty() )
      continue;

    std::sort( all(vs[i]) );

    ps[1].emplace_back( vs[i].back() );

    rep( j, vs[i].size()-1 )
      ps[0].emplace_back( vs[i][j] );
  }

  rep( i, 2 )
  {
    std::sort( ps[i].rbegin(), ps[i].rend() );

    rep( j, ps[i].size() )
      S[i][j+1] = S[i][j]+ps[i][j];
  }

  repi( y, std::max( 0ll, ll(K-ps[0].size()) ), K+1 )
  {
    if( y > ps[1].size() || K-y < 0 )
      continue;

    chmax( ans, S[0][K-y]+S[1][y]+ll(y*y) );
  }

  std::cout << ans << std::endl;

  return 0;
}

Measured memory_bytes: 8948
import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    while (sc.hasNext()) {
      int n = sc.nextInt();
      int sum = 1;
      for (int i = 1; i <= n; i++) {
        sum += i;
      }
      System.out.println(sum);
    }
  }
}

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

using namespace std;

typedef long long ll;

const int mod = 1e9+7;

int main(){
	std::ios::sync_with_stdio(false);
    cin.tie(0);
    int n,m;
    cin >> n >> m;
    int a,b;
    map<int,set<int> > mp;
	for(int i=1;i<=m;i++){
		cin >> a >> b;
		if(a>b) swap(a,b);
		mp[a].insert(b);
		mp[b].insert(a);
	}
	
	for(int x:mp[1]){
		if(mp[x].count(n)){
			cout << "POSSIBLE\n";
			return 0;
		}
	}
	cout << "IMPOSSIBLE\n";

	return 0;
} 


Measured memory_bytes: 37760
import java.io.PrintWriter

fun next() = readLine()!!
fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun nextDouble() = next().toDouble()
fun nextList() = next().split(" ")
fun nextIntList() = nextList().map(String::toInt)
fun nextLongList() = nextList().map(String::toLong)
fun nextDoubleList() = nextList().map(String::toDouble)

val pw = PrintWriter(System.out)
fun print(s: Any = "") = pw.print(s)
fun println(s: Any = "") = pw.println(s)

fun main(args: Array<String>) {
    main()
    pw.flush()
}

fun main() {
    val N = nextInt()
    val x = 800 * N
    val y = 200 * (N / 15)
    println(x - y)
}

Measured memory_bytes: 31636
#include <iostream>
#include <vector>
#include <algorithm>

#define INPUT_FROM_FILE (0) 
#if INPUT_FROM_FILE
#include <fstream>
#endif


int main(int argc, char **argv){
	std::vector<int> v(3);
	char tmp;
	int num_rectangle = 0;
	int num_rhombus = 0;

#if INPUT_FROM_FILE
	std::ifstream ifs("test.txt");
	//FILE *fp = fopen("test.txt", "r");
#endif



#if INPUT_FROM_FILE
	while(ifs >> v[0] >> tmp >> v[1] >> tmp >> v[2]){
#else
	while(std::cin >> v[0] >> tmp >> v[1] >> tmp >> v[2]){
#endif
		
		//std::sort(v.begin(), v.end());

		if(v[0] * v[0] + v[1] * v[1] == v[2] * v[2]){
			num_rectangle++;
		}
		else if(v[0] == v[1]){
			num_rhombus++;
		}
	}
	std::cout << num_rectangle << std::endl;
	std::cout << num_rhombus << std::endl;
	return 0;
}


Measured memory_bytes: 3008
#include <iostream>
#include <algorithm>
#include <utility>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <math.h>
#include <string.h>
#include <iomanip>
#include <numeric>
#include <cstdlib>
#include <cstdint>
#include <cmath>

using namespace std;

using ll = long long;
using pll = pair<ll, ll>;
using vl = vector<ll>;
using vll = vector<vl>;
using vpll = vector<pll>;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define Rep(i, n) for (long long i = 0; i< (long long)(n); i++)
#define RRep(i,n) for (long long i = ((long long)(n)-1); i>=0; i--)

struct Edge{
    int to;
    int weight;
    Edge(int t, int w) : to(t), weight(w){ }
};

using Graph = vector<vector<Edge>>;
using graph = vector<vector<int>>;

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

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

template <class T>
T gcd(T a, T b){
    if( b==0 ) return a;
    else return gcd(b, a%b);
}

template <class T>
T lcm(T a, T b){
    return (a*b)/gcd(a,b);
}

int INF = 1e9+7;

vector<int> dx = {-1,0,1,0};
vector<int> dy = {0,-1,0,1};

int main(){
    int n;
    cin >> n;
    cout << (n+1)/2 << endl;
}

Measured memory_bytes: 256
package main
 
import (
	"bufio"
	"fmt"
	"os"
    "strconv"
    "sort"
)

// override by `ldflags`
var env = "online"

func checkLocal() bool {
	return env == "local"
}

func debugPrint(format string, args ...interface{}) {
	// debug out to stderr
	if checkLocal() {
		fmt.Fprintf(os.Stderr, format, args...)
	}
}

var (
	BufferSize = 100 + 10
)

func scanStr(sc *bufio.Scanner) string {
	if !sc.Scan() {
		panic(nil)
	}
	return sc.Text()
}

func scanInt(sc *bufio.Scanner) int {
	if !sc.Scan() {
		panic(nil)
	}
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	} 
	return i
}

func main() {
	sc := bufio.NewScanner(os.Stdin)
	buf := make([]byte, BufferSize)
	sc.Buffer(buf, BufferSize)
	sc.Split(bufio.ScanWords)

    length := 3
    a := make([]int, length)
    for i := 0; i < length; i++ {
        a[i] = scanInt(sc)
    }
    sort.Ints(a)
    /*
    for _, i := range a {
        fmt.Printf("%d ", i)
    }
    fmt.Printf("\n")
    */
    for i := 0; i < length; i++ {
        if i != length-1 {
            fmt.Printf("%d ", a[i])
        } else {
            fmt.Println(a[i])
        }
    }
}


Measured memory_bytes: 1104
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define repk(i,m,n) for(int i=m;i<n;i++)
#define OKawaiiKoto ios::sync_with_stdio(false);cin.tie(0);
#define F first
#define S second
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef long double ld;
using namespace std;
const int MOD1=1e9+7;
const int MOD2=998244353;
const ll INF=2*1e18;
const ld PI=3.14159265358979323846;
int main()
{
    OKawaiiKoto
    string verdict[]={"AC","WA","TLE","RE"};
    ll n;
    cin>>n;
    vector<ll> v(4,0LL);
    rep(i,n)
    {
        string s;
        cin>>s;
        rep(j,4) if(s==verdict[j]) v[j]++;
    }
    rep(i,4) cout<<verdict[i]<<" x "<<v[i]<<"\n";
}


Measured memory_bytes: 3684
#include <stdio.h>
int main(void){   
   int S,h,m,s;
   scanf("%d",&S);
   
   s=S%60;
   m=S/60%60;
   h=S/3600;
   
   printf("%d:%d:%d\n", h, m, s);
   
   return 0;
}


Measured memory_bytes: 2740
use warnings;
    use Data::Dumper;
    use List::Util qw(max min);
    # use Statistics::Lite qw(max min sum);
    
    sub GetInputData{
    
        my @array_data;
    
        my $line = <STDIN>;
    
        chomp($line);
    
        while($line ne ""){
    
           push(@array_data,$line);
    
           $line = <STDIN>;
    
           chomp($line);
    
    }
    
        return @array_data;
    
    }
    
    sub GetSpaceInputData{
    
        my @array_temp=GetInputData();
    
        my @array_buf;
    
        foreach(@array_temp){
    
            #戻りは配列スペース区切りを分解
            # myを先頭につける必要あり
            my @array_work=split(" ",$_);

            # print "@array_work";
    
            # リファレンスを配列に代入
            push(@array_buf,\@array_work);
        }
    
        return @array_buf;
    
    }
    
    my @arr_result = GetSpaceInputData();

    my $n= $arr_result[0][0];

    my @arr=();

    for(my $i=1;$i<=$n;$i++){

        push(@arr,$arr_result[$i][0]);
    }

    my $maxdata =max @arr;
    my $sumdata = eval join '+',@arr;
    print $sumdata - ($maxdata) /2;



Measured memory_bytes: 1920
#include<iostream>
#include<algorithm>
#include<math.h>
#include<vector>
#include<map>
#include<set>
#include<iomanip>

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

const int MOD = 1e9 + 7;
const int MAX = 1e9;
const ll LLMAX = 1e18;
const int INF = numeric_limits<int>::max();
const ll LLINF = numeric_limits<ll>::max();
const double PI = acos(-1.0);

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

int main() {
    string A, B, C; cin >> A >> B >> C;
    
    // cout << char(toupper(A[0])) << char(toupper(B[0])) << char(toupper(C[0])) << endl;

    // 小文字を大文字に変える
    char diff = 'a' - 'A'; // A < a
    cout << char(A[0] - diff) << char(B[0] - diff) << char(C[0] - diff) << endl;
    return 0;
}


Measured memory_bytes: 3640
import java.io.*;
import java.util.*;

public class Main
{
	public static void main(String []args)throws IOException
	{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		
		int n = Integer.parseInt(br.readLine());
		System.out.println(n*n*n);
			
	}
}




Measured memory_bytes: 21076
H,W,N = map(int, input().split())
Sr, Sc = map(int, input().split())
S = input()
T = input()

atk_U = [0]*N
atk_D = [0]*N
atk_L = [0]*N
atk_R = [0]*N
u = 0
d = 0
l = 0
r = 0
for i in range(N):
  if S[i] == 'U':
    u += 1
  if S[i] == 'D':
    d += 1
  if S[i] == 'L':
    l += 1
  if S[i] == 'R':
    r += 1
  atk_U[i] = u
  atk_D[i] = d
  atk_L[i] = l
  atk_R[i] = r

def_U = [0]*N
def_D = [0]*N
def_L = [0]*N
def_R = [0]*N
u = 0
d = 0
l = 0
r = 0
for i in range(N-1):
  if T[i] == 'U':
    if u + 1 - atk_D[i] < Sr:
      u += 1
  if T[i] == 'D':
    if d + 1 - atk_U[i] < H - Sr + 1:
      d += 1
  if T[i] == 'L':
    if l + 1 - atk_R[i] < Sc:
      l += 1
  if T[i] == 'R':
    if r + 1 - atk_L[i] < W - Sc + 1:
      r += 1
  def_U[i+1] = d
  def_D[i+1] = u
  def_L[i+1] = r
  def_R[i+1] = l

dam_U = max([atk_U[i] - def_U[i] for i in range(N)])
dam_D = max([atk_D[i] - def_D[i] for i in range(N)])
dam_L = max([atk_L[i] - def_L[i] for i in range(N)])
dam_R = max([atk_R[i] - def_R[i] for i in range(N)])
if dam_U < Sr and dam_D < H - Sr + 1 and dam_L < Sc and dam_R < W - Sc + 1:
  print('YES')
else:
  print('NO')

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

int main(){

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

  int min,max;
  min=1;
  max=n;
  for(int i=0;i<m;i++){
    int l,r;
    cin>>l>>r;
    if(min<l)
    min=l;
    if(max>r)
    max=r;
  }
  int ans=max-min+1;
  if(ans<0)
  ans=0;
  cout<<ans<<endl;

}


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

int main() {
	int n, k, arr[1005], ans = 0;
	scanf("%d %d", &n, &k);
	for(int i = 0;i < n;i++) scanf("%d", &arr[i]);
	sort(arr, arr+n);
	for(int i = 0;i < k;i++) ans += arr[i];
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 3828
#include<stdio.h>
int main()
{
	int a[3],buf,i,j,k=0,n;
	double b[3];
	scanf("%d",&n);
	while(k<n){
	scanf("%d%d%d",&a[0],&a[1],&a[2]);
	for(j=0;j<3;j++)
	{
		for(i=1;i<3;i++)
		{
			if(a[i-1]>a[i]){buf=a[i];a[i]=a[i-1];a[i-1]=buf;}
		}
	}
	for(i=0;i<3;i++)
	{
		b[i]=a[i]*a[i];
	}			
	if(b[2]==b[0]+b[1]){printf("YES\n");}
	else{printf("NO\n");}
	k++;
	}
	return 0;
}

Measured memory_bytes: 580
module Memoizable
	def memoize(name)
		original = "__original_#{name}__"
		([Class, Module].include?(self.class) ? self : self.class).class_eval {
			alias_method(original, name)
			private(original)
			cache = {}
			define_method(name){|*args|
				cache[args] ||= send(original, *args)
			}
		}
	end 
end

include Memoizable

def f(n, k)
	if n <= 0
		return n == 0 ? 1 : 0
	end
	if k == 17
		return n % 289 == 0 ? 1 : 0
	end
	f(n, k+1) + f(n-k*k, k)
end

memoize :f
	
loop {
	n = gets.to_i
	break if n == 0
	p f(n, 1)
}

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

int main(){
  int x1,y1,x2,y2;
  cin >> x1 >> y1 >> x2 >> y2;

  int s1,t1;
  s1 = -(y2-y1);//(s1,t1)は(x1,y1)→(x2,y2)のベクトルを90°回転させたもの
  t1 = (x2-x1);

  int x3,y3,x4,y4;

  x3 = x2+s1;
  y3 = y2+t1;

  x4 = x1+s1;
  y4 = y1+t1;

  cout << x3 << " " << y3 << " " << x4 << " " << y4 << endl;



}

Measured memory_bytes: 256