akhauriyash/Code-Regression huggingface dataset:
//                                 Alisher_2211
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        # include <bits/stdc++.h>
# define  long          long long
# define  all(vc)       vc.begin(),vc.end()
# define  allr(vc)      vc.rbegin(),vc.rend()
# define  pb            push_back
# define  fi            first 
# define  se            second
# define  pi            pair <long, long>    
# define  lcm(a, b)     (a * b) / __gcd(a, b)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        using namespace std;
const long N = 100100;
void read(){freopen("input.txt" , "r" , stdin );freopen("output.txt", "w" , stdout );}
long dp[N][2];
void solve(){
    long a;
    cin >> a;
    vector <long> v(a);
    for(auto &i: v) cin >> i;
    long mx = 0, ans = 0;
    for (int i = 0; i < a; ++i){    
        if( mx < v[i] ){
            mx = v[i];
            continue;
        }
        if( mx == v[i] ) continue;
        ans += mx - v[i];
    }
    cout << ans;
}
int32_t main(){
ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); 
        long T = 1;
        //cin >> T;
        while( T-- ){
            solve();
            cout<<'\n';
        }
cerr << "\nTime elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
}

Measured memory_bytes: 4752
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    n=INT()
    d,x=INTM()
    A=[]
    for i in range(n):
        A.append(INT())
    for a in A:
        x+=(d-1)//a+1
    print(x)
if __name__ == '__main__':
    do()

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

int main(){
  string s;
  cin >> s;
  if(s[0] == s[1] && s[2] == s[3] && s[0] != s[2]) cout << "Yes" << endl;
  else if(s[0] == s[2] && s[1] == s[3] && s[0] != s[1]) cout << "Yes" << endl;
  else if(s[0] == s[3] && s[1] == s[2] && s[0] != s[1]) cout << "Yes" << endl;
  else cout << "No" << endl;
}

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

typedef int_fast32_t int32;
typedef int_fast64_t int64;

const int32 inf = 1e9+7;
const int32 MOD = 1000000007;
const int64 llinf = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE\n" : "IMPOSSIBLE\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define all(obj) (obj).begin(),(obj).end()
#define rall(obj) (obj).rbegin(),(obj).rend()
#define fi first
#define se second
#define pb(a) push_back(a)
typedef pair<int32,int32> pii;
typedef pair<int64,int64> pll;

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

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int64 a,v,b,w,t;
  cin >> a >> v >> b >> w >> t;
  YES(abs(a-b) <= (v- w) * t);
  return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
int main(){
    string s, t;
    long long i, j, cnt=0, ans=100000, f=0;
    cin >> s >> t;
    for(i=0;i<s.size();i++){
        cnt=0;
        for(j=0;j<t.size();j++){
            if(i+j>=s.size()){
                f=1;
                break;
            }
            if(s.at(i+j)!=t.at(j)) cnt++;
        }
        if(f==1) break;
        ans=min(ans, cnt);
    }
    cout << ans <<endl;
    return 0;
}


Measured memory_bytes: 3608
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <numeric>
#include <regex>
#include <tuple>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
#define MOD 1000000007 // 10^9 + 7
#define INF 1000000000 // 10^9
#define LLINF 1LL<<60


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

	string S; cin >> S;
	bool flag = true;
	int ans1 = -1, ans2 = -1;

	for (int i = 0; i < S.size() - 1 && flag; i++) {
		if (S[i] == S[i + 1]) {
			ans1 = i + 1;
			ans2 = i + 2;
			flag = false;
		}
	}

	for (int i = 0; i < S.size() - 2 && flag; i++) {
		if (S[i] == S[i + 2]) {
			ans1 = i + 1;
			ans2 = i + 3;
			flag = false;
		}
	}

	cout << ans1 << " " << ans2 << endl;

	return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
#define pb push_back
int dy[]={0, 0, 1, -1, 1, 1, -1, -1};
int dx[]={1, -1, 0, 0, 1, -1, -1, 1};

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define mp make_pair
#define fi first
#define sc second
ll m,n;
char a[100][100],b[100][100];
int main(){
	cin >> n >> m;

	REP(i,n) {
		cin >> a[i];
	}
	REP(i,m) {
		cin >> b[i];
	}


	REP(i,n - m + 1) {
		REP(j,n - m + 1) {
			bool flag = true;
			REP(k,m) {
				REP(l,m) {
					if(a[i + k][j + l] != b[k][l]) 
						flag = false;
				}
			}
			if(flag) {
				cout << "Yes" << endl;
				return 0;
			}
		}
	}
	cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 256
//
// 問題 - AtCoder Beginner Contest 109
// https://beta.atcoder.jp/contests/abc109/tasks
//

//
//
// https://beta.atcoder.jp/contests/abc109/tasks/abc109_d
//

// 2018-09-08(土) 21:00 ~ 22:40
// a b c d
// 100分 (1時間40分) 4問
// 25分/問

// debug pretty print
#[allow(unused_macros)]
macro_rules! p {
  () => {
    println!()};
  ($v0:expr) => {
    println!(concat!(stringify!($v0), " = {:#?}"), $v0)};
  ($($v0:expr),*) => {
    println!(concat!($(stringify!($v0), " = {:#?}, "),*), $($v0),*)};
}

use std::io::{ stdin, stdout, BufRead, Write };
use std::ops::{ Add, Sub, Mul };

const SP : u8 = b' ';
const LF : u8 = b'\n';

#[inline(always)]
fn atoui<T>(s: &[u8]) -> T
  where T: Add<Output=T> +
           Sub<Output=T> +
           Mul<Output=T> +
           Default +
           From<u8>
{
  let mut n = T::default();
  if s.len() == 0 {
    return n;
  }

  let mut i = 0;
  if s[i] == b'+' {
    i += 1;
  }

  for b in &s[i..] {
    n = (n * T::from(10)) + T::from(b - b'0');
  }

  n
}

fn main() {
  let stdin = stdin();
  let mut stdin = stdin.lock();

  let mut buf = Vec::with_capacity(500 * 2);
  let len = stdin.read_until(SP, &mut buf).unwrap();
  buf.truncate(len - 1);
  let h = atoui::<usize>(&buf);

  buf.clear();
  let len = stdin.read_until(LF, &mut buf).unwrap();
  buf.truncate(len - 1);
  let w = atoui::<usize>(&buf);

  let mut ans = Vec::with_capacity(8 * h * w - 1);
  let mut n   = 0;

  let mut odd = 0;
  let mut x   = 0;
  let mut y   = 0;

  for i in 0..h {
    buf.clear();
    stdin.read_until(LF, &mut buf).unwrap();

    if i % 2 == 0 {
      for j in 0..w {
        if odd != 0 {
          writeln!(&mut ans, "{} {} {} {}", y + 1, x + 1, i + 1, j + 1).unwrap();
          n += 1;
        }
        odd ^= buf[j * 2] & 1;
        y = i;
        x = j;
      }
    } else {
      for mut j in 0..w {
        j = w - 1 - j;

        if odd != 0 {
          writeln!(&mut ans, "{} {} {} {}", y + 1, x + 1, i + 1, j + 1).unwrap();
          n += 1;
        }
        odd ^= buf[j * 2] & 1;
        y = i;
        x = j;
      }
    }
  }

  let stdout = stdout();
  let mut stdout = stdout.lock();
  writeln!(&mut stdout, "{}", n).unwrap();
  stdout.write(&ans).unwrap();
  stdout.flush().unwrap();
}


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

int main(){
  int n;
  cin>>n;
  vector<int>a(n);
  rep(i,n)cin>>a[i];
  bool clear=true;
  
  rep(i,n){
    if(a[i]%2==0)
      if(a[i]%3!=0 and a[i]%5!=0)
        clear=false;
  }
  if(clear)cout<<"APPROVED"<<endl;
  else cout<<"DENIED"<<endl;
  
  return 0;
}

Measured memory_bytes: 3644
"use strict";

function main(input){
  const args = input.trim().split('\n');
  const n = parseInt(args[0],10);
  const arr = args[1].split(' ').map(_=>parseInt(_,10));
  arr.sort((a,b)=>b-a);
  
  let a = 0,
      b = 0;
  for(let i=0; i<n; i++){
    if(i%2==0) a+=arr[i]; else b += arr[i];
  }
  
  console.log(a - b);
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));  

