akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cmath>
#include<vector>
#include<set>
#include<algorithm>
#include<tuple>
#include<utility>
#include<cctype>
#include<climits>
#include<map>
#include<queue>
#include<functional>

using namespace std;
template<class T> void chmax(T& a, T b) {if(a < b){a=b;}}
template<class T> void chmin(T& a, T b) {if(a > b){a=b;}}

#define REP(i,a,n) for(int i=a;i<n;++i)
#define RUP(a,b) ((a+b-1)/(b))
#define ENT "\n"
#define REV(v) reverse(v.begin(),v.end())
#define SRTV(v) sort(v.begin(),v.end())
#define SRTAG(a,n) sort(a,a+n,greater<>())
#define MOD 1000000007

typedef long long ll;
typedef tuple<int,int,bool> Tb;

int atcoder(){
    //入力
    int n,m;
    cin >> n >> m;
    string a[n],b[m];
    REP(i,0,n) cin >> a[i];
    REP(i,0,m) cin >> b[i];
    bool ans = false;
    
    //処理
    REP(l,0,n-m+1){
    REP(i,0,n-m+1){
        bool tmp = true;
        REP(j,0,m){
            REP(k,0,m){
                if(a[l+j][i+k]!=b[j][k]) tmp=false;
            }
        }
        if(tmp){
            ans=true;
            break;
        }
    }}

    //出力
    if(ans) cout << "Yes" << ENT;
    else cout << "No" << ENT;
    return 0;
}

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


Measured memory_bytes: 256
n = int(input())
a = [int(i) for i in input().split()]

count1 = 0
count2 = 0
count3 = 0
for i in range(n):
    if a[i] % 2 == 0 and a[i] % 4 != 0:
        count1 += 1
    elif a[i] % 4 == 0:
        count2 += 1
    else:
        count3 += 1

#print(count1, count2, count3)

if count2 >= n // 2:
    print("Yes")
