akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <stdlib.h>

int main(void)
{
	int n, num[101],i,j,k,color[10], min = 0, max = 0;
	for(i = 0; i < 10; i++)
		color[i] = 0;
	scanf("%d", &n);
	for(i = 0; i < n; i++){
		scanf("%d", &num[i]);
	}
	

	for(i = 0; i < n; i++){
		switch (num[i]/400){
			case 0:
				color[0]++;
				break;
			case 1:
				color[1]++;
				break;
			case 2:
				color[2]++;
				break;
			case 3:
				color[3]++;
				break;
			case 4:
				color[4]++;
				break;
			case 5:
				color[5]++;
				break;
			case 6:
				color[6]++;
				break;
			case 7:
				color[7]++;
				break;
			default:
				color[8]++;
				break;
		}
	}
	for(i = 0; i < 8; i++){
		if(color[i] > 0){
			min++;
			max++;
		}
	}
	if(color[8] > 0){
		max = max + color[8];
		if(min == 0)
			min++;
	}
	printf("%d %d", min, max);

	return 0;
}

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

using namespace std ;

const int MAX = 1e5 + 10 ;

int arr[MAX] ;
long long n ;

long long ans = 0 ;

void solve(long long k)
{
	long long a = n ;
	while(a % k == 0)
		a /= k ;
	if(a % k == 1)
		ans++ ;
	return ;
}

void factorize(long long x)
{
	if(x == n-1 && x != 1)
		solve(x) ;
	if(x == n)
		solve(x) ;
	for(long long i = 2ll ; i * i <= x ; ++i)
	{
		if(x % i == 0)
		{
			solve(i) ;
			if(x/i != i)
				solve(x/i) ;
		}
	}
	return ;
}

int main()
{
	ios_base::sync_with_stdio(0) ;
	cin.tie(0) ;
	cin>>n ;
	factorize(n-1) ;
	factorize(n) ;
	return cout<<ans<<"\n" , 0 ;
}		

Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#include <functional>
#include <cassert>
#include <utility>
using namespace std;
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,n1,n2) for(int i=n1;i<n2;i++)
typedef long long ll;
typedef pair<int,int> Pii;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a, b)*b;}


int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s,t;
	cin>>s>>t;
	int ss[26]={};
	int tt[26]={};
	for(int i=0;i<s.size();i++){
		ss[s[i]-'a']++;
		tt[t[i]-'a']++;
	}
	sort(ss,ss+26);
	sort(tt,tt+26);
	for(int i=0;i<26;i++){
		if(ss[i]!=tt[i]){
			cout<<"No"<<endl;
			return 0;
		}
	}
	cout<<"Yes"<<endl;
	return 0;
}





Measured memory_bytes: 916
#include <bits/stdc++.h>
using namespace std;
#define rep(i, s, e) for (int i = s; i < e; ++i)
#define sort_(a) sort(a.begin(), a.end())
#define rsort(a) sort(a.rbegin(), a.rend())
#define sum(a) accumulate(a.begin(), a.end(), 0LL)
typedef long long unsigned int ll;
const long mod = 1e9 + 7;

