akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

void Main()
{
  int A,B,C,D;
  char a,b,c,d;
  cin >> a >> b >> c >> d;
  A = (int)a - '0';
  B = (int)b - '0';
  C = (int)c - '0';
  D = (int)d - '0';
  rep(op1, 2) {
    rep(op2, 2) {
      rep(op3, 2) {
        int sum = 0;
        string s = "";
        if (op1 == 0) {
          sum += A+B;
          s += to_string(A) + "+" + to_string(B);
        } else {
          sum += A-B;
          s += to_string(A) + "-" + to_string(B);
        }
        if (op2 == 0) {
          sum += C;
          s += "+" + to_string(C);
        } else {
          sum -= C;
          s += "-" + to_string(C);
        }
        if (op3 == 0) {
          sum += D;
          s += "+" + to_string(D);
        } else {
          sum -= D;
          s += "-" + to_string(D);
        }
        s += "=7";
        if (sum == 7) {
          cout << s << endl;
          return;
        }
      }
    }
  }
}

int main()
{
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  Main();
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s=sc.next();
		int cnt=0;
		for(int i=0;i<6;i++)
		{
			if(s.substring(i,i+1).equals("1")){
					cnt++;
			}
		}
		System.out.println(cnt);

	}

}


Measured memory_bytes: 21972
#include<stdio.h>

int main(void)
{
    int m[50], f[50], r[50], num=0, i;
    
    while(1){
        scanf("%d %d %d", &m[num], &f[num], &r[num]);
        if(m[num]==-1 && f[num]==-1 && r[num]==-1) break;
        num++;
    }
    
    for(i=0; i<num; i++){    
        if(m[i]==-1 || f[i]==-1)             printf("F\n");
        else if(m[i]+f[i] >= 80)             printf("A\n");
        else if(m[i]+f[i] >= 65)             printf("B\n");
        else if(m[i]+f[i] >= 50 || r[i] >= 50)  printf("C\n");
        else if(m[i]+f[i] >= 30)             printf("D\n");
        else                                 printf("F\n");
    }
    
    return 0;
}


Measured memory_bytes: 2048
import Data.Char
import Data.List

main=do
    (sa:sd)<-getLine
    putStrLn $ if and [e1 sa, e2 sd] then "AC" else "WA"
    where
        e1 sa = sa == 'A'
        ic sd = findIndex (=='C') sd
        e2 sd = case ic sd of
            Nothing -> False
            Just (i) | i>0 && i<(length sd)-1 -> e3 $ delete (sd !! i) sd
            otherwise -> False
            where i = ic sd
        e3 sr = all (isLower) sr

Measured memory_bytes: 380
n, m = map(int, input().split())
k = []
s = []
for _ in range(m):
    inp = list(map(int, input().split()))
    k.append(inp[0])
    s.append(set(inp[1:]))
p = list(map(int, input().split()))

cnt = 0
for i in range(2 ** n):
    pattern = list(bin(i)[2:].zfill(n))
    ramp = p.copy()
    for j in range(n):
        if pattern[j] == "1":
            for l in range(m):
                if (j+1) in s[l]:
                    ramp[l] ^= 1
    f = False
    for j in range(m):
        f |= ramp[j]

    if not f:
        cnt += 1

print(cnt)


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

int main() {
	string a, b, c;
	cin >> a >> b >> c;
	if (a.at(a.length() - 1) == b.at(0) && b.at(b.length() - 1) == c.at(0))cout << "YES" << endl;
	else cout << "NO" << endl;
}

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


int main() {
  int n;
  cin >> n ;
  
  int c=0;
  vector<int>vec(n);
  for(int i=0;i<n;i++){
    cin >> vec.at(i);
    if(vec.at(i)%2==1||vec.at(i)%6==0||vec.at(i)%10==0){
      c++;
    }
    else{
      cout << "DENIED" << endl;
      break;
    }
    if(c==n){
      cout << "APPROVED" << endl;
    }
  }
}
  
  

Measured memory_bytes: 256
#include<stdio.h>

int main(void){

char s[4];

scanf("%s",&s);

if(s[0]=='A'&&s[1]=='B'&&s[2]=='C'&&s[3]=='\0'){printf("ARC");}
else if(s[0]=='A'&&s[1]=='R'&&s[2]=='C'&&s[3]=='\0'){printf("ABC");}

return 0;
}


