akhauriyash/Code-Regression huggingface dataset:
/*

*/
#include<bits/stdc++.h>

using namespace std;
using ll=long long;
#define rep2(i, a, n) for(int i = (a); i < (n); i++)
#define rep(i, n) rep2(i,0,n)
template<class T,class U>void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>void chmax(T &t,U f){if(t<f)t=f;}

void in(){} template<typename Head,typename... Tail> void in(Head&& head,Tail&&... tail){cin>>head;in(forward<Tail>(tail)...);}

int main(){
  cin.tie(nullptr);ios_base::sync_with_stdio(false);
  string s,t;
  in(s,t);
  int ans=t.size(),dif;
  rep(st,s.size()-t.size()+1){
    dif=0;
    rep(i,t.size()){
      if(t[i]!=s[st+i])dif++;
    }
    chmin(ans,dif);
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3588
#include <algorithm>
#include <iostream>
#include <queue>
#include <string>
#include <vector>
#include <math.h>
#include <utility>
#include <map>
#include <queue>
#include <stack>
#include <set>

using namespace std;

#define INF 210000000
#define int long long

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

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

signed main() {
    int a,b,c;
    cin >> a >> b >> c;
    set<int> hoge{a,b,c};
    cout << hoge.size();
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
using ll = int64_t;
constexpr ll mod = ll(1e9 + 7);
 
int main () {
  ios::sync_with_stdio(0); cin.tie(0);
 
  int TT = 1;
  // cin >> TT;
  while (TT--) {
    ll n,h,w;
    cin >> n >> h >> w;
    --h;
    --w;
    cout << max(ll(0), ((n-h)*(n-w))) << endl;
  }
}


Measured memory_bytes: 3660
#include<stdio.h>
#include<iostream>
#include<math.h>
#include<algorithm>
using namespace std;

int main() {
	int a, b, c, d;
	while(cin >> a >> b) {
		c = a;
		d = b;
		while (1) {
			if(a == 0) {
			cout << 0 << " " << 0 << endl;
			break;
			}
			if ((max(a, b) % min(a, b)) == 0) {
				cout << min(a, b);
				break;
			}else if(a > b) {
				a  = a%b;
			}else b = b%a;
		}
		if(a != 0) { 
		cout << " " << c / min(a,b) * d << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 1160
N = int(input())
a = list(map(int, input().split()))

quadruple_cnt = 0
double_cnt = 0
other_cnt = 0

for i in range(N):
    if a[i] % 4 == 0:
        quadruple_cnt += 1
    elif a[i] % 2 == 0:
        double_cnt += 1
    else:
        other_cnt += 1

if double_cnt == 0:
    n = 0
else:
    n = 1

if quadruple_cnt >= other_cnt - 1 + n:
    ans = "Yes"
else:
    ans = "No"

print(ans)


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

int main() {
  int N, K;
  string S;
  cin >> N >> K >> S;
  
  char C = S.at(K - 1);
  if (C == 'A') {
    S.at(K - 1) = 'a';
  } else if (C == 'B') {
    S.at(K - 1) = 'b';
  } else {
    S.at(K - 1) = 'c';
  }
  
  cout << S << endl;
}

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

using namespace std;

typedef long long ll;

int main() {
    string s;   cin >> s;
    ll l = s.length(), mod = 1e9+7;
    vector<vector<ll> > dp(l+1, vector<ll>(13));
    
    dp[0][0] = 1;
    for (int i = 0; i < l; i++) {
        for (int j = 0; j < 13; j++) {
            if (s[i] == '?') {
                for (int k = 0; k < 10; k++) {
                    dp[i+1][(10*j+k)%13] = (dp[i+1][(10*j+k)%13] + dp[i][j]) % mod;
                }
            }
            else {
                int k = s[i]-'0';
                dp[i+1][(10*j+k)%13] = (dp[i+1][(10*j+k)%13] + dp[i][j]) % mod;
            }
        }
    }

    cout << dp[l][5] << endl;
}

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

int main() {
  
  int n;
  string s;
  cin >> n >> s;
  
  int count = 1;
  
  for ( int i = 0; i < s.size()-1; i++){
    if ( s[i] == s[i+1] ){
      continue;
    }else{
      count++;
    }
  }
  
  cout << count << endl;
  
  
}


Measured memory_bytes: 512
using System;
using System.Collections.Generic;
using System.Linq;

public class Program
{
    public static void Main(string[] args)
    {
        var tmp = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
        var n = int.Parse(Console.ReadLine());
        var val = Console.ReadLine().ToCharArray();
        var result = string.Empty;
        for (int i = 0; i < val.Length; i++)
        {
            var idx = tmp.IndexOf(val[i]) + n;
            idx = idx >= 26 ? idx - 26 : idx;
            result += tmp.Substring(idx, 1);
        }
        Console.WriteLine(result);
    }
}

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

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();
            int ans = 0;
            string ps = string.Empty;
            for (int i = 0; i < s.Length; i++) {
                if (ps != s[i].ToString()) {
                    ps = s[i].ToString();
                } else if (i < s.Length - 1) {
                    ps = string.Concat(s[i], s[i + 1]);
                    i++;
                } else {
                    break;
                }
                ans++;
            }
            Console.WriteLine(ans);
        }
    }
}


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

#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,x,n) for(int i=x; i<(n); i++)
#define rrep(i,n) for(int i=(n)-1; i>=0; i--)
#define all(X) (X).begin(),(X).end()
#define X first
#define Y second
#define pb push_back
#define eb emplace_back

using namespace std;
typedef long long int ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

template<class A, size_t N, class T> void Fill(A (&a)[N], const T &v){ fill( (T*)a, (T*)(a+N), v ); }

template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {os<<"{"; rep(i,t.size()) {os<<t[i]<<",";} os<<"}"; return os;}
template<class T,size_t n> ostream& operator<<(ostream &os, const array<T,n> &t) {os<<"{"; rep(i,n) {os<<t[i]<<",";} os<<"}"; return os;}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}

const ll INF = 1e9+7;


int main(){
	ios_base::sync_with_stdio(false);
	int N, ans=0;
	string S;

	cin >> S;

	if(S[2] == S[3] && S[4] == S[5]){
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}


	return 0;
}

Measured memory_bytes: 256
import Control.Monad
import qualified Data.ByteString.Char8 as BS
import Data.List
import Data.Maybe
import Data.Ord
import qualified Data.Vector as VC
import qualified Data.Vector.Mutable as VM

readNums :: IO [Integer]
readNums = map (fst . fromJust . BS.readInteger) . BS.words <$> BS.getLine

readNumLists :: Int -> IO [[Integer]]
readNumLists n = replicateM n (map (fst . fromJust . BS.readInteger) . BS.words <$> BS.getLine)

readStrings :: IO [String]
readStrings = map BS.unpack . BS.words <$> BS.getLine

readStringLists :: Int -> IO [[String]]
readStringLists n = replicateM n (map BS.unpack . BS.words <$> BS.getLine)

main :: IO ()
main = do
  (h:w:n:_) <- concat <$> readNumLists 3
  print $ solve h w n

solve :: Integral a => a -> a -> a -> a
solve h w n
  | m == 0 = d
  | otherwise = d + 1
  where
    longer = max h w
    (d, m) = divMod n longer

Measured memory_bytes: 380
import java.util.Scanner;

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

        int max = Math.max(A+B,A-B);

        System.out.println(Math.max(max,A*B));



    }
}


