akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>

int main()
{
    int n,k,m;
    scanf("%d %d",&n,&k);
    int arr[k];
    
    for ( int i=0 ; i<k ; i++ ) {
        scanf("%d",arr+i);
    }
    
    for ( int i=0 ; i<(k-1) ; i++) {
        for ( int j=i+1 ; j<=(k-1) ; j++) {
            if ( arr[i] < arr[j]) {
                arr[i] = arr[i]^arr[j];
                arr[j] = arr[i]^arr[j];
                arr[i] = arr[i]^arr[j];
            }
        }
    }
    
    for ( int i=0 ; i<(n-k) ; i++ ) {
        scanf("%d",&m);
        if ( arr[0] > m)
            arr[0] = m;
        for ( int p=0 ; p<(k-1) ; p++) {
        for ( int q=p+1 ; q<=(k-1) ; q++) {
            if ( arr[p] < arr[q]) {
                arr[p] = arr[p]^arr[q];
                arr[q] = arr[p]^arr[q];
                arr[p] = arr[p]^arr[q];
            }
        }
    }
    }
    /*for( int i=0 ; i<k ; i++ ) {
        printf("%d\t",arr[i]);
    }*/
    m = 0;
    for (int i=0 ; i<k ; i++ ) {
        m += arr[i];
    }
    
    printf("%d",m);
    
    return 0;
}

Measured memory_bytes: 1668
#include <bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define rep(i,a,b) for(int i=a; i<b; i++)
#define dep(i,a,b) for(int i=a; i>=b; i--)
#define sq(a) (a)*(a)
#define ms(a,v)	memset(a,v,sizeof a)
using namespace std;
const long long INF = 1e18 , MAXN =1e5, MOD = 1e9 + 7;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<vector<int> > vvi;
typedef map<int, int> mii;
typedef map<string, int> msi;
typedef map<int, string> mis;
typedef map<string, string> mss;

int main()
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n,m;  cin>>n>>m;
  int arr[n],sum=0;
  rep(i,0,n) cin>>arr[i],sum+=arr[i];
  int n1=m;
  int i=0;
  while (i<n && n1>0){
    if (arr[i]*m*4>=sum)  n1--;
    i++;
  }
  if (n1<=0)  cout<<"Yes\n";
  else  cout<<"No\n";
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(ll i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  ll n, h;
  cin >> n >> h;
  vector<P> p;
  rep(i, n) {
    ll a, b;
    cin >> a >> b;
    p.push_back({a, 0});
    p.push_back({b, 1});
  }
  sort(all(p), greater<P>());
  ll ans = 0, now = 0;
  for(ll i = 0; now < h; i++) {
    ll a = p[i].first;
    ll t = p[i].second;
    if(t == 1) {
      ans++;
      now += a;
    } else {
      ans += (h - now + a - 1) / a;
      break;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 7348
#include <iostream>
using namespace std;
bool isPrime (int);

int main()
{
    int number, i;
    cin>>number;
    for (i=number; !isPrime(i); i++);

    cout<<i;
    return 0;
}

bool isPrime (int a)
{
    int counter=0;
    for (int i=2; i<=a/2; i++)
        if (a%i==0)
            counter++;

    if (counter==0)
        return true;
    else
        return false;
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<array>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<functional>
#include<limits>
#include<list>
#include<map>
#include<numeric>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<unordered_map>
#include<queue>
#include<regex>
#include<vector>
using namespace std;

//#define int long long
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;

#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(a) (a).begin(),(a).end()
#define dump(o) {cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) {cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
const int MOD = 1e9 + 7;

//n??????
//Radix r("0123456789abcdef");
//http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0208
class Radix {
private:
	const char* s;
	int a[128];
public:
	Radix(const char* s = "0123456789ABCDEF") : s(s) {
		for (int i = 0; s[i]; i++) a[(int)s[i]] = i;
	}
	//10?????´??° ??? n???????????????
	string format(long long x, int n) {
		if (!x) return "0";
		char t[64] = {};
		int i;
		for (i = 62; x; i--) {
			t[i] = s[x % n];
			x /= n;
		}
		return string(t + i + 1);
	}
	//m??????????????? ??? n???????????????
	string format(const string &t, int m, int n) {
		return format(format(t, m), n);
	}
	//m??????????????? ??? 10?????´??°
	long long format(const string &t, int m) {
		long long sm = a[(int)t[0]];
		for (int i = 1; i < (int)t.length(); i++)
			sm = sm * m + a[(int)t[i]];
		return sm;
	}
};


signed main() {
	string color[] = { "black","blue","lime","aqua","red","fuchsia","yellow","white" };
	int R[] = { 0,0,0,0,0xff,0xff,0xff,0xff };
	int G[] = { 0,0,0xff,0xff,0,0,0xff,0xff };
	int B[] = { 0,0xff,0,0xff,0,0xff,0,0xff };
	Radix r("0123456789abcdef");
	for (string s; cin >> s&&s != "0";) {
		int RR, GG, BB;
		RR = r.format(s.substr(1, 2), 16);
		GG = r.format(s.substr(3, 2), 16);
		BB = r.format(s.substr(5, 2), 16);
		int min = INF, ans;
		rep(i, 0, 8) {
			int d = (RR - R[i])*(RR - R[i]) + (GG - G[i])*(GG - G[i]) + (BB - B[i])*(BB - B[i]);
			if (min > d) {
				min = d;
				ans = i;
			}
		}
		cout << color[ans] << endl;
	}
	return 0;
}

Measured memory_bytes: 3176
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define rep(i,from,to) for(int i=from; i<to; ++i)
#define REP(i,from,to) for(int i=from; i<=to; ++i)
using namespace std;

const int MAXN = 250000;
bool p[MAXN];
int n;

void maketbl() {
	for (int i = 0; i < MAXN; ++i) {
		p[i] = false;
	}
	p[0] = p[1] = true;
	for (int i = 2; i < MAXN; ++i) {
		if (p[i]) {
			continue;
		}
		for (int j = i * 2; j < MAXN; j += i) {
			p[j] = true;
		}
	}
}

void solve() {
	while (cin >> n, n) {
		int ans = 0;
		REP(i,n+1,2*n)
		{
//			printf("%2d: %d\n", i, p[i]);
			if (!p[i]) {
				ans++;
			}
		}
		cout << ans << endl;
	}
}

int main() {
	maketbl();
	solve();
}

Measured memory_bytes: 3316
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
#include <queue>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    ll a, b, z = 0;
    cin >> a >> b;
    if (a + 28 > b) {
        for (ll i = a; i <= b; i++) z ^= i;
    } else {
        while (a % 4 != 0) z ^= a, a++;
        while (b % 4 != 3) z ^= b, b--;
    }
    cout << z;
}


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

#define int long long
#define rep(i,l,r) for(int i=(int)(l);i<(int)(r);i++)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)x.size())
template<class T>bool chmax(T &a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,T b){if(a>b){a=b;return 1;}return 0;}


/*{
  }*/

using vi = vector<int>;
using vvi = vector<vi>;
using P = pair<int,int>;

//constexpr int mod = 1e9+7;
//constexpr int inf = 1<<30;

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

  if(a+b+c >= 22) cout << "bust" << endl;
  else cout << "win" << endl;

  return 0;
}



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

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            StringBuilder sb = new StringBuilder();
            const int MAX = 1000000;

            bool[] isPrime = Enumerable.Repeat(true, MAX).ToArray();
            isPrime[0] = isPrime[1] = false;

            int[] primeCounts = new int[MAX];
            int count = 0;

            for (int i = 2; i < MAX; i++)
            {
                if (isPrime[i])
                {
                    if (i < Math.Sqrt(MAX))
                    {
                        for (int j = i * i; j < MAX; j += i) isPrime[j] = false;
                    }
                    count++;
                }
                primeCounts[i] = count;
            }

            string input;
            while (!string.IsNullOrEmpty(input = Console.ReadLine()))
            {
                int n = int.Parse(input);
                sb.AppendLine(primeCounts[n].ToString());
            }
            Console.Write(sb);
        }
    }
}

