akhauriyash/Code-Regression huggingface dataset:
// </> : towhid1zaman

#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair< int, int > pii;
typedef vector<pii>vip;
typedef pair< pii, int > ppi;
#define fill(a,b) memset(a,b,sizeof(a))
#define all(v) (v).begin(),(v).end()
#define sp(k) cout<<setprecision(k)<<fixed;
#define rep(i,a) for(int i=0;i<a;i++)
#define rep1(i,a,b) for(int i=(a);i<=(b);++i)
#define irep(i,b,a) for(int i=(b);i>=(a);--i)
#define minv(v) *min_element(all(v))
#define maxv(v) *max_element(all(v))
#define unq(v) sort(all(v)),(v).erase(unique(all(v)),(v).end())
#define _ ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl "\n"
#define sqr(a) ((a)*(a))
#define sz(a) int(a.size())
#define ff first
#define ss second
#define pb push_back

const double pi = acos(-1.0);
const int mod = 1000000007; // (int)1e9+7
const int inf = 0x3f3f3f3f;// (int)3e18;
const int maxn = 2000100;



int main(){
        _
        ll n;cin >> n;
        vll a(n);
        ll sum = 0;
        rep(i,n){
            cin >> a[i];
            sum^=a[i];
        }
        rep(i,n){
            a[i] = sum^a[i];
        }
        rep(i,n){
            cout<<a[i]<<' ';
        }
        cout<<endl;


return 0;
}




Measured memory_bytes: 4752
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <utility>
#include <cmath>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <numeric>


using namespace std;

using ll = long long;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define mkp(a, b) make_pair(a, b)


using namespace std;


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

	vector<ll> a(n);

	vector<ll> v(n + 1, 0);
	rep(i, n) {
		cin >> a[i];
		v[a[i]]++;
	}

	ll total = 0;
	rep(i, n + 1) {
		ll cur = v[i];
		total += cur * (cur - 1) / 2; 
	}
	//cout << "total:" << total << endl;

	rep(i, n) {
		ll cur = v[a[i]];
		//cout << "cur:" << cur << endl;
		if (cur < 2) {
			cout << total << endl;
		} else {

			//cout << "minus:" <<  cur * (cur - 1) / 2  << endl;
			//cout << "plus:" << (cur - 1) * ( cur - 2) / 2 << endl;
			
			cout << total 
				- cur * (cur - 1) / 2 
				+ (cur - 1) * ( cur - 2) / 2
				<< endl;	
		}
	}

	return 0;

}

Measured memory_bytes: 5760
/***** author : @C0d1ngPhenomena *****/

	#include <bits/stdc++.h>
	#include <cstdio>
	#include <cstring>
	#include <cmath>
	#include <cstring>
	#include <chrono>
	#include <complex>
	#define endl "\n"
	#define ll long long int
	#define vi vector<int>
	#define vll vector<ll>
	#define vvi vector < vi >
	#define pii pair<int,int>
	#define pll pair<long long, long long>
	#define mod 1000000007
	#define inf 1000000000000000001;
	#define all(c) c.begin(),c.end()
	#define mp(x,y) make_pair(x,y)
	#define mem(a,val) memset(a,val,sizeof(a))
	#define eb emplace_back
	#define pb push_back
	#define f first
	#define s second
	
	using namespace std;
	int main()
	{
		std::ios::sync_with_stdio(false);
		
		ll A,B,C,D;
		ll flag=0;
		cin >> A >> B >> C >> D;
		ll alt=0;
		
		while(1)
		{
			if(alt)
			{
				A-=D;
				alt=0;
				// cout<<A<<endl;

			}
			
			if(!alt)
			{
				C-=B;
				alt=1;
				// cout<<C<<endl;

			}
			

			if(A<=0)
			{
				flag=1;
				break;

			}
			if(C<=0)
			{
				break;
			}

		}

		if(flag)
			cout<<"No";
		else
			cout<<"Yes";

		return 0;
	}


Measured memory_bytes: 3636
#include<stdio.h>
int main(void){
    int n, i, j;
    scanf("%d",&n);
    char s[n], t[n], h[201];
    scanf("%s%s",&s,&t);
    h[0]=s[0];
    for(i=1;i<n;i++){
        h[i*2-1] = t[i-1];
        h[i*2] = s[i];
    }
    h[2*n-1] = t[n-1];
    h[2*n] = '\0';
    printf("%s\n",h);
    return 0;
}

