akhauriyash/Code-Regression huggingface dataset:
#include <float.h>
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

// 内部変数
static FILE *szpFpI;											// 入力

// 内部変数 - テスト用
#ifdef D_TEST
	static int siRes;
	static FILE *szpFpA;
	static int siTNo;
#endif

// １行出力
int
fOutLine(
	char *pcpLine				// <I> １行
)
{
	char lc1Buf[1024];

#ifdef D_TEST
	fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
	if (strcmp(lc1Buf, pcpLine)) {
		siRes = -1;
	}
#else
	printf("%s", pcpLine);
#endif

	return 0;
}

// 実行メイン
int
fMain(
)
{
	int i, j;
	char lc1Buf[1024];

	// A, B, C - 取得
	int li1Val[6];
	fgets(lc1Buf, sizeof(lc1Buf), szpFpI);
	sscanf(lc1Buf, "%d%d%d", &li1Val[0], &li1Val[1], &li1Val[2]);
	if (li1Val[0] % 2 == 0 && li1Val[0] == li1Val[1] && li1Val[0] == li1Val[2]) {
		return -1;
	}

	// 回数 - 取得
	for (i = 0; ; i++) {
		for (j = 0; j < 3; j++) {
			if (li1Val[j] % 2) {
				return i;
			}
		}

		// 交換
		int li1Val2[3];
		for (j = 0; j < 3; j++) {
			li1Val[j + 3] = li1Val[j];
			li1Val2[j] = (li1Val[j + 1] + li1Val[j + 2]) / 2;
		}
		for (j = 0; j < 3; j++) {
			li1Val[j] = li1Val2[j];
		}
	}

	return 0;
}

// １回実行
int
fOne(
)
{
	int liRet;
	char lc1Buf[1024];

	// 入力 - セット
#ifdef D_TEST
	sprintf(lc1Buf, ".\\Test\\T%d.txt", siTNo);
	szpFpI = fopen(lc1Buf, "r");
	sprintf(lc1Buf, ".\\Test\\A%d.txt", siTNo);
	szpFpA = fopen(lc1Buf, "r");
	siRes = 0;
#else
	szpFpI = stdin;
#endif

	// 実行メイン
	liRet = fMain();

	// １行出力
	sprintf(lc1Buf, "%d\n", liRet);
	fOutLine(lc1Buf);

	// 残データ有無
#ifdef D_TEST
	lc1Buf[0] = '\0';
	fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
	if (strcmp(lc1Buf, "")) {
		siRes = -1;
	}
#endif

	// テストファイルクローズ
#ifdef D_TEST
	fclose(szpFpI);
	fclose(szpFpA);
#endif

	// テスト結果
#ifdef D_TEST
	if (siRes == 0) {
		printf("OK %d\n", siTNo);
	}
	else {
		printf("NG %d\n", siTNo);
	}
#endif

	return 0;
}

// プログラム開始
int
main()
{

#ifdef D_TEST
	int i;
	for (i = D_TEST_SNO; i <= D_TEST_ENO; i++) {
		siTNo = i;
		fOne();
	}
#else
	fOne();
#endif

	return 0;
}



Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, n) for(int i = 0; i < (n); i++)
#define FORR(x, arr) for(auto& x:arr)
#define ITR(x, c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define MEM(a, x) memset(a, x, sizeof(a))
#define ALL(a) a.begin(), a.end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())
typedef long long ll;
typedef pair<int, int> P;

string s, t;

