akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ll long long int
#define INF INT_MAX
#define mod
#define chutiyaap ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;

int main()
{
	chutiyaap;
	ll n;cin>>n;
	ll a[n+1];for(ll i=0;i<n;i++)cin>>a[i];
	ll dp[n+1];
	dp[0]=0;
	dp[1]=abs(a[1]-a[0]);
	for(ll i=2;i<n;i++)
	{
		dp[i]=min(dp[i-1]+abs(a[i-1]-a[i]),dp[i-2]+abs(a[i-2]-a[i]));
	}
	cout<<dp[n-1];
}


Measured memory_bytes: 1792
import java.util.Scanner;
public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		 long N =sc.nextLong();
         
      long a =0;
		for(long i=1;i<=N;i++) {
			if(i%3!=0&&i%5!=0) {
              a +=i;
            }
        }
          System.out.println(a);
		}
	}


Measured memory_bytes: 35776
// 🐋💭
import Foundation

func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}

func readInt() -> Int {
    return Int(readLine()!)!
}

func readDoubles () -> [Double] {
    return readLine()!.split(separator: " ").map { Double($0)! }
}

func readDouble() -> Double{
    return Double(readLine()!)!
}
///最大公約数を返す
func gcd(_ m:Int, _ n:Int) -> Int {
    if n == 0 {return m}
    return gcd(n, m % n)
}

///素数判定(試し割り)
func isPrime(_ x:Int) -> Bool {
    if x <= 1 || x % 2 == 0 { return false }
    if x == 2 { return true }
    for i in stride(from: 3, to: Int(ceil(sqrt(Double(x)))), by: 2){
        if x % i == 0 {
            return false
        }
    }
    return true
}

//https://program-life.com/669
///実行速度の計測
func exectionTime(action: () -> Void) {
    let startDate = Date()
    action()
    let endDate = Date()
    print(endDate.timeIntervalSince(startDate))
}

// https://melheaven.hatenadiary.jp/entry/atcoder144
///約数の配列を返す
func makeDivisors(_ n:Int) -> [Int] {
    var divisors = [Int]()
    for i in 1..<Int(pow(Double(n), 0.5)) + 1 {
        if n % i == 0{
            divisors.append(i + n / i)
        }
    }
    
    return divisors
}

//https://riptutorial.com/ja/swift/example/14738/インデックスを知らずに配列から要素を削除する
extension Array where Element: Equatable {
    
    mutating func remove(_ element: Element) {
        _ = index(of: element).flatMap {
            self.remove(at: $0)
        }
    }
}

func binarySearch(rifgt:Int, key:Int, ary:[String]) -> Int{
    var left = 0
    var right = rifgt
    
    while abs(right - left) > 1 {
        let mid = left + (right - left) / 2
        
        if Int(ary[mid])! < key {
            left = mid
            
        } else {
            right = mid
        }
    }
    return left
}

func arrangement (prev:String, ary:[String], returnVal:[String]) -> [String] {
    var returnVal = returnVal
    if ary.count == 0 {
        returnVal.append(prev)
        return returnVal
    }
    
    for s in ary {
        let wprev = prev + s
        var wary = ary
        wary.remove(s)
        returnVal = arrangement(prev: wprev, ary: wary, returnVal: returnVal)
    }
    return returnVal
}

func main() {
    let n = readInt()
    var aryH = readInts()
    //＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿ここまで入力
    aryH.reverse()
    
    for i in 1..<n {
        if aryH[i - 1] < aryH[i] {
            aryH[i] -= 1
            if aryH[i - 1] < aryH[i] {
                print("No")
                return
            }
        }
    }
    print("Yes")
    
}
main()


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

#define pb push_back
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define debug(x) cerr << #x << " : " << x << '\n';
//#define int ll
using namespace std;

typedef long long ll;
typedef long double ld;
typedef string str;
typedef pair<ll, ll> pll;

const ld PI = 3.14159265359;

const ll MOD = (ll) 1e9 + 7;
const ll MAXN = (ll) 1e6 + 10;
const ll INF = (ll) 2242545357980376863;
const ld EPS = (ld) 1e-8;
const ll LOG = (ll) 25;


ll a[MAXN];

int main(){
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	ll n;
	cin >> n;
	ll c0 = 0, c1 = 0, c2 = 0, v;
	for(int i = 0; i < n; i++){
		cin >> v;
		if(v % 4 == 0) c0 ++;
		else if(v % 4 == 2) c2 ++;
		else c1 ++;
	}
	if(c2){
		c1 ++;
		cout << (c0 + 1 >= c1 ? "Yes" : "No");
	} else {
		cout << (c0 + 1 >= c1 ? "Yes" : "No");
	}
	return 0;
}

/*

                                 ____              ,----..               ,----..
   ,---,                       ,'  , `.           /   /   \             /   /   \
  '  .' \                   ,-+-,.' _ |          /   .     :           /   .     :
 /  ;    '.              ,-+-. ;   , ||         .   /   ;.  \         .   /   ;.  \
:  :       \            ,--.'|'   |  ;|        .   ;   /  ` ;        .   ;   /  ` ;
:  |   /\   \          |   |  ,', |  ':        ;   |  ; \ ; |        ;   |  ; \ ; |
|  :  ' ;.   :         |   | /  | |  ||        |   :  | ; | '        |   :  | ; | '
|  |  ;/  \   \        '   | :  | :  |,        .   |  ' ' ' :        .   |  ' ' ' :
'  :  | \  \ ,'        ;   . |  ; |--'         '   ;  \; /  |        '   ;  \; /  |
|  |  '  '--'          |   : |  | ,             \   \  ',  /          \   \  ',  /
|  :  :                |   : '  |/               ;   :    /            ;   :    /
|  | ,'                ;   | |`-'                 \   \ .'              \   \ .'
`--''                  |   ;/                      `---`                 `---`
                       '---'

*/


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using ll = long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;
using namespace std;
struct Fast { Fast(){ std::cin.tie(0); ios::sync_with_stdio(false); } } fast;

template<typename ...Ts>
void show(Ts... ts){
  cout<<"#:";
  auto print=[](auto v){cout<<v<<" ";};
  initializer_list<int>{(void(print(ts)),0)...};
  cout<<endl;
}

ll gcd( ll a, ll b ){
    /*
    ll a,b;
    while( y != 0){
        x, y = y, x%y;
        a, b = y, x%y;
    }
    return x;
    */
    while(1) {
    if(a < b) swap(a, b);
    if(!b) break;
    a %= b;
  }
  return a;
}


