akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size)
#define MOD 1000000007
const long long mod = 1e9+7;
typedef vector<long long> Vl;
typedef vector<double> VI;  // VI a(n);
typedef vector<string> VS;  
typedef vector<VS> VSS;  
typedef vector<VI> VVI;   // VVI a(n,vector<int>(m)) n * m 
typedef vector<Vl> VVl;
typedef pair<int, int> PII;
typedef long long ll;  //ll とdoubleは違う
// cout << << endl;
// cin >> ;
int main(){
    ll a,b,c=0,d=0,n,m1,n2,m2,min=100000,k=0,ans=0;
    string s,s2;
    cin >> a >> b >> c >> n;
    for(int i=0;i<=a;i++){
        for(int j=0;j<=b;j++){
            for(int k=0;k<=c;k++){
                if(n == 500*i + 100*j + 50*k)
                    ans++;
            }
        }
    }
    cout << ans <<endl; 
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (long long i = j; i < (long long)(n); i++)
#define _GLIBCXX_DEBUG
#define MOD 1000000007
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; }
//name[i][j]-> vvl name(i,vl(j))
//map<int,int>mp
//余りを切り上げる =>  (a + b - 1) / b 

signed main(){
	ll n; cin>>n;
	ll cnt=0;
	string s=to_string(n);
	int m=s.size();
	rep(i,0,m){
		cnt+=ll(s[i]-'0');
	}
	//cout<<cnt<<endl;
	if(n%cnt==0)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 3684
import math

D,G = map(int,input().split())
pc = [list(map(int,input().split())) for i in range(D)]

digit = '0'+str(D)+'b'
rangeEnd = 2**D
minimam = float('INF')
for i in range(rangeEnd):#完答パターンごとのループ
  pattern = list(str(format(i,digit)))
  point = 0 #獲得ポイント初期化
  count = 0 #initialize the problem counter
  tmp = -1
  for j in range(D):
    if pattern[j]=="1":
      p = pc[j][0]
      c = pc[j][1]
      point += p*100*(j+1)+c
      count += p
    else:
      tmp = j #store the maximam problem number remaining
  r = G - point
  if r > 0 and tmp >- 1:#there are neccery points still.
    countTmp = math.ceil(r/(100*(tmp+1)))
    if countTmp < pc[tmp][0]:
      count += countTmp
    else:
      continue
  minimam = min(count, minimam)
  
print(minimam)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define REP(i, n) for(long long i=0; i<n; i++)
#define REPR(i, n) for(long long i=n-1; i>=0; i--)
#define FOR(i, m, n) for(long long i=m; i<=n; i++)
#define FORR(i, m, n) for(long long i=m; i>=n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.rbegin(), v.rend());
#define ALL(v) (v).begin(),(v).end()
#define FIN ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;
const ll mod = 1e9+7;
const ll inf = 1e15;



int main(){FIN

    ll n;cin>>n;
    vll h(n,0);
    ll ans=0;
    REP(i,n){
        cin>>h[i];
        if(i>0 && h[i]<h[i-1]) ans+= -(h[i]-h[i-1]);
        // cout<<ans<<endl;
    }
    ans += h[n-1];
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 384
/*
	Name: 
	Copyright: 
	Author: 
	Date: 12/01/19 21:42
	Description: 这种做法的本质思路，有点接近于数值计算，数值分析里的编程设计思路，通过对要计算的表达式的改造来实现精度控制。

19:18 2019/1/17终于AC了，为什么各种不对劲，就是判断先后 
*/

#include <cstdio>
#include <cmath>
#include <stdbool.h>
#include <cstring>
int main(){
	int N, A, B;
	long long num;
	scanf("%d %d %d", &N, &A, &B); 
    if(B < A) {
		printf("0\n");
		return 0;
	}
	if(N == 1){
		if(A == B){ 
			printf("1\n");
			return 0;
		}
		else {
			printf("0\n");
			return 0;
		}
	}	
	
	num = (long long)(B - A)*(N-2)+1;
	printf("%lld\n", (long long)(B - A)*(N-2)+1);
	return 0;	
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i,n) for (int i = (0); i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define show(x) cout << #x << " = " << (x) << endl
#define show2(x,y) cout << #x << " = " << (x) << ", " << #y << " = " << (y) << endl
#define show3(x,y,z) cout << #x << " = " << (x) << ", " << #y << " = " << (y) <<  ", " << #z << " = " << (z) << endl
#define showv(v) rep(i,v.size()) printf("%d%c", v[i], i==v.size()-1?'\n':' ')
#define showv2(v) rep(j,v.size()) showv(v[j])
#define showt(t,n) rep(i,n) printf("%d%c", t[i], i==n-1?'\n':' ')
#define showt2(t,r,c) rep(j,r) showt(t[j],c)
#define showvp(p) rep(i,p.size()) printf("%d %d\n", p[i].first, p[i].second);
#define printv(v) rep(i,v.size()) printf("%d\n", v[i])
#define printt(t,n) rep(i,n) printf("%d\n", t[i])
#define incl(v,x) find(rng(v),x)!=v.end()
#define incls(s,c) s.find(c)!=string::npos
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define bit(n,k) ((n>>k)&1) // nのk bit目
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vs = vector<string>;
using P = pair<int, int>;
using T = tuple<int, int, int>;
using vp = vector<P>;
using vt = vector<T>;
const int mod = 1000000007;
const double EPS = 1e-9;
//const long double EPS = 1e-14;
const int INF = (1<<30)-1;
//const ll INF = (1LL<<62)-1;
#define dame { puts("No"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
inline int in() { int x; scanf("%d",&x); return x;}
//template<class T = int> inline T in() { T x; cin >> x; return (x);}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

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

  map<char,int> cnt;
  rep(i,n) {
    string s;
    cin >> s;
    cnt[s[0]]++;
  }

  ll ans = 0;
  string t = "MARCH";
  int nt = sz(t);
  for (int i = 0; i < nt; ++i) {
    for (int j = i+1; j < nt; ++j) {
      for (int k = j+1; k < nt; ++k) {
        char ci = t[i];
        char cj = t[j];
        char ck = t[k];
        ans += (ll)cnt[ci]*cnt[cj]*cnt[ck];
      }
    }
  }

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define debug(x) cerr<<#x<<'='<<x<<' '
typedef long long ll;
typedef pair<int,int> pi;

const int MOD = 1e9+7;

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int N,M;
    cin >> N >> M;
    vector<vector<char> > grid(N+5,vector<char>(M+5));
	for (int i = 1; i <= N; i++) {
		for (int j = 1; j <= M; j++) {
			cin >> grid[i][j];
		}
	}
	vector<vector<int> > dp(N+5,vector<int>(M+5));
	dp[1][1] = 1;
	for (int i = 1; i <= N; i++) {
		for (int j = 1; j <= M; j++) {
			if (grid[i][j] == '#') continue;
			//if (grid[i-1][j] != '#') {cnt += dp[i-1][j]; cnt %= MOD;}
			//if (grid[i][j-1] != '#') {cnt += dp[i][j-1]; cnt %= MOD;}
			dp[i][j] += dp[i-1][j] + dp[i][j-1];
			dp[i][j] %= MOD;
		}
	}
	//for (int i = 1; i <= N; i++) {
		//for (int j = 1; j <= M; j++) {
			//cout << dp[i][j] << ' ';
		//}
		//cout << endl;
	//}
	cout << dp[N][M];
    return 0;
}


Measured memory_bytes: 5248
#include <stdio.h>

int main(void) {
	int S, h, m, s;
	scanf("%d", &S);
	h=S/3600;
	m=(S%3600)/60;
	s=S-h*3600-m*60;
	printf("%d:%d:%d\n", h, m, s);
	return 0;
}


Measured memory_bytes: 2036
import math
N = []
las = []
dic = {}
_time = 0
for i in range(5):
    n = input()
    diff = 10 - int(n[-1])
    if diff != 10:
        N.append((diff, int(n)))
    else:
        N.append((int(n[-1]), int(n)))
N.sort()
for i, n in enumerate(N):
    _time += n[1]
    if i != len(N) - 1:
        _time = math.ceil(_time / 10) * 10
print(_time)


Measured memory_bytes: 38512
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pli = pair<ll, int>;
using pil = pair<int, ll>;
using pdd = pair<double, double>;
using uint = unsigned int;
template <typename T>
using Graph = vector<vector<T>>;
const int MOD = 1e9 + 7;
const ld PI = acosl(-1);

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

    int H, W;
    cin >> H >> W;
    vector<vector<int>> A(H + 1, vector<int>(W + 1));
    vector<vector<int>> B(H + 1, vector<int>(W + 1));
    for (int i = 0; i < H; ++i)
        for (int j = 0; j < W; ++j)
            cin >> A[i][j];
    for (int i = 0; i < H; ++i)
        for (int j = 0; j < W; ++j)
            cin >> B[i][j];

    static bool dp[80][80][12805];
    dp[0][0][abs(A[0][0] - B[0][0])] = true;
    for (int i = 0; i < H; ++i) {
        for (int j = 0; j < W; ++j) {
            int tmp1 = abs(A[i + 1][j] - B[i + 1][j]);
            int tmp2 = abs(A[i][j + 1] - B[i][j + 1]);
            for (int k = 0; k <= (i + j + 2) * 80; ++k) {
                if (dp[i][j][k]) {
                    if (i + 1 < H)
                        dp[i + 1][j][k + tmp1] = dp[i + 1][j][abs(k - tmp1)] = true;
                    if (j + 1 < W)
                        dp[i][j + 1][k + tmp2] = dp[i][j + 1][abs(k - tmp2)] = true;
                }
            }
        }
    }

    for (int i = 0; i <= 12800; ++i) {
        if (dp[H - 1][W - 1][i]) {
            cout << i << endl;
            return 0;
        }
    }

    return 0;
}


Measured memory_bytes: 67348
#include <cstdio>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <set>

struct Node {
  std::vector<int> next;
  int inbound_degree{0};
  int max_depth{-1};
  int parent{-1};
};
void dfs(int root, std::vector<Node> &nodes) {
  if (nodes[root].max_depth != -1) {
    return;
  }
  nodes[root].max_depth = 0;
  for (auto to : nodes[root].next) {
    dfs(to, nodes);
    nodes[root].max_depth = std::max(nodes[root].max_depth, nodes[to].max_depth + 1);
  }
}
void dfs2(int root, int from, std::vector<Node> &nodes) {
  if (nodes[root].parent != -1) {
    return;
  }
  nodes[root].parent = from;
  std::sort(nodes[root].next.begin(), nodes[root].next.end(),
            [&](const auto &a, const auto &b) { return nodes[a].max_depth > nodes[b].max_depth; });
  for (auto to : nodes[root].next) {
    dfs2(to, root + 1, nodes);
  }
}
int main(void) {
  int n, m;
  while (scanf("%d%d", &n, &m) == 2) {
    std::vector<Node> nodes(n);
    for (int i = 0; i < n - 1 + m; i++) {
      int a, b;
      scanf("%d%d", &a, &b);
      a--, b--;
      nodes[a].next.push_back(b);
      nodes[b].inbound_degree++;
    }
    int root = 0;
    for (int i = 0; i < n; i++) {
      if (nodes[i].inbound_degree == 0) {
        root = i;
      }
    }
    dfs(root, nodes);
    dfs2(root, 0, nodes);
    for (int i = 0; i < n; i++) {
      printf("%d\n", nodes[i].parent);
    }
  }
  return 0;
}


Measured memory_bytes: 14080
// B.

#include <iostream>
#include <sstream>
#include <algorithm>
#include <vector>

using namespace std;

int main(int argc, char *argv[]) {
	int n;
	cin >> n;
	string s;
	cin >> s;
	string t = s.substr(0, n / 2) + s.substr(0, n / 2);
	string ans = s == t ? "Yes" : "No";
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
        int S,h,m,s;

        cin>>S;

        h = S / 3600;
        m = (S-h * 3600) / 60;
        s = S-h*3600-m*60;

        cout<<h<<":"<<m<<":"<<s<<"\n";
}

Measured memory_bytes: 1164
import math
import collections


def comb(n, r):
    mf = math.factorial
    return mf(n) // (mf(n - r) * mf(r))


n = int(input())
s = [''.join(sorted(list(input()))) for _ in range(n)]
c = collections.Counter(s)
print(sum(comb(a, 2) for a in c.values() if a > 1))

Measured memory_bytes: 19800
module.exports=function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=0)}([function(t,e,n){"use strict";var r=n(1),i=new(n(2))(r.readFileSync("/dev/stdin","utf8").split(/\s+/g));n(4)(i)},function(t,e){t.exports=require("fs")},function(t,e,n){"use strict";var r=n(3);t.exports=class{constructor(t){this.inp=new r(t)}n(){return this.inp.deq()}ni(){return parseInt(this.inp.deq(),10)}add(t){this.inp.enq(t)}}},function(t,e,n){"use strict";t.exports=class{constructor(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.size=t.length,this.items=t,this.ind=0}enq(t){this.size+=1,this.items.push(t)}deq(){var t=this.items[this.ind];return this.size-=1,this.ind+=1,t}}},function(t,e,n){"use strict";t.exports=function(t){t.ni()<t.ni()?console.log(0):console.log(10)}}]);