int main(int argc, char const *argv[]) {
	ios_base::sync_with_stdio(false);
	cin >> s >> t;
	vector<int> v;
	FOR(i, s.size()-t.size()+1) {
		if (s[i]==t[0]) v.push_back(i);
		else if (s[i]=='?') {
			int cnt = 0;
			for (int j = 0; j < t.size(); j++) {
				if (s[i+j]=='?'||s[i+j]==t[j]) cnt++;
			}
			if (cnt==t.size()) v.push_back(i);
		}
	}
	if (v.empty()) {
		cout << "UNRESTORABLE" << endl;
		return 0;
	}
	for (int i = v.size()-1; i >= 0; i--) {
		bool ok = true;
		FOR(j, t.size()) {
			if (s[v[i]+j]=='?' || s[v[i]+j]==t[j]) continue;
			ok = false;
		}
		if (ok) {
			FOR(j, t.size()) {
				s[v[i]+j] = t[j];
			}
			FOR(j, s.size()) {
				if (s[j]=='?') s[j]='a';
			}
			cout << s << endl;
			return 0;
		}
	}
	cout << "UNRESTORABLE" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define SZ(x) ((int)x.size())
#define ALL(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
typedef long double ld;
int main() {
	ll n, m;
	scanf("%lld%lld", &n, &m);
	if(n == 1 && m == 1) printf("1");
	else if(n == 1) printf("%lld", max(0ll, m - 2));
	else if(m == 1) printf("%lld", max(0ll, n - 2));
	else printf("%lld", max(0ll, (n - 2) * (m - 2)));
	return 0;
}

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

int main() {
	int n, a[200010] = { 0 };
	cin >> n;
	for (int i = 2; i <= n; i++) {
		int ai;
		cin >> ai;
		a[ai]++;
	}
	for (int i = 1; i <= n; i++) {
		cout << a[i] << " " << endl;
	}
	return 0;
}

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

using namespace std;

using int64 = long long;
const int mod = 1e9 + 7;

int64 dp[2002][2002][2];

int main() {
  int N, K;
  cin >> N >> K;
  dp[N][0][0] = 1;
  for(int i = N; i >= 1; i--) {
    for(int j = N; j >= 0; j--) {
      (dp[i - 1][j][0] += dp[i][j][0] + dp[i][j][1]) %= mod;
      (dp[i - 1][j + 1][1] += dp[i][j][0] + dp[i][j][1]) %= mod;
      if(j) (dp[i][j - 1][0] += dp[i][j][0]) %= mod;
    }
  }
  int ret = (dp[1][N - K][0] + dp[1][N - K][1]) % mod;
  for(int i = 0; i < N - K - 1; i++) (ret *= 2) %= mod;
  cout << ret << endl;
}


Measured memory_bytes: 62848
#include <bits/stdc++.h>
#define rep3(i, s, n, a) for (int i = (s); i < (int)(n); i += a)
#define rep2(i, s, n) rep3(i, s, n, 1)
#define rep(i, n) rep2(i, 0, n)

using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;

int main(){
    int n;
    cin >> n;
    vector<ll> l, tmp;
    rep(i, n){
        ll x;
        cin >> x;
        l.push_back(x);
    }

    int cnt = 0;
    rep(i, n-2){
        rep2(j, i+1, n-1){
            rep2(k, j+1, n){
                tmp.clear();
                tmp.push_back(l[i]);
                tmp.push_back(l[j]);
                tmp.push_back(l[k]);
                sort(tmp.begin(), tmp.end());
                tmp.erase(unique(tmp.begin(), tmp.end()), tmp.end());
                if (tmp.size() != 3) {
                    continue;
                }
                if(tmp[0]+tmp[1]>tmp[2]){
                    cnt++;
                }
            }
        }
    }

    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(n) begin(n), end(n)
using ll = long long;
using namespace std;

int main(){
  int h, w, k;
  cin >> h >> w >> k;
  vector<string> s(h);
  rep(snip_i, h) cin >> s.at(snip_i);
  int ans = 1001001001;

  rep(bit, 1 << (h-1)){
    vector<int> v;
    int na = 0;
    rep(j, h-1){
      if((bit & (1 << j)) != 0){
        v.push_back(j);
        na++;
      }
    }
    v.push_back(h);
    vector<int> sum(v.size()+1, 0);
    int vindex = 0;
    bool con = false;
    rep(i, h){
      sum.at(vindex) += s.at(i).at(0) - '0';
      if(sum.at(vindex) > k){
        con = true;
        break;
      }
      if(i == v.at(vindex))vindex++;
    }
    if(con == true) continue;
    rep2(i, 1, w){
      vindex = 0;
      vector<int> add(sum.size(), 0);
      bool new_v = false;
      rep(j, h+1){
        if(j != h)add.at(vindex) += s.at(j).at(i) - '0';
        if(j == v.at(vindex)){
          if(add.at(vindex) > k){
            con = true;
            break;
          }else if(sum.at(vindex) + add.at(vindex) > k){
            new_v = true;
          }
          vindex++;
        }
      }
      // rep(deb, sum.size()){
      //   cerr << sum.at(deb) << " ";
      // }
      // cerr << endl;

      if(con == true) break;
      if(new_v == true){
        na++;
        rep(j, sum.size()){
          sum.at(j) = add.at(j);
        }
      }else{
        rep(j, sum.size()){
          sum.at(j) += add.at(j);
        }
      }
    }
    if(con == true) continue;
    ans = min(ans, na);
    // cerr << ans << endl;
  }
  cout << ans << endl;
  return 0;
}

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

using namespace std;

using ll = long long;
using ld = long double;

using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vs = vector<string>;

typedef pair<ll, ll> P;

#define bit(n) (1LL << (n))

//#define int long long

#define all(v) v.begin(), v.end()

#define rep(i, n) for (ll i = 0; i < n; i++)
#define REP(i, n) for (ll i = 1; i < n; i++)

#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define FORm(i, m) for (auto i = m.begin(); i != m.end(); i++)

template <class T>
inline void chmax(T& a, T b) {
  a = std::max(a, b);
}
template <class T>
inline void chmin(T& a, T b) {
  a = std::min(a, b);
}

#define mod (ll)(1e9 + 7)
const long long INF = 1LL << 60;

// Dijkstra
struct Dijkstra {
  struct Edge {
    int to;
    long long cost;
  };

  vector<vector<Edge>> G;
  int num_v;

 public:
  Dijkstra(int num_v) : G(num_v), num_v(num_v) {
  }

  void add_edge(int from, int to, long long cost) {
    G[from].push_back((Edge){to, cost});
  }

  // start: Start point
  // result: result
  void solve(int start, vector<long long>& result) {
    vector<int> tmp;
    solve(start, result, tmp);
  }

  void solve(int start, vector<long long>& result, vector<int>& prev) {
    result.resize(num_v, INF);
    prev.resize(num_v, -1);

    // get<0>(T): cost
    // get<1>(T): index
    // get<2>(T): ... ( for extent)
    using T = tuple<long long, int>;
    priority_queue<T, vector<T>, greater<T>> que;

    que.emplace(0, start);

    while (!que.empty()) {
      T p = que.top();
      que.pop();

      long long t = get<0>(p);
      int v = get<1>(p);

      // 対象以下のコストの経路が既に見つかっている場合
      if (result[v] <= t) {
        continue;
      }

      result[v] = t;

      // vの各辺に対しよりコストの低い経路があるかを確認
      for (auto& e : G[v]) {
        // pathを確認しないならこのifはなくても良い
        if (result[e.to] > result[v] + e.cost) {
          prev[e.to] = v;
          que.emplace(result[v] + e.cost, e.to);
        }
      }
    }
  }

  // t: 目的地
  vector<int> get_path(const vector<int>& prev, int t) {
    vector<int> path;

    for (int v = t; v != -1; v = prev[v]) {
      path.push_back(v);
    }

    reverse(path.begin(), path.end());
    return path;
  }
};

Dijkstra d(1);

int dfs(int idx, int from, int prohibited) {
  int ans = 1;
  FORm(it, d.G[idx]) {
    if (it->to != from && it->to != prohibited) {
      ans += dfs(it->to, idx, prohibited);
    }
  }
  return ans;
}

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);

  ll n;
  cin >> n;

  d = Dijkstra(n + 1);

  rep(i, n - 1) {
    ll a, b;
    cin >> a >> b;
    d.add_edge(a, b, 1);
    d.add_edge(b, a, 1);
  }

  vll dist;
  vi pre;
  d.solve(1, dist, pre);
  vi path = d.get_path(pre, n);
  int si = (path.size() + 1) / 2;
  int fi = si - 1;

  // 1-nの最短経路でそれぞれがどこまで取れたか
  int f = path[fi];
  int s = path[si];

  int nf = dfs(1, -1, s);
  int sf = n - nf;

  if (nf > sf) {
    cout << "Fennec" << endl;
  } else {
    cout << "Snuke" << endl;
  }

  return 0;
}


Measured memory_bytes: 12156
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iomanip>
#include <map>
#include <utility>
#include <numeric>
#include <typeinfo>