int main(void) {
#ifdef DEBUG
  freopen("input.txt", "r", stdin);
#endif

  ios_base::sync_with_stdio(false);
  cin.tie(0);

  int N, M, Ai;
  cin >> N >> M;
  priority_queue<pair<int, int>> card;
  rep(i, 0, N) {
    cin >> Ai;
    card.push(make_pair(Ai, 1));
  }

  int B, C;
  rep(i, 0, M) {
    cin >> B;
    cin >> C;
    card.push(make_pair(C, B));
  }

  ll ans = 0;
  rep(i, 0, N) {
    auto p = card.top();
    card.pop();
    ans += p.first;
    if (p.second > 1) {
      --p.second;
      card.push(p);
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 2420
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;
int main(){
  ll N,T;
  cin >> N >> T;
  vector<ll> t(N);
  for(int i = 0;i < N;i++)cin >> t[i];

  ll ans = 0;
  for(int i = 1;i < N;i++){
    if(t[i] - t[i-1] >= T)ans += T;
    else ans += t[i] - t[i-1];
  }
  ans += T;
  cout << ans << endl;
}


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

using namespace std;

int main()
{
    int k,a,b,c = 0;
    cin >> k >> a >> b;
    for(int i = 0; i < b - a + 1; i++){
        int p;
        p = (a + i) % k;
        if(p == 0) c++;
    }
    if(c >= 1) cout << "OK" << endl;
    if(c == 0) cout << "NG" << endl;
}

Measured memory_bytes: 3548
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<string.h>
#include<math.h>
#include<stack>
#include<queue>
#include<string>
#include<deque>
#include<set>
#include<vector>
#define ll long long
using namespace std;
int main()
{
	int n,k;
	cin>>n>>k;
	int num[55];
	for(int i=0;i<n;i++)
	cin>>num[i];
	int maxx=0;
	for(int a=0;a<=k;a++)
	{
		for(int b=0;b<=k;b++)
		{
			for(int c=0;c<=k;c++)
			{
				if(a+c+b<=k&&a+b>=c&&a+b<=n)
			    {
			    	priority_queue<int>q;
			    	for(int i=0;i<a;i++)
			    	q.push(num[i]);
			    	for(int i=0;i<b;i++)
			    	q.push(num[n-i-1]);
			    	int sum=0;
			    	for(int i=0;i<a+b-c;i++)
			    	{
			    		sum=sum+q.top();
			    		q.pop();
					}
					maxx=max(maxx,sum);
				}
			}
		}
	 } 
    cout<<maxx<<endl;
		return 0;
 } 


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; ++i)
#define ALL(v) v.begin(), v.end()
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1000000007;

int main()
{
	int n;
	cin >> n;
	int now=0,X=0,Y=0;
	rep(i,n)
	{
		int t,x,y;
		cin >> t >> x >> y;
		if(t-now>=abs(X-x)+abs(Y-y)&&(t-now)%2==(abs(X-x)+abs(Y-y))%2)
		{

		}
		else
		{
			cout<<"No"<<endl;
			return 0;
		}
		now = t;
		X = x;
		Y = y;
	}
	cout<<"Yes"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <limits>
#include <queue>
#include <iomanip>
#include <set>

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

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

using namespace std;
using ll = long long int;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vvll> vvvll;
const int MOD=1000000007;
//const int MOD=998244353;
const int INTMAX=1001001000;
const ll LLMAX=1010010010010010000;


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    ll R;
    cin>>R;
    printf("%.12f\n",R*2*3.14159265358979323);
    
    return 0;
}


Measured memory_bytes: 3780
l, r = map(int, input().split())
ans = 2019
if r-l > 2019:
    print(0)
else:
    for i in range(l, r+1):
        for j in range(i+1, r+1):
            mod = divmod(i*j, 2019)[-1]
            if mod < ans:
                ans = mod
    print(ans)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main() {
  int n, x, y;
  cin >> n >> x >> y;
  x--;
  y--;
  int dist[n][n];
  //vector<vector<int>> dist(n, vector<int>(n));
  int ans[n-1] = {}; // 1,2,...,n-1
  
  for (int i = 0; i < n; ++i)
    for (int j = i; j < n; ++j)
      dist[i][j] = abs(i-j);
      
  for (int i = 0; i < n; ++i) {
    for (int j = i + 1; j < n; ++j) {
      dist[i][j] = min(dist[i][j], dist[min(i, x)][max(i, x)] + 1 + dist[min(j, y)][max(j, y)]);
      ans[dist[i][j]-1]++;
      //dist[i][j] = min(dist[i][j], dist[i][y-1] + 1 + dist[x-1][j]);
    }
  }
  
  for (int i = 0; i < n-1; ++i)
    cout << ans[i] << '\n';
  return 0;
}

Measured memory_bytes: 15616
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
 
typedef long long ll;
 
using namespace std; 
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

const long long INF = 1LL << 60;
 
#define REP(inc, bgn, end) for (int inc = bgn; inc < end; inc++)

int main() {
    ll n;
    cin >> n;
    vector<ll> d(n);
    REP(i,0,n) cin >> d[i];

    sort(d.begin(), d.end());
    int abc = n / 2 - 1;
    int arc = n / 2;

    cout << d[arc] - d[abc] << endl;;
}

Measured memory_bytes: 1024
#include<iostream>
using namespace std;
int main(){
    int x,y;
    int a,b;
    cin >> x >> y;
    a=0;

    while(b>=0){
      b=x-a;
      if(b<0){
          cout << "No";
          break;
      }else if(2*a+4*b==y){
          cout << "Yes";
          break;
      }
      a++;
    }
    return 0;
}


Measured memory_bytes: 3592
#include"bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef vector<int> vi;

int main(void) {
	ll n;
	cin >> n;
	vector<ll> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	ll tot = 0;

	for (int i = 1; i < n; i++) {
		if (a[i] >= a[i-1]) {
			continue;
		}
		else {
			tot += a[i - 1] - a[i];
			a[i] += a[i - 1] - a[i];
		}
	}

	cout << tot << endl;
	

	return 0;
}

Measured memory_bytes: 4828
#include <algorithm>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <list>
#define INF 10000000000ll
#define MOD 1000000007ll
#define EPS 1e-10
#define REP(i,m) for(long long i=0; i<m; i++)
#define FOR(i,n,m) for(long long i=n; i<m; i++)
#define DUMP(a) for(long long dump=0; dump<(ll)a.size(); dump++) { cout<<a[dump]; if(dump!=(ll)a.size()-1) cout<<" "; else cout<<endl; }
#define ALL(v) v.begin(),v.end()
#define pb push_back
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
typedef long double ld;
using namespace std;

int main(){
	int n;
	cin >> n;
	int a[(n+1)/2] = { };
	REP(i, n){
		int x;
		cin >> x;
		if((x % 2) != (n % 2)){
			if(n % 2 == 0) a[(x-1)/2]++;
			else a[x/2]++;
		}
	}
	int ans = 1;
	if(n % 2 == 0){
		REP(i, (n+1)/2){
			if(a[i] != 2) ans = 0;
		}
	}
	else{
		REP(i, (n+1)/2){
			if(i == 0 && a[i] != 1) ans = 0;
			if(i != 0 && a[i] != 2) ans = 0;
		}
	}
	if(ans == 0) cout << 0 << endl;
	else{
		int p = n / 2;
		ll ans = 1;
		REP(i, p) ans = (ans * 2) % MOD;
		cout << ans << endl;
	}
	return 0;
}


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

#define int         long long int
#define all(a)      (a).begin(),(a).end()
#define f           first
#define s           second
#define endl        '\n'
#define MOD         1000000007

void solve()
{
    int n ;
    cin >> n ; 
    bool ok = true ;
    for(int i = 0 ; i < n ; i++)
    {
        int tmp ;
        cin >> tmp ;
        if(tmp % 2 == 0)
            ok = (tmp % 3 == 0 or tmp  % 5 == 0) ;
        if(!ok)
            break ;
    }
    if(ok)
    {
        cout << "APPROVED" << endl ;
    }
    else
    {
        cout << "DENIED" << endl ;
    }
}

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

    int t = 1 ;
    //cin >> t ;
    while(t--)
    {
        solve() ;
    }
    return 0 ;
}

Measured memory_bytes: 256
N = int(input())
c = [0]*4
for i in range(N):
    s = input()
    if s == 'AC':
        c[0] += 1
    elif s == 'WA':
        c[1] += 1
    elif s == 'TLE':
        c[2] += 1
    else:
        c[3] += 1
print('AC x ',c[0])
print('WA x ',c[1])
print('TLE x ',c[2])
print('RE x ',c[3])


Measured memory_bytes: 9208
def main():
    s = input()
    t = input()
    sl = [c for c in s]
    tl = [c for c in t]
    sl.sort()
    tl.sort(reverse=True)
    s2 = "".join(sl)
    t2 = "".join(tl)

    if s2 < t2:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Scanner;

public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	public void _main(String[] args) {
		Scanner sc = new Scanner(in);
		int n = sc.nextInt();

		if(n==1) {
			out.println("Hello World");
		}else {
			int a = sc.nextInt();
			int b = sc.nextInt();
			out.println(a+b);
		}

		sc.close();
	}

	public static void main(String[] args) {
		new Main()._main(args);
	}

}