elif count2 >= (n - 2 * (count1 // 2)) // 2:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 14252
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 

using namespace std;
using namespace __gnu_pbds; 
#define     mod             1e9+7
#define     MOD             998244353
#define     ll              long long
#define     mp              make_pair
#define     F               first
#define     S               second
#define     t()             int test;cin>>test;while(test--)
#define     ii              pair<int,int>
#define     que_max         priority_queue <int>
#define     IOS             ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define     endl            "\n"
typedef tree<ii, null_type, less<ii>, rb_tree_tag, tree_order_statistics_node_update> pbds;

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cout << name << " : " << arg1 << endl;
        //use cerr if u want to display at the bottom
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
#else
#define trace(...)
#endif

vector<vector<bool> > grid(1000, std::vector<bool>(1000, false));

int cnt_n(int x, int y)
{
    int p = 0;

    if(x-1 >=0 && grid[x-1][y])
    {
        p++;
    }
    if(y-1 >=0 && grid[x][y-1])
    {
        p++;
    }
    if(grid[x+1][y])p++;
    if(grid[x][y+1])p++;

    return p;

}    

int32_t main()
 
{  
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif

    IOS;
   
    //t()
    {
        ll int a;
        cin>>a;


        long double b;

        cin>>b;
        
        ll y  = round(b*100); 

        


      cout<<(a*y)/100;

       

    

    }

    

}

Measured memory_bytes: 3880
// #define STOPIT
#include <bits/stdc++.h>
#define loop(n) for (lint ngtkana_is_a_genius = 0; ngtkana_is_a_genius < lint(n); ngtkana_is_a_genius++)
#define rep(i, begin, end) for (lint i = lint(begin); (i) < lint(end); i++)
#define all(v) v.begin(), v.end()
#define rand(l, r) std::uniform_int_distribution<>(l, r)(mt)
using lint = long long;
auto mt = std::mt19937_64(std::random_device{}());
auto cmn = [](auto& a, auto b){ if (a > b) {a = b; return true;} return false; };
auto cmx = [](auto& a, auto b){ if (a < b) {a = b; return true;} return false; };
void debug_impl() { std::cerr << std::endl; }
template <typename Head, typename... Tail>
void debug_impl(Head head, Tail... tail) { std::cerr << " " << head; debug_impl(tail...); }
#ifndef STOPIT
#define debug(...)\
	do {\
		std::cerr << std::boolalpha << "[" << #__VA_ARGS__ << "]:";\
		debug_impl(__VA_ARGS__);\
		std::cerr << std::noboolalpha;\
	} while (false)
#else
#define debug(...) {}
#endif

template < typename Container, typename Value = typename Container::value_type, std::enable_if_t<!std::is_same< Container, std::string >::value, std::nullptr_t> = nullptr>
std::istream& operator>> (std::istream& is, Container& v)
	{ for (auto & x : v) { is >> x; } return is; }

template < typename Container, typename Value = typename Container::value_type, std::enable_if_t<!std::is_same< Container, std::string >::value, std::nullptr_t> = nullptr >
std::ostream& operator<< (std::ostream& os, Container const& v) {
 os << "{";
	for (auto it = v.begin(); it != v.end(); it++)
		{os << (it != v.begin() ? "," : "") << *it;}
	return os << "}";
}

int main() {
	std::cin.tie(0); std::cin.sync_with_stdio(false);
	int n; std::cin >> n;
	lint Z, W; std::cin >> Z >> W;
	std::vector<lint> a(n); std::cin>> a;

	lint x = a.at(n-1) - W;
	lint y = x;
	if (1 < n) {
		y = a.at(n-2) - a.at(n-1);
	}
	if (x < 0) x = -x;
	if (y < 0) y = -y;
	lint ans = std::max(x,y);
	std::cout << ans << std::endl;
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <chrono>
#define _USE_MATH_DEFINES
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;

#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-8;
const int MOD = 1000000007; // 998244353;
const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};
/*-------------------------------------------------*/
int main() {
  cin.tie(0); ios::sync_with_stdio(false);
  // freopen("input.txt", "r", stdin);

  int n; cin >> n;
  vector<int> h(n); REP(i, n) cin >> h[i];
  --h[0];
  bool ok = true;
  FOR(i, 1, n) {
    if (h[i - 1] < h[i]) --h[i];
    if (h[i - 1] > h[i]) ok = false;
  }
  cout << (ok ? "Yes\n" : "No\n");
  return 0;
}


Measured memory_bytes: 640
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    n,m = LI()
    x = sorted(LI())
    t = sorted([x[i+1]-x[i] for i in range(m-1)])
    r = 0
    for i in range(m-n):
        r += t[i]

    return r



print(main())




Measured memory_bytes: 15660
import Control.Applicative
import Control.Monad
import qualified Data.Array.Unboxed as A
import qualified Data.Array.ST as AS
import Data.List

data Drop = Small | Middle | Large deriving (Enum)
spread :: Drop -> (Int,Int) -> [(Int,Int)]
spread Small = neighbours 1
spread Middle = \(x,y) -> [(x+i,y+j) | i <- [-1..1], j <- [-1..1]]
spread Large = neighbours 2

neighbours :: Int -> (Int,Int) -> [(Int,Int)]
neighbours n (x,y) =
        [(x+i,y+j) | i <- [-n..n], let jw = n - abs i, j <- [-jw..jw]]

dropInk :: [((Int,Int), Drop)] -> A.UArray (Int,Int) Int
dropInk ds = AS.runSTUArray $ do
    paper <- AS.newArray ((0,0), (9,9)) 0
    forM_ ds $ \ (loc, d) ->
        forM_ (spread d loc) $ \ stain ->
            unless (outside stain) $
                AS.readArray paper stain >>= AS.writeArray paper stain . succ
    return paper

outside :: (Int,Int) -> Bool
outside (x,y) = not $ x `elem` [0..9] && y `elem` [0..9]

parseLine :: String -> ((Int,Int), Drop)
parseLine s = let (x:y:d:_) = map read . splitWith ',' $ s
                in ((x,y), toEnum (d-1))

splitWith :: Eq a => a -> [a] -> [[a]]
splitWith c = unfoldr f where
    f [] = Nothing
    f xs = let (pre,post) = break (== c) xs in
        Just (pre, drop 1 post)

main = do
    paper <- A.elems .  dropInk . map parseLine . lines <$> getContents
    print . length . filter (== 0) $ paper
    print . maximum $ paper

Measured memory_bytes: 4068
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define pb push_back
#define mp make_pair
#define all(a) begin(a),end(a)
#define FOR(x,val,to) for(int x=(val);x<int((to));++x)
#define FORE(x,val,to) for(auto x=(val);x<=(to);++x)
#define FORR(x,arr) for(auto &x: arr)
#define FORS(x,plus,arr) for(auto x = begin(arr)+(plus); x != end(arr); ++x)
#define FORREV(x,plus,arr) for(auto x = (arr).rbegin()+(plus); x !=(arr).rend(); ++x)
#define REE(s_) {cout<<s_<<'\n';exit(0);}
#define GET(arr) for(auto &i: (arr)) sc(i)
#define whatis(x) cerr << #x << " is " << (x) << endl;
#define e1 first
#define e2 second
#define INF 0x7f7f7f7f
typedef std::pair<int,int> pi;
typedef std::vector<int> vi;
typedef std::vector<std::string> vs;
typedef int64_t ll;
typedef uint64_t ull;
#define umap unordered_map
#define uset unordered_set
using namespace std;
using namespace __gnu_pbds;
 
#ifdef ONLINE_JUDGE
#define whatis(x) ;
#endif
#ifdef _WIN32
#define getchar_unlocked() _getchar_nolock()
#define _CRT_DISABLE_PERFCRIT_LOCKS
#endif
template<class L, class R> ostream& operator<<(ostream &os, map<L, R> P) { for(auto const &vv: P)os<<"("<<vv.first<<","<<vv.second<<")"; return os; }
template<class T> ostream& operator<<(ostream &os, set<T> V) { os<<"[";for(auto const &vv:V)os<<vv<<","; os<<"]"; return os; }
template<class T> ostream& operator<<(ostream &os, vector<T> V) { os<<"[";for(auto const &vv:V)os<<vv<<","; os<<"]"; return os; }
template<class L, class R> ostream& operator<<(ostream &os, pair<L, R> P) { os<<"("<<P.first<<","<<P.second<<")"; return os; }
inline int fstoi(const string &str){auto it=str.begin();bool neg=0;int num=0;if(*it=='-')neg=1;else num=*it-'0';++it;while(it<str.end()) num=num*10+(*it++-'0');if(neg)num*=-1;return num;}
inline void getch(char &x){while(x = getchar_unlocked(), x < 33){;}}
inline void getstr(string &str){str.clear(); char cur;while(cur=getchar_unlocked(),cur<33){;}while(cur>32){str+=cur;cur=getchar_unlocked();}}
template<typename T> inline bool sc(T &num){ bool neg=0; int c; num=0; while(c=getchar_unlocked(),c<33){if(c == EOF) return false;} if(c=='-'){ neg=1; c=getchar_unlocked(); } for(;c>47;c=getchar_unlocked()) num=num*10+c-48; if(neg) num*=-1; return true;}template<typename T, typename ...Args> inline void sc(T &num, Args &...args){ bool neg=0; int c; num=0; while(c=getchar_unlocked(),c<33){;} if(c=='-'){ neg=1; c=getchar_unlocked(); } for(;c>47;c=getchar_unlocked()) num=num*10+c-48; if(neg) num*=-1; sc(args...); }
template<typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; //s.find_by_order(), s.order_of_key() <- works like lower_bound
template<typename T> using ordered_map = tree<T, int, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define N 1000001
 
int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);
    int n;
    sc(n);
    int ans = 0;
    FOR(i,1,1200000){
        ans += n-i > i;
    }
    cout << ans;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main() 
{
    string s,t;
    cin>>s>>t;
    string check=t.substr(0,s.size());
    if(s==check)
    {
        cout<<"Yes";
    }
    else
    {
        cout<<"No";
    }
    return 0;
}


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

int main() {
  int N, M, p=0, q;
  cin >> N;
  M = N;
  
  while(N >= 1){
  p += (N % 10);
  N /= 10; 
  }
  
  if(M % p == 0)
  cout << "Yes";
  else
  cout << "No";
  

}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
#include <cstring>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<long long, long long> P;
#define rep(i, n) for(long long i=0; i<n; i++)
#define reps(i, s, e) for(long long i=s; i<e; i++)
#define repr(i, n) for(long long i=n-1; i>=0; i--)
#define reprs(i, s, e) for(long long i=e-1; i>=s; i--)

int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);

    ll n; cin >> n;
    ll x[n];
    rep(i, n){
        cin >> x[i];
    }

    ll min_cost = 1e18;
    ll ans = 0;
    ll x_min = *min_element(x, x+n);
    ll x_max = *max_element(x, x+n);

    reps(p, x_min, x_max + 1){
        ll cost = 0;
        rep(i, n){
            cost += (x[i] - p) * (x[i] - p);
        }

        if(cost < min_cost){
            min_cost = cost;
            ans = p;
        }
    }

    cout << min_cost << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <deque>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <cstring>