using namespace std;

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

  sort(A.begin(),A.end());
  bool flag=true;
  if(N%2==1){
    if(A.at(0)!=0)  flag=false;
    for(int i=1;i<N;i++){
      if(A.at(i)!=(i+1)/2*2)  flag=false;
    }
  }
  else if(N%2==0){
    for(int i=0;i<N;i++){
      if(A.at(i)!=i/2*2+1)  flag=false;
    }
  }
  if(!flag){
    cout << 0 << endl;
    return 0;
  }

  long long ans=1;
  long long mod=1000000007;
  for(int i=0;i<N/2;i++){
    ans*=2;
    ans%=mod;
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 640
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
using namespace std;

#define int long long

const int CN = 3001;

int read(){
    int s = 0,ne = 1; char c = getchar();
    while(c < '0' || c > '9') ne = c == '-' ? -1 : 1, c = getchar();
    while(c >= '0' && c <= '9') s = (s << 1) + (s << 3) + c - '0', c = getchar();
    return s * ne;
}

int n, m, K, v[CN][CN], f[4][CN][CN];

signed main()
{
    // freopen("_in.in", "r", stdin);
    n = read(), m = read(), K = read();
    while(K--) {int i = read(), j = read();v[i][j] = read();}
    for(int i = 1; i <= n; i++)
        for(int j = 1; j <= m; j++){
            if(v[i][j]){
                for(int k = 1; k <= 3; k++)
                    f[k][i][j] = max(f[k - 1][i][j - 1], f[3][i - 1][j]) + v[i][j];
            }
            for(int k = 0; k <= 3; k++)
                f[k][i][j] = max(f[k][i][j], max(f[k][i][j - 1], f[3][i - 1][j]));
        }
    printf("%lld", f[3][n][m]);
}

Measured memory_bytes: 355288
Scanf.scanf "%d" (fun d ->
    let c = Array.init 26 (fun _ -> Scanf.scanf " %d" (fun c -> c)) in
    let s = Array.init d (fun _ ->
        Array.init 26 (fun _ ->
            Scanf.scanf " %d" (fun s -> s)))
    in
    let t = Array.init d (fun _ -> Scanf.scanf " %d" (fun t -> t - 1)) in
    let basicsat =
        let rec loop i acc =
            if i = d then acc else loop (i + 1) (acc + s.(i).(t.(i)))
        in
        loop 0 0
    in
    let module S = Set.Make (struct type t = int let compare = compare end) in
    let last = Array.make 26 (S.add d @@ S.singleton (-1)) in
    Array.iteri (fun i t -> last.(t) <- S.add i last.(t)) t;

    let f a = a * (a - 1) / 2 in

    let reducesat =
        let calc set =
            let rec loop prev acc = function
            | [] -> acc
            | hd :: tl -> loop hd (acc + f (hd - prev)) tl
            in
            match S.elements set with
            | hd :: tl -> loop hd 0 tl
            | [] -> 0
        in
        let rec loop i acc =
            if i = 26 then acc else loop (i + 1) (acc + c.(i) * calc last.(i))
        in
        loop 0 0
    in
    Scanf.scanf " %d" (fun m ->
        let rec loop i score =
            if i = m then score else
                let score = Scanf.scanf " %d %d" (fun a b ->
                    let a, b = a - 1, b - 1 in
                    let pre = t.(a) in
                    let p1, _, p2 = S.split a last.(pre) in
                    let p1m = S.max_elt p1 in
                    let p2m = S.min_elt p2 in
                    let score = score + c.(pre) * (f (a - p1m) + f (p2m - a) - f (p2m - p1m)) in
                    let score = score - s.(a).(pre) in
                    last.(pre) <- S.remove a last.(pre);

                    let p1, _, p2 = S.split a last.(b) in
                    let p1m = S.max_elt p1 in
                    let p2m = S.min_elt p2 in
                    let score = score + c.(b) * (- f (a - p1m) - f (p2m - a) + f (p2m - p1m)) in
                    let score = score + s.(a).(b) in
                    last.(b) <- S.add a last.(b);
                    t.(a) <- b;
                    score
                )
                in
                let () = Printf.printf "%d\n" score in
                loop (i + 1) score
        in
        loop 0 (basicsat - reducesat)
    )
)

Measured memory_bytes: 6400
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
using P = pair<int, int>;
int k,x,y;
vector<P> ans;
void s(int x, int y){
	if(abs(x) > 2*k || abs(y) > 2*k) s(x+(x>0?-k:k),y+(y>0?-k:k));
	else if(abs(x+y) + abs(x-y) != 2*k){
		if(x&1) s(x+(x>0?-k:k),y+(y>0?-k:k));
		else ans.push_back(P(x>0?k:-k,y>0?y-k:y+k));
	}
	ans.push_back(P(x,y));
}
int main(){
	scanf("%d%d%d", &k, &x, &y);
	if(~k&(x+y)&1) return 0*puts("-1");
	s(x+y,x-y);
	printf("%d\n", (int)ans.size());
	for(P t : ans){
		tie(x,y) = t;
		printf("%d %d\n", (x+y)/2, (x-y)/2);
	}
}

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

#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << ": " << arg1 << "\t|";
    __f(comma + 1, args...);
}

#define print(x) for(auto it : x) cout<< it << ' '; cout << '\n';
typedef long long ll;
typedef unsigned long long ull;
#define mem1(a)           memset(a,-1,sizeof(a))
#define mem0(a)           memset(a,0,sizeof(a))

const int MOD = 1e9 + 7;
ll mod(ll a) { return (ll) (a % MOD + MOD) % MOD; }
ll mul(ll a, ll b) { return (ll) mod(mod(a) * mod(b));}

int a[100];
int dp[100006];

int main() {
    ios::sync_with_stdio(false); cin.tie(0);
    int n, k; cin >> n >> k;
    for (int i = 0; i < n; i++)
        cin >> a[i];
    dp[0] = 0;
    for (int i = 1; i <= 100005; i++) {
        dp[i] = 0;
        for (int j = 0; j < n; j++) {
            int el = a[j];
            if ((i - el >= 0) && (!dp[i - el])) {
                dp[i] = 1;
                break;
            }
        }
    }
    cout << (dp[k] ? "First\n" : "Second\n") ;
    return 0;
}


Measured memory_bytes: 4016
#include <iostream>
#include <string>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <map>
#include <cmath>
#include <queue>
#include <utility>
#include <functional>
#include <deque>
#include <cctype>

const long long int Z = 1000000007;
const long long int INF = 1 << 30;
int flag = 0;
using ll = long long;

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

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

 int main() {
	 std::string s;
	 while (std::cin >> s) {
		 if (s == "0") {
			 break;
		 }
		 int ans = 0;
		 for (int i = 0;i < s.size();i++) {
			 int a = s[i] - '0';
			 ans += a;
		 }
		 std::cout << ans << std::endl;
	}
	return 0;
}


Measured memory_bytes: 3192
from sys import setrecursionlimit, stdin


