akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
//long long int h[200000],d[200000];
//int i,n,m,j,k,l=0;
long long int a[200000];
int main()
{
    long long  int i,n,m,j,k=0,l;
    scanf("%lld",&n);
    for(i=1;i<=n;i++)
    {
        scanf("%lld",&a[i]);
    }
    sort(a+1,a+1+n);
    while(k!=-1)
    {
        if(a[n]==n-1)
        {
            printf("%lld",k);
            break;
        }
        l=a[n]/n;
        a[n]%=n;
        for(i=1;i<n;i++)
        {
            a[i]+=l;
        }
        k+=l;
        sort(a+1,a+1+n);
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define endl '\n'

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    string s;
    cin >> s;

    int flag = 0;

    for(int i = 0; i < s.size(); i++)
    {
        if(s[i] == 'L')
        {
            if((i + 1) % 2 != 0)
            {
                flag = 1;
                break;
            }
        }
        if(s[i] == 'R')
        {
            if((i + 1) % 2 == 0)
            {
                flag = 1;
                break;
            }
        }
    }

    if(flag) { cout << "No" << endl; }
    else { cout << "Yes" << endl; }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
typedef long double ld;
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define mod 1000000007
#define inf 1000000000000000000
#define bpc(x) __builtin_popcountll(x)
#define autoit(x,it) for(auto it = x.begin(); it != x.end(); it++)
#define rep(n) for(ll i = 0; i < n; i++)
#define repi(i,n) for(ll i = 0; i < n; i++)

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 

#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 

using namespace std;

ll n,m;
ll get(ll i, ll j)
{
    return i*m+j;
}

bool vx(ll x)
{
    if(x>-1 && x<n)
        return 1;
    return 0;    
}

bool vy(ll y)
{
    if(y>-1 && y<m)
        return 1;
    return 0;    
}

ll dijk(vector<pair<ll,ll>> v[], ll n, ll x, ll y)
{
    set<pair<ll,ll>> st;
    vector<ll> dis(n,inf);
    
    st.insert(mp(0,x));
    dis[x] = 0;
    
    while(st.size() > 0)
    {
        ll temp = st.begin()->second;
        st.erase(st.begin());
        
        for(auto it = v[temp].begin();it!=v[temp].end();it++)
        {
            ll v1 = it->first;
            ll wt = it->second;
            
            if(dis[v1]>dis[temp] + wt)
            {
                dis[v1] = dis[temp] + wt;
                st.insert(mp(dis[v1],v1));
            }
        }
    }
    
    return dis[y];
}

int main()
{
  FAST/**/
   
   cin>>n>>m;
   ll x1,x2,y1,y2;
   cin>>x1>>y1>>x2>>y2;
   x1--,y1--,x2--,y2--;
   
   string arr[n];
   rep(n)
        cin>>arr[i];
   
   vector<pair<ll,ll>> gr[n*m];
   
   for(ll i=0;i<n;i++)
   {
       for(ll j=0;j<m;j++)
       {
           if(arr[i][j] == '#')
                continue;
           for(ll dx=-2;dx<=2;dx++)
           {
               for(ll dy=-2;dy<=2;dy++)
               {
                   if(abs(dx)+abs(dy) == 0)
                        continue;
                   ll cst = 1ll;    
                   if(abs(dx) + abs(dy) == 1)
                        cst = 0ll;
                   if(vx(dx+i) && vy(dy+j) && arr[dx+i][dy+j] == '.')
                   {
                       gr[get(i,j)].pb(mp(get(dx+i,dy+j),cst));
                       gr[get(i+dx,j+dy)].pb(mp(get(i,j),cst));
                   }
               }
           }
       }
   }
   
   ll ans = dijk(gr,n*m,get(x1,y1),get(x2,y2));
   if(ans == inf)
        ans = -1;
   cout<<ans;        
   
   
   return 0;        
}  

  
          
   

Measured memory_bytes: 291648
#include <bits/stdc++.h>
const int INF = 1e9;
const int MODk = 1e9+7;
using LL = long long;
const LL LINF = 1e18;
const double EPS = 1e-10;
using namespace std;
class Edge{
public:
    int from,to,value;
    Edge(LL a,LL b,LL c){
        from = a;
        to = b;
        value = c;
    }
    Edge(LL a,LL b){
        from = a;
        to = b;
    }
};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    string str;
    cin >> str;
    if(count(str.begin(),str.end(), 'x') >= 8){
        cout<<"NO"<<endl;
    }else{
        cout<<"YES"<<endl;
    }

}


Measured memory_bytes: 256
#include <stdlib.h>
#include <iostream>
#include <list>
using namespace std;

void insertion_sort(int *array, int n, int g, int &cnt);
void shell_sort(int *array, int n);
void print_array(int *array, int size);
int main(){
	int n;

	cin >> n;

	int* array = (int*)malloc(n * sizeof(int));

	if(n < 1){
		return 0;
	}

	for(int i = 0; i < n; i++){
		cin >> array[i];
	}
	shell_sort(array, n);
	return 0;
}
void insertion_sort(int *array, int n, int g, int &cnt){
	//g???????????????
	for(int i = g; i < n; i++){
		int v = array[i];
		int j = i - g;
		//g??¢???????????°?????????????????\?????????i=4g?????¨??????4g??¨3g 3g??¨2g 2g??¨g g??¨0
		while(j >= 0 && array[j] > v){
			array[j+g] = array[j];
			j -= g;
			++cnt;
		}
		array[j+g] = v;
	}
}

void shell_sort(int *array, int n){
	int* G = (int*)malloc(n * sizeof(int));
	int g = 1;
	int m = 0;
	int cnt = 0;
	do{
		G[m] = g;
		++m;
		g *= 3;
		g += 1;
	}
	while(g < n);
	
	for(int i = 0; i < m - i; ++i){
		swap(G[i], G[m-i-1]);
	}
	for(int i = 0; i < m; ++i){
		insertion_sort(array, n, G[i], cnt);
	}
	cout << m << endl;
	print_array(G, m);
	cout << cnt << endl;
	for(int i = 0; i < n; ++i){
		cout << array[i] << endl;
	}

}

void print_array(int *array, int size){
	for(int i = 0; i < size; i++){
		cout <<  array[i];
		if(i != size - 1){
		cout << " " ;
		}
	}
	cout << endl;
}

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

const int mod = 1000000007;

int main()
{
    int n;
    std::cin >> n;

    std::vector<std::string> s(2);
    for (int i = 0; i < 2; i++) {
        std::cin >> s[i];
    }

    long long count = 3;

    int ptr;
    int num_vertical_sequence = 0;
    int num_horizontal_sequence = 0;
    if (s[0][0] == s[1][0]) {
        num_vertical_sequence++;
        ptr = 1;
    } else {
        num_horizontal_sequence++;
        ptr = 2;
        count *= 2;
    }

    while (ptr < n) {
        if (s[0][ptr] == s[1][ptr]) {
            ptr++;
            if (num_vertical_sequence) {
                count *= 2;
                count %= mod;
            }
            num_vertical_sequence++;
            num_horizontal_sequence = 0;
        } else {
            ptr += 2;
            if (num_horizontal_sequence) {
                count *= 3;
            } else {
                count *= 2;
            }
            count %= mod;

            num_horizontal_sequence++;
            num_vertical_sequence = 0;
        }
    }

    std::cout << count << std::endl;
}


Measured memory_bytes: 384
{-# LANGUAGE BangPatterns #-}

module Main where

import Data.Char
import Data.List
import Control.Monad
import Control.Applicative


readInt :: IO Int
readInt = read <$> (input `seq` input)
    where input = do
            !c <- getChar
            if isDigit c || c == '-'
                then (c :) <$> input
                else return []

prints :: Show a => [a] -> IO ()
prints as = putStrLn $ concat $ intersperse " " $ map show as

main = print . f =<< replicateM 3 readInt

f [a,b,c] = length $ filter (\x -> c `mod` x == 0) [a..b]


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

int h, w, n, res = 0, cnt = 0;

int main() {
  cin >> h >> w >> n;
  while(res < n) {
    res += max(h, w);
    ++cnt;
  }

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

Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;

namespace Contest
{
    

    class Program
    {
        
        static void Main(string[] args)
        {
            int[] number = new int[1000001];
            bool[] furui = new bool[1000001];
            var n = int.Parse(Console.ReadLine());
            var nums = Console.ReadLine().Split(" ")
                .Select(x => int.Parse(x))
                .OrderBy(x => x).ToArray();
            
            for(int i = 0; i < number.Length; i++)
            {
                number[i] = 0;
                
            }
            for (int i = 0; i < n; i++)
            {
                number[nums[i]]++;

            }

            if (nums.Count() == 0)
            {
                Console.WriteLine(0);
                return;
            }

            int ans = 0;
            for(int i = 0; i < n; i++)
            {
                //number[nums[i]]++;
                // 倍数だったら入れない
                if (furui[nums[i]])
                {
                    continue;
                } else
                {
                    if (number[nums[i]] == 1) ans++;

                    for(int j = nums[i]; j < furui.Length; j += nums[i])
                    {
                        furui[j] = true;
                    }
                }
            }

            Console.WriteLine(ans);
        }
    }
}




Measured memory_bytes: 53184
import java.util.ArrayDeque;
import java.util.Queue;
import java.util.Scanner;

public class Main{

	public static String[][] maze;
	public static boolean[][] visit;
	public static int width;
	public static int height;

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		while (true) {
			String[] str = s.nextLine().split(" ");
			if (Integer.parseInt(str[0]) == 0 && Integer.parseInt(str[1]) == 0)
				break;
			width = Integer.parseInt(str[0]);
			height = Integer.parseInt(str[1]);
			maze = new String[2 * width - 1][2 * height - 1];
			visit = new boolean[2 * width - 1][2 * height - 1];
			for (int i = 0; i < (2 * height - 1); i++) {
				String line = s.nextLine();
				for (int j = 0; j < line.length(); j++) {
					String c = line.substring(j, j + 1);
					if (c != " ")
						maze[j][i] = c;
					else
						maze[j][i] = "";
				}
			}
			System.out.println(solve());
		}
	}

	public static int solve() {
		Queue<int[]> queue = new ArrayDeque<int[]>();
		int[] a = new int[3];
		queue.add(a);
		visit[0][0] = true;
		while (!queue.isEmpty()) {
			int[] current = queue.poll();
			if (current[0] == 2 * width - 2 && current[1] == 2 * height - 2)
				return ++current[2];
			if (current[0] < 2 * width - 2) {
				if (Integer.parseInt(maze[current[0] + 1][current[1]]) != 1
						&& !visit[current[0] + 2][current[1]]) {
					int[] p = new int[3];
					p[0] = current[0] + 2;
					p[1] = current[1];
					p[2] = current[2] + 1;
					queue.add(p);
					visit[current[0] + 2][current[1]] = true;
				}
			}
			if (current[1] < 2 * height - 2) {
				if (Integer.parseInt(maze[current[0]][current[1] + 1]) != 1
						&& !visit[current[0]][current[1] + 2]) {
					int[] p = new int[3];
					p[0] = current[0];
					p[1] = current[1] + 2;
					p[2] = current[2] + 1;
					queue.add(p);
					visit[current[0]][current[1] + 2] = true;
				}
			}
			if (current[1] > 0) {
				if (Integer.parseInt(maze[current[0]][current[1] - 1]) != 1
						&& !visit[current[0]][current[1] - 2]) {
					int[] p = new int[3];
					p[0] = current[0];
					p[1] = current[1] - 2;
					p[2] = current[2] + 1;
					queue.add(p);
					visit[current[0]][current[1] - 2] = true;
				}
			}
			if (current[0] > 0) {
				if (Integer.parseInt(maze[current[0]-1][current[1]]) != 1
						&& !visit[current[0]-2][current[1]]) {
					int[] p = new int[3];
					p[0] = current[0] - 2;
					p[1] = current[1];
					p[2] = current[2] + 1;
					queue.add(p);
					visit[current[0] - 2][current[1]] = true;
				}
			}
		}
		return 0;
	}
}

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

int main() {
	int n;
	cin >> n;
	
	if(n % 10 != 0) {
		int sum = 0;
		while (n > 0) {
			sum += n % 10;
			n /= 10;
		}
		cout << sum << endl;
	}
	else cout << 10 << endl;
}

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

int n, m, q;
vector<int> a, b, c, d;
int ans;

void dfs(vector<int> A) {
    if (A.size() == n+1) {
        int now = 0;
        rep(i, q) {
            if (A[b[i]] - A[a[i]] == c[i]) now += d[i];
        }
        ans = max(ans, now);
        return;
    }
    A.push_back(A.back());
    while (A.back() <= m) {
        dfs(A);
        A.back()++;
    }

}

int main() {
    cin >> n >> m >> q;
    a = b = c = d = vector<int>(q);
    rep(i, q) {
        cin >> a[i] >> b[i] >> c[i] >> d[i];
    }
    dfs(vector<int>(1, 1));
    cout << ans << endl;

    return 0;
}

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

int main(){
    
    int n;
    cin >> n;
    
    if(n%2){
        double ans = (n/2 + 1)/(double)n;
        printf("%0.10lf\n", ans);
    }else{
        double ans = 0.5;
        printf("%0.10f\n", ans);
    }

    return 0;
    
    
}


Measured memory_bytes: 3740
def main():
    import bisect
    n = int(input())
    a_lis = list(map(int, input().split()))
    b_lis = list(map(int, input().split()))
    c_lis = list(map(int, input().split()))
    a_lis.sort()
    b_lis.sort()
    c_lis.sort()
    cnt = 0

    for b in b_lis:
        a = bisect.bisect_left(a_lis, b)
        c = n - bisect.bisect_right(c_lis, b)
        cnt += a * c

    print(cnt)
        


    


if __name__ == "__main__":
    main()

Measured memory_bytes: 22720
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <unordered_map>
constexpr int MOD = 1000000000 + 7;
constexpr int INF = 2000000000;
using namespace std;
using LL = long long;

struct Rectangle { int height; int pos; };

int getLargestRectangle(int size, int buffer[]) {
	stack<Rectangle> S;
	int maxv = 0;
	buffer[size] = 0;
	for (int i = 0; i <= size; i++) {
		Rectangle rect;
		rect.height = buffer[i];
		rect.pos = i;
		if (S.empty()) {
			S.push(rect);
		}
		else {
			if (S.top().height < rect.height)S.push(rect);
			else if (S.top().height > rect.height) {
				int target = i;
				while (!S.empty() && S.top().height >= rect.height) {
					Rectangle pre = S.top();
					S.pop();
					int area = pre.height*(i - pre.pos);
					maxv = max(maxv, area);
					target = pre.pos;
				}
				rect.pos = target;
				S.push(rect);
			}
		}
	}
	return maxv;
}

int H, W;
int Buffer[1400][1400];
int T[1400][1400];

int getLargestRectangle() {
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			if (Buffer[i][j]) {
				T[i][j] = 0;
			}
			else {
				T[i][j] = (i > 0) ? T[i - 1][j] + 1 : 1;
			}
		}
	}
	int maxv = 0;
	for (int i = 0; i < H; i++) {
		maxv = max(maxv, getLargestRectangle(W, T[i]));
	}
	return maxv;
}

