akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
using namespace  std ;
typedef long l ;
typedef long long ll ;
typedef vector<int>vi ;
typedef vector<l>vl ;
typedef vector<ll>vll ;
typedef vector<vector<ll> >vvl ;
typedef pair<int,int> pii ;
typedef pair<ll,ll> pll ;
long long power(long long k , long long n , long long m=1e9+7)
{
    long long res = 1;
    while(n)
    {
        if(n%2!=0)
        {
            res = (res*k)%m ;
        }
        k = (k*k)%m ;
        n = n/2 ;
    }
    return(res) ;
}
ll nck(ll n , ll k ,ll m=1e9+7)
{
    ll i , j,b=1,c=1 ;
    if(n-k<k)
    {
        k = n-k ;
    }
    while(k)
    {
        b*=n ;
        c*=k ;
        ll g = __gcd(b,c) ;
        b/=g ;
        c/=g ;
        n--;
        k-- ;
    }
    return(b) ;
}
long long fact(long long n , long long m = 1e9+7)
{
    long long a = 1 ;
    if(n==0 || n==1)
    {
        return(1) ;
    }
    while(n>0)
    {
        a = (a%m * n%m)%m ;
        n-- ;
    }
    return(a) ;
}
void READ(vll &v, ll n)
{
    ll a ;
    for(ll i=0 ; i<n ; i=i+1)
    {
        cin>>a ;
        v.pb(a) ;
    }
}
void PRINT(vll &v, ll n)
{
    ll a ;
    for(ll i=0 ; i<n ; i=i+1)
    {
        cout<<v[i]<<" " ;
    }
    cout<<"\n" ;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    std::cout.unsetf ( std::ios::floatfield );//this and next line for floating precision upto 6
    std::cout.precision(10);
    ll a,b,c,d,e,x,i,j,n,t,m,k,y,s;
    double p,q,r,w,u ;
    string str = "",str1 = "" ;
    char ch,chr ;
    ll a1,a2,b1,b2 ;
    cin>>n>>m ;
    vll v;
    READ(v,m);
    if(n>=m)
    {
        cout<<"0\n" ;
    }
    else
    {
        sort(all(v));
        c = 1 ;
        d = 2e5;
        ll ans = 1e18 ;
        vll v1 ;
        for(i=0 ; i<m-1 ; i=i+1)
        {
        	v1.pb(v[i+1]-v[i]);
		}
		sort(all(v1));
		c = 0 ;
		for(i=0 ; i<m-n ; i=i+1)
		{
			c = c + v1[i];
		}
		cout<<c;
    }
}

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

using namespace std;

typedef long long int llint;
typedef pair<int, int> pii;
typedef pair<llint, llint> pll;
typedef vector<int> vi;
typedef vector<llint> vl;
typedef vector<pii> vii;
typedef vector<pll> vll;

#define ci cin
#define co cout
#define en endl
#define ln cout<< '\n'
#define rep(i, n) for(int i = 0; i < n; i++)
#define outl(x) cout<< (x) << '\n'
#define pb push_back
#define fi first
#define se second
#define MOD 1000000007

template<typename Tn> Tn gcd(Tn a, Tn b)
{
	return (b ? gcd(b, a % b) : a);
}

template<typename Tn> Tn lcm(Tn a, Tn b)
{
	return a / gcd(a, b) * b;
}

string IntToString(int number)
{
	stringstream ss;
	ss << number;
	return ss.str();
}

llint cnt = 0;
int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};

int main()
{
    int n, m;
    int k, a;
    int food[31] = {};

    ci >> n >> m;
    
    rep(i, n) {
	ci >> k;
	rep(j, k) {
	    ci >> a;
	    food[a]++;
	}
    }

    rep(i, m + 1) if(food[i] == n) cnt++;

    co << cnt << en;
    
    
    return 0;
}






Measured memory_bytes: 256
#include <iostream>

int main(void)
{
    int x, y;
    std::cin >> x;
    std::cin >> y;

    int great, small;

    if (x >= y) {
        great = x;
        small = y;
    } else {
        great = y;
        small = x;
    }

    int next_small;
    while ((next_small = great % small) > 0) {
        great = small;
        small = next_small;
    }

    std::cout << small << std::endl;
    return 0;
}



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

int main(){
    int num = 0;
    int n;
    int e = 0;
    cin >> n;
    for(int i = 0; i < n; i++){
        int p;
        e = 0;
        cin >> p;
        int k = int(sqrt(p));
        for(int j = 2; j < k+1; j++){
            if(p % j == 0)e++;
        }
        if(e == 0)num++;
    }
    cout << num << endl;
}


Measured memory_bytes: 3092
#include <iostream>
#include <cstdio>
#include <map>
#include <algorithm>

void check_multiplicity(const int* sorted_cards, std::map<int,int>& multiplicities)
{
	multiplicities.clear();

	const int* current = sorted_cards;
	const int* end = sorted_cards + 5;
	while (current != end) {
		const int* next = std::upper_bound(current, end, *current);
		++multiplicities[next - current];
		current = next;
	}
}

int count(const std::map<int,int> multiplicities, int multiplicity)
{
	std::map<int,int>::const_iterator i = multiplicities.find(multiplicity);
	return (i != multiplicities.end()) ? i->second : 0;
}

bool check_straight(const int* sorted_cards, const std::map<int,int>& multiplicities)
{
	if (count(multiplicities, 1) != 5) {
		return false;
	}
	return (sorted_cards[4] == sorted_cards[0] + 4)
		|| (sorted_cards[0] == 1 && sorted_cards[1] == 10);
}

int main()
{
	int cards[5] = {};
	while (scanf("%d,%d,%d,%d,%d",&cards[0],&cards[1],&cards[2],&cards[3],&cards[4]) == 5) {
		std::sort(cards, cards + 5);
		std::map<int,int> multiplicities;
		check_multiplicity(cards, multiplicities);

		if (count(multiplicities, 4) > 0) {
			std::cout << "four card\n";
		} else if (count(multiplicities, 3) > 0 && count(multiplicities, 2) > 0) {
			std::cout << "full house\n";
		} else if (check_straight(cards, multiplicities)) {
			std::cout << "straight\n";
		} else if (count(multiplicities, 3) > 0) {
			std::cout << "three card\n";
		} else if (count(multiplicities, 2) == 2) {
			std::cout << "two pair\n";
		} else if (count(multiplicities, 2) == 1) {
			std::cout << "one pair\n";
		} else {
			std::cout << "null\n";
		}
	}
	return 0;
}