Measured memory_bytes: 21844
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
	int N, K, Q;
	cin >> N >> K >> Q;
	vector<int> A(N);
	for (int i = 0; i < N; ++i) cin >> A[i];
	int ret = (1 << 30);
	for (int i = 0; i < N; ++i) {
		vector<int> candy, cur;
		for (int j = 0; j <= N; j++) {
			if (j == N || A[j] < A[i]) {
				sort(cur.begin(), cur.end());
				if (cur.size() >= K) candy.insert(candy.end(), cur.begin(), cur.end() - K + 1);
				cur.clear();
			}
			else cur.push_back(A[j]);
		}
		sort(candy.begin(), candy.end());
		if (candy.size() >= Q) ret = min(ret, candy[Q - 1] - A[i]);
	}
	cout << ret << '\n';
	return 0;
}

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


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

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

#define rep(i, n)    for(int i = 0; i < (n); ++i)
#define repA(i, a, n)  for(int i = a; i <= (n); ++i)
#define repD(i, a, n)  for(int i = a; i >= (n); --i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
#define fill(a)  memset(a, 0, sizeof (a))
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
typedef long double ld;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

void pre(){


}

void solve(){


}
int x[500009],y[500009];
int main() {
	cin.sync_with_stdio(0); cin.tie(0);
	cin.exceptions(cin.failbit);
	pre();
	int n;
	string s;cin>>s;
	n=sz(s)+1;
	rep(i,n-1) if(s[i]=='<') x[i+1] = x[i]+1;
	repD(i,n-2,0) if(s[i]=='>') x[i]=max(x[i],x[i+1]+1);
	ll ans =0;
	rep(i,n) ans+=x[i];
	cout<<ans;
	return 0;
}



Measured memory_bytes: 2844
import math
a, b = map(int, input().split())

def solve():
  tmp = int(str(a) + str(b))

  for i in range(0, int(math.sqrt(tmp) + 1)):
    if tmp  == i * i:
      print('Yes')
      return
    
  print('No')

def main():
  solve()

if __name__ == "__main__":
  main()

Measured memory_bytes: 2940
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        
        int h = Integer.parseInt(sc.next());
        int w = Integer.parseInt(sc.next());
        int k = Integer.parseInt(sc.next());
        int black = 0;
        //黒1 白0
        int[][] map = new int[h][w];
        for(int i=0; i<h; i++) {
             String S = sc.next();
             String[] c = S.split(""); 
            for(int j=0; j<w; j++) {
                if(c[j].equals("#")) {
                    map[i][j] = 1;
                    black++;
                }
            }
        }
        
        
        int count = black;
        int ans = 0;
        int[][] copy = new int[h][w];
        for(int i=0; i<h; i++) {
            copy[i] = map[i].clone();
        }
        
        
        for (int i=0; i<(Math.pow(2,h)); i++) {
            count = black;
            for(int o=0; o<h; o++) {
                copy[o] = map[o].clone();
            }
			for (int j=0; j<h; j++) {
			    if ((1&i>>j) == 1) {
			        for(int a=0; a<w; a++) {
			            if(copy[j][a] == 1) {
			                count--;
			            }
			            copy[j][a] = -1; 
			        }
			    }
			}
			int count2 = count;
            int[][] cp = new int[h][w];
            for(int z=0; z<h; z++) {
                cp[z] = copy[z].clone();
            }
			for (int x=0; x<(Math.pow(2,w)); x++) {
    			for (int y=0; y<w; y++) {
    				if ((1&x>>y) == 1) {
    			        for(int a=0; a<h; a++) {
    			            if(cp[a][y] == 1) {
    			                count2--;
    			            }
    			            cp[a][y] = -1; 
    			        }
    			    }
    			}
        		if(count2 == k) ans++;
        		for(int z=0; z<h; z++) {
                    cp[z] = copy[z].clone();
                }
        		count2 = count;
    		}
    	
    		
		}
		
		System.out.println(ans);

    }
}

Measured memory_bytes: 38616
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<math.h>
#include<vector>
#include<string>

using namespace std;

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


	int count = 0;

	for (int i = 0; i < s.length();i++)
		if (s[i] != t[i])
			count++;

	cout << count;
	return 0;
}

Measured memory_bytes: 3912
// Problem : C - Digits in Multiplication
// Contest : AtCoder - AtCoder Beginner Contest 057
// URL : https://atcoder.jp/contests/abc057/tasks/abc057_c
// Memory Limit : 256 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>

#define spc ' '
#define endl '\n'

using namespace std;


