akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
 
#ifndef LOCAL_
#define fprintf if( false ) fprintf
#endif // LOCAL_
#define dumpl(x1) fprintf(stderr, "#%s.%d (%s) = (%ld)\n", __func__, __LINE__, #x1, x1);
#define dumpll(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%ld, %ld)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define dumplll(x1, x2, x3) fprintf(stderr, "#%s.%d (%s, %s, %s) = (%ld, %ld, %ld)\n", __func__, __LINE__, #x1, #x2, #x3, x1, x2, x3);
#define dumpd(x1) fprintf(stderr, "#%s.%d (%s) = (%lf)\n", __func__, __LINE__, #x1, x1);
#define dumpdd(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%lf, %lf)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define loop for(;;)
 
struct S002 {
  int n;
  S002& operator > (long& x) {
    n = x;
    return *this;
  }
  S002& operator > (long&& x) {
    n = x;
    return *this;
  }
  S002& operator >= (long& x) {
    if( scanf("%ld", &x) <= 0 ) exit(0);
    return *this;
  }
  S002& operator >= (double& x) {
    if( scanf("%lf", &x) <= 0 ) exit(0);
    return *this;
  }
  S002& operator >= (std::string& s) {
    if( not (std::cin >> s) ) exit(0);
    return *this;
  }
  template<typename a>
  S002& operator >= (std::vector<a>& v) {
    v.resize(n);
    for(long i = 0; i < n; ++i) {
      *this >= v[i];
    }
    return *this;
  }
  template<typename a, std::size_t s>
  S002& operator >= (std::array<a, s>& x) {
    for(long i = 0; i < (long)s; ++i) {
      *this >= x[i];
    }
    return *this;
  }
};

struct Solver {
  long n;
  std::vector<long> xs;
  Solver() {
    S002 reader;
    reader >= n >n>= xs;
  }
  void solve() {
    std::vector<long> ys;
    ys.push_back(0);
    for(long i = 0; i < n; ++i) ys.push_back(xs[i]);
    long res = 0;
    for(long i = 1; i <= n; ++i) {
      if( ys[ys[i]] == i and i != ys[i] ) res += 1;
    }
    printf("%ld\n", res / 2);
  }
};

int main() {
  loop std::unique_ptr<Solver>(new Solver())->solve();
  return 0;
}

Measured memory_bytes: 2168
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        s: String,
    }
    let week = ["SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"];
    let index: usize = (0..7).find(|&i| week[i as usize].to_string() == s).unwrap();
    println!("{}", 7 - index);
}


Measured memory_bytes: 2064
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#define IO(i, o) freopen(i, "r", stdin), freopen(o, "w", stdout)

using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
mt19937 rng((uint32_t)chrono::steady_clock::now().time_since_epoch().count());

int n, k;

int main(){
	//IO("input.txt", "output.txt");
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin >> n >> k;
	if(n % k == 0) cout << "0\n";
	else cout << "1\n";
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include <stdio.h>
#include<string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <cstdint>
#include <queue> 
#include <map>
#include <set>
#define MOD 1000000007
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n)  FOR(i,0,n)
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
typedef long long ll;
using namespace std;

int main(){

  int n,k;
  cin >> n >> k;

  int   s[4010][4010] = {};
  
  REP(i,n){
    int X,Y; char c;
    cin >> X >> Y >> c;
    if(c == 'W')  X += k;
    s[X%(2*k)+1][Y%(2*k)+1]++;
    s[X%(2*k)+2*k+1][Y%(2*k)+1]++;
    s[X%(2*k)+1][Y%(2*k)+2*k+1]++;
    s[X%(2*k)+2*k+1][Y%(2*k)+2*k+1]++;
      }
  
  REP(i,4*k+1){
    REP(j,4*k){
      s[i][j+1] += s[i][j];
    }
  }
  
  REP(j,4*k+1){
    REP(i,4*k){
      s[i+1][j] += s[i][j];
    }
  }
  
  int ans = 0;
  REP(i,2*k){
    REP(j,2*k){
      int sum = 0;
      sum += s[k+i][k+j]-s[k+i][+j]-s[+i][k+j]+s[+i][+j];
      sum += s[2*k+i][2*k+j]-s[2*k+i][k+j]-s[k+i][2*k+j]+s[k+i][k+j];
      ans = max(ans,sum);
      //cout << i << " "<< j; dump(sum);
    }
  }
  
/*    REP(i,4*k+1){
    REP(j,4*k+1){
      cout << s[i][j];
    }
      cout <<endl;
  }
  */
  cout << ans << endl;

 return 0;
}

Measured memory_bytes: 63104
#include<bits/stdc++.h>
using namespace std;
int dp[1000000]={0};
int h[1000005];


int main()
{
    int n;
    cin>>n;
    for(int i=0;i<n;i++)
        cin>>h[i];

    dp[1]=abs(h[0]-h[1]);
    for(int i=2;i<n;i++)
        dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]) , dp[i-2]+abs(h[i]-h[i-2]));
    cout<<dp[n-1];

}