#include <iomanip>
#include <utility>
  
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n) for(int i=1;i<=(n);i++)
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
using namespace std;
      
int main(){
  cin.tie(0);
  ios::sync_with_stdio(0);

  int n;
  cin>>n;
  string s[n+5],x;
  int t[n+5],sum=0;

  reps(i,n){
    cin>>s[i]>>t[i];
  }
  cin>>x;

  bool ok=false;
  reps(i,n){
    if(ok){
      sum+=t[i];
    }
    else if(s[i]==x){
      ok=true;
    }
  }
  cout<<sum<<'\n';
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main(){
    string s;
    while(cin>>s){
        int ans[2]={0};
        if(s.size()>2){
            char bef[2]={s[0],s[1]};
            for(int i=2;i<s.size();i++){
                if(s[i]=='I'&&bef[1]=='O'){
                    if(bef[0]=='J')ans[0]++;
                    if(bef[0]=='I')ans[1]++;
                }
                bef[0]=bef[1],bef[1]=s[i];
            }
        }
        cout<<ans[0]<<"\n"<<ans[1]<<endl;
    }
    return 0;
}


Measured memory_bytes: 3156
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
using namespace std;
long long gcd(long long a, long long b) {
	if (b == 0) return a;
	else return gcd(b, a % b);
}
 
int main() {
	long long A, B;
	cin >> A >> B;
	long long GCD = gcd(A, B);
	int ans = 1;
	for (long long i = 2, imax = (long long)sqrt(GCD) + 1; i <= imax; i++) {
		if (GCD % i == 0) ans++;
		while (GCD % i == 0) GCD /= i;
	}
	if (GCD > 1) ans++;
	cout << ans << endl;
}

Measured memory_bytes: 256
import std.algorithm;
import std.array;
import std.ascii;
import std.bigint;
import std.complex;
import std.container;
import std.conv;
import std.functional;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

auto readInts() {
	return array(map!(to!int)(readln().strip().split()));
}
auto readInt() {
	return readInts()[0];
}
auto readLongs() {
	return array(map!(to!long)(readln().strip().split()));
}
auto readLong() {
	return readLongs()[0];
}

void readlnTo(T...)(ref T t) {
    auto s = readln().split();
    assert(s.length == t.length);
    foreach(ref ti; t) {
        ti = s[0].to!(typeof(ti));
        s = s[1..$];
    }
}

const real eps = 1e-10;

int d2(int[] xy1, int[] xy2) {
    int[2] dxy = xy1[] - xy2[];
    return dxy[0]*dxy[0] + dxy[1]*dxy[1];
}

int[] search(Tuple!(int, double)[][] gl, int s, int g) {
    auto pre = new int[](gl.length);
    auto used = new bool[](gl.length);
    //cost, idx, preIdx
    auto rbt = new RedBlackTree!(Tuple!(double, int, int));
    rbt.insert(tuple(0., s, -1));
    while(!rbt.empty()) {
        auto t = rbt.front;
        rbt.removeFront();
        auto idx = t[1];
        auto preIdx = t[2];
        if(used[idx]) {
            continue;
        }
        used[idx] = true;
        pre[idx] = preIdx;
        foreach(u; gl[idx]) {
            if(used[u[0]]) {
                continue;
            }
            rbt.insert(tuple(t[0] + u[1], u[0], idx));
        }
    }
    if(!used[g]) {
        return null;
    }
    auto ans = [g];
    while(ans.front != s) {
        ans = pre[ans.front] ~ ans;
    }
    return ans;
}


void main(){
    while(true) {
        auto n = readInt();
        if(n == 0) {
            return;
        }
        auto xy = new int[][](n);
        foreach(i; iota(n)) {
            auto bxy = readInts();
            xy[bxy[0]-1] ~= bxy[1..$];
        }
        auto minL = new int[][](n, n);
        auto gl = new Tuple!(int, double)[][](n, 0);
        foreach(i; iota(n)) {
            foreach(j; iota(n)) {
                int d2_ = d2(xy[i], xy[j]);
                if(d2_ <= 50*50) {
                    gl[i] ~= tuple(j, sqrt(d2_.to!double));
                    gl[j] ~= tuple(i, sqrt(d2_.to!double));
                }
            }
        }
        auto m = readInt();
        foreach(i; iota(m)) {
            int s, g;
            readlnTo(s, g);
            --s;
            --g;
            auto ans = search(gl, s, g);
            if(ans) {
                writeln(ans.map!(a => (a+1).to!string).join(" "));
            } else {
                writeln("NA");
            }
        }
    }
}

Measured memory_bytes: 2504
while True:
  n = int(input())
  if n == 0:break
  to = []
  fr = [[] for _ in range(n * n)]
  for i in range(n):
    line = list(map(int, input().split()))
    for j in range(n):
      x, y = line[2 * j:2 * j + 2]
      to.append(y * n + x)
      fr[y * n + x].append(i * n + j)
  
  order = []
  used = [False] * (n * n)
  def dfs(x):
    if used[x]:return
    used[x] = True
    dfs(to[x])
    order.append(x)
  
  for i in range(n * n):
    dfs(i)
  
  def dfs2(x, used, group):
    if used[x]:return
    used[x] = True
    for f in fr[x]:
      dfs2(f, used, group)
    group.append(x)
  
  used = [False] * (n * n)
  ans = 0
  for i in order:
    group = []
    if not used[i]:
      dfs2(i, used, group)
    if len(group) >= 1:
      ans += 1
  print(ans)
  


Measured memory_bytes: 8396
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <numeric>

// output
#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
// utility
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline T chmax(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T chmin(T& a, const T b) { return a = (a > b) ? b : a; }

// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;


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

  vector<int> u(M), v(M), d(M);
  vector<vector<int>> dist(N, vector<int>(N, INF));
  REP(i, N) dist[i][i] = 0;
  REP(i, M){
    cin >> u[i] >> v[i] >> d[i];
    u[i]--; v[i]--;
    dist[u[i]][v[i]] = d[i];
    dist[v[i]][u[i]] = d[i];
  }

  REP(k, N) REP(i, N) REP(j, N){
    chmin(dist[i][j], dist[i][k]+dist[k][j]);
  }

  int ans = 0;
  REP(k, M){
    bool flag = false;
    REP(i, N) REP(j, N){
      if(dist[i][j] == dist[i][u[k]]+d[k]+dist[v[k]][j]) flag = true;
    }
    if(flag) ans++;
  }

  cout << M-ans << endl;

  return 0;
}

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

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

int main(){

  int h,w,m;
  cin>>h>>w>>m;
  vector<map<int,int>> target(h);
  vector<int> row(h);
  vector<int> col(w);
  rep(i,m){
    int hi,wi;
    cin>>hi>>wi;
    hi--;wi--;
    target[hi][wi] = 1;
    row[hi]++;
    col[wi]++;
  }

  int c_max = 0;
  rep(wi,w)c_max=max(c_max,col[wi]);
  vector<int> w_candidate;
  rep(wi,w)
    if(col[wi]==c_max)
      w_candidate.emplace_back(wi);
  
  int ans = 0;
  rep(hi,h)for(int wi:w_candidate){
    if(target[hi].count(wi))
      ans = max(ans,row[hi]+col[wi]-1);
    else{
      ans = max(ans,row[hi]+col[wi]);
      break;
    }
  }

  cout<<(ans)<<endl;

}

Measured memory_bytes: 35724
#include <stdio.h>

int main(void){
  int  n , m;
  scanf("%d  %d",&n,&m);
  
  int h[n+2];
  for(int i = 1;i <= n;i ++){
    scanf("%d",&h[i]);
  }

  int a[m+1] , b[m+1];
  for(int i = 0;i < m;i ++){
    scanf("%d %d",&a[i],&b[i]);
  }

  int count[100001] = {0} , ans = 0;
  
  for(int i = 0;i < m;i ++){
    if(h[a[i]] > h[b[i]]){
      count[b[i]] ++;
    }
    else if(h[a[i]] < h[b[i]]){
      count[a[i]] ++;
    }
    else if(h[a[i]] == h[b[i]]){
      count[a[i]] ++;
      count[b[i]] ++;
  }
  }
  
  for(int i = 1;i <= n; i ++){
    if(count[i]==0){
      ans ++;
    }
  }
  
  printf("%d",ans);
  
  return 0;
}


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

int main(void){
    int H,W;
    while(true){
        cin>>H>>W;
        if(H==0 && W==0){
            break;
        }
        for(int j=0;j<W;j++){
            cout<<'#';
        }
        cout<<endl;
        for(int i=1;i<H-1;i++){
         cout<<'#';
         for(int j=1;j<W-1;j++){
            cout<<'.';
        }
        cout<<'#'<<endl;
    }
    for(int j=0;j<W;j++){
            cout<<'#';
        }
        cout<<endl<<endl;
    }
}



Measured memory_bytes: 3108
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <queue>
#include <sstream>
#include <stack>
#include <time.h>
#include <vector>
#include <complex>
using namespace std;
int main(){
  long long n,m;
  cin>>n>>m;
  if (m / 2 < n)
    cout<<m / 2;
  else
  cout<<n + (m - (n * 2)) / 4;
  system ("pause");
  return 0;
  } 

Measured memory_bytes: 504
#include <iostream>
#include <algorithm>
#include <vector>
#include <numeric>
#include <functional>
#include <iomanip>

using namespace std;

using ll = long long;

ll pascal[51][51];

void make_table()
{
    for (int n = 0; n < 51;n++)
    {
        for (int r = 0; r <= n;r++)
        {
            if(r == n || r == 0)
            {
                pascal[n][r] = 1LL;
            }
            else
            {
                pascal[n][r] = pascal[n - 1][r - 1] + pascal[n - 1][r];
            }
        }
    }
}

int main()
{
    int N, A, B;
    vector<ll> v;

    cin >> N >> A >> B;

    v.resize(N);

    make_table();

    for (int i = 0; i < N;i++)
    {
        cin >> v[i];
    }

    sort(v.begin(), v.end(), greater<ll>());

    ll sum = accumulate(v.begin(), v.begin() + A, 0LL);

    double ans = sum / (double)A;

    ll num;
    if (v[0] != v[A - 1])
    {    
        int cntn = count(v.begin(), v.end(), v[A - 1]);
        int cntr = count(v.begin(), v.begin() + A, v[A - 1]);
        num = pascal[cntn][cntr];
    }
    else
    {
        num = 0;
        int cntn = count(v.begin(), v.end(), v[A - 1]);
        for (int i = A; i <= B; i++)
        {
            int cntr = i;
            num += pascal[cntn][cntr];
        }

    }

    cout << fixed;
    cout << setprecision(6) << ans << endl << num << endl;

    return 0;
}


Measured memory_bytes: 256
import std.stdio;
import std.conv, std.array, std.algorithm, std.string;
import std.math, std.random, std.range, std.datetime;
import std.bigint;

void main(){
	int n, x;
	{
		int[] tmp = readln.chomp.split.map!(to!int).array;
		n = tmp[0], x = tmp[1];
		}
	
	ulong[] as = readln.chomp.split.map!(to!ulong).array;
	
	ulong ans = 0;
	
	for(int i = 1; i < as.length; i ++){
		if(as[i - 1] + as[i] < x) continue;
		ulong r = as[i - 1] + as[i] - x;
		if(r <= as[i]){
			ans += r, as[i] -= r;
			}
		else{
			ans += as[i], as[i] = 0;
			ans += as[i - 1] - x, as[i - 1] = x;
			}
		}
	
	debug as.writeln;
	
	ans.writeln;
	}

Measured memory_bytes: 3784
import java.util.*;

public class Main {

  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s = sc.nextLine();
    s = s.replace(" ", "");
    int i = Integer.parseInt(s);
    if ((i % 4) == 0){
      System.out.println("YES");
    } else {
      System.out.println("NO");
    }
  }
}

