akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

#define intt long long

const int N = 100005;

int n, a[N];

map <int, int> mp;

int main() {

	cin >> n;

	for (int i = 1; i <= n; i ++) {
		cin >> a[i];
		mp[a[i]] ++;
	}

	int ans = 0, cnte = 0;

	for (int i = 1; i < N; i ++) {
		if (mp[i] > 0) {
			ans ++;
			if (mp[i] % 2 == 0) cnte ++;
		}
	}

	if (cnte % 2) ans --;

	cout << ans << '\n';
}

Measured memory_bytes: 5376
#include<bits/stdc++.h>
using namespace std;
#define NL            "\n"
#define _SAD()        ios::sync_with_stdio(0),cin.tie(0), cout.tie(0);
#define SZ(s)         s.size()
#define SRT(x,y)      sort(x,x+y)
#define REV(a,b)      reverse(a,a+b)
#define VSRT(x)       sort(x.begin(),x.end())
#define VREV(x)       reverse(x.begin(),x.end())
int main()
{
    _SAD()
    int n,fl=0,y;
    cin>>n;
    y=n;
    double x=0;
    while(1)
    {
        x=n*1.08;
        if(floor(x)==y)
        {
            cout<<n<<NL;
            return 0;
        }
        if(floor(x)<y)
        {
            cout<<":("<<NL;
            return 0;
        }
        n--;
    }
    return 0;
}


Measured memory_bytes: 256
S = input()


def f(s):
    return '01' <= s <= '12'


ans = (
    'NA' if not f(S[:2]) and not f(S[2:]) else
    'MMYY' if f(S[:2]) and not f(S[2:]) else
    'YYMM' if not f(S[:2]) and f(S[2:]) else
    'AMBIGUOUS'
)

print(ans)


Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define f first
#define s second
using namespace std;
typedef long long ll;
const int N = 1e3+5, mod = 1e9+7;
int n, a[N];
vector<pair<int, int>> ans;
void solvePOS()
{
	for(int i=1; i<n; i++) ans.push_back({i, i+1});
}
void solveNEG()
{
	for(int i=n-1; i>0; i--) ans.push_back({i+1, i});
}
void print()
{
	cout << ans.size() << endl;
	for(auto i : ans) cout << i.f << " " << i.s << endl;
}
int main()
{
	cin >> n;
	for(int i=0; i<n; i++) cin >> a[i];
	int mn = *min_element(a, a+n);
	int mx = *max_element(a, a+n);
	if(mn >= 0) solvePOS();
	else if(mx <= 0) solveNEG();
	else if(mx >= abs(mn))
	{
		int l = find(a, a+n, mx)-a + 1;
		for(int i=0; i<n; i++) if(a[i] < 0) ans.push_back({l, i+1});
		solvePOS();
	}
	else
	{
		int l = find(a, a+n, mn)-a + 1;
		for(int i=0; i<n; i++) if(a[i] > 0) ans.push_back({l, i+1});
		solveNEG();
	}
	print();
}

Measured memory_bytes: 256
# 解説放送
# 写経

def main():
    inf = 18 * (10 ** 6 + 1)

    s = '0' + input()
    n = len(s)

    s = map(int, reversed(s))  # 先に一括でintにした

    dp = [[inf] * 2 for _ in range(n + 1)]
    dp[0][0] = 0

    for i, c in enumerate(s):  # islice不要だった
        for j in range(2):
            x = c + j
            if x != 10:  # 不等号をやめた
                dp[i + 1][0] = min(dp[i + 1][0], dp[i][j] + x)  # a=x,b=0
            if x != 0:
                dp[i + 1][1] = min(dp[i + 1][1], dp[i][j] + (10 - x))  # a=0,bに繰り下がり

    print(dp[n][0])


if __name__ == '__main__':
    main()


Measured memory_bytes: 141316
#include <stdio.h>
#include <limits.h>

int main(){
  int n, min = 0, max = INT_MIN;
  scanf("%d\n", &n );

  for( int i = 0; i < n; i ++ ){
    int k;
    scanf("%d\n", &k );
    if( min == 0 ){
      min = k;
      continue;
    }
    if( k - min > max ) max = k - min;
    if( k < min ) min = k;
  }
  printf("%d\n", max );
  return 0;
}


Measured memory_bytes: 2144
#include <bits/stdc++.h>
#define ps push_back
using namespace std;
void solve()
{

}
int main()
{
//    ios::sync_with_stdio(0);
//    cin.tie(0);
    int t;
    cin>>t;
    if(t>=30)printf("Yes\n");
    else printf("No\n");
    return 0;
}


Measured memory_bytes: 3632
#include <stdio.h>
int main(void){
  int a,b,n,x,t[4][14]={};
  char c;
  scanf("%d",&n);
  while(n-->0) {
    scanf(" %c %d",&c,&x);
    if(c=='S')t[0][x]++;
    else if(c=='H')t[1][x]++;
    else if(c=='C') t[2][x]++;
    else if(c=='D')t[3][x]++;
  }
  for (a=0;a<4;a++){
    char k;
    if(a==0)k='S';
    else if(a==1)k='H';
    else if(a==2)k='C';
    else k='D';
    for(b=1;b<14;b++){
      if (!t[a][b])printf("%c %d\n",k,b);
    }
  }
  return 0;
}

Measured memory_bytes: 596
#include<algorithm>
#include<complex>
#include<ctype.h>
#include<iomanip>
#include<iostream>
#include<map>
#include<math.h>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<stdio.h>
#include<string>
#include<string>
#include<vector>

