akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<29;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-11;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

int f(int i,int x){
	return i*(100+x)/100;
}

int main(){
	while(1){
		int n,m,p,t=0;
		cin>>n>>m>>p;
		if(n==0) break;
		vi a(n);
		for(auto &i:a){
			cin>>i;
			t+=i;
		}
		cout<<(a[m-1]?t*(100-p)/a[m-1]:0)<<endl;
	}
}


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

int main(void){
    int a,b;
    cin >> a;
    cin >> b;
   if(a<b){
       cout << "a < b";
   }
   else if(a>b){
       cout << "a > b"; 
   }
   else{
       cout << "a == b";
   }
    
    cout << endl;


    // Your code here!
    
}


Measured memory_bytes: 3088
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		int n;
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
		}

		// a[0]は整列済のため、結果を出力
		print(a);

		for (int i = 1; i < a.length; i++) {
			for (int j = 0; j < i; j++) {
				if (a[i] < a[j]) {
					int tmp = a[i];
					for (int k = i - 1; k >= j; k--) {
						a[k+1] = a[k];
					}
					a[j] = tmp;
				}
			}
			print(a);
		}


	}

	static void print(int[] a) {
		for (int i = 0; i < a.length; i++) {
			System.out.print(a[i]);
			if (i != a.length-1) {
				System.out.print(" ");
			} else {
				System.out.print("\n");
			}
		}
	}

}



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

int main() {
  int N, l, r, x;
  x = 0;
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> l >> r;
    x += r - l + 1;
  }
  cout << x << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#include <chrono> 
using namespace std::chrono;
using namespace std;
typedef long long ll;
using namespace __gnu_pbds;   
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
#define ordered_mset tree<pair<ll,ll>, null_type,less<pair<ll,ll>>, rb_tree_tag,tree_order_statistics_node_update> 
#define fr(i,a,b) for (ll i=(a); i<(b);++i)
#define frr(i,a,b) for(ll i=(a-1);i>=(b);--i)
#define vi vector<ll>
#define vl vector<ll>
#define pb push_back
#define ppb pop_back()
#define pf push_front
#define ppf pop_front()
#define F first
#define S second
#define pii pair<ll,ll> 
#define rev(a) reverse(a.begin(),a.end())
#define srt(a,k) sort(a,a+k,greater<ll>())
#define rsrt(a) sort(a.begin(),a.end(),greater<ll>())
#define sz(a) (ll)a.size()
//#define endl "\n"
#define po(a,b) (ll)(pow(a,b)+0.5)
#define double long double
#define print(a) for(auto x:a)cout<<x<<" ";cout<<endl;
#define setbits(a) __builtin_popcount(a)
const ll M=1e9+7;
const ll mxx=3001;

int main()
{  


 string s;int n;
 cin>>n;
 cin>>s;
 int ans=0;
 fr(i,0,n-2)
 {
    if(s[i]=='A' && s[i+1]=='B' && s[i+2]=='C')ans++;
 }
   cout<<ans;
}



Measured memory_bytes: 3628
#include<stdio.h>

int main () {

  int a,b,c,d,i;
  int divisor_num = 0;
  scanf("%d %d %d",&a,&b,&c);

  for (i = a; i <= b; i++){
    if (c % i == 0)
      divisor_num++;
  }

  printf("%d\n",divisor_num);

  return 0;
}

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

int main(){
  int N , K ; cin >> N >> K ; 
  double ans = 0 ; 
  for(int i = 1 ; i <= N ; i++){
    double P = 1 ; 
    int x = i ; 
    while(x < K){
      P *= 0.5 ; 
      x *= 2 ; 
    }
    ans += P/N ; 
  }
  
  cout << fixed << setprecision(13) << ans << endl;

}

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

int main(){
	int n,a[100];
	while(~scanf("%d",&n)){
		int c=0;
		for(int i=1;i<=n;i++){
			scanf("%d",&a[i]);
			if(i%2==1){
				if(a[i]%2==1) c++;
			}
			else continue;
		}
		printf("%d\n",c);
	}
	return 0;
} 

Measured memory_bytes: 3756
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan=new Scanner(System.in);
		int N=scan.nextInt();
		String S=scan.next();
		String d[]=S.split("");
		long NR=0;
		long NG=0;
		long NB=0;
		long count=0;
		for(int i=0;i<N;i++){
			if(d[i].equals("R")){
				NR++;
			}
			if(d[i].equals("G")){
				NG++;
			}
			if(d[i].equals("B")){
				NB++;
			}
		}
		long total=NR*NG*NB;
		for(int i=0;i<N;i++){
			for(int j=0;j<N;j++){
				if(i<j&&j<2*j-i&&2*j-i<N){
					if((!(d[i].equals(d[j]))&&!(d[i].equals(d[2*j-i]))&&!(d[j].equals(d[2*j-i])))){
						count++;
					}
				}
			}
		}
		System.out.println(total-count);
	}

}


Measured memory_bytes: 36608
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a) for(int i = 0; i < (a); i++)
#define ALL(a) (a).begin(),(a).end()
typedef long long ll;
typedef pair<int, int> P;
const ll INF = 1e12;
const int MOD = 1e9 + 7;

signed main(){
    ll h,w;
    cin >> h >> w;
    ll ans = INF;
    REP(i,2){
        for(ll i = 0; i <= h; i++){
            if(w % 2 == 0){
                ans = min(ans, max(w * i, (h - i) * (w / 2)) - min(w * i, (h - i) * (w / 2)));
            }else{
                ans = min(ans, max({w * i, (h - i) * (w / 2), (h - i) * (w / 2 + 1)}) - min({w * i, (h - i) * (w / 2), (h - i) * (w / 2 + 1)}));
            }
            if((h - i) % 2 == 0){
                ans = min(ans, max(w * i, (h - i) / 2 * w) - min(w * i, (h - i) / 2 * w));
            }else{
                ans = min(ans, max({w * i, ((h - i) / 2) * w, ((h - i) / 2 + 1) * w}) - min({w * i, ((h - i) / 2) * w, ((h - i) / 2 + 1) * w}));
            }
        }
        swap(h, w);
    }
    cout << ans << endl;
}

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

struct PQ {
private:
	long H;// 1-origin binary heap size
	vector<long> a;// 1-origin array for binary heap

public:
	PQ() : H(0), a(16,0) {} // a must have positive size.

	void insert(long x) {
		if (a.size() -1 < H) {
			a.resize(2*H);
		}
		++H;
		a[H] = x;
		heap_increase_key(H);
	}