Measured memory_bytes: 22964
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define ALL(a)  (a).begin(),(a).end()
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
  string s;
  cin >> s;
  int ans = 1000;
  rep(i, s.length() - 2){
    ans = min(abs(stoi(s.substr(i,3)) - 753), ans);
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
table = [[0, 1, 2], [3, 4, 5], [6, 7, 8], [0, 3, 6], [1, 4, 7], [2, 5, 8],
         [0, 4, 8], [2, 4, 6]]
check = ->(field, type) {
  table.each do |pat|
    return true if pat.map {|i| field[i] == type}.all?
  end
  false
}
game = ->(field, left) {
  if check.(field, "o")
      "o"
  elsif check.(field, "x")
      "x"
  else
    nxt = (left.size % 2).zero? ? "x" : "o"
    try = ->(f) {
      left.each do |pos|
        table[pos] = nxt
        a = f.()
        return a if a
        table[pos] = "s"
      end
    }
    try.(->{ check.(table, left.reject {|i| i == pos}) })
    try.(->{ game .(table, left.reject {|i| i == pos}) })
    false
  end
}
         
$<.readlines.map(&:chomp).map(&:chars).each do |field|
  left = field.map {|i| i == "s" ? i : nil}.compact
  result = game.(field, left)
  puts result ? result : "d"
end


Measured memory_bytes: 6884
from collections import defaultdict
import sys
input = lambda: sys.stdin.readline().rstrip()

M = 998244353
B = pow(10, 18, M)
N = int(input())

def geometric_mod(a, r, m, n):
  x = a
  for i in range(n):
    yield x
    x = (x*r)%m

BB = list(geometric_mod(1, B, M, N+2))

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

def inv_mod(a, b, m):
  x, y = ext_euc(a, m)
  return (x * b % m)

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

def calc_grundy(e):
  g = {}
  sum_g = defaultdict(int)
  for i in range(N, 0, -1):
    if i not in e:
      continue
    m = mex({g.get(j, 0) for j in e[i]})
    if m:
      g[i] = m
      sum_g[g[i]] = (sum_g[g[i]] + BB[i]) % M
      sum_g[0] = (sum_g[0] + BB[i]) % M
  sum_g[0] = (inv_mod(B-1, pow(B, N+1, M)-B, M) - sum_g[0]) % M
  return sum_g

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

def solve(N, edge):
  sum_g = list(map(calc_grundy, edge))
  ret = 0
  for gx, sx in sum_g[0].items():
    for gy, sy in sum_g[1].items():
      gz = gx^gy
      sz = sum_g[2][gz]
      if sz:
        ret = (ret + sx*sy*sz) % M
  return ret


edge = [read_edge() for i in range(3)]

print(solve(N, edge))

Measured memory_bytes: 113056
#include<cmath>
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<cstring>
#include<stack>
#include<vector>
#include<string.h>
#include<string>
#include<iomanip>
#include <sstream>
#include<map>
#include<complex>
#include<set>
using namespace std;
#define rep(i,t,n)  for(ll i =(t);i<=(n);++i)
#define per(i,n,t)  for(int i =(n);i>=(t);--i)
#define mmm(a,b) memset(a,b,sizeof(a))
#define pb push_back
#define Decimal fixed<<setprecision(20)
#define debug(x) cerr<<#x<<":"<<x<<endl
#define FAST_IO ios::sync_with_stdio(0); cin.tie(0)
typedef long long ll;
const ll mod = 1e9 + 7;
const int maxn = 2e3 + 5;
typedef double db;
const db pi = acos(-1.);


const int N = 10;

int main() {
	FAST_IO;
	double a, b, x;
	cin >> a >> b >> x;
	db lim = a * b/2;
	x /= a;
	if(x<=lim)
	cout << Decimal << atan2( b, x * 2 / b)/pi*180 << endl;
	else{
		x -= lim;
		x /= a; x *= 2;
		cout << Decimal << atan2(b-x, a) / pi * 180 << endl;
	}
	cin >> x;
}         
/*
2
A 0 0 2
B 1 0 2


*/


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int (i)=0;(i)<(n);i++)
#define INF 1001001001
#define LLINF 1001001001001001001
#define MOD 1000000007
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define ALL(v) v.begin(), v.end()
typedef long long ll;