using namespace std;
typedef long long ll;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define pn(s) cout << (#s) << " " << (s) << endl

const ll mod = 1e9 + 7;
const ll inf = 1e18;

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

    ll Q;
    cin >> Q;

    // エラトステネスのふるい
    int N = 100010;
    vector<int> P(N);
    FOR(i, 0, N){
        P[i] = 1; // 素数である
    }
    P[0] = 0;
    P[1] = 0;

    FOR(i, 2, N){
        if(P[i]==1){
            int p = i;
            int step_p = p;
            // それの倍数を消していく
            while(p < N){
                p += step_p;
                if(p<N){
                    P[p] = 0;
                }
            }
        }
    }

    // 2017に似た数、の累積和
    int AC[N];
    AC[0] = 0;
    AC[1] = 0;
    AC[2] = 0;
    FOR(i, 3, N){
        if(i%2==0){
            AC[i] = AC[i-1];
        }else{
            int a = i;
            int b = (i+1)/2;
            if(P[a]==1 && P[b]==1){
                AC[i] = AC[i-1] + 1;
            }else{
                AC[i] = AC[i-1];
            }
        }
    }

    // クエリを処理していく
    FOR(i, 0, Q){
        int l, r;
        cin >> l >> r;
        int num = AC[r] - AC[l-1];
        p(num);
    }
    
    return 0;
}

Measured memory_bytes: 1408
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <unordered_map>
#include <set>
#include <map>
#define rep(i,n) for (int i=0; i<n;++i)
#define ALL(a)  (a).begin(),(a).end()
#define PI 3.14159265358979
typedef long long ll;
using namespace std;
const ll MOD = 1e9+7LL;
const int INF = 2e9;
ll N, A, B;

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

  cin >> N >> A>> B;
  ll cnt = N/(A+B);
  ll ans = cnt *A;
  ll a = N%(A+B);
  if (a>=A) ans+=A;
  else ans+=a;
  cout << ans << "\n";
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i,a,b) for(inti=a;i<=b;i++)

typedef long long int ll;
typedef vector<int>vi;
typedef pair<int,int>pi;



int main()
{

int n;
cin>>n;

int ans = 0;
int i =1;
for(int index =0;index<n;index++)
{
    int c;
    cin>>c;

    if(c!=i)ans++;
    else i++;
}
if(ans==n)
    cout<<-1<<endl;
else
    cout<<ans<<endl;


 return 0;
}


Measured memory_bytes: 3592
N,A,B,C=map(int,input().split())
L=[int(input()) for i in range(N)]
INF=10**8
def dfs(n,a,b,c):
  #n:n番目の竹までをみる
  #a:Aに使う竹の合計
  #b:Bに使う竹の合計
  #c:Cに使う竹の合計
  if n==N:
    if a*b*c>0:
      ret=abs(A-a)+abs(B-b)+abs(C-c)-30
    else:
      ret=INF
  else:
    ret=dfs(n+1,a,b,c)
    reta=dfs(n+1,a+L[n],b,c)+10
    retb=dfs(n+1,a,b+L[n],c)+10
    retc=dfs(n+1,a,b,c+L[n])+10
    ret = min(ret,reta,retb,retc)
  return ret
print(dfs(0,0,0,0))


Measured memory_bytes: 3192
#include <bits/stdc++.h>
#define int int64_t
using namespace std;

signed main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int n;
	cin >> n;
	vector<double> v(n);
	for (int i=0; i<n; ++i){
		cin >> v[i];
	}
	sort(v.begin(),v.end());
	for (int i=1; i<n; ++i){
		v[i] = (v[i]+v[i-1])/2;
	}
	cout << v[n-1];
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<vector>
#include<map>
#include<stack>
#include<queue>
#include<string>
#include<utility>
#include<numeric>
#include<algorithm>
#include<cmath>
#include<climits>
using namespace std;

using ll = long long;

class Stream{
public:
    Stream(){

    }
    //配列以外の入力を受け取る
    void read(){

    }
    template<typename First, typename... Rest>
    void read(First& first, Rest&... rest){
        cin >> first;
        read(rest...);
    }
    //配列を区切って出力する
    template<typename T>
    void write_vec(vector<T>& v, char divider){
        for(size_t i = 0; i < v.size(); i++){
            cout << v[i] << divider;
        }
    }
};

struct UF{
    const int node_num;
    vector<int> parent;
    vector<int> size;

    UF(int N) : node_num(N), parent(N), size(N, 1) {
        for(int i = 0; i < N; ++i) parent[i] = i;
    }

    //xの根を得る
    int root(int x){
        if(parent[x] == x) return x;
        return parent[x] = root(parent[x]);
    }

    //xが属する木とyが属する木を一つに合わせる
    void unite(int x, int y){
        int root_x = root(x);
        int root_y = root(y);
        if(root_x == root_y) return;
        parent[root_y] = root_x;
        size[root_x] += size[root_y];
    }

    //xとyが属する木が同じならtrueを返す
    bool same(int x, int y){
        int root_x = root(x);
        int root_y = root(y);
        return root_x == root_y;
    }

    //xと同じ木に属する要素の数を返す
    int same_size(int x){
        int root_x = root(x);
        return size[root_x];
    }
};

int main(){
    Stream io;
    
    int A, B;
    io.read(A, B);
    auto comp = [](int a, int b){
        if(a == 13 && b == 1){
            return -1;
        }
        else if(a == 1 && b == 13){
            return 1;
        }
        else if(a > b){
            return 1;
        }
        else if(a == b){
            return 0;
        }
        return -1;
    };
    int f = comp(A, B);
    string ans = "Alice";
    if(f == 0){
        ans = "Draw";
    }
    else if(f == -1){
        ans = "Bob";
    }
    cout << ans;
    return 0;
}

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

using namespace std;
#define int long long

signed main(){
    int a,b;
    cin >> a >> b;
    
    if(a+b == 15) cout << "+" << endl;
    else if(a*b == 15) cout << "*" << endl;
    else cout << "x" << endl;
    
    return 0;
}


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


int main(){
	int A,B,ans=0; cin >> A >> B;
	if(A>B){
		ans+=A;
		if(A-1>B){
			ans+=A-1;
		}else{
			ans+=B;
		}
	}else{
		ans+=B;
		if(B-1>A){
			ans+=B-1;
		}else{
			ans+=A;
		}
		}
	cout << ans << endl;

}

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

using ll = long long;
using namespace std;
constexpr ll inf = 1e15;
constexpr ll mod = 1e9+7;

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

    string S;
    cin>>S;

    cout<<((S.length() % 2 == 0) ^ (S[0] != S[S.length()-1]) ? "First" : "Second")<<endl;
    return 0;
}

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

