akhauriyash/Code-Regression huggingface dataset:
/*
Looking from a window above
It's like a story of love
Can you hear me?
Came back only yesterday
I'm moving further away
Want you near me
All I needed was the love you gave
All I needed for another day
And all I ever knew
Only you
Sometimes when I think of her name
When it's only a game
And I need you
Listen to the words that you say
It's getting harder to stay
When I see you
All I needed was the love you gave
All I needed for another day
And all I ever knew
Only you, only you
Uh uh uh only you, only you
Only you, only you, only you
This is going to take a long time
And I wonder what's mine
Can't take no more
Wonder if you'll understand
It's just the touch of your hand
Behind a closed door
And all I needed was the love you gave
All I needed for another day
And all I ever knew
Only you, only you, only you
All I needed was the love you gave
All I needed for another day
And all I ever knew
Only you, only you, only you
Only you
*/

#include <bits/stdc++.h>

using namespace std;

#define int long long
#define ld long double
#define endl '\n'
#define rep(x,s,e) for(int x=s;x<=(e);x++)
#define repn for(int x=0;x<n;x++)
#define rep1n for(int x=1;x<=n;x++)
#define rep1m for(int y=1;y<=m;y++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(), x.rend()
#define precise(x) cout << fixed << setprecision(x)
#define bits(x) __builtin_popcountll(x)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define sz(x) ((int)(x.size()))
#define test int t; cin>>t; while(t--)
#define FAST                          \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL)

typedef vector<int> vi;
typedef vector<pair<int,int>> vii;
typedef pair<int,int> pii;


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


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

const int inf = 3e18;
const int N = 5e5 + 100;




int32_t main(){ 
   FAST;
   string a, b, c;
   cin >> a >> b >> c;
   cout << (a.back() == b.front() and (b.back() == c.front()) ? "YES" :"NO") << '\n';
}

Measured memory_bytes: 256
/*
これを入れて実行
g++ code.cpp
./a.out
 */
 
#include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>
#include <bitset>
#include <functional>

#define all(x) (x).begin(),(x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
using namespace std;
typedef long long ll;
typedef long double ld;
 
int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
 
const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;
 
bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}
 
ll gcd(ll a, ll b){
	if (b == 0)return a;
	return gcd(b, a % b);
}
 
ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}
 
ll nCr(ll n, ll r){
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return (nCr(n - 1, r) + nCr(n - 1, r - 1));
}
 
ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}
 
//-----------------------ここから-----------
int main(void){
    int n;
    cin >> n;
    vector<pair<int,int>> a(n);
    rep(i, n) cin >> a[i].first >> a[i].second;
    sort(all(a));
    double ans = 0;
    double cnt = 0;
    do{
        double tmp = 0;
        rep(i, n - 1){
            double dist = sqrt(pow(a[i].first - a[i + 1].first, 2.0) + pow(a[i].second - a[i + 1].second, 2.0));
            tmp += dist;
        }
        ans += tmp;
        cnt++;
    } while(next_permutation(all(a)));
    cout << fixed << setprecision(15) << ans / cnt << endl;
}   

Measured memory_bytes: 256
#include <iostream> // cin, cout, cerr
#include <algorithm> // minmax, sort, swap
#include <numeric> // iota
#include <cstdio> // printf, scanf
#include <string> // string, stoi, to_string
#include <vector> // vector
#include <queue> // queue, priority_queue
#include <deque> // deque
#include <map> // key-value pairs sorted by keys
#include <set> // set
#include <iomanip> // cout<<setprecision(n)
#include <functional> // function<void(int)>
#include <cmath>

#ifdef DEBUG
#include "debug.hpp"
#else
#define debug(...)
#endif

#define int long long // at least int64 > 9*10^18
#define ENDL '\n'
#define rep(i,n) for(int i = 0; i < (n); i++)
#define print(i) std::cout << (i) << '\n'
#define all(v) (v).begin(), (v).end()
/* libraries */

// ceil of a/b
inline int ceil(int a, int b) { return (a%b?a/b+1:a/b); }


struct S
{
	int sum, lazy;
	int h;
	void merge(const S& a, const S& b) {
		sum = a.sum + b.sum + lazy*h;
	}
	void add(int a) {
		if(h>1) lazy += a;
		sum += a * h;
	}
};

struct LazySegmentTree
{
	std::vector<S> tree;
	int h;
	int n;
	std::vector<int> height;
	LazySegmentTree(int n,std::vector<int>& a) : tree(2*n),n(n),height(2*n) {
		h=0;
		for(int i=0;i<n;i++) {
			height[n+i]=1;
		}
		for(int i=n-1;i>0;i--) {
			height[i] = height[(i<<1)] + height[(i<<1)|1];
		}
		for(int i=1;i<2*n;i++) tree[i].h=height[i];
		while(n>>h) {
			h++;
		}
		for(int i=0;i<n;i++) {
			tree[n+i].sum = a[i];
		}
		for(int i=n-1;i>0;i--) {
			tree[i].merge(tree[i<<1], tree[(i<<1)|1]);
		}
	}
	void push(int i) {
		for(int s = h; s>0; s--) {
			int c = i>>s;
			if(tree[c].lazy!=0) {
				tree[c<<1].add(tree[c].lazy);
				tree[(c<<1)|1].add(tree[c].lazy);
				tree[c].lazy = 0;
			}
		}
	}
	void build(int i) {
		while(i>0) {
			i>>=1;
			if(i==0) break;
			tree[i].merge(tree[i<<1], tree[(i<<1)|1]);
		}
	}
	int query(int l, int r) {
		int sum = 0;
		l+=n;r+=n;
		push(l);
		push(r-1);
		while(l<r) {
			if(l&1) sum+=tree[l++].sum;
			if(r&1) sum+=tree[--r].sum;
			l>>=1;r>>=1;
		}
		return sum;
	}
	void modify(int l, int r, int v) {
		l+=n;r+=n;
		int la = l, ra = r;
		while(l<r) {
			if(l&1) tree[l++].add(v);
			if(r&1) tree[--r].add(v);
			l>>=1;r>>=1;
		}
		build(la); build(ra-1);
	}
};