int main(void){
    ll ans=0;
    ll n,m;
    cin>>n>>m;
    vector<int> b(n,0);
    rep(i,n){
        cin>>b[i];
        b[i]/=2;
    }

 
    ll lcm=b[0];
    REP(i,1,n){
        lcm=(lcm/gcd(b[i],lcm))*b[i];
        if (lcm>m*3)break;
    }
 
    ans=(1+m/lcm)/2;
    
    ll t;
    bool fl=false;
    rep(i,n){
        t=lcm/b[i];
        if (t%2==0)fl=true;
        
        if (lcm%2==0 and fl)ans=0;

    }
    cout<<ans;
}



Measured memory_bytes: 640
/// time is tough.....so don't stop ...keep learning ...keep growing :)

#include <bits/stdc++.h>
using namespace std ;
typedef long long ll ;
typedef long double ld ;
const int N = 1e5+5 ;
const int K = 50 ;
const ll mod =  1e9+7 ;
#define pb push_back
#define ft first 
#define sd second 
#define IOS ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
ll poww(ll a,ll b){ll res=1;while(b){if(b&1){res*=a;}a=a*a;b>>=1;}return res;}
ll poww(ll a,ll b,ll mod){ll res=1;while(b){if(b&1){res*=a;res%=mod;}a=a*a;a%=mod;b>>=1;}return res;}
const ll INF = 2e18 ;
int h[N] ;
int dp[N];
int solve(int n) {
	if(n <= 2) return dp[n];
	int &res = dp[n];
	if(~res) return res;
	return res = min(solve(n-1)+(int)abs(h[n]-h[n-1]), solve(n-2)+(int)abs(h[n]-h[n-2])) ;
}
int main() {
    IOS;
    int n;
    cin >> n;
    memset(dp,-1,sizeof dp);
    for(int i=1;i<=n;i++) {
    	cin >> h[i];
    }
    dp[1] = 0;
    if(n > 1) {
    	dp[2] = dp[1] + abs(h[2]-h[1]) ;
    }
    cout << solve(n) << '\n';
	return 0 ;
}

Measured memory_bytes: 2560
L, R = map(int, input().split())
# R-L>=2019なら、[L,R]に2019の倍数が必ず存在する
if R - L >= 2019:
    print(0)
else:
    ans = 10**9
    for i in range(L, R + 1):  # L<=i<=R
        for j in range(i + 1, R + 1):  # i<j<=R
            ans = min(ans, (i * j) % 2019)
    print(ans)


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

int main() {
 int a,b,c;
  cin >> a >> b >> c;
  int d = 0;
  for(int i = a; i<=b;i++){
    if(c % i ==0){
      d++;
    }
    
  }
  
  cout << d << endl;
}



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


int gcd(int a, int b){
    while(b){
        a%=b;
        swap(a, b);
    }
    return a;
}

int main(){
    int a, b, c; cin >> a >> b >> c;
    cout << a*b/2 << endl;
    return 0;
}


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

typedef long long ll;

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

    int n,a;cin>>n>>a;
    // res[i][j]:=i枚選んで和がjになる組み合わせ
    vector<vector<ll>> res(60,vector<ll>(2600,0));res[0][0]=1;
    for(int i=1;i<=n;i++){
        int x;cin>>x;
        for(int j=n;j>=1;j--){
            for(int k=2500;k>=0;k--){
                if(k-x>=0) res[j][k]+=res[j-1][k-x];
            }
        }
    }
    ll ans=0;
    for(int i=1;i<=n;i++){
        ans+=res[i][a*i];
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 1536
#include <bits/stdc++.h>
#include <set>
using namespace std;
int main(){
  int N;
  cin>>N;
  set<int> A;
  int num1;
  cin>>num1;
  A.insert(num1);
  int B;
  for(int i=1; i<N; i++){
    cin>>B;
    if(A.count(B)==1){
      cout<<"NO"<<endl;
      return 0;
    }
    if(A.count(B)==0){
      A.insert(B);
    }
  }
  cout<<"YES"<<endl;
}

Measured memory_bytes: 9600
pink = 0
green = 0
white = 0
yellow = 0

n = input()
l = raw_input().split()
 
for i in range(n):
   
    if(l[i] == 'P'):
        pink = 1

    if(l[i]== 'G'):
        green = 1

    if(l[i] == 'W'):
        white = 1

    if(l[i] == 'Y'):
        yellow = 1

if(pink + white + green + yellow) == 4:
    print u"Four"
else:
    print u"Three"


Measured memory_bytes: 2568
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int INF = 0x3f3f3f3f;
const ll inf = 0x3f3f3f3f3f3f3f3f;
const int N = 2e6 + 10;
const ll mod = 1e9 + 7;
int n, m, k;
ll a[3010][3010];
ll dp[3010][3010][4];
int main() {
	scanf("%d%d%d", &n, &m, &k);
	for (int i = 1; i <= n; i++)for (int j = 1; j <= m; j++)a[i][j] = -inf;
	for (int i = 1; i <= k; i++) {
		int x, y;
		scanf("%d%d", &x, &y);
		if (a[x][y] != -inf)while (1);
		scanf("%lld", &a[x][y]);
	}
	for (int i = 0; i <= n; i++)for (int j = 0; j <= m; j++)for (int x = 0; x <= 3; x++)dp[i][j][3] = -inf;
	for (int i = 0; i <= n; i++)for (int j = 0; j <= m; j++)dp[i][j][0] = 0;
	dp[1][1][0] = 0; if (a[1][1] >= 0)dp[1][1][1] = a[1][1];
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= m; j++) {
			dp[i][j][0] = 0;
			if (i == 1 && j == 1)continue;
			if (a[i][j] <= 0) {
				for (int x = 0; x <= 3; x++) {
					dp[i][j][0] = max(dp[i][j][0], dp[i - 1][j][x]);
					dp[i][j][x] = max(dp[i][j][x], dp[i][j - 1][x]);
				}
				continue;
			}
			dp[i][j][0] = max(dp[i][j][0], dp[i][j - 1][0]);
			for (int x = 0; x <= 3; x++)dp[i][j][0] = max(dp[i][j][0], dp[i - 1][j][x]), dp[i][j][1] = max(dp[i][j][1], dp[i - 1][j][x] + a[i][j]);
			for (int x = 1; x <= min(j, 3); x++) {
				dp[i][j][x] = max(dp[i][j][x], max(dp[i][j - 1][x], dp[i][j - 1][x - 1] + a[i][j]));
			}
		}
	}
	ll ans = 0;
	for (int i = 0; i <= 3; i++)ans = max(ans, dp[n][m][i]);
	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 356376
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll mod = 1e9+7;
ll INF = 1e18;
double EPS = 0.00000001;
ll res = INF;
int main() {
    ll n; cin >> n; vector<ll> a(n); for (ll i = 0; i < n; i++) { cin >> a[i]; }
    if (a.back() != 2) { printf("-1\n"); return 0; }
    ll ma, mi;
    ma = mi = 2;
    for (ll i = n - 2; i >= 0; i--) {
        ll pma = ma; ll pmi = mi;
        ma = (ll)floor((double)(ma + a[i + 1] - 1) / (double)a[i]) * a[i]; mi = (ll)ceil((double)mi / (double)a[i]) * a[i];
        if (!(pmi <= ma && ma <= pma + a[i + 1] - 1) && !(pmi <= mi && mi <= pma + a[i + 1] - 1)) { printf("%d\n",-1); return 0; }
        if (!(pmi <= ma && ma <= pma + a[i + 1] - 1)) { ma = mi; }
        if (!(pmi <= mi && mi <= pma + a[i + 1] - 1)) { mi = ma; }
    }
    cout << mi << " " << ma + a.front() - 1 << endl;
    return 0;
}


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