Measured memory_bytes: 1192
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Convert;
using static System.Console;
using static System.Math;
class MainClass
{
	static void Main(string[] args)
	{
		Answer();
	}
	public static void Answer()
	{
      var x = long.Parse(Console.ReadLine());

      double a = (x / 11) * 2;
      double b = x % 11;
      if (b < 7)
      {
        if(b!=0)
          a += 1;
      }
      else if (7 <= b)
      {
        a += 2;
      }
      Console.WriteLine(a);
	}
}


Measured memory_bytes: 13140
#include <iostream>
using namespace std;
int main(){
 int a,b,c,t;
 cin>>a>>b>>c;
 if(a>b){
  t=a;a=b;b=t;
 }
 if(b>c){
  t=b;b=c;c=t;
 }
 if(a>b){
  t=a;a=b;b=t;
 }
 cout<<c*10+b+a;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(){
    int m,f,r,sum;
    while(1){
        scanf("%d%d%d", &m,&f,&r);
        if (m==f&&f==r&&m==-1)break;
        if (m==-1||f==-1){printf("F\n");continue;}
        sum=m+f;
        if (sum>=80)putchar('A');
        else if(sum>=65)putchar('B');
        else if(sum>=50||r>=50)putchar('C');
        else if(sum>=30)putchar('D');
        else if(sum<30)putchar('F');
        putchar('\n');
    }
}



Measured memory_bytes: 1932
#include <stdio.h>

main(){
  int n, p, d1, d2, max, name, i, temp;

  while(1){
    scanf("%d", &n);
    if(n==0) break;

    max=-1;
    for(i=0;i<n;i++){
      scanf("%d %d %d", &p, &d1, &d2);
      temp=d1+d2;

      if(temp>max){
	max=temp;
	name=p;
      }
    }

    printf("%d %d\n", name, max);
  }
  return 0;
}

Measured memory_bytes: 412
import sys

n = [int(i) for i in list(input())]
ops = ['+', '-']
for a in ops:
    for b in ops:
        for c in ops:
            e = '{}{}{}{}{}{}{}'.format(n[0], a, n[1], b, n[2], c, n[3])
            if eval(e) == 7:
                print('{}=7'.format(e))
                sys.exit(0)


Measured memory_bytes: 3060
pub struct ProconReader<R: std::io::Read> {
    reader: R,
}

impl<R: std::io::Read> ProconReader<R> {
    pub fn new(reader: R) -> Self {
        Self { reader }
    }
    pub fn get<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .reader
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&byte| byte == b' ' || byte == b'\n' || byte == b'\r')
            .take_while(|&byte| byte != b' ' && byte != b'\n' && byte != b'\r')
            .collect::<Vec<_>>();
        std::str::from_utf8(&buf)
            .unwrap()
            .parse()
            .ok()
            .expect("Parse Error.")
    }
}

pub struct UnionFind {
    par: Vec<usize>,
    size: Vec<usize>,
}

impl UnionFind {
    pub fn new(n: usize) -> UnionFind {
        UnionFind {
            par: (0..n).map(|i| i).collect::<Vec<_>>(),
            size: vec![1; n],
        }
    }
    pub fn find(&mut self, i: usize) -> usize {
        if self.par[i] == i {
            self.par[i]
        } else {
            self.par[i] = self.find(self.par[i]);
            self.par[i]
        }
    }
    pub fn unite(&mut self, i: usize, j: usize) {
        let i = self.find(i);
        let j = self.find(j);
        if i == j {
            return;
        }
        let (i, j) = if self.size[i] >= self.size[j] {
            (i, j)
        } else {
            (j, i)
        };
        self.par[j] = i;
        self.size[i] += self.size[j];
    }
    pub fn get_size(&mut self, i: usize) -> usize {
        let p = self.find(i);
        self.size[p]
    }
}

fn main() {
    let stdin = std::io::stdin();
    let mut rd = ProconReader::new(stdin.lock());

    let n: usize = rd.get();
    let m: usize = rd.get();
    let ab: Vec<(usize, usize)> = (0..m)
        .map(|_| {
            let a: usize = rd.get();
            let b: usize = rd.get();
            (a - 1, b - 1)
        })
        .collect();

    let mut uf = UnionFind::new(n);
    for (a, b) in ab {
        uf.unite(a, b);
    }
    let size = (0..n).map(|i| uf.get_size(i)).max().unwrap();
    println!("{}", size);
}

Measured memory_bytes: 8392
#include<bits/stdc++.h>
using namespace std;
int N,A[3][3],b[10];
bool appear[3][3];
int main() {
    for(int i= 0;i< 3;i++) {
        for(int j= 0;j< 3;j++) cin >> A[i][j];
    }
    cin >> N;
    for(int i= 0;i<N;i++) cin >> b[i];
    for(int i= 0;i<N;i++) {
        for(int j= 0;j<N;j++) {
        appear[i][j] =false;
            for(int k= 0;k<N;k++) {
                if(A[i][j] ==b[k]) appear[i][j] = true;
            }
        }
    }
    string ANS="No";
    for(int i= 0;i< 3;i++) {
        if(appear[i][0] and appear[i][1] and appear[i][2])ANS="Yes";
    }
    for(int i= 0;i< 3;i++) {
        if(appear[0][i] and appear[1][i] and appear[2][i])ANS="Yes";
    }
    if(appear[0][0] and appear[1][1] and appear[2][2])ANS="Yes";
    if(appear[0][2] and appear[1][1] and appear[2][0])ANS="Yes";
    cout << ANS << endl;
    return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <memory>
#include <regex>
using namespace std;

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

    if(x == 3 || x == 5 || x == 7)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;

    return 0;
}


Measured memory_bytes: 256
inf = 1 << 60
N,A,B,C=map(int, input().split())
l = []
for i in range(N):
    l.append(int(input()))

def dfs(n, a, b, c):
    if n == N:
        if min(a,b,c) == 0:
            return inf
        return abs(A-a)+abs(B-b)+abs(C-c)-30

    a1 = dfs(n+1, a, b, c)
    a2 = dfs(n+1, a + l[n], b, c) + 10
    a3 = dfs(n+1, a, b + l[n], c) + 10
    a4 = dfs(n+1, a, b, c + l[n]) + 10
    return min(a1, a2, a3, a4)