map<string, set<string>> res;
set<string> te;
map<string, int> OK;

set<string> dfs(const string& s) {
	if (OK[s]) {
		return res[s];
	}
	OK[s] = 1;
	auto tmp = res[s];
	for (auto t : tmp) {
		if (te.count(t) == 0) {
			continue;
		}
		res[s].erase(t);
		auto ss = dfs(t);
		res[s].insert(ss.begin(), ss.end());
	}
	return res[s];
}

int main()
{
	int n;
	while (cin >> n, n) {
		string S;
		vector<string> t(n);
		for(int j = 0;j < n;j++) {
			cin >> S;
			int tmp = 0;
			for (int i = 0; i < (int)S.size(); i++) {
				if (S[i] == ':') {
					te.insert(S.substr(0, i));
					t[j] = S.substr(0, i);
					tmp = i + 1;
				}
				else if (S[i] == ',' || S[i] == '.') {
					res[t[j]].insert(S.substr(tmp, i - tmp));
					tmp = i + 1;
				}
			}
		}
		cout << dfs(t[0]).size() << endl;
		res.clear();
		te.clear();
		OK.clear();
	}
	return 0;
}

Measured memory_bytes: 3388
#include<stdio.h>
#include<algorithm>
#include<cmath>
using namespace std;
long long a[105];
int main()
{
    int n;
    scanf("%d",&n);
    for(int i = 0; i < n; i++)
        scanf("%lld",&a[i]);
    sort(a,a+n);
    long long ans = abs(a[n-1]-a[0]);
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 128
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		char[] abc = new char[26];
		for(char i = 'a';i <= 'z';i++) abc[i - 'a'] = i;

		int[] count = new int[26];

		Scanner sc = new Scanner(System.in);
		String input = "";
		while(sc.hasNext()){
			input += sc.nextLine().toLowerCase();
		}

		for(int i = 0;i < input.length();i++){
			if(input.charAt(i) - 'a' < 26 && 0 <= input.charAt(i) - 'a')
				count[input.charAt(i) - 'a']++;
		}

		for(int i = 0;i < 26;i++){
			System.out.println(abc[i] + " : " + count[i]);
		}

	}
}


Measured memory_bytes: 26116
combinations :: Int -> [a] -> [[a]]
combinations n xs = comb n (length xs) xs where
  comb 0 _ _ = [[]]
  comb r n a@(x:xs)
    | n == r    = [a]
    | otherwise = map (x:) (comb (r - 1) (n - 1) xs) ++ comb r (n - 1) xs

ans' n t s =
  let c = combinations t n
      o = filter (\e -> sum e == s) c
  in
    length o

ans (t:s:_) =
  let n = [0..9]
  in 
    if s < ( sum $ take t n )
    then 0
    else if s > (sum $ take t $ reverse n)
         then 0
         else ans' n t s

main = do
  c <- getContents
  let i' = map (map read) $ map words $ lines c :: [[Int]]
      i  = takeWhile (/= [0,0]) i'
      o  = map ans i
  mapM_ print o

Measured memory_bytes: 4060
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0;i < (int)(n);i++)
using ll = long long;
const ll MOD=1000000007;
//const ll MOD=998244353;
const long long INF = 1LL << 60;
const double pi=acos(-1.0);

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

//https://qiita.com/drken/items/a14e9af0ca2d857dad23

//N=1の時に自分で対応しなきゃいけないから注意
vector<pair<long long, long long> > prime_factorize(long long N) {
    vector<pair<long long, long long> > res;
    for (long long a = 2; a * a <= N; ++a) {
        if (N % a != 0) continue;
        long long ex = 0; // 指数

        // 割れる限り割り続ける
        while (N % a == 0) {
            ++ex;
            N /= a;
        }

        // その結果を push
        res.push_back({a, ex});
    }

    // 最後に残った数について
    if (N != 1) res.push_back({N, 1});
    return res;
}

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  // cout << fixed << setprecision(15);

  ll N; cin>>N;
  vector<ll> A(N); rep(i,N) cin>>A[i];
  /*
  vector<int> hurui(1000001,1);
  vector<ll> enum_list(0);
  for(int i=2;i<=1000000;i++){
    if(!hurui[i]) continue;
    enum_list.push_back(i);
    for(int j=2*i;j<=1000000;j+=i) hurui[j]=0;
  }
  //for(auto v:enum_list) cout<<v<<endl;
  */
  map<ll,ll> mp;
  for(auto a:A){
    vector<pair<ll,ll>> vec=prime_factorize(a);
    for(auto v:vec) mp[v.first]++;
  }
  
  string ans="pairwise coprime";
  for(auto p:mp){
    if(p.second>1) ans="setwise coprime";
    if(p.second>=N) {ans="not coprime"; break;}
  }
  
  cout<<ans<<endl;
  
  return 0;
}


Measured memory_bytes: 15828
#include<stdio.h>
int main(void)
{
	int a,b;
	scanf("%d %d",&a,&b);
	if(a%3==0||b%3==0) {
		printf("Possible\n");
	}
	else if((a+b)%3==0) {
		printf("Possible\n");
	}
	else {
		printf("Impossible\n");
	}
	return 0;
}

Measured memory_bytes: 128
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<type_traits>
#include<math.h>
#include<fstream>
#include<set>
using namespace std;
typedef long long ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
#define out(str) cout << str << endl
#define ALL(a) (a).begin(),(a).end()
#define INF (1<<29)

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

string S;

int main(){
    cin>>S;
    if(S=="Sunny")out("Cloudy");
    else if(S=="Cloudy")out("Rainy");
    else out("Sunny");
}


Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
using namespace std;

int main(){
        int i,j,u,idx;
        long long t=0;
        string s;
        cin >> s;
        for(i=0;i<(1<<(s.length()-1));++i){
                j=1;
                u=0;
                idx=0;
                while(j<=(1<<(s.length()-1))){
                        t += ((int)s[s.length()-1-idx]-48)*pow(10,u);
                        ++u;
                        if(i&j) u = 0;
                        j <<= 1;
                        ++idx;
                }
        }
        cout << t << endl;
        return 0;
}