signed main() {
	int n,d,a;
	std::cin >> n >> d >> a;
	std::vector<std::pair<int,int> > M;
	std::set<int> set;
	rep(i,n) {
		int x,h;
		std::cin >> x >> h;
		M.emplace_back(x,h);
		set.emplace(x);
		set.emplace(x+2*d);
	}
	std::sort(all(M));
	int m = set.size();
	std::map<int,int> map;
	{
		int i=0;
		for(auto x:set) {
			map[x]=i;
			i++;
		}
	}
	std::vector<int> base(m,0);
	rep(i,n) {
		base[map[M[i].first]]=M[i].second;
	}
	int count = 0;
	LazySegmentTree seg(m,base);
	rep(i,n) {
		int from = map[M[i].first];
		int to = map[M[i].first+2*d];
		int h=seg.query(from,from+1);
		if(h<=0) continue;
		int cnt = ceil(h,a);
		count+=cnt;
		seg.modify(from,to+1,-a*cnt);
	}
	print(count);

	return 0;
}


Measured memory_bytes: 75244
#include <iostream>

using namespace std;


int DigitSum(int a) {
	int sum = 0;
	while (a > 0) {
		sum += a % 10;
		a /= 10;
	}
	return sum;
}

int main()
{
	int n, a, b;
	int ans = 0;

	cin >> n >> a >> b;

	for (int i = 1; i <= n; i++) {
		int x = DigitSum(i);
		if (a <= x && x <= b) {
			ans += i;
		}
	}
	cout << ans << endl;

    return 0;
}



Measured memory_bytes: 256
with Ada.Text_IO;
with Ada.Integer_Text_IO;
with Ada.Float_Text_IO;
use Ada.Text_IO;
use Ada.Integer_Text_IO;
use Ada.Float_Text_IO;

procedure hoge is
 a: integer;
 b: integer;
begin
 get(a);
 get(b);
 if a>=10 then
  put(-1);
 elsif b>=10 then
  put(-1);
 else
  put(a*b);
 end if;
end hoge;

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

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int INF = 1e9;

  vector<ll> y(100000), p(100000), yd[100001];
int main() {
  int n, m;
  cin >> n >> m;
  rep(i, m) cin >> p[i] >> y[i], yd[p[i]].push_back(y[i]);
  rep(i, n) sort(yd[i + 1].begin(), yd[i + 1].end());
  rep(i, m) printf("%012lld\n",
                   p[i] * 1000000 +
                       lower_bound(yd[p[i]].begin(), yd[p[i]].end(), y[i]) -
                       yd[p[i]].begin() + 1);
}


Measured memory_bytes: 8576
import java.util.*;

public class Main{
  
  public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
    
    int N = sc.nextInt();
    int T = sc.nextInt();
    int[] allList = new int[2*N];
    for(int i = 0; i < 2*N; i++){
      allList[i] = sc.nextInt();
    }
    int cost = 10001; 
    for(int i = 1; i < 2*N; i+=2){
      if(allList[i] <= T && allList[i-1]<cost){
        cost = allList[i-1];
      }
    }
    
    if(cost == 10001){
      System.out.println("TLE");
    }else{
      System.out.println(cost);
    }
    
  }
  
}

Measured memory_bytes: 36012
import bisect,collections,copy,heapq,itertools,math,string
import sys
def li(): return map(int,sys.stdin.readline().rstrip().split())
def lf(): return map(float,sys.stdin.readline().rstrip().split())
def ls(): return sys.stdin.readline().rstrip().split()

a, b, c, d = li()
cn = b//c - (a-1)//c
dn = b//d - (a-1)//d
lcm = c*d//math.gcd(c,d)
cdn = b//lcm - (a-1)//lcm
print(b-a+1-cn-dn+cdn)

Measured memory_bytes: 10040
function*stdinIter(){const t=require("fs").readFileSync("/dev/stdin","utf-8").trim().split(/\n|\s/);yield*t}function readMany(t,e){const i=e||this.iter||(this.iter=stdinIter()),n=[];for(let e=0;e<t;e+=1)n.push(i.next().value);return n};

(() => {
    const [ h, w ] = readMany(2)
    const s = []
    for (let i = 0; i < h; i += 1) {
        const tmp = readMany(1)[0].split('')
        s.push(tmp)
    }

    const get = (arr, i, j) => {
        const tmp = arr[i]
        if (tmp) {
            return tmp[j]
        } else {
            void 0
        }
    }

    for (let i = 0; i < h; i += 1) {
        for (let j = 0; j < w; j += 1) {
            if (get(s, i, j) != '#') continue

            if (
                get(s, i - 1, j) == '#' ||
                get(s, i, j - 1) == '#' ||
                get(s, i, j + 1) == '#' ||
                get(s, i + 1, j) == '#'
            ) {
                // ok
            } else {
                return console.log('No')
            }
        }
    }

    console.log('Yes')
})()


Measured memory_bytes: 7500
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String N = sc.next();
		char a = N.charAt(0);
		char b = N.charAt(1);
		char c = N.charAt(2);
		char d = N.charAt(3);
		
		if ((a == b && b == c) || (b == c && c == d)) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}


Measured memory_bytes: 21844
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
  private static class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;

    public FastScanner(InputStream in) {
      reader = new BufferedReader(new InputStreamReader(in));
      tokenizer = null;
    }

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

    public String nextLine() {
      if (tokenizer == null || !tokenizer.hasMoreTokens()) {
        try {
          return reader.readLine();
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }

      return tokenizer.nextToken("\n");
    }

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

    public int nextInt() {
      return Integer.parseInt(next());
    }

    public double nextDouble() {
      return Double.parseDouble(next());
    }

    public int[] nextIntArray(int n) {
      int[] a = new int[n];
      for (int i = 0; i < n; i++)
        a[i] = nextInt();
      return a;
    }

    public long[] nextLongArray(int n) {
      long[] a = new long[n];
      for (int i = 0; i < n; i++)
        a[i] = nextLong();
      return a;
    }
  }

  public static void main(String[] args) {
    FastScanner sc = new FastScanner(System.in);
    String s = sc.next();
    if (s.equals("RRR")) {
      System.out.println(3);
    } else if (s.contains("RR")) {
      System.out.println(2);
    } else if (s.equals("SSS")) {
      System.out.println(0);
    } else {
      System.out.println(1);
    }
  }
}

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

using namespace std;