def solve2():
    best_sc = inf
    for i in range(0, 1 << (2*N)):
        le = [0] * 3
        sc = 0
        for j in range(N):
            a = (i >> (2*j)) & 0x3
            if a <= 2:
                le[a] += l[j]
                sc += 10
        if min(le) == 0:
            continue
        sc += abs(A-le[0]) + abs(B-le[1]) + abs(C-le[2]) - 30
        best_sc = min(best_sc, sc)
    return best_sc

#ans = dfs(0, 0, 0, 0)
ans = solve2()
print(ans)


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

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	auto S=in<string>();
	reverse(ALL(S));
	
	out(S);
	return 0;
}


Measured memory_bytes: 3208
#include <bits/stdc++.h>
typedef long long ll;
#define rep(i,a,n) for(ll i = a;i < n;i++)
#define rrep(i,a,n) for(ll i = n; i >= a;i--)
#define index_check(i,n) if(i > n-1 || i < 0) continue; 
#define LINF 1e18
#define INF 1e9
#define MOD (ll)(1e9+7)
using namespace std;

#define fs first
#define sc second

using P = pair<ll,ll>;
using Pll = pair<P,ll>;
using PQ = priority_queue<P,vector<P>,greater<P>>;

signed main(){
    ll n;
    cin >> n;
    if(n % 2) cout << 0 << endl;
    else{
        ll ans = 0,temp = n,cnt = 0,roopcnt = 0;
        while(temp > 1){
            ans += temp / 10;
            if(temp != n) cnt += temp / 10;
            temp /= 10;
        }
        temp = n/10;
        ll cnt2 = 0;
        while(temp > 1){
            cnt2 += temp / 5;
            temp /= 5;
        }

        ans += cnt2 - cnt;
        cout << ans << endl;
    }
    return 0;
}


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

int main() {

  int N;
  std::cin >> N;

  long long int sum = 0;
  long long int max = 0;

  for (int i=0; i<N; ++i) {
    int t = 0;
    std::cin >> t;
    max = std::max(max, (long long int) t);
    sum += max - t;
  }

  std::cout << sum << std::endl;

  return 0;

}


Measured memory_bytes: 3632
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
const ld eps=1e-9;

//// < "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\a.txt"
int main() {
	int N; cin >> N;
	vector<int>ds(N);
	for (int i = 0; i < N; ++i) {
		cin >> ds[i];
	}
	vector<vector<unsigned long long int>>dp(N, vector<unsigned long long int>(21,0));
	dp[1][ds[0]] = 1;
	for (int i = 1; i < N-1; ++i) {
		for (int j = 0; j <= 20; ++j) {
			{
				int next = j + ds[i];
				if (next >= 0 && next <= 20) {
					dp[i + 1][next] += dp[i][j];
				}
			}
			{
				int next = j - ds[i];
				if (next >= 0 && next <= 20) {
					dp[i + 1][next] += dp[i][j];
				}
			}
		}
	}
	unsigned long long int ans = dp[N - 1][ds[N - 1]];
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3144
#include <bits/stdc++.h>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
using namespace std; 
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define FORD(i,a,b) for(int i=(a);i>=(b);i--)
inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }
const int INF = 1<<29;
typedef long long int ll;
inline int two(int n) { return 1 << n; }
inline int test(int n, int b) { return (n>>b)&1; }
inline void set_bit(int & n, int b) { n |= two(b); }
inline void unset_bit(int & n, int b) { n &= ~two(b); }
inline int last_bit(int n) { return n & (-n); }
inline int ones(int n) { int res = 0; while(n && ++res) n-=n&(-n); return res; }
template<class T> void chmax(T & a, const T & b) { a = max(a, b); }
template<class T> void chmin(T & a, const T & b) { a = min(a, b); }
const int MOD=1000000007;
#define pp pair<ll,ll>
bool isPowerOfTwo (ll x)  
{  
    return x && (!(x&(x-1)));  
}
bool isPrime(int n) 
{ 
    if (n <= 1)  return false; 
    if (n <= 3)  return true; 
    if (n%2 == 0 || n%3 == 0) return false; 
  
    for (int i=5; i*i<=n; i=i+6) 
        if (n%i == 0 || n%(i+2) == 0) 
           return false; 
  
    return true; 
}
int highestPowerof2(unsigned int n) 
{ 
    // Invalid input 
    if (n < 1) 
        return 0; 
  
    int res = 1;
    for (int i=0; i<8*sizeof(unsigned int); i++) 
    { 
        int curr = 1 << i; 
        if (curr > n) 
           break; 
  
        res = curr; 
    } 
  
    return res; 
} 
long long binpow(long long a, long long b) {
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}
const int dx[] = {1,0,-1,0,1,1,-1,-1};
const int dy[] = {0,-1,0,1,1,-1,-1,1};
/*lcm(gcd(N1, M), gcd(N2, M), ..., gcd(Nk, M)) = gcd(lcm(N1, ..., Nk), M)
gcd(lcm(N1, M), lcm(N2, M), ..., lcm(Nk, M)) = lcm(gcd(N1, ..., Nk), M).

If gcd(N1, N2) = 1, then
gcd(N1·N2, M) = gcd(N1, M)·gcd(N2, M)
lcm(N1·N2, M) = lcm(N1, M)·lcm(N2, M)/M.

lcm(M, N, P) · gcd(M, N) · gcd(N, P) · gcd(P, M) = NMP · gcd(N, M, P).
*/
////////////////////////////////////////////////////////////////////

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);  
  cout.tie(NULL);
  int t=1;
  while(t--)
  {
    int n,k;
    cin>>n>>k;
    int cnt0=0,cntk=0;
    for(int i=1;i<=n;i++)
    {
        if(i%k == 0)
        {
            cnt0++;
        }
        else if(i%k == k/2 && k%2==0)
        {
            cntk++;
        }
    }
    ll ans=binpow(cnt0,3);
    if(k%2 == 0)
    {
        ans+=binpow(cntk,3);
    }
    cout<<ans;
  }  
  return 0;
}
/* Look for:
* the exact constraints (multiple sets are too slow for n=10^6 :( )
* special cases (n=1?)
* 1LL<<i and not 1<<i
* overflow (int vs ll?)
* array bounds
* if you have no idea just guess the appropriate well-known algo instead of doing nothing :/
*/

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

using namespace std;

typedef long long i64;
typedef i64 int_t;
typedef vector<int_t> vi;
typedef vector<vi> vvi;

typedef pair<int_t, int_t> pi;

#define tr(c, i) for(auto i = (c).begin(); i != (c).end(); i++)
#define pb push_back
#define sz(a) i64((a).size())
#define all(c) (c).begin(), (c).end()
#define REP(s, e, i) for(i=(s); i < (e); ++i)