Measured memory_bytes: 21332
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

using namespace std;
using namespace boost::multiprecision;

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPI(i,a,b) for(int i=int(a);i<int(b);++i)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define ALL(x) (x).begin(),(x).end()

int main () {
  int n, v;
  std::priority_queue<
    int,                // 要素の型はint
    std::vector<int>,   // 内部コンテナはstd::vector (デフォルトのまま)
    std::greater<int>   // 昇順 (デフォルトはstd::less<T>)
  > que;
  cin >> n;

  REP(i, n) {
    cin >> v;
    que.push(v);
  }

  double acc = 0;

  while(!que.empty()) {
    acc = acc == 0 ? que.top() : (acc+que.top())/2;
    que.pop();
  }

  cout << acc << endl;
  return 0;
}


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

int main(){
  int N, M;
  vector<vector<bool>> like(30, vector<bool>(30, false));

  cin >> N >> M;
  for(int i=0; i<N; i++){
    int K; cin >> K;
    for(int j=0; j<K; j++){
      int A; cin >> A; A--;
      like[i][A] = true;
    }
  }

  int ans = 0;
  for(int i=0; i<M; i++){
    bool flag = true;
    for(int j=0; j<N; j++) flag = (flag && like[j][i]);
    if(flag) ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
{-# OPTIONS_GHC -O2 -funbox-strict-fields #-}
{-# LANGUAGE BangPatterns      #-}
{-# LANGUAGE CPP               #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TupleSections     #-}

import           Control.Applicative
import           Control.Monad
import           Control.Monad.Primitive
import           Control.Monad.ST
import           Control.Monad.State.Strict
import           Data.Bool
import qualified Data.ByteString.Char8       as B
import qualified Data.ByteString.Unsafe      as B
import           Data.Char
import           Data.Function
import qualified Data.IntMap.Strict          as IM
import qualified Data.IntSet                 as IS
import           Data.List
import qualified Data.Map.Strict             as M
import           Data.Monoid
import           Data.Ord
import           Data.Primitive.MutVar
import qualified Data.Set                    as S
import           Data.Tuple
import qualified Data.Vector                 as V
import qualified Data.Vector.Generic         as G
import qualified Data.Vector.Generic.Mutable as GM
import qualified Data.Vector.Unboxed         as U
import qualified Data.Vector.Unboxed.Mutable as UM
import           Debug.Trace
import           Foreign                     hiding (void)
import           Unsafe.Coerce

main :: IO ()
main = do
    !n <- readLn :: IO Int
    xs <- U.toList.U.unfoldrN n (B.readInt.B.dropWhile isSpace) <$> B.getLine
    ys <- U.toList.U.unfoldrN n (B.readInt.B.dropWhile isSpace) <$> B.getLine
    putStrLn.bool"No""Yes" $ solve xs ys

solve :: [Int] -> [Int] -> Bool
solve xs ys = go 0 0 xs ys
  where
--    go r2 r1 (x:_) (y:_) | traceShow(r2, r1, x, y)False = undefined
    go r2 r1 [x] [y] = x' <= y'
      where
        x' = x + 2 * r2
        y' = y + r1
    go r2 r1 (x:xs) (y:ys)
      | x == y = go r2 r1 xs ys
      | x < y = case quotRem (y - x) 2 of
          (_, 1) -> go r2 r1 ((x+2):xs) ((y+1):ys)
          (q, _)
            | q <= r2 -> go (r2-q) r1 xs ys
            | otherwise -> go 0 (r1 + q - r2) xs ys
      | x <= y + r1 = go r2 (r1 - (x - y)) xs ys
      | otherwise = go (r2 + x - y - r1) 0 xs ys




Measured memory_bytes: 1404
package main

import (
	"fmt"
	"strconv"
)

func main() {
	var a, b string
	fmt.Scan(&a, &b)
	t, _ := strconv.Atoi(a + b)

	for i := 0; i <= t; i++ {
		if i*i == t {
			fmt.Println("Yes")
			return
		}
	}
	fmt.Println("No")
}


Measured memory_bytes: 512
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        final Scanner scanner = new Scanner(System.in);
        final int length = scanner.nextInt();
        final int a = scanner.nextInt();
        final int b = scanner.nextInt();
        final int c = scanner.nextInt();
        final int d = scanner.nextInt();

        scanner.nextLine();
        final char[] road = scanner.nextLine().toCharArray();

        if (d > c) {
            if (check(road, a, c) && check(road, b, d)) {
                System.out.println("Yes");
            } else
                System.out.println("No");
        } else {
            if (!(check(road, a, c) && doubleCheck(road, b, d))) {
                System.out.println("No");
                return;
            }

            if (check(road, b, d)) {
                System.out.println("Yes");
            } else {
                System.out.println("No");
            }
        }
    }

    private static boolean check(char[] roads, final int begin, final int end) {
        if (roads[begin - 1] == '#' || roads[end - 1] == '#') return false;
        for (int i = begin; i < end; i++) {
            if (roads[i] == '#' && roads[i - 1] == '#') {
                return false;
            }
        }

        return true;
    }

    private static boolean doubleCheck(final char[] road, final int begin, final int end) {
        int counter = 0;
        for (int i = begin - 2; i < end + 1; i++) {
            if (road[i] == '.') {
                counter++;
                if (counter == 3) {
                    return true;
                }
            } else {
                counter = 0;
            }
        }
        return false;
    }
}



Measured memory_bytes: 26524
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int a = sc.nextInt();
		int b = 0;
		int c = 0;
		int e = 0;
		int f = 0;
		// スペース区切りの整数の入力
		// 文字列の入力
		String[] d = new String[a + 1];
		for(int i = 0; i < a + 1; i++){
			d[i] = sc.nextLine();
		} 
		for(int i = 0; i < a + 1; i++){
			if(d[i].equals("AC")){
				b++;
			}
			if(d[i].equals("WA")){
				c++;
			}
			if(d[i].equals("TLE")){
				e++;
			}
			if(d[i].equals("RE")){
				f++;
			}
		}
		System.out.println("AC x " + b);
		System.out.println("WA x " + c);
		System.out.println("TLE x " + e);
		System.out.println("RE x " + f);
		
		
		
	}
}

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

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

    int max = -9999999999;
    int min = vec[0];
    for (int i =1; i < N; i++) {
        int value = vec[i] - min;
        if (value > max) {
            max = value;
        }

        if (min > vec[i]) {
            min = vec[i];
        }
    }

    cout << max << endl;

    return 0;
}