	void heap_increase_key(long index) {
		long i_parent = index/2;
		if (i_parent < 1) return;
		if (a[index] > a[i_parent]) {
			swap(a[index], a[i_parent]);
			heap_increase_key(i_parent);
		}
	}

	void max_heapify(long i) {
		long lc, rc;
		lc = 2*i;
		rc = 2*i + 1;
		long largest = i;
		if (lc <= H && a[lc] > a[i]) {
			largest = lc;
		}
		if (rc <= H && a[rc] > a[largest]) {
			largest = rc;
		}
	
		if (largest != i) {
			swap(a[i], a[largest]);
			max_heapify(largest); 
		}
	}

	long extract_max() {
		if (H < 1) return -1;
		long res = a[1];
		a[1] = a[H];
		H--;
		max_heapify(1);
		return res;
	}
};

int main() {
	PQ pq;
	string s;
	while (cin >> s) {
		//cout << "input is " << s << endl;
		if (s == "end") break;
		if (s == "extract") {
			long max = pq.extract_max();
			cout << max << endl;
			continue;
		}
		long input_key; 
		if (s[0] == 'i') {
			cin >> input_key;
			pq.insert(input_key);
		}
	}
	return 0;
}




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

using namespace std;

#define int long long

void solve() {
    int x;
    cin >> x;
    cout << (x / 500) * 1000 + ((x % 500) / 5) * 5;
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    solve();
    return 0;
}


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

int main(){
	string s;
	getline(cin, s);
	const char *p = s.c_str();
	bool space = false;
	char buf[1100] = "";

	while(*p){
		int d = 0;
		sscanf(p, "%*[ .,]%n", &d);
		p += d;
		if(sscanf(p, "%[^ .,]", buf) == 1){
			string t = buf;
			p += t.size();
			if(t.size() >= 3 && t.size() <= 6){
				if(space){ cout << ' '; }
				space = true;
				cout << t;
			}
		}
	}
	cout << endl;
}

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

#define REP(i,s,n) for(int i=s; i<n; ++i)
#define rep(i,n) REP(i,0,n)
#define SORT(c) sort((c).begin(),(c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG false

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

int main(){

  ll n, m;
  cin >> n;
  map<ll, ll> mp;
  rep(i, n){
    ll in;
    cin >> in;
    mp[in]++;
  }
  cin >> m;
  bool f = true;
  rep(i, m){
    ll in;
    cin >> in;
    mp[in]--;
    if(mp[in] < 0) f= false;
  }

  cout << (f ? "YES" : "NO") << endl;

  return 0;
}


Measured memory_bytes: 12800
/*;

THE BEST IS YET TO COME

*/
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define r(i, s, l) for (int i = s; i < l; i++)
#define rr(i, s, l) for (int i = s; i >= l; i--)
#define mod 1000000007
#define INT_BITS 32
#define ld long double
#define pp pair<int, int>
#define ss second
#define ff first
#define INF 1e18
#define N 2000005
#define all(a) a.begin(), a.end()
#define pb push_back
#define vi vector<int>
#define vip vector<pair<int, int>>
#define endl "\n"
#define ln length()
#define sz size()
using namespace std;
void fast()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
}

signed main()
{

    fast();
            int n,k;
            
            cin>>n>>k;
            vi arr(n);
            for(int i=0;i<n;i++)
            {
                cin>>arr[i];
            }
            sort(all(arr));
 
            int start = 0,end = n-1,ans = 1,val = 0;
            if(arr[n-1]<0&&k%2)
            {
                for(int i=0;i<k;i++)
                {
                    ans = (ans*arr[n-1-i])%mod;
                }
            }
            else
            {
                while(k)
                {
                    if(k>1)
                    {
                        if(arr[start]*arr[start+1]>arr[end]*arr[end-1])
                        {
                            ans = (((arr[start]*arr[start+1])%mod)*ans)%mod;
                            start+=2;
                            k-=2;
                        }
                        else
                        {
                            ans = (ans*arr[end])%mod;
                            end--;
                            k--;
                        }
                    }
                    else
                    {
                        ans = (ans*arr[end])%mod;
                        end--;
                        k--;
                    }
                }
            }
            ans = (ans+mod)%mod;
            cout<<ans;
    

    return 0;
}

Measured memory_bytes: 4776
#include<iostream>
#include<vector>
#include<random>
#include<queue>
#include<unordered_map>

int main(){
  int d;
  std::cin >> d;
  std::vector<int> c(26);
  for (int i = 0; i < 26; i++) std::cin >> c[i];
  std::vector<std::vector<int> > s(d, std::vector<int>(26));
  for (int i = 0; i < d; i++) {
    for (int j = 0; j < 26; j++) {
      std::cin >> s[i][j];
    }
  }
  for (int i = 0; i < d; i++) {
    int maxi = 0, ans = 0;
    for (int j = 0; j < 26; j++) {
      if(maxi < s[i][j])ans = j, maxi = s[i][j];
    }
    std::cout << ans + 1 << std::endl;
  }
  return 0;
}


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

//typedef
//------------------------------------------
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

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

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int MOD = 1000000007;

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

//main code

int main(int argc, char const* argv[])
{
	int n;
	cin >> n;
	VL dp(n+1,0);
	for (int i = 1; i < n+1; i++) {
		dp[i] = i;
		for (int j = 6; j < i+1; j *= 6) {
			dp[i] = min(dp[i],dp[i-j] + 1);
			for (int k = 9; k < i+1; k *= 9) {
				dp[i] = min(dp[i],dp[i-k] + 1);
			}
		}
	}
	cout << dp[n] << endl;
	return 0;
}


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