Measured memory_bytes: 128
// amigos y no más
// dile a la jardinera que traigo flores
 
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
 
#define fastio ios_base::sync_with_stdio(0);cin.tie(0)
#define MOD 998244353LL
#define MOD1 1000000007LL
#define LIM 262150
 
using namespace std;
 
typedef long long ll ;
 
ll n;
ll bits[100] = {0LL};

int cont=0;
ll ans = 0LL;

int main() {
	fastio;
	cin>>n;
	for(int i=0; i<n;i++){
		ll x; cin>>x;
		cont=0;
		while(x){
			ll y = x&1LL;
			if(y == 1LL )(bits[cont])++;
			x = x>>1;
			cont++;
		}
	}
	
	for(int i=0; i<64;i++){
		ll bits0 = n - bits[i] ; 
		ans = (ans + ( ( ((bits0 * bits[i])%MOD1)  * ( (1LL<<i) %MOD1)  ) % MOD1 ) )% MOD1;
	}
	
	cout<<ans<<"\n";
	return 0;
}

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

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

int main() {
  int n;
  cin>>n;
  long long ans=0;
  vector<int> a(n+1),b(n);
  rep(i,n+1){
    cin>>a[i];
    ans+=a[i];
  }
  rep(i,n){
    cin>>b[i];
    if(a[i]>=b[i]) a[i]-=b[i];
    else {
      a[i+1]-=b[i]-a[i];
      if(a[i+1]<0) a[i+1]=0;
      a[i]=0;
    }
    ans-=a[i];
  }
  ans-=a[n];
  cout<<ans;
  return 0;
}

Measured memory_bytes: 1024
from collections import deque

s = input()
n = len(s)
l = deque([])
r = deque([])
c = 0

for i in range(n):
    if s[i] != "x": l.append(s[i])
    if s[n-1-i] != "x": r.append(s[n-1-i])

if l != r:
    print(-1)
    exit(0)

if len(l) % 2 == 1: c = len(l) // 2 + 1
else: c = len(l) // 2

cntl = [0]*c
cntr = [0]*c

k = 0
i = 0

while k < c:
    if s[i] == "x":
        cntl[k] += 1
    else:
        k += 1
    i += 1

k = 0
i = n-1

while k < c:
    if s[i] == "x":
        cntr[k] += 1
    else:
        k += 1
    i -= 1

ans = 0

for j in range(c):
    ans += abs(cntl[j] - cntr[j])

print(ans)

Measured memory_bytes: 5876
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int N=1e5+500;
int n,a[5][N],rev[3],tmp[N],pos[N*3];
struct BIT
{
    int a[N];
    void clear(){for(int i=1;i<=n;i++)a[i]=0;}
    void update(int x,int w){for(;x<=n;x+=x&-x)a[x]+=w;}
    int query(int x){int ans=0;for(;x;x-=x&-x)ans+=a[x];return ans;}
    int query(int l,int r){if(l>r)return 0;return query(r)-query(l-1);}
}s[2];
int main()
{
    scanf("%d",&n);
    for(int i=1;i<=3;i++)
        for(int j=1;j<=n;j++)scanf("%d",&a[i][j]);
    for(int i=1;i<=n;i++)tmp[i]=a[2][i];
    sort(tmp+1,tmp+n+1);
    for(int i=1;i<=n;i++)pos[(i-1)*3+2]=i;
    for(int i=1;i<=n;i++)if(tmp[i]!=(i-1)*3+2){puts("No");return 0;}
    for(int i=1;i<=n;i++)
    {
        int u=a[1][i],v=a[3][i];if(u>v)swap(u,v),rev[i&1]^=1;
        if(u+1!=a[2][i]||v-1!=a[2][i]){puts("No");return 0;}
        if((pos[a[2][i]]&1)!=(i&1)){puts("No");return 0;}
        rev[~i&1]^=s[i&1].query(pos[a[2][i]]+1,n)&1;
        s[i&1].update(pos[a[2][i]],1);
    }
    if(rev[0]||rev[1]){puts("No");return 0;}
    puts("Yes");return 0;
}