int main(){
  int n,n_new,a,b,ans;
  cin >> n >> a;
  
  b = n/500;
  n_new = n - b*500;
  ans = n_new - a;
  if(ans <= 0){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}


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

int main() {
    string S;cin >> S;
    int N = S.length();
    reverse(S.begin(),S.end());
    int dp[100003][13] = {};
    if (S[0] == '?'){
        rep(i,10) dp[0][i] = 1;
    }
    else{
        dp[0][S[0] - '0'] = 1;
    }
    int num = 1;
    for(int i = 1;i < N;i++){
        num *= 10;num %= 13;
        if (S[i] != '?'){
            int c = S[i] - '0';
            for (int j = 0;j < 13;j++){
                int index = (c * num + j) % 13;
                dp[i][index] += dp[i - 1][j];
                dp[i][index] %= MOD;
            }
        }
        else{
            for (int q = 0;q < 10;q++){
                for (int j = 0;j < 13;j++){
                    int index = ((q) * num + j) % 13;
                    dp[i][index] += dp[i - 1][j];
                    dp[i][index] %= MOD;
                }
            }
        }
    }

    cout << dp[N - 1][5] << endl;
}

Measured memory_bytes: 5504
import heapq

N,M=map(int,input().split())
A=list(map(int,input().split()))

for i in range(N):
    A[i] = -A[i]

heapq.heapify(A)

for j in range(M):
    a = heapq.heappop(A)
    b = -1*((-a) // 2)
    heapq.heappush(A,b)

print(-sum(A))

Measured memory_bytes: 14180
import java.util.Scanner;

class Main{
	static int G;
	static int D;
	static int[] p;
	static int[] c;
	static boolean[] used;
	static long ans = 1000000000;


	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);			//文字の入力
		int n = sc.nextInt();
		long[] a = new long[n];
		long sum = 0;
		for(int i = 0;i < n;i++){
			a[i] = sc.nextInt();
			sum += a[i]-1;
		}
		
		
		System.out.println(sum);
	}
	

}

class Pair implements Comparable{
	int from;		//p
	int end;		//y
	int num;
	int bango;
	@Override
	public int compareTo(Object other) {
		Pair otherpair = (Pair)other;

		return from - otherpair.from;
	}
}



Measured memory_bytes: 26096
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define N 200000
#define mod1 1000000007
#define mod2 1000000009
#define mod3 998244353
#define endl '\n'
#define IO ios_base::sync_with_stdio(false);cin.tie(NULL);
void Google(ll tt){
    cout<<"Case #"<<tt<<": ";
}

int main()
{
    IO
    clock_t begin = clock();
    ll n,p,ans=0;
    cin>>n;
    vector <ll> val(n+5,0);
    for(ll i=1;i<=n;i++)
    {
        for(ll j=1;j<=n;j++)
        {
            for(ll k=1;k<=n;k++)
            {
                ll ans=(i*i)+(j*j)+(k*k)+(i*j)+(i*k)+(j*k);
                if(ans>n)
                    break;
                else
                    val[ans]++;
            }
        }
    }
    for(ll i=1;i<=n;i++)
    cout<<val[i]<<endl;
    // cout<<double(clock() - begin)/CLOCKS_PER_SEC<<endl;
    return 0;
}

Measured memory_bytes: 3580
#include <iostream>

using namespace std;

int main(){
	int k;
	cin >> k;
	if  ( k%2==1){
		cout << (k+1)/2*(k-1)/2 << endl;
		
	}
	else if (k%2==0){
	    cout <<	k*k/4 <<endl;
		
	}
	
	return 0;
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        C solver = new C();
        solver.solve(1, in, out);
        out.close();
    }

    static class C {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            int n = Integer.parseInt(in.next());
            Set<Integer> s = new HashSet<>();

            for (int i = 0; i < n; i++) {
                s.add(Integer.parseInt(in.next()));
            }

            // 出力
            if (s.size() == n) out.println("YES");
            else out.println("NO");

        }

    }
}



Measured memory_bytes: 67652
#include "stdio.h"
#define MAX_N 999999
int is_prime[MAX_N+1]; 
int sieve(int n)
{
	int p=0,i,j;
	for(i=0;i<=n;i++) is_prime[i]=1;
	is_prime[0]=is_prime[1]=0;
	for(i=2;i<=n;i++)
	{
		if(is_prime[i])
		{
			p++;
			for(j=2*i;j<=n;j+=i) is_prime[j]=0;
		}
	}
	return p;
}
int main()
{
	int n;
	while(scanf("%d",&n)!=EOF)
	{
		printf("%d\n",sieve(n));
	}
	return 0;
}

Measured memory_bytes: 4496
#include <iostream>
#include <iomanip>
#include <vector>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <cstring>
#include <map>
#define rep(i, N) for (int i = 0; i < (int)N; i++)
using namespace std;
typedef long long ll;
const ll LLINF = 9223372036854775807;
const int MOD = 1000000007;