def bit_add(bit, i, x):
    i += 1
    n = len(bit)
    while i <= n:
        bit[i - 1] += x
        i += i & -i


def bit_sum(bit, i):
    result = 0
    i += 1
    while i > 0:
        result += bit[i - 1]
        i -= i & -i
    return result


def query(bit, start, stop):
    if start == 0:
        return bit_sum(bit, stop - 1)
    else:
        return bit_sum(bit, stop - 1) - bit_sum(bit, start - 1)


readline = stdin.readline
setrecursionlimit(10 ** 6)

N, Q = map(int, readline().split())
a = list(map(int, readline().split()))

bit = [0] * N
for i in range(N):
    bit_add(bit, i, a[i])

result = []
for _ in range(Q):
    Query = readline()
    if Query[0] == '0':
        _, p, x = map(int, Query.split())
        bit_add(bit, p, x)
    elif Query[0] == '1':
        _, l, r = map(int, Query.split())
        result.append(query(bit, l, r))

print(*result, sep='\n')


Measured memory_bytes: 65984
#include<iostream>
#include<stack>
#include<vector>
#include<queue>
#include<deque>
#include<string>
#include<map>
#include<unordered_map>
#include<set>
#include<algorithm>
#include <cstdlib>
#include<unordered_set>
#include<cmath>
#include<list>
#include<functional>
#include<cmath>
#include <iostream>
#include <fstream>
using namespace std;

int main() {
	int n;
	cin >> n;
	int k;
	cin >> k;
	vector<bool> avail(10, true);
	for (int i = 0; i < k; i++) {
		int num;
		cin >> num;
		avail[num] = false;
	}
	while (1) {
		int temp = n;
		while (temp > 0) {
			int d = temp % 10;
			if (!avail[d]) {
				break;
			}
			temp /= 10;
		}
		if (temp <= 0) {
			cout << n<< endl;
			break;
		}
		n++;
	}
	//system("pause");
	return 0;
}


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

int main() {
  int N,A;
  cin >> N;
  A =0;
  for(int i=0;i<N;i++){
    int l,r;
    cin >> l >>r;
    A+=(r-l+1);
      
}
  cout << A;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define inf (1ll<<60)
#define Yes(f) cout<<(f?"Yes":"No")<<endl
#define yes(f) cout<<(f?"yes":"no")<<endl
#define YES(f) cout<<(f?"YES":"NO")<<endl
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v), greater<int>())

using namespace std;

const int mod=1e9+7;

void run();

void init() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(12);
}

signed main(){
    init();
    run();
    return 0;
}