Measured memory_bytes: 2124
#include <bits/stdc++.h>
#define whlie while
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define rep(i,N) for(int i = 0; i < (N); i++)
#define repr(i,N) for(int i = (N) - 1; i >= 0; i--)
#define rep1(i,N) for(int i = 1; i <= (N) ; i++)
#define repr1(i,N) for(int i = (N) ; i > 0 ; i--)
#define each(x,v) for(auto& x : v)
#define all(v) (v).begin(),(v).end()
#define sz(v) ((int)(v).size())
#define vrep(v,it) for(auto it = v.begin(); it != v.end(); it++)
#define vrepr(v,it) for(auto it = v.rbegin(); it != v.rend(); it++)
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) ll __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
using namespace std; void solve();
using ll = long long; using vl = vector<ll>;
using vi = vector<int>; using vvi = vector< vector<int> >;
constexpr int inf = 1001001001;
constexpr ll infLL = (1LL << 61) - 1;
struct IoSetupNya {IoSetupNya() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); cerr << fixed << setprecision(7);} } iosetupnya;
template<typename T, typename U> inline bool amin(T &x, U y) { return (y < x) ? (x = y, true) : false; }
template<typename T, typename U> inline bool amax(T &x, U y) { return (x < y) ? (x = y, true) : false; }
template<typename T, typename U> ostream& operator <<(ostream& os, const pair<T, U> &p) { os << p.first << " " << p.second; return os; }
template<typename T, typename U> istream& operator >>(istream& is, pair<T, U> &p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator <<(ostream& os, const vector<T> &v) { int s = (int)v.size(); rep(i,s) os << (i ? " " : "") << v[i]; return os; }
template<typename T> istream& operator >>(istream& is, vector<T> &v) { for(auto &x : v) is >> x; return is; }
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
template<typename T>void die(T x){out(x); exit(0);}
#ifdef NyaanDebug
  #include "NyaanDebug.h"
  #define trc(...) do { cerr << #__VA_ARGS__ << " = "; dbg_out(__VA_ARGS__);} while(0)
  #define trca(v,...) do { cerr << #v << " = "; array_out(v , __VA_ARGS__ );} while(0)
#else
  #define trc(...)
  #define trca(...)
  int main(){solve();}
#endif
 
using P = pair<int,int>; using vp = vector<P>;
constexpr int MOD = /**/ 1000000007; //*/ 998244353;
/////////////////

void solve(){
  ini(N , K , Q);
  vi v(Q); in(v);
  vi cnt(N , 0);
  rep(i , Q) cnt[v[i] - 1]++;
  rep(i , N){
    out (K - Q + cnt[i] > 0 ? "Yes" : "No");
  }


}

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

int gcd(int a, int b){
	if(b == 0){
		return a;
	}
	else{
		return gcd(b, a % b);
	}
}

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

int MOD_m(int a, int m){
	a %= m;
	return a >= 0 ? a : a + m;
}

pair<int, int> Extention_Euclidean(int x, int y){
	if(y == 0){
		return pair<int, int>(1, 0);
	}
	else{
		pair<int, int> p = Extention_Euclidean(y, x % y);
		return pair<int, int>(p.second, p.first - p.second * (x / y));
	}
}

int inverse_m(int a, int m){
	if(gcd(a, m) > 1){
		return -1;
	}
	else{
		return MOD_m(Extention_Euclidean(a, m).first, m);
	}
}

int Garner(vector<int> &_a, vector<int> &_m, int N, int M){
	int i, j;
	vector<int> a(N), m(N);
	for(i = 0; i < N; i++){
		a[i] = _a[i] % _m[i];
		m[i] = _m[i];
	}
	int g, gi, gj;
	for(i = 0; i < N; i++){
		for(j = i + 1; j < N; j++){
			g = gcd(m[i], m[j]);
			if(MOD_m(a[i] - a[j], g) != 0){
				return -1;
			}
			m[i] /= g;
			m[j] /= g;
			gi = gcd(m[i], g);
			gj = g / gi;
			for(g = gcd(gi, gj); g > 1; g = gcd(gi, gj)){
				gi *= g;
				gj /= g;
			}
			m[i] *= gi;
			m[j] *= gj;
			a[i] = MOD_m(a[i], m[i]);
			a[j] = MOD_m(a[j], m[j]);
		}
	}
	int T, ms, x;
	vector<int> t(N);
	t[0] = a[0];
	for(i = 1; i < N; i++){
		T = 0;
		ms = 1;
		for(j = 0; j < i; j++){
			T = MOD_m(T + t[j] * ms, m[i]);
			ms = MOD_m(ms * m[j], m[i]);
		}
		t[i] = MOD_m((a[i] - T) * inverse_m(ms, m[i]), m[i]);
	}
	x = 0;
	ms = 1;
	for(i = 0; i < N; i++){
		x = MOD_m(x + t[i] * ms, M);
		ms = MOD_m(ms * m[i], M);
	}
	return x;
}

signed main(){
	int N, i, j;
	scanf("%lld", &N);
	vector<int> P(N), Q(N);
	for(i = 0; i < N; i++){
		scanf("%lld", &P[i]);
		P[i]--;
	}
	for(i = 0; i < N; i++){
		scanf("%lld", &Q[i]);
		Q[i]--;
	}
	vector<int> is_visit(N, 0);
	vector<vector<int>> e(N, vector<int>(0));
	for(i = 0; i < N; i++){
		if(is_visit[i] == 0){
			e[i].push_back(i);
			for(int j = Q[i]; j != i; j = Q[j]){
				e[i].push_back(j);
			}
			//e[i].push_back(i);
		}
	}

	vector<int> a(N), b(N);
	for(i=0;i<N;i++){
		for(int j=0;j<e[P[i]].size();j++){
			//printf("test4%d %d\n", i, e[P[i]][j]);
			if(e[P[i]][j]==i){
				a[i]=j;
				b[i]=e[P[i]].size();
				break;
			}
			else if(j==e[P[i]].size()-1){
				printf("-1\n");return 0;
			}
		}
	}
	//printf("test5\n");

	int res = Garner(a, b, N, (int)(1e18 + 100));
	printf("%lld\n", res);
	return 0;

}


Measured memory_bytes: 3380
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;

const ll Q = 1000000007;
ll v[4][4][4][201];

int main(int argc, const char * argv[]) {
    
    
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    
    ll n;
    cin >> n;
    
    for ( int i = 0; i < 4 ; i++ )
        for ( int j = 0; j < 4; j++ )
            for ( int k = 0; k < 4; k++ )
                v[i][j][k][3] = 1;
    
    v[0][1][2][3] = v[1][0][2][3] = v[0][2][1][3] = 0;

    
    for ( int i = 3; i < n; i++ ){
        
        for ( int a = 0; a < 4 ; a++ ){
            for ( int b = 0; b < 4; b++ ){
                for ( int c = 0; c < 4; c++ ){
                    for ( int d = 0; d < 4; d++ ){
                        if ( (b == 0 && c == 1 && d == 2) || (b == 1 && c == 0 && d == 2) || (b == 0 && c == 2 && d == 1) || (a == 0 && c == 1 && d == 2) || ( a == 0 && b == 1 && d == 2 )) continue;
                        v[b][c][d][i+1] += v[a][b][c][i];
                        v[b][c][d][i+1] %= Q;
                    }
                }
            }
        }
        
    }
    
    ll ans = 0;
    for ( int a = 0; a < 4 ; a++ )
        for ( int b = 0; b < 4; b++ )
            for ( int c = 0; c < 4; c++ )
                ans += v[a][b][c][n];
            
    
    cout << ans % Q << endl;
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep_range(i, s, e) for (int i = (s); i < (int)(e); i++)
#define rep_rev(i, s, e) for (int i = (s)-1; i >= (int)(e); i--)
#define sort_vec(v) sort((v).begin(),(v).end())
typedef int64_t lint;
// lint mod = 998244353;
// lint mod = 1000000007;
template< typename T1, typename T2 >
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 >
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

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

  vector<int> l(n);
  rep(i,n){
    cin>>l[i];
  }

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

  int ans=0;
  rep(a,n) rep_range(b,a,n) rep_range(c,b,n){
    int la=l[a],lb=l[b],lc=l[c];
    if(la<lb&&lb<lc&&la+lb>lc) ans++;
  }

  return ans;
}

int main(){cout<<app()<<endl;return 0;}


Measured memory_bytes: 3624
#include<stdio.h>
#include<stdlib.h>
#define MAX 200001
#define AMAX 10000
void CountingSort(int);
  int *A,*B;
  int C[AMAX+ 1]; 

int main(){
  int n,i,j;
  scanf("%d",&n);
 A = malloc(sizeof(int)*n+1);
 B = malloc(sizeof(int)*n+1);
  CountingSort(n);
  for(i=0;i<n;i++){
    if(i>0)printf(" ");
    printf("%d",B[i]);
  }
  printf("\n");

  return 0;
}

void CountingSort(n){
  int i,j;
  for(i = 0;i < AMAX; i++)C[i] = 0;

  for(i = 0;i < n; i++){
    scanf("%d", &A[i]);
    C[A[i]]++;
  }

  for(i = 1;i <= AMAX; i++) C[i] = C[i] + C[i-1];

  for(j = n;j >= 0; j--){
    B[C[A[j]]-1] = A[j];
    C[A[j]]--;
  }
}

Measured memory_bytes: 16272
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(LL i=0;i<N;++i)
typedef long long int LL;

int main()
{
	int N, M, X, Y;
	in >> N >> M >> X >> Y;
	std::vector<int>x(N), y(M);
	rep(i, N) in >> x[i];
	rep(i, M) in >> y[i];

	int maxX = -114514, minY = 114514;
	rep(i, N) maxX = std::max(maxX, x[i]);
	rep(i, M) minY = std::min(minY, y[i]);

	for (int i = X + 1; i <= Y; ++i)
	{
		if (maxX < i&&i <= minY)
		{
			out << "No War" << std::endl;
			return 0;
		}
	}
	out << "War" << std::endl;
}


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

using namespace std;

long long MAX_N = 6208;

pair<long long, long long> doTest(long long X, const vector<long long>& pow5) {
    // X == 0
    if (X == 0LL) {
        return make_pair(0LL, 0LL);
    }
    // One is zero
    for (long long i = 1; i <= MAX_N; ++i) {
        if (pow5[i - 1] == X) {
            return make_pair(i, 0LL);
        }
    }

    // A > 0
    for (long long i = 1; i <= MAX_N; ++i) {
        long long X_m_A5 = X - pow5[i - 1];
        for (long long j = 1; j <= MAX_N; ++j) { // A > 0 && B > 0
            if (X_m_A5 == -pow5[j - 1]) {
                return make_pair(i, j);
            }
        }
        for (long long j = 1; j <= MAX_N; ++j) { // A > 0 && B < 0
            if (X_m_A5 == pow5[j - 1]) {
                return make_pair(i, -j);
            }
        }
    }
    return make_pair(0, 0);
}

void Main() {
    long long X;
    cin >> X;

    vector<long long> pow5(MAX_N, 0LL);
    for (long long i = 1; i <= MAX_N; ++i) {
        pow5[i - 1] = pow(i, 5);
    }

    pair<long long, long long> res = doTest(X, pow5);
    cout << res.first << " " << res.second << endl;
}

int main() {
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 4288
#include "iostream"
#include "algorithm"
#include "cstring"
#include "cstdio"
#include "cmath"
#include "vector"
#include "map"
#include "set"
#include "queue"
using namespace std;
#define MAXN 1000006
//#define int long long
#define rep(i, a, b) for (int i = (a), i##end = (b); i <= i##end; ++i)
#define per(i, a, b) for (int i = (a), i##end = (b); i >= i##end; --i)
#define pii pair<int,int>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define vi vector<int>
#define all(x) (x).begin() , (x).end()
#define mem( a ) memset( a , 0 , sizeof a )
typedef long long ll;
#define P 1000000007
int n , x;
int A[MAXN] , B[MAXN]; map<int,int> ok;
void solve() {
    cin >> x >> n;
    rep( i , 1 , n ) scanf("%d",A + i) , ok[A[i]] = 1;
    int ps = 0;
    for( int i = x - 100 ; i <= x + 100 ; ++ i ) if( !ok[i] ) {
        if( abs( x - ps ) > abs( i - x ) ) ps = i;
    }
    printf("%d\n",ps);
}

signed main() {
//    int T;cin >> T;while( T-- ) solve();
    solve();
}


Measured memory_bytes: 3848
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <functional>
#include <math.h>
#include <stdlib.h>
#include <map>
#include <sys/timeb.h>
#include <fstream>

using namespace std;

#define repr(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repr(i,0,n)
#define reprrev(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define reprev(i,n) reprrev(i,0,n)
#define repi(itr,ds) for(auto itr=ds.begin();itr!=ds.end();itr++)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define mp make_pair
#define mt make_tuple
#define INF 1050000000
#define INFL 1100000000000000000LL
#define EPS (1e-10)
#define MOD 1000000007
#define PI 3.1415926536
#define RMAX 4294967295

typedef long long ll;
typedef pair<int, int> Pi;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<Pi> vPi;
typedef vector<vector<int> > vvi;
typedef vector<vector<bool> > vvb;
typedef vector<vector<ll> > vvll;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<double> > vvd;
typedef vector<vector<Pi> > vvPi;
typedef priority_queue<int, vector<int>, greater<int> > pqli;
typedef priority_queue<ll, vector<ll>, greater<ll> > pqlll;
typedef priority_queue<Pi, vector<Pi>, greater<Pi> > pqlP;
struct Edge {
	int from, to, cost;
	bool operator<(Edge e) {
		return cost < e.cost;
	}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
template <class T>
using vec = vector<T>;
template<class T>
using pql = priority_queue<T, vector<T>, greater<T>>;
string debug_show(Pi a) {
	return "(" + to_string(a.first) + "," + to_string(a.second) + ")";
}

template<class T>
struct augEdge {
	T from, to;
	int cost;
	bool operator<(augEdge e) { return cost < e.cost; }
	bool operator>(augEdge e) { return cost > e.cost; }
};
template<class T>
using augGraph = vector<augEdge<T>>;


ll gcd(ll a, ll b) {
	ll temp;
	while (a % b != 0)
	{
		temp = b;
		b = a % b;
		a = temp;
	}
	return b;
}

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

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

	int n;
	cin >> n;
	vll t(n);
	rep(i, n)cin >> t[i];

	if (n == 1) {
		cout << t[0] << endl;
		return 0;
	}

	ll ans = lcm(t[0], t[1]);
	repr(i, 2, n) {
		ans = lcm(ans, t[i]);
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <ratio>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <climits>
#define ll long long
#define ld long double
#define mp make_pair
#define pb push_back
#define in insert
#define vll vector<ll>
#define endl "\n"
#define pll pair<ll,ll>
#define f first
#define s second
#define FOR(i,a,b) for(int i=(a),_b=(b); i<=_b; i++)
#define int ll
#define sz(x) (ll)x.size()
#define all(x) (x.begin(),x.end())
using namespace std;

 
const ll INF = 1e12;
const ll N =(1e5+5); // TODO : change value as per problem
const ll MOD = 1e9+7;

int a[N];
void solve(){
    int n;
    cin >> n;
    n*=2;
    for(int i = 1;i<=n;i++){
        cin >> a[i];
    }    
    sort(a+1,a+n+1);
    int ans = 0;
    for(int i = 1;i < n;i+=2){
        ans += min(a[i],a[i+1]);
    }
    cout << ans << endl;
}
signed main(){
 
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
     // freopen(".in","r",stdin);freopen(".out","w",stdout);
    
     ll tt=1;   
     // cin >> tt;
    while(tt--){    
        solve();
    }    
}

Measured memory_bytes: 3624
#include <iostream>
#include <string>

int main() {
  std::string S, T;
  std::cin >> S;
  std::cin >> T;

  for (auto i=0; i<S.length(); i++) {
    auto R = S.substr(i, S.length()) + S.substr(0, i);
    if (R == T) {
      std::cout << "Yes" << std::endl;
      return 0;
    }
  }

  std::cout << "No" << std::endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <tuple>
#include <deque>

using namespace std;

/*
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
*/

typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<long long, long long> pll;
typedef vector<pll> vpll;

typedef long double ld;
typedef vector<ld> vld;

typedef vector<bool> vb;

/*
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define reps(i, n) for (ll i = 1; i <= (n); i++)
#define rrep(i, n) for (ll i = (n) - 1; i >= 0; i--)
#define rreps(i, n) for (ll i = (n); i >= 1; i--)
#define all(v) (v).begin(), (v).end()
*/

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

constexpr int INF = 1 << 30;
constexpr ll INFL = 1LL << 60;
constexpr ll MOD = 1000000007;
constexpr ld EPS = 1e-12;
constexpr ld PI = 3.14159265358979323846;

void solve() {
    ll n, k;
    cin >> n >> k;
    int ans = 0;
    if(n % k > 0) ans = 1;
    cout << ans << endl;
    return;
}

int main() {
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
}


Measured memory_bytes: 256
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
#include<list>
#include<bitset>
#include<stack>
#include<memory>
#include<numeric>
using namespace std;
using namespace std::chrono;
typedef long long int llint;
typedef long double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
/*cout<<fixed<<setprecision(20);cin.tie(0);ios::sync_with_stdio(false);*/
const int mod=1000000007;
const llint big=2.19e15+1;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-4;
template <class T,class U>bool mineq(T& a,U b){if(a>b){a=b;return true;}return false;}
template <class T,class U>bool maxeq(T& a,U b){if(a<b){a=b;return true;}return false;}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){if(a==0){return b;}return a/gcd(a,b)*b;}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
template<class T>int LBI(const vector<T>&ar,T in){return lower_bound(ar.begin(),ar.end(),in)-ar.begin();}
template<class T>int UBI(const vector<T>&ar,T in){return upper_bound(ar.begin(),ar.end(),in)-ar.begin();}
llint solve(deque<llint>&A,llint Y){
	llint n=A.size(),i,j,S=0;
	llint dp[301][6]={};dp[0][0]=1;
	//dpは累積和
	vector<llint>wa(n+1);
	for(i=0;i<n;i++){wa[i+1]=wa[i]+A[i];}
	for(i=0;i<n;i++){
		int bas=LBI(wa, wa[i+1]+Y - (wa[n]-1)/5 )-1;
		if(bas<0){continue;}
		//cerr<<"bas="<<bas<<endl;
		mineq(bas,i);
		for(j=0;j<5;j++){dp[i+1][j+1]=dp[i][j+1]+dp[bas][j];}//cerr<<endl;
	}
	
	return dp[n][5];
}
int main(void){
	cout<<fixed<<setprecision(20);
	cin.tie(0);ios::sync_with_stdio(false);
	llint n,Y,i,ans=0;cin>>n>>Y;
	deque<llint>in(n);
	for(i=0;i<n;i++){cin>>in[i];}
	for(i=0;i<n;i++){
		ans+=solve(in,Y);
		in.pub(in[0]);
		in.pof();
	}
	cout<<ans/5<<endl;
	return 0;
}



Measured memory_bytes: 3232
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder.Abc
{
    class QuestionG
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            // 整数の入力
            int num_N = int.Parse(Console.ReadLine());

            var num_Sumlist = new List<long>();

            for (int inumA = 1; inumA <= num_N; inumA++)
            {
                if (inumA % 3 != 0 & inumA % 5 != 0)
                {
                    num_Sumlist.Add(inumA);
                }

            }

            var num_Sum = num_Sumlist.Sum();

            Console.WriteLine(num_Sum);

            Console.Out.Flush();
        }
    }
}


Measured memory_bytes: 40692
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
#define N 100010
typedef long long ll;
#define NO !printf("No\n")
inline int read(){
	int x=0,f=1;
	char c=getchar();
	while(c<'0'||c>'9'){
		if(c=='-')f=-1;
		c=getchar();
	}
	while(c>='0'&&c<='9'){
		x=(x<<1)+(x<<3)+c-'0';
		c=getchar();
	}
	return x*f;
}
int n,q,a[N],b[N],c[N];
ll m;
struct Union_set{
	int f[N];
	void init(int n){
		for(int i=0;i<n;++i){
			f[i]=i;
		}
	}
	inline int getf(int x){
		return f[x]==x?x:f[x]=getf(f[x]);
	}
	int Merge(int x,int y){
		int fx=getf(x),fy=getf(y);
		if(fx==fy)return 0;
		f[fy]=fx;
		return 1;
	}
}S;
int main(){
	n=read(),m=read(),q=read();
	for(int i=1;i<=q;++i){
		a[i]=read()+1,b[i]=read()+1,c[i]=read();
	}
	S.init(n);
	int tot=n;
	for(int i=1;i<=q;++i){
		if(!c[i]){
			tot-=S.Merge(a[i],b[i]);
		}
	}
	if(1LL*tot*(tot-1)/2+n-tot<m)return NO;
	
	int res=0;
	for(int i=1;i<=q;++i){
		if(c[i]){
			if(S.getf(a[i])==S.getf(b[i]))return NO;
		}
	}
	for(int i=1;i<=q;++i){
		if(c[i])res+=S.Merge(a[i],b[i]);
	}
	if(res){
		if(m<n)return NO;
	}
	printf("Yes\n");
	return 0;
}



Measured memory_bytes: 5200
import heapq as hq
def main():
    n = int(input())
    a = list(map(int,input().split(' ')))
    ans = [0]*(n+1)
    ans_cnt = 0
    for num,i in enumerate(a[::-1]):
        cnt = 0
        for j in range(n-num,n+1,n-num):
            if ans[j] ==1:
                cnt += 1
        if cnt%2 != i:
            ans[n-num] = 1
            ans_cnt += 1
    print(ans_cnt)
    for num,i in enumerate(ans):
        if i:
            print(num,'',end='')

if __name__ == '__main__':
    main()

Measured memory_bytes: 8380
program maze_master
    implicit none
    integer(4):: h,w
    integer(4):: i,j, cnt
    character(20)::s
    logical, allocatable:: is_pass(:,:), is_road(:,:)

    read*, h,w
    allocate(is_pass(h,w), is_road(0:h+1,0:w+1))

    is_road(:,:) = .false.
    do i=1,h
        read*, s
        do j=1,w
            if (s(j:j) == "." ) is_road(i,j) = .true.
        end do
    end do

    ! do i=0, h+1
    !     print*, is_road(i,:)
    ! end do
    
    cnt = 0
    do j=1, w
       do i=1, h
        cnt = max(solve_maze(i,j, is_pass, is_road), cnt)
       end do
    end do

    print*, cnt
    
contains

function solve_maze(ih, iw, is_pass, is_road) result(cnt)
    integer(4):: ih, iw, cnt, i, j, dh, dw
    logical:: is_pass(:,:), is_road(0:,0:), is_update
    logical, allocatable:: new_pass(:,:)
    allocate(new_pass(h,w))

    cnt = 0
    is_update = .true.
    is_pass(:,:) = .false.

    if(is_road(ih,iw)) is_pass(ih,iw)=.true.
    ! print*, '------'

    do while(is_update)
        is_update = .false.
        new_pass(:,:) = is_pass(:,:)
        do i = 1,h
            do j= 1,w
                if (.not. is_pass(i,j)) cycle
                do dh = -1,1
                    do dw = -1,1
                        if ((dw/=0 .and. dh/=0) .or. (dw==0 .and. dh==0)) cycle
                        if (is_road(i+dh,j+dw) .and. (.not. is_pass(i+dh,j+dw)))then
                            new_pass(i+dh,j+dw) = .true.
                            is_update = .true.
                        end if
                    end do
                end do
            end do
        end do
        is_pass(:,:) = new_pass(:,:)
        
        if (is_update) cnt = cnt + 1
        ! print*, cnt
        ! do i=1,h
        !     print*, is_pass(i,:)
        ! end do
    end do


    
end function
    
end program maze_master

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <array>
#include <algorithm>
#include <list>
#include <iomanip>
#include <queue>
#include <functional>
#include <cassert>
#include <cmath>
#include <set>
#include <map>
#include <numeric>

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repe(i, n) for(int i = 0; i <= (n); i++)
#define fo(i, a, b) for(int i = (a); i < (b); i++)
#define foe(i, a, b) for(int i = (a); i <= (b); i++)
#define NL << endl

using namespace std;
using ll = long long;
const int INTMAX = numeric_limits<int>::max();
const int INTMIN = numeric_limits<int>::min();
const ll LLMAX = numeric_limits<long long>::max();
const ll LLMIN = numeric_limits<long long>::min();
const int MOD = 1000000007;
int gcd(int a, int b) { return b ? gcd(b, a%b) : a; }

using namespace std;

int main() {

	int n;
	cin >> n;
	vector<int> s(n);
	int sum = 0;
	rep(i, n) {
		cin >> s[i]; sum += s[i];
	}
	sort(s.begin(), s.end());

	if (sum % 10 == 0) {
		int c;
		for (c = 0; c < s.size(); c++)
			if (s[c] % 10 != 0) break;
		c < s.size() ? sum -= s[c] : sum = 0;
	}
	cout << sum NL;

	return 0;

}



Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
	int a, b, c;
	int falled_in_sleep[60] = {0};
	int current_time = 0;
	int next_getoff;
	if (scanf("%d%d%d", &a, &b, &c) != 3) return 1;
	next_getoff = c;
	for (;;) {
		if (current_time <= next_getoff && next_getoff <= current_time + a) {
			printf("%d\n", next_getoff);
			return 0;
		}
		current_time += a;
		if (next_getoff < current_time) next_getoff += 60;
		if (falled_in_sleep[current_time % 60]++) {
			puts("-1");
			return 0;
		}
		current_time += b;
		if (next_getoff < current_time) next_getoff += 60;
	}
}

Measured memory_bytes: 596
module practiceA
  sub Main()
    dim intNum as integer
    dim i as integer
    dim intAns as integer
    dim intAns2 as Double
    dim intAns3 as integer
    dim blnAns  as boolean
Dim line As String
Dim data() As String
Dim data2be As Double
Dim data2af As Double

    intNum =Console.ReadLine()
    line = Console.ReadLine()
        data = Split(line, " ")

    for i = 0 to intNum  -1
    intAns = intAns + CInt(data(i).Trim())
    next i

    intAns2  = intAns / intNum  '平均

    blnAns   = false
    for i = 0 to intNum  -1
    if (data(i) = intAns2) then
      intAns3 = i
    blnAns   = true

    Console.Write(intAns3 )
      exit for
    end if
    next i

    if     blnAns   = false then
      data2be = 0
      data2af = 999
    for i = 0 to intNum  -1
      data2be =   Math.Abs(data(i) - intAns2)
      if data2af > data2be then
        data2af  = data2be 
      end if
    next i
   
    for i = 0 to intNum  -1
'    Console.Write(data(i) & " " &  intAns2 & " " & data2af & vbCrLf )

    if ((data(i) = (intAns2 - data2af)) or (data(i) = (intAns2 + data2af))) then
      intAns3 = i
    Console.Write(intAns3 )
      exit for
    end if
     
    next i


    ' Console.Write(data2af  )
    end if
  end sub
end module

Measured memory_bytes: 13536
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

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

    int N = scanner.nextInt();
    int Q = scanner.nextInt();
    Node[] nodes = new Node[N];
    for (int i = 0; i < N; i++) nodes[i] = new Node();
    for (int i = 0; i < N - 1; i++) {
      int a = scanner.nextInt() - 1;
      int b = scanner.nextInt() - 1;
      nodes[a].neighbors.add(nodes[b]);
      nodes[b].neighbors.add(nodes[a]);
    }
    for (int i = 0; i < Q; i++) {
      int p = scanner.nextInt() - 1;
      int q = scanner.nextInt();
      nodes[p].offset += q;
    }
    dfs(null, nodes[0], 0);
    StringBuilder sb = new StringBuilder();
    for (int i = 0; i < N; i++) {
      sb.append(nodes[i].counter).append(' ');
    }
    System.out.println(sb.toString());
  }

  private static void dfs(Node parent, Node node, int sum) {
    sum += node.offset;
    node.counter = sum;
    for (Node a : node.neighbors) {
      if (a != parent) {
        dfs(node, a, sum);
      }
    }
  }

  private static class Node {
    private List<Node> neighbors = new ArrayList<>();
    private int offset;
    private int counter;
  }
}


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