int main(){
  int N;
  cin >> N;
  vector<int> ds(N);
  for(int i = 0; i < N; i++){
    cin >> ds.at(i);
  }
  
  sort(ds.begin(), ds.end());
  
  int ans = ds.at(N/2) - ds.at(N/2 - 1);
  
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 640
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#define debug(x) cerr << #x << " = " << x << endl;


#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 110

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

int main(){
  ll h,w,n;
  map<pair<int,int>, int> mm;

  scanf("%lld%lld%lld",&h,&w,&n);

  for(int i=0;i<n;i++){
    int x, y;
    
    scanf("%d%d",&y,&x);
    x--; y--;

    for(int j=0;j<9;j++){
      if(1<=x+dx[j] && x+dx[j]<w-1 && 1<=y+dy[j] && y+dy[j]<h-1)
        mm[make_pair(x+dx[j],y+dy[j])]++;
    }
  }

  ll ans[10] = {};

  ans[0] = (h-2)*(w-2) - mm.size();
  
  for(auto it = mm.begin();it!=mm.end();it++){
    ans[it->second]++;
  }

  for(int i=0;i<10;i++){
    printf("%lld\n",ans[i]);
  }
    
  return 0;
}


Measured memory_bytes: 56448
using System;

class Program
{
    static void Main(string[] args)
    {
        Console.WriteLine(Resale());
    }

    private static int Resale()
    {
        int N = 0;
        int[] C = null;
        int[] V = null;
        int[] diff = null;

        readData(ref N,ref C,ref V);

        diff = makeDiffArray(N, C, V);

        return MaxOtokuValue(diff);
    }

    private static int MaxOtokuValue(int[] diff)
    {
        //降順にする
        Array.Sort(diff);
        Array.Reverse(diff);

        //価値が0未満になるのは頭が0未満の時
        if (diff[0] <= 0) return 0;

        //最大お得値を得る
        int sum = 0;
        for (int i = 0; i < diff.Length; i++)
        {
            if (diff[i] <= 0) break;

            sum += diff[i];
        }

        return sum;
    }

    private static int[] makeDiffArray(int N, int[] C, int[] V)
    {
        int[] diff = new int[N];

        for (int i = 0; i < N; i++)
        {
            diff[i] = C[i] - V[i];
        }

        return diff;
    }

    /// <summary>
    /// データを読み込む
    /// </summary>
    private static void readData(ref int N, ref int[] C,ref int[] V)
    {
        N = int.Parse(Console.ReadLine());

        C = Array.ConvertAll<string, int>(Console.ReadLine().Split(' '), int.Parse);
        V = Array.ConvertAll<string, int>(Console.ReadLine().Split(' '), int.Parse);
    }
}




Measured memory_bytes: 13268
# A - Can't Wait for Holiday

# 文字列 S の入力
S = input()
# print(S)

# 何日後か求める条件文
if S == 'SUN':
    print(7)
elif S == 'MON':
    print(6)
elif S == 'TUE':
    print(5)
elif S == 'WED':
    print(4)
elif S == 'THU':
    print(3)
elif S == 'FRI':
    print(2)
elif S == 'SAT':
    print(1)


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

int main() {

	int K, S;
	cin >> K >> S;

	int x, y, z;
	int N1 = 0;
	int N2 = 0;
	int N3 = 0;

	for (x = 0; x <= K; x++) {
		z = S - 2 * x;
		if (z == x) N3++;
		else if (z >=0 && z <= K) N2++;

		for (y = x + 1; y <= K; y++) {
			z = S - x - y;
			if (z > y && z <= K) N1++;
		}
	}

	cout << 6 * N1 + 3 * N2 + N3;

	return 0;
}

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

/*                    ॐ Shree ॐ                     */
/* ॐ ॐ ॐ
ॐ भूर् भुवः स्वः
तत् सवितुर्वरेण्यं
भर्गो देवस्य धीमहि
धियो यो नः प्रचोदयात्
*/

using namespace std;
typedef long long int ll;
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#else
// online submission
#endif
	int n, m, x, y;
	cin >> n >> m;
	vector<int> v(n + 1);
	vector<bool> remove(n + 1, false);
	for (int i = 1; i <= n; i++) cin >> v[i];
	while (m--) {
		cin >> x >> y;
		if (v[x] >= v[y]) {
			remove[y] = true;
		}
		if (v[x] <= v[y]) {
			remove[x] = true;
		}
	}
	int count = n;
	for (int i = 1; i <= n; i++) {
		if (remove[i]) {
			count--;
		}
	}
	cout << count;
}

Measured memory_bytes: 3724
function solve(H,W,h,w){
    return (H-h)*(W-w);
}
function readInt(str){
    return parseInt(str, 10);
}
function Main(raw) {
    const input = raw.split("\n");
    const [H, W] = input[0].split(" ").map(readInt);
    const [h, w] = input[1].split(" ").map(readInt);
    
    //出力
    console.log("%d", solve(H,W,h,w));
}

//DO NOT EDIT
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
  

Measured memory_bytes: 7500
#include <bits/stdc++.h>
#define IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ll long long
#define pii pair<int, int>

using namespace std;

int main() {
    //freopen("output.txt", "w", stdout);
    ll n, d; cin >> n >> d;
    ll ds = d*d;
    int cnt = 0;
    while(n--) {
        ll x, y; cin >> x >> y;
        if (x*x + y*y <= ds) cnt++;
    }
    cout << cnt << endl;
}

Measured memory_bytes: 3648
#include<iostream>
#include<string>
#include<vector>
#include<cstdio>
#include<sstream>
#include<algorithm>
#include<cmath>
#include<map>
#include<functional>
#include<queue>
#include<stack>
#include<set>
using namespace std;
int stoi(string x){stringstream ss;ss<<x;int tmp;ss>>tmp;return tmp;}
string itos(int x){stringstream ss;ss<<x;return ss.str();}
int main(){
string n,tmp;
int cnt=0;
	while(getline(cin,n)){
		for(int i=0;i<n.size();i++){
			bool f=0;
			for(int j=0;j<10;j++)if(n[i]==j+'0')f=1;
			if(f)tmp.push_back(n[i]);
			else {
				if(!tmp.empty()){cnt+=stoi(tmp);tmp.clear();}
			}
		}
	}
	if(!tmp.empty())cnt+=stoi(tmp);
	cout<<cnt<<endl;
	return 0;
}

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

int main(){
    int n;
    cin >> n;
    int p[n], min;
    int ans = 0;

    rep(i, n)  {
        cin >> p[i];
        if(i==0) min = p[0];

        if(p[i]<=min) {
            min = p[i];
            ans++;
        }
    }

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

Measured memory_bytes: 1024
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        for(int i=0;i<50;i++){
            int m = sc.nextInt();
            int f = sc.nextInt();
            int r = sc.nextInt();
            if(m>=0 && f>=0){
                if((m+f)>=80){
                    System.out.println("A");
                } else if ((m+f)>=65 && (m+f)<80){
                    System.out.println("B");
                } else if ((m+f)>=50 && (m+f)<65){
                    System.out.println("C");
                } else if ((m+f)>=30 && (m+f)<50){
                    if(r>=50){
                        System.out.println("C");
                    } else {
                        System.out.println("D");
                    }
                } else {
                    System.out.println("F");
                }
            } else if (m==-1 && f==-1 && r==-1){
                break;
            } else {
                System.out.println("F");
            }
        }
        sc.close();
    }
}