Measured memory_bytes: 7304
#!/usr/bin/env python3
import sys


def solve(N: int, X: int, x: "List[int]"):
    from fractions import gcd
    from functools import reduce
    Y = sorted(x+[X])
    Z = [x2-x1 for x1, x2 in zip(Y, Y[1:])]
    return reduce(gcd, Z)


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    X = int(next(tokens))  # type: int
    x = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    print(solve(N, X, x))

def test():
    import doctest
    doctest.testmod()

if __name__ == '__main__':
    #test()
    main()


Measured memory_bytes: 22612
using System;
using System.Linq;
class program{
  static void Main(){
    int[] x = Array.ConvertAll(Console.ReadLine().Split(' '),int.Parse);
    for(int i = 0;i<5;i++){
      if(x[i] != i+1){
        Console.Write(i+1);
      }
    }
  }
}

Measured memory_bytes: 27404
n=int(input())
mt,mx,my=0,0,0
p=True
for i in range(n):
    t,x,y=map(int,input().split())
    #print(abs(mx-x),abs(my-y),t-mt)
    if abs(mx-x)+abs(my-y)<=t-mt and (t-mt)%2==(abs(mx-x)+abs(my-y))%2:
        mt,mx,my=t,x,y
    else:
        p=False
        print('No')
        break
        
if p:
    print('Yes')

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

#define rep(i, N) for (int i = 0; i < N; i++)
#define pb push_back

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

double f(ll N){
    ll n, dig;
    n = N;
    ll sum = 0;

    while(n){
        dig = n % 10;
        sum = sum + dig;
        n = n / 10;
    }
    return (double)N / sum;
}

int main() {
    ll K;
    cin >> K;
    ll a = 1, order=1;
    for(int i = 0; i < K; i++){

        cout << (ll)a << endl;
        if (f(a + pow(10, order-1)) > f(a + pow(10.0, order*1.0))){
            order++;
        }
        a += pow(10.0, order-1*1.0);
    }
    return 0;
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Map;
import java.util.Scanner;
import java.util.TreeMap;

public class Main {

	public static void main(String args[]) {

		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		int M = sc.nextInt();

		int[] A = new int[N];
		Map<Integer,Integer> map = new TreeMap<Integer, Integer>();
		for(int i=0;i<N;i++) {
			A[i] = sc.nextInt();
			int b = sc.nextInt();

			if(map.containsKey(A[i])) {
				int temp = map.get(A[i]);
				map.remove(A[i]);
				map.put(A[i], temp+b);
				A[i] = Integer.MAX_VALUE;
			}else {
				map.put(A[i], b);
			}
		}
		Arrays.sort(A);

		long yen = 0;
		for(int i=0;i<A.length;i++) {
			if(M > map.get(A[i])) {
				yen += ((long)A[i] * (long)map.get(A[i]));
				M -= map.get(A[i]);
			}else {
				yen += ((long)A[i] * (long)M);
				break;
			}
		}
		System.out.println(yen);
	}
}

Measured memory_bytes: 99140
#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long
#define pb push_back
#define sz(i) (int)(i.size())
#define F first
#define S second
#define L long double
#define P pair<int, int>
const int inf = 0x3f3f3f3f3f3f3f3LL;
const int mod = (int)1e9 + 7;
using namespace std;
#if LOCAL
#include "../../tr.h"
#else
#define tr(...)
#define endl '\n'
#endif
template<class T> void smin(T& a, T val) {if (a > val) a = val;}template<class T> void smax(T& a, T val) {if (a < val) a = val;}
const int N = 5*(int)1e5 + 10;

int n, k;
#define pow ckcm

int pow[60];

int get(int which){
   for (int i = 0; i < 60; ++i)
   {
      if (which * pow[i] >= k){
         return i;
      }
   }
   assert(0);
}

int32_t main(){_

   cin>>n>>k;

   L ans = 1/(L)n;
   L sum = 0;

   pow[0] = 1;
   for (int i = 1; i < 60; ++i)
   {
      pow[i] = pow[i-1] * 2;
   }

   for (int i = 1; i <= n; ++i)
   {
      int x = get(i);         
      sum += (L)1/(L)pow[x];
   }

   ans *= sum;
   cout << fixed << setprecision(15);

   cout<<ans;

   return 0;
}

// Common sense: do smth instead of nothing
// Even a single second counts...
// If other's can do it, even I can do it. It wouldn't be that tough. Let me give it a try.
// Mistakes made in past
// -Ques. ask for max-min => think binary_search, DP, greedy
// -not reading question properly / skipping to read & understand all samples properly & wasting time in wrong direction.
// -Using wrong indexing in nested loops something like a[i], when it is supposed to be a[j](WA)
// -value of const int N is not correct (WA/RTE).
// -Did you memset dp to -1 ?
// -check for small edges cases and work on small test cases manually if WA
// -not deallocating memory to pointers can lead to MLE. Use delete :))
// -not reading problem statements of harder problems E,..., thinking it couldn't be solved, but it isn't the case.
// -Avoid using #define int long long as much as possible when it's dp problem and requires high memory say, O(N^2, N=5000) (MLE)
// -Check Bitwise Operator Precedence 
// -Use pragmas to optimize (by constant factor) when necessary..
// -Think before coding & starting to debug. Have patience to look inside code and actually see how it works

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdlib>

using namespace std;

int main(){

	int x;
	int min=10000;
	string s, s3;

	cin>> s;

	for(int i=0;i<s.size()-2;i++){
		s3=s.substr(i, 3);
		x=atoi(s3.c_str());
		if(abs(753-x)<min) min=abs(753-x);
	}
	cout<< min << "\n";
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int K = sc.nextInt();
		int a[] = new int[N];
		for(int i=0;i<N;i++) a[i]=sc.nextInt();
		sc.close();
		
		boolean dp[] = new boolean[K+1];
		dp[0]=false;
		for(int i=0;i<=K;i++) {
			for(int t:a) {
				if(i-t>=0)dp[i] |= !dp[i-t];
			}
		}
		if(dp[K])System.out.println("First");
		else System.out.println("Second");
	}
}


