akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define SIZE 105
#define INF 1000000005
//#define INF 1e18
#define MOD 1000000007

using namespace std;
typedef long double ll;
typedef pair <int,int> P;

typedef tuple <ll,int,int> T;
struct edge{int to;ll cost;};
vector<edge> G[SIZE],M[SIZE];
bool used[SIZE];

//0_indexed
ll prim(){
  priority_queue<T,vector<T>,greater<T>> que;
  fill(used,used+SIZE,false);
  rep(i,0,SIZE) M[i].clear();
  ll res = 0;
  que.push(T(0,0,0));
  while(!que.empty()){
    T t = que.top();que.pop();
    ll l = get<0>(t);
    int v = get<1>(t);
    int from = get<2>(t);
    if(used[v])continue;
    res += l;
    used[v] = true;
    M[v].push_back((edge){from,l});
    M[from].push_back((edge){v,l});
    for(edge u : G[v]){
      if(!used[u.to])que.push(T(u.cost,u.to,v));
    }
  }
  return res;
}

void add_edge(int a,int b,ll c){
  G[a].push_back((edge){b,c});
  G[b].push_back((edge){a,c});
}

int n;
ll x[SIZE],y[SIZE],z[SIZE],r[SIZE];
int solve(){
  rep(i,0,SIZE) G[i].clear();
  cin >> n;
  if(n==0)return 1;
  rep(i,0,n){
    cin >> x[i] >> y[i] >> z[i] >> r[i];
  }
  rep(i,0,n) rep(j,i+1,n){
    ll D = (x[i]-x[j])*(x[i]-x[j]) + (y[i]-y[j])*(y[i]-y[j])+(z[i]-z[j])*(z[i]-z[j]);
    if(D <= pow((r[i]+r[j]),2))D=0.0l;
    else{
      D = sqrt(D);
      D -= r[i]+r[j];
    }
    add_edge(i,j,D);
  }

  cout << prim() << endl;

  return 0;
}

int main(){
  cout << setprecision(3) << fixed;
  while(solve()==0);
  return 0;
}



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

namespace Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var s = Console.ReadLine();
            int n = s.Length;
            string temp1 = s.Substring(0, (n - 1) / 2);
            string temp2 = s.Substring(temp1.Length+1, temp1.Length );

            var ans = temp1 == temp2 ? "Yes" : "No";
            Console.WriteLine(ans);

        }
    }
}


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

using namespace std;

typedef long long ll;
const ll INF = 1LL<<60;

ll gcd(ll a, ll b) {
  if(b == 0) return a;
  return gcd(b, a % b);
}

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

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

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

    map<char, int> mp;
    string S;
    cin >> S;
    for(int i = 0; i < 4; i++){
        mp[S[i]]++;
    }

    bool is_2 = true;
    for(auto itr = mp.begin(); itr != mp.end(); itr++){
        if(itr->second != 2) is_2 = false;
    }

    if(mp.size()==2 && is_2){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }


    return 0;
}



Measured memory_bytes: 256
n = int(input())
a = list(map(int,input().split()))
bar = dict()
for i in range(n):
    if a[i] not in bar:
        bar[a[i]] = 0
    bar[a[i]] += 1
l_bar = list(bar.items())
l_bar.sort(reverse=True)
cnt = 0
hen1 = 0
hen2 = 0
for i in range(len(l_bar)):
    if l_bar[i][1] >= 4 and cnt == 0:
        print(l_bar[i][0]**2)
        exit()
    if l_bar[i][1] >= 2:
        if cnt == 0:
            cnt += 1
            hen1 = l_bar[i][0]
        elif cnt == 1:
            cnt += 1
            hen2 = l_bar[i][0]
    if cnt == 2:
        print(hen1*hen2)
        exit()
print(0)





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

typedef long long ll ; 
typedef unsigned long long ull ; 
typedef vector<int> vi ; 
typedef vector<vi> vii ;
typedef vector<ll> vl ;
typedef vector<vl> vll ;
typedef set<int> si ; 
typedef map<int,int> mii ; 
typedef map<ll,ll>  mll ; 
typedef map<string,int> msi ;
typedef set<ll> sl ; 
typedef set<char> sc ; 
typedef pair<int,int> pii ;


#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define FORD(i,a,b) for(int i=(a);i>=(b);i--)
const int INF = 1 << 29 ; 
#define MOD (ll)(1e9+7)
#define eps 1e-6
#define pb push_back 
#define mp make_pair 
#define DEBUG(x)		cout << '>' << #x << ':' << x << endl;
#define F first 
#define S second 

int main() 
{
	ios::sync_with_stdio(0) ;
	

	int n ;
	cin >> n ;
	int k ;
	cin >> k;
	int a[n];
	REP(i,n) cin >> a[i];
	bool dp[k+5];
	REP(i,k+5) dp[i] = 0;
	for(int i = 0; i <= k; ++i) {
		for(int j = 0; j < n; ++j) {
			if(i >= a[j] && !dp[i - a[j]]) {
				dp[i] = 1;
			}
		}
	}
	
	if(dp[k]) {
		cout << "First\n";
	}
	else {
		cout << "Second\n";
	}
	return 0 ; 
}