Measured memory_bytes: 16024
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;
int main(void){
    int n;
    ll mi = 0,sum = 0,ab_mn = 9223372036854775807;
    cin >> n;
    vector<int> a(n);
    for(int i = 0;i < n;i++){
        cin >> a[i];
        if(a[i] < 0) mi++;
        if(abs(a[i]) < ab_mn) ab_mn = abs(a[i]);
        sum += abs(a[i]);
    }
    ll ans = 0;
    if(mi % 2 == 0) cout << sum << endl;
    else cout << sum - 2*ab_mn << endl;
    return 0;
}

Measured memory_bytes: 640
//#include <bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <stdio.h>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <time.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int N, A[int(2e5 + 5)];
Pii P[int(2e5 + 5)];
set <ll> st = {0};

int main(){
  scanf("%d", &N);
  st.insert(N + 1);
  for (int i = 1; i <= N; i++){
    scanf("%d", A + i);
    P[i] = {A[i], i};
  }
  sort(P + 1, P + N + 1);

  ll ans = 0;
  for (ll i = 1; i <= N; i++){
    ll now = P[i].se;
    st.insert(now);

    auto L = st.find(now), R = st.find(now);
    L--; R++;
    ans += i * (*R - now) * (now - *L);
  }
  printf("%lld\n", ans);

  return 0;
}


Measured memory_bytes: 15452
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<string>
#include<stack>
#include<cstdio>
#include<cmath>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<int,P> P1;

#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define rep(i,x) for(int i=0;i<x;i++)
#define rep1(i,x) for(int i=1;i<=x;i++)
#define rrep(i,x) for(int i=x-1;i>=0;i--)
#define rrep1(i,x) for(int i=x;i>0;i--)
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define uniq(vec) vec.erase(unique(vec.begin(),vec.end()),vec.end())
#define mp1(a,b,c) P1(a,P(b,c))

const int INF=1000000000;
const int dir_4[4][2]={{1,0},{0,1},{-1,0},{0,-1}};
const int dir_8[8][2]={{1,0},{1,1},{0,1},{-1,1},{-1,0},{-1,-1},{0,-1},{1,-1}};

int main(){
	int n;
	string s,t;
	cin >> n >> s >> t;
	int a[30] = {} , b[30] = {};
	rep(i,n){
		a[s[i]-'a'] ++;
		b[t[i]-'a'] ++;
	}
	
	vector<int> A,B;
	rep(i,26){
		A.pb(a[i]);
		B.pb(b[i]);
	}
	sor(A);
	sor(B);
	
	int ret = 0;
	rep(i,26){
		ret += abs(A[i]-B[i]);
	}
	
	cout << ret/2 << endl;
}

Measured memory_bytes: 1528
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define UNIQUE(v) v.erase(unique(all(v)), v.end());
#define ZIP(v) sort(all(v)),UNIQUE(v)
#define ADD(a, b) a = (a + b) % mod
#define SUB(a, b) a = (a+mod-b)%mod
#define MUL(a, b) a = (a * b) % mod
#define repi(i,m,n) for(int i = m;i < n;i++)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rep(i,n) repi(i,0,n)
#define rrep(i,n) repi(i,1,n+1)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define dmp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define fi first
#define se second
typedef pair<int,int> P;
typedef pair<int, P> PP;
typedef pair<P, int> Pi;
typedef vector<int> vi;
typedef deque<int> dq;
const int inf = 1e9+7;
const int INF = 1e18+7;