int main() {
  ios_base::sync_with_stdio(false);

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

  vector<int> large(n), small(n);
  {
    deque<int> q;
    for (int i = 0; i < n; i++) {
      while (q.size() && a[q.back()] < a[i]) q.pop_back();
      q.push_back(i);
      if (q.front() == i - k) q.pop_front();
      large[i] = a[q.front()];
    }
  }
  {
    deque<int> q;
    for (int i = 0; i < n; i++) {
      while (q.size() && a[q.back()] > a[i]) q.pop_back();
      q.push_back(i);
      if (q.front() == i - k) q.pop_front();
      small[i] = a[q.front()];
    }
  }

  vector<int> sum(n);
  for (int i = 1; i < n; i++) {
    sum[i] = sum[i - 1] + (a[i - 1] < a[i]);
  }
  vector<bool> sorted(n);
  for (int i = k - 1; i < n; i++) {
    sorted[i] = (sum[i] - sum[i - k + 1] == k - 1);  
  }

  int ans = 0;
  bool same = sorted[k - 1];
  if (!same) ans = 1;
  for (int i = k; i < n; i++) {
    if (large[i] == a[i] && a[i - k] < small[i]) continue;
    if (sorted[i]) {
      same = true;
    } else {
      ans++;
    }
  }
  cout << ans + same << '\n';
  return 0;
}



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

int main() {
  int x, a, b;
  cin >> x >> a >> b;
  if(b - a <= 0) {
    cout << "delicious" << endl;
  } else if(b - a <= x) {
    cout << "safe" << endl;
  } else {
    cout << "dangerous" << endl;
  }
}

Measured memory_bytes: 256
import core.bitop, std.bitmanip;
import core.checkedint;
import std.algorithm, std.functional;
import std.array, std.container;
import std.bigint;
import std.conv;
import std.math, std.numeric;
import std.range, std.range.interfaces;
import std.stdio, std.string;
import std.typecons;
 
void main()
{
    int n;
    readf("%s", &n);
    readln;

    auto arr = readln.chomp.split.map!(to!int).array;

    arr.sort();
    
    struct fwtr {
        immutable int MX = 10 ^^ 3 + 23;
        int[MX] f;
        
        void add(int v) {
            while (v < MX) { 
                f[v] += 1;
                v += (v & (-v));
            }
        }
        
        int sm(int v) {
            int ret = 0;
            while (v > 0) {
                ret += f[v];
                v -= (v & (-v));
            }
            
            return ret;
        }
    }
    
    fwtr t;
    
    auto ans = 0L;
    foreach (i; 0 .. n) {
        foreach  (j; i+1 .. n) {
            int search = arr[j] - arr[i];
            
            ans += i - t.sm(search);
        }
        
        t.add(arr[i]);
    }
    
    ans.writeln;
}

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

using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n - 1); }
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;

struct UnionFind {
    V<int> p, r;
    int gn;
    UnionFind(int n = 0) : p(n, -1), r(n, 1), gn(n) {}
    void merge(int a, int b) {
        int x = group(a), y = group(b);
        if (x == y) return;  // same
        gn--;
        if (r[x] < r[y])
            p[x] = y;
        else if (r[x] > r[y])
            p[y] = x;
        else {
            p[x] = y;
            r[x]++;
        }
    }
    int group(int a) {
        if (p[a] == -1) return a;
        return p[a] = group(p[a]);
    }
    bool same(int a, int b) { return group(a) == group(b); }
};