int main() {
  string S, T; cin >> S >> T;
  map<char, vector<char>> cs, ct;

  string result = "Yes";
  if (S.length()!=T.length()) "No";
  rep(i,S.length()) { cs[S[i]].push_back(T[i]); ct[T[i]].push_back(S[i]); }
  for (auto x: cs) for (auto y: x.second) { 
    if (y!=x.second[0]) result = "No"; 
  }
  for (auto x: ct) for (auto y: x.second) { 
    if (y!=x.second[0]) result = "No"; 
  }
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 1288
#include <bits/stdc++.h>
#define PI 3.14159265359
using namespace std;
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;
}
const long long INF = 1LL << 60;
using pll = pair<long long, long long>;

int main() {
  // 標準入力が早くなる。Cスタイルの入出力とC++スタイルの入出力を混合させてはならない。
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);

  long long A, B, C, K;
  cin >> A >> B >> C >> K;
  long long res = 0;

  if (K <= A) {
    res = K;
  } else if (K <= A + B) {
    res = A;
  } else {
    res = A - (K - A - B);
  }

  cout << res << endl;

  return 0;
}


Measured memory_bytes: 3624
def gets_num
  gets.split("\s").map(&:to_i)
end

x = gets.to_i
a = 0
result = nil

loop do
  if a**5 == x
    result = [a, 0]
    break
  elsif a**5 > x
    0.upto(a) do |b|
      if (a**5 - b**5).abs == x
        result = [a, b]
        break
      end
    end
  else
    0.downto(-a) do |b|
      if (a**5 - b**5).abs == x
        result = [a, b]
        break
      end
    end
  end
  break if result

  a += 1
end

a, b = result

print (a**5 - b**5) > 0 ? [a, b].join("\s") : [b, a].join("\s")


Measured memory_bytes: 14316
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>

using namespace std;

int main(){
    int a,b,c,n,ch[1000][4],good[301]={0},sum,ans;
    
    
    while(1){
        
        for(int i=0;i<301;i++){
            good[i]=0;
        }
        
        sum=ans=0;
        
    scanf("%d%d%d",&a,&b,&c);
    
    if(a+b+c==0)break;
        
    scanf("%d",&n);
        
    for(int i=0;i<n;i++){
        for(int j=0;j<4;j++){
            scanf("%d",&ch[i][j]);
        }
    }
    
    for(int i=0;i<n;i++){
        if(ch[i][3]==1){
            for(int j=0;j<3;j++){
                good[ch[i][j]]=1;
            }
        }
    }
    
    for(int i=0;i<n;i++){
        sum=0;
        for(int j=0;j<3;j++)
            sum+=good[ch[i][j]];
        if(sum==2){
            for(int j=0;j<3;j++)
                if(good[ch[i][j]]!=1){
                    good[ch[i][j]]=-1;
                }
        }
    }
    
    for(int i=1;i<=a+b+c;i++){
        if(good[i]==-1)
            ans=0;
        else if(good[i]==1)
            ans=1;
        else
            ans=2;
        printf("%d\n",ans);
    }}
    
    return 0;
}

Measured memory_bytes: 1200
#pragma GCC optimize ("Ofast")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
using namespace std;

// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

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

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound
#define all(x) begin(x), end(x)
#define sz(x) (int) x.size()

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)

const int MOD = 1e9+7; // 998244353;
const int MX = 2e5+5;
const ll INF = 1e18;
const ld PI = acos((ld)-1);
const ld EPS = 1e-6;
const int dx[4] = {1,0,-1,0}, dy[4] = {0,1,0,-1};
const char nl = '\n';

template <typename T> inline T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template <typename T> inline T lcm(T a, T b) { return a / gcd(a, b) * b; }
template <class T> void ckmin(T& a, T b) { a = min(a, b); }
template <class T> void ckmax(T& a, T b) { a = max(a, b); }

// (Integer/Long).bitCount(x)
int pct(int x) { return __builtin_popcount(x); }
int pctll(ll x) { return __builtin_popcountll(x); }

void setIn(string s) { freopen(s.c_str(),"r",stdin); }
void setOut(string s) { freopen(s.c_str(),"w",stdout); }
void unsyncIO() { ios_base::sync_with_stdio(0); cin.tie(0); }
void setIO(string s = "") {
	unsyncIO();
	if (sz(s)) { setIn(s+".in"), setOut(s+".out"); }
}

// Binary Exponentiation
ll pow(ll b, ll e, ll m = 0LL, ll ans = 1LL) { while (e) { if (e & 1LL) { ans *= b; if (m) ans %= m; } b *= b, e >>= 1LL; if (m) b %= m; } return ans; }



void solve(int tcn) {
	string s, t;
	cin >> s >> t;
	int ans = sz(s);
	F0R(i, sz(s) - sz(t) + 1) {
		int cur = 0;
		F0R(j, sz(t)) {
			if (s[i+j] != t[j]) {
				++cur;
			}
		}
		ckmin(ans, cur);
	}
	cout << ans << nl;
}

int main() {
    setIO();

    int t = 1; //cin >> t;
	for (int i = 1; i <= t; ++i) {
		//cout << "Case #" << i << ": ";
		solve(i);
	}
	return 0;
}

Measured memory_bytes: 3660
#include<bits/stdc++.h>
#define int long long
int f(int x){
	if(x%2)return x%4==1;
	return x+(x%4)/2;
}
signed main(){
	int a,b;
	std::cin>>a>>b;
	std::cout<<(f(a-1)^f(b))<<"\n";
}


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

int main() {
    int A,B,C;
    int X;
    cin >> A >> B >> C;
    X = C-A+B;
    if(X<0){
        X=0;
    }
    cout << X << endl;
    
    return 0;
}

Measured memory_bytes: 384
H, W = map(int, input().split())

grid = [['.' for _ in range(W + 2)]]
for _ in range(H):
    g = ['.'] + [i for i in input()] + ['.']
    grid.append(g)

grid.append(['.' for _ in range(W + 2)])

f = 1
for h in range(1, H + 1):
    for w in range(1, W + 1):
        if grid[h][w] == '.':
            continue
        a = grid[h - 1][w] == '#'
        b = grid[h + 1][w] == '#'
        c = grid[h][w - 1] == '#'
        d = grid[h][w + 1] == '#'
        if not any([a, b, c, d]):
            f = 0
            break
    
    if not f:
        break

print(['No', 'Yes'][f])

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <math.h>
#include <complex>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <functional>
#include <assert.h>
#define int long
#define ll long long
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define eb emplace_back
#define all(x) x.begin(),x.end()
#define SZ(x) x.size()
#define fi first
#define se second
const int INF = 1e9;
using namespace std;

template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;