class UnionFindTree {
public:
  UnionFindTree(i64 N) : trees(N, -1), height(N, 1) {
  }

  void merge(i64 ia, i64 ib) {
    if(is_same_group(ia, ib)) {
      return;
    }

    if(height[ia] > height[ib]) {
      swap(ia, ib);
    }

    while(trees[ia] != -1) {
      i64 next = trees[ia];
      trees[ia] = ib;
      ia = next;
    }
    trees[ia] = ib;
  }

  bool is_same_group(i64 ia, i64 ib) {
    return find_root(ia) == find_root(ib);
  }

  i64 find_root(i64 ia) {
    vi children;
    i64 i;
    while(trees[ia] != -1) {
      children.pb(ia);
      ia = trees[ia];
    }
    REP(0, sz(children), i) {
      trees[children[i]] = ia;
    }
    return ia;
  }

  vi trees;
  vi height;
};

int main(int argc, char *argv[]) {
  i64 N, M, i;
  cin >> N >> M;
  
  UnionFindTree tree(N);
  REP(0, M, i) {
    i64 A, B;
    cin >> A >> B;
    tree.merge(A-1, B-1);
  }

  unordered_map<i64, i64> S;
  REP(0, N, i) {
    i64 r = tree.find_root(i);
    if(S.find(r) == S.end()) {
      S[r] = 0;
    }
    S[r]++;
  }

  i64 ans = 0;
  for(auto p: S) {
    ans = max(ans, p.second);
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 14348
#include<iostream>

using namespace std;
int main(void) {

	int h, w,x,y;

	while (1)
	{
		cin >> h >> w;
		
		if (h == 0 && w == 0)
			break;

		for (y = 0; y < h; y++) {
			for (x = 0; x < w; x++)
			{
				cout << "#";
			}
			cout << endl;
		}

		cout << endl;

	
	}
	return 0;
}



Measured memory_bytes: 3120
#include<iostream>
using namespace std;
int main()
{
  int a, b, c;
  cin >> a >> b >> c;
  int answer;
    for(int i = 0; i < 1000; i++){
     answer = (a * i) % b;
     if(answer == c)break;
    }
          if(answer == c){
        cout << "YES" << endl;
      } else {
        cout << "NO" << endl;
      }
  return 0;
}


Measured memory_bytes: 256
def min(a,b):
  return a if a<=b else b


def main():
  n,m=map(int,input().split())
  inf=10**9
  cost=[0]*m
  dp=[inf]*(1<<n)
  dp[0]=0
  for i in range(m):
    a,b=map(int,input().split())
    t=sum([1<<(int(x)-1) for x in input().split()])
    for s in range(1<<n):
      dp[t|s]=min(dp[t|s], dp[s]+a)
  print(-1 if dp[-1]==inf else dp[-1])
  
  
if __name__=='__main__':
  main()

Measured memory_bytes: 9196
using System;
using System.Linq;
using System.Collections.Generic;
class Program
{
    static void Main()
    {
        var input = Console.ReadLine().Split(' ').ToList();
        if (input[0].Substring(input[0].Length - 1, 1) == input[1].Substring(0, 1) && input[1].Substring(input[1].Length - 1, 1) == input[2].Substring(0, 1))
        {
            Console.WriteLine("YES");
        }
        else
        {
            Console.WriteLine("NO");
        }
    }
}

Measured memory_bytes: 13268
#include<iostream>
#include<string>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<list>
#include<cstdint>
#include<bits/stdc++.h>
#include<queue>
#include<set>

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep_r(i, n) for(int i = n-1; i >= 0; i--)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i++)
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((ll)(x).size())
#define bit(n) (1LL<<(n))
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define INF bit(60)
#define pb push_back
#define mod 1000000007

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

using namespace std;
using uif=uint_fast64_t;
using ll=long long int;

int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a%mod;a=1ll*a*a%mod;}while(b>>=1);return ans;}
int qp(int a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}

int gcd(int a,int b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int main(void){

  ll h,w;
  cin>>h>>w;

  vector< vector<char> > a(h,vector<char>(w));
  vector< vector<ll> > dp(h,vector<ll>(w,0));
  vector< vector<bool> > used(h,vector<bool>(w,false));
  vector< vector<bool> > q_used(h,vector<bool>(w,false));
  queue<pair<ll,ll>> que;
  dp[0][0]=1;
  que.push(make_pair(0,0));
  q_used[0][0]=true;

  rep(i,h){
    rep(j,w){
      cin>>a[i][j];
      if(a[i][j] == '#') dp[i][j]=-INF;
      //cout << a[i][j];
    }
    //cout << endl;
  }

  while(!que.empty()){
    pair<ll,ll> c=que.front();
    //cout << c.first << "," << c.second << endl;
    que.pop();
    for(ll i=0;i<2;i++){
      if( !(c.first+dx[i]>=0 && c.first+dx[i]<w && c.second+dy[i]>=0 && c.second+dy[i]<h ) ) continue;
      if(dp[c.second+dy[i]][c.first+dx[i]] == -INF) continue;
      if(q_used[c.second+dy[i]][c.first+dx[i]] == true) continue;
      que.push(make_pair(c.first+dx[i],c.second+dy[i]));
      q_used[c.second+dy[i]][c.first+dx[i]] = true;
    }
    for(ll i=2;i<4;i++){
      if( !(c.first+dx[i]>=0 && c.first+dx[i]<w && c.second+dy[i]>=0 && c.second+dy[i]<h ) ) continue;
      if(dp[c.second+dy[i]][c.first+dx[i]] == -INF) continue;
      dp[c.second][c.first] += dp[c.second+dy[i]][c.first+dx[i]];
      dp[c.second][c.first] %= mod;
    }

  }
  /*
  rep(i,h){
    rep(j,w){
      if(dp[i][j] == -INF) cout << "x" << " ";
      else cout << dp[i][j] << " ";
    }
    cout << endl;
  }
  */

  cout << dp[h-1][w-1] << endl;

  return 0;

}


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

const int MOD = 1000000007;
const int MAX = 5100000;
ll gcd(ll a, ll b) {
    return (b==0) ? a : gcd(b, a%b);
}

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
ll COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

// 以下から
const int MAX_N = 100000;
struct Edge {
    int to;
    int id;
};

const int D = 80 * 160 + 10;
const int D2 = D*2;
typedef bitset<D2> bs;
int a[100][100];
bs dp[90][90];

int main(){
    int h,w; cin >> h >> w;
    rep(i,h)rep(j,w){
        int x; cin >> x;
        a[i][j] = x;
    }
    rep(i,h)rep(j,w){
        int x; cin >> x;
        a[i][j] = abs(x-a[i][j]);
    }

    dp[0][0][D-a[0][0]] = 1;
    dp[0][0][D+a[0][0]] = 1;
    rep(i,h)rep(j,w) {
        if (i) {
            dp[i][j] |= dp[i-1][j] << a[i][j];
            dp[i][j] |= dp[i-1][j] >> a[i][j];
        }
        if (j) {
            dp[i][j] |= dp[i][j-1] << a[i][j];
            dp[i][j] |= dp[i][j-1] >> a[i][j];
        }
    }
    int ans = D2;
    rep(i,D2) if (dp[h-1][w-1][i]) {
        ans = min(ans, abs(i-D));
    }
    cout << ans << endl;
    return 0;
}


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

using namespace std;

typedef long long int64;
typedef vector<int64> vi;
typedef pair<int, int> pii;

const int oo = 0x3f3f3f3f;
const double pi = acos(-1);
const double eps = 1e-9;

#define endl '\n'


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

	int n;
	cin >> n;

	map<string, int> m;
	vector<string> S(n);

	vector<string> ans;
	int mx = 0;

	for (int i = 0; i < n; ++i){
		cin >> S[i];
		m[S[i]]++;

		if (m[S[i]] > mx){
			ans = vector<string>();
			mx = m[S[i]];
		}
		if (m[S[i]] == mx){
			ans.push_back(S[i]);
		}
	}

	sort(ans.begin(), ans.end());
	for (int i = 0; i < ans.size(); ++i)
		cout << ans[i] << endl;

	return 0;
}