Measured memory_bytes: 26312
#include <bits/stdc++.h>
#define mk make_pair
#define fs first
#define sc second
using namespace std;
typedef long long ll;
typedef long double ld;
int a[100010];
int main(){
    int n;
    while(cin>>n){
        ll ans=0;
        bool l=0;
        for(int i=1; i<=9; ++i){
            if(n%i==0 && n/i<=9){
                l=1;
            }
        }
        if(l)
            cout<<"Yes"<<endl;
        else
            cout<<"No"<<endl;
    }
  return 0;
}




Measured memory_bytes: 256
w=input()
for X in ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]:
    if int(w.count(X))%2==1:
        print("No")
        break
else:
    print("Yes")

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define inf (int)(1e18)

signed main(){
	int N, K, i, j, k, jj, l;
	scanf("%lld%lld", &N, &K);
	vector<int> H(N + 1, 0), sorted_H(N + 1, 0);
	for(i = 1; i <= N; i++){
		scanf("%lld", &H[i]);
		sorted_H[i] = H[i];
	}
	sort(sorted_H.begin(), sorted_H.end());
	vector<vector<vector<int>>> dp(N + 1, vector<vector<int>>(K + 1, vector<int>(N + 1, inf)));
	vector<vector<vector<int>>> min_from_l(N + 1, vector<vector<int>>(K + 1, vector<int>(N + 1, inf)));
	vector<vector<vector<int>>> min_minus_sorted_H_l_to_l(N + 1, vector<vector<int>>(K + 1, vector<int>(N + 1, inf)));
	dp[0][0][0] = 0;
	for(i = 1; i <= N; i++){
		for(j = 0; j <= K; j++){
			i--;
			min_from_l[i][j][N] = dp[i][j][N];
			for(k = N - 1; k >= 0; k--){
				min_from_l[i][j][k] = min(min_from_l[i][j][k + 1], dp[i][j][k]);
			}
			min_minus_sorted_H_l_to_l[i][j][0] = dp[i][j][0] - sorted_H[0];
			for(k = 1; k <= N; k++){
				min_minus_sorted_H_l_to_l[i][j][k] = min(min_minus_sorted_H_l_to_l[i][j][k - 1], dp[i][j][k] - sorted_H[k]);
			}
			i++;

			for(k = 0; k <= N; k++){
				if(sorted_H[k] == H[i]){
					jj = j;
				}
				else if(j == 0){
					continue;
				}
				else{
					jj = j - 1;
				}
				l = lower_bound(sorted_H.begin(), sorted_H.end(), sorted_H[k]) - begin(sorted_H);
				dp[i][j][k] = min(min_from_l[i - 1][jj][l], min_minus_sorted_H_l_to_l[i - 1][jj][l] + sorted_H[k]);
			}
		}
	}
/*	printf("sorted_H:\n");
	for(i = 0; i <= N; i++){
		printf("%lld ", sorted_H[i]);
	}
	printf("\n");
	printf("\n");
	for(i = 0; i <= N; i++){
		for(j = 0; j <= K; j++){
			for(k = 0; k <= N; k++){
				printf("dp[%lld][%lld][%lld] = %lld\n", i, j, k, dp[i][j][k]);
			}
			printf("\n");
		}
		printf("\n");
	}
*/	int ans = inf;
	for(j = 0; j <= K; j++){
		for(k = 0; k <= N; k++){
			ans = min(ans, dp[N][j][k]);
		}
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 648704
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <unordered_map>
#include <queue>
#define INT long long
#define oo 987654321
#define OO 999999987654321LL
#define MOD 1000000007

using namespace std;
int n, s[100010], sum, ans = 1;

int main()
{
    ios::sync_with_stdio(false);
    cin>>n;
    for(int i = 0, t ; i < n ; i++ ) cin>>t, s[t]++;
    if( n%2 )
    {
        if( s[0] == 1 )
        {
            sum+=s[0];
            for(int i = 1 ; i < n ; i++ )
            {
                sum += s[i];
                if( i%2==0 and s[i] != 2 ) goto FAIL;
            }
        }
        else goto FAIL;
        if( sum != n ) goto FAIL;
        for(int i = 2 ; i < n ; i+= 2 ) ans *= 2, ans%=MOD;
    }
    else
    {
        for(int i = 1 ; i < n ; i++ )
        {
            sum += s[i];
            if( i%2==1 and s[i] != 2 ) goto FAIL;
        }
        if( sum != n ) goto FAIL;
        for(int i = 1 ; i < n ; i+= 2 ) ans*=2, ans%=MOD;
    }
    cout<<ans<<endl;
    return 0;
FAIL : cout<<0<<endl; return 0;
}


Measured memory_bytes: 640
#include <iostream>
using namespace std;
int main() {
  int a[100][100] = {};
  int n, k, idx, v;
  cin >> n;
  for(int i = 0; i < n; ++i) {
	cin >> idx >> k;
	for(int j = 0; j < k; ++j) {
	  cin >> v;
	  a[i][v - 1] = 1;
	}
  }

  for(int i = 0; i < n; ++i) {
	for(int j = 0; j < n; ++j) {
	  cout << a[i][j];
	  cout << (j < n - 1 ? " " : "\n");
	}
  }
  return 0;
}

Measured memory_bytes: 3100
import sys
def input(): return sys.stdin.readline().rstrip()

def main():
    n = int(input())
    a = list(map(int, input().split()))
    ans = [None] * n
    for i, j in enumerate(a):
        ans[j-1] = i + 1
    print(*ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 13880
#define dbg(...) fprintf(stderr,__VA_ARGS__)
#define dpr(x) cerr<<#x<<": "<<x<<endl;
#define dprc(c) do{cerr<<#c<<":";for(auto&_i:(c)){cerr<<" "<<_i;}cerr<<endl;}while(0)
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
int INF = 1e9+7;
#define all(c) (c).begin(), (c).end()
#define tr(i,c) for(auto i=(c).begin();i!=(c).end();i++)
#define rtr(i,c) for(auto i=(c).rbegin();i!=(c).rend();i++)
#define rep(i,b) for(auto i=0;i<(b);i++)
#define pb push_back
#define sz(c) int((c).size())

int main(int argc, char **argv)
{
  int n;
  list<int> L;
  scanf("%d", &n);

  for (int i = 0; i < n; i++) {
    int x;
    char buf[128];
    memset(buf, 0, 128);
    scanf("%s", buf);
    if (strcmp(buf, "insert") == 0) {
      scanf("%d", &x);
      L.push_front(x);
    } else if (strcmp(buf, "delete") == 0) {
      scanf("%d", &x);
      auto k = find(all(L), x);
      if (k != L.end()) L.erase(k);
    } else if (strcmp(buf, "deleteFirst") == 0) {
      L.pop_front();
    } else if (strcmp(buf, "deleteLast") == 0) {
      L.pop_back();
    } else {
      fprintf(stderr, "Unknown command: %s\n", buf);
      return 1;
    }
  }

  const char *sp = "";
  for (auto& x:L) {
    printf("%s%d", sp, x);
    sp = " ";
  }
  putchar('\n');

  return 0;
}

Measured memory_bytes: 34436
import java.util.*;

public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        long[] a = new long[n];
        int[] count = new int[100001];
        for (int i = 0; i < n; i++) {
            int num = Integer.parseInt(sc.next());
            a[i] = num;
            count[num]++;
        }
        int q = Integer.parseInt(sc.next());
        List<String> list = new ArrayList<>();
        long sum = Arrays.stream(a).sum();
        for (int i = 0; i < q; i++) {
            int b = Integer.parseInt(sc.next());
            int c = Integer.parseInt(sc.next());
            long diff = (long) (c - b) * count[b];
            count[c] += count[b];
            count[b] = 0;
            sum += diff;
            list.add(Long.toString(sum));
        }
        sc.close();

        String result = String.join("\r\n", list);

        // 出力
        System.out.println(result);
    }
}


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

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

int main()
{   
    /* 座席　（中央×後）*/
    //資料の説明通りにやってみたつもりです

    int n;
    cin >> n;
    vector<vector<int>> edges(n, vector<int>());

    REP(i, n) {
        int u, k, e;
        cin >> u >> k;

        REP(j, k) {
            cin >> e;
            edges.at(u-1).push_back(e-1);
        }
    }

    queue<int> Q;
    vector<int> dst(n, 1000000);

    dst[0] = 0;
    Q.push(0);

    while (!Q.empty()) {
        int cur = Q.front();
        Q.pop();

        REP(i, edges[cur].size()) {
            if (dst[edges[cur][i]] == 1000000)
                Q.push(edges[cur][i]);
                if (dst[edges[cur][i]] > dst[cur]+1)
                    dst[edges[cur][i]] = dst[cur]+1;
        }
    }

    REP(i, n) {
        if (dst[i] == 1000000)
            cout << i+1 << " " << -1 << endl;
        else 
            cout << i+1 << " " << dst[i] << endl;
    }
}


Measured memory_bytes: 3152
#include<iostream>
using namespace std;
#define MAX 19980328
typedef long long LL;

int n, k;
LL T[MAX];

int check(LL P){
    int i=0;
    for (int j=0;j<k;j++){
        LL s=0;
        while(s+T[i]<=P){
            s+=T[i];
            i++;
            if(i == n){return n;}
        }
    }
    return i;
}

int solve(){
    LL left = 0;
    LL right = 100000*100000;
    LL mid;
    while(right>left+1){
        mid = (left+right)/2;
        int v = check(mid);
        if (v>=n) {
            right = mid;
        }
        else left = mid;
    }
    return right;
}

int main(){
    cin >> n>>k;
    for (int i=0;i<n;i++) cin>>T[i];
    LL ans = solve();
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3880
#define prob CandyAddict
#ifdef  DEBUG
#define MAXN 100300
#else
 
#define MAXN 100300
#endif

#include <bits/stdc++.h>

using namespace std;
#define rep(i, l, r) for (int i = l; i<r;i++)
#define vi vector<int>
#define all(v) v.begin(),v.end()
#define pb(c) push_back(c)
#define vii vector<pair<int,int>>
#define vvi vector<vector<int>>
#define ii pair<int,int>
#define mp(i, j) make_pair(i,j)
#define ull unsigned long long int
#define ll  long long int
 #define PI  3.141592653589793238
#define MOD (1000000007)
#define INF (1100000000)
#define EPS 0.00000001

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
#ifdef DEBUG
    freopen("input", "r", stdin);//use flush(cout)
#endif
    ll n, k;
    cin >> n >> k;
    ll ans = 0;
    ll a[n], b[n];
    rep (i, 0, n) {
        cin >> a[i] >> b[i];
    }
    int lastBit = -1;
    rep (i,0,32)
        if (k&(1<<i)) lastBit = i;

    int dp[n] = {0};
    for (int hole = -1; hole <= lastBit; hole++) {
        if (hole!=-1 && !(k&(1<<hole))) {
            continue;
        }
        ll res = 0;
        int orr =0;
        rep (i, 0, n) {

            bitset<32> mask;
            mask.set();
            mask = mask << (hole + 1);
            ull at = a[i] & mask.to_ulong();
            ull kt = k & mask.to_ulong();

            if (((a[i] & (1 << hole) )== 0) && (at | kt) == kt) {

                res += b[i];
                orr |= a[i];
            }


        }
        
        ans = max(ans, res);



    }

    cout<<ans;
    return 0;
}

Measured memory_bytes: 2304
#include "bits/stdc++.h"

using namespace std;

void solve(void)
{
	int n, k;
	string s;
	cin >> n >> s >> k;
	for (int i = 0; i < n; i++)
	{
		cout << (s[i] == s[k-1] ? s[k-1] : '*');
	}
	cout << endl;
}

int main()
{
	solve();
	//cout << "yui(*-v・)yui" << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;
const int maxn = 5e5 + 5;
int n, m;
ll inv[maxn], fac[maxn], ans;
ll qpow(ll a, ll b) {
    ll ans = 1, base = a;
    while (b) {
        if (b & 1) ans = ans * base % MOD;
        b >>= 1, base = base * base % MOD;
    }
    return ans;
}
void init() {
    fac[0] = 1;
    for (int i = 1; i <= m; i++) fac[i] = fac[i - 1] * i % MOD;
    for (int i = 0; i <= m; i++) inv[i] = qpow(fac[i], MOD - 2);
}
ll A(ll a, ll b) { return fac[a] * inv[a - b] % MOD; }
ll C(ll a, ll b) { return fac[a] * inv[b] % MOD * inv[a - b] % MOD; }
int main() {
    cin >> n >> m;
    init();
    ans = qpow(A(m, n), 2);
    for (int s = 1; s <= n; s++) {
        ans -= (s & 1 ? 1 : -1) * C(n, s) * A(m, s) % MOD *
               qpow(A(m - s, n - s), 2) % MOD;
        ans %= MOD;
    }
    cout << (ans + MOD) % MOD;
    return 0;
}

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

#define dump(...) cout<<"# "<<#__VA_ARGS__<<'='<<(__VA_ARGS__)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define peri(i,a,b) for(int i=int(b);i-->int(a);)
#define rep(i,n) repi(i,0,n)
#define per(i,n) peri(i,0,n)
#define all(c) begin(c),end(c)
#define mp make_pair
#define mt make_tuple

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<string> vs;

template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& p){
	return os<<'('<<p.first<<','<<p.second<<')';
}

template<typename Tuple>
void print_tuple(ostream&,const Tuple&){}
template<typename Car,typename... Cdr,typename Tuple>
void print_tuple(ostream& os,const Tuple& t){
	print_tuple<Cdr...>(os,t);
	os<<(sizeof...(Cdr)?",":"")<<get<sizeof...(Cdr)>(t);
}
template<typename... Args>
ostream& operator<<(ostream& os,const tuple<Args...>& t){
	print_tuple<Args...>(os<<'(',t);
	return os<<')';
}

template<typename Ch,typename Tr,typename C,typename=decltype(begin(C()))>
basic_ostream<Ch,Tr>& operator<<(basic_ostream<Ch,Tr>& os,const C& c){
	os<<'[';
	for(auto i=begin(c);i!=end(c);++i)
		os<<(i==begin(c)?"":" ")<<*i;
	return os<<']';
}

constexpr int INF=1e9;
constexpr int MOD=1e9+7;
constexpr double EPS=1e-9;

int main()
{
	for(int n;cin>>n && n;){
		vector<map<string,int>> ss(n);
		rep(i,n){
			int k; cin>>k;
			rep(j,k){
				string name; int value; cin>>name>>value;
				ss[i][name]=value;
			}
		}
		int q; cin>>q;
		vs ns(q);
		rep(i,q) cin>>ns[i];
		int m; cin>>m;
		vvi d(n+1,vi(n+1,INF));
		rep(i,n+1) d[i][i]=0;
		rep(i,m){
			int u,v,w; cin>>u>>v>>w;
			(u+=n)%=n+1; (v+=n)%=n+1;
			d[u][v]=d[v][u]=w;
		}
		
		rep(k,n+1) rep(i,n+1) rep(j,n+1)
			d[i][j]=min(d[i][j],d[i][k]+d[k][j]);
		
		vvi dp(1<<(n+1),vi(n+1,INF));
		rep(i,n) dp[1<<i][i]=d[n][i];
		rep(i,1<<(n+1)) rep(j,n+1) if(i>>j&1) rep(k,n+1) if(!(i>>k&1))
			dp[i|1<<k][k]=min(dp[i|1<<k][k],dp[i][j]+d[j][k]);
		
		pii res(INF,INF);
		rep(i,1<<n){
			vi ps(q,INF);
			rep(j,n) if(i>>j&1)
				rep(k,q) if(ss[j].count(ns[k]))
					ps[k]=min(ps[k],ss[j][ns[k]]);
			if(count(all(ps),INF)) continue;
			res=min(res,mp(accumulate(all(ps),0),dp[i|1<<n][n]));
		}
		
		if(res==mp(INF,INF))
			puts("impossible");
		else
			printf("%d %d\n",res.first,res.second);
	}
}

Measured memory_bytes: 1432
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=1;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define maxs(a, b) a = max(a, b)
#define mins(a, b) a = min(a, b)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll linf = (1ll << 61);
const int inf = 1001001001;
const int mod = 1000000007;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, k;
	cin >> n >> k;
	vector<double> p(n);
	rep(i, n) cin >> p[i];
	vector<double> res(n);
	rep(i, n) {
		double tmp = p[i] * (1 + p[i]) / 2;
		tmp /= p[i];
		res[i] = tmp;
		//cout << res[i] << endl;
	}
	vector<double> sum(n + 1);
	rep(i, n) sum[i + 1] = sum[i] + res[i];
	double ans = 0;
	rrep(i, n - k + 2) {
		maxs(ans, sum[i + k - 1] - sum[i - 1]);
	}
	printf("%.10f\n", ans);
	return 0;
}