using pi=pair<int,int>;
using vi=vc<int>;

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

    int K,X; cin >> K >> X;
    for(int i=X-K+1;i<X+K;i++){
        cout << i << " ";
    }
    cout << endl;
}

Measured memory_bytes: 256
from collections import Counter

n = int(input())
S = Counter([input() for i in range(n)])
m = int(input())
T = Counter([input() for i in range(m)])

ans = 0
for k, v in S.items():
    if k in T:
        temp = v - T[k]
    else:
        temp = v
    ans = max(ans, temp)
        
print(ans)

Measured memory_bytes: 3436
#include <iostream>
#include <iomanip>
#include <cstdint>
using namespace std;

int main() {
    cout << fixed << setprecision(9);

    int64_t w, h, x, y;
    cin >> w >> h >> x >> y;
    cout << w * h / 2.0 << ' ' << (!(w & 1) && !(h & 1) && w / 2 == x && h / 2 == y ? 1 : 0) << endl;
}



Measured memory_bytes: 3760
#include<stdio.h>

int day(c)
{
    if(c >= 24){
        c -= 24;

        return day(c);
    }
    else{
        return c;
    }
}

int main()
{
    int a;  scanf("%d", &a);
    int b;  scanf("%d", &b);
    int c;

    c = a + b;

    printf("%d\n", day(c));

    return 0;
}

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

using namespace std;

int n,a[105],rez;