void run(){
    char b;
    cin>>b;
    switch(b){
        case 'A':cout<<'T'<<endl;break;
        case 'T':cout<<'A'<<endl;break;
        case 'G':cout<<'C'<<endl;break;
        case 'C':cout<<'G'<<endl;break;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
long long n,m,i,j,a[200005],sum[200005],ans=0x7fffffffffffffffll,ss,t;
int main()
{
	ios_base::sync_with_stdio(0);
	cin>>n>>m;
	for (i=1;i<=n;i++) cin>>a[i];
	for (i=1;i<=n;i++) sum[i]=sum[i-1]+a[i];
	for (i=1;i<=n;i++)
	{
		j=n;ss=0;t=3;
		while (j>0)
		{
			ss+=max(t,5ll)*(sum[j]-sum[max(j-i,0ll)]);
			if (ss>ans) break;
			j=max(0ll,j-i);
			t+=2;
		}
		ans=min(ans,ss+i*m);
	}
	cout<<n*m+ans;
	return 0;
}

Measured memory_bytes: 3328
/*
      author : nishi5451
      created: 11.08.2020 22:38:23
*/

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


int main(){
    char c;
    cin >> c;
    cout << char(c+1) << endl;
    return 0;
}

Measured memory_bytes: 3484
#define MOD 1000000007
#include<bits/stdc++.h>
#define lli long long int
using namespace std;

int main() {
	int h, w;
	cin>>h>>w;
	lli input[h + 1][w + 1];
	memset(input, -1, sizeof(input));
	for(int i = 1; i <= h; i++) {
		for(int j = 1; j <= w; j++) {
			char ch; cin>>ch;
			if(ch == '#') input[i][j] = 0;
		}
	}
	input[1][1] = 1;
	for(int i = 2; i <= h; i++) {
		input[i][1] = input[i][1]? input[i - 1][1]: 0;
	}
	for(int i = 2; i <= w; i++) {
		input[1][i] = input[1][i]? input[1][i - 1]: 0;
	}
	
	for(int i = 2; i <= h; i++)
		for(int j = 2; j <= w; j++)
			input[i][j] = input[i][j]?(input[i - 1][j] + input[i][j - 1]) % MOD: 0;
			
	cout<<(input[h][w] % MOD);
	return 0;
}

Measured memory_bytes: 8064
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n,i;
  cin>>n;
  if(n<1000)
    cout<<1000-n;
  else
  {
  int r=n%1000;
  int e=1000-r;
    if(e==1000)
      cout<<"0";
    else
    cout<<e;
  }
  cout<<"\n";
}

Measured memory_bytes: 3592
// Code by Tea
#include<bits/stdc++.h>
using namespace std;
#define LL long long
#define dou double
#define rep(a,b,c) for(register int a = b; a <= c; ++ a)
#define dep(a,b,c) for(register int a = b; a >= c; -- a)
#define Set(a,b) memset(a,b,sizeof a)
#define INF (0x3f3f3f3f)
template<class T> inline T read() {static T x;static char c;static int _;x=0;_=1;while(!isdigit(c=getchar()))if(c=='-')_=-1;while(x=(x<<1)+(x<<3)+(c&15),isdigit(c=getchar()));return x*_;}
template<class T> void write(T x) {if(x<0)putchar('-'),x=-x;if(x>9)write(x/10);putchar(x%10^48);}
template<class T> inline bool chikmin(T &a, T b) {return a>b?(a = b,1):0;}
template<class T> inline bool chikmax(T &a, T b)
{return a<b?(a=b,1):0;}
#define N 44
int dp[N][N][N][N], sum[N][N];
int n, m, tx, ty;
inline void Init() {
    char str[N];
    scanf("%d%d", &n, &m);
    rep(i,1,n) {
        scanf("%s", str + 1);
        rep(j,1,m) {
            if(str[j] == 'P') {
                tx = i;
                ty = j;
            } else if(str[j] == '#') {
                sum[i][j] = 1;
            }
        }
    }
    rep(i,1,n) rep(j,1,m) {
        sum[i][j] += sum[i - 1][j] + sum[i][j - 1] - sum[i - 1][j - 1];
    }
}
inline int Sum(const int &a, const int &b, const int &c, const int &d) {
    return sum[c][d] - sum[c][b - 1] - sum[a - 1][d] + sum[a - 1][b - 1];
}
int work(const int &a, const int &b, const int &c, const int &d) {
    if(dp[a][b][c][d] != -1) return dp[a][b][c][d];
    int &ans = dp[a][b][c][d] = INF;
    
    chikmin(ans, Sum(a, b, tx, ty));
    chikmin(ans, Sum(tx, b, c, ty));
    chikmin(ans, Sum(a, ty, tx, d));
    chikmin(ans, Sum(tx, ty, c, d));
    
    rep(i, a + 1, tx) rep(j, b + 1, ty) 
        chikmin(ans, work(i, j, c, d) + Sum(i, b, c, j - 1) +\
                                        Sum(a, j, i - 1, d));
    rep(i, tx, c - 1) rep(j, ty, d - 1) 
        chikmin(ans, work(a, b, i, j) + Sum(a, j + 1, i, d) +\
                                        Sum(i + 1, b, c, j));
    rep(i, tx, c - 1) rep(j, b + 1, ty)
        chikmin(ans, work(a, j, i, d) + Sum(a, b, i, j - 1) +\
                                        Sum(i + 1, j, c, d));
    rep(i, a + 1, tx) rep(j, ty, d - 1)
        chikmin(ans, work(i, b, c, j) + Sum(a, b, i - 1, j) +\
                                        Sum(i, j + 1, c, d));
    return ans;
}
int main()
{
    //freopen("haner.in","r",stdin);
    //freopen("haner.out","w",stdout);
    Init();
    Set(dp,-1);
    printf("%d\n", work(1,1,n,m));
    return 0;	
}


Measured memory_bytes: 14976
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
using namespace std;
const int maxx = 100010;
const int INF = 1 << 30;

class DisjointSet {
public:
	// rank??°???????????????
	vector<int> rank, p;
	DisjointSet() {};
	DisjointSet(int size) {
		rank.resize(size, 0);
		p.resize(size, 0);
		for (int i = 0; i < size; i++)
			makeSet(i);
	}
	void makeSet(int i) {
		p[i] = i;
		rank[i] = 0;
	}

	bool same(int x, int y) {
		return findSet(x) == findSet(y);
	}

	void unite(int x, int y) {
		link(findSet(x), findSet(y));
	}

	void link(int x, int y) {
		// ??????x?????????????????´??????????°?y???????????¶??°x???
		if (rank[x] > rank[y])
			p[y] = x;
		else {
			p[x] = y;
			if (rank[x] == rank[y])
				rank[y]++;
		}
	}
	int findSet(int x) {
		if (x != p[x])
			p[x] = findSet(p[x]);
		return p[x];
	}
};

class Edge {
public:
	int source, target, cost;
	Edge(int source = 0, int target = 0, int cost = 0) :
		source(source), target(target), cost(cost) {}
	bool operator < (const Edge &e) const {
		return cost < e.cost;
	}
};


int kruskal(int n, vector<Edge> edges) {
	int totalCost = 0;
	sort(edges.begin(), edges.end());

	DisjointSet dset = DisjointSet(n + 1);
	for (int i = 0; i < n; i++)
		dset.makeSet(i);

	int len = edges.size();
	for (int i = 0; i < len; i++) {
		Edge e = edges[i];
		// ?????????????????????
		if (!dset.same(e.source, e.target)) {
			// ??????????°????????????????
			//MST.push_back(e);
			totalCost += e.cost;
			dset.unite(e.source, e.target);
		}
	}
	return totalCost;
}
int main() {

	int n, m, cost;
	int source, target;
	scanf("%d %d", &n, &m);
	vector<Edge> edges;
	for (int i = 0; i < m; i++) {
		scanf("%d %d %d", &source, &target, &cost);
		edges.push_back(Edge(source, target, cost));
	}
	printf("%d\n", kruskal(n, edges));
	return 0;
}

Measured memory_bytes: 5164
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int INF = 1e9;
int MOD = 1e9+7;
main(){
    int N,M;
    int cnt[26] = {};
    cin >> N >> M;
    string S;
    for(int i = 0;i < N;i++){
        cin >> S;
        for(char c:S)cnt[c-'a']++;
    }
    sort(cnt,cnt+26,greater<int>());
//    vector<int> num((N+1)/2*(M+1)/2,4);
    int num[3] = {};//1 2 4
    if(N == 1 ^ M == 1){
        num[1] = max(N,M)/2;
        num[0] = max(N,M)&1;
    }else if(N == 1 && M == 1){
        num[0] = 1;
    }else if((N&1) && (M&1)){
        num[0] = 1;
        num[1] = (N/2)+(M/2);
        num[2] = (N/2)*(M/2);
    }else if((N&1) ^ (M&1)){
        int even = N&1?M:N;
        int odd = N+M - even;
        num[1] = even/2;
        num[2] = odd/2 * (even/2);
    }else{
        num[2] = (N/2)*(M/2);
    }
    for(int i = 0;i < 26;i++){
        for(int j = 2;j >= 0;j--){
            if(num[j] == 0)continue;
            int d = 1 << j;
            int dif = cnt[i] / d;
            if(num[j] < dif){
                cnt[i] -= d*num[j];
                num[j] = 0;
            }else{
                num[j] -= dif;
                cnt[i] -= dif*d;
            }
        }
    }
    if(num[0] | num[1] | num[2]){
        cout << "No" << endl;
    }else{
        cout << "Yes" << endl;
    }
}

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

#define fa(x,v) for(auto x:v)
#define f(i,a,b) for(ll i=(ll)a;i<=(ll)b;i++)
#define rf(i,a,b) for(ll i=(ll)a;i>=(ll)b;i--)
#define spc " "
#define endl '\n'
#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define len(s) (ll)int(s.length())
#define sz(v) (ll)int(v.size())
#define MOD 1000000007

void Fast_IO() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    #ifndef ONLINE_JUDGE
    freopen("input.in","r",stdin);
    freopen("output.out","w",stdout);
    freopen("debug.out","w",stderr);
    #endif
} 

// Code Here