Measured memory_bytes: 22996
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using pii=pair<int,int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()

using data=map<string,int>;

void add(data&d, string s){
	if(d.find(s)==d.end()){
		int n=d.size();
		d[s]=n;
	}
}

int main(){
	int n;
	while(cin>>n,n){
		data mp;
		vector<vector<string>> input;
		set<int> k;
		k.insert(0);
		rep(i,n){
			input.emplace_back();
			string s;
			cin>>s;
			s=regex_replace(s,regex(":|,")," ");
			stringstream ss(s);
			ss>>s;
			add(mp,s);
			while(ss>>s){
				if(s.back()=='.') s=s.substr(0,s.size()-1);
				input[i].push_back(s);
			}
		}
		queue<int> q; q.push(0);
		while(!q.empty()){
			int f=q.front(); q.pop();
			rep(i,input[f].size()){
				if(mp.find(input[f][i])!=mp.end()){
					if(k.find(mp[input[f][i]])==k.end()){
						k.insert(mp[input[f][i]]);
						q.push(mp[input[f][i]]);
					}
				}
			}
		}
		set<string> ans;
		for(auto i:k){
			rep(j,input[i].size()){
				if(mp.find(input[i][j])==mp.end()) ans.insert(input[i][j]);
			}
		}
		cout<<ans.size()<<endl;
	}
	return 0;
}



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


ll arr[3000+1][3000+1];
 ll dp[3000+1][3000+1][4];
int main(){
ll t;
t=1;

// dp[i][j] = max(dp[i-1][j]+arr[i][j], dp[i][j-1] - min + max)
//cin>>t;
while(t--){
    ll r,c,k;
    cin>>r>>c>>k;
    
    memset(arr,0,sizeof(arr));
    for(int i=0; i<k;i++){
        ll u,v, a;
        cin>>u>>v>>a;
        arr[u][v] = a;
    }

    for(ll i=1; i<=r;i++){
        for(ll j=1; j<=c; j++){
            if(i==1&&j==1){
            dp[i][j][1] = arr[1][1];
            continue;
            }
            dp[i][j][1] = max({dp[i][j-1][1], max({dp[i-1][j][1], dp[i-1][j][2], dp[i-1][j][3]}) + arr[i][j]});          
            dp[i][j][2] = max({dp[i][j-1][2], dp[i][j-1][1] + arr[i][j] });
            dp[i][j][3] = max({dp[i][j-1][3], dp[i][j-1][2] + arr[i][j] });
        }   
    }
    
    cout<<max({dp[r][c][1], dp[r][c][2], dp[r][c][3]})<<endl;
    }

}

Measured memory_bytes: 355340
#include <iostream>
using namespace std;
 