Measured memory_bytes: 256
/*
Author: CNYALI_LK
LANG: C++
PROG: a.cpp
Mail: cnyalilk@vip.qq.com
*/
#include<bits/stdc++.h>
#define debug(...) fprintf(stderr,__VA_ARGS__)
#define DEBUG printf("Passing [%s] in LINE %lld\n",__FUNCTION__,__LINE__)
#define Debug debug("Passing [%s] in LINE %lld\n",__FUNCTION__,__LINE__)
#define all(x) x.begin(),x.end()
using namespace std;
const double eps=1e-8;
const double pi=acos(-1.0);
typedef long long ll;
typedef pair<ll,ll> pii;
template<class T>ll chkmin(T &a,T b){return a>b?a=b,1:0;}
template<class T>ll chkmax(T &a,T b){return a<b?a=b,1:0;}
template<class T>T sqr(T a){return a*a;}
template<class T>T mmin(T a,T b){return a<b?a:b;}
template<class T>T mmax(T a,T b){return a>b?a:b;}
template<class T>T aabs(T a){return a<0?-a:a;}
#define min mmin
#define max mmax
#define abs aabs
ll read(){
	ll s=0,base=1;
	char c;
	while(!isdigit(c=getchar()))if(c=='-')base=-base;
	while(isdigit(c)){s=s*10+(c^48);c=getchar();}
	return s*base;
}
char WritellBuffer[1024];
template<class T>void write(T a,char end){
	ll cnt=0,fu=1;
	if(a<0){putchar('-');fu=-1;}
	do{WritellBuffer[++cnt]=fu*(a%10)+'0';a/=10;}while(a);
	while(cnt){putchar(WritellBuffer[cnt]);--cnt;}
	putchar(end);
}
int main(){
#ifdef cnyali_lk
	freopen("a.in","r",stdin);
	freopen("a.out","w",stdout);
#endif
	ll n=read(),m=read();
	printf("%lld\n",abs((n-2)*(m-2)));
	return 0;
}



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

int main(){
	int a,b,c;

	std::cin >> a >> b >> c;

	if (a == b && a != c || a == c && a != b || c == b && a != c) {
		std::cout << "Yes" << std::endl;
		exit(0);
	}


	std::cout<<"No"<<std::endl;
	return 0;
}

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

int main() {
	int n;
	cin>>n;
	int flag=0;
	for(int i=1;i<=9;i++)
	{
		int x = n/i;
		if(n%i==0)
		{
			if(x>=1&&x<=9)
			{	flag=1;
				cout<<"Yes";
				break;
			}
		}
	}
	if(flag==0)
	cout<<"No";
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
struct po {int x,y,r,g;};
vector <po> c[5];
int ans;
bool used[1<<24];

bool check(po a){
  if(a.x==100000)return 0;
  for(int i=0;i<4;i++)
    for(int j=0;j<c[i].size();j++){
      po b = c[i][j];
      if(a.g>b.g && (a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y) < (a.r+b.r)*(a.r+b.r)) return false;
    }
  return 1;
}

void saiki(int sum,int i,int bit){
  ans=max(ans,sum);
  vector <int> J;
  for(int j=0;j<c[i].size();j++)if(check(c[i][j]))J.push_back(j);
  for(int j=0;j<J.size();j++)
    for(int k=j+1;k<J.size();k++){
      int nbit=(1<<c[i][J[j]].g)|(1<<c[i][J[k]].g)|bit;
      if(used[nbit])continue;
      used[nbit]=1;
      int a=c[i][J[j]].x, b=c[i][J[k]].x;
      c[i][J[j]].x = c[i][J[k]].x = 100000;
      for(int l=0;l<4;l++)saiki(sum+2,l,nbit);
      c[i][J[j]].x=a;
      c[i][J[k]].x=b;
    }
}

int main(){
  while(1){
    int n;
    cin>>n;
    if(n==0)break;
    int x,y,r,col;
    for(int i=0;i<(1<<24);i++)used[i]=0;
    for(int i=0;i<4;i++) c[i].clear();
    for(int i=0;i<n;i++)cin >>x>>y>>r>>col, c[--col].push_back((po){x,y,r,i});
    ans=0;
    for(int i=0;i<4;i++) saiki(0,i,0);
    cout <<ans<<endl;
  }
  return 0;
}

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

using namespace std;

int main() {
	int n;
	cin >> n;
  	for(int i = 1; i <= 9; i++) {
    	if(!(n % i) && (1 <= (n/i) && (n/i) <= 9)) {
			cout << "Yes";
			return 0;
    	}
  	}
  	cout << "No";
}


Measured memory_bytes: 256
import java.io.*;

class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		double r = Double.parseDouble(br.readLine());
		double pi = Math.PI;
		double menseki = r*r*pi;
		double enshu = 2.0*pi*r;
		System.out.printf("%.6f %.6f", menseki, enshu);
	}
}

Measured memory_bytes: 16920
S = str(input())
temp, temp2 = "", ""
ans1, ans2 = 0, 0
for i in range(len(S)):
    if i % 2 == 0:
        temp += "0"
        temp2 += "1"
    else:
        temp += "1"
        temp2 += "0"
    if temp[i] == S[i]:
        ans1 += 1
    elif temp2[i] == S[i]:
        ans2 += 1
        
print(min(ans1, ans2))

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

void push(int);
int pop(void);

int top=0, S[101];

int main(void)
{
	int x, y;
	char str[8];
	
	while ( scanf("%s",str) != EOF ) {
		switch ( str[0] ) {
		case '+':
			y = pop();
			x = pop();
			push(x+y);
			break;
		case '-':
			y = pop();
			x = pop();
			push(x-y);
			break;
		case '*':
			y = pop();
			x = pop();
			push(x*y);
			break;
		default:
			push( atoi(str) );
			break;
		}
	}
	printf("%d\n",S[top]);
	
	return 0;
}

void push(int x)
{
	top++;
	S[top] = x;
}

int pop(void)
{
	top--;
	return S[top+1];
}