Measured memory_bytes: 26992
#include<iostream>
#include<cstdio>
#include<queue>
#include<vector>
#include<string.h>
#include<algorithm>
#include <cmath>

using namespace std;

long long N,M,a,b,i,j,k;

int main()
{
  priority_queue<long long,vector<long long>,greater<long long>> A;
  
  cin>>N;
  
  for(i=0;i<N;i++)
  {
    cin>>j;
    A.push(j);
  }
  j=-1;
  k=-2;
  a=0;
  for(i=0;i<N;i++)
  {
    j=A.top();
    A.pop();
    if(j!=k)
    {
      k=j;
      continue;
    }
    else
    {
      a=1;
      break;
    }
  }
  
  if(a==0)
  {
    cout<<"YES";
  }
  else
  {
    cout <<"NO";
  }
}



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

using namespace std;

int main() {
  int n, x; cin >> n >> x;
  priority_queue<int> q;
  while (n--) {
    int t; cin >> t;
    q.push(-t);
  }
  q.push(-x-1);
  int res = 0;
  while ((x += q.top()) >= 0) {
    q.pop();
    res++;
  }
  x -= q.top();
  if (q.size() - 1 || !x) cout << res << endl;
  else cout << res - 1 << endl;
}

Measured memory_bytes: 256
//#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<set>

/*
#include<boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/rational.hpp>
namespace mp = boost::multiprecision;
using Real = mp::number<mp::cpp_dec_float<1024>>;
using Bint = mp::cpp_int;
*/

using namespace std;

#define int long long
#define REP(i,s,e) for((i)=(s);(i)<(e);(i)++)
#define RREP(i,s,e) for((i)=((s)-1);(i)>=(e);(i)--)
#define FOR(i,n) for((i)=(0);(i)<(n);(i)++)
#define RFOR(i,n) for((i)=((n)-1);(i)>=(0);(i)--)
#define MOD 1000000007

signed main(){

    int X,A;

    cin>>X>>A;

    cout<<max(0ll,X-A)<<endl;
}



Measured memory_bytes: 3164
var GET=(function(){function f(s){return new g(s);}function g(s){this._s=s.trim().split("\n");this._y=0;}g.prototype.a=function(f){var s=this._s, y=this._y, r;if(typeof s[y]==="string")s[y]=s[y].split(" ").reverse();r=s[y].pop();if(!s[y].length)this._y++;return f?r:+r;};g.prototype.l=function(f){var s=this._s[this._y++].split(" ");return f?s:s.map(a=>+a);};g.prototype.m=function(n,f){var r=this._s.slice(this._y,this._y+=n).map(a=>a.split(" "));return f?r:r.map(a=>a.map(a=>+a));};g.prototype.r=function(n,f){var r=this._s.slice(this._y,this._y+=n);return f?r:r.map(a=>+a);};return f;})();
var o=GET(require("fs").readFileSync("/dev/stdin","utf8"));
function xArray(v){var a=arguments,l=a.length,r="Array(a["+--l+"]).fill(v)";while(--l)r="Array(a["+l+"]).fill(0).map(x=>"+r+")";return eval(r);}

console.log(main());
function main(){
  var a = o.r(5).sort((a,b)=>a-b);
  var k = o.a();
  return a[4] - a[0] <= k ? "Yay!" : ":(";
}

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

using namespace std;

int main(){
  int a,b;	cin >> a >> b;
  string str_a="";
  string str_b = "";
  
  for(int i=0; i<b;i++)
    str_a += to_string(a);
  
  for(int i=0; i<a; i++)
    str_b += to_string(b);
  
  if(str_a.length() >= str_b.length())
    cout << str_a << endl;
  else
    cout << str_b << endl;
  
  return 0;
  

}


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

typedef long long ll;
 
int main(){
  string s, ans;
  cin >> s;
  int dp=0,su=0;
  for(int i=0; i<s.length(); i++){
    su *= 10;
    su += s[i]-'0';
    dp += s[i]-'0';
  }
  if(su%dp==0) ans = "Yes";
  else ans = "No";
  cout << ans << endl;
  return 0;
}


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

int main() {
  int h,w,d;
  cin >> h >> w >> d;
  vector<P>data(h*w+1);
  rep(i,0,h) rep(j,0,w){
    int a;
    cin >> a;
    data[a].first = i;data[a].second = j;
  }
  vector<int>dist(h*w+1);
  rep(i,1,d+1) dist[i] = 0;
  rep(i,d,h*w+1){
    int p = i-d;
    int vx = data[i].first,vy = data[i].second,px = data[p].first,py = data[p].second;
    dist[i] = dist[p]+abs(vx-px)+abs(vy-py);
  }
  int q;
  cin >> q;
  rep(i,0,q){
    int l,r;
    cin >> l >> r;
    cout << dist[r]-dist[l] << endl;
  }
}