int main(){
ll r,g;cin>>r>>g;
cout << g*2-r << endl;


    return 0;
}





Measured memory_bytes: 256
#include <bits/stdc++.h>
#define endl '\n'
#define fast ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define zy -2147382637
#define bql 2147483647
#define ll long long
#define ull unsigned long long
#define ld long double
#define il inline
#define sz(x) x.size()
#define maxn 100010
#define rp(i, l, r) for (int i = l; i <= r; i++)
#define rb(i, r, l) for (int i = r; i >= l; i--)
#define fi first
#define se second
#define pb push_back
#define mp make_pair

using namespace std;
ll max(ll a,ll b){if(a>b)return a;else return b;}
ll min(ll a,ll b){if(a<b)return a;else return b;}
ll lowbit(ll x){return x&(-x);}
ll prime(ll x){
   if(x<=1)return false;
   for(int i=2;i<=int(sqrt(x));i++){
	   if(x%i==0)return false;
   }return true;
}
bool cmp(ll a,ll b){return a>b;}
ll gcd(ll a,ll b){ll r;while(b>0){r=a%b;a=b;b=r;}return a;}
ll powmod(ll a,ll b,ll mod) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
inline ll read() {
	char c = getchar(); ll w = 1; ll x = 0;
	while (!isdigit(c))
		(c == '-') && (w = -w), c = getchar();
	while (isdigit(c))
		x = (x << 1) + (x << 3) + (c ^ '0'), c = getchar();
	x *= w;
}
void fl(string name){
	freopen((name+".in").c_str(),"r",stdin);
	freopen((name+".out").c_str(),"w",stdout);
}
const ll MAXN=2e5+10;
ll sum[MAXN],dp[MAXN],a[MAXN],n;
int main(){
	cin>>n;
	for(int i=1;i<=n;i++)cin>>a[i];
	sum[1]=a[1];
	for(int i=3;i<=n;i+=2){
		sum[i]=sum[i-2]+a[i];
	}
	for(int i=2;i<=n;i++){
		if(i%2==1){
			dp[i]=max(dp[i-1],dp[i-2]+a[i]);
		}
		else dp[i]=max(sum[i-1],dp[i-2]+a[i]);
	}
	cout<<dp[n]<<endl;
	return 0;

}

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