Measured memory_bytes: 548
#include <cstdio>
#include <cstring>
#include <map>
#include <vector>
#include <queue>
#include <set>
#include <algorithm>
using namespace std;
typedef vector<int> vec;
typedef vector<vec > mal;
int ttt;
mal g(4,vector<int>(8));
map<mal,int> dist;
set<mal> checked;

bool check(mal c){
	for(int i=0;i<4;i++){
		for(int j=0;j<7;j++){
			if(c[i][j]!=(i+1)*10+j+1)return false;
		}
	}
	return true;
}

int bfs(mal s){
	checked.clear();
	dist.clear();
	queue<mal > que;
	que.push(s);
	checked.insert(s);
	while(que.size()){
		mal q=que.front();
		que.pop();
		if(check(q))return dist[q];
		for(int i=0;i<4;i++){
			for(int j=1;j<8;j++){
				if(q[i][j]!=0)continue;
				for(int k=0;k<4;k++){
					for(int l=1;l<8;l++){
						if(q[k][l]==0)continue;
						if(q[i][j-1]==q[k][l]-1){
							mal nq=q;
							nq[i][j]=q[k][l];
							nq[k][l]=0;
							if(checked.find(nq)==checked.end()){
								checked.insert(nq);
								dist[nq]=dist[q]+1;
								que.push(nq);
							}
						}	
					}
				}
			}
		}
	}
	return -1;
}

int main(void){
	scanf("%d",&ttt);
	for(int test=0;test<ttt;test++){
		mal fie(4,vec(8));
		for(int i=0;i<4;i++){
			for(int j=1;j<8;j++){
				scanf("%d",&fie[i][j]);
				if(fie[i][j]%10==1){
					fie[fie[i][j]/10-1][0]=fie[i][j];
					fie[i][j]=0;
				}
			}
		}
		printf("%d\n",bfs(fie));
	}
	return 0;
}

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

int numofdigits(int x){
  int count=0;

  while(x>0){
    x/=10;
    count++;
  }

  return count;
}
 