Measured memory_bytes: 8032
def area(p,q):return p[0]*q[1]-p[1]*q[0]
n = int(input())
P =[]
s = 0
for _ in range(n):P.append([int(i) for i in input().split()])
P.append(P[0])
for i in range(n):s += P[i][0]*P[i+1][1] - P[i][1]*P[i+1][0]
print(s*0.5)

Measured memory_bytes: 7724
n,m,k=map(int,input().split())
m+=1
n+=1
r=[0]*(n)
c=[0]*(m)
d={}
for _ in range(k):
  a,b=map(int,input().split())
  d[(a,b)]=1
  r[a]+=1
  c[b]+=1
m1=max(r)
x=[]
for i in range(n):
  if(r[i]==m1):
    x.append(i)
m2=max(c)
y=[]
for i in range(m):
  if(c[i]==m2):
    y.append(i)
ans=m1+m2
z=0
for i in x:
  for j in y:
    if((i,j) not in  d):
      z=-1
      break
if(z==0):
  print(ans-1)
else:
  print(ans)   


  

Measured memory_bytes: 85492
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define FOR(i,l,r) for(ll i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define REPS(i,n) FOR(i,1,n+1)
#define RFOR(i,l,r) for(ll i=(l);i>=(r);--i)
#define RREP(i,n) RFOR(i,n-1,0)
#define RREPS(i,n) RFOR(i,n,1)
#define pb push_back
#define eb emplace_back
#define SZ(x) ((ll)(x).size())
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
template<class T = ll> using V = vector<T>;
template<class T = ll> using VV = V<V<T>>;
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; }
inline void Yes(bool b = true) {cout << (b ? "Yes" : "No") << '\n';}
inline void YES(bool b = true) {cout << (b ? "YES" : "NO") << '\n';}
inline void YAY(bool b = true) {cout << (b ? "Yay!" : ":(") << '\n';}
inline void err(bool b = true) {if(b) {cout << -1 << '\n'; exit(0);}}
template<class T> inline void fin(bool b = true, T e = 0) {if(b) {cout << e << '\n'; exit(0);}}
template<class T> T Roundup_div(T x, T y) {return (x+(y-1))/y;}
const ll INF = 1e18;
V<> VEC(ll n) {V<> v(n); REP(i, n) cin >> v[i]; return v;}
template <typename T> T pow(T a, long long n, T e = 1) {T ret = e; while (n) {if (n & 1) ret *= a; a *= a; n >>= 1;} return ret;}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n, k; cin >> n >> k;
    V<> a = VEC(n);
    REP(i, n - k){
        Yes(a[k + i] > a[i]);
    }
}