int s[2][200000], d[200000];
signed main(){
	int n, m, p;
	scanf("%lld%lld%lld", &n, &m, &p);
	rep(i,m){
		int x;
		scanf("%lld", &x);
		d[x] = 1;
	}
	rrep(i,n-1){
		int pp = (p+i)%n;
		s[0][pp] = s[0][(n+pp-1)%n];
		if(d[pp])s[0][pp] = 100*i;
	}
	rrep(i,n-1){
		int pp = (n+p-i)%n;
		s[1][pp] = s[1][(pp+1)%n];
		if(d[pp])s[1][pp] = 100*i;
	}
	int ans = INF;
	rrep(i,n){
		int pp = (p+i)%n;
		chmin(ans, 2*s[0][pp]+s[1][(pp+1)%n]);
		chmin(ans, s[0][pp]+2*s[1][(pp+1)%n]);
	}
	//rep(i,n)printf("%3lld ", s[0][i]);printf("\n");
	//rep(i,n)printf("%3lld ", s[1][i]);printf("\n");
	printf("%lld\n", ans);
	return 0;
}








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


int main() {
int n;
cin >> n;
map<string,int> mp;
rep(i,n) {
  string a;
  cin >> a;
  if (mp.count(a)) mp[a]++;
  else mp[a] = 1;
}
vector<pair<int,string>> vec(mp.size());
int i = 0;
for (auto p : mp) {
  vec.at(i).first = p.second;
  vec.at(i).second = p.first;
  i++;
}
sort(vec.begin(),vec.end());
int maxi = vec.at(mp.size()-1).first;
rep(i,vec.size()) {
  if (vec.at(i).first == maxi) cout << vec.at(i).second << endl;
}
}



Measured memory_bytes: 26764
#[allow(unused_imports)]
use proconio::{input, marker::*};

#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};

#[allow(unused_imports)]
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*).unwrap();
    }
}

fn main() {
    input! {
        n: usize,
        c: Chars,
    }

    let mut l = 0;
    let mut r = n - 1;
    let mut count = 0usize;
    while l < r {
        for lt in l..r + 1 {
            if c[lt] == 'W' {
                l = lt;
                break;
            }
        }
        for rt in (l..r + 1).rev() {
            if c[rt] == 'R' {
                r = rt;
                break;
            }
        }
        if l < r && c[l] == 'W' && c[r] == 'R' {
            count += 1;
            l += 1;
            r -= 1;
        } else {
            break;
        }
    }
    println!("{}", count);
}


Measured memory_bytes: 3028
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

/**
 * Unique number
 */
public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line = "";

		while ((line = br.readLine()) != null && !line.isEmpty()) {

			int n = Integer.parseInt(line);
			short[][] occured = new short[3][101];
			short[][] choice = new short[n][3];

			short c1, c2, c3;
			StringTokenizer st;
			for (int i = 0; i < n; i++) {
				st = new StringTokenizer(br.readLine());
				c1 = Short.parseShort(st.nextToken());
				c2 = Short.parseShort(st.nextToken());
				c3 = Short.parseShort(st.nextToken());
				occured[0][c1]++;
				occured[1][c2]++;
				occured[2][c3]++;
				choice[i][0] = c1;
				choice[i][1] = c2;
				choice[i][2] = c3;
			}

			short points;
			StringBuilder sb = new StringBuilder();
			for (int i = 0; i < n; i++) {
				points = 0;
				for (int j = 0; j < 3; j++) {
					if (occured[j][choice[i][j]] < 2) {
						points += choice[i][j];
					}
				}
				sb.append(points + "\n");
			}
			
			System.out.print(sb.toString());
		}

	}
}

Measured memory_bytes: 17032
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <map>
#include <queue>
#include <list>
#define rep(i,n) for(int i=0;i<(n);i++)
#define crep(i) for(char i='a';i<='z';i++)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define psortfirst(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.first<b.first;});
#define All(x) (x).begin(),(x).end()
int ctoi(const char c){
  if('0' <= c && c <= '9') return (c-'0');
  return -1;
}
using namespace std;
using pii  = pair<int,int>;
long long gcd(long long a, long long b){return (b == 0 ? a : gcd(b, a%b));}
long long lcm(long long a, long long b){return a*b/gcd(a,b);}
typedef long long ll;
#define MOD 1000000007
#define EPS 10e-8

map<ll,ll> M;

int main(){
    ll N,x=0,m=0;
    cin >> N;
    char S[107];
    cin >> S;
    rep(i,N){
        if(S[i]=='I'){
            x++;
            if(x>m){
                m=x;
            }
        }
        else{
            x--;
        }
    }
    cout << m << endl;
}

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

int main() {
	ios::sync_with_stdio(0); cout.tie(0); cin.tie(0);
	int n, m; cin >> n >> m;
	vector<vector<char>> a(n, vector<char>(m));
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			cin >> a[i][j];
		}
	}
	vector<vector<int>> pre1(n, vector<int>(m)), pre2(m, vector<int>(n)), suf1(n, vector<int>(m)), suf2(m, vector<int>(n));
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			if (a[i][j] == '#') {
				pre1[i][j] = 0;
			} else {
				pre1[i][j] = (j == 0 ? 1 : pre1[i][j - 1] + 1);
			}
		}
	}
	for (int j = 0; j < m; j++) {
		for (int i = 0; i < n; i++) {
			if (a[i][j] == '#') {
				pre2[j][i] = 0; 
			} else {
				pre2[j][i] = (i == 0 ? 1 : pre2[j][i - 1] + 1);
			}
		}
	}
	for (int i = 0; i < n; i++) {
		for (int j = m - 1; j >= 0; j--) {
			if (a[i][j] == '#') {
				suf1[i][j] = 0;
			} else {
				suf1[i][j] = (j == m - 1 ? 1 : suf1[i][j + 1] + 1);
			}
		}
	}
	for (int j = 0; j < m; j++) {
		for (int i = n - 1; i >= 0; i--) {
			if (a[i][j] == '#') {
				suf2[j][i] = 0; 
			} else {
				suf2[j][i] = (i == n - 1 ? 1 : suf2[j][i + 1] + 1);
			}
		}
	}
	int ans = 0;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			ans = max(ans, pre1[i][j] + pre2[j][i] + suf1[i][j] + suf2[j][i]);
			//cout << i << " " << j << " " << pre1[i][j] + pre2[j][i] + suf1[i][j] + suf2[j][i] << '\n';
		}
	}
	cout << ans - 3 << '\n';
}