int main() {
	cin >> H >> W;
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			cin >> Buffer[i][j];
		}
	}
	cout << getLargestRectangle() << endl;
}

Measured memory_bytes: 18388
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>

using namespace std;

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

vector<P> company[1000010];
vector<int> edge[400010];
vector<int> edge2[100010];
int check[100010];
queue<int> que;
int cost[400010];

void bfs(){
    while(!que.empty()){
        int v = que.front();
        que.pop();
        for(int i = 0; i < edge[v].size(); i++){
            int v2 = edge[v][i];
            if(cost[v2] > cost[v]+1){
                cost[v2] = cost[v]+1;
                que.push(v2);
            }
        }
    }
}

void dfs(int cur, int v, int id){
    if(check[v] == cur) return;
    check[v] = cur;
    edge[v].push_back(id);
    edge[id].push_back(v);
    for(int i = 0; i < edge2[v].size(); i++){
        dfs(cur, edge2[v][i], id);
    }
}

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

    for(int i = 0; i < M; i++){
        int p, q, c;  cin >> p >> q >> c;
        p--; q--; c--;
        company[c].emplace_back(p, q);
    }

    int id = N;
    fill(check, check+N, -1);
    for(int i = 0; i < 1000010; i++){
        if(company[i].size() == 0)  continue;
        vector<int> V;

        for(int j = 0; j < company[i].size(); j++){
            P e = company[i][j];
            edge2[e.first].push_back(e.second);
            edge2[e.second].push_back(e.first);
            V.push_back(e.first);
            V.push_back(e.second);
        }

        for(int j = 0; j < V.size(); j++){
            int v = V[j];
            if(check[v] == i) continue;
            dfs(i, v, id);
            id++;
        }
        for(int j = 0; j < company[i].size(); j++){
            P e = company[i][j];
            edge2[e.first].clear();
            edge2[e.second].clear();
        }
    }


    for(int i = 0; i < id; i++){
        cost[i] = 100000000;
    }
    cost[0] = 0;
    que.push(0);
    bfs();

    if(cost[N-1] == 100000000){
        cout << -1 << endl;
    }
    else{
        cout << cost[N-1]/2 << endl;
    }

    return 0;
}