Measured memory_bytes: 4264
#include "bits/stdc++.h"
#define MAXN 100009
#define INF 1000000007
#define mp(x,y) make_pair(x,y)
#define all(v) v.begin(),v.end()
#define pb(x) push_back(x)
#define wr cout<<"----------------"<<endl;
#define ppb() pop_back()
#define tr(ii,c) for(__typeof((c).begin()) ii=(c).begin();ii!=(c).end();ii++)
#define ff first
#define ss second
#define my_little_dodge 46
#define debug(x)  cerr<< #x <<" = "<< x<<endl;
using namespace std;

typedef long long ll;
typedef pair<int,int> PII;
template<class T>bool umin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T>bool umax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
char tmp[MAXN],s[MAXN];
int n;
char change(char x){
	if(x=='S')
		return 'W';return 'S';
}
void checker(){
	bool dif=0;
	for(int j=1;j<n-1;j++){
		dif=0;
		if(tmp[j-1]!=tmp[j+1])
			dif=1;
		if(tmp[j]=='S'){
			if(s[j]=='o' and dif)
				return;	
			if(s[j]=='x' and !dif)
				return;
		}
		else{
			if(s[j]=='x' and dif)
				return;
			if(s[j]=='o' and !dif)
				return;
		}
	}dif=0;
	if(tmp[n-1]!=tmp[1])
		dif=1;
	if(tmp[0]=='S'){
		if(s[0]=='o' and dif)
			return;
		if(s[0]=='x' and !dif)
			return;
	}
	else{
		if(s[0]=='x' and dif)
			return;
		if(s[0]=='o' and !dif)
			return;
	}dif=0;
	if(tmp[n-2]!=tmp[0])
		dif=1;
	if(tmp[n-1]=='S'){
		if(s[n-1]=='o' and dif)
			return;
		if(s[n-1]=='x' and !dif)
			return;
	}
	else{
		if(s[n-1]=='x' and dif)
			return;
		if(s[n-1]=='o' and !dif)
			return;
	}
	for(int i=0;i<n;i++)
		printf("%c",tmp[i]);
	exit(0);	
}
int main(){
	//~ #ifndef ONLINE_JUDGE
    //~ freopen("file.in", "r", stdin);
	//~ #endif	
	scanf("%d",&n);
	scanf("%s",s);
	for(int i=0;i<2;i++){
		if(i)
			tmp[0]='W';
		else
			tmp[0]='S';
		bool dif=1;	
		if((s[0]=='o' and !i) or (s[0]=='x' and i))
			dif=0;
		for(int k=0;k<2;k++){
			if(k)
				tmp[1]='W';
			else
				tmp[1]='S';
			if(!dif)
				tmp[n-1]=tmp[1];
			else
				tmp[n-1]=change(tmp[1]);
			for(int j=2;j<n-1;j++){
				if((s[j-1]=='o' and tmp[j-1]=='S') or (s[j-1]=='x' and tmp[j-1]=='W'))	
					tmp[j]=tmp[j-2];
				else
					tmp[j]=change(tmp[j-2]);
			}checker();
		}
	}puts("-1");
	return 0;
}
	


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n;
int a[100],b[100],c[100];
int main() {
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
        scanf("%d",&a[i]);
    for(int i=1;i<=n;i++)
        scanf("%d",&b[i]);
    for(int i=1;i<n;i++)
        scanf("%d",&c[i]);
    int last = -1,res=0;
    for(int i=1;i<=n;i++) {
        res+=b[a[i]];
        if(a[i]-last==1)
            res+=c[a[i]-1];
        last = a[i];
    }
    printf("%d\n",res);
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

int main(void){
  int N;
  scanf("%d", &N);
  char S[10000];
  scanf("%s", S);
  for(int i=0; i<strlen(S); i++){
    int add;
    if (S[i]+N>90)
      add =  N - 26;
    else
      add = N;
    S[i] += add;
  }
  
  printf("%s\n", S);

  return 0;
}
  
  


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

#ifdef DEBUG
    #include "debug.h"
    #define DEB
    #define dump(...)                                                              \
        DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                            \
                << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]"        \
                << endl                                                            \
                << "    ",                                                         \
            dump_func(__VA_ARGS__)
#else
    #define DEB if (false)
    #define dump(...)
#endif


// http://beet-aizu.hatenablog.com/entry/2018/04/08/145516
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);
}

//////////////////

#define int long long
 
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

#define YES puts("YES")
#define Yes puts("Yes")
#define NO  puts("NO")
#define No  puts("No")
#define ALL(v) (v).begin(), (v).end()
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
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; }

/*
#define mod 1000000007 /*/
#define mod 998244353 //*/

typedef pair<int, int> P;
#define INF (1LL<<60)


void solve(){
    char c;
    cin >> c;
    if('A'<= c && c<='Z') cout << "A" << endl;
    else cout << "a" << endl;
}


signed main(){
    cout << fixed << setprecision(18);
    cerr << fixed << setprecision(18);
    solve();
}


Measured memory_bytes: 3592
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mod 1000000007
#define wi while
#define vl vector<ll>
#define vi vector<int>
#define map map<char,ll>
#define endl "\n"
const int mxN = 200001;
int main()
{
    
    int n;
    cin>>n;
    int d[n+1];
    for(int i=1;i<=n;++i)cin>>d[i];
        int sum = 0;
    for(int i=1;i<=n;++i)
    {
        for(int j=i+1;j<=n;j++)
        {
            sum += d[i] * d[j];
        }
    }
    cout<<sum<<endl;
    
    return 0;

}


Measured memory_bytes: 3600
//把质因数写出来后就是很明显的插板法了 
#include <bits/stdc++.h>
#define Maxn 1000000
#define rint register int
using namespace std;
const int Mod = 1e9 + 7;

int read() {
  rint s = 0, f = 1; register char ch = getchar();
  while (!isdigit(ch)) { if (ch == '-') f = -1; ch = getchar(); }
  while (isdigit(ch)) { s = s * 10 + ch - '0'; ch = getchar(); }
  return s * f;
}

namespace Mathscalc {
  inline int add(int a, int b) { return a + b >= Mod ? a + b - Mod : a + b; }
  inline int sub(int a, int b) { return a - b < 0 ? a - b + Mod : a - b; }
  inline int mul(int a, int b) { return 1LL * a * b % Mod; }
  inline int power(int a, int b) { rint res = 1; for (; b; b >>= 1) { if ( b & 1 ) res = mul(res, a); a = mul(a, a); } return res; }
} using namespace Mathscalc;