Measured memory_bytes: 3580
#include<iostream>
#include<math.h>
#include<stdlib.h>
#include<string>
#include<vector>

using namespace std;

#define INF (1<<30)

int main(){
	int a,b,t;
	cin >> a >> b >> t;
	int ans = t/a * b;
	cout << ans << endl;
}

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

typedef long long ll;

ll a, b, d;
ll ansX, ansY;

void updateAns(int x, int y){
  ll sum = x + y;
  ll fom = a * x + b * y;

  if(ansX + ansY > sum || ansX + ansY == sum &&
     a * ansX + b * ansY > fom){
    ansX = x;
    ansY = y;
  }
}

int main(){
  while(cin >> a >> b >> d, a || b || d){
    ansX = 999999999;
    ansY = 999999999;

    for(ll x = 0; x < 100000; x++){
      // check 1
      ll A = x * a;
      ll B = A - d;
      if(B >= 0 && B % b == 0){
        ll y = B / b;
        updateAns(x, y);
      }

      B = x * a + d;
      if(B % b == 0){
        ll y = B / b;
        updateAns(x, y);
      }

      B = d - x * a;
      if(B >= 0 && B % b == 0){
        ll y = B / b;
        updateAns(x, y);
      }
    }

    cout << ansX << " " << ansY << endl;
  }
}

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