Measured memory_bytes: 56064
import java.util.*;
import java.lang.*;

public class Main{
    public static void main(String[]args){
	int ans=0;
	
        Scanner sc = new Scanner(System.in);
	int N=sc.nextInt();
	int a[]=new int[N];
	int b[]=new int[N];
	a[0]=sc.nextInt();
	b[0]=a[0];
	long a_sum=a[0];
	long b_sum=b[0];
	
	for(int i=1; i<N; i++){
	    a[i]=sc.nextInt();
	    a_sum+=a[i];
	    b[i]=a[i];
	    if(b[i]<b[i-1]){
		b[i]=b[i-1];
	    }
	    b_sum+=b[i];
	}
	
	System.out.println(b_sum-a_sum);
	
    }
}


Measured memory_bytes: 60992
#include <stdio.h>

int main(void)
{
	double v;
	
	while (scanf("%lf", &v) != EOF){
		double t = v / 9.8;
		double y = 4.9 * t * t;
		int i;
		
		for (i = 1; (i - 1) * 5 < y; i++);
		printf("%d\n", i);
	}
	
	return 0;
}

Measured memory_bytes: 624
#include <iostream>
#include <cmath>

using namespace std;

int main()
{
    int a, b, c, d, e, f; cin >> a >> b >> c >> d >> e >> f;

    int i = 0, j = 0;
    float ret = -1;
    int maxX = 0;
    int maxY = 0;

    float x = 0;
    float y = 0;

    for (int i = 0; i < 30; i++) {
        for (int j = 0; j < 30; j++) {

            x = 100 * a * i + 200 * b * j;
            if (x > f) break;

            for (int k = 0; ; k++) {
                if (x + c * k > f) break;

                for (int l = 0; ; l++) {
                    y  = c * k + d * l;
                    if (x + y > f) break;

                    if (x != 0 && (100 * y) / x <= e) {
                        if (ret < (100 * y) / (x + y)) {
                            ret = (100 * y) / (x + y);
                            maxX = x;
                            maxY = y;
                        }
                    }                   
                }
            }
        }
    }

    cout << (maxX + maxY) << " " << maxY << endl;

    return 0;
}