typedef long long LL;
const int MX = 1e5+7, N = 105;
const LL INF = 1e18;
LL dp[N][MX];


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

    for (int i=0; i<=n; i++)
        for (int j=0; j<MX; j++)
            dp[i][j] = INF;

    dp[0][0] = 0;

    int ans = 0;
    for (int i=1; i<=n; i++) {
        for (int j=0; j<MX; j++)    dp[i][j] = dp[i-1][j];
        int x, v;
        cin>>x>>v;
        for (int j=v; j<MX; j++) {
            dp[i][j] = min(dp[i][j], dp[i-1][j-v] + x);
            if (dp[i][j] <= w)  ans = max(ans, j);
//            cout<<"--->"<<i<<" "<<j<<" "<<dp[i][j]<<endl;
        }
    }
    cout<<ans<<endl;

}



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

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

	int n, x, y;
	cin >> n >> x >> y;
	vector<int> cnt(n);
	for (int i = 1; i <= n; ++i)
		for (int j = i + 1; j <= n; ++j)
			cnt[min({j - i, abs(x - i) + abs(j - y) + 1, abs(y - i) + abs(j - x) + 1})]++;
	for (int i = 1; i < n; ++i)
		cout << cnt[i] << '\n';
	return 0;
}

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

int main(){
  for(;;){
    int n;
    cin>>n;
    if(n==0) break;
    vector<int> a;
    for(int i=0;i<n;i++){
      int dummy;
      cin>>dummy;
      a.push_back(dummy);
    }

    sort(a.begin(),a.end());

    int min=10000000;
    for(int i=0;i<n-1;i++){
      int diff=a[i+1]-a[i];
      if(diff<min) min=diff;
    }
    cout<<min<<endl;
  }
}


Measured memory_bytes: 3080
#include <stdio.h>

int main(){
 int num[5];
 scanf("%d %d %d %d %d", &num[0], &num[1], &num[2], &num[3], &num[4]);

 for(int i = 0; i < 5; i++){
  if(num[i] == 0){
    printf("%d\n", i+1);
  }
 }

 return 0;
}


Measured memory_bytes: 3076
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<string>
#define MOD 1000000007
typedef long long ll;
using namespace std;

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    const double pi = 3.14159265358979323846;
    double r; cin >> r;
    double ans = 2 * r * pi;
    printf("%.12f\n",ans);
    return 0;
}

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

int main(){
  int N;
  string S;
  cin >> N;
  cin >> S;
  int ans = 0;
  for(int a=0;a<10;a++) for(int b=0;b<10;b++) for(int c=0;c<10;c++){
    int abc[] = {a,b,c};
    int count = 0;
    for(int i=0; i<N; i++){
      int num = S[i] - '0';
      if(num == abc[count]){
        count++;
        if(count == 3){
          ans++;
          break;
        }
      }
    }
  }
  cout << ans;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
#define ld long double
#define inf LLONG_MAX>>2
#define MAX 1000000
#define mod 1000000007
#define pb push_back
#define f(i,a,n,x) for ((i)=(a);(i)<(n);(i)+=(x))
#define fd(i,a,n,x) for ((i)=(a);(i)>=(n);(i)-=(x))
#define fi first
#define se second
#define mk make_pair
#define pi pair
#define vt vector
using namespace std;
void read(vt<ll> &a,ll n){ll i,temp;f(i,0,n,1){cin>>temp;a.pb(temp);}}
void solve(){
    ll k,i,j;
    string n,m="0";
    vt<ll> dislike;
    cin>>n>>k;
    m=m+n;
    read(dislike,k);
    fd(i,m.length()-1,1,1)
        while(find(dislike.begin(),dislike.end(),m[i]-'0')!=dislike.end()){
            j=i;
            if (m[j]!='9'){
                m[j]=((m[j]-'0'+1)%10)+'0';
                f(j,j+1,m.length(),1)
                    m[j]='0';
                i=m.length()-1;
            }
            else{
                while(m[j]=='9'){
                    m[j]='0';
                    j--;
                }
                m[j]=((m[j]-'0'+1)%10)+'0';
                i=m.length()-1;
            }
        }
    if (m[0]!='0'){
        while(find(dislike.begin(),dislike.end(),m[0]-'0')!=dislike.end()){
            m[0]=((m[0]-'0'+1)%10)+'0';
        }
        f(j,1,m.length(),1)
            m[j]='0';
        fd(i,m.length()-1,1,1)
            while(find(dislike.begin(),dislike.end(),m[i]-'0')!=dislike.end()){
                j=i;
                if (m[j]!='9'){
                    m[j]=((m[j]-'0'+1)%10)+'0';
                    f(j,j+1,m.length(),1)
                        m[j]='0';
                    i=m.length()-1;
                }
                else{
                    while(m[j]=='9'){
                        m[j]='0';
                        j--;
                    }
                    m[j]=((m[j]-'0'+1)%10)+'0';
                    i=m.length()-1;
                }
            }
    }
    if (m[0]!='0')
        cout<<m<<endl;
    else
        cout<<m.substr(1)<<endl;
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll t=1;
    //cin>>t;
    while(t--)
        solve();
    return 0;
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define erep(i,a,b) for(int i=a;i<=(int)(b);++i)
#define per(i,a,b) for(int i=(b);i>(a);--i)
#define eper(i,a,b) for(int i=((int)(a));i>=b;--i)
#define pb push_back
#define mp make_pair
#define INF (1<<28)-1
#define MOD 1000000007
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a, b)*b;}