using namespace std;

#define fcout(d) cout << fixed << setprecision(d)
#define rep(i,n) for(int (i) = 0; (i) < (n); ++(i))
#define rep1(i,n) for(int (i) = 1; (i) <= (n); ++(i))
#define repU(i,bottom,ceiling) for(auto (i) = (bottom); (i) <= (ceiling); ++(i))
#define repD(i,ceiling,bottom) for(auto (i) = (ceiling); (i) >= (bottom); --(i))
#define repS(s,n) for(int (s) = 0; s < 1 << (n); ++(s))
#define repV(i,v) for(auto (i) = begin(v); (i) < end(v); ++(i))
#define all(v)  begin(v),end(v)
#define clr(v) fill(all(v),0)
#define l_bnd lower_bound
#define u_bnd upper_bound
#define puf push_front
#define pub push_back
#define pof pop_front
#define pob pop_back
#define mkp make_pair
#define mkt make_tuple
#define fir first
#define sec second
#define divceil(n,d) ((n)/(d) + ((n)%(d) > 0))
#define parity(a,b) (((a) & 1LL)^((b) & 1LL)^1LL)

typedef long long ll;
typedef unsigned long long ull;
typedef double db;

const pair<int,int> DIR[] = { {1,0},{0,1},{-1,0},{0,-1},{1,1},{-1,1},{-1,-1},{1,-1} };
const int INF = -1 + (1 << 30);
const int MOD = (int)1e9 + 7;

ull next_subset(ull subset){
	ull tem = subset + (subset & -subset);
	ull btm = (~tem & subset) / (subset & -subset) >> 1;
	return btm | tem;
}


int N;
string S;

void solve(){
	
	int l = 0, r = 0, f = 0, t;
	
	rep(i,N){
		if(S[i] == '(') ++l;
		else ++r;
		if(l == r) l = r = 0;
		if(l < r){
			++l;
			++f;
		}
	}
	
	t = l - r;
	
	rep(i,f) cout<<'(';
	cout<<S;
	rep(i,t) cout<<')';
	cout<<endl;
	
	return;
}

void input(){
	
	cin>>N>>S;
	
	return;
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	input();
	solve();
	
	return 0;
}





Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
	int n,x,t;cin>>n>>x>>t;
	cout << t * ((n + x - 1) / x) << endl;
	return 0;
}

Measured memory_bytes: 3636
#include<iostream>
using namespace std;
 
int main(){
   int n,m;
    cin>>n>>m;
    int a[n][m];
    int sum[n];
    int sum2[m+1];
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            cin>>a[i][j];
        }
        sum[i]=0;
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            cout<<a[i][j]<<" ";
            sum[i]+=a[i][j];
        }
        cout<<sum[i]<<endl;
    }
    for(int j=0;j<=m;j++){
        sum2[j]=0;
    }
    for(int j=0;j<m;j++){
        for(int i=0;i<n;i++){
            sum2[j]+=a[i][j];
        }
        cout<<sum2[j]<<" ";
        sum2[m]+=sum2[j];
    }
    cout<<sum2[m]<<endl;
    return(0);
}

Measured memory_bytes: 3132
#include<bits/stdc++.h>
using namespace std;
 
#define int long long int
#define ff first
#define ss second
#define pb push_back
 
int bexp(int a, int b, int mod)
{
    int res = 1;
    if (mod <= 0)
        return 0;
 
    while (b)
    {
        if (b & 1) res = (res * a) % mod;
 
        a = (a * a) % mod; 
        b >>= 1;
    }
    return res;
}
 
#define N 300010
#define MOD 1000000007
 
int gcd(int a, int b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}

