akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

import java.util.InputMismatchException;

public class Main{
    public static void main(String args[]){
        int distance[] = new int[5];
        int limit = 0;
        int flag = 0;

        try{
            Scanner scanner = new Scanner(System.in);
            for(int i = 0; i < distance.length; i++){
                distance[i] = scanner.nextInt();
            }
            limit = scanner.nextInt();
            scanner.close();
        } catch(InputMismatchException e){
            System.out.println(e);
        }

        for(int i = distance.length - 1; i >= 0; i--){
            for(int j = i - 1; j >= 0; j--){
                if(distance[i] - distance[j] > limit){
                    flag = 1;
                }
            }
        }

        if(flag == 1){
            System.out.println(":(");
        }
        else{
            System.out.println("Yay!");
        }
    }
}


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

int main() {
  int a, b;
  cin >> a >> b;
  if (a + b >= 10) {
    cout << "error" << endl;
  } else {
    cout << a + b << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
  
// #define int long long
#define pb push_back
  
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vector<int> > vii;
 
template <class X> void print(X Target){ cout << Target << '\n'; }

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

int w, h;
int xs, ys, xg, yg;
int mp[128][128];
bool check[128][128];

void dfs(int y, int x, int color)
{
  if (x < 1 || x > w || y < 1 || y > h) return;
  if (check[y][x]) return;
  check[y][x] = true;
  for (int i = 0; i < 4; i++){
    if (mp[y + dy[i]][x + dx[i]] == color){
      dfs(y + dy[i], x + dx[i], color);
    }
  }
}

signed main()
{
  ios::sync_with_stdio(false);
  int n;

  while (cin >> w >> h, w || h){
    memset(check, false, sizeof(check));
    memset(mp, 0, sizeof(mp));
    cin >> xs >> ys >> xg >> yg >> n;
    for (int i = 0; i < n; i++){
      int c, d, x, y;
      cin >> c >> d >> x >> y;
      if (d){
        for (int j = 0; j < 4; j++){
          for (int k = 0; k < 2; k++){
            mp[y + j][x + k] = c;
          }
        }
      }
      else {
        for (int j = 0; j < 2; j++){
          for (int k = 0; k < 4; k++){
            mp[y + j][x + k] = c;
          }
        }
      }
    }
    dfs(ys, xs, mp[ys][xs]);
    (check[yg][xg]) ? print("OK") : print("NG");
  }

  return (0);
}

Measured memory_bytes: 1276
using System;
using System.Linq;

namespace ABC152C
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var Ps = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();

            int min = int.MaxValue;
            int max = int.MinValue;
            int ans = 0;
            for (var i = 0; i < N; i++)
            {
                var Pi = Ps[i];
                min = Math.Min(min, Pi);
                max = Math.Max(max, Pi);

                if (Pi <= min)
                {
                    ans++;
                    continue;
                }
                
            }
            Console.WriteLine(ans);
        }
    }
}

Measured memory_bytes: 33500
import java.io.*;
class Main{
	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line = br.readLine();
		String[] menseki = line.split(" ");
		int sum = Integer.parseInt(menseki[0]) * Integer.parseInt(menseki[1]);
		int syu1 = Integer.parseInt(menseki[0]) * 2;
		int syu2 = Integer.parseInt(menseki[1]) * 2;
		int syuLength = syu1 + syu2;
		System.out.println(sum+" "+syuLength);
	}
}

Measured memory_bytes: 24136
n,q = map(int,input().split())

queue = []

for _ in range(n):
    name, time = input().split()
    time = int(time)
    queue.append([name,time])

time = 0
ans = []

while queue:
    tmp = queue.pop(0)
    if tmp[1] > q:
        tmp[1] -= q
        time += q
        queue.append(tmp)
    else:
        time += tmp[1]
        ans.append((tmp[0],time))

for x in ans:
    print(x[0], x[1])


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

using namespace std; 

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef pair<LL, LL> PLL;
typedef vector<PLL> VPLL;
typedef priority_queue<int> PQ_DESC;
typedef priority_queue<int, vector<int>, greater<int>> PQ_ASC;
typedef priority_queue<PII> PQ_DESC_PII;
typedef priority_queue<PII, vector<PII>, greater<PII>> PQ_ASC_PII;

#define ALL(c) (c).begin(),(c).end()
#define PB push_back
#define MP make_pair
#define SORT_ASC(c) sort(ALL(c))
//#define SORT_DESC(c) sort(ALL(c), greater<typeof(*((c).begin()))>())
#define SORT_DESC(c) sort((c).rbegin(),(c).rend())
#define REV(c) reverse((c).begin(), (c).end())
#define SIZE(a) int((a).size())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ROF(i,a,b) for(int i=(b-1);i>=(a);--i)
#define REP(i,n) FOR(i,0,n)
#define PER(i,n) ROF(i,0,n)

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int LARGE_INT = 1e9+100;
const int INF = 2e9+100;
const LL INF_LL = (LL)INF*(LL)INF;
const int MOD = 1e9+7;

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

LL modpow(LL a, LL n) {
    LL res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}

void Main()
{
    int n,m;cin>>n>>m;

    VVL a(8);
    REP(i,n){
        LL x,y,z;cin>>x>>y>>z;

        a[0].PB( x + y + z);
        a[1].PB( x + y - z);
        a[2].PB( x - y + z);
        a[3].PB( x - y - z);
        a[4].PB(-x + y + z);
        a[5].PB(-x + y - z);
        a[6].PB(-x - y + z);
        a[7].PB(-x - y - z);
    }
    REP(i,8){
        SORT_DESC(a[i]);
    }

    LL result = -INF_LL;
    REP(i,8){
        LL t=0;
        REP(j,m){
            t+=a[i][j];
        }
        result = max(result,t);
    }
    cout<<result<<endl;
	return;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
    return 0;
}

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

int compare(const void *a, const void *b){
    return *(int *)a - *(int *)b;
}

int max(int a[],int n){
    qsort(a,n,4,compare);
    return a[n-1];
}
int min(int a[],int n){
    qsort(a,n,4,compare);
    return a[0];
}