struct E {
    int from, to;
    ll cost;
    bool operator<(const E& r) const { return cost < r.cost; }
};
ll D;
V<ll> a;
V<E> edges;
void adde(int l, int r) {
    edges.push_back(E{l, r, D * abs(l - r) + a[l] + a[r]});
}
void solve(int l, int r) {
    if (l + 1 == r) return;
    int md = (l + r) / 2;
    solve(l, md); solve(md, r);
    {
        ll ma = TEN(18);
        int ma_ar = -1;
        for (int i = md; i < r; i++) {
            if (i * D + a[i] < ma) {
                ma = i * D + a[i];
                ma_ar = i;
            }
        }
        for (int i = l; i < md; i++) {
            adde(i, ma_ar);
        }
    }
    {
        ll ma = TEN(18);
        int ma_ar = -1;
        for (int i = l; i < md; i++) {
            if ((-i) * D + a[i] < ma) {
                ma = (-i) * D + a[i];
                ma_ar = i;
            }
        }
        for (int i = md; i < r; i++) {
            adde(i, ma_ar);
        }
    }
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(20) << fixed;
    int n;
    cin >> n >> D;
    a = V<ll>(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    solve(0, n);
    sort(edges.begin(), edges.end());
    auto uf = UnionFind(n);
    ll ans = 0;
    for (auto e: edges) {
        if (uf.same(e.from, e.to)) continue;
        uf.merge(e.from, e.to);
        ans += e.cost;
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 69472
import itertools,math,bisect,pprint,sys
#N, K = map(int, raw_input().split())
n = input()
s = list(raw_input())
ans = [0 for i in range(n)]
def check():
    b1 = (s[n-1]=="o" and (ans[n-2]+ans[n-1]+ans[0])%2==1)
    b2 = (s[n-1]=="x" and (ans[n-2]+ans[n-1]+ans[0])%2==0)
    b3 = (s[0]=="o" and (ans[n-1]+ans[0]+ans[1])%2==1)
    b4 = (s[0]=="x" and (ans[n-1]+ans[0]+ans[1])%2==0)
    return (b1 or b2) and (b3 or b4)
for i in [[0,0],[0,1],[1,0],[1,1]]:
    ans[0] = i[0]
    ans[1] = i[1]
    for j in range(2,n):
        if s[j-1] == "o":
            ans[j] = (ans[j-2]+ans[j-1]+1)%2
        else:
            ans[j] = (ans[j-2]+ans[j-1])%2
    else:
        if check():
            res = ""
            for i in ans:
                if i == 1:
                    res += "S"
                else:
                    res += "W"
            print res
            sys.exit()
else:
    print -1

Measured memory_bytes: 7544
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>

std::string solve(const std::string& s)
{
  char prev = 0;
  for (auto c : s) {
    if (c == prev) return "Bad";
    prev = c;
  }
  return "Good";
}

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

  std::cout << solve(s) << std::endl;
}


Measured memory_bytes: 256
n, m = gets.split.map(&:to_i)
cond = m.times.map {
  k, *ss = gets.split.map(&:to_i)
  ss.inject(0) {|acc, s| acc | (1 << (s - 1))}
}
ps = gets.split.map(&:to_i)

puts (2 ** n).times.map {|switches|
  cond.map.with_index {|c, i| (switches & c).to_s(2).count("1") % 2 == ps[i]}.all?
}.count(true)

Measured memory_bytes: 1788
#include<cstdio>
#define N 305
#define ld double
int n,a[N];
int cnt[4];
ld dp[N][N][N];//0,1,2
int vis[N][N][N];
ld DP(int a,int b,int c){
	if(b<0||c<0||(n-a-b-c)<0)return 0;
	if(a==n)return 0;
	if(vis[a][b][c])return dp[a][b][c];
	vis[a][b][c]=1;
	dp[a][b][c]=(DP(a+1,b-1,c)*b/n+DP(a,b+1,c-1)*c/n+DP(a,b,c+1)*(n-a-b-c)/n+1)*n/(n-a);
	return dp[a][b][c];
}
int main(){
	scanf("%d",&n);
	for(int i=0;i<n;++i)scanf("%d",&a[i]),cnt[a[i]]++;
	printf("%.10f\n",DP(cnt[0],cnt[1],cnt[2]));
	return 0;
}

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

int a,b,c,d;

int main()
{
	ios::sync_with_stdio(false); 
	while(cin>>a>>b>>c>>d){
		if(abs(a-c)<=d||(abs(a-b)<=d&&abs(b-c)<=d)){
			cout<<"Yes"<<endl;
		}else	cout<<"No"<<endl;
	} 
	return 0;
}

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

using namespace std;

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

  vector<int> p(N);
  for(int i=0; i<N; i++) {
    cin >> p.at(i);
  }
  sort(p.begin(), p.end());
  int sum = 0;
  for(int i=0; i<K; i++) {
    sum += p.at(i);
  }
  cout << sum << endl;

}


Measured memory_bytes: 3628
/**   Created by: Marcos Portales
          Codeforces User: marcosportales
          Country: Cuba
          Copyright                    */
#include<bits/stdc++.h>
using namespace std;
/// Pragmas:
#pragma GCC optimize("Ofast","unroll-loops","omit-frame-pointer","inline") //Optimization flags
#pragma GCC option("arch=native","tune=native","no-zero-upper") //Enable AVX
#pragma GCC target("avx2") //Enable AVX
/// Macros:
#define int long long
#define f first
#define s second
#define db(x) cerr << #x << ": " << (x) << '\n';
#define pb push_back
#define lb lower_bound
#define up upper_bound
#define all(x) x.begin() , x.end()
#define rall(x) x.rbegin() , x.rend()
#define enl '\n'
#define vi vector<int>
#define sz(a) int((a).size())
#define rep(i,n) for(int i=0;i<(n);i++)
#define repi(i,n) for(int i=(1);i<=(n);i++)
typedef pair<int,int> ii;
typedef long double ld;
typedef unsigned long long ull;
/// Constraints:
const int maxn = 200005;
const int mod = 1000000007;
const ld eps = 1e-9;
const int inf = ((1ll<<31ll)-1ll);
const int INF = 2000000000000000000ll;
const ld pi = acos(-1);
/// Prime Numbers:
// 2, 173, 179, 181, 197, 311, 331, 737, 1009, 2011, 2027, 3079, 4001, 10037, 10079, 20011, 20089;
// 100003, 100019, 100043, 200003, 200017, 1000003, 1000033, 1000037, 1000081;
// 2000003, 2000029, 2000039, 1000000007, 1000000021, 2000000099;
/// Functions:
#define lg2(x) 31 - __builtin_clz(x)
#define lgx(x,b) ( log(x) / log(b) )
/// Red-Black Tree Test.insert(x)late ---------------------------------
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//typedef tree < long long ,  null_type ,  less<long long> ,  rb_tree_tag ,  tree_order_statistics_node_update > ordered_set;
/// Quick Pow------------------------------------------------
int qpow(int b,int e){
    if( !e ) return 1;
    if( e & 1 ) return qpow(b,e-1) * b % mod;
    int pwur = qpow(b,e>>1);
    return (pwur * pwur) % mod;
}
int modinv(int x){
    return qpow(x,mod-2);
}

/// My Code -------------------------------------------------

int32_t main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    cout.setf(ios::fixed); cout.precision(0);
    srand(time(NULL));
    //freopen("a.in","r",stdin);
    //freopen("a.in","w",stdout);
    int n,m;
    string s;
    cin>>n>>m>>s;
    int ans=0;
    rep(i,s.size()){
        if(s[i]!='-')ans++;
    }
    if(ans==n+m && s[n]=='-')cout<<"Yes";
    else cout<<"No";
    return 0;
}


Measured memory_bytes: 3644
#include <map>
#include <cmath>
#include <queue>
#include <stack>
#include <vector>
#include <cstdio>
#include <string>
#include <cstring>
#include <sstream>
#include <algorithm>

using namespace std;

int ro[200005], ra[200005], n, k, l;

int Find(int *r, int x) {
    return r[x]==x ? x : r[x]=Find(r, r[x]);
}

void init() {
    for(int i=1;i<=n;i++) {
        ra[i]=ro[i]=i;
    }
}

vector <int> ve[200005];
map <int, int> ma;
int ans[200005];

int main () {
    int u, v;
    scanf("%d%d%d", &n, &k, &l);
    init();
    for(int i=1;i<=k;i++) {
        scanf("%d%d", &u, &v);
        u=Find(ro, u), v=Find(ro, v);
        if(u!=v) {
            ro[u]=v;
        }
    }

    for(int i=1;i<=l;i++) {
        scanf("%d%d", &u, &v);
        u=Find(ra, u), v=Find(ra, v);
        if(u!=v) {
            ra[u]=v;
        }
    }

    for(int i=1;i<=n;i++) {
        ve[Find(ro, i)].push_back(i);
    }

    for(int i=1;i<=n;i++) {
        ma.clear();
        for(int j=0;j<(int)ve[i].size();j++) {
            ma[Find(ra, ve[i][j])]++;
        }

        for(int j=0;j<(int)ve[i].size();j++) {
            ans[ve[i][j]]+=ma[Find(ra, ve[i][j])];
        }
    }

    for(int i=1;i<=n;i++) {
        printf("%d%c", ans[i], i==n ? '\n' : ' ');
    }
    return 0;
}