Measured memory_bytes: 24404
#include <iostream>

using namespace std;

int main(){
    char a, b;

    cin >> a >> b;
    if(a == 'H'){
        if(b == 'H'){
            cout << "H" << endl;
        }else{
            cout << "D" << endl;
        }
    }else{
        if(b == 'H'){
            cout << "D" << endl;
        }else{
            cout << "H" << endl;
        }
    }
}

Measured memory_bytes: 3628
public class Main{
  public void run(java.io.InputStream in, java.io.PrintStream out){
    java.util.Scanner sc = new java.util.Scanner(in);
    String s;
    char[] c;
    int i, n;

    n = sc.nextInt(); s = sc.nextLine();
    for(;n-- > 0;){
      s = sc.nextLine(); c = new char[s.length()];
      for(i = 0;i < s.length();i++)c[i] = s.charAt(i);

      for(i = 0;i < s.length() - 6;i++){
        if(c[i] == 'H' && c[i + 1] == 'o' && c[i + 2] == 's' && c[i + 3] == 'h'
         && c[i + 4] == 'i' && c[i + 5] == 'n' && c[i + 6] == 'o')
         c[i + 6] = 'a';
        out.print(c[i]);
      }
      for(;i < s.length();i++)out.print(c[i]);
      out.println();
    }

    sc.close();
  }
  public static void main(String[] args){
    (new Main()).run(System.in, System.out);
  }
}

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

#define ll long long
#define INF 99999999
#define rep(i,n) for(int i=0,temp=(int)(n);i<temp;++i) //vec.size()がnの時等の高速化
#define all(x) (x).begin(),(x).end()
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define vint vector<int>
#define vvint vector<vector<int>>

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; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int a,b,c,k;

int bfs(int x,int y,int z,int id){
  if(id==k) return x+y+z;
  return max(bfs(x*2,y,z,id+1),max(bfs(x,y*2,z,id+1),bfs(x,y,z*2,id+1)));
}

int main(){
  cin >> a >> b >> c >>k;
  cout << bfs(a,b,c,0) << endl;
  return 0;
}


Measured memory_bytes: 256
N, L = map(int, input().split())
#apple = []
#for i in range(N):
apple = [L + i for i in range(N)] 

abs_min = float('Inf')
for i in apple:
    if abs(i) < abs(abs_min):
        abs_min = i

apple.remove(abs_min)
print(sum(apple))

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