int main(void){
    int n,m,i,a;
    scanf("%d%d",&n,&m);
    int l[m],r[m];
    for(i=0;i<m;i++){
        scanf("%d%d",&l[i],&r[i]);
    }
    if(min(r,m) < max(l,m)){
        printf("0\n");
        return 0;
    }
    a = min(r,m) - max(l,m) +1;
    printf("%d\n",a);
    return 0;
}

Measured memory_bytes: 1396
def get_input():
    while True:
        try:
            yield "".join(input())
        
        except EOFError:
            break

if __name__ == "__main__":
    array = list(get_input())
    for i in range(len(array)):
        temp_a,temp_b,temp_c,temp_d,temp_e,temp_f = array[i].split()
        
        a,b,c,d,e,f = int(temp_a),int(temp_b),int(temp_c),int(temp_d),int(temp_e),int(temp_f)
        
        if a!=0:
            if e-b*d/a !=0:
                y = (f-c*d/a)/(e-b*d/a)
                x = (c - b*y)/a
            else:
                print("cannot solve equation")
        else:
            if b!=0:
                y = c/b
                if d!=0:
                    x = (f -e*y)/d
                else:
                    print("cannot solve equation")
                
        
        print("{:.3f} {:.3f}".format(x,y))
       
            
        

Measured memory_bytes: 7720
import java.util.*;

public class Main {
 	public static void main (String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int h = sc.nextInt();
		int w = sc.nextInt();
		char[][] field = new char[h][];
		for (int i = 0; i < h; i++) {
		    field[i] = sc.next().toCharArray();
		}
		int[][] horCount = new int[h][w];
		for (int i = 0; i < h; i++) {
		    int count = 0;
		    for (int j = 0; j < w; j++) {
		        if (field[i][j] == '#') {
		            count = 0;
		        } else {
		            count++;
		        }
		        horCount[i][j] = count;
		    }
		    for (int j = w- 2; j >= 0; j--) {
		        if (horCount[i][j] != 0 && horCount[i][j + 1] != 0) {
		            horCount[i][j] = horCount[i][j + 1];
		        }
		    }
		}
		int[][] verCount = new int[h][w];
		for (int i = 0; i < w; i++) {
		    int count = 0;
		    for (int j = 0; j < h; j++) {
		        if (field[j][i] == '#') {
		            count = 0;
		        } else {
		            count++;
		        }
		        verCount[j][i] = count;
		    }
		    for (int j = h- 2; j >= 0; j--) {
		        if (verCount[j][i] != 0 && verCount[j + 1][i] != 0) {
		            verCount[j][i] = verCount[j + 1][i];
		        }
		    }
		}
		int max = 0;
		for (int i = 0; i < h; i++) {
		    for (int j = 0; j < w; j++) {
		        max = Math.max(horCount[i][j] + verCount[i][j], max);
		    }
		}
		System.out.println(max - 1);
	}
}


Measured memory_bytes: 68936
s = input()
count1 = 0
count2 = 0

for i in range(len(s)):
    if i%2 ==0 and s[i]=='0':
        count1 = count1 +1
    if i%2 ==1 and s[i]=='1':
        count1 = count1+1
    if i%2 ==1 and s[i]=='0':
        count2 = count2 +1
    if i%2 ==0 and s[i]=='1':
        count2 = count2+1

print(min(count1,count2))

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