Measured memory_bytes: 14072
//C 
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int raw[100000][10],dp[100000][10];
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n,m,k;
	cin >> n;
	for(int i = 1;i <= n;i++){
		for(int j = 1;j <= 3;j++)cin >> raw[i][j];
	}
	ll ans = 0;
	for(int i = 1;i <= n;i++){
		for(int j = 1;j <= 3;j++){
			for(int k = 1;k <= 3;k++)if(k != j){
				dp[i][j] = max(dp[i-1][k],dp[i][j]);
			}
			dp[i][j] += raw[i][j];
		}
	}
	cout << max({dp[n][1],dp[n][2],dp[n][3]});
	return 0;
}

Measured memory_bytes: 11384
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <vector>
#include <iomanip>
#include <ctime>
#include <queue>
using namespace std;

template <typename T>
T next_int() {  
    T x = 0, p = 1;
    char ch;
    do { ch = getchar(); } while(ch <= ' ');
    if (ch == '-') {
        p = -1;
        ch = getchar();
    }
    while(ch >= '0' && ch <= '9') {
        x = x * 10 + (ch - '0');
        ch = getchar();
    }
    return x * p;
}

const int max_n = (int)1e6 + 227 + 1;
const int max_int = (int)1e9 + 227 + 1;
const int mod = (int)1e9 + 7;

int main() {
//	freopen(".in", "r", stdin);

	int n = next_int<int>() * 2;

	vector<long long> a(n);
	for(int i = 0; i < n; i++) a[i] = next_int<long long>();

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

	long long ans = 0;
	for(int i = 0; i < n / 2; i++) {
		int j = i * 2;

		ans += min(a[j], a[j + 1]);
	}

	cout << ans << "\n";
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
	double a,b,c,d,e,f;
	double x,y;
	while (scanf("%lf %lf %lf %lf %lf %lf",&a,&b,&c,&d,&e,&f) != EOF) {
		y = (c * d - a * f) / (b * d - e * a);
		x = (c - (b * y)) / a;
		printf("%.3lf %.3lf\n",x,y);
	}
	return 0;
}

Measured memory_bytes: 648
#include <bits/stdc++.h>
#define endl '\n'
#define fast ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define zy -2147382637
#define bql 2147483647
#define ll long long
#define ull unsigned long long
#define ld long double
#define il inline
#define sz(x) x.size()
#define maxn 100010
#define rp(i, l, r) for (int i = l; i <= r; i++)
#define rb(i, r, l) for (int i = r; i >= l; i--)
#define fi first
#define se second
#define pb push_back
#define mp make_pair

using namespace std;
ll max(ll a,ll b){if(a>b)return a;else return b;}
ll min(ll a,ll b){if(a<b)return a;else return b;}
ll lowbit(ll x){return x&(-x);}
ll prime(ll x){
   if(x<=1)return false;
   for(int i=2;i<=int(sqrt(x));i++){
	   if(x%i==0)return false;
   }return true;
}
bool cmp(ll a,ll b){return a>b;}
ll gcd(ll a,ll b){ll r;while(b>0){r=a%b;a=b;b=r;}return a;}
ll powmod(ll a,ll b,ll mod) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
inline ll read() {
	char c = getchar(); ll w = 1; ll x = 0;
	while (!isdigit(c))
		(c == '-') && (w = -w), c = getchar();
	while (isdigit(c))
		x = (x << 1) + (x << 3) + (c ^ '0'), c = getchar();
	x *= w;
}
void fl(){
	freopen(".in","r",stdin);
	freopen(".out","w",stdout);
}
const int dx[8] = {-1, 1, 0, 0, -1, 1, -1, 1},
		  dy[8] = {0, 0, -1, 1, -1, -1, 1, 1};