Measured memory_bytes: 4736
#pragma GCC optimize (3)
#include<vector>
#include<stack>
#include<bitset>
#include<cstdlib>
#include<cmath>
#include<set>
#include<list>
#include<deque>
#include<map>
#include<queue>
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#define PII pair<int,int>
#define ll long long
#define ull unsigned long long
#define INFI 2147483647
#define INFL 9223372036854775807
#define INFU 18446744073709551615
using namespace std;
const double PI = acos(-1.0);
const double eps = 1e-6;
inline int read()
{
	int x = 0, f = 1;
	char ch = getchar();
	while (ch<'0' || ch>'9') {
		if (ch == '-') f = -1;
		ch = getchar();
	}
	while (ch >= '0' && ch <= '9') {
		x = x * 10 + ch - '0';
		ch = getchar();
	}
	return x * f;
}
int main()
{
	//ios_base::sync_with_stdio(false);
	//cin.tie(0);
	//cout.tie(0);
	ll n;
	while (scanf("%lld", &n) == 1) {
		printf("%lld\n", n * (n - 1) / 2);
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
int main(void){
    long long N,i,l;
    cin>>N;
    long long L[N];
    for(i=0;i<N;i++){
        cin>>L[i];
    }
    sort(L,L+N);
    l=0;
    for(i=0;i<N-1;i++){
        l+=L[i];
    }
    if(L[N-1]<l){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
}


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

using namespace std;
typedef long long ll;

int main() {
    ll n;
    cin >> n;
    vector<ll> nums(3 * n);
    for (int i = 0; i < 3 * n; ++i) {
        cin >> nums[i];
    }
    sort(nums.begin(), nums.end(), greater<int>());
    ll ans = 0;
    ll cnt = 0;
    for (int i = 1; ; i += 2) {
        ans += nums[i];
        ++cnt;
        if (cnt == n) break;
    }
    cout << ans << endl;
    return 0;
}

static int speedUp = []() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    return 0;
}();

Measured memory_bytes: 2560
use std::io::Read;
use std::collections::HashMap;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();

    let answer = solve(&buf);

    println!("{}", answer);
}

fn solve(input: &str) -> String {
    let mut iterator = input.split_whitespace();

    let n: usize = iterator.next().unwrap().parse().unwrap();

    let mut f: Vec<usize> = vec![0; n + 1];
    for i in 1..=n {
        let mut j = i;
        while j <= n {
            f[j] += 1;
            j += i;
        }
    }
    let mut ans: usize = 0;
    for i in 1..=n {
        ans += i * f[i];
    }
    return ans.to_string();
}

Measured memory_bytes: 80152
# -*- coding: utf-8 -*-

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N, M = MAP()

# (鍵の購入コスト, 開けられる宝箱)
keys = [None] * M
for i in range(M):
    c, _ = MAP()
    # どの宝箱を開けられるのかをbitで持っておく
    s = 0
    for a in [a-1 for a in LIST()]:
        s += 1 << a
    keys[i] = (c, s)

# dp[i][j] := i個目の鍵まで見て、集合jの宝箱を開けるための最小コスト
dp = list2d(2, 1<<N, INF)
dp[0][0] = 0
cur = 0
nxt = 1
for i in range(M):
    # 今回の鍵で開けられる宝箱の集合s
    s = keys[i][1]
    c = keys[i][0]
    for j in range(1<<N):
        # 今回の鍵を買わない遷移
        dp[nxt][j] = min(dp[nxt][j], dp[cur][j])
        if dp[cur][j] != INF:
            m = j | s
            # 買う遷移：遷移元の開けられる宝箱の集合j | 今回の鍵で開けられる宝箱の集合s
            dp[nxt][m] = min(dp[nxt][m], dp[cur][j]+c)
    cur, nxt = nxt, cur
ans = dp[M%2][-1]

if ans != INF:
    print(ans)
else:
    print(-1)


Measured memory_bytes: 49500
if __name__ == "__main__":
    while True:
        nums = map( int, raw_input().split())
        H = nums[0]
        W = nums[1]
        if H == 0:
            if W == 0:
                break

        s = ""
        j = 0
        while j < W:
            s += "#"
            j += 1

        i = 0
        while i < H:
            print s
            i += 1
        print

Measured memory_bytes: 4212
#include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
typedef long long ll;
using namespace std;
int static fast = [](){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0); return 0;
}();