int main(){
    string s;
    cin >> s;
    if(s == "SUN"){
       cout << 7 << endl; 
    }  
    else if(s == "MON"){
       cout << 6 << endl;
    }
    else if(s == "TUE"){
        cout << 5 << endl;

    }
    else if(s == "WED"){
        cout << 4 << endl;

    }
    else if(s == "THU"){
        cout << 3 << endl;

    }
    else if(s == "FRI"){
        cout << 2 << endl;

    }
    else if(s == "SAT"){
        cout << 1 << endl;
        
    }
    
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template <typename Q_type>
using smaller_queue = priority_queue<Q_type, vector<Q_type>, greater<Q_type>>;

const int MOD_TYPE = 1;
const ll MOD = (MOD_TYPE == 1 ? (ll)(1e9 + 7) : 998244353);
const int INF = (int)1e9;
const ll LINF = (ll)4e18;
const double PI = acos(-1.0);

#define REP(i, m, n) for (ll i = m; i < (ll)(n); ++i)
#define rep(i, n) REP(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl
#define possible(n) cout << ((n) ? "possible" : "impossible") << endl
#define Yay(n) cout << ((n) ? "Yay!" : ":(") << endl
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x) cerr << #x << ":" << x << endl;

vector<int> Dx = {0, 0, -1, 1, -1, 1, -1, 1, 0};
vector<int> Dy = {1, -1, 0, 0, -1, -1, 1, 1, 0};

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(50) << setiosflags(ios::fixed);
  int q;
  cin >> q;
  multimap<string, int> mp;
  rep(qi, q)
  {
    int type;
    cin >> type;
    if (type == 0)
    {
      string key;
      int x;
      cin >> key >> x;
      mp.emplace(key, x);
    }
    else if (type == 1)
    {
      string key;
      cin >> key;
      auto p = mp.equal_range(key);
      for (auto itr = p.first; itr != p.second; itr++)
      {
        cout << itr->second << endl;
      }
    }
    else if (type == 2)
    {
      string key;
      cin >> key;
      mp.erase(key);
    }
    else
    {
      string l, r;
      cin >> l >> r;
      auto itr = mp.lower_bound(l);
      while (itr != mp.end() && itr->first <= r)
      {
        cout << itr->first << " " << itr->second << endl;
        itr++;
      }
    }
  }
  return 0;
}



Measured memory_bytes: 24908
import Data.List

main = do
  n <- readLn :: IO Int
  a <- sortBy (\x y -> compare y x) . map read . words <$> getLine :: IO [Int]
  let (x, y) = solve a ([], [])
  print $ sum x - sum y

solve :: [Int] -> ([Int], [Int]) -> ([Int], [Int])
solve [] (x, y) = (x, y)
solve (a:[]) (x, y) = (a:x, y)
solve (a:b:as) (x, y) = solve as (a:x, b:y)


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

// infty
#define ULLINF (ULLONG_MAX)
#define LLINF  (LLONG_MAX)
#define IINF   (INT_MAX)
#define INF    (1<<29)

// math
#define Sq(x) ((x)*(x))

// container utility
#define ALL(x) (x).begin(), (x).end()
#define MP make_pair
#define PB push_back
#define EACH(it,c) for(__typeof((c).begin())it=(c).begin();it!=(c).end();it++)

// rep
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)

// typedef
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<PII> VII;
typedef vector<VI> VVI;

typedef long long ll;

// pair util
#define FST first
#define SND second

// range validator
#define CK(n,a,b) (a<=n && n<b)

// conversion
template<class T> inline string toStr(T a) { ostringstream oss_; oss_ << a; return oss_.str(); }
inline int toInt(string s) { return atoi(s.c_str()); }

// prime
bool isPrime(int a) { for(int i=2; i*i <=a; i++) if(a%i == 0) return false; return true; }

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

//////////////////////////////////////////////////////////////

#define EPS (1e-5)

typedef complex<double> P;
typedef pair<double, P> C;
typedef pair<P, P> S;

double dot(P a, P b) {
  return a.real()*b.real()+a.imag()*b.imag();
}

double cross(P a, P b) {
  return a.real()*b.imag()-a.imag()*b.real();
}

typedef S Line;
double distanceLP(Line l, P a) {
  P base = l.SND-l.FST;
  return abs(cross(base, a-l.FST)) / abs(base);
}