int main() {
    //Recieve the inputs
    int D, T, S;
    cin >> D >> T >> S;
 
    //Calculate the duration of Takahashi's journey
    double time = (double)D / S;
 
    //Output depending on the inequality between T and time
    if (T >= time) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 3612
#include <iostream>
using namespace std;
#define int long long
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define SORT(x) sort(x.begin(), x.end())
#define RS(x) rsort(x.begin(),x,end()))
#define REVE(x) reverse(x.begin(), x.end())
#define ALL(x) (x).begin(), (x).end()
typedef long double ld;
signed main(){
int s,w;
cin >> s >> w;
if(s<=w){
    cout << "unsafe";
}else{
    cout << "safe";
}
}

Measured memory_bytes: 3600
#include <iostream>
#include <stdio.h>
#include <string>
#include <cmath>
#include <algorithm>
using namespace std;

int main() {
    int n, m, a, x[100000] = {}, y[100000] = {}, p = 0, q = 0;
    string s;
    cin >> n >> m;
    for (int i = 0; i < m;++i) {
        cin >> a>> s;
        if (s == "AC") x[a-1]++;
        else if (s== "WA" && x[a-1] ==0) y[a-1]++;
    }
    for (int i = 0; i < n; ++i) {
        if (x[i] != 0) {
            p++;
            q += y[i];
        }
    }
    cout << p <<" " << q << endl;

}



Measured memory_bytes: 1024
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace CsharpSpiral {
    partial class Program {
        static void Main(string[] args) {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            new Program().Solve(new ConsoleInput(Console.In, ' '));
            Console.Out.Flush();
        }
        public void Solve(ConsoleInput cin) {
            var n = cin.ReadInt;
            var k = cin.ReadInt;
            Console.WriteLine(n <= k ? 1 : 0);
        }
    }

    static class ExtendClass {
        public static string Join<T>(this T[] X, string separator = " ") => string.Join(separator, X);
    }

    class ConsoleInput {
        private readonly TextReader _stream;
        private readonly char _separator = ' ';
        private readonly Queue<string> inputStream;
        public ConsoleInput(TextReader stream, char separator = ' ') {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read {
            get {
                if(inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for(int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); } }
        public int ReadInt { get { return int.Parse(Read); } }
        public long ReadLong { get { return long.Parse(Read); } }
        public double ReadDouble { get { return double.Parse(Read); } }
        public string[] ReadStrArray(long N) {
            var ret = new string[N];
            for(long i = 0; i < N; ++i)
                ret[i] = Read;
            return ret;
        }
        public int[] ReadIntArray(long N) { var ret = new int[N]; for(long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public long[] ReadLongArray(long N) { var ret = new long[N]; for(long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
        public double[] ReadDoubleArray(long N) { var ret = new double[N]; for(long i = 0; i < N; ++i) ret[i] = ReadDouble; return ret; }
    }

}



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

#define ll long long
int absolute(int a);



int main()
{
   ios_base::sync_with_stdio(false);
   cin.tie(NULL);

   int n,k,sum=0;
   cin>>n>>k;
   int a[n];
   for(int i=0;i<n;i++)
      cin>>a[i];
   sort(a,a+n);
   for( int i=0;i<k;i++)
   sum+=a[i];
   cout<<sum;



   return 0;
}





int absolute(int a)
{
   if (a<0)return -a;
   return a;
}

Measured memory_bytes: 3644
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main()
{
	long unsigned int n, a, b;
	cin >> n;
	cin >> a;
	cin >> b;

	
	long unsigned int count = 0;

	long unsigned int  x, y;
	if ((a + b) == 0) {
		x = y = 0;
	}
	else {
		x = n / (a + b);
		y = n % (a + b);
	}
	count = a * x;
	if (y < a) {
		count += y;
	}
	else {
		count += a;
	}
	/*
	while (n > 0) {
		for (int i = 0; i < a && n > 0; i++) {
			n--;
			count++;
		}
		for (int i = 0; i < b && n > 0; i++) {
			n--;
		}
	}*/
	cout << count << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int A,B;
  cin>>A>>B;
  if((A%2==0 && B%2==0) || (A%2!=0 && B%2!=0)){
    cout<<(A+B)/2<<endl;
  }
  
  else {
    cout<<"IMPOSSIBLE"<<endl;
  }
  
  return 0;
}
       

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#define MAX 2000001
#define VMAX 10000

int main(){
  unsigned short *A, *B;
  int C[VMAX+1];
  int n, i, j;

  scanf("%d", &n);

  A = malloc(sizeof(short)*n+1);
  B = malloc(sizeof(short)*n+1);

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

   for(i=0;i<VMAX+1;i++){
    C[i]=0;
  }

  for(j=1;j<=n;j++){
    C[A[j]]++;
  }

  for(i=1;i<VMAX+1;i++){
    C[i]=C[i]+C[i-1];
  }

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

  for(i=1;i<=n;i++){
    printf("%d",B[i]);
    if(i!=n){
      printf(" ");
    }
    }
  printf("\n");


  return 0;
}



Measured memory_bytes: 9572
n, m = gets.chomp.split(" ").map(&:to_i)
pattern = [1]

for i in 1..m
	a = gets.chomp.to_i
	pattern[a] = 0
end

pattern[1] = 1 if pattern[1].nil?

for i in 2..n
	if pattern[i].nil?
		pattern[i] = pattern[i-2] + pattern[i-1]
	end
end

puts pattern[n] % 1000000007

Measured memory_bytes: 433020
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace IPT1_2B
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] StrNum = Console.ReadLine().Split(' ');
            if ((int.Parse(StrNum[0]) < int.Parse(StrNum[1])) && (int.Parse(StrNum[1]) < int.Parse(StrNum[2])))
                Console.WriteLine("Yes");
            else
                Console.WriteLine("No");
        }
    }
}

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

int main(){
    ll n;
    cin>>n;
    vector<char> s(n);
    for(ll i=0;i<n;++i){
        cin>>s[i];
    }
    sort(s.begin(), s.end());
    ll flag=1;
    for(ll i=0;i<n-1;++i){
        if(s[i]<s[i+1]){
            flag++;
        }
    }
    if(flag==3){
        cout<<"Three"<<endl;
    }else if(flag==4){
        cout<<"Four"<<endl;
    }
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
//#define int long long  ←保留
#define _CRT_SECURE_NO_WARNINGS
#define rep(i, n) for (int i = 0; i < n; i++)
#define _GLIBCXX_DEBUG
const int MOD = 1e9 + 7;
const int INF = 1e18 + 9;
constexpr long double pi = 3.141592653589793238462643383279; //円周率
/*---------------------便利な関数--------------------------------------*/
int fact(int i) {       //階乗
    if (i == 0) return 1;
    return (fact(i - 1)) * i;
}

int gcd(int a, int b) {        //最大公約数
    if (b == 0) return a;
    return gcd(b, a % b);
}

int lcm(int a, int b) {      //最小公倍数
    return a * b / gcd(a, b);
}

int keta(int n) {        //桁数を求める
    if (n == 0) return 1;
    int count = 0;
    while (n != 0) {
        n /= 10;
        count++;
    }
    return count;
}

int ketasum(int n) {    //各桁の和
    int sum = 0;
    while (n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
/*-------------ここまで---------------------------------------------*/

//C++(GCC9.2.1)

signed main() {
    int A, B; cin >> A >> B;
    int ans = 0;
    int outlet = 1;
    while (outlet < B) {
         --outlet;
        outlet += A;
        ++ans;
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;

using int64 = long long;

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

  int m, d;
  cin >> m >> d;
  int count = 0;
  for (int i = 1; i <= m; i++) {
    for (int j = 1; j <= d; j++) {
      int d1 = j / 10;
      int d2 = j % 10;
      if (d1 >= 2 && d2 >= 2 && i == d1 * d2) {
        count++;
      }
    }
  }
  cout << count << endl;
}

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

using namespace std;

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

    for (int i = 0; i < n; ++i) {
        int a;
        cin >> a;
        h -= a;
    }

    if (h <= 0) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
def resolve():

    def COMinit(n, MOD):
        fact = [1, 1]
        fact_inv = [1, 1]
        inv = [0, 1]
        for i in range(2, n + 1):
            fact.append((fact[-1] * i) % MOD)
            inv.append((-inv[MOD % i] * (MOD // i)) % MOD)
            fact_inv.append((fact_inv[-1] * inv[i]) % MOD)
        return fact, fact_inv

    # 二項係数計算
    def Combination(n, k, MOD=10 ** 9 + 7):
        # fac, finv = COMinit(n, MOD)
        if n < k: return 0
        if n < 0 or k < 0: return 0
        ret = fac[n] * (finv[k] * finv[n - k] % MOD) % MOD
        return ret

    MOD = 10 ** 9 + 7
    K = int(input())
    S = input()
    N = len(S)

    pow26 = [1] * (K + 1)
    pow25 = [1] * (K + 1)
    t1 = 1
    t2 = 1
    for i in range(K + 1):
        pow25[i] = t1
        pow26[i] = t2
        t1 *= 25
        t1 %= MOD
        t2 *= 26
        t2 %= MOD

    fac, finv = COMinit(N + K, MOD)
    v = 1
    ans = 0
    for i in range(K + 1):
        ans += pow25[i] * Combination(N-1+i, N-1) * pow26[K-i]
        ans %= MOD
    print(ans)

if __name__ == "__main__":
    resolve()


Measured memory_bytes: 223252
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

 
int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    int count = 0;
    for(int i = 0;i < n;i++){
    cin >> a[i];
    }
    for(int i = 0;i < n;i++){
        if(a[i] % 2 == 0){
            if(a[i] % 3 != 0 && a[i] % 5 != 0)
                count++;
        }
    }
    if(count > 0)
        cout << "DENIED" << endl;
    else
        cout << "APPROVED" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define endl "\n"

int main()
{
  i64 S, W;
  cin >> S >> W;
  if (W < S)
    cout << "safe" << endl;
  else
    cout << "unsafe" << endl;
  return 0;
}


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

typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef vector<vector<long long>> VVL;
typedef pair<int,int> P;
typedef tuple<int,int,int> tpl;

#define ALL(a)  (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())
#define EXIST(m,v) (m).find((v)) != (m).end()
#define LB(a,x) lower_bound((a).begin(), (a).end(), x) - (a).begin()
#define UB(a,x) upper_bound((a).begin(), (a).end(), x) - (a).begin()

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

#define en 


constexpr double EPS = 1e-9;
constexpr double PI  = 3.1415926535897932;
constexpr int INF = 2147483647;
constexpr long long LINF = 1LL<<60;
constexpr long long MOD = 1000000007; // 998244353;

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; }

vector< int64_t > divisor(int64_t n) {
  vector< int64_t > ret;
  for(int64_t i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}

void Main(){
    string s;
    cin >> s;
    int ans = 0;
    int now = 0;
    REP(i, s.size()) {
        if (s[i] == 'A' || s[i] == 'C' || s[i] == 'G' || s[i] == 'T') {
            now++;
        } else {
            now = 0;
        }
        if (now > ans) {
            ans = now;
        }
    }
    cout << ans << endl;
    return;
}

int main(void){
    cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(0);cout<<fixed<<setprecision(15);
    int t=1; //cin>>t;
    REP(_,t) Main();
    return 0;
}

Measured memory_bytes: 3628
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<utility>
#include<cmath>
#include<climits>
#include<queue>
#include<stack>
#include<numeric>
#include<set>
#include<iomanip>
#include<map>
#include<type_traits>
#include<tuple>
#include<deque>
#include<cassert>
#include<bitset>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,N) for(ll (i)=0;(i)<(N);(i)++)
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)
const int mod = 1000000007;
const int INF = 1001001001;
int dp[110][5][2];

int main() {
  string s;
  int K;
  cin >> s >> K;
  int n = s.length();
  dp[0][0][0] = 1;
  rep(i, n) rep(j, 4) rep(k, 2) rep(l, 10) {
    int ni = i + 1, nj = j, nk = k;
    if(l != 0) nj++;
    if(nj > K) continue;
    if(nk == 0) {
      if(l < s[i] - '0') dp[ni][nj][1] += dp[i][j][k];
      else if(l == s[i] - '0') dp[ni][nj][0] += dp[i][j][k];
      else break;
    } else if (nk == 1) {
      dp[ni][nj][nk] += dp[i][j][k];
    }
  }

  cout << dp[n][K][0] + dp[n][K][1] << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#define SF scanf
#define PF printf
#define MAXN 100010
using namespace std;
int a[MAXN];
int n;
int Query(int ans){
    char ret[20];
    printf("%d\n", ans);
	fflush(stdout);
    scanf("%s", ret);
    if(ret[0] == 'V') exit(0);
    return ret[0] == 'M' ? 1 : 0;
}
int main(){
    SF("%d",&n);
    memset(a,-1,sizeof a);
    a[0]=Query(0);
    int l=0,r=n-1;
    int las=0;
    while(l<=r){
        int mid=(l+r)>>1;
        if(a[mid]!=-1){
            l+=2;
            mid++;
        }
        a[mid]=Query(mid);
        if(a[mid]==a[l]){
            if((mid-l+1)%2==0)
                r=mid-1;
            else
                l=mid;
        }
        else{
            if((mid-l+1)%2!=0)
                r=mid;
            else{
                a[mid-1]=a[mid]^1;
                l=mid-1;
            }
        }
    }
}


Measured memory_bytes: 1228
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll max1=1000000;
const ll min1=-1000000;
int main()
{
    ll k ,x;
    cin>>k>>x;
    ll n=x-k+1;
    ll m=x+k-1;
    if(n>=min1 && m<=max1){
        for(ll i=n;i<=m;i++){
            printf("%I64d ",i);
        }
    }
    if(n<min1 && m<=max1){
        for(ll i=min1;i<=m;i++){
            printf("%I64d ",i);
        }
    }
    if(n>=min1 && m>max1){
        for(ll i=n;i<=max1;i++){
            printf("%I64d ",i);
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <utility>
#include <tuple>
#include <algorithm>
#include <cstdio>
#include <cmath>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
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; }

class unionFind{
  vector<int> p;
public:
  unionFind(int n){
    p = vector<int>(n, -1);
  }
  int root(int x){
    if (p[x] < 0)
      return x;
    return p[x] = root(p[x]);
  }
  int size(int x){
    return -p[root(x)];
  }
  bool unite(int x, int y){
    x = root(x);
    y = root(y);
    if(x == y){
      return false;
    }
    if(size(x) < size(y))
      swap(x, y);
    p[x] += p[y];
    p[y] = x;
    return true;
  }
};

int main() {
  int N, K, L;
  cin >> N >> K >> L;
  vector<int> p(K), q(K), r(L), s(L);
  rep(i, K) {
    cin >> p[i] >> q[i];
    p[i]--; q[i]--;
  }
  rep(i, L) {
    cin >> r[i] >> s[i];
    r[i]--; s[i]--;
  }
  unionFind uniR(N), uniT(N);
  rep(i, K)
    uniR.unite(p[i], q[i]);
  rep(i, L)
    uniT.unite(r[i], s[i]);
  map<pair<int, int>, int> mp;
  vector<int> a(N), b(N);
  rep(i, N) {
    a[i] = uniR.root(i);
    b[i] = uniT.root(i);
    mp[make_pair(a[i], b[i])]++;
  }
  rep(i, N)
    printf("%d%c", mp[make_pair(a[i], b[i])], i<N-1 ? ' ' : '\n');
  return 0;
}

Measured memory_bytes: 16640
#include <iostream>

using namespace std;

int ABS(int n){
    if (n < 0) n = -1 * n;
    return n;
}

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

    int sum = 0;
    for (int i = 1; i <= N; i++) sum += i + L - 1;

    int min = L + 1;
    for (int i = 1; i <= N; i++){
        if (ABS(min) > ABS(L + i - 1)) min = L + i - 1;
    }

    cout << sum - min << endl;
    

    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
// const int INF = (1 << 30) - 1;
// const ll LL_INF = (1LL << 62) - 1;
// const ll MOD = 1e9 + 7;

struct uf_tree {
  vector<int> par, sizes;
  uf_tree(int n) : par(n), sizes(n, 1) {
    for (int i = 0; i < n; i++) {
      par[i] = i;
    }
  }
  int find(int x) {
    if (x == par[x]) {
      return x;
    }
    return par[x] = find(par[x]);
  }
  void unite(int x, int y) {
    x = find(x);
    y = find(y);
    if (x == y) {
      return;
    }
    if (sizes[x] < sizes[y]) {
      swap(x, y);
    }
    par[y] = x;
    sizes[x] += sizes[y];
  }
  bool same(int x, int y) { return find(x) == find(y); }
  int size(int x) { return sizes[find(x)]; }
};

int N, M, K;
vector<int> friends;
vector<int> blocks;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> N >> M >> K;
  uf_tree ut(N);
  friends.resize(N);
  for (int i = 0; i < M; i++) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    ut.unite(a, b);
    friends[a]++;
    friends[b]++;
  }
  blocks.resize(N);
  for (int i = 0; i < K; i++) {
    int c, d;
    cin >> c >> d;
    c--;
    d--;
    if (ut.same(c, d)) {
      blocks[c]++;
      blocks[d]++;
    }
  }

  for (int i = 0; i < N; i++) {
    if (i != 0) {
      cout << " ";
    }
    cout << ut.size(i) - 1 - friends[i] - blocks[i];
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 2432
#include <bits/stdc++.h>
 
#define inf 0x3f3f3f3f
#define pb push_back
#define fi first
#define se second
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef vector <int> vi;
typedef vector <ll> vl;
typedef vector <ull> vu;
typedef vector <vector <int>> vvi;
typedef vector <vector <ll>> vvl;
typedef pair <int, int> pi;
typedef vector <pair <int, int>> vpi;

string s, t;

void read() {
  cin >> s >> t;
}

bool check(string s, string t) {
  for(int i = 0; s[i]; ++i)
    if (s[i] != t[i])
      return 0;
  return 1;
}

void solve() {
  if (check(s, t)) {
    cout << "Yes";
    return;
  }
  for(int c = 0; s[c]; ++c) {
    char temp = t[t.size() - 1];
    for(int i = t.size() - 1; i > 0; --i)
      t[i] = t[i - 1];
    t[0] = temp;
    if (check(s, t)) {
      cout << "Yes";
      return;
    }
  }
  if (check(s, t))
    cout << "Yes";
  else cout << "No";
}

int main() {
  ios :: sync_with_stdio(false);
  cin.tie(nullptr);
  int t = 1;
  //cin >> t; //please do not forget to comment this if there are no queries
  while(t) {
    --t;
    read();
    solve(); 
  }
  return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("O3")

#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <string>
#include <assert.h>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <random>
#include <cmath>
#include <chrono>
#include <bitset>

#define ld long double
#define pb push_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()

#define int long long
using namespace std;

const int INF = 2e18;
const int MOD = 1e9 + 7;
const int MB = 20;

void solve() {
	int n, k, q;
	cin >> n >> k >> q;
	vector<int> a(n);
	for (int i = 0; i < q; i++) {
		int x;
		cin >> x;
		x--;
		a[x]++;
	}

	for (int i = 0; i < n; i++) {
		if (k - q + a[i] > 0) cout << "Yes\n";
		else cout << "No\n";
	}
}
signed main() {
	/*
	freopen("search.in", "r", stdin);
	freopen("search.out", "w", stdout);
	*/
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	cout.precision(12);
	solve();
}

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

 ll dp[1000000];

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

    ll n;
    cin>>n;
    ll a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    ll ans = -1e18;
    ll mi=a[0];
    for(int i=1;i<n;i++){
        ans = max(ans,a[i]-mi);
        mi = min(mi,a[i]);
    }
    cout << ans << endl;
    

    
}


Measured memory_bytes: 4732
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <iomanip>
#include <string.h>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()

typedef long long lint;

using namespace std;

int main(){
  lint A,B,K;
  cin>>A>>B>>K;
  cout<<max((lint)0,A-K)<<" "<<min(B,max((lint)0,A+B-K))<<endl;
  return 0;
}


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

template<class T> void vin(vector<T>& v, int n) {
    v.resize(n);
    for (int i = 0; i < n; ++i) {
        cin >> v[i];
    }
}

int main() {
    int n, k;
    cin >> n >> k;
    priority_queue<pair<ll, ll>> que;
    priority_queue<pair<ll, ll>, vector<pair<ll, ll>>, greater<pair<ll, ll>>> que2;
    vector<int> f(n+10, 0);

    rep(i, n) {
        ll t, d;
        cin >> t >> d;
        que.push({d, t});
    }

    int co=0;
    ll x=0, s=0, ans=0;
    while (co<k) {
        pair<ll, ll> p = que.top(); que.pop();
        que2.push(p);
        s += p.first;
        if (!f[p.second]) x++;
        f[p.second]++;
        co++;
    }
    ans = s + x*x;
    ll m=-1;
    while (que.size()) {
        pair<ll, ll> p = que.top(); que.pop();
        if (f[p.second]) continue;
        ll m=-1;
        while (que2.size()) {
            pair<ll, ll> p2 = que2.top(); que2.pop();
            if (f[p2.second]>1) {
                f[p2.second]--;
                m=p2.first;
                break;
            }
        }
        if (m==-1) break;
        x++;
        f[p.second]++;
        s += p.first;
        s-=m;
        ans = max(ans, s+x*x);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 5232
class Node:
    def __init__(self, num, parent, children):
        self.id = num
        self.parent = -1
        self.children = children
        self.depth = 0
        
    def show_info(self):
        print('node {0}: '.format(self.id), end = '')
        print('parent = {0}, '.format(self.parent), end = '')
        print('depth = {0}, '.format(self.depth), end = '')
        if self.children and self.parent != -1:
            print('internal node, ', end = '')
        elif self.parent != -1:
            print('leaf, ', end = '')
        else:
            print('root, ', end = '')
        print(self.children)


def set_node(i_s):
    i_l = list(map(int, i_s.split()))
    num = i_l[0]
    children = i_l[2:]
    node = Node(num, -1, children)
    T[num] = node
    for n in children:
        T[-1] -= n

def set_pd(node, parent, depth):
    node.parent = parent
    node.depth = depth
    for n in node.children:
        set_pd(T[n], node.id, depth + 1)


import sys

n = int(sys.stdin.readline())

T = [None for i in range(n)]

T.append(int(n * (n - 1) / 2))

for x in sys.stdin.readlines():
    set_node(x)

set_pd(T[T[-1]], -1, 0)

for n in T[:-1]:
    n.show_info()

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

int a[3][3];

int main(){

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

    bool f=1;
    int d1=abs(a[0][0]-a[1][0]), d2=abs(a[1][0]-a[2][0]);
    for(int i=1; i<3; ++i){
        if( abs(a[0][i]-a[1][i])!=d1||abs(a[1][i]-a[2][i])!=d2 ){
            f=0;
            break;
        }
    }

    if(f)
        puts("Yes");
    else
        puts("No");


    return 0;
}


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

int x[1000],y[1000];
string lab[1000];

int main(){
	int n,m,s,g;
	while(cin >> n >> m >> s >> g && n){
		for(int i = 0 ; i < m ; i++){
			cin >> y[i] >> x[i] >> lab[i];
		}
		string memo[40];
		for(int i = 0 ; i < 40 ; i++) memo[i] = "~";
		memo[g] = "";
		int ref = 0;
		bool bad = 0;
		int p = 0;
		while(1){
			bool f = false;
			for(int j = 0 ; j < m ; j++){
				if(memo[x[j]]=="~") continue;
				string cost = lab[j]+memo[x[j]];
				if(cost < memo[y[j]]){
					memo[y[j]] = cost;
					f = true;
					if(s == y[j] && memo[y[j]].length() > 250){bad = true; f = false; break;}
				}
			}
			if(!f) break;
			ref++;
			if(ref == 280) { break;}
		}
		if(bad || memo[s] == "~") cout << "NO" << endl;
		else cout << memo[s] << endl;

	}
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define all(vec) vec.begin(), vec.end()
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
constexpr ll INF = (1LL << 30) - 1LL;
constexpr ll LINF = (1LL << 60) - 1LL;
constexpr double eps = 1e-9;
constexpr ll MOD = 1000000007LL;
template <typename T> bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
};
template <typename T> bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
};
template <typename T> ostream &operator<<(ostream &os, vector<T> v) {
    for (int i = 0; i < v.size(); i++) {
        os << v[i] << (i + 1 == v.size() ? "\n" : " ");
    }
    return os;
}
template <typename T> vector<T> make_v(size_t a) { return vector<T>(a); }
template <typename T, typename... Ts> auto make_v(size_t a, Ts... ts) {
    return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template <typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type fill_v(T &t, const V &v) {
    t = v;
}
template <typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type fill_v(T &t, const V &v) {
    for (auto &e : t) {
        fill_v(e, v);
    }
};
struct edge {
    ll to, cost;
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, m, p;
    cin >> n >> m >> p;
    vector<vector<edge>> g(n);
    for (int i = 0; i < m; i++) {
        int a, b, c;
        cin >> a >> b >> c;
        --a;
        --b;
        g[a].push_back({b, p - c});
    }
    vector<ll> d(n, LINF);
    d[0] = 0;
    bool f = false;
    for (int i = 0; i < 2 * n; i++) {
        for (int j = 0; j < n; j++) {
            if (d[j] == LINF)
                continue;
            for (auto e : g[j]) {
                if (d[e.to] > d[j] + e.cost) {
                    d[e.to] = d[j] + e.cost;
                    if (i >= n - 1 && e.to == n - 1)
                        f = true;
                }
            }
        }
    }
    if (f) {
        cout << -1 << endl;
    } else {
        cout << max(0LL, -d[n - 1]) << endl;
    }
}


Measured memory_bytes: 512
fn main() {
  let n = get::val::<usize>();
  let mut xs = get::list::<usize>();
  
  let mut count = 0;
  while xs.iter().any(|&x|x>=n) {
    let s = xs.iter().map(|x|x/n).sum::<usize>();
    for x in xs.iter_mut() {
      *x = *x % n + (s - *x / n)
    }
    count += s;
  }
  println!("{}", count)
}

#[allow(dead_code)]
mod get {
  use std::io::*;
  use std::str::*;

  pub fn val<T: FromStr>() -> T {
    let mut buf = String::new();
    let s = stdin();
    s.lock().read_line(&mut buf).ok();
    buf.trim_right().parse::<T>().ok().unwrap()
  }

  pub fn vals<T: FromStr>(n: usize) -> Vec<T> {
    let mut vec: Vec<T> = vec![];
    for _ in 0 .. n {
      vec.push(val());
    }
    vec
  }

  pub fn tuple<T1: FromStr, T2: FromStr>() -> (T1, T2) {
    let mut buf = String::new();
    let s = stdin();
    s.lock().read_line(&mut buf).ok();
    let mut it = buf.trim_right().split_whitespace();
    let x = it.next().unwrap().parse::<T1>().ok().unwrap();
    let y = it.next().unwrap().parse::<T2>().ok().unwrap();
    (x, y)
  }

  pub fn tuples<T1: FromStr, T2: FromStr>(n: usize) -> Vec<(T1, T2)> {
    let mut vec: Vec<(T1, T2)> = vec![];
    for _ in 0 .. n {
      vec.push(tuple());
    }
    vec
  }

  pub fn tuple3<T1: FromStr, T2: FromStr, T3: FromStr>() -> (T1, T2, T3) {
    let mut buf = String::new();
    let s = stdin();
    s.lock().read_line(&mut buf).ok();
    let mut it = buf.trim_right().split_whitespace();
    let x = it.next().unwrap().parse::<T1>().ok().unwrap();
    let y = it.next().unwrap().parse::<T2>().ok().unwrap();
    let z = it.next().unwrap().parse::<T3>().ok().unwrap();
    (x, y, z)
  }

  pub fn tuple3s<T1: FromStr, T2: FromStr, T3: FromStr>(n: usize) -> Vec<(T1, T2, T3)> {
    let mut vec: Vec<(T1, T2, T3)> = vec![];
    for _ in 0 .. n {
      vec.push(tuple3());
    }
    vec
  }

  pub fn list<T: FromStr>() -> Vec<T> {
    let mut buf = String::new();
    let s = stdin();
    s.lock().read_line(&mut buf).ok();
    buf.trim_right().split_whitespace().map(|t| t.parse::<T>().ok().unwrap()).collect()
  }

  pub fn lists<T: FromStr>(h: usize) -> Vec<Vec<T>> {
    let mut mat: Vec<Vec<T>> = vec![];
    for _ in 0 .. h {
      mat.push(list());
    }
    mat
  }

  pub fn chars() -> Vec<char> {
    let mut buf = String::new();
    let s = stdin();
    s.lock().read_line(&mut buf).ok();
    buf.trim_right().chars().collect()
  }
}

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

int main() {
    ios::sync_with_stdio(0); cin.tie(0);
    using ull = unsigned long long;
    ull x, y;
    cin >> x >> y;
    ull ans = 0;
    while((1ull << (ans++)) * x <= y);
    cout << ans - 1<< endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
  int n,itung=0;
  cin >> n;
  
  int w,h,w1,h1;
  cin >> w >> h;
  
  for(int i=0;i<n;i++){
    cin >> w1 >> h1;
    if(w1>=w && h1>=h){
     itung++; 
    }
  }
  cout << itung << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <utility>
#include <vector>
#include <queue>
#include <stack>
#include <array>
#include <algorithm>
#include <numeric>
#include <limits>
#include <string>
#include <regex>
#include <cstdio>
#include <cstring>
#include <cmath>
#define INF 2000000000
#define REP(i,b,n) for(int i = (b); i < n; i++)
#define rREP(i,b,n) for(int i = n; i >= b; i--)
using namespace std;
using ll = long long;
using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, 1, 0, -1};
const string lowercase = "abcdefghijklmnopqrstuvwxyz";
const string uppercase = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
int gcd(int a, int b){return b ? gcd(b, a % b): a;}

int main()
{
    int n;
    int l[10];
    int lmax = 0;
    int lsum = 0;

    cin >> n;
    REP(i,0,n){
        cin >> l[i];
        if (l[i] > lmax) lmax = l[i];
        lsum += l[i];
    }
    if (lmax < lsum - lmax) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}


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

int a[30];
void f(int i,int n,int rem){
	if(rem==0){
		cout<<a[0];
		for(int j=1;j<i;j++)cout<<' '<<a[j];
		cout<<endl;
		return ;
	}
	for(n=min(n,rem);n>0;n--){
		a[i]=n;
		f(i+1,n,rem-n);
	}
}
int main(){
	int n;
	while(cin>>n&&n){
		f(0,n,n);
	}
	return 0;
}

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

using namespace std;

typedef long long ll;

#define INF (int)1e9+7
#define rep(i,a,b) for(int i=a;i<b;++i)
#define rrep(i,a,b) for(int i=a;i>=b;--i)
#define vi vector<int>
#define vl vector<ll>
#define vvi vector<vector<int>>
#define vvl vector<vector<long long>>
#define pii pair<int,int>
#define pll pair<long,long>
#define vpii vector<pii>
#define vpll vector<pll>
//#define N 100005
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define PI 3.1415926535897932384626433832795



ll powM(ll a,ll b,ll m )
{ 
  a%=m;
  ll ans=1;
  while(b>0)
  {
    if(b&1)ans=ans*a%m;
    a=a*a%m;
    b>>=1;
  }

return ans;
}






int main()
{
   ios_base::sync_with_stdio(false);
    cin.tie(NULL);
ll n,m,a,b;
cin>>n>>m;
vector<ll>v[n+1];
vl level(n+1);
vector<bool>vis(n+1,false);
for(int i=1;i<=m;i++)
{
  cin>>a>>b;
  v[a].pb(b);
  v[b].pb(a);
}

queue<ll>q;
q.push(1);

while(!q.empty())
{
  ll f=q.front();
  q.pop();
vis[f]=true;
  for(int i=0;i<v[f].size();i++)
  {
    ll x=v[f][i];
    if(!vis[x])
    {
         vis[x]=true;
         level[x]=level[f]+1;
         q.push(x);
    }
  }
}

for(int i=2;i<=n;i++)if(level[i]==0)
{
  cout<<"No"<<"\n";
  return 0;
}

vector<ll>ans(n+1,n+1);
vector<ll>cur(n+1,INT_MAX);

for(int i=2;i<=n;i++)
{
  for(int j=0;j<v[i].size();j++)
  {
      ll t=v[i][j];
      if(level[t]<cur[i])
      {
        cur[i]=level[t];
        ans[i]=t;
      }
  }
}
cout<<"Yes"<<"\n";
for(int i=2;i<=n;i++)cout<<ans[i]<<"\n";

return 0;

}

Measured memory_bytes: 14312
import Control.Applicative
import Control.Monad
import Data.List

main = do
  n <- (read::String -> Int) <$> getLine
  arr <- forM [1..n] (\i -> do
              params <- words <$> getLine
              let point = (read::String -> Int) $ params !! 1
              return (params !! 0, point, i))
  let lists = map third $ sortBy myCompare arr
  forM_ lists print

myCompare::(String, Int, Int) -> (String, Int, Int) -> Ordering
myCompare (a1, b1, c1) (a2, b2, c2) = case compare a1 a2 of
                                        LT -> LT
                                        EQ -> compare b2 b1
                                        GT -> GT

third::(String, Int, Int) -> Int
third (_, _, x) = x



Measured memory_bytes: 1020
#include<bits/stdc++.h>
using  namespace std;
typedef long long ll;
#define MOD (long long)(1e9+7)
#define _(i,a,n) for(int i=a;i<n;i++)
#define zero(a) a[0]=0
bool cmp(int x,int y)
{
    return x>y;
}
int main()
{
string s;
cin>>s;
ll ans=0;
_(i,0,s.size())
ans+=s[i]-'0';
if(ans%9==0)
    cout<<"Yes"<<endl;
else
    cout<<"No"<<endl;
}


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

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

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

  int tmp;
  vector<int> dif(N);
  for (int i = 0; i < N; i++) {
    cin >> tmp;
    dif[i] = abs(tmp - X);
  }

  int ans = dif[0];
  for (int i = 1; i < dif.size(); i++) {
    ans = gcd(ans, dif[i]);
  }

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


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

using namespace std;

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define RREP(i,s,n) for(lli i=s;i>=n;i--)
#define MOD 1000000007
#define NUM 2520
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)
#define INF (1LL<<50)

signed main(){

	vector<pair<lli,lli>> v;
	lli n;

	cin>>n;

	for(lli i=1;i<=n;i++){
		for(lli j=i+1;j<=n;j++){
			if(n%2==0){
				if(j == n-i+1)continue;
			}
			else{
				if(j == n-i)continue;
			}
			v.push_back(make_pair(i,j));
		}
	}
	lli size = v.size();
	cout<<size<<endl;
	REP(i,0,size){
		cout<<v[i].first<<" "<<v[i].second<<endl;
	}

	return 0;
}

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

#define fastio 			ios::sync_with_stdio(0);	cin.tie(0); cout.tie(0);  cout<<fixed;  cout<<setprecision(12);	
#define randomINT 		mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define	newl 			cout<<"\n"
#define DISP(as)		for(auto it : as) cout<<it<<" ";newl;
#define all(x)         	(x).begin(),(x).end()
#define mset(x,val)    	memset(x,val,sizeof(x))
#define newl           	cout<<"\n"
#define pb             	push_back
#define mp             	make_pair
#define f 				first
#define s 				second
#define dline          cerr<<"///REACHED///\n";
#define deb1(x)        cerr<<#x<<" = "<<x<<'\n';
#define deb2(x,y)      cerr<<'['<<#x<<','<<#y<<"] = "<<'['<<x<<','<<y<<']'<<'\n';
#define deb3(x,y,z)    cerr<<'['<<#x<<','<<#y<<','<<#z<<"] = "<<'['<<x<<','<<y<<','<<z<<']'<<'\n';

typedef long long 				ll;
typedef long double 			ld;
typedef vector<ll> 				vll;
typedef pair<ll ,ll> 			pll;
typedef pair<ld,ld> 			pld;
typedef unordered_map<ll,ll> 	um;
typedef vector<pll> 			vpll;

const ll 	MAX5 	= 	1e+5+7;
const ll 	MAX7 	= 	1e+7+7;
const ll 	MAXN 	= 	MAX7;
const ll   	INF   	=  	0x7f7f7f7f7f7f7f7f;
const ll  	INFi 	=  	0x7f7f7f7f;
const ll 	MOD		=  	1000000007;

/*vll adj[MAXN];ll visit[MAXN]={};
ll dx8[]={0,1,1,1,0,-1,-1,-1}, dy8[]={1,1,0,-1,-1,-1,0,1};
ll dx4[]={0,1,0,-1}, dy4[]={1,0,-1,0};
*/
// <------------- Declare Variables Here ------------> //

ll T=1;
ll n,x,y,m,k,d,w,summ;
string s,t;
vll a,b;

ll cnt[4000][4000];
// <------------- Implement Functions Here ----------> //

// <------------- Start of main() -------------------> //

void MAIN(ll _) {
	cin >> n;
	a = vll(n);
	for(ll i=0;i<n;i++) {
		cin>>a[i];
		a[i]--;
	}
	ll cou = 0;
	for(ll i=0;i<n;i++) {
		if(a[i]==i){
			cou++;
			if(i!=n-1)
				swap(a[i],a[i+1]);
			else
				swap(a[i],a[i-1]);
		}
	}
	cout<<cou;
}

int main() {
	fastio;randomINT;
	//freopen("out_hc.txt","w+",stdout);
	//cin>>T;
	for(ll i=1;i<=T;i++) {
		MAIN(i);
	}
	return 0;
}



Measured memory_bytes: 4040