Measured memory_bytes: 384
n = int(input())
s = input()
count = s.count("R")*s.count("G")*s.count("B")
for i in range(n-2):
    for j in range(i+1, (i+n+1)//2):
        if s[j] != s[i] and s[j] != s[2*j-i] and s[i] != s[2*j-i]:
            count -= 1
        # print(i, j, 2*j-i, count)
print(count)

Measured memory_bytes: 9180
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()

from collections import defaultdict, deque, Counter
from sys import exit
import heapq
import math
import copy
from operator import mul
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7

N = getN()
rength = len(str(N))
numlist = [3, 5, 7]
cnt = 0

def sevfivthr(i, strint):
    global cnt
    if i == rength:
        return
    else:
        for num in numlist:
            newstr = strint + str(num)
            if ('3' in newstr) and ('5' in newstr) and ('7' in newstr):
                if int(newstr) <= N:
                    cnt += 1
            sevfivthr(i + 1, newstr)
for i in numlist:
    sevfivthr(1, str(i))
print(cnt)

Measured memory_bytes: 48604
#include<bits/stdc++.h>
using namespace std;
using lli = long long;
#define rep(i,n) for(int i=0;i<n;i++)
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;
lli k;

int main(void){
    cin >> s >> k;
    lli n = s.size();
    priority_queue<string, vector<string>, greater<string>> p;
    for(int i = 1; i <= n; i++){
        for(int j = 0; j < n; j++){
            if(j+i-1 >= n) break;
            string t = s.substr(j, i);
            if(t.size() <= k) p.push(t);
        }
    }
    unordered_map<string, lli> mp;
    while(k > 0){
        string t = p.top();
        p.pop();
        if(mp[t]) continue;
        else{
            k--;
            mp[t]=true;
        }
        if(k == 0){
            cout << t << endl;
            break;
        }
    }
    return 0;
}


Measured memory_bytes: 4260
import sys
rl = sys.stdin.readline
n = int(rl())
x, y, z = 0, 0, 0
for _ in range(n):
  a, b, c = map(int, rl().split())
  x, y, z = max(y, z) + a, max(x, z) + b, max(x, y) + c
print(max(x, y, z))


Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <algorithm>
#include <tuple>
#include <cstdint>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <cctype>

using namespace std;

#define ll long long
#define ld long double
#define v vector

#define max(a, b) (a)<(b)?(b):(a)
#define min(a, b) (a)<(b)?(a):(b)
#define rep(i, n)      for (int i = 0; i < (int)(n); ++i)
#define rep3(i, m, n)  for (int i = (m); i < (int)(n); ++i)
#define rrep(i, n)     for (int i = (int)(n)-1; i >= 0; --i)
#define rrep3(i, m, n) for (int i = (int)(n)-1; i >= (m); --i)
#define all(x) begin(x), end(x)
#define rall(x) end(x), begin(x)

#define endl '\n'


ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }

string solve(ll K, string S) {
  if ((ll)S.length() <= K) {
    return S;
  } else {
    return S.substr(0, K) + "...";
  }
}

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

  ll K;
  string S;
  cin >> K >> S;

  auto ans = solve(K, S);
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3100
h, w = map(int, input().split())

all_total = 0
col_total = [0]*w

for _ in range(h):
    nums = list(map(int, input().split()))
    row_total = sum(nums)
    col_total = list(map(sum, zip(nums, col_total)))
    all_total += row_total
    print(' '.join(map(str, nums+[row_total])))

print(' '.join(map(str, col_total+[all_total])))


Measured memory_bytes: 5616
#include <cstring>
#include <sstream>
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <cmath>
#include <queue>
#include <set>
#include <numeric>
#include <stack>

using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = n - 1; i >= 0; i--)
#define repone(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define each(i, mp) for(auto i:mp)
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll half_inf = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);
typedef unordered_map<ll, ll> ump;
typedef pair<ll, ll> P;

ump mp;

int main() {
#ifdef MY_DEBUG
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wmissing-noreturn"
    while (true) {
        mp = ump();
#pragma clang diagnostic pop
#endif
        ll n;
        cin >> n;
        vector<ll> a(n);
        rep(i, n) cin >> a[i];
        ll ans = 0;
        ll s = 0, t = 0, sum = 0;
        while (s < n) {
            while (t < n && (sum ^ a[t]) == (sum + a[t])) {
                sum += a[t++];
            }
            ans += t - s;
            if (s == t) sum += a[t++];
            else sum -= a[s++];
        }
        cout << ans << endl;

#ifdef MY_DEBUG
    }
#endif
    return 0;
}

Measured memory_bytes: 1792
use std::io::*;
use std::str::FromStr;

//https://qiita.com/tubo28/items/e6076e9040da57368845
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

//refer
//https://atcoder.jp/contests/agc008/submissions/15248942
fn main() {
    let x: i64 = read();
    let y: i64 = read();

    let mut ans = 1 << 40;
    for (a,b,c) in &[(x,y,0), (-x,y,1), (x,-y,1), (-x,-y,2)]{
        if a <= b{
            ans = std::cmp::min(ans,b-a+c);
        }
    }
    
    println!("{}",ans);

}


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

struct UnionFind{
    vector<int> par, cnt;
    UnionFind(int NV){ 
        par.clear(); 
        cnt.resize(NV, 1); 
        rep(i, 0, NV) par.push_back(i);
    }
    void reset(){ 
        rep(i, 0, cnt.size()) cnt[i] = 1; 
        rep(i, 0, par.size()) par[i] = i; 
    }
    int operator[](int x) {
        if(par[x] == x){
            return x;
        }
        else{
            return par[x] = operator[](par[x]);
        }
    }
    void operator()(int x, int y) {
        x = operator[](x);
        y = operator[](y);
        if (x != y) {
            par[x] = y;
            cnt[y] += cnt[x];
        }
    }
};

int N;