int n, m;
int c[Maxn], p[Maxn], primenum = 0;
int inv[Maxn], fac[Maxn], invfac[Maxn];

void input() { n = read(), m = read(); }

namespace Solution {
  void divide(int x) {
  	for (rint i = 2; i <= sqrt(x); ++i) {
  		if (x % i == 0) {
  			p[++primenum] = i, c[primenum] = 0;
  			while (x % i == 0) x /= i, ++c[primenum];
			}
		}
		if (x > 1) p[++primenum] = x, c[primenum] = 1;
	}
	
	void get() {
		inv[1] = 1;
		fac[0] = fac[1] = 1;
		invfac[0] = invfac[1] = 1;
		for (rint i = 2; i <= n + 1000; ++i) {
		  inv[i] = mul((Mod - Mod / i), inv[Mod % i]);
			fac[i] = mul(fac[i - 1], i);
			invfac[i] = mul(invfac[i - 1], inv[i]);
		}
	}
	
	inline int C(int n, int m) { return mul(fac[n], mul(invfac[m], invfac[n - m])); }
	
	void solve() {
		divide(m);
		get();
		int ans = 1;
		for (rint i = 1; i <= primenum; ++i) ans = mul(ans, C(n + c[i] - 1, n - 1));
		printf("%d\n", ans);
	}
}

signed main() {
  input();
  Solution :: solve();
  return 0;
}

Measured memory_bytes: 12928
from itertools import permutations

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

INF = float('inf')
graph = [[INF for i in range(N)] for j in range(N)]
for i in range(M):
    A, B, C = map(int, input().split())
    graph[A-1][B-1] = C
    graph[B-1][A-1] = C

for i in range(N):
    graph[i][i] = 0

for k in range(N):
    for i in range(N):
        for j in range(N):
            graph[i][j] = min(graph[i][j], graph[i][k] + graph[k][j])

ans = 10**9
for p in permutations(r, len(r)):
    dist = 0
    flag = 0
    for i in range(len(r) - 1):
        if graph[p[i]-1][p[i+1]-1] == INF:
            flag = 1
            continue
        dist += graph[p[i]-1][p[i+1]-1]
    if flag == 0:
        ans = min(ans, dist)

print(ans)