int main() {
    int n, k;
    // a = r mod(K)
    // b = K-r mod(K)
    // c = r mod(K)
    // => a+c = 2r = 0 mod(K)
    cin >> n >> k;
    ll ans = 0;
    if (k % 2 == 0) {
        ll cnt = 0;
        for(int i = 1; i <= n; i++) {
            if (i % k == (k/2))
                cnt += 1;
        }
        ans += cnt*cnt*cnt;
    }
    ll cnt = 0;
    for(int i = 1; i <= n; i++) {
        if (i % k == 0)
            cnt += 1;
    }
    ans += cnt*cnt*cnt;
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
using ll = long long; 
using ld = long double;
#define endl "\n"
//#define int long long
#define all(V) V.begin(),V.end()
#define rep(i, n) for (int i = 0; i < n; i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
const int MOD = 1e9 + 7;
const ll INF = 1LL << 60;
const int inf = 1 << 25;
constexpr long double pi = 3.141592653589793238462643383279;
int dx[] = { 1,0,-1,0 };
int dy[] = { 0,1,0,-1 };
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
ll fact_mod(ll n, ll mod) {
    ll f = 1; for (int i = 2; i <= n; i++) f = f * (i % mod) % mod;
    return f;
}
ll gcd(ll a, ll b) {
    if (b == 0) return a;
    return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
    return a * b / gcd(a, b);
}
ll keta(ll n) {
    if (n == 0) return 1;
    ll count = 0;
    while (n != 0) {
        n /= 10;
        count++;
    }
    return count;
}
ll ketasum(ll n) {
    ll sum = 0;
    while (n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
ll mch(ll n) {
    if (n == 1) return 1;
    else return n * mch(n - 1);
}
ll pow_mod(ll x, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = (res * x) % mod; //ビット演算(最下位ビットが1のとき)
        x = (x * x) % mod;
        n >>= 1; //右シフト(n = n >> 1)
    }
    return res;
}
ll inv_mod(ll a, ll mod) { //逆元
    ll b = mod, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= mod;
    if (u < 0) u += mod;
    return u;
}
bool is_prime(const unsigned n) {
    switch (n) {
    case 0: // fall-through
    case 1: return false;
    case 2: // fall-through
    case 3: return true;
    } // n > 3 が保証された
    if (n % 2 == 0 || n % 3 == 0) return false;
    for (unsigned i = 5; i * i <= n; i += 6) {
        if (n % i == 0) return false; // (6の倍数)-1
        if (n % (i + 2) == 0) return false; // (6の倍数)+1
    }
    return true;
}

//宣言とか
ll n, k;
ll dp[100010];
/*signed*/int main(void) {
    cin >> n >> k;
    vector<ll> h(n);
    rep(i, n) cin >> h[i];
    fill(dp, dp + n, INF);
    dp[0] = 0;
    rep(i, n) {
        for (ll j = 1; j <= k; ++j) {
            if (n <= i + j) break;
            chmin(dp[i + j], dp[i] + abs(h[i] - h[i + j]));
        }
    }
    cout << dp[n - 1] << endl;
    return 0;
}

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

template<typename FI>
void parted_rotate(FI first1, FI last1, FI first2, FI last2)
{
 if(first1 == last1 || first2 == last2) return;
 FI next = first2;
 while (first1 != next) {
  std::iter_swap(first1++, next++);
  if(first1 == last1) first1 = first2;
  if (next == last2) {
   next = first2;
  } else if (first1 == first2) {
   first2 = next;
  }
 }
}
 
template<typename BI>
bool next_combination_imp(BI first1, BI last1, BI first2, BI last2)
{
 if(first1 == last1 || first2 == last2) return false;
 auto target = last1; --target;
 auto last_elem = last2; --last_elem;
 // find right-most incrementable element: target
 while(target != first1 && !(*target < *last_elem)) --target;
 if(target == first1 && !(*target < *last_elem)) {
  parted_rotate(first1, last1, first2, last2);
  return false;
 }
 // find the next value to be incremented: *next
 auto next = first2;
 while(!(*target < *next)) ++next;
 std::iter_swap(target++, next++);
 parted_rotate(target, last1, next, last2);
 return true;
}
 
// INVARIANT: is_sorted(first, mid) && is_sorted(mid, last)
template<typename BI>
inline bool next_combination(BI first, BI mid, BI last)
{
 return next_combination_imp(first, mid, mid, last);
}
 
// INVARIANT: is_sorted(first, mid) && is_sorted(mid, last)
template<typename BI>
inline bool prev_combination(BI first, BI mid, BI last)
{
 return next_combination_imp(mid, last, first, mid);
}

int main(void) {
  int N, C;
  cin >> N >> C;
  vector<vector<int>> D(C, vector<int>(C));
  vector<vector<int>> c(N, vector<int>(N));

  for (int i = 0; i < C; i++) {
    for (int j = 0; j < C; j++) {
      cin >> D[i][j];
    }
  }
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N; j++) {
      cin >> c[i][j];
      c[i][j]--;
    }
  }

  int cost[3][31];
  memset(cost, 0, sizeof(cost));
  for (int k = 0; k < C; k++) {
    for (int i = 0; i < N; i++) {
      for (int j = 0; j < N; j++) {
        cost[(i + j) % 3][k] += D[c[i][j]][k];
      }
    }
  }

  vector<int> colors;
  for (int i = 0; i < C; i++) {
    colors.push_back(i);
  }

  int ret = 1e9;
  do {
    vector<int> perm(colors.begin(), colors.begin() + 3);
    do {
      int sumcost = 0;
      for (int i = 0; i < 3; i++) {
        sumcost += cost[i][perm[i]];
      }
      ret = min(ret, sumcost);
    } while(next_permutation(perm.begin(), perm.end()));
  } while(next_combination(colors.begin(), colors.begin() + 3, colors.end()));
  cout << ret << endl;
  return 0;
}

Measured memory_bytes: 1280
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using static System.Math;
 
public class Hello{
    public static void Main(){
        string[] read = ReadLine().Split(' ');
//        int read_leng = read.Length;
//        int[] readR = new int[mochinum];
        int a = int.Parse(read[0]);
        int b = int.Parse(read[1]);
        int c = int.Parse(read[2]);
        int d = int.Parse(read[3]);
        
        int st = Max(a,c);
        int en = Min(b,d);
        WriteLine(Max(0,en-st));
        
    }
}

Measured memory_bytes: 13140
#include <iostream>
using namespace std;
int main() {
	int c[3][3];
	int a1, a2, a3;
	int flg = 0;
	int max = 0;
	
	for (int i = 0; i < 3; i++)
	{
		for (int j = 0; j < 3; j++)
		{
			cin >> c[i][j];
			if (c[i][j] > max)
				max = c[i][j];
		}
	}

	for (a1 = 0;a1 <= max && flg == 0;a1++) {
		for (a2 = 0;a2 <= max && flg == 0;a2++) {
			for (a3 = 0;a3 <= max && flg == 0;a3++) {
				if (c[0][0] - a1 == c[0][1] - a2 && c[0][2] - a3 == c[0][1] - a2) {
					if (c[1][0] - a1 == c[1][1] - a2 && c[1][2] - a3 == c[1][1] - a2) {
						if (c[2][0] - a1 == c[2][1] - a2 && c[2][2] - a3 == c[2][1] - a2) {
							flg = 1;
						}
					}
				}
			}
		}
	}

	if (flg == 0)
		cout << "No" << endl;
	else
		cout << "Yes" << endl;

	return 0;
}

Measured memory_bytes: 256
import math
N,K = map(int,input().split())
xs = input().split()
res_list = []
for i in range(N-K+1):
    if int(xs[i]) >0:
        diff = int(xs[i+K-1])
        res_list.append(diff)
        break
    elif int(xs[i]) <= 0 and int(xs[i+K-1]) > 0:
        diff = 2 * min(abs(int(xs[i])),abs(int(xs[i+K-1]))) + max(abs(int(xs[i])),abs(int(xs[i+K-1])))
    elif int(xs[i+K-1]) <= 0:
        diff = abs(int(xs[i]))
    res_list.append(diff)
print(min(res_list))

Measured memory_bytes: 12676
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
#include <string.h>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <tuple>
#include <stdlib.h>
using namespace std;
#define PI 3.14159265358979
typedef long long int ll;


int main()
{
	long double ans = 0, unchi, unko;
	ll N, tmp = 1, b = 1;
	cin >> N;
	vector<long double>x(N),y(N);
	for (int i = 0; i < N; i++)cin >> x[i] >> y[i]; int u = N-1;
	for (int i = 0; i < N; i++)
	{
		b *= N - i;
	}
	for (int i = 0; i < N-2; i++)
	{
		tmp *= u;
		u--;
	}
	tmp *= 2;
	for (int i = 0; i < N; i++)
	{
		for (int j = i+1; j < N; j++)
		{
			unchi = (x[i] - x[j])*(x[i] - x[j]);
			unko = (y[i] - y[j])*(y[i] - y[j]);
			ans += tmp*(sqrt(unchi+unko));
		}
	}
	cout.precision(15);
	cout << ans/double(b);
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  int A, B;
  cin>>A>>B;
  if(A<=8 && B<=8) cout<<"Yay!"<<endl;
  else cout<<":("<<endl;
}