int main(){
    cin >> n;
    for(int i=1;i<=n;i++) cin >> a[i];
    for(int i=2;i<=n;i++){
        if(a[i]==a[i-1]) {rez++; a[i]=-1;}
    }
    cout<<rez;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <vector>
#include <cstring>
#include <algorithm> // sort
#include <unistd.h>
#include <bits/stdc++.h>

#define pii pair<int,int>
#define REP(i, n) for (long long i = 0; i < (n); i++) 
using namespace std;


typedef long long ll;
static const ll INF = 1000000000000000000LL;
static const ll MOD = 1000000007;


int main()
{
    string s,t,u;
    cin >> s;
    cin >> t;
    int  N,M;
    cin >> N >> M;
    cin >> u;

    if(s == u)--N;
    if(t == u)--M;

    cout << N << " " << M << endl;

    return 0;
}

Measured memory_bytes: 256
N,K = [int(i) for i in input().split(" ")]
H = [int(i) for i in input().split(" ")]

def check(N,K,H):
    count = 0
    H = sorted(H)
    if K >= len(H):
        return 0
    H = H[0:len(H)-K]
    return sum(H)

ans = check(N,K,H)
print(ans)
    
    

Measured memory_bytes: 26024
#include <bits/stdc++.h>
#define REP(i,n) for (int i=0;i<(n);i++)
#define FOR(i,s,e) for (int i=s;i<(e);i++)
#define All(v) (v).begin(),(v).end()
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
using namespace std;
typedef long long llint;
typedef pair<int, int> P;
const int MOD = (int)1e9 + 7;
const int INF = 999999999;

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

    int N, K;
    cin >> N >> K;
    cout << ceil((double)(N%K)/N) <<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define m_p make_pair
#define p_b push_back
#define e_b emplace_back
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
using namespace std;
using ll = long long;
using ld = long double;
template<class T> bool chmax(T &a,T b){if(a<b){a=b;return true;}return false;}
template<class T> bool chmin(T &a,T b){if(a>b){a=b;return true;}return false;}

int main(){
  ios_base::sync_with_stdio(false);cin.tie(0);
  int N;
  cin >> N;
  vector<int> A(N);
  for(int i=0;i<N;i++)  cin >> A.at(i);

  vector<int> exist(1e6+1,0);
  for(int i=0;i<N;i++){
    exist.at(A.at(i))++;
  }
  if(exist.at(1)==1){
    cout << 1 << endl;
    return 0;
  }
  if(exist.at(1)>=2){
    cout << 0 << endl;
    return 0;
  }

  int ans=N;
  for(int i=0;i<N;i++){
    if(exist.at(A.at(i))>=2){
      ans--;
      continue;
    }

    int now=A.at(i);
    bool flag=false;
    for(int j=2;j*j<=now;j++){
      if(now%j!=0)  continue;
      if(exist.at(j)>0 || exist.at(now/j)>0){
        flag=true;
        break;
      }
    }
    if(flag) ans--;
    //cout << A.at(i) << " " << flag << endl;
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 7948
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;


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

  if(N == 3){
    cout << 2 << " " << 5 << " " << 63 << endl;
    return 0;
  }
  if(N == 4){
    cout << 2 << " " << 5 << " " << 20 << " " << 63 << endl;
    return 0;
  }
  if(N == 5){
    cout << 2 << " " << 5 << " " << 20 << " " << 63 << " " << 90 << endl;
    return 0;
  }
  vector<int> v;
  vector<int> w = {2,3,4,6};
  int k = 0;
  int ii = 0;
  rep(i,N){
    v.push_back(6*k+w[ii]);
    ii++;
    if(ii >= w.size()){
      k++;
      ii = 0;
    }
  }

  ll sum = 0;
  rep(i,v.size()){
    sum += v[i];
  }

  int mx = v[v.size()-1];
  if(sum % 6 == 0){
    ;
  }
  else if(sum % 6 == 1){
    ; // none
  }
  else if(sum % 6 == 2){
    if(mx >= 6*k) k++;
    v[4] = 6*k;
  }
  else if(sum % 6 == 3){
    if(mx >= 6*k) k++;
    v[5] = 6*k;
  }
  else if(sum % 6 == 4){
    ; // none
  }
  else if(sum % 6 == 5){
    if(mx >= 6*k+4) k++;
    v[5] = 6*k + 4;
  }
  
  sort(ALLOF(v));

  rep(i,N){
    if(i>0) cout << " ";
    cout << v[i];
  }
  cout << endl;
  
  return 0;
}


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

int main(){
    string A,B,C;
    cin >> A >> B >> C;
    if(A[A.size()-1]==B[0] && B[B.size()-1]==C[0]){
        printf("YES\n");
    }
    else{
        printf("NO\n");
    }
    return 0;
}

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

using namespace std;

int main() {
    int a, b, c;
    cin >> a >> b >> c;

    if (a > b) {
	    swap(a, b);
    }
    if (b > c) {
	    swap(b, c);
    }
    if (a > b) {
	    swap(a, b);
    }
    cout << a <<" " << b << " " << c << endl;
    return 0;
}

Measured memory_bytes: 1164
#include <bits/stdc++.h>
#define clr(x) memset(x,0,sizeof x)
#define For(i,a,b) for (int i=(a);i<=(b);i++)
#define Fod(i,b,a) for (int i=(b);i>=(a);i--)
#define fi first
#define se second
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define outval(x) cerr<<#x" = "<<x<<endl
#define outtag(x) cerr<<"---------------"#x"---------------"<<endl
#define outarr(a,L,R) cerr<<#a"["<<L<<".."<<R<<"] = ";\
						For(_x,L,R)cerr<<a[_x]<<" ";cerr<<endl;
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector <int> vi;
typedef long double LD;
LL read(){
	LL x=0,f=0;
	char ch=getchar();
	while (!isdigit(ch))
		f|=ch=='-',ch=getchar();
	while (isdigit(ch))
		x=(x<<1)+(x<<3)+(ch^48),ch=getchar();
	return f?-x:x;
}
const int N=100005,M=16;
int n;
int v[N],c[M];
int dp[1<<M];
int DP(int x){
	if (~dp[x])
		return dp[x];
	if (x==0)
		return dp[x]=0;
	int ans=1e9;
	For(i,1,M-1)
		For(j,1,M-1)
			if (i!=j&&(x>>i&1)&&(x>>j&1)){
				int s=x^(1<<i)^(1<<j);
				int v=i^j,c=0;
				if (v){
					if (s>>v&1)
						c++;
					s^=1<<v;
				}
				ans=min(ans,DP(s)+1+c);
			}
	return dp[x]=ans;
}
int main(){
	n=read();
	For(i,1,n-1){
		int x=read()+1,y=read()+1,z=read();
		v[x]^=z,v[y]^=z;
	}
	For(i,1,n)
		c[v[i]]++;
	int ans=0,S=0;
	For(i,1,M-1){
		ans+=c[i]>>1;
		c[i]&=1;
		S|=c[i]<<i;
	}
	memset(dp,-1,sizeof dp);
	cout<<ans+DP(S)<<endl;
	return 0;
}

Measured memory_bytes: 896
#include <stdio.h>
#include <string.h>

typedef long long int lli;

lli max(lli a, lli b) {
	return a > b ? a : b;
}

lli max_value(int n, int w, lli *weights, lli *values) {
	lli dp[n+1][w+1];
	memset(dp, 0, (w+1)*(n+1)*sizeof(lli));
	int i, j;
	for (i = 0; i <= n; i++) {
		for (j = 0; j <= w; j++) {
			if (i == 0 || j == 0) {
				dp[i][j] = 0;
				continue;
			}
			dp[i][j] = max(dp[i][j], dp[i-1][j]);
			if (j - weights[i-1] >= 0) {
				dp[i][j] = max(values[i-1] + dp[i-1][j-weights[i-1]], dp[i][j]);
			}
		}
	}

	return dp[n][w];
}

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

	lli weights[n], values[n];
	int i;
	for (i = 0; i < n; i++)
		scanf("%lld %lld", &weights[i], &values[i]);

	printf("%lld\n", max_value(n, w, weights, values));
	return 0;
}

Measured memory_bytes: 79104
// AC版.
#include <bits/stdc++.h>
using namespace std;
const int INF = 1e8;
int N, M;

struct edge {
    int to; // 次の頂点.
    int d;  // 距離.
    bool operator < (const edge &E) const { return d > E.d; }
};

int dist[101][101];    // 頂点(i, j) の 最短距離 を 保存.
vector<edge> graph[1001];

// https://ja.wikipedia.org/wiki/ダイクストラ法
// グラフを最良優先探索する.
// ※dijkstraの動作確認用.
// @param s: 今回探索する頂点番号.
// @return: 特に無し.
void dijkstra(int s) {
    
    // 1. 初期化.
    priority_queue<edge> pq;
    
    // 2. 始点設定.
    dist[s][s] = 0;
    pq.push({s, 0});

    // 3. キュー pq が 空になるまで, 探索.
    while(!pq.empty()){
        // 4. 探索を継続するために, 頂点を取得.
        int u = pq.top().to;
        int d = pq.top().d;
        pq.pop();
        
        // 5. より小さい距離が設定済みなら, Skip.
        if(dist[s][u] < d) continue;

        // 6. 各隣接する頂点について, 距離を確認し, 最短経路を更新.
        for(int i = 0; i < graph[u].size(); ++i){
            int nu = graph[u][i].to;
            int nd = d + graph[u][i].d;
            // 最短経路更新.
            if(dist[s][nu] > nd) dist[s][nu] = nd, pq.push({nu, nd});
        }
    }
}

int main() {

    // 1. 入力情報取得.
    scanf("%d %d", &N, &M);
    map<pair<int, int>, int> m; // 二頂点間の距離を保存.
    for(int i = 0; i < M; i++){
        int a, b, c;
        scanf("%d %d %d", &a, &b, &c);
        a--, b--;
        if(a > b) swap(a, b);
        graph[a].push_back({b, c});
        graph[b].push_back({a, c});
        m[{a, b}] = c;
    }
    
    // 2. 各二頂点間の最短経路を求める(ダイクストラ法).
    int ans = 0;
    for(int i = 0; i < 101; i++) for(int j = 0; j < 101; j++) dist[i][j] = INF;
    for(int i = 0; i < N - 1; i++){
        dijkstra(i);
        for(int j = i + 1; j < N; j++){
            // 始めに保存した二頂点間の距離が, 最短経路探索後の二頂点間の距離と異なっているのであれば, 
            // この辺は, 最短経路に含まれてないと判定.
            if(m[{i, j}] > 0 && m[{i, j}] != dist[i][j]) ans++;
            // printf("m[{%d, %d}]=%d dist[%d][%d]=%d\n", i, j, m[{i, j}], i, j, dist[i][j]);
        }
    }
    
    // 3. 出力 ～ 後処理.
    printf("%d\n", ans);
    return 0;
    
}

Measured memory_bytes: 640
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<P> r, b;
    rep(i,n){
        int x, y;
        cin >> x >> y;
        r.emplace_back(x, y);
    }
    rep(i,n){
        int x, y;
        cin >> x >> y;
        b.emplace_back(x, y);
    }
    sort(r.begin(), r.end());
    sort(b.begin(), b.end());
    int ans = 0;
    vector<bool> RU(n, false), BU(n, false);
    rep(j,n){
        int id = -1, my = 0;
        rep(i,n){
            if(RU[i]) continue;
            if(r[i].first < b[j].first && r[i].second < b[j].second){
                if(r[i].second >= my){
                    my = r[i].second;
                    id = i;
                }
            }
        }
        if(id != -1){
            RU[id] = true;
            BU[j] = true;
            ++ans;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;
//https://kimiyuki.net/writeup/algo/atcoder/arc-075-f/
long long repunit[40];
long long ten[40];
long long digits(long long k,long long i){
    //number of pairs a,b such that a-b == k
    long long cnt = 0;
    for(long long a=0;a<10;a++){
        for(long long b=0;b<10;b++){
            if(i==0 && b==0){
                //no leading zeroes
                continue;
            }
            if(a-b ==k){
                cnt++;
            }

        }

    }
    return cnt;
}
long long go(long long d,long long dig,long long i){
    long long e = repunit[dig+1-i]-repunit[i];
    //factor by which we multiply the pair of digits
    if(e == 0){
        //middle number, hence if d =0, it can be any number since we multiply it by 0
        return (long long)10* (long long)(d==0);
    }else if(e<0){
        //rightmost digit is now to the left of leftmost digit, hence if d==0, return 1
        return (long long)(d==0);
    }else{
        long long acc = 0;
        for(long long k=-9;k<=9;k++){
            //iterate through all pairs
            if((d-k*e)%(ten[i+1])==0){
                //difference has to be a multiple of 10^i (the number of 0s increases from the left to the right)
                acc+=go(d-k*e,dig,i+1)*digits(k,i);
            }
        }
        return acc;
    }
}
long long solve(long long d){
    repunit[0] = 0;
    for(long long i=0;i<21;i++){
        repunit[i+1] = (repunit[i]*10) + 1;
        //111111111111111111111111111111111111111111111111111111111111111
       // cout<<repunit[i+1]<<endl;
    }
    ten[0] = 1;
    for(long long i=0;i<21;i++){
        ten[i+1] = ten[i]*10;
        //1000000000000000000000000000000000000000000000000000000000000
    }
    if(d%9!=0){
        return 0;
    }
    d/=9;
    long long res = 0;
    for(long long i=0;i<18;i++){
        res+=go(d,i,0);
        //try for all digit numbers
    }
    return res;
}
int main(){
    long long d;
    cin>>d;
    cout<<solve(d)<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(x),end(x)
#define show(obj) {for(auto x:obj)cout<<x<<' ';cout<<endl;}
#define line "----------"
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> LP;
const int inf = 1001001000;
const ll INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

ll N, A, B;
vector<ll> h(1000000);

bool isOK(ll attack){
	ll al = B*attack;
	if(1e16 / B < attack)return true;
	ll need = 0LL;
	ll addi = A-B;
	rep(i,N){
		ll t = max(0LL, h[i]-al);
		need += t/addi + (t % addi != 0);
	}
	return ((need <= attack)?true:false);
}

ll binary_search(){
	ll ng = -1LL;
	ll ok = 100000000001000;
	while(abs(ok-ng) > 1LL){
		ll mid = (ok + ng)/2;
		if(isOK(mid))ok = mid;
		else ng = mid;
	}
	return ok;
}

int main(){
	cin >> N >> A >> B;
	h.resize(N);
	rep(i,N)cin >> h[i];
	cout << binary_search() << endl;
	return 0;
}


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

int main() {
  int n,m,k;
  cin>>n;
  m=n/100;
  k=n%100;
  if(5*m>=k){
      cout<<"1"<<endl;
  }
  else{
      cout<<"0"<<endl;
  }
}


Measured memory_bytes: 256
/*** akshaykumar99 ***/
 
#include<bits/stdc++.h> 
using namespace std;
 
const long long MOD = 1e9+7;
const long double PI = acos(-1);
const long long N = 5e5+1;
 
typedef long long ll;
typedef long double ld;

void test_case()
{
	ll n, kk;
	cin >> n >> kk;
	vector<ll> p(n+1), c(n+1);
	for(int i = 1; i <= n; i++)
		cin >> p[i];
	for(int i = 1; i <= n; i++)
		cin >> c[i];

	vector<ll> res1[n+1];
	for(int i = 1; i <= n; i++)
	{
		vector<bool> done(n+1, 0);
		ll curr = i;
		while(!done[curr])
		{
			res1[i].push_back(c[p[curr]]);
			done[curr] = 1;
			curr = p[curr];
		}
	}
	ll ans[n+1];
	for(int i = 1; i <= n; i++)
		ans[i] = LLONG_MIN;
	for(int i = 1; i <= n; i++)
	{
		ll k = kk;
		vector<ll> v = res1[i];
		ll ans1 = 0, zz = 0, nn = v.size();
		for(int j = 0; j < min(k, nn); j++)
		{
			ans1 += v[j];
			ans[i] = max(ans[i], ans1);
			zz += v[j];
		}
		k -= min(nn, k);
		ll xx = k / nn;
		if( k == xx * nn)
			xx = max(xx - 1, 0ll);
		ans1 += zz * xx;
		ans[i] = max(ans[i], ans1);
		k -= xx * nn;
		for(int j = 0; j < min(k, nn); j++)
		{
			ans1 += v[j];
			ans[i] = max(ans[i], ans1);
		}
	}
	ll fans = LLONG_MIN;
	for(int i = 1; i <= n; i++)
	{
		fans = max(fans, ans[i]);
	}
	cout << fans << '\n';

}
 
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL); 
    ll tc=1;
    // cin>>tc;
    while(tc--)
        test_case();
    return 0;
}

Measured memory_bytes: 218936
#include<iostream>
using namespace std;
int main(){
	int x1,x2,x3,x4,y1,y2,y3,y4;
	cin>>x1>>y1>>x2>>y2;
	x3=x2-(0-(y1-y2));
	y3=y2-(x1-x2);
	x4=x3-(0-(y2-y3));
	y4=y3-(x2-x3);
	cout<<x3<<" "<<y3<<" "<<x4<<" "<<y4<<" ";
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
 
public class Solution
{
    public static void Main()
    {
      string str1 = Console.ReadLine();
      string[] strA = str1.Split(' ');
      int A = int.Parse(strA[0]);
      int B = int.Parse(strA[1]);
      int T = int.Parse(strA[2]);

      int ans = 0;
      int i = A;
      while (i < T + 1)
      {
        ans += B;
        i += A;
      }
      Console.WriteLine($"{ans}");
    }
}

Measured memory_bytes: 13140
#include <stdio.h>
#define MAX 200000
int main()
{
    long n, m;
    long p[MAX];
    int S[MAX];
    long AC[MAX];
    char input[10];
    long AC_num = 0;
    long WA_num = 0;
    for (long i = 0; i < MAX; i++)
    {
        AC[i] = -1;
    }

    scanf("%ld %ld", &n, &m);
    for (int i = 0; i < m; i++)
    {
        scanf("%ld %s", &p[i], input);
        if (input[0] == 'A')
        {
            S[i] = 0;
            if (AC[p[i]] == -1)
            {
                AC[p[i]] = i;
                AC_num++;
            }
        }
        else
        {
            S[i] = 1;
        }
    }
    for (long i = 0; i < m; i++)
    {
        if (S[i])
        {
            if (i < AC[p[i]])
            {
                WA_num++;
            }
        }
    }
    printf("%ld %ld", AC_num, WA_num);
    return 0;
}

Measured memory_bytes: 3840
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,a,n) for(ll i=a;i<n;i++)
#define rev(i,n,a) for(ll i=n-1;i>=a;i--)
#define f first
#define s second
#define vll vector<ll>
#define vvll vector<vector<ll>>
#define vpii vector<pair<int,int>>
#define vpll vector<pll>
#define pll pair<ll,ll>
#define secreterror() ios_base::sync_with_stdio(false);cin.tie(NULL);

void solve(){

    ll n;
    cin>>n;
    vector<ll>arr(n);
    map<ll,ll>mp;
    rep(i,0,n){
        cin>>arr[i];
        mp[arr[i]]++;

    }
    sort(arr.begin(),arr.end());

   vector<int>vis(1000001,1);

    for(int i=0;i<n;i++){
        // cout<<vis[arr[i]]<<endl;

        
        if(vis[arr[i]]){
            for(int j=2*arr[i];j<=1000000;j=j+arr[i]){
                vis[j]=0;
            }
        }
        if(mp[arr[i]]>1){
            vis[arr[i]]=0;
        }
    }

    ll cnt=0;

    for(int i=0;i<n;i++){
        if(vis[arr[i]]&&mp[arr[i]]==1){
            cnt++;
        }
    }
    cout<<cnt<<endl;
    
}


int main()
{
    secreterror()
    // ll t;
    // cin>>t;
    // //while(t--){
        solve();
        
    //}

}

Measured memory_bytes: 21108
n = int(input())
a = list(map(int ,input().split()))
cnt = 0
for i in range(n):
    if a[i]<0:
        a[i] = -a[i]
        cnt += 1

if 0 in a:
    print(sum(a))
elif cnt%2 == 0:
    print(sum(a))
else:
    print(sum(a)-min(a)*2)

Measured memory_bytes: 14412
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
 
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll n;
  cin>>n;
  ll h[n+1];
  ll dp[n+1];
  for(ll i=1;i<=n;i++)
  {
      cin>>h[i];
  }
  dp[0]=0;
  dp[1]=0;
  dp[2]=abs(h[2]-h[1]);
  for(ll i=3;i<=n;i++)
  {
      dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]));
  }
  cout<<dp[n]<<'\n';
   
   
  return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define rep(k,i,n) for(ll i=k;i<n;++i)