Measured memory_bytes: 7500
#include <bits/stdc++.h>
#include<chrono>
using namespace std;
using ll = long long;

int main() {
  int N, M, X;
  cin >> N >> M >> X;
  set<int> A;
  for (int i = 0; i < M; i++) {
    int a;
    cin >> a;
    A.insert(a);
  }
  //XからN方面に行くコストcost_N
  int cost_N = 0;
  for (int i = X; i <= N; i++) {
    if (A.count(i)) {
      cost_N++;
    }
  }
  //Xから0方面に行くコストcost_0
  int cost_0 = 0;
  for (int i = 0; i <= X; i++) {
    if (A.count(i)) {
      cost_0++;
    }
  }
  
  cout << min(cost_N, cost_0) << endl;
}

  
  
  
  
 

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


#define mp make_pair
#define pb push_back
#define rep(i,port,sail) for(i=port;i<=sail;i++)
const int N = 100010;
int h[N],dp[N];
int main()
{
	int n,i,j,k,t;
	cin>>n;
	rep(i,1,n)cin>>h[i];
	dp[1]=0;
	dp[2]= abs(h[2]-h[1]);
	rep(i,3,n)dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]));
	cout<<dp[n]<<"\n";
	
	return 0;
}



Measured memory_bytes: 1024
while abcdef = STDIN.gets
  abcdef.chomp!
  a,b,c,d,e,f = abcdef.split(" ").map { |item| item.to_i }
  x = (c*e-b*f)/(a*e-d*b).to_f.round(3)
  y = (c*d-a*f)/(b*d-a*e).to_f.round(3)
  if x.zero? then x = 0 end
  if y.zero? then y = 0 end
  puts sprintf("%.3f %.3f", x, y)
end

Measured memory_bytes: 8760
import sys

def II(): return int(input())
def MI(): return map(int,input().split())
def LI(): return list(map(int,input().split()))
def TI(): return tuple(map(int,input().split()))
def RN(N): return [input().strip() for i in range(N)]


def main():
    a = II()



    
    print(a + pow(a,2) + pow(a,3))

if __name__ == "__main__":
	main()

Measured memory_bytes: 9168
N = int(input())
G = [[1 if s == '#' else 0 for s in input().strip()] for _ in range(N)]
Gm = list(map(sum, G))
GT = list(map(list, zip(*G)))
geta = sum(sum(g) == N for g in GT)
exist = [sum(g) > 0 for g in GT]
ans = -1
if sum(Gm) != 0:
    ans = N - geta + min(N - Gm[i] + 1 - exist[i] for i in range(N))
print(ans)

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