int main(){
    cin >> N;
    vector<pair<int,int>> vx,vy;
    for(int i=0;i<N;i++){
        int x,y;
        cin >> x >> y;
        vx.push_back(make_pair(x,i));
        vy.push_back(make_pair(y,i));
    }

    vector<tuple<int, int, int>> edges;
    sort(vx.begin(), vx.end());
    sort(vy.begin(), vy.end());
    for(int i=0;i<N-1;i++){
        edges.push_back(make_tuple( vx[i + 1].first - vx[i].first, vx[i].second, vx[i + 1].second));
        edges.push_back(make_tuple( vy[i + 1].first - vy[i].first, vy[i].second, vy[i + 1].second));
    }

    sort(edges.begin(), edges.end());
    
    UnionFind uf(N);
    ll ans = 0;

    for (auto p : edges) {
        int x, y, c;
        tie(c, x, y) = p;
 
        if (uf[x] != uf[y]) {
            uf(x, y);
            ans += c;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 7144
//dp[i] - > there are i stones in pile 1 if wins otherwise 0
//if from k we reach any other state (k-a[i]) that is losing state 
//then k is winning state
//dp[x] = 1 (if (x-a[i]) = 0) otherwise dp[x] = 0
#include <bits/stdc++.h>
using namespace std;
string solve(int *a , int n , int k){
    bool dp[k+1];
    memset(dp , 0  ,sizeof(dp));
    for(int i=1 ; i<=k ; i++){
        for(int j=1 ; j<=n ; j++){
            if(a[j] > i){continue;}
            if(dp[i-a[j]] == 0){
                dp[i] = 1;
            }
        }
    }
    if(dp[k] == 1){
        return "First";
    }else{
        return "Second";
    }
}
int main() {
    int n , k;
    cin>>n>>k;
    int a[n+1];
    for(int i=1 ; i<=n ; i++){
        cin>>a[i];
    }
    cout<<solve(a , n , k);
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
typedef pair<ll, ll> P;
using VP = vector<P>;
using VVP = vector<VP>;
using VI = vector<ll>;
using VVI = vector<VI>;
using VVVI = vector<VVI>;
const int inf = 1e9 + 7;
const ll INF = 1LL << 61;
const ll mod = 1e9 + 7;

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

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

int gcd(int a, int b) {
    if (a < b) swap(a, b);
    if (a % b == 0) return b;
    return gcd(b, a % b);
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int i, j;
    int x;
    cin >> x;
    int g = gcd(360, x);
    cout << 360 / g << endl;
}

Measured memory_bytes: 3636
q,h,s,d=map(int,input().split())
n=int(input())
a=sorted([q*8,h*4,s*2,d])
if a[0]==q*8:
    print(q*4*n)
elif a[0]==h*4:
    print(h*2*n)
elif a[0]==s*2:
    print(s*n)
else:
    if n%2==0:
        print(d*(n//2))
    else:
        ans=d*(n//2)
        a=sorted([q*8,h*4,s*2])
        if a[0]==q*8:
            ans+=q*4
        elif a[0]==h*4:
            ans+=h*2
        else:
            ans+=s
        print(ans)

Measured memory_bytes: 61932
T = gets.to_i
T.times do
    a, b, c, d = gets.split.map(&:to_i)
    if a < b
        puts 'No'
        next
    end
    if b > d
        puts 'No'
        next
    elsif b == d
        puts c >= a % b ? 'Yes' : 'No'
        next
    else
        if c >= b
            puts 'Yes'
            next
        end
        gcd = b.gcd(d)
        rest = a % gcd
        t = (c-rest)/gcd+1
        min = t*gcd + rest
        puts min >= b ? 'Yes' : 'No'
    end
end

Measured memory_bytes: 1788
#include<stdio.h>

int main(){

  int H,W;
  int i,j,k,l;
  for(i=0;;i++){
    scanf("%d %d",&H,&W);
    if(H==0 && W==0) break;
    for(i=0;i<W;i++){
      printf("#");
    }
    printf("\n");

    for(j=1;j<H-1;j++){
      for(k=1;k<=W;k++){
        if(k==1 || k==W){
          printf("#");
        }
        else{
          printf(".");
        }
      }
      printf("\n");
    }
    for(l=0;l<W;l++){
      printf("#");
    }
    printf("\n");

    printf("\n");
 }



  return 0;
}

Measured memory_bytes: 572
/**
 * Created by hiramekun at 14:58 on 2019-08-26.
 */
#include <bits/stdc++.h>

using namespace std;

using ll = long long;

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = ll(n - 1); i >= 0; i--)
#define each(i, mp) for(auto& i:mp)
#define all(obj) (obj).begin(), (obj).end()

/* ------------- ANSWER ------------- */
/* ---------------------------------- */
// 約数列挙
vector<ll> divisor(ll n) {
    vector<ll> res;
    for (ll i = 1; i * i <= n; ++i) {
        if (n % i == 0) {
            res.emplace_back(i);
            if (i != n / i) res.emplace_back(n / i);
        }
    }
    return res;
}

int main() {

    ll n, k;
    cin >> n >> k;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];

    vector<ll> divs = divisor(accumulate(all(a), 0LL));

    ll ans = 0;
    each(e, divs) {
        vector<ll> mods(n);
        rep(i, n) mods[i] = a[i] % e;
        sort(all(mods));

        vector<ll> minus(n + 1);
        rep(i, n) minus[i + 1] = minus[i] + mods[i];

        vector<ll> plus(n + 1);
        repr(i, n) plus[i] = plus[i + 1] + e - mods[i];

        for (ll i = 0; i <= n; ++i) {
            if (max(plus[i], minus[i]) <= k) ans = max(ans, e);
        }
    }
    cout << ans << '\n';
    return 0;
}

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

int main(){
	int H,W;
	while(cin >> W >> H && W){
		int c[10][10] = {0};
		for(int i = 1 ; i <= H ; i++)
			for(int j = 1 ; j <= W ; j++)
				cin >> c[i][j];
		int sx , sy ;
		for(int i = 1 ; i <= H ; i++)
			for(int j = 1 ; j <= W ; j++)
				if(c[i][j] == 2){
					sx = j;
					sy = i;
					c[i][j] = 1;
				}
		int done[10][10][10];
		memset(done,-1,sizeof(done));
		queue< pair< pair<int,int> , int > > Q;
		Q.push( make_pair(make_pair(sx,sy),6) );
		done[sx][sy][6] = 0;
		
		int dx[] = {-1,0,1,0};
		int dy[] = {0,1,0,-1};
		while(Q.size()){
			int x = Q.front().first.first;
			int y = Q.front().first.second;
			int r = Q.front().second;
			int xx = done[x][y][r];
			Q.pop();
			if(r == 0) continue;
			if(c[y][x] == 3){ cout << done[x][y][r] << endl; goto exit;}
			if(c[y][x] == 4) r = 6;
			for(int i = 0 ; i < 4 ; i++){
				int tx = x + dx[i];
				int ty = y + dy[i];
				int tr = r-1;
				if(c[ty][tx] == 0) continue;
				if(~done[tx][ty][tr]) continue;
				Q.push(make_pair(make_pair(tx,ty),tr));
				done[tx][ty][tr] = xx+1;
			}
		}
		cout << -1 << endl;
		exit:;
	}
}

Measured memory_bytes: 0
/*
--------------              |   /
      |                     |  /
      |                     | /
      |             *       |/          |    |         ------            *
      |                     |           |    |        /      \
      |             |       |\          |    |       |       |\          |
   \  |             |       | \         |    |       |       | \         |
    \ |             |       |  \        |    |        \     /   \        |
     V              |       |   \        \__/|         -----     \       |
*/
#include <bits/stdc++.h>
using namespace std;

#define EmiliaMyWife ios::sync_with_stdio(0); cin.tie(NULL);
#define mem(i,j) memset(i,j,sizeof (i));
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(), (a).end()
#define lowbit(x) ((x)&(-(x)))
#define siz(v) (long long)(v).size()
typedef int64_t ll;
typedef uint64_t ull;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
const double EPS  = 1e-8;
const int INF     = 0x3F3F3F3F;
const ll LINF     = 4611686018427387903;
const int MOD     = 1e9+7;
const int MAXN    = 2e5+9;
/*-----------------------------------------------------------------------------------------------------*/

signed main() {
	EmiliaMyWife

	ll n, m;
	cin >> n >> m;
	//cout << n%m;
	cout << min(n%m, m-n%m);

	return 0;
}


Measured memory_bytes: 256
n, m = gets.chomp.split.map(&:to_i)
sc = []

m.times do |i|
  sc << gets.chomp.split.map(&:to_i)
end


1000.times do |i|
  str = i.to_s
  check = true
  next if str.length != n
  sc.each do |num|
    check = false if str[num[0]-1] != num[1].to_s
  end
  if check
    puts str
    exit
  end
end


puts "-1"

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

using namespace std;

using ll = long long;
using Vi = vector<int>;
using Vl = vector<ll>;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

//===


int main() {
	int A, B;
	cin >> A >> B;
	int c = A + B;

	if (c % 2 == 0) {
		cout << c / 2 << endl;
	}
	else {
		cout << "IMPOSSIBLE" << endl;
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;

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

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

	REP(i, (int)s.size() - 1){
		if (s.substr(i, 2) == "AC"){
			cout << "Yes" << endl;
			return 0;
		}
	}

	cout << "No" << endl;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {

  public static void main(String[] args) { 
      Scanner sc = new Scanner(System.in);
      long a = sc.nextLong();
      long b = sc.nextLong();
      long res = 0;
      if(a % 2 == 1) {
        res ^= a;
        a++;
      }
      if(b % 2 == 0) {
        res ^= b;
        b--;
      }
      
      long cnt = (b - a + 1) / 2;
      if(cnt % 2 == 1)
        res ^= 1; 
      System.out.println(res);
  }
}

Measured memory_bytes: 21844
#include <iostream>

using namespace std;

long long modPow(long long a, long long n, long long p) {
  if (n == 0) return 1; // 0乗にも対応する場合
  if (n == 1) return a % p;
  if (n % 2 == 1) return (a * modPow(a, n - 1, p)) % p;
  long long t = modPow(a, n / 2, p);
  return (t * t) % p;
}

int main()
{
    long long m, n;
    cin >> m >> n;
    cout << modPow(m, n, 1000000007) << endl;
    return 0;
}


Measured memory_bytes: 3104
fun main(args: Array<String>){
    val (h, w) = readLine()!!.split(" ").map { it.toInt() }
    val s = Array(h){ readLine()!! }
    for(i in 0 until h){
        for(j in 0 until w){
            if(s[i][j] == '#'){
                var f = false
                if(i != 0){
                    f = f || s[i - 1][j] == '#'
                }
                if(j != 0){
                    f = f || s[i][j - 1] == '#'
                }
                if(i != h - 1){
                    f = f || s[i + 1][j] == '#'
                }
                if(j != w - 1){
                    f = f || s[i][j + 1] == '#'
                }
                if(!f){
                    println("No")
                    return
                }
            }

        }
    }
    println("Yes")
}

Measured memory_bytes: 38060
#include <iostream>
#include <string>
#include <algorithm>
#include <bits/stdc++.h>
#include <stdio.h>
using namespace std;
int main(void)
{
  long n,one=0,two=0,count=0;
  cin>>n;
  vector<long> a(n);
  for (int i = 0; i < n; ++i)
    cin>>a.at(i);
  sort(a.begin(),a.end());
  for (int i = n; i > 1; --i)
  {
    if(a.at(i-1)==a.at(i-2))
    {
      if(one==0)
        one=a.at(i-1);
      else
      {
        two=a.at(i-1);
        break;
      }
      i--;
    }
  }
  cout<<one*two<<endl;
  
  return(0);
}

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

const LL MX = 100005;

int main(){
	LL n;
	cin >> n;
	vector<int> cnt(MX); 
	LL ans = 0;
	rep(i,n){
		LL a;cin >> a;
		cnt[a]++;ans+=a;
	}
	LL	 q;cin >> q;
	rep(i,q){
		LL b, c;
		cin >> b >> c;
		ans += (c-b)*cnt[b];
		cnt[c] += cnt[b];
		cnt[b] = 0;
		cout << ans << endl;
	}
     return 0;

}




Measured memory_bytes: 3764
import java.util.*;

public class Main {
	public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        List<Integer> list = new ArrayList<Integer>();
        for (int tmp = 0; tmp < m; tmp++) {
            int w = sc.nextInt();

            list.add(w);
        }

        long INF = 1000000007;
        long[] dp = new long[n + 1];

        dp[0] = 1;
        dp[1] = 1;

        for (int i = 0; i < m; i++) {
            dp[list.get(i)] = -1;
        }

        for (int j = 2; j <= n; j++) {
            if (dp[j] != -1 && dp[j - 1] != -1 && dp[j - 2] != -1) {
                dp[j] = (dp[j - 1] + dp[j - 2]) % INF;
            } else if (dp[j] != -1 && dp[j - 1] == -1) {
                dp[j] = (dp[j - 2]);
            } else if (dp[j] != -1 && dp[j - 2] == -1) {
                dp[j] = (dp[j - 1]);
            }


        }
        if (dp[n] == -1) {
            System.out.println(0);
        } else {
            System.out.println(dp[n] % INF);
        }
    }
}

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

typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)

// cout<<fixed<<setprecision(10);
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;}

ll f(ll h){
    ll ret = 0;
    while(true){
        if(h == 0) break;
        ret++;
        h = h/2;
    }
    return ret;
}

int main(){
    ll h; cin >> h;
   // cout << f(h) << endl; // debug
    ll n = f(h);
    ll ans = pow(2, n)-1;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)


void solve(std::string S){
    int c = count(S.cbegin(), S.cend(), 'o');
    cout << 700 + 100* c << endl;
}

int main(){

    std::string S;
    std::cin >> S;
    solve(S);
    return 0;
}



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

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

int main (void) {
    int i;
    int n, m;

    scanf("%d%d", &n, &m);

    int a[n];
    int sum = 0;

    for ( i=0; i<n; i++ ) {
        scanf("%d", &a[i]);
        sum += a[i];
    }

    qsort(a, n, sizeof(int), comp_int);

    int limits;
    if ( sum % (m * 4) == 0 )
        limits = sum / (m * 4);
    else
        limits = ceil((double)sum / (m * 4));
    for ( i=0; i<m; i++ ) {
        if ( a[i] < limits ) {
            printf("No\n");
            return EXIT_SUCCESS;
        }
    }
    printf("Yes\n");
    return EXIT_SUCCESS;
}


Measured memory_bytes: 128
import random
import numpy
import sys

N=int(input()) #枚数
A = list(map(int, input().split(" ")))#カードのリスト

alice = []
bob = []
while not len(A)==0:
  A = sorted(A,reverse=True)
  alice.append(A.pop(0))
  if len(A)==0:
    break
  bob.append(A.pop(0))
print(sum(alice)-sum(bob))


Measured memory_bytes: 13176
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define repe(i,n) for(int i=0;i<n;i++)
#define repa(i,j,n) for(int i=j;i<n;i++)
//#define v.all() v.begin(),v.end()
#define repr(i,n) for(int i=n;i>=0;i--)
#define int long long int
#define vi vector<int>
#define vpi vector<pair<int,int>>
int gcd(int a,int b){
	if(b==0) return a;
	else return gcd(b,a%b);
}
vi primef(int n){
	vi a,ref;
	a.push_back(1);
	while(n%2==0) {
		a.push_back(2);
		n/=2;
	}
	for(int i=3;i<=sqrt(n);i+=2){
		while(n%i==0){
			a.push_back(i);

			n/=i;
		}
	}
	if(n>2) a.push_back(n);
	sort(a.begin(), a.end());
	ref.push_back(a[0]);
	for(int i=1;i<a.size();i++){
		if(a[i]!=a[i-1]) {
			ref.push_back(a[i]);
		}
	}
	return ref;
}
signed  main(){
	int t=1;
	//cin>>t;
	while(t--) {
		int x;
		cin>>x;
		x/=200;
		x-=1;
		cout<<9-x<<endl;



	}
	return 0;
}

Measured memory_bytes: 3612
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<string>
#include<cstring>
#include<queue>
#include<vector>
#include<functional>
#include<cmath>
#include<map>
#include<stack>
#include<set>
#include<numeric>
#include<limits>
#include<iterator>

#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define rep(i,n) for(int i=0; i<n; i++)

using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<ll, char> plc;

int d[10][10];

int main()
{
	rep(i, 6)rep(j, 6)d[i][j] = -1;
	d[0][1] = d[2][1] = d[3][4] = d[5][2] = d[4][5] = 0;
	d[0][2] = d[1][3] = d[3][5] = d[5][1] = d[4][2] = 1;
	string s;
	while (1) {
		cin >> s;
		if (s == "#")break;

		int pos = 0,ans = 1;
		rep(i, s.size()) {
			bool f = false;
			rep(j, 6) {
				if (d[pos][j] == s[i] - '0') {
					f = true;
					pos = j;
					break;
				}
			}
			if (!f) {
				ans = 0;
				break;
			}
		
		}
		if (pos != 5)ans = 0;
		if (ans)cout << "Yes" << endl;
		else cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 3212
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int size = sc.nextInt();
		int at = sc.nextInt();
		sc.nextLine();
		String line = sc.nextLine();
		sc.close();
		line = "T" + line + "T";
		// closeしよう
		String pre = line.substring(0, at);
		String suf = line.substring(at+1, size+1);
		char atChar = line.charAt(at);
		Character.toLowerCase(atChar);
		String output = pre + Character.toLowerCase(atChar) + suf;

		System.out.println(output.substring(1,size+1));
	}
}

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

char ss[12][12];

void dfs(int x, int y) {
  if (x < 0 || y < 0 || x >= 12 || y >= 12 || ss[y][x] == '0')
    return;
  ss[y][x] = '0';
  dfs(x + 1, y);
  dfs(x - 1, y);
  dfs(x, y + 1);
  dfs(x, y - 1);
}
int main() {
  int n, ans = 0;
  while (cin >> ss[0][0]) {
    ans = 0;
    rep(i, 12) rep(j, 12) {
      if (i == 0 && j == 0)
        ;
      else
        cin >> ss[i][j];
    }
    rep(i, 12) rep(j, 12) {
      if (ss[i][j] == '1') {
        ans++;
        dfs(j, i);
      }
    }
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 3044
import static java.lang.System.*;
import java.util.*;

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

        int h = sc.nextInt();
		int w = sc.nextInt();
		int n = sc.nextInt();
		int y = sc.nextInt()-1;
		int x = sc.nextInt()-1;
		
		char[] s = sc.next().toCharArray();
		char[] t = sc.next().toCharArray();
		
		int lx=0, rx=0, uy=0, dy=0;
		for(int i=n-1; i>=0; i--) {
			switch(t[i]) {
				case 'L':
					if(rx > 0) rx--; break;
				case 'R':
					if(lx > 0) lx--; break;
				case 'U':
					if(dy > 0) dy--; break;
				case 'D':
					if(uy > 0) uy--; break;
			}
			switch(s[i]) {
				case 'L':
					lx++; break;
				case 'R':
					rx++; break;
				case 'U':
					uy++; break;
				case 'D':
					dy++; break;
			}
			if(lx + rx >= w || uy + dy >= h) break;
		}

		//out.println(lx + " " + rx + " " + uy + " " + dy);
		
		boolean ans = true;
		ans &= x - lx >= 0;
		ans &= x + rx < w;
		ans &= y - uy >= 0;
		ans &= y + dy < h;
        out.println(ans?"YES":"NO");
    }
}


Measured memory_bytes: 31632
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define sf scanf
#define pf printf
#define pb push_back
#define llu unsigned long long
#define U unsigned int
#define SIZE 100005
#define pie 3.14159265358979323
#define minuss 1e-6
#define fast_cin ios_base::sync_with_stdio(false);cin.tie(NULL)
#define BIG 1000000000
#define N 10000
ll tra[100006],tra1[100006];

int main()
{
    string s;
    cin>>s;
    ll one=0,zero=0;
    for(int i=0;i<s.length();i++)
    {
        if(s[i]=='1')
            one++;
        else
            zero++;
    }
    cout<<(min(one,zero)*2)<<endl;



}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> llP;

ll mod(ll a, ll b){
  ll ret=a%b;
  if(ret<0) ret+=b;
  return ret;
}

ll modpow(ll a,ll b,ll c){
  ll res=1;
  while(b>0){
    if(b&1) res=mod(res*a,c);
    a=mod(a*a,c);
    b>>=1;
  }
  return res;
}

int main() {
  int n,m;
  cin>>n>>m;
  int x[m],y[m],sum[n];
  bool pos[n];
  for(int i=0;i<m;i++){
    cin>>x[i]>>y[i];
    x[i]--;y[i]--;
  }
  for(int i=0;i<n;i++){
    sum[i]=1;
    pos[i]=false;
  }
  pos[0]=true;
  for(int i=0;i<m;i++){
    if(pos[x[i]]) pos[y[i]]=true;
    sum[x[i]]--;sum[y[i]]++;
    if(sum[x[i]]==0) pos[x[i]]=false; 
  }
  int ans=0;
  for(int i=0;i<n;i++){
    if(pos[i])ans++;
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 4860
module M = Map.Make (struct type t = int let compare = compare end)
module S = Set.Make (struct type t = int let compare = compare end)

let () =
    let main () =
        let n = Scanf.sscanf (read_line ()) "%d" (fun n -> n) in
        let xy = Array.init n (fun _ -> Scanf.sscanf (read_line ()) "%d %d" (fun x y -> x, y)) in
        let xmap = Array.fold_left (fun map (x, y) ->
            M.add x (S.add y (try M.find x map with _ -> S.empty)) map) M.empty xy in
        let ymap = Array.fold_left (fun map (x, y) ->
            M.add y (S.add x (try M.find y map with _ -> S.empty)) map) M.empty xy in
        let cx = Array.make 100002 true in
        let cy = Array.make 100002 true in
        let rec dfs_x px set ax ay =
            cx.(px) <- false;
            S.fold (fun py ((ax, ay) as acc) ->
                if cy.(py) then dfs_y py (M.find py ymap) ax ay else acc) set (ax + 1, ay)
        and dfs_y py set ax ay =
            cy.(py) <- false;
            S.fold (fun px ((ax, ay) as acc) ->
                if cx.(px) then dfs_x px (M.find px xmap) ax ay else acc) set (ax, ay + 1)
        in
        let acc = M.fold (fun x set acc ->
            if cx.(x) && S.cardinal set > 0 then let sx, sy = dfs_x x set 0 0 in acc + sx * sy else acc) xmap 0 in
        let acc = M.fold (fun y set acc ->
            if cy.(y) && S.cardinal set > 0 then let sx, sy = dfs_y y set 0 0 in acc + sx * sy else acc) ymap acc in
        Printf.printf "%d\n" (acc - n)
    in
    main ()

Measured memory_bytes: 37628
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1e9+7,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<int,int> P;

void Main() {
  string s,t;
  cin >> s >> t;
  ll x;
  stringstream ss;
  ss << s+t;ss >> x;
  ll y=sqrt(x);
  if(x==y*y) pr("Yes");
  else pr("No");
}

int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}


Measured memory_bytes: 256
#include<stdio.h>

int main(){
   int a=0,b=0,c=0;      // define variable, 0<= a, b, c <=100

   scanf("%d %d %d", &a, &b, &c);   // input

   if(a<b && b<c) printf("Yes\n");
   else printf("No\n");

   return 0;
}

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

namespace AtCoder
{
    class Program
    {

        static void Main()
        {
            IO io = new IO();
            Func func = new Func();

            //ここから


            int[] str = io.ReadLineToIntArray();
            int n = str[0];
            int m = str[1];
            
            string s = io.ReadLineToString();
            string t = io.ReadLineToString();

            int gcd = (int)func.Gcd(n, m);
            for (int i = 0; i < gcd; i++)
            {
                if (s[(n / gcd) * i] != t[(m / gcd) * i])
                {
                    Console.WriteLine(-1);
                    return;
                }
            }

            long ans = func.Lcm(n, m);


            //ここまで

            Console.WriteLine(ans);
            Console.ReadKey();
        }
    }

    //関数
    public class Func
    {
        public void Swap<T>(ref T a,ref T b)
        {
            T temp;
            temp = a;
            a = b;
            b = temp;
        }

        public long Gcd(int a,int b)
        {
            return b != 0 ? Gcd(b, a % b) : a;
        }

        public long Lcm(int a,int b)
        {
            long gcd = Gcd(a, b);
            return (long)a * b / gcd;
        }
    }

    //IOを担う関数群
    public class IO
    {
        //stringの入力
        public string ReadLineToString()
        {
            return Console.ReadLine();
        }

        //intの入力
        public int ReadLineToInt()
        {
            return int.Parse(Console.ReadLine());
        }

        //空白区切りの複数の文字列の入力をstring[]にして返す
        public string[] ReadLineToStringArray()
        {
            return Console.ReadLine().Split(' ').ToArray();
        }


        //空白区切りの複数の整数の入力をint[]にして返す
        public int[] ReadLineToIntArray()
        {
            return Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
        }

        //空白区切りの複数の文字列の入力をList<string>で受け取る
        public List<string> ReadLineToStringList()
        {
            return Console.ReadLine().Split(' ').ToList();
        }

        //空白区切りの複数の整数の入力をList<int>で受け取る
        public List<int> ReadLineToIntList()
        {
            return Console.ReadLine().Split(' ').Select(int.Parse).ToList();
        }
    }

}


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

int main()
{
  int x;
  cin >> x;
  int max_n = (int)(x / 100);
  int residue = x % 100;
  if(residue <= max_n * 5)
    cout << 1 << endl;
  else
    cout << 0 << endl;
  return 0;
}

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

int main(){
    int a, b;
    cin >> a >> b;
    if(a < b){
	for(int i = 0; i < b; i++) cout << a;
    }		
    else{
	for(int i = 0; i < a; i++) cout << b;
    }
    cout << endl;
}


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

using namespace std;
typedef long long ll;

#define MOD (long long)(1e9+7)
#define INF (1LL<<60)
#define rep(i,n) for(ll i = 0; i < (n); i++)
#define rep1(i,n) for(ll i = 1; 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;
}


// 最大公約数
ll gcd(ll a, ll b)
{
  if(b == 0) return a;
  return gcd(b, a % b);
}

// mod m におけるa の逆元
ll modinv(ll a, ll m) {
  ll b = m, u = 1, v = 0;
  while (b) {
    ll t = a / b;
    a -= t * b; swap(a, b);
    u -= t * v; swap(u, v);
  }
  u %= m;
  if (u < 0) u += m;
  return u;
}

// 素因数分解
vector<pair<ll, ll>> prim;
void pf(ll n)
{
  ll s = sqrt(n);
  ll r = 0;
  for(ll i = 2; i <= s; i++) {
    if((n % i) == 0) {
      r = 0;
      do {
	r++;
	n = n / i;
      } while((n % i) == 0);
      prim.push_back({i, r});
    }
  }
  if(n > s) {
    prim.push_back({n, 1});
  }
}

void solve()
{
  ll N, K; cin >> N >> K;
  vector<ll> a(N); rep(i, N) cin >> a[i];
  
  ll ans = 0;

  vector<ll> a1(N), b1(N);
  rep(i, N) {
    rep(j, N) {
      if(a[j] < a[i]) {
	if(j < i) b1[i] ++;
	else a1[i] ++;
      }	
    }
  }
  ll mod2 = modinv(2, MOD);
  cerr << mod2 << endl;
  rep(i, N) {
    ans += a1[i] * K;
    
    ans %= MOD;
  
    ans += ((((((a1[i] + b1[i]) * K) % MOD ) *(K-1)) % MOD) * mod2) % MOD;
    ans %= MOD;

  }
  
  

  cout << ans << endl;
}


int main(void)
{
  // ll t; cin >> t; rep(i, t)
  solve();
}


Measured memory_bytes: 3648
object Main extends App {
    val in = io.Source.stdin.getLines.map(_.split(" ").map(_.toInt))
    val n = in.next.head
    val a = (0 to n-1).toArray
    def find(m: Int): Int = if(a(m) == m) m else {a(m) = find(a(m)); a(m)}
 
    def unite(x: Int, y: Int) = {
        val _x = find(x)
        val _y = find(y)
        if(_x != _y) a(_x) = _y
    }
 
    in.foreach(_ match {
        case Array(0, x, y) => unite(x, y)
        case Array(1, x, y) => println(if (find(x) == find(y)) 1 else 0)
    })
}

Measured memory_bytes: 165892
import itertools as it
n = int(input())
l = list(map(int, input().split()))
s = []
ans = 0
l.sort()
seed = list(range(0,n))
cmt = list(it.combinations(seed, 3))
for i in range(len(cmt)):
  a = cmt[i]
  if l[a[1]] + l[a[0]] > l[a[2]] and l[a[0]] != l[a[1]] and l[a[1]] != l[a[2]] and l[a[0]] != l[a[2]]:
    ans += 1
print (ans)

Measured memory_bytes: 20488
#include <algorithm>
#include <climits>
#include <cmath>
#include <iostream>
#include <map>
#include <string>
#include <vector>

using namespace std;
using ll = long long int;

const ll MOD = 1e9 + 7;

ll pow_fast(ll n, ll k) {
  if (k == 0) {
    return 1LL;
  }
  if (k == 1) {
    return n;
  }

  if (k % 2 == 0) {
    ll tmp = pow_fast(n, k / 2);
    return tmp * tmp % MOD;
  } else {
    ll tmp = pow_fast(n, (k - 1) / 2);
    tmp *= tmp;
    tmp %= MOD;
    return tmp * n % MOD;
  }
}

template <typename T>
class stack {
 private:
  vector<T> _vec;

 public:
  stack(){};

  void push(T n) {
    _vec.push_back(n);
    return;
  }

  void pop() {
    if (this->empty()) {
      return;
    }
    _vec.erase(_vec.end() - 1);
    _vec.shrink_to_fit();
    return;
  }

  size_t size() { return _vec.size(); }

  T top() { return _vec[this->size() - 1]; }
  bool empty() { return _vec.empty(); }
};

int main() {
  ll N;
  cin >> N;
  vector<ll> A(N);

  for (ll i = 0; i < N; i++) {
    ll ai;
    cin >> ai;
    A[i] = ai;
  }

  sort(A.begin(), A.end());
  cout << (A[A.size() - 1] - A[0]) << endl;
}

Measured memory_bytes: 3596
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <string>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <climits>
#include <utility>
#include <numeric>
typedef long long ll;
using namespace std;

int main(void){
  int x, y, z, k, i, j;
  cin >> x >> y >> z >> k;
  vector<ll> a(x), b(y), c(z), d(x*y), e(min(k,x*y)*z);

  for(i=0;i<x;i++){
    cin >> a[i];
    a[i] *= -1LL;
  }
  for(i=0;i<y;i++){
    cin >> b[i];
    b[i] *= -1LL;
  }
  for(i=0;i<z;i++){
    cin >> c[i];
    c[i] *= -1LL;
  }

  for(i=0;i<x;i++){
    for(j=0;j<y;j++){
      d[i*y+j] = a[i] + b[j];
    }
  }
  sort(d.begin(),d.end());
  sort(c.begin(),c.end());

  for(i=0;i<min(k,x*y);i++){
    for(j=0;j<z;j++){
      e[i*z+j] = d[i] + c[j];
    }
  }

  sort(e.begin(),e.end());

  for(i=0;i<k;i++){
    cout << e[i] * -1LL << endl;
  }

  return 0;
}


Measured memory_bytes: 34676
#include<string>
#include<iostream>

using namespace std;

int main()
{
	int a,b,c;
	cin >> a >> b >> c;
	int i,j=0;
	for(i=a;i<=b;i++){
	
		if(c%i==0) j++;
	
	}
	cout << j <<endl;
}

Measured memory_bytes: 1160
import sys
C = [list(map(int, input().split())) for _ in range(3)]
for i in range(3):
    if not ((C[i][0] - C[(i + 1) % 3][0]) == (C[i][1] - C[(i + 1) % 3][1]) == (C[i][2] - C[(i + 1) % 3][2])):
        print('No')
        sys.exit()
for j in range(3):
    if not ((C[0][j] - C[0][(j + 1) % 3]) == (C[1][j] - C[1][(j + 1) % 3]) == (C[2][j] - C[2][(j + 1) % 3])):
        print('No')
        sys.exit()
print('Yes')


Measured memory_bytes: 9088
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <set>
#include <map>
#include <algorithm>

#define int long long
#define MOD7 1000000007
#define MOD9 1000000009

#define rep(i, n) for (int i = 0; i < (n); i++)
#define REP(i, a, n) for (int i = (a); i <= (n); i++)
#define all(a) (a).begin(), (a).end()

using namespace std;

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

int nextInt() {int a; cin >> a; return a;}
char nextChar() {char a; cin >> a; return a;}
double nextDouble() {double a; cin >> a; return a;}
string nextString() {string a; cin >> a; return a;}

void inputVector(vector<int> &v, int &n) {rep(i,n){v.push_back(nextInt());}}
void inputVector(vector<double> &v, int &n) {rep(i,n){v.push_back(nextDouble());}}
void inputVector(vector<string> &v, int &n) {rep(i,n){v.push_back(nextString());}}

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

    rep(i, n) {
	int y, m, d;
	cin >> y >> m >> d;

	int ret = 0;
	while (d <= (y % 3 == 0 || m % 2 ? 20 : 19)) {
	    ret++;
	    d++;
	}
	m++;
	while (m <= 10) {
	    ret += (y % 3 == 0 || m % 2 ? 20 : 19);
	    m++;
	}
	y++;
	while (y <= 999) {
	    ret += y % 3 ? 195 : 200;
	    y++;
	}
	cout << ret << endl;
    }

    return 0;
}

Measured memory_bytes: 2980
MOD = 10 ** 9 + 7


def make_table_mod(n, mod=10 ** 9 + 7):
    fct = [1, 1]
    inv = [1, 1]

    for i in range(2, n + 1):
        fct.append((fct[i-1] * i) % MOD)
        inv.append(divmod(fct[i]))
    return fct, inv


def divmod(n, p=10**9+7):
    return pow(n, p-2, p)


def ncr(n, r, mod=10**9+7):
    return (fct[n] * inv[r] * inv[n-r]) % mod

N, K = map(int, input().split())
fct, inv = make_table_mod(N)
for i in range(1, K + 1):
    if N - K + 1 < i:
        print(0)
    else:
        print((ncr(N - K + 1, i) * ncr(K - 1, i - 1)) % MOD)


Measured memory_bytes: 41968
#include <stdio.h>

int main(void){
    int buf, i, j = 0;
    int ary[3];
    
    scanf("%d %d %d", &ary[0], &ary[1], &ary[2]);
    for (i = 0; i < 3; i++){
        buf = ary[i];
        for (j = i; j < 3; j++){
            if (ary[j] < buf){
                ary[i] = ary[j];
                ary[j] = buf;
                buf = ary[i];
            }
        }
    }
    printf("%d %d %d\n", ary[0], ary[1], ary[2]);
    return 0;
}


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

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int a, b, k;
	cin >> a >> b >> k;
	int c = 0;
	for(int i = 100; i > 0; i--) {
		if(a % i == 0 && b % i == 0) {
			c++;
		}
		if(c == k) {
			cout << i << endl;
			return 0;
		}
	}
	return 0;
}
/* --------------------------------------- */


Measured memory_bytes: 256
public class Main {
	public static void main(String[] args){
		java.util.Scanner scan = new java.util.Scanner(System.in);
		int n = scan.nextInt();
		String taro;
		String hana;
		int countt = 0;
		int counth = 0;

		for(int i = 0; i < n;i++){
			taro = scan.next();
			hana = scan.next();

			if(taro.compareTo(hana) > 0){
				countt += 3;
			}else if(taro.compareTo(hana) < 0){
				counth += 3;
				}else{
					countt++;
					counth++;
				}
			}
		System.out.println(countt +" "+counth);
	}

}

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

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

    int data = 1;
    for (int i = 0; i < N; i++) {
        data = min(data * 2, data + K);
    }
    cout << data;
}


Measured memory_bytes: 256
import java.util.*;

class Main{
    public Main(){
        Scanner SC = new Scanner(System.in);

        int S = Integer.parseInt(SC.next());
        int W = Integer.parseInt(SC.next());

        if(S <= W){
            System.out.println("unsafe");
        }else{
            System.out.println("safe");
        }

    }

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


Measured memory_bytes: 35724