int main(){
	ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
	long long n, l;
	cin >> n;
	for(long long i = 1; i * i <= n; i++){
	    if(n%i==0) l = i;
	}
	cout << int(max(log10(l), log10(n/l))) + 1;
	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <numeric>
#include <string.h>
#define rep(i, x) for (int i = 0; i < (int)(x); i++)
#define repn(i, x) for (int i = 1; i <= (int)(x); i++)
#define repr(i, x) for (int i = ((int)(x) - 1); i >= 0; i--)
#define reprn(i, x) for (int i = ((int)(x)); i > 0; i--)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long int64;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const long long  INFL = 1e18;
const int MOD = 1000000007;
void solve() {
	int n; cin >> n;
	vector<int> l(n), r(n);
	rep (i, n) {
		cin >> l[i] >> r[i];
	}
	int ans = 0;
	rep (i, n) {
		ans += (r[i] - l[i]) + 1;
	}
	cout << ans << endl;
	return;
}

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

Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<algorithm>
#include<utility>
#include<queue>
#include<deque>
#include<string.h>
#include<string>
#include<set>
#include<map>
#include<vector>
#include<functional>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll INF=2e18;
const ll MOD=1e9+7;

ll N;
ll a[100010];

int main(){
    cin>>N;
    for(ll i=0;i<N;i++){
        cin>>a[i];
    }
    sort(a,a+N);
    ll ans=0;
    if(N%2==0){
        for(ll i=0;i<N/2-1;i++){
            ans-=a[i]*2;
        }
        ans-=a[N/2-1];
        ans+=a[N/2];
        for(ll i=N/2+1;i<N;i++){
            ans+=a[i]*2;
        }
    }else{
        for(ll i=0;i<N/2-1;i++){
            ans-=2*a[i];
        }
        //-1が２個
        ans-=a[N/2-1]+a[N/2];
        //+2がN/２個
        for(ll i=N/2+1;i<N;i++){
            ans+=2*a[i];
        }

        ll tmp=0;
        //-2がN/2個
        for(ll i=0;i<N/2;i++){
            tmp-=2*a[i];
        }
        //+1が２個
        tmp+=a[N/2]+a[N/2+1];
        //+2がN/2-1
        for(ll i=N/2+2;i<N;i++){
            tmp+=2*a[i];
        }
        ans=max(ans,tmp);
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
typedef long long ll;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin >> n;
    #define N 200'000
    static int x[N];
    static int a[N];
    for(int i = 0; i < n; i++) {
        cin >> x[i];
        a[i] = x[i];
    }
    sort(x, x + n);
    int Lm = x[(n-1) / 2];
    int Rm = x[n / 2];
    for(int i = 0; i < n; i++) {
        if(a[i] <= Lm) {
            cout << Rm << endl;
        } else {
            cout << Lm << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 3712
from collections import deque
from itertools import chain

ADS = [(0, 1), (1, 0), (-1, 0), (0, -1)]

h, w = map(int, input().split(" "))
s = [list(input()) for _ in range(h)]

l = [[None for _ in range(w)] for _ in range(h)]
l[0][0] = 0

q = deque([(0, 0)])
while q:
	this_x, this_y = q.popleft()
	this_num = l[this_y][this_x]
	if (this_x, this_y) == (w-1, h-1):
		# [print(" ".join(str(l_j).rjust(2) if l_j != None else "  " for l_j in l_i)) for l_i in l]
		print(sum(s_i.count(".") for s_i in s) - l[h-1][w-1] - 1)
		exit()

	for ad_x, ad_y in ADS:
		x, y = this_x+ad_x, this_y+ad_y
		if not (0 <= x < w and 0 <= y < h):
			continue
		
		square = s[y][x]
		if square == "#":
			continue

		num = l[y][x]
		if num != None:
			continue
		l[y][x] = this_num + 1

		q.append((x, y))

print(-1)

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

int main() {
  int H,W;
  cin >> H >> W;
  vector<vector<bool>> ma(H,vector<bool>(W,false));
  char a;
  for (int i=0; i<H; i++) {
    for (int j=0; j<W; j++) {
      cin >> a;
      if (a == '#') {
        ma[i][j] = true;
      }
    }
  }
  vector<bool> tfH(H,false);
  for (int i=0; i<H; i++) {
    for (int j=0; j<W; j++) {
      if (ma[i][j]) {
        tfH[i] = true;
        break;
      }
    }
  }
  vector<bool> tfW(W,false);
  for (int i=0; i<W; i++) {
    for (int j=0; j<H; j++) {
      if (ma[j][i]) {
        tfW[i] = true;
        break;
      }
    }
  }
  for (int i=0; i<H; i++) {
    if (tfH[i] == false) {
      continue;
    }
    for (int j=0; j<W; j++) {
      if (tfW[j] == false) {
        continue;
      }
      if (ma[i][j]) {
        cout << '#';
      }
      else {
        cout << '.';
      }
    }
    cout << endl;
  }
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define EPS (1e-7)
#define INF (1e9)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
const double PI = acos(-1);
const ll MOD = 1000000007;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
 
template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
///////////////////////////////////////////////////////////////
 
int main() {
  ios::sync_with_stdio(false); cin.tie(nullptr); //入出力高速化
  int N; cin >> N;
  string s; cin >> s;

  vector<vector<char>> A(N+2, vector<char>(4));
  rep(i,N) {
    if (i == 0) {
      if (s[i] == 'o') {
        A[0][0] = A[1][0] = A[2][0] = A[1][1] = A[0][2] = A[2][3] = 'S';
        A[0][1] = A[2][1] = A[1][2] = A[2][2] = A[0][3] = A[1][3] = 'W';
      } else {
        A[0][0] = A[1][0] = A[2][0] = A[1][1] = A[0][2] = A[2][3] = 'W';
        A[0][1] = A[2][1] = A[1][2] = A[2][2] = A[0][3] = A[1][3] = 'S';
      }
    } else {
      if (s[i] == 'o') {
        rep(j,4) {
          if (A[i][j] == 'S' && A[i+1][j] == 'S') A[i+2][j] = 'S';
          if (A[i][j] == 'S' && A[i+1][j] == 'W') A[i+2][j] = 'W';
          if (A[i][j] == 'W' && A[i+1][j] == 'S') A[i+2][j] = 'W';
          if (A[i][j] == 'W' && A[i+1][j] == 'W') A[i+2][j] = 'S';
        } 
      } else {
        rep(j,4) {
          if (A[i][j] == 'S' && A[i+1][j] == 'S') A[i+2][j] = 'W';
          if (A[i][j] == 'S' && A[i+1][j] == 'W') A[i+2][j] = 'S';
          if (A[i][j] == 'W' && A[i+1][j] == 'S') A[i+2][j] = 'S';
          if (A[i][j] == 'W' && A[i+1][j] == 'W') A[i+2][j] = 'W';
        }
      }
    }
  }
  
  int k = -1;
  rep(j,4) {
    if (A[N][j] == A[0][j] && A[N+1][j] == A[1][j]) {
      k = j;
      break;
    } 
  }

  if (k == -1) cout << k << endl;
  else {
    for (int i = 1; i < N+1; i++) cout << A[i][k];
    cout << endl;
  }
}

Measured memory_bytes: 5968
#include<cstdio>
#include<vector>
#include<iostream>
#include<algorithm>
#include<map>
#include<queue>
#define MAX_N 400
using namespace std;
typedef pair<int,int> P; // first = 距離 , second = 頂点の番号
struct edge {
  int to;
  int cost;
};
vector<edge> G[MAX_N + 1]; // データ
int d[MAX_N+1];
void dijkstra(int s);
int n,m;
int main(){
  edge d1,d2;
  int a,b,c;
  cin >> n >> m;
  for(int i=0;i<m;i++){
    cin >> a >> b >> c;
    d1.to = a;
    d2.to = b;
    d2.cost = c;
    G[d1.to].push_back( d2 );
  }
  dijkstra( 0 );
  cout << d[n-1] << endl;
}
void dijkstra(int s){
  priority_queue<P> que;
  fill( d , d + n , -1 );
  d[s] = 0;
  que.push(P(0,s));
  
  while(!que.empty()){
    P p = que.top();que.pop();
    int v = p.second;
    if(d[v] > p.first)continue;
    for(int i=0;i<G[v].size();i++){
      edge e = G[v][i];
      if(d[e.to] < d[v] + e.cost){
	d[e.to] = d[v] + e.cost;
	que.push(P(d[e.to],e.to));
      }
    }
  }
}

Measured memory_bytes: 1240
#include<bits/stdc++.h>
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
using namespace  std ;
typedef long l ;
typedef long long ll ;
typedef vector<int>vi ;
typedef vector<l>vl ;
typedef vector<ll>vll ;
typedef vector<vector<ll> >vvl ;
typedef pair<int,int> pii ;
typedef pair<ll,ll> pll ;
long long power(long long k , long long n , long long m=1e9+7)
{
    long long res = 1;
    while(n)
    {
        if(n%2!=0)
        {
            res = (res*k)%m ;
        }
        k = (k*k)%m ;
        n = n/2 ;
    }
    return(res) ;
}
ll nck(ll n , ll k ,ll m=1e9+7)
{
    ll i , j,b=1,c=1 ;
    if(n-k<k)
    {
        k = n-k ;
    }
    while(k)
    {
        b*=n ;
        c*=k ;
        ll g = __gcd(b,c) ;
        b/=g ;
        c/=g ;
        n--;
        k-- ;
    }
    return(b) ;
}
long long fact(long long n , long long m = 1e9+7)
{
    long long a = 1 ;
    if(n==0 || n==1)
    {
        return(1) ;
    }
    while(n>0)
    {
        a = (a%m * n%m)%m ;
        n-- ;
    }
    return(a) ;
}
void READ(vll &v, ll n)
{
    ll a ;
    for(ll i=0 ; i<n ; i=i+1)
    {
        cin>>a ;
        v.pb(a) ;
    }
}
void PRINT(vll &v, ll n)
{
    ll a ;
    for(ll i=0 ; i<n ; i=i+1)
    {
        cout<<v[i]<<" " ;
    }
    cout<<"\n" ;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    std::cout.unsetf ( std::ios::floatfield );//this and next line for floating precision upto 6
    std::cout.precision(10);
    ll a,b,c,d,e,x,i,j,n,t,m,k,y,s;
    double p,q,r,w,u ;
    string str = "",str1 = "" ;
    char ch,chr ;
    ll a1=0,a2=0,b1=0,b2=0 ;
    cin>>n;
    ll dp[n][3];
    vvl v(n);
    memset(dp,0,sizeof(dp));
    for(i=0 ; i<n; i=i+1)
    {
        cin>>a>>b>>c;
        v[i].pb(a);
        v[i].pb(b);
        v[i].pb(c);
    }
    dp[0][0] = v[0][0];
    dp[0][1] = v[0][1];
    dp[0][2] = v[0][2];
    for(i=1 ; i<n ; i=i+1)
    {
        dp[i][0] = v[i][0] + max(dp[i-1][1],dp[i-1][2]);
        dp[i][1] = v[i][1] + max(dp[i-1][0],dp[i-1][2]);
        dp[i][2] = v[i][2] + max(dp[i-1][1],dp[i-1][0]);   
    }
    a = max(dp[n-1][0],dp[n-1][1]);
    a = max(a,dp[n-1][2]);
    cout<<a;
}

Measured memory_bytes: 9600
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-2;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;

int w, h, n;
int x[100], y[100];
int d[100][1001];
struct vertice {
	int id, bl; int cost;
	bool operator<(const vertice &v)const {
		if (v.cost != cost)return cost > v.cost;
		if (v.id != id)return v.id > id;
		else return v.bl > bl;
	}
};
priority_queue<vertice> q;
void init() {
	rep(i, 100) {
		rep(j, 1001) {
			d[i][j] = mod;
		}
	}
}
int main() {
	init();
	cin >> w >> h >> n;
	rep(i, n) {
		cin >> x[i] >> y[i];
	}
	rep(i, n) {
		int z = x[i] - 1 + y[i] - 1;
		q.push({ i,z,z });
		d[i][z] = z;
	}
	int ans = mod;
	//dijkstra
	while (!q.empty()) {
		vertice v = q.top(); q.pop();
		int id = v.id,bl=v.bl,cost=v.cost;
		int dis = h - x[id] + w - y[id];
		ans = min(ans, cost+max(0, dis - bl));
		rep(i, n) {
			if (i == id)continue;
			int dis = abs(x[id] - x[i]) + abs(y[id] - y[i]);
			dis = max(0, dis - bl-1);
			if (d[i][dis] > cost + dis) {
				d[i][dis] = cost + dis;
				q.push({ i,dis,cost + dis });
			}
		}
	}
	cout << ans << endl;
	//stop
	return 0;
}



Measured memory_bytes: 4284
//C++14 (Clang 3.8.0)

#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <string>
#define rp(i,a,b) for(int (i)=(int)(a);i<(int)(b);++i)

using namespace std;

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



int dx[]={1,-1,4,-4};
string ini="01234567";

map<string,int> maps;
set <string> sets;
int bfs(){
    queue<string> que;
    que.push(ini);
    maps[ini]=0;
    sets.insert(ini);
    while(que.size()){
        string p=que.front();que.pop();
        int zero;
        rp(j,0,8) {if(p[j]=='0') {zero=j;break;}}
        rp(j,0,4){
            int pl=zero+dx[j];
            string ns(p);
            bool flag=true;
            if(zero==3 and j==0) flag=false;
            if(zero==4 and j==1) flag=false;
            if(0<=pl and pl<=7 and flag) {
                ns[zero]=p[pl];
                ns[pl]='0';
            
                if(sets.find(ns)==sets.end()) {
                    que.push(ns);
                    sets.insert(ns);
                    maps[ns]=maps[p]+1;
                }
                
            }
        }
    }
}



int main(){
    bfs();
    string s;
    stringstream ss;
    string c;
    while(getline(cin,s)){
        if (s.size()==0) break;
        string c="01234567";
        rp(i,0,8) c[i]=s[i*2];
        cout<<maps[c]<<endl;

    }
        return 0;
};

Measured memory_bytes: 7300
#include <iostream>
#include <cmath>
#include <cassert>
#include <vector>

using ll = long long;
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
#define MAX(a, b) (((a) < (b)) ? (b) : (a))

class Dsu{
public:
  std::vector<int> mult;
  std::vector<int> sz;
  Dsu(int n) {
    mult.resize(1 + n);
    sz.resize(1 + n);
    for(int i = 1;i <= n; i++){
      mult[i] = i;
      sz[i] = 1;
    }
  }
  int jump(int gala) {
    if(gala != mult[gala])
      mult[gala] = jump(mult[gala]);
    return mult[gala];
  }
  void unite(int a, int b) {
    a = jump(a);
    b = jump(b);
    if(a == b)
      return ;
    if(sz[b] < sz[a])
      std::swap(a, b);
    sz[b] += sz[a];
    mult[a] = b;
  }
  int _count(int n){
    int result = 0;
    for(int i = 1;i <= n; i++)
      if(mult[i] == i)
        result++;
    return result;
  }
};

int main() {
  ll n, m, q;
  std::cin >> n >> m >> q;
  std::vector<std::pair<int,int>> cond[2];

  for(int i = 1;i <= q; i++) {
    int x, y, k;
    std::cin >> x >> y >> k;
    ++x;
    ++y;
    cond[k].push_back({x, y});
  }
  Dsu dsu(n);
  for(int i = 0; i < cond[0].size(); i++){
    int x = cond[0][i].first;
    int y = cond[0][i].second;
    dsu.unite(x, y);
  }
  int comp = dsu._count(n);
  m -= (n - 1);
  if(m <= 1LL * comp * (comp - 1) / 2 - (comp - 1)){
    if(0 < cond[1].size()) {
      if(0 == m || comp <= 2) {
        std::cout << "No";
        return 0;
      } else {
        for(int i = 0; i < cond[1].size(); i++) {
          int x = cond[1][i].first, y = cond[1][i].second;
          if(dsu.jump(x) == dsu.jump(y)) {
            std::cout << "No";
            return 0;
          }
        }
        std::cout << "Yes";
      }
    } else
      std::cout << "Yes";
  } else
    std::cout << "No";
  return 0;
}


Measured memory_bytes: 4768
using System;

namespace v0_0008
{
    class Program
    {
        static void Main(string[] args)
        {
            string line;
            while (!string.IsNullOrEmpty(line = Console.ReadLine()))
            {
                int n = int.Parse(line);
                int count = 0;
                for (int a = 0; a < 10; a++)
                {
                    if ((n - a) > 27) { continue; }
                    for (int b = 0; b < 10; b++)
                    {
                        for (int c = 0; c < 10; c++)
                        {
                            if (((n - (a + b + c)) >= 0) && ((n - (a + b + c)) < 10)) { count++; }
                        }
                    }
                }
                Console.WriteLine(count);
            }
        }
    }
}

Measured memory_bytes: 8872
hw=input().split()
h=int(hw[0])
w=int(hw[1])
mx=[1,1,0,-1,-1,-1,0,1]
my=[0,1,1,1,0,-1,-1,-1]
grid=[]
for t in range(h):
	row=list(input())
	grid.append(row)
for i in range(w):
	for j in range(h):
		if grid[j][i]==".":
			ctr=0
			for k in range(8):
				adx=i+mx[k]
				ady=j+my[k]
				if adx>=0 and adx<w and ady>=0 and ady<h:
					if grid[ady][adx]=="#":
						ctr+=1
			grid[j][i]=str(ctr)
for l in range(h):
    print(''.join(grid[l]))

Measured memory_bytes: 3188
#include<iostream>
#include<algorithm>
#include<math.h>

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


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

    bool takawin = true;

    while(true) {
        C -= B;
        if (C <= 0) {
            takawin = true;
            break;
        }
        A -= D;
        if (A <= 0) {
            takawin = false;
            break;
        }
    }

    if (takawin) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 3672
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
using namespace std;
const int MAX = 100000;

int main() {
    int N;
    int A[MAX];
    int S = 0;
    int S2 = 0;

    cin >> N;
    for (int i = 0; i < N; i++) {
        cin >> A[i];
        S += A[i];
        if (i % 2 != 0) S2 += A[i];
    }

    int x = S - 2 * S2;
    cout << x;
    for (int i = 0; i < N - 1; i++) {
        x = 2 * A[i] - x;
        cout << " " << x;
    }
    cout << endl;

    

    return 0;
}

Measured memory_bytes: 1664
N, Y = map( int, input().split() )

ans = [0]*3
isDiscovered = False

for i in range( Y//10000+1 ):
    a = Y - 10000*i
    for j in range( a//5000+1 ):
        b = (a - 5000*j) / 1000
        if( b.is_integer() and i + j + b == N ):
            ans[0] = i
            ans[1] = j
            ans[2] = int(b)
            isDiscovered = True
            break
    if isDiscovered: break

if sum(ans) == 0: print( '-1 -1 -1' ) 
else: print( str(ans[0]) + ' ' + str(ans[1]) + ' ' + str(ans[2]) )

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

#define rep(i, n) for(int i = 0; i<(n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
using ll = long long;

// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1000000007;

struct mint {
    ll x; // typedef long long ll;
    mint(ll x = 0) : x((x % mod + mod) % mod) {}

    mint operator-() const { return mint(-x); }

    mint &operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }

    mint &operator-=(const mint a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }

    mint &operator*=(const mint a) {
        (x *= a.x) %= mod;
        return *this;
    }

    mint operator+(const mint a) const {
        mint res(*this);
        return res += a;
    }

    mint operator-(const mint a) const {
        mint res(*this);
        return res -= a;
    }

    mint operator*(const mint a) const {
        mint res(*this);
        return res *= a;
    }

    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const {
        return pow(mod - 2);
    }

    mint &operator/=(const mint a) {
        return (*this) *= a.inv();
    }

    mint operator/(const mint a) const {
        mint res(*this);
        return res /= a;
    }
};

int bit_count(int bits) {
    int cnt = 0;
    for (; bits != 0; bits >>= 1) {
        cnt += bits & 1;
    }
    return cnt;
}

int A[21][21];
mint dp[22][1 << 21];

int main() {
    int N;
    cin >> N;
    rep(i, N) rep(j, N) cin >> A[i][j];

    dp[0][0] = 1; // dp[i][j] 男性i番目までマッチング済,集合jのbitが立っている女性がマッチング済
    rep(i, N) {
        rep(bit, 1 << N) {
            if (i != bit_count(bit)) continue; // 男性マッチング数=女性マッチング数(bitが立ってる数) が不一致の状態は無効なのでスキップ
            rep(j, N) { // j番目の女性とマッチングできるか試す
                int flg = 1 << j;
                if (!(bit & flg) && A[i][j]) dp[i + 1][bit | flg] += dp[i][bit];
            }
        }
    }

    cout << dp[N][(1 << N) - 1].x << endl;
}

Measured memory_bytes: 360704
#include<bits/stdc++.h>
using namespace std;
#define sync ios_base::sync_with_stdio(false), cin.tie(NULL)
#define F first
#define S second
#define pb emplace_back
#define mt make_tuple
#define gcd __gcd
#define PI 3.141592653589
// Input
#define in(a) scanf("%d",&a)
#define in2(a,b) scanf("%d%d",&a,&b)
#define in3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define llin(a) cin >> a
#define inl(a) scanf("%lld",&a)
#define read(v,i,n) for(i=0;i<n;i++)in(v[i])
#define twod(mat,i,j,n,m) rep(i,n){rep(j,m)in(mat[i][j]);}
#define sc(ch) scanf("%c",&ch)
#define sstr(str) scanf("%s",str)
// Output
#define pr(a) printf("%d ",a)
#define pr2(a,b) printf("%d %d\n",a,b)
#define pr3(a,b,c) printf("%d %d %d\n",a,b,c)
#define out(a) printf("%d\n",a)
#define outl(a) printf("%lld\n",a)
#define llpr(a) cout << a << " "
#define llout(a) cout << a << "\n"
#define yes printf("YES\n")
#define no printf("NO\n")
#define lin printf("\n")
// Iterator
#define lp(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) for(i=0;i<n;i++)
#define all(vec) vec.begin(),vec.end()
#define lower(v,k) lower_bound(v.begin(),v.end(),k)-v.begin()
#define upper(v,k) upper_bound(v.begin(),v.end(),k)-v.begin()
#define tf(mytuple) get<0>(mytuple)
#define ts(mytuple) get<1>(mytuple)
#define tt(mytuple) get<2>(mytuple)
// Debug
#define dbg(v,i,n) for(i=0;i<n;i++)pr(v[i]); lin
#define what(x) cerr << #x << " : " << x << "\n"
#define ck printf("continue\n")
#define debug(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args)
{
	cerr << *it << " = " << a << "\n";
	err(++it, args...);
}
// Data Type
#define ll long long int
#define ii pair<int,int>
#define pli pair<ll,int>
#define triple tuple<int,int,int>
#define vi vector<int>
#define vii vector<pair<int,int> >
#define vvi vector<vector<int> >
#define viii vector<pair<pair<int,int>,int> >
#define vvii vector<vector<pair<int,int> > >
#define M 1000000007
#define N 100005  //check the limits, man
int main()
{
    int n;
    ll ans;
    in(n);
    ans=n,ans*=(n-1);
    llout(ans/2);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for (int i=0;i<(n);i++)
#define FOR(i,s,e) for (int i=s;i<(e);i++)
#define All(v) (v).begin(),(v).end()
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define int long long
using namespace std;
typedef long long llint;
typedef pair<int, int> P;
const int MOD = (int)1e9 + 7;
const int INF = (int)1e18 * 5;

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

    string a, b;
    cin >> a >> b;
    a += b;
    double x = sqrt(stoi(a));
    x /= (int)x;
    puts(x == 1 ? "Yes" : "No");
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>

int main(){
int a,b;
scanf("%d %d", &a,&b);
if (a<b) printf("%c < %c\n",'a','b');
if (a>b) printf("%c > %c\n",'a','b');
if (a==b) printf("%c == %c\n",'a','b');

return 0;
}





Measured memory_bytes: 2736
# AOJ 2805: Tournament
# Python3 2018.7.11 bal4u

def calc(l, n):
	if n == 2:
		if a[l] and a[l+1]: return [0, True]
		if a[l] or a[l+1]: return [0, False]
		return [1, False]
	m = n >> 1
	c1, f1 = calc(l, m)
	c2, f2 = calc(l+m, m)
	if f1 and f2: return [c1+c2, True]
	if f1 or f2: return [c1+c2, False]
	return [c1+c2+1, False]

N, M = map(int, input().split())
if M == 0: print(N-1)
else:
	a = [False]*256
	for i in range(M): a[int(input())] = True
	print(calc(0, N)[0])


Measured memory_bytes: 5600
#include<bits/stdc++.h>
#define mp(a,b) make_pair(a,b)
#define pb push_back
#define ppb pop_back
using namespace std;
typedef long long int ll;
int  main(){
	ll n;
	cin>>n;
	vector<ll>v(n);
	for(int i=0;i<n;i++){
		cin>>v[i];
	}
	ll mi=v[0],c=1;
	for(int i=1;i<n;i++){
		mi=min(mi,v[i]);
		if(v[i]<=mi){
			c++;
		}
	}
	cout<<c<<endl;
}

Measured memory_bytes: 1792
#include <iostream>
#include <math.h>
using namespace std;

int main()
{
    long long int t,x,y,num,flag = 0;
    double dis;
    cin>>t>>num;
    for(int i =1 ; i<=t; i++){
        cin>>x>>y;
        dis = (double)sqrt((x*x)+(y*y));
        if(dis<=num){
            flag++;
        }
    }
    cout << flag << endl;
    return 0;
}


Measured memory_bytes: 3652
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstdlib>
#include<cstring>
using namespace std;
inline int read()
{
	int x=0,f=1;char ch=getchar();
	while(ch<'0' || ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0' && ch<='9')x=x*10+ch-'0',ch=getchar();
	return x*f;
}
int stack[20];
inline void write(int x)
{
	if(x<0){putchar('-');x=-x;}
	if(!x){putchar('0');return;}
	int top=0;
	while(x)stack[++top]=x%10,x/=10;
	while(top)putchar(stack[top--]+'0');
}
inline void pr1(int x){write(x),putchar(' ');}
inline void pr2(int x){write(x),puts("");}
const int mod=998244353;
inline int ad(int x){return x>=mod?x-mod:x;}
inline int dec(int x){return x<0?x+mod:x;}
char ss[15];
int n,m,a[15][15],row[15],col[15];
inline bool pd(int x,int y)
{
	if(x==0 && y==0)return true;
	if(x==0 || y==0)return false;
	for(int i=0;i<n;i++)if(x>>i&1 && ((row[i]&y)==y || (row[i]&y)==0))return false;
	for(int i=0;i<m;i++)if(y>>i&1 && ((col[i]&x)==x || (col[i]&x)==0))return false;
	return true;
}
int C[15][15],f[15][15][3],g[15][15][3];
int main()
{
	//freopen("a.in","r",stdin);
	//freopen("a.out","w",stdout);
	for(int i=0;i<=10;i++)
	{
		C[i][0]=1;
		for(int j=1;j<=i;j++)C[i][j]=ad(C[i-1][j]+C[i-1][j-1]);
	}
	n=read(),m=read();
	for(int i=0;i<n;i++)
	{
		scanf("%s",ss);
		for(int j=0;j<m;j++)a[i][j]=ss[j]=='.';
	}
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<m;j++)row[i]+=a[i][j]<<j;
	}
	for(int i=0;i<m;i++)
	{
		for(int j=0;j<n;j++)col[i]+=a[j][i]<<j;
	}
	for(int i=0;i<m;i++)f[0][i][2]=1<<i;
	f[n][m][0]=1<<m;
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<m;j++)
		{
			for(int k=1;k<n-i;k++)
			{
				g[i+k][j][1]=ad(g[i+k][j][1]+1LL*ad(f[i][j][1]+ad(f[i][j][2]*2))*C[k+i][i]%mod);
				g[i+k][j][2]=ad(g[i+k][j][2]+1LL*f[i][j][2]*dec((1<<k)-2)%mod*C[k+i][i]%mod);
			}
			g[n][m][0]=ad(g[n][m][0]+1LL*f[i][j][2]*dec((1<<(n-i))-2)%mod*C[n][i]%mod*C[m][j]%mod);
			for(int k=1;k<m-j;k++)
			{
				f[i][j+k][1]=ad(f[i][j+k][1]+1LL*ad(g[i][j][1]+ad(g[i][j][2]*2))*C[k+j][j]%mod);
				f[i][j+k][2]=ad(f[i][j+k][2]+1LL*g[i][j][2]*dec((1<<k)-2)%mod*C[k+j][j]%mod);
			}
			f[n][m][0]=ad(f[n][m][0]+1LL*g[i][j][2]*dec((1<<(m-j))-2)%mod*C[m][j]%mod*C[n][i]%mod);
		}
	}
	int ans=0;
	for(int i=0;i<(1<<n);i++)
	{
		for(int j=0;j<(1<<m);j++)
		{
			if(pd(i,j)==false)continue;
			int x=n,y=m;
			for(int k=0;k<n;k++)if(i>>k&1)x--;
			for(int k=0;k<m;k++)if(j>>k&1)y--;
			for(int k=0;k<3;k++)ans=ad(ans+ad(f[x][y][k]+g[x][y][k]));
		}
	}pr2(ans);
	return 0;
}




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

#define pb push_back
#define ll long long
#define maxn 300005
#define fr(i,j,k) for(int i=j;i<k;i++)
#define f(n) fr(i,0,n)
#define f1(n) fr(i,1,n+1)
#define ms(i) memset(i,0,sizeof(i));
#define ms1(i) memset(i,-1,sizeof(i));
#define bg begin()
#define ed end()
#define pii pair<int,int>
const ll mod = 1e9+7;
int main(){
	int n,m;
	while(cin >> n >> m){
		ll dp[n+5] = {1};
		set<int>st;
		f(m){
			int add;
			cin >> add;
			st.insert(add);
		}
		f1(n){
			if(st.find(i)!=st.end()){
				dp[i] = 0;
			}
			else{
				dp[i] = dp[i-1];
				if(i>=2) dp[i]+=dp[i-2];
			}
			dp[i] %= mod;
		}
		cout << dp[n] << endl;
	}
}

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

// 総数を1000000007（素数）で割った余り
const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

bool g[8][8];

int dfs(int v, int n, vector<bool> visited) {
    bool all_visited = true;
    rep(i, n) {
        if (!visited[i]) all_visited = false;
    }
    if (all_visited) return 1;
    int ret = 0;
    rep(i, n) {
        if (!g[v][i]) continue;
        if (visited[i]) continue;
        visited[i] = true;
        ret += dfs(i, n, visited);
        visited[i] = false;
    }
    return ret;
}

int main(){
    int n, m;
    cin >> n >> m;
    rep(i, m) {
        int a, b;
        cin >> a >> b;
        --a; --b;
        g[a][b] = true;
        g[b][a] = true;
    }
    vector<bool> visited(n, false);
    visited[0] = true;
    cout << dfs(0, n, visited) << endl;
    return 0;
}


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

int main() {
    int N, K;
  
  cin >> N >> K;
  
    long long int a[100010];
  
   long long int s[100010]={0}, t[100010]={0};
    for (int i = 0; i < N; ++i) {
        cin >> a[i];
      
        s[i+1] = s[i] + a[i];
        t[i+1] = t[i] + (a[i] >= 0 ? a[i] : 0);
    }
  
    long long res = -1e18;
    for (int i = 0; i + K <= N; ++i) {
        int left = i, right = i + K;
      
        long long tmp = (t[left] - t[0]) + max(0LL, s[right] - s[left]) + (t[N] - t[right]);
        res = max(res, tmp);
    }
    cout << res << endl;
}


Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
struct _IO{_IO(){ios::sync_with_stdio(0);cin.tie(0);}}_io;
typedef long long ll; typedef long double db;
const int N = 3e5 + 5, M = 1e9 + 7;

ll dp[50][1 << 20];
ll qpow(ll x, ll n) {
  ll res = 1;
  for (; n; n >>= 1, x = x * x % M) if (n & 1) res = res * x % M;
  return res;
}
int main() {
  int n, x, y, z;
  cin >> n >> x >> y >> z;
  int mask = (1 << z - 1) | (1 << z + y - 1) | (1 << z + y + x - 1);
  int S = (1 << x + y + z) - 1;
  dp[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= S; j++) {
      if (!dp[i-1][j]) continue;
      for (int k = 1; k <= 10; k++) {
        int cur = ((j << k) | (1 << k - 1)) & S;
        if ((cur & mask) == mask) continue;
        dp[i][cur] = (dp[i][cur] + dp[i-1][j]) % M;
      }
    }
  }
  int ans = 0;
  for (int i = 0; i <= S; i++) {
    ans = (ans + dp[n][i]) % M;
  }
  cout << ((qpow(10, n) - ans) % M + M) % M;
}


Measured memory_bytes: 41104