struct comp {
    bool operator() (const pair<int, int> a, const pair<int, int> b) const
    {
        return a.ss * (a.ff - a.ff / 2) > b.ss * (b.ff - b.ff / 2);
    }
};


vector<int> getprimes()
{
    int f[1001] = {};
    vector<int> ans;

    f[1] = 1, f[0] = 1;
    f[2] = 0;
    for (int i = 2; i < 1001; ++i)
    {
        if (f[i] == 0)
        {
            for (int j = i * i; j < 1001; j += i)
            {
                f[j] = 1;
            }
        }
    }
    ans.push_back(2);

    for (int i = 3; i < 1001; i += 2)
        if (f[i] == 0)
            ans.push_back(i);

    return ans;
}

int32_t main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.precision(10);

    int n;
    cin >> n;

    int a;
    int k = 0;
    int p = 1;

    vector<int> primes = getprimes();
    set<int> si;
    for (int i = 0; i < n; ++i)
    {
        cin >> a;
        k = __gcd(k, a);

        int l = a;

        for (int k : primes)
        {
            if (k * k > a)
                break;
            if (a % k == 0)
            {
                if (si.insert(k).ss == false) p = 0;

                while (a % k == 0) a /= k;
                
            }
        }

        if (a > 1)
        {
            if (si.insert(a).second == false) p = 0;
        }
    }


    if (p == 1)
        cout << "pairwise coprime\n";
    else if (k == 1)
        cout << "setwise coprime\n";
    else
        cout << "not coprime\n";
    return 0;
}

Measured memory_bytes: 7352
from collections import defaultdict
import sys

input = lambda: sys.stdin.readline().rstrip()

def mod_inv(a):
  x1, y1, z1 = 1, 0, a
  x2, y2, z2 = 0, 1, M
  while z1 != 1:
    d, m = divmod(z2, z1)
    x1, x2 = x2-d*x1, x1
    y1, y2 = y2-d*y1, y1
    z1, z2 = m, z1
  return x1%M

def mex(s):
  s = set(s)
  for i in range(N+1):
    if i not in s:
      return i

def calc_grundy(e):
  g = {}
  for i in range(N, 0, -1):
    if i not in e:
      continue
    m = mex(map(lambda x:g.get(x, 0), e[i]))
    if m:
      g[i] = m
  return g

def sum_grundy(grundy):
  sum_g = [defaultdict(int, {0:B_sum}) for i in range(3)]
  W, prev = B, 1
  for i in range(1, N+1):
    for s, g in zip(sum_g, grundy):
      if i in g:
        if prev != i:
          W, prev = W * pow(B, i-prev, M) % M, i
        s[g[i]] =  (s[g[i]] + W) % M
        s[0] =  (s[0] - W) % M
  return sum_g

def read_edge():
  M = int(input())
  e = defaultdict(list)
  for i in range(M):
    a, b = sorted(map(int, input().split()))
    e[a].append(b)
  return e

N = int(input())
M = 998244353
B = pow(10, 18, M)
B_sum = (pow(B, N+1, M) - B) * mod_inv(B-1) % M

edge = [read_edge() for i in range(3)]
grundy = list(map(calc_grundy, edge))
sum_g = sum_grundy(grundy)
ans = 0
for gx, sx in sum_g[0].items():
  for gy, sy in sum_g[1].items():
    gz = gx^gy
    if gz in sum_g[2]:
      ans = (ans + sx*sy*sum_g[2][gz]) % M
print(ans)


Measured memory_bytes: 70288
#include<iostream>
#include<cstdio>
#include<set>
#include<map>
#include<cmath>
#include<cstdlib>
#include<algorithm>
#include<cstring>
#include<cassert>
#include<string>
#include<vector>
#include<queue>
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define INF 1000000005
#define rep(i,n) for(int i = 0;i < n;i++)
using namespace std;
typedef long long int ll;
typedef pair<int,int> PI;

int n;
int m[12][5];//???????????????
int erase(){
    int ret = 0;
    rep(i,n){
        int now = 0;
        int left = 0;
        while(now<5){
            while(now<5&&m[i][left]==m[i][now])now++;
            if(now-left<3){
                left=now;
            }else{
                while(left<now){
                    ret += m[i][left];
                    m[i][left]=0;
                    left++;
                }
            }
        }
    }
    return ret;
}
void down(){
    rep(j,5){
        int down = 0;
        int now = 0;
        while(now<n){
            while(now<n&&!m[now][j])now++;
            if(now==n){
                break;
            }
            m[down][j]=m[now][j];
            if(down<now){
                m[now][j]=0;
            }
            down++;
            now++;
        }
    }
    return;
}

void show(){
    rep(i,n){
        rep(j,5){
            cout<<m[n-1-i][j]<<" ";
        }
        cout<<endl;
    }
    cout<<endl;
}

int main(){
    while(1){
        cin>> n;
        if(!n)
            break;
        rep(i,11){rep(j,5)m[i][j]=0;}
        rep(i,n){
            rep(j,5){cin>>m[n-1-i][j];}
        }
        int ans = 0;
        int temp;
        while(1){
            temp = erase();
//            show();
            ans += temp;
            if(!temp){
                break;
            }
            down();
//            show();
        }
        cout<<ans<<endl;
    }
}

Measured memory_bytes: 1160
#include<stdio.h>
#include<math.h>

# define PI 3.141592653589793