Measured memory_bytes: 69964
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#define CK(N, A, B) (A <= N && N < B)
#define REP(i, a, b) for (int i = a; i < b; i++)
#define RREP(i, a, b) for (int i = (b - 1); a <= i; i--)
#define F first
#define S second
#define ll long long

const int INF = 1e9;
const long long LLINF = 1e18;

using namespace std;

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

/*==================================================*/
/*variable*/
int N;
/*==================================================*/
/*function*/

/*==================================================*/

int main() {
    cin>>N;

    if(N < 1000){
        cout<<"ABC"<<endl;
    }else{
        cout<<"ABD"<<endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main() {
  int k, a, b,num=0;
  scanf("%d", &k);
  scanf("%d %d", &a, &b);
  num = a / k;
  num *= k;
  num += k;
  if(num < b || b % k == 0 || a % k == 0) printf("OK");
  else printf("NG");
}

Measured memory_bytes: 1724
#include<iostream>
#define MAXN 100005
using namespace std;
struct box
{
	int num;
	bool flag;
}box[MAXN];

int main() {
	int N, M, fromNo, toNo, count = 0;
	cin >> N >> M;
	for (int i = 1; i <= N; i++) {
		box[i].num = 1;
	}
	box[N];
	box[1].flag = true;
	for (int i = 0; i < M; i++) {
		cin >> fromNo >> toNo;
		if (box[fromNo].flag == true)
			box[toNo].flag = true;
		box[fromNo].num--;
		box[toNo].num++;
		if (box[fromNo].num == 0)
			box[fromNo].flag = false;
	}
	for (int i = 1; i <= N; i++) {
		if (box[i].flag == true)
			count++;
	}
	cout << count << endl;
	//system("pause");
	return 0;
}

Measured memory_bytes: 1024
#include <algorithm>
#include <bitset>
#include <cctype>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;

int main() {
    int n, x;
    while (cin >> n >> x, n || x) {
        int ans = 0;
        for (int i = 1; i <= n; i++) {
            for (int j = i + 1; j <= n; j++) {
                for (int k = j + 1; k <= n; k++) {
                    if (i + j + k == x) {
                        ans++;
                    }
                }
            }
        }
        cout << ans << endl;
    }
}

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

int main(){
  int n;
  cin >> n;
  vector<int> d(n);
  rep(i,n) cin >> d[i];
  
  ll ans = 0;
  
  for(int i=0;i<n;i++){
    for(int j=i+1;j<n;j++){
      ans += d[i]*d[j];
    }
  }
  
  cout << ans << endl;
}


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

int main(){
  int N, K;
  cin >> N >> K;
  
  vector<int> ball(N);
  
  for (int i = 0; i < N; i++) {
    int a;
    cin >> a;
    ball.at(a - 1)++;
  }
  
 
  sort(ball.begin(), ball.end());
  
  int ans = 0;
  
  for (int i = 0; i < N - K; i++) {
    ans += ball.at(i);
  }
  
  cout << ans << endl;
  
}

Measured memory_bytes: 1024
#include <iostream>
#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>
#include <math.h>
#define int long long
using namespace std;
signed main() {
    int X;
    cin>>X;

    if(X==1){
        cout<<0<<endl;
    }
    else{
        cout<<1<<endl;
    }
}

Measured memory_bytes: 3620
class Card:
    __slots__ = ["mark", "value"]

    def __init__(self, text):
        self.mark = text[0]
        self.value = int(text[1])

    def __str__(self):
        return f"{self.mark}{self.value}"


def BubbleSort(lst):
    lst = lst.copy()
    for i in range(0, len(lst)):
        for j in range(len(lst) - 1, i, -1):
            if lst[j].value < lst[j -1].value:
                lst[j], lst[j - 1] = lst[j - 1], lst[j]
    return lst


def SelectionSort(lst):
    lst = lst.copy()
    for i in range(0, len(lst)):
        minj = i
        for j in range(i, len(lst)):
            if lst[j].value < lst[minj].value:
                minj = j
        lst[i], lst[minj] = lst[minj], lst[i]
    return lst

def check_stable(lst):
    for x in range(1, 10):
        if "".join(c.mark for c in lst if c.value == x) != "".join(c.mark for c in C if c.value == x):
            return False
    return True


input()
C = [Card(i) for i in input().split()]
B = BubbleSort(C)
S = SelectionSort(C)
print(" ".join(map(str, B)))
print("Stable" if check_stable(B) else "Not stable")
print(" ".join(map(str, S)))
print("Stable" if check_stable(S) else "Not stable")



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

int main(){
    int n;
    cin>>n;
    n-=400;
    n/=200;
    int ans=8-n;
    cout<<ans<<endl;
}

Measured memory_bytes: 3628
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define rep2(i,n) for(int i=0;i<=n;i++)
#define repr(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define do long double
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 INF=1e10;
int MOD=1e9+7;
struct Union{
  vector<int> par;
  Union(int n){
  par= vector<int>(n, -1);
  }
  int find(int x){
    if(par[x]<0)
      return x;
    else
      return par[x]=find(par[x]);
  }
  bool same(int a,int b){
    return find(a)==find(b);
  }
  int Size(int a){
    return -par[find(a)];
  }
  void unite(int a,int b){
    a=find(a);
    b=find(b);
    if(a==b)
      return;
    if(Size(b)>Size(a))
      swap<int>(a,b);
    par[a]+=par[b];
    par[b]=a;
  }
};
signed main(){
int a,b;
cin>>a>>b;
 int c[b][3];
rep(i,b)rep(j,3)
cin>>c[i][j];
Union d(a);
rep(i,b){
  d.unite(c[i][0]-1,c[i][1]-1);
}
vector<int> e(a);
rep(i,a){
e[i]=d.find(i);
}
sort(all(e));
e.erase(unique(all(e)),e.end());
cout<<e.size()<<endl;
}


Measured memory_bytes: 4224
$count = 0

def merge(a, left, mid, right)
  la = a[left..mid]
  ra = a[mid+1..right]
  sorted = []
  i = 0
  j = 0
  while i < la.size || j < ra.size
    if la[i] <= ra[j]
      sorted <<  la[i]
      i += 1
    else
      sorted << ra[j]
      j += 1
    end
    $count += 1
    if la.size <= i
      until ra.size <= j
        sorted << ra[j]  
        j += 1
        $count += 1
      end
    elsif ra.size <= j
      until la.size <= i
        sorted << la[i] 
        i += 1
        $count += 1
      end
    end
  end
  sorted
end

def merge_sort(a, left, right)
  if right - left > 0
    mid = (left + right) / 2
    sorted = merge_sort(a[0..mid], 0, mid) + merge_sort(a[mid+1..right], 0, right - (mid + 1))
    merge(sorted, left, mid, right)
  else
    a
  end
end

n = gets.to_i
a = gets.split.map(&:to_i)
puts merge_sort(a, 0, n-1).join(' '), $count

Measured memory_bytes: 267448
//奇数文字目がすべて R, U, D のいずれか。
//偶数文字目がすべて L, U, D のいずれか。

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

int main(){
	string S;
  	int x=0;
  	cin>>S;
	for(int i=0;i<S.size();i+=2){
	if(S[i]=='R'||S[i]=='U'||S[i]=='D'){
	x++;
 	}
    }
    for(int i=1;i<S.size();i+=2){
	if(S[i]=='L'||S[i]=='U'||S[i]=='D'){
	x++;
 	}
    }
	if (x==S.size())cout<<"Yes"<<endl;
  	else cout<<"No"<<endl;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	static Scanner scanner;

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

	    int A=gi();
	    int B=gi();
	    int C=gi();
boolean flg=false;
	    for(int i=1;i<=B; i++) {
	    	if(((A*i)%B) == C) {
	    		flg=true;
	    	}
	    }
        //System.out.println((H-h)*(W-w));
        if (flg) {
        	System.out.print("YES");
        }else {
        	System.out.print("NO");
        }


	}

	// 文字列として入力を取得
	public static String gs() {
		return scanner.next();
	}

	// intとして入力を取得
	public static int gi() {
		return Integer.parseInt(scanner.next());
	}

	// longとして入力を取得
	public static long gl() {
		return Long.parseLong(scanner.next());
	}

	// doubleとして入力を取得
	public static double gd() {
		return Double.parseDouble(scanner.next());
	}
}

Measured memory_bytes: 35560
def resolve():
    N = int(input())
    T = list(map(int, input().split()))
    M = int(input())
    PX = [list(map(int, input().split())) for i in range(M)]
    sumT = sum(T)
    for px in PX:
        print(sumT-T[px[0]-1]+px[1])
    

if '__main__' == __name__:
    resolve()

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

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

    //各方向に対応する差分を持った配列を利用して調べると実装が楽になる。
    string board[50];

    for (int i = 0; i < h; i++) {
        cin >> board[i];
    }

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

    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            if (board[i][j] == '#') {
                continue;
            }

            int num = 0;
            for (int d = 0; d < 8; ++d) {
                const int ni = i + dy[d];
                const int nj = j + dx[d];

                if (ni < 0 or h <= ni) continue;
                if (nj < 0 or w <= nj) continue;
                if (board[ni][nj] == '#') num++;
            }

            board[i][j] = char(num + '0');
        }
    }
    for (int i = 0; i < h; ++i) cout << board[i] << endl;

    return 0;
}