Measured memory_bytes: 3524
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  int A;   
  for ( int i = 0; i < N; i++ ){
    int l, r;
    cin >> l >> r;
    A += (r - l + 1);
  }
  cout << A << endl;
}

Measured memory_bytes: 256
import java.util.*;

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

        Map<Integer, List<Integer>> graph = new HashMap<>();
        int n = sc.nextInt();

//        for (int i = 1; i <= n; i++) {
//            graph.put(i, new ArrayList<>());
//        }

        int m = sc.nextInt();
        for (int i = 0; i < m; i++) {
            int x = sc.nextInt();
            int y = sc.nextInt();
            List<Integer> edges = graph.get(x);
            if(edges == null) {
                edges = new ArrayList<>();
                graph.put(x, edges);
            }
            edges.add(y);
        }

        Integer[] maxes = new Integer[n+1];
        int maxPath = 0;
        for (int i = 1; i <= n; i++) {
          if(maxes[i] == null)
            maxPath = Math.max(maxPath, maxPath(graph, i, maxes));
        }

        System.out.println(maxPath);
    }

    private static int maxPath(Map<Integer, List<Integer>> graph, int i, Integer[] maxes) {
        if(maxes[i] != null) {
            return maxes[i];
        }

        List<Integer> edges = graph.get(i);
        if(edges == null || edges.isEmpty()) {
            return 0;
        }

        int max = 0;
        for (int edge: edges) {
            int path = maxPath(graph, edge, maxes);
            max = Math.max(path, max);
        }

        max++;
        maxes[i] = max;
        return max;
    }

  
}


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

int minCost(int *arr, int n, int curr, int *dp){
    if(curr==n) return 0;
    if(curr==n-1){
        return abs(arr[curr]-arr[n]);
    }
    
    if(dp[curr]!=-1) return dp[curr];
    
    int oneJump=abs(arr[curr]-arr[curr+1]) + minCost(arr,n,curr+1,dp);
    int twoJump=abs(arr[curr]-arr[curr+2]) + minCost(arr,n,curr+2,dp);
    dp[curr]= min(oneJump,twoJump);
    return dp[curr];
}

int main(){
	int n;
  	cin>>n;
  	int *arr=new int[n+1];
    for(int i=1;i<=n;i++){
    	int h;
      	cin>>h;
      	arr[i]=h;
    }
    
    int *dp=new int[n+1];
    memset(dp,-1,sizeof(dp[0])*(n+1));
    
    cout<< minCost(arr,n,1,dp)<<endl;
  	return 0;
}

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


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

	int x_group = 0;
	int y_group = 0;

	if(x==1
	|| x==3
	|| x==5
	|| x==7
	|| x==8
	|| x==10
	|| x==12
	) x_group = 1;

	if(y==1
	|| y==3
	|| y==5
	|| y==7
	|| y==8
	|| y==10
	|| y==12
	) y_group = 1;

	if(x==4
	|| x==6
	|| x==9
	|| x==11
	) x_group = 2;

	if(y==4
	|| y==6
	|| y==9
	|| y==11
	) y_group = 2;

	if(x==2
	) x_group = 3;

	if(y==2
	) y_group = 3;

	cout<<(x_group == y_group? "Yes":"No");

}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#include <math.h>
#include <time.h>
using namespace std;
const long long mod = 1000000007;
#define dump(x)                             \
    if (dbg) {                              \
        cout << #x << " = " << (x) << endl; \
    }
bool dbg = false;
long long gcd(long long a, long long b){
   if (a % b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a % b));
   }
}
long long lcm(long long a, long long b){
   return (a / gcd(a, b))* b;
}
//---------------------------------------------------------------------------------------------------
/*ここからいじる*/
//---------------------------------------------------------------------------------------------------

void solve(){
}
int main(){
    int n, d;
    cin >> n >> d;
    d = 2 * d + 1;
    int ans;
    if(n % d != 0){
        n += d;
    }
    cout << n / d << endl;
    solve();
    return 0;
}



Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	private static Scanner scanner;

	public static void main(String[] args) {

		scanner = new Scanner(System.in);
		int S;
		while(0 > (S = scanner.nextInt()) || S >= 86400 );

		int hour = S/3600;
		int minute = (S-hour*3600)/60;
		int second = (S-hour*3600-minute*60);
		System.out.println(hour+":"+minute+":"+second);

	}

}



Measured memory_bytes: 26244
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
 
#define f0rn(i, a, b) for (int i=a; i<(b); i++)
#define forn(i,n) for(int i = 0; i < n; i++)
 
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
 
const int MOD = 1000000007;
 