Measured memory_bytes: 4764
#include<stdio.h>

int main(){
 int n,i;
 long ans;

 ans = 1;

 scanf("%d",&n);

 if(n==0){ans=1;}
 else{
 for(i=1;i<=n;i++)ans*=i;
 }
 printf("%ld\n",ans);

return 0;
}


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

typedef long long ll;
const ll INF = 1e9, MOD = 1e9 + 7;
const double EPS = 1e-9, PI = 3.141592653589793;
#define REP(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define REPR(i,a,b) for(ll i=b;i>=a;i--)
#define repr(i,n) REPR(i,0,n)
#define all(v) (v).begin(), (v).end()
#define pb push_back

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

    string n;
    cin >> n;
    if(n[0]==n[2]) cout << "Yes" << "\n";
    else cout << "No" << "\n";
    return 0;
}

Measured memory_bytes: 256
// template for atcoder beginners
// when you create a *.cpp file, this template is loaded

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

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

  if (N < 3200)
    cout << "red" <<endl;
  else {
    string s;
    cin >> s;
    cout << s << endl;
  }
}



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

int sorting(const void *a, const void *b)
{
	int x = *(int *)a;
	int y = *(int *)b;
	if (x == y) {
		return 0;
	} else if (x > y) {
		return 1;
	} else {
		return -1;
	}
}