double distanceSP(S s, P a) {
  {
    P X = s.SND - s.FST, Y = a - s.FST;
    if(dot(X, Y) < EPS) return abs(Y);
  }
  {
    P X = s.FST - s.SND, Y = a - s.SND;
    if(dot(X, Y) < EPS) return abs(Y);
  }
  
  return distanceLP(s, a);
}

int main() {
  
  while(1) {
    int N;
    cin >> N; if(N == 0) break;
    
    vector<C> circles(N);
    
    for(int i=0; i<N; i++) {
      double x, y, r;
      cin >> x >> y >> r;
      circles[i] = C(r, P(x, y));
    }
    
    int Q; cin >> Q;
    while(Q--) {
      double x, y;
      cin >> x >> y; P taro(x, y);
      cin >> x >> y; P devil(x, y);
      
      bool ok = 0;
      for(int idx=0; idx<N; idx++) {
	if( distanceSP( S(taro, devil), circles[idx].SND ) < circles[idx].FST + EPS ) {
	  if( abs(taro-circles[idx].SND) > circles[idx].FST
	      || abs(devil-circles[idx].SND) > circles[idx].FST ) ok = 1;
	}
      }
      
      if(ok) cout << "Safe" << endl;
      else cout << "Danger" << endl;
    }
    
  }
  
  return 0;
}

Measured memory_bytes: 1244
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;

int main()
{
  ll N, T, Q; cin >> N >> T >> Q;
  ll A[N], D[N]; FOR(i,0,N) cin >> A[i] >> D[i];
  ll X[Q]; FOR(i,0,Q) cin >> X[i];
  vector<ll> stop;
  stop.push_back(-(1LL<<62));
  FOR(i,0,N-1) {
    if(D[i] == 1 && D[i+1] == 2) {
      stop.push_back((A[i]+A[i+1])/2);
    }
  }
  stop.push_back(1LL<<62);
  sort(stop.begin(), stop.end());
  FOR(i,0,Q) {
    ll a = A[X[i] - 1];
    int j = lower_bound(stop.begin(), stop.end(), a) - stop.begin();
    if(D[X[i]-1] == 1) {
      cout << min(stop[j], a + T) << endl;
    } else {
      j--;
      cout << max(stop[j], a - T) << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 4684
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
using namespace std;
int main()
{
  int n;cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];

  map<int,int> mp;
  rep(i,n) mp[a[i]]++;
  int res = n;
  int cnt = 0;
  for(auto m : mp) {
    if(m.second % 2 == 1) {
      res -= m.second - 1;
    }
    else {
      res -= m.second - 2;
      cnt++;
    }
  }
  res -= (cnt + 1)/2 * 2;
  cout << res << "\n";
  return 0;
}


Measured memory_bytes: 5376
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <unordered_map>
#include <utility>
#include <algorithm>
#include <set>
#include <cmath>
#include <array>
#include <bitset>
using namespace std;

typedef long long ll;
const ll mod=1000000007;
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,n) for(int i=1;i<n+1;i++)

ll gcd(ll a,ll b){ // 高速ユークリッド互助法
    if(a<0) a=-1*a;
    if(b<0) b=-1*b;
    if(a==0) return b;
    if(b==0) return a;
    if(a==b) return a;
    ll c;
    if(a<b){
        c=b-(b/a)*a;
        if(c<a/2) return gcd(a,c);
        else return gcd(a,c-a);
    } else{
        c=a-(a/b)*b;
        if(c<b/2) return gcd(c,b);
        else return gcd(c-b,b);
    }
}
int main(){
    ll A,B,C,D;
    cin>>A>>B>>C>>D;
    ll b_num,a_num;
    ll g=gcd(C,D);
    ll w=(C*D)/g;
    b_num=B-(B/D+B/C-B/w);
    a_num=(A-1)-(A-1)/D-(A-1)/C+(A-1)/w;
    cout<<b_num-a_num;
    return 0;
}

Measured memory_bytes: 256
/*
    हॉंजी । की हाल चाल?
    बड़ीया सब?
*/

#include<bits/stdc++.h>
using namespace std;

#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             unordered_map<int,int>
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define MOD             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define w(x)            int x; cin>>x; while(x--)
#define EPS             1e-9

void gogeta()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}