int main()
{
    //Fast_IO();
    ll n, m, k; cin >> n >> m >> k;
    ll a[n]; f(i,0,n-1) cin >> a[i];
    ll b[m]; f(i,0,m-1) cin >> b[i];
    ll tt = 0;
    ll id1 = -1;
    f(i,0,n-1) {
    	if(tt + a[i] > k) {
    		id1 = i-1;
    		break;
    	}
    	tt += a[i];
    	id1 = i;
    }
    ll id2 = -1;
    f(i,0,m-1) {
    	if(tt + b[i] > k) {
    		id2 = i-1;
    		break;
    	}
    	tt += b[i];
    	id2 = i;
    }
    ll ans = id1 + 1 + id2 + 1;
    while(id1 >= 0) {
    	tt -= a[id1];
    	id1--;
    	while(id2 < m-1 && tt + b[id2+1] <= k) {
    		tt += b[id2+1];
    		id2++;
    	}
    	ans = max(ans,id1+id2+2);
    }
    cout << ans;
    return 0;
}

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

const int maxn = 105;

bool vis[maxn];
int n, k;

int main(){
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    cin >> n >> k;
    for(int i = 1;i <= k;i++){
        int d;
        cin >> d;
        for(int j = 1;j <= d;j++){
            int x;
            cin >> x;
            vis[x] = 1;
        }
    }
    int ans = 0;
    for(int i = 1;i <= n;i++){
        if(!vis[i])
            ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3656
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <stack>
#include <vector>

using namespace std;

using Pair = pair<int, int>;
using lint = long long;

 const int mod = 1e9 + 7;
// const int mod = 998244353;

template <typename T> vector<T> make_v(size_t a) { return vector<T>(a); }

template <typename T, typename... Ts> auto make_v(size_t a, Ts... ts) {
  return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
int main(){
  int n;
  cin>>n;
  string s;
  cin >> s;
  vector<int> R(n,0), W(n,0);
  for (int i = 0;i< n;i++){
    if (i > 0) R[i] = R[i - 1];
    if (s[i] == 'W') R[i]++;
  }
  for (int i = n-1; i >= 0; i--) {
    if (i < n-1) W[i] = W[i + 1];
    if (s[i] == 'R') W[i]++;
  }
  int ret = mod;
  for (int i = -1; i < n; i++) {
    if(i==-1){
      chmin(ret, W[0]);
    }
    else if(i==n-1){
      chmin(ret, R[n - 1]);
    }
    else {
      chmin(ret, max(R[i], W[i + 1]));
    }
  }
  cout << ret << endl;
}


Measured memory_bytes: 5240
#include <stdio.h>
int main(){
	int n,m,x,a[101],i,c=0,cs=0;	
	scanf("%d %d %d",&n,&m,&x);
	for(i=0;i<m;i++){
			scanf("%d",&a[i]);
			if(a[i]<x)c=c+1;
			if(a[i]>x)cs=cs+1;
		}
	if(c>cs)c=cs;
	printf("%d\n",c);
  
	return 0;
}


Measured memory_bytes: 128
#include<stdio.h>
int main(void){
    int n;
    scanf("%d",&n);
    while(n--){
        int i;
        double x[5],y[5];
        for(i = 0; i < 4; i++){
            scanf("%lf%lf",&x[i],&y[i]);
        }
        if(x[0] == x[1] && x[2] == x[3])puts("YES");
        else if(y[0] == y[1] && y[2] == y[3])puts("YES");
        else if((y[0]-y[1])/(x[0]-x[1]) == (y[2]-y[3])/(x[2]-x[3]))puts("YES");
        else puts("NO");
    }
    return 0;
}

Measured memory_bytes: 620
def gcd(a, b):
    while b:
	    a, b = b, a % b
    return a

def lcm(a, b):
    return a * b // gcd (a, b)

n, k = list(map(int, input().split()))
a_list =[]
for i in range(n):
    cnt = 0
    tmp = i+1
    while tmp < k:
        tmp *= 2
        cnt += 1
    if i < k:
        a = n*2**cnt
    else:
        a = n
    a_list.append(a)
_lcm = a_list[0]
for i in range(1, n):
    _lcm = lcm(_lcm, a_list[i])
tmp = 0
for a in a_list:
    tmp += _lcm / a
print(tmp/_lcm)


Measured memory_bytes: 3864
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define vi vector<ll>
#define vvi vector<vi>
#define BITLE(n) (1LL<<((ll)n))
#define SHIFT_LEFT(n) (1LL<<((ll)n))
#define SUBS(s,f,t) ((s).substr((f)-1,(t)-(f)+1))
#define ALL(a) (a).begin(),(a).end()
#define EPS 1e-15
using namespace std;
ll dp[111][111][2];
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll l,k;cin>>l>>k;
  for(int i=0;i<111;i++)
    for(int j=0;j<111;j++)
      dp[i][j][0] = dp[i][j][1] = 0;
  dp[0][0][1] = 1;
  for(int i=0;i<l;i++){
    for(int j=0;j<l;j++){
      for(int kk=0;kk<2;kk++){
	if(kk == 0){
	  if(dp[i][j][1] > 0){
	    ///cout<<i<<" "<<j<<" "<<"black"<<endl;
	    dp[i+1][j+1][0] += dp[i][j][1];
	    if(j+k <= l){
	      dp[i+1][j+k][0] += dp[i][j][1];
	    }
	  }
	}else{
	  if(dp[i][j][0] > 0){
	    dp[i+1][j+1][1] += dp[i][j][0];
	  }
	}
      }
    }
  }
  ll ans = 0;
  for(int i=0;i<111;i++){
    for(int j=0;j<111;j++){
  
      ans += dp[i][j][0];
    }
  }
  cout<<ans<<endl;
  return 0;
}



Measured memory_bytes: 3404
#include <algorithm>
#include <bitset>
#include <complex>
#include <cstdio>
#include <cstdint>
#include <cassert>
#include <cmath>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;

using int64 = int64_t;

constexpr int64 MOD = 1000000007;

int N, M;
int64 xl[101010];
int64 yl[101010];

int64 calc(vector<int64>& v) {
    int64 ret = 0;
    int L = v.size();
    for (int j = 0; j < L; ++j) {
        ret = (ret + v[j] * (j+1) % MOD * (L-j)) % MOD;
    }
    return ret;
}

int main() {
    cin >> N >> M;
    for (int j = 0; j < N; ++j) { cin >> xl[j]; }
    for (int j = 0; j < M; ++j) { cin >> yl[j]; }

    vector<int64> dx;
    for (int j = 0; j < N-1; ++j) { dx.push_back(xl[j+1]-xl[j]); }
    vector<int64> dy;
    for (int j = 0; j < M-1; ++j) { dy.push_back(yl[j+1]-yl[j]); }

    cout << (calc(dx) * calc(dy)) % MOD << endl;

    return 0;
}


Measured memory_bytes: 4084
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using P = pair<int, int>;

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

constexpr int MOD = 1e9 + 7;
constexpr ll INF = 1e18;
constexpr double pi = acos(-1);
constexpr double EPS = 1e-10;

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

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

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

    vector<vector<ll>> dp(n+1, vector<ll>((1<<n), 0));
    dp[0][0] = 1;

    for(int bit=0; bit<(1<<n); bit++){
        int i = __builtin_popcount(bit);

        for(int j=0; j<n; j++){
            if(!(bit & (1<<j)) && a[i][j]){
                int nbit = bit | (1 << j);
                (dp[i+1][nbit] += dp[i][bit]) %= MOD;
            }
        }
    }

    cout << dp[n][(1<<n)-1] << endl;
}

Measured memory_bytes: 377216
#include <stdio.h>
#include <stdlib.h>

void main(void)
{
  int a,b,c,d;
  scanf("%d",&a);
  scanf("%d",&b);
  scanf("%d",&c);
  scanf("%d",&d);
  
  while(1){
    a-=d;
    c-=b;
    if(c<1){
      printf("Yes");
      break;
    }
    else if(a<1){
      printf("No");
      break;
    }
  }
}

Measured memory_bytes: 1720
#include <iostream>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cassert>
#include <algorithm>
#include <iterator>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <tuple>
#include <queue>
#include <stack>
#include <functional>
#include <utility>
#include <complex>
#include <bitset>
#include <numeric>
#include <random>
using namespace std;

//make_tuple emplace_back next_permutation
#define REP(i,n) for(int (i)=0; (i)<(n) ;++(i))
#define REPN(i,a,n) FOR((i),(a),(a)+(n))
#define FOR(i,a,b) for(int (i)=(a); (i)<(b) ;++(i))
#define PB push_back
#define MP make_pair
#define SE second
#define FI first
#define DBG(...) string s999=#__VA_ARGS__;replace(ALL(s999),',',' ');stringstream ds999; ds999<<s999; debug(ds999,__VA_ARGS__);
inline void debug(stringstream& ds){cerr<<endl;return;}
template<typename F, typename... R>void debug(stringstream& ds,const F& f, const R&... r){string n; ds>>n; cerr<< n <<' '<<f<<' '; debug(ds,r...);}
#define ALL(v) (v).begin(),(v).end()
#define SI(v) (int)(v).size()
typedef long long LL;  typedef pair<LL, LL> PLL; typedef vector<LL> VLL;
typedef pair<int,int>PI; typedef vector<int> VI;
const LL LINF=334ll<<53; const int INF=15<<26; const LL MOD=1E9+7;


//sum(a,b) = sum of [a,b)
//sum(a) = sum of [0,a)
template<typename T>
struct BIT{
    vector<T> bit;
    int size;
    BIT(int _size) : bit(vector<T>(_size+1,0)),size(_size){}
    void add(int index, T value){
        for(int i=index+1 ; i<=size ; i+=(i&-i)) bit[i]+=value;
    }
    T sum(int a,int b){//sum of[a,b)
        return sum(b)-sum(a);
    }
    T sum(int a){ // sum of[0,a) = sum of bit[0]~bit[a]
        T ret=0;
        for(int i= a ; i>0; i-=(i&-i)) ret+=bit[i];
        return ret;
    }
};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,k;
    cin >> n >> k;
    BIT<LL> a(n),pos(n),neg(n);
    REP(i,n) {
        int tmp;
        cin >> tmp;
        a.add(i,tmp);
        if(tmp>0) pos.add(i,tmp);
        if(tmp<0) neg.add(i,tmp);
    }
    LL ans=-LINF;

    REP(i,n-k+1){
        LL tmp=0;
        tmp=pos.sum(0,i)+pos.sum(i+k,n);
        ans=max(ans,tmp);
        tmp+=a.sum(i,i+k);
        ans=max(ans,tmp);
    }
    cout << ans<<endl;



    return 0;
}