int main()
{
	int input[3];
	int i;
	for (i = 0; i < 3; i++) {
		scanf("%d", &input[i]);
	}

	qsort(input, 3, sizeof(int), sorting);

	printf("%d %d %d\n", input[0], input[1], input[2]);

	return 0;
}

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

int main(){
    vector<int> a(3);
    cin >> a[0] >> a[1] >> a[2];
    sort(a.begin(),a.end());
    reverse(a.begin(),a.end());
    cout << a[0]*10 + a[1] + a[2] << endl;
    return 0;
}

Measured memory_bytes: 256
ptn=["23542","14631",
"12651","15621",
"13641","32453"]

def rNO(d):
  global ptn
  for i,e in enumerate(ptn):
    if d in e:
      return i
  return 0
      

dice = list(input().split(" "))
n = int(input())

for i in range(n):
  q = input().split()
  for i,e in enumerate(dice):
    if e == q[0] :
      q1 = i + 1
    if e == q[1]:
      q2 = i + 1
  
  qq=str(q1) + str(q2)
  ans = rNO(qq)
  print(dice[ans])


Measured memory_bytes: 5600
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;

namespace AtCoder.A
{
    public class Program
    {
        public static void Main() { var r = GetResult(); Debug.WriteLine(r); Console.Write(r); }

        private static object GetResult()
        {
            var (A, B) = Read2Longs();
            return A + B >= 10 ? "error" : (A + B).ToString();
        }

        #region Console.Read

        public static string ReadText() { return Console.ReadLine(); }
        public static List<string> ReadTexts() { return Console.ReadLine().Split(' ').ToList(); }
        public static long ReadLong() { return long.Parse(Console.ReadLine()); }
        public static (long, long) Read2Longs() { var ls = ReadLongs(); return (ls[0], ls[1]); }
        public static (long, long, long) Read3Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2]); }
        public static (long, long, long, long) Read4Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2], ls[3]); }
        public static (long, long, long, long, long) Read5Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2], ls[3], ls[4]); }
        public static List<long> ReadLongs() { return Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToList(); }

        #endregion
    }
}


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

int main(){
  int N;
  cin >> N;
  vector<int> kushi(2*N);
  for(int i=0; i<2*N; ++i){
    cin >> kushi.at(i);
  }
  sort(kushi.begin(),kushi.end());
  int sum=0;
  for(int i=0; i<2*N; i=i+2){
    sum+=kushi.at(i);
  }
  cout << sum << endl;
}

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

using namespace std;

int main(){
    long long k;
    cin>>k;
    long long ans=0;
    
    for(long long a=1;a<=k;a++){
        for(long long b=1;b<=k;b++){
            for(long long c=1;c<=k;c++){
                ans+=gcd(gcd(gcd(a,b),gcd(a,c)),gcd(b,c));
            }
        }
    }
    
    cout<<ans<<endl;
    
    return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define FAST_INPUT ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define ll long long

using namespace std;


void solve() {
	int n; cin >> n;
	vector<double> dp(n + 1);
	dp[0] = 1;
	for (int i = 0; i < n; i++) {
		double pHeads; cin >> pHeads;
		for (int j = i + 1; j >= 0; j--) {
			dp[j] = (j == 0 ? 0 : dp[j - 1]) * pHeads + dp[j] * (1 - pHeads);
		}
	}

	double ans = 0;
	for (int heads = 0; heads <= n; heads++){
		int tails = n - heads;
		if (heads > tails) {
			ans += dp[heads];
		}
	}

	cout << setprecision(20) << ans << endl;

}

int main() {
    FAST_INPUT;

    solve();

    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
using namespace std;
const int N=602,M=1000000007;
typedef long long ll;
int n,k,i,j,l,r,x,y,L[N],R[N],cnt[N],num[N][N];
ll g[N],f[N][N],Ans;
bool ok;
void init(){
    scanf("%d%d",&n,&k);
    n*=2;
    for(i=1;i<=k;i++){
        scanf("%d%d",L+i,R+i);
        if(L[i]>R[i])
            swap(L[i],R[i]);
        cnt[L[i]]++;
        cnt[R[i]]++;
    }
    for(i=1;i<=n;i++)
        cnt[i]=1-cnt[i]+cnt[i-1];
    for(l=1;l<=n;l++)
        for(r=l;r<=n;r++)
            num[l][r]=cnt[r]-cnt[l-1];
}
void work(){
    g[0]=1;
    for(i=2;i<=n;i++)
        g[i]=(i-1)*g[i-2]%M;
    for(j=1;j<=n;j+=2)
        for(x=1;x+j<=n;x++){
            y=x+j;
            ok=1;
            for(i=1;i<=k&&ok;i++){
                if(L[i]<x&&x<=R[i]&&R[i]<=y)
                    ok=0;
                if(x<=L[i]&&L[i]<=y&&y<R[i])
                    ok=0;
            }
            if(ok){
                f[x][y]=g[num[x][y]];
                for(i=x+1;i<y;i+=2)
                    f[x][y]=(f[x][y]-f[x][i]*g[num[i+1][y]])%M;
            }
            Ans=(Ans+f[x][y]*g[num[1][x-1]+num[y+1][n]])%M;
        }
    printf("%lld",(Ans+M)%M);
}
int main(){
    init();
    work();
    return 0;
}

Measured memory_bytes: 4352
/* Hello darkness my old friend, I've come to visit you again! */

#include<bits/stdc++.h>
#define lli long long int
#define FOR(i,a,b) for(i=a;i<b;i++)
#define FORB(i,b,a) for(i=b;i>=a;i--)
#define mod 1000000007
#define PI 2*acos(0.0)
#define gs getline(cin,s)
#define pii pair<int,int>
#define pli pair<long long int,int>
#define pil pair<int,long long int>
#define pll pair<long long int,long long int>
#define pb push_back
#define eb emplace_back4
#define mem(a,b) memset(a,b,sizeof(a))
#define inf 1000000005
#define INF 1000000000000000005
#define io ios_base::sync_with_stdio(0);
#define ff first
#define ss second
using namespace std;
int a[100005];
int main()
{
    io;
    cin.tie(0);
    cout.tie(0);
    int n,i;
    cin>>n;
    a[1]=1;
    FOR(i,2,n+1)
    {
        a[i]=a[i-1]+1;
        int k=6;
        while(k<=i)
        {
            a[i]=min(a[i],a[i-k]+1);
            k*=6;
        }
        k=9;
        while(k<=i)
        {
            a[i]=min(a[i],a[i-k]+1);
            k*=9;
        }
        //cout<<i<<"\n";
    }
    cout<<a[n];
    return 0;
}

/* This is the end, beautiful friend! */


Measured memory_bytes: 640
#include <bits/stdc++.h>
 
typedef long long ll;
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))
#define rep(i, n) for (int i = 0; i < (n); ++i)
const double PI=3.14159265358979323846;
 