Measured memory_bytes: 72664
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string s;
	cin>>s;
	if(s=="AAA"||s=="BBB")
	{
		cout<<"No";
		return 0;
	}
	else
	{
		cout<<"Yes";
		return 0;
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll  long long
#define endl '\n'
#define FASTINOUT ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const int N=5e5+9;
int a[N],Block,value,m[N];
bool ok[N];
struct query
{
    int l,r,i;
};
query q[N];
bool f(query a, query b)
{
    if(a.l / Block != b.l / Block)
        return a.l < b.l;
    return a.l / Block % 2 ? a.r < b.r : a.r > b.r;
}
void add(int pos)
{
    int val=a[pos];
    m[val]++;
    if (m[val]==1)
    {
        value++;
    }
    else if (!m[val])
    {
        value--;
    }
}
void remove(int pos)
{
    int val=a[pos];
    m[val]--;
    if (!m[val])
    {
        value--;
    }
}
int main()
{
    FASTINOUT;
    int x,t;
    scanf("%d%d",&x,&t);
    Block=sqrtl(x);
    for (int i=0; i<x; i++)
        scanf("%d",&a[i]);
    for (int j=0; j<t; j++)
    {
        scanf("%d%d",&q[j].l,&q[j].r);
        q[j].l--;
        q[j].r--;
        q[j].i=j;
    }
    sort(q,q+t,f);
    int start=0,end=-1;
    vector<int>ans(t);
    for (int i=0; i<t; i++)
    {
        int L=q[i].l, R=q[i].r;

        while (start > L)
            start--,add(start);

        while (end < R)
            end++, add(end);

        while (start < L)
            remove(start),start++;

        while (end > R)
            remove(end),end--;

        ans[q[i].i]=value;
    }
    for (int j:ans)
        printf("%d\n",j);
    return 0;
}


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

using namespace std;

int main(){
  int W,H,N;
  cin>>W;
  cin>>H;
  cin>>N;
  
  vector<int> row;
  for(int i = 0;i < N;++i){
    int a;
    cin>>a;
    row.push_back(a);
  }

  int o_s = W + H + W - 2;
  int o = W + H + W - 2;
  int i_s = W + H + W - 6;
  int c = 0;
  int ans = 0;

  for(int e : row){
    if(e == 0){
      --o_s;
    }
    else{
      --i_s;
    }

    if(o_s == 0 || i_s == 0){
      break;
    }
    else if(o - (W - 1) < o_s){
      if(o_s == i_s + 4){
        ++ans;
      }
    }
    else if(o - (W - 1) == o_s){
      continue;
    }
    else if(o - (W - 1) > o_s && o_s > o - (W + H - 2)){
      if(o_s == i_s + 2){
        ++ans;
      }
    }
    else if(o_s == o - (W + H - 2)){
      continue;
    }
    else if(o_s < o - (W + H - 2)){
      if(o_s == i_s){
        ++ans;
      }
    }
  }

  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 3160
#include <iostream>
#include<string>
#include<algorithm>
#include<vector>
using namespace std;
  
int main(){
   int N,M;
   cin>>N>>M;
   int b =0;
   if(N%2==0){
       for(int i=0;i<N/2;i++){
          b=b+1;
       }
   }
   else{
       for(int j= 0;j<N+1;j=j+2){
          b++;
       }
   }
   if(b>=M){
       cout<<"YES"<<endl;
   }
   else{
       cout<<"NO"<<endl;
   }
}

Measured memory_bytes: 256
import java.io.*;

public class Main{
	public static void main(String[] args){
		
		try(
		BufferedReader br = new BufferedReader( new InputStreamReader(System.in));
		){
			
			
			int M = Integer.parseInt(br.readLine());
			
			
			if( M != Math.round(M) ||
				M < 1 || M > 23 ){
				new IllegalArgumentException();
			}
			
			System.out.println( (24 - M ) + 24);
		}catch(IOException e){
			e.printStackTrace();
		}
	}
}


Measured memory_bytes: 21076
#pragma warning(disable:4996)

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <float.h>

#pragma region 定義
typedef long long  ll;
typedef unsigned long long  ull;


#define _itoa(A,N) sprintf(A, "%d", N);

int i_dsort(const void* a, const void* b);
int i_asort(const void* a, const void* b);

int  _gcd(int a, int b);
int  _swp(int* a, int* b);
int _cknum(char* a, int n);
int _atoi(char* s, int len);

int s_asort(const void* a, const void* b);
int s_dsort(const void* a, const void* b);

//昇順
int s_asort(const void* a, const void* b) {
	return(strcmp((char*)a, (char*)b));
}
int s_dsort(const void* a, const void* b) {
	return(strcmp((char*)b, (char*)a));
}

int i_dsort(const void* a, const void* b) {
	return(*(int*)b - *(int*)a);
}
int i_asort(const void* a, const void* b) {
	return(*(int*)a - *(int*)b);
}


int i_gcd(int a, int b);
int i_gcd(int a, int b) {
	if (!b)return a;
	return i_gcd(b, a % b);
}
int i_lcm(int a, int b);
int i_lcm(int a, int b) {
	return (a * b) / i_gcd(a, b);
}
int ll_gcd(ll a, ll b);
int ll_gcd(ll a, ll b) {
	if (!b)return a;
	return ll_gcd(b, a % b);
}
int ll_lcm(ll a, ll b);
int ll_lcm(ll a, ll b) {
	return (a * b) / ll_gcd(a, b);
}

// puts("Yes\n") puts("No\n")
// scanf("%d.%d") 浮動小数点入力を整数２つで得る


//#define pai  3.1415926535 
//#define  _USE_MATH_DEFINES でM_PIが使える

#define deg_rad(X)  (X*(M_PI/180))


int _swp(int* a, int* b)
{
	int tmp;
	tmp = *b; *b = *a; *a = tmp;
	return 0;
}
#define _abs(x) ((x)>0?(x):-(x))
#define _min(x,y) ((x)<(y)?(x):(y))
#define _max(x,y) ((x)<(y)?(y):(x))

int _cknum(char* a, int n) {
	int i;
	char t = '0';

	for (i = 0; i < n; i++) {
		if (a[i] < '0' || a[i]>'9') return 1;
	}
	return 0;
}


int _atoi(char* s, int len) {
	char tmp[20];
	memcpy(tmp, s, len);
	tmp[len] = 0x00;
	return (atoi(tmp));
}

//素因数分解　pf素数が入る　pc 素数の数
//ll _pfact(ll a);
//static ll pf[100000000];
//static ll pc;
//
//ll _pfact(ll a) {
//	long i, r;
//	if (a % 2 == 0) {
//		pf[pc] = 2; pc++;
//		return(_pfact(a / 2));
//	}
//	r = sqrt(a);
//	for (i = 3; i <= r; i += 2) {
//		if (a % i == 0) {
//			pf[pc] = i; pc++;
//			return(_pfact(a / i));
//		}
//	}
//	if (a != 1) {
//		pf[pc] = a; pc++;
//	}
//	return 0;
//
//}

//同じものの最初の文字をNULLにして降順
int _sort(const void* a, const void* b);
int _sort(const void* a, const void* b) {
	char rc;

	rc = strcmp((char*)b, (char*)a);
	if (rc == 0) {
		*(char*)a = 0x00;
		return(1);
	}
	return(rc);
}
// 立っている ビットの数
int bitcount(unsigned int uc);
int bitcount(unsigned int uc)
{
	int bit;

	for (bit = 0; 0 != uc; uc = (unsigned int)(uc >> 1))
		if (0 != (uc & 1))++bit;

	return bit;
}//bitco

#define _rnd(a,b)    ((a+b-1)/b) //　A/Bの余りを繰り上げる

#pragma endregion

// ABC081 B - Break Number

int main(void) {
	int n,i,res=0;

	scanf("%d", &n);
	int max = 0,cnt,k;

	for (i = n; i > 0; i--) {
		if (i % 2)continue;
		cnt = 0; k = i;
		while (1) {
			if (k % 2) break;
			k /= 2;
			cnt++;
		}
		if (cnt > max) {
			res = i;
			max = cnt;
		}
	}
	if (!res) res = n;
	printf("%d\n", res);
	return 0;
}

Measured memory_bytes: 1692
main = do
    s <- getLine
    let l = read $ take 2 s
    let r = read $ drop 2 s
    putStrLn $ if r > 0 && r <=12 && l > 0 && l <=12
                    then "AMBIGUOUS"
               else if r > 0 && r <=12
                    then "YYMM"
               else if l > 0 && l <=12
                    then "MMYY"
               else "NA"


Measured memory_bytes: 3880
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;

class Program
{
    static void Main()
    {
        //var NN = ReadLine().Split().Select(int.Parse).ToArray();
        var S = (ReadLine()+"B").Select(x=>A(x)).ToArray();
        var a = 0;
        for (int i = 0; i < S.Length; i++)
        {
            var c = 0;
            for (int j = i; j <S.Length; j++)
            {
                
                if (!S[j])
                {
                    if (c > a) a = c;
                    break;
                }
                else c++;
            }
        }
        WriteLine(a);
    }

    static bool A(char c)
    {
        if (c == 'A' || c == 'T' || c == 'C' || c == 'G') return true;
        return false;
    }
}


Measured memory_bytes: 13268
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <numeric>
#include <cmath>

#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
using P = pair<ll, ll>;

template<class T> inline bool chmin(T& a,T b) {if (a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a,T b) {if (a < b) {a = b; return true;} return false;}

const ll MOD = 1000000007;
const int INF = 1<<29;
//const ll INF = (ll)1e18 + 1;

int main(){
  int N; cin >> N;
  set<int> vec;
  rep(i, N){
    int d; cin >> d;
    vec.insert(d);
  }
  cout << vec.size() << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <list>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <algorithm>
#include <cmath>
#include <string>
using namespace std;
typedef long long lli;
typedef vector<lli> vll;
typedef vector<bool> vbl;
typedef vector<vector<lli> > mat;
typedef vector<vector<bool> > matb;
typedef vector<string> vst;
typedef pair<lli,lli> pll;
typedef pair<double,double> pdd;

lli a,b,c;

int main(){
    cin >> a >> b >> c;
    cout << (c >= a && c <= b ? "Yes" : "No") << endl;
    return 0;
}

Measured memory_bytes: 256
N=input()

memo={}
memo[0]=1
memo[1]=2

def func(N):
	if N in memo:
		return memo[N]
	result= ( func(N/2)+func((N-1)/2)+func(N/2-1) )% (10**9+7)
	
	memo[N]=result
	return result

print func(N)


Measured memory_bytes: 2948