bool check(pii p) {
    if (p.ff == p.ss)    return true;
    return false;
}

int32_t main()
{
    gogeta();
    int n; cin >> n;
    std::vector<pii> v(n);
    for (int i = 0; i < n; i++)  cin >> v[i].ff >> v[i].ss;
    bool ans = false;
    for (int i = 0; i < n - 2; i++) {
        if (check(v[i]) && check(v[i + 1]) && check(v[i + 2])) {
            ans = true;
            break;
        }
    }
    if (ans) cout << "Yes\n";
    else    cout << "No\n";
}


Measured memory_bytes: 3640
import java.util.*;
public final class Main{ 
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in); 
        int n = sc.nextInt();
        long s=0;
        for(int i = 0; i <= n; i++){
            if(i%3!=0 && i%5!=0)
                s+=i;
        }
        System.out.print(s);
    }
}



Measured memory_bytes: 27192
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()) {
			String S = sc.nextLine();
			String[] s = S.split(" ");
			for(int i = 0; i < 26; i++) {
				String[] t = new String[s.length];
				int[] g = new int[4];
				for(int j = 0; j < s.length; j++) {
					t[j] = func(s[j], i);
					g[check(t[j])]++;
				}
				if(g[0] >= 1 || g[1] >= 1 || g[2] >= 1) {
					for(int j = 0; j < s.length; j++) {
						if(j != s.length - 1) {
							System.out.printf("%s ", t[j]);
						}else {
							System.out.println(t[j]);
						}
					}
					break;
				}
			}
		}
		sc.close();
	}
	static int check(String s) {
		if(s.equals("the")) return 0;
		if(s.equals("this")) return 1;
		if(s.equals("that")) return 2;
		return 3;
	}
	static String func(String s, int k) {
		char[] c = s.toCharArray();
		int l = s.length();
		for(int i = 0; i < l; i++) {
			if(c[i] != '.') {
				c[i] = (char)((c[i] - 'a' + k) % 26 + 'a');
			}
		}
		return new String(c);
	}
}


Measured memory_bytes: 26144
#include <bits/stdc++.h>
#define LL long long
#define rep1(i,a,b) for (int i = a;i <= b;i++)

using namespace std;

const int N = 1e6;

int n;

int main()
{
    #ifdef LOCAL_DEFINE
        freopen("rush.txt","r",stdin);
    #endif // LOCAL_DEFINE
    scanf("%d",&n);
    int ans = -1;
    rep1(i,1,n-1){
        int x = i,y = n-i;
        int sum1 = 0,sum2 = 0;
        while (x>0){
            sum1+=x%10;
            x/=10;
        }
        while (y>0){
            sum2+=y%10;
            y/=10;
        }
        if (ans==-1){
            ans = sum1+sum2;
        }else{
            ans = min(ans,sum1+sum2);
        }
    }
    cout<<ans<<endl;
    return 0;
}


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

bool cmp(int a,int b){
	return a>b;
}

int main(){

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

	int n,m;
	cin >> n >> m;
	
	vector<int> val(n);
	int sum=0;
	for(int i=0;i<n;i++){
		cin >> val[i];
		sum += val[i];
	}

	float s = float(sum)/(4*m);
	sort(val.begin(),val.end(),cmp);
	//cout<<sum<<" "<<s<<endl;
	/*for(int i=0;i<n;i++)
		cout<<val[i]<<" ";
	cout<<endl;	
	*/
	bool check=false;
	for(int i=0;i<m;i++){
		if(val[i]<s){
			check=true;
			break;
		}
	}

	if(check==false) cout<<"Yes";
	else cout<<"No";

	return 0;
}


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

					#define F first
					#define S second
					#define N 222222
					#define M 1000000007
					#define pb push_back
					#define cend(s) return cout << s, 0
					using namespace std;
					typedef long long ll;
					typedef vector<int> vi;

					int main()
					{
						int n;
						ll t = 0;
						cin >> n;
						int a[n+9];
						for(int i = 1; i <= n; i++)
							cin >> a[i];
						for(int i = 2; i <= n; i++)
							if(a[i-1] > a[i])
								t += (a[i-1]-a[i]), a[i] = a[i-1];
						cout << t << '\n';			
					}

Measured memory_bytes: 4404