vector<ll> A,B;
int main(){
	fast;
	ll a,b,k;
	cin>>a>>b>>k;
	ll f[101]={0},index=0;
	for(int i=min(a,b);i>=1;i--){
		if(a%i==0&&b%i==0){
			index++;
			f[index]=i;
		}
	}
	cout<<f[k]<<endl;
}/*『你强归你强，我永不示弱』*/




Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
int main() {
  int n,m;cin>>n>>m;
  vector<vector<int>> vec(m);
  rep(i,m) {
    int k;cin>>k;
    vec[i].resize(k);
    rep(j,k) {
      cin>>vec[i][j];
      vec[i][j]-=1;
    }
  }
  vector<int> p(m);
  rep(i,m) cin>>p[i];
  
  int ans=0;
  for (int bit=0;bit < (1<<n); bit++) {
    for (int i=0;i<m;i++) {
      int count=0;
      for (int id: vec[i]) {
        if (bit & (1<<id)) {
          count++;
        }
      }
      if (count%2!=p[i]) {
        break;
      }
      else if (count%2==p[i] && i==m-1) {
        ans++;
      }
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#define ArraySizeOf(array)     (sizeof(array) / sizeof(array[0]))
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define int long long
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define _GLIBCXX_DEBUG
int INF = 1e9 + 7;
unsigned NthDayOfWeekToDay(unsigned n, unsigned dow, unsigned dow1)
{
    unsigned day;
    if (dow < dow1) dow += 7;
    day = dow - dow1;
    day += 7 * n - 6;
    return day;
}
unsigned DayToWeekNumber(unsigned day)
{
    return (day - 1) / 7 + 1;
}
unsigned AnotherDayOfWeek(unsigned day, unsigned day0, unsigned dow0)
{
    return (dow0 + 35 + day - day0) % 7;
}
using namespace std;
signed main() {
    int N; cin >> N;
    vector<int>a(N);
    int ans = 1;
    rep(i, N){
        cin >> a[i];
        if (a[i] == ans)ans++;
    }
    cout << (ans == 1 ? -1 : N - (ans-1)) << endl;
}

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

long long n, a, b, m = 1, t = 2;
const long long M = 1000000007;
long long w[200001], v[200001];

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

	for (int i = 0; (1ull << i) <= n; i++) {
		if((1ull << i) & n)
			m = m * t % M;

		t = t * t % M;
	}

	m -= 1;

	w[0] = 1, w[1] = 1;
	v[0] = 1, v[1] = 1;

	for (int i = 2; i < 200001; i++) {
		w[i] = w[i - 1] * i % M;

		t = w[i];
		v[i] = 1;

		for (int j = 0; (1ull << j) < M - 1; j++) {
			if ((1ull << j) & (M - 2))
				v[i] = v[i] * t % M;

			t = t * t % M;
		}
	}

	t = 1;
	for (long long i = n; i > n - a; i--)
		t = t * i % M;

	m = (M + m - (t * v[a] % M)) % M;

	t = 1;
	for (long long i = n; i > n - b; i--)
		t = t * i % M;

	m = (M + m - (t * v[b] % M)) % M;

	cout << m << endl;

	return 0;
}

Measured memory_bytes: 3328
N = int(input())
S =input()

al = [chr(ord('a') + i) for i in range(26)]
left =[]
right = []
for i in S:
    right.append(i)

ans = 0

for i in range(len(S)):
    left.append(right[0])
    right.pop(0)
    aaa = 0
    for i in al:
        if i in left and i in right:
            aaa += 1
    ans = max(ans,aaa)

print(ans)


Measured memory_bytes: 65660
from itertools import product

n = int(input())

test = []

for i in range(n):
  a = int(input())
  test.append([list(map(int, input().split())) for i in range(a)])

ans = 0

for i in product(range(2), repeat=n):
  flag = True
  for j in range(n):
    if i[j] == 1:
      for s in test[j]:
        if i[s[0]-1] != s[1]:
          flag = False 
          break
  if flag == True:
    cnt = i.count(1)
    if cnt > ans:
      ans = cnt

print(ans)

Measured memory_bytes: 9184
# include <bits/stdc++.h>
# define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
# define reps(i, n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(int i=((int)(n)-1); i>=0; --i)
# define rreps(i, n) for(int i=((int)(n)); i>0; --i)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define optimize_cin() cin.tie(0); ios::sync_with_stdio(false)
using namespace std;
using ll = long long;
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; }
const long long INF = 1LL << 60;

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

uintmax_t combination(unsigned int n, unsigned int r) {
  if ( r * 2 > n ) r = n - r;
  uintmax_t dividend = 1;
  uintmax_t divisor  = 1;
  for ( unsigned int i = 1; i <= r; ++i ) {
    dividend *= (n-i+1);
    divisor  *= i;
  }
  return dividend / divisor;
}

int modPow(long long a, long long n, long long p) {
  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;
}

ll lcm(ll a, ll b)
{
   return a / gcd(a, b) * b;
}

int main()
{
    int n;
    cin >> n;
    vector<ll> a(n);
    rep(i,n) cin >> a[i];

    ll ans = a[0];

    rep(i,n-1){
        chmin(ans,gcd(a[i],a[i+1]));
    }

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

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

int main() {
  string days[] = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};
  string S;

  cin >> S;

  for (int i = 0; i < 7; i++) {
    if (S == days[i]) {
      cout << 7 - i;
      return 0;
    }
  }

  return 0;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
ll maxSubArraySum(int a[], int size)
{
         ll max_so_far = 0, max_ending_here = 0;
   for (int i = 0; i < size; i++)
   {
       max_ending_here = max_ending_here + a[i];
       if (max_ending_here < 0)
           max_ending_here = 0;

       /* Do not compare for all elements. Compare only
          when  max_ending_here > 0 */
       else if (max_so_far < max_ending_here)
           max_so_far = max_ending_here;
   }
                return max_so_far;
}
int main()
{
	int h,n;
	cin>>h>>n;
	int arr[n];
	int sum=0;
	for(int i=0;i<n;i++)
	{
		cin>>arr[i];
		sum=sum+arr[i];
	}
	if(sum>=h)
	cout<<"Yes\n";
	else
	cout<<"No\n";

}



Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <string>
#include <cmath>
using namespace std;
#define MOD 1000000007
#define INF 1<<30
#define LINF (ll)1<<62
#define MAX 5100
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll, ll> P;
typedef vector<pair<ll, ll>> vpl;



int main(){
    ll m,d; cin >> m >> d;
    ll ans = 0;
    for(ll i=4; i<=m; i++){
        for(ll j=22; j<=d; j++){
            ll a = j / 10;
            ll b = j % 10;
            if(a>=2 && b>=2 && i == a*b) ans++;
        }
    }
    cout << ans << endl;
}

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

using namespace std;
#define endl "\n"

const int MOD = 1000000007;
int main()
{
	string a, b, c;
	cin >> a >> b >> c;
	int x = c.size();
  printf("%c",a[0]-32);
    printf("%c",b[0]-32);
    printf("%c",c[0]-32);
	
	
	return 0;
}

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

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

		if (n == 0)
			break;

		int len[40];
		for (int i = 0;i < n;i++) {
			string w;
			cin >> w;

			len[i] = w.size();
		}

		for (int i = 0;i < n;i++) {
			bool flg = false;
			int sta = 0;
			int sum = 0;

			for (int j = i;j < n;j++) {
				sum += len[j];

				//区切りなら
				if (sum == 5 || sum == 12 || sum == 17 || sum == 24 || sum == 31) {
					sta++;
				}

				if (sta == 5) {
					flg = true;
					break;
				}
				else if (sum >= 31) {
					break;
				}
			}
			if (flg) {
				cout << i + 1 << endl;
				break;
			}
		}
	}
	return 0;
}


Measured memory_bytes: 3112
import java.util.Arrays;
import java.util.Scanner;


public class Main {
	
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		
		final double r = sc.nextDouble();
		
		System.out.printf("%.7f %.7f\n", Math.PI * r * r, 2 * Math.PI * r);
		
	}
	
}

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

using namespace std;

#define INF (1 << 30)
#define EPS 1e-10
#define MOD 1000000007

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

using ll = long long;

template<class T> void chmax(T& a, T b){ a>b?:a=b; }
template<class T> void chmin(T& a, T b){ a<b?:a=b; }

vector<int> g[100000];
int ans[100000], d[100000];

// void dfs(int u, int v, int dd) {
//     if (d[v] <= dd)
//         return;
//     d[v] = dd;
//     ans[v] = u;
//     for (auto t : g[v]) {
//         dfs(v, t, dd + 1);
//     }
// }