using namespace std;
 
int ans = 0;
ll goal;
 
bool is (ll a) {
    int f[3] = {0, 0, 0};
 
    string s = to_string(a);
    rep(i, s.length()) {
        if (s[i] == '3') f[0] = 1;
        if (s[i] == '5') f[1] = 1;
        if (s[i] == '7') f[2] = 1;
    }
    
    return f[0] && f[1] && f[2];
}
 
void dfs(ll now) {
 
    if (now > goal) return;
 
    if (now > 100 && now <= goal) {
        if (is(now)) {
          //  cout << now << endl;
            ans++;
        }
    }
 
    dfs(now * 10 + 3);
    dfs(now * 10 + 5);
    dfs(now * 10 + 7);
}
 
int main() {
 
    cin >> goal;
 
    dfs(3);
    dfs(5);
    dfs(7);
 
    cout << ans << endl;
}

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

using namespace std;

const int MAX = 10000;
const int INF = (1<<20);

int data[MAX],n;


void solve(){
  vector<int> V;
  fill(data,data+MAX,0);
  for(int i = 1; i < n; i++){
    V.push_back((i*i)%n);
  }
  V.push_back(-1);
  V.push_back(INF);
  sort(V.begin(),V.end());
  vector<int> VV;
  int now = -1;
  while(1){
    now = *upper_bound(V.begin(),V.end(),now);
    if(now == INF) break;
    VV.push_back(now);
  }
  for(int i = 0; i < VV.size(); i++)
    for(int j = 0; j < VV.size(); j++){
      //if(VV[i]!=VV[j]) {
      int num = VV[i]-VV[j];
      if(num < 0) num += n;
      if(num > (n-1)/2) num = n-num;
      data[num]++;
      //}
    }
}

void print(){
  for(int i = 1; i <= (n-1)/2; i++)
    cout << data[i] << endl;
}


int main(){
  while(cin >> n && n){
    solve();
    print();
  }
  return 0;
}

Measured memory_bytes: 1052
#include <bits/stdc++.h>
using namespace std;
using Int = long long;

template<typename T1,typename T2> void chmin(T1 &a,T2 b){if(a>b)a=b;};
template<typename T1,typename T2> void chmax(T1 &a,T2 b){if(a<b)a=b;};

const int MAX = 11514;
signed main(){
  int n,m,R;
  while(scanf("%d %d %d",&n,&m,&R),n||m){
    R*=4;
    vector<int> ax(n),ay(n);
    vector<int> bx(m),by(m);
    for(int i=0;i<n;i++) scanf("%d %d",&ax[i],&ay[i]);
    for(int i=0;i<m;i++) scanf("%d %d",&bx[i],&by[i]);

    vector<vector<int> > ps(MAX);
    for(int i=0;i<m;i++) ps[bx[i]].emplace_back(by[i]);
    for(int i=0;i<MAX;i++) sort(ps[i].begin(),ps[i].end());

    auto calc=[&](vector<int> &v,int l,int r)->int{
      return upper_bound(v.begin(),v.end(),r)-lower_bound(v.begin(),v.end(),l);
    };
    
    long long ans=0;
    for(int i=0;i<n;i++){
      int dy=0;
      for(int dx=-R;dx<=R;dx++){
	int x=ax[i]+dx;
	if(x<0||x>=MAX||ps[x].empty()) continue;
	while(dx*dx+(dy+1)*(dy+1)<=R*R) dy++;
	while(dx*dx+dy*dy>R*R) dy--;
	ans+=calc(ps[x],ay[i]-dy,ay[i]+dy);
      }      
    }
    printf("%lld\n",ans);
  }  
  
}




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

int main() {
  int n;
  cin >> n;
  int a=n/1000;
  int b=(n-a*1000)/100;
  int c=(n-a*1000-b*100)/10;
  int d=(n-a*1000-b*100-c*10);
  if(a+b+c+d==7)cout << a << '+' << b << '+' << c << '+' << d;
  else if(a+b+c-d==7)cout << a << '+' << b << '+' << c << '-' << d;
  else if(a+b-c+d==7)cout << a << '+' << b << '-' << c << '+' << d;
  else if(a+b-c-d==7)cout << a << '+' << b << '-' << c << '-' << d;
  else if(a-b+c+d==7)cout << a << '-' << b << '+' << c << '+' << d;
  else if(a-b+c-d==7)cout << a << '-' << b << '+' << c << '-' << d;
  else if(a-b-c+d==7)cout << a << '-' << b << '-' << c << '+' << d;
  else if(a-b-c-d==7)cout << a << '-' << b << '-' << c << '-' << d;
  cout << '=' << 7 << endl;
}


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

using namespace std;

const int N=2e5;

long long ans,a[N+2];

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    int i,n;
    cin >> n;
    for(i=1;i<=n;i++)cin >> a[i];
    for(i=2;i<=n;i++)
    {
        if(a[i] < a[i-1])ans+=a[i-1]-a[i],a[i]=a[i-1];
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 5188