Measured memory_bytes: 2560
// This amazing code is by Eric Sunli Chen.
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <vector>
using namespace std;
template<typename T> void get_int(T &x)
{
	char t=getchar();
	bool neg=false;
	x=0;
	for(; (t>'9'||t<'0')&&t!='-'; t=getchar());
	if(t=='-')neg=true,t=getchar();
	for(; t<='9'&&t>='0'; t=getchar())x=x*10+t-'0';
	if(neg)x=-x;
}
template<typename T> void print_int(T x)
{
	if(x<0)putchar('-'),x=-x;
	short a[20]= {},sz=0;
	while(x>0)a[sz++]=x%10,x/=10;
	if(sz==0)putchar('0');
	for(int i=sz-1; i>=0; i--)putchar('0'+a[i]);
}
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define get1(a) get_int(a)
#define get2(a,b) get1(a),get1(b)
#define get3(a,b,c) get1(a),get2(b,c)
#define printendl(a) print_int(a),puts("")
typedef long long LL;
typedef unsigned long long uLL;
typedef pair<int,int> pii;
const int inf=0x3f3f3f3f;
const LL Linf=1ll<<61;
const double pi=acos(-1.0);

int n,m,k;
int main()
{
	cin>>n>>m>>k;
	for(int i=0;i<=n;i++)for(int j=0;j<=m;j++)
	{
		if(i*m+j*n-i*j*2==k)
		{
			puts("Yes");
			return 0;
		}
	}
	puts("No");
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
constexpr int inf=1e9+7;
constexpr ll longinf=1LL<<60 ;
constexpr ll mod=1e9+7 ;

void solve(){
    int n;
    cin>>n;
    if(n==0)exit(0);

    int ans=0;
    vector<string> s(n);
    rep(i,n)cin>>s[i];
    int l=0,r=0;
    rep(i,n-1){
        if(l==0&&r==0&&s[i]=="lu"&&s[i+1]=="ru")++ans;
        if(l==0&&r==0&&s[i]=="ru"&&s[i+1]=="lu")++ans;
        if(l==1&&r==1&&s[i]=="ld"&&s[i+1]=="rd")++ans;
        if(l==1&&r==1&&s[i]=="rd"&&s[i+1]=="ld")++ans;
        if(s[i]=="lu")++l;
        if(s[i]=="ld")--l;
        if(s[i]=="ru")++r;
        if(s[i]=="rd")--r;
    }
    cout<<ans<<endl;
}

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


Measured memory_bytes: 3148
#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, val;
    cin >> n >> k;
    unordered_map<int, int> cnt;
    for(int i = 0; i < n; i++) {
        cin >> val;
        cnt[val] += 1;
    }
    if (cnt.size() <= k) {
        cout << 0 << endl;
    } else {
        map<int, vector<int>> rev_freq;
        for(auto p: cnt) {
            rev_freq[p.second].push_back(p.first);
        }
        int diff = cnt.size()-k;
        int ans = 0;
        for(auto p: rev_freq) {
            if (diff > p.second.size()) {
                diff -= p.second.size();
                ans += p.first *p.second.size();
            } else {
                ans += p.first * diff;
                cout << ans << endl;
                break;
            }
        }
    }

    return 0;
}