int main() {
  string s;
  cin >> s;
  int len=s.length()-2;
  while(len>1) {
    if(s.substr(0,len/2)==s.substr(len/2,len/2)) {
      cout << len << endl;
      return 0;
    }
       len-=2;
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <queue>
#include <functional>
#include <algorithm>
#include <vector>
using namespace std;
#pragma warning (disable: 4996)

long long N, M, A[100009], B[100009], C[100009], D[100009], LIM[400009];
vector<long long>vec; vector<pair<long long, long long>>I;
priority_queue<long long, vector<long long>, greater<long long>>Q;

int main() {
	cin >> N >> M;
	for (int i = 1; i <= N; i++) { scanf("%lld%lld", &A[i], &B[i]); vec.push_back(A[i]); }
	for (int i = 1; i <= M; i++) { scanf("%lld%lld", &C[i], &D[i]); vec.push_back(C[i]); }
	sort(vec.begin(), vec.end());
	vec.erase(unique(vec.begin(), vec.end()), vec.end());
	for (int i = 1; i <= N; i++) { A[i] = lower_bound(vec.begin(), vec.end(), A[i]) - vec.begin(); A[i]++; I.push_back(make_pair(A[i], B[i])); }
	for (int i = 1; i <= M; i++) { C[i] = lower_bound(vec.begin(), vec.end(), C[i]) - vec.begin(); C[i]++; }

	for (int i = 0; i <= 400000; i++) LIM[i] = (1LL << 30);
	for (int i = 1; i <= M; i++) { LIM[C[i]] = D[i] - 1; }
	for (int i = 1; i <= 400000; i++) LIM[i] = min(LIM[i], LIM[i - 1]);
	sort(I.begin(), I.end());
	reverse(I.begin(), I.end());

	for (int i = 0; i < I.size(); i++) {
		Q.push(I[i].second);
		while (((long long)Q.size() > LIM[I[i].first])) {
			Q.pop();
		}
	}
	long long sum = 0;
	while (!Q.empty()) { sum += Q.top(); Q.pop(); }
	cout << sum << endl;
	return 0;
}


Measured memory_bytes: 12344
#include <cstdio>
#include <vector>
#include <set>
#include <map>
using namespace std;
long long solve(const vector<pair<pair<int,int>,pair<int,int>>> &v){
	set<int>lx,ly;
	for(auto &e:v){
		lx.insert(e.first.first);lx.insert(e.second.first);
		ly.insert(e.first.second);ly.insert(e.second.second);
	}
	int i;
	map<int,int>mx,my,sx,sy;
	i=0;for(auto ix1=lx.begin(),ix2=lx.begin();++ix2!=lx.end();++ix1,++i){
		mx[*ix1]=i,sx[i]=*ix2-*ix1;
	}
	mx[*lx.rbegin()]=i,sx[i]=0;
	i=0;for(auto iy1=ly.begin(),iy2=ly.begin();++iy2!=ly.end();++iy1,++i){
		my[*iy1]=i,sy[i]=*iy2-*iy1;
	}
	my[*ly.rbegin()]=i,sy[i]=0;
	vector<vector<int>>m(my.size());
	for(auto &e:m)e.resize(mx.size());
#if 0
	for(auto &e:v){
		for(int y=my[e.first.second];y<my[e.second.second];y++)
			for(int x=mx[e.first.first];x<mx[e.second.first];x++)m[y][x]++;
	}
#else
	for(auto &e:v){
		m[my[e.first.second]][mx[e.first.first]]++;
		m[my[e.second.second]][mx[e.first.first]]--;
		m[my[e.first.second]][mx[e.second.first]]--;
		m[my[e.second.second]][mx[e.second.first]]++;
	}
	for(int y=0;y<sy.size();y++)for(int x=1;x<sx.size();x++)m[y][x]+=m[y][x-1];
	for(int y=1;y<sy.size();y++)for(int x=0;x<sx.size();x++)m[y][x]+=m[y-1][x];
#endif
	long long r=0;
	for(int y=0;y<sy.size();y++)for(int x=0;x<sx.size();x++)if(m[y][x])r+=(long long)sx[x]*sy[y];
	return r;
}
int main(){
	int N,x1,y1,x2,y2;
	vector<pair<pair<int,int>,pair<int,int>>>v;
	scanf("%d",&N);
	for(int i=0;i<N;i++){
		scanf("%d%d%d%d",&x1,&y1,&x2,&y2);
		v.push_back({{x1,y1},{x2,y2}});
	}
	printf("%lld\n",solve(v));
}

Measured memory_bytes: 66284
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, n) for(int i = 1; i < (int)(n); i++)
typedef long long ll;
#define NP next_permutation
#define MP make_pair

int dp[100];

//最大公約数
int gcd(int x, int y){
  if(x % y == 0) return y;
  return gcd(y, x % y);
}
//最小公倍数
int lcm(int x, int y){
  return x * y / gcd(x, y);
}
//フィボナッチ数列
//配列dpを-1で初期化する
int fib(int n){
  if(n == 0 || n == 1) return dp[n] = 1;
  if(dp[n] != -1) return dp[n];
  return dp[n] = fib(n - 1) + fib(n - 2);
}
//階乗計算(factorial)
int fact(int n){
  if(n = 1) return 1;
  return n * fact(n - 1);
}
//累乗計算(Exponentiation)
//x**y
ll expo(int x, int y){
  ll ans = 1;
  rep(i, y){
    ans *= x;
  }
  return ans;
}
//桁数
int keta(ll x){
  if(x == 0) return 1;
  int res = 0;
  while(x){
    x /= 10;
    res++;
  }
  return res;
}


int main(){
  string at;
  cin >> at;
  int ans = 0;
  int cnt = 0;
  rep(i, at.size()){
    if(at[i] == 'A' || at[i] == 'C' || at[i] == 'G' || at[i] == 'T') cnt++;
    else{
      ans = max(ans, cnt);
      cnt = 0;
    }
    ans = max(ans, cnt);
  }
  cout << ans << endl;
}




Measured memory_bytes: 256
#include<bits/stdc++.h>
#define F first
#define S second
using namespace std;
vector<int> v[100001];
int dp[100001];
int arr[100001];
int dfs(int s)
{       
    if((int)v[s].size()==0){return 0;}
    if(dp[s]!=-1)return dp[s];
    
   
    vector<int> rt;
    for(int i=0;i<v[s].size();i++)
    {
       rt.push_back(dfs(v[s][i]));
    }
    sort(rt.begin(),rt.end());
    int j=0;
    for(int i=(int)rt.size()-1,j=0;i>=0,j<rt.size();i--,j++)
    {   //cout<<dp[rt[i]]<<endl;
        dp[s]= max(dp[s], rt[i]+j+1);
    }
    
    return dp[s];
}
int main()
{
    int n;
    for(int i=0;i<=100000;i++)dp[i]=-1;
    cin>>n;
    int i;
    
    
    
    for(i=2;i<=n;i++)
    {
        cin>>arr[i];
        v[arr[i]].push_back(i);
    }
    
   
    
    dfs(1);
    int m=0;
    for(i=1;i<=n;i++)
    {
        m=max(m,dp[i]);
    }
    cout<<m<<endl;
    return 0;
}


Measured memory_bytes: 17408
headData = input().split()
candyTotal = int(headData[1])
childList = [ int(n) for n in input().split()]
childList.sort()
childTotal = sum(childList)

if candyTotal == childTotal:
    print(len(childList))
elif candyTotal > childTotal:
    print(len(childList)-1)
else:
    answer=0
    childSum=0
    for child in childList:
        childSum = childSum + child
        if childSum > candyTotal:
            print(answer)
            exit()
        else:
            answer = answer + 1
    print(answer-1)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using i64 = long long;

int main() {
    i64 n, k;
    std::cin >> n >> k;
    i64 z = 0;
    std::vector<i64> a, b;
    for (int i = 0; i < n; i++) {
        i64 in;
        std::cin >> in;
        if (in > 0) a.push_back(in);
        else if (in < 0) b.push_back(-in);
        else z++;
    }

    std::sort(a.begin(), a.end());
    std::sort(b.begin(), b.end());

    i64 pos = a.size(), neg = b.size();

    i64 l = std::numeric_limits<i64>::min() / 3, r = std::numeric_limits<i64>::max() / 3;
    while (r - l > 1) {
        const i64 mid = (l + r) / 2;
        i64 c = 0;

        if (mid > 0) {
            c = (pos + neg) * z + pos * neg + z * (z - 1) / 2;
            for (int i = 0; i < pos; i++) {
                int j = std::upper_bound(a.begin(), a.end(), mid / a[i]) - a.begin();
                c += std::max(0, j - i - 1);
            }
            for (int i = 0; i < neg; i++) {
                int j = std::upper_bound(b.begin(), b.end(), mid / b[i]) - b.begin();
                c += std::max(0, j - i - 1);
            }
        } else if (mid == 0) {
            c = (pos + neg) * z + pos * neg + z * (z - 1) / 2;
        } else {
            const i64 mm = -mid;
            for (int i = 0; i < pos; i++) {
                int j = b.end() - std::lower_bound(b.begin(), b.end(), (mm + a[i] - 1) / a[i]);
                c += j;
            }
        }

        if (c >= k) r = mid;
        else l = mid;
    }

    std::cout << r << std::endl;

    return 0;
}


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

using namespace std;

int main()
{
	int n, l, total = 0;
	cin >> n >> l;
	total = l * n + n * (n - 1)/2;
	if (l > 0)
		cout << total - l;
	else if (l + n - 1 < 0)
		cout << total - (l + n - 1);
	else
		cout << total;
}


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

using namespace std;

string s;

pair<bool ,long long> count_same_string(bool prev_last_changed) {
	long long count = 0;
	char prev;
	if (prev_last_changed) {
		prev = '!';
	} else {
		prev = s.at(s.length() - 1);
	}

	for (int i = 0; i < s.length() ; i++) {
		if (prev == s.at(i)) {
			count++;
			prev = '!';
		} else {
			prev = s.at(i);
		}
	}
	return make_pair(prev == '!' , count);
}

int main() {

	int k;
	cin >> s >> k;

	pair<bool ,long long > s_count = count_same_string(false);
	pair<bool ,long long > s_c_count = count_same_string(true);

	//cout << "false: last:" << s_count.first << " count:" << s_count.second << endl;
	//cout << "true: last:" << s_c_count.first << " count:" << s_c_count.second << endl;

	bool prev_change = true;
	long long  count = 0;
	for (int i = 0; i < k; i++) {
		pair<bool ,long long > cur = prev_change ? s_c_count : s_count;
		prev_change = cur.first;
		count += cur.second;
	}

	cout << count << endl;
	return 0;
}

Measured memory_bytes: 888
## coding: UTF-8
from fractions import gcd
s = input().split()
t = [int(p) for p in s]
#print(t)

A = t[0]
B = t[1]
C = t[2]

#print(A)
#print(B)
Gcd = gcd(A, B)
#print(Gcd)

#print(C)

if(C % Gcd == 0):
    print("YES")
else:
    print("NO")

Measured memory_bytes: 5048
#include <stdio.h>

int main(void) {
	int n, m;
	int s[5];
	int c[5];
	int num[3] = { 0 };
	int num_f[3] = { 0 };

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

	for (int i = 0; i < m; i++) {
		scanf("%d%d", &s[i], &c[i]);
		if (num_f[s[i] - 1 + (3 - n)] == 0) {
			num[s[i] - 1 + (3 - n)] = c[i];
			num_f[s[i] - 1 + (3 - n)] = 1;
		}
		else {
			if (num[s[i] - 1 + (3 - n)] != c[i]) {
				printf("-1\n");
				return 0;
			}
		}
	}

	if (n == 3) {
		if (num[0] == 0)
			if (num_f[0] == 1) {
				printf("-1\n");
				return 0;
			}
			else {
				num[0] = 1;
			}
	}

	if (n == 2) {
		if (num[1] == 0)
			if (num_f[1] == 1) {
				printf("-1\n");
				return 0;
			}
			else {
				num[1] = 1;
			}
	}

	printf("%d\n", num[0] *  100 + num[1] * 10 + num[2]);

	return 0;
}

Measured memory_bytes: 128
#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;

vector<ll> prime_factorize(ll N) {
    vector<ll> res;
    for (ll a = 2; a * a <= N; ++a) {
        if (N % a != 0) continue;
        ll ex = 0; // 指数

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

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

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

ll pairsCanMake(ll n){
    ll a = 1;
    for(a = 1; a * (a + 1) <= 2 * n; a++);
    return --a;
}

int main() {
    ll N, ans;
    cin >> N;
    vector<ll> primeCounts;
    primeCounts = prime_factorize(N);
    ans = 0;
    for(ll x: primeCounts){
        ans += pairsCanMake(x);
    }

    cout << ans << endl;

    
    return 0;
}


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

#define LL long long
#define RG register

using namespace std;
template<class T> T gi() {
	T x = 0; bool f = 0; char c = getchar();
	while (c != '-' && (c < '0' || c > '9')) c = getchar();
	if (c == '-') f = 1, c = getchar();
	while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
	return f ? -x : x;
}
const int N = 3010, Mod = 1e9 + 7;
int f[N][N << 1][2];
void pls(int &x, int y) { x += y; if (x >= Mod) x -= Mod; }
int main() {
	int n = gi<int>(), m = gi<int>();
	for (int i = 1; i <= n; i++) f[0][i][0] = 1;
	f[0][0][1] = 1;	
	for (int i = 0; i < m; i++)
		for (int j = 0; j <= n; j++) {
			if (j) {
				pls(f[i + 1][j][1], f[i][j][1]);
				pls(f[i + 1][j - 1][1], f[i][j][1]);
			}
			if (j < n) {
				pls(f[i + 1][j][1], f[i][j][1]);
				pls(f[i + 1][j + 1][1], f[i][j][1]);
				pls(f[i + 1][j][0], f[i][j][0]);
				pls(f[i + 1][j + 1][0], f[i][j][0]);
			}
			if (j) {
				pls(f[i + 1][j][j == 1], f[i][j][0]);
				pls(f[i + 1][j - 1][j == 1], f[i][j][0]);
			}
		}
	int ans = 0;
	for (int i = 0; i <= n; i++)
		pls(ans, f[m][i][1]);
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 140672
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	var n int
	fmt.Scan(&n)
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	as := make([]int, n)
	for i := range as {
		sc.Scan()
		as[i], _ = strconv.Atoi(sc.Text())
	}
	var s int
	m := 1000
	for i := range as {
		if i == n-1 {
			m += s * as[i]
			s = 0
		} else {
			if as[i+1] > as[i] {
				s += m / as[i]
				m %= as[i]
			} else {
				m += s * as[i]
				s = 0
			}
		}
	}
	fmt.Println(m)
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}


Measured memory_bytes: 1844
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower

using namespace std;

#define rep(i, a, b) for (int i = a; i < b; i++)
#define all(A) A.begin(), A.end()
typedef long long ll;
const ll mod = 1e9 + 7;
const ll inf = 1e18;

struct WarshallFloyd{
    ll n;
    vector<vector<ll> > d;
    WarshallFloyd(ll _n){
        n = _n;
        d.resize(n, vector<ll>(n));
        for(int i = 0; i < n; i++){
            for(int j = 0; j < n; j++){
                d[i][j] = inf;
            }
            d[i][i] = 0;
        }
    }
    void build(){
        for(int k = 0; k < n; k++){
            for(int i = 0; i < n; i++){
                for(int j = 0; j < n; j++){
                    d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
                }
            }
        }
    }
};

int main() {
    ll N, M, L;
    cin >> N >> M >> L;

    WarshallFloyd wf(N);

    rep(i, 0, M) {
        ll A, B, C;
        cin >> A >> B >> C;
        A -= 1;
        B -= 1;
        wf.d[A][B] = C;
        wf.d[B][A] = C;
    }

    wf.build();

    rep(i, 0, N) {
        rep(j, 0, N) {
            if (wf.d[i][j] <= L) {
                wf.d[i][j] = 1ll;
            }
            else {
                wf.d[i][j] = inf;
            }
        }
    }

    wf.build();
    
    ll Q;
    cin >> Q;
    rep(i, 0, Q) {
        ll s, t;
        cin >> s >> t;
        s -= 1;
        t -= 1;
        int ans;
        if (wf.d[s][t] == inf) {
            ans = -1;
        }
        else {
            ans = wf.d[s][t] - 1;
        }
        cout << ans << endl;
    }
}

Measured memory_bytes: 1280
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <cmath>
#include <algorithm>

typedef long long ll;
using namespace std;

int main() {
    int n;
    cin >> n;
    vector<int> a(n, 0);
    int el;
    for(int i = 0; i < n-1; ++i){
        cin >> el;
        ++a[el-1];
    }
    for(auto e : a){
        cout << e << endl;
    }
}




Measured memory_bytes: 3612
import scala.math.sqrt
object Main extends App {
  val in = new java.util.Scanner(System.in)
  val A, B, C = in.nextLong
  val b = (C - A - B) match {
    case n if n < 0 => false
    case n => 4 * A * B < n * n
  }
  println(if (b) "Yes" else "No")
}

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

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

typedef long long ll;
const ll MOD = 1e9 + 7;

int main() {
  int K, X, first, last;
  std::cin >> K >> X;
  first = std::max(-(int)1e6, X - K + 1);
  last = std::min((int)1e6, X + K - 1);
  for(int i = first; i <= last; ++i) {
    std::cout << i << ' ';
  } std::cout << '\n';
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
#define ll long long

int powmod(int a, int n) {
  int pm = 1;
  while (n > 0) {
    if (n & 1) pm = (ll)pm * a % MOD;
    a = (ll)a * a % MOD;
    n >>= 1;
  }
  return pm;
}


int main() {
  int n;
  scanf("%d", &n);

  int e10 = powmod(10, n), e9 = MOD - powmod(9, n), e8 = powmod(8, n);
  printf("%lld\n", ((ll)e10 + e9 * 2 + e8) % MOD);
  return 0;
}


Measured memory_bytes: 3812
import std.stdio, std.conv, std.array, std.string, std.algorithm, std.container, std.range, core.stdc.stdlib, std.math, std.typecons;
T[][] combinations(T)(T[] s, in int m) {   if (!m) return [[]];   if (s.empty) return [];   return s[1 .. $].combinations(m - 1).map!(x => s[0] ~ x).array ~ s[1 .. $].combinations(m); }

void main() {
  int N, M; readf("%d %d\n", &N, &M);
  writeln(N % M == 0 ? N / M : N / M + 1);
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		string[]str = Console.ReadLine().Split();
		int H = int.Parse(str[0]);
		int W = int.Parse(str[1]);
		int N = int.Parse(str[2]);
		string[]str2 = Console.ReadLine().Split();
		int R = int.Parse(str2[0]);
		int C = int.Parse(str2[1]);
		string str3 = Console.ReadLine();
		string str4 = Console.ReadLine();
		int L1 = 0;
		int R1 = W-1;
		int U1 = 0;
		int D1 = H-1;
		for(var i=N-1;i>=0;i--){
			string s1 = str3.Substring(i,1);
			string s2 = str4.Substring(i,1);
			if(s2=="L"){
				R1 = Math.Min(R1+1,W-1);
			} else if(s2=="R"){
				L1 = Math.Max(L1-1,0);
			}
			if(s2=="U"){
				D1 = Math.Min(D1+1,H-1);
			} else if(s2=="D"){
				U1 = Math.Max(U1-1,0);
			}
			//Console.WriteLine(L1+" "+R1+" "+U1+" "+D1);
			if(s1=="L"){
				L1++;
			} else if(s1=="R"){
				R1--;
			}
			if(L1>R1){
				break;
			}
			if(s1=="U"){
				U1++;
			} else if(s1=="D"){
				D1--;
			}
			if(U1>D1){
				break;
			}
			//Console.WriteLine(L1+" "+R1+" "+U1+" "+D1);
		}
		string ans = "NO";
		if(L1 <= C-1 && R1 >= C-1 && U1 <= R-1 && D1 >= R-1){
			ans = "YES";
		}
		Console.WriteLine(ans);
	}
}

Measured memory_bytes: 17888
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0; i<(int)n; i++)
#define REPR(i, n) for(int i=(int)n-1; i>=0; i--)
#define FOR(i, m, n) for(int i=(int)m; i<(int)n; i++)
#define FORR(i, m, n) for(int i=(int)m-1; i>=(int)n; i--)
#define ALL(x) (x).begin(), (x).end()
#define ASC(v) sort(ALL(v));
#define DESC(v) sort(ALL(v), greater<int>());
#define UNIQ(a) sort(ALL(a));(a).resize(unique(ALL(a)) - a.begin());
#define PRINTD(x, d) cout << fixed << setprecision(d) << x << "\n";
#define DEBUG(x) cout<<#x<<": "<<x<<"\n"
typedef long long ll;
const double PI = acos(-1);
ll lcm(ll a, ll b) { return a / __gcd(a, b) * b; }
bool isprime(int x){ int i; if(x<2)return 0; else if(x==2) return 1; if(x%2==0) return 0; for(i=3; i*i<=x; i+=2) if(x%i==0) return 0; return 1; }
int digsum(int n) { int r=0; while(n>0) { r+=n%10; n/=10; } return r; }
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 (a>b) { a = b; return 1; } return 0; }


const string YES = "Yes";
const string NO = "No";

void solve(std::string S){
	if (S[2] == S[3] && S[4]==S[5]) cout << YES << "\n";
	else cout << NO << "\n";
}

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


Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int K,P,N,i,j,KP;
	scanf("%d",&N);
	for(i=1;i<=N;i++){
		scanf("%d %d",&K,&P);
		if(K%P==0){
			printf("%d\n",P);
		}
		else{
			KP=K%P;
			printf("%d\n",KP);
		}
	}
	return 0;
}
		

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cstdint>
#include <map>