int main() {

  int N;

  cin >> N ;

  int ans=0;

  for(int i=1;i<=N;i++){
    int d=numofdigits(i);
    if(d%2==1) ans++;
  }

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

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

int main(){
  int n, p;
  cin >> n >> p;
  vector<long long> vec(5001, 0);
  vec[0] = 1;
  for(int i=0; i<n; i++){
    int num;
    cin >> num;
    for(int j=5000; j>=0; j--){
      if(vec[j] != 0 && j+num <= 5000) vec[j+num] += vec[j];
    }
  }
  long long sum = 0;
  if(p == 0){
    for(int i=0; i<=5000; i++){
      if(i%2==0) sum += vec[i];
    }
  }else{
    for(int i=0; i<=5000; i++){
      if(i%2==1) sum += vec[i];
    }
  }
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1e18;
#define rep(i, a, b) for (int i = a; i < b; i++)
#define per(i, a, b) for (int i = b - 1; i >= a; i--)
#define int long long
using pint = pair<int, int>;
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
int dxx[8] = {1, 1, 1, 0, 0, -1, -1, -1}, dyy[8] = {-1, 0, 1, -1, 1, -1, 0, 1};

signed main() {
    string s;
    cin >> s;
    int n = s.size();
    map<char, int> mp;
    rep (i, 0, n) mp[s[i]]++;
    int ans = n * (n - 1) / 2;
    for (auto p : mp) {
        ans -= p.second * (p.second - 1) / 2;
    }
    cout << ++ans << "\n";
}

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

int main() {
  int n1;
  cin >> n1;
  for(int i = 0; i < n1; ++i) {
    int n2;
    cin >> n2;
    int height;
    int min = 0;
    int max = 0;
    int lastHeight;
    cin >> lastHeight;
    for(int j = 0; j < n2 - 1; ++j) {
      cin >> height;
      int d = height - lastHeight;
      if(d > max) max = d;
      if(d < min) min = d;
      lastHeight = height;
    }
    cout << max << " " << -min << endl;
  }
  return 0;
}

Measured memory_bytes: 1160
#include <stdio.h>
#include <stdbool.h>
#define N 8
#define FREE 0
#define NOT_FREE -1

int row[N], col[N], dpos[2*N-1], dneg[2*N-1];
bool x[N][N];
void putQueen(int);
void printBoard();

int main(){
  int i, j, k, r, c;
  
  for(i = 0; i < N; i++){
    for(j = 0; j < N; j++){
      x[i][j] = false;
    }
  }
  scanf("%d",&k);
  for(i = 0; i < k; i++){
    scanf("%d%d",&r,&c);
    x[r][c] = true;
  }

  putQueen(0);

  return 0;
}

void putQueen(int i){
  int j;
  if(i == N){
    printBoard();
    return;
  }
  for(j = 0; j < N; j++){
    if(col[j] == NOT_FREE || dpos[i+j] == NOT_FREE || dneg[i-j+N-1] == NOT_FREE)
      continue;
    row[i] = j;
    col[j] = dpos[i+j] = dneg[i-j+N-1] = NOT_FREE;
    putQueen(i+1);
    row[i] = col[j] = dpos[i+j] = dneg[i-j+N-1] = FREE;
  }
}

void printBoard(){
  int i, j;
  for(i = 0; i < N; i++){
    for(j = 0; j < N; j++){
      if(x[i][j]){
	if(row[i] != j) return;
      }
    }
  }
  for(i = 0; i < N; i++){
    for(j = 0; j < N; j++){
      if(row[i] == j) printf("Q");
      else printf(".");
    }
    printf("\n");
  }
}

Measured memory_bytes: 572
import Control.Monad
import Control.Applicative
import Data.List
import Data.Array
strToInt s = (read :: String -> Int) s

main = do

   n <- readLn :: IO Int
   an <- map strToInt . words <$> getLine
   print (solve an 0)

solve :: [Int] -> Int -> Int
solve an n = if an == bn 
             then solve (map (`div` 2) an) (n+1)
             else n
                where bn = filter evens an

evens :: Int -> Bool
evens a = if (even a) && (a /= 0)
          then True
          else False


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

int main() {// 単調非減少＝広義の単調増加。
  int n;
  cin >> n;
  if(n==111) puts("999");
  else if(n==119) puts("991");
  else if(n==191) puts("919");
  else if(n==911) puts("199");
  else if(n==199) puts("911");
  else if(n==919) puts("191");
  else if(n==991) puts("119");
  else if(n==999) puts("111");
  
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cstdio>
#include <string>
#include <stack>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <numeric>
using namespace std;
#define MOD 1000000007
typedef long long ll;
typedef pair <int,int> P;

int main(){
    char b;
    cin >> b;
    if(b == 'A'){
        cout << "T" << endl;
    }else if(b == 'T'){
        cout << "A" << endl;
    }else if(b == 'G'){
        cout << "C" << endl;
    }else{
        cout << "G" << endl;
    }
}

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

using namespace std;

int main(){
    int n,q;
    cin>>n>>q;
    vector<vector<int>> ki(n);
    for (int i = 1; i < n; ++i) {
        int a,b;
        cin>>a>>b;
        --a;--b;
        ki[a].emplace_back(b);
        ki[b].emplace_back(a);
    }
    vector<bool> visited(n,false);
    vector<int> ans(n,0);
    for (int i = 0; i < q; ++i) {
        int p,x;
        cin>>p>>x;
        --p;
        ans[p]+=x;
    }
    queue<int> waku;
    waku.push(0);
    visited[0]=true;
    while(!waku.empty()){
        int pos=waku.front();
        waku.pop();
        int val=ans[pos];
        for(auto i:ki[pos]){
            if(!visited[i]){
                visited[i]=true;
                waku.push(i);
                ans[i]+=val;
            }
        }
    }
    for (int i = 0; i < n; ++i) {
        cout<<ans[i];
        if(i==n-1)cout<<endl;
        else cout<<" ";
    }
    return 0;
}


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

const ll INF = 1LL << 60;

string S, T;
int main() {
    // cout << 'd' - 'a' << endl;
    // return 0;

    cin >> S >> T;
    map<int, int> s_mp, e_mp;
    rep(i, 26) {
        s_mp[i] = -1;
        e_mp[i] = -1;
    }

    string ans = "Yes";
    for (int i = 0; i < S.size(); i++) {
        int before = S[i] - 'a';
        int after = T[i] - 'a';

        // cout << "i: " << i << " " << endl;
        // cout << s_mp[before] << " " << after << endl;
        // cout << e_mp[after] << " " << before << endl;
        if (s_mp[before] == -1 && e_mp[after] == -1) {
            s_mp[before] = after;
            e_mp[after] = before;
            continue;
        } 

        if (s_mp[before] != after || e_mp[after] != before) {
            ans = "No";
            break;
        }
    }

    // // S を変換させてTになるかどうかを見る
    // for (auto m : mp) {
    //     cout << m.first << " " << m.second << endl;
    //     cout << (char)('a' + m.first) << " " << (char)('a' + m.second) << endl;
    // }

    cout << ans << endl;
}

Measured memory_bytes: 776
class Rect
	attr_accessor :h, :w, :len
	def initialize(h, w)
		@h = h
		@w = w
		@len = h * h + w * w
	end
end

rects = []

for i in 1..151
	for j in (i+1)..151
		rects << Rect.new(i, j)
	end
end

rects.sort!{|i,  j|
	if i.len == j.len
		i.h <=> j.h
	else
		i.len <=> j.len
	end
}

loop do
	h, w = gets.chomp.split.map(&:to_i)
	if h == 0 && w == 0
		break
	end
	ans = 0
	rects.each_with_index do |r, i|
		if r.h == h && r.w == w
			ans = i+1
		end
	end
	puts "#{rects[ans].h} #{rects[ans].w}"
end

Measured memory_bytes: 6396
#include <algorithm>
#include <fstream>
#include <iostream>
#include <deque>
#include <stack>
using namespace std;

long long dp[200005];
long long x[200005];
deque<int> dq;

bool stack_better(int j1, int j2) {
    return dp[j1] - x[j1] - 2LL * x[j1 + 1] < dp[j2] - x[j2] - 2LL * x[j2 + 1];
}

bool deque_better(int i, int j) {
    return dp[i] - x[i] < dp[j] - x[j];
}

int main() {
    //ifstream cin("f.in");
    int n, j = -1, bst = -1; long long t, e;
    cin >> n >> e >> t;
    for (int i = 1; i <= n; ++ i) {
        cin >> x[i];
    }
    dp[0] = 0;
    dq.push_back(0);
    for (int i = 1; i <= n; ++ i) {
        dp[i] = 1LL << 60;

        /// the ones whose time surpassed t
        while (j + 1 < i && 2LL * (x[i] - x[j + 2]) >= t) {
            j += 1;
            if (bst == -1 || stack_better(j, bst)) {
                bst = j;
            }
        }
        if (j >= 0) {
            dp[i] = min(dp[i], dp[bst] - (x[bst] + 2LL * x[bst + 1]) + 3LL * x[i]);
        }

        /// time did not surpass t
        while (!dq.empty() && 2LL * (x[i] - x[dq.front() + 1]) >= t) {
            dq.pop_front();
        }
        if (!dq.empty()) {
            dp[i] = min(dp[i], dp[dq.front()] - x[dq.front()] + x[i] + t);
        }
        while (!dq.empty() && dp[i] - x[i] < dp[dq.back()] - x[dq.back()]) {
            dq.pop_back();
        }
        dq.push_back(i);
    }
    cout << dp[n] + (e - x[n]) << "\n";
    return 0;
}


Measured memory_bytes: 2048
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
using ll = long long;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-8;
const int MOD = 1000000007;
// const int MOD = 998244353;
const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};
const int dy8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dx8[] = {0, -1, -1, -1, 0, 1, 1, 1};
template <typename T, typename U> inline bool chmax(T &a, U b) { return a < b ? (a = b, true) : false; }
template <typename T, typename U> inline bool chmin(T &a, U b) { return a > b ? (a = b, true) : false; }
struct IOSetup {
  IOSetup() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  }
} iosetup;

template <typename Abelian>
struct BIT0based {
  BIT0based(int n, const Abelian UNITY = 0) : n(n), UNITY(UNITY), dat(n, UNITY) {}

  void add(int idx, Abelian val) {
    while (idx < n) {
      dat[idx] += val;
      idx |= idx + 1;
    }
  }

  Abelian sum(int idx) const {
    Abelian res = UNITY;
    --idx;
    while (idx >= 0) {
      res += dat[idx];
      idx = (idx & (idx + 1)) - 1;
    }
    return res;
  }

  Abelian sum(int left, int right) const {
    return left < right ? sum(right) - sum(left) : UNITY;
  }

  Abelian operator[](const int idx) const { return sum(idx, idx + 1); }

  int lower_bound(Abelian val) const {
    if (val <= UNITY) return 0;
    int res = 0, exponent = 1;
    while (exponent <= n) exponent <<= 1;
    for (int mask = exponent >> 1; mask > 0; mask >>= 1) {
      if (res + mask - 1 < n && dat[res + mask - 1] < val) {
        val -= dat[res + mask - 1];
        res += mask;
      }
    }
    return res;
  }

private:
  int n;
  const Abelian UNITY;
  vector<Abelian> dat;
};

int main() {
  int n, q; cin >> n >> q;
  BIT0based<ll> bit(n);
  REP(i, n) {
    int a; cin >> a;
    bit.add(i, a);
  }
  while (q--) {
    int query; cin >> query;
    if (query == 0) {
      int p, x; cin >> p >> x;
      bit.add(p, x);
    } else if (query == 1) {
      int l, r; cin >> l >> r;
      cout << bit.sum(l, r) << '\n';
    }
  }
  return 0;
}


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

int main(){
  int N;
  cin >> N;
  int A;
  for(int i=0; i<N; i++){
    cin >> A;
    if(A%2==0 && (A%3!=0 && A%5!=0)){
      cout << "DENIED" << endl;
      goto finish;
    }
  }
  cout << "APPROVED" << endl;
finish: A=0;
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        DDivGame solver = new DDivGame();
        solver.solve(1, in, out);
        out.close();
    }

    static class DDivGame {
        public void solve(int testNumber, Scanner sc, PrintWriter pw) {
            ArrayList<Integer> primes = new ArrayList<>();
            boolean[] isPrime = new boolean[(int) 5e6 + 1];
            Arrays.fill(isPrime, true);
            isPrime[0] = isPrime[1] = false;
            for (int i = 2; i * i <= (int) 5e6 + 1; i++)
                if (isPrime[i])
                    for (int j = i * i; j < isPrime.length; j += i)
                        isPrime[j] = false;
            for (int i = 1; i < isPrime.length; i++)
                if (isPrime[i])
                    primes.add(i);
            long n = sc.nextLong();
            int idx = 0, p = primes.get(idx++);
            long ans = 0;
            while (1l * p * p <= n) {
                if (n % p == 0) {
                    int c = 0;
                    while (n % p == 0) {
                        c++;
                        n /= p;
                    }
                    ans += bs(c);
                }
                p = primes.get(idx++);
            }
            if (n != 1)
                ans++;
            pw.println(ans);
        }

        private long bs(int x) {
            int low = 0, high = (int) 1e4;
            while (low <= high) {
                int mid = (low + high) / 2;
                if (mid * (mid + 1) / 2 <= x) {
                    low = mid + 1;
                } else
                    high = mid - 1;
            }
            return high;
        }

    }

    static class Scanner {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(FileReader r) {
            br = new BufferedReader(r);
        }

        public Scanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

    }
}



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