#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))

typedef long long LL;

int main(){
  LL n;
  cin >> n;
  vector<LL> a(n);
  LL total=0;
  vector<LL> kaisu(n,0);
  for(int i=0;i<n;i++){
    cin >> a[i];
    total+=a[i];
  }
  if(total*2%(n*(n+1))){
    cout << "NO" << endl;
    return 0;
  }
  // cout << total << endl;
  LL count=total*2/n/(n+1);
  // cout << "count" << count << endl;
  int sum=0;
  for(LL i=0;i<n-1;i++){
    kaisu[i]=max(0,(a[i]+count-a[i+1])/n);
    sum+=kaisu[i];
  }
  kaisu[n-1]=max(0,(a[n-1]+count-a[0])/n);
  sum+=kaisu[n-1];
  if(sum!=count){
    cout << "NO" << endl;
    return 0;
  }
  // for(int i=0;i<n;i++){
  //   cout <<kaisu[i] << " ";
  // }
  // cout << endl;
  vector<LL> simu(n,0);
  for(LL i=0;i<n-1;i++){
    simu[0]+=kaisu[i]*(n-i);
    simu[i+1]+=kaisu[i]*(-n);
  }
  simu[0]+=kaisu[n-1];
  for(LL i=1;i<n;i++){
    simu[i]+=simu[i-1];
  }
  for(LL i=0;i<n;i++){
    simu[i]+=count*i;
  }
  // for(int i=0;i<n;i++){
  //   cout << simu[i] << " ";
  // }
  // cout << endl;
  for(LL i=0;i<n;i++){
    if(simu[i]!=a[i]){
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES" << endl;
  return 0;
}


Measured memory_bytes: 2560
#include<bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
using namespace std;
typedef long long ll;
ll gcd(ll a,ll b){return b!=0?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}

int main(){
    ll n,k;
    cin>>n>>k;
    cout<<(n-1+k-1-1)/(k-1)<<endl;
    return 0;
}

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

void solve(long long a, long long b)
{
    string ans = "Odd";
    if (a * b % 2 == 0)
        ans = "Even";

    cout << ans << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main()
{
    long long a;
    scanf("%lld", &a);
    long long b;
    scanf("%lld", &b);
    solve(a, b);
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iostream>
#include<string>
#include<cmath>
#include<cstdio>
#include<cctype>
#include<cstring>
#include<iomanip>
#include<cstdlib>
#include<ctime>
#include<set>
#include<map>
#include<utility>
#include<queue>
#include<vector>
#include<stack>
#include<sstream>
#include<algorithm>
/************************************************/
#define rep(i,n) for(int i=0;i<n;i++)
#define m_p make_pair
#define pb push_back
#define fr first
#define se second
#define forn(i,a,n) for(int i=a;i<n;i++)
#define foreach(i,c) for(__typeof(c.begin())i=(c.begin());i!=(c).end();i++)
#define pii pair<int,int>
#define vi vector<int>
#define ll long long
#define sz(s) s.size()
#define all(s) s.begin(),s.end()
#define zero(x) memset(x,0,sizeof(x))
#define vii vector<pair<int,int> >
#define mpis map<int,string>
#define mpii map<int,int>
#define mpsi map<string,int>
#define re return
#define mod 1000000007
/************************************************/
using namespace std;

long long get(){
	char c=getchar();
	long long x=0LL;
	while(c<'0'||c>'9')
	c=getchar();
	while(c>='0'&&c<='9'){
		x*=10LL;
		x+=(c-'0');
		c=getchar();
	}
	return x;
}
int n,k,d;
int a[101];
int main(){
	ios::sync_with_stdio(0);
	cin>>n>>k;
	rep(i,k){
		cin>>d;
		rep(j,d){
			int x;
			cin>>x;
			x--;
			a[x]++;
		}
	}
	int ans=0;
	rep(i,n)
	if(a[i]==0)
	ans++;
	cout<<ans;
	re 0;
}

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

int main()
{
	int x, y;
	int t;

	for (;;) {
		scanf("%d%d", &x, &y);
		if (x == 0 && y == 0) break;
		if (x > y) t = x, x = y, y = t;
		printf("%d %d\n", x, y);
	}
	return 0;
}


Measured memory_bytes: 2072
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll N, K;
  cin >> N >> K;
  vector<vector<ll>> A(2, vector<ll>(N+1));
  rep(i, N) cin >> A[0][i];
  int flag = 1;
  bool ok;
  rep(k, K) {
    rep(i, N+1) A[flag][i] = 0;
    rep(i, N) {
      ll l = max(i-A[1-flag][i], 0LL);
      ll r = min(i+A[1-flag][i], N-1);
      A[flag][l]++;
      A[flag][r+1]--;
    }
    ok = true;
    rep(i, N) A[flag][i+1] += A[flag][i];
    rep(i, N) if(A[flag][i] != N) ok = false;
    if(ok) break;
    flag = 1-flag;
  }
  if(ok) rep(i, N) cout << N << ' ';
  else rep(i, N) cout << A[1-flag][i] << ' ';
  cout << endl;
  return 0;
}


Measured memory_bytes: 7948
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <complex>
#include <iomanip>

using namespace std;

//typedef
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long ll;

#define omajinai ios::sync_with_stdio(false);cin.tie(0)

//container util
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define UNIQUE(a)  (a).erase(unique((a).begin(),(a).end()),(a).end())
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(auto i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RFOR(i,b,a) for(int i=(b)-1;i>=(a);--i)
#define RREP(i,n) RFOR(i,n,0)

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << "[L " << __LINE__ << "] " << #x << " = " << (x) << "\n";

// #define X first
// #define Y second

const int INF = 1e9;
const ll LINF = 1e18;
const long double PI = 3.1415926535897932;
const int _N = 2e5;
const int _M = 270000;
int n,m;
int main() {
  omajinai;
  cin>>n;
  cout<<((n/10==9||n%10==9)?"Yes":"No")<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("O3")
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define EPS (1e-9)
#define INF (1e17)
#define PI (acos(-1))
//const double PI = acos(-1);
//const double EPS = 1e-15;
//long long INF=(long long)1E17;
#define i_7 (long long)(1e9+7)
//#define i_7 998'244'353
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
long long po(long a, long b){
    if(b==0){
        return 1;
    }
    
    long long z = po(a,b/2);
    z = mod(z*z);
    if(b%2!=0){
        z = mod(a*z);
    }
    return z;
}
 
bool prime_(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=std::sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}
 
long long gcd_(long long a, long long b){
  if(a<b){
    std::swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd_(b,a%b);
  }
}
 
long long lcm_(long long x, long long y){
  return (x/gcd_(x,y))*y;
}
 
//using namespace std;
//using namespace boost::multiprecision;
//using namespace __gnu_pbds;

long long dp[3005][3005][4];
long long exist[3005][3005];

int main(){
  using namespace std;
  int R, C, k;
  cin>>R>>C>>k;
  int r[k], c[k];
  long long v[k];
  REP(i, k){
    cin>>r[i]>>c[i]>>v[i];
    r[i]--; c[i]--;
  }
  //long long dp[R][C][4];
  //REP(i, R) REP(j, C) REP(l, 4) dp[i][j][l] = 0;
  //long long exist[R][C];
  //REP(i, R) REP(j, C) exist[i][j] = 0;
  REP(i, k) exist[r[i]][c[i]] = v[i];
  REP(i, R){
    REP(j, C){
      for(int l = 3; l >= 1; l--) if(exist[i][j] > 0) dp[i][j][l] = max(dp[i][j][l], exist[i][j] + dp[i][j][l - 1]);
      if(i + 1 < R) for(int l = 0; l < 4; l++) dp[i + 1][j][0] = max(dp[i + 1][j][0], dp[i][j][l]);
      if(j + 1 < C) for(int l = 0; l < 4; l++) dp[i][j + 1][l] = max(dp[i][j + 1][l], dp[i][j][l]);  
    }
  }
  long long ans = 0;
  REP(l, 4) ans = max(ans, dp[R - 1][C - 1][l]);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 358784
#include<stdio.h>
#include<iostream>
#include<vector>
#include <bits/stdc++.h>
#include <queue>
#include <algorithm>
#include <string>
#include <iomanip>
#include <cmath>

using namespace std;
typedef long long ll;

#define rep(i,n) for(ll i=0; i<(ll)(n); i++)
#define Q 1000000007

// ll T,N;
// vector<ll> a(N);
// const int M = 2;
// void dfs(vector<int> &A) {
//     // 終端条件 --- 10 重ループまで回したら処理して打ち切り
//     if (A.size() == n) {
//         return;
//     }

//     for (int v = 0; v < M; ++v) {
//         A.push_back(v);
//         dfs(A);
//         A.pop_back(); // これが結構ポイント
//     }
// }

bool IsPrime(ll num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (ll i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}

int main(){
  char a;
  cin>>a;
  //   cin>>N;
  //   a.resize(N);
//   ll ans;
//   rep(i,5){
//       cin>>x[i];
//       cout<<i<<endl;
//       if(x[i]==0){
//           ans = i+1;
//       }
//   }
  if(isupper(a)){
      cout<<"A";
  }else{
      cout<<"a";
  }



 

  return 0;
}

Measured memory_bytes: 3680
Module Module1

    Sub Main()
        Dim len As Integer = 0
        Dim hogehoge() As String

        len = CType(Console.ReadLine, Integer)
        hogehoge = Console.ReadLine.Split(" "c)
        Dim bashozahyo(hogehoge.Length - 1) As Integer

        Dim count As Integer = 0
        For a As Integer = 0 To hogehoge.Length - 1
            bashozahyo(count) = CType(hogehoge(a), Integer)
            count += 1
        Next

        Dim sum As Integer = 0
        For a As Integer = 0 To bashozahyo.Length - 1
            sum += bashozahyo(a)
        Next

        'Dim basho As Integer = CInt(bashozahyo.Average)
        Dim basho As Integer = CInt(sum / bashozahyo.Length)

        Dim ans As Integer = 0

        Dim shukaicount = 0
        'For Each bashogoto In bashozahyo
        For i As Integer = 0 To bashozahyo.Length - 1
            ans += CInt((basho - bashozahyo(i)) * (basho - bashozahyo(i)))
            shukaicount += 1
        Next



        Console.WriteLine(ans.ToString)

        Console.ReadKey()


    End Sub


End Module


Measured memory_bytes: 19792
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")
  
#include <iostream>
#include <stdlib.h>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <assert.h>
#include <memory.h>
#include <time.h>
#include <bitset>

#include "atcoder/convolution.hpp"
#include "atcoder/dsu.hpp"
#include "atcoder/fenwicktree.hpp"
#include "atcoder/lazysegtree.hpp"
#include "atcoder/math.hpp"
#include "atcoder/maxflow.hpp"
#include "atcoder/mincostflow.hpp"
#include "atcoder/modint.hpp"
#include "atcoder/scc.hpp"
#include "atcoder/segtree.hpp"
#include "atcoder/string.hpp"
#include "atcoder/twosat.hpp"

#define uint unsigned int
#define ll long long
#define ull unsigned long long
#define ld long double
#define rep(i, l, r) for (int i = (l); i < (r); i++)
#define repb(i, r, l) for (int i = (r); i > (l); i--)
#define sz(a) (int)a.size()
#define fi first
#define se second
#define mp(a, b) make_pair(a, b)
#define rank qwertyuio
#define next dfghjk
#define prev fhsgfhjf
#define plus fsghsf
#define minus ytryr
  
using namespace std;
  
inline bool setmin(int &x, int y) { return (y < x) ? x = y, 1 : 0; }
inline bool setmax(int &x, int y) { return (y > x) ? x = y, 1 : 0; }
inline bool setmin(ll &x, ll y) { return (y < x) ? x = y, 1 : 0; }
inline bool setmax(ll &x, ll y) { return (y > x) ? x = y, 1 : 0; }
  
const int N = 100000;
const int inf = (int)1e9 + 1;
const ll big = (ll)1e18 + 1;
const int P = 239;
const int P1 = 31;
const int P2 = 57;
const int MOD = (int)1e9 + 7;
const int MOD1 = (int)1e9 + 9;
const int MOD2 = 998244353;
const ld eps = 1e-9;
const double pi = atan2(0, -1);
const int ABC = 26;

int main()
{
    //freopen("circus.in", "r", stdin);
    //freopen("circus.out", "w", stdout);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.precision(20);
    cout << fixed;
    //ll TL = 10.95 * CLOCKS_PER_SEC;
    //clock_t time = clock();
    int n, q;
    cin >> n >> q;
    atcoder::dsu d(n);
    rep(i, 0, q) {
        int t, u, v;
        cin >> t >> u >> v;
        if (t == 0) {
            d.merge(u, v);
        } else {
            cout << d.same(u, v) << "\n";
        }
    }
    return 0;
}



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

int main(){
    while(true){
        int h,w;
        cin >>h>>w;
        if(h==0 && w==0)break;
        for(int i=0;i<h;i++){
            for(int j=0;j<w;j++){
                int v = j+i;
                if(v%2==0)cout<<"#";
                else if(v%2==1)cout<<".";
            }
            cout<<endl;
        }
        cout<<endl;
    }
return 0;
}


Measured memory_bytes: 3088
n=int(input())
def prime_factors(n):
    i = 2
    factors = []
    while i * i <= n:
        if n % i:
            i += 1
        else:
            a=n//i 
            if (a+1)*i<=n:
              a+=1
            n=a
            factors.append(i)
    if n > 1:
        factors.append(n)
    return factors
a=prime_factors(n)
current=0
index=0
anslist=[]
for i in range(len(a)):
  if a[i]!=current:
    current=a[i]
    anslist.append(1)
  else:
    anslist[-1]+=1
ans=0
for i in anslist:
  k=1
  while (k*(k+1))<=2*i:
    k+=1
  k-=1
  ans+=k
print(ans)

Measured memory_bytes: 62932
#include<iostream>

using namespace std;

int main(){
	int sum=0;
	double num=0;
	int cou=0;
	int a,b;
	char ch;
	while(cin>>a>>ch>>b){
		sum+=a*b;
		num+=b;
		cou++;
	}
	
	cout<<sum<<endl<<(int)(num/(double)cou+0.5)<<endl;
}

Measured memory_bytes: 1160
package main

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

var (
	n   int
	tmp int
)

func main() {
	fmt.Scanln(&n)
	buf := bytes.NewBufferString("")

	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)

	a := make([]int, 0, n)

	for sc.Scan() {
		tmp, _ := strconv.Atoi(sc.Text())
		a = append(a, tmp)
	}

	if n == 1 {
		fmt.Println(a[0])
		os.Exit(0)
	} else if n == 2 {
		fmt.Println(a[1], a[0])
		os.Exit(0)
	}

	i := len(a) - 1
	for i >= 0 {
		buf.WriteString(fmt.Sprintf("%d ", a[i]))
		i -= 2
	}
	if i == -2 {
		i = 1
	} else {
		i = 0
	}
	for i < len(a) {
		if i == len(a)-2 {
			buf.WriteString(fmt.Sprint(a[i]))
			break
		}
		buf.WriteString(fmt.Sprintf("%d ", a[i]))
		i += 2
	}

	fmt.Println(buf.String())
}

Measured memory_bytes: 15232
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long long int lli;
typedef long double ld;
const int oo = 1e9; 

int m;
const int mx = 1e5+5;
int ac[mx][3];
int dp[3][mx];
int go(int a, int i){
	if(i == m) return 0;
	if(dp[a][i] != -1) return dp[a][i];
	int& ans = dp[a][i];
	
	if(a==0){
		ans=max(ans, go(1, i+1)+ac[i][0]);
		ans=max(ans, go(2, i+1)+ac[i][0]);
	}
	if(a==1){
		ans=max(ans, go(0, i+1)+ac[i][1]);
		ans=max(ans, go(2, i+1)+ac[i][1]);
	}
	if(a==2){
		ans=max(ans, go(0, i+1)+ac[i][2]);
		ans=max(ans, go(1, i+1)+ac[i][2]);
	}
	
	return ans;
}
int main(){
	cin>>m;
	for(int i=0; i<m; i++) cin>>ac[i][0]>>ac[i][1]>>ac[i][2];
	memset(dp, -1, sizeof dp);
	cout<<max(go(0,0),max(go(1,0),go(2,0)))<<"\n";
	return 0;
}

Measured memory_bytes: 7296
function main(input){
    input = input.split('\n');
    inputA = input[0].split(' ');
    inputH = parseInt(inputA[0]);
    inputN = parseInt(inputA[1]);
    inputB = input[1].split(' ');
    sum = 0;
    out = '';

    for(i=0;i<inputN;i++){
        sum = sum + parseInt(inputB[i]);
    }
    
    res = inputH-sum;

    if(res<=0){
        out = 'Yes';
    }
    else if(res>0){
        out = 'No';
    }

    console.log(out);
}

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

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

using namespace std;

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

  int n;
  cin >> n;
  vector<int> C(n), V(n);
  for (auto &v : V) cin >> v;
  for (auto &c : C) cin >> c;

  int res = 0;
  for (int i = 0; i < n; ++i) {
    res += max(V[i]-C[i], 0);
  }
  cout << res << endl;

  return 0;
}



Measured memory_bytes: 256
N, M = map(int, input().split())
K = {i: 0 for i in range(1, M+1)}

for i in range(N):
    row = list(map(int, input().split()))
    for j in range(1, row[0]+1):
        K[row[j]] += 1

result = 0
for i in range(1, M+1):
    if K[i] == N:
        result += 1

print(result)

Measured memory_bytes: 3064