int main() {
    ll l[100];
    l[0] = 2; l[1] = 1;
    f0rn(i,2,100) {
        l[i] = l[i-1] + l[i-2];
    }
    int n; cin >> n; cout << l[n];
    
    fflush(stdout);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define IOS ios::sync_with_stdio(0),cin.tie(0),cout.tie(0) 
#define X first
#define Y second 
#define nl '\n'
#define AC return 0
#define pb(a) push_back(a) 
#define mst(a,b) memset(a, b, sizeof a)
#define rep(i,n) for(int i = 0; (i)<(n); i++)
#define rep1(i,n) for(int i = 1; (i)<=(n); i++)
#define scd(a) scanf("%lld", &a)
#define scdd(a,b) scanf("%lld%lld", &a, &b)
#define scs(s) scanf("%s", s)
//#pragma GCC optimize(2)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
const ll INF = (ll)0x3f3f3f3f3f3f3f, MAX = 9e18, MIN = -9e18;
const int N = 1e6+10, M = 2e6+10, mod = 1e9+7, inf = 0x3f3f3f;
ll dp[N]; 

int main()
{
	IOS;
	ll n;
	cin>>n;
	dp[0] = 1;
	for(int i = 3; i <= n; i++)
	{
		dp[i] = dp[i-1] + dp[i-3];
		dp[i] %= mod;
	}
	cout<<dp[n]<<nl;
	
	AC;
} 

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define txt                        \
    freopen("ip.txt", "r", stdin); \
    freopen("op.txt", "w", stdout)
#define a3 INT_MAX
#define i3 INT_MIN
#define a6 INT64_MAX
#define i6 INT64_MIN
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define fo(i, n) for (i = 0; i < n; i++)
#define Fo(i, k, n) for (i = k; k < n ? i < n : i > n; k < n ? i += 1 : i -= 1)
#define quickie                       \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);
#define div2(a) (!(a & 1))
#define deb(x) cout << (#x) << " " << (x) << "\n";
#define newl cout << "\n"
#define all(s) s.begin(), s.end()
#define pi 3.14159265358979323846
#define mod 1000000007
#define fp(x) fixed << setprecision(x) <<
template <class T>
int digit(T a)
{
    vector<long long> dig = {
        0,
        9,
        99,
        999,
        9999,
        99999,
        999999,
        9999999,
        99999999,
        999999999,
        9999999999,
        99999999999,
        999999999999,
        9999999999999,
        99999999999999,
        999999999999999,
        9999999999999999,
        99999999999999999,
        999999999999999999,
        INT64_MAX};
    auto it = lower_bound(dig.begin(), dig.end(), a);
    int idx = (it - dig.begin());
    return idx;
}
template <class T>
int sumAllInts(T n)
{
    int a = 1;
    int su = 0;
    while (n)
    {
        su += n % 10;
        n /= 10;
    }
    return su;
}
template <class T>
void split(char c, T s)
{
    int n = s.size();
    int i = 0;
    while ((cout << s[i], i += 1) && (i < n) && (cout << c << ' '))
        ;
}
void solve()
{
    string s;
    cin >> s;
    int ans = 0;
    int curr = 0;
    bool start = 0;
    for (int i = 0; i < s.size(); i++)
    {

        if (s[i] == 'A')
        {
            start = 1;
        }
        if (start)
            curr++;
        if (s[i] == 'Z')
        {
            ans = max(ans, curr);
        }
    }
    cout<<ans;
}
int main()
{
    quickie;
    //txt;
    int t = 1;
    while (t--)
    {
        solve();
        newl;
    }
    return 0;
}

Measured memory_bytes: 3764
#include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define each(a, b) for(auto (a): (b))
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define pb push_back
#define show(x) cout <<#x<<" = "<<(x)<<endl
#define spair(p) cout <<#p<<": "<<p.fi<<" "<<p.se<<endl
#define svec(v) cout<<#v<<":";rep(i,v.size())cout<<" "<<v[i];cout<<endl
#define sset(s) cout<<#s<<":";each(i,s)cout <<" "<<i;cout<<endl

using namespace std;

typedef pair<int,int>P;

const int MAX_N = 300000;

int n;
int prime[MAX_N];
bool is_prime[MAX_N];

int sieve(int n)
{
	int p = 0;
	for(int i=0;i<=n;i++){
		is_prime[i] = true;
	}
	is_prime[0] = is_prime[1] = false;
	for(int i=2;i<=n;i++){
		if(is_prime[i]){
			prime[p++] = i;
			for(int j=2*i;j<=n;j+=i){
				is_prime[j] = false;
			}
		}
	}
	return p;
}

int main()
{
    sieve(246912);
    while(1){
        cin >> n;
        if(n == 0){
            break;
        }
        int cnt = 0;
        for(int i=n+1;i<=2*n;i++){
            if(is_prime[i]){
                cnt++;
            }
        }
        cout << cnt << "\n";
    }
}

Measured memory_bytes: 3416
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <numeric>
#include <map>
#include <vector>
#include <string>
#include <vector>
#include <cassert>
#include <cmath>
#include <stack>
#include <cctype>
#include <queue>
#include <algorithm>
#include <memory>
#include <memory.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, P> PP;
const int INF = 1 << 30;
const double EPS = 1e-10;
const double PI = 3.14159;

int nums[1000000];
bool prime[1000000];

int main(){
	int n;
	int count = 0;
	prime[0] = prime[1] = false;
	for(int i = 2; i < 300000; i++){
		if(i % 7 == 1 || i % 7 == 6){
			nums[count++] = i;
			prime[i] = true;
		}else{
			prime[i] = false;
		}
	}
	for(int i = 2; i * i < 300000; i++){
		if(prime[i])
			for(int j = 0; j < count && nums[j] * i < 300000; j++){
				prime[i*nums[j]] = false;
			}
	}	
	while(cin >> n && n != 1){
		cout << n << ":";
		for(int i = 0; i < 300000; i++){
			if(prime[i] && n % i == 0 && ((n / i) % 7 == 1 || (n / i) % 7 == 6)) cout << " " << i;
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 1496
# -*- coding: utf-8 -*-
n = int(input())
p = list(map(int, input().split()))
ans = 0
for i in range(n):
    if i + 1 == p[i]:
        continue
    else:
        ans += 1
        if ans > 2:
            break
if ans <= 2:
    print('YES')
else:
    print('NO')


Measured memory_bytes: 2940
import bisect
N = int(input())
Ln = list(map(int,input().split(' ')))

def binary_area_search(target_list: list, target_item: int) -> int:
    '''
    @params
    target_list: [1,3,5](ACC)
    target_item: 2

    @return
    return index
    '''
    low = 0
    high = len(target_list) - 1
    while low <= high:
        mid = (low + high) //2
        guess = target_list[mid]
        if guess > target_item:
            if mid == 0:
                return 0
            if target_item > target_list[mid-1]:
                return mid 
            high = mid -1
        else:
            if mid == len(target_list) - 1:
                return None
            if target_list[mid+1] > target_item:
                return mid + 1 
            low = mid + 1
    return None

def main():
    '''
    N^2*logN
    '''
    Ln.sort()
    count = 0
    for a in range(N):
        a_l = Ln[N-a-1]
        for b in range(a+1, N):
            b_idx = N-b-1
            b_l = Ln[b_idx]
            c_threshold = a_l - b_l
            #c_list = Ln[0:N-b-1]
            c_idx = bisect.bisect_right(Ln,c_threshold)
            #c_idx = binary_area_search(c_list,c_threshold)
            if c_idx >= b_idx:
                break
            count += b_idx - c_idx
    print(count)

def main2():
    '''
    N^2
    '''
    Ln.sort(reverse=True)
    count = 0
    for a in range(N):
        a_l = Ln[a]
        current_min = N-1
        b = a +1
        while b <= current_min:
            c_idx = current_min
            bc = Ln[b] + Ln[c_idx]
            if a_l < bc:
                count += (current_min - b)
                b += 1
                continue
            current_min -= 1
    print(count)
main()

Measured memory_bytes: 3188
s = input()
evenpool = "RUD"
oddpool = 'LUD'
n = len(s)
for i in range(n):
    if i % 2 == 0 and s[i] not in evenpool:
        print("No")
        break
    elif i % 2 == 1 and s[i] not in oddpool:
        print("No")
        break
else:
    print("Yes")

Measured memory_bytes: 3060
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp> 
//#include <ext/pb_ds/tree_policy.hpp>
//#include <functional> // for less
//using namespace __gnu_pbds;
using namespace std;
typedef long long  L;

#define max_(x, y) (((x) > (y)) ? (x) : (y))
#define min_(x, y) (((x) < (y)) ? (x) : (y))
#define ___ ios_base::sync_with_stdio(false);cin.tie(NULL);
#define Mx 2000001
#define inf 1e15
const L MOD = 1e9+7;
const double pi = 2 * acos (0.0);

/*------------------------------Graph Moves----------------------------*/
//const int fx[]={+1,-1,+0,+0};
//const int fy[]={+0,+0,+1,-1};
//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move
//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move
//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
/*---------------------------------------------------------------------*/


//typedef tree<L,null_type,less<L>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

L a,b,a1,a2,a3,b1,b2,b3,c,c1,c2,c3,d,d1,d2,d3,d4,d5,e1,e2,e3,f,h,k,l,n,m,m1,m2,n1,n2,o,p1,p2,p3,p4,
q1,q2,q3,q4,r,s,t,x,y,z,sum,mx=-inf,mn=inf,flg,flg1,flg2,id1,id2,id3,cnt,lim;
string str1,str2;   
int main()
{
    cin>>str1>>str2;
    l=str2.size();
    str1+=(str2[l-1]);
    if(str2==str1)printf("Yes\n");
    else printf("No\n");
    return 0;
}
/// empty() lld I64d push_back() top() pop() insert() upper_bound() lower_bound() memset() max() min() scanf continue


Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i <(n); ++i)
#define ALL(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
static const double PI = acos(-1);



int main(){
  int a;
  cin >> a;
  int ans = a + a*a + a*a*a;
  cout << ans << endl;


  return 0;
}

Measured memory_bytes: 3596
#include <stdio.h>
int main()
{
  for(;;){
    int n,i,pm,pe,pj;
    scanf("%d",&n);
    if(n == 0) break;
    for(i=0; i<n; i++){
      scanf("%d %d %d",&pm,&pe,&pj);
      if(pm == 100 || pe == 100 || pj == 100){
        printf("A\n");
      }else if((pm + pe) / 2 >= 90){
        printf("A\n");
      }else if((pm + pe + pj) / 3 >= 80){
        printf("A\n");
      }else if((pm + pe + pj) / 3 >= 70){
        printf("B\n");
      }else if((pm + pe + pj) / 3 >= 50 && (pm >= 80 || pe >= 80)){
        printf("B\n");
      }else{
        printf("C\n");
      }
    }
  }
  return 0;
}

Measured memory_bytes: 584
/*
confirm 0LL and 1LL
confirm cornercases such as 0
confirm times of cin < 10^6
*/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Pld = pair<ld, ld>;
using Vec = vector<ll>;
using VecP = vector<P>;
using VecB = vector<bool>;
using VecC = vector<char>;
using VecD = vector<ld>;
using VecS = vector<string>;
using Graph = vector<VecP>;
template <typename T>
using Vec1 = vector<T>;
template <typename T>
using Vec2 = vector<Vec1<T> >;
#define REP(i, m, n) for(ll i = (m); (i) < (n); ++(i))
#define REPN(i, m, n) for(ll i = (m); (i) <= (n); ++(i))
#define REPR(i, m, n) for(ll i = (m)-1; (i) >= (n); --(i))
#define REPNR(i, m, n) for(ll i = (m); (i) >= (n); --(i))
#define rep(i, n) REP(i, 0, n)
#define repn(i, n) REPN(i, 1, n)
#define repr(i, n) REPR(i, n, 0)
#define repnr(i, n) REPNR(i, n, 1)
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define fs first
#define sc second
template <typename T>
bool chmax(T &a, const T b){if(a < b){a = b; return true;} return false;}
template <typename T>
bool chmin(T &a, const T b){if(a > b){a = b; return true;} return false;}
template <typename T>
ll pow2(const T n){return (1LL << n);}
template <typename T>
void cosp(const T n){cout << n << ' ';}
void co(void){cout << '\n';}
template <typename T>
void co(const T n){cout << n << '\n';}
template <typename T1, typename T2>
void co(pair<T1, T2> p){cout << p.fs << ' ' << p.sc << '\n';}
template <typename T>
void co(const Vec1<T> &v){for(T i : v) cosp(i); co();}
template <typename T>
void co(initializer_list<T> v){for(T i : v) cosp(i); co();}
template <typename T>
void ce(const T n){cerr << n << endl;}
void sonic(){ios::sync_with_stdio(false); cin.tie(0);}
void setp(const ll n){cout << fixed << setprecision(n);}
constexpr int INF = 1e9+1;
constexpr ll LINF = 1e18+1;
constexpr ll MOD = 1e9+7;
//constexpr ll MOD = 998244353;
constexpr ld EPS = 1e-11;
const ld PI = acos(-1);

int main(void){
	ll n, m, x;
	cin >> n >> m >> x;
	Vec c(n);
	Vec2<ll> a(n, Vec(m));

	rep(i, n){
		cin >> c[i];
		rep(j, m) cin >> a[i][j];
	}

	ll ans = LINF;
	rep(bit, pow2(n + 1)){
		Vec s(m);
		ll sum = 0;
		rep(i, n) if(bit & pow2(i)){
			sum += c[i];
			rep(j, m) s[j] += a[i][j];
		}

		bool flg = true;
		rep(i, m) flg &= s[i] >= x;
		if(flg) chmin(ans, sum);
	}
	if(ans == LINF) co(-1);
	else co(ans);

	return 0;
}


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

using namespace std;

int main()
{
    int n,m;
    cin >> n;
    string a[102];
    string b[102];
    map<string ,int> fruit;
    for(int i=0;i<n;i++)
    {
        cin >>a[i];
    }
    cin >> m;
    int max=0;
    for(int i=0;i<m;i++)
    {
        cin >>b[i];
    }
    for(int i=0;i<m;i++)
    {
        fruit[b[i]]--;
    }
    for(int i=0;i<n;i++)
    {
        fruit[a[i]]++;
        if(fruit[a[i]]>max) max=fruit[a[i]];
    }
    cout <<max;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <algorithm>
#include <vector>

int main() {
  int n,i;
  scanf("%d",&n);
  int a[n];
  for(i=0;i<n;i++) {
    scanf("%d",&a[i]);
  }
  int dai = a[0];
  int sho = a[0];
  for(i=1;i<n;i++) {
    if(dai<a[i]) {
      dai = a[i];
    }
    if(sho>a[i]) {
      sho = a[i];
    }
  }
  printf("%d\n",dai-sho);
}


Measured memory_bytes: 256
from __future__ import print_function

import sys

import re
import array
import copy
import functools
import operator

import math
import string
import fractions
from fractions import Fraction
from fractions import gcd
# fractions.gcd() を用いること
# math.log2()はatcoderでは対応していない．留意せよ．

import collections
import itertools
import bisect

import random
import time

import heapq
from heapq import heappush
from heapq import heappop
from heapq import heappushpop
from heapq import heapify
from heapq import heapreplace
from queue import PriorityQueue as pq
from queue import Queue

from itertools import accumulate

from collections import deque
from collections import Counter

from operator import mul
from functools import reduce

input = sys.stdin.readline


def eprint(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)
    return


def lcm(n, m):
    return int(n * m / gcd(n, m))


def coprimize(p, q):
    common = fractions.gcd(p, q)
    return (p // common, q // common)


def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom


def main():
    # input
    n = int(input().strip())
    C = Counter()
    frequency_max = 0
    for _ in range(n):
        S_temp = input().strip()
        C[S_temp] += 1
        frequency_max = max(frequency_max, C[S_temp])

    # deciding the number of frequency and "the most frecuent strings"
    l_str=[]
    for key, value in C.items():
        if value == frequency_max:
            l_str.append(key)

    # sort the list of "the most frecuent strings" in "dictionary order"
    l_str.sort()
    for s in l_str:
        print(s)

if __name__ == '__main__':
    main()


Measured memory_bytes: 114260
#include <bits/stdc++.h>
using namespace std;
using ll = long long; using ull = unsigned long long;
//#define int ll
using vb = vector<bool>; using vvb = vector<vb>;
using vi = vector<int>; using vvi = vector<vi>;
using vl = vector<ll>; using vvl = vector<vl>;
template<class T> using V = vector<T>;
template<class T> using VV = vector<V<T>>;
#define fi first
#define se second
#define maxs(x,y) (x=max(x,y))
#define mins(x,y) (x=min(x,y))
using pii = pair<int,int>; using pll = pair<ll,ll>;
#define FOR(i,a,b) for(ll i = (a); i < (ll)(b); ++i)
#define REP(i,n) FOR(i,0,n)
#define RFOR(i,a,b) for(ll i = (ll)(b)-1;i >= a;--i)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define eb(val) emplace_back(val)
const double PI = acos(-1), EPS = 1e-10;
const ll MOD = 1e9+7;
void cioacc(){//accelerate cin/cout
  cin.tie(0);
  ios::sync_with_stdio(false);
}
signed main(){
  int r,g,b,n;
  cin >> r >> g >> b >> n;
  int ans = 0;
  REP(i,n+1)REP(j,n+1){
    int m = r*i+j*g;
    if(n<m) break;
    if((n-m)%b==0){
      ++ans;
      //cout << i << " " << j << endl;
      //break;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
/*
Author: CNYALI_LK
LANG: C++
PROG: b.cpp
*/
#include<bits/stdc++.h>
#define debug(...) fprintf(stderr,__VA_ARGS__)
#define all(x) x.begin(),x.end()
using namespace std;
const double eps=1e-8;
const double PI=acos(-1.0);
typedef long long ll;
template<class T>void chkmin(T &a,T b){a=a<b?a:b;}
template<class T>void chkmax(T &a,T b){a=a>b?a:b;}
template<class T>T sqr(T a){return a*a;}
template<class T>T mmin(T a,T b){return a<b?a:b;}
template<class T>T mmax(T a,T b){return a>b?a:b;}
template<class T>T aabs(T a){return a<0?-a:a;}
#define min mmin
#define max mmax
#define abs aabs
int main(){
#ifdef cnyali_lk
	freopen("in.txt","r",stdin);
	freopen("out.txt","w",stdout);
#endif
	int n,m,k;
	scanf("%d%d%d",&n,&m,&k);
	for(int i=0;i<=n;++i)for(int j=0;j<=m;++j){
		if(i*m+j*n-j*i*2==k){
			printf("Yes\n");
			return 0;
		}
	}
	printf("No\n");
	return 0;
}



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

int main() {
  long long N;
  cin >> N;
  map<long long, long long> M;
  long long A,sum = 0;
  for (long long i = 0; i < N; i++){
    cin >> A;
    sum += A;
    M[A]++;
  }
  long long Q;
  cin >> Q;
  long long B,C;
  for (long long i = 0; i < Q; i++){
    cin >> B >> C;
    if (M[B] > 0){
      sum += (C - B) * M[B];
      M[C] += M[B];
      M[B] = 0;
    }
    cout << sum << endl;
  }
}

Measured memory_bytes: 9244
#include <bits/stdc++.h>
using namespace std;
 
int main()
{
    int X, Y;
    cin >> X >> Y;
    if (Y % 2 == 1)
    {
        cout << "No" << endl;
        return 0;
    }
    int a = 2 * X - Y / 2, b = Y / 2 - X;
    if (a < 0 || b < 0)
    {
        cout << "No" << endl;
        return 0;
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 3604
#define ll long long
#define PI 3.14159265359
#define INF 99999999
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#include<bits/stdc++.h>
using namespace std;
int main (){
    int r;
    cin >> r;
    cout << 2* r*PI;
    return 0;
}

Measured memory_bytes: 3784
#include<bits/stdc++.h>
#define endl '\n'
using namespace std;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    long int n,k;
    cin>>n>>k;
    if(n%k==0) cout<<0;
    else if( abs(n%k-k) <= abs(n%k)) cout<<abs(n%k-k);
    else cout<<(abs(n%k));
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<math.h>
#include<algorithm>
#include<utility>
#include<functional>
#include<queue>
#include<string.h>
#include<string>
#include<set>
#include<map>
#include<vector>
using namespace std;
typedef long long LL;
typedef pair<int, int> P;

int main(){
    int A,N;
    cin>>N>>A;
    cout<<N*N-A;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>

using namespace std;

int main() {

    unsigned int N;
    int T;
    int A;
    vector<int> H;
    vector<double> temp;

    cin>>N;
    cin>>T>>A;

    H.resize(N);
    temp.resize(N);
    for(int i=0; i<N; ++i){
        cin>>H[i];
        temp[i] = fabs((T - H[i] * 0.006)-A);
    }

    double min = 10000000000;
    int minPlace=0;

    for(int i=0; i<N; ++i)
    {
        if(temp[i]<min)
        {
            min=temp[i];
            minPlace = i+1;
        }
    }

    cout<<minPlace<<endl;


    return 0;
}

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

#define ll long long
#define mod 1000000007
#define pb push_back
#define pi pair<int,int>
#define vi vector<int>
#define vpi vector< pi > 
#define IOS ios_base::sync_with_stdio(false),cin.tie(NULL)
const int N=200002,M=11;
int a[N],h[N];
vi v[N];
int main()
{
	int n;
	cin>>n;
	map<int,int> mm;
	ll res=0;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
		res+=mm[i-a[i]];

		mm[a[i]+i]+=1;
	}
	// mm.clear();
	// for(int i=n;i>=1;i--)
	// {
	// 	res+=mm[i+a[i]];
	// 	mm[i-a[i]]+=1;
	// }
	cout<<res<<"\n";
	return 0;
}

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

long long ucln(long long a, long long b)
{
	if (b==0) return a;
	else return ucln(b, a%b);
}

int main(){
	long long a, b, c, d;
	cin >> a >> b >> c >> d;
	long long hai=b/c-(a-1)/c;
	long long ba=b/d-(a-1)/d;
	long long sau=b/(c*d/ucln(c,d))-(a-1)/(c*d/ucln(c,d));
	cout << b-a+1-hai-ba+sau;
}

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

int main(){
    int n;
    cin >> n;
    string s[100];
    for(int i=0; i<n; i++){
        cin >> s[i];
    }

    string ans = "";

    for(char c='a'; c<='z'; c++){
        int minCharCount = 100;
        for(int i=0; i<n; i++){
            int tmpCharCount = 0;
            for(int j=0; j<s[i].size(); j++){
                if(s[i][j] == c) tmpCharCount++;
            }
            minCharCount = min(minCharCount, tmpCharCount);
        }
        for(int k=0; k<minCharCount; k++){
            ans += c;
        }
    }

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define fr(i,n) for(i=0;i<n;i++)
#define F first
#define S second
#define fast std::ios_base::sync_with_stdio(false)
#define mod 1000000007
#define pi 3.14159265
int main() {
    fast;
    string s;
    cin>>s;
    lli i;
    fr(i,s.length())
    {
        if(s[i]!='h'&&s[i]!='i')
        {
            cout<<"No";
            return 0;
        }
    }
    if(s.length()%2!=0)
    {
        cout<<"No";
        return 0;
    }
    fr(i,s.length())
    {
        if(i%2==0&&s[i]!='h')
        {
            cout<<"No";
            return 0;
        }
        else if(i%2==1&&s[i]!='i')
        {
            cout<<"No";
            return 0;
        }
    }
    cout<<"Yes";
    
    return 0;
}

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

#define ll long long int
#define mp make_pair
#define ff first
#define ss second
#define fr(i,l,r) for (long long int i = l; i < r; ++i)
#define frr(i,l,r) for (long long int i = r; i >= l; --i) 
#define sortarr sort(arr,arr+n) //sorts array in asc order
#define sortarr_r sort(arr, arr+n, greater<long long int>()) //sorts array in desc order
#define make_set set<long long int>s //Set arranges in asc order
#define make_set_r set<long long int, greater <long long int>>s ////Set arranges in desc order
#define make_vector vector<long long int>v; 
#define pb push_back


// string size = str.size()

// stack <int> s; 
// queue <int> gquiz; 
// __gcd(m, n) 

// ll arr[10e5 + 5];
// char arr[10e5 + 5];

// printf ("%.9f\n",x);

bool compare(string &s1,string &s2) 
{ 
    return s1.size() < s2.size(); 
} 
void yes()
{
    cout << "YES" << endl;
}
void no()
{
    cout << "NO" << endl;
}


int main(void)
{
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    // ll n;
    // cin >> n;
    ll k;
    cin >> k;
    string str;
    cin >> str;
    if(str.size() <= k)
    {
        cout << str << endl;
    }
    else
    {
        for(ll i = 0; i<k ;i++)
        {
            cout << str[i];
        }
        cout << "..." << endl;
    }
    
    return 0;
}   

Measured memory_bytes: 3616