int main()
{
	size_t N;
	size_t A[2][100];
	std::cin >> N;
	std::fill_n(&A[0][0], 200, 0);

	size_t AS[2] = { 0, 0 };
	for (size_t j = 0; j < 2; ++j)
	{
		for (size_t n = 0; n < N; ++n)
		{
			size_t AT;
			std::cin >> AT;
			A[j][n] = AT;
			AS[j] += AT;
		}
	}

	size_t ma = 0;
	size_t us = 0;
	for (size_t n = 0; n < N; ++n)
	{
		us += A[0][n];
		ma = std::max(ma, us + AS[1]);
		AS[1] -= A[1][n];
	}

	std::cout << ma << std::endl;
	return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <numeric>
#include <vector>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <map>
/*#include <unordered_map>
#include <unordered_set>*/
#include <utility>
using namespace std;
using ll=long long;
#define rep(i,a,b) for(ll i=a;i<b;i++)
/*#define INT(...) int __VA_ARGS__;in(__VA_ARGS__)
#define LL(...) ll __VA_ARGS__;in(__VA_ARGS__)
#define STR(...) string __VA_ARGS__;in(__VA_ARGS__)
#define CHR(...) char __VA_ARGS__;in(__VA_ARGS__)
#define DBL(...) double __VA_ARGS__;in(__VA_ARGS__)
#define vec(type,name,...) vector<type> name(__VA_ARGS__)
#define VEC(type,name,size) vector<type> name(size);in(name)
#define vv(type,name,h,...) vector<vector<type>>name(h,vector<type>(__VA_ARGS__))
#define VV(type,name,h,...) vector<vector<type>>name(h,vector<type>(__VA_ARGS__));in(name)*/
#define YES(x) cout<<(x?"YES":"NO")<<endl;
#define Yes(x) cout<<(x?"Yes":"No")<<endl;
inline constexpr int intpow(ll a,ll b) {if(b==0) return 1;ll ans=intpow(a,b/2); return ans*ans*(b&1?a:1);}
inline ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
inline ll lcm(ll a, ll b) { return a*b / gcd(a, b) ; }
inline ll digitsum(ll x) {ll dig,sum = 0;while (x) {dig = x % 10;sum = sum + dig;x = x / 10;}return sum;}
inline bool prime(ll x) {if(x<2) return 0; if(x<4) return 1; if(!((x%2)&&(x%3))) return 0; for(ll i=5;i*i<x;i+=4-i%6/2) {if(x%i ==0) return 0;} return 1;}
/*template <class Head, class... Tail> inline void in(Head&& head,Tail&&... tail) {cin>>head;in(move(tail)...);}
template <class T> inline bool out(T t){cout<<t<<'\n';return 0;}
template <class T> inline bool out(){cout<<'\n';return 0;}
template <class Head, class... Tail> inline bool out(Head head,Tail... tail){cout<<head<<' ';out(move(tail)...);return 0;}*/
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll LINF=0x1fffffffffffffff;
const int INF=0x3fffffff;
const ll MOD=1000000007;
signed main(){
    ll n;
    cin>>n;
    string s;
    cin>>s;
    ll cnt=0;
    rep(i,0,n){
        if(s[i]=='R') cnt++;
    }
    if(cnt>n-cnt) cout<<"Yes";
    else cout<<"No";
}

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

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            //[summary]C - 100 to 105
            int X = int.Parse(Console.ReadLine());

            if (CanBuy(X))
            {
                Console.WriteLine(1);
            }
            else
            {
                Console.WriteLine(0);
            }
        }

        static bool CanBuy(int X)
        {
            for (int a = 0; a <= 1000; a++)
            {
                if (a * 100 > X)
                {
                    break;
                }
                else
                {
                    int x = X - a * 100;

                    for (int b = 0; b < 1000; b++)
                    {
                        if (b * 101 > x)
                        {
                            break;
                        }
                        else
                        {
                            x -= b * 101;

                            for (int c = 0; c < 1000; c++)
                            {
                                if (c * 102 > x)
                                {
                                    break;
                                }
                                else
                                {
                                    x -= c * 102;

                                    for (int d = 0; d < 1000; d++)
                                    {
                                        if (d * 103 > x)
                                        {
                                            break;
                                        }
                                        else
                                        {
                                            x -= d * 103;

                                            for (int e = 0; e < 1000; e++)
                                            {
                                                if (e * 104 > x)
                                                {
                                                    break;
                                                }
                                                else
                                                {
                                                    x -= e * 104;

                                                    if (x % 105 == 0)
                                                    {
                                                        return true;
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }

            return false;
        }
    }
}

Measured memory_bytes: 13140
import java.io.IOException;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		while (true) {
			int x = scanner.nextInt();
			if (x == 0) {
				break;
			}

			boolean right = false, left = false;
			int num = 0;
			for (int i = 0; i < x; i++) {
				String step = scanner.next();

				if (step.indexOf("l") != -1) {
					if (left) {
						left = false;
					} else {
						left = true;
					}
				} else {
					if (right) {
						right = false;
					} else {
						right = true;
					}
				}

				if (left && right) {
					left = false;
					right = false;
					num++;
				}

			}
			System.out.println(num);
		}

	}

	static int nextInt() {
		int c;
		try {
			c = System.in.read();
			while (c != '-' && (c < '0' || c > '9'))
				c = System.in.read();
			if (c == '-')
				return -nextInt();
			int res = 0;
			while (c >= '0' && c <= '9') {
				res = res * 10 + c - '0';
				c = System.in.read();
			}
			return res;
		} catch (IOException e) {
			e.printStackTrace();
		}
		return -1;
	}

}

Measured memory_bytes: 26936
n, k = map(int, input().split())
p = list(map(int, input().split()))

# ans = 0
# for i in range(n-k+1):
#     e = 0
#     for j in range(k):
#         e += ((1+p[i+j])*p[i+j]/2)/p[i+j]
#     ans = max(ans, e)
# print(ans)

cum = [0]
for i in range(n):
    cum.append(cum[-1] + p[i])

mx = (0, 0)
for i in range(n-k+1):
    idx = i+k-1
    mx = max(mx, (cum[i+k]-cum[i], idx))

ans = 0
for i in range(k):
    ans += ((1+p[mx[1]-i])*p[mx[1]-i]/2)/p[mx[1]-i]
print(ans)

Measured memory_bytes: 76168
#include<bits/stdc++.h>
using namespace std;
typedef long double ld;
const int N=100005;
int n,i;
char c[1000005];
int main()
{
	scanf("%s",c);
	for(i=0;c[i];++i)
		if(c[i]=='?')
			c[i]='D';
	printf("%s",c);
}


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

using namespace std;

void Main() {
    int N;
    cin >> N;
    vector<vector<int>> A(2, vector<int>(N, 0));
    for (int i = 0; i < 2; ++i) {
        for (int j = 0; j < N; ++j) {
            cin >> A[i][j];
        }
    }

    vector<vector<int>> dp(2, vector<int>(N, -1));
    dp[0][0] = A[0][0];
    dp[1][0] = A[0][0] + A[1][0];
    for (int i = 1; i < N; ++i) {
        dp[0][i] = dp[0][i - 1] + A[0][i];
        dp[1][i] = max(dp[1][i - 1], dp[0][i]) + A[1][i];
    }
    cout << dp[1][N - 1] << endl;
}

int main() {
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 3632
#include<cstdio>
#include<cstring>
#include<algorithm>
#define ll long long
using namespace std;
const int N=5010,P=1e9+7;
inline int read(){
	int x=0,f=0,c=getchar();
	for(;c>'9'||c<'0';f=c=='-',c=getchar());
	for(;c>='0'&&c<='9';c=getchar())
	x=(x<<1)+(x<<3)+c-'0';return f?-x:x;
}
inline void write(ll x){
	if(x<0)putchar('-'),x=-x;
	if(x>9)write(x/10);putchar(x%10+'0');
}
int A,B,C,K,ans;
int main(){
	A=read();B=read();C=read();
	K=read();ans=A-B;if(K&1)ans=-ans;
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 128
using System;
using System.Collections.Generic;
using System.Text;
using System.Numerics;
using System.IO;

namespace SolutionCS
{

    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());

            string[] s = Console.ReadLine().Split(' ');
            int c = 0;
            for (int i = 0; i < N; i++)
            {
                if (i+1 != int.Parse(s[i]))
                {
                    c++;
                }
            }

            if ( c > 2 )
            {
                Console.WriteLine("NO");
                return;
            }

            Console.WriteLine("YES");
        }
    }
}


Measured memory_bytes: 13140
#include "bits/stdc++.h"
#include<vector>
#include<iostream>
#include<queue>
#include<algorithm>
#include<map>
#include<set>
#include<iomanip>
#include<assert.h>
#include<unordered_map>
#include<unordered_set>
#include<string>
#include<stack>
#include<complex>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
const ld eps=1e-9;
	
#define WHATS(var)cout<<__LINE__<<' '<<#var<<"="<<var<<endl;
	
template<class S, class T> ostream& operator <<(ostream &os, const pair<S, T> v){
os << "( " << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator <<(ostream &os, const vector<T> &v){
for(int i = 0; i < v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator <<(ostream &os, const vector<vector<T>> &v){
for(int i = 0; i < v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}
template<class T> ostream& operator <<(ostream &os, const vector<set<T>> &v){
for(int i = 0; i < v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}
template<class T> ostream& operator <<(ostream &os, const set<T> &v){
int i=0;
for(auto it:v){
	if(i > 0){os << ' ';}
	os << it;
	i++;
} 
return os;
}
template<class T,class TT> ostream& operator <<(ostream &os, const map<T,TT> &v){
	int i=0;
	for(auto it:v){
		if(i > 0){os << ' ';}
		os << it;
		i++;
	} 
return os;
}
using ll = long long ;


int main(){
	ios::sync_with_stdio(false);
	// int X,Y;cin>>X>>Y;
	// map<int,int>mp;
	// int ans=0;
	// if(X<=3){
	// 	ans+=4-X;
	// }
	// if(Y<=3)ans+=4-Y;
	// if(X==1&&Y==1)ans+=1;
	// cout<<ans*100000<<endl;

	int N;cin>>N;
	vector<ll>vs(N);
	for(int i=0;i<N;++i)cin>>vs[i];
	ll sum=accumulate(vs.begin(),vs.end(),0ll);
	ll asum=0;
	ll answer=1e18;
	for(int i=0;i<N;++i){
		asum+=vs[i];
		ll nanswer=abs(sum-asum*2);
		answer=min(answer,nanswer);
	}
	cout<<answer<<endl;

	return 0;
}

Measured memory_bytes: 1792
#include <iostream>

using namespace std;

char inp[10][10];

void rotate()
{
    char tmp[10][10];

    for (int i = 0; i < 8; i++)
        for (int j = 0; j < 8; j++)
            tmp[i][j] = inp[i][j];

    for (int i = 0; i < 8; i++)
        for (int j = 0; j < 8; j++)
            inp[i][j] = tmp[7 - j][i];
}

int main()
{
    for (int i = 0; i < 8; i++)
        cin >> inp[i];

    for (int i = 1; i <= 3; i++) {
        rotate();
        cout << i * 90 << endl;
        for (int j = 0; j < 8; j++)
            cout << inp[j] << endl;
    }
        
    
    return 0;
}

Measured memory_bytes: 1144
n, sum = map(int, input().split())

for x in range(n+1):
    for y in range(n+1):
        z = n - x - y        
        if 10000 * x + 5000 * y + 1000 * z == sum and z >= 0:
                print("{} {} {}".format(x, y, z))
                exit()

print("{} {} {}".format(-1, -1, -1))

Measured memory_bytes: 3060
#include <iostream>                                             
#include <algorithm>                                            
#include <vector>                                               
#define N 3                                                     
using namespace std;                                            
                                                                
int main() {                                                    
  vector<int> Sort;                                             
  for (int i=0; i<N; i++) {                                     
    int x;                                                      
    cin >> x;                                                   
    Sort.push_back(x);                                          
  }                                                             
  sort(Sort.begin(),Sort.end());                                
  for (int i=0; i<Sort.size(); i++) {                           
    cout << (i==0?"":" ") << Sort[i] << flush;                  
  }                                                             
  cout << endl;                                                 
  return 0;                                                     
}                                                               
                             

Measured memory_bytes: 3012
#ifdef __APPLE__
#include <iostream>
#include <vector>
#include <utility>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <random>
#else
#include <bits/stdc++.h>
#endif

using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define tc(t) for (int tc=1; tc<=t; tc++)
typedef vector<int> VI;
typedef vector<long long int> VLLI;
typedef vector<pair<int, int> > VPI;
typedef long long ll;
typedef pair<int,int> PII;
typedef pair<ll, ll> PLL;
mt19937 mrand(random_device{}()); 
const ll mod=1000000007;
int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll modInverse (ll a) {ll p = mod - 2; return powmod(a, p);}
// head

int main() {
    int n;
    cin >> n;
    unordered_map<string, int> data;
    string str;
    for (int i = 0; i < n; i++) {
        cin >> str;
        data[str]++;
    }
    int max = 0;
    for (auto it = data.begin(); it != data.end(); it++) {
        max = std::max(max, it->second);
    }
    vector<string> ans;
    for (auto it = data.begin(); it != data.end(); it++) {
        if (it->second == max)
            ans.push_back(it->first);
    }
    sort(ans.begin(), ans.end());
    for (auto x : ans)
        cout << x << "\n";
    
}



Measured memory_bytes: 26692
#include <string>
#include <bits/stdc++.h>
#include <stdio.h>
#include<math.h>
#include <ctype.h>
#include <algorithm> // sort
#include <map> // pair
using namespace std;


int main() {
  int a,b;
  cin >> a >> b;
  if(a>8||b>8){
    cout << ":(" << endl;
  }
  else{
    cout <<"Yay!" << endl;
  }
}

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


int main(){
    ll n,k; cin>>n>>k;
    vector<vector<ll>> cnt(4*k+1, vector<ll>(4*k+1,0));
    rep(i,n){
        ll x,y; char c; cin>>x>>y>>c;
        if(c=='W') x+=k;
        x%=(2*k); y%=(2*k);
        cnt[x+k+1][y+k+1]++;
        cnt[x+k+1][y+2*k+1]--;
        cnt[x+2*k+1][y+k+1]--;
        cnt[x+2*k+1][y+2*k+1]++;
    }
    
    rep(i, 4*k+1){
        rep(j, 4*k+1){
            if(j==0) continue;
            cnt[i][j]+=cnt[i][j-1];
        }
    }
    rep(i, 4*k+1){
        rep(j, 4*k+1){
            if(i==0) continue;
            cnt[i][j]+=cnt[i-1][j];
        }
    }
    for(ll i=2*k; i<4*k; i++){
        for(ll j=2*k; j<4*k; j++){
            cnt[i][j]+=cnt[i-2*k][j]+cnt[i][j-2*k]+cnt[i-2*k][j-2*k];
        }
    }
    for(ll i=2*k; i<4*k; i++){
        for(ll j=2*k; j<3*k; j++){
            if(i<3*k) cnt[i][j]+=cnt[i+k][j+k];
            else cnt[i][j]+=cnt[i-k][j+k];
        }
    }
    ll res=0;
    rep(i,2*k){
        rep(j,k){
            chmax(res, cnt[i+2*k][j+2*k]);
        }
    }
    cout<<res<<endl;
    return 0;
}


Measured memory_bytes: 125440
#include<stdio.h>
int main(){
	int n,x,i;
	scanf("%d",&n);
	for(i=1;i<=n;i++){
		if(i%3==0){
			printf(" %d",i);
			continue;
		}
		x=i;
		while(x){
			if(x%10==3){
				printf(" %d",i);
				break;
			}
			x/=10;
		}
	}		
	printf("\n");
	return 0;
}

Measured memory_bytes: 600
#include <iostream>

int main() {
	int W,H,x,y,r;
	std::cin >> W >> H >> x >> y >> r;
	bool x_flg,y_flg;
	
	if(x - r >= 0 & x + r <= W)
		x_flg = true;
	else
		x_flg = false;

	if(y - r >= 0 & y + r <= H)
		y_flg = true;
	else
		y_flg = false;

	if(x_flg & y_flg)
		std::cout << "Yes" << std::endl;
	else
		std::cout << "No" << std::endl;

	return 0;
}




Measured memory_bytes: 3128
#define _CRT_SECURE_NO_WARNINGS

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define all(c) (c).begin(), (c).end()
#define loop(i,a,b) for(int i=a; i<int(b); i++)
#define rep(i,b) loop(i,0,b)
#define each(e,c) for(auto& e:c)
#define iter(it,c) for(auto it=c.begin(); it!=c.end(); ++it)

ll const inf = 1<<28;
double const pi = acos(-1);

int a[1024];
int d[1024*1024];

// 整数二分探索,
// int res=l;
// for(int d=(inf); d; d>>=1) if(res+d <= r && ok(res+d)) res += d;
// すると間違えない. (n回目)
int solve(int n, int k){
    int c=0;
    rep(i,n)loop(j,i,n){
        int s=a[i]+a[j];
        if(s<=k){
            d[c++]=s;
        }
    }

    sort(d,d+c);
    int ans=0;
    rep(i,c){
        int s1=d[i];
        int l=0, r=c;
        int res=l;
        for(int w=1<<22;w;w>>=1){
            bool ok;
            if(res+w>=r) ok=false;
            else{
                int s2=d[res+w];
                ok=(s1+s2<=k);
            }
            if(res+w<r && ok) res+=w;
        }
        ans=max(ans, s1+d[res]);
    }
    return ans;
}

int main(){
    int n,k;
    while(cin>>n>>k && n|k){
        a[0]=0;
        rep(i,n)cin>>a[i+1];
        n++;
        cout << solve(n,k) << endl;
    }
}

Measured memory_bytes: 3140
a, b, m = map(int, input().split())

a_list = list(map(int, input().split()))
b_list = list(map(int, input().split()))

mini = min(a_list) + min(b_list)

c_list = []

for i in range(m):
  a_1, b_1, m_1 = map(int, input().split())
  c_list.append(a_list[a_1 - 1] + b_list[b_1 - 1] - m_1)

c_list.append(mini)

ans = min(c_list)

print(ans)

Measured memory_bytes: 18736
n,x = map(int,input().split())
a = list(map(int,input().split()))
a.sort()
cnt = 0

for i in a:
    if x > i:
        x -= i
        cnt += 1
    elif x == i:
        cnt += 1
        break
    else:
        break
else:
    cnt -= 1

print(cnt)


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

template <typename T>
struct SegmentTree{
  const T e_T= 0;
  T op(const T &a, const T &b) const{
    return max(a, b);
  }
  vector<T> m_SegT;

  SegmentTree(int N): m_SegT(2*N, e_T){}
  SegmentTree(const vector<T> &data): m_SegT(2*data.size()){
    size_t N= m_SegT.size() >> 1;
    for(size_t i=0; i<N; i++){
      m_SegT.at(i+N)= data.at(i);
    }
    for(size_t i=N-1; i>0; i--){
      m_SegT.at(i)= op(m_SegT.at(i << 1), m_SegT.at((i << 1) | 1));
    }
  }

  /* メンバ関数の引数は 0-indexed */
  void set_val(size_t idx, T val){
    idx+= m_SegT.size() >> 1;
    m_SegT.at(idx)= val;
    while((idx >> 1) > 0){
      idx >>= 1;
      m_SegT.at(idx)= op(m_SegT.at(idx << 1), m_SegT.at((idx << 1) | 1));
    }
  }

  T range(size_t left, size_t right) const{// [left, right)
    left += m_SegT.size() >> 1;
    right+= m_SegT.size() >> 1;
    T calc_l= e_T;
    T calc_r= e_T;

    while(left < right){
      if(left&1){
        calc_l= op(calc_l, m_SegT.at(left));
        left++;
      }
      if(right&1){
        calc_r= op(m_SegT.at(right-1), calc_r);
      }

      left >>= 1;
      right>>= 1;
    }

    return op(calc_l, calc_r);
  }
};

int main() {
  int N,K;
  cin >> N >> K;
 
  vector<int> data(N);
  for(int i=0; i<N; i++){
    cin >> data.at(i);
  }
 
  constexpr int Vmax= 300'000; // '
  SegmentTree<int> st(Vmax+1);
  for(int i=0; i<N; i++){
    int left = max(0   , data.at(i)- K);
    int right= min(Vmax, data.at(i)+ K);
    int len_prev= st.range(left, right+1);
    st.set_val(data.at(i), len_prev+1);
  }
 
  int ans= st.range(0, Vmax+1);
  cout << ans << endl;
}

Measured memory_bytes: 6672
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int> >;
#define rep(i, n)         for(int i = 0; i < (int)(n); i++)
#define brep(n)           for(int bit=0;bit<(1<<n);bit++)
#define erep(i,container) for (auto i : container)
#define irep(i, n)        for(int i = n-1; i >= (int)0; i--)
#define rrep(i,m,n) for(int i = m; i < (int)(n); i++)
#define reprep(i,j,h,w) rep(i,h)rep(j,w)
#define all(x) (x).begin(),(x).end()
#define aall(x,n) (x).begin(),(x).begin()+(n)
#define VEC(type,name,n) std::vector<type> name(n);rep(i,n)std::cin >> name[i];
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define itn int
#define mp make_pair
#define sum accumulate
#define keta fixed<<setprecision
#define vvector(name,typ,m,n,a)vector<vector<typ> > name(m,vector<typ> (n,a))
#define vvvector(name,t,l,m,n,a) vector<vector<vector<t> > > name(l, vector<vector<t> >(m, vector<t>(n,a)));
#define vvvvector(name,t,k,l,m,n,a) vector<vector<vector<vector<t> > > > name(k,vector<vector<vector<t> > >(l, vector<vector<t> >(m, vector<t>(n,a)) ));
typedef long long ll;
const int INF = 2000000000;
const ll INF64 = 9223372036854775806ll;
const ll  MOD = 1000000007LL;
/*メモ 
*/
int main(){
    int n,r;
    std::cin >> n>>r;
    std::cout << r+max(10-n,0)*100 << std::endl;
}

Measured memory_bytes: 256
#include"bits/stdc++.h"
#define int long long
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define itr(i,x) for(auto i=(x).begin();i!=(x).end();++i)
#define All(x) (x).begin(),(x).end()
#define gridif(a,x,b) if((a)<=(x)&&(x)<(b))

using namespace std;
typedef pair<int,int> P;
const int mod=1000000007;

int digitsum(int n,int b){
	if(b<2) return -1;
	if(n<b) return n;
	return digitsum(n/b,b)+n%b;
}
int mpow(int a,int x);
int m_inv(int n);
vector<int> split(int n,int a);
string xal_number(int n,int x);
int gcd(int x,int y){return y?gcd(y,x%y):x;}
int lcm(int x,int y){return x*y/gcd(x,y);}
class Factorial{
private:
	vector<int> fac;
public:
	Factorial(int N){
		fac.push_back(1);
		rep(i,N) fac.push_back(fac[i]*(i+1)%mod);
	}
	int fact(int a){return fac[a];}
	int ifac(int a){return m_inv(fac[a]);}
	int cmb(int n,int r);
};
struct UnionFind {
    vector<int> par; // 親ノード
    UnionFind(int n = 1) { init(n);}
    void init(int n = 1) {
        par.resize(n);
        rep(i,n) par[i] = -1;
    }
    int root(int x) {
        if (par[x] <0) return x;
        else return par[x] = root(par[x]);      
    }
    int size(int x){ return -par[root(x)];}
    bool issame(int x, int y) {return root(x)==root(y);}
    bool connect(int x, int y);
};

signed main(){
	int N,K,L;
	cin>>N>>K>>L;
	UnionFind road(N),rail(N);
	rep(i,K){
		int p,q;
		cin>>p>>q;
		p--;q--;
		road.connect(p,q);
	}
	rep(i,L){
		int p,q;
		cin>>p>>q;
		p--;q--;
		rail.connect(p,q);
	}
	map<P,int> mp;
	vector<int> a(N),b(N);
	rep(i,N){
		a[i]=road.root(i);
		b[i]=rail.root(i);
		mp[P(a[i],b[i])]++;
	}
	rep(i,N) cout<<mp[P(a[i],b[i])]<<" \n"[i==N-1];
}

int mpow(int a,int x){
	int ans=1;
	while(x>0){
		if(x%2==1) (ans*=a)%=mod;
		(a*=a)%=mod;
		x>>=1;
	}
	return ans;
}
int m_inv(int n){return mpow(n,mod-2);}
vector<int> split(string s,int a){
	if(a<0||a>s.length()) return {-1,-1};
	string l="0",r="0";
	if(a!=0) l=s.substr(0,a);
	if(a!=s.length()) r=s.substr(a);
	return{stoll(l),stoll(r)};
}
int Factorial::cmb(int n,int r){
		if(n<r) return 0;
		if(r==0||r==n) return 1;
		return fac[n]*ifac(r)%mod*ifac(n-r)%mod;
}
string xal_number(int n,int x){
	if(x>36) return "out of use";
	if(n==0) return "";
	string s;
	int i=n%x;
	char a = i + ( i >= 10 ? 'A'-10 : '0' );
	s=xal_number(n/x,x)+a;
	return s;
}

bool UnionFind::connect(int x,int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (size(x) < size(y)) swap(x, y);
        par[x] += par[y];
        par[y] = x;
        return true;
}

Measured memory_bytes: 18048
#include <iostream>

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

using namespace std;

int main(){
	
	int n;
	cin >> n;
	
	bool bucket[100005];
	REP(i,100005) bucket[i] = false;
	REP(i,n){
		int input;
		cin >> input;
		bucket[i] = (i+1==input);
	}
	
	//	REP(i,10) cout << bucket[i] << endl;
	
	int continuous = 0;
	int ans = 0;
	
	REP(i,n){
		if(bucket[i]==1){
			continuous +=1;
		}else{
			if(continuous!=0){
				ans += (continuous+1)/2;
				continuous = 0;
			}
		}
	}
	
	if(continuous!=0){
		ans += (continuous+1)/2;
	}
	
	cout << ans << endl;
}


Measured memory_bytes: 384
#include <stdio.h>

int main(){
  	long long a, b, k, ra, rb;
  	scanf("%lld %lld %lld",&a,&b,&k);
  	if(k <= a){
      ra = a-k;
      rb = b;
    }
  	else if(k <= a + b){
      ra = 0;
      rb = a + b - k;
    } else {
      ra = 0;
      rb = 0;
    }
	printf("%lld %lld",ra,rb);
	return 0;
}

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

int main() {
  string S, T;
  cin >> S;
  cin >> T;
  int count = 0;
  for(int i = 0; i < S.length(); i++) {
    if(S[i] != T[i]) count++;
  }
  cout << count << endl;
  return 0;
}


Measured memory_bytes: 3580
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define vv(T) std::vector<std::vector<T>>
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;
using ll = long long;

int		main(void)
{
	int n;
	cin >> n;
	
	vector<bool> seen(1'000'000'000);
	bool ans = true;
	for (int i = 0; i < n; ++i)
	{
		int a;
		cin >> a;
		if (seen[a])
			ans = false;
		seen[a] = true;
	}
	cout << (ans ? "YES" : "NO") << endl;
}



Measured memory_bytes: 125224
#include<stdio.h>
#define MATRIX_MAX 100
#define LOOP_RESET 0
#define MATRIX_RESET 0
#define DIFF 1
#define RETURN 0

int main(){
	unsigned long ulW_D_inact[MATRIX_MAX][MATRIX_MAX];	/* 行列Ａの格納用配列 */
	unsigned long ulW_D_act[MATRIX_MAX][MATRIX_MAX];  	/* 行列Ｂの格納用配列 */
	unsigned long ulW_D_ans[MATRIX_MAX][MATRIX_MAX];  	/* 積の格納用変数 */
	unsigned short usW_D_row;                         	/* 行数の格納用変数 */
	unsigned short usW_D_share;                       	/* 共用部分の格納用変数 */
	unsigned short usW_D_col;                         	/* 列数の格納用変数 */
	unsigned short usW_C_i, usW_C_j, usW_C_k;         	/* ループ変数 */
	
	/* 配列の初期化 */
	for(usW_C_i = LOOP_RESET;usW_C_i < MATRIX_MAX;usW_C_i++){
		for(usW_C_j = LOOP_RESET;usW_C_j < MATRIX_MAX;usW_C_j++){
			ulW_D_inact[usW_C_i][usW_C_j] = MATRIX_RESET;
			ulW_D_act[usW_C_i][usW_C_j] = MATRIX_RESET;
			ulW_D_ans[usW_C_i][usW_C_j] = MATRIX_RESET;
		}
	}
	
	/* 行数、共通部分、列数の入力 */
	scanf("%d %d %d", &usW_D_row, &usW_D_share, &usW_D_col);
	
	/* 行列Ａの入力 */
	for(usW_C_i = LOOP_RESET;usW_C_i < usW_D_row;usW_C_i++){
		for(usW_C_j = LOOP_RESET;usW_C_j < usW_D_share;usW_C_j++){
			scanf("%ld", &ulW_D_inact[usW_C_i][usW_C_j]);
		}
	}
	
	/* 行列Ｂの入力 */
	for(usW_C_i = LOOP_RESET;usW_C_i < usW_D_share;usW_C_i++){
		for(usW_C_j = LOOP_RESET;usW_C_j < usW_D_col;usW_C_j++){
			scanf("%ld", &ulW_D_act[usW_C_i][usW_C_j]);
		}
	}
	
	/* 行列Ａと行列Ｂの積の計算 */
	for(usW_C_i = LOOP_RESET;usW_C_i < usW_D_row;usW_C_i++){
		for(usW_C_j = LOOP_RESET;usW_C_j < usW_D_col;usW_C_j++){
			for(usW_C_k = LOOP_RESET;usW_C_k < MATRIX_MAX;usW_C_k++){
				ulW_D_ans[usW_C_i][usW_C_j] += ulW_D_inact[usW_C_i][usW_C_k] * ulW_D_act[usW_C_k][usW_C_j];
			}
		}
	}
	
	/* 計算結果の出力 */
	for(usW_C_i = LOOP_RESET;usW_C_i < usW_D_row;usW_C_i++){
		for(usW_C_j = LOOP_RESET;usW_C_j < usW_D_col - DIFF;usW_C_j++){
			/* 末端列以外の出力 */
			printf("%ld ", ulW_D_ans[usW_C_i][usW_C_j]);
		}
		/* 末端列の出力 */
		printf("%ld\n", ulW_D_ans[usW_C_i][usW_D_col - DIFF]);
	}
	
	return RETURN;
}




Measured memory_bytes: 2100
#include <stdio.h>

int main(){
	int m,d;
	int i;
	
	int Days;
	
	
	while(1){
		Days = 0;
		scanf("%d %d",&m,&d);
		if(m == 0&&d == 0)break;
		for(i = 1,Days += d;i < m;i++){
			if(i == 2){
				Days += 29;
			}else if(i == 4||i == 6||i == 9||i == 11){
				Days += 30;
			}else{
				Days += 31;
			}
		}
		
		switch(Days%7){
			case 0:printf("Wednesday\n");
					break;
			case 1:printf("Thursday\n");
					break;
			case 2:printf("Friday\n");
					break;
			case 3:printf("Saturday\n");
					break;
			case 4:printf("Sunday\n");
					break;
			case 5:printf("Monday\n");
					break;
			case 6:printf("Tuesday\n");
					break;
		}
	}
	return 0;
}

Measured memory_bytes: 1012
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <cstdio>
#include <string>
#include <vector>
#include <random>
#include <chrono>
#include <utility>
#include <numeric>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <sstream>
#include <assert.h>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <unordered_map>
using namespace std;

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

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...);}
#ifdef HOME
#warning CHECK int:ll::INT_MAX:LLONG_MAX
#define maxn 20
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define maxn 2000006
#define gcd __gcd
#define debug(x...)
#endif

#define ff first
#define endl '\n'
#define ss second
#define inf 0x3f3f3f3f
#define MOD 1000000007
#define PI 3.14159265358979323846264338327950L
#define f(i,x,n) for(int i=x;i<=n;i++)
#define fr(i,x,n) for(int i=x;i>=n;i--)
struct _ { ios_base::Init i; _() { ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL); } } _;

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

int n;
vector<int> vis(1000006, 0);
vector<vector<int>> x(200005);


int main() {

	cin >> n;

	for (int i = 0; i <= n - 1; i++) {
		int num; cin >> num;
		vis[num]++;
		x[i].push_back(num);

		for (int fac = 1; fac * fac <= num; fac++) {
			if (num % fac == 0) {
				x[i].push_back(fac);
				if (fac * fac != num ) x[i].push_back(num / fac);
			}
		}
	}

	int ans = 0;

	for (int i = 0; i <= n - 1; i++) {
		bool flg = true;
		for (int j = 1; j <= (int)x[i].size() - 1; j++) {
			if (x[i][j] == x[i][0]) {
				if (vis[x[i][j]] > 1) { flg = false; break;}
			}
			else {
				if (vis[x[i][j]] > 0) {flg = false; break;}
			}
		}

		ans += (flg == true);

	}

	cout << ans;

	return 0;
}

Measured memory_bytes: 64756
import java.util.Scanner;

public class Main {

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

		String s = sc.next();
		int ans = 700;
		
		for(int i = 0; i < 3; ++i) {
			char chr = s.charAt(i);
			
			if(chr == 'o') {
				ans += 100; 
			}
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 21588
#include <stdio.h>
int main(void){
	
	double r,menseki,ensyu;
	scanf("%lf",&r);
	
	menseki=r*r*3.141592653589;
	ensyu=2*r*3.141592653589;
	
	printf("%f %f\n",menseki,ensyu);
	
	return 0;
}


Measured memory_bytes: 2120
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
const int maxn = 1e5 + 10;
long long n, k;
long long x, y;
struct nodes {
	long long a, b;
	bool operator <(const nodes n)
	{
		return a < n.a;
	}
}node[maxn];

int main()
{
	while (cin >> n >> k)
	{
		memset(node, 0, sizeof(node));
		int cnt = 0;
		for (int i = 0; i < n; i++)
		{
			cin >> x >> y;
			node[cnt].a = x;
			node[cnt].b = y;
			cnt++;
		}
		sort(node, node + cnt);
		long long sum = 0;
		for (int i = 0; i < cnt; i++)
		{
			sum += node[i].b;
			if (sum >= k) {
				cout << node[i].a << endl;
				break;
			}
		}
	}
	return 0;
}

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

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

    const int MAX = 100005;
    int even[MAX] = {0}, odd[MAX] = {0};

    rep(i, n) {
        int x;
        cin >> x;
        if (i % 2 == 0) {
            even[x]++;
        } else {
            odd[x]++;
        }
    }

    int emax = 0, omax = 0, ei, oi;
    for (int i = 0; i < MAX; i++) {
        if (emax < even[i]) emax = even[i], ei = i;
        if (omax < odd[i]) omax = odd[i], oi = i;
    }

    sort(even, even + MAX, greater<int>());
    sort(odd, odd + MAX, greater<int>());

    if (ei == oi)
        cout << min(n - even[0] - odd[1], n - even[1] - odd[0]) << endl;
    else
        cout << n - even[0] - odd[0] << endl;

    return 0;
}


Measured memory_bytes: 1024
_in = list(map(int, input().split()))
k = _in[0]
n = _in[1]
p = 0
_i = list(map(int, input().split()))
dis = 0
mdis = k - _i[n-1] + _i[0]
for i in range(1,n):
    dis = _i[i] - _i[i-1]
    if dis>mdis:
        mdis = dis
print(k-mdis)

Measured memory_bytes: 26444
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() { 
  ios::sync_with_stdio(false); cin.tie(0);
  //a
  int n, k;
  cin >> n >> k;
  if (k == 1) cout << 0 << endl;
  else cout << (n - (k - 1)) - 1 << endl;
  return 0;
}

Measured memory_bytes: 256
#include <cmath>
#include <iostream>
#include <functional>
#include <string>
#include <sstream>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <iomanip>
#include <math.h>
#include <list>
#include <numeric>
using namespace std;

int main(){    
  long long N,a;
  cin >> N;
  long long A[N];
  for(int i=0;i<N;i++){
    cin >> A[i];
  }
  sort(A,A+N);
  for(int i=1;i<N;i++){
    if(A[i-1]==A[i]){
      cout <<"NO";
      return 0;
    }
  }
  cout <<"YES";
}


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

using namespace std;

int main(){
    string s;
    cin>>s;
    if (s.at(0)==s.at(1) && s.at(1)!=s.at(2) && s.at(2)==s.at(3)) {
        cout<<"Yes"<<endl;
    }else if(s.at(0)==s.at(2) && s.at(1)!=s.at(2) && s.at(1)==s.at(3)){
        cout<<"Yes"<<endl;
    }else if(s.at(0)==s.at(3) && s.at(1)!=s.at(3) && s.at(2)==s.at(1)){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(void){
	int n;
	
	while(cin >> n && n){
		int sumdiv=0;
		for(int i=2;i*i <= n; i++){
			if(n%i == 0){
				if(i*i != n){
					sumdiv += i + n/i;
				}else{
					sumdiv += i;
				}
			}
		}
		sumdiv += 1;
		if(sumdiv == n &&  n != 1){
			cout << "perfect number" << endl;
		}else if(sumdiv < n || n == 1){
			cout << "deficient number" << endl;
		}else{
			cout << "abundant number" << endl;
		}
	}
}

Measured memory_bytes: 0
#include <cstdlib>
#include <iostream>
#include <cstdint>
#include <vector>
#include <string>
#include <complex>
#include <map>

#include <boost/algorithm/string/predicate.hpp>

using namespace std;

#if 0
// memo
abs()

start_with(str, "hoge");
ends_with(str, "hoge");

std::sort(d.begin(), d.end());
d.erase(std::unique(d.begin(), d.end()), d.end());
#endif

using namespace boost;
using namespace boost::algorithm;

static inline bool isOdd(int v)
{
    return v & 0x01;
}

int main()
{
    int N;
    scanf("%d", &N);



    map<string, int> ss;

    for (int i = 0; i < N; ++i) {
        string s;
        cin >> s;
        ss[s] = ss[s] + 1;
    }

    int M;
    scanf("%d", &M);

    for (int i = 0; i < M; ++i) {
        string t;
        cin >> t;
        ss[t] = ss[t] - 1;
    }

    int m = 0;
    for (auto i: ss) {
        if (m < i.second) {
            m = i.second;
        }
    }

    cout << m << endl;

    return 0;
}


Measured memory_bytes: 256