template<class Abel> struct UnionFind {
    vector<int> par;
    vector<int> rank;
    vector<Abel> diff_weight;

    UnionFind(int n = 1, Abel SUM_UNITY = 0) {
        init(n, SUM_UNITY);
    }

    void init(int n = 1, Abel SUM_UNITY = 0) {
        par.resize(n); rank.resize(n); diff_weight.resize(n);
        for (int i = 0; i < n; ++i) par[i] = i, rank[i] = 0, diff_weight[i] = SUM_UNITY;
    }

    int root(int x) {
        if (par[x] == x) {
            return x;
        }
        else {
            int r = root(par[x]);
            diff_weight[x] += diff_weight[par[x]];
            return par[x] = r;
        }
    }

    Abel weight(int x) {
        root(x);
        return diff_weight[x];
    }

    bool issame(int x, int y) {
        return root(x) == root(y);
    }

    bool merge(int x, int y, Abel w) {
        w += weight(x); w -= weight(y);
        x = root(x); y = root(y);
        if (x == y) return false;
        if (rank[x] < rank[y]) swap(x, y), w = -w;
        if (rank[x] == rank[y]) ++rank[x];
        par[y] = x;
        diff_weight[y] = w;
        return true;
    }

    Abel diff(int x, int y) {
        return weight(y) - weight(x);
    }
};
int main() {
 ios::sync_with_stdio ( false );
 cin.tie ( 0 );
    int n, m;
    cin >> n >> m;
    UnionFind<int> uf(n);
    rep(i, 0, m) {
        int l, r, d;
        cin >> l >> r >> d;
        --l, --r;
        if (uf.issame(l, r)) {
            int diff = uf.diff(l, r);
            if (diff != d) {
                cout << "No" << endl;
                return 0;
            }
        } else {
            uf.merge(l, r, d);
        }
    }
    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

int n,m;
vvi g,a;
vi vis;

bool dfs(int v,int pre=-1){
	vis[v]++;
	for(auto u:g[v]) if(u!=pre){
		if(vis[u]) a[u].push_back(v);
		else if(dfs(u,v)) a[v].push_back(u);
	}
	int N=a[v].size();
	for(int i=0;i<N/2*2;i++) cout<<v+1<<' '<<a[v][i]+1<<endl;
	if(N%2==1){
		cout<<v+1<<' '<<a[v].back()+1<<endl;
		cout<<v+1<<' '<<pre+1<<endl;
		return 0;
	}
	return 1;
}

int main(){
	cin>>n>>m;
	if(m%2==1){
		cout<<-1<<endl;
		return 0;
	}
	vis=vi(n);
	g=a=vvi(n);
	for(int i=0;i<m;i++){
		int u,v;
		cin>>u>>v;
		u--;v--;
		g[u].push_back(v);
		g[v].push_back(u);
	}
	dfs(0);
}

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

struct Point {double x,y;};


void koch(int d, Point p1, Point p2){
  if (d==0) return ;

  Point s,t,u;
  double th = M_PI *60.0/180.0;

  s.x = (2 * p1.x + p2.x)/3;
  s.y = (2 * p1.y + p2.y)/3;
  t.x = (p1.x + p2.x * 2)/3;
  t.y = (p1.y + p2.y * 2)/3;
  u.x = s.x + (t.x-s.x)*cos(th)-(t.y-s.y)*sin(th);
  u.y = s.y + (t.x-s.x)*sin(th)+(t.y-s.y)*cos(th);

  koch(d-1, p1,s);
  cout<<s.x<<" "<<s.y<<endl;
  koch(d-1, s,u);
  cout<<u.x<<" "<<u.y<<endl;
  koch(d-1, u,t);
  cout<<t.x<<" "<<t.y<<endl;
  koch(d-1,t,p2);
}

int main(){
  Point a,b;
  int n;
  cin>>n;

  a.x=0;
  a.y=0;
  b.x =100;
  b.y=0;
  cout<<a.x<<" "<<a.y<<endl;
  koch(n,a,b);
  cout<<b.x<<" "<<b.y<<endl;

}



Measured memory_bytes: 3212
from collections import Counter
N = int(input())

A = list(map(int, input().split()))
if all(a == 0 for a in A):
        print('Yes')
elif N % 3:
    print('No')
else:
    n = N//3
    CA = Counter(A)
    ans = 'Yes'
    t = []
    for k, v in CA.items():
        if not v % n:
            t.append(k)
        
    if len(t) == 3 and (t[0]^t[1] == t[2] and t[2]^t[1] == t[0] and t[0]^t[2] == t[1]):
        ans = 'Yes'
    elif len(t) == 2 and (t[0] == 0 or t[1] == 0):
        ans = 'Yes'
    else:
        ans = 'No'
        
    print(ans)

Measured memory_bytes: 60784
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define ve vector
#define chmin(x,y) x = min(x,y)

int main(){
    ll n,m;
    cin >> n >> m;
    
    ve<ve<ll>> a(4,ve<ll>(n));
    rep(i,n){
        ll x,y,z;
        cin >> x >> y >> z;
        a[0][i] = x+y+z;
        a[1][i] = x+y-z;
        a[2][i] = x-y+z;
        a[3][i] = x-y-z;
    }
    rep(i,4)sort(a[i].begin(), a[i].end());
    
    ll ans = 0;
    rep(i,4){
        ll me1 = 0, me2 = 0;
        rep(j,m){
            me1 += a[i][j];
            me2 += a[i][n-1-j];
        }
        ans = max(ans,abs(me1));
        ans = max(ans,abs(me2));
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3688
ans = ('YYMM', 'MMYY', 'AMBIGUOUS', 'NA')

s = input()

if (1 <= int(s[0:2]) and int(s[0:2]) <= 12) and (1 <= int(s[2:4]) and int(s[2:4]) <= 12):
    print(ans[2])
elif 1 <= int(s[0:2]) and int(s[0:2]) <= 12:
    print(ans[1])
elif 1 <= int(s[2:4]) and int(s[2:4]) <= 12:
    print(ans[0])
else:
    print(ans[3])


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

int main () {
  int N , Y , ans = 0 ;
  cin >> N >> Y ;
  for(int i = 0 ; i <= N ; i++ ){
    for(int j = 0 ; j <= N - i ; j++ ){
      int k = N - i - j ;
        if( 10000 * i + 5000 * j + 1000 * k == Y ) {
          cout << i << ' ' <<j <<' ' << k << endl ;
          return 0 ;
        }
    }
  }
  cout << -1 << ' ' <<-1 <<' ' << -1 << endl ;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<functional>
#include<math.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pf(n) printf("%d\n",n)
#define pff(a,b) printf("%d  %d\n",a,b);
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = 1001001001;
const double PI = acos(-1);

int main() {
	int n, m, c;
	cin >> n >> m >> c;
	int b[20];
	rep(i, m) cin >> b[i];
	int a[20][20];
	rep(i, n)rep(j, m) cin >> a[i][j];

	int cnt = 0;
	rep(i, n) {
		int num = 0;
		rep(i2, m) {
			num += a[i][i2] * b[i2];
		}
		num += c;
		if (num > 0) cnt++;
	}
	pf(cnt);

	return 0;
}

Measured memory_bytes: 3776
import java.util.*;
class Main{
    public static void main(String[]args){
        Scanner sc=new Scanner(System.in);
        String str=sc.nextLine();
        int p=sc.nextInt();
        
        for(int i=0;i<p;i++){
            String order=sc.next();
            int a=sc.nextInt();
            int b=sc.nextInt();
            
            if(order.equals("replace")){
                String rep=sc.next();
                str=str.substring(0,a)+rep+str.substring(b+1,str.length());
                
            }else if(order.equals("reverse")){
                StringBuffer sb=new StringBuffer(str.substring(a,b+1));
                String rvs=sb.reverse().toString();
                str=str.substring(0,a)+rvs+str.substring(b+1,str.length());
                
            }else{
                System.out.println(str.substring(a,b+1));
            }
        }
    }
}


Measured memory_bytes: 29416
#include <stdio.h>

int main(){
  char s[4];
  char t[4];
  
  scanf("%s",&s);
  scanf("%s",&t);
  
  int ans=0;
  
  if(s[0]==t[0]){
    ans=ans+1;
  }
  if(s[1]==t[1]){
    ans=ans+1;
  }
  if(s[2]==t[2]){
    ans=ans+1;
  }
  
  printf("%d",ans);
  return 0;
}

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

bool isPrime(long long x){
    for(long long i=2; i*i<=x; i++){
        if(x % i ==0) return false;
    }
    return true;
}

long long largest(long long x){
    long long ans = 1e12;
    for(long long i =2; i*i<=x; i++){
        if(x % i == 0){
            ans = min(ans, i+x/i);
        }
    }
    return ans;
}

int main()
{
    long long n;
    cin >> n;
    if(isPrime(n)){
        cout << n-1 << endl;
        return 0;
    }
    long long ans = largest(n);
    cout << ans-2 << endl;
    return 0;
}

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

ans = 0
for i in range(1, len(ps)-1):
    if ps[i-1] <= ps[i] <= ps[i+1] or ps[i+1] <= ps[i] <= ps[i-1]:
        ans += 1
print(ans)


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

using namespace std;

typedef long long ll;

#define int long long

int N;

signed main()
{
	while (cin >> N, N)
	{
		int ans = 0;
		for (int i = 1; i < N; i++)
		{
			int sum = i;
			for (int j = i + 1; j <= N; j++)
			{
				sum += j;
				if (sum >= N)
				{
					if (sum == N) ans++;
					break;
				}
			}
		}
		printf("%d\n", ans);
	}
	return 0;
}

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

int a[2001][3001]={0};
int main() {
    int N, K;
    int x, y;
    char c;
    scanf("%d %d", &N, &K);
    int i,j;
    for(i=0;i<N;i++) {
        scanf("%d %d %c", &x, &y, &c);
        y%=2*K;
        if(c=='W')x+=K;
        if(y>=K){
            x+=K;
            y-=K;
        }
        x%=2*K;
        a[y][x]++;
        a[y+K][x]--;
        a[y][x+K]--;
        a[y+K][x+K]++;
    }

    for(i=0;i<2*K;i++){
        for(j=0;j<3*K;j++){
            a[i+1][j]+=a[i][j];
        }
    }
    for(i=0;i<2*K;i++){
        for(j=0;j<3*K;j++){
            a[i][j+1]+=a[i][j];
        }
    }

    int ans=0;
    for(i=0;i<2*K;i++){
        for(j=0;j<3*K;j++){
            if(i<K&&j<2*K)continue;
            int l=i,m=j;
            if(m>=2*K)m-=2*K;
            if(l>=K){
                if(m<K){
                    m+=K;
                    l-=K;
                }else{
                    m-=K;
                    l-=K;
                }
            }
            a[l][m]+=a[i][j];
        }
    }
    for(i=0;i<K;i++){
        for(j=0;j<2*K;j++){
            if(ans<a[i][j])ans=a[i][j];
        }
    }
    printf("%d\n",ans);
}


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

#define FOR(i,l,r) for(int i = (l);i < (r);i++)
#define ALL(x) (x).begin(),(x).end()
template<typename T> bool chmax(T& a,const T& b){return a < b ? (a = b,true) : false;}
template<typename T> bool chmin(T& a,const T& b){return b < a ? (a = b,true) : false;}
typedef long long ll;

int main()
{
	double x1,y1,x2,y2,x3,y3,xp,yp;
	while(~scanf("%lf%lf%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3,&xp,&yp)){
		double a = (x2 - x1) * (yp - y1) - (xp - x1) * (y2 - y1);
		double b = (x3 - x2) * (yp - y2) - (xp - x2) * (y3 - y2);
		double c = (x1 - x3) * (yp - y3) - (xp - x3) * (y1 - y3);
		if(a > 0 == b > 0 && b > 0 == c > 0){
			printf("YES\n");
		}
		else{
			printf("NO\n");
		}
	}

	return 0;
}

Measured memory_bytes: 3224
a, b, c, d, e, f = map(int, input().split())

water = set()
sugar = set()
for i in range(f // (100 * a) + 1):
    for j in range((f - 100 * a * i) // (100 * b) + 1):
        if 100 * a * i + 100 * b * j <= f:
            water.add(100 * a * i + 100 * b * j)

for i in range(f // c + 1):
    for j in range((f - c * i) // d + 1):
        if c * i + d * i <= f:
            sugar.add(c * i + d * j)

ans = (0, 0)
concentration = 0
for w in water:
    if w == 0:
        continue
    for s in sugar:
        if w + s <= f:
            if concentration <= s / (w + s) <= e / (100 + e):
                concentration = s / (w + s)
                ans = (w + s, s)

print(*ans)


Measured memory_bytes: 3188
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <random>
#include <chrono>
#include <queue>
#include <ctime>
#include <cassert>
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
#define fs first
#define sc second
#define INF 1000000000
#define MOD 1000000007
#define EPS 0.00000001


void dfs(int p, int s, vector<int> &S, vector<bool> &visited, vector<int> &P, vector<vector<int>> &E){
    visited[p] = true;
    s += P[p];
    S[p] = s;
    for(int i=0; i<E[p].size(); i++){
        if(!visited[E[p][i]]) dfs(E[p][i], s, S, visited, P, E);
    }
    return;
}

int main(){
    int N, Q; cin >> N >> Q;
    vector<vector<int>> E(N);

    
    for(int i=0; i<N-1; i++){
        int a, b; cin >> a >> b;
        a--;
        b--;
        E[a].push_back(b);
        E[b].push_back(a);
    }
    
    vector<int> P(N);
    for(int i=0; i<Q; i++){
        int p, x; cin >> p >> x;
        p--;
        P[p] += x;
    }
    
    vector<int> S(N);
    vector<bool> visited(N);
    dfs(0, 0, S, visited, P, E);
    
    for(int i=0; i<N; i++){
        cout << S[i] << endl;
    }
    
    return 0;
}





Measured memory_bytes: 30592
#include<iostream>
#include<string>
#include<vector>
#include <algorithm>
using namespace std;
int main() {
    int N;
    cin >> N;
    vector<int> D(101); // 0でラベル化
    for(int i=0;i<N;i++){
        int d;
        cin >> d ;
        D.at(d) = 1;   // これで同じdが来てもダブルカウント防止
    }
    int count =0;
    for(int i=0;i<101;i++){
        if(D.at(i) != 0){
            count++ ;
        }
    }
    cout << count << endl;
}

Measured memory_bytes: 3640
N = int(input())
T = []
Z = []
time = []
T.append([0,0,0])
for i in range(N):
    t = list(map(int, input().split()))
    T.append(t)
goal = True

for l in range(len(T)-1):
    Z.append(abs(T[l+1][1]-T[l][1]) + abs(T[l+1][2]-T[l][2]))
    time.append(T[l+1][0] - T[l][0])

for j in range(len(T)-1):
    if Z[j] > time[j] or Z[j]%2 != time[j]%2:
        goal = False
        break

if goal == False:
    print('No')
else:
    print('Yes')

 

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

using namespace std;

#define MP make_pair
#define PB push_back
#define f first
#define s second

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

//int dr1[] = {-1, 0, 1, 0};
//int dc1[] = {0, 1, 0, -1};
//int dr3[] = {0, 1, 2, 3, 2, 1, 0, -1, -2, -3, -2, -1, -1, 1, 0, 0};
//int dc3[] = {3, 2, 1, 0, -1, -2, -3, -2, -1, 0, 1, 2, 0, 0, -1, 1};
const int MOD = 1000000007;
const int INF = 1000000007;

ll modx(ll a)
{
    return (a%MOD+MOD)%MOD;
}

ll times(ll a, ll b)
{
    return modx(modx(a)*modx(b));
}

ll add(ll a, ll b)
{
    return modx(modx(a)+modx(b));
}

ll sub(ll a, ll b)
{
    return modx(MOD+modx(a)-modx(b));
}

ll fastExp(ll base, ll exp)
{
    if(exp == 0LL)
    {
        return 1LL;
    }

    if(exp%2==0)
    {
        return fastExp(times(base, base), exp/2);
    }
    else
    {
        return times(base, fastExp(times(base, base), exp/2));
    }
}


const int MAXN = (int)5e5+1;
ll N, res[MAXN];
ll ans;


int main()
{
    //freopen("input.in","r",stdin);
    //freopen("output.out","w",stdout);
    ios::sync_with_stdio(0);
    cin.tie(0);
    string s;
    cin >> s;
    ll ctr = 0;
    while(ctr < s.length() && s[ctr] == '>')
    {
        ctr++;
    }
    ans += ctr*(ctr+1)/2;
    while(ctr < s.length())
    {
        ll ct_ge = 0;
        ll ct_le = 0;
        while(ctr < s.length() && s[ctr] == '<')
        {
            ct_ge++;
            ctr++;
        }
        while(ctr < s.length() && s[ctr] == '>')
        {
            ct_le++;
            ctr++;
        }
        if(ct_le < ct_ge)
        {
            ct_le--;
        }
        else
        {
            ct_ge--;
        }
        ans += ct_ge*(ct_ge+1)/2;
        ans += ct_le*(ct_le+1)/2;
    }

    cout << ans;
    return 0;
}


Measured memory_bytes: 1172
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long

int32_t main()
{
	IOS;
	string s;
	cin >> s;
	if(s[0] == 'S')
		cout << "Cloudy";
	else if(s[0] == 'C')
		cout << "Rainy";
	else
		cout << "Sunny";
	return 0;
}


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

int main(){
  int n;
  int a[1111],p[1111],q[1111],r[1111],c[1111];
  int P,Q,R,C;
  while(1){
    cin >> n;
    if(n == 0) break;
    for(int i=0;i<n;i++){
      cin >> a[i] >> p[i] >> q[i] >> r[i];
      c[i] = 4 * p[i] + 9 * q[i] + 4 * r[i];
    }
    cin >> P >> Q >> R >> C;
    int f=0;
    for(int i=0;i<n;i++){
      int flag = 0;
      if(p[i] > P) flag = 1;
      else if(q[i] > Q) flag = 1;
      else if(r[i] > R) flag = 1;
      else if(c[i] > C) flag = 1;

      if(flag != 1) {
	cout << a[i] << endl;
	f = 1;
      }
    }
    if(f==0) cout << "NA" << endl;
  }
}

Measured memory_bytes: 1180
#include <cstdio>

int main() {
    long n, m;
    scanf("%ld %ld", &n, &m);
    long a = n % m;
    long b = a - m;
    if ( b < 0 ) {
        b *= (-1);
    }
    if ( a < b ) {
        printf("%ld\n", a);
    } else {
        printf("%ld\n", b);
    }
}

Measured memory_bytes: 3224
#include <iostream>

using namespace std;

unsigned long gcd (unsigned long a, unsigned long b){
  if(b == 0) return a;
  return gcd(b, a % b);
}

unsigned long long lcm(unsigned long a, unsigned long b){
  return a * b / gcd(a, b);
}

int main(void){
  unsigned long min, max, divide1, divide2;

  unsigned long count = 0;

  cin >> min >> max >> divide1 >> divide2;

  unsigned long divide;
  divide = lcm(divide1, divide2);
  unsigned long number_divisible_lcm, number_divisible1, number_divisible2;
  number_divisible_lcm = max / divide - (min - 1) / divide;
  number_divisible1 = max / divide1 - (min - 1) / divide1;
  number_divisible2 = max / divide2 - (min - 1) / divide2;

  cout << max - min + 1 - number_divisible1 - number_divisible2 + number_divisible_lcm << endl;
  return 0;
}

Measured memory_bytes: 384
#include "bits/stdc++.h"
using namespace std;

int main() {
	
	long long a, b;
	cin >> a >> b;
	long long x = min(a, b), y = max(a, b);
	
	if (x == 1) {
		if (y == 1) cout << 1 << endl;
		else cout << max(0ll, y-2) << endl;
	}
	else {
		cout << (x-2) * (y-2) << endl;
	}
	
}


Measured memory_bytes: 256
#include <stdio.h>

void swap(double *a,double *b){
	double tmp;

	tmp = *a;
	*a = *b;
	*b = tmp;
}

int main(){
	double x1,x2,x3,x4,y1,y2,y3,y4;
	double A,B,C,xp,yp;

	while(scanf("%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf",&x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4) != EOF){
		A = x1*(x2-x4)*(y1-y3)-x2*(x1-x3)*(y2-y4)+(y2-y1)*(x1-x3)*(x2-x4);
		B = (y1-y3)*(x2-x4)-(y2-y4)*(x1-x3);
		C = (y1-y3)*(x1-x2)*(y2-y4)+y2*(y1-y3)*(x2-x4)-y1*(y2-y4)*(x1-x3);
		xp = A/B;
		yp = C/B;

		if(x1 > x3){
			swap(&x1,&x3);
		}
		if(y1 > y3){
			swap(&y1,&y3);
		}
		if(x2 > x4){
			swap(&x2,&x4);
		}
		if(y2 > y4){
			swap(&y2,&y4);
		}

		if((x1 <= xp && xp <= x3) && (y1 <= yp && yp <= y3) && (x2 <= xp && xp <= x4) && (y2 <= yp && yp <= y4)){
			printf("YES\n");
		}else{
			printf("NO\n");
		}
	}

	return 0;
}

Measured memory_bytes: 608
#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{ 
	int a,b,c;
	cin >> a >> b >> c;
	if(a == b)
		cout << c << endl;
	else if(a == c)
		cout << b << endl;
	else if(b == c)
		cout << a << endl;
	return 0;
}

Measured memory_bytes: 256
// {{{
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>

using namespace std;

typedef long int i32;
typedef unsigned long int u32;
typedef long long int i64;
typedef unsigned long long int  u64;
typedef pair<i32, i32> PII;
typedef vector<i32> VI;
typedef vector<string> VS;
typedef vector<PII> VII;
typedef vector<VI> VVI;
typedef map<i32, i32> MPII;
typedef set<i32> SETI;
typedef multiset<i32> MSETI;
#define IN(x) cin >> x;
#define SCD(t) scanf("%d",&t)
#define SCLD(t) scanf("%ld",&t)
#define SCLLD(t) scanf("%lld",&t)
#define SCC(t) scanf("%c",&t)
#define SCS(t) scanf("%s",t)
#define SCF(t) scanf("%f",&t)
#define SCLF(t) scanf("%lf",&t)
#define MEM(a, b) memset(a, (b), sizeof(a))
#define ZERO(a) memset(a, 0, sizeof(a))
#define FOR(i, j, k, in) for (int i=j ; i<k ; i+=in)
#define RFOR(i, j, k, in) for (int i=j ; i>=k ; i-=in)
#define REP(i, j) FOR(i, 0, j, 1)
#define RREP(i, j) RFOR(i, j, 0, 1)
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define FOREACH(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define BTW(A, B, C) assert( B <= A && A <= C)
#define MP make_pair
#define PB push_back
#define PF push_front
#define INF (u64)1e9
#define EPS 1e-9
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define DEBUG(x) cout << #x << ": " << x << endl;

template<typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }
// }}}

const u64 MAX_N = 200;
u64 d[MAX_N+1][MAX_N+1];
int main() {
    u64 N, M, R;
    IN(N);IN(M);IN(R);
    auto r = vector<u64>(R);
    auto A = vector<u64>(M);
    auto B = vector<u64>(M);
    auto C = vector<u64>(M);
    REP(i, R) {
        IN(r[i]);
        r[i]--;
    }
    REP(i, N)REP(j, N) {
        d[i][j] = (u64)INF;
    }
    REP(i, M) {
        IN(A[i]);IN(B[i]);IN(C[i]);
        A[i]--;
        B[i]--;
        d[A[i]][B[i]] = d[B[i]][A[i]] = C[i];
    }
    REP(k, N)REP(i, N)REP(j, N) {
        if(d[i][j] > d[i][k] + d[k][j]) {
            d[i][j] = d[i][k] + d[k][j];
        }
    }
    u64 ans = (u64)INF;
    sort(r.begin(), r.end());
    do {
        u64 tmpAns = 0;
        REP(i, R-1) {
            tmpAns += d[r[i]][r[i+1]];
        }
        amin(ans, tmpAns);
    } while(next_permutation(r.begin(), r.end()));
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 1024
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <list>
#include <string>
#include <map>
#include <vector>
using namespace std;
#define repd(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) repd(i, 0, n)
typedef long long ll;
/*
https://atcoder.jp/contests/abc042/tasks/abc042_b
*/
int main()
{
    long long N,L;
    vector<string> S;
    cin >> N >> L;
    for (int i = 0; i < N; i++)
    {
        string s; cin >> s;
        S.push_back(s);
    }
    sort(S.begin(),S.end());
    rep(i, N) {cout << S[i];}
    cout <<endl;
    return 0;
}

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

 using namespace std;

 int main() {
   int N, K, ans;

   cin >> N >> K;

   ans = 1;
   for (int i = 0; i < N; i++) {
     if (ans < K) ans *= 2;
     else ans += K;
   }
   cout << ans << endl;
 }


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

int main() {
  int K, T;
  cin >> K >> T;
  vector<int> A(T);
  for (int i = 0; i < T; i++) cin >> A[i];
  int maxA = 0, t;
  for (int i = 0; i < T; i++) if (A[i] > maxA) maxA = A[i], t = i;
  cout << max((2 * maxA - 1 - K), 0) << endl;
}

Measured memory_bytes: 256