using namespace std;

int main()
{
    int n, t;
    cin >> n >> t;
    map<int,int> route;
    for(int i = 0; i < n; ++i)
    {
        int ci,ti;
        cin >> ci >> ti;
        if(ti <= t)
            route[ci] = ti;
    }
    if(!route.empty())
    {
        cout << route.begin()->first << '\n';
    }
    else
    {
        cout << "TLE\n";
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, s, e) for(int i = s; i < e; i++)
#define rrep(i, s, e) for(int i = s; i > (s)-(e); i--)
#define pr(s) std::cout << s << std::endl
#define prb(s) std::cout << s
using namespace std;



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


  int r, g;
  cin >> r >> g;

  pr(r + (g-r)*2);


  return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define INF (1<<30)
using namespace std;
int main() {
	cin.tie(0); ios::sync_with_stdio(false);
	int n;
	while (cin >> n, n) {
		vector<int> a(n);
		for (int i = 0; i < n;i++) cin >> a[i];
		int Ans = INF;
		for (int i = 0; i < n;i++) {
			for (int j = i + 1; j < n; j++) {
				Ans = min(Ans, abs(a[i] - a[j]));
			}
		}
		cout << Ans << endl;
	}
}

Measured memory_bytes: 3140
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
*/

int main(){
    ll x, y; cin >> x >> y;

    if(x == y) cout << 0 << endl;
    else if(0<=x && x<=y) cout << y-x << endl;
    else if(x<=0 && 0<=y) cout << ((-x<=y)? min(1+y+x, y-x):min(y-x, 1-y-x)) << endl;
    else if(x<=y && y<=0) cout << y-x << endl;
    else if(0<=y && y<=x) cout << min(1+y+x, 2+x-y) << endl;
    else if(y<=0 && 0<=x) cout << ((y<=-x)? 1-x-y:1+x+y) << endl;
    else cout << min(2+x-y, 1-y-x) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define pr pair<ll, ll>
#define vct vector<ll>
#define vpt vector<pr>
#define st set<ll>
#define pq priority_queue<ll>
#define mat vector<vector<ll> >
#define F(i, n) for (i = 0; i < (1LL*n); i++)
#define Fr(i, n) for (i = n - 1; i >= 0; i--)
struct custom_hash
{
    static uint64_t splitmix64(uint64_t x)
    {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
    size_t operator()(uint64_t x) const
    {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
#define umap unordered_map<long long, int, custom_hash>
void prv(vct v)
{
    for (ll i = 0; i < v.size(); i++)
        cout << v[i] << " ";
    cout << "\n";
}
ll poww(ll x, ll y, ll m)
{
    ll res = 1;
    while (y)
    {
        if (y % 2 == 0)
        {
            x = (x * x) % m;
            y = y / 2;
        }
        else
        {
            res = (res * x) % m;
            y--;
        }
    }
    return res;
}
void deb(string s, ll n)
{
    cout << s << " : " << n << "\n";
}
void prn(ll n) { cout << n << "\n"; }
void prs(string n) { cout << n << "\n"; }

mat mt;
void setmtsize(ll m,ll n, ll ini=0){
    mt.resize(m,vector<ll>(n,ini));
}
void prmt(mat m){
    for(ll i=0;i<(1LL*m.size());i++)prv(m[i]);
}

ll n, k, m, l, r, x, y, ans=0;
ll t, t1, t2;

ll i, j;
ll a, b;
ll mod = 1000000007;


void solve()
{
    cin>>n;
    vct v(n+1,0);
    set<vct> s[n+1];
    ll sq=sqrt(n);
    for(i=1;i<=sq;i++){
        for(j=1;j<=sq;j++){
            for(k=1;k<=sq;k++){
                ll su=i*i+j*j+k*k+i*k+i*j+j*k;
                if(su<=n){
                    vct tp;tp.pb(i);tp.pb(j);tp.pb(k);
                    s[su].insert(tp);
                }
            }
        }
    }
    for(i=1;i<=n;i++)prn(s[i].size());
}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    ll t = 1;
    // cin >> t;
    while (t--)
        solve();
    return 0;
}

Measured memory_bytes: 27640
n=gets.chomp.to_i
a=gets.chomp.split(" ").insert(0,0).insert(n+1,0).map { |e| e.to_i }

def abs(n)

  if n>=0
    return n
  else
    return -n
  end

end


sum = 0
distance = 0

(n+1).times do |i|
  distance += abs(a[i]-a[i+1])
end

1.upto(n) do |i|
  puts (distance - abs(a[i-1]-a[i]) - abs(a[i]-a[i+1]) + abs(a[i-1]-a[i+1]))
end


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

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

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

const int N = 2 * 1000 * 100 + 10;
int n, K, L, col[2][N], cnt[2], ans[N];
vector<int> adj[2][N];
bool vis[2][N];
map<pair<int, int>, int> res;
	

void dfs(int root, bool tp) {
	if (tp) {
		res[make_pair(cnt[tp], col[0][root])]++;
		res[make_pair(col[0][root], cnt[tp])]++;
	}
	vis[tp][root] = true;
	col[tp][root] = cnt[tp];
	for (auto u: adj[tp][root])
		if (!vis[tp][u])
			dfs(u, tp);
}

int main() { 
	ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	cin >> n >> K >> L;
	for (int i = 1, v, u; i <= K; i++) {
		cin >> v >> u;
		adj[0][v].push_back(u);
		adj[0][u].push_back(v);
	}
	for (int i = 1, v, u; i <= L; i++) {
		cin >> v >> u;
		adj[1][v].push_back(u);
		adj[1][u].push_back(v);
	}
	for (int i = 1; i <= n; i++)
		ans[i] = 1;
	for (int i = 1; i <= n; i++)
		if (!vis[0][i]) {
			cnt[0]++; 
			dfs(i, 0);
		}
	cnt[1] = cnt[0];
	for (int i = 1; i <= n; i++)
		if (!vis[1][i]) {
			cnt[1]++;
			dfs(i, 1);
		}
	/*for (int i = 1; i <= n; i++)
		cout << col[1][i] << ' ';
	cout << endl;
	for (int i = 1; i <= n; i++)
		cout << col[0][i] << ' ';
	cout << endl; */
	for (int i = 1; i <= n; i++)
		cout << res[make_pair(col[0][i], col[1][i])] << ' ';
	cout << endl;
	return 0;
}


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

using namespace std;

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,n) for(int i=1;i<=(int)(n);i++)
#define rep3(i,n) for(int i=0;i<=(int)(n);i++)
#define REP(i,m,n) for(int i=m;i<(int)(n);i++)
#define INF 1e9  //
#define INFLL 4e18  //
#define MOD (1e9)+7
#define MP make_pair

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

// a 0x61  z 0x7a  0 0x30

//------------------------------------------------------

pll two_cut(ll x, ll y) { //横に切る
    if (y % 2 == 0) {
        return (MP(y / 2 * x, y / 2 * x));
    } else {
        return (MP((y / 2 + 1) * x, y / 2 * x));
    }
}

int main() {
    ll H, W;
    cin >> H >> W;

    ll s, smm;
    ll sout = INFLL;

    rep2(i, H - 1) {
        s = i * W;
        pll p = two_cut(W, H - i);
        smm = max({s, p.first, p.second}) - min({s, p.first, p.second});
        sout = min(sout, smm);
    }

    rep2(i, W - 1) {
        s = H * i;
        pll p = two_cut(W - i, H);
        smm = max({s, p.first, p.second}) - min({s, p.first, p.second});
        sout = min(sout, smm);
    }

    swap(H, W);

    rep2(i, H - 1) {
        s = i * W;
        pll p = two_cut(W, H - i);
        smm = max({s, p.first, p.second}) - min({s, p.first, p.second});
        sout = min(sout, smm);
    }

    rep2(i, W - 1) {
        s = H * i;
        pll p = two_cut(W - i, H);
        smm = max({s, p.first, p.second}) - min({s, p.first, p.second});
        sout = min(sout, smm);
    }

    cout << sout << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
/* typedef */
typedef long long ll;
typedef pair<int, int> pii;
/* constant */
const int INF = 1 << 30;
const ll LINF = 1LL << 50;
const int NIL = -1;
const int MAX = 10000;
const int mod = 1000000007;
const double pi = 3.141592653589;
/* global variables */
/* function */
/* main */
int main(){
    int D, T, S;
    cin >> D >> T >> S;
    if (S * T >= D) cout << "Yes" << '\n';
    else cout << "No" << '\n';
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
#define pb push_back
#define fr(i,n) for(int i=0;i<n;i++)
#define Fr(i,n) for(int i=0;i++<n;)
#define ifr(i,n) for(int i=n-1;i>=0;i--)
#define iFr(i,n) for(int i=n;i>0;i--)

int main(){
  int a[4],n=0;
  char c,p[2]={'-','+'};
  for(;cin>>c;) a[n++]=c-'0';
  fr(i,2){
    fr(j,2){
      fr(k,2){
        if(a[0]+(2*i-1)*a[1]+(2*j-1)*a[2]+(2*k-1)*a[3]==7){
          cout<<a[0]<<p[i]<<a[1]<<p[j]<<a[2]<<p[k]<<a[3]<<"=7"<<endl;
          return 0;
        }
      }
    }
  }
}

Measured memory_bytes: 256
/*
      author  : nishi5451
      created : 15.08.2020 11:08:39
*/

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
typedef long long ll;


int main(){
    int n,d;
    cin >> n >> d;
    vector<vector<int>> x(n,vector<int>(d));
    rep(i,n){
        rep(j,d){
            cin >> x[i][j];
        }
    } 
    int ans = 0;
    for(int i=0; i<n; i++){
        for(int j=i+1; j<n; j++){
            double dist = 0.0;
            for(int k=0; k<d; k++){
                dist += (x[i][k]-x[j][k])*(x[i][k]-x[j][k]);
            }
            dist = sqrt(dist);
            if((dist-(int)dist) < 0.00001){
                ans++;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3732
#include <iostream>

using namespace std;

int main() {
    int n; string s;
    cin >> n >> s;
    int red = 0, green = 0, blue = 0;
    long long triples = 0;
    for (int k = 0; k < n; ++k) {
        if (s[k] == 'R') triples += green * blue, ++red;
        else if (s[k] == 'G') triples += red * blue, ++green;
        else triples += red * green, ++blue;

        for (int gap = 1; k - 2*gap >= 0; ++gap) {
            int i = k - 2*gap, j = k - gap;
            if (s[i] != s[j] && s[i] != s[k] && s[j] != s[k]) --triples;
        }
    }
    cout << triples << endl;
    return 0;
}


Measured memory_bytes: 3576
#include <bits/stdc++.h>
const int INF =1e9+5;
using  namespace std;
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n;cin>>n;
    vector<int> c(n);
    for(int& x:c)
        cin>>x;
    vector<int> dp(n,INF);
    dp[0]=0;
    for(int i=0;i<n;i++){
        for(int j : {i+1,i+2}){
            if(j<n)
                dp[j]=min(dp[j],dp[i]+abs(c[i]-c[j]));
        }
    }    
    cout<<dp[n-1];
}

Measured memory_bytes: 1024
S = input()

cnt = 0
for i in range(1 << (len(S) - 1)):
    t = i
    l = 0
    r = 1
    while t > 0:
        if t % 2 == 1:
            cnt += int(S[l:r])
            l = r
            r += 1
        else:
            r += 1
        t >>= 1
    cnt += int(S[l:])

print(cnt)


Measured memory_bytes: 39152
#include <iostream>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <math.h>
#include <vector>
#include <algorithm>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

int main(){
	string n;
	cin >> n;
	int min=1000;
	for(int i=0; i+3<=n.length(); i++){
		int a=stoi(n.substr(i,3));
		if(min>abs(a-753)) min=abs(a-753);
	}
	cout << min << endl;
	return 0;
}

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

int main(void){
    int n;
    cin >> n;
    string ans;

    while(n != 0){
        int r = n%(-2);
        if(r == -1){
            r += 2;
        }
        ans = to_string(r) + ans;
        n = (n-r)/(-2);
    }
    if(ans == ""){
        ans = "0";
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define RREP(i,m,n) for(int i=int(n)-1;i>=int(m);--i)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long int;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;

//struct edge {int from, to, cost;};

constexpr double EPS = 1e-10;
//constexpr double PI  = acos(-1.0);
//constexpr int INF = INT_MAX;
constexpr int MOD = 1'000'000'007;
//inline void modAdd(LL &l, LL &r) {l = (l + r) % MOD;}

template<class T> inline T sqr(T x) {return x*x;}

void solve() {
    int n;
    cin >> n;
    vector<pair<LL,LL>> r(n);
    REP(i,0,n) cin >> r[i].first >> r[i].second;
    sort(all(r), [](auto &l, auto &r) {
        return atan2(l.second, l.first) < atan2(r.second, r.first);
    });
    vector<pair<LL,LL>> ru(n+1);
    REP(i,0,n) {
        ru[i+1].first += ru[i].first + r[i].first;
        ru[i+1].second += ru[i].second + r[i].second;
    }
    double ans = 0;
    REP(i,0,n) REP(j,0,n) {
        LL sx,sy;
        if (i <= j) {
            sx = ru[j+1].first - ru[i].first;
            sy = ru[j+1].second - ru[i].second;
        } else {
            sx = ru[n].first - ru[i].first + ru[j+1].first;
            sy = ru[n].second - ru[i].second + ru[j+1].second;
        }

        ans = max(ans, sqrt(sx * sx + sy * sy));
    }
    printf("%.10lf\n", ans);
}

int main() {
    solve();
    
    return 0;
}

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

using namespace std;
using ll = long long;
constexpr int mod = 1e9+7;
constexpr int md = mod;
int main(){
    ll n;
    cin>>n;
    vector<pair<ll,ll>> susi(n);
    ll sum = 0;
    for(auto & a : susi) cin>>a.first >> a.second,a.first +=a.second,sum-=a.second;
    sort(susi.rbegin(),susi.rend());
    for(ll i=0;i<n;i+=2){
        if(i%2==0)sum += susi[i].first;
    }
    cout << sum << endl;
    return 0;
}



Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define endl "\n"
#define all(v) v.begin(),v.end()
#define mp make_pair
#define mm(a) memset(a,true,sizeof(a))
#define rep(i,a,b) for(ll i = a; i < b; i++)
#define repn(i,a,b) for(ll i = a; i >= b; i--)
#define pb push_back
#define ff first
#define ss second
#define fto(k,m) for(auto k:m)
#define in_edges(m) repp(i, 1, m){ ll a, b; cin >> a >> b; adj[a].pb(b), adj[b].pb(a);}
#define debug(this) cerr<<"> "<<#this<<" : "<<this<<"\n"
#define MOD 1000000000000000007
#define pii 3.14159265358979323846
// int/float to string = to_string(12.90);
vector<ll> v;
void sieve(ll l,ll n)
{
	bool prime[n+1];
	mm(prime);
	prime[1] = false;
	for( ll i=2;i*i <= n; i++)
	{
		if(prime[i] == true)
		{
			for(ll k = i*i;k<=n;k+=i)
			{
				prime[k] = false;
			}
		}
	}
	for(ll i=l;i<=n;i++)
	{
		if(prime[i])
		v.pb(i);
	}
}

int main()
{
	    // freopen("in.txt","r",stdin);
	    // freopen("out","w",stdout);
		ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	    ll t;t=1;
	    // cin >> t;
	    while(t--)
	    {
			string s; cin >>s;
			if(s=="ABC")cout <<"ARC";
			else if(s=="ARC")cout<<"ABC";
		}
}


Measured memory_bytes: 3656