const ll inf=1e6;
ll c0[20][20],c1[20][20][20][20];//c0は入力の値を保存、c1は開始地点を変えながらbfsをしたときそれぞれの座標のd（最短距離）を保存するための配列
ll dx[4]={0,0,1,-1},dy[4]={-1,1,0,0};//周辺を探索するときの座標変化
ll h,w;
ll bfs(ll sx,ll sy){
    if(c0[sx][sy]==-1)return 0;//開始地点が壁の時は0を返す。
    ll res=0;//最短距離の最大値の初期化
    ll d=0;//最短距離の値の初期化
    c1[sx][sy][sx][sy]=d;//スタート地点の初期化
    queue<P> que;//未探索の次に探索する座標を保存させるためのqueue
    que.push(P(sx,sy));//スタート地点の座標をqueueに保存
    while(!que.empty()){//bfsが終わったらqueueにはいる座標はなくなるので、queueになくなるまでループを繰り返す
        P p=que.front();que.pop();//queueを取り出す。
        rep(0,i,4){
            ll nx=p.first+dx[i],ny=p.second+dy[i];//多分now_xの略、今現在見ている座標を意味する。
            if(0<=nx && h>nx && 0<=ny && w>ny){//範囲内の座標の条件
                ll d=c1[sx][sy][nx][ny];
                if(d==inf){//未探索の条件
                    que.push(P(nx,ny));//次の探索範囲に追加
                    c1[sx][sy][nx][ny]=c1[sx][sy][p.first][p.second]+1;//最短距離をc1に入れる
                    res=max(c1[sx][sy][nx][ny],res);//ここまでの最大値を入力
                }
            }
        }
    }
    return res;
}
int main(void){
    cin>>h>>w;//座標の大きさの入力
    rep(0,i,h){
        string s0;
        cin>>s0;
        rep(0,j,w){
            string s1=s0.substr(j,1);//座標ごとの文字をs1に入力
            if(s1=="#"){
                c0[i][j]=-1;//壁があるとき、c0に-1を入力
            }else{
                c0[i][j]=inf;//未探索の印にc0にinfを入力
            }
        }
    }
    ll ans=0;//答えの初期化
    rep(0,i0,h){
        rep(0,j0,w){
            rep(0,i1,h){
                rep(0,j1,w){
                    c1[i0][j0][i1][j1]=c0[i1][j1];//c0によりc1を初期化、(i0,j0)は開始地点。
                }
            }
            ans=max(bfs(i0,j0),ans);//それぞれの開始地点においてbfsをし、最大値をとる。
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 1536
package main

import (
	"fmt"
)

const mod = 1000000007

func main() {
	var n, m int
	fmt.Scan(&n, &m)
	if n == 1 {
		fmt.Println(1)
		return
	}
	mp := make(map[int]int)
	for i := 0; i < m; i++ {
		var tmp int
		fmt.Scan(&tmp)
		mp[tmp] = 1
	}
	dp := make([]int, n + 1)
	dp[0] = 0
	if mp[1] == 0 {
		dp[1] = 1
	}
	if mp[2] == 0 {
		dp[2] = dp[1] + 1
	}
	for i := 3; i < n + 1; i++ {
		if mp[i] == 1 {
			continue
		}
		dp[i] = dp[i - 1] % mod + dp[i - 2] % mod
	}
	fmt.Println(dp[n] % mod)
}


Measured memory_bytes: 8064