Measured memory_bytes: 10312
#include <iostream>

using namespace std;

void solve()
{
	int N;
	while(cin >> N, N)
	{
		int sum = 0;
		int n = N / 4;
		int temp;
		for(int i = 0; i < n; ++i)
		{
			cin >> temp;
			sum += temp;
		}
		cout << sum << endl;
	}
}

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

Measured memory_bytes: 0
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <numeric>
#include <cmath>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, k, n) for(int i = (k); i < (int)(n); i++)
using namespace std;
using ll = long long;

int main(){
    int N, cnt = 0, ans = 0, tmp = 0;
    int i;
    cin >> N >> i;
    ans = (N - i) + 1;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long N = sc.nextLong();
        long A = sc.nextLong();
        long B = sc.nextLong();
        long ans = 0;
        ans += N/(A+B)*A;
        ans += Math.min(A, N%(A+B));
        System.out.println(ans);
    }
}

Measured memory_bytes: 23764
#include <bits/stdc++.h>
using namespace std;
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp> 
// using namespace __gnu_pbds;
#define ordered_set tree<pair<int,int>, null_type,less<pair<int,int> >, rb_tree_tag,tree_order_statistics_node_update>
#define standardVar ll n,m,i,j,k,num,num1,num2,flag=0
#define nn <<"\n"
#define __ <<" "<<
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define ittr(x,v) for(auto x=v.begin();x!=v.end();x++)
#define itr(x,n) for(x=0;x<n;x++)
#define itrab(x,a,b) for(x=a;x<b;x++)
#define itpr(v) ittr(x,v)cout<<*x<<" "; cout nn
#define itppr(v) ittr(x,v)cout<<(*x).ff<<" "<<(*x).ss<<"  "; cout nn
#define size(x) (ll)x.size()
#define pi 3.14159265359
#define dTor(x) ((x)*pi)/180.0
#define INF 1000000100;
#define INFF 1000000000000000100;

typedef long long int ll;       //TYPEDEFS
typedef long double ld;
typedef vector<ll> vl;
typedef map<ll,ll> ml;
typedef set<ll> sl;
typedef string str;
typedef pair<ll, ll> pl;
typedef vector< pl > vpl;
typedef map<pl,ll> mpl;
typedef set< pl > spl;
typedef vector<str> vst;
typedef vector<vl> vvl;

const ll M=1000000007;          //COMMON MODULO PRIMES
const ll N=998244353;

ll power(ll x, ll y, ll p){     //MODULAR EXPONENTIATION
    ll res=1;
    x=x%p;
    if(x==0)
        return 0;
    while(y>0){
        if(y&1)
            res=(res*x)%p;
        y=y>>1;
        x=(x*x)%p;
    }
    return res;
}
ll inv(ll x, ll m){             //FERMAT INVERSE
    return power(x,m-2,m);
}
struct comp{                    //COMPARISON ON PAIRS
    template<typename T>        
    bool operator()(const T &a, const T &b){
        if (a.ff==b.ff)
            return (a.ss<b.ss);
        else
            return (a.ff<b.ff);
    }
};
bool mod(const pair<ll,ll> &a, const pair<ll,ll> &b){   //COMPARATOR FOR PAIRS (SORTING)
    if(a.ff!=b.ff)
        return (a.ff>b.ff);
    else
        return (a.ss>b.ss);
}
vector<bool> pr(1000000+1,1);
void sieve(ll mn, ll mx){       //SIEVE OF ERATOSTHENES
    for(ll i=mn;i*i<=mx;i++)
        if(pr[i-mn]==1)
            for(ll j=i*i;j<=mx;j+=i)
                pr[j-mn]=0;
}
bool isValid(ll i, ll j, ll n, ll m){   //CHECKS FOR OVERFLOW
    if(i>=0&&i<n&&j>=0&&j<m){
        return true;
    }
    return false;
}

//MAIN FUNCTION STARTS HERE

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    standardVar;
    str s;
    cin>>s;
    ll len=0;
    ll mx=-1;
    itr(i,size(s)){
        if(s[i]=='R'){
            len++;
        }
        else{
            mx=max(mx,len);
            len=0;
        }
    }
    mx=max(mx,len);
    cout<<mx nn;
    return 0;
}

Measured memory_bytes: 3664
#include<bits/stdc++.h>
using namespace std;
string s;
int ans,l,r,n,k,cnt;

int main()
{
	cin >> n >> k >> s;
	for(;r < s.size(); r++){
		if(s[r]=='0'){
			if(r==0 || s[r-1]=='1') cnt++;
		}
		if(cnt > k){
			while(l < s.size() && s[l]=='1') l++;
			while(l < s.size() && s[l]=='0') l++;
			cnt--;
		}
		ans=max(ans,r-l+1);
	}
	cout << ans << endl;
	return 0;
}

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

int main(){
    int N;
    cin >> N;
    char tmp;
    for (int i = 0; i < N; ++i){
        cin >> tmp;
        if (tmp == 'Y'){
            cout << "Four" << endl;
            return 0;
        }
    }
    cout << "Three" << endl;
    return 0;
}

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

using namespace std;

int main(){
    int N;
    cin >> N;
    vector<string> S(N);
    vector<int> T(N);
    int sumT = 0;
    for(int i = 0; i < N; ++i){
        string s;
        int t;
        cin >> S[i] >> T[i];
        sumT += T[i];
    }
    string X;
    cin >> X;
    int tmp = 0;
    for(int i = 0; i < N; ++i){
        if(S[i] != X){
            tmp += T[i];
        }else{
            tmp += T[i];
            break;
        }
    }
    cout << sumT - tmp << endl;




    return 0;
}

Measured memory_bytes: 256