int main() {
    int n, m, a, b;
    cin >> n >> m;
    for (int i = 0; i < m; ++i) {
        cin >> a >> b;
        a--;
        b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }

    fill(d, d + n, INF);
    d[0] = 0;
    priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> q;
    q.push(make_pair(0, 0));
    while (!q.empty()) {
        auto t = q.top();
        int u = t.second;
        int dd = t.first;
        q.pop();

        for (auto v : g[u]) {
            if (d[v] > dd + 1) {
                d[v] = dd + 1;
                ans[v] = u;
                q.push(make_pair(dd + 1, v));
            }
        }
    }

    for (int i = 0; i < n; ++i) {
        if (ans[i] == INF) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    for (int i = 1; i < n; ++i) {
        cout << ans[i] + 1 << endl;
    }

    return 0;
}

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

int main() {
  long long a=0,b=0,c=0,d=0,m=0,n=0,p=0,q=0;
  
  cin >> a >> b >> c >> d >> m;
  
  cout << ((c-a)*60+d-b)-m ; 
}


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

using namespace std;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  set<int> s;
  for(int i=0, x; i<n; i++) cin >> x, s.insert(x);
  cout << s.size() << endl;
  return 0;
}


Measured memory_bytes: 256
h, w = list(map(int, input().split()))
ans = 10**10
if h%3 == 0 or w%3 == 0:
    ans = 0