using namespace std;

#define FOR(i,s,e) for(int (i)=(s);(i)<(int)(e);(i)++)
#define REP(i,e) FOR(i,0,e)
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define all(o) (o).begin(), (o).end()
#define pb(x) push_back(x)
#define mp make_pair
#define mt make_tuple
#define t0(t) get<0>((t))
#define t1(t) get<1>((t))
#define t2(t) get<2>((t))

typedef long long ll;

const int N = 1e5;
const int INF = 1e9;
int h[N+10], dp[N+10];
int n;

int main() {
  scanf("%d ", &n); 
  REP(i,n) scanf("%d ", h+i);
  dp[0] = 0;
  FOR(i,1,n+1) dp[i] = INF;
  REP(i,n-1) {
    dp[i+1] = min(dp[i+1], dp[i] + (int)abs(h[i]-h[i+1]));
    dp[i+2] = min(dp[i+2], dp[i] + (int)abs(h[i]-h[i+2]));
  }
  printf("%d\n", dp[n-1]);
  return 0;
}

Measured memory_bytes: 1024
h,w = map(int,input().split())
s = [list(input()) for _ in range(h)]
bomb_count = 0
for i in range(h):
  for j in range(w):
    if s[i][j] == "#":
      continue
    else:
      for k in range(3):
        for l in range(3):
          a = i-1+k
          b = j-1+l
          if a < 0:
            continue
          elif a > h-1:
            continue
          if b < 0:
            continue
          elif b > w-1:
            continue
          if s[a][b] == "#":
            bomb_count += 1
      s[i][j] = str(bomb_count)
      bomb_count = 0
for i in range(h):
  print("".join(s[i]))

Measured memory_bytes: 9248
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n,count;
  count=1;
  cin >> n;
  vector<string> vec(n);
  for(int i=0;i<n;i++){
    cin >> vec.at(i);//商品の種類を代入する
  }
  sort(vec.begin(), vec.end());//多分ここまではOK
  for(int i=1;i<n;i++){
    if(vec.at(i)!=vec.at(i-1)){
      count++;
    }
  }
  cout << count << endl;
}
  

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

#define xx first
#define yy second

#define MAX_N 100000

using namespace std;

int n;
pair <int, int> v[MAX_N + 1];

struct cmp
{
    bool operator() (const pair<int, int> &a, const pair<int, int> &b)const
    {
        if(a.yy == b.yy)
            return a.xx < b.xx;

        return a.yy < b.yy;
    }
};