Measured memory_bytes: 888
#include <bits/stdc++.h>
#include <vector>
 
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 main() {
 
 	int n;
 	cin >> n;

 	string ans = "bon";

 	switch(n % 10) {
 		case 2:
 		case 4:
 		case 5:
 		case 7:
 		case 9:
 			ans = "hon";
 			break;

 		case 0:
 		case 1:
 		case 6:
 		case 8:
 			ans = "pon";
 			break;
 	}

 	cout << ans << endl;

}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
#define cout16 cout << setprecision(16) 
#define rep(i,n) for(int i=0;i<n;i++ )
#define rep2(i,f,n) for(int i=f;i<n;i++ )
#define SORT(A) sort(A.begin(),A.end())
#define REV(A) reverse(A.begin(),A.end())
typedef long long int ll;
using vi = std::vector<int>;
using vvi = std::vector<std::vector<int>>;
using vll = std::vector<ll>;
using vvll = std::vector<std::vector<ll>>;
using P = std::pair<int,int>;
using vp = std::vector<P>;
using namespace std;
#define INF 1001001001
#define LL_INF 1001001001001001001
#define fi first
#define se second

int main(void) {
	int n,m,c; cin >> n >> m >> c;
	vi b(m); rep(j,m) cin >> b[j];
	vvi a(n,vi(m));
	rep(i,n)rep(j,m) cin >> a[i][j];
	int ans = 0;
	rep(i,n){
		int x = 0;
		rep(j,m) x += a[i][j]*b[j];
		x += c;
		if(x>0) ans++;
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
s = input()
k = int(input())
prev1 = ""
prev2 = s[0]
a = 0
b = 0
flag = False
flag2 = False
for i, c in enumerate(s):
    if c == prev1:
        a += 1
        prev1 = ""
    else:
        prev1 = c
        if i == len(s)-1 and c == s[0]:
            flag = True
    if c == prev2:
        b += 1
        prev2 = ""
    else:
        prev2 = c
        if i == len(s)-1 and c == s[0]:
            flag2 = True

ans = 0
if flag:
    if flag2:
        ans = a + b*(k-1)
    else:
        ans = a*((k+1)//2) + b*(k-(k+1)//2)
else:
    ans = k*a
print(ans)

Measured memory_bytes: 38384
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

#define YES(n) cout << (n?"YES":"NO")<<endl;
#define Yes(n) cout << (n?"Yes":"No")<<endl;

int main() {
    string S;
    cin >> S;
    int cou = 0;
    for (int i = 0; i < S.size(); i++) {
        if (S[i] == '1') {
            cou++;
        }
    }
    cout << cou << endl;
}

Measured memory_bytes: 256
import java.util.*;

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

    int n = sc.nextInt();
    int l = sc.nextInt();
    
    String[] s = new String[n];
    for (int i = 0; i < n; i++) {
      s[i] = sc.next();
    }

    Arrays.sort(s);

    for (int i = 0; i < n; i++) {
      System.out.print(s[i]);
    }
    System.out.println();
  }
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
/*cout<<setprecision(5)<<ret<<endl;で、数字部分を計5桁表示かつゼロ埋め無*/
/*cout<<fixed<<setprecision(5)<<ret<<endlで、小数部のみ5桁表示かつゼロ埋め有*/
using namespace std;

typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
/* [Shift+Command+b]（コンパイル）ー＞[Ctrl+Shift+`]（ターミナル起動）ー＞[./a.out] */

//////////////////
//  A
/*int main(void){
    int a,b;cin>>a>>b;
    double c=(double)(a+b)/2.0;
    if(c==(a+b)/2) cout<<(int)c<<endl;
    else cout<<"IMPOSSIBLE"<<endl;

    return 0;
}*/
//////////////////
//  B
int main(void){
    int n;cin>>n;
    vector<int> v(n),w(n);
    rep(i,n){ cin>>v[i]; w[i]=v[i];}

    sort(v.begin(),v.end());
    int cnt=0;
    rep(i,n){
        if(v[i]!=w[i]){
            cnt++;
        }
    }
    if(cnt==0 || cnt==2) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
    return 0;
}
//////////////////
//  C 
/*int main(void){

    return 0;
}*/
//////////////////
//  D
/*int main(void){

    return 0;
}*/


Measured memory_bytes: 3628
n,m = (int(i) for i in input().split())
a = [int(i) for i in input().split()]
par,rank,b,t = [i for i in range(n)],[0 for i in range(n)],[],n-m-1
def root(x):
	if par[x]!=x: par[x] = root(par[x])
	return par[x]
def unite(x,y):
	x2,y2 = root(x),root(y)
	if x2!=y2:
		if rank[x2]<rank[y2]: par[x2] = y2
		else: par[y2] = x2
		if rank[x2]==rank[y2]: rank[x2]+=1
for _ in range(m):
	x,y = (int(i) for i in input().split())
	unite(x,y)
for i in range(n): par[i] = root(par[i])
if n<2*t: ans = "Impossible"
elif t==0: ans = 0
else:
	for i in range(n): b.append((a[i],par[i]))
	ans,b,v,w = 0,sorted(b),[1]*n,n-m-2
	for i,j in b:
		if v[j]: v[j],ans = 0,ans+i
		elif w: w,ans = w-1,ans+i
print(ans)

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

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

    string s, t;
    while (cin >> s >> t) {
        int l = s.length(), ans = 0;
        for (int i = 0; i < l; i++)
            if (s[i] != t[i])
                ++ans;
        cout << ans << '\n';
    }
    return 0;
}


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

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

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

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

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

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

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

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

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

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

fn main() {
    input! {
        a: i64,
        b: i64,
        c: i64,
    }

    let ans = a == b && a == c;

    println!("{}", if ans { "Yes" } else { "No" });
}


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

class _C
{
	void _()
	{

		var n = _Ns();

		var N = n[0];
		var M = n[1];

		var b = new int[N];
		for (var i = 0;i<N; i++) {
			b[i]=1;
		}

		var f = new HashSet<int>();
		f.Add(0);

		for (int i=0; i<M;i++) {
			var t = _Ns();
			var x = t[0];
			var y = t[1];

			//
			b[x-1]-=1;

			//
			b[y-1]+=1;

			if (f.Contains(x - 1))
				if (!f.Contains(y - 1))
					f.Add(y - 1);

			if (b[x - 1] == 0)
				if (f.Contains(x - 1))
					f.Remove(x - 1);




		}
		Console.WriteLine(f.Count);
		
	}

	static void Main(string[] args)
  {
    new _C()._();
  }

  #region

  string _S()
  {
    return Console.ReadLine();
  }

  string[] _Ss()
  {
    return Console.ReadLine().Split();
  }

  int[] _N(int n)
  {
    var x = new int[n];
    for (var i = 0; i < n; i++)
    {
      x[i] = int.Parse(Console.ReadLine());
    }
    return x;
  }

  int[] _Ns()
  {
    var ss = Console.ReadLine().Split();

    var x = new int[ss.Length];
    for (var i = 0; i < ss.Length; i++)
      x[i] = int.Parse(ss[i]);

    return x;
  }
  #endregion
}

Measured memory_bytes: 11560
from collections import deque
N,X,Y = map(int,input().split())

G = [[] for i in range(N)]
for i in range(N):
    if i == X-1:
        G[i].append(Y-1)
    if i == Y-1:
        G[i].append(X-1)

    if i == 0:
        G[i].append(1)
    elif i == N-1:
        G[i].append(N-2)
    else:
        G[i].append(i+1)
        G[i].append(i-1)

ans = [0]*(N-1)
for s in range(N):
    dist = [-1]*N
    q = deque([])
    q.append(s)
    dist[s] = 0

    while len(q) != 0:
        v = q.popleft()
        for nv in G[v]:
            if dist[nv] != -1:
                continue
            dist[nv] = dist[v] + 1
            q.append(nv)
    for d in dist:
        if d != 0:
            ans[d-1] += 1

for i in range(N-1):
    print(ans[i]//2)






Measured memory_bytes: 48220
#include <bits/stdc++.h>
using namespace std;
#define all(arr) arr.begin(), arr.end() 
#define IOS ios_base::sync_with_stdio(0); cin.tie(); cout.tie();
#define ff first
#define ss second
#define pb push_back
#define debug(val) cerr << "The value of " << #val << " is = " << val << '\n';
typedef long long ll;
typedef unsigned long long ull;
const ll mod = 1e9 + 7;
const ll inf = 0x3f3f3f3f;
const ll mininf = -922337203685477;
const ll nax = 0;
bool yah=0;
int n, l[200005], ans=0;

int main(){
	IOS
	cin >> n;
	for(int i=0;i<n;i++){
		cin >> l[i];
	}
	int curr=1;
	for(int i=0;i<n;i++){
		if(l[i]!=curr){
			ans++;
		}
		else{
			yah=1;
			curr++;
		}
	}
	if(!yah){
		cout << -1 << '\n'; return 0;
	}
	cout << ans << '\n';
}


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

#define MAX 100001
int score[MAX];

int main(){
	int n,k,q;	cin>>n>>k>>q;
	for(int i=0; i<q; i++){
		int a;	cin>>a;
		score[a]++;
	}

	for(int i=1; i<=n; i++){
		if(k-q+score[i]>0) cout<<"Yes"<<endl;
		else cout<<"No"<<endl;
	}



	return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <cstdio>
#include <algorithm>
#include <cassert>
#include <utility>
#include <string>
#include <cmath>
#include <unordered_set>
#include <map>
#include <random>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; ++i)
typedef long long ll;
typedef pair<int,int> pii;

int main(){
    int k,t;
    cin  >> k >> t;
    vector<int>a(t);
    rep(i,t){
        cin >> a[i];
    }
    cout << max(0,*max_element(a.begin(),a.end())*2 -k-1) << endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using static System.Console;
using static System.Math;

namespace Atcoder
{
    class Program
    {
        static StreamWriter sw = new StreamWriter(OpenStandardOutput()) { AutoFlush = false };
        static void Main(string[] args)
        {
            try
            {
                SetOut(sw);
                Solve.Answer();
                Out.Flush();
            }
            catch (Exception ex)
            {
                WriteLine(ex.ToString());
                Out.Flush();
            }
        }
    }

    public class Solve
    {
        public static void Answer()
        {
            var k = IO.RLong;
            long num = 0;
            for (int i = 0; i <= k; i++)
            {
                num = (num * 10) % k;
                num = (num + 7) % k;
                if (num == 0)
                {
                    WriteLine(i + 1);
                    return;
                }
            }
            WriteLine(-1);
        }
    }

    public class IO
    {
        #region Input
        public static int RInt => int.Parse(ReadLine());
        public static long RLong => long.Parse(ReadLine());
        public static double RDouble => double.Parse(ReadLine());

        public static string[] RSString => ReadLine().Split();
        public static int[] RSInt => ReadLine().Split().Select(s => int.Parse(s)).ToArray();
        public static long[] RSLong => ReadLine().Split().Select(s => long.Parse(s)).ToArray();
        public static double[] RSDouble => ReadLine().Split().Select(s => double.Parse(s)).ToArray();
        #endregion

        #region Output
        public static void OutJoinSpace<T>(IEnumerable<T> list) => WriteLine(string.Join(" ", list));
        public static void WriteLineYes_or_No(bool flag) => WriteLine(flag ? "Yes" : "No");
        public static void WriteLineYES_or_NO(bool flag) => WriteLine(flag ? "YES" : "NO");
        #endregion
    }

    public class Mod
    {
        #region
        private readonly static long M = 1000000007;

        public static long Add(long a, long b) => (a * b) % M;
        public static long Sub(long a, long b) => (a - b) % M >= 0 ? (a - b) % M : (a - b) % M + M;
        public static long Multi(long a, long b) => (a * b) % M;
        #endregion
    }
}

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

int main(){
  int N;
  cin >> N;
  
  vector<int> vec(N);
  for(int i =0; i<N; i++){
    vec.at(i)=i+1;
  }

  vector<int> vex(N);
  for(int i=0; i<N; i++){
    cin >> vex.at(i);
  }
  
  int ans;
  ans = 0;
  
  for(int i=0; i<N; i++){
    if(vec.at(i)==vex.at(i)){
      ans = ans+1;
    }
  }

  if(ans == N or ans == N-2){
    cout << "YES" << endl;
  }
  else{
    cout << "NO" << endl;
  }
  
}

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

int main(void){
  int n, temp;
  cin >> n;
  map<int, int> m;
  for(int i = 0; i < n; i++){
    cin >> temp;
    m[temp]++;
  }
  int ans = 0;
  for(auto i = m.begin(); i != m.end(); i++){
    if(i->second % 2 == 1) ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 4864
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <functional>
#include <algorithm>

using namespace std;

#define rep(i,j) REP((i), 0, (j))
#define REP(i,j,k) for(int i=(j);(i)<(k);++i)
#define BW(a,x,b) ((a)<=(x)&&(x)<=(b))
#define ALL(v) (v).begin(), (v).end()
#define LENGTHOF(x) (sizeof(x) / sizeof(*(x)))
#define AFILL(a, b) fill((int*)a, (int*)(a + LENGTHOF(a)), b)
#define SQ(x) ((x)*(x))
#define Mod(x, mod) (((x)+(mod)%(mod))
#define MP make_pair
#define PB push_back
#define Fi first
#define Se second
#define INF (1<<29)
#define EPS 1e-10
#define MOD 1000000007

string S;
int f[26];
int Ssize;

inline string parse(string s, int b)
{
  rep(i, Ssize){
    if((b>>i)&1/* && s[i] < 'z'*/){
      ++s[i];
    }
  }
  return s;
}

inline int C(string s)
{
  memset(f, 0, sizeof(f));
  rep(i, Ssize){
    if(!f[s[i]-'a'] && 'a' < s[i]){
      f[s[i]-'a'] = 1;
      --s[i];
    }
  }
  return s == S;
}

int main()
{
  while(cin >> S, S != "#"){
    Ssize = S.size();
    //    set<string>Se;
    vector<string>Se;
    int ret = 0;
    int bitset = 0;
    rep(i, Ssize){
      if(S[i] == 'z') bitset |= 1<<i;
    }
    rep(i, 1<<Ssize){
      if(i&bitset) continue;
      string s = parse(S, i);
      if(C(s)){
	//	Se.insert(s);
	Se.push_back(s);
      }
    }

    sort(Se.begin(), Se.end());
    //    Se.erase(unique(Se.begin(), Se.end()), Se.end());    
    int Sesize = Se.size();
    cout << Sesize << endl;
    if(Sesize < 10){
      for(auto s: Se)
	cout << s << endl;
    }else{
      auto it = Se.begin();
      rep(i, 5){
	cout << *it << endl;
	it++;
      }
      it = Se.end();
      rep(i, 5) it--;
      rep(i, 5){
	cout << *it << endl;
	it++;
      }
    }
  }
  return 0;
}

Measured memory_bytes: 4180
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<string>
#define rep(i,N) for(int i=0;i<N;i++)

long long  INF=1000000000000000000;
long long mod=1000000007;
using namespace std;

int main(){
int a,b,c;
cin>>a>>b>>c;
int d;
cin>>d;

string ans="No";
if(abs(a-c)<=d)ans="Yes";

if(abs(a-b)<=d && abs(c-b)<=d)ans="Yes";

cout<<ans<<endl;
 return 0;
}
/*
4 7 9 3

Yes

100 10 1 2

No


10 10 10 1

Yes


1 100 2 10

Yes
*/

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
 
int main() {
  ios::sync_with_stdio(0); 
  cin.tie(0); 

  ll n; cin >> n;
  ll low = 1, high = n;

  ll res = 1;
  while (low <= high) {
    ll mid = low + (high - low) / 2;
    ll x = mid * mid;

    if (x > n) {
      high = mid - 1;
    } else {
      res = max(res, x);
      low = mid + 1;
    }
  }

  cout << res << "\n";
}


Measured memory_bytes: 3652
package main

import (
	"fmt"
)

func main() {
	var s string
	fmt.Scan(&s)
	a, z := -1, -1
	for i := 0; i < len(s); i++ {
		if a == -1 && s[i] == 'A' {
			a = i
		}
		if s[i] == 'Z' {
			z = i
		}
	}
	fmt.Println(z - a + 1)
}


Measured memory_bytes: 1920
#include<bits/stdc++.h>
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3f
#define EPS (1e-10)
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
typedef pair<int, int>P;

bool is_prime[1000001];
int t[1500][1500], dp[1500][1500];
int dx[]{ 1,0,-1,0 }, dy[]{ 0,1,0,-1 };

int main() {
	memset(is_prime, 1, sizeof(is_prime));
	is_prime[0] = is_prime[1] = false;
	for (int i = 2; i <= 1000000; i++) {
		if (is_prime[i]) {
			for (int j = i * 2; j <= 1000000; j += i)is_prime[j] = false;
		}
	}
	int m, n;
	while (scanf("%d%d", &m, &n), m) {
		memset(dp, 0, sizeof(dp));
		memset(t, 0, sizeof(t));
		int sx, sy, x = 750, y = 750, id = 0;
		for (int i = 1; i <= m; i++) {
			t[x][y] = i;
			if (i == n)sx = x, sy = y;
			int nx = x + dx[(id + 1) % 4], ny = y + dy[(id + 1) % 4];
			if (!t[nx][ny]) {
				(id += 1) %= 4; x = nx; y = ny;
			}
			else x += dx[id], y += dy[id];
		}
		int Max = 0; id = 0;
		if (is_prime[n])dp[sx][sy] = 1;
		for (int i = sx; i < 1400; i++) {
			for (int j = sy - (i - sx); j <= sy + (i - sx); j++) {
				if (Max < dp[i][j] && is_prime[t[i][j]]) {
					Max = dp[i][j]; id = t[i][j];
				}
				else if (Max == dp[i][j] && is_prime[t[i][j]]) {
					id = max(id, t[i][j]);
				}
				for (int k = j - 1; k <= j + 1; k++) {
					if (is_prime[t[i + 1][k]])dp[i + 1][k] = max(dp[i + 1][k], dp[i][j] + 1);
					else dp[i + 1][k] = max(dp[i + 1][k], dp[i][j]);
				}
			}
		}
		if (Max == 0)puts("0 0");
		else printf("%d %d\n", Max, id);
	}
}

Measured memory_bytes: 21772
macro_rules! scan_sub {
    ( $itr:ident, $t:ty ) => {
        let mut buf = String::new();
        let $itr = {
            while buf.trim().len() == 0 {
                buf = String::new();
                std::io::stdin().read_line(&mut buf).unwrap();
            }
            buf.split_whitespace().map(|n| n.parse::<$t>().unwrap())
        };
    };
}

macro_rules! scan {
    ( $x:ident; Vec<$t:ty> ) => {
        scan_sub!(itr, $t);
        let $x = itr.collect::<Vec<_>>();
    };
    ( $( $x:ident ),*; $t:ty ) => {
        scan_sub!(itr, $t);
        let mut itr = itr;
        $(
            let $x = itr.next().unwrap();
        )*
    };
}

fn table(dp: &mut Vec<usize>, skills: &Vec<(usize, usize)>, h: i64) -> usize {
    if h <= 0 { return 0; }
    let hu = h as usize;
    if dp[hu] > 0 { return dp[hu]; }

    dp[hu] = skills.iter().map(|&(a, b)| {
        table(dp, skills, h-a as i64) + b
    }).min().unwrap();

    dp[hu]
}

fn main() {
    scan!(h, n; usize);
    let skills = (0..n).map(|_| {
        scan!(a, b; usize);
        (a, b)
    }).collect::<Vec<_>>();

    let mut dp = vec![0; h+1];

    println!("{}", table(&mut dp, &skills, h as i64));
}


Measured memory_bytes: 4988
/*
...........__________    							 |										    ___  __
.............|       |     						     |											 |   /
.............|       |     						     |									  		 |  /
.............|       |                               |                         __                | /      _______
.............|_______|  _______            _______   |______   ________   /|  /  |               |/       |      |
.............| \               | |      | |          |      |          | / | /   |               |\       |
.............|  \       _______| |      | |_______   |      |   _______|   |/    |               | \      |
.............|   \      |      | |      |         |  |      |  |       |   |     |               |  \     |
.........  __|    \__|  |______| |______| ________|  |      |_ |_______|   |     |__|           _|   \__ _|        .

*/
#include<bits/stdc++.h>
using namespace std ;
#define int 				long long
#define ull 				unsigned long long int
#define ld 					long double
#define vi 					vector<int>
#define vii 				vector<pair<int,int>>
#define vvi 				vector<vector<int>>
#define pf 					push_front
#define popb 				pop_back
#define pb 					push_back
#define eb 					emplace_back
#define pii 				pair<int,int>
#define prec(x) 			fixed<<setprecision(15)<<x
#define all(x) 				x.begin(),x.end()
#define rall(x) 			x.rbegin(),x.rend()
#define mset(a,b) 			memset(a,b,sizeof(a))
#define mcpy(a,b) 			memcpy(a,b,sizeof(a))
#define fo0(i,n) 			for(int i=0,i##end=n;i<i##end;i++)
#define fo1(i,n) 			for(int i=1,i##end=n;i<=i##end;i++)
#define fo(i,a,b) 			for(int i=a,i##end=b;i<=i##end;i++)
#define foe(i,x)			for(__typeof((x).end())i=(x).begin();i!=(x).end();++i)
#define fre(i,x)			for(__typeof((x).rend())i=(x).rbegin();i!=(x).rend();++i)
#define fast ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0)
#define inf 1e18
const int mod=1e9+7;
const int N=4e5+10;

void raushan_kumar(){
	int n;cin>>n;
	int a[n];
	set<int> s;
	fo0(i,n){
		cin>>a[i];
		s.insert(a[i]);
	}
	if(s.size()==n){
		cout<<"YES";
	}
	else
		cout<<"NO";
}

int32_t main()
{
	
	fast;int t=1;
	//cin>>t;
	while(t--){
		raushan_kumar();
	}

}

Measured memory_bytes: 11264
n, k = gets.split().map(&:to_i)
numbers = [*0..n]
min = numbers[0, k].inject(&:+)
max = numbers.reverse.slice(0, k).inject(:+)
ans = (max - min + 1)

(k+1..n+1).each do |i|
  min += numbers[i-1]
  max += numbers[-i]
  ans += (max - min + 1)
end

puts ans % (10**9 + 7)

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

int main(){
	int x,y,amari=1,a,ans;
	cin>>x>>y;
	a=min(x,y);
	x=max(x,y);
	y=a;
	while(amari){
		amari=x%y;
		x=y;
		y=amari;
	}
	cout<<x<<endl;
	return 0;
}

Measured memory_bytes: 1160
import sys
input = sys.stdin.readline


N = int(input())
lst_A = [int(input()) for _ in range(N)]
srt_A = sorted(lst_A, reverse=True)
m1 = srt_A[0]
m2 = srt_A[1]


for v in lst_A:
    print(m2 if v == m1 else m1)

Measured memory_bytes: 59344
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <regex>
#define rep(i,n) for(int i = 0; i < n; i++)
#define reps(i,j,n) for(int i = j; i < n; i++)
#define rrep(i,j,n) for(int i = j-1; i >= n; i--)
#define prec(n) fixed << setprecision(n)
#define print_array(v) rep(__k, v.size()) { cout << v[__k]; if(__k != v.size()-1) cout << " "; else cout << endl; }
#define YesorNo(a) printf(a?"Yes\n":"No\n")
#define fi first
#define se second
using namespace std;

int inf = 2147483647;
int64_t inf64 = 9223372036854775807;
int MOD = 1e+7;

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

  int a, b;
  cin >> a >> b;
  if(a <= 0 && 0 <= b) cout << "Zero" << endl;
  else if(a > 0 && b > 0) cout << "Positive" << endl;
  else if(a < 0 && b < 0) {
    if((b-a+1) % 2 == 0) cout << "Positive" << endl;
    if((b-a+1) % 2 == 1) cout << "Negative" << endl;
  }
  return 0;
}

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

const int MOD = 1000000007;
const int INF = 999999999;

int main(){
    int N;
    cin >> N;
    vector<int> a(N);
    rep(i, N){
        cin >> a[i];
    }
    vector<int> colors(9, 0);
    rep(i, N){
        if(a[i] <= 399){
            colors[0]++;
        }else if(a[i] <= 799){
            colors[1]++;
        }else if(a[i] <= 1199){
            colors[2]++;
        }else if(a[i] <= 1599){
            colors[3]++;
        }else if(a[i] <= 1999){
            colors[4]++;
        }else if(a[i] <= 2399){
            colors[5]++;
        }else if(a[i] <= 2799){
            colors[6]++;
        }else if(a[i] <= 3199){
            colors[7]++;
        }else{
            colors[8]++;
        }
    }
    int gray = 0;
    int red = 0;
    rep(i, 9){
        if(i <= 7){
            if(colors[i] > 0){
                gray++;
            }
        }else{
            red += colors[i];
        }
    }
    if(gray == 0){
        cout << 1 << " " << gray + red << endl;
    }else{
        cout << gray << " " << gray + red << endl;
    }
return 0;}
/**
 * g++ code.cpp
 * ./a.out
 * shift + ctrl + i
**/ 

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<limits>
#include<set>
#include<deque>
#include<queue>
using namespace std;
#define int long  long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
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; }
typedef pair<int, int>P;
const int MOD = 1e9 + 7;
const int INF = 1e10;
const long double PI = (acos(-1));


signed main() {
	int N, H, W;
	cin >> N >> H >> W;
	int ans = 0;
	rep(i, N) {
		int A, B;
		cin >> A >> B;
		if (A >= H && B >= W)ans++;
	}
	cout << ans << endl;
}

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

int main() {
    int n;
    string s, t, ans = "";
    cin >> n >> s >> t;
    rep(i, n) {
        ans += s[i];
        ans += t[i];
    }

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


Measured memory_bytes: 3580
from collections import defaultdict
n = int(input())
a = list(map(int,input().rstrip().split()))
dic = defaultdict(int)
for x in a:
  dic[x-1]+=1
  dic[x]+=1
  dic[x+1]+=1
m=0
for v in dic.values():
  m = max(m,v)   
print(m)
  

Measured memory_bytes: 20040
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
    int n,t,a;
    int h[1005];
    cin>>n>>t>>a;
    for(int i=0;i<n;i++) cin>>h[i];
    int index=0;
    double minh=100005;
    for(int i=0;i<n;i++){
        if(abs(a-(t-h[i]*0.006))<minh){
            index=i;
            minh=abs(a-(t-h[i]*0.006));
        }
    }
    cout<<index+1<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())

using namespace std;
using ll = long long;

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; }
template<class T> inline void dump(vector<T> v) { for (auto& x : v) cerr << x << " "; cerr << endl; }
template<class T> inline void dump(vector<pair<T, T>> v) { for (auto& p : v) cerr << p.first << " " << p.second << endl; }
template<class T> inline void dump(vector<vector<T>> vv) { for (auto& v : vv) {for (auto& x : v) cerr << x << " "; cerr << endl;} }

constexpr int INF = 1e9 + 5;
constexpr long long INFLL = 1LL << 60;
constexpr double eps = (1e-9);

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

  int a, b, q;
  cin >> a >> b >> q;
  vector<ll> s(a), t(b);
  rep(i, a) cin >> s[i];
  rep(i, b) cin >> t[i];

  rep(i, q) {
    ll x;
    cin >> x;
    ll ans = INFLL;
    auto its = lower_bound(ALL(s), x);
    ll es;  // 東で一番近い神社
    if (its == s.end()) es = INFLL;
    else es = *its - x;
    ll ws;         // 西で一番近い神社
    if (es == 0) ws = 0;
    else if (its == s.begin()) ws = INFLL;
    else ws = x - s[its - s.begin() - 1];

    auto itt = lower_bound(ALL(t), x);
    ll et;  // 東で一番近い寺
    if (itt == t.end()) et = INFLL;
    else et = *itt - x;
    ll wt;         // 西で一番近い寺
    if (et == 0) wt = 0;
    else if (itt == t.begin()) wt = INFLL;
    else wt = x - t[itt - t.begin() - 1];

    // cerr << ws << " " << es << "  " << wt << " " << ws << endl;

    // w w: 西の s or t の遠い方
    chmin(ans, max(ws, wt));
    // w e: 西にある s or t と東にある s or t
    chmin(ans, ws * 2 + et);
    chmin(ans, wt * 2 + es);
    // e w: 東にある s or t と西にある s or t
    chmin(ans, ws + et * 2);
    chmin(ans, wt + es * 2);
    // e e: 東の s or t の遠い方
    chmin(ans, max(es, et));

    cout << ans << endl;
  }

  return 0;
}


Measured memory_bytes: 4768