else:
    h1 = h//3
    h2 = (h-h1)//2
    h3 = h-h1-h2
    ans1 = (max([h1, h2, h3]) - min(h1, h2, h3))*w

    w1 = w//3
    w2 = (w-w1)//2
    w3 = w-w1-w2
    ans2 = (max([w1, w2, w3]) - min(w1, w2, w3))*h
    
    a1 = (h//3)*w
    a2 = (w//2)*(h-h//3)
    a3 = (w-w//2)*(h-h//3)
    ans3 = max([a1, a2, a3]) - min(a1, a2, a3)
    
    a1 = (w//3)*h
    a2 = (h//2)*(w-w//3)
    a3 = (h-h//2)*(w-w//3)
    ans4 = max([a1, a2, a3]) - min(a1, a2, a3)

    a1 = (h//3+1)*w
    a2 = (w//2)*(h-h//3-1)
    a3 = (w-w//2)*(h-h//3-1)
    ans5 = max([a1, a2, a3]) - min(a1, a2, a3)
    
    a1 = (w//3+1)*h
    a2 = (h//2)*(w-w//3-1)
    a3 = (h-h//2)*(w-w//3-1)
    ans6 = max([a1, a2, a3]) - min(a1, a2, a3)
    
    ans = min([ans1, ans2, ans3, ans4, ans5, ans6])

print(ans)
    

Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

const ll mod = 1000000007;

int main() {
    int N, cnt;
    bool hasBingo = false;
    vector<vector<int>> cardNum(3, vector<int>(3));
    vector<vector<int>> cardHole(3, vector<int>(3));
    rep(i, 3){
        rep(j, 3){
            cin >> cardNum[i][j];
        }
    }
    cin >> N;
    rep(i, N){
        int num;
        cin >> num;
        rep(j,3){
            rep(k, 3){
                if(cardNum[j][k] == num){
                    cardHole[j][k] = 1;
                }
            }
        }
    }
    rep(i, 3){
        cnt = 0;
        rep(j, 3){
            cnt += cardHole[i][j];
        }
        if(cnt == 3){
            hasBingo = true;
            break;
        }
    }
    rep(i, 3){
        cnt = 0;
        rep(j, 3){
            cnt += cardHole[j][i];
        }
        if(cnt == 3){
            hasBingo = true;
            break;
        }
    }
    cnt = 0;
    rep(i, 3){
        cnt += cardHole[i][i];
    }
    if(cnt == 3){
        hasBingo = true;
    }

    cnt = 0;
    rep(i, 3){
        cnt += cardHole[i][2 - i];
    }
    if(cnt == 3){
        hasBingo = true;
    }
    if(hasBingo){
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}


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

#define deb(x)        cerr << #x << " = " << x << "\n";
#define deb2(x, y)    cerr << #x << " = " << x << ", " << #y << " = " << y << "\n";
#define deb3(x, y, z) cerr << #x << " = " << x << ", " << #y << " = " << y << ", " << #z << " = " << z << "\n";

#define pb push_back
#define mp make_pair
#define F  first
#define S  second

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

typedef long long ll;  

void solve() {
    int n;
    cin >> n;
    cout << (n ? 0 : 1);
}

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

    ll tc = 1;
    //cin >> tc;

    while(tc--) {
        solve();
        cout << '\n';
    }

    return 0;
}


Measured memory_bytes: 3580
#include <iostream>
#include <fstream>
#include <string>
#include <iomanip>
#include <math.h>
using namespace std;

class Point {
    public:
    double x, y;

    Point(double x = 0, double y = 0): x(x), y(y) {}

    Point operator + (Point p) { return Point(x+p.x, y+p.y); }
    Point operator - (Point p) { return Point(x-p.x, y-p.y); }
    Point operator * (double a) { return Point(a*x, a*y); }
    Point operator / (double a) { return Point(x/a, y/a); }

    double abs() {return sqrt(norm()); }
    double norm() {return x*x + y*y; }
};

typedef Point Vector;


double dot(Vector a, Vector b) {
    return a.x * b.x + a.y * b.y;
}

double cross(Vector a, Vector b) {
    return a.x*b.y - a.y*b.x;
}

int main(){
    //cinの入力元をテキストファイルに(テスト用)
    #if 0
    std::ifstream in("input.txt");
    std::cin.rdbuf(in.rdbuf());
    #endif

    Point p1, p2;
    int q;

    //標準入力
    cin >> p1.x;
    cin >> p1.y;
    cin >> p2.x;
    cin >> p2.y;
    cin >> q;

    Vector v12 = p2 - p1;
    double norm = v12.norm();

    for(int i=0; i<q; i++){
        Point p;
        cin >> p.x;
        cin >> p.y;

        double uvdot = dot(v12, p-p1);
        Vector th = v12 * (uvdot/norm);
        Vector tv = th - (p - p1);
        Vector t = p1 + th + tv;

        std::cout << setprecision(14) << t.x << " " << t.y << "\n";
    }

    return 0;
}



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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcount

#define INF INT_MAX/3

ll h,w,d;
char cs[]={'R','Y','G','B'};
char res[600][600];

int main(){
  cin>>h>>w>>d;
  rep(i,h){
    rep(j,w){
      cout<<cs[(((i+j)/d)%2)*2+((i-j+d*1000)/d)%2];
    }
    cout<<endl;
  }
	return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
//#include <ext/hash_map>
#include <tr1/unordered_map>
#include <set>
#include <stack>
#include <queue>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using namespace tr1;
//using namespace __gnu_cxx;

#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define mp make_pair
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define DEB 0

#define SZ 885777

/*
real	0m2.093s  --> 
real	0m2.000s
*/
const int dx[] = {1,0,-1,0}; //r,d,l,u
const int dy[] = {0,1,0,-1};

int w,h,sx,sy,home,last;
int field[16][16];
int num[16][16];
int hS[25],hx[25],hy[25],edge[25][4][25]; //[src][dir][dest]
//hash_map<int,int> hii(3000000);
unordered_map<int,int> hii(SZ);


inline bool isnotgoal(int s){
  return (((last&s)) == last);
}
inline bool isnot(int s){
  rep(i,home)if( !(s&(1<<i)) ){
    if( (hS[i]&s)==hS[i] ) return true;
  }
  return false;
}
inline bool inside(int x, int y){
  return (x<0 || y<0 || x>=w || y>=h);
}

int dfs(int S){
  int src = S&((1<<5)-1);
  int x = hx[src];
  int y = hy[src];
  int s = S>>5;

  if( (1<<home)-1 == s ){ //ツ静「ツ妥篠づ可姪淞づェツづゥ
    return 1;
  }
  if( isnotgoal(s) ){ //ツ仰ウツ嘉ッツづ可姪淞づゥツつスツづ淞づ個嘉づーツ湘氾ッツつオツつスツつゥツづつ、ツつゥ
    return 0;
  }
  //hash_map<int,int>::iterator it = hii.find(S);
  unordered_map<int,int>::iterator it = hii.find(S);
  if( it!=hii.end() ){ //ツ探ツ催オツ催渉づ敖づ個湘ウツ妥板つゥツづつ、ツつゥ
    return it->second;
  }

  // ツプツδ個ゼツδ督トツつェツ置ツつッツづ按つ「ツ嘉づ個有ツ鳴ウ
  if( s>0 && ((s&(s-1))!=0) && isnot(s&~(1<<src)) ){
    return 0;
  }
  
  int ret = 0;
  rep(k,4){
    for(int j=0; edge[src][k][j]!=-1; j++){
      int dest = edge[src][k][j];
      int nx = hx[dest];
      int ny = hy[dest];
      if( field[ny][nx]==1 ){
	field[ny][nx] = 0;
	ret += dfs(((s|(1<<dest))<<5)|dest);
	field[ny][nx] = 1;
	break;
      }
    }
  }
  hii.insert(make_pair(S,ret));
  return ret;
}

int main(){

  while(scanf("%d%d",&w,&h),w|h){
    hii.clear();
    memset(num,-1,sizeof(num));
    memset(edge,-1,sizeof(edge));
    memset(hS,0,sizeof(hS));
    home = last = 0;
    rep(i,h){
      rep(j,w){
	scanf("%d",&field[i][j]);
	if( field[i][j]==2 ){
	  sx=j; sy=i;
	}
	if( field[i][j]==1 ){
	  hx[home]=j; hy[home]=i;
	  num[i][j] = home;
	  home++;
	}
      }
    }
    hx[home] = sx;
    hy[home] = sy;

    // other homes
    rep(i,home){
      rep(k,4){
	int sz = 0;
	for(int j=1; j<20; j++){
	  int tx = hx[i] + dx[k]*j;
	  int ty = hy[i] + dy[k]*j;
	  if( inside(tx,ty) ) break;
	  if( field[ty][tx]==1 ){
	    hS[i] |= (1<<num[ty][tx]);
	    edge[i][k][sz++] = num[ty][tx];
	  }
	}
      }
    }

    //last homes
    rep(k,4){
      int sz = 0;
      for(int i=1; i<20; i++){
	int tx = sx + dx[k]*i;
	int ty = sy + dy[k]*i;
	if( inside(tx,ty) )break;
	if( field[ty][tx]==1 ){
	  last |= (1<<num[ty][tx]);
	  edge[home][k][sz++] = num[ty][tx];
	}
      }
    }
    printf("%d\n",dfs(home));
  }
  

  return 0;
}

Measured memory_bytes: 17000
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();
		Work[] works = new Work[n];
		for (int i = 0; i < n; i++) {
			works[i] = new Work(sc.nextInt(), sc.nextInt());
		}
		Arrays.sort(works, new Comparator<Work>() {
		public int compare(Work w1, Work w2) {
			if (w1.a == w2.a) {
				return w2.b - w1.b;
			} else {
				return w2.a - w1.a;
			}
		}
		});
		PriorityQueue<Work> queue = new PriorityQueue<Work>(new Comparator<Work>() {
		public int compare(Work w1, Work w2) {
			return w1.b - w2.b;
		}
		});
		int total = 0;
		int idx = 0;
		for (int i = 0; i <= m; i++) {
			while (idx < n && works[idx].a + i > m) {
				Work x = queue.peek();
				if (x != null && x.b < works[idx].b) {
					total -= x.b;
					total += works[idx].b;
					queue.poll();
					queue.add(works[idx]);
				}
				idx++;
			}
			if (idx >= n) {
				break;
			}
			if (i >= m) {
				break;
			}
			total += works[idx].b;
			queue.add(works[idx]);
			idx++;
		}
		System.out.println(total);
	}
	
	static class Work {
		int a;
		int b;
		public Work(int a, int b) {
			this.a = a;
			this.b = b;
		}
	}
}


Measured memory_bytes: 88424
#include <iostream>
using namespace std;
int main(void){

    int X;
    cin>>X;
    int happy=0;
    while(X>=500){
        X-=500;
        happy+=1000;
    }
    while(X>5){
        X-=5;
        happy+=5;
    }
    cout<<happy<<endl;
}

Measured memory_bytes: 256