int main()
{
    cin >> n;
    for(int i = 1; i <= n; i ++)
    {
        int a, b;
        cin >> a >> b;
        v[i] = {a - b, a + b};
    }

    sort(v + 1, v + n + 1, cmp());

    int cate = 1;
    int st = v[1].xx;
    int dr = v[1].yy;
    for(int i = 2; i <= n; i ++)
    {
        if(v[i].xx >= dr)
        {
            st = v[i].xx;
            dr = v[i].yy;
            cate ++;
        }
    }

    cout << cate << "\n";

    return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std ;
int main()
{
    int s[3] ,k;
    for(int i =0; i<3; i++)
    {
       cin>> s[i];
    }
    cin>> k ;
    sort(s, s+3);
    for (int i=0 ; i<k;i++)
    {
        s[2]=2*s[2];
    }
    cout << s[0]+s[1]+ s[2];


    return 0;
}

Measured memory_bytes: 256
use text_io::*;
use std::collections::HashMap;
use std::process::exit;

fn main() {
    let n:usize = read!();
    let m:usize = read!();
    let mut vn:Vec<isize> = Vec::new();
    let mut vm:Vec<isize> = Vec::new();
    let x:isize = read!();
    vn.push(x);
    let y:isize = read!();
    vm.push(y);
    for _i in 0..n {
        let a:isize = read!();
        vn.push(a);
    }
    for _i in 0..m {
        let a:isize = read!();
        vm.push(a);
    }
    vn.sort();
    vm.sort();
    if vn[n]<vm[0] {
        println!("No War");
    }
    else {
        println!("War");
    }
}

Measured memory_bytes: 2164
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vll = vector<long long>;
using vp = vector<pair<int, int>>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvll = vector<vector<long long>>;
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 (b<a) {a=b; return 1;} return 0;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n;
    cin >> n;
    vi h(n);
    rep(i, n) cin >> h[i];
    int ans = 0;
    while (1) {
        bool flag = true;
        bool plus = false;
        int cnt = 0;
        rep(i, n) {
            if (h[i]) {
                flag = false;
                h[i]--;
                if (!plus) {
                    plus = true;
                    cnt++;
                }
            } else {
                plus = false;
            }
        }
        ans += cnt;
        if (flag) break;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    int n=sc.nextInt();
    long[] a=new long[n];
    for(int i=0;i<n;i++){
      a[i]=sc.nextLong();
    }
    long ans=0;
    long zer;
    long one;
    long mod=1000000007;
    for(long i=1;i<1152921504606846976l;i*=2){
      zer=0;
      one=0;
      for(int j=0;j<n;j++){
        if((a[j]/i)%2==1){
          one++;
        }else{
          zer++;
        }
      }
      ans=((((((zer%mod)*(one%mod))%mod)*(i%mod))%mod)+ans)%mod;
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 99524
N, M = map(int, input().split())
ab_list = []
for _ in range(M):
    a, b = map(int, input().split())
    ab_list.append((a, b))

# bについて昇順ソート
ab_list.sort(key=lambda x: x[1])

ans = 0

# 直前に切断した橋のindex
# 0や適当な負の値で初期化しておくと1回目の判定で都合が良い
pre_x = 0

for a, b in ab_list:
    # 直前の切断で条件が満たせる場合
    if pre_x >= a:
        continue
    # 新たに切断する必要がある場合
    else:
        pre_x = b - 1
        ans += 1
print(ans)


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

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

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

  int n; cin >> n;
  bool flag = false;
  rep(i, n) rep(j, n) {
    if(i*4+j*7 == n) flag = true;
  }
  cout << (flag ? "Yes" : "No") << '\n';
  return 0;
}


Measured memory_bytes: 256
#[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, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (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! {
        n: usize,
        a_s: [i64; n],
        b_s: [i64; n],
        c_s: [i64; n-1],
    }
    let mut ans = 0;
    for i in 0..n {
        ans += b_s[(a_s[i] - 1) as usize];
        if i > 0 && a_s[i] - a_s[i - 1] == 1 {
            ans += c_s[a_s[i - 1] as usize - 1];
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
//---------------------------
using namespace std;
//---------------------------
#define REP(i,n) for(int i = 0; i < (n); i++)
#define P(x) cout << (x) << "\n"

#define MOD 1000000007 // 1e9+7
#define PI 3.1415926525
#define ll long long int // 10^18
#define INF 1000000001 // 1e9+1

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

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

  // ifstream in("input.txt");
  // cin.rdbuf(in.rdbuf());

  string s;cin>>s;
  bool flagN=false,flagW=false,flagS=false,flagE=false;
  bool flag=false;
  REP(i,(int)s.size()){
    if(s[i]=='N')flagN=true;
    if(s[i]=='W')flagW=true;
    if(s[i]=='S')flagS=true;
    if(s[i]=='E')flagE=true;
  }
  if(flagN && !flagS)flag=true;
  if(flagS && !flagN)flag=true;
  if(flagE && !flagW)flag=true;
  if(flagW && !flagE)flag=true;

  if(flag){
    P("No");
  }else{
    P("Yes");
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <functional>
#include <string>
#include <algorithm>

using namespace std;

int main()
{
  int n, k;
  
  cin >> n >> k;
  vector<int> l(n);

  for (int i = 0; i < n; i++) {
	  cin >> l[i];
  }
  sort(l.begin(), l.end(), greater<int>());
  
  int res = 0;
  for (int i = 0; i < k; i++) {
	res += l[i];
  }

  cout << res << endl;
  
  return (0);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pii pair<int,int>
#define x first
#define y second
#define mp make_pair
#define pb push_back
#define ll long long
#define sz size()
#define ft front
#define pu push
#define ty empty
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
const int m5=100042;
int sum;
int day;
int w[10042];
int main(void)
{
	cin>>sum>>day;
	int i;
	rep(i,day)
	{
		cin>>w[i];
		sum-=w[i];
	}
	if(sum<0)
	{
		cout<<"-1";
	}
	else
	{
		cout<<sum;
	}
    return 0;
}



Measured memory_bytes: 3668