int main(void){
  double x=0,y=0;
  double a,rad=0,deg=0;

  while(1){
    scanf("%lf,%lf",&a,&deg);

    if(a==0 && deg==0)break;

    x+=a*sin(rad);
    y+=a*cos(rad);

    rad+=deg*PI/180;

  }

  printf("%d\n%d\n",(int)x,(int)y);

  return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <stdio.h>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>

using namespace std;
int main(){
	int N;
	cin >> N;
	for(int i = 0;i < N;i++){
		double xa, ya, ra;
		double xb, yb, rb;
		double d, R;

		cin >> xa >> ya >> ra;
		cin >> xb >> yb >> rb;

		d = sqrt((xa-xb)*(xa-xb) + (ya-yb)*(ya-yb));
		R = fabs(ra-rb);
		if(ra+rb < d){
			cout << "0" << endl;
		}
		else if(ra+rb == d || (R < d && d < ra+rb) || R == d){
			cout << "1" << endl;
		}
		else if(R > d && ra > rb){
			cout << "2" << endl;
		}
		else if(R > d && ra < rb){
			cout << "-2" << endl;
		}

	}

	
	return 0;
}

Measured memory_bytes: 1228
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <set> 
#include <map>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstring>
#include <iomanip>
#define REP(i,n) for(int i=0; i<(n); ++i)
#define FOR(i,a,b) for(int i=(a); i<(b); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const ll INFLL = 1001001001001001001;  // > 10^18
const ll MODLL = (ll)1e9 + 7;
const double EPS = 1e-9;

int main () {
    
    string s; cin >>s;
    int n = s.length();

    string t = "";
    t += s[0];
    int count1 = 1;
    for (int i = 1; i < n;) {
        if (t.length() == 1) {
            if (t[0] == s[i] && i < n-1) {
                t = "";
                t += s[i];
                t += s[i+1];
                count1++;
                i += 2;
            } else if (t[0] != s[i]) {
                t = "";
                t += s[i];
                count1++;
                i += 1;
            } else {
                i += 1;
            }
        } else {
            t = "";
            t += s[i];
            count1++;
            i += 1;
        }
    }

    if (t.length() == 1 && t[0] != s[n-1]) {
        count1++;
    } 

    cout << count1 << endl;
    
    return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#define INF (1e17)
#define N 100005
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
ll n,m,x,h[N];
vector<P> G[N];
priority_queue<P,vector<P>,greater<P> > q;

ll dijkstra(){
  bool used[N]={};
  q.push(P(0,0));
  while(!q.empty()){
    P temp=q.top(); q.pop();
    ll cost=temp.first;
    ll node=temp.second;
    if(node==n-1)return cost+max(cost-x+h[node],0LL);
    if(used[node])continue;
    used[node]=1;
    for(int i=0;i<G[node].size();i++){
      ll nnode=G[node][i].first;
      ll ncost=G[node][i].second+cost;
      ncost+=max(x-ncost-h[nnode],0LL);
      q.push(P(ncost,nnode));
    }
  }
  return -1;
}

int main(){
  
  cin>>n>>m>>x;
  
  for(int i=0;i<n;i++)scanf("%lld",&h[i]);

  ll a,b,c;
  for(int i=0;i<m;i++){
    scanf("%lld%lld%lld",&a,&b,&c);
    a--,b--;
    if(h[a]>=c)G[a].push_back(P(b,c));
    if(h[b]>=c)G[b].push_back(P(a,c));
  }

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

Measured memory_bytes: 29848
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
typedef long long ll;
long long mod = 1e9 + 7;
const int iINF = 0x3f3f3f3f;
const long long INF = 1LL << 60;
using namespace std;

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

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

int main()
{
  ll n;
  cin >> n;
  vector<ll> a, a_top, a_under;

  rep(i, n + 1)
  {
    ll x;
    cin >> x;
    a.push_back(x);
  }

  ll tmp = 1;
  a_top.push_back(1);
  repi(i, 1, n + 1)
  {
    ll x;
    if (tmp - a[i - 1] < 0)
    {
      cout << -1 << endl;
      return 0;
    }

    if ((tmp - a[i - 1]) > 1e18 / 2)
    {
      x = 1e18 / 2;
    }
    else
    {
      x = (tmp - a[i - 1]) * 2;
    }
    a_top.push_back(x);
    tmp = x;
  }

  tmp = a[a.size() - 1];
  a_under.insert(a_under.begin(), tmp);
  repi(i, 1, n + 1)
  {
    ll x = ll(tmp + a[n - i]);
    a_under.insert(a_under.begin(), x);
    tmp = x;
  }

  ll ans = 0;
  ll tmp_num = 0;
  rep(i, n + 1)
  {
    if (i != 0 && a_top[i] <= 0 && a_under[i] <= 0)
    {
      cout << -1 << endl;
      return 0;
    }

    // cout << a_top[i] << " " << a_under[i] << endl;

    if (i == n && a_top[i] < a_under[i])
    {
      cout << -1 << endl;
      return 0;
    }
    else if (i == 0)
    {

      tmp_num = min(a_top[i], a_under[i]);
      ans += tmp_num;
    }
    else if (tmp_num * 2 >= min(a_top[i], a_under[i]))
    {
      tmp_num = min(a_top[i], a_under[i]);
      ans += tmp_num;
    }
    else
    {
      cout << -1 << endl;
      return 0;
    }
  }

  cout << ans << endl;

  return 0;
}


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

using namespace std;

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

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e17;

ll A[10];

int main() {
    ll N;
    cin >> N;
    ll m = INF;
    REP(i, 5) {
        cin >> A[i];
        m = std::min(m, A[i]);
    }
    cout << ((N + m - 1) / m - 1) + 5LL << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <cmath>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <iostream>
#include <random>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include <fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;

using ll = long long;
using vll = vector<ll>;
using pll = pair<ll, ll>;
using qll = queue<ll>;
using vb = vector<bool>;
using mll = map<ll, ll>;
using sll = stack<ll>;
#define REP(i,n) for(ll i(0);(i)<(n);(i)++)
#define rep(i,n) for(ll i(0);(i)<(n);(i)++)
#define ALL(a) a.begin(), a.end()
#define enld endl //* missspell check
const ll INF = 1LL << 60;
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; }

void solve(long long A, long long B, long long H, long long M){
    double alphaH = 2.0*M_PI*(H/12. +  M/60./12.);
    
    double alphaM = 2.0*M_PI*(double)M/60.;

    double result = sqrt((A*cos(alphaH) - B*cos(alphaM))*(A*cos(alphaH) - B*cos(alphaM)) 
                       + (A*sin(alphaH) - B*sin(alphaM))*(A*sin(alphaH) - B*sin(alphaM)) );
    
    cout<<setprecision(14)<<result<<endl;
}
int main(){
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    long long H;
    scanf("%lld",&H);
    long long M;
    scanf("%lld",&M);
    solve(A, B, H, M);
    return 0;
}


Measured memory_bytes: 4152