Measured memory_bytes: 256
#include<set>
#include<map>
#include<cmath>
#include<queue>
#include<bitset>
#include<string>
#include<cstdio>
#include<cctype>
#include<cassert>
#include<cstdlib>
#include<cstring>
#include<sstream>
#include<iostream>
#include<algorithm>

#define For(i,x,y) for (int i=x;i<y;i++)
#define pb push_back
#define mp make_pair
#define fi first
#define se second

#define dprintf(...) fprintf(stderr,__VA_ARGS__)
using namespace std;

typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
typedef vector<int> Vi;

int IN(){
	int c,f,x;
	while (!isdigit(c=getchar())&&c!='-');c=='-'?(f=1,x=0):(f=0,x=c-'0');
	while (isdigit(c=getchar())) x=(x<<1)+(x<<3)+c-'0';return !f?x:-x;
}

const int N=1e5+19;
const int p=1e9+7;

int x[N],y[N];
int n,m;

int calc(int *A,int n){
	int res=0,sum=0;
	sort(A+1,A+n+1);
	For(i,1,n+1){
		res=(res+1ll*(i-1)*(A[i]+p))%p;
		res=(res-sum+p)%p;
		sum=(0ll+sum+A[i]+p)%p;
	}
	return res;
}

int main(){
	n=IN(),m=IN();
	For(i,1,n+1) x[i]=IN();
	For(i,1,m+1) y[i]=IN();
	printf("%d\n",1ll*calc(x,n)*calc(y,m)%p);
}

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


int tax(int X, int i) {
  return i * (100 + X) / 100;
}

int main() {
  int X;
  int Y;
  int S;
  
  while (true)
    {
      cin >> X >> Y >> S;
      if (X == 0 && Y == 0 && S == 0) break;
      int maximum = 0;
      
      for (int i = 1; i < S; i++) {
	for (int j = 1; j < S; j++) {
	  if (tax(X, i) + tax(X, j) == S) {	    
	    if (maximum < tax(Y, i) + tax(Y, j)) {
	      maximum = tax(Y, i) + tax(Y, j); // (*)
	      //cout << maximum << endl;
	      //cout << "i is " << i << endl;
	      //cout << "j is" << j << endl;
	    }
	  }
	}
      }

  cout << maximum << endl;
    }    
}

Measured memory_bytes: 1160
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
char g[202][202];
int vis[202][202];
int main()
{
    int i, j, k;
    int n, t, m;
    int h , w;
    cin >> h >> w;
    getchar();
    for(i = 1; i <= h; i++) {
        for(j = 1; j <= w; j++) {
            scanf("%c", &g[i][j]);
        }
        getchar();
    }
    memset(vis, 0x3f, sizeof(vis));
    int cnt = 1;
    vis[0][1] = 0;
    vis[1][0] = 0;
    while(1) {
        for(i = 1; i <= h; i++) {
            for(j = 1; j <= w; j++) {
                if(vis[i][j] == 0x3f3f3f3f) {
                    if(g[i][j] == '.') {
                        vis[i][j] = min(vis[i-1][j], vis[i][j-1]);
                    }
                    else {
                        vis[i][j] = min(vis[i][j], vis[i-1][j]+!(g[i-1][j] == '#'));
                        vis[i][j] = min(vis[i][j], vis[i][j-1]+!(g[i][j-1] == '#'));
                    }
                }
            }
        }
        if(vis[h][w] != 0x3f3f3f3f) break;
    }

    cout << vis[h][w] << endl;
    return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <string>

using namespace std;

int main(){
    set<int>st;
    int n;
    cin >> n;
    for(int i = 0; i < n; i++){
        int temp;
        cin >> temp;
        st.insert(temp);
    }
    cout << st.size() << endl;
}

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

int main() {
  string s;
  cin >> s;
  int a,b,c,d;
  a = s[0]-'0';b = s[1]-'0';c = s[2]-'0';d = s[3]-'0';
  for (int bit = 0; bit < (1<<3); ++bit){
    int sum = a;
    char op1,op2,op3;
    if(bit & (1<<0)){
      sum += b;
      op1 = '+';
    }
    else{
      sum -= b;
      op1 = '-';
    }
    if(bit & (1<<1)){
      sum += c;
      op2 = '+';
    }
    else{
      sum -= c;
      op2 = '-';
    }
    if(bit & (1<<2)){
      sum += d;
      op3 = '+';
    }
    else{
      sum -= d;
      op3 = '-';
    }
    if(sum == 7){
      cout << a << op1 << b << op2 << c << op3 << d << "=7" << endl;
      return 0;
    }
  }
}

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

using namespace std;

int n, frequency[183579396], ncr[40][40];
char x[20];
long long answer;

int main() {
	for (int i = 0; i < 40; i++) {
		ncr[i][0] = ncr[i][i] = 1;
		for (int j = 1; j < i; j++)
			ncr[i][j] = ncr[i - 1][j - 1] + ncr[i - 1][j];
	}
	// printf("%d\n", ncr[35][10]);
	scanf("%d", &n);
	while (n--) {
		scanf("%s", x);
		sort(x, x + 10);
		int id = 0;
		for (int i = 0; i < 10; i++)
			id += ncr['z' - x[i] + 9 - i][10 - i];
		// printf("id=%d\n", id);
		answer += frequency[id]++;
	}
	printf("%lld\n", answer);
}



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

using namespace std;
#define ll long long
#define inf 998244353

ll fun(ll n,ll m)
{
    ll s=1;
    while(m)
    {
        if(m&1)
        {
            s=s*n%inf;
        }
        n=n*n%inf;
        m=m/2;
    }
    return s;
}

int main()
{
    int n, m;
    scanf("%d%d",&n,&m);
    int z=n*(n-1)/2;
    z=z+m*(m-1)/2;
    printf("%d\n",z);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <fstream>
#include <string>
#include <math.h>
#include <cstdlib>
#include <istream>
#include <sstream>
#include <cctype>
//string b="12345";
//a = int(b[4]-48);
using namespace std;
int main()
{
	int N, M, AC = 0,WA=0;
	vector<pair<int,string>> A;
	cin >> N >> M;
	vector<int> B(N, 0);

	for (int i = 0; i < M;i++) {
		pair<int, string> t;
		cin >> t.first;
		cin >> t.second;
		A.push_back(t);
	}

	if (A.size() == 0) {
		cout << "0 0" << endl;
	}
	else{
		for (int i = 0; i < A.size(); i++) {
			if (B[A[i].first-1] == 0 && A[i].second == "WA") {
				WA++;
			}
			else if (B[A[i].first-1] == 0 && A[i].second == "AC") {
				AC++;
				B[A[i].first-1] = 1;
			}
		}
		for (int i = 0; i < A.size(); i++) {
			if (B[A[i].first - 1] == 0 && A[i].second == "WA") {
				WA = WA - 1;
			}
		}
		cout << AC << " " << WA << endl;
	}
	

}

Measured memory_bytes: 6896
def main():
    weight = [6**i for i in range(7)] + [9**i for i in range(1, 6)]
    W = int(input())
    n = len(weight)

    dp = [[1 << 62 for i in range(W + 1)] for j in range(n + 1)]
    for i in range(n):
        dp[i][0] = 0
    for i in range(n):
        for w in range(W + 1):
            if w - weight[i] >= 0:
                dp[i + 1][w] = min(dp[i][w], dp[i+1][w - weight[i]] + 1)
            else:
                dp[i + 1][w] = dp[i][w]

    print(dp[n][W])


if __name__ == '__main__':
    main()


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

int main(int argc, char *argv[]) { ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);


  string s;cin>>s;
  int ans=0;

  for(int i=0;i<s.size();i++){
    int t=0;
    for(int j=i;j<s.size();j++){
      if(s[j]=='A'||s[j]=='G'||s[j]=='C'||s[j]=='T'){
        t++;
      }else{
        break;
      }
    }
    ans=max(ans,t);
  }

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


Measured memory_bytes: 3572
a,b=map(int, input().split())
ans=0
for i in range(a+1):
    for j in range(a-i+1):
        z=a-i-j
        if 10000*i+5000*j+1000*z==b and ans==0:
            print(i,j,z)
            ans+=1
if ans==0:
    print(-1,-1,-1)

Measured memory_bytes: 3060
T1, T2 = list(map(int, input().split()))
A1, A2 = list(map(int, input().split()))
B1, B2 = list(map(int, input().split()))

a, b = A1 * T1, A2 * T2
c, d = B1 * T1, B2 * T2

if a + b == c+ d:
    print("infinity")
    exit()
if a + b < c+d:
    a,b,c,d = c,d,a,b
if a > c:
    print(0)
    exit()
else:
    num = 0
    if (c-a) % (a+b-c-d)  == 0:
        num = 1
    print((c-a-1) // (a+b-c-d) * 2+num+1)


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

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

    int i,a,b,c,n;

    cin>>a>>b>>c;

    if(a==b && b!=c || b==c && a!=b || a==c && b!=c ){

        cout<<"Yes";
    }

    else if(a==b && b==c)
    {
        cout<<"No";
    }

    else if(a!=b && b!=c)
    {
        cout<<"No";
    }



}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
using namespace std;
#define ll long long 
#define il inline
char s[3];
int main(){
    cin>>s;
    if (s[0]=='R'){
        if (s[1]=='R'){
            if (s[2]=='R') cout<<"3";
            else cout<<"2";
        }else{
            if (s[2]=='R') cout<<"1";
            else cout<<"1";
        }
    }else{
        if (s[1]=='R'){
            if (s[2]=='R') cout<<"2";
            else cout<<"1";
        }else{
            if (s[2]=='R') cout<<"1";
            else cout<<"0";
        }
    }
}

Measured memory_bytes: 3584
import numpy as np
n=int(input())
a=list(map(int,input().split()))
g=np.gcd.reduce(a)
if g>1:
    print("not coprime")
    exit()
c=[0]*(10**6+1)
for i in a:
    c[i]+=1
if np.all([sum(c[i::i])<=1 for i in range(2,10**6+1)]):
    print("pairwise coprime")
else:
    print("setwise coprime")

Measured memory_bytes: 150448
import java.util.*;
 
public class Main {
	public static void main(String[] args) throws Exception{
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
        if(n <= 1199){
        	System.out.println("ABC");
        }else if(n <= 2799){
        	System.out.println("ARC");
        }else{
        	System.out.println("AGC");
        }
	}
}

Measured memory_bytes: 35760
import sys
from math import *
from collections import deque, Counter, defaultdict
from fractions import gcd
input = lambda: sys.stdin.readline().rstrip()

def eprint(s):
    sys.stderr.write('DEBUG: {}'.format(s))
    return

def main():
    ans="Yes"
    S = input()
    if(S=='AAA' or S=='BBB'):
      ans="No"
    print(ans)
    return

if __name__ == '__main__':
    main()

Measured memory_bytes: 5328
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long long int lli;
typedef long double ld;
const int oo = 1e9;
//const int mod = 1e9+9;
/*ll gcd(ll x, ll y){return (y ? gcd(y, x%y) : x); }
*ll lcm(ll x, ll y){return x*(y/gcd(x,y));}
*void exEuclid(int a, int b){
	if(b==0){x = 1; y=0; d=a; return ;}
	exEuclid(b, a%b);
	int x1=y;
	int y1=x-(a/b)*y;
	x=x1; 100000
	y=y1;
} 
* */
//===========================================================//
int n, k;
const int nx = 1e5+5;
ll ac[nx][2];
ll dp[105][nx];
ll go(ll i, ll w){
	if(w>k) return -oo;
	if(i == n) return 0;
	if(dp[i][w] != -1) return dp[i][w];
	ll& ans = dp[i][w];
	ans = max(ans, go(i+1,w));
	if(w+ac[i][0]<=k) ans = max(ans, go(i+1,w+ac[i][0])+ac[i][1]);
	return ans;
}
int main(){
	
	cin>>n>>k;
	memset(dp, -1, sizeof dp);
	for(int i=0; i<n; i++) cin>>ac[i][0]>>ac[i][1];
	cout<<go(0,0)<<"\n";
}


Measured memory_bytes: 82304
#include<iostream>
using namespace std;
int main(){
  int N;
  unsigned long H[100000];
  cin >> N;
  for(int i=0; i<N; i++){
    cin >> H[i];
  }
  bool flag=true;
  for(int i=N-2; i>=0; i--){
    if(H[i] == H[i+1] + 1){
      H[i]--;
    }else if(H[i] <= H[i+1]){
    }else{
      flag = false;
      break;
    }
  }
  if(flag==true) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
const long long mod = 1000000007;

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

  vector<int> oks(N+1, true);
  for(int i = 0; i < M; i++){
    int a;
    cin >> a;
    oks[a] = false;
  }

  vector<long long int> dp(N+1);
  dp[0] = 1;
  if(oks[1]){
    dp[1] = 1;
  }
  for(int next = 2; next <= N; next++){
    if(oks[next]){
      dp[next] = dp[next - 1] + dp[next - 2];
      dp[next] %= mod;
    }
  }

  cout << dp[N] << endl;
  return 0;

  return 0;
}


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

using namespace std;

int main(){
	int a,b;
	cin>>a>>b;
	int arr[b];
	for(int i = 0; i < b; i++){
		int p;
		cin>>p;
		a -= p;	
	}
	if(a>0){
		cout<<"No"<<endl;
	}
	else{
		cout<<"Yes"<<endl;
	}	
}


Measured memory_bytes: 256
k,n=map(int,input().split())
a=list(map(int,input().split()))
lenmax=k-a[n-1]+a[0]
for i in range(n-1):
    if(lenmax<-1*(a[i]-a[i+1])):
        lenmax=-1*(a[i]-a[i+1])
print(k-lenmax)

Measured memory_bytes: 26420
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include<bits/stdc++.h>
using namespace std;
using namespace __gnu_pbds;
#define ll int
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define sz(v) ((ll)v.size())
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define F first
#define S second
#define pii pair<ll,ll> 
const ll mod = 1000000007;
const ll mod1= 1000000009;
const ll base= 2323233;
const ll base1=3424424;
#define MAXN 2000002
ll a[200002];
ll j;
pii seg[800002][9];
pii query(ll node, ll start, ll end, ll l, ll r,ll j2)
{
    if(r < start or end < l or r<l)
    {
        // range represented by a node is completely outside the given range
        return  {mod,0};
    }
    if(l <= start and end <= r)
    {
      return seg[node][j2];
    }
    // range represented by a node is partially inside and partially outside the given range
    ll mid = (start + end) >> 1;
    pii p1 = query(2*node, start, mid, l, r,j2);
    pii p2 = query(2*node+1, mid+1, end, l, r,j2);
    return min(p1,p2);
}
void update(ll node, ll start, ll end, ll idx, ll val)
{
    if(start == end)
    {
      ll tmp=val;
      for(j=0;j<9;j++){
           seg[node][j]={mod,0};
           if(tmp%10){
                seg[node][j]={val,idx};
           }
           tmp/=10;
      }
    }
    else
    {
        ll mid = (start + end) >> 1 ;
        if(start <= idx and idx <= mid)
        {
            // If idx is in the left child, recurse on the left child
            update(2*node, start, mid, idx, val);
        }
        else
        {
            // if idx is in the right child, recurse on the right child
            update(2*node+1, mid+1, end, idx, val);
        }
        // Internal node will have the sum of both of its children
        for(j=0;j<9;j++)
          seg[node][j]=min(seg[2*node][j], seg[2*node+1][j]);
    }
}
void build(ll node, ll start, ll end)
{
   for(j=0;j<9;j++) seg[node][j]={mod,0};
    if(start == end)
    {
         ll tmp=a[start];
         for(j=0;j<9;j++){
           if(tmp%10){
              seg[node][j]={a[start],start};
           }
           tmp/=10;
          }
    }
    else
    {
         ll mid = (start + end)>>1;
        // Recurse on the left child
        build(2*node, start, mid);
        // Recurse on the right child
        build(2*node+1, mid+1, end);
        // Internal node will have the sum of both of its children
       for(j=0;j<9;j++)
        seg[node][j]=min(seg[2*node][j], seg[2*node+1][j]);
    }
}
int main() {
   ios::sync_with_stdio(0);
   cin.tie(0);
   cout.tie(0);
   ll n,m,i,j;
   cin>>n;
   ll ans=0;
   ll y=INT_MAX;
   for(i=0;i<n-1;i++){
    ll  x;
    cin>>x;
    ans+=min(x,y);
    y=x;
   }
   ans+=y;
   cout<<ans;
 }


Measured memory_bytes: 256
import sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = 10**20
def I(): return int(input())
def F(): return float(input())
def S(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LS(): return input().split()

def resolve():
    N, M, X = LI()
    C = [0]*N
    A = [[0]*M for _ in range(N)]
    for i in range(N):
        ca = LI()
        C[i] = ca[0]
        A[i] = ca[1:]

    cost_min = INF
    for i in range(2**N):
        cost = 0
        rikaido = [0]*M
        for j in range(N):
            if i>>j&1:
                cost += C[j]
                rikaido = [k+m for k, m in zip(rikaido, A[j])]
        if [j>=X for j in rikaido].count(True)==M:
            cost_min = min(cost, cost_min)

    if cost_min>=INF:
        print(-1)
    else:
        print(cost_min)

if __name__ == '__main__':
    resolve()


Measured memory_bytes: 9284
h, w = (int(i) for i in input().split())
a = [input() for i in range(h)]
ans = []
for i in range(h):
    if '#' in a[i]:
        ans.append(a[i])

del_col_idxs = set()
for i in range(w):
    for j in range(h):
        if a[j][i] == "#":
            break
    else:
        del_col_idxs.add(i)

for i in range(len(ans)):
    for j in range(w):
        if not j in del_col_idxs:
            print(ans[i][j],sep="",end="")
    print()

Measured memory_bytes: 42728
h, w = map(int, input().split())
n = int(input())
a = list(map(int, input().split()))

b = []
for i in range(n):
    for j in range(a[i]):
        b.append(i + 1)

ans = []
for i in range(0, h*w, w):
    if (i // w) % 2 == 0:
        ans.append(b[i:i+w])
    else:
        ans.append(list(reversed(b[i:i+w])))


print('\n'.join([' '.join([str(aij) for aij in ai]) for ai in ans]))


Measured memory_bytes: 3700
#include <bits/stdc++.h>
using namespace std;
int N, Y;
int main() {
	cin >> N >> Y;
	bool found = false;
	for (int i = 0; i <= 2000 && !found; i++) {
		for (int j = 0; j <= 2000 && !found; j++) {
			if (i + j <= N) {
				int w = (Y - 10000 * i - 5000 * j);
				if (w >= 0 && i + j + w / 1000 == N) {
					cout << i << ' ' << j << ' ' << w / 1000 << endl;
					found = true;
				}
			}
		}
	}
	if (!found) cout << -1 << ' ' << -1 << ' ' << -1 << endl;
	return 0;
}

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

using namespace std;

using ll = long long;
int main(void)
{
    int N;
    cin >> N;
    vector<int> A(N);

    for (int i = 0; i < N; i++)
    {
        cin >> A[i];
    }

    sort(A.begin(), A.end(), less<int>());
    int Amax = A[A.size() - 1];

    vector<bool> dp(Amax);
    fill(dp.begin(), dp.end(), true);

    for (int i = 0; i < N; i++)
    {
        if(dp[A[i] - 1]){
            for (int j = 2; j * A[i] <= Amax; j++)
            {
                dp[j * A[i] - 1] = false;
            }
        }
    }

    int point = 0;
    for (int i = 0; i < N; i++)
    {
        if (i+1 < N && A[i] == A[i + 1])
        {
            dp[A[i] - 1] = false;
        }

        if (dp[A[i] - 1] == true)
        {
            point++;
        }
    }
    
    cout << point << endl;

    return 0;
}


Measured memory_bytes: 4024
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <complex>
typedef long long int LL;
using namespace std;

// 插入此處

int main() {
    char s[105];
    char t[105];
    scanf("%s%s", s, t);
    int n = strlen(s);
    bool ok = false;
    for (int i = 0; i < n; i++) {
        bool pok = true;
        for (int j = 0; j < n; j++) {
            if (s[j] != t[(i + j) % n]) {
                pok = false; break;
            }
        }
        if (pok) {ok = true; break;}
    }
    if (ok) {
        printf("Yes\n");
    } else {
        printf("No\n");
